Datasets:
Add files using upload-large-folder tool
Browse files- md/train/-1AAgrS5FF/-1AAgrS5FF.md +316 -0
- md/train/3WbWmdTd8fN/3WbWmdTd8fN.md +389 -0
- md/train/5kTlVBkzSRx/5kTlVBkzSRx.md +202 -0
- md/train/7aogOj_VYO0/7aogOj_VYO0.md +475 -0
- md/train/B14TlG-RW/B14TlG-RW.md +314 -0
- md/train/B1edvs05Y7/B1edvs05Y7.md +359 -0
- md/train/B1ffQnRcKX/B1ffQnRcKX.md +555 -0
- md/train/B1kJ6H9ex/B1kJ6H9ex.md +397 -0
- md/train/BJDEbngCZ/BJDEbngCZ.md +0 -0
- md/train/BJg866NFvB/BJg866NFvB.md +0 -0
- md/train/BJrFC6ceg/BJrFC6ceg.md +170 -0
- md/train/BM64dm9HvN/BM64dm9HvN.md +395 -0
- md/train/Bk9zbyZCZ/Bk9zbyZCZ.md +317 -0
- md/train/BkMWx309FX/BkMWx309FX.md +0 -0
- md/train/BkgWHnR5tm/BkgWHnR5tm.md +462 -0
- md/train/ByS1VpgRZ/ByS1VpgRZ.md +280 -0
- md/train/Byg3y3C9Km/Byg3y3C9Km.md +583 -0
- md/train/Dx3x05MlFwj/Dx3x05MlFwj.md +495 -0
- md/train/H1BLjgZCb/H1BLjgZCb.md +330 -0
- md/train/H1e5GJBtDr/H1e5GJBtDr.md +198 -0
- md/train/Hkemdj09YQ/Hkemdj09YQ.md +433 -0
- md/train/HksioDcxl/HksioDcxl.md +254 -0
- md/train/IDFQI9OY6K/IDFQI9OY6K.md +0 -0
- md/train/O0ow9RQW1nP/O0ow9RQW1nP.md +441 -0
- md/train/OKrNPg3xR3T/OKrNPg3xR3T.md +274 -0
- md/train/S1cZsf-RW/S1cZsf-RW.md +310 -0
- md/train/S1jE5L5gl/S1jE5L5gl.md +567 -0
- md/train/S1lIMn05F7/S1lIMn05F7.md +380 -0
- md/train/S1lOTC4tDS/S1lOTC4tDS.md +346 -0
- md/train/S1ldO2EFPr/S1ldO2EFPr.md +0 -0
- md/train/S5S3eTEmouw/S5S3eTEmouw.md +471 -0
- md/train/SQxuiYf2TT/SQxuiYf2TT.md +296 -0
- md/train/Skl4mRNYDr/Skl4mRNYDr.md +449 -0
- md/train/WtmMyno9Tq2/WtmMyno9Tq2.md +253 -0
- md/train/X2K8KVEaAXG/X2K8KVEaAXG.md +219 -0
- md/train/XPZIaotutsD/XPZIaotutsD.md +454 -0
- md/train/ZS394D3djsg/ZS394D3djsg.md +457 -0
- md/train/cKnKJcTPRcV/cKnKJcTPRcV.md +346 -0
- md/train/hb1sDDSLbV/hb1sDDSLbV.md +0 -0
- md/train/i80OPhOCVH2/i80OPhOCVH2.md +366 -0
- md/train/kmG8vRXTFv/kmG8vRXTFv.md +574 -0
- md/train/r1te3Fqel/r1te3Fqel.md +238 -0
- md/train/rJl8viCqKQ/rJl8viCqKQ.md +243 -0
- md/train/rbdKZJxDWWx/rbdKZJxDWWx.md +214 -0
- md/train/ry-TW-WAb/ry-TW-WAb.md +413 -0
- md/train/ry_WPG-A-/ry_WPG-A-.md +384 -0
- md/train/ryxjnREFwH/ryxjnREFwH.md +413 -0
- md/train/ryxyCeHtPB/ryxyCeHtPB.md +308 -0
- md/train/ryzECoAcY7/ryzECoAcY7.md +250 -0
- md/train/wCrH0JBCFNm/wCrH0JBCFNm.md +252 -0
md/train/-1AAgrS5FF/-1AAgrS5FF.md
ADDED
|
@@ -0,0 +1,316 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# ImageBART: Bidirectional Context with Multinomial Diffusion for Autoregressive Image Synthesis
|
| 2 |
+
|
| 3 |
+
Patrick Esser∗ Robin Rombach∗ Andreas Blattmann∗ Björn Ommer Ludwig Maximilian University of Munich & IWR, Heidelberg University, Germany https://compvis.github.io/imagebart/
|
| 4 |
+
|
| 5 |
+
# Abstract
|
| 6 |
+
|
| 7 |
+
Autoregressive models and their sequential factorization of the data likelihood have recently demonstrated great potential for image representation and synthesis. Nevertheless, they incorporate image context in a linear 1D order by attending only to previously synthesized image patches above or to the left. Not only is this unidirectional, sequential bias of attention unnatural for images as it disregards large parts of a scene until synthesis is almost complete. It also processes the entire image on a single scale, thus ignoring more global contextual information up to the gist of the entire scene. As a remedy we incorporate a coarse-to-fine hierarchy of context by combining the autoregressive formulation with a multinomial diffusion process: Whereas a multistage diffusion process successively removes information to coarsen an image, we train a (short) Markov chain to invert this process. In each stage, the resulting autoregressive ImageBART model progressively incorporates context from previous stages in a coarse-to-fine manner. Experiments show greatly improved image modification capabilities over autoregressive models while also providing high-fidelity image generation, both of which are enabled through efficient training in a compressed latent space. Specifically, our approach can take unrestricted, user-provided masks into account to perform local image editing. Thus, in contrast to pure autoregressive models, it can solve free-form image inpainting and, in the case of conditional models, local, text-guided image modification without requiring mask-specific training.
|
| 8 |
+
|
| 9 |
+
# 1 Introduction
|
| 10 |
+
|
| 11 |
+
Spurred by the increasingly popular attention mechanism, a remarkably simple principle has driven progress in deep generative modeling over the past few years: Factorizing the likelihood of the data in an autoregressive (AR) fashion
|
| 12 |
+
|
| 13 |
+
$$
|
| 14 |
+
p ( \boldsymbol x ) = \prod _ { i } p _ { \boldsymbol \theta } ( x _ { i } | \boldsymbol x _ { < i } )
|
| 15 |
+
$$
|
| 16 |
+
|
| 17 |
+
and subsequently learning the conditional transition probabilities with an expressive neural network such as a transformer [75]. The success of this approach is evident in domains as diverse as language modeling [7], music generation [16], neural machine translation [46, 76], and (conditional) image synthesis [54, 8]. However, especially for the latter task of image synthesis, which is also the focus of this work, the high dimensionality and redundancy present in the data challenges the direct applicability of this approach.
|
| 18 |
+
|
| 19 |
+
Missing Bidirectional Context Autoregressive models which represent images as a sequence from the top-left to the bottom-right have demonstrated impressive performance in sampling novel images and completing the lower half of a given image [8, 21]. However, the unidirectional, fixed ordering of sequence elements not only imposes a perceptually unnatural bias to attention in images by only considering context information from left or above. It also limits practical applicability to image modification: Imagine that you only have the lower half of an image and are looking for a completion of the upper half then these models fail at this minor variation of the completion task. The importance of contextual information from both directions [36] has also been recognized in the context of language modeling [14, 45]. However, simply allowing bidirectional context as in [14] does not provide a valid factorization of the density function for a generative model. Furthermore, the sequential sampling strategy introduces a gap between training and inference, as training relies on so-called teacher-forcing [3] (where ground truth is provided for each step) and inference is performed on previously sampled tokens. This exposure bias can introduce significant accumulations of errors during the generation process, affecting sample quality and coherence [57].
|
| 20 |
+
|
| 21 |
+
Global Context & Control via Multinomial Diffusion We propose a coarse-to-fine approach that addresses the unidirectional bias of generative autoregressive models and their exposure bias as well as the lacking global context. We formulate learning the data density as a hierarchical problem. A coarser stage provides compressed contextual side information about the entire image for the autoregressive process on the next finer stage. We utilize a diffusion process to gradually eliminate information and compress the data, yielding a hierarchy of increasingly abstract and compact representations. The first scale of this approach is a discrete representation learning task (cf. [74, 58, 16, 21, 78, 56]). Subsequently, we further compress this learned representation via a fixed, multinomial diffusion process [65, 30]. We then invert this process by training a Markov chain to recover the data from this hierarchy. Each Markovian transition is modeled autoregressively but it simultaneously attends to the preceding state in the hierarchy, which provides crucial global context to each individual autoregressive step. As each of this steps can also be interpreted as learning a denoising cloze task [45], where missing tokens at the next finer stage are “refilled” with a bidirectional encoder and an autoregressive decoder, we dub our approach ImageBART.
|
| 22 |
+
|
| 23 |
+
Contributions of our work Our approach tackles high-fidelity image synthesis with autoregressive models by learning to invert a fixed multinomial diffusion process in a discrete space of compact image representations to successively introduce context. This reduces both the often encountered exposure bias of AR models and also enables locally controlled, user-interactive image editing. Additionally, our model effectively handles a variety of conditional synthesis tasks and our introduced hierarchy corresponds to a successively compressed image representation. We observe that our model sample visually plausible images while still enabling a trade-off between reconstruction capability and compression rate.
|
| 24 |
+
|
| 25 |
+
# 2 Related Work
|
| 26 |
+
|
| 27 |
+
Latent Variable Models Among likelihood-based approaches, latent variable models represent a data distribution with the help of unobserved latent variables. For example, Variational Autoencoders (VAEs) [38, 59] encode data points into a lower dimensional latent variable with a factorized distribution. This makes them easy to sample, interpolate [44, 37] and modify [77]. In a conditional setting [39], latent variables which are independent from the conditioning lead to disentangled representations [31, 69, 48, 60, 5]. A hierarchy of latent variables [66] gives mutli-scale representations of the data. Unfortunately, even the deepest instantiations of these models [47, 71, 10] lack in sample quality compared to other generative models and are oftentimes restricted to highly regular datasets.
|
| 28 |
+
|
| 29 |
+
Autoregressive Models AR models represent a distribution as a product of conditional, learnable factors via the chain rule of probability densities. While this makes them powerful models for density estimation [70, 24], their samples often lack global consistency. Especially on image data modeled with convolutional architectures [73, 62], this has been attributed to a locality bias of convolutional neural networks (CNNs) which biases the model towards strong local correlations between neighboring pixels at the expense of a proper modeling of coherence [40, 22]. This leads to samples resembling texture patterns without discernible global structure. Attempts to fix this properties by including explicit latent variables [27, 9, 22] have not been overly successful, mainly due the expressiveness of AR models, providing little incentive for learning additional latent variables.
|
| 30 |
+
|
| 31 |
+
Generative Models on Improved Representations Another successful line of work first learn an improved image representation and subsequently learn a generative model for this representation [74, 12]. Most works [58, 21, 56] learn a discrete representation which is subsequently modeled autoregressively but approaches using continuous representations in combination with VAEs [12], or normalizing flows [1, 60, 20, 4, 18], exist too. Learning a compact representation enables the use of transformers for autoregressive modeling [8], which avoids the locality bias of CNNs, can be used for the synthesis of complex scenes conditioned on text as in DALL-E [56], and, when combined with adversarial learning [25], enables sampling of coherent high-resolution images [21]. However, AR modeling of a learned representation still limits applications compared to latent variable models. Their samples can still exert artifacts resulting from a sequential modeling of components, and, since these models are always trained by “teacher-forcing”, they are susceptible to an exposure bias [3, 57, 26, 63, 43].
|
| 32 |
+
|
| 33 |
+

|
| 34 |
+
Figure 1: Overview over our approach: We first learn a compressed, discrete image representation $x _ { 1 }$ and subsequently our generative ImageBART model reverts a fixed multinomial diffusion process via a Markov Chain, where the individual transition probabilities are modeled as independent autoregressive encoder-decoder models. This introduces a coarse-to-fine hierarchy such that each individual AR model can attend to global context from its preceding scale in the hierarchy.
|
| 35 |
+
|
| 36 |
+
Diffusion Probabilistic Models Diffusion probabilistic models revert a fixed, diffusion process with a learned Markov Chain [65]. Being directly applied in pixel space, however, downstream analysis reveals that these models tend to optimize subtle details of the modeled data, which have little contribution to the sample quality [29, 15], particularly hindering applications on high-resolution and -complexity datasets. By using a multinomial diffusion process [30] (recently generalized by [2]) on a compressed, discrete representation of images, we circumvent these issues. Diffusion probabilistic models require a very large number of diffusion steps in order to model the reverse process with a model distribution that factorizes over components. Because our approach uses autoregressively factorized models for the reverse process, we can reduce the required number of steps and obtain significant improvements in sampling speed and the ability to model complex datasets.
|
| 37 |
+
|
| 38 |
+
# 3 Method
|
| 39 |
+
|
| 40 |
+
# 3.1 Hierarchical Generative Models
|
| 41 |
+
|
| 42 |
+
To tackle the difficult problem of modeling a highly complex distribution $p ( x )$ of high-dimensional images $x$ , we (i) introduce bidirectional context into an otherwise unidirectional autoregressive factorization of $p ( x )$ as in Eq. (1) and (ii) reduce the difficulty of the learning problem with a hierarchical approach. To do so, we learn a sequence of distributions $( p _ { \theta } ^ { t } ) _ { t = 0 } ^ { T }$ , such that each distribution $p _ { \theta } ^ { t - 1 }$ models a slightly more complex distribution with the help of a slightly simpler distribution $p _ { \theta } ^ { t }$ one level above. This introduces a coarse-to-fine hierarchy of image representations $x _ { 0 : T } : = ( x _ { t } ) _ { t = 0 } ^ { T }$ , such that an $x _ { t - 1 }$ is modeled conditioned on $x _ { t }$ , i.e. $x _ { t - 1 } \sim p _ { \theta } ^ { t - 1 } ( x _ { t - 1 } | x _ { t } )$ and defines a reverse Markov Chain for $x = : x _ { 0 }$ as $\begin{array} { r } { p _ { \theta } ( x _ { 0 } ) = p _ { \theta } ^ { T } ( x _ { T } ) \prod _ { t = 1 } ^ { T } p _ { \theta } ^ { t - 1 } ( x _ { t - 1 } \vert x _ { t } ) } \end{array}$ . Since our goal is to approximate the original distribution $p ( x )$ with $p _ { \theta } ( x _ { 0 } )$ , we introduce a forward Markov Chain, $\begin{array} { r } { q _ { \theta } ( x _ { 1 : T } | x _ { 0 } ) = \prod _ { t = 1 } ^ { T } q _ { \theta } ^ { t } ( x _ { t } | x _ { t - 1 } ) } \end{array}$ , to obtain a tractable upper bound on the Kullback-Leibler (KL) divergence between $p$ and $p _ { \theta }$ , $\mathbb { K L } ( p ( x _ { 0 } ) \Vert p _ { \boldsymbol \theta } ( x _ { 0 } ) ) = : K \bar { \mathcal { L } }$ , using the evidence lower bound (ELBO). With $q _ { \theta } ^ { T } ( x _ { T } | x _ { T - 1 } ) : = p _ { \theta } ^ { T } ( x _ { T } )$ , we obtain
|
| 43 |
+
|
| 44 |
+
$$
|
| 45 |
+
K \mathcal { L } \leq \underbrace { \mathbb { E } _ { x _ { 0 } , x _ { 1 } } \log \frac { p ( x _ { 0 } ) } { p _ { \theta } ^ { 0 } ( x _ { 0 } | x _ { 1 } ) } } _ { = : L _ { 1 } \to \mathrm { d i s c r e t e r e p r . l e a r n i n g } } + \sum _ { t = 2 } ^ { T } \underbrace { \mathbb { E } _ { x _ { 0 } , x _ { t } } \mathbb { K } \mathbb { L } ( q _ { \theta } ^ { t - 1 } ( x _ { t - 1 } | x _ { t } , x _ { 0 } ) | | p _ { \theta } ^ { t - 1 } ( x _ { t - 1 } | x _ { t } ) ) } _ { = : L _ { t } \to \mathrm { d e c o u p l e d ~ w i t h ~ d i f f u s i o n ~ p r o c e s s } }
|
| 46 |
+
$$
|
| 47 |
+
|
| 48 |
+
We use $L _ { 1 }$ to learn a compressed and discrete representation of images, such that subsequent stages of the hierarchy do not need to model redundant information (Sec. 3.2). With $L _ { t } , t > 1$ we learn a model that can rely on global context from a coarser representation $x _ { t }$ to model the representation $x _ { t - 1 }$ (Sec. 3.3). See Fig. 1 for an overview of the proposed model.
|
| 49 |
+
|
| 50 |
+
# 3.2 Learning a compact, discrete representation for images
|
| 51 |
+
|
| 52 |
+
Since the first stage of the hierarchical process is the one that operates directly on the data, we assign it a separate role. To avoid that the optimization of $L _ { t }$ $( t = 1 , \ldots , T )$ in Eq. (2) unnecessarily wastes capacity on redundant details in the input images—which is an often encountered property of pixel-based likelihood models [74, 21, 50]—we take $\begin{array} { r } { L _ { 1 } = \mathbb { E } _ { p ( x _ { 0 } ) q _ { \theta } ^ { 1 } ( x _ { 1 } | x _ { 0 } ) } \log \frac { p ( x _ { 0 } ) } { p _ { \theta } ^ { 0 } ( x _ { 0 } | x _ { 1 } ) } } \end{array}$ to be the reconstruction term for a discrete autoencoder model. This has the advantage that we can directly build on work in neural discrete representation learning, which has impressively demonstrated that discrete representations can be used for high-quality synthesis of diverse images while achieving strong compression. In particular, [49] and [21] have shown that adding an adversarial realism prior to the usual autoencoder objective helps to produce more realistic images at higher compression rates by locally trading reconstruction fidelity for realism.
|
| 53 |
+
|
| 54 |
+
More specifically, we follow [21] to encode images into a low-dimensional representation which is then vector-quantized with a learned codebook of size $K$ to obtain $\{ 0 , \dotsc , \dot { K } - 1 \} ^ { h \times w } \ni x _ { 1 } \sim$ $q _ { \theta } ^ { 1 } ( x _ { 1 } | x _ { 0 } )$ deterministically as the index of the closest codebook entry. The encoder is a convolutional neural network (CNN) with four downsampling steps, such that $h = H / 1 6$ and $w = W / 1 6$ for any input image $\boldsymbol { x } _ { 0 } \in \mathbb { R } ^ { H \times W \times 3 }$ . For downstream autoregressive learning, this representation is then unrolled into a discrete sequence of length $N = h \cdot w$ . To recover an image from $x _ { 1 }$ , we utilize a CNN decoder $G$ , such that the reverse model is specified as
|
| 55 |
+
|
| 56 |
+
$$
|
| 57 |
+
- \log p _ { \theta } ^ { 0 } ( x _ { 0 } | x _ { 1 } ) \propto f _ { r e c } ( x _ { 0 } , G _ { \theta } ( x _ { 1 } ) ) + \log D _ { \phi } ( G _ { \theta } ( x _ { 1 } ) ) = : L _ { r e c } ( x _ { 0 } , x _ { 1 } ; \theta ) + L _ { a d v } ( x _ { 1 } ; \theta , \phi )
|
| 58 |
+
$$
|
| 59 |
+
|
| 60 |
+
Here, $f _ { r e c }$ denotes the perceptual similarity metric [23, 32, 19, 80] (known as LPIPS) and $D _ { \phi }$ denotes a patch-based adversarial discriminator [25]. Note that, due to the deterministic training, the likelihood in Eq. (3) is likely to be degenerate. $D _ { \phi }$ is optimized to differentiate original images $x _ { 0 }$ from their reconstruction $G _ { \theta } ( x _ { 1 } )$ using simultaneous gradient ascent, such that the objective for learning the optimal parameters $\{ \theta ^ { * } , \phi ^ { * } \}$ reads:
|
| 61 |
+
|
| 62 |
+
$$
|
| 63 |
+
\{ \theta ^ { * } , \phi ^ { * } \} = \arg \operatorname* { m i n } _ { \theta } \operatorname* { m a x } _ { \phi } \Big ( L _ { r e c } ( x _ { 0 } , x _ { 1 } ; \theta ) - L _ { a d v } ( x _ { 1 } ; \theta , \phi ) + \log D _ { \phi } ( x _ { 0 } ) + L _ { c b } ( \theta ) \Big )
|
| 64 |
+
$$
|
| 65 |
+
|
| 66 |
+
The optimization of $\theta$ via this objective includes the parameters of the encoder and decoder in addition to the parameters of the learned codebook, trained via the codebook loss $L _ { c b }$ as in [74, 21].
|
| 67 |
+
|
| 68 |
+
# 3.3 Parallel learning of hierarchies
|
| 69 |
+
|
| 70 |
+
Under suitable choices for $p _ { \theta } , q _ { \theta }$ , one can directly optimize these chains over $\sum _ { t } L _ { t }$ . However, the objectives $L _ { t }$ of the hierarchy levels are coupled through the forward chain $q _ { \theta }$ , which makes this optimization problem difficult. With expressive reverse models $p _ { \theta } ^ { t - 1 }$ , the latent variables $x _ { t }$ are often ignored by the model [22] and the scale of the different level-objectives can be vastly different, resulting in a lot of gradient noise that hinders the optimization [52]. In the continuous case, reweighting schemes for the objective can be derived [29] based on a connection to score matching models [67]. However, since we are working with a discrete $x _ { 1 }$ , there is no analogue available.
|
| 71 |
+
|
| 72 |
+
While we could follow the approach taken for the first level and sequentially optimize over the objectives $L _ { t }$ , this is a rather slow process since each level $t - 1$ needs to be converged before we can start solving level $t$ . However, this sequential dependence is only introduced through the forward models $q _ { \theta } ^ { t }$ and since $q _ { \theta } ^ { 1 }$ already learns a strong representation, we can choose simpler and fixed, predefined forward processes for $q _ { \theta } ^ { t } , t > 1$ . The goal of these processes, i.e., generating a hierarchy of distributions by reducing information in each transition, can be readily achieved by, e.g., randomly masking [14], removing [45] or replacing [30] a fraction of the components of $x _ { t - 1 }$ .
|
| 73 |
+
|
| 74 |
+
Multinomial diffusion This process of randomly replacing a fraction $\beta _ { t }$ of the components with random entries can be described as a multinomial diffusion process [30], a natural generalization of binomial diffusion [65]. The only parameter $\theta$ of $q _ { \theta } ^ { t }$ is therefore $\beta _ { t }$ , which we consider to be fixed. Using the standard basis $e ( k ) = ( \delta _ { j k } ) _ { j = 1 } ^ { K }$ , the forward process can be written as a product of categorical distributions $\mathcal { C }$ specified in terms of the probabilities over the codebook indices:
|
| 75 |
+
|
| 76 |
+
$$
|
| 77 |
+
q _ { \theta } ^ { t } ( x _ { t } | x _ { t - 1 } ) = \prod _ { i = 1 } ^ { N } { \mathcal { C } } ( x _ { t } ^ { i } | ( 1 - \beta _ { t } ) e ( x _ { t - 1 } ^ { i } ) + \beta _ { t } \mathbb { 1 } / K ) , \quad t > 1
|
| 78 |
+
$$
|
| 79 |
+
|
| 80 |
+
where $\mathbb { 1 } = ( 1 ) _ { j = 1 } ^ { K }$ is the all one vector. It then follows that after $t - 1$ steps, on average, a fraction of $\begin{array} { r } { \bar { \alpha } _ { t } : = \prod _ { l = 2 } ^ { t } ( 1 - \beta _ { t } ) } \end{array}$ entries from $x _ { 1 }$ remain unchanged in $x _ { t }$ , i.e.
|
| 81 |
+
|
| 82 |
+
$$
|
| 83 |
+
q _ { \theta } ^ { t } \big ( x _ { t } | x _ { 1 } \big ) = \prod _ { i = 1 } ^ { N } \mathcal { C } \big ( x _ { t } ^ { i } | \bar { \alpha } _ { t } e \big ( x _ { 1 } ^ { i } \big ) + \big ( 1 - \bar { \alpha } _ { t } \big ) \mathbb { 1 } / K \big ) , \quad t > 1 .
|
| 84 |
+
$$
|
| 85 |
+
|
| 86 |
+
This enables computation of the posterior $\begin{array} { r } { q _ { \theta } ( x _ { t - 1 } \vert x _ { t } , x _ { 1 } ) = \frac { q _ { \theta } ^ { t } ( x _ { t } \vert x _ { t - 1 } ) q _ { \theta } ( x _ { t - 1 } \vert x _ { 1 } ) } { q _ { \theta } ( x _ { t } \vert x _ { 1 } ) } } \end{array}$ for $t > 2$ , and, using the fact that $q _ { \theta } ^ { 1 }$ is deterministic, we can rewrite $L _ { t }$ as
|
| 87 |
+
|
| 88 |
+
$$
|
| 89 |
+
\mathbb { E } _ { p ( x _ { 0 } ) } \mathbb { E } _ { q _ { \theta } ( x _ { t } | x _ { 1 } ) } \mathbb { K L } \big ( q _ { \theta } ^ { t - 1 } ( x _ { t - 1 } | x _ { t } , x _ { 1 } ) \| p _ { \theta } ^ { t - 1 } ( x _ { t - 1 } | x _ { t } ) \big ) , \quad t > 2
|
| 90 |
+
$$
|
| 91 |
+
|
| 92 |
+
such that the KL term can now be computed analytically for $t > 2$ . For $t = 2$ , we use a single sample Monte-Carlo estimate for the maximum likelihood reformulation, i.e.
|
| 93 |
+
|
| 94 |
+
$$
|
| 95 |
+
\begin{array} { r } { \arg \operatorname* { m i n } L _ { 2 } = \arg \operatorname* { m a x } \mathbb { E } _ { p ( x _ { 0 } ) } \mathbb { E } _ { q _ { \theta } ^ { 2 } ( x _ { 2 } | x _ { 1 } ) } \log p _ { \theta } ^ { 1 } ( x _ { 1 } | x _ { 2 } ) . } \end{array}
|
| 96 |
+
$$
|
| 97 |
+
|
| 98 |
+
Finally, we set $p _ { \theta } ^ { T }$ to be a uniform distribution. This completes the definition of the reverse chain $p _ { \theta }$ , which can now be started from a random sample for $x _ { T } \sim p _ { \theta } ^ { T } ( x _ { T } )$ , denoised sequentially through $x _ { t - 1 } \sim p _ { \theta } ^ { t - 1 } ( x _ { t - 1 } | x _ { t } )$ for $t = T , \dots , 2$ , and finally be decoded to a data sample $x _ { 0 } = G ( x _ { 1 } )$ .
|
| 99 |
+
|
| 100 |
+
Reverse diffusion models Under what conditions can we recover the true data distribution? By rewriting $\textstyle \sum _ { t } L _ { t }$ , we can see from
|
| 101 |
+
|
| 102 |
+
$$
|
| 103 |
+
\mathbb { K L } ( p ( x _ { 0 } ) \| p _ { \theta } ( x _ { 0 } ) ) \leq \sum _ { t = 1 } ^ { T } \mathbb { K L } ( q _ { \theta } ( x _ { t - 1 } | x _ { t } ) \| p _ { \theta } ^ { t - 1 } ( x _ { t - 1 } | x _ { t } ) )
|
| 104 |
+
$$
|
| 105 |
+
|
| 106 |
+
that this is possible as long as all reverse models are expressive enough to represent the true reverse processes defined by $q _ { \theta }$ . For the first level, we can ensure this by making $x _ { 1 }$ large enough such that the reconstruction error becomes negligible. For the diffusion process, previous image models [65, 29, 68, 30] relied on the fact that, in the limit $\beta _ { t } \to 0$ , the form of the true reverse process has the same functional form as the forward diffusion process [65, 41]. In particular, this allows modeling of the reverse process with a distribution factorized over the components. However, to make $q _ { \theta } ^ { T - 1 }$ close to a uniform distribution requires a very large $T$ (in the order of 1000 steps) with small $\beta _ { t }$ . Training such a large number of reverse models is only feasible with shared weights for the models, but this requires a delicate reweighting [29] of the objective and currently no suitable reweighting is known for the discrete case considered here.
|
| 107 |
+
|
| 108 |
+
Thus, to be able to recover the true data distribution with a modest number of reverse models that can be trained fully parallel, and without weight-sharing, we model each reverse process autoregressively. We use an encoder-decoder transformer architecture [75], such that the decoder models the reverse process for $x _ { t - 1 }$ autoregressively with the help of global context obtained by cross-attending to the encoder’s representation of $x _ { t }$ as visualized in Fig. 1. Note that the need for autoregressive modeling gets reduced for small $\beta _ { t }$ , which we can adjust for by reducing the number of decoder layers compared to encoder layers. The use of the compression model described in Sec. 3.2, however, allows to utilize full-attention based transformer architectures to implement the autoregressive scales.
|
| 109 |
+
|
| 110 |
+
# 4 Experiments
|
| 111 |
+
|
| 112 |
+
Sec. 4.1 evaluates the quality ImageBART achieves in image synthesis. Since we especially want to increase the controllability of the generative process, we evaluate the performance of ImageBART on class- and text-conditional image generation in Sec. 4.2. The ability of our approach to attend to global context enables a new level of localized control which is not possible with previous, purely autoregressive approaches as demonstrated in Sec. 4.3. Finally, Sec. 4.4 presents ablations on model and architecture choices.
|
| 113 |
+
|
| 114 |
+

|
| 115 |
+
Figure 2: Samples from our models. Top row: FFHQ, LSUN-Cats, Middle row: LSUN-Bedrooms, LSUNChurches, Bottom row: ImageNet.
|
| 116 |
+
|
| 117 |
+
<table><tr><td>Method</td><td>Cats Beds</td><td>Churches</td><td></td><td>FFHQ</td><td></td><td>ImageBART</td><td>DDPM</td><td>SSDE</td></tr><tr><td>VDVAE [10]</td><td>1</td><td>1</td><td>1</td><td>28.5</td><td rowspan="2">Churches</td><td rowspan="2"></td><td rowspan="2"></td><td rowspan="2">健</td></tr><tr><td>DDPM [29]</td><td>19.75</td><td>4.90</td><td>7.89</td><td>1</td></tr><tr><td>StyleGAN2 [34]</td><td>7.25</td><td>2.35</td><td>3.86</td><td>3.8</td><td>Cats</td><td></td><td></td><td></td></tr><tr><td>BigGAN [6]</td><td>1</td><td>1</td><td>1</td><td>12.4</td><td>cIN (c14)</td><td></td><td></td><td></td></tr><tr><td>DCT[50]</td><td>1</td><td>6.40</td><td>7.56</td><td>13.06</td><td>cIN (c323)</td><td></td><td></td><td></td></tr><tr><td>TT[21]</td><td>17.31</td><td>6.35</td><td>7.81</td><td>11.4</td><td>cIN (c963)</td><td></td><td></td><td></td></tr><tr><td>ImageBART</td><td>15.09</td><td>5.51</td><td>7.32</td><td>9.57</td><td></td><td></td><td></td><td></td></tr></table>
|
| 118 |
+
|
| 119 |
+
Table 1: Left: FIDs on the LSUN-{Churches,Beds,Cats} [79] and FFHQ [33] datasets. Right: Corresponding qualitative comparisons. Qualitative comparisons with TT can be found in Fig. 20 and Fig. 21
|
| 120 |
+
|
| 121 |
+
# 4.1 High-Fidelity Image Synthesis with ImageBART
|
| 122 |
+
|
| 123 |
+
In this section we present qualitative and quantitative results on images synthesized by our approach. We train models at resolution $2 5 6 \times 2 5 6$ for unconditional generation on FFHQ [33], LSUN -Cats, -Churches and -Bedrooms [79] and on class-conditional synthesis on ImageNet (cIN) [13].
|
| 124 |
+
|
| 125 |
+
Effective Discrete Representations Learning the full hierarchy as described in Eq. (2) and without unnecessary redundancies in the data requires to first learn a strong compression model via the objective in Eq. (4). [21] demonstrated how to effectively train such a model and we directly utilize the publicly available pretrained models. For training on LSUN, we finetune an ImageNet pretrained model for one epoch on each dataset. As the majority of codebook entries remains unused, we shrink the codebook to those entries which are actually used (evaluated on the validation split of ImageNet) and assign a random entry for eventual outliers. This procedure yields an effective, compact representation on which we subsequently train ImageBART.
|
| 126 |
+
|
| 127 |
+
Training Details As described in Sec. 3.3, we use an encoder-decoder structure to model the reverse Markov Chain $p _ { \theta } ^ { t - 1 } ( x _ { t - 1 } | x _ { t } ) , \ t < T ,$ , where the encoder is a bidirectional transformer model and decoder is implemented as an AR transformer. As the context for the last scale is pure noise, we employ a decoder-only variant to model $p _ { \theta } ^ { T - 1 } ( x _ { T - 1 } | x _ { T } )$ . Furthermore, to account for the different complexities of the datasets, we adjust the number of multinomial diffusion steps for each dataset accordingly. For FFHQ we choose a chain of length $T = 3$ , such that the total model consists of (i) the compression stage and (ii) $n = 2$ transformer models trained in parallel via the objective described in Eq.(7). Similarly, we set $n = 3$ for each of the LSUN models and $n = 5$ for the ImageNet model.
|
| 128 |
+
|
| 129 |
+
<table><tr><td rowspan="2"></td><td colspan="4">rejection rate for cIN sampling</td></tr><tr><td>1.0</td><td>0.5</td><td>0.25</td><td>0.05</td></tr><tr><td>FID</td><td>21.19</td><td>13.12</td><td>9.77</td><td>7.44</td></tr><tr><td>IS</td><td>61.6±0.8</td><td>109.5±2.3</td><td>146.2±3.8</td><td>273.5±4.1</td></tr></table>
|
| 130 |
+
|
| 131 |
+
<table><tr><td colspan="3">Text-conditional image synthesis on CC [64]</td></tr><tr><td>Method</td><td>FID↓ IS↑</td><td>CLIP-score ↑</td></tr><tr><td>TT[21]</td><td>28.86</td><td>13.11±0.43 0.20±0.03</td></tr><tr><td>ImageBART 22.61</td><td>15.27±0.59</td><td>0.23±0.03</td></tr></table>
|
| 132 |
+
|
| 133 |
+
Table 2: Quantitative analysis on conditional models. Left: Results on class conditional Imagenet for different rejection rates, see also Fig, 20 in the supplemental. Right: Results of text-conditional ImageBART and comparison with TT [21] on the CC test set. Corresponding qualitative comparisons can be found in Fig. 21.
|
| 134 |
+
|
| 135 |
+

|
| 136 |
+
Figure 3: Samples from text-conditional ImageBART. Best 2 of 32 with reranking as in [56].
|
| 137 |
+
|
| 138 |
+
Results For each of these settings, Fig. 2 depicts samples of size $2 5 6 \times 2 5 6$ generated with ImageBART and a single pass through the learned Markov Chain, demonstrating that our model is able to produce realistic and coherent samples. This is further confirmed by a quantitative analysis in Tab. 1, where we compare FID scores of competing likelihood-based and score-based methods such as TT [21] and DDPM [29]. Regarding other works on diffusion models such as [29] and [68] operating directly in pixel space, we observe that these approaches perform roughly equivalently well in terms of FID for datasets of low complexity (e.g. LSUN-Bedrooms and-Churches). For more complex datasets (LSUN-Cats, cIN), however, our method outperforms these pixel-based approaches, which can also be seen qualitatively on the right in Tab. 1. See Fig. 20 for a comparison on ImageNet.
|
| 139 |
+
|
| 140 |
+
# 4.2 Conditional Markov Chains for Controlled Image Synthesis
|
| 141 |
+
|
| 142 |
+
Being a sequence-to-sequence model, our approach allows for flexible and arbitrary conditioning by simply preprending tokens, similar to [21, 56]. More specifically, each learned transition $p _ { \theta } ^ { t - 1 } \dot { ( x } _ { t - 1 } \dot { | x _ { t } , c ) }$ , $t > 1$ of the Markov chain is then additionally conditioned on a representation $c$ e.g. a single token in the case of the class-conditional model of Sec. 4.1. Note that the compression model $p _ { \theta } ^ { 0 }$ remains unchanged.
|
| 143 |
+
|
| 144 |
+
Text-to-Image Synthesis Besides class-conditional modeling on ImageNet, we also learn a textconditional model on Conceptual Captions (CC) [64, 51]. We obtain $c$ by using the publicly available tokenizer of the CLIP model [55], yielding a conditioning sequence of length 77. To model the dataset, we choose $T = 5$ and thus train $n = 4$ transformer models independently. For the $p _ { \theta } ^ { 0 }$ , we directly transfer the compression model from Sec. 4.1, trained on the ImageNet dataset.
|
| 145 |
+
|
| 146 |
+
Fig. 3 visualizes synthetic samples obtained with this model for various “image-cloze” tasks. Our resulting model is able to attend to semantic variations in the conditioning sentence (e.g. a change of weather for imagery of mountains) and renders the corresponding images accordingly. In Tab. 2, we evaluate FID [28] and Inception Scores (IS) [61] to measure the quality of synthesized images, as well as cosine similarity between CLIP [55] embeddings of the text prompts and the synthesized images to measure how well the image reflects the text. ImageBART improves all metrics upon [21]. Fig. 21 in the supplement provides corresponding qualitative examples for user-defined text inputs.
|
| 147 |
+
|
| 148 |
+
Resolutions Beyond $\mathbf { 2 5 6 \times 2 5 6 }$ Pixels. Our approach is not restricted to generating images of size $2 5 6 \times 2 5 6$ pixels. Although trained on a fixed resolution, we can apply our models in a patch-wise manner, where we use the sliding attention window of [21] for each scale $t > 0$ . As we now incorporate more and more global context while decoding with the Markov chain (which can be thought of as widening a noisy receptive field), ImageBART is able to render consistent images in the megapixel regime. See for example Fig. 4, where we use our text-conditional model to render an image of size $3 0 0 \times 1 8 0 0$ pixel and interpolate between two different text prompts. More examples, especially also for semantically guided synthesis, can be found in Sec. A.2.
|
| 149 |
+
|
| 150 |
+

|
| 151 |
+
Figure 4: ImageBART is capable of generating high-resolution images. Here, we condition it on text prompts and interpolate between the two descriptions depicted above the image (see also Sec. 4.2).
|
| 152 |
+
|
| 153 |
+
# 4.3 Beyond Conditional Models: Local Editing with Autoregressive Models
|
| 154 |
+
|
| 155 |
+
Recent autoregressive approaches, which use a CNN to learn a discrete representation [74], partially alleviate the issues of pixel-wise autoregressive models by working on larger image patches. However, as we show in Fig. 5, even approaches which use adversarial learning to maximize the amount of context encoded in the discrete representation [21] cannot produce completions of the upper half of an image which are consistent with a given lower half.
|
| 156 |
+
|
| 157 |
+
While our approach also models each transition autoregressively from the top-left to the bottom-right, the ability to attend to global context from the previous scale enables consistent completions of arbitrary order, e.g. right-to-left. To achieve this, we mask the diffusion process as described in Sec. A.3. For a user-specified mask $m$ (e.g. the upper half of an image as in Fig. 5), this results in a forward-backward process pt−θ $p _ { \theta } ^ { t - 1 | t - 1 , m }$ , which, by definition, leaves the unmasked context intact. The reverse process then denoises the unmasked entries to make them consistent with the given context.
|
| 158 |
+
|
| 159 |
+
Fig. 5 (bottom) visualizes this mixing process, where we use a model with $T = 3$ . The first column shows the masked input. To start the process we set all masked entries to random entries. The first two columns then show (decoded) samples from the masked reverse processes $p _ { \theta } ^ { 2 , m }$ and p1,θ $p _ { \theta } ^ { 1 , m }$ , which still display inconsistencies. The remaining columns show the trajectory of the process $p _ { \theta } ^ { 1 | 1 , m }$ , which demonstrates how the model iteratively adjusts its samples according to the given context until it converges to a globally consistent sample. For illustration, we show the analog trajectory obtained with [21], but because it can only attend to unidirectional context, this trajectory is equivalent to a sequence of independent samples and therefore fails to achieve global consistency.
|
| 160 |
+
|
| 161 |
+
The masked process can be used with arbitrary masks, which enables localized image editing with free, hand-drawn masks as shown in Fig. 6. Note that our model does not need to be trained specifically for this task, which also avoids generalization problems associated with training on masks [81]. Combining this property with the conditional models from Sec. 4.2 allows for especially interesting novel applications, where local image regions are modified based on user specified class or text prompts, as shown in Fig. 7.
|
| 162 |
+
|
| 163 |
+

|
| 164 |
+
Figure 5: Without global context, AR models fail at completing upper halfs, contrasting ImageBART.
|
| 165 |
+
|
| 166 |
+

|
| 167 |
+
Figure 6: Local editing application using markov chain of length 16 on FFHQ. By incorporating bidirectional context ImageBART is able to solve this unconditional inpainting task (cf. Sec. 4.3).
|
| 168 |
+
|
| 169 |
+

|
| 170 |
+
Figure 7: Conditionally guided inpainting results obtained from conditional ImageBART trained on the i) ImageNet (top row) and ii) Conceptual Captions (bottom row) datasets.
|
| 171 |
+
|
| 172 |
+
# 4.4 Ablations
|
| 173 |
+
|
| 174 |
+
On the Number of Diffusion Steps In this section we analyze the effect of varying the number of diffusion steps (denoted by $T$ ). To do so, we perform an experiment for unconditional training on the FFHQ dataset, where we train a Taming Transformers (TT) baseline (corresponding to the case $T = 2$ within our framework) with 800M parameters and three variants of ImageBART with $T = 3$ $( 2 \mathrm { x } 4 0 0 \mathrm { M } )$ , $T = 5$ $( 4 \mathrm { x } 2 0 0 \mathrm { M } )$ and $T = 9$ (8x100M), respectively. Note that for a fair comparison, all models use the same first level for compression, and we fix the number of remaining parameters to $8 0 0 \mathbf { M }$ and distribute them equally across all scales. All models were trained with the same computational budget and evaluated at the best validation checkpoint.
|
| 175 |
+
|
| 176 |
+
In Tab. 3, we assess both the pure synthesis and the modification ability of ImageBART by computing FID scores on samples and modified images (in the case of upper half completion as in Fig. 5). For both tasks, we use a single pass through the reverse Markov chain. We observe that the modification performance increases monotonically with the number of scales, which highlights the improved image manipulation abilities of our approach. For unconditional generation, we observe a similar trend, although FID seems to plateau beyond $T = 5$ .
|
| 177 |
+
|
| 178 |
+
Joint vs. Independent Training While it is possible to optimize Eq. (2) jointly across all scales, we found that training is more robust when training all scales independently. Besides the usual separation of training the compression model $p _ { \theta } ^ { 0 }$ and the generative model $p _ { \theta } ^ { t \geq 1 }$ , training the latter in parallel over multiple scales avoids the tedious weighting of the loss contribution from different scales; an often encountered problem in other denoising diffusion probabilistic models [29].
|
| 179 |
+
|
| 180 |
+
Efficiency with Less Decoder Layers As we implement the conditional transition probabilities $p _ { \theta } ^ { t - 1 }$ with an encoder-decoder transformer architecture, we are interested in the effect of altering the ratio of encoder and decoder layers in the model. Recent work has provided evidence that it is possible to significantly reduce the number of decoder layers and thus also decrease autoregressive decoding speed while maintaining high quality [35]. We perform an experiment on LSUN-Churches, where we analyze the effect of different layer-ratios on synthesis quality (measured by FID) and on decoding speed when fixing the total number of model parameters to 200M. The results in the left part of Fig. 8 confirms that it is indeed possible to reduce the number of decoder layers while maintaining satisfactory FID scores with higher decoding efficiency. We identity a favorable trade-off between four and six decoder layers and transfer this setting to our other experiments.
|
| 181 |
+
|
| 182 |
+
<table><tr><td colspan="3">Unconditional Generation</td><td colspan="3">Upper Half Completion</td></tr><tr><td>method</td><td>FID↓</td><td>IS个</td><td>method</td><td>FID↓</td><td>IS↑</td></tr><tr><td>TT(T= 2)</td><td>12.44</td><td>4.42 ± 0.05</td><td>TT(T= 2)</td><td>11.80</td><td>4.48 ± 0.10</td></tr><tr><td>ImageBART (T = 3)</td><td>12.55</td><td>3.98± 0.07</td><td>ImageBART(T= 3)</td><td>9.25</td><td>4.49 ± 0.13</td></tr><tr><td>ImageBART(T=5)</td><td>10.69</td><td>4.27 ± 0.05</td><td>ImageBART(T= 5)</td><td>6.87</td><td>4.81 ± 0.13</td></tr><tr><td>ImageBART (T = 9)</td><td>10.81</td><td>4.49 ± 0.05</td><td>ImageBART (T = 9)</td><td>6.64</td><td>4.86 ± 0.15</td></tr></table>
|
| 183 |
+
|
| 184 |
+
Table 3: Assessing the effect of different $\overline { { T } }$ with a fixed number of parameters distributed equally over all scales. All models are trained on FFHQ. Left: Full image generation results. Right: Using the example of upper image completion, we evaluate the ability to complete and modifiy an image, see Sec. 4.3 and 4.4.
|
| 185 |
+
|
| 186 |
+

|
| 187 |
+
Figure 8: Left: Effect of number of encoder vs. decoder layers for a fixed total number of model parameters $( ( 1 9 5 \pm 5 ) M )$ , evaluated on LSUN-Churches. FIDs are evaluated w.r.t $3 \times 2 5 0 0 \mathrm { k }$ samples. The plot shows 3 standard deviations. All models are trained jointly over three scales. Right: Our model achieves better sampling performance than state of the art diffusion models (SSDE [68], DDPM [29], ADM [15]) and also approaches the inference speed of TT [21], which only consists of a single autoregressive stage. Reducing the number of scales increases inference speed at the expense of controllability. Experiments were conducted on a single NVIDIA A100 and are reported averaged over 1000 samples with a batch size of 50, evaluated on FFHQ while using the same number of trainable parameters $( 8 0 0 \mathrm { m } )$ for all AR models.
|
| 188 |
+
|
| 189 |
+
Finally, we compare our model in terms of sampling speed with the recent state-of-the-art generative diffusion [29, 68] and AR models [21]. The results are summarized in Fig. 8. While consistently being faster than all pixel-based models due to training in a compressed latent space, the increase in runtime w.r.t. [21] is moderate due to the use of encoder-decoder transformers, i.e., a a decrease in pure decoder layers. If a faster runtime is desired, the speed can be further increased by reducing the number of decoder layers even more, see also the discussion in Sec. A.5.
|
| 190 |
+
|
| 191 |
+
# 5 Conclusion
|
| 192 |
+
|
| 193 |
+
We have proposed ImageBART, a hierarchical approach to introduce bidirectional context into autoregressive transformer models for high-fidelity controllable image synthesis. We invert a multinomial diffusion process by training a Markov chain to gradually incorporate context in a coarse-to-fine manner. Our study shows that this approach (i) introduces a natural hierarchical representation of images, with consecutive levels carrying more information than previous ones. (see also Fig. 9). (ii) It alleviates the unnatural unidirectional ordering of pure autoregressive models for image representation through global context from previous levels of the hierarchy. (iii) It enables global and local manipulation of a given input, a feat previously out-of-reach for ARMs. (iv) We additionally show that our model can be efficiently conditioned on various representations, allowing for a large class of conditional image synthesis tasks such as semantically guided generation or text-to-image synthesis.
|
| 194 |
+
|
| 195 |
+
# Acknowledgments
|
| 196 |
+
|
| 197 |
+
Many thanks to Phil Wang for providing https://github.com/lucidrains/x-transformers and all the other great PyTorch implementations.
|
| 198 |
+
|
| 199 |
+
# Funding and Transparency Statement
|
| 200 |
+
|
| 201 |
+
Funding in direct support of this work: German Research Foundation (DFG) projects 371923335 and 421703927, German Federal Ministry for Economic Affairs and Energy within the project ’KI-Absicherung - Safe AI for automated driving’.
|
| 202 |
+
|
| 203 |
+
# Checklist
|
| 204 |
+
|
| 205 |
+
1. For all authors...
|
| 206 |
+
|
| 207 |
+
(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
|
| 208 |
+
(b) Did you describe the limitations of your work? [Yes] See supplementary.
|
| 209 |
+
(c) Did you discuss any potential negative societal impacts of your work? [Yes] See supplementary.
|
| 210 |
+
(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
|
| 211 |
+
|
| 212 |
+
2. If you are including theoretical results...
|
| 213 |
+
|
| 214 |
+
(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]
|
| 215 |
+
|
| 216 |
+
3. If you ran experiments...
|
| 217 |
+
|
| 218 |
+
(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)? [No] Including the code while maintaining anonymity is difficult; it will be published after deanonymization.
|
| 219 |
+
(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] We include most relevant details in the supplementary and the full code release will contain the precise values.
|
| 220 |
+
(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes] Yes, wherever this does not introduce irresponsible waste of computational resources.
|
| 221 |
+
(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] The supplementary contains an overview of used hardware.
|
| 222 |
+
|
| 223 |
+
4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
|
| 224 |
+
|
| 225 |
+
(a) If your work uses existing assets, did you cite the creators? [Yes]
|
| 226 |
+
(b) Did you mention the license of the assets? [No] Licenses will be included along with the code release.
|
| 227 |
+
(c) Did you include any new assets either in the supplemental material or as a URL? [No]
|
| 228 |
+
(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A]
|
| 229 |
+
(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [Yes] See supplementary.
|
| 230 |
+
|
| 231 |
+
5. If you used crowdsourcing or conducted research with human subjects...
|
| 232 |
+
|
| 233 |
+
(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
|
| 234 |
+
(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
|
| 235 |
+
(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
|
| 236 |
+
|
| 237 |
+
# References
|
| 238 |
+
|
| 239 |
+
[1] R. Abdal, P. Zhu, N. J. Mitra, and P. Wonka. Styleflow: Attribute-conditioned exploration of stylegangenerated images using conditional continuous normalizing flows. ACM Trans. Graph., 40(3), May 2021. ISSN 0730-0301. doi: 10.1145/3447648. URL https://doi.org/10.1145/3447648.
|
| 240 |
+
[2] J. Austin, D. Johnson, J. Ho, D. Tarlow, and R. v. d. Berg. Structured denoising diffusion models in discrete state-spaces. arXiv preprint arXiv:2107.03006, 2021.
|
| 241 |
+
[3] S. Bengio, O. Vinyals, N. Jaitly, and N. Shazeer. Scheduled sampling for sequence prediction with recurrent neural networks. CoRR, abs/1506.03099, 2015. [4] A. Blattmann, T. Milbich, M. Dorkenwald, and B. Ommer. Behavior-driven synthesis of human dynamics. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pages 12236–12246, June 2021.
|
| 242 |
+
[5] A. Blattmann, T. Milbich, M. Dorkenwald, and B. Ommer. ipoke: Poking a still image for controlled stochastic video synthesis. In Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV), pages 14707–14717, October 2021.
|
| 243 |
+
[6] A. Brock, J. Donahue, and K. Simonyan. Large scale GAN training for high fidelity natural image synthesis. In Int. Conf. Learn. Represent., 2019.
|
| 244 |
+
[7] T. B. Brown, B. Mann, N. Ryder, M. Subbiah, J. Kaplan, P. Dhariwal, A. Neelakantan, P. Shyam, G. Sastry, A. Askell, S. Agarwal, A. Herbert-Voss, G. Krueger, T. Henighan, R. Child, A. Ramesh, D. M. Ziegler, J. Wu, C. Winter, C. Hesse, M. Chen, E. Sigler, M. Litwin, S. Gray, B. Chess, J. Clark, C. Berner, S. McCandlish, A. Radford, I. Sutskever, and D. Amodei. Language models are few-shot learners. In NeurIPS, 2020. [8] M. Chen, A. Radford, R. Child, J. Wu, H. Jun, D. Luan, and I. Sutskever. Generative pretraining from pixels. In ICML, volume 119 of Proceedings of Machine Learning Research, pages 1691–1703. PMLR, 2020. [9] X. Chen, D. P. Kingma, T. Salimans, Y. Duan, P. Dhariwal, J. Schulman, I. Sutskever, and P. Abbeel. Variational lossy autoencoder. CoRR, abs/1611.02731, 2016.
|
| 245 |
+
[10] R. Child. Very deep vaes generalize autoregressive models and can outperform them on images. CoRR, abs/2011.10650, 2020.
|
| 246 |
+
[11] K. Crawford and T. Paglen. Excavating ai: The politics of training sets for machine learning, 2019. URL https://excavating.ai.
|
| 247 |
+
[12] B. Dai and D. P. Wipf. Diagnosing and enhancing VAE models. In ICLR (Poster). OpenReview.net, 2019.
|
| 248 |
+
[13] J. Deng, W. Dong, R. Socher, L. Li, K. Li, and F. Li. Imagenet: A large-scale hierarchical image database. In CVPR, pages 248–255. IEEE Computer Society, 2009.
|
| 249 |
+
[14] J. Devlin, M. Chang, K. Lee, and K. Toutanova. BERT: pre-training of deep bidirectional transformers for language understanding. CoRR, abs/1810.04805, 2018.
|
| 250 |
+
[15] P. Dhariwal and A. Nichol. Diffusion models beat gans on image synthesis. CoRR, abs/2105.05233, 2021. URL https://arxiv.org/abs/2105.05233.
|
| 251 |
+
[16] P. Dhariwal, H. Jun, C. Payne, J. W. Kim, A. Radford, and I. Sutskever. Jukebox: A generative model for music. CoRR, abs/2005.00341, 2020.
|
| 252 |
+
[17] S. Dieleman. Musings on typicality, 2020. URL https://benanne.github.io/2020/09/01/ typicality.html.
|
| 253 |
+
[18] M. Dorkenwald, T. Milbich, A. Blattmann, R. Rombach, K. G. Derpanis, and B. Ommer. Stochastic image-to-video synthesis using cinns. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pages 3742–3753, June 2021.
|
| 254 |
+
[19] A. Dosovitskiy and T. Brox. Generating images with perceptual similarity metrics based on deep networks. In NIPS, pages 658–666, 2016.
|
| 255 |
+
[20] P. Esser, R. Rombach, and B. Ommer. A disentangling invertible interpretation network for explaining latent representations. CoRR, abs/2004.13166, 2020.
|
| 256 |
+
[21] P. Esser, R. Rombach, and B. Ommer. Taming transformers for high-resolution image synthesis. CoRR, abs/2012.09841, 2020.
|
| 257 |
+
[22] J. D. Fauw, S. Dieleman, and K. Simonyan. Hierarchical autoregressive image models with auxiliary decoders. CoRR, abs/1903.04933, 2019.
|
| 258 |
+
[23] L. A. Gatys, A. S. Ecker, and M. Bethge. Image style transfer using convolutional neural networks. In CVPR, pages 2414–2423. IEEE Computer Society, 2016.
|
| 259 |
+
[24] M. Germain, K. Gregor, I. Murray, and H. Larochelle. MADE: masked autoencoder for distribution estimation. CoRR, abs/1502.03509, 2015.
|
| 260 |
+
[25] I. J. Goodfellow, J. Pouget-Abadie, M. Mirza, B. Xu, D. Warde-Farley, S. Ozair, A. C. Courville, and Y. Bengio. Generative adversarial networks. CoRR, 2014.
|
| 261 |
+
[26] A. Goyal, A. Lamb, Y. Zhang, S. Zhang, A. C. Courville, and Y. Bengio. Professor forcing: A new algorithm for training recurrent networks. In NIPS, pages 4601–4609, 2016.
|
| 262 |
+
[27] I. Gulrajani, K. Kumar, F. Ahmed, A. A. Taïga, F. Visin, D. Vázquez, and A. C. Courville. Pixelvae: A latent variable model for natural images. CoRR, abs/1611.05013, 2016.
|
| 263 |
+
[28] M. Heusel, H. Ramsauer, T. Unterthiner, B. Nessler, and S. Hochreiter. Gans trained by a two time-scale update rule converge to a local nash equilibrium. In Adv. Neural Inform. Process. Syst., pages 6626–6637, 2017.
|
| 264 |
+
[29] J. Ho, A. Jain, and P. Abbeel. Denoising diffusion probabilistic models. In NeurIPS, 2020.
|
| 265 |
+
[30] E. Hoogeboom, D. Nielsen, P. Jaini, P. Forré, and M. Welling. Argmax flows and multinomial diffusion: Towards non-autoregressive language models. CoRR, abs/2102.05379, 2021.
|
| 266 |
+
[31] A. H. Jha, S. Anand, M. Singh, and V. S. R. Veeravasarapu. Disentangling factors of variation with cycle-consistent variational auto-encoders. In ECCV (3), volume 11207 of Lecture Notes in Computer Science, pages 829–845. Springer, 2018.
|
| 267 |
+
[32] J. Johnson, A. Alahi, and L. Fei-Fei. Perceptual losses for real-time style transfer and super-resolution. In ECCV (2), volume 9906 of Lecture Notes in Computer Science, pages 694–711. Springer, 2016.
|
| 268 |
+
[33] T. Karras, S. Laine, and T. Aila. A style-based generator architecture for generative adversarial networks. In 2019 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2019.
|
| 269 |
+
[34] T. Karras, S. Laine, M. Aittala, J. Hellsten, J. Lehtinen, and T. Aila. Analyzing and improving the image quality of stylegan. CoRR, abs/1912.04958, 2019.
|
| 270 |
+
[35] J. Kasai, N. Pappas, H. Peng, J. Cross, and N. A. Smith. Deep encoder, shallow decoder: Reevaluating non-autoregressive machine translation, 2021.
|
| 271 |
+
[36] S. Khan, M. Naseer, M. Hayat, S. W. Zamir, F. S. Khan, and M. Shah. Transformers in vision: A survey. CoRR, abs/2101.01169, 2021.
|
| 272 |
+
[37] Y. Kilcher, A. Lucchi, and T. Hofmann. Semantic interpolation in implicit models. CoRR, abs/1710.11381, 2017.
|
| 273 |
+
[38] D. P. Kingma and M. Welling. Auto-Encoding Variational Bayes. In 2nd International Conference on Learning Representations, ICLR, 2014.
|
| 274 |
+
[39] D. P. Kingma, D. J. Rezende, S. Mohamed, and M. Welling. Semi-supervised learning with deep generative models. CoRR, abs/1406.5298, 2014.
|
| 275 |
+
[40] A. Kolesnikov and C. H. Lampert. Pixelcnn models with auxiliary variables for natural image modeling. In ICML, volume 70 of Proceedings of Machine Learning Research, pages 1905–1914. PMLR, 2017.
|
| 276 |
+
[41] A. Kolmogoroff. Über die analytischen methoden in der wahrscheinlichkeitsrechnung. Mathematische Annalen, 104:415–458, 1931. URL http://eudml.org/doc/159476.
|
| 277 |
+
[42] A. Krizhevsky. Learning multiple layers of features from tiny images. 2009.
|
| 278 |
+
[43] R. Leblond, J. Alayrac, A. Osokin, and S. Lacoste-Julien. SEARNN: training rnns with global-local losses. CoRR, abs/1706.04499, 2017.
|
| 279 |
+
[44] D. Lesniak, I. Sieradzki, and I. T. Podolak. Distribution-interpolation trade off in generative models. In ICLR (Poster). OpenReview.net, 2019.
|
| 280 |
+
[45] M. Lewis, Y. Liu, N. Goyal, M. Ghazvininejad, A. Mohamed, O. Levy, V. Stoyanov, and L. Zettlemoyer. BART: denoising sequence-to-sequence pre-training for natural language generation, translation, and comprehension. In ACL, pages 7871–7880. Association for Computational Linguistics, 2020.
|
| 281 |
+
[46] N. Li, S. Liu, Y. Liu, S. Zhao, and M. Liu. Neural speech synthesis with transformer network. In AAAI, pages 6706–6713. AAAI Press, 2019.
|
| 282 |
+
[47] L. Maaløe, M. Fraccaro, V. Liévin, and O. Winther. BIVA: A very deep hierarchy of latent variables for generative modeling. In NeurIPS, pages 6548–6558, 2019.
|
| 283 |
+
[48] M. Mathieu, J. J. Zhao, P. Sprechmann, A. Ramesh, and Y. LeCun. Disentangling factors of variation in deep representations using adversarial training. CoRR, abs/1611.03383, 2016.
|
| 284 |
+
[49] F. Mentzer, G. Toderici, M. Tschannen, and E. Agustsson. High-fidelity generative image compression. In NeurIPS, 2020.
|
| 285 |
+
[50] C. Nash, J. Menick, S. Dieleman, and P. W. Battaglia. Generating images with sparse representations. CoRR, abs/2103.03841, 2021.
|
| 286 |
+
[51] E. G. Ng, B. Pang, P. Sharma, and R. Soricut. Understanding guided image captioning performance across domains. arXiv preprint arXiv:2012.02339, 2020.
|
| 287 |
+
[52] A. Nichol and P. Dhariwal. Improved denoising diffusion probabilistic models. CoRR, abs/2102.09672, 2021.
|
| 288 |
+
[53] T. Park, M.-Y. Liu, T.-C. Wang, and J.-Y. Zhu. Semantic image synthesis with spatially-adaptive normalization. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, 2019.
|
| 289 |
+
[54] N. Parmar, A. Vaswani, J. Uszkoreit, L. Kaiser, N. Shazeer, A. Ku, and D. Tran. Image transformer. In ICML, volume 80 of Proceedings of Machine Learning Research, pages 4052–4061. PMLR, 2018.
|
| 290 |
+
[55] A. Radford, J. W. Kim, C. Hallacy, A. Ramesh, G. Goh, S. Agarwal, G. Sastry, A. Askell, P. Mishkin, J. Clark, G. Krueger, and I. Sutskever. Learning transferable visual models from natural language supervision. CoRR, abs/2103.00020, 2021.
|
| 291 |
+
[56] A. Ramesh, M. Pavlov, G. Goh, S. Gray, C. Voss, A. Radford, M. Chen, and I. Sutskever. Zero-shot text-to-image generation. CoRR, abs/2102.12092, 2021.
|
| 292 |
+
[57] M. Ranzato, S. Chopra, M. Auli, and W. Zaremba. Sequence level training with recurrent neural networks. In ICLR (Poster), 2016.
|
| 293 |
+
[58] A. Razavi, A. van den Oord, and O. Vinyals. Generating diverse high-fidelity images with VQ-VAE-2. In NeurIPS, pages 14837–14847, 2019.
|
| 294 |
+
[59] D. J. Rezende, S. Mohamed, and D. Wierstra. Stochastic backpropagation and approximate inference in deep generative models. In Proceedings of the 31st International Conference on International Conference on Machine Learning, ICML, 2014.
|
| 295 |
+
[60] R. Rombach, P. Esser, and B. Ommer. Network-to-network translation with conditional invertible neural networks. In NeurIPS, 2020.
|
| 296 |
+
[61] T. Salimans, I. Goodfellow, W. Zaremba, V. Cheung, A. Radford, and X. Chen. Improved techniques for training gans. In NIPS, 2016.
|
| 297 |
+
[62] T. Salimans, A. Karpathy, X. Chen, and D. P. Kingma. Pixelcnn $^ { + + }$ : Improving the pixelcnn with discretized logistic mixture likelihood and other modifications. CoRR, abs/1701.05517, 2017.
|
| 298 |
+
[63] F. Schmidt. Generalization in generation: A closer look at exposure bias. In NGT@EMNLP-IJCNLP, pages 157–167. Association for Computational Linguistics, 2019.
|
| 299 |
+
[64] P. Sharma, N. Ding, S. Goodman, and R. Soricut. Conceptual captions: A cleaned, hypernymed, image alt-text dataset for automatic image captioning. In Proceedings of ACL, 2018.
|
| 300 |
+
[65] J. Sohl-Dickstein, E. A. Weiss, N. Maheswaranathan, and S. Ganguli. Deep unsupervised learning using nonequilibrium thermodynamics. CoRR, abs/1503.03585, 2015.
|
| 301 |
+
[66] C. K. Sønderby, T. Raiko, L. Maaløe, S. K. Sønderby, and O. Winther. Ladder variational autoencoders. In NIPS, pages 3738–3746, 2016.
|
| 302 |
+
[67] Y. Song and S. Ermon. Generative modeling by estimating gradients of the data distribution. In NeurIPS, pages 11895–11907, 2019.
|
| 303 |
+
[68] Y. Song, J. Sohl-Dickstein, D. P. Kingma, A. Kumar, S. Ermon, and B. Poole. Score-based generative modeling through stochastic differential equations. CoRR, abs/2011.13456, 2020.
|
| 304 |
+
[69] A. Szabó, Q. Hu, T. Portenier, M. Zwicker, and P. Favaro. Challenges in disentangling independent factors of variation. In ICLR (Workshop). OpenReview.net, 2018.
|
| 305 |
+
[70] B. Uria, M. Côté, K. Gregor, I. Murray, and H. Larochelle. Neural autoregressive distribution estimation. CoRR, abs/1605.02226, 2016.
|
| 306 |
+
[71] A. Vahdat and J. Kautz. NVAE: A deep hierarchical variational autoencoder. In NeurIPS, 2020.
|
| 307 |
+
[72] A. van den Oord, N. Kalchbrenner, L. Espeholt, k. kavukcuoglu, O. Vinyals, and A. Graves. Conditional image generation with pixelcnn decoders. In Advances in Neural Information Processing Systems, 2016.
|
| 308 |
+
[73] A. van den Oord, N. Kalchbrenner, O. Vinyals, L. Espeholt, A. Graves, and K. Kavukcuoglu. Conditional image generation with pixelcnn decoders. CoRR, abs/1606.05328, 2016.
|
| 309 |
+
[74] A. van den Oord, O. Vinyals, and K. Kavukcuoglu. Neural discrete representation learning. In NIPS, pages 6306–6315, 2017.
|
| 310 |
+
[75] A. Vaswani, N. Shazeer, N. Parmar, J. Uszkoreit, L. Jones, A. N. Gomez, L. Kaiser, and I. Polosukhin. Attention is all you need. In NIPS, pages 5998–6008, 2017.
|
| 311 |
+
[76] C. Wang, Y. Tang, X. Ma, A. Wu, D. Okhonko, and J. Pino. fairseq s2t: Fast speech-to-text modeling with fairseq, 2020.
|
| 312 |
+
[77] T. White. Sampling generative networks: Notes on a few effective techniques. CoRR, abs/1609.04468, 2016.
|
| 313 |
+
[78] W. Yan, Y. Zhang, P. Abbeel, and A. Srinivas. Videogpt: Video generation using VQ-VAE and transformers. CoRR, abs/2104.10157, 2021.
|
| 314 |
+
[79] F. Yu, Y. Zhang, S. Song, A. Seff, and J. Xiao. LSUN: construction of a large-scale image dataset using deep learning with humans in the loop. CoRR, abs/1506.03365, 2015.
|
| 315 |
+
[80] R. Zhang, P. Isola, A. A. Efros, E. Shechtman, and O. Wang. The unreasonable effectiveness of deep features as a perceptual metric. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), June 2018.
|
| 316 |
+
[81] C. Zheng, T. Cham, and J. Cai. Tfill: Image completion via a transformer-based architecture. CoRR, abs/2104.00845, 2021.
|
md/train/3WbWmdTd8fN/3WbWmdTd8fN.md
ADDED
|
@@ -0,0 +1,389 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Learning Division with Neural Arithmetic Logic Modules
|
| 2 |
+
|
| 3 |
+
Anonymous Author(s)
|
| 4 |
+
Affiliation
|
| 5 |
+
Address
|
| 6 |
+
email
|
| 7 |
+
|
| 8 |
+
# Abstract
|
| 9 |
+
|
| 10 |
+
1 To achieve systematic generalisation, it first makes sense to master simple tasks
|
| 11 |
+
2 such as arithmetic. Of the four fundamental arithmetic operations $( + , - , \times , \div )$ ,
|
| 12 |
+
3 division is considered the most difficult for both humans and computers. In this
|
| 13 |
+
4 paper we show that robustly learning division in a systematic manner remains a
|
| 14 |
+
5 challenge even at the simplest level of dividing two numbers. We propose two
|
| 15 |
+
6 novel approaches for division which we call the Neural Reciprocal Unit (NRU) and
|
| 16 |
+
7 the Neural Multiplicative Reciprocal Unit (NMRU), and present improvements for
|
| 17 |
+
8 an existing division module, the Real Neural Power Unit (Real NPU). Experiments
|
| 18 |
+
9 in learning division with input redundancy on 225 different training sets, find that
|
| 19 |
+
10 our proposed modifications to the Real NPU obtains an average success of $8 5 . 3 \%$
|
| 20 |
+
11 improving over the original by $1 5 . 1 \%$ . In light of the suggestion above, our NMRU
|
| 21 |
+
12 approach can further improve the success to $9 1 . 6 \%$ .
|
| 22 |
+
|
| 23 |
+
# 13 1 Introduction
|
| 24 |
+
|
| 25 |
+
14 Imagine you must learn to divide 2 numbers, but are only given 10 numbers and the target value. This
|
| 26 |
+
15 task requires finding the 2 relevant operands, the order to divide the operands, and learning to divide.
|
| 27 |
+
16 In machine learning, this is equivalent to a supervised regression task where the aim is to learn the
|
| 28 |
+
17 underlying function between the inputs and output such that the solution is generalisable to any input.
|
| 29 |
+
18 The ability to select relevant features is a desirable property of neural networks, useful for improved
|
| 30 |
+
19 intepretability, reduced pre-processing costs and greater generalisation [Chandrashekar and Sahin,
|
| 31 |
+
20 2014]. The ability to model division, one of the four fundamental arithmetic operations, is necessary
|
| 32 |
+
21 for expressing dynamical systems [Sahoo et al., 2018], and physics-based formulas [Udrescu and
|
| 33 |
+
22 Tegmark, 2020]. However, even recent models still struggle to learn division when there is input
|
| 34 |
+
23 redundancy [Schlör et al., 2020].
|
| 35 |
+
24 The main challenge of the above task comes from learning the selection and operation at the same
|
| 36 |
+
25 time, which can lead to conflicting priorities when learning network weights. Furthermore, the natural
|
| 37 |
+
26 properties of division of values around zero leads to undesirable gradients. Models which deal with
|
| 38 |
+
27 this naively (e.g. MLPs) are unable to deal with the fluctuant gradients caused by the asymptotic
|
| 39 |
+
28 nature and discontinuities in division [Trask et al., 2018].
|
| 40 |
+
|
| 41 |
+
9 Can we build models which can learn division in the presence of its undesirable, yet valid, properties? We aim to address this question in this paper. Specifically, we contribute the following:0
|
| 42 |
+
|
| 43 |
+
• Improvements to the Real NPU [Heim et al., 2020] including: clipping, discretisation and constrained initialisation to improve performance in learning division on different training ranges.
|
| 44 |
+
|
| 45 |
+
33 • Two novel division modules, the NRU and the NMRU. The NRU explores extending the NMU
|
| 46 |
+
34 weight ranges from [0,1] to [-1,1] to include division, where we find a weakness in learning from
|
| 47 |
+
35 negative ranges. Learning from the weaknesses of the NRU, the NMRU extends the NMU to learn
|
| 48 |
+
36 division while keeping weights values between [0,1]. We further boost performance by using a
|
| 49 |
+
37 Real NPU inspired sign retrieval mechanism, enabling the NMRU to gain the best performance
|
| 50 |
+
38 when using a mean squared error (MSE) loss.
|
| 51 |
+
39 • New understanding into the hindrances in learning division including: training on mixed-sign
|
| 52 |
+
40 inputs, training on negative ranges, and division on extremely small values. We find these difficulties
|
| 53 |
+
41 can be sufficiently identified using synthetic division tasks.
|
| 54 |
+
42 The broader impact of our work relates to interpretable Artificial Intelligence where our modules
|
| 55 |
+
43 can be included in larger networks for applications such as image classification or analogy creation,
|
| 56 |
+
44 whilst retaining the ability to produce transparent generalisable solutions. However, there are possible
|
| 57 |
+
45 negative societal impacts. Such modules can be viewed as specialised feature selectors/aggregators
|
| 58 |
+
46 which do not require integrating domain knowledge. Therefore, if a non-domain-expert tries inter
|
| 59 |
+
47 preting relations in the input data, they may incorrectly interpret causality, which can be especially
|
| 60 |
+
48 harmful if such a case occurs on medical or financial data. Mitigating against such downstream issues
|
| 61 |
+
49 requires to first focus efforts on producing robust modules to different distributions and understand
|
| 62 |
+
50 their affect on learning other networks architectures (e.g. CNN). Understanding this will enable
|
| 63 |
+
51 recognising situations where these modules can aid and where they should avoid being used.
|
| 64 |
+
|
| 65 |
+
# 52 2 Related Work
|
| 66 |
+
|
| 67 |
+
53 One approach to learn division would be symbolic regression networks [Sahoo et al., 2018]. However,
|
| 68 |
+
54 a symbolic approach pre-defines the operations, which is not a limitation of using Neural Arithmetic
|
| 69 |
+
55 Logic Modules (NALMs).
|
| 70 |
+
56 NALMs are neural networks which learn arithmetic operations and input selection [Mistry et al.,
|
| 71 |
+
57 2021]. The weights of these networks are intepretable such that a discrete value represents a specific
|
| 72 |
+
58 operation. For example, ‘-1’ to represent division and $\cdot _ { 0 } \cdot \mathrm { ~ }$ for no selection. From this research field,
|
| 73 |
+
59 we focus on the Real NPU and the NMU. Until now, the Real NPU only has learned division on
|
| 74 |
+
60 training ranges of either $\mathcal { U } [ 0 . 1 , 2 ]$ or Sobol(0,0.5) [Heim et al., 2020]. It remains unclear if this
|
| 75 |
+
61 module is robust to other training ranges even as a stand-alone unit. Robustness to training ranges is
|
| 76 |
+
62 important as these module’s applicational use comes from being part of larger end-to-end networks,
|
| 77 |
+
63 where the input range into the module cannot be controlled. The NMU is a multiplication module
|
| 78 |
+
64 which we extend to also do division. The authors of the NMU believe such an extension incurs too
|
| 79 |
+
65 many limitations for learning [Madsen and Johansen, 2020]. We use this paper as an opportunity to
|
| 80 |
+
66 explore this belief.
|
| 81 |
+
67 Trask et al. [2018] developed the Neural Arithmetic Logic Unit (NALU) which can model all four
|
| 82 |
+
68 arithmetic operations. However, studies show this module to be unstable in learning division [Schlör
|
| 83 |
+
69 et al., 2020, Heim et al., 2020]. In particular, their gating method responsible for selecting an operation
|
| 84 |
+
70 cannot learn consistently [Madsen and Johansen, 2020]. Schlör et al. [2020] developed iNALU
|
| 85 |
+
71 additionally applying weight and gradient clipping, sign retrieval, regularisation, reinitialisation and
|
| 86 |
+
72 separating shared parameters to the NALU. Even with these modifications, they still find consistently
|
| 87 |
+
73 learning division to a high precision to remain unattainable. Furthermore, Heim et al. [2020]’s results
|
| 88 |
+
74 imply iNALU is outperformed by the Real NPU for division.
|
| 89 |
+
|
| 90 |
+
# 75 3 Architectures
|
| 91 |
+
|
| 92 |
+
76 This section introduces the architectures for the (Real) NPU, NRU, and the NMRU. The (Real) NPU
|
| 93 |
+
77 is an existing module, which we improve in Section 5. The NRU and NMRU are novel contributions.
|
| 94 |
+
78 Appendix A summarises the important properties of these division modules.
|
| 95 |
+
|
| 96 |
+
# 3.1 Real Neural Power Unit
|
| 97 |
+
|
| 98 |
+
80 Heim et al. [2020] develop a module to learn to multiply and divide, using the intuition from Trask
|
| 99 |
+
81 et al. [2018] that multiplicative operations are additive operations in log space. Their work extends
|
| 100 |
+
82 this idea into complex space. The NPU can be used with its complex form (Equation 1) requiring both
|
| 101 |
+
83 a complex and real weight matrix $( W ^ { ( i ) } , W ^ { ( r ) } )$ , or only its real form the Real NPU (Equation 2).
|
| 102 |
+
84 For improved gradients, a relevance gate $\mathbfit { \Delta } \mathbf { r }$ (Equation 3) is used which converts inputs close to 0 (i.e.
|
| 103 |
+
85 irrelevant features) to 1 to avoid the resulting output evaluating to 0. A gating vector $\textbf { { g } }$ , learns to
|
| 104 |
+
86 select relevant input elements, where gate values are clipped between [0,1] during training.
|
| 105 |
+
|
| 106 |
+
$$
|
| 107 |
+
\mathrm { N P U } : = \exp ( { W ^ { ( r ) } \log ( r ) - W ^ { ( i ) } k } ) \odot \cos ( { W ^ { ( i ) } \log ( r ) + W ^ { ( r ) } k } ) ,
|
| 108 |
+
$$
|
| 109 |
+
|
| 110 |
+
87
|
| 111 |
+
|
| 112 |
+
$$
|
| 113 |
+
\mathrm { R e a l N P U } : = \exp ( W ^ { ( r ) } \log ( r ) ) \odot \cos ( W ^ { ( r ) } k )
|
| 114 |
+
$$
|
| 115 |
+
|
| 116 |
+
$$
|
| 117 |
+
\mathrm { e r e } \quad r = g \odot ( | { \pmb x } | + \epsilon ) + ( { \bf 1 } - { \pmb g } ) \quad \mathrm { a n d } \quad k _ { i } = \left\{ 0 \qquad x _ { i } \geq 0 \atop \pi { \bf g _ { i } } \quad x _ { i } < 0 \right. .
|
| 118 |
+
$$
|
| 119 |
+
|
| 120 |
+
89 A weighted L1 penalty is used when training. The weight value $\beta$ grows between predefined values
|
| 121 |
+
90 $\beta _ { s t a r t }$ to $\beta _ { e n d }$ and is increased every $\beta _ { s t e p } = 1 0 , 0 0 0$ iterations by a growth factor $\beta _ { g r o w t h } = 1 0$ .
|
| 122 |
+
91 We focus on the Real NPU over the NPU as the solution of the tasks in this paper can be captured
|
| 123 |
+
92 using only real values meaning that the complex form is not required.
|
| 124 |
+
|
| 125 |
+
# 93 3.2 Neural Reciprocal Unit
|
| 126 |
+
|
| 127 |
+
94 We propose the NRU, which can model multiplication and division. We extend the NMU, motivated
|
| 128 |
+
95 by division being multiplication of reciprocals. The range which weight values can be is extended
|
| 129 |
+
96 from [0,1] to [-1,1], where $^ { - 1 }$ represents applying the reciprocal on the corresponding input element.
|
| 130 |
+
97 A NRU output element $z _ { o }$ is defined as
|
| 131 |
+
|
| 132 |
+
$$
|
| 133 |
+
\mathrm { N R U : ~ } z _ { o } = \prod _ { i = 1 } ^ { I } ( \mathrm { s i g n ( x } _ { i } ) \cdot | \mathbf { x } _ { i } | ^ { W _ { i , o } } \cdot | W _ { i , o } | + 1 - | W _ { i , o } | ) ,
|
| 134 |
+
$$
|
| 135 |
+
|
| 136 |
+
98 where $I$ is the number of inputs. Assuming weights are either 1 (multiply) or $^ { - 1 }$ (reciprocal), $\left| \mathbf { x } _ { i } \right| ^ { W _ { i , o } }$
|
| 137 |
+
99 will apply the operation on an input element. The absolute value is used so that the module only
|
| 138 |
+
100 operates in the space of real numbers, as $x _ { i } ^ { W _ { i , o } }$ for a negative input $( x _ { i } )$ when $- 1 < W _ { i , o } < 1$ results
|
| 139 |
+
101 in a complex number. The use of absolute means the sign of the input must be reapplied. For the
|
| 140 |
+
102 no-selection case $W _ { i , o } = 0$ , we want the input element to convert to 1 (the identity value), resulting
|
| 141 |
+
103 in applying $| W _ { i , o } | + 1 - | W _ { i , o } |$ . The derivative of the absolute function at 0 is undefined meaning the
|
| 142 |
+
104 gradients of Equation 4 can contain points of discontinuity. To alleviate this issue, we approximate
|
| 143 |
+
105 the absolute function using a scaled tanh (inspired by Faber and Wattenhofer [2020]). More formally,
|
| 144 |
+
|
| 145 |
+
$$
|
| 146 |
+
| W _ { i , o } | = \left\{ \begin{array} { l l } { \operatorname { t a n h } ( 1 0 0 0 \cdot W _ { i , o } ) ^ { 2 } } & { \mathrm { i f ~ t r a i n i n g } } \\ { | W _ { i , o } | } & { \mathrm { o t h e r w i s e } } \end{array} . \right.
|
| 147 |
+
$$
|
| 148 |
+
|
| 149 |
+
106 The scale factor (1000) controls how close to the absolute function the approximation is, where larger
|
| 150 |
+
107 values give a more accurate approximation. For clipping and regularisation, the same scheme as the
|
| 151 |
+
108 Neural Addition Unit (NAU) (see Appendix B) is used.
|
| 152 |
+
|
| 153 |
+
# 109 3.3 Neural Multiplicative Reciprocal Unit
|
| 154 |
+
|
| 155 |
+
110 An alternate extension of the NMU, also motivated by division being multiplication of reciprocals
|
| 156 |
+
111 is the NMRU (Equation 5). We concatenate the reciprocal of the input (plus a small $\epsilon$ ) to the input
|
| 157 |
+
112 resulting in a module which only needs to learn selection. Hence, weights can be in the range [0,1].
|
| 158 |
+
|
| 159 |
+
$$
|
| 160 |
+
\mathrm { N M R U } : z _ { o } = \prod _ { i = 1 } ^ { 2 I } ( W _ { i , o } \cdot | \mathbf { x } _ { i } | + 1 - W _ { i , o } ) \cdot \sum _ { i = 1 } ^ { 2 I } ( \cos ( W _ { i , o } \cdot k _ { i } ) ) \mathrm { , ~ w h e r e ~ } k _ { i } \ = \{ { 0 } \quad x _ { i } \geq 0 \atop \pi \ .
|
| 161 |
+
$$
|
| 162 |
+
|
| 163 |
+
113 The iteration over $2 I$ represents the going through all inputs and their reciprocals. We calculate the
|
| 164 |
+
114 magnitude and sign separately, joining the result at the end. The magnitude is calculated passing
|
| 165 |
+
115 absolute of the concatenated input through an NMU architecture and the sign by using a cosine
|
| 166 |
+
116 mechanism similar to the Real NPU. However, unlike the Real NPU only the weight matrix is
|
| 167 |
+
117 required. The norm of the weight’s gradients are clipped to 1 prior to being updated by the optimiser.
|
| 168 |
+
118 This is done to alleviate the issue of exploding gradients caused by including the reciprocal to the
|
| 169 |
+
119 inputs. For clipping and regularisation, the same scheme as the NMU (see Appendix B) is used.
|
| 170 |
+
|
| 171 |
+
Table 1: Interpolation (train/validation) and extrapolation (test) ranges used. Data (as floats) is drawn from a Uniform distribution with the range values as the lower and upper bounds.
|
| 172 |
+
|
| 173 |
+
<table><tr><td>Interpolation Extrapolation</td><td>[-20,-10) [-40, -20)</td><td>[-2, -1) [-6,-2)</td><td>[-1.2, -1.1) [-6.1, -1.2)</td><td>[-0.2,-0.1) [-2, -0.2)</td><td>[-2,2) [-6, -2), [2, 6)]</td></tr><tr><td>Interpolation</td><td>[0.1, 0.2)</td><td>[1,2)</td><td>[1.1, 1.2)</td><td>[10,20)</td><td></td></tr><tr><td>Extrapolation</td><td>[0.2,2)</td><td>[2,6)</td><td>[1.2, 6)</td><td>[20,40)</td><td></td></tr></table>
|
| 174 |
+
|
| 175 |
+
# 120 4 Experiment Setup
|
| 176 |
+
|
| 177 |
+
We introduce the two main experiments used to evaluate modules, including: default parameters, train and test ranges, and evaluation metrics. The tasks evaluate the ability of a single module to divide two numbers from an input vector in two settings: no redundancy and with redundancy.
|
| 178 |
+
|
| 179 |
+
124 Default parameters: All experiments use a mean squared error (MSE) loss with an Adam optimiser
|
| 180 |
+
125 [Kingma and Ba, 2015], with 10,000 samples for the validation and test sets. The best model for
|
| 181 |
+
126 evaluation is taken using early stopping on the validation set. All runs are over 25 different seeds. All
|
| 182 |
+
127 inputs are required in the no redundancy setting, i.e., input size of 2. Training takes 50,000 iterations
|
| 183 |
+
128 where each iteration consists of a different batch of size 128. The Real NPU uses a learning rate of
|
| 184 |
+
129 5e-3 with sparsity regularisation scaling during iterations 40,000 to 50,000. The NRU and NMRU
|
| 185 |
+
130 use sparsity regularisation scaling during iterations 20,000 to 35,000 and a learning rate of 1 and 1e-2
|
| 186 |
+
131 respectively. In contrast, the redundancy setting uses an input size of 10, where 8 input values are not
|
| 187 |
+
132 required for the final output. The total training iterations are extended to 100,000 with batch sizes
|
| 188 |
+
133 of 128. The learning rates for the Real NPU, NRU and NMRU are 5e-3, 1e-3 and 1e-2 respectively.
|
| 189 |
+
134 Sparsity regularisation scaling occurs during iteration 50,000 to 75,000 for all modules. A summary
|
| 190 |
+
135 of all relevant parameters is found in Appendix C.
|
| 191 |
+
36 Ranges: The interpolation (train/validation) and extrapolation (test) ranges, are found in Table 1.
|
| 192 |
+
37 The chosen ranges are influenced by Madsen and Johansen [2020].
|
| 193 |
+
138 Evaluation metrics: We use the Madsen and Johansen [2019]’s evaluation scheme, consisting of
|
| 194 |
+
139 three evaluation metrics: the success on the extrapolation dataset against a near optimal solution
|
| 195 |
+
140 (success rate), the first iteration which the task is considered solved (speed of convergence), and
|
| 196 |
+
141 the extent of discretisation towards the weights’ inductive biases (sparsity error). Sparsity error
|
| 197 |
+
142 calculated by $\operatorname* { m a x } _ { i , o } ( \operatorname* { m i n } ( | W _ { i , o } | , 1 - | W _ { i , o } | ) )$ , measures the weight element which is the furthest away
|
| 198 |
+
143 from the acceptable discrete weights for the module. A success means the MSE of the trained model
|
| 199 |
+
144 is lower than a threshold value (i.e. the MSE of a near optimal solution). We differ from Madsen
|
| 200 |
+
145 and Johansen [2019] by using a fixed threshold value 1e-5 rather than a simulated MSE, as there
|
| 201 |
+
146 are no intermediate layers to accumulate numerical errors. We choose this precision as it can be
|
| 202 |
+
147 guaranteed when working with 32-bit PyTorch Tensors. $9 5 \%$ confidence intervals (over the 25 seeds)
|
| 203 |
+
148 are calculated from a specific family of distributions dependant on the metric. The success rate uses
|
| 204 |
+
149 Binomial distribution because trials (i.e. run on a single seed) are either pass/ fail situations. The
|
| 205 |
+
150 convergence metric uses a Gamma distribution and sparsity error uses a Beta distribution. Both Beta
|
| 206 |
+
151 and Gamma can easily approximate the normal distribution and support its corresponding metric.
|
| 207 |
+
|
| 208 |
+
# 5 Improving the Real NPU’s Robustness
|
| 209 |
+
|
| 210 |
+
We first improve the robustness of the Real NPU on different training ranges. We use the Single Module Task with no redundancy (see Section 4) to investigate the following questions:
|
| 211 |
+
|
| 212 |
+
1. Is L1 regularisation required, and if so, do the regularisation parameters require tuning?
|
| 213 |
+
2. Does clipping the weight matrix aid learning?
|
| 214 |
+
3. Does enforcing discretisation on parameters improve convergence?
|
| 215 |
+
4. Can the weight matrix initialisation be improved?
|
| 216 |
+
159 To address each question in order, we propose applying incremental modifications to the Real NPU.
|
| 217 |
+
160 These modifications include: ablation study on the L1 regularisation (including a sweep over the
|
| 218 |
+
161 scaling range hyperparameters), clipping, enforcing discretisation, and a more restrictive initialisation
|
| 219 |
+
162 scheme. We assume that we are optimising the Real NPU to perform multiplication or division.
|
| 220 |
+
163 Therefore, we trade-off the flexibility of having non-discretised weights, which enables the success of
|
| 221 |
+
164 modelling the SIR data in Heim et al. [2020, Section 4.1] , in favour of sparse models with discrete
|
| 222 |
+
165 weight values. All the modifications suggested can also be generalised for the NPU architecture.
|
| 223 |
+
166 Is L1 regularisation required? (Yes) L1 encourages sparsity (i.e., zero weights) in solutions.
|
| 224 |
+
167 Zero-valued weights means not to select an input and return the identity value 1. For the task, the
|
| 225 |
+
168 optimal weight values require selecting all inputs and therefore non-zero values, suggesting the
|
| 226 |
+
169 application of L1 could be damaging. Therefore, we compare against a model which does not use
|
| 227 |
+
170 L1 regularisation, shown in Figure 1a. Removing L1 proves to be detrimental in five of the nine
|
| 228 |
+
171 cases shown and only shows minor improvements in two of the nine ranges (i.e., $\mathcal { U } [ - 1 . 2 , - 1 . 1 )$ and
|
| 229 |
+
172 U[1.1,1.2)). Hence, we keep L1 regularisation. The L1 regularisation scaling (see Section 3.1),
|
| 230 |
+
173 requires setting the hyperparameters for the start $( \beta _ { s t a r t } )$ and end $( \beta _ { e n d } )$ scaling values. We run a
|
| 231 |
+
174 sweep over six different start and end values, denoted (<start>, <end>), displaying results in Figure 1b.
|
| 232 |
+
175 We find the configuration (1e-9, 1e-7) is the most successful when considering performance on all
|
| 233 |
+
176 the ranges, and larger scaling values perform worse.
|
| 234 |
+
177 Does clipping the learnable parameters help? (Yes) Division and multiplication operations are
|
| 235 |
+
178 represented by weight values of -1 and 1 respectively. The current architecture does not constrain the
|
| 236 |
+
179 weights which can result in large weight values. The gate weights do get clipped and saved to another
|
| 237 |
+
180 variable during the forward pass, meaning after an update step the gate values can also be out of the
|
| 238 |
+
181 range [-1,1]. Hence, we investigate the effect of applying clipping directly to the weight and gate
|
| 239 |
+
182 values after every optimisation step. Results, shown in Figure 2a, show clipping is beneficial, with
|
| 240 |
+
183 clipping on both weight and gate (or just on the weights) to improve over the baseline on all ranges
|
| 241 |
+
184 (excluding $\mathcal { U } [ 1 , 2 )$ where the baseline has already achieved full success).
|
| 242 |
+
185 Does enforcing discretisation help? (Yes) Modelling division in a generalisable manner requires
|
| 243 |
+
186 all learnable parameters to be discrete i.e., a value from {-1, 0, 1}. Using Madsen and Johansen
|
| 244 |
+
187 [2020]’s regularisation scaling scheme, we penalise weights for not being discrete. We modify the
|
| 245 |
+
188 scaling factor to be $\hat { \lambda } = 1$ and the regularisation to go from ‘off’ to ‘on’ between iterations 40,000 to
|
| 246 |
+
189 50,000. Results, shown in Figure 2b, show discretising the gate improves over the baseline but also
|
| 247 |
+
190 discretising the weights is additionally beneficial (especially for range U [-0.2,-0.1)). U [10,20) is the
|
| 248 |
+
191 only range where the baseline outperforms using discretisation, succeeding on two additional seeds.
|
| 249 |
+
192 Does using a more constrained initialisation help? (Yes) $W ^ { ( r ) }$ uses a Xavier-Uniform initial
|
| 250 |
+
193 isation [Glorot and Bengio, 2010]. This can result in weights initialised out of the range [-1,1].
|
| 251 |
+
194 Therefore, we use the initialisation for the Neural Addition Unit which is a constrained form of
|
| 252 |
+
195 the Xavier-Uniform that does not allow the fan values of the uniform distribution to go beyond 0.5,
|
| 253 |
+
196 meaning that no weight value will be out of the range [-1,1] [Madsen and Johansen, 2020]. Figure 2c
|
| 254 |
+
197 shows using the constrained initialisation provides improvements over multiple ranges.
|
| 255 |
+
|
| 256 |
+

|
| 257 |
+
Figure 1: Exploring the effect and sensitivity of L1 regularisation on the Real NPU
|
| 258 |
+
|
| 259 |
+

|
| 260 |
+
Figure 2: Effect of clipping, discretisation, and the NAU initialisation scheme on the Real NPU.
|
| 261 |
+
|
| 262 |
+

|
| 263 |
+
Figure 3: Division without redundancy (input size 2).
|
| 264 |
+
|
| 265 |
+
# 6 Results: Single Module Task
|
| 266 |
+
|
| 267 |
+
We analyse the results for the: Real NPU without using the modifications of Section 5, Real NPU with modifications, NRU, and NMRU.
|
| 268 |
+
|
| 269 |
+
# 6.1 No Redundancy
|
| 270 |
+
|
| 271 |
+
Figure 3 shows the baseline Real NPU without modifications struggles with all ranges except U[1,2), struggling with sparsity on the larger ranges. Applying the modifications deals with the sparsity issue and improves the robustness such that only range $\mathcal { U } [ - 2 , 2 )$ struggles (with a success rate of 0.64). The NRU and NMRU achieve full success over all ranges while solving the problem consistently fast and with low sparsity error. The success of the NRU is correlated with the learning rate (see Appendix E).
|
| 272 |
+
|
| 273 |
+
# 6.1.1 Mixed-signed Inputs
|
| 274 |
+
|
| 275 |
+
The remaining failure range of the Real NPU is U [-2,2) where inputs can consist of arbitrary signed values (e.g. all positives, all negatives, or a mixture of positive and negative values). We question if the failure is due to the input samples in a batch having different signs from each other, or if the problem is due to the fact data samples can be close to 0 (leading to singularity issues). To investigate
|
| 276 |
+
|
| 277 |
+

|
| 278 |
+
Figure 4: Extrapolation results on training the Real NPU using mixed-sign datasets that control the sign of the input elements. The ranges are in order of the datasets (i.e. dataset 1 to 5).
|
| 279 |
+
|
| 280 |
+

|
| 281 |
+
Figure 5: Effect of the singularity issue on the Real NPU, NRU and NMRU over increasing input ranges. Left: Reciprocal for an input size of 1 (no redundancy). Middle: Reciprocal for an input size of 2 (with redundancy). Right: Division for an input size of 2 (no redundancy).
|
| 282 |
+
|
| 283 |
+
212 this, we create additional mixed-sign datasets, controlling the range for each element in the input. The
|
| 284 |
+
213 interpolation and extrapolation ranges for the different datasets can be found in Appendix C. Datasets
|
| 285 |
+
214 1, 2, 4 and 5 sample a positive value for one input element and a negative value for the other element.
|
| 286 |
+
215 Dataset 3 samples the signs randomly. Datasets 2 and 5 avoid sampling close to 0 values to mitigate
|
| 287 |
+
216 the singularity issue. As shown by Figure 4, the Real NPU struggles on all these ranges, implying that
|
| 288 |
+
217 the core issue is not from different input samples having different signs or due to the input samples
|
| 289 |
+
218 being able to contain small values close to 0. The underlying issue is therefore most likely correlated
|
| 290 |
+
219 to the each element in an input having different signs. When the denominator of the output is positive
|
| 291 |
+
220 (dataset 1 or 2), the solution is found faster than when the denominator is a negative value (dataset 4
|
| 292 |
+
221 or 5). When the signs for an input element are controlled, discretisation/sparsity is no problem, in
|
| 293 |
+
222 contrast when the signs are arbitrary the sparsity error are slightly (though not significantly) higher.
|
| 294 |
+
|
| 295 |
+
# 6.2 Division by Small Numbers
|
| 296 |
+
|
| 297 |
+
Division by zero remains a challenge to model due to the inability to provide an computational value for the output and gradient. Furthermore, the discontinuous nature at zero causes its neighbouring values to have large gradients. To understand the extent of this issue when learning, we explore learning to divide by values close to zero using three tasks with increasing difficulty: 1) learning to take the reciprocal of a single input, 2) taking the reciprocal of the first input given two inputs, and 3) diving the first input by the second given two inputs. Figure 5 plots the test error for different modules assuming the module weights are set to the ‘gold’ solution for the three tasks. As the range values become closer to zero, the test error thresholds become increasingly large. Therefore, even with the correct weights, relying on the test errors alone as an indicator become increasingly deceptive with values close to zero. The Real NPU has larger test errors for all tasks and ranges, caused by adding $\epsilon$ to the input (see Equation 3). Setting $\epsilon = 0$ reduces the test error at the cost of the ability to deal with zero-valued inputs. Appendix F provides the corresponding experimental results for these tasks.
|
| 298 |
+
|
| 299 |
+

|
| 300 |
+
Figure 6: Division with redundancy (input size 10).
|
| 301 |
+
|
| 302 |
+
# 6.3 With Redundancy
|
| 303 |
+
|
| 304 |
+
Introducing redundancy (Figure 6) causes failure modes to arise. Failures on range U[-2,2) become more prevalent. The baseline Real NPU produces high sparsity errors relative to the other modules suggesting struggle with discretisation. Using the modified Real NPU improves over all ranges of the baseline (which were not already at full success) in terms of success, speed and sparsity.2 To ensure that complex weights do not fix the issue, we test the NPU module with all the modifications used on the real weight matrix (see Appendix G). Complex weights hinders success and convergence speeds of negative ranges. Assuming the global solution only uses the real weights, we enforce the complex weights to be clipped between [-1,1] and to go to 0 during the regularisation stage using a L1 penalty. This did not result in any significant improvements against the Real NPU results. Input redundancy effects the NRU the most, resulting in full failures on all the negative ranges. The NMRU is the only module with success for the range $\mathcal { U } [ - 2 , 2 )$ , which is a result of using the sign mechanism (see Appendix H). It performs well over all ranges though can be outperformed by the modified Real NPU for negative ranges. Multiple ranges for the NMRU are solved around 50,000 iterations correlating to the sparsity regularisation being turned on.
|
| 305 |
+
|
| 306 |
+
# 6.3.1 Gradient Difficulties with the NRU
|
| 307 |
+
|
| 308 |
+
252 The partial derivative for the NRU weights, Equation 6, can give insight to the struggles of the NRU.
|
| 309 |
+
|
| 310 |
+
$$
|
| 311 |
+
\begin{array} { r l r } & { } & { \displaystyle \frac { \partial \hat { \bf y } } { \partial w _ { i } } = \mathrm { t a n h } ( 1 0 0 0 w _ { i } ) ( \mathrm { s i g n } ( x _ { i } ) | x _ { i } | ( \mathrm { t a n h } ( 1 0 0 0 w _ { i } ) \log ( | x | ) + } \\ & { } & { \displaystyle 2 0 0 0 \mathrm { s e c h } ( 1 0 0 0 w _ { i } ) ^ { 2 } ) - 2 0 0 0 \mathrm { s e c h } ( 1 0 0 0 w _ { i } ) ^ { 2 } ) \times \mathrm { N R U } _ { \tilde { \bf x } \in { \bf x } \backslash \{ { \bf x } _ { i } \} } ( \tilde { \bf x } ) . } \end{array}
|
| 312 |
+
$$
|
| 313 |
+
|
| 314 |
+
$\_$ applies the NRU to all inputs excluding $x _ { i }$ influencing the gradient values between subsequent update steps. Factoring out this term, the following observations are made. If $x _ { i } \approx 0$ and $w _ { i } \approx 0$ then gradients become increasingly large. If $x _ { i } \approx 0$ and $- 1 \leq w _ { i } < 0$ then as $w _ { i } \to - 1$ all gradients for $x _ { i }$ where $| x _ { i } | > > 1$ become increasingly small. The gradients for $x _ { i } = - 1$ and $x _ { i } = 1$ are 0 regardless the value of $w _ { i }$ . If $w _ { i } = 0$ then the gradient is 0 for all $x _ { i }$ , a result of using the tanh approximation. Even if the sign and magnitude are calculated separately and then combined (see Appendix I) to try to control the gradient better, the problem remains. Therefore, we conclude that extending the NMU to divide using a weight of -1 is a poor choice when there are redundant inputs.
|
| 315 |
+
|
| 316 |
+

|
| 317 |
+
Figure 7: Root Mean Squared loss curvature for the NAU stacked with either a RealNPU, NRU, or NMRU. "The weight matrices are constrained to $\mathbf { W } _ { 1 } = \left[ \begin{array} { l l l } { w _ { 1 } \ w _ { 1 } } & { 0 } & { 0 } \\ { w _ { 1 } \ w _ { 1 } \ w _ { 1 } \ w _ { 1 } } & { w _ { 1 } } \end{array} \right]$ , $\mathbf { W } _ { 2 } = \left[ w _ { 2 } \ w _ { 2 } \right]$ . The problem is $( x _ { 1 } + x _ { 2 } ) \cdot ( x _ { 1 } + x _ { 2 } + x _ { 3 } + x _ { 4 } )$ for $x = ( 1 , 1 . 2 , 1 . 8 , 2 ) "$ [Madsen and Johansen, 2020]. The ideal solution is $w _ { 1 } = w _ { 2 } = 1$ , though other valid solutions do exist e.g., $w _ { 1 } = - 1 , w _ { 2 } = 1$ . (The NMRU’s weight matrix would be $\bar { \bf W _ { 2 } } = [ w _ { 2 } \ w _ { 2 } \ 0 \ 0 ]$ , and the Real NPU’s $\mathbf { g } = \left[ 1 \mathbf { \Omega } ^ { 1 } \right]$ . )
|
| 318 |
+
|
| 319 |
+
# 261 6.3.2 The Real NPU’s and NMRU’s Exploitation of Multiplicative Rules
|
| 320 |
+
|
| 321 |
+
The NMRU solutions exploit the inverse rule of division in that 1 = 1. Since the input also contains the reciprocals, numerous extrapolative solutions exist. However this comes at the cost of finding a ‘simple’ solution which contains ones only for relevant inputs. The Real NPU exploits the rules $a _ { i } \cdot 0 = 0$ and $1 ^ { a _ { i } } = 1$ enabling non-zero weight values if the corresponding gate value is 0. However, we can avoid this by allowing 0 to also not be penalised during sparsity regularisation stage (see Appendix G). We find this alleviates the exploitation issue with no cost to performance.
|
| 322 |
+
|
| 323 |
+
# 268 7 Discussion
|
| 324 |
+
|
| 325 |
+
269 In this paper, we demonstrate the limitations of intepretable neural networks in learning to divide.
|
| 326 |
+
270 Using the no redundancy setting (size 2), we find that the Real NPU is challenged when training data
|
| 327 |
+
271 consists of mixed-signed inputs even with our applied improvements. Increasing the difficulty to
|
| 328 |
+
272 have an input redundancy (with 8 redundant and 2 relevant input values) magnifies this issue, but
|
| 329 |
+
273 also introduces failure modes for the NRU and NMRU for negative ranges. The NRU is unable to
|
| 330 |
+
274 handle any negative ranges, in which we conclude it is not wise to use with MSE. Alternate losses
|
| 331 |
+
275 can improve certain failure cases though sometimes at the cost of performance on other ranges. For
|
| 332 |
+
276 further details see Appendix J which displays results on a correlation and scale-invariant based loss.
|
| 333 |
+
277 Our NMRU is the only module with reasonable success over all tested ranges, requiring only $2 I \times O$
|
| 334 |
+
278 learnable parameters. However, this comes at the cost of the simplicity of the solution due to its
|
| 335 |
+
279 exploitation of the identity rule; an issue the Real NPU does not have.
|
| 336 |
+
|
| 337 |
+
Once robust modules are attainable in a single layer setting, the next step would be to question performance when learning stacked modules, e.g. learning a stacked additive and multiplicative module. Previously, Madsen and Johansen [2020, Figure 2] illustrates the troubles for multiplicative models with the capacity for division. They show how a stacked summative-multiplicative module can lead to an exploding loss when the output of the summative module is close to 0 and the multiplicative model tries to divide. In Figure 7, we recreate their setup to produce the loss surfaces for the NAUReal $\mathrm { N P U } ^ { 3 }$ , NAU-NRU and NAU-NMRU respectively. 4 We find a similar issue with the Real-NPU and NRU, as both these units use a weight range of [-1,1]. In contrast, the NMRU, whose weight’s range is limited to [0,1] does not have exploding losses.
|
| 338 |
+
|
| 339 |
+
In conclusion, division remains a challenge to learn using intepretable neural networks, even for the simplest tasks. Nevertheless, by identifying the specific areas causing difficulty (e.g., training ranges), and useful architecture properties (e.g., using a sign retrieval mechanism), we hope the community has better intuition for dealing with division and develop more robust modules to learn division.
|
| 340 |
+
|
| 341 |
+
# References
|
| 342 |
+
|
| 343 |
+
Girish Chandrashekar and Ferat Sahin. A survey on feature selection methods. Computers & Electrical Engineering, 40(1):16–28, 2014. ISSN 0045-7906. doi: https://doi.org/10.1016/j.comp eleceng.2013.11.024. URL https://www.sciencedirect.com/science/article/pii/S0 045790613003066. 40th-year commemorative issue.
|
| 344 |
+
Lukas Faber and Roger Wattenhofer. Neural status registers. CoRR, abs/2004.07085, 2020. URL https://arxiv.org/abs/2004.07085.
|
| 345 |
+
Xavier Glorot and Yoshua Bengio. Understanding the difficulty of training deep feedforward neural networks. In Proceedings of the thirteenth international conference on artificial intelligence and statistics, pages 249–256. JMLR Workshop and Conference Proceedings, 2010. URL http: //proceedings.mlr.press/v9/glorot10a/glorot10a.pdf.
|
| 346 |
+
Niklas Heim, Tomáš Pevny, and Václav Šmídl. Neural power units. \` Advances in Neural Information Processing Systems, 33, 2020. URL https://papers.nips.cc/paper/2020/file/48e5900 0d7dfcf6c1d96ce4a603ed738-Paper.pdf.
|
| 347 |
+
Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. CoRR, abs/1412.6980, 2015. URL https://arxiv.org/pdf/1412.6980.pdf.
|
| 348 |
+
Andreas Madsen and Alexander Rosenberg Johansen. Measuring arithmetic extrapolation performance. In Science meets Engineering of Deep Learning at 33rd Conference on Neural Information Processing Systems (NeurIPS 2019), volume abs/1910.01888, Vancouver, Canada, October 2019. URL https://arxiv.org/pdf/1910.01888.pdf.
|
| 349 |
+
Andreas Madsen and Alexander Rosenberg Johansen. Neural arithmetic units. In International Conference on Learning Representations, 2020. URL https://openreview.net/forum?id= H1gNOeHKPS.
|
| 350 |
+
Bhumika Mistry, Katayoun Farrahi, and Jonathon Hare. A primer for neural arithmetic logic modules, 2021. URL https://arxiv.org/pdf/2101.09530.pdf.
|
| 351 |
+
Subham Sahoo, Christoph Lampert, and Georg Martius. Learning equations for extrapolation and control. In International Conference on Machine Learning, pages 4442–4450. PMLR, 2018.
|
| 352 |
+
Daniel Schlör, Markus Ring, and Andreas Hotho. inalu: Improved neural arithmetic logic unit. Frontiers in Artificial Intelligence, 3:71, 2020. ISSN 2624-8212. doi: 10.3389/frai.2020.00071. URL https://www.frontiersin.org/article/10.3389/frai.2020.00071.
|
| 353 |
+
Andrew Trask, Felix Hill, Scott E Reed, Jack Rae, Chris Dyer, and Phil Blunsom. Neural arithmetic logic units. In Advances in Neural Information Processing Systems, pages 8035–8044, 2018. URL https://openreview.net/pdf?id=H1gNOeHKPS.
|
| 354 |
+
Silviu-Marian Udrescu and Max Tegmark. Ai feynman: A physics-inspired method for symbolic regression. Science Advances, 6(16), 2020. doi: 10.1126/sciadv.aay2631. URL https: //advances.sciencemag.org/content/6/16/eaay2631.
|
| 355 |
+
|
| 356 |
+
# Checklist
|
| 357 |
+
|
| 358 |
+
1. For all authors...
|
| 359 |
+
|
| 360 |
+
(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes] See contributions in the introduction. For Real NPU improvements see Section 5. For two novel modules see Section 3.2 and 3.3 and results in Section 6. For hindrances in learning division, see Section 6.
|
| 361 |
+
(b) Did you describe the limitations of your work? [Yes] See Section 7.
|
| 362 |
+
(c) Did you discuss any potential negative societal impacts of your work? [Yes] This paper focuses on the ML techniques and the foundational research required to learn division in a systematic manner. Once robust modules for the arithmetic operations (i.e. NALMs) are achievable the community will possess trainable modules with significant advantages regarding model transparency and generalisability. That being said, we discuss how this leads to a negative societal impact in the end of Section 1.
|
| 363 |
+
|
| 364 |
+
(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes] We have read the guidelines and our work does not use human-derived data.
|
| 365 |
+
|
| 366 |
+
2. If you are including theoretical results...
|
| 367 |
+
|
| 368 |
+
(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]
|
| 369 |
+
|
| 370 |
+
3. If you ran experiments...
|
| 371 |
+
|
| 372 |
+
(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] See link provided to the code base. Data is generated in real time and the code to generate it is available in the linked repository.
|
| 373 |
+
(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] See Section 4 and Appendix C.
|
| 374 |
+
(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes] See plots and experiment details in Section 4 for further details.
|
| 375 |
+
(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.
|
| 376 |
+
|
| 377 |
+
4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
|
| 378 |
+
|
| 379 |
+
(a) If your work uses existing assets, did you cite the creators? [Yes] See footnote link provided to the code base and Section 4.
|
| 380 |
+
(b) Did you mention the license of the assets? [Yes] We state the MIT licence when giving the link to the codebase.
|
| 381 |
+
(c) Did you include any new assets either in the supplemental material or as a URL? [Yes] All code for model, data and experiments are available through the link to the codebase.
|
| 382 |
+
(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A]
|
| 383 |
+
(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [No] All data is synthetic, containing no such information.
|
| 384 |
+
|
| 385 |
+
5. If you used crowdsourcing or conducted research with human subjects...
|
| 386 |
+
|
| 387 |
+
(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
|
| 388 |
+
(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
|
| 389 |
+
(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
|
md/train/5kTlVBkzSRx/5kTlVBkzSRx.md
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Twins: Revisiting the Design of Spatial Attention in Vision Transformers
|
| 2 |
+
|
| 3 |
+
Xiangxiang $\mathbf { C h u ^ { 1 } }$ , Zhi Tian1,2, Yuqing Wang1, Bo Zhang1 Haibing Ren1, Xiaolin Wei1, Huaxia Xia1, Chunhua Shen2∗
|
| 4 |
+
|
| 5 |
+
1 Meituan Inc. 2 The University of Adelaide, Australia 1 {chuxiangxiang,wangyuqing06,zhangbo97,renhaibing,weixiaolin02,xiahuaxia}@meituan.com 2 zhi.tian@outlook.com, chunhua@me.com
|
| 6 |
+
|
| 7 |
+
# Abstract
|
| 8 |
+
|
| 9 |
+
Very recently, a variety of vision transformer architectures for dense prediction tasks have been proposed and they show that the design of spatial attention is critical to their success in these tasks. In this work, we revisit the design of the spatial attention and demonstrate that a carefully devised yet simple spatial attention mechanism performs favorably against the state-of-the-art schemes. As a result, we propose two vision transformer architectures, namely, Twins-PCPVT and TwinsSVT. Our proposed architectures are highly efficient and easy to implement, only involving matrix multiplications that are highly optimized in modern deep learning frameworks. More importantly, the proposed architectures achieve excellent performance on a wide range of visual tasks including image-level classification as well as dense detection and segmentation. The simplicity and strong performance suggest that our proposed architectures may serve as stronger backbones for many vision tasks. Our code is available at: https://git.io/Twins.
|
| 10 |
+
|
| 11 |
+
# 1 Introduction
|
| 12 |
+
|
| 13 |
+
Recently, Vision Transformers [1–3] have received increasing research interest. Compared to the widely-used convolutional neural networks (CNNs) in visual perception, Vision Transformers enjoy great flexibility in modeling long-range dependencies in vision tasks, introduce less inductive bias, and can naturally process multi-modality input data including images, videos, texts, speech signals, and point clouds. Thus, they have been considered to be a strong alternative to CNNs. It is expected that vision transformers are likely to replace CNNs and serve as the most basic component in the next-generation visual perception systems.
|
| 14 |
+
|
| 15 |
+
One of the prominent problems when applying transformers to vision tasks is the heavy computational complexity incurred by the spatial self-attention operation in transformers, which grows quadratically in the number of pixels of the input image. A workaround is the locally-grouped self-attention (or self-attention in non-overlapped windows as in the recent Swin Transformer [4]), where the input is spatially grouped into non-overlapped windows and the standard self-attention is computed only within each sub-window. Although it can significantly reduce the complexity, it lacks the connections between different windows and thus results in a limited receptive field. As pointed out by many previous works [5–7], a sufficiently large receptive field is crucial to the performance, particularly for dense prediction tasks such as image segmentation and object detection. Swin [4] proposes a shifted window operation to tackle the issue, where the boundaries of these local windows are gradually moved as the network proceeds. Despite being effective, the shifted windows may have uneven sizes. The uneven windows result in difficulties when the models are deployed with ONNX or TensorRT, which prefers the windows of equal sizes. Another solution is proposed in PVT [8]. Unlike the standard self-attention operation, where each query computes the attention weights with all the input tokens, in PVT, each query only computes the attention with a sub-sampled version of the input tokens. Although its computational complexity in theory is still quadratic, it is already manageable in practice.
|
| 16 |
+
|
| 17 |
+
From a unified perspective, the core in the aforementioned vision transformers is how the spatial attention is designed. Thus, in this work, we revisit the design of the spatial attention in vision transformers. Our first finding is that the global sub-sampled attention in PVT is highly effective, and with the applicable positional encodings [9], its performance can be on par or even better than state-of-the-art vision transformers (e.g., Swin). This results in our first proposed architecture, termed Twins-PCPVT. On top of that, we further propose a carefully-designed yet simple spatial attention mechanism, making our architectures more efficient than PVT. Our attention mechanism is inspired by the widely-used separable depthwise convolutions and thus we name it spatially separable self-attention (SSSA). Our proposed SSSA is composed of two types of attention operations—(i) locally-grouped self-attention (LSA), and (ii) global sub-sampled attention (GSA), where LSA captures the fine-grained and short-distance information and GSA deals with the long-distance and global information. This leads to the second proposed vision transformer architecture, termed Twins-SVT. It is worth noting that both attention operations in the architecture are efficient and easy-to-implement with matrix multiplications in a few lines of code. Thus, all of our architectures here have great applicability and can be easily deployed.
|
| 18 |
+
|
| 19 |
+
We benchmark our proposed architectures on a number of visual tasks, ranging from image-level classification to pixel-level semantic/instance segmentation and object detection. Extensive experiments show that both of our proposed architectures perform favorably against other state-of-the-art vision transformers with similar or even reduced computational complexity.
|
| 20 |
+
|
| 21 |
+
# 2 Related Work
|
| 22 |
+
|
| 23 |
+
Convolutional neural networks. Characterized by local connectivity, weight sharing, shiftinvariance and pooling, CNNs have been the de facto standard model for computer vision tasks. The top-performing models [10–13] in image classification also serve as the strong backbones for downstream detection and segmentation tasks.
|
| 24 |
+
|
| 25 |
+
Vision Transformers. Transformer was firstly proposed by [14] for machine translation tasks, and since then they have become the state-of-the-art models for NLP tasks, overtaking the sequence-tosequence approach built on LSTM. Its core component is multi-head self-attention which models the relationship between input tokens and shows great flexibility.
|
| 26 |
+
|
| 27 |
+
In 2020, Transformer was introduced to computer vision for image and video processing [1–3, 9, 15– 17, 17–32]. In the image classification task, ViT [1] and DeiT [2] divide the images into patch embedding sequences and feed them into the standard transformers. Although vision transformers have been proved compelling in image classification compared with CNNs, a challenge remains when it is applied to dense prediction tasks such as object detection and segmentation. These tasks often require feature pyramids for better processing objects of different scales, and take as inputs the highresolution images, which significantly increase the computational complexity of the self-attention operations.
|
| 28 |
+
|
| 29 |
+
Recently, Pyramid Vision Transformer (PVT) [8] is proposed and can output the feature pyramid [33] as in CNNs. PVT has demonstrated good performance in a number of dense prediction tasks. The recent Swin Transformer [4] introduces non-overlapping window partitions and restricts self-attention within each local window, resulting in linear computational complexity in the number of input tokens. To interchange information among different local areas, its window partitions are particularly designed to shift between two adjacent self-attention layers. The semantic segmentation framework OCNet [34] shares some similarities with us and they also interleave the local and global attention. Here, we demonstrate this is a general design paradigm in vision transformer backbones rather than merely an incremental module in semantic segmentation.
|
| 30 |
+
|
| 31 |
+
Grouped and Separable Convolutions. Grouped convolutions are originally proposed in AlexNet [35] for distributed computing. They were proved both efficient and effective in speeding up the networks. As an extreme case, depthwise convolutions [12, 36] use the number of groups that is equal to the input or output channels, which is followed by point-wise convolutions to aggregate the information across different channels. Here, the proposed spatially separable self-attention shares some similarities with them.
|
| 32 |
+
|
| 33 |
+
Positional Encodings. Most vision transformers use absolute/relative positional encodings, depending on downstream tasks, which are based on sinusoidal functions [14] or learnable [1, 2]. In CPVT [9], the authors propose the conditional positional encodings, which are dynamically conditioned on the inputs and show better performance than the absolute and relative ones.
|
| 34 |
+
|
| 35 |
+
# 3 Our Method: Twins
|
| 36 |
+
|
| 37 |
+
We present two simple yet powerful spatial designs for vision transformers. The first method is built upon PVT [8] and CPVT [9], which only uses the global attention. The architecture is thus termed Twins-PCPVT. The second one, termed Twins-SVT, is based on the proposed SSSA which interleaves local and global attention.
|
| 38 |
+
|
| 39 |
+
# 3.1 Twins-PCPVT
|
| 40 |
+
|
| 41 |
+
PVT [8] introduces the pyramid multi-stage design to better tackle dense prediction tasks such as object detection and semantic segmentation. It inherits the absolute positional encoding designed in ViT [1] and DeiT [2]. All layers utilize the global attention mechanism and rely on spatial reduction to cut down the computation cost of processing the whole sequence. It is surprising to see that the recently-proposed Swin transformer [4], which is based on shifted local windows, can perform considerably better than PVT, even on dense prediction tasks where a sufficiently large receptive field is even more crucial to good performance.
|
| 42 |
+
|
| 43 |
+
In this work, we surprisingly found that the less favored performance of PVT is mainly due to the absolute positional encodings employed in PVT [8]. As shown in CPVT [9], the absolute positional encoding encounter difficulties in processing the inputs with varying sizes (which are common in dense prediction tasks). Moreover, this positional encoding also breaks the translation invariance. On the contrary, Swin transformer makes use of the relative positional encodings, which bypasses the above issues. Here, we demonstrate that this is the main cause why Swin outperforms PVT, and we show that if the appropriate positional encodings are used, PVT can actually achieve on par or even better performance than the Swin transformer.
|
| 44 |
+
|
| 45 |
+
Here, we use the conditional position encoding (CPE) proposed in CPVT [9] to replace the absolute PE in PVT. CPE is conditioned on the inputs and can naturally avoid the above issues of the absolute encodings. The position encoding generator (PEG) [9], which generates the CPE, is placed after the first encoder block of each stage. We use the simplest form of PEG, i.e., a 2D depth-wise convolution without batch normalization. For image-level classification, following CPVT, we remove the class token and use global average pooling (GAP) at the end of the stage [9]. For other vision tasks, we follow the design of PVT. Twins-PCPVT inherits the advantages of both PVT and CPVT, which makes it easy to be implemented efficiently. Our extensive experimental results show that this simple design can match the performance of the recent state-of-the-art Swin transformer. We have also attempted to replace the relative PE with CPE in Swin, which however does not result in noticeable performance gains, as shown in our experiments. We conjecture that this maybe due to the use of shifted windows in Swin, which might not work well with CPE.
|
| 46 |
+
|
| 47 |
+
Architecture settings We report the detailed settings of Twins-PCPVT in Table 2 (in supplementary), which are similar to PVT [8]. Therefore, Twins-PCPVT has similar FLOPs and number of parameters to [8].
|
| 48 |
+
|
| 49 |
+
# 3.2 Twins-SVT
|
| 50 |
+
|
| 51 |
+
Vision transformers suffer severely from the heavy computational complexity in dense prediction tasks due to high-resolution inputs. Given an input of $H \times W$ resolution, the complexity of selfattention with dimension $d$ is $\mathcal { O } ( H ^ { 2 } W ^ { 2 } d )$ . Here, we propose the spatially separable self-attention (SSSA) to alleviate this challenge. SSSA is composed of locally-grouped self-attention (LSA) and global sub-sampled attention (GSA).
|
| 52 |
+
|
| 53 |
+

|
| 54 |
+
Figure 1 – Architecture of Twins-SVT-S. “PEG" is the positional encoding generator from CPVT [9].
|
| 55 |
+
|
| 56 |
+
Locally-grouped self-attention (LSA). Motivated by the group design in depthwise convolutions for efficient inference, we first equally divide the 2D feature maps into sub-windows, making self-attention communications only happen within each sub-window. This design also resonates with the multi-head design in selfattention, where the communications only occur within the channels of the same head. To be specific, the feature maps are divided into $m \times n$ sub-windows. Without loss of generality, we assume $H \% m = 0$ and $W \% n = 0$ . Each group contains $\textstyle { \frac { H W } { m n _ { * } } }$ elements, and thus the computation cost of the self-attention in this window is $\begin{array} { r } { \mathcal { O } \big ( \frac { H ^ { 2 } W ^ { 2 } } { m ^ { 2 } n ^ { 2 } } d \big ) } \end{array}$ , and the total cost is $\begin{array} { r } { \mathcal { O } ( \frac { H ^ { 2 } W ^ { 2 } } { m n } d ) } \end{array}$ . If we let $\begin{array} { r } { \dot { k } _ { 1 } = \frac { H } { m } } \end{array}$ and $\textstyle k _ { 2 } \ = \ { \frac { W } { n } }$ , the cost can be
|
| 57 |
+
|
| 58 |
+

|
| 59 |
+
Figure 2 – (a) Twins-SVT interleaves locally-grouped attention (LSA) and global sub-sampled attention (GSA). (b) Schematic view of the locally-grouped attention (LSA) and global sub-sampled attention (GSA).
|
| 60 |
+
|
| 61 |
+
computed as $\mathcal { O } ( k _ { 1 } k _ { 2 } H W d )$ , which is significantly more efficient when $k _ { 1 } \ll H$ and $k _ { 2 } \ll W$ and grows linearly with $H W$ if $k _ { 1 }$ and $k _ { 2 }$ are fixed.
|
| 62 |
+
|
| 63 |
+
Although the locally-grouped self-attention mechanism is computation friendly, the image is divided into non-overlapping sub-windows. Thus, we need a mechanism to communicate between different sub-windows, as in Swin. Otherwise, the information would be limited to be processed locally, which makes the receptive field small and significantly degrades the performance as shown in our experiments. This resembles the fact that we cannot replace all standard convolutions by depth-wise convolutions in CNNs.
|
| 64 |
+
|
| 65 |
+
Global sub-sampled attention (GSA). A simple solution is to add extra standard global selfattention layers after each local attention block, which can enable cross-group information exchange. However, this approach would come with the computation complexity of $\mathcal { O } ( H ^ { 2 } W ^ { 2 } d )$ .
|
| 66 |
+
|
| 67 |
+
Here, we use a single representative to summarize the important information for each of $m \times n$ sub-windows and the representative is used to communicate with other sub-windows (serving as the key in self-attention), which can dramatically reduce the cost to $\begin{array} { r } { \mathcal { O } ( m n H W d ) = \mathcal { O } ( \frac { H ^ { 2 } W ^ { 2 } d } { k _ { 1 } k _ { 2 } } ) } \end{array}$ . This is essentially equivalent to using the sub-sampled feature maps as the key in attention operations, and thus we term it global sub-sampled attention (GSA). If we alternatively use the aforementioned LSA and GSA like separable convolutions (depth-wise $^ +$ point-wise). The total computation cost√ is $\begin{array} { r } { \mathcal { O } ( \frac { H ^ { 2 } W ^ { 2 } d } { k _ { 1 } k _ { 2 } } + k _ { 1 } k _ { 2 } \bar { H } W d ) } \end{array}$ . We have $\begin{array} { r } { \frac { H ^ { 2 } W ^ { 2 } d } { k _ { 1 } k _ { 2 } } + k _ { 1 } k _ { 2 } H W d \geq 2 H W d \sqrt { H W } } \end{array}$ . The minimum is obtained when $\boldsymbol { k } _ { 1 } \cdot \boldsymbol { k } _ { 2 } = \sqrt { H W }$ . We note that $H = W = 2 2 4$ is popular in classification. Without loss of generality, we use square sub-windows, i.e., $k _ { 1 } = k _ { 2 }$ . Therefore, $k _ { 1 } = k _ { 2 } = 1 5$ is close to the global minimum for $H = W = 2 2 4$ . However, our network is designed to include several stages with variable resolutions. Stage 1 has feature maps of $5 6 \times 5 6$ , the minimum is obtained when $k _ { 1 } \stackrel { \cdot } { = } k _ { 2 } = \sqrt { 5 6 } \approx 7 .$ Theoretically, we can calibrate optimal $k _ { 1 }$ and $k _ { 2 }$ for each of the stages. For simplicity, we use $k _ { 1 } = k _ { 2 } = 7$ everywhere. As for stages with lower resolutions, we control the summarizing window-size of GSA to avoid too small amount of generated keys. Specifically, we use the size of 4, 2 and 1 for the last three stages respectively.
|
| 68 |
+
|
| 69 |
+
As for the sub-sampling function, we investigate several options including average pooling, depthwise strided convolutions, and regular strided convolutions. Empirical results show that regular strided convolutions perform best here. Formally, our spatially separable self-attention (SSSA) can be written as
|
| 70 |
+
|
| 71 |
+
$$
|
| 72 |
+
\begin{array} { r l } & { \hat { \mathbf { z } } _ { i j } ^ { l } = \mathrm { L S A } \left( \mathrm { L a y e r N o r m } \left( \mathbf { z } _ { i j } ^ { l - 1 } \right) \right) + \mathbf { z } _ { i j } ^ { l - 1 } , } \\ & { \mathbf { z } _ { i j } ^ { l } = \mathrm { F F N } \left( \mathrm { L a y e r N o r m } \left( \hat { \mathbf { z } } _ { i j } ^ { l } \right) \right) + \hat { \mathbf { z } } _ { i j } ^ { l } , } \\ & { \hat { \mathbf { z } } ^ { l + 1 } = \mathrm { G S A } \left( \mathrm { L a y e r N o r m } \left( \mathbf { z } ^ { l } \right) \right) + \mathbf { z } ^ { l } , } \\ & { \mathbf { z } ^ { l + 1 } = \mathrm { F F N } \left( \mathrm { L a y e r N o r m } \left( \hat { \mathbf { z } } ^ { l + 1 } \right) \right) + \hat { \mathbf { z } } ^ { l + 1 } , } \\ & { i \in \{ 1 , 2 , . . . . , m \} , j \in \{ 1 , 2 , . . . . , n \} } \end{array}
|
| 73 |
+
$$
|
| 74 |
+
|
| 75 |
+
where LSA means locally-grouped self-attention within a sub-window; GSA is the global sub-sampled attention by interacting with the representative keys (generated by the sub-sampling functions) from each sub-window $\hat { \mathbf { z } } _ { i j } \mathbf { \bar { \Psi } } \in \mathcal { R } ^ { k _ { 1 } \times k _ { 2 } \times \mathbf { \bar { C } } }$ . Both LSA and GSA have multiple heads as in the standard self-attention.The PyTorch code of LSA is given in Algorithm 1 (in supplementary).
|
| 76 |
+
|
| 77 |
+
Again, we use the PEG of CPVT [9] to encode position information and process variable-length inputs on the fly. It is inserted after the first block in each stage.
|
| 78 |
+
|
| 79 |
+
Model variants. The detailed configure of Twins-SVT is shown in Table 3 (in supplementary). We try our best to use the similar settings as in Swin [4] to make sure that the good performance is due to the new design paradigm.
|
| 80 |
+
|
| 81 |
+
Comparison with PVT. PVT entirely utilizes global attentions as DeiT does while our method makes use of spatial separable-like design with LSA and GSA, which is more efficient.
|
| 82 |
+
|
| 83 |
+
Comparison with Swin. Swin utilizes the alternation of local window based attention where the window partitions in successive layers are shifted. This is used to introduce communication among different patches and to increase the receptive field. However, this procedure is relatively complicated and may not be optimized for speed on devices such as mobile devices. Swin Transformer depends on torch.roll() to perform cyclic shift and its reverse on features. This operation is memory unfriendly and rarely supported by popular inference frameworks such as NVIDIA TensorRT, Google TensorflowLite, and Snapdragon Neural Processing Engine SDK (SNPE), etc. This hinders the deployment of Swin either on the server-side or on end devices in a production environment. In contrast, Twins models don’t require such an operation and only involve matrix multiplications that are already optimized well in modern deep learning frameworks. Therefore, it can further benefit from the optimization in a production environment. For example, we converted Twins-SVT-S from PyTorch to TensorRT , and its throughput is boosted by $1 . 7 \times$ . Moreover, our local-global design can better exploit the global context, which is known to play an important role in many vision tasks.
|
| 84 |
+
|
| 85 |
+
Finally, one may note that the network configures (e.g., such as depths, hidden dimensions, number of heads, and the expansion ratio of MLP) of our two variants are sightly different. This is intended because we want to make fair comparisons to the two recent well-known transformers PVT and Swin. PVT prefers a slimmer and deeper design while Swin is wider and shallower. This difference makes PVT have slower training than Swin. Twins-PCPVT is designed to compare with PVT and shows that a proper positional encoding design can greatly boost the performance and make it on par with recent state-of-the-art models like Swin. On the other hand, Twins-SVT demonstrates the potential of a new paradigm as to spatially separable self-attention is highly competitive to recent transformers.
|
| 86 |
+
|
| 87 |
+
# 4 Experiments
|
| 88 |
+
|
| 89 |
+
# 4.1 Classification on ImageNet-1K
|
| 90 |
+
|
| 91 |
+
We first present the ImageNet classification results with our proposed models. We carefully control the experiment settings to make fair comparisons against recent works [2, 8, 9]. All our models are trained for 300 epochs with a batch size of 1024 using the AdamW optimizer [37]. The learning rate is initialized to be 0.001 and decayed to zero within 300 epochs following the cosine strategy. We use a linear warm-up in the first five epochs and the same regularization setting as in [2]. Note that we do not utilize extra tricks in [26, 28] to make fair comparisons although it may further improve the performance of our method. We use increasing stochastic depth [38] augmentation of 0.2, 0.3, 0.5 for small, base and large model respectively. Following Swin [4], we use gradient clipping with a max norm of 5.0 to stabilize the training process, which is especially important for the training of large models.
|
| 92 |
+
|
| 93 |
+
We report the classification results on ImageNet-1K [39] in Table 1. Twins-PCPVT-S outperforms PVT-small by $1 . 4 \%$ and obtains similar result as Swin-T with $18 \%$ fewer FLOPs. Twins-SVT-S is better than Swin-T with about $3 5 \%$ fewer FLOPs. Other models demonstrate similar advantages.
|
| 94 |
+
|
| 95 |
+
It is interesting to see that, without bells and whistles, Twins-PCPVT performs on par with the recent state-of-the-art Swin, which is based on much more sophisticated designs as mentioned above. Moreover, Twins-SVT also achieves similar or better results, compared to Swin, indicating that the spatial separable-like design is an effective and promising paradigm.
|
| 96 |
+
|
| 97 |
+
One may challenge our improvements are due to the use of the better positional encoding PEG. Thus, we also replace the relative PE in Swin-T with PEG [9], but the Swin-T’s performance cannot be improved (being $8 1 . 2 \%$ ).
|
| 98 |
+
|
| 99 |
+
# 4.2 Semantic Segmentation on ADE20K
|
| 100 |
+
|
| 101 |
+
We further evaluate the performance on segmentation tasks. We test on the ADE20K dataset [42], a challenging scene parsing task for semantic segmentation, which is popularly evaluated by recent Transformer-based methods. This dataset contains 20K images for training and 2K images for validation. Following the common practices, we use the training set to train our models and report the mIoU on the validation set. All models are pretrained on the ImageNet-1k dataset.
|
| 102 |
+
|
| 103 |
+
Twins-PCPVT vs. PVT. We compare our Twins-PCPVT with PVT [8] because they have similar design and computational complexity. To make fair comparisons, we use the Semantic FPN framework [43] and exactly the same training settings as in PVT. Specifically, we train 80K steps with a batch size of 16 using AdamW [37]. The learning rate is initialized as $1 \times 1 0 ^ { - 4 }$ and scheduled by the ‘poly’ strategy with the power coefficient of 0.9. We apply the drop-path regularization of 0.2 for the backbone and weight decay 0.0005 for the whole network. Note that we use a stronger drop-path regularization of 0.4 for the large model to avoid over-fitting. For Swin, we use their official code and trained models. We report the results in Table 2. With comparable FLOPs, Twins-PCPVT-S outperforms PVT-Small with a large margin $( + 4 . 5 \%$ mIoU), which also surpasses ResNet-50 by $7 . 6 \%$ mIoU. It also outperforms Swin-T with a clear margin. Besides, Twins-PCPVT-B also achieves $3 . 3 \%$ higher mIoU than PVT-Medium, and Twins-PCPVT-L surpasses PVT-Large with $4 . 3 \%$ higher mIoU.
|
| 104 |
+
|
| 105 |
+
Twins-SVT vs. Swin. We also compare our Twins-SVT with the recent state-of-the-art model Swin [4]. With the Semantic FPN framework and the above settings, Twins-SVT-S achieves better performance $( + 1 . 7 \% )$ than Swin-T. Twins-SVT-B obtains comparable performance with Swin-S and Twins-SVT-L outperforms Swin-B by $0 . 7 \%$ mIoU (left columns in Table 2). In addition, Swin evaluates its performance using the UperNet framework [44]. We transfer our method to this framework and use exactly the same training settings as [4]. To be specific, we use the AdamW optimizer to train all models for $1 6 0 \mathrm { k }$ iterations with a global batch size of 16. The initial learning rate is $6 \times 1 0 ^ { - 5 }$ and linearly decayed to zero. We also utilize warm-up during the first 1500 iterations. Moreover, we apply the drop-path regularization of 0.2 for the backbone and weight decay 0.01 for the whole network. We report the mIoU of both single scale and multi-scale testing (we use scales from 0.5 to 1.75 with step 0.25) in the right columns of Table 2. Both with multi-scale testing, Twins-SVT-S outperforms Swin-T by $1 . 3 \%$ mIoU. Moreover, Twins-SVT-L achieves new state of the art result $5 0 . 2 \%$ mIoU under comparable FLOPs and outperforms Swin-B by $0 . 5 \%$ mIoU. Twins-PCPVT also achieves comparable performance to Swin [4].
|
| 106 |
+
|
| 107 |
+
# 4.3 Object Detection and Segmentation on COCO
|
| 108 |
+
|
| 109 |
+
We evaluate the performance of our method using two representative frameworks: RetinaNet [46] and Mask RCNN [47]. Specifically, we use our transformer models to build the backbones of these detectors. All the models are trained under the same setting as in [8]. Since PVT and Swin report their results using different frameworks, we try to make fair comparison and build consistent settings for future methods. Specifically, we report standard $1 \times$ -schedule (12 epochs) detection results on the COCO 2017 dataset [48] in Tables 3 and 4. As for the evaluation based on RetinaNet, we train all the models using AdamW [37] optimizer for 12 epochs with a batch size of 16. The initial learning rate is $1 \times 1 \bar { 0 } ^ { - 4 }$ , started with 500-iteration warmup and decayed by $1 0 \times$ at the 8th and 11th epoch, respectively. We use stochastic drop path regularization of 0.2 and weight decay 0.0001. The implementation is based on MMDetection [49]. For the Mask R-CNN framework, we use the initial learning rate of $2 \times 1 0 ^ { - 4 }$ as in [8]. All other hyper-parameters follow the default settings in MMDetection. As for $3 \times$ experiments, we follow the common multi-scale training in [3, 4], i.e., randomly resizing the input image so that its shorter side is between 480 and 800 while keeping longer one less than 1333. Moreover, for $3 \times$ training of Mask R-CNN, we use an initial learning rate of 0.0001 and weight decay of 0.05 for the whole network as [4].
|
| 110 |
+
|
| 111 |
+
Table 1 – Comparisons with state-of-the-art methods for ImageNet-1K classification. Throughput is tested on the batch size of 192 on a single V100 GPU. All models are trained and evaluated on $2 2 4 \times 2 2 4$ resolution on ImageNet-1K dataset. †: w/ CPVT’s position encodings [9].
|
| 112 |
+
|
| 113 |
+
<table><tr><td>Method</td><td>Param (M)</td><td>FLOPs (G)</td><td>Throughput (Images/s)</td><td>Top-1 (%)</td></tr><tr><td colspan="5">ConvNet</td></tr><tr><td>RegNetY-4G [40]</td><td>21</td><td>4.0</td><td>1157</td><td>80.0</td></tr><tr><td>RegNetY-8G [40]</td><td>39</td><td>8.0</td><td>592</td><td>81.7</td></tr><tr><td>RegNetY-16G [40]</td><td>84</td><td>16.0</td><td>335</td><td>82.9</td></tr><tr><td colspan="5">Transformer</td></tr><tr><td>DeiT-Small/16 [2]</td><td>22.1</td><td>4.6</td><td>437</td><td>79.9</td></tr><tr><td>CrossViT-S [30]</td><td>26.7</td><td>5.6</td><td>-</td><td>81.0</td></tr><tr><td>T2T-ViT-14 [27]</td><td>22</td><td>5.2</td><td></td><td>81.5</td></tr><tr><td>TNT-S [15]</td><td>23.8</td><td>5.2</td><td>=</td><td>81.3</td></tr><tr><td>CoaTMini [17]</td><td>10</td><td>6.8</td><td></td><td>80.8</td></tr><tr><td>CoaT-Lite Small [17]</td><td>20</td><td>4.0</td><td>-</td><td>81.9</td></tr><tr><td>PVT-Small [8]</td><td>24.5</td><td>3.8</td><td>820</td><td>79.8</td></tr><tr><td>CPVT-Small-GAP [9]</td><td>23</td><td>4.6</td><td>817</td><td>81.5</td></tr><tr><td>Twins-PCPVT-S (ours)</td><td>24.1</td><td>3.8</td><td>815</td><td>81.2 (+1.3)</td></tr><tr><td>Swin-T[4]</td><td>29</td><td>4.5</td><td>766</td><td>81.3</td></tr><tr><td>Swin-T + CPVT†</td><td>28</td><td>4.4</td><td>766</td><td>81.2</td></tr><tr><td>Twins-SVT-S (ours)</td><td>24</td><td>2.9</td><td>1059</td><td>81.7 (+1.8)</td></tr><tr><td>T2T-ViT-19 [27]</td><td>39.2</td><td>8.9</td><td>1</td><td>81.9</td></tr><tr><td>PVT-Medium [8]</td><td>44.2</td><td>6.7</td><td>526</td><td>81.2</td></tr><tr><td>Twins-PCPVT-B(ours)</td><td>43.8</td><td>6.7</td><td>525</td><td>82.7 (+0.8)</td></tr><tr><td>Swin-S [4]</td><td>50</td><td>8.7</td><td>444</td><td>83.0</td></tr><tr><td>Twins-SVT-B (ours)</td><td>56</td><td>8.6</td><td>469</td><td>83.2 (+1.3)</td></tr><tr><td>ViT-Base/16 [1]</td><td>86.6</td><td>17.6</td><td>86</td><td>77.9</td></tr><tr><td>DeiT-Base/16 [2]</td><td>86.6</td><td>17.6</td><td>292</td><td>81.8</td></tr><tr><td>T2T-ViT-24[27]</td><td>64.1</td><td>14.1</td><td>1</td><td>82.3</td></tr><tr><td>Cross ViT-B [30]</td><td>104.7</td><td>21.2</td><td>1</td><td>82.2</td></tr><tr><td>TNT-B [15]</td><td>66</td><td>14.1</td><td>=</td><td>82.8</td></tr><tr><td>CPVT-B [9]</td><td>88</td><td>17.6</td><td>292</td><td>82.3</td></tr><tr><td>PVT-Large [8]</td><td>61.4</td><td>9.8</td><td>367</td><td>81.7</td></tr><tr><td>Twins-PCPVT-L(ours)</td><td>60.9</td><td>9.8</td><td>367</td><td>83.1 (+5.2)</td></tr><tr><td>Swin-B [4]</td><td>88</td><td>15.4</td><td>275</td><td>83.3</td></tr><tr><td>Twins-SVT-L (ours)</td><td>99.2</td><td>15.1</td><td>288</td><td>83.7( (+5.8)</td></tr><tr><td colspan="5">Hybrid</td></tr><tr><td>BoTNet-S1-59 [29]</td><td>33.5</td><td>7.3</td><td></td><td>81.7</td></tr><tr><td>BossNet-T1 [41]</td><td>1</td><td>7.9</td><td></td><td>81.9</td></tr><tr><td>CvT-13 [31]</td><td>20</td><td>4.5</td><td></td><td>81.6</td></tr><tr><td>BoTNet-S1-110 [29]</td><td>54.7</td><td>10.9</td><td></td><td>82.8</td></tr><tr><td>CvT-21 [31]</td><td>32</td><td>7.1</td><td>=</td><td>82.5</td></tr></table>
|
| 114 |
+
|
| 115 |
+
For $1 \times$ schedule object detection with RetinaNet, Twins-PCPVT-S surpasses PVT-Small with $2 . 6 \%$ mAP and Twins-PCPVT-B exceeds PVT-Medium by $2 . 4 \%$ mAP on the COCO val2017 split. Twins-SVT-S outperforms Swin-T with $1 . 5 \%$ mAP while using $12 \%$ fewer FLOPs. Our method outperform the others with similar advantage in $3 \times$ experiments.
|
| 116 |
+
|
| 117 |
+
Table 2 – Performance comparisons with different backbones on ADE20K validation dataset. FLOPs are tested on $5 1 2 \times 5 1 2$ resolution. All backbones are pretrained on ImageNet-1k except SETR [45], which is pretrained on ImageNet-21k dataset.
|
| 118 |
+
|
| 119 |
+
<table><tr><td rowspan="2">Backbone</td><td colspan="3">Semantic FPN 80k (PVT [8] setting)</td><td colspan="3">Upernet 160k (Swin [4] setting)</td></tr><tr><td>FLOPs (G)</td><td>Param (M)</td><td>mIoU (%)</td><td>FLOPs (G)</td><td>Param (M)</td><td>mIoU/MS mIoU (%)</td></tr><tr><td>ResNet50 [10]</td><td>45</td><td>28.5</td><td>36.7</td><td></td><td>1</td><td></td></tr><tr><td>PVT-Small [8]</td><td>40</td><td>28.2</td><td>39.8</td><td>1</td><td>-</td><td>=</td></tr><tr><td>Twins-PCPVT-S (ours)</td><td>40</td><td>28.4</td><td>44.3 (+7.6)</td><td>234</td><td>54.6</td><td>46.2/47.5</td></tr><tr><td>Swin-T[4]</td><td>46</td><td>31.9</td><td>41.5</td><td>237</td><td>59.9</td><td>44.5/45.8</td></tr><tr><td>Twins-SVT-S (ours)</td><td>37</td><td>28.3</td><td>43.2( (+6.5)</td><td>228</td><td>54.4</td><td>46.2/47.1</td></tr><tr><td>ResNet101 [10]</td><td>66</td><td>47.5</td><td>38.8</td><td>258</td><td>86</td><td>-/44.9</td></tr><tr><td>PVT-Medium [8]</td><td>55</td><td>48.0</td><td>41.6</td><td>=</td><td>1</td><td></td></tr><tr><td>Twins-PCPVT-B (ours)</td><td>55</td><td>48.1</td><td>44.9 (+6.1)</td><td>250</td><td>74.3</td><td>47.1/48.4</td></tr><tr><td>Swin-S [4]</td><td>70</td><td>53.2</td><td>45.2</td><td>261</td><td>81.3</td><td>47.6/49.5</td></tr><tr><td>Twins-SVT-B (ours)</td><td>67</td><td>60.4</td><td>45.3 (+6.5)</td><td>261</td><td>88.5</td><td>47.7/48.9</td></tr><tr><td>ResNetXt101-64×4d [13]</td><td>1</td><td>86.4</td><td>40.2</td><td>1</td><td>1</td><td>=</td></tr><tr><td>PVT-Large [8]</td><td>71</td><td>65.1</td><td>42.1</td><td>-</td><td>-</td><td>-</td></tr><tr><td>Twins-PCPVT-L (ours)</td><td>71</td><td>65.3</td><td>46.4 (+6.2)</td><td>269</td><td>91.5</td><td>48.6/49.8</td></tr><tr><td>Swin-B [4]</td><td>107</td><td>91.2</td><td>46.0</td><td>299</td><td>121</td><td>48.1/49.7</td></tr><tr><td>Twins-SVT-L (ours)</td><td>102</td><td>103.7</td><td>46.7 (+6.5)</td><td>297</td><td>133</td><td>48.8/50.2</td></tr><tr><td>Backbone</td><td></td><td></td><td>PUP (SETR [45] setting)</td><td colspan="3">MLA (SETR [45] setting)</td></tr><tr><td>T-Large (SETR) [45]</td><td>-</td><td>310</td><td>50.1</td><td>1</td><td>308</td><td>48.6/50.3</td></tr></table>
|
| 120 |
+
|
| 121 |
+
For $1 \times$ object segmentation with the Mask R-CNN framework, Twins-PCPVT-S brings similar improvements $( + 2 . 5 \%$ mAP) over PVT-Small. Compared with PVT-Medium, Twins-PCPVT-B obtains $2 . 6 \%$ higher mAP, which is also on par with that of Swin. Both Twins-SVT-S and Twins-SVTB achieve better or slightly better performance compared to the counterparts of Swin. As for large models, our results are shown in Table 1 (in supplementary) and we also achieve better performance with comparable FLOPs.
|
| 122 |
+
|
| 123 |
+
Table 3 – Object detection performance on the COCO val2017 split using the RetinaNet framework. $1 \times$ is 12 epochs and $3 \times$ is 36 epochs. “MS”: Multi-scale training. FLOPs are evaluated on $8 0 0 \times 6 0 0$ resolution.
|
| 124 |
+
|
| 125 |
+
<table><tr><td rowspan="2">Backbone</td><td rowspan="2">FLOPsParaml (G)</td><td rowspan="2">(M)</td><td>RetinaNet1×</td><td>RetinaNet 3× +MS</td></tr><tr><td>|AP</td><td>AP50 AP75 APs APm APL|AP AP50 AP75APs APm APL</td></tr><tr><td>ResNet50 [10]</td><td>111</td><td>37.7 36.3</td><td>55.3 38.6 19.3 40.0 48.8|39.0</td><td>58.4 41.8 22.4 42.8 51.6</td></tr><tr><td>PVT-Small [8]</td><td>118</td><td>34.2</td><td>61.3 43.0 25.0 42.9 55.7</td><td>62.7 45.0 26.2 45.2 57.2</td></tr><tr><td>Twins-PCPVT-S (ours)</td><td>118</td><td>34.4</td><td>43.0(+6.7) 64.1 46.0 27.5 46.3 57.3</td><td>45.2(+6.2) 66.5 48.6 30.0 48.8 58.9</td></tr><tr><td>Swin-T[4]</td><td>118</td><td>38.5</td><td>62.1 44.2 25.1 44.9 55.5</td><td>43.9 64.8 47.1 28.4 47.2 57.8</td></tr><tr><td>Twins-SVT-S (ours)</td><td>104</td><td>34.3</td><td>43.0(+6.7) 64.2 46.3 28.0 46.4 57.5</td><td>45.6(+6.6) 67.1 48.6 29.8 49.3 60.0</td></tr><tr><td>ResNet101[10]</td><td>149</td><td>56.7</td><td>57.8 41.2 21.4 42.6 51.1</td><td>60.1 44.0 23.7 45.0 53.8</td></tr><tr><td>ResNeXt101-32×4d[13]</td><td>151</td><td>56.4</td><td>59.642.7 22.344.2 52.5</td><td>61.0 44.3 23.9 45.5 53.7</td></tr><tr><td>PVT-Medium [8]</td><td>151</td><td>53.9</td><td>63.1 44.3 25.0 44.9 57.64</td><td>63.8 46.1 27.3 46.3 58.9</td></tr><tr><td>Twins-PCPVT-B (ours)</td><td>151</td><td>54.1</td><td>41.9 44.3(+5.8) ) 65.6 47.3 27.9 47.9 59.64</td><td>43.2 46.4(+5.5) 67.7 49.8 31.3 50.2 61.4 46.3</td></tr><tr><td>Swin-S [4]</td><td>162</td><td>59.8</td><td>44.5 65.7 47.5 27.4 48.0 59.9</td><td>67.4 49.8 31.1 50.3 60.9</td></tr><tr><td>Twins-SVT-B (ours)</td><td>163</td><td>67.0</td><td>45.3(+6.8) 66.7 48.1 28.5 48.9 60.646.9(+6.0)</td><td>68.0 50.2 31.7 50.3 61.8</td></tr></table>
|
| 126 |
+
|
| 127 |
+
# 4.4 Ablation Studies
|
| 128 |
+
|
| 129 |
+
Configurations of LSA and GSA blocks. We evaluate different combinations of LSA and GSA based on our small model and present the ablation results in Table 5. The models with only locally-grouped attention fail to obtain good performance $( 7 6 . 9 \% )$
|
| 130 |
+
|
| 131 |
+
Table 5 – Classification performance for different combinations of LSA (L) and GSA (G) blocks based on the small model.
|
| 132 |
+
|
| 133 |
+
<table><tr><td>Function Type</td><td>Params (M)</td><td>FLOPs (G)</td><td>Top-1 (%)</td></tr><tr><td>(L,L,L)</td><td>8.8</td><td>2.2</td><td>76.9</td></tr><tr><td>(L, LLG, LLG, G)</td><td>23.5</td><td>2.8</td><td>81.5</td></tr><tr><td>(L, LG, LG, G)</td><td>24.1</td><td>2.8</td><td>81.7</td></tr><tr><td>(L,L,L, G)</td><td>22.2</td><td>2.9</td><td>80.5</td></tr><tr><td>PVT-small(G, G, G, G) [8]</td><td>24.5</td><td>3.8</td><td>79.8</td></tr></table>
|
| 134 |
+
|
| 135 |
+
Table 4 – Object detection and instance segmentation performance on the COCO val2017 dataset using the Mask R-CNN framework. FLOPs are evaluated on a $8 0 0 \times 6 0 0$ image.
|
| 136 |
+
|
| 137 |
+
<table><tr><td rowspan="2">Backbone</td><td rowspan="2">FLOPsParaml (G)</td><td rowspan="2">(M)</td><td colspan="3">Mask R-CNN 1×</td><td colspan="3">Mask R-CNN3× +MS</td></tr><tr><td>|APb</td><td>AP0APAPm</td><td>APAP|APb</td><td></td><td></td><td>AP0APP APm APAPP</td></tr><tr><td>ResNet50 [10]</td><td>174</td><td>44.2</td><td>38.0</td><td>58.6 41.4 34.4</td><td>55.1 36.741.0</td><td></td><td></td><td>61.7 44.9 37.1 58.4 40.1</td></tr><tr><td>PVT-Small [8]</td><td>178</td><td>44.1</td><td>40.4</td><td>62.9 43.8 37.8</td><td>60.1 40.343.0</td><td></td><td></td><td>65.3 46.9 39.9 62.5 42.8</td></tr><tr><td>Twins-PCPVT-S (ours)</td><td>178</td><td>44.3</td><td>42.9(+4.9)</td><td>65.8 47.1 40.0(+5.6)</td><td>62.742.9</td><td></td><td>46.8(+5.8)</td><td>69.3 51.8 42.6 66.3 46.0</td></tr><tr><td>Swin-T[4]</td><td>177</td><td>47.8</td><td>42.2</td><td>64.6 46.2 39.1</td><td></td><td>61.6 42.0 46.0</td><td></td><td>68.2 50.2 41.6 65.1 44.8</td></tr><tr><td>Twins-SVT-S (ours)</td><td>164</td><td>44.0</td><td>43.4(+5.4)</td><td>66.0 47.3 40.3(+5.9)</td><td>63.243.4</td><td></td><td>46.8(+5.8)</td><td>69.2 51.2 42.6 66.3 45.8</td></tr><tr><td>ResNet101[10]</td><td>210</td><td>63.2</td><td>40.4</td><td>61.1 44.2 36.4</td><td></td><td>57.7 38.842.8</td><td></td><td>63.2 47.1 38.5 60.1 41.3</td></tr><tr><td>ResNeXt101-32×4d[13]</td><td>212</td><td>62.8</td><td>41.9</td><td>62.5 45.9 37.5</td><td></td><td>59.4 40.2 44.0</td><td></td><td>64.4 48.0 39.2 61.4 41.9</td></tr><tr><td>PVT-Medium [8]</td><td>211</td><td>63.9</td><td>42.0</td><td>64.4 45.6 39.0</td><td>61.6 42.1</td><td>44.2</td><td></td><td>66.0 48.2 40.5 63.1 43.5</td></tr><tr><td>Twins-PCPVT-B (ours)</td><td>211</td><td>64.0</td><td>44.6(+4.2)</td><td>66.7 48.9 40.9(+4.5)</td><td></td><td>63.844.2</td><td>47.9(+5.1) 70.1</td><td>52.5 43.2 67.2 46.3</td></tr><tr><td>Swin-S [4]</td><td>222</td><td>69.1</td><td>44.8</td><td>66.6 48.9 40.9</td><td></td><td>63.4 44.2 47.6</td><td></td><td>69.4 52.5 42.8 66.5 46.4</td></tr><tr><td>Twins-SVT-B (ours)</td><td>224</td><td>76.3</td><td>45.2(+4.8)</td><td>67.6 49.3 41.5(+5.1) </td><td>64.5 44.8</td><td></td><td>48.0(+5.2)</td><td>69.5 52.7 43.0 66.8 46.6</td></tr></table>
|
| 138 |
+
|
| 139 |
+
because this setting has a limited and small receptive field. An extra global attention layer in the last stage can improve the classification performance by $3 . 6 \%$ . Local-Local-Global (abbr. LLG) also achieves good performance $( 8 1 . 5 \% )$ , but we do not use this design in this work.
|
| 140 |
+
|
| 141 |
+
Sub-sampling functions. We further study how the different sub-sampling functions affect the performance. Specifically, we compare the regular strided convolutions, separable convolutions and average pooling based on the ‘small’ model and present the results in Table 6. The first option performs best and therefore we choose it as our default implementation.
|
| 142 |
+
|
| 143 |
+
Table 6 – ImageNet classification performance of different forms of sub-sampled functions for the global sub-sampled attention (GSA).
|
| 144 |
+
|
| 145 |
+
<table><tr><td>Function Type</td><td>Top-1(%)</td></tr><tr><td>2D Conv.</td><td>81.7</td></tr><tr><td>2D Separable Conv.</td><td>81.2</td></tr><tr><td>Average Pooling</td><td>81.2</td></tr></table>
|
| 146 |
+
|
| 147 |
+
sitional Encodings. We replace the relative positional encoding with CPVT for Swin-T and report the detection performance on COCO with RetinaNet and Mask R-CNN in Table 7. The CPVT-based Swin cannot achieve improved performance with both frameworks, which indicates that our performance improvements should be owing to the paradigm of Twins-SVT instead of the positional encodings.
|
| 148 |
+
|
| 149 |
+
Table 7 – Object detection performance on the COCO using different positional encoding strategies.
|
| 150 |
+
|
| 151 |
+
<table><tr><td rowspan="2">Backbone</td><td colspan="4">RetinaNet</td><td colspan="6">Mask RCNN</td></tr><tr><td>FLOPs(G)</td><td>Param(M) AP</td><td></td><td>AP50</td><td>AP75</td><td>FLOPs(G)</td><td>Param(M)</td><td>AP</td><td>AP50</td><td>AP75</td></tr><tr><td>Swin-T[4]]</td><td>245</td><td>38.5</td><td>41.5</td><td>62.1</td><td>44.2</td><td>264</td><td>47.8</td><td>42.2</td><td>64.6</td><td>46.2</td></tr><tr><td>Swin-T+CPVT</td><td>245</td><td>38.5</td><td>41.3</td><td>62.4</td><td>44.1</td><td>263</td><td>47.8</td><td>42.0</td><td>64.5</td><td>45.9</td></tr></table>
|
| 152 |
+
|
| 153 |
+
# 5 Conclusion
|
| 154 |
+
|
| 155 |
+
In this paper, we have presented two powerful vision transformer backbones for both image-level classification and a few downstream dense prediction tasks. We dub them as twin transformers: Twins-PCPVT and Twins-SVT. The former variant explores the applicability of conditional positional encodings [9] in pyramid vision transformer [8], confirming its potential for improving backbones in many vision tasks. In the latter variant we revisit current attention design to proffer a more efficient attention paradigm. We find that interleaving local and global attention can produce impressive results, yet it comes with higher throughputs. Both transformer models set a new state of the art in image classification, objection detection and semantic/instance segmentation.
|
| 156 |
+
|
| 157 |
+
# References
|
| 158 |
+
|
| 159 |
+
[1] Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, Jakob Uszkoreit, and Neil Houlsby. An image is worth 16x16 words: Transformers for image recognition at scale. In Proc. Int. Conf. Learn. Representations, 2021.
|
| 160 |
+
[2] Hugo Touvron, Matthieu Cord, Matthijs Douze, Francisco Massa, Alexandre Sablayrolles, and Hervé Jégou. Training data-efficient image transformers & distillation through attention. arXiv preprint arXiv:2012.12877, 2020. [3] Nicolas Carion, Francisco Massa, Gabriel Synnaeve, Nicolas Usunier, Alexander Kirillov, and Sergey Zagoruyko. End-to-end object detection with transformers. In Proc. Eur. Conf. Comp. Vis., pages 213–229. Springer, 2020.
|
| 161 |
+
[4] 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. In Proc. IEEE Int. Conf. Comp. Vis., pages 10012–10022, 2021. [5] Liang-Chieh Chen, George Papandreou, Iasonas Kokkinos, Kevin Murphy, and Alan L Yuille. Deeplab: Semantic image segmentation with deep convolutional nets, atrous convolution, and fully connected crfs. IEEE Trans. Pattern Anal. Mach. Intell., 40(4):834–848, 2017. [6] Chao Peng, Xiangyu Zhang, Gang Yu, Guiming Luo, and Jian Sun. Large kernel matters– improve semantic segmentation by global convolutional network. In Proc. IEEE Conf. Comp. Vis. Patt. Recogn., pages 4353–4361, 2017.
|
| 162 |
+
[7] Wei Liu, Andrew Rabinovich, and Alexander C Berg. Parsenet: Looking wider to see better. arXiv preprint arXiv:1506.04579, 2015. [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 preprint arXiv:2102.12122, 2021. [9] Xiangxiang Chu, Zhi Tian, Bo Zhang, Xinlong Wang, Xiaolin Wei, Huaxia Xia, and Chunhua Shen. Conditional positional encodings for vision transformers. arXiv preprint arXiv:2102.10882, 2021.
|
| 163 |
+
[10] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In Proc. IEEE Conf. Comp. Vis. Patt. Recogn., pages 770–778, 2016.
|
| 164 |
+
[11] Mingxing Tan and Quoc Le. Efficientnet: Rethinking model scaling for convolutional neural networks. In Proc. Int. Conf. Mach. Learn., pages 6105–6114. PMLR, 2019.
|
| 165 |
+
[12] François Chollet. Xception: Deep learning with depthwise separable convolutions. In Proc. IEEE Conf. Comp. Vis. Patt. Recogn., pages 1251–1258, 2017.
|
| 166 |
+
[13] Saining Xie, Ross Girshick, Piotr Dollár, Zhuowen Tu, and Kaiming He. Aggregated residual transformations for deep neural networks. In Proc. IEEE Conf. Comp. Vis. Patt. Recogn., pages 1492–1500, 2017.
|
| 167 |
+
[14] Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. In Proc. Advances in Neural Inf. Process. Syst., pages 6000–6010, 2017.
|
| 168 |
+
[15] Kai Han, An Xiao, Enhua Wu, Jianyuan Guo, Chunjing Xu, and Yunhe Wang. Transformer in transformer. arXiv preprint arXiv:2103.00112, 2021.
|
| 169 |
+
[16] Prajit Ramachandran, Niki Parmar, Ashish Vaswani, Irwan Bello, Anselm Levskaya, and Jon Shlens. Stand-alone self-attention in vision models. In Proc. Advances in Neural Inf. Process. Syst., volume 32, pages 68–80, 2019.
|
| 170 |
+
[17] Weijian Xu, Yifan Xu, Tyler Chang, and Zhuowen Tu. Co-scale conv-attentional image transformers, 2021.
|
| 171 |
+
[18] Yuqing Wang, Zhaoliang Xu, Xinlong Wang, Chunhua Shen, Baoshan Cheng, Hao Shen, and Huaxia Xia. End-to-end video instance segmentation with transformers. In Proc. IEEE Conf. Comp. Vis. Patt. Recogn., 2021.
|
| 172 |
+
[19] 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 preprint arXiv:2012.00364, 2020.
|
| 173 |
+
[20] Fuzhi Yang, Huan Yang, Jianlong Fu, Hongtao Lu, and Baining Guo. Learning texture transformer network for image super-resolution. In Proc. IEEE Conf. Comp. Vis. Patt. Recogn., pages 5791–5800, 2020.
|
| 174 |
+
[21] Yanhong Zeng, Jianlong Fu, and Hongyang Chao. Learning joint spatial-temporal transformations for video inpainting. In Proc. Eur. Conf. Comp. Vis., pages 528–543. Springer, 2020.
|
| 175 |
+
[22] Zhigang Dai, Bolun Cai, Yugeng Lin, and Junying Chen. UP-DETR: Unsupervised pre-training for object detection with transformers. arXiv preprint arXiv:2011.09094, 2020.
|
| 176 |
+
[23] Aravind Srinivas, Tsung-Yi Lin, Niki Parmar, Jonathon Shlens, Pieter Abbeel, and Ashish Vaswani. Bottleneck transformers for visual recognition. arXiv: Comp. Res. Repository, 2021.
|
| 177 |
+
[24] 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. arXiv preprint arXiv:2012.15840, 2020.
|
| 178 |
+
[25] Niki Parmar, Ashish Vaswani, Jakob Uszkoreit, Lukasz Kaiser, Noam Shazeer, Alexander Ku, and Dustin Tran. Image transformer. In Proc. Int. Conf. Mach. Learn., volume 80, pages 4055–4064, 2018.
|
| 179 |
+
[26] Hugo Touvron, Matthieu Cord, Alexandre Sablayrolles, Gabriel Synnaeve, and Hervé Jégou. Going deeper with image transformers. arXiv preprint arXiv:2103.17239, 2021.
|
| 180 |
+
[27] Li Yuan, Yunpeng Chen, Tao Wang, Weihao Yu, Yujun Shi, Francis Tay, Jiashi Feng, and Shuicheng Yan. Tokens-to-token ViT: Training vision transformers from scratch on imagenet. arXiv preprint arXiv:2101.11986, 2021.
|
| 181 |
+
[28] Zihang Jiang, Qibin Hou, Li Yuan, Daquan Zhou, Xiaojie Jin, Anran Wang, and Jiashi Feng. Token labeling: Training an $8 5 . 4 \%$ top-1 accuracy vision transformer with 56M parameters on ImageNet. arXiv: Comp. Res. Repository, 2021.
|
| 182 |
+
[29] Aravind Srinivas, Tsung-Yi Lin, Niki Parmar, Jonathon Shlens, Pieter Abbeel, and Ashish Vaswani. Bottleneck transformers for visual recognition. arXiv preprint arXiv:2101.11605, 2021.
|
| 183 |
+
[30] Chun-Fu Chen, Quanfu Fan, and Rameswar Panda. CrossViT: Cross-attention multi-scale vision transformer for image classification. arXiv preprint arXiv:2103.14899, 2021.
|
| 184 |
+
[31] Haiping Wu, Bin Xiao, Noel Codella, Mengchen Liu, Xiyang Dai, Lu Yuan, and Lei Zhang. CvT: Introducing convolutions to vision transformers. arXiv: Comp. Res. Repository, 2021.
|
| 185 |
+
[32] Xizhou Zhu, Weijie Su, Lewei Lu, Bin Li, Xiaogang Wang, and Jifeng Dai. Deformable detr: Deformable transformers for end-to-end object detection. In Proc. Int. Conf. Learn. Representations, 2021.
|
| 186 |
+
[33] Tsung-Yi Lin, Piotr Dollár, Ross Girshick, Kaiming He, Bharath Hariharan, and Serge Belongie. Feature pyramid networks for object detection. In Proc. IEEE Conf. Comp. Vis. Patt. Recogn., pages 2117–2125, 2017.
|
| 187 |
+
[34] Yuhui Yuan, Lang Huang, Jianyuan Guo, Chao Zhang, Xilin Chen, and Jingdong Wang. OCNet: Object context network for scene parsing. arXiv: Comp. Res. Repository, 2021.
|
| 188 |
+
[35] Alex Krizhevsky, Ilya Sutskever, and Geoffrey E. Hinton. ImageNet classification with deep convolutional neural networks. In Proc. Advances in Neural Inf. Process. Syst., volume 25, pages 1097–1105, 2012.
|
| 189 |
+
[36] Laurent Sifre and Stéphane Mallat. Rigid-motion scattering for texture classification. arXiv preprint arXiv:1403.1687, 2014.
|
| 190 |
+
[37] Ilya Loshchilov and Frank Hutter. Decoupled weight decay regularization. In Proc. Int. Conf. Learn. Representations, 2019.
|
| 191 |
+
[38] Gao Huang, Yu Sun, Zhuang Liu, Daniel Sedra, and Kilian Weinberger. Deep networks with stochastic depth. In Proc. Eur. Conf. Comp. Vis., pages 646–661. Springer, 2016.
|
| 192 |
+
[39] 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.
|
| 193 |
+
[40] Ilija Radosavovic, Raj Prateek Kosaraju, Ross Girshick, Kaiming He, and Piotr Dollár. Designing network design spaces. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 10428–10436, 2020.
|
| 194 |
+
[41] Changlin Li, Tao Tang, Guangrun Wang, Jiefeng Peng, Bing Wang, Xiaodan Liang, and Xiaojun Chang. Bossnas: Exploring hybrid cnn-transformers with block-wisely self-supervised neural architecture search. arXiv preprint arXiv:2103.12424, 2021.
|
| 195 |
+
[42] Bolei Zhou, Hang Zhao, Xavier Puig, Sanja Fidler, Adela Barriuso, and Antonio Torralba. Scene parsing through ADE20k dataset. In Proc. IEEE Conf. Comp. Vis. Patt. Recogn., pages 633–641, 2017.
|
| 196 |
+
[43] Alexander Kirillov, Ross Girshick, Kaiming He, and Piotr Dollár. Panoptic feature pyramid networks. In Proc. IEEE Conf. Comp. Vis. Patt. Recogn., pages 6399–6408, 2019.
|
| 197 |
+
[44] Tete Xiao, Yingcheng Liu, Bolei Zhou, Yuning Jiang, and Jian Sun. Unified perceptual parsing for scene understanding. In Proceedings of the European Conference on Computer Vision (ECCV), pages 418–434, 2018.
|
| 198 |
+
[45] Sixiao Zheng, Jiachen Lu, Hengshuang Zhao, Xiatian Zhu, Zekun Luo, Yabiao Wang, Yanwei Fu, Jianfeng Feng, Tao Xiang, Philip H.S. Torr, and Li Zhang. Rethinking semantic segmentation from a sequence-to-sequence perspective with transformers. In CVPR, 2021.
|
| 199 |
+
[46] Tsung-Yi Lin, Priya Goyal, Ross Girshick, Kaiming He, and Piotr Dollár. Focal loss for dense object detection. In Proc. IEEE Int. Conf. Comp. Vis., pages 2980–2988, 2017.
|
| 200 |
+
[47] Kaiming He, Georgia Gkioxari, Piotr Dollár, and Ross Girshick. Mask R-CNN. In Proc. IEEE Int. Conf. Comp. Vis., pages 2961–2969, 2017.
|
| 201 |
+
[48] Tsung-Yi Lin, Michael Maire, Serge Belongie, James Hays, Pietro Perona, Deva Ramanan, Piotr Dollár, and C Lawrence Zitnick. Microsoft coco: Common objects in context. In Proc. Eur. Conf. Comp. Vis., pages 740–755, 2014.
|
| 202 |
+
[49] Kai Chen, Jiaqi Wang, Jiangmiao Pang, Yuhang Cao, Yu Xiong, Xiaoxiao Li, Shuyang Sun, Wansen Feng, Ziwei Liu, Jiarui Xu, Zheng Zhang, Dazhi Cheng, Chenchen Zhu, Tianheng Cheng, Qijie Zhao, Buyu Li, Xin Lu, Rui Zhu, Yue Wu, Jifeng Dai, Jingdong Wang, Jianping Shi, Wanli Ouyang, Chen Change Loy, and Dahua Lin. MMDetection: Open MMLab detection toolbox and benchmark. arXiv preprint arXiv:1906.07155, 2019.
|
md/train/7aogOj_VYO0/7aogOj_VYO0.md
ADDED
|
@@ -0,0 +1,475 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# DO NOT LET PRIVACY OVERBILL UTILITY: GRADIENT EMBEDDING PERTURBATION FOR PRIVATE LEARNING
|
| 2 |
+
|
| 3 |
+
Da $\mathbf { V } \mathbf { u } ^ { 1 , 2 , * }$ , Huishuai Zhang2,∗, Wei Chen2, Tie-Yan Liu2
|
| 4 |
+
1School of Computer Science and Engineering, Sun Yat-sen University
|
| 5 |
+
2Microsoft Research Asia
|
| 6 |
+
1yuda3@mail2.sysu.edu.cn
|
| 7 |
+
2{huzhang,wche,tyliu}@microsoft.com
|
| 8 |
+
|
| 9 |
+
# ABSTRACT
|
| 10 |
+
|
| 11 |
+
The privacy leakage of the model about the training data can be bounded in the differential privacy mechanism. However, for meaningful privacy parameters, a differentially private model degrades the utility drastically when the model comprises a large number of trainable parameters. In this paper, we propose an algorithm Gradient Embedding Perturbation (GEP) towards training differentially private deep models with decent accuracy. Specifically, in each gradient descent step, GEP first projects individual private gradient into a non-sensitive anchor subspace, producing a low-dimensional gradient embedding and a small-norm residual gradient. Then, GEP perturbs the low-dimensional embedding and the residual gradient separately according to the privacy budget. Such a decomposition permits a small perturbation variance, which greatly helps to break the dimensional barrier of private learning. With GEP, we achieve decent accuracy with reasonable computational cost and modest privacy guarantee for deep models. Especially, with privacy bound $\epsilon = 8$ , we achieve $7 4 . 9 \%$ test accuracy on CIFAR10 and $9 5 . 1 \%$ test accuracy on SVHN, significantly improving over existing results.
|
| 12 |
+
|
| 13 |
+
# 1 INTRODUCTION
|
| 14 |
+
|
| 15 |
+
Recent works have shown that the trained model may leak/memorize the information of its training set (Fredrikson et al., 2015; Wu et al., 2016; Shokri et al., 2017; Hitaj et al., 2017), which raises privacy issue when the models are trained with sensitive data. Differential privacy (DP) mechanism provides a way to quantitatively measure and upper bound such information leakage. It theoretically ensures that the influence of any individual sample is negligible with the DP parameter $\epsilon$ or $( \epsilon , \delta )$ . Moreover, it has been observed that differentially private models can also resist model inversion attack (Carlini et al., 2019), membership inference attack (Rahman et al., 2018; Bernau et al., 2019; Sablayrolles et al., 2019; Yu et al., 2021), gradient matching attack (Zhu et al., 2019), and data poisoning attack (Ma et al., 2019).
|
| 16 |
+
|
| 17 |
+
One popular way to achieve differentially private machine learning is to perturb the training process with noise (Song et al., 2013; Bassily et al., 2014; Shokri & Shmatikov, 2015; Wu et al., 2017; Fukuchi et al., 2017; Iyengar et al., 2019; Phan et al., 2020). Specifically, gradient perturbation perturbs the gradient at each iteration of (stochastic) gradient descent algorithm and guarantees the privacy of the final model via composition property of DP. It is worthy to note that gradient perturbation does not assume (strongly) convex objective and hence is applicable to various settings (Abadi et al., 2016; Wang et al., 2017; Lee & Kifer, 2018; Jayaraman et al., 2018; Wang & Gu, 2019; Yu et al., 2020). Specifically, for given gradient sensitivity $S$ , a general form of gradient perturbation is to add an isotropic Gaussian noise $_ z$ to the gradient $\pmb { g } \in \mathbb { R } ^ { p }$ independently for each step,
|
| 18 |
+
|
| 19 |
+
$$
|
| 20 |
+
\tilde { \pmb g } = \pmb g + \pmb z , \mathrm { w h e r e } \ z \sim \mathcal N ( 0 , \sigma ^ { 2 } S ^ { 2 } \pmb { I } _ { p \times p } ) .
|
| 21 |
+
$$
|
| 22 |
+
|
| 23 |
+
One can set proper variance $\sigma ^ { 2 }$ to make each update differentially private with parameter $( \epsilon , \delta )$ . It is easy to see that the intensity of the added noise $\mathbb { E } [ \| z \| ^ { 2 } ]$ scales linearly with the model dimension $p$
|
| 24 |
+
|
| 25 |
+

|
| 26 |
+
Figure 1: Noise norm vs gradient norm of ResNet20 at initialization. The noise variance is chosen such that SGD satisfies $( 5 , 1 0 ^ { - 5 } )$ -DP after 90 epochs in Abadi et al. (2016).
|
| 27 |
+
|
| 28 |
+

|
| 29 |
+
Figure 2: Stable rank $\| \cdot \| _ { F } ^ { 2 } / \| \cdot \| ^ { 2 }$ (Tropp et al., 2015) of batch gradient matrix of given groups (with $p$ parameters). The setting is ResNet20 on CIFAR-10. The stable rank is small throughout training.
|
| 30 |
+
|
| 31 |
+
This indicates that as the model becomes larger, the useful signal, i.e., gradient, would be submerged in the added noise (see Figure 1). This dimensional barrier restricts the utility of deep learning models trained with gradient perturbation.
|
| 32 |
+
|
| 33 |
+
The dimensional barrier is attributed to the fact that the added noise is isotropic while the gradients live on a very low dimensional manifold, which has been observed in (Gur-Ari et al., 2018; Vogels et al., 2019; Gooneratne et al., 2020; Li et al., 2020) and is also verified in Figure 2 for the gradients of a 20-layer ResNet (He et al., 2016). Hence to limit the noise energy, it is natural to think
|
| 34 |
+
|
| 35 |
+
“Can we reduce the dimension of gradients first and then add the isotropic noise onto a low-dimensional gradient embedding?"
|
| 36 |
+
|
| 37 |
+
The answer is affirmative. We propose a new algorithm Gradient Embedding Perturbation (GEP), illustrated in Figure 3. Specifically, we first compute anchor gradients on some non-sensitive auxiliary data, and identify an anchor subspace that is spanned by several top principal components of the anchor gradient matrix. Then we project the private gradients into the anchor subspace and obtain low-dimensional gradient embeddings and small-norm residual gradients. Finally, we perturb the gradient embedding and residual gradient separately according to the sensitivities and privacy budget.
|
| 38 |
+
|
| 39 |
+
We intuitively argue why GEP could reduce the perturbation variance and achieve good utility for large models. First, because the gradient embedding has a very low dimension, the added isotropic noise on embedding has small energy that scales linearly only with the subspace dimension. Second, if the anchor subspace can cover most of the gradient information, the residual gradient, though high dimensional, should have small magnitude, which permits smaller added noise to guarantee the same level privacy because of the reduced sensitivity. Overall, we can use a much lower perturbation compared with the original gradient perturbation to guarantee the same level of privacy.
|
| 40 |
+
|
| 41 |
+
We emphasize several properties of GEP. First, the non-sensitive auxiliary data assumption is weak. In fact, GEP only requires a small number of non-sensitive unlabeled data following a similar feature distribution as the private data, which often exist even for learning on sensitive data. In our experiments, we use a few unlabeled samples from ImageNet to serve as auxiliary data for MNIST, SVHN, and CIFAR-10. This assumption is much weaker than the public data assumption in previous works (Papernot et al., 2017; 2018; Alon et al., 2019; Wang & Zhou, 2020), where the public data should follow exactly the same distribution as the private data. Second, GEP produces an unbiased estimator of the target gradient because of releasing both the perturbed gradient embedding and the perturbed residual gradient, which turns out to be critical for good utility. Third, we use power method to estimate the principal components of anchor gradients, achievable with a few matrix multiplications. The fact that GEP is not sensitive to the choices of subspace dimension further allows a very efficient implementation.
|
| 42 |
+
|
| 43 |
+
Compared with existing works of differentially private machine learning, our contribution can be summarized as follows: (1) we propose a novel algorithm GEP that achieves good utility for large models with modest differential privacy guarantee; (2) we show that GEP returns an unbiased estimator of target private gradient with much lower perturbation variance than original gradient perturbation; (3) we demonstrate that GEP achieves state-of-the-art utility in differentially private learning with three benchmark datasets. Specifically, for $\epsilon = 8$ , GEP achieves $7 4 . 9 \%$ test accuracy on CIFAR-10 with a ResNet20 model. To the best of our knowledge, GEP is the first algorithm that can achieve such utility with training deep models from scratch for a “single-digit" privacy budget1.
|
| 44 |
+
|
| 45 |
+

|
| 46 |
+
Figure 3: Overview of the proposed GEP approach. 1) We estimate an anchor subspace on some non-sensitive data; 2) We project the private gradients into the anchor subspace, producing lowdimensional embeddings and residual gradients; 3) We perturb the gradient embedding and residual gradient separately to guarantee differential privacy. The auxiliary data are only required to share similar features as the private data. In our experiments, we use 2000 images from ImageNet as auxiliary data for MNIST, SVHN, and CIFAR-10 datasets.
|
| 47 |
+
|
| 48 |
+
# 1.1 RELATED WORK
|
| 49 |
+
|
| 50 |
+
Existing works studying differentially private machine learning in high-dimensional setting can be roughly categorized into two sets. One is treating the optimization of the machine learning objective as a whole mechanism and adding noise into this process. The other one is based on the knowledge transfer of machine learning models, which trains a differentially private publishable student model with private signals from teacher models. We review them one by one.
|
| 51 |
+
|
| 52 |
+
Differentially private convex optimization in high-dimensional setting has been studied extensively over the years (Kifer et al., 2012; Thakurta & Smith, 2013; Talwar et al., 2015; Wang & Xu, 2019; Wang & Gu, 2019). Although these methods demonstrate good utility on some convex settings, their analyses can not be directly applied to non-convex setting. Right before the submission, we note two independent and concurrent works (Zhou et al., 2020; Kairouz et al., 2020) that also leverage the gradient redundancy to reduce the added noise. Specifically, Kairouz et al. (2020) track historical gradients to do dimension reduction for private AdaGrad. Zhou et al. (2020) requires gradients on some public data and then project the noisy gradients into a public subspace at each update. One core difference between these two works and GEP is that we introduce residual gradient perturbation and GEP produces an unbiased estimator of the private gradients, which is essential for achieving the superior utility. Moreover, we weaken the auxiliary data assumption and introduce several designs that significantly boost the efficiency and applicability of GEP.
|
| 53 |
+
|
| 54 |
+
One recent progress towards training arbitrary models with differential privacy is Private Aggregation of Teacher Ensembles (PATE) (Papernot et al., 2017; 2018; Jordon et al., 2019). PATE first trains independent teacher models on disjoint shards of private data. Then it trains a student model with privacy guarantee by distilling noisy predictions of teacher models on some public samples. In comparison, GEP only requires some non-sensitive data that have similar natural features as the private data while PATE requires the public data follow exactly the same distribution as the private data and in practice it uses a portion of the test data to serve as public data. Moreover, GEP demonstrates better performance than PATE especially for complex datasets, e.g., CIFAR-10, because GEP can train the model with the whole private data rather than a small shard of data.
|
| 55 |
+
|
| 56 |
+
# 2 PRELIMINARIES
|
| 57 |
+
|
| 58 |
+
We introduce some notations and definitions. We use bold lowercase letters, e.g., $\textbf { { v } }$ , and bold capital letters, e.g., $M$ , to denote vectors and matrices, respectively. The $L ^ { 2 }$ norm of a vector $\textbf { { v } }$ is denoted by $\| \pmb { v } \|$ . The spectral norm and the Frobenius norm of a matrix $M$ are denoted by $\lVert M \rVert$ and $\| M \| _ { F }$ respectively. A sample $d = ( \pmb { x } , y )$ consists of feature $_ { \textbf { \em x } }$ and label $y$ . A dataset $\mathbb { D }$ is a collection of individual samples. A dataset $\mathbb { D } ^ { \prime }$ is said to be a neighboring dataset of $\mathbb { D }$ if they differ in a single sample, denoted as $\mathbb { D } \sim \mathbb { D } ^ { \prime }$ . Differential privacy ensures that the outputs of an algorithm on neighboring datasets have approximately indistinguishable distributions.
|
| 59 |
+
|
| 60 |
+
Definition 1 $( \epsilon , \delta )$ -DP (Dwork et al., 2006a;b)). A randomized mechanism $\mathcal { M }$ guarantees $( \epsilon , \delta )$ - differential privacy if for any two neighboring input datasets $\mathbb { D } \sim \mathbb { D } ^ { \prime }$ and for any subset of outputs $S$ it holds that $P r [ \mathcal { M } ( \mathbb { D } ) \in S ] \leq e ^ { \epsilon } P r [ \mathcal { M } ( \mathbb { D } ^ { ' } ) \in S ] + \delta$ .
|
| 61 |
+
|
| 62 |
+
By its definition, $( \epsilon , \delta )$ -DP controls the maximum influence that any individual sample can produce. One can adjust the privacy parameters to trade off between privacy and utility. Differential privacy is immune to post-processing (Dwork et al., 2014), i.e., any function applied on the output of a differentially private algorithm would not increase the privacy loss as long as it does not have new interaction with the private dataset. Differential privacy also allows composition, i.e., the composition of a series of differentially private mechanisms is also differentially private but with different parameters. Several variants of $( \epsilon , \delta )$ -DP have been proposed (Bun & Steinke, 2016; Dong et al., 2019) to address certain weakness of $( \epsilon , \delta )$ -DP, e.g., they achieve better composition property. In this work, we use Rényi differential privacy (Mironov, 2017) to track the privacy loss and then convert it to $( \epsilon , \delta )$ -DP.
|
| 63 |
+
|
| 64 |
+
Suppose that there is a private dataset $\mathbb { D } = \{ ( \boldsymbol { x } _ { i } , y _ { i } ) \} _ { i = 1 } ^ { n }$ with $n$ samples. We want to train a model $f$ to learn the mapping in $\mathbb { D }$ . Specifically, $f$ takes $_ { \textbf { \em x } }$ as input and outputs a label $y$ , and $f$ has parameter $\theta \in \mathbb { R } ^ { p }$ . The training objective is to minimize an empirical risk $\begin{array} { r } { \dot { \frac { 1 } { n } } \sum _ { i = 1 } ^ { n } \ell ( \dot { f } ( \pmb { x } _ { i } ) , \dot { y } _ { i } ) , } \end{array}$ , where $\ell ( \cdot , \cdot )$ is a loss function. We further assume that there is an auxiliary dataset $\mathbb { D } ^ { ( a ) } = \{ ( \tilde { \pmb { x } } _ { j } , \tilde { \pmb { y } } _ { j } ) \} _ { j = 1 } ^ { m }$ that $\tilde { \pmb x }$ shares similar features as $_ { \textbf { \em x } }$ in $\mathbb { D }$ while $\tilde { y }$ could be random.
|
| 65 |
+
|
| 66 |
+
# 3 GRADIENT EMBEDDING PERTURBATION
|
| 67 |
+
|
| 68 |
+
An overview of GEP is given in Figure 3. GEP has three major ingredients: 1) first, estimate an anchor subspace that contains the principal components of some non-sensitive anchor gradients via power method; 2) then, project private gradients into the anchor subspace and produce low-dimensional embeddings of private gradients and residual gradients; 3) finally, perturb gradient embedding and residual gradient separately to establish differential privacy guarantee. In Section 3.1, we present the GEP algorithm in detail. In Section 3.2, we given an analysis on the residual gradients. In Section 3.3, we give a differentially private learning algorithm that updates the model with the output of GEP.
|
| 69 |
+
|
| 70 |
+
# 3.1 THE GEP ALGORITHM AND ITS PRIVACY ANALYSIS
|
| 71 |
+
|
| 72 |
+
The pseudocode of GEP is presented in Algorithm 1. For convenience, we write a set of gradients and a set of basis vectors as matrices with each row being one gradient/basis vector.
|
| 73 |
+
|
| 74 |
+
The anchor subspace is constructed as follows. We first compute the gradients of the model on an auxiliary dataset $\mathbb { D } ^ { ( a ) }$ with $m$ samples, which is referred to as the anchor gradients $G ^ { ( a ) } \in \mathbb { R } ^ { m \times p }$ We then use the power method to estimate the principal components of $G ^ { ( a ) }$ to construct a subspace basis $\boldsymbol { B } \in \mathbb { R } ^ { k \times \hat { p } }$ , which is referred to as the anchor subspace. All these matrices are publishable because $\mathbb { D } ^ { ( a ) }$ is non-sensitive. We expect that the anchor subspace $\textbf { { B } }$ can cover most energy of private gradients when the auxiliary data are not far from private data and $m , k$ are reasonably large.
|
| 75 |
+
|
| 76 |
+
Suppose that the private gradients are $G \in \mathbb { R } ^ { n \times p }$ . Then, we project the private gradients into the anchor subspace $\textbf { { B } }$ . The projection produces low-dimensional embeddings $\mathbf { \check { \boldsymbol { W } } } = \check { G } \mathbf { \boldsymbol { B } } ^ { T }$ and residual gradients $\bar { \pmb { R } } = \pmb { G } - \pmb { G } \bar { \pmb { B } } ^ { T } \bar { \pmb { B } }$ . The magnitude of residual gradients is usually much smaller than original gradient even when $k$ is small because of the gradient redundancy.
|
| 77 |
+
|
| 78 |
+
Then, we aggregate the gradient embeddings and the residual gradients, respectively. We perturb the aggregated embedding and the aggregated residual gradient respectively to guarantee certain differential privacy. Finally, we release the perturbed embedding and the perturbed residual gradient and construct an unbiased estimator of the private gradient: $\widetilde { \pmb { v } } : = ( \widetilde { \pmb { w } } ^ { T } \pmb { B } ^ { \top } + \widetilde { \pmb { r } } ) / n$ . This construction process does not resulting in additional privacy loss because of DP’s post-processing property. The privacy analysis of the whole process of GEP is given in Theorem 3.1.
|
| 79 |
+
|
| 80 |
+
Theorem 3.1. Let $S _ { 1 }$ and $S _ { 2 }$ be the sensitivity of $\pmb { w }$ and $\pmb { r }$ , respectively, the output of Algorithm $^ { l }$ satisfies $( \epsilon , \delta )$ -DP for any $\delta \in ( 0 , 1 )$ and $\epsilon \leq 2 \log ( 1 / \delta )$ if we choose $\sigma _ { 1 } \geq 2 S _ { 1 } \sqrt { 2 \log ( 1 / \delta ) } / \epsilon$ and $\sigma _ { 2 } \geq 2 S _ { 2 } \sqrt { 2 \log ( 1 / \delta ) } / \epsilon$ .
|
| 81 |
+
|
| 82 |
+
1: Input: anchor gradients $G ^ { ( a ) } \in \mathbb { R } ^ { m \times p }$ ; number of basis vectors $k$ ; private gradients $G \in \mathbb { R } ^ { n \times p }$
|
| 83 |
+
clipping thresholds $S _ { 1 } , S _ { 2 }$ ; standard deviations $\sigma _ { 1 } , \sigma _ { 2 }$ ; number of power iterations $t$ .
|
| 84 |
+
2: //First stage: Compute an orthonormal basis for the anchor subspace.
|
| 85 |
+
3: Initialize $\mathbf { \bar { \boldsymbol { B } } } \in \mathbb { R } ^ { k \times p }$ randomly.
|
| 86 |
+
4: for $i = 1$ to $t$ do
|
| 87 |
+
5: Compute $\pmb { A } = \pmb { G } ^ { ( a ) } \pmb { B } ^ { T }$ and $B = A ^ { T } G ^ { ( a ) }$ .
|
| 88 |
+
6: Orthogonalize $\textbf { { B } }$ and normalize row vectors.
|
| 89 |
+
7: end for
|
| 90 |
+
8: Delete $G ^ { ( a ) }$ to free memory.
|
| 91 |
+
9: //Second stage: project the private gradients $G$ into anchor subspace $\textbf { { B } }$
|
| 92 |
+
10: Compute gradient embeddings $\pmb { W } = \pmb { G } \pmb { B } ^ { T }$ and clip its rows with $S _ { 1 }$ to obtain $\hat { W }$ .
|
| 93 |
+
11: Compute residual gradients $R = G - W B$ and clip its rows with $S _ { 2 }$ to obtain $\hat { R }$ .
|
| 94 |
+
12: //Third stage: perturb gradient embedding and residual gradient separately
|
| 95 |
+
13: Perturb embedding with noise $\boldsymbol { z } ^ { ( 1 ) } \sim \mathcal { N } ( 0 , \sigma _ { 1 } ^ { 2 } \boldsymbol { I } _ { k \times k } )$ : $\begin{array} { r } { \pmb { w } : = \sum _ { i } \hat { W } _ { i , : } , \tilde { \pmb { w } } : = \pmb { w } + \pmb { z } ^ { ( 1 ) } . } \end{array}$
|
| 96 |
+
14: Perturb residual gradient with noise $\boldsymbol { z } ^ { ( 2 ) } \sim \mathcal { N } ( 0 , \sigma _ { 2 } ^ { 2 } \boldsymbol { I } _ { p \times p } )$ : $\begin{array} { r } { \pmb { r } : = \sum _ { i } \hat { \pmb { R } } _ { i , : } , \ \tilde { \pmb { r } } : = \pmb { r } + \boldsymbol { z } ^ { ( 2 ) } . } \end{array}$
|
| 97 |
+
15: Return $\tilde { v } : = ( \tilde { w } ^ { T } B + \tilde { r } ) / n$ .
|
| 98 |
+
|
| 99 |
+
A common practice to control sensitivity is to clip the output with a pre-defined threshold. In our experiments, we use different thresholds $S _ { 1 }$ and $S _ { 2 }$ to clip the gradient embeddings and residual gradients, respectively. The privacy loss of GEP consists of two parts: the privacy loss incurred by releasing the perturbed embedding and the privacy loss incurred by releasing the perturbed residual gradient. We compose these two parts via the Rényi differential privacy and convert it to $( \epsilon , \delta )$ -DP.
|
| 100 |
+
|
| 101 |
+
We highlight several implementation techniques that make GEP widely applicable and implementable with reasonable computational cost. Firstly, auxiliary non-sensitive data do not have to be the same source as the private data and the auxiliary data can be randomly labeled. This non-sensitive data assumption is very weak and easy to satisfy in practical scenarios. To understand why random label works, a quick example is that for the least squares regression problem the individual gradient is aligned with the feature vector while the label only scales the length but does not change the direction. This auxiliary data assumption avoids conducting principal component analysis (PCA) on private gradients, which requires releasing private high-dimensional basis vectors and hence introduces large privacy loss. Secondly, we use power method (Panju, 2011; Vogels et al., 2019) to approximately estimate the principal components. The new operation we introduce is standard matrix multiplication that enjoys efficient implementation on GPU. The computational complexity of each power iteration is $2 m k p$ , where $p$ is the number of model parameters, $m$ is the number of anchor gradients and $k$ is the number of subspace basis vectors. Thirdly, we divide the parameters into different groups and compute one orthonormal basis for each group. This further reduces the computational cost. For example, suppose the parameters are divided into two groups with size $p _ { 1 } , p _ { 2 }$ and the numbers of basis vectors are $k _ { 1 } , k _ { 2 }$ , the computational complexity of each power iteration is $2 m ( k _ { 1 } p _ { 1 } + k _ { 2 } p _ { 2 } )$ , which is smaller than $2 m ( k _ { 1 } + k _ { 2 } ) ( p _ { 1 } + p _ { 2 } )$ . In Appendix B, we analyze the additional computational and memory costs of GEP compared to standard gradient perturbation.
|
| 102 |
+
|
| 103 |
+
Curious readers may wonder if we can use random projection to reduce the dimensionality as Johnson–Lindenstrauss Lemma (Dasgupta & Gupta, 2003) guarantees that one can preserve the pairwise distance between any two points after projecting into a random subspace of much lower dimension. However, preserving the pairwise distance is not sufficient for high quality gradient reconstruction, which is verified by the empirical observation in Appendix C.
|
| 104 |
+
|
| 105 |
+
# 3.2 AN ANALYSIS ON THE RESIDUAL GRADIENTS OF GEP
|
| 106 |
+
|
| 107 |
+
Let $\begin{array} { r } { \pmb { g } : = \frac { 1 } { n } \sum _ { i } \pmb { G } _ { i } , } \end{array}$ : be the target private gradient. For a given anchor subspace $\textbf { { B } }$ , the residual gradients are defined as $\pmb { R } : = \pmb { G } - \pmb { G } \pmb { B } ^ { T } \pmb { B }$ . We then analyze how large the residual gradients could be. The following argument holds for all time steps and we ignore the time step index for simplicity.
|
| 108 |
+
|
| 109 |
+
For the ease of discussion, we introduce $\pmb { \xi } _ { i } : = ( G _ { i , : } ) ^ { T }$ for $i \in [ n ]$ to denote the the private gradients and the $\hat { \pmb { \xi } } _ { j } : = ( { \pmb { G } } _ { j , : } ^ { ( a ) } ) ^ { T }$ for $j \in [ m ]$ to denote the anchor gradients. We use $\lambda _ { k } ( \cdot )$ to denote the $k _ { t h }$ largest eigenvalue of a given matrix. We assume that the private gradients $\xi _ { 1 } , . . . , \xi _ { n }$ and the anchor gradients $\hat { \xi } _ { 1 } , . . . , \hat { \xi } _ { m }$ are sampled independently from a distribution $\mathcal { P }$ . We assume $\Sigma : = \mathbb { E } _ { \pmb { \xi } \sim \mathcal { P } } \pmb { \xi } \pmb { \xi } ^ { \bar { T } } \in \mathbb { R } ^ { p \times p }$ to be the population gradient (uncentered) covariance matrix. We also consider the (uncentered) empirical gradient covariance matrix $\begin{array} { r } { \hat { \pmb { S } } : = \frac { 1 } { m } \sum _ { i = 1 } ^ { m } \hat { \pmb { \xi } } _ { i } \hat { \pmb { \xi } } _ { i } ^ { T } } \end{array}$ .
|
| 110 |
+
|
| 111 |
+
One case is that the population gradient covariance matrix $\pmb { \Sigma }$ is low-rank $k$ . In this case we can argue that the residual gradients are 0 once the number of anchor gradients $m > k$ .
|
| 112 |
+
|
| 113 |
+
Lemma 3.1. Assume that the population covariance matrix $\pmb { \Sigma }$ is with rank $k$ and the distribution $\mathcal { P }$ satisfies $\mathbb { P } ( \pmb { \xi } \in \mathbb { F } _ { s } ) = 0$ for all $s$ -flats $\mathbb { F } _ { s }$ in $\mathbb { R } ^ { p }$ with $0 \leq s < k$ . Let $\pmb { \Sigma } = \pmb { V _ { k } } \pmb { \Lambda } \pmb { V } _ { k } ^ { T }$ and $\hat { \pmb { S } } = \hat { V } _ { k ^ { \prime } } \hat { \pmb { \Lambda } } \hat { V } _ { k ^ { \prime } } ^ { T }$ be the eigendecompositions of $\pmb { \Sigma }$ and the empirical covariance matrix $\hat { S }$ , respectively, such that $\lambda _ { k ^ { \prime } } ( \hat { S } ) > 0$ and $\bar { \lambda _ { k ^ { \prime } + 1 } } ( \hat { S } ) = \bar { 0 }$ . Then if $m \geq k$ , we have with probability $^ { l }$ ,
|
| 114 |
+
|
| 115 |
+
$$
|
| 116 |
+
k ^ { \prime } = k \quad a n d \quad \| V _ { k } V _ { k } ^ { T } - \hat { V } _ { k } \hat { V } _ { k } ^ { T } \| _ { 2 } = 0 .
|
| 117 |
+
$$
|
| 118 |
+
|
| 119 |
+
Proof. The proof is based on the non-singularity of covariance matrix. See Appendix D.
|
| 120 |
+
|
| 121 |
+
We note that $s$ -flat is the translate $\mathbb { F } _ { s } = \pmb { x } + \mathbb { F } _ { s ( 0 ) }$ of an $s$ -dimensional linear subspace $\mathbb { F } _ { s ( 0 ) }$ in $\mathbb { R } ^ { p }$ and the normal distribution satisfies such condition (Eaton & Perlman, 1973; Muirhead, 2009). Therefore, we have seen that for low-rank case of population covariance matrix, the residual gradients are 0 once $m > k$ . In the general case, we measure the expected norm of the residual gradients.
|
| 122 |
+
|
| 123 |
+
Lemma 3.2. Assume that $\xi \sim \mathcal { P }$ and $\| \pmb { \xi } \| ^ { 2 } < T$ almost surely. Let $\pmb { \Sigma } = \pmb { V } \pmb { \Lambda } \pmb { V } ^ { T }$ be the eigendecomposition of the population covariance matrix $\pmb { \Sigma }$ . Let $\hat { \pmb { S } } = \hat { V } _ { k } \hat { \Lambda } \hat { V } _ { k } ^ { T }$ be the eigendecomposition of the empirical covariance matrix $\hat { S } .$ . Then we have with probability $1 - 2 \exp ( - \delta )$ ,
|
| 124 |
+
|
| 125 |
+
$$
|
| 126 |
+
\mathbb { E } \| \pmb { \xi } - \Pi _ { \hat { V } _ { k } } ( \pmb { \xi } ) \| _ { 2 } ^ { 2 } \leq \sum _ { k ^ { \prime } > k } \lambda _ { k ^ { \prime } } ( \pmb { \Sigma } ) + \sqrt { k C / m } + T \sqrt { 2 \delta / m } ,
|
| 127 |
+
$$
|
| 128 |
+
|
| 129 |
+
where $\begin{array} { r } { C = \big [ \mathbb { E } \| \pmb { \xi } \| ^ { 4 } - \sum _ { i } \lambda _ { i } ^ { 2 } ( \pmb { \Sigma } ) \big ] + \Big [ \frac { 1 } { m } \sum _ { j = 1 } ^ { m } \| \hat { \pmb { \xi } } _ { j } \| ^ { 4 } - \sum _ { i } \lambda _ { i } ^ { 2 } ( \pmb { \hat { S } } ) \Big ] } \end{array}$ , $\Pi _ { \hat { V } _ { k } }$ is a projection operator onto the subspace $\hat { V } _ { k }$ and the E is taken over the randomness of $\xi \sim \mathcal { P }$ .
|
| 130 |
+
|
| 131 |
+
Proof. The proof is an adaptation of Theorem 3.1 in Blanchard et al. (2007).
|
| 132 |
+
|
| 133 |
+
From Lemma 3.2, we can see the larger the number of anchor gradients and the dimension of the anchor subspace $k$ , the smaller the residual gradients. We can choose $m , k$ properly such that the upper bound on the expected residual gradient norm is small. This indicates that we may use a smaller clipping threshold and consequently apply smaller noises with achieving the same privacy guarantee.
|
| 134 |
+
|
| 135 |
+
We next empirically examine the projection error $\begin{array} { r } { \pmb { r } = \sum _ { i } \pmb { R } _ { i } , } \end{array}$ ,: by training a 20-layer ResNet on CIFAR10 dataset. We try two different types of auxiliary data to compute the anchor gradients: 1) samples from the same source as private data with correct labels, i.e., 2000 random samples from the test data; 2) samples from different source with random labels, i.e., 2000 random samples from ImageNet. The relation between the dimension of anchor subspace $k$ and the projection error rate $( \left\| { \frac { 1 } { n } } { \overline { { r } } } \right\| / \left\| g \right\| )$ is presented in Figure 4. We can see that the project error is small and decreases with $k$ , and the benefit of increasing $k$ diminishes when $k$ is large, which is implied by Lemma 3.2. In practice one can only use small or moderate $k$ because of the memory constraint. GEP needs to store at least $k$ individual gradients and each individual gradient consumes the same amount of memory as the model itself. Moreover, we can see that the projection into anchor subspace of random labeled auxiliary data yields comparable projection error, corroborating our argument that unlabeled auxiliary data are sufficient for finding the anchor subspace.
|
| 136 |
+
|
| 137 |
+
We also verify that the redundancy of residual gradients is small, by plotting the stable rank of residual gradient matrix in Figure 5. The stable rank of residual gradient matrix is an order of magnitude higher than the stable rank of original gradient matrix. This implies that it could be hard to further approximate $\pmb { R }$ with low-dimensional embeddings.
|
| 138 |
+
|
| 139 |
+
We next compare the GEP with a scheme that simply discards the residual gradients and only outputs the perturbed gradient embedding, i.e., the output is $\tilde { \mathbf { u } } : = \tilde { \mathbf { w } } ^ { T } \mathbf { B } / n$ .
|
| 140 |
+
|
| 141 |
+

|
| 142 |
+
Figure 4: Relative projection error $( \left\| { \frac { 1 } { n } } \pmb { r } \right\| / \left\| \pmb { g } \right\| )$ of the second stage in ResNet20. The number of anchor gradients is 2000. The dimension of anchor subspace is $k$ . The learning rate is decayed by 10 at epoch 30. The left plot uses random samples from ImageNet. The right plot uses random samples from test data. The benefit of increasing $k$ becomes smaller when $k$ is larger.
|
| 143 |
+
|
| 144 |
+

|
| 145 |
+
Figure 5: Stable rank of the residual gradient matrix versus original gradient matrix. The gradients are computed on full batch data for the first stage in ResNet20. The dimension of anchor subspace is $k = 1 0 0 0$ .
|
| 146 |
+
|
| 147 |
+
Remark 1. Let $\tilde { \mathbf { u } } : = \tilde { \mathbf { w } } ^ { T } \mathbf { B } / n$ be the reconstructed gradient from noisy gradient embedding and $\tilde { v }$ be the output of GEP. If ignoring the effect of gradient clipping, we have
|
| 148 |
+
|
| 149 |
+
$$
|
| 150 |
+
\mathbb { E } [ \tilde { \pmb { u } } ] = \pmb { g } - \pmb { r } / n , \quad \mathbb { E } [ \tilde { \pmb { v } } ] = \pmb { g } .
|
| 151 |
+
$$
|
| 152 |
+
|
| 153 |
+
where $\begin{array} { r } { { \pmb r } = \sum _ { i } { \pmb R } _ { i } , } \end{array}$ : is the aggregated residual gradients, $\tilde { \pmb { w } } , \pmb { B }$ are given in Algorithm 1 and the expectation is over the added random noises.
|
| 154 |
+
|
| 155 |
+
This indicates that $\tilde { \mathbf { \pmb { u } } }$ contains a systematic error that makes $\tilde { \mathbf { \pmb { u } } }$ always deviate from $\textbf { { g } }$ by the residual gradient. This systematic error is the projection error, which is plotted in Figure 4. The systematic error cannot be mitigated by reducing the noise magnitude (e.g., increasing the privacy budget or collecting more private data). We refer to the algorithm releasing $\tilde { \mathbf { \pmb { u } } }$ directly as Biased-GEP or $B$ -GEP for short, which can be viewed as an efficient implementation of the algorithm in (Zhou et al., 2020). In our experiments, B-GEP can outperform standard gradient perturbation when $k$ is large but is inferior to GEP. We note that the above remark is made with ignoring the clipping effect (or set a large clipping threshold). In practice, we do apply clipping for the individual gradients at each time step, which makes the expectations in Remark 1 obscure (Chen et al., 2020b). We note that the claim that $\tilde { v }$ is an unbiased estimator of $\textbf { { g } }$ is not that precise when applying gradient clipping.
|
| 156 |
+
|
| 157 |
+
# 3.3 PRIVATE LEARNING WITH GRADIENT EMBEDDING PERTURBATION
|
| 158 |
+
|
| 159 |
+
GEP (Algorithm 1) describes how to release one-step gradient with privacy guarantee. In this section, we compose the privacy losses at each step to establish the privacy guarantee for the whole learning process. The differentially private learning process with GEP is given in Algorithm 2 and the privacy analysis is presented in Theorem 3.2.
|
| 160 |
+
|
| 161 |
+
Algorithm 2: Differentially private gradient descent with GEP.
|
| 162 |
+
|
| 163 |
+
<table><tr><td>configuration of GEP C; loss function l;</td><td>1: Input: private dataset D; auxiliary dataset D(@); number of updates T; learning rate n;</td></tr><tr><td>2: Output: Differentially private model 0T.</td><td></td></tr><tr><td>3: fort=OtoT-1do</td><td></td></tr><tr><td>4:</td><td>Compute the private gradients Gt and anchor gradients G(@) of loss with respect to 0t.</td></tr><tr><td>5:</td><td> and configuration C to get Ut.</td></tr><tr><td>6: 7: end for</td><td>Update model 0t+1 = 0t - nUt.</td></tr></table>
|
| 164 |
+
|
| 165 |
+
Theorem 3.2. For any $\epsilon < 2 \log ( 1 / \delta )$ and $\delta \in ( 0 , 1 )$ , the output of Algorithm 2 satisfies $( \epsilon , \delta )$ -DP if we set $\sigma \geq 2 \sqrt { 2 T \log ( 1 / \delta ) } / \epsilon$ .
|
| 166 |
+
|
| 167 |
+
If the private gradients are randomly sampled from the full batch gradients, the privacy guarantee can be strengthened via the privacy amplification by subsampling theorem of DP (Balle et al., 2018; Wang et al., 2019; Zhu & Wang, 2019; Mironov et al., 2019). Theorem 3.3 gives the expected excess error of Algorithm 2. Expected excess error measures the distance between the algorithm’s output and the optimal solution in expectation.
|
| 168 |
+
|
| 169 |
+
Theorem 3.3. Suppose the loss $\begin{array} { r } { L ( \pmb \theta ) = \frac { 1 } { n } \sum _ { ( \pmb x , y ) \in \mathbb { D } } \ell ( f _ { \pmb \theta } ( \pmb x ) , y ) } \end{array}$ is $I$ -Lipschitz, convex, and $\beta$ - smooth. If $\begin{array} { r l r } { \eta } & { { } = } & { \frac { 1 } { \beta } } \end{array}$ , $\begin{array} { l } { T \ = \ { \frac { n \beta \epsilon } { \sqrt { p } } } } \end{array}$ and $\begin{array} { r c l } { \overline { { \pmb { \theta } } } } & { = } & { \frac { 1 } { T } \sum _ { t = 1 } ^ { T } \pmb { \theta } _ { t } } \end{array}$ , then we have $\begin{array} { r } { \mathbb { E } [ L ( \bar { \pmb \theta } ) ] ~ - ~ L ( \pmb \theta _ { * } ) ~ \leq } \end{array}$ $\begin{array} { r } { \mathcal { O } \left( \frac { \sqrt { k \log ( 1 / \delta ) } } { n \epsilon } + \frac { \bar { r } \sqrt { p \log ( 1 / \delta ) } } { n \epsilon } \right) } \end{array}$ , where $\begin{array} { r } { \bar { r } = \frac { 1 } { T } \sum _ { t = 0 } ^ { T - 1 } r _ { t } ^ { 2 } } \end{array}$ and $r _ { t } = \operatorname* { m a x } _ { i } \| ( \pmb { R } _ { t } ) _ { i , : } \|$ is the sensitivity of residual gradient at step $t$ .
|
| 170 |
+
|
| 171 |
+
The $\bar { r }$ term represents the average projection error over the training process. The previous best expected excess error for gradient perturbation is $\mathcal { O } ( \sqrt { p \log ( 1 / \delta ) } / ( n \epsilon ) )$ (Wang et al., 2017). As shown in Lemma 3.1, if the gradients locate in a $k$ -dimensional subspace over the training process, $\bar { r } = 0$ and the excess error is $\mathcal { O } ( \sqrt { k \log ( 1 / \delta ) } / ( n \epsilon ) )$ , independent of the problem ambient dimension $p$ . When the gradients are in general position, i.e., gradient matrix is not exact low-rank, Lemma 3.2 and the empirical result give a hint on how small the residual gradients could be. However, it is hard to get a good bound on $\operatorname { m a x } _ { i } \| ( \pmb { R } _ { t } ) _ { i , : } \|$ and the bound in Theorem 3.3 does not explicitly improve over previous result. One possible solution is to use a clipping threshold based on the expected residual gradient norm. Then the output gradient becomes biased because of clipping and the utility/privacy guarantees in Theorem $3 . 3 / 3 . 2$ require new elaborate derivation. We leave this for future work.
|
| 172 |
+
|
| 173 |
+
# 4 EXPERIMENTS
|
| 174 |
+
|
| 175 |
+
We conduct experiments on MNIST, extended SVHN, and CIFAR-10 datasets. Our implementation is publicly available2. The model for MNIST has two convolutional layers with max-pooling and one fully connected layer. The model for SVHN and CIFAR-10 is ResNet20 in He et al. (2016). We replace all batch normalization (Ioffe & Szegedy, 2015) layers with group normalization (Wu & He, 2018) layers because batch normalization mixes the representations of different samples and makes the privacy loss cannot be analyzed accurately. The non-private accuracy for MNIST, SVHN, and CIFAR-10 is $9 9 . 1 \%$ , $9 5 . 9 \%$ , and $9 0 . 4 \%$ , respectively.
|
| 176 |
+
|
| 177 |
+
We also provide experiments with pre-trained models in Appendix A. Tramèr & Boneh (2020) show that differentially private linear classifier can achieve high accuracy using the features produced by pre-trained models. We examine whether GEP can improve the performance of such private linear classifiers. Notably, using the features produced by a model pre-trained on unlabeled ImageNet, GEP achieves $9 4 . 8 \%$ validation accuracy on CIFAR10 with $\epsilon = 2$ .
|
| 178 |
+
|
| 179 |
+
Evaluated algorithms We use the algorithm in Abadi et al. (2016) as benchmark gradient perturbation approach, referred to as “GP”. We also compare GEP with PATE (Papernot et al., 2017). We run the experiments for PATE using the official implementation. The privacy parameter $\epsilon$ of PATE is data-dependent and hence cannot be released directly (see Section 3.3 in Papernot et al. (2017)). Nonetheless, we report the results of PATE anyway.
|
| 180 |
+
|
| 181 |
+
Implementation details At each step, GEP needs to release two vectors: the noisy gradient embedding and the noisy residual gradient. The gradient embeddings have a sensitivity of $S _ { 1 }$ and the residual gradients have a sensitivity of $S _ { 2 }$ because of the clipping. The output of GEP can be constructed as follows: (1) normalize the gradient embeddings and residual gradients by $1 / S _ { 1 }$ and $1 / S _ { 2 }$ , respectively, (2) concatenate the rescaled vectors, (3) release the concatenated vector via√ gaussian mechanism with sensitivity $\sqrt { 2 }$ , (4) rescale the two components by $S _ { 1 }$ and $S _ { 2 }$ . B-GEP only needs to release the normalized noisy gradient embedding. We use the numerical tool in Mironov et al. (2019) to compute the privacy loss. For given privacy budget and sampling probability, $\sigma$ is set to be the smallest value such that the privacy budget is allowable to run desired epochs.
|
| 182 |
+
|
| 183 |
+
All experiments are run on a single Tesla V100 GPU with 16G memory. For ResNet20, the parameters are divided into five groups: input layer, output layer, and three intermediate stages. For a given quota of basis vectors, we allocate it to each group according to the square root of the number of parameters in each group. We compute an orthonormal subspace basis on each group separately.
|
| 184 |
+
|
| 185 |
+
Table 1: Test accuracy (in $\%$ ) with varying choices of privacy bound $\epsilon$ . The numbers under symbol $\Delta$ denote the improvement over GP baseline.
|
| 186 |
+
|
| 187 |
+
<table><tr><td rowspan=1 colspan=2>Dataset Algorithm</td><td rowspan=1 colspan=1>e=2</td><td rowspan=1 colspan=1>A</td><td rowspan=1 colspan=1>e=5</td><td rowspan=1 colspan=1>A</td><td rowspan=1 colspan=1>e=8</td><td rowspan=1 colspan=1>A</td></tr><tr><td rowspan=4 colspan=2>GPPATEMNISTB-GEPGEP</td><td rowspan=1 colspan=1>94.7</td><td rowspan=1 colspan=1>+0.0</td><td rowspan=1 colspan=1>96.8</td><td rowspan=1 colspan=1>+0.0</td><td rowspan=1 colspan=1>97.2</td><td rowspan=1 colspan=1>+0.0</td></tr><tr><td rowspan=1 colspan=1>PATE</td><td rowspan=1 colspan=1>98.5</td><td rowspan=1 colspan=1>+3.8</td><td rowspan=1 colspan=1>98.5</td><td rowspan=1 colspan=1>+1.7</td><td rowspan=1 colspan=1>98.6</td><td rowspan=1 colspan=1>+1.4</td></tr><tr><td rowspan=1 colspan=1>B-GEP</td><td rowspan=1 colspan=1>93.1</td><td rowspan=1 colspan=1>-1.6</td><td rowspan=1 colspan=1>94.5</td><td rowspan=1 colspan=1>-2.3</td><td rowspan=1 colspan=1>95.9</td><td rowspan=1 colspan=1>-1.3</td></tr><tr><td rowspan=1 colspan=1>96.3</td><td rowspan=1 colspan=1>+1.6</td><td rowspan=1 colspan=1>97.9</td><td rowspan=1 colspan=1>+1.1</td><td rowspan=1 colspan=1>98.4</td><td rowspan=1 colspan=1>+1.2</td></tr><tr><td rowspan=4 colspan=1>SVHN</td><td rowspan=1 colspan=1>GP</td><td rowspan=1 colspan=1>87.1</td><td rowspan=1 colspan=1>+0.0</td><td rowspan=1 colspan=1>91.3</td><td rowspan=1 colspan=1>+0.0</td><td rowspan=1 colspan=1>91.6</td><td rowspan=1 colspan=1>+0.0</td></tr><tr><td rowspan=1 colspan=1>PATE</td><td rowspan=1 colspan=1>80.7</td><td rowspan=1 colspan=1>-6.4</td><td rowspan=1 colspan=1>91.6</td><td rowspan=1 colspan=1>+0.3</td><td rowspan=1 colspan=1>91.6</td><td rowspan=1 colspan=1>+0.0</td></tr><tr><td rowspan=1 colspan=1>B-GEP</td><td rowspan=1 colspan=1>88.5</td><td rowspan=1 colspan=1>+1.4</td><td rowspan=1 colspan=1>91.8</td><td rowspan=1 colspan=1>+0.5</td><td rowspan=1 colspan=1>92.3</td><td rowspan=1 colspan=1>+0.7</td></tr><tr><td rowspan=1 colspan=1>GEP</td><td rowspan=1 colspan=1>92.3</td><td rowspan=1 colspan=1>+5.2</td><td rowspan=1 colspan=1>94.7</td><td rowspan=1 colspan=1>+3.4</td><td rowspan=1 colspan=1>95.1</td><td rowspan=1 colspan=1>+3.5</td></tr><tr><td rowspan=2 colspan=1>CIFAR-10</td><td rowspan=1 colspan=1>GP</td><td rowspan=1 colspan=1>43.6</td><td rowspan=1 colspan=1>+0.0</td><td rowspan=1 colspan=1>52.2</td><td rowspan=1 colspan=1>+0.0</td><td rowspan=1 colspan=1>56.4</td><td rowspan=1 colspan=1>+0.0</td></tr><tr><td rowspan=1 colspan=1>PATE</td><td rowspan=1 colspan=1>34.2</td><td rowspan=1 colspan=1>-9.4</td><td rowspan=1 colspan=1>41.9</td><td rowspan=1 colspan=1>-10.3</td><td rowspan=1 colspan=1>43.6</td><td rowspan=1 colspan=1>-12.8</td></tr><tr><td rowspan=2 colspan=1></td><td rowspan=1 colspan=1>B-GEP</td><td rowspan=1 colspan=1>50.3</td><td rowspan=1 colspan=1>+6.7</td><td rowspan=1 colspan=1>59.5</td><td rowspan=1 colspan=1>+7.3</td><td rowspan=1 colspan=1>63.0</td><td rowspan=1 colspan=1>+6.6</td></tr><tr><td rowspan=1 colspan=1>GEP</td><td rowspan=1 colspan=1>59.7</td><td rowspan=1 colspan=1>+16.1</td><td rowspan=1 colspan=1>70.1</td><td rowspan=1 colspan=1>+17.9</td><td rowspan=1 colspan=1>74.9</td><td rowspan=1 colspan=1>+18.5</td></tr></table>
|
| 188 |
+
|
| 189 |
+

|
| 190 |
+
Figure 6: Test accuracy when varying the dimension of anchor subspace. GEP significantly outperforms B-GEP for all $k$ . Moreover, the performance of GEP is not that sensitive to $k$ .
|
| 191 |
+
|
| 192 |
+
Then we concatenate the projections of all groups to construct gradient embeddings. The number of power iterations $t$ is set as 1 as empirical evaluations suggest more iterations do not improve the performance for GEP and B-GEP.
|
| 193 |
+
|
| 194 |
+
For all datasets, the anchor gradients are computed on 2000 random samples from ImageNet. In Appendix C, we examine the influence of choosing different numbers of anchor gradients and different sources of auxiliary data. The selected images are downsampled into size of $3 2 \times 3 2$ ( $2 8 \times 2 8$ for MNIST) and we label them randomly at each update. For SVHN and CIFAR-10, $k$ is chosen from [500, 1000, 1500, 2000]. For MNIST, we halve the size of $k$ . We use SGD with momentum 0.9 as the optimizer. Initial learning rate and batchsize are 0.1 and 1000, respectively. The learning rate is divided by 10 at middle of training. Weight decay is set as $1 \times 1 0 ^ { - 4 }$ . The clipping threshold for is 10 for original gradients and 2 for residual gradients. The number of training epochs for CIFAR-10 and MNIST is 50, 100, 200 for privacy parameter $\epsilon = 2 , 5 , 8$ , respectively. The number of training epochs for SVHN is 5, 10, 20 for privacy parameter $\epsilon = 2 , 5 , 8$ , respectively. Privacy parameter $\delta$ is $1 ^ { \cdot } \times 1 0 ^ { - 6 }$ for SVHN and $\mathrm { i } \times \mathrm { 1 0 ^ { - 5 } }$ for CIFAR-10 and MNIST.
|
| 195 |
+
|
| 196 |
+
Results The best accuracy with given $\epsilon$ is in Table 4. For all datasets, GEP achieves considerable improvement over GP in Abadi et al. (2016). Specifically, GEP achieves $7 4 . 9 \%$ test accuracy on CIFAR-10 with $( 8 , 1 0 ^ { - 5 } )$ -DP, outperforming GP by $1 8 . 5 \%$ . PATE achieves best accuracy on MNIST but its performance drops as the dataset becomes more complex.
|
| 197 |
+
|
| 198 |
+
We also plot the relation between accuracy and $k$ in Figure 6. GEP is less sensitive to the choice of $k$ and outperforms B-GEP for all choices of $k$ . The improvement of increasing $k$ becomes smaller as $k$ becomes larger. We note that the memory cost of choosing large $k$ is high because we need to store at least $k$ individual gradients to compute anchor subspace.
|
| 199 |
+
|
| 200 |
+
# 5 CONCLUSION
|
| 201 |
+
|
| 202 |
+
In this paper, we propose Gradient Embedding Perturbation (GEP) for learning with differential privacy. GEP leverages the gradient redundancy to reduce the added noise and outputs an unbiased estimator of target gradient. The several key designs of GEP significantly boost the applicability of GEP. Extensive experiments on real world datasets demonstrate the superior utility of GEP.
|
| 203 |
+
|
| 204 |
+
# REFERENCES
|
| 205 |
+
|
| 206 |
+
Martin Abadi, Andy Chu, Ian Goodfellow, H Brendan McMahan, Ilya Mironov, Kunal Talwar, and Li Zhang. Deep learning with differential privacy. In ACM SIGSAC Conference on Computer and Communications Security, 2016.
|
| 207 |
+
|
| 208 |
+
Noga Alon, Raef Bassily, and Shay Moran. Limits of private learning with access to public data. In Advances in Neural Information Processing Systems, 2019.
|
| 209 |
+
|
| 210 |
+
Borja Balle, Gilles Barthe, and Marco Gaboardi. Privacy amplification by subsampling: Tight analyses via couplings and divergences. In Advances in Neural Information Processing Systems, 2018.
|
| 211 |
+
|
| 212 |
+
Raef Bassily, Adam Smith, and Abhradeep Thakurta. Differentially private empirical risk minimization: Efficient algorithms and tight error bounds. Annual Symposium on Foundations of Computer Science, 2014.
|
| 213 |
+
|
| 214 |
+
Daniel Bernau, Philip-William Grassal, Jonas Robl, and Florian Kerschbaum. Assessing differentially private deep learning with membership inference. arXiv preprint arXiv:1912.11328, 2019.
|
| 215 |
+
|
| 216 |
+
Gilles Blanchard, Olivier Bousquet, and Laurent Zwald. Statistical properties of kernel principal component analysis. Machine Learning, 66(2-3):259–294, 2007.
|
| 217 |
+
|
| 218 |
+
Mark Bun and Thomas Steinke. Concentrated differential privacy: Simplifications, extensions, and lower bounds. In Theory of Cryptography Conference, 2016.
|
| 219 |
+
|
| 220 |
+
Nicholas Carlini, Chang Liu, Úlfar Erlingsson, Jernej Kos, and Dawn Song. The secret sharer: Evaluating and testing unintended memorization in neural networks. In USENIX Security Symposium, 2019.
|
| 221 |
+
|
| 222 |
+
Ting Chen, Simon Kornblith, Kevin Swersky, Mohammad Norouzi, and Geoffrey Hinton. Big self-supervised models are strong semi-supervised learners. arXiv preprint arXiv:2006.10029, 2020a.
|
| 223 |
+
|
| 224 |
+
Xiangyi Chen, Steven Z Wu, and Mingyi Hong. Understanding gradient clipping in private sgd: A geometric perspective. Advances in Neural Information Processing Systems, 33, 2020b.
|
| 225 |
+
|
| 226 |
+
Sanjoy Dasgupta and Anupam Gupta. An elementary proof of a theorem of johnson and lindenstrauss. Random Structures & Algorithms, 2003.
|
| 227 |
+
|
| 228 |
+
Jinshuo Dong, Aaron Roth, and Weijie J Su. Gaussian differential privacy. arXiv preprint arXiv:1905.02383, 2019.
|
| 229 |
+
|
| 230 |
+
Cynthia Dwork, Krishnaram Kenthapadi, Frank McSherry, Ilya Mironov, and Moni Naor. Our data, ourselves: Privacy via distributed noise generation. In Annual International Conference on the Theory and Applications of Cryptographic Techniques, 2006a.
|
| 231 |
+
|
| 232 |
+
Cynthia Dwork, Frank McSherry, Kobbi Nissim, and Adam Smith. Calibrating noise to sensitivity in private data analysis. In Theory of cryptography conference, 2006b.
|
| 233 |
+
|
| 234 |
+
Cynthia Dwork, Aaron Roth, et al. The algorithmic foundations of differential privacy. Foundations and Trends® in Theoretical Computer Science, 2014.
|
| 235 |
+
|
| 236 |
+
Morris L Eaton and Michael D Perlman. The non-singularity of generalized sample covariance matrices. The Annals of Statistics, pp. 710–717, 1973.
|
| 237 |
+
|
| 238 |
+
Matt Fredrikson, Somesh Jha, and Thomas Ristenpart. Model inversion attacks that exploit confidence information and basic countermeasures. In ACM SIGSAC Conference on Computer and Communications Security, 2015.
|
| 239 |
+
|
| 240 |
+
Kazuto Fukuchi, Quang Khai Tran, and Jun Sakuma. Differentially private empirical risk minimization with input perturbation. In International Conference on Discovery Science, 2017.
|
| 241 |
+
|
| 242 |
+
Mary Gooneratne, Khe Chai Sim, Petr Zadrazil, Andreas Kabel, Françoise Beaufays, and Giovanni Motta. Low-rank gradient approximation for memory-efficient on-device training of deep neural network. In IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP). IEEE, 2020.
|
| 243 |
+
|
| 244 |
+
Guy Gur-Ari, Daniel A Roberts, and Ethan Dyer. Gradient descent happens in a tiny subspace. arXiv preprint arXiv:1812.04754, 2018.
|
| 245 |
+
|
| 246 |
+
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, 2016.
|
| 247 |
+
|
| 248 |
+
Kaiming He, Haoqi Fan, Yuxin Wu, Saining Xie, and Ross Girshick. Momentum contrast for unsupervised visual representation learning. In Conference on Computer Vision and Pattern Recognition, 2020.
|
| 249 |
+
|
| 250 |
+
Briland Hitaj, Giuseppe Ateniese, and Fernando Pérez-Cruz. Deep models under the gan: information leakage from collaborative deep learning. In Proceedings of the 2017 ACM SIGSAC Conference on Computer and Communications Security, 2017.
|
| 251 |
+
|
| 252 |
+
Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. In International Conference on Machine Learning, 2015.
|
| 253 |
+
|
| 254 |
+
Roger Iyengar, Joseph P Near, Dawn Song, Om Thakkar, Abhradeep Thakurta, and Lun Wang. Towards practical differentially private convex optimization. In IEEE Symposium on Security and Privacy, 2019.
|
| 255 |
+
|
| 256 |
+
Bargav Jayaraman, Lingxiao Wang, David Evans, and Quanquan Gu. Distributed learning without distress: Privacy-preserving empirical risk minimization. In Advances in Neural Information Processing Systems, 2018.
|
| 257 |
+
|
| 258 |
+
James Jordon, Jinsung Yoon, and Mihaela van der Schaar. Pate-gan: Generating synthetic data with differential privacy guarantees. In International Conference on Learning Representations, 2019.
|
| 259 |
+
|
| 260 |
+
Peter Kairouz, Mónica Ribero, Keith Rush, and Abhradeep Thakurta. Dimension independence in unconstrained private erm via adaptive preconditioning. arXiv preprint arXiv:2008.06570, 2020.
|
| 261 |
+
|
| 262 |
+
Daniel Kifer, Adam Smith, and Abhradeep Thakurta. Private convex empirical risk minimization and high-dimensional regression. In Conference on Learning Theory, 2012.
|
| 263 |
+
|
| 264 |
+
Jaewoo Lee and Daniel Kifer. Concentrated differentially private gradient descent with adaptive per-iteration privacy budget. In Proceedings of the 24th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, 2018.
|
| 265 |
+
|
| 266 |
+
Xinyan Li, Qilong Gu, Yingxue Zhou, Tiancong Chen, and Arindam Banerjee. Hessian based analysis of sgd for deep nets: Dynamics and generalization. In SIAM International Conference on Data Mining, 2020.
|
| 267 |
+
|
| 268 |
+
Yuzhe Ma, Xiaojin Zhu, and Justin Hsu. Data poisoning against differentially-private learners: attacks and defenses. In Proceedings of the 28th International Joint Conference on Artificial Intelligence, pp. 4732–4738. AAAI Press, 2019.
|
| 269 |
+
|
| 270 |
+
Ilya Mironov. Rényi differential privacy. In IEEE Computer Security Foundations Symposium, 2017.
|
| 271 |
+
|
| 272 |
+
Ilya Mironov, Kunal Talwar, and Li Zhang. Rényi differential privacy of the sampled gaussian mechanism. arXiv, 2019.
|
| 273 |
+
|
| 274 |
+
Robb J Muirhead. Aspects of multivariate statistical theory, volume 197. John Wiley & Sons, 2009.
|
| 275 |
+
|
| 276 |
+
Maysum Panju. Iterative methods for computing eigenvalues and eigenvectors. arXiv preprint arXiv:1105.1185, 2011.
|
| 277 |
+
|
| 278 |
+
Nicolas Papernot, Martín Abadi, Ulfar Erlingsson, Ian Goodfellow, and Kunal Talwar. Semisupervised knowledge transfer for deep learning from private training data. In International Conference on Learning Representations, 2017.
|
| 279 |
+
|
| 280 |
+
Nicolas Papernot, Shuang Song, Ilya Mironov, Ananth Raghunathan, Kunal Talwar, and Úlfar Erlingsson. Scalable private learning with pate. In International Conference on Learning Representations, 2018.
|
| 281 |
+
|
| 282 |
+
NhatHai Phan, My T Thai, Han Hu, Ruoming Jin, Tong Sun, and Dejing Dou. Scalable differential privacy with certified robustness in adversarial learning. International Conference on Machine Learning, 2020.
|
| 283 |
+
|
| 284 |
+
Md Atiqur Rahman, Tanzila Rahman, Robert Laganiere, Noman Mohammed, and Yang Wang. Membership inference attack against differentially private deep learning model. Transactions on Data Privacy, 2018.
|
| 285 |
+
|
| 286 |
+
Alexandre Sablayrolles, Matthijs Douze, Yann Ollivier, Cordelia Schmid, and Hervé Jégou. Whitebox vs black-box: Bayes optimal strategies for membership inference. International Conference on Machine Learning, 2019.
|
| 287 |
+
|
| 288 |
+
Reza Shokri and Vitaly Shmatikov. Privacy-preserving deep learning. In ACM SIGSAC conference on computer and communications security, 2015.
|
| 289 |
+
|
| 290 |
+
Reza Shokri, Marco Stronati, Congzheng Song, and Vitaly Shmatikov. Membership inference attacks against machine learning models. In IEEE Symposium on Security and Privacy (SP), 2017.
|
| 291 |
+
|
| 292 |
+
Shuang Song, Kamalika Chaudhuri, and Anand D Sarwate. Stochastic gradient descent with differentially private updates. In Global Conference on Signal and Information Processing (GlobalSIP), 2013.
|
| 293 |
+
|
| 294 |
+
Kunal Talwar, Abhradeep Guha Thakurta, and Li Zhang. Nearly optimal private lasso. In Advances in Neural Information Processing Systems, 2015.
|
| 295 |
+
|
| 296 |
+
Abhradeep Guha Thakurta and Adam Smith. Differentially private feature selection via stability arguments, and the robustness of the lasso. In Conference on Learning Theory, 2013.
|
| 297 |
+
|
| 298 |
+
Florian Tramèr and Dan Boneh. Differentially private learning needs better features (or much more data). arXiv preprint arXiv:2011.11660, 2020.
|
| 299 |
+
|
| 300 |
+
Joel A Tropp et al. An introduction to matrix concentration inequalities. Foundations and Trends® in Machine Learning, 8(1-2):1–230, 2015.
|
| 301 |
+
|
| 302 |
+
Thijs Vogels, Sai Praneeth Karimireddy, and Martin Jaggi. Powersgd: Practical low-rank gradient compression for distributed optimization. In Advances in Neural Information Processing Systems, 2019.
|
| 303 |
+
|
| 304 |
+
Di Wang and Jinhui Xu. On sparse linear regression in the local differential privacy model. In International Conference on Machine Learning, 2019.
|
| 305 |
+
|
| 306 |
+
Di Wang, Minwei Ye, and Jinhui Xu. Differentially private empirical risk minimization revisited: Faster and more general. In Advances in Neural Information Processing Systems, 2017.
|
| 307 |
+
|
| 308 |
+
Jun Wang and Zhi-Hua Zhou. Differentially private learning with small public data. In AAAI, 2020.
|
| 309 |
+
|
| 310 |
+
Lingxiao Wang and Quanquan Gu. Differentially private iterative gradient hard thresholding for sparse learning. In International Joint Conference on Artificial Intelligence, 2019.
|
| 311 |
+
|
| 312 |
+
Yu-Xiang Wang, Borja Balle, and Shiva Prasad Kasiviswanathan. Subsampled rényi differential privacy and analytical moments accountant. In International Conference on Artificial Intelligence and Statistics, 2019.
|
| 313 |
+
|
| 314 |
+
Xi Wu, Matthew Fredrikson, Somesh Jha, and Jeffrey F Naughton. A methodology for formalizing model-inversion attacks. In IEEE Computer Security Foundations Symposium, 2016.
|
| 315 |
+
|
| 316 |
+
Xi Wu, Fengan Li, Arun Kumar, Kamalika Chaudhuri, Somesh Jha, and Jeffrey Naughton. Bolt-on differential privacy for scalable stochastic gradient descent-based analytics. In ACM International Conference on Management of Data, 2017.
|
| 317 |
+
|
| 318 |
+
Yuxin Wu and Kaiming He. Group normalization. In Proceedings of the European conference on computer vision (ECCV), 2018.
|
| 319 |
+
|
| 320 |
+
Da Yu, Huishuai Zhang, Wei Chen, Jian Yin, and Tie-Yan Liu. Gradient perturbation is underrated for differentially private convex optimization. In Proc. of 29th Int. Joint Conf. Artificial Intelligence, 2020.
|
| 321 |
+
|
| 322 |
+
Da Yu, Huishuai Zhang, Wei Chen, Jian Yin, and Tie-Yan Liu. How does data augmentation affect privacy in machine learning? In Proc. of the AAAI Conference on Artificial Intelligence, 2021.
|
| 323 |
+
|
| 324 |
+
Yingxue Zhou, Zhiwei Steven Wu, and Arindam Banerjee. Bypassing the ambient dimension: Private sgd with gradient subspace identification. arXiv preprint arXiv:2007.03813, 2020.
|
| 325 |
+
|
| 326 |
+
Ligeng Zhu, Zhijian Liu, and Song Han. Deep leakage from gradients. In Advances in Neural Information Processing Systems, 2019.
|
| 327 |
+
|
| 328 |
+
Yuqing Zhu and Yu-Xiang Wang. Poission subsampled rényi differential privacy. In International Conference on Machine Learning, 2019.
|
| 329 |
+
|
| 330 |
+
# A EXPERIMENTS WITH PRE-TRAINED MODELS
|
| 331 |
+
|
| 332 |
+
Recent works have shown that pre-training the models on unlabeled data can be beneficial for subsequent learning tasks (Chen et al., 2020a; He et al., 2020). Tramèr & Boneh (2020) demonstrate that differentially private linear classifier can achieve high accuracy using the features produced by those per-trained models. We show that GEP can also benefit from such pre-trained models.
|
| 333 |
+
|
| 334 |
+
Inspired by Tramèr & Boneh (2020), we use the output of the penultimate layer of a pre-trained ResNet152 model as feature to train a private linear classifier. The ResNet152 model is pre-trained on unlabeled ImageNet using SimCLR (Chen et al., 2020a). The feature dimension is 4096.
|
| 335 |
+
|
| 336 |
+
Implementation Details We choose the privacy parameter $\epsilon$ from [0.1, 0.5, 1, 2]. The privacy parameter $\delta$ is $1 \times 1 0 ^ { - 5 }$ . We run all experiments for 5 times and report the average accuracy. The clipping threshold of residual gradients is still one-fifth of the clipping threshold of the original gradients. The√ dimension of anchor subspace is set as $2 0 0 \simeq { \sqrt { p } }$ where $p = 4 0 9 6 0$ is the model dimension. We randomly sample 500 samples from the test set as auxiliary data and evaluate performance on the rest test samples. The optimizer is Adam with default momentum coefficients. Other hyper-parameters are listed in Table 2.
|
| 337 |
+
|
| 338 |
+
Table 2: Hyperparameter values used in Appendix A.
|
| 339 |
+
|
| 340 |
+
<table><tr><td rowspan=1 colspan=1>Hyperparameter</td><td rowspan=1 colspan=1>Values</td></tr><tr><td rowspan=1 colspan=1>Learning rate</td><td rowspan=1 colspan=1>0.01,0.05,0.1</td></tr><tr><td rowspan=1 colspan=1>Running steps</td><td rowspan=1 colspan=1>50,100,400</td></tr><tr><td rowspan=1 colspan=1>Clipping threshold</td><td rowspan=1 colspan=1>0.01,0.1,1</td></tr></table>
|
| 341 |
+
|
| 342 |
+
Results The experiment results are shown in Table 3. GEP outperforms GP on all values of $\epsilon$ . With privacy bound $\epsilon = 2$ , GEP achieves $9 4 . 8 \%$ validation accuracy on CIFAR10 dataset, improving over the GP baseline by $1 . 4 \%$ . For very strong privacy guarantee $\epsilon = 0 . 1$ ), B-GEP performs on par with GEP because strong privacy guarantee requires large noise and the useful signal in residual gradient is submerged in the added noise. B-GEP benefits less from larger $\epsilon$ compared to GP or GEP. For $\epsilon = 1$ and 2, the performance of B-GEP is worse than the performance of GP. This is because larger $\epsilon$ can not reduce the systematic error of B-GEP (see Remark 1 in Section 3.2).
|
| 343 |
+
|
| 344 |
+
Table 3: Validation accuracy $( \mathrm { i n } \% )$ ) on CIFAR10 with varying choices of $\epsilon$ . We train a private linear model on top of the features from a ResNet152 model, which is pre-trained on unlabeled ImageNet.
|
| 345 |
+
|
| 346 |
+
<table><tr><td></td><td>e=0.1</td><td>e=0.5</td><td>e=1</td><td>e=2</td></tr><tr><td>Non private</td><td>96.3</td><td>96.3</td><td>96.3</td><td>96.3</td></tr><tr><td>GP</td><td>88.2 (±0.16)</td><td>91.1 (±0.17)</td><td>93.2 (±0.19)</td><td>93.4 (±0.12)</td></tr><tr><td>B-GEP</td><td>91.0 (±0.07)</td><td>92.9 (±0.03)</td><td>93.1 (±0.10)</td><td>93.2 (±0.08)</td></tr><tr><td>GEP</td><td>90.9 (±0.19)</td><td>93.5 (±0.06)</td><td>94.3 (±0.09)</td><td>94.8 (±0.06)</td></tr></table>
|
| 347 |
+
|
| 348 |
+
# B COMPLEXITY ANALYSIS
|
| 349 |
+
|
| 350 |
+
We provide an analysis of the computational and memory costs of the construction of anchor subspace. The computation of the anchor subspace is the dominant additional cost of GEP compared to conventional gradient perturbation. Notations: $k , m , n$ , and $p$ are the dimension of anchor subspace, number of anchor gradients, number of private gradients, and the model dimension, respectively. In order to reduce the computational and memory costs, we divide the parameters into $g$ groups and compute one orthonormal basis for each group. We refer to this approach as ‘parameter grouping’. In this section, we assume the parameters and the dimension of the anchor subspace are both divided evenly. Table 4 summarizes the additional costs of GEP with/without parameter grouping. Using parameter grouping can reduce the computational/memory cost significantly.
|
| 351 |
+
|
| 352 |
+
Table 4: Computational and memory costs of a single power iteration in Algorithm 1. The computation cost is measured by the number of floating point operations. The memory cost is measured by the number of floating-point numbers we need to store. $\cdot _ { \mathrm { G E P + P G } } ,$ denotes GEP with parameter grouping and $g$ denotes the number of groups. Notations: $k$ , $m$ , $n$ , and $p$ are the dimension of anchor subspace, number of anchor gradients, number of private gradients, and the model dimension, respectively.
|
| 353 |
+
|
| 354 |
+
<table><tr><td></td><td>Computational Cost</td><td>Memory Cost</td></tr><tr><td>GEP</td><td>2mkp+pk²</td><td>max(0,(m-n+k)p+mk)</td></tr><tr><td>GEP+PG</td><td>2mkp/g+pk²/g²</td><td>max (0,(m-n+)p+mk)</td></tr></table>
|
| 355 |
+
|
| 356 |
+
# C ABLATION STUDY
|
| 357 |
+
|
| 358 |
+
The influence of choosing different auxiliary datasets. We conduct experiments with different choices of auxiliary datasets. For CIFAR10, we try 2000 random test samples from CIFAR10, 2000 random samples from CIFAR100, and 2000 random samples from ImageNet. When the auxiliary dataset is CIFAR10, we try both correct labels and random labels. For all choices of auxiliary datasets, the test accuracy is evaluated on 8000 test samples of CIFAR10 that are not used as auxiliary data. Other implementation details are the same as in Section 4. The results are shown in Table 5. Surprisingly, using samples from CIFAR10 with correct labels yields the worst accuracy. This may because the model ‘overfits’ the auxiliary data when it has access to correct labels, which makes the anchor subspace contains less information about the private gradients. The best accuracy is achieved using samples from CIFAR10 with random labels, this makes sense because in this case the features of auxiliary data and private data have the same distribution. Using samples from CIFAR100 or ImageNet as auxiliary data has a small influence on the test accuracy.
|
| 359 |
+
|
| 360 |
+
Table 5: Test accuracy on CIFAR10 with different choices of auxiliary datasets. The privacy guarantee is $( 8 , 1 0 ^ { - 5 } )$ -DP. We report the average accuracy of five runs with standard deviations in brackets.
|
| 361 |
+
|
| 362 |
+
<table><tr><td>Auxiliary Data</td><td>RandomLabel?</td><td>Test Accuracy</td></tr><tr><td>CIFAR10</td><td>No</td><td>72.9 (±0.31)</td></tr><tr><td>CIFAR10</td><td>Yes</td><td>75.1 (±0.42)</td></tr><tr><td>CIFAR100</td><td>Yes</td><td>74.7 (±0.46)</td></tr><tr><td>ImageNet</td><td>Yes</td><td>74.8 (±0.39)</td></tr></table>
|
| 363 |
+
|
| 364 |
+
The influence of the number of anchor gradients. In the main text, the size of auxiliary dataset is $m = 2 0 0 0$ . We conduct more experiments with different sizes of auxiliary dataset to examine the influence of $m$ . The auxiliary data is randomly sampled from ImageNet. Table 6 reports the test accuracy on CIFAR10 with different choices of $m$ . For both B-GEP and GEP, increasing $m$ leads to slightly improved performance.
|
| 365 |
+
|
| 366 |
+
Table 6: Test accuracy on CIFAR10 with different sizes of auxiliary dataset. The privacy guarantee is $( 8 , 1 0 ^ { - 5 } )$ -DP. We report the average accuracy of five runs with standard deviations in brackets.
|
| 367 |
+
|
| 368 |
+
<table><tr><td>Algorithm</td><td>m = 1000</td><td>m = 2000</td><td>m = 4000</td></tr><tr><td>B-GEP</td><td>62.2 (±0.26)</td><td>62.6 (±0.24)</td><td>63.3 (±0.27)</td></tr><tr><td>GEP</td><td>74.6 (±0.41)</td><td>74.8 (±0.39)</td><td>75.2 (±0.34)</td></tr></table>
|
| 369 |
+
|
| 370 |
+
The projection error of random basis vectors. It is tempting to construct the anchor subspace using random basis vectors because Johnson–Lindenstrauss Lemma (Dasgupta & Gupta, 2003) guarantees that one can preserve the pairwise distance between any two points after projecting into a random subspace of much lower dimension. We empirically verify the projection error of Gaussian random basis vectors on CIFAR10 and SVHN. The experiment settings are the same as in Section 4. The projection errors over the training process are plotted in Figure 7. The projection error of random basis vectors is very high $( > 9 5 \%$ ) throughout training. This is because preserving the pairwise distance is not sufficient for high quality gradient reconstruction, which requires one to preserve the average ‘distance’ between any individual gradient and all other gradients.
|
| 371 |
+
|
| 372 |
+

|
| 373 |
+
Figure 7: Projection error rate of random basis vectors. The dimension of subspace is denoted by $k$ .
|
| 374 |
+
|
| 375 |
+
# D MISSING PROOFS
|
| 376 |
+
|
| 377 |
+
Lemma 3.1. Assume that the population covariance matrix $\pmb { \Sigma }$ is with rank $k$ and the distribution $\mathcal { P }$ satisfies $\mathbb { P } ( \pmb { \xi } \in \mathbb { F } _ { s } ) = 0$ for all $s$ -flats $\mathbb { F } _ { s }$ in $\mathbb { R } ^ { p }$ with $0 \leq s < k$ . Let $\pmb { \Sigma } = \pmb { V _ { k } } \pmb { \Lambda } \pmb { V } _ { k } ^ { T }$ and $\hat { \pmb { S } } = \hat { V } _ { k ^ { \prime } } \hat { \pmb { \Lambda } } \hat { V } _ { k ^ { \prime } } ^ { T }$ be the eigendecompositions of $\pmb { \Sigma }$ and the empirical covariance matrix $\hat { S }$ , respectively, such that $\lambda _ { k ^ { \prime } } ( \hat { S } ) > 0$ and $\lambda _ { k ^ { \prime } + 1 } ( \hat { \pmb S } ) = 0$ . Then if $m \geq k$ , we have with probability $^ { l }$ ,
|
| 378 |
+
|
| 379 |
+
$$
|
| 380 |
+
k ^ { \prime } = k \quad a n d \quad \| V _ { k } V _ { k } ^ { T } - \hat { V } _ { k } \hat { V } _ { k } ^ { T } \| _ { 2 } = 0 .
|
| 381 |
+
$$
|
| 382 |
+
|
| 383 |
+
Proof. We extend the Theorem 3.2 in Eaton & Perlman (1973) to the low-rank case.
|
| 384 |
+
|
| 385 |
+
Theorem D.1 (Theorem 3.2 in Eaton & Perlman (1973)). Let $\pmb { X } = ( \pmb { x } _ { 1 } , . . . , \pmb { x } _ { n } )$ where the $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { i } }$ are i.i.d. random vectors in $\mathbb { R } ^ { p }$ , $n \geq p$ . If $\mathbb { P } \{ \pmb { x } _ { 1 } \in \mathbb { M } \} = 0$ for all proper manifolds $\mathbb { M } \subset \mathbb { R } ^ { p }$ , then $\mathbb { P } \{ X$ is non-singular $\scriptstyle \cdot \} = I$ .
|
| 386 |
+
|
| 387 |
+
We note that the subspace spanned by $\hat { V } _ { k ^ { \prime } }$ is in the space spanned by $V _ { k }$ by definition. Hence $k ^ { \prime } \leq k$
|
| 388 |
+
|
| 389 |
+
Let $\hat { \pmb { x } } _ { i } : = V _ { k } ^ { T } \pmb { \hat { \xi } } _ { i } \in \mathbb { R } ^ { k }$ for $i \in [ m ]$ . Then $\hat { \pmb X } : = ( \hat { \pmb x } _ { 1 } , . . . , \hat { \pmb x } _ { m } )$ is non-singular because of the assumption and Theorem D.1. That is $r a n k ( { \hat { X } } ) = k$ . Therefore $r a n k ( ( \hat { \xi } _ { 1 } , . . . , \hat { \xi } _ { m } ) ) \geq k , r a n k ( \hat { S } ) \geq k$ and $k ^ { \prime } \geq k$ . Therefore $k ^ { \prime } = k$ and the subspace spanned by $\hat { V } _ { k ^ { \prime } }$ and the subspace spanned by $V _ { k }$ are identical. □
|
| 390 |
+
|
| 391 |
+
Theorem 3.1. Let $S _ { 1 }$ and $S _ { 2 }$ be the sensitivity of w and $\pmb { r }$ , respectively, the output of Algorithm $^ { l }$ satisfies $( \epsilon , \delta )$ -DP for any $\delta \in ( 0 , 1 )$ and $\epsilon \leq 2 \log ( 1 / \delta )$ if we choose $\sigma _ { 1 } \geq 2 S _ { 1 } \sqrt { 2 \log ( 1 / \delta ) } / \epsilon$ and $\sigma _ { 2 } \geq 2 S _ { 2 } \sqrt { 2 \log ( 1 / \delta ) } / \epsilon$ .
|
| 392 |
+
|
| 393 |
+
Proof of Theorem 3.1. We first introduce some background knowledge of Rényi differential privacy (RDP) (Mironov, 2017). RDP measures the Rényi divergence between two output distributions.
|
| 394 |
+
|
| 395 |
+
Definition 2 ( $( \lambda , \gamma )$ -RDP). A randomized mechanism $f$ is said to guarantee $( \lambda , \gamma )$ -RDP if for any neighboring datasets $\mathbb { D } , \mathbb { D } ^ { \prime }$ and $\lambda > 1$ it holds that
|
| 396 |
+
|
| 397 |
+
$$
|
| 398 |
+
D _ { \lambda } ( f ( \mathbb { D } ) | | f ( \mathbb { D } ^ { \prime } ) ) \leq \gamma ,
|
| 399 |
+
$$
|
| 400 |
+
|
| 401 |
+
where $D _ { \lambda } ( \cdot | | \cdot )$ denotes the Rényi divergence of order $\lambda$ .
|
| 402 |
+
|
| 403 |
+
We next introduce some useful properties of RDP.
|
| 404 |
+
|
| 405 |
+
Lemma D.2 (Gaussian mechanism of RDP). Let $S = \operatorname* { m a x } _ { \mathbb { D } \sim \mathbb { D ^ { \prime } } } \| f ( \mathbb { D } ) - f ( \mathbb { D ^ { \prime } } ) \|$ be the $l _ { 2 }$ sensitivity, then Gaussian mechanism $\mathcal { M } = f ( \mathbb { D } ) + z$ satisfies $( \lambda , \frac { \lambda S ^ { 2 } } { 2 \sigma ^ { 2 } } )$ -RDP, where $z \sim \mathcal { N } ( 0 , \sigma ^ { 2 } I _ { p \times p } )$ .
|
| 406 |
+
|
| 407 |
+
Lemma D.3 (Composition of RDP). If $M _ { 1 }$ , $M _ { 2 }$ satisfy $( \lambda , \gamma _ { 1 } )$ -RDP and $( \lambda , \gamma _ { 2 } )$ -RDP respectively, then their composition satisfies $( \lambda , \gamma _ { 1 } + \gamma _ { 2 } ) – R D P$ .
|
| 408 |
+
|
| 409 |
+
Lemma D.4 (Conversion from RDP to $( \epsilon , \delta )$ -DP). If $\mathcal { M }$ obeys $( \lambda , \gamma )$ -RDP, then $\mathcal { M }$ obeys $( \gamma +$ $\log ( 1 / \delta ) / ( \lambda - 1 ) , \delta )$ -DP for all $0 < \delta < 1$ .
|
| 410 |
+
|
| 411 |
+
Now we proof Theorem 3.1. Let $W$ , $W ^ { \prime }$ be the gradient embeddings of two neighboring datasets $\mathbb { D } \sim \mathbb { D } ^ { \prime }$ and $R , R ^ { \prime }$ be corresponding residual gradients. Without loss of generality, suppose $W \left( R \right)$ has one more row than $W ^ { \prime } \left( R ^ { \prime } \right)$ . For given sensitivity $S _ { 1 } , S _ { 2 }$ ,
|
| 412 |
+
|
| 413 |
+
$$
|
| 414 |
+
\operatorname* { m a x } _ { \mathbb { D } \sim \mathbb { D } ^ { \prime } } \| \boldsymbol { w } - \boldsymbol { w } ^ { \prime } \| = \operatorname* { m a x } _ { \boldsymbol { W } \sim \boldsymbol { W } ^ { \prime } } \| \boldsymbol { W } _ { n , : } \| \le S _ { 1 } , \quad \operatorname* { m a x } _ { \mathbb { D } \sim \mathbb { D } ^ { \prime } } \| \boldsymbol { r } - \boldsymbol { r } ^ { \prime } \| = \operatorname* { m a x } _ { \boldsymbol { R } \sim \boldsymbol { R } ^ { \prime } } \| \boldsymbol { R } _ { n , : } \| \le S _ { 2 } .
|
| 415 |
+
$$
|
| 416 |
+
|
| 417 |
+
If we set $\sigma _ { 1 } = S _ { 1 } \sigma$ and $\sigma _ { 2 } = S _ { 2 } \sigma$ for some $\sigma$ , then Algorithm 1 satisfies $( \lambda , { \frac { \lambda } { \sigma ^ { 2 } } } )$ -RDP because of Lemma D.2 and D.3. In order to guarantee $( \epsilon , \delta )$ -DP, we need
|
| 418 |
+
|
| 419 |
+
$$
|
| 420 |
+
\frac { \lambda } { \sigma ^ { 2 } } + \frac { \log ( 1 / \delta ) } { \lambda - 1 } \leq \epsilon .
|
| 421 |
+
$$
|
| 422 |
+
|
| 423 |
+
Choose $\begin{array} { r } { \lambda = 1 + \frac { 2 \log ( 1 / \delta ) } { \epsilon } } \end{array}$ and rearrange Eq (5), we need
|
| 424 |
+
|
| 425 |
+
$$
|
| 426 |
+
\sigma ^ { 2 } \geq \frac { 2 \left( \epsilon + 2 \log ( 1 / \delta ) \right) } { \epsilon ^ { 2 } } .
|
| 427 |
+
$$
|
| 428 |
+
|
| 429 |
+
Then using the constraint on $\epsilon$ concludes the proof.
|
| 430 |
+
|
| 431 |
+
Theorem 3.2. For any $\epsilon < 2 \log ( 1 / \delta )$ and $\delta \in ( 0 , 1 )$ , the output of Algorithm 2 satisfies $( \epsilon , \delta )$ -DP if we set $\sigma \geq 2 \sqrt { 2 T \log ( 1 / \delta ) } / \epsilon$ .
|
| 432 |
+
|
| 433 |
+
Proof of Theorem 3.2. From the proof of Theorem 3.1, we have each call of GEP satisfies $( \lambda , { \frac { \lambda } { \sigma ^ { 2 } } } )$ - RDP. Then by the composition property of RDP (Lemma D.3), the output of Algorithm 2 satisfies $( \lambda , \frac { T \lambda } { \sigma ^ { 2 } } )$ -RDP. Plugging $\textstyle { \frac { T \lambda } { \sigma ^ { 2 } } }$ into Equation 5 and 6 concludes the proof.
|
| 434 |
+
|
| 435 |
+
Theorem 3.3. Suppose the loss $\begin{array} { r } { L ( \pmb \theta ) = \frac { 1 } { n } \sum _ { ( \pmb x , y ) \in \mathbb { D } } \ell ( f _ { \pmb \theta } ( \pmb x ) , y ) } \end{array}$ is $I$ -Lipschitz, convex, and $\beta$ - smooth. If $\begin{array} { r l r } { \eta } & { { } = } & { \frac { 1 } { \beta } } \end{array}$ , $\begin{array} { l } { T \ = \ { \frac { n \beta \epsilon } { \sqrt { p } } } } \end{array}$ √p , and $\begin{array} { r c l } { \overline { { \pmb { \theta } } } } & { = } & { \frac { 1 } { T } \sum _ { t = 1 } ^ { T } \pmb { \theta } _ { t } } \end{array}$ , then we have $\begin{array} { r } { \mathbb { E } [ L ( \bar { \pmb \theta } ) ] ~ - ~ L ( \pmb \theta _ { * } ) ~ \leq } \end{array}$ $\begin{array} { r } { \mathcal { O } \left( \frac { \sqrt { k \log ( 1 / \delta ) } } { n \epsilon } + \frac { \bar { r } \sqrt { p \log ( 1 / \delta ) } } { n \epsilon } \right) } \end{array}$ , where r¯ = 1T PT −1t=0 r2t and rt = maxi k(Rt)i,:k is the sensitivity of residual gradient at step $t$ .
|
| 436 |
+
|
| 437 |
+
Proof of Theorem 3.3. The $\beta$ -smooth condition gives
|
| 438 |
+
|
| 439 |
+
$$
|
| 440 |
+
L ( \pmb \theta _ { t + 1 } ) \leq L ( \pmb \theta _ { t } ) + \langle \nabla L ( \pmb \theta _ { t } ) , \pmb \theta _ { t + 1 } - \pmb \theta _ { t } \rangle + \frac { \beta } { 2 } \left. \pmb \theta _ { t + 1 } - \pmb \theta _ { t } \right. ^ { 2 } .
|
| 441 |
+
$$
|
| 442 |
+
|
| 443 |
+
Based on the update rule of GEP we have
|
| 444 |
+
|
| 445 |
+
$$
|
| 446 |
+
\pmb { \theta } _ { t + 1 } - \pmb { \theta } _ { t } = - \eta \tilde { \pmb { v } } = - \eta \nabla L ( \pmb { \theta } _ { t } ) - \frac { \eta } { n } ( z _ { t } ^ { ( 1 ) } \pmb { B } + z _ { t } ^ { ( 2 ) } ) ,
|
| 447 |
+
$$
|
| 448 |
+
|
| 449 |
+
where $\boldsymbol { z } _ { t } ^ { ( 1 ) } \sim \mathcal { N } ( 0 , \sigma ^ { 2 } \boldsymbol { I } _ { k \times k } )$ , $\boldsymbol { z } _ { t } ^ { ( 2 ) } \sim \mathcal { N } ( \boldsymbol { 0 } , \sigma ^ { 2 } r _ { t } ^ { 2 } \boldsymbol { I } _ { p \times p } )$ are the perturbation noises and $r _ { t } = $ $\operatorname * { m a x } _ { i } \| ( \pmb { R } _ { t } ) _ { i , : } \|$ is the sensitivity of residual gradients at step $t$ .
|
| 450 |
+
|
| 451 |
+
Take expectation on Eq (7) with respect to the perturbation noises.
|
| 452 |
+
|
| 453 |
+
$$
|
| 454 |
+
\mathbb { E } [ L ( \pmb { \theta } _ { t + 1 } ) ] \leq \mathbb { E } [ L ( \pmb { \theta } _ { t } ) ] - ( \eta - \beta \eta ^ { 2 } / 2 ) \mathbb { E } [ \| \nabla L ( \pmb { \theta } _ { t } ) \| ^ { 2 } ] + \frac { \beta \eta ^ { 2 } \sigma ^ { 2 } } { 2 n ^ { 2 } } \left( k + p r _ { t } ^ { 2 } \right) .
|
| 455 |
+
$$
|
| 456 |
+
|
| 457 |
+
Subtract $L ( \theta _ { * } )$ from both sides, we have
|
| 458 |
+
|
| 459 |
+
$$
|
| 460 |
+
\begin{array} { r l } & { \mathbb { I } [ L ( \theta _ { t + 1 } ) ] - L ( \theta _ { * } ) \le \mathbb { E } [ L ( \theta _ { t } ) ] - L ( \theta _ { * } ) - ( \eta - \beta \eta ^ { 2 } / 2 ) \mathbb { E } [ \left. \nabla L ( \theta _ { t } ) \right. ^ { 2 } ] + \displaystyle \frac { \beta \eta ^ { 2 } \sigma ^ { 2 } } { 2 n ^ { 2 } } \left( k + p r _ { t } ^ { 2 } \right) } \\ & { \qquad \le \mathbb { E } [ \langle \nabla L ( \theta _ { t } ) , \theta _ { t } - \theta _ { * } \rangle ] - ( \eta - \beta \eta ^ { 2 } / 2 ) \mathbb { E } [ \left. \nabla L ( \theta _ { t } ) \right. ^ { 2 } ] + \displaystyle \frac { \beta \eta ^ { 2 } \sigma ^ { 2 } } { 2 n ^ { 2 } } \left( k + p r _ { t } ^ { 2 } \right) . } \end{array}
|
| 461 |
+
$$
|
| 462 |
+
|
| 463 |
+
The second inequality holds because $L$ is convex. Then choose $\begin{array} { r } { \eta \mathrm { ~ = ~ } \frac { 1 } { \beta } } \end{array}$ and plug $\nabla L ( \pmb \theta _ { t } ) =$ $( \pmb { \theta } _ { t } - \pmb { \theta } _ { t + 1 } ) / \eta - ( z _ { 1 } ^ { t } \pmb { B } + z _ { 2 } ^ { t } ) / n$ into Eq (10).
|
| 464 |
+
|
| 465 |
+
$$
|
| 466 |
+
\begin{array} { r l } & { \displaystyle \mathbb { E } [ L ( \theta _ { t + 1 } ) ] - L ( \theta _ { * } ) \le \beta \mathbb { E } [ \langle \theta _ { t } - \theta _ { t + 1 } , \theta _ { t } - \theta _ { * } \rangle ] - \frac { \beta } { 2 } \mathbb { E } [ \| \theta _ { t } - \theta _ { t + 1 } \| ^ { 2 } ] + \frac { \sigma ^ { 2 } } { \beta n ^ { 2 } } \left( k + p r _ { t } ^ { 2 } \right) } \\ & { \quad \quad \quad \quad \quad = \displaystyle \frac { \beta } { 2 } \left( \mathbb { E } [ \| \theta _ { t } - \theta _ { * } \| ^ { 2 } ] - \mathbb { E } [ \| \theta _ { t + 1 } - \theta _ { * } \| ^ { 2 } ] \right) + \frac { \sigma ^ { 2 } } { \beta n ^ { 2 } } \left( k + p r _ { t } ^ { 2 } \right) . } \end{array}
|
| 467 |
+
$$
|
| 468 |
+
|
| 469 |
+
Sum over $t = 0 , \ldots , T - 1$ and use convexity, we have
|
| 470 |
+
|
| 471 |
+
$$
|
| 472 |
+
\mathbb { E } [ L ( \bar { \theta } ) ] - L ( \theta _ { * } ) \le \frac { \beta } { 2 T } \lVert \theta _ { 0 } - \theta _ { * } \rVert + \frac { \sigma ^ { 2 } } { \beta n ^ { 2 } } ( k + \frac { p } { T } \sum _ { t = 0 } ^ { T - 1 } r _ { t } ^ { 2 } ) .
|
| 473 |
+
$$
|
| 474 |
+
|
| 475 |
+
Then substituting $\begin{array} { r } { T = \frac { n \beta \epsilon } { \sqrt { p } } } \end{array}$ and $\sigma = \mathcal { O } ( \sqrt { T \log ( 1 / \delta ) } / \epsilon )$ yields the desired bound.
|
md/train/B14TlG-RW/B14TlG-RW.md
ADDED
|
@@ -0,0 +1,314 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# QANET: COMBINING LOCAL CONVOLUTION WITH GLOBAL SELF-ATTENTION FOR READING COMPREHENSION
|
| 2 |
+
|
| 3 |
+
Adams Wei $\mathbf { Y u } ^ { 1 }$ ∗, David Dohan2†, Minh-Thang Luong2† {weiyu}@cs.cmu.edu, {ddohan,thangluong}@google.com 1Carnegie Mellon University, 2Google Brain
|
| 4 |
+
|
| 5 |
+
Rui Zhao, Kai Chen, Mohammad Norouzi, Quoc V. Le Google Brain
|
| 6 |
+
|
| 7 |
+
# ABSTRACT
|
| 8 |
+
|
| 9 |
+
Current end-to-end machine reading and question answering (Q&A) models are primarily based on recurrent neural networks (RNNs) with attention. Despite their success, these models are often slow for both training and inference due to the sequential nature of RNNs. We propose a new Q&A architecture called QANet, which does not require recurrent networks: Its encoder consists exclusively of convolution and self-attention, where convolution models local interactions and self-attention models global interactions. On the SQuAD dataset, our model is 3x to $1 3 \mathrm { x }$ faster in training and $4 \mathbf { x }$ to $9 \mathbf { x }$ faster in inference, while achieving equivalent accuracy to recurrent models. The speed-up gain allows us to train the model with much more data. We hence combine our model with data generated by backtranslation from a neural machine translation model. On the SQuAD dataset, our single model, trained with augmented data, achieves 84.6 F1 score1 on the test set, which is significantly better than the best published F1 score of 81.8.
|
| 10 |
+
|
| 11 |
+
# 1 INTRODUCTION
|
| 12 |
+
|
| 13 |
+
There is growing interest in the tasks of machine reading comprehension and automated question answering. Over the past few years, significant progress has been made with end-to-end models showing promising results on many challenging datasets. The most successful models generally employ two key ingredients: (1) a recurrent model to process sequential inputs, and (2) an attention component to cope with long term interactions. A successful combination of these two ingredients is the Bidirectional Attention Flow (BiDAF) model by Seo et al. (2016), which achieve strong results on the SQuAD dataset (Rajpurkar et al., 2016). A weakness of these models is that they are often slow for both training and inference due to their recurrent nature, especially for long texts. The expensive training not only leads to high turnaround time for experimentation and limits researchers from rapid iteration but also prevents the models from being used for larger dataset. Meanwhile the slow inference prevents the machine comprehension systems from being deployed in real-time applications.
|
| 14 |
+
|
| 15 |
+
In this paper, aiming to make the machine comprehension fast, we propose to remove the recurrent nature of these models. We instead exclusively use convolutions and self-attentions as the building blocks of encoders that separately encodes the query and context. Then we learn the interactions between context and question by standard attentions (Xiong et al., 2016; Seo et al., 2016; Bahdanau et al., 2015). The resulting representation is encoded again with our recurrency-free encoder before finally decoding to the probability of each position being the start or end of the answer span. We call this architecture QANet, which is shown in Figure 1.
|
| 16 |
+
|
| 17 |
+
The key motivation behind the design of our model is the following: convolution captures the local structure of the text, while the self-attention learns the global interaction between each pair of words. The additional context-query attention is a standard module to construct the query-aware context vector for each position in the context paragraph, which is used in the subsequent modeling layers. The feed-forward nature of our architecture speeds up the model significantly. In our experiments on the SQuAD dataset, our model is $3 \mathbf { x }$ to $1 3 \mathrm { x }$ faster in training and 4x to $9 \mathbf { x }$ faster in inference. As a simple comparison, our model can achieve the same accuracy (77.0 F1 score) as BiDAF model (Seo et al., 2016) within 3 hours training that otherwise should have taken 15 hours. The speed-up gain also allows us to train the model with more iterations to achieve better results than competitive models. For instance, if we allow our model to train for 18 hours, it achieves an F1 score of 82.7 on the dev set, which is much better than (Seo et al., 2016), and is on par with best published results.
|
| 18 |
+
|
| 19 |
+
As our model is fast, we can train it with much more data than other models. To further improve the model, we propose a complementary data augmentation technique to enhance the training data. This technique paraphrases the examples by translating the original sentences from English to another language and then back to English, which not only enhances the number of training instances but also diversifies the phrasing.
|
| 20 |
+
|
| 21 |
+
On the SQuAD dataset, QANet trained with the augmented data achieves 84.6 F1 score on the test set, which is significantly better than the best published result of 81.8 by Hu et al. (2017).2 We also conduct ablation test to justify the usefulness of each component of our model. In summary, the contribution of this paper are as follows:
|
| 22 |
+
|
| 23 |
+
• We propose an efficient reading comprehension model that exclusively built upon convolutions and self-attentions. To the best of our knowledge, we are the first to do so. This combination maintains good accuracy, while achieving up to $1 3 \mathrm { x }$ speedup in training and $9 \mathbf { x }$ per training iteration, compared to the RNN counterparts. The speedup gain makes our model the most promising candidate for scaling up to larger datasets. • To improve our result on SQuAD, we propose a novel data augmentation technique to enrich the training data by paraphrasing. It allows the model to achieve higher accuracy that is better than the state-of-the-art.
|
| 24 |
+
|
| 25 |
+
# 2 THE MODEL
|
| 26 |
+
|
| 27 |
+
In this section, we first formulate the reading comprehension problem and then describe the proposed model QANet: it is a feedforward model that consists of only convolutions and self-attention, a combination that is empirically effective, and is also a novel contribution of our work.
|
| 28 |
+
|
| 29 |
+
# 2.1 PROBLEM FORMULATION
|
| 30 |
+
|
| 31 |
+
The reading comprehension task considered in this paper, is defined as follows. Given a context paragraph with $n$ words $C = \{ c _ { 1 } , c _ { 2 } , . . . , c _ { n } \}$ and the query sentence with $m$ words $Q = \{ q _ { 1 } , q _ { 2 } , . . . , \bar { q } _ { m } \}$ , output a span $S = \{ c _ { i } , c _ { i + 1 } , . . . , c _ { i + j } \}$ from the original paragraph $C$ . In the following, we will use $x$ to denote both the original word and its embedded vector, for any $x \in C , Q$ .
|
| 32 |
+
|
| 33 |
+
# 2.2 MODEL OVERVIEW
|
| 34 |
+
|
| 35 |
+
The high level structure of our model is similar to most existing models that contain five major components: an embedding layer, an embedding encoder layer, a context-query attention layer, a model encoder layer and an output layer, as shown in Figure 1. These are the standard building blocks for most, if not all, existing reading comprehension models. However, the major differences between our approach and other methods are as follow: For both the embedding and modeling encoders, we only use convolutional and self-attention mechanism, discarding RNNs, which are used by most of the existing reading comprehension models. As a result, our model is much faster, as it can process the input tokens in parallel. Note that even though self-attention has already been used extensively in Vaswani et al. (2017a), the combination of convolutions and self-attention is novel, and is significantly better than self-attention alone and gives 2.7 F1 gain in our experiments. The use of convolutions also allows us to take advantage of common regularization methods in ConvNets such as stochastic depth (layer dropout) (Huang et al., 2016), which gives an additional gain of $0 . 2 \mathrm { F } 1$ in our experiments.
|
| 36 |
+
|
| 37 |
+

|
| 38 |
+
Figure 1: An overview of the QANet architecture (left) which has several Encoder Blocks. We use the same Encoder Block (right) throughout the model, only varying the number of convolutional layers for each block. We use layernorm and residual connection between every layer in the Encoder Block. We also share weights of the context and question encoder, and of the three output encoders. A positional encoding is added to the input at the beginning of each encoder layer consisting of sin and cos functions at varying wavelengths, as defined in (Vaswani et al., 2017a). Each sub-layer after the positional encoding (one of convolution, self-attention, or feed-forward-net) inside the encoder structure is wrapped inside a residual block.
|
| 39 |
+
|
| 40 |
+
In detail, our model consists of the following five layers:
|
| 41 |
+
|
| 42 |
+
1. Input Embedding Layer. We adopt the standard techniques to obtain the embedding of each word $w$ by concatenating its word embedding and character embedding. The word embedding is fixed during training and initialized from the $p _ { 1 } = 3 0 0$ dimensional pre-trained GloVe (Pennington et al., 2014) word vectors, which are fixed during training. All the out-of-vocabulary words are mapped to an ${ \mathrm { < U N K > } }$ token, whose embedding is trainable with random initialization. The character embedding is obtained as follows: Each character is represented as a trainable vector of dimension $p _ { 2 } = 2 0 0$ , meaning each word can be viewed as the concatenation of the embedding vectors for each of its characters. The length of each word is either truncated or padded to 16. We take maximum value of each row of this matrix to get a fixed-size vector representation of each word. Finally, the output of a given word $x$ from this layer is the concatenation $[ x _ { w } ; x _ { c } ] \in \mathbf { R } ^ { p _ { 1 } + p _ { 2 } }$ , where $x _ { w }$ and $x _ { c }$ are the word embedding and the convolution output of character embedding of $x$ respectively. Following Seo et al. (2016), we also adopt a two-layer highway network (Srivastava et al., 2015) on top of this representation. For simplicity, we also use $x$ to denote the output of this layer.
|
| 43 |
+
|
| 44 |
+
2. Embedding Encoder Layer. The encoder layer is a stack of the following basic building block: [convolution-layer $\times \# +$ self-attention-layer $^ +$ feed-forward-layer], as illustrated in the upper right of Figure 1. We use depthwise separable convolutions (Chollet, 2016) (Kaiser et al., 2017) rather than traditional ones, as we observe that it is memory efficient and has better generalization. The kernel size is 7, the number of filters is $d = 1 2 8$ and the number of conv layers within a block is
|
| 45 |
+
|
| 46 |
+
4. For the self-attention-layer, we adopt the multi-head attention mechanism defined in (Vaswani et al., 2017a) which, for each position in the input, called the query, computes a weighted sum of all positions, or keys, in the input based on the similarity between the query and key as measured by the dot product. The number of heads is 8 throughout all the layers. Each of these basic operations (conv/self-attention/ffn) is placed inside a residual block, shown lower-right in Figure 1. For an input $x$ and a given operation $f$ , the output is $f ( l a y e r n o r m ( x ) ) + x$ , meaning there is a full identity path from the input to output of each block, where layernorm indicates layer-normalization proposed in (Ba et al., 2016). The total number of encoder blocks is 1. Note that the input of this layer is a vector of dimension $p _ { 1 } + p _ { 2 } = 5 0 0$ for each individual word, which is immediately mapped to $d = 1 2 8$ by a one-dimensional convolution. The output of this layer is a also of dimension $d = 1 2 8$ .
|
| 47 |
+
|
| 48 |
+
3. Context-Query Attention Layer. This module is standard in almost every previous reading comprehension models such as Weissenborn et al. (2017) and Chen et al. (2017). We use $C$ and $Q$ to denote the encoded context and query. The context-to-query attention is constructed as follows: We first computer the similarities between each pair of context and query words, rendering a similarity matrix $S \in \mathbf { R } ^ { n \times m }$ . We then normalize each row of $S$ by applying the softmax function, getting a matrix $\overline { S }$ . Then the context-to-query attention is computed as $\bar { A } = \mathbf { \bar { \boldsymbol { S } } } \cdot \boldsymbol { Q } ^ { T } \in \mathbf { R } ^ { n \times d }$ . The similarity function used here is the trilinear function (Seo et al., 2016):
|
| 49 |
+
|
| 50 |
+
$$
|
| 51 |
+
\begin{array} { r } { f ( q , c ) = W _ { 0 } [ q , c , q \odot c ] , } \end{array}
|
| 52 |
+
$$
|
| 53 |
+
|
| 54 |
+
where $\odot$ is the element-wise multiplication and $W _ { 0 }$ is a trainable variable.
|
| 55 |
+
|
| 56 |
+
Most high performing models additionally use some form of query-to-context attention, such as BiDaF (Seo et al., 2016) and DCN (Xiong et al., 2016). Empirically, we find that, the DCN attention can provide a little benefit over simply applying context-to-query attention, so we adopt this strategy. More concretely, we compute the column normalized matrix $\overline { { \overline { { S } } } }$ of $S$ by softmax function, and the query-to-context attention is B = S · S · C T .
|
| 57 |
+
|
| 58 |
+
4. Model Encoder Layer. Similar to Seo et al. (2016), the input of this layer at each position is $\left[ c , a , c \odot a , c \odot b \right]$ , where $a$ and $b$ are respectively a row of attention matrix $A$ and $B$ . The layer parameters are the same as the Embedding Encoder Layer except that convolution layer number is 2 within a block and the total number of blocks are 7. We share weights between each of the 3 repetitions of the model encoder.
|
| 59 |
+
|
| 60 |
+
5. Output layer. This layer is task-specific. Each example in SQuAD is labeled with a span in the context containing the answer. We adopt the strategy of Seo et al. (2016) to predict the probability of each position in the context being the start or end of an answer span. More specifically, the probabilities of the starting and ending position are modeled as
|
| 61 |
+
|
| 62 |
+
$$
|
| 63 |
+
p ^ { 1 } = s o f t m a x ( W _ { 1 } [ M _ { 0 } ; M _ { 1 } ] ) , ~ p ^ { 2 } = s o f t m a x ( W _ { 2 } [ M _ { 0 } ; M _ { 2 } ] ) ,
|
| 64 |
+
$$
|
| 65 |
+
|
| 66 |
+
where $W _ { 1 }$ and $W _ { 2 }$ are two trainable variables and $M _ { 0 } , M _ { 1 } , M _ { 2 }$ are respectively the outputs of the three model encoders, from bottom to top. The score of a span is the product of its start position and end position probabilities. Finally, the objective function is defined as the negative sum of the log probabilities of the predicted distributions indexed by true start and end indices, averaged over all the training examples:
|
| 67 |
+
|
| 68 |
+
$$
|
| 69 |
+
L ( \theta ) = - \frac { 1 } { N } \sum _ { i } ^ { N } \left[ \log ( p _ { y _ { i } ^ { 1 } } ^ { 1 } ) + \log ( p _ { y _ { i } ^ { 2 } } ^ { 2 } ) \right] ,
|
| 70 |
+
$$
|
| 71 |
+
|
| 72 |
+
where $y _ { i } ^ { 1 }$ and $y _ { i } ^ { 2 }$ are respectively the groundtruth starting and ending position of example $i$ , and $\theta$ contains all the trainable variables. The proposed model can be customized to other comprehension tasks, e.g. selecting from the candidate answers, by changing the output layers accordingly.
|
| 73 |
+
|
| 74 |
+
Inference. At inference time, the predicted span $( s , e )$ is chosen such that $p _ { s } ^ { 1 } p _ { e } ^ { 2 }$ is maximized and $s \leq e$ . Standard dynamic programming can obtain the result with linear time.
|
| 75 |
+
|
| 76 |
+
# 3 DATA AUGMENTATION BY BACKTRANSLATION
|
| 77 |
+
|
| 78 |
+
Since our model is fast, we can train it with much more data. We therefore combine our model with a simple data augmentation technique to enrich the training data. The idea is to use two translation models, one translation model from English to French (or any other language) and another translation model from French to English, to obtain paraphrases of texts. This approach helps automatically increase the amount of training data for broadly any language-based tasks including the reading comprehension task that we are interested in. With more data, we expect to better regularize our models. The augmentation process is illustrated in Figure 2 with French as a pivotal language.
|
| 79 |
+
|
| 80 |
+
In this work, we consider attention-based neural machine translation (NMT) models Bahdanau et al. (2015); Luong et al. (2015), which have demonstrated excellent translation quality Wu et al. (2016), as the core models of our data augmentation pipeline. Specifically, we utilize the publicly available codebase3 provided by Luong et al. (2017), which replicates the Google’s NMT (GNMT) systems Wu et al. (2016). We train 4-layer GNMT models on the public WMT data for both English-French4 (36M sentence pairs) and English-German5 (4.5M sentence pairs). All data have been tokenized and split into subword units as described in Luong et al. (2017). All models share the same hyperparameters6 and are trained with different numbers of steps, 2M for English-French and 340K for English-German. Our English-French systems achieve 36.7 BLEU on newstest2014 for translating into French and 35.9 BLEU for the reverse direction. For English-German and on newstest2014, we obtain 27.6 BLEU for translating into German and 29.9 BLEU for the reverse direction.
|
| 81 |
+
|
| 82 |
+

|
| 83 |
+
Figure 2: An illustration of the data augmentation process with French as a pivotal language. $\mathbf { k }$ is the beam width, which is the number of translations generated by the NMT system.
|
| 84 |
+
|
| 85 |
+
Our paraphrase process works as follows, supposedly with French as a pivotal language. First, we feed an input sequence into the beam decoder of an English-to-French model to obtain $k$ French translations. Each of the French translation is then passed through the beam decoder of a reversed translation model to obtain a total of $k ^ { 2 }$ paraphrases of the input sequence.
|
| 86 |
+
|
| 87 |
+
Relation to existing Works. While the concept of backtranslation has been introduced before, it is often used to improve either the same translation task Sennrich et al. (2016) or instrinsic paraphrase evaluations Wieting et al. (2017); Mallinson et al. (2017). Our approach is a novel application of backtranslation to enrich training data for down-stream tasks, in this case, the question answering (QA) task. It is worth to note that (Dong et al., 2017) use paraphrasing techniques to improve QA; however, they only paraphrase questions and did not focus on the data augmentation aspect as we do in this paper.
|
| 88 |
+
|
| 89 |
+
Handling SQuAD Documents and Answers. We now discuss our specific procedure for the SQuAD dataset, which is essential for best performance gains. Remember that, each training example of SQuAD is a triple of $( d , q , a )$ in which document $d$ is a multi-sentence paragraph that has the answer $a$ . When paraphrasing, we keep the question $q$ unchanged (to avoid accidentally changing its meaning) and generate new triples of $\bar { ( d ^ { \prime } , q , a ^ { \prime } ) }$ such that the new document $d ^ { \prime }$ has the new answer $a ^ { \prime }$ in it. The procedure happens in two steps: (i) document paraphrasing – paraphrase $d$ into $d ^ { \prime }$ and (b) answer extraction – extract $a ^ { \prime }$ from $d ^ { \prime }$ that closely matches $a$ .
|
| 90 |
+
|
| 91 |
+
For the document paraphrasing step, we first split paragraphs into sentences and paraphrase them independently. We use $k = 5$ , so each sentence has 25 paraphrase choices. A new document $d ^ { \prime }$ is formed by simply replacing each sentence in $d$ with a randomly-selected paraphrase. An obvious issue with this na¨ıve approach is that the original answer $a$ might no longer be present in $d ^ { \prime }$ .
|
| 92 |
+
|
| 93 |
+
The answer extraction addresses the aforementioned issue. Let $s$ be the original sentence that contains the original answer $a$ and $s ^ { \prime }$ be its paraphrase. We identify the newly-paraphrased answer with simple heuristics as follows. Character-level 2-gram scores are computed between each word in $s ^ { \prime }$ and the start / end words of $a$ to find start and end positions of possible answers in $s ^ { \prime }$ . Among all candidate paraphrased answer, the one with the highest character 2-gram score with respect to $a$ is selected as the new answer $a ^ { \prime }$ . Table 1 shows an example of the new answer found by this process.7
|
| 94 |
+
|
| 95 |
+
Table 1: Comparison between answers in original sentence and paraphrased sentence.
|
| 96 |
+
|
| 97 |
+
<table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>Sentence that contains an answer</td><td rowspan=1 colspan=1>Answer</td></tr><tr><td rowspan=1 colspan=1>Original</td><td rowspan=1 colspan=1>All of the departments in the College of Science offer PhDprograms,except for the Department of Pre-ProfessionalStudies.</td><td rowspan=1 colspan=1>Department of Pre-Professional Studies</td></tr><tr><td rowspan=1 colspan=1>Paraphrase</td><td rowspan=1 colspan=1>All departments in the College of Science offer PHD pro- grams with the exception of the Department of PreparatoryStudies.</td><td rowspan=1 colspan=1>Department of PreparatoryStudies</td></tr></table>
|
| 98 |
+
|
| 99 |
+
The quality and diversity of paraphrases are essential to the data augmentation method. It is still possible to improve the quality and diversity of this method. The quality can be improved by using better translation models. For example, we find paraphrases significantly longer than our models’ maximum training sequence length tend to be cut off in the middle. The diversity can be improved by both sampling during the beam search decoding and paraphrasing questions and answers in the dataset as well. In addition, we can combine this method with other data augmentation methods, such as, the type swap method (Raiman & Miller, 2017), to acquire more diversity in paraphrases.
|
| 100 |
+
|
| 101 |
+
In our experiments, we observe that the proposed data augmentation can bring non-trivial improvement in terms of accuracy. We believe this technique is also applicable to other supervised natural language processing tasks, especially when the training data is insufficient.
|
| 102 |
+
|
| 103 |
+
# 4 EXPERIMENTS
|
| 104 |
+
|
| 105 |
+
In this section, we conduct experiments to study the performance of our model and the data augmentation technique. We will primarily benchmark our model on the SQuAD dataset (Rajpurkar et al., 2016), considered to be one of the most competitive datasets in Q&A. We also conduct similar studies on TriviaQA (Joshi et al., 2017), another Q&A dataset, to show that the effectiveness and efficiency of our model are general.
|
| 106 |
+
|
| 107 |
+
# 4.1 EXPERIMENTS ON SQUAD
|
| 108 |
+
|
| 109 |
+
# 4.1.1 DATASET AND EXPERIMENTAL SETTINGS
|
| 110 |
+
|
| 111 |
+
Dataset. We consider the Stanford Question Answering Dataset (SQuAD) (Rajpurkar et al., 2016) for machine reading comprehension.8 SQuAD contains 107.7K query-answer pairs, with $8 7 . 5 \mathrm { K }$ for training, 10.1K for validation, and another 10.1K for testing. The typical length of the paragraphs is around 250 while the question is of 10 tokens although there are exceptionally long cases. Only the training and validation data are publicly available, while the test data is hidden that one has to submit the code to a Codalab and work with the authors of (Rajpurkar et al., 2016) to retrieve the final test score. In our experiments, we report the test set result of our best single model.9 For further analysis, we only report the performance on the validation set, as we do not want to probe the unseen test set by frequent submissions. According to the observations from our experiments and previous works, such as (Seo et al., 2016; Xiong et al., 2016; Wang et al., 2017; Chen et al., 2017), the validation score is well correlated with the test score.
|
| 112 |
+
|
| 113 |
+
Data Preprocessing. We use the NLTK tokenizer to preprocess the data.10 The maximum context length is set to 400 and any paragraph longer than that would be discarded. During training, we batch the examples by length and dynamically pad the short sentences with special symbol ${ \mathrm { < P A D > } }$ . The maximum answer length is set to 30. We use the pretrained 300-D word vectors GLoVe (Pennington et al., 2014), and all the out-of-vocabulary words are replace with ${ \mathrm { < U N K > } }$ , whose embedding is updated during training. Each character embedding is randomly initialized as a 200-D vector, which is updated in training as well. We generate two additional augmented datasets obtained from Section 3, which contain 140K and $2 4 0 \mathrm { K }$ examples and are denoted as “data augmentation $\times 2 ^ { , , }$ and “data augmentation $\times 3 ^ { \mathfrak { r } }$ respectively, including the original data.
|
| 114 |
+
|
| 115 |
+
Training details. We employ two types of standard regularizations. First, we use L2 weight decay on all the trainable variables, with parameter $\lambda = 3 \times \bar { 1 0 } ^ { - 7 }$ . We additionally use dropout on word, character embeddings and between layers, where the word and character dropout rates are 0.1 and 0.05 respectively, and the dropout rate between every two layers is 0.1. We also adopt the stochastic depth method (layer dropout) (Huang et al., 2016) within each embedding or model encoder layer, where sublayer l has survival probability $\begin{array} { r } { p _ { l } = 1 - \frac { l } { L } ( 1 - p _ { L } ) } \end{array}$ where $L$ is the last layer and $p _ { L } = 0 . 9$ .
|
| 116 |
+
|
| 117 |
+
The hidden size and the convolution filter number are all 128, the batch size is 32, training steps are 150K for original data, 250K for “data augmentation $\times 2 ^ { , , }$ , and 340K for “data augmentation $\times 3 ^ { \mathfrak { s } }$ . The numbers of convolution layers in the embedding and modeling encoder are 4 and 2, kernel sizes are 7 and 5, and the block numbers for the encoders are 1 and 7, respectively.
|
| 118 |
+
|
| 119 |
+
We use the ADAM optimizer (Kingma & Ba, 2014) with $\beta _ { 1 } = 0 . 8 , \beta _ { 2 } = 0 . 9 9 9 , { \epsilon } = 1 0 ^ { - 7 }$ . We use a learning rate warm-up scheme with an inverse exponential increase from 0.0 to 0.001 in the first 1000 steps, and then maintain a constant learning rate for the remainder of training. Exponential moving average is applied on all trainable variables with a decay rate 0.9999.
|
| 120 |
+
|
| 121 |
+
Finally, we implement our model in Python using Tensorflow (Abadi et al., 2016) and carry out our experiments on an NVIDIA p100 GPU.11
|
| 122 |
+
|
| 123 |
+
# 4.1.2 RESULTS
|
| 124 |
+
|
| 125 |
+
Accuracy. The F1 and Exact Match (EM) are two evaluation metrics of accuracy for the model performance. F1 measures the portion of overlap tokens between the predicted answer and groundtruth, while exact match score is 1 if the prediction is exactly the same as groundtruth or 0 otherwise. We show the results in comparison with other methods in Table 2. To make a fair and thorough comparison, we both report both the published results in their latest papers/preprints and the updated but not documented results on the leaderboard. We deem the latter as the unpublished results. As can be seen from the table, the accuracy (EM/F1) performance of our model is on par with the state-of-the-art models. In particular, our model trained on the original dataset outperforms all the documented results in the literature, in terms of both EM and F1 scores (see second column of Table 2). When trained with the augmented data with proper sampling scheme, our model can get significant gain 1.5/1.1 on EM/F1. Finally, our result on the official test set is 76.2/84.6, which significantly outperforms the best documented result 73.2/81.8.
|
| 126 |
+
|
| 127 |
+
Speedup over RNNs. To measure the speedup of our model against the RNN models, we also test the corresponding model architecture with each encoder block replaced with a stack of bidirectional
|
| 128 |
+
|
| 129 |
+
Table 2: The performances of different models on SQuAD dataset.
|
| 130 |
+
|
| 131 |
+
<table><tr><td></td><td>Published12</td><td>LeaderBoard13</td></tr><tr><td>Single Model</td><td>EM/F1</td><td>EM/F1</td></tr><tr><td>LR Baseline (Rajpurkar et al., 2016)</td><td>40.4/51.0</td><td>40.4/51.0</td></tr><tr><td>Dynamic Chunk Reader (Yu et al., 2016)</td><td>62.5 /71.0</td><td>62.5 /71.0</td></tr><tr><td>Match-LSTM with Ans-Ptr(Wang & Jiang,2016)</td><td>64.7 /73.7</td><td>64.7 /73.7</td></tr><tr><td>Multi-Perspective Matching (Wang et al., 2016)</td><td>65.5 /75.1</td><td>70.4/78.8</td></tr><tr><td>Dynamic Coattention Networks (Xiong et al., 2016)</td><td>66.2 /75.9</td><td>66.2/75.9</td></tr><tr><td>FastQA(Weissenborn et al.,2017)</td><td>68.4/ 77.1</td><td>68.4/ 77.1</td></tr><tr><td>BiDAF (Seo et al., 2016)</td><td>68.0 /77.3</td><td>68.0 /77.3</td></tr><tr><td>SEDT (Liu et al.,2017a)</td><td>68.1 / 77.5</td><td>68.5/78.0</td></tr><tr><td>RaSoR (Lee et al.,2016)</td><td>70.8/78.7</td><td>69.6/77.7</td></tr><tr><td>FastQAExt (Weissenborn et al.,2017)</td><td>70.8 / 78.9</td><td>70.8/78.9</td></tr><tr><td>ReasoNet (Shen et al.,2017b)</td><td>69.1/78.9</td><td>70.6/79.4</td></tr><tr><td>Document Reader (Chen et al., 2017)</td><td>70.0 /79.0</td><td>70.7 /79.4</td></tr><tr><td>Ruminating Reader (Gong & Bowman, 2017)</td><td>70.6 / 79.5</td><td>70.6 / 79.5</td></tr><tr><td>jNet (Zhang et al., 2017)</td><td>70.6 /79.8</td><td>70.6 /79.8</td></tr><tr><td>Conductor-net</td><td>N/A</td><td>72.6 /81.4</td></tr><tr><td>Interactive AoA Reader (Cui etal.,2017)</td><td>N/A</td><td>73.6 /81.9</td></tr><tr><td>Reg-RaSoR</td><td>N/A</td><td>75.8 /83.3</td></tr><tr><td>DCN+</td><td>N/A</td><td>74.9 /82.8</td></tr><tr><td>AIR-FusionNet</td><td>N/A</td><td>76.0 /83.9</td></tr><tr><td>R-Net (Wang et al., 2017)</td><td>72.3 / 80.7</td><td>76.5 /84.3</td></tr><tr><td>BiDAF+ Self Attention+ELMo</td><td>N/A</td><td>77.9/85.3</td></tr><tr><td>Reinforced Mnemonic Reader (Hu et al., 2017)</td><td>73.2 /81.8</td><td>73.2 /81.8</td></tr><tr><td>Dev set: QANet</td><td>73.6/82.7</td><td>N/A</td></tr><tr><td>Dev set: QANet + data augmentation ×2</td><td>74.5 /83.2</td><td>N/A</td></tr><tr><td>Dev set: QANet + data augmentation ×3</td><td>75.1/ 83.8</td><td>N/A</td></tr><tr><td>Test set: QANet + data augmentation ×3</td><td>76.2 / 84.6</td><td>76.2/84.6</td></tr></table>
|
| 132 |
+
|
| 133 |
+
LSTMs as is used in most existing models. Specifically, each (embedding and model) encoder block is replaced with a 1, 2, or 3 layer Bidirectional LSTMs respectively, as such layer numbers fall into the usual range of the reading comprehension models (Chen et al., 2017). All of these LSTMs have hidden size 128. The results of the speedup comparison are shown in Table 3. We can easily see that our model is significantly faster than all the RNN based models and the speedups range from 3 to 13 times in training and 4 to 9 times in inference.
|
| 134 |
+
|
| 135 |
+
Table 3: Speed comparison between our model and RNN-based models on SQuAD dataset, all with batch size 32. RNN- $x$ - $y$ indicates an RNN with $x$ layers each containing $y$ hidden units. Here, we use bidirectional LSTM as the RNN. The speed is measured by batches/second, so higher is faster.
|
| 136 |
+
|
| 137 |
+
<table><tr><td></td><td>QANet</td><td>RNN-1-128</td><td>Speedup</td><td>RNN-2-128</td><td>Speedup</td><td>RNN-3-128 Speedup</td></tr><tr><td>Training</td><td>3.2</td><td>1.1</td><td>2.9x</td><td>0.34</td><td>9.4x</td><td>0.24 13.3x</td></tr><tr><td>Inference</td><td>8.1</td><td>2.2</td><td>3.7x</td><td>1.3</td><td>6.2x</td><td>0.92 8.8x</td></tr></table>
|
| 138 |
+
|
| 139 |
+
Speedup over BiDAF model. In addition, we also use the same hardware (a NVIDIA p100 GPU) and compare the training time of getting the same performance between our model and the BiDAF model14(Seo et al., 2016), a classic RNN-based model on SQuAD. We mostly adopt the default settings in the original code to get its best performance, where the batch sizes for training and inference are both 60. The only part we changed is the optimizer, where Adam with learning 0.001 is used here, as with Adadelta we got a bit worse performance. The result is shown in Table 4 which shows that our model is 4.3 and 7.0 times faster than BiDAF in training and inference speed. Besides, we only need one fifth of the training time to achieve BiDAF’s best F1 score (77.0) on dev set.
|
| 140 |
+
|
| 141 |
+
Table 4: Speed comparison between our model and BiDAF (Seo et al., 2016) on SQuAD dataset.
|
| 142 |
+
|
| 143 |
+
<table><tr><td></td><td>Train time to get 77.0 F1onDev set</td><td>Train speed</td><td>Inference speed</td></tr><tr><td>QANet</td><td>3hours</td><td>102 samples/s</td><td>259 samples/s</td></tr><tr><td>BiDAF</td><td>15 hours</td><td>24 samples/s</td><td>37samples/s</td></tr><tr><td>Speedup</td><td>5.0x</td><td>4.3x</td><td>7.0x</td></tr></table>
|
| 144 |
+
|
| 145 |
+
# 4.1.3 ABALATION STUDY AND ANALYSIS
|
| 146 |
+
|
| 147 |
+
We conduct ablation studies on components of the proposed model, and investigate the effect of augmented data. The validation scores on the development set are shown in Table 5. As can be seen from the table, the use of convolutions in the encoders is crucial: both F1 and EM drop drastically by almost 3 percent if it is removed. Self-attention in the encoders is also a necessary component that contributes 1.4/1.3 gain of EM/F1 to the ultimate performance. We interpret these phenomena as follows: the convolutions capture the local structure of the context while the self-attention is able to model the global interactions between text. Hence they are complimentary to but cannot replace each other. The use of separable convolutions in lieu of tradition convolutions also has a prominent contribution to the performance, which can be seen by the slightly worse accuracy caused by replacing separable convolution with normal convolution.
|
| 148 |
+
|
| 149 |
+
The Effect of Data Augmentation. We additionally perform experiments to understand the values of augmented data as their amount increases. As the last block of rows in the table shows, data augmentation proves to be helpful in further boosting performance. Making the training data twice as large by adding the En-Fr-En data only (ratio 1:1 between original training data and augmented data, as indicated by row “data augmentation $\times 2$ (1:1:0)”) yields an increase in the F1 by 0.5 percent. While adding more augmented data with French as a pivot does not provide performance gain, injecting additional augmented data En-De-En of the same amount brings another 0.2 improvement in F1, as indicated in entry “data augmentation $\times \ 3$ (1:1:1)”. We may attribute this gain to the diversity of the new data, which is produced by the translator of the new language.
|
| 150 |
+
|
| 151 |
+
The Effect of Sampling Scheme. Although injecting more data beyond $\times \ 3$ does not benefit the model, we observe that a good sampling ratio between the original and augmented data during training can further boost the model performance. In particular, when we increase the sampling weight of augmented data from (1:1:1) to (1:2:1), the EM/F1 performance drops by $0 . 5 / 0 . 3$ . We conjecture that it is due to the fact that augmented data is noisy because of the back-translation, so it should not be the dominant data of training. We confirm this point by increasing the ratio of the original data from (1:2:1) to (2:2:1), where $0 . 6 / 0 . 5$ performance gain on EM/F1 is obtained. Then we fix the portion of the augmented data, and search the sample weight of the original data. Empirically, the ratio (3:1:1) yields the best performance, with 1.5/1.1 gain over the base model on EM/F1. This is also the model we submitted for test set evaluation.
|
| 152 |
+
|
| 153 |
+
# 4.1.4 ROBUSTNESS STUDY
|
| 154 |
+
|
| 155 |
+
In the following, we conduct experiments on the adversarial SQuAD dataset (Jia & Liang, 2017) to study the robustness of the proposed model. In this dataset, one or more sentences are appended to the original SQuAD context of test set, to intentionally mislead the trained models to produce wrong answers. However, the model is agnostic to those adversarial examples during training. We focus on two types of misleading sentences, namely, AddSent and AddOneSent. AddSent generates sentences that are similar to the question, but not contradictory to the correct answer, while AddOneSent adds a random human-approved sentence that is not necessarily related to the context.
|
| 156 |
+
|
| 157 |
+
The model in use is exactly the one trained with the original SQuAD data (the one getting 84.6 F1 on test set), but now it is submitted to the adversarial server for evaluation. The results are shown in Table 6, where the F1 scores of other models are all extracted from Jia & Liang (2017).15 Again, we only compare the performance of single models. From Table 6, we can see that our model is on par with the state-of-the-art model Mnemonic, while significantly better than other models by a large margin. The robustness of our model is probably because it is trained with augmented data.
|
| 158 |
+
|
| 159 |
+
Table 5: An ablation study of data augmentation and other aspects of our model. The reported results are obtained on the development set. For rows containing entry “data augmentation”, $^ { 6 6 } \times N ^ { \prime }$ means the data is enhanced to $N$ times as large as the original size, while the ratio in the bracket indicates the sampling ratio among the original, English-French-English and English-German-English data during training.
|
| 160 |
+
|
| 161 |
+
<table><tr><td colspan="2"></td><td>EM/F1</td><td>Differenceto Base Model EM/F1</td></tr><tr><td colspan="2">Base QANet</td><td>73.6/82.7</td><td></td></tr><tr><td rowspan="3"></td><td>- convolution in encoders</td><td>70.8/ 80.0</td><td>-2.8/-2.7</td></tr><tr><td>- self-attention in encoders</td><td>72.2 /81.4</td><td>-1.4 / -1.3</td></tr><tr><td>replace sep convolution with normal convolution</td><td>72.9 / 82.0</td><td>- 0.7/-0.7</td></tr><tr><td></td><td>+ data augmentation ×2 (1:1:0)</td><td>74.5/83.2</td><td>+0.9/+0.5</td></tr><tr><td></td><td>+ data augmentation ×3 (1:1:1)</td><td>74.8 /83.4</td><td>+1.2/+0.7</td></tr><tr><td></td><td>+ data augmentation ×3 (1:2:1)</td><td>74.3/83.1</td><td>+0.7 /+0.4</td></tr><tr><td></td><td>+ data augmentation ×3 (2:2:1)</td><td>74.9 / 83.6</td><td>+1.3/+0.9</td></tr><tr><td></td><td>+ data augmentation ×3 (2:1:1)</td><td>75.0 / 83.6</td><td>+1.4 /+0.9</td></tr><tr><td></td><td>+ data augmentation ×3 (3:1:1)</td><td>75.1/83.8</td><td>+1.5 / +1.1</td></tr><tr><td></td><td>+ data augmentation ×3 (4:1:1)</td><td>75.0 / 83.6</td><td>+1.4/ +0.9</td></tr><tr><td>+ data augmentation ×3 (5:1:1)</td><td></td><td>74.9 / 83.5</td><td>+1.3 /+0.8</td></tr></table>
|
| 162 |
+
|
| 163 |
+
The injected noise in the training data might not only improve the generalization of the model but also make it robust to the adversarial sentences.
|
| 164 |
+
Table 6: The F1 scores on the adversarial SQuAD test set.
|
| 165 |
+
|
| 166 |
+
<table><tr><td>Single Model</td><td>AddSent</td><td>AddOneSent</td></tr><tr><td>Logistic (Rajpurkar et al.,2016)</td><td>23.2</td><td>30.4</td></tr><tr><td>Match (Wang & Jiang,2016)</td><td>27.3</td><td>39.0</td></tr><tr><td>SEDT (Liu et al., 2017a)</td><td>33.9</td><td>44.8</td></tr><tr><td>DCR (Yu et al., 2016)</td><td>37.8</td><td>45.1</td></tr><tr><td>BiDAF (Seo et al., 2016)</td><td>34.3</td><td>45.7</td></tr><tr><td>jNet (Zhang et al.,2017)</td><td>37.9</td><td>47.0</td></tr><tr><td>Ruminating (Gong & Bowman, 2017)</td><td>37.4</td><td>47.7</td></tr><tr><td>RaSOR (Lee et al., 2016)</td><td>39.5</td><td>49.5</td></tr><tr><td>MPCM (Wang et al.,2016)</td><td>40.3</td><td>50.0</td></tr><tr><td>ReasoNet (Shen et al.,2017b)</td><td>39.4</td><td>50.3</td></tr><tr><td>Mnemonic (Hu et al.,2017)</td><td>46.6</td><td>56.0</td></tr><tr><td>QANet</td><td>45.2</td><td>55.7</td></tr></table>
|
| 167 |
+
|
| 168 |
+
# 4.2 EXPERIMENTS ON TRIVIAQA
|
| 169 |
+
|
| 170 |
+
In this section, we test our model on another dataset TriviaQA (Joshi et al., 2017), which consists of 650K context-query-answer triples. There are 95K distinct question-answer pairs, which are authored by Trivia enthusiasts, with 6 evidence documents (context) per question on average, which are either crawled from Wikipedia or Web search. Compared to SQuAD, TriviaQA is more challenging in that: 1) its examples have much longer context (2895 tokens per context on average) and may contain several paragraphs, 2) it is much noisier than SQuAD due to the lack of human labeling, 3) it is possible that the context is not related to the answer at all, as it is crawled by key words.
|
| 171 |
+
|
| 172 |
+
In this paper, we focus on testing our model on the subset consisting of answers from Wikipedia. According to the previous work (Joshi et al., 2017; Hu et al., 2017; Pan et al., 2017), the same model would have similar performance on both Wikipedia and Web, but the latter is five time larger. To keep the training time manageable, we omit the experiment on Web data.
|
| 173 |
+
|
| 174 |
+
Due to the multi-paragraph nature of the context, researchers also find that simple hierarchical or multi-step reading tricks, such as first predicting which paragraph to read and then apply models like BiDAF to pinpoint the answer within that paragraph (Clark & Gardner, 2017), can significantly boost the performance on TriviaQA. However, in this paper, we focus on comparing with the single-paragraph reading baselines only. We believe that our model can be plugged into other multi-paragraph reading methods to achieve the similar or better performance, but it is out of the scope of this paper.
|
| 175 |
+
|
| 176 |
+
The Wikipedia sub-dataset contains around 92K training and 11K development examples. The average context and question lengths are 495 and 15 respectively. In addition to the full development set, the authors of Joshi et al. (2017) also pick a verified subset that all the contexts inside can answer the associated questions. As the text could be long, we adopt the data processing similar to Hu et al. (2017); Joshi et al. (2017). In particular, for training and validation, we randomly select a window of length 256 and 400 encapsulating the answer respectively. All the remaining setting are the same as SQuAD experiment, except that the training steps are set to 120K.
|
| 177 |
+
|
| 178 |
+
Accuracy. The accuracy performance on the development set is shown in Table 7. Again, we can see that our model outperforms the baselines in terms of F1 and EM on Full development set, and is on par with the state-of-the-art on the Verified dev set.
|
| 179 |
+
|
| 180 |
+
Table 7: The development set performances of different single-paragraph reading models on the Wikipedia domain of TriviaQA dataset. Note that ∗ indicates the result on test set.
|
| 181 |
+
|
| 182 |
+
<table><tr><td></td><td>Full</td><td>Verified</td></tr><tr><td>Single Model</td><td>EM/F1</td><td>EM/F1</td></tr><tr><td>Random (Joshi et al.,2017)</td><td>12.7 /22.5</td><td>13.8/23.4</td></tr><tr><td>Classifier (Joshi et al., 2017)</td><td>23.4 / 27.7</td><td>23.6 /27.9</td></tr><tr><td>BiDAF (Seo et al., 2016)</td><td>40.3/45.7</td><td>46.5 /52.8</td></tr><tr><td>MEMEN (Pan et al.,2017)</td><td>43.2/46.9</td><td>49.3 / 55.8</td></tr><tr><td>M-Reader (Hu et al., 2017)*</td><td>46.9/ 52.9*</td><td>54.5/ 59.5*</td></tr><tr><td>QANet</td><td>51.1/ 56.6</td><td>53.3/59.2</td></tr></table>
|
| 183 |
+
|
| 184 |
+
Speedup over RNNs. In addition to accuracy, we also benchmark the speed of our model against the RNN counterparts. As Table 8 shows, not surprisingly, our model has 3 to 11 times speedup in training and 3 to 9 times acceleration in inference, similar to the finding in SQuAD dataset.
|
| 185 |
+
|
| 186 |
+
<table><tr><td></td><td>QANet</td><td>RNN-1-128</td><td>Speedup</td><td>RNN-2-128</td><td>Speedup</td><td>RNN-3-128</td><td>Speedup</td></tr><tr><td>Training</td><td>1.8</td><td>0.41</td><td>4.4x</td><td>0.20</td><td>9.0x</td><td>0.11</td><td>16.4x</td></tr><tr><td>Inference</td><td>3.2</td><td>0.89</td><td>3.6x</td><td>0.47</td><td>6.8x</td><td>0.26</td><td>12.3x</td></tr></table>
|
| 187 |
+
|
| 188 |
+
Table 8: Speed comparison between the proposed model and RNN-based models on TriviaQA Wikipedia dataset, all with batch size 32. RNN- $x$ - $y$ indicates an RNN with $x$ layers each containing $y$ hidden units. The RNNs used here are bidirectional LSTM. The processing speed is measured by batches/second, so higher is faster.
|
| 189 |
+
|
| 190 |
+
# 5 RELATED WORK
|
| 191 |
+
|
| 192 |
+
Machine reading comprehension and automated question answering has become an important topic in the NLP domain. Their popularity can be attributed to an increase in publicly available annotated datasets, such as SQuAD (Rajpurkar et al., 2016), TriviaQA (Joshi et al., 2017), CNN/Daily News (Hermann et al., 2015), WikiReading (Hewlett et al., 2016), Children Book Test (Hill et al., 2015), etc. A great number of end-to-end neural network models have been proposed to tackle these challenges, including BiDAF (Seo et al., 2016), r-net (Wang et al., 2017), DCN (Xiong et al., 2016), ReasoNet (Shen et al., 2017b), Document Reader (Chen et al., 2017), Interactive AoA Reader (Cui et al., 2017) and Reinforced Mnemonic Reader (Hu et al., 2017).
|
| 193 |
+
|
| 194 |
+
Recurrent Neural Networks (RNNs) have featured predominatnly in Natural Language Processing in the past few years. The sequential nature of the text coincides with the design philosophy of RNNs, and hence their popularity. In fact, all the reading comprehension models mentioned above are based on RNNs. Despite being common, the sequential nature of RNN prevent parallel computation, as tokens must be fed into the RNN in order. Another drawback of RNNs is difficulty modeling long dependencies, although this is somewhat alleviated by the use of Gated Recurrent Unit (Chung et al.,
|
| 195 |
+
|
| 196 |
+
2014) or Long Short Term Memory architectures (Hochreiter & Schmidhuber, 1997). For simple tasks such as text classification, with reinforcement learning techniques, models (Yu et al., 2017) have been proposed to skip irrelevant tokens to both further address the long dependencies issue and speed up the procedure. However, it is not clear if such methods can handle complicated tasks such as Q&A. The reading comprehension task considered in this paper always needs to deal with long text, as the context paragraphs may be hundreds of words long. Recently, attempts have been made to replace the recurrent networks by full convolution or full attention architectures (Kim, 2014; Gehring et al., 2017; Vaswani et al., 2017b; Shen et al., 2017a). Those models have been shown to be not only faster than the RNN architectures, but also effective in other tasks, such as text classification, machine translation or sentiment analysis.
|
| 197 |
+
|
| 198 |
+
To the best of our knowledge, our paper is the first work to achieve both fast and accurate reading comprehension model, by discarding the recurrent networks in favor of feed forward architectures. Our paper is also the first to mix self-attention and convolutions, which proves to be empirically effective and achieves a significant gain of 2.7 F1. Note that Raiman & Miller (2017) recently proposed to accelerate reading comprehension by avoiding bi-directional attention and making computation conditional on the search beams. Nevertheless, their model is still based on the RNNs and the accuracy is not competitive, with an $\mathrm { E M } 6 8 . 4$ and F1 76.2. Weissenborn et al. (2017) also tried to build a fast Q&A model by deleting the context-query attention module. However, it again relied on RNN and is thus intrinsically slower than ours. The elimination of attention further has sacrificed the performance (with EM 68.4 and F1 77.1).
|
| 199 |
+
|
| 200 |
+
Data augmentation has also been explored in natural language processing. For example, Zhang et al. (2015) proposed to enhance the dataset by replacing the words with their synonyms and showed its effectiveness in text classification. Raiman & Miller (2017) suggested using type swap to augment the $\mathrm { S Q u A D }$ dataset, which essentially replaces the words in the original paragraph with others with the same type. While it was shown to improve the accuracy, the augmented data has the same syntactic structure as the original data, so they are not sufficiently diverse. Zhou et al. (2017) improved the diversity of the SQuAD data by generating more questions. However, as reported by Wang et al. (2017), their method did not help improve the performance. The data augmentation technique proposed in this paper is based on paraphrasing the sentences by translating the original text back and forth. The major benefit is that it can bring more syntactical diversity to the enhanced data.
|
| 201 |
+
|
| 202 |
+
# 6 CONCLUSION
|
| 203 |
+
|
| 204 |
+
In this paper, we propose a fast and accurate end-to-end model, QANet, for machine reading comprehension. Our core innovation is to completely remove the recurrent networks in the encoder. The resulting model is fully feedforward, composed entirely of separable convolutions, attention, linear layers, and layer normalization, which is suitable for parallel computation. The resulting model is both fast and accurate: It surpasses the best published results on SQuAD dataset while up to 13/9 times faster than a competitive recurrent models for a training/inference iteration. Additionally, we find that we are able to achieve significant gains by utilizing data augmentation consisting of translating context and passage pairs to and from another language as a way of paraphrasing the questions and contexts.
|
| 205 |
+
|
| 206 |
+
# ACKNOWLEDGEMENT
|
| 207 |
+
|
| 208 |
+
Adams Wei Yu is supported by NVIDIA PhD Fellowship and CMU Presidential Fellowship. We would like to thank Samy Bengio, Lei Huang, Minjoon Seo, Noam Shazeer, Ashish Vaswani, Barret Zoph and the Google Brain Team for helpful discussions.
|
| 209 |
+
|
| 210 |
+
# REFERENCES
|
| 211 |
+
|
| 212 |
+
Mart´ın Abadi, Ashish Agarwal, Paul Barham, Eugene Brevdo, Zhifeng Chen, Craig Citro, Gregory S. Corrado, Andy Davis, Jeffrey Dean, Matthieu Devin, Sanjay Ghemawat, Ian J. Goodfellow, Andrew Harp, Geoffrey Irving, Michael Isard, Yangqing Jia, Rafal Jozefowicz, Lukasz ´ Kaiser, Manjunath Kudlur, Josh Levenberg, Dan Mane, Rajat Monga, Sherry Moore, Derek Gor- ´ don Murray, Chris Olah, Mike Schuster, Jonathon Shlens, Benoit Steiner, Ilya Sutskever, Kunal
|
| 213 |
+
|
| 214 |
+
Talwar, Paul A. Tucker, Vincent Vanhoucke, Vijay Vasudevan, Fernanda B. Viegas, Oriol Vinyals, ´ Pete Warden, Martin Wattenberg, Martin Wicke, Yuan Yu, and Xiaoqiang Zheng. Tensorflow: Large-scale machine learning on heterogeneous distributed systems. CoRR, abs/1603.04467, 2016. URL http://arxiv.org/abs/1603.04467.
|
| 215 |
+
|
| 216 |
+
Lei Jimmy Ba, Ryan Kiros, and Geoffrey E. Hinton. Layer normalization. CoRR, abs/1607.06450, 2016. URL http://arxiv.org/abs/1607.06450.
|
| 217 |
+
|
| 218 |
+
Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. Neural machine translation by jointly learning to align and translate. In International Conference on Learning Representations, 2015.
|
| 219 |
+
|
| 220 |
+
Danqi Chen, Adam Fisch, Jason Weston, and Antoine Bordes. Reading wikipedia to answer opendomain questions. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics, ACL 2017, Vancouver, Canada, July 30 - August 4, Volume 1: Long Papers, pp. 1870–1879, 2017.
|
| 221 |
+
|
| 222 |
+
Franc¸ois Chollet. Xception: Deep learning with depthwise separable convolutions. CoRR, abs/1610.02357, 2016. URL http://arxiv.org/abs/1610.02357.
|
| 223 |
+
|
| 224 |
+
Junyoung Chung, Caglar Gulcehre, KyungHyun Cho, and Yoshua Bengio. Empirical evaluation of gated recurrent neural networks on sequence modeling. arXiv preprint arXiv:1412.3555, 2014.
|
| 225 |
+
|
| 226 |
+
Christopher Clark and Matt Gardner. Simple and effective multi-paragraph reading comprehension. CoRR, abs/1710.10723, 2017. URL http://arxiv.org/abs/1710.10723.
|
| 227 |
+
|
| 228 |
+
Yiming Cui, Zhipeng Chen, Si Wei, Shijin Wang, Ting Liu, and Guoping Hu. Attention-overattention neural networks for reading comprehension. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics, ACL 2017, Vancouver, Canada, July 30 - August 4, Volume 1: Long Papers, pp. 593–602, 2017.
|
| 229 |
+
|
| 230 |
+
Li Dong, Jonathan Mallinson, Siva Reddy, and Mirella Lapata. Learning to paraphrase for question answering. In Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing, pp. 875–886. Association for Computational Linguistics, 2017. URL http://aclweb.org/anthology/D17-1091.
|
| 231 |
+
|
| 232 |
+
Jonas Gehring, Michael Auli, David Grangier, Denis Yarats, and Yann N Dauphin. Convolutional sequence to sequence learning. In International Conference on Machine Learning, 2017.
|
| 233 |
+
|
| 234 |
+
Yichen Gong and Samuel R. Bowman. Ruminating reader: Reasoning with gated multi-hop attention. CoRR, abs/1704.07415, 2017. URL http://arxiv.org/abs/1704.07415.
|
| 235 |
+
|
| 236 |
+
Karl Moritz Hermann, Tomas Kocisk ´ y, Edward Grefenstette, Lasse Espeholt, Will Kay, Mustafa ´ Suleyman, and Phil Blunsom. Teaching machines to read and comprehend. In Advances in Neural Information Processing Systems 28: Annual Conference on Neural Information Processing Systems 2015, December 7-12, 2015, Montreal, Quebec, Canada, pp. 1693–1701, 2015.
|
| 237 |
+
|
| 238 |
+
Daniel Hewlett, Alexandre Lacoste, Llion Jones, Illia Polosukhin, Andrew Fandrianto, Jay Han, Matthew Kelcey, and David Berthelot. Wikireading: A novel large-scale language understanding task over wikipedia. In Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics, ACL 2016, August 7-12, 2016, Berlin, Germany, Volume 1: Long Papers, 2016.
|
| 239 |
+
|
| 240 |
+
Felix Hill, Antoine Bordes, Sumit Chopra, and Jason Weston. The goldilocks principle: Reading children’s books with explicit memory representations. CoRR, abs/1511.02301, 2015.
|
| 241 |
+
|
| 242 |
+
Sepp Hochreiter and Jurgen Schmidhuber. Long short-term memory. ¨ Neural computation, 9(8): 1735–1780, 1997.
|
| 243 |
+
|
| 244 |
+
Minghao Hu, Yuxing Peng, and Xipeng Qiu. Reinforced mnemonic reader for machine comprehension. CoRR, abs/1705.02798, 2017. URL http://arxiv.org/abs/1705.02798.
|
| 245 |
+
|
| 246 |
+
Gao Huang, Yu Sun, Zhuang Liu, Daniel Sedra, and Kilian Q. Weinberger. Deep networks with stochastic depth. In Computer Vision - ECCV 2016 - 14th European Conference, Amsterdam, The Netherlands, October 11-14, 2016, Proceedings, Part IV, pp. 646–661, 2016.
|
| 247 |
+
|
| 248 |
+
Robin Jia and Percy Liang. Adversarial examples for evaluating reading comprehension systems. In Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing, EMNLP 2017, Copenhagen, Denmark, September 9-11, 2017, pp. 2021–2031, 2017.
|
| 249 |
+
|
| 250 |
+
Mandar Joshi, Eunsol Choi, Daniel S. Weld, and Luke Zettlemoyer. Triviaqa: A large scale distantly supervised challenge dataset for reading comprehension. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics, ACL 2017, Vancouver, Canada, July 30 - August 4, Volume 1: Long Papers, pp. 1601–1611, 2017.
|
| 251 |
+
|
| 252 |
+
Lukasz Kaiser, Aidan N Gomez, and Francois Chollet. Depthwise separable convolutions for neural machine translation. arXiv preprint arXiv:1706.03059, 2017.
|
| 253 |
+
|
| 254 |
+
Yoon Kim. Convolutional neural networks for sentence classification. In Proceedings of the 2014 Conference on Empirical Methods in Natural Language Processing, EMNLP 2014, October 25- 29, 2014, Doha, Qatar, A meeting of SIGDAT, a Special Interest Group of the ACL, pp. 1746– 1751, 2014.
|
| 255 |
+
|
| 256 |
+
Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. CoRR, abs/1412.6980, 2014. URL http://arxiv.org/abs/1412.6980.
|
| 257 |
+
|
| 258 |
+
Kenton Lee, Tom Kwiatkowski, Ankur P. Parikh, and Dipanjan Das. Learning recurrent span representations for extractive question answering. CoRR, abs/1611.01436, 2016.
|
| 259 |
+
|
| 260 |
+
Rui Liu, Junjie Hu, Wei Wei, Zi Yang, and Eric Nyberg. Structural embedding of syntactic trees for machine comprehension. In Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing, EMNLP 2017, Copenhagen, Denmark, September 9-11, 2017, pp. 826–835, 2017a.
|
| 261 |
+
|
| 262 |
+
Xiaodong Liu, Yelong Shen, Kevin Duh, and Jianfeng Gao. Stochastic answer networks for machine reading comprehension. CoRR, abs/1712.03556, 2017b. URL http://arxiv.org/abs/ 1712.03556.
|
| 263 |
+
|
| 264 |
+
Minh-Thang Luong, Hieu Pham, and Christopher D. Manning. Effective approaches to attentionbased neural machine translation. In EMNLP, 2015.
|
| 265 |
+
|
| 266 |
+
Minh-Thang Luong, Eugene Brevdo, and Rui Zhao. Neural machine translation (seq2seq) tutorial. https://github.com/tensorflow/nmt, 2017.
|
| 267 |
+
|
| 268 |
+
Jonathan Mallinson, Rico Sennrich, and Mirella Lapata. Paraphrasing revisited with neural machine translation. In Proceedings of the 15th Conference of the European Chapter of the Association for Computational Linguistics: Volume 1, Long Papers, pp. 881–893. Association for Computational Linguistics, 2017. URL http://aclweb.org/anthology/E17-1083.
|
| 269 |
+
|
| 270 |
+
Boyuan Pan, Hao Li, Zhou Zhao, Bin Cao, Deng Cai, and Xiaofei He. MEMEN: multi-layer embedding with memory networks for machine comprehension. CoRR, abs/1707.09098, 2017.
|
| 271 |
+
|
| 272 |
+
Jeffrey Pennington, Richard Socher, and Christopher D. Manning. Glove: Global vectors for word//w representation. In Empirical Methods in Natural Language Processing (EMNLP), pp. 1532–1543, 2014. URL http://www.aclweb.org/anthology/D14-1162.
|
| 273 |
+
|
| 274 |
+
Jonathan Raiman and John Miller. Globally normalized reader. In Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing, EMNLP 2017, Copenhagen, Denmark, September 9-11, 2017, pp. 1070–1080, 2017.
|
| 275 |
+
|
| 276 |
+
Pranav Rajpurkar, Jian Zhang, Konstantin Lopyrev, and Percy Liang. Squad: 100, $0 0 0 +$ questions for machine comprehension of text. In Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing, EMNLP 2016, Austin, Texas, USA, November 1-4, 2016, pp. 2383–2392, 2016.
|
| 277 |
+
|
| 278 |
+
Rico Sennrich, Barry Haddow, and Alexandra Birch. Improving neural machine translation models with monolingual data. In ACL (1). The Association for Computer Linguistics, 2016.
|
| 279 |
+
|
| 280 |
+
Min Joon Seo, Aniruddha Kembhavi, Ali Farhadi, and Hannaneh Hajishirzi. Bidirectional attention flow for machine comprehension. CoRR, abs/1611.01603, 2016. URL http://arxiv.org/ abs/1611.01603.
|
| 281 |
+
|
| 282 |
+
Tao Shen, Tianyi Zhou, Guodong Long, Jing Jiang, Shirui Pan, and Chengqi Zhang. Disan: Directional self-attention network for rnn/cnn-free language understanding. CoRR, abs/1709.04696, 2017a. URL http://arxiv.org/abs/1709.04696.
|
| 283 |
+
|
| 284 |
+
Yelong Shen, Po-Sen Huang, Jianfeng Gao, and Weizhu Chen. Reasonet: Learning to stop reading in machine comprehension. In Proceedings of the 23rd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, Halifax, NS, Canada, August 13 - 17, 2017, pp. 1047–1055, 2017b.
|
| 285 |
+
|
| 286 |
+
Rupesh Kumar Srivastava, Klaus Greff, and Jurgen Schmidhuber. Highway networks. ¨ CoRR, abs/1505.00387, 2015. URL http://arxiv.org/abs/1505.00387.
|
| 287 |
+
|
| 288 |
+
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, 2017a. URL http://arxiv.org/abs/1706.03762.
|
| 289 |
+
|
| 290 |
+
Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention is all you need. In Neural Information Processing Systems, 2017b.
|
| 291 |
+
|
| 292 |
+
Shuohang Wang and Jing Jiang. Machine comprehension using match-lstm and answer pointer. CoRR, abs/1608.07905, 2016. URL http://arxiv.org/abs/1608.07905.
|
| 293 |
+
|
| 294 |
+
Wenhui Wang, Nan Yang, Furu Wei, Baobao Chang, and Ming Zhou. Gated self-matching networks for reading comprehension and question answering. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics, ACL 2017, Vancouver, Canada, July 30 - August 4, Volume 1: Long Papers, pp. 189–198, 2017.
|
| 295 |
+
|
| 296 |
+
Zhiguo Wang, Haitao Mi, Wael Hamza, and Radu Florian. Multi-perspective context matching for machine comprehension. CoRR, abs/1612.04211, 2016. URL http://arxiv.org/abs/ 1612.04211.
|
| 297 |
+
|
| 298 |
+
Dirk Weissenborn, Georg Wiese, and Laura Seiffe. Making neural QA as simple as possible but not simpler. In Proceedings of the 21st Conference on Computational Natural Language Learning (CoNLL 2017), Vancouver, Canada, August 3-4, 2017, pp. 271–280, 2017.
|
| 299 |
+
|
| 300 |
+
John Wieting, Jonathan Mallinson, and Kevin Gimpel. Learning paraphrastic sentence embeddings from back-translated bitext. In EMNLP, pp. 274–285. Association for Computational Linguistics, 2017.
|
| 301 |
+
|
| 302 |
+
Yonghui Wu, Mike Schuster, Zhifeng Chen, Quoc V. Le, Mohammad Norouzi, Wolfgang Macherey, Maxim Krikun, Yuan Cao, Qin Gao, Klaus Macherey, Jeff Klingner, Apurva Shah, Melvin Johnson, Xiaobing Liu, Lukasz Kaiser, Stephan Gouws, Yoshikiyo Kato, Taku Kudo, Hideto Kazawa, Keith Stevens, George Kurian, Nishant Patil, Wei Wang, Cliff Young, Jason Smith, Jason Riesa, Alex Rudnick, Oriol Vinyals, Greg Corrado, Macduff Hughes, and Jeffrey Dean. Google’s neural machine translation system: Bridging the gap between human and machine translation. arXiv preprint arXiv:1609.08144, 2016.
|
| 303 |
+
|
| 304 |
+
Caiming Xiong, Victor Zhong, and Richard Socher. Dynamic coattention networks for question answering. CoRR, abs/1611.01604, 2016. URL http://arxiv.org/abs/1611.01604.
|
| 305 |
+
|
| 306 |
+
Adams Wei Yu, Hongrae Lee, and Quoc V. Le. Learning to skim text. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics, ACL 2017, Vancouver, Canada, July 30 - August 4, Volume 1: Long Papers, pp. 1880–1890, 2017.
|
| 307 |
+
|
| 308 |
+
Yang Yu, Wei Zhang, Kazi Saidul Hasan, Mo Yu, Bing Xiang, and Bowen Zhou. End-to-end reading comprehension with dynamic answer chunk ranking. CoRR, abs/1610.09996, 2016. URL http: //arxiv.org/abs/1610.09996.
|
| 309 |
+
|
| 310 |
+
Junbei Zhang, Xiao-Dan Zhu, Qian Chen, Li-Rong Dai, Si Wei, and Hui Jiang. Exploring question understanding and adaptation in neural-network-based question answering. CoRR, abs/1703.04617, 2017.
|
| 311 |
+
|
| 312 |
+
Xiang Zhang, Junbo Jake Zhao, and Yann LeCun. Character-level convolutional networks for text classification. In Advances in Neural Information Processing Systems 28: Annual Conference on Neural Information Processing Systems 2015, December 7-12, 2015, Montreal, Quebec, Canada, pp. 649–657, 2015.
|
| 313 |
+
|
| 314 |
+
Qingyu Zhou, Nan Yang, Furu Wei, Chuanqi Tan, Hangbo Bao, and Ming Zhou. Neural question generation from text: A preliminary study. CoRR, abs/1704.01792, 2017. URL http: //arxiv.org/abs/1704.01792.
|
md/train/B1edvs05Y7/B1edvs05Y7.md
ADDED
|
@@ -0,0 +1,359 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# SPARSE BINARY COMPRESSION: TOWARDS DISTRIBUTED DEEP LEARNING WITH MINIMAL COMMUNICATION
|
| 2 |
+
|
| 3 |
+
Anonymous authors Paper under double-blind review
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
Currently, progressively larger deep neural networks are trained on ever growing data corpora. In result, distributed training schemes are becoming increasingly relevant. A major issue in distributed training is the limited communication bandwidth between contributing nodes or prohibitive communication cost in general. To mitigate this problem we propose Sparse Binary Compression (SBC), a compression framework that allows for a drastic reduction of communication cost for distributed training. SBC combines existing techniques of communication delay and gradient sparsification with a novel binarization method and optimal weight update encoding to push compression gains to new limits. By doing so, our method also allows us to smoothly trade-off gradient sparsity and temporal sparsity to adapt to the requirements of the learning task. Our experiments show, that SBC can reduce the upstream communication on a variety of convolutional and recurrent neural network architectures by more than four orders of magnitude without significantly harming the convergence speed in terms of forward-backward passes. For instance, we can train ResNet50 on ImageNet in the same number of iterations to the baseline accuracy, using $\times 3 5 3 1$ less bits or train it to a $1 \%$ lower accuracy using $\times 3 7 2 0 8$ less bits. In the latter case, the total upstream communication required is cut from 125 terabytes to 3.35 gigabytes for every participating client. Our method also achieves state-of-the-art compression rates in a Federated Learning setting with 400 clients.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
Distributed Stochastic Gradient Descent (DSGD) is a training setting, in which a number of clients jointly trains a deep learning model using stochastic gradient descent (Dean et al., 2012; Recht et al., 2011; Moritz et al., 2015). Every client holds an individual subset of the training data, used to improve the current master model. The improvement is obtained by investing computational resources to perform iterations of stochastic gradient descent (SGD). This local training produces a weight update $\Delta { \boldsymbol { \nu } } _ { }$ in every participating client, which in regular or irregular intervals ("communication rounds") is exchanged to produce a new master model. This exchange of weight updates can be performed indirectly via a centralized server or directly in an all-reduce operation. In both cases, all clients share the same master model after every communication round (see figure 1). In vanilla DSGD the clients have to communicate a full gradient update during every iteration. Every such update is of the same size as the full model, which can be in the range of gigabytes for modern architectures with millions of parameters (He et al., 2016; Huang et al., 2017). Over the course of multiple hundred thousands of training iterations on big datasets the total communication for every client can easily grow to more than a petabyte. Consequently, if communication bandwidth is limited, or communication is costly, distributed deep learning can become unproductive or even unfeasible. DSGD is a very popular training setting with many applications. On one end of the spectrum, DSGD can be used to greatly reduce the training time of large-scale deep learning models by introducing device-level data parallelism (Chilimbi et al., 2014; Zinkevich et al., 2010; Xing et al., 2015; Li et al., 2014), making use of the fact that the computation of a mini-batch gradient is perfectly parallelizable. In this setting, the clients are usually embodied by hardwired high-performance computation units (i.e. GPUs in a cluster) and every client performs one iteration of SGD per communication round. Since communication is high-frequent in this setting, bandwidth can be a significant bottleneck. On the other end of the spectrum DSGD can also be used to enable privacy-preserving deep learning (Shokri & Shmatikov, 2015; McMahan et al., 2016). Since the clients only ever share weight updates, DSGD makes it possible to train a model from the combined data of all clients without any individual client having to reveal their local training data to a centralized server. In this setting the clients typically are embedded or mobile devices with low network bandwidth, intermittent network connections, and an expensive mobile data plan. In both scenarios, the communication cost between the individual training nodes is a limiting factor for the performance of the whole learning system. For the synchronous distributed training scheme described above, the total amount of bits communicated by every client during training is given by
|
| 12 |
+
|
| 13 |
+

|
| 14 |
+
Figure 1: One communication round of DSGD: a) Clients synchronize with the server. b) Clients compute a weight update independently based on their local data. c) Clients upload their local weight updates to the server, where they are averaged to produce the new master model.
|
| 15 |
+
|
| 16 |
+
$$
|
| 17 |
+
\begin{array} { r } { \mathsf { b } _ { t o t a l } \in \mathcal { O } ( \underbrace { N _ { i t e r } \times f } _ { \# \mathrm { c o m m u n i c a t i o n ~ r o u n d s } } \times \underbrace { | \Delta \mathcal { W } _ { \neq 0 } | \times ( \bar { \mathrm { b } } _ { p o s } + \bar { \mathrm { b } } _ { v a l } ) } _ { \# \mathrm { b i t s ~ p e r ~ c o m m u n i c a t i o n } } \times \underbrace { K } _ { \# \mathrm { r e c e i v i n g ~ n o d e s } } ) } \end{array}
|
| 18 |
+
$$
|
| 19 |
+
|
| 20 |
+
where $N _ { i t e r }$ is the total number of training iterations (forward-backward passes) every client performs, $f$ is the communication frequency, $| \mathcal { W } _ { \neq 0 } |$ is the sparsity of the weight update, $\bar { \mathrm { b } } _ { p o s }$ , $\bar { \mathrm { b } } _ { v a l }$ are the average number of bits required to communicate the position and the value of the non-zero elements respectively and $K$ is the number of receiving nodes (if $\mathcal { W }$ is dense, the positions of all weights are predetermined and no position bits are required).
|
| 21 |
+
|
| 22 |
+
Substantial research has gone into the effort of reducing the amount of communication necessary between the clients via lossy compression schemes. Using the systematic of equation 1, we can organize prior approaches into three different groups:
|
| 23 |
+
|
| 24 |
+
Sparsification methods restrict weight updates to modifying only a small subset of the parameters, thus reducing $| \Delta \mathcal { W } _ { \neq 0 } |$ . Strom (2015) presents an approach (later modified by Tsuzuku et al. (2018)) in which only gradients with a magnitude greater than a certain predefined threshold are sent to the server. All other gradients are aggregated into a residual. This method achieves compression rates of up to 3 orders of magnitude on an acoustic modeling task. In practice however, it is hard to choose appropriate values for the threshold, as it may vary a lot for different architectures and even different layers. Instead of using a fixed threshold to decide what gradient entries to send, Aji & Heafield (2017) use a fixed sparsity rate. They only communicate the fraction $p$ entries of the gradient with the biggest magnitude, while also collecting all other gradients in a residual. At a sparsity rate of $p = 0 . 0 0 1$ their method slightly degrades the convergence speed and final accuracy of the trained model. Lin et al. (2017) present modifications to the work of Aji et al. which close this performance gap. These modifications include using a curriculum to slowly increase the amount of sparsity in the first couple communication rounds and applying momentum factor masking to overcome the problem of gradient staleness. Their method achieves compression rates ranging from $\times 2 7 0$ to $\times 6 0 0$ on different architectures, without slowdown in convergence speed.
|
| 25 |
+
|
| 26 |
+
Communication delay methods try to reduce the communication frequency $f$ . McMahan et al. (2016) propose Federated Averaging to reduce the cumulative communication. In Federated Averaging, instead of communicating after every iteration, every client performs multiple iterations of SGD to compute a weight update. The authors observe that this delay of communication does not significantly harm the convergence speed in terms of local iterations and report a reduction in the number of necessary communication rounds by a factor of $\times 1 0 - \times 1 0 0$ on different convolutional and recurrent neural network architectures. In a follow-up work Konecnˇ y et al. (2016) combine this \` communication delay with random sparsification and probabilistic quantization. They restrict the clients to learn random sparse weight updates or force random sparsity on them afterwards ("structured" vs "sketched" updates) and combine this sparsification with probabilistic quantization. While their method also combines communication delay with (random) sparsification and quantization, and achieves good compression gains for one particular CNN and LSTM model, it also causes a major drop in convergence speed and final accuracy.
|
| 27 |
+
|
| 28 |
+
Dense quantization methods try to reduce the amount of value bits $\bar { \mathrm { b } } _ { v a l }$ . Different quantization methods have been proposed that reduce the bit-width of the gradients to ternary (Wen et al., 2017), binary (Seide et al., 2014; Bernstein et al., 2018) or arbitrary (Alistarh et al., 2017) bitwidths. While these are theoretically well-founded and come with strong convergence guarantees, they are also limited to a maximum compression rate of $\times 3 2$ , compared to the regular 32-bit encoding.
|
| 29 |
+
|
| 30 |
+

|
| 31 |
+
2 ON THE ACCUMULATION OF GRADIENT INFORMATION
|
| 32 |
+
Figure 2: Sources of noise in SGD (illustration): Left: Optimization noise, caused by Gradient Descent overshooting. Bouncing between the walls of the ravine results in negatively correlated noise. Middle: Batch noise, caused by the batch loss being only a noisy approximation of the full empirical loss. Right: The compressed path converges equally fast, but requires only half of the information to be communicated.
|
| 33 |
+
|
| 34 |
+
Communication delay and sparsification methods as described above already achieve impressive compression rates, however the phenomenon underlying their successes is still only poorly understood. We present a new information-theoretic perspective that is based on the observation that both of these approaches achieve compression by accumulating gradient information locally before sending it to the server. In the case of communication delay all gradients are accumulated uniformly for a fixed amount of iterations, while in the case of sparsification methods they are accumulated non-uniformly until they exceed some fixed or adaptive threshold. In both cases the rate of compression is proportional to the number of steps that the updates are being delayed on average.
|
| 35 |
+
|
| 36 |
+
Consider now the optimization path $\Delta { \mathcal { W } } _ { 1 } , . . , \Delta { \mathcal { W } } _ { T }$ taken by SGD on the loss-surface between some initialization point W0 and the model WT = W0 + PTt=1 trained for $T$ iterations. Following this path, we can model the changes occurring to any individual weight in the network $w$ as a noisy stochastic process via
|
| 37 |
+
|
| 38 |
+
$$
|
| 39 |
+
\Delta w ^ { t } = s ^ { t } + n ^ { t } , t = 1 , . . , T
|
| 40 |
+
$$
|
| 41 |
+
|
| 42 |
+
where $s ^ { t }$ denotes the deterministic signal (i.e. the true direction of the minimum), while $n ^ { t }$ denotes the noise, induced by mini-batch sampling in SGD ("batch noise") and the stochasticity of the learning process itself ("optimization noise", see figure 2 for an illustration). For the sake of simplicity, and motivated by the central limit theorem we can assume (a) that this noise $n ^ { t }$ is normally distributed at every time-step $n ^ { t } \sim \mathcal N ( 0 , \sigma ^ { 2 } )$ with the variance being constant in time $\mathbb { V } ( n ^ { t } ) \stackrel { } { = } \sigma ^ { 2 }$ for all $t = 1 , . . , T$ . Since the optimization process has the tendency to damp noise as investigated for instance in LeCun et al. (2012) it is also reasonable to assume (b) that the noise is (negatively) self-correlated. The noise process is then given by $n ^ { 1 } = N ^ { 1 }$ , $n ^ { t } = \alpha n ^ { t - 1 } + N ^ { t }$ , with $N ^ { t }$ normally distributed and all $N ^ { t }$ uncorrelated, $\alpha \in ( - 1 , 0 )$ . Given these assumptions we can bound the variance of the accumulated parameter updates.
|
| 43 |
+
|
| 44 |
+
Theorem 2.1. Under assumptions (a) and $( b )$ , the variance of the accumulated noise can be bounded by
|
| 45 |
+
|
| 46 |
+
$$
|
| 47 |
+
\mathbb { V } ( \sum _ { t = 1 } ^ { T } n ^ { t } ) \le \sigma ^ { 2 } ( T ( 1 + \alpha ) + 1 ) .
|
| 48 |
+
$$
|
| 49 |
+
|
| 50 |
+
The proof can be found in the supplement. Theorem 2.1 directly leads us to a lower bound on the signal-to-noise ratio of the accumulated weight-updates:
|
| 51 |
+
|
| 52 |
+
Corollary 2.1.1. Under assumptions (a) and $( b )$ , accumulation increases the signal-to-noise ratio from $\bar { s } / \sigma$ to
|
| 53 |
+
|
| 54 |
+
$$
|
| 55 |
+
S N R ( \sum _ { t = 1 } ^ { T } \Delta w ^ { t } ) = \frac { \mathbb { E } [ \sum _ { t = 1 } ^ { T } s ^ { t } + n ^ { t } ] } { \sqrt { \mathbb { V } [ \sum _ { t = 1 } ^ { T } s ^ { t } + n ^ { t } ] } } \geq \frac { \sum _ { t = 1 } ^ { T } s ^ { t } } { \sqrt { \sigma ^ { 2 } ( T ( 1 + \alpha ) + 1 ) } } \approx \frac { \sqrt { T } } { \sqrt { 1 + \alpha } } \frac { \bar { s } } { \sigma }
|
| 56 |
+
$$
|
| 57 |
+
|
| 58 |
+
$\begin{array} { r } { \bar { s } = \frac { 1 } { T } \sum _ { t = 1 } ^ { T } { s ^ { t } } } \end{array}$ being the signal-average over time.
|
| 59 |
+
|
| 60 |
+
This means that a weight-update will be more informative the longer the accumulation period and the stronger the noise correlates temporally. Convergence speed will not be compromised for as long as the information content of the accumulated update is equal to the cumulative information content of the individual updates (c.f. fig. 2 (c)). This line of reasoning helps to shed light on both the successes of communication delay and gradient sparsification. In fact, it implies that both of these approaches are actually very similar in the way they affect the information flow from client to server on the individual weight level.
|
| 61 |
+
|
| 62 |
+
We find that this intuition is also verified empirically. Figure 3 shows validation errors for ResNet32 model trained on CIFAR for 60000 iterations at different levels of communication delay and gradient sparsity. We observe multiple things: 1.) The validation error remains more or less constant along the off-diagonals of the matrix where the total sparsity (i.e. the product of communication delay and gradient sparsity) is constant. 2.) The existing methods of Federated Averaging (McMahan et al., 2016) (purple) and Gradient Dropping/ DGC (Aji & Heafield, 2017; Lin et al., 2017)(yellow) are just lines in the two-dimensional space of possible compression methods. 3.) There exists a roughly triangular area of approximately constant error, optimal compression methods lie along the hypotenuse of this triangle. We find this behavior consistently across different model architectures, more examples can be found in the supplement. These results indicate, that communication delay and sparsification affect the convergence in a roughly multiplicative way and that there seems to exist a fixed information budged in DSGD, necessary to maintain unhindered convergence.
|
| 63 |
+
|
| 64 |
+

|
| 65 |
+
Figure 3: Validation Error for ResNet32 trained on CIFAR at different levels of temporal and gradient sparsity (the error is color-coded, brighter means lower error). The prior approaches of Gradient Dropping and Federated Averaging can be embedded in a two-dimensional compression framework.
|
| 66 |
+
|
| 67 |
+
In the following we present a framework that allows us to smoothly trade of these two types of gradient accumulation against one another. By doing so our proposed framework can adapt to the requirements of the distributed learning environment and achieve state-of-the-art compression results by reaping the benefits from both approaches.
|
| 68 |
+
|
| 69 |
+
# 3 SPARSE BINARY COMPRESSION
|
| 70 |
+
|
| 71 |
+
Inspired by our findings in the previous section, we propose Sparse Binary Compression (cf. Figure 4), to drastically reduce the number of communicated bits in distributed training. SBC makes use of multiple compression techniques simultaneously1 to reduce all multiplicative components of equation 1.
|
| 72 |
+
|
| 73 |
+

|
| 74 |
+
Figure 4: Step-by-step explanation of techniques used in Sparse Binary Compression: (a) Illustrated is the traversal of the parameter space with regular DSGD (left) and Federated Averaging (right). With this form of communication delay, a bigger region of the loss surface can be traversed, in the same number of communication rounds. That way compression gains of up to $\times 1 0 0 0$ are possible. After a number of iterations, the clients communicate their locally computed weight updates. (b) Before communication, the weight update is first sparsified, by dropping all but the fraction $p$ weight updates with the highest magnitude. This achieves up to $\times 1 0 0 0$ compression gain. (c) Then the sparse weight update is binarized for an additional compression gain of approximately $\times 3 .$ . (d) Finally, we optimally encode the positions of the non-zero elements, using Golomb encoding. This reduces the bit size of the compressed weight update by up to another $\times 2$ compared to naive encoding.
|
| 75 |
+
|
| 76 |
+
In the following $\mathcal { W }$ will refer to the entirety of neural network parameters, while $W \in { \mathcal { W } }$ will refer to one specific tensor of weights. Arithmetic operations on $\mathcal { W }$ are to be understood componentwise.
|
| 77 |
+
|
| 78 |
+
Communication Delay, Fig. 4 (a): We use communication delay, proposed by McMahan et al. (2016), to introduce temporal sparsity into DSGD. Instead of communicating gradients after every local iteration, we allow the clients to compute more informative updates by performing multiple iterations of SGD. These generalized weight updates are given by
|
| 79 |
+
|
| 80 |
+
$$
|
| 81 |
+
\Delta \mathcal { W } _ { i } = \mathrm { S G D } _ { n } ( \mathcal { W } _ { i } , D _ { i } ) - \mathcal { W } _ { i }
|
| 82 |
+
$$
|
| 83 |
+
|
| 84 |
+
where $\mathrm { S G D } _ { n } ( \mathcal { W } _ { i } , D _ { i } )$ refers to the set of weights obtained by performing $n$ iterations of stochastic gradient descent on $\mathcal { W } _ { i }$ , while sampling mini-batches from the i-th client’s training data $D _ { i }$ . Empirical analysis by McMahan et al. (2016) suggests that communication can be delayed drastically, with only marginal degradation of accuracy. For $n = 1$ we obtain regular DSGD.
|
| 85 |
+
|
| 86 |
+
Sparse Binarization, Fig. 4 (b), (c): Following the works of Lin et al. (2017)Strom (2015)Shokri & Shmatikov (2015) and Aji & Heafield (2017) we use the magnitude of an individual weight within a weight update as a heuristic for it’s importance. First, we set all but the fraction $p$ biggest and fraction $p$ smallest weight updates to zero. Next, we compute the mean of all remaining positive and all remaining negative weight updates independently. If the positive mean $\mu ^ { + }$ is bigger than the absolute negative mean $\mu ^ { - }$ , we set all negative values to zero and all positive values to the positive mean and vice versa. The method is illustrated in figure 4 and formalized in algorithm 2. Finding the fraction $p$ smallest and biggest values in a vector $W$ requires $\mathcal { O } ( | W | )$ operations, where $| W |$ refers to the number of elements in $W$ (Cormen et al., 2009). Lin et al. (2017) suggest to reduce the computational cost of this operation, by randomly subsampling from $W$ . However this comes at the cost of introducing (unbiased) noise in the amount of sparsity. Luckily, in our approach communication rounds (and thus compressions) are relatively infrequent, which helps to marginalize the overhead of the sparsification. Quantizing the non-zero elements of the sparsified weight update to the mean reduces the required value bits $\bar { b } _ { v a l }$ from 32 to $O$ . This translates to a reduction in communication cost by a factor of around $\times 3$ . We can get away with averaging out the non-zero weight updates because they are relatively homogeneous in value and because we accumulate our compression errors as described in the next paragraph.
|
| 87 |
+
|
| 88 |
+
Residual Accumulation, Fig. 4 (d): It is well established (Lin et al., 2017; Strom, 2015; Aji & Heafield, 2017; Seide et al., 2014) that the convergence in sparsified DSGD can be greatly accelerated by accumulating the error that arises from only sending sparse approximations of the weight updates. After every communication round, the residual is updated via
|
| 89 |
+
|
| 90 |
+
$$
|
| 91 |
+
\mathcal { R } _ { \tau } = \sum _ { t = 1 } ^ { \tau } ( \Delta \mathcal { W } _ { t } - \Delta \mathcal { W } _ { t } ^ { * } ) = \mathcal { R } _ { \tau - 1 } + \Delta \mathcal { W } _ { \tau } - \Delta \mathcal { W } _ { \tau } ^ { * } .
|
| 92 |
+
$$
|
| 93 |
+
|
| 94 |
+
Error accumulation has the great benefit that no gradient information is lost (it may only become outdated or "stale"). In the context of pure sparsification residual accumulation can be interpreted to be equivalent to increasing the batch size for individual parameters (Lin et al., 2017). Moreover, we can show:
|
| 95 |
+
|
| 96 |
+
Theorem 3.1. Let $\Delta W _ { 1 } , . . , \Delta W _ { T } \in \mathbb { R } ^ { n }$ be (flattened) weight updates, computed by one client in the first $T$ communication rounds. Let $\Delta W _ { 1 } ^ { * } , . . , \Delta W _ { T - 1 } ^ { * } \in \mathcal { S }$ be the actual weight updates, transferred in the previous rounds (restricted to some subspace $s$ ) and $\mathcal { R } _ { \tau }$ be the content of the residual at time $\tau$ as in equation 5. Then the orthogonal projection
|
| 97 |
+
|
| 98 |
+
$$
|
| 99 |
+
v = P r o j _ { S } ( \mathcal { R } _ { T - 1 } + \Delta W _ { T } )
|
| 100 |
+
$$
|
| 101 |
+
|
| 102 |
+
uniquely minimizes the accumulated error
|
| 103 |
+
|
| 104 |
+
$$
|
| 105 |
+
\operatorname { e r r } ( \Delta W _ { T } ^ { * } ) = \| \sum _ { t = 1 } ^ { T } ( \Delta W _ { t } - \Delta W _ { t } ^ { * } ) \|
|
| 106 |
+
$$
|
| 107 |
+
|
| 108 |
+
in S. (Proof in Supplement.)
|
| 109 |
+
|
| 110 |
+
That means that the residual accumulation keeps the compressed optimization path as close as possible to optimization path taken with non-compressed weight updates.
|
| 111 |
+
|
| 112 |
+
<table><tr><td></td><td>Algorithm 1: SynchronousDistributed Stochastic Gradient Descent (DSGD)</td></tr><tr><td></td><td>input: initial parameters W 2 outout: improved parameters W 3 init:all clients Ci are initialized with the</td></tr><tr><td></td><td>same parameters Wi ← W, the initial</td></tr><tr><td></td><td>global weight update and the residuals are set to zero △W,Ri←0</td></tr><tr><td></td><td>4 for t=1,..,T do for i∈ It ≌ {1,..,M} in parallel do</td></tr><tr><td>5 6</td><td>Client Ci does:</td></tr><tr><td>7</td><td>· msg ← downloads→C (msg)</td></tr><tr><td>8</td><td>· △W ← decode(msg)</td></tr><tr><td></td><td>·Wi←Wi+△W</td></tr><tr><td>9</td><td>· △Wi ← Ri+SGDn(Wi,Di)-Wi</td></tr><tr><td>10 11</td><td>· △W* ← compress(△Wi)</td></tr><tr><td>12</td><td>·Ri←△Wi-△W*</td></tr><tr><td></td><td>· msg: ← encode(△W*)</td></tr><tr><td>13 14</td><td>· uploadci→s(msg;)</td></tr><tr><td>15</td><td>end</td></tr><tr><td>16</td><td>Server S does:</td></tr><tr><td>17</td><td>: gatherci→s(△W*), i ∈ It</td></tr><tr><td>18</td><td>△W← £ielt △W*</td></tr><tr><td></td><td>. W←W+△W</td></tr><tr><td>19</td><td></td></tr><tr><td>20</td><td>broadcasts→c (△W), i=1,..,M</td></tr><tr><td>21</td><td>end</td></tr></table>
|
| 113 |
+
|
| 114 |
+
# Algorithm 2: Sparse Binary Compression
|
| 115 |
+
|
| 116 |
+
1 input: tensor $\Delta W$ , sparsity $p$
|
| 117 |
+
2 output: sparse tensor $\Delta W ^ { * }$
|
| 118 |
+
$\begin{array} { r l r } { { 3 } } & { { } \bullet } & { \mathrm { v a l ^ { + } } \mathrm { t o p } _ { p \% } ( \Delta W ) ; } \end{array}$ ;
|
| 119 |
+
$\begin{array} { r } { \mathbf { \Sigma } ^ { \mathbf { \textsc { v a l } } } \mathbf { \Sigma } ^ { } \mathbf { \Sigma } ^ { \mathbf { w p } } p \% \mathbf { \Sigma } ^ { \lfloor \Delta \nu \nu \rfloor , } } \\ { \mathbf { v a l } ^ { - } \mathbf { t o p } _ { p \% } ( - \Delta W ) } \end{array}$
|
| 120 |
+
${ \mathfrak { a } } \bullet \mu ^ { + } \operatorname { m e a n } ( \mathrm { v a l } ^ { + } ) ; \mu ^ { - } \operatorname { m e a n } ( \mathrm { v a l } ^ { - } )$ 5 if $\mu ^ { + } \geq \mu ^ { - }$ then
|
| 121 |
+
6 return $\Delta W ^ { * } \gets \mu ^ { + } ( W \geq \mathrm { \ m i n } ( \mathrm { v a l } ^ { + } ) )$ 7 else
|
| 122 |
+
8 return
|
| 123 |
+
$\Delta W ^ { * } \gets - \mu ^ { - } ( W \le - \operatorname* { m i n } ( \mathrm { v a l } ^ { - } ) )$ 9 end
|
| 124 |
+
|
| 125 |
+
# Algorithm 3: Golomb Position Encoding
|
| 126 |
+
|
| 127 |
+
1 input: sparse tensor $\Delta W ^ { * }$ , sparsity $p$
|
| 128 |
+
2 output: binary message msg
|
| 129 |
+
3 • $\bar { \mathcal { T } } \Delta W ^ { * } [ : ] _ { \neq 0 }$
|
| 130 |
+
4 $\begin{array} { r } { \bullet \ \mathbf { b } ^ { * } 1 + \lfloor \log _ { 2 } ( \frac { \log ( \phi - 1 ) } { \log ( 1 - p ) } ) \rfloor } \end{array}$
|
| 131 |
+
5 for $i = 1 , . . , | \mathcal { T } |$ do
|
| 132 |
+
6 • d ← Ii − Ii−1
|
| 133 |
+
7 • q ← (d − 1) div 2b∗
|
| 134 |
+
8 • r ← (d − 1) mod 2b∗
|
| 135 |
+
9 • msg.add(1, .., 1, 0, binaryb∗ (r))
|
| 136 |
+
| {z }q times
|
| 137 |
+
10 end
|
| 138 |
+
11 return msg
|
| 139 |
+
|
| 140 |
+
Optimal Position Encoding, Fig. 4 (e): To communicate a set of sparse binary tensors produced by SGC, we only need to transfer the positions of the non-zero elements in the flattened tensors, along with one mean value $\mu ^ { + }$ or $\mu ^ { - }$ ) per tensor. Instead of communicating the absolute non-zero positions it is favorable to only communicate the distances between all non-zero elements. It is possible to show that for big values of $| W |$ and $k = p | W |$ , the distances are approximately geometrically distributed with success probability equal to the sparsity rate $p$ . Therefore, we can optimally encode the distances using the Golomb code Golomb (1966). Golomb encoding reduces the average number of position bits to
|
| 141 |
+
|
| 142 |
+
$$
|
| 143 |
+
\bar { \mathrm { b } } _ { p o s } = \mathbf { b } ^ { * } + \frac { 1 } { 1 - ( 1 - p ) ^ { 2 ^ { \mathbf { b } ^ { * } } } } ,
|
| 144 |
+
$$
|
| 145 |
+
|
| 146 |
+
with b∗ = 1 + blog2( log(φ−1)log(1−p) ) and $\textstyle \phi = { \frac { { \sqrt { 5 } } + 1 } { 2 } }$ being the golden ratio. For a sparsity rate of i.e. $p = 0 . 0 1$ , we get $\bar { \mathrm { b } } _ { p o s } = 8 . 3 8$ , which translates to $\times 1 . 9$ compression, compared to a naive distance encoding with 16 fixed bits. While the overhead for encoding and decoding makes it unproductive to use Golomb encoding in the situation of Strom (2015), this overhead becomes negligible in our situation due to the infrequency of weight update exchange resulting from communication delay. The encoding scheme is given in algorithm 3, while the decoding scheme can be found in the supplement.
|
| 147 |
+
|
| 148 |
+
Momentum Correction, Warm-up Training and Momentum Masking: Lin et al. (2017) introduce multiple minor modifications to the vanilla Gradient Dropping method, to improve the convergence speed. We adopt momentum masking, while momentum correction is implicit to our approach. For more details on this we refer to the supplement.
|
| 149 |
+
|
| 150 |
+
Our proposed method is described in Algorithms 1, 2 and 3. Algorithm 1 describes how compression and residual accumulation can be introduced into DSGD. Algorithm 2 describes our compression method. Algorithm 3 describes the Golomb encoding. Table 1 compares theoretical asymptotic compression rates of different popular compression methods.
|
| 151 |
+
|
| 152 |
+
<table><tr><td colspan="2">Total Bits =</td><td>Baseline</td><td>SignSGD, TernGrad, QSGD</td><td>Gradient Dropping, DGC</td><td>Federated Averaging</td><td>Sparse Binary Compression</td></tr><tr><td rowspan="3">×</td><td>Temporal Sparsity</td><td>100%</td><td>100%</td><td>100%</td><td>0.1% - 10%</td><td>0.1% - 10%</td></tr><tr><td>Gradient Sparsity</td><td>100%</td><td>100%</td><td>0.1%</td><td>100%</td><td>0.1% - 10%</td></tr><tr><td>Value Bits</td><td>32</td><td>1-8</td><td>32</td><td>32</td><td>0</td></tr><tr><td colspan="2">×M Position Bits</td><td>0</td><td>0</td><td>16</td><td>0</td><td>8-14</td></tr><tr><td colspan="2">Compression Rate</td><td>×1</td><td>×4-×32</td><td>×666</td><td>×10-×1000</td><td>-×40000</td></tr></table>
|
| 153 |
+
|
| 154 |
+
Table 1: Theoretical asymptotic compression rates for different compression methods broken down into components. Only SBC reduces all multiplicative components of the total bitsize (cf. eq. 1).
|
| 155 |
+
|
| 156 |
+
# 4 EXPERIMENTS
|
| 157 |
+
|
| 158 |
+
# 4.1 NETWORKS AND DATASETS
|
| 159 |
+
|
| 160 |
+
We evaluate our method on commonly used convolutional and recurrent neural networks with millions of parameters, which we train on well-studied data sets that contain up to multiple millions of samples. We perform experiments with client numbers ranging from 4 to 400 to cover both the distributed training and federated learning use-case.
|
| 161 |
+
|
| 162 |
+
Image Classification: We run experiments for LeNet5-Caffe2 on MNIST LeCun (1998), ResNet18 and ResNet34 He et al. (2016) on CIFAR-10 and CIFAR-100 Krizhevsky et al. (2014) and ResNet50 on ILSVRC12 (ImageNet) Deng et al. (2009). For the i.i.d. setting we split the training data randomly into equally sized shards and assign one shard to every one of the clients. For the non-i.i.d. setting every client is assigned samples from only two classes of the dataset, but the amount of data still remains the same for every client. All models are trained using momentum SGD, except for LeNet5- Caffe, which is trained using the Adam optimizer Kingma & Ba (2014). Learning rate, weight intitiallization and data augmentation are as in the respective papers.
|
| 163 |
+
|
| 164 |
+
<table><tr><td></td><td colspan="2">Compression Method -→</td><td>Baseline</td><td>DGC3</td><td>Federated Averaging4</td><td>SBC (1)</td><td>SBC (2)</td><td>SBC (3)</td></tr><tr><td rowspan="9">taprrisititt</td><td>LeNet5-Caffe @MNIST</td><td>Accuracy</td><td>0.9946</td><td>0.994</td><td>0.994</td><td>0.994</td><td>0.994</td><td>0.991</td></tr><tr><td></td><td>Compression</td><td>×1</td><td>×718</td><td>×500</td><td>×2071</td><td>×3166</td><td>×24935</td></tr><tr><td>ResNet18 @CIFAR10</td><td>Accuracy</td><td>0.946</td><td>0.9383</td><td>0.9279</td><td>0.9422</td><td>0.9435</td><td>0.9219</td></tr><tr><td>ResNet34</td><td>Compression Accuracy</td><td>×1</td><td>×768</td><td>×1000</td><td>×2369</td><td>×3491 0.7655</td><td>× 31664 0.701</td></tr><tr><td>@CIFAR100</td><td>Compression</td><td>0.773 ×1</td><td>0.767 ×718</td><td>0.7316</td><td>0.767 ×2370</td><td>×3166</td><td>×31664</td></tr><tr><td>ResNet50</td><td>Accuracy</td><td>0.737</td><td>0.739</td><td>×1000 0.724</td><td>0.735</td><td>0.737</td><td>0.728</td></tr><tr><td>@ImageNet</td><td>Compression</td><td>×1</td><td>×601</td><td>×1000</td><td>×2569</td><td>×3531</td><td>×37208</td></tr><tr><td>WordLSTM</td><td>Perplexity</td><td>76.02</td><td>75.98</td><td>76.37</td><td>77.73</td><td>78.19</td><td>77.57</td></tr><tr><td>@PTB</td><td>Compression</td><td>×1</td><td>×719</td><td>×1000</td><td>×2371</td><td>×3165</td><td>×31658</td></tr><tr><td>WordLSTM*</td><td>Perplexity</td><td>101.5</td><td>102.318</td><td>131.51</td><td>103.95</td><td>103.95</td><td>104.62</td></tr><tr><td>@WIKI</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td>Compression</td><td></td><td>×719</td><td>×1000</td><td>×2371</td><td>×3165</td><td>×31657</td></tr><tr><td></td><td></td><td>×1</td><td></td><td></td><td></td><td></td><td></td></tr></table>
|
| 165 |
+
|
| 166 |
+
Table 2: Final accuracy/perplexity achieved on the test split and average compression rate for different compression schemes in a distributed training setting with different numbers of clients.
|
| 167 |
+
|
| 168 |
+
Language Modeling: We experiment with multilayer sequence-to-sequence LSTM models as described in Zaremba et al. (2014) on the Penn Treebank (PTB) Marcus et al. (1993) and Wikitext-2 corpora for next-word prediction. The PTB dataset consists of a sequence 923000 training, and 82000 validation words, while the Wikitext-2 dataset contains 2088628 train and 245569 test words. On both datasets we train a two-layer LSTM model with 650 and 200 hidden units respectively ("WordLSTM" / "WordLSTM\*") with tied weights between encoder and decoder as described in Inan et al. (2016). The training data is split into consecutive subsequences of equal length, out of which we assign one to every client.
|
| 169 |
+
|
| 170 |
+
While the models we use in our experiments do not fully achieve state-of-the-art results on the respective tasks and datasets, they are still sufficient for the purpose of evaluating our compression method and demonstrate, that our method works well with common regularization techniques such as batch normalization Ioffe & Szegedy (2015) and dropout Srivastava et al. (2014). A complete description of models and hyperparameters can be found in the supplement.
|
| 171 |
+
|
| 172 |
+
# 4.2 RESULTS
|
| 173 |
+
|
| 174 |
+
We experiment with three configurations of our method: SBC (1) uses no communication delay and a gradient sparsity of $0 . 1 \%$ , SBC (2) uses 10 iterations of communication delay and $1 \%$ gradient sparsity and SBC (3) uses 100 iterations of communication delay and $1 \%$ gradient sparsity. Our decision for these points on the 2D grid of possible configurations is somewhat arbitrary. The experiments with SBC (1) serve the purpose of enabling us to directly compare our 0-value-bit quantization to the 32-value-bit Deep Gradient Compression (Lin et al., 2017)).
|
| 175 |
+
|
| 176 |
+
Table 2 lists compression rates and final validation accuracies achieved by different compression methods, when applied to the training of neural networks on 5 different datasets. The number of iterations (forward-backward-passes) is held constant for all methods. On all benchmarks, our methods perform comparable to the baseline, while communicating significantly less bits.
|
| 177 |
+
|
| 178 |
+
Figure 5 shows convergence speed in terms of iterations (left) and communicated bits (right) respectively for ResNet50 trained on ImageNet. The convergence speed is only marginally affected, by our different compression methods. In the first 30 epochs SBC (3) even achieves the highest accuracy, using about $\times 3 7 0 0 0$ less bits than the baseline. In total, SBC (3) reduces the upstream communication on this benchmark from 125 terabytes to 3.35 gigabytes for every participating client. After the learning rate is lowered in epochs 30 and 60 progress slows down for SBC (3) relative to the
|
| 179 |
+
|
| 180 |
+
<table><tr><td rowspan=2 colspan=1></td><td rowspan=1 colspan=2>Compression Method -→</td><td rowspan=1 colspan=1>Baseline</td><td rowspan=1 colspan=1>GradientDroping</td><td rowspan=1 colspan=1>FederatedAveraging</td><td rowspan=1 colspan=1>SBC (1)</td><td rowspan=1 colspan=1>SBC (2)</td><td rowspan=1 colspan=1>SBC (3)</td></tr><tr><td rowspan=1 colspan=8> i.i.d. data</td></tr><tr><td rowspan=1 colspan=1>50</td><td rowspan=1 colspan=1>ResNet18*5@CIFAR10</td><td rowspan=1 colspan=1>AccuracyCompression</td><td rowspan=1 colspan=1>0.9254×1</td><td rowspan=1 colspan=1>0.9167×713</td><td rowspan=1 colspan=1>0.911×100</td><td rowspan=1 colspan=1>0.921×2362</td><td rowspan=1 colspan=1>0.902×3166</td><td rowspan=1 colspan=1>0.906×31664</td></tr><tr><td rowspan=1 colspan=1>10</td><td rowspan=1 colspan=1>LeNet5-Caffe@MNIST</td><td rowspan=1 colspan=1>AccuracyCompression</td><td rowspan=1 colspan=1>0.979×1</td><td rowspan=1 colspan=1>0.9811×714</td><td rowspan=1 colspan=1>0.967×100</td><td rowspan=1 colspan=1>0.979×2363</td><td rowspan=1 colspan=1>0.9818×3165</td><td rowspan=1 colspan=1>0.9536×31655</td></tr><tr><td rowspan=1 colspan=1>300</td><td rowspan=1 colspan=1>LeNet5-Caffe@MNIST</td><td rowspan=1 colspan=1>AccuracyCompression</td><td rowspan=1 colspan=1>0.9758×1</td><td rowspan=1 colspan=1>0.9744×714</td><td rowspan=1 colspan=1>0.899×100</td><td rowspan=1 colspan=1>0.9731×2363</td><td rowspan=1 colspan=1>0.9733×3165</td><td rowspan=1 colspan=1>0.8919×31655</td></tr><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=8> non-i.i.d. data</td></tr><tr><td rowspan=1 colspan=1>10</td><td rowspan=1 colspan=1>LeNet5-Caffe@MNIST</td><td rowspan=1 colspan=1> AccuracyCompression</td><td rowspan=1 colspan=1>0.9506×1</td><td rowspan=1 colspan=1>0.9498×714</td><td rowspan=1 colspan=1>0.8592×100</td><td rowspan=1 colspan=1>0.9522×2363</td><td rowspan=1 colspan=1>0.9583×3165</td><td rowspan=1 colspan=1>0.8344×31655</td></tr></table>
|
| 181 |
+
|
| 182 |
+
Table 3: Final accuracy achieved on the test split and average compression rate for different compression schemes in a Federated learning setting with different numbers of clients.
|
| 183 |
+
|
| 184 |
+
methods which do not use communication delay. In direct comparison SBC (1) performs very similar to Gradient Dropping, while using about $\times 4$ less bits (that is $\times 2 5 6 9$ less bits than the baseline).
|
| 185 |
+
|
| 186 |
+

|
| 187 |
+
Figure 5: Left: Top-1 validation accuracy vs number of epochs. Right: Top-1 validation error vs number of transferred bits (log-log). Epochs 30 and 60 at which the learning rate is reduced are marked in the plot. ResNet50 trained on ImageNet.
|
| 188 |
+
|
| 189 |
+
Table 3 shows results for the federated learning setting with much higher numbers of clients trained on both i.i.d. and non-i.i.d. splits of data. We can see that in particular with growing numbers of clients and in the non-i.i.d. case, Federated Averaging significantly slows down the convergence and degrades the final accuracy. SBC (3) also suffers in this scenario as is also relies on 100 steps of communication delay. Conversely, our methods SBC (1) and (2) that rely more heavily on gradient sparsification perform much better in this setting and in some cases even beat the baseline. This behavior is expected, as the frequent exchange of gradient information in SBC (1) and (2) keeps all clients aligned, while they diverge further from one another for every iteration that communication is delayed in Federated Averaging.
|
| 190 |
+
|
| 191 |
+
Our experiments suggest that the distinction between the two formerly treated as separate distributed training settings of federated learning and data-parallel training is somewhat arbitrary and misleading and that better results can be achieved by combining the best approaches from both of these worlds. Contrary to the paradigm suggested in previous literature (McMahan et al., 2016), communication delay does not seem to be a well-suited approach for communication reduction in the federated learning setting. Instead our experiments demonstrate, that drastically better performance can be achieved under an even lower communication budged, if individual weight-updates are sparsified instead of delayed. On the other hand, it’s easy to see that communication delay has the potential to speed-up parallel training as it allows the individual computation devices to perform multiple steps of SGD without interruption. Our experiments with 4 clients demonstrate that introducing communication delay into data parallel training is not harmful to the convergence of the model in terms of training iterations.
|
| 192 |
+
|
| 193 |
+
# 5 CONCLUSION
|
| 194 |
+
|
| 195 |
+
The gradient information for training deep neural networks with SGD is highly redundant (see e.g. Lin et al. (2017)). We exploit this fact to the extreme by combining 3 powerful compression strategies and are able to achieve compression gains of up to four orders of magnitude with only a slight decrease in accuracy. More fundamentally, we present theoretical and empirical evidence suggesting that the formerly treated as separate compression methods of communication delay and gradient sparsification in fact can be viewed as two very similar forms of gradient delay that affect the convergence speed in a roughly multiplicative way. Based on this insight we propose a framework that is able to reap the benefits from both compression approaches and can smoothly adapt to communication-constraints in the learning environment, such as network bandwidth and latency and (SGD-)computation time as well as temporal inhomogeneities therein. This leads to advantages in both federated learning and data-parallel training of deep neural networks. We would like to highlight, that in no case we did modify the hyperparameters of the respective baseline models to accommodate our method. This demonstrates that our method is easily applicable. Note however that an extensive hyperparameter search could further improve the results. Furthermore, our findings in sections 2 and 4 indicate that even higher compression rates are possible if we adapt communication delay and gradient sparsity to the particular training objective. It remains an interesting direction of further research to identify heuristics and theoretical insights that can help to find the optimal balance and thus guide sparsity towards optimality.
|
| 196 |
+
|
| 197 |
+
# REFERENCES
|
| 198 |
+
|
| 199 |
+
Alham Fikri Aji and Kenneth Heafield. Sparse communication for distributed gradient descent. arXiv preprint arXiv:1704.05021, 2017.
|
| 200 |
+
|
| 201 |
+
Dan Alistarh, Demjan Grubic, Jerry Li, Ryota Tomioka, and Milan Vojnovic. Qsgd: Communicationefficient sgd via gradient quantization and encoding. In Advances in Neural Information Processing Systems, pp. 1707–1718, 2017.
|
| 202 |
+
|
| 203 |
+
Jeremy Bernstein, Yu-Xiang Wang, Kamyar Azizzadenesheli, and Anima Anandkumar. signsgd: compressed optimisation for non-convex problems. arXiv preprint arXiv:1802.04434, 2018.
|
| 204 |
+
|
| 205 |
+
Trishul M Chilimbi, Yutaka Suzue, Johnson Apacible, and Karthik Kalyanaraman. Project adam: Building an efficient and scalable deep learning training system. In OSDI, volume 14, pp. 571–582, 2014.
|
| 206 |
+
|
| 207 |
+
Thomas H Cormen, Charles E Leiserson, Ronald L Rivest, and Clifford Stein. Introduction to algorithms. MIT press, 2009.
|
| 208 |
+
|
| 209 |
+
Jeffrey Dean, Greg Corrado, Rajat Monga, Kai Chen, Matthieu Devin, Mark Mao, Andrew Senior, Paul Tucker, Ke Yang, Quoc V Le, et al. Large scale distributed deep networks. In Advances in neural information processing systems, pp. 1223–1231, 2012.
|
| 210 |
+
|
| 211 |
+
Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. In Computer Vision and Pattern Recognition, 2009. CVPR 2009. IEEE Conference on, pp. 248–255. IEEE, 2009.
|
| 212 |
+
|
| 213 |
+
Solomon Golomb. Run-length encodings (corresp.). IEEE transactions on information theory, 12(3): 399–401, 1966.
|
| 214 |
+
|
| 215 |
+
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.
|
| 216 |
+
|
| 217 |
+
Gao Huang, Zhuang Liu, Kilian Q Weinberger, and Laurens van der Maaten. Densely connected convolutional networks. In Proceedings of the IEEE conference on computer vision and pattern recognition, volume 1, pp. 3, 2017.
|
| 218 |
+
|
| 219 |
+
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.
|
| 220 |
+
|
| 221 |
+
Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. In International conference on machine learning, pp. 448–456, 2015.
|
| 222 |
+
|
| 223 |
+
Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
|
| 224 |
+
|
| 225 |
+
Jakub Konecnˇ y, H Brendan McMahan, Felix X Yu, Peter Richtárik, Ananda Theertha Suresh, and \` Dave Bacon. Federated learning: Strategies for improving communication efficiency. arXiv preprint arXiv:1610.05492, 2016.
|
| 226 |
+
|
| 227 |
+
Alex Krizhevsky, Vinod Nair, and Geoffrey Hinton. The cifar-10 dataset. online: http://www. cs. toronto. edu/kriz/cifar. html, 2014.
|
| 228 |
+
|
| 229 |
+
Yann LeCun. The mnist database of handwritten digits. http://yann. lecun. com/exdb/mnist/, 1998.
|
| 230 |
+
|
| 231 |
+
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.
|
| 232 |
+
|
| 233 |
+
Yann A LeCun, Léon Bottou, Genevieve B Orr, and Klaus-Robert Müller. Efficient backprop. In Neural networks: Tricks of the trade, pp. 9–48. Springer, 2012.
|
| 234 |
+
|
| 235 |
+
Mu Li, David G Andersen, Alexander J Smola, and Kai Yu. Communication efficient distributed machine learning with the parameter server. In Advances in Neural Information Processing Systems, pp. 19–27, 2014.
|
| 236 |
+
|
| 237 |
+
Yujun Lin, Song Han, Huizi Mao, Yu Wang, and William J Dally. Deep gradient compression: Reducing the communication bandwidth for distributed training. arXiv preprint arXiv:1712.01887, 2017.
|
| 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 |
+
H Brendan McMahan, Eider Moore, Daniel Ramage, Seth Hampson, et al. Communication-efficient learning of deep networks from decentralized data. arXiv preprint arXiv:1602.05629, 2016.
|
| 242 |
+
|
| 243 |
+
Philipp Moritz, Robert Nishihara, Ion Stoica, and Michael I Jordan. Sparknet: Training deep networks in spark. arXiv preprint arXiv:1511.06051, 2015.
|
| 244 |
+
|
| 245 |
+
Benjamin Recht, Christopher Re, Stephen Wright, and Feng Niu. Hogwild: A lock-free approach to parallelizing stochastic gradient descent. In Advances in neural information processing systems, pp. 693–701, 2011.
|
| 246 |
+
|
| 247 |
+
Frank Seide, Hao Fu, Jasha Droppo, Gang Li, and Dong Yu. 1-bit stochastic gradient descent and its application to data-parallel distributed training of speech dnns. In Fifteenth Annual Conference of the International Speech Communication Association, 2014.
|
| 248 |
+
|
| 249 |
+
Reza Shokri and Vitaly Shmatikov. Privacy-preserving deep learning. In Proceedings of the 22nd ACM SIGSAC conference on computer and communications security, pp. 1310–1321. ACM, 2015.
|
| 250 |
+
|
| 251 |
+
Nitish Srivastava, Geoffrey Hinton, Alex Krizhevsky, Ilya Sutskever, and Ruslan Salakhutdinov. Dropout: A simple way to prevent neural networks from overfitting. The Journal of Machine Learning Research, 15(1):1929–1958, 2014.
|
| 252 |
+
|
| 253 |
+
Nikko Strom. Scalable distributed dnn training using commodity gpu cloud computing. In Sixteenth Annual Conference of the International Speech Communication Association, 2015.
|
| 254 |
+
|
| 255 |
+
Yusuke Tsuzuku, Hiroto Imachi, and Takuya Akiba. Variance-based gradient compression for efficient distributed deep learning. arXiv preprint arXiv:1802.06058, 2018.
|
| 256 |
+
|
| 257 |
+
Wei Wen, Cong Xu, Feng Yan, Chunpeng Wu, Yandan Wang, Yiran Chen, and Hai Li. Terngrad: Ternary gradients to reduce communication in distributed deep learning. arXiv preprint arXiv:1705.07878, 2017.
|
| 258 |
+
|
| 259 |
+
Eric P Xing, Qirong Ho, Wei Dai, Jin Kyu Kim, Jinliang Wei, Seunghak Lee, Xun Zheng, Pengtao Xie, Abhimanu Kumar, and Yaoliang Yu. Petuum: A new platform for distributed machine learning on big data. IEEE Transactions on Big Data, 1(2):49–67, 2015.
|
| 260 |
+
|
| 261 |
+
Wojciech Zaremba, Ilya Sutskever, and Oriol Vinyals. Recurrent neural network regularization. arXiv preprint arXiv:1409.2329, 2014.
|
| 262 |
+
|
| 263 |
+
Martin Zinkevich, Markus Weimer, Lihong Li, and Alex J Smola. Parallelized stochastic gradient descent. In Advances in neural information processing systems, pp. 2595–2603, 2010.
|
| 264 |
+
|
| 265 |
+
# 6 SUPPLEMENT
|
| 266 |
+
|
| 267 |
+
6.1 MOMENTUM CORRECTION, WARM-UP TRAINING AND MOMENTUM MASKING:
|
| 268 |
+
|
| 269 |
+
Lin et al. introduce multiple minor modifications to the vanilla Gradient Dropping method. With these modifications they achieve up to around $1 \%$ higher accuracy compared to Gradient Dropping on a variety of benchmarks. Those modifications include:
|
| 270 |
+
|
| 271 |
+
Momentum correction: Instead of adding the raw gradient to the residuum, the momentum-corrected gradient is added. This is used implicitly in our approach, as our weight updates are already momentum-corrected.
|
| 272 |
+
|
| 273 |
+
Warm-up Training: The sparsity rate is increased exponentially from $2 5 \%$ to $0 . 1 \%$ in the first epochs. We find that warm-up training can indeed speed-up convergence in the beginning of training, but ultimately has no effect on the final accuracy of the model. We therefore omit warm up training in our experiments, as it adds an additional hyperparameter to the method, without any real benefit.
|
| 274 |
+
|
| 275 |
+
Momentum Masking: To avoid stale momentum from carrying the optimization into a wrong direction after a weight update is performed, Lin et al. suggest to set the momentum to zero for updated weights. We adopt momentum correction in our method.
|
| 276 |
+
|
| 277 |
+
# 6.2 GOLOMB POSITION DECODING
|
| 278 |
+
|
| 279 |
+
Algorithm 4 describes the decoding of a binary sequence produced by Golomb Position Encoding (see main paper). Since the shapes of all weight-tensors are known to both the server and all clients, we can omit the shape information in both encoding and decoding.
|
| 280 |
+
|
| 281 |
+
# Algorithm 4: Golomb Position Decoding
|
| 282 |
+
|
| 283 |
+
1 input: binary message msg, bitsize $\mathbf { b } ^ { * }$ , mean value $\mu$
|
| 284 |
+
2 output: sparse tensor $\Delta W ^ { * }$
|
| 285 |
+
3 init: $\Delta W ^ { * } 0 \in \mathbb { R } ^ { n }$
|
| 286 |
+
4 $i \gets 0$ ; $q \gets 0$ ; $j 0$
|
| 287 |
+
5 while $i < s i z e ( \mathrm { m s g } )$ do
|
| 288 |
+
6 i ${ \bf f } \log [ i ] = 0$ then
|
| 289 |
+
7 • $j \gets j + q 2 ^ { \mathbf { b } ^ { \ast } } + \mathrm { i n t } _ { \mathbf { b } ^ { \ast } } ( \mathrm { m s g } [ i + 1 ] , . . , \mathrm { m s g } [ i + \mathbf { b } ^ { \ast } ] ) + 1$
|
| 290 |
+
8 • ∆W ∗j ← µ
|
| 291 |
+
9 q 0; i i + b∗ + 1
|
| 292 |
+
10 else
|
| 293 |
+
11 • q ← q + 1; i ← i + 1
|
| 294 |
+
12 end
|
| 295 |
+
13 end
|
| 296 |
+
14 return ∆W ∗
|
| 297 |
+
|
| 298 |
+
# 6.3 MODEL SPECIFICATION
|
| 299 |
+
|
| 300 |
+
Below, we describe the neural network models used in our experiments. Table 4 list the training hyperparameters that were used.
|
| 301 |
+
|
| 302 |
+
Table 4: Hyperparameters used for our experiments in sections 2 and 4.
|
| 303 |
+
|
| 304 |
+
<table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>Experiment</td><td rowspan=1 colspan=1>Iterations</td><td rowspan=1 colspan=1>Batchsize</td><td rowspan=1 colspan=1>LR</td><td rowspan=1 colspan=1>LR Decay</td><td rowspan=1 colspan=1>Optimizer</td></tr><tr><td rowspan=6 colspan=1>tettittt</td><td rowspan=1 colspan=1>LeNet5-Caffe@MNIST</td><td rowspan=1 colspan=1>2000</td><td rowspan=1 colspan=1>128×4</td><td rowspan=1 colspan=1>0.001</td><td rowspan=1 colspan=1>=</td><td rowspan=1 colspan=1>Adam</td></tr><tr><td rowspan=1 colspan=1>ResNet18@CIFAR10</td><td rowspan=1 colspan=1>36000</td><td rowspan=1 colspan=1>32×4</td><td rowspan=1 colspan=1>0.1</td><td rowspan=1 colspan=1>0.1 @ ep 40 and 80</td><td rowspan=1 colspan=1>Momentum SGD</td></tr><tr><td rowspan=1 colspan=1>ResNet34@CIFAR100</td><td rowspan=1 colspan=1>36000</td><td rowspan=1 colspan=1>32×4</td><td rowspan=1 colspan=1>0.1</td><td rowspan=1 colspan=1>0.1@ep 40 and 80</td><td rowspan=1 colspan=1>Momentum SGD</td></tr><tr><td rowspan=1 colspan=1>ResNet50@ImageNet</td><td rowspan=1 colspan=1>900000</td><td rowspan=1 colspan=1>32×4</td><td rowspan=1 colspan=1>0.1</td><td rowspan=1 colspan=1>0.1@ep 30 and 60</td><td rowspan=1 colspan=1>Momentum SGD</td></tr><tr><td rowspan=1 colspan=1>WordLSTM@PTB</td><td rowspan=1 colspan=1>53000</td><td rowspan=1 colspan=1>5×4</td><td rowspan=1 colspan=1>20</td><td rowspan=1 colspan=1>decay 0.25 if losshas not decreased</td><td rowspan=1 colspan=1>SGD</td></tr><tr><td rowspan=1 colspan=1>WordLSTM*@WIKI</td><td rowspan=1 colspan=1>120000</td><td rowspan=1 colspan=1>5×4</td><td rowspan=1 colspan=1>20</td><td rowspan=1 colspan=1>decay 0.25 if losshas not decreased</td><td rowspan=1 colspan=1>SGD</td></tr><tr><td rowspan=1 colspan=1>50</td><td rowspan=1 colspan=1>Resnet18*@CIFAR10</td><td rowspan=1 colspan=1>23000</td><td rowspan=1 colspan=1>4×50</td><td rowspan=1 colspan=1>0.1</td><td rowspan=1 colspan=1>0.1@ ep 40 and 80</td><td rowspan=1 colspan=1>Momentum SGD</td></tr><tr><td rowspan=1 colspan=1>100</td><td rowspan=1 colspan=1>LeNet5-Caffe@MNIST</td><td rowspan=1 colspan=1>2500</td><td rowspan=1 colspan=1>8×100</td><td rowspan=1 colspan=1>0.001</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>Adam</td></tr><tr><td rowspan=1 colspan=1>40</td><td rowspan=1 colspan=1>LeNet5-Caffe@MNIST</td><td rowspan=1 colspan=1>2500</td><td rowspan=1 colspan=1>2×400</td><td rowspan=1 colspan=1>0.001</td><td rowspan=1 colspan=1>=</td><td rowspan=1 colspan=1>Adam</td></tr></table>
|
| 305 |
+
|
| 306 |
+
LeNet5-Caffe: The model specification can be downloaded from the Caffe MNIST tutorial page: https://github.com/BVLC/caffe/blob/master/examples/mnist/lenet_ train_test.prototxt. (Features convolutional layers, fully connected layers, pooling.)
|
| 307 |
+
|
| 308 |
+
ResNet18, ResNet32, ResNet50: We use the implementation from the official PyTorch repository: https://github.com/pytorch/examples/tree/master/imagenet. (Features skip-connections, batch-normalization.)
|
| 309 |
+
|
| 310 |
+
WordLSTM: We use the implementation from the official PyTorch repository (configuration "medium"): https://github.com/pytorch/examples/tree/master/word_ language_model. (Features trainable word-embeddings, multilayer LSTM-cells, dropout.)
|
| 311 |
+
|
| 312 |
+
# 6.4 PROOF OF THEOREM 2.1.
|
| 313 |
+
|
| 314 |
+
Proof. Since
|
| 315 |
+
|
| 316 |
+
$$
|
| 317 |
+
\begin{array} { r } { n ^ { t } = \alpha n ^ { t - 1 } + N ^ { t } = \alpha ( \alpha n ^ { t - 2 } + N ^ { t - 1 } ) + N ^ { t } = \alpha ^ { 2 } n ^ { t - 2 } + \alpha N ^ { t - 1 } + N ^ { t } } \\ { = \alpha ^ { \tau } n ^ { t - \tau } + \displaystyle \sum _ { i = 0 } ^ { \tau - 1 } \alpha ^ { i } N ^ { t - i } } \end{array}
|
| 318 |
+
$$
|
| 319 |
+
|
| 320 |
+
it holds that
|
| 321 |
+
|
| 322 |
+
$$
|
| 323 |
+
\mathrm { c o v } ( n ^ { t - \tau } , n ^ { t } ) = \mathrm { c o v } ( n ^ { t - \tau } , \alpha ^ { \tau } n ^ { t - \tau } + \sum _ { i = 0 } ^ { \tau - 1 } \alpha ^ { i } N ^ { t - i } ) = \alpha ^ { \tau } \sigma ^ { 2 } + \sum _ { i = 0 } ^ { \tau - 1 } \alpha ^ { i } \underbrace { \mathrm { c o v } ( n ^ { t - \tau } , N ^ { t - i } ) } _ { = 0 } = \alpha ^ { \tau } \sigma ^ { 2 }
|
| 324 |
+
$$
|
| 325 |
+
|
| 326 |
+
With equation equation 10 it follows that
|
| 327 |
+
|
| 328 |
+
$$
|
| 329 |
+
\begin{array} { r l r } { { \mathbb { V } ( \sum _ { t = 1 } ^ { T } n ^ { t } ) = \sum _ { t _ { 1 } = 1 } ^ { T } \sum _ { t _ { 2 } = 1 } ^ { T } \operatorname { c o v } ( n ^ { t _ { 1 } } , n ^ { t _ { 2 } } ) } } \\ & { } & { = \underbrace { \sum _ { t = 1 } ^ { T } \operatorname { c o v } ( n ^ { t } , n ^ { t } ) } _ { T \sigma ^ { 2 } } + 2 \underbrace { \sum _ { t = 1 } ^ { T - 1 } \operatorname { c o v } ( n ^ { t } , n ^ { t + 1 } ) } _ { \alpha ( T - 1 ) \sigma ^ { 2 } } + 2 \underbrace { \sum _ { t = 1 } ^ { T - 2 } \operatorname { c o v } ( n ^ { t } , n ^ { t + 2 } ) } _ { \alpha ^ { 2 } ( T - 2 ) \sigma ^ { 2 } } + \dots + 2 \underbrace { \operatorname { c o v } ( n ^ { 1 } , n ^ { T } ) } _ { \alpha ^ { T - 1 } ( 1 ) \sigma ^ { 2 } } } \end{array}
|
| 330 |
+
$$
|
| 331 |
+
|
| 332 |
+
For negatively correlated noise $\alpha \in ( - 1 , 0 )$ we can bound this term by
|
| 333 |
+
|
| 334 |
+
$$
|
| 335 |
+
\begin{array} { r l } & { \Psi \big ( \displaystyle \sum _ { t = 1 } ^ { T } n ^ { t } \big ) = \sigma ^ { 2 } ( T + 2 \displaystyle \sum _ { \tau = 1 } ^ { T - 1 } \alpha ^ { \tau } ( T - \tau ) ) } \\ & { \qquad = \sigma ^ { 2 } ( T + 2 \frac { \alpha ^ { T + 1 } - \alpha ^ { 2 } T + \alpha T - \alpha } { ( \alpha - 1 ) ^ { 2 } } ) } \\ & { \qquad = \sigma ^ { 2 } ( T + 2 \underbrace { \frac { ( \alpha - \alpha ^ { 2 } ) } { ( \alpha - 1 ) ^ { 2 } } } _ { \le \frac { 1 } { 2 } \alpha } T + 2 \underbrace { \frac { \alpha ^ { T + 1 } - \alpha } { ( \alpha - 1 ) ^ { 2 } } } _ { \le \frac { 1 } { 2 } } ) } \\ & { \qquad \le \sigma ^ { 2 } ( T ( 1 + \alpha ) + 1 ) } \end{array}
|
| 336 |
+
$$
|
| 337 |
+
|
| 338 |
+
# 6.5 PROOF OF THEOREM 3.1.
|
| 339 |
+
|
| 340 |
+
Proof. It holds that
|
| 341 |
+
|
| 342 |
+
$$
|
| 343 |
+
\mathrm { e r r } ( \mathcal { R } _ { T - 1 } + \Delta W _ { T } ) = \| \sum _ { t = 1 } ^ { T } \Delta W _ { t } - \sum _ { t = 1 } ^ { T - 1 } \Delta W _ { t } ^ { * } - \mathcal { R } _ { T - 1 } - \Delta W _ { T } \| = 0 .
|
| 344 |
+
$$
|
| 345 |
+
|
| 346 |
+
Since $s$ is a metric subspace, the projection
|
| 347 |
+
|
| 348 |
+
$$
|
| 349 |
+
\Delta W _ { T } ^ { * } = \mathrm { P r o j } _ { \cal S } ( { \mathcal { R } } _ { T - 1 } + \Delta W _ { T } )
|
| 350 |
+
$$
|
| 351 |
+
|
| 352 |
+
uniquely solves the minimization problem in $s$ .
|
| 353 |
+
|
| 354 |
+
# 6.6 ADDITIONAL RESULTS
|
| 355 |
+
|
| 356 |
+
Figure 6 shows validation error for WordLSTM trained on PTB at different levels of gradient sparsity and temporal sparsity. The total sparsity, defined as the product of temporal and gradient sparsity remains constant along the diagonals of the matrix. We observe that different forms of sparsity perform best during different stages of training. Phrased differently, this means that there is not one optimal sparsity setup, but rather sparsity needs to be adapted to the current training phase to achieve optimal compression.
|
| 357 |
+
|
| 358 |
+

|
| 359 |
+
Figure 6: Perplexity for different levels of gradient sparsity and temporal sparsity at different stages of training. WordLSTM trained on PTB.
|
md/train/B1ffQnRcKX/B1ffQnRcKX.md
ADDED
|
@@ -0,0 +1,555 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# AUTOMATICALLY COMPOSING REPRESENTATION TRANSFORMATIONS AS A MEANS FOR GENERALIZATION
|
| 2 |
+
|
| 3 |
+
Michael B. Chang Electrical Engineering and Computer Science University of California, Berkeley, USA mbchang@berkeley.edu
|
| 4 |
+
|
| 5 |
+
Abhishek Gupta Electrical Engineering and Computer Science University of California, Berkeley, USA abhigupta@berkeley.edu
|
| 6 |
+
|
| 7 |
+
# Sergey Levine
|
| 8 |
+
|
| 9 |
+
Electrical Engineering and Computer Science University of California, Berkeley svlevine@eecs.berkeley.edu
|
| 10 |
+
|
| 11 |
+
Thomas L. Griffiths Psychology and Cognitive Science Princeton University, USA tomg@princeton.edu
|
| 12 |
+
|
| 13 |
+
# ABSTRACT
|
| 14 |
+
|
| 15 |
+
A generally intelligent learner should generalize to more complex tasks than it has previously encountered, but the two common paradigms in machine learning – either training a separate learner per task or training a single learner for all tasks – both have difficulty with such generalization because they do not leverage the compositional structure of the task distribution. This paper introduces the compositional problem graph as a broadly applicable formalism to relate tasks of different complexity in terms of problems with shared subproblems. We propose the compositional generalization problem for measuring how readily old knowledge can be reused and hence built upon. As a first step for tackling compositional generalization, we introduce the compositional recursive learner, a domaingeneral framework for learning algorithmic procedures for composing representation transformations, producing a learner that reasons about what computation to execute by making analogies to previously seen problems. We show on a symbolic and a high-dimensional domain that our compositional approach can generalize to more complex problems than the learner has previously encountered, whereas baselines that are not explicitly compositional do not.
|
| 16 |
+
|
| 17 |
+
# 1 INTRODUCTION
|
| 18 |
+
|
| 19 |
+
This paper seeks to tackle the question of how to build machines that leverage prior experience to solve more complex problems than they have previously encountered. How does a learner represent prior experience? How does a learner apply what it has learned to solve new problems? Motivated by these questions, this paper aims to formalize the idea of, as well as to develop an understanding of the machinery for, compositional generalization in problems that exhibit compositional structure. The solutions for such problems can be found by composing in sequence a small set of reusable partial solutions, each of which tackles a subproblem of a larger problem. The central contributions of this paper are to frame the shared structure across multiple tasks in terms of a compositional problem graph, propose compositional generalization as an evaluation scheme to test the degree a learner can apply previously learned knowledge to solve new problems, and introduce the compositional recursive learner, a domain-general framework1 for sequentially composing representation transformations that each solve a subproblem of a larger problem.
|
| 20 |
+
|
| 21 |
+
The key to our approach is recasting the problem of generalization as a problem of learning algorithmic procedures over representation transformations. A solution to a (sub)problem is a transformation between its input and output representations, and a solution to a larger problem composes these subsolutions together. Therefore, representing and leveraging prior problem-solving experience amounts to learning a set of reusable primitive transformations and their means of composition that reflect the structural properties of the problem distribution.
|
| 22 |
+
|
| 23 |
+
This paper introduces the compositional recursive learner (CRL), a framework for learning both these transformations and their composition together with sparse supervision, taking a step beyond other approaches that have assumed either pre-specified transformation or composition rules (Sec. 5). CRL learns a modular recursive program that iteratively re-represents the input representation into more familiar representations it knows how to compute with. In this framework, a transformation between representations is encapsulated into a computational module, and the overall program is the sequential combination of the inputs and outputs of these modules, whose application are decided by a controller.
|
| 24 |
+
|
| 25 |
+
What sort of training scheme would encourage the spontaneous specialization of the modules around the compositional structure of the problem distribution? First, exposing the learner to a diverse distribution of compositional problems helps it pattern-match across problems to distill out common functionality that it can capture in its modules for future use. Second, enforcing that each module have only a local view of the global problem encourages task-agnostic functionality that prevents the learner from overfitting to the empirical training distribution; two ways to do this are to constrain the model class of the modules and to hide the task specification from the modules. Third, training the learner with a curriculum encourages the learner to build off old solutions to solve new problems by re-representing the new problem into one it knows how to solve, rather than learning from scratch.
|
| 26 |
+
|
| 27 |
+
How should the learner learn to use these modules to exploit the compositional structure of the problem distribution? We can frame the decision of which computation to execute as a reinforcement learning problem in the following manner. The application of a sequence of modules can be likened to the execution trace of the program that CRL automatically constructs, where a computation is the application of a module to the output of a previous computation. The automatic construction of the program can be formulated as the solution to a sequential decision-making problem in a meta-level Markov decision process (MDP) (Hay et al., 2014), where the state space is the learner’s internal states of computation and the action space is the set of modules. Framing the construction of a program as a reinforcement learning problem allows us to use techniques in deep reinforcement learning to implement loops and recursion, as well as decide on which part of the current state of computation to apply a module, to re-use sub-solutions to solve a larger problem.
|
| 28 |
+
|
| 29 |
+
Our experiments on solving multilingual arithmetic problems and recognizing spatially transformed MNIST digits (LeCun et al., 1998) show that the above proposed training scheme prescribes a type of reformulation: re-representing a new problem in terms of other problems by implicitly making an analogy between their solutions. We also show that our meta-reasoning approach for deciding what modules to execute achieves better generalization to more complex problems than monolithic learners that are not explicitly compositional.
|
| 30 |
+
|
| 31 |
+
# 2 COMPOSITIONAL GENERALIZATION
|
| 32 |
+
|
| 33 |
+
Solving a problem simply means representing it so as to make the solution transparent.
|
| 34 |
+
|
| 35 |
+
(SIMON, 1988)
|
| 36 |
+
|
| 37 |
+
Humans navigate foreign cities and understand novel conversations despite only observing a tiny fraction of the true distribution of the world. Perhaps they can extrapolate in this way because the world contains compositional structure, such that solving a novel problem is possible by composing previously learned partial solutions in a novel way to fit the context.
|
| 38 |
+
|
| 39 |
+
With this perspective, we propose the concept of compositional generalization. The key assumption of compositional generalization is that harder problems are composed of easier problems. The problems from the training and test sets share the same primitive subproblems, but differ in the manner and complexity with which these subproblems are combined. Therefore, problems in the test set can be solved by combining solutions learned from the training set in novel ways.
|
| 40 |
+
|
| 41 |
+
Definition. Let a problem $P$ be a pair $( X _ { i n } , X _ { o u t } )$ , where $X _ { i n }$ and $X _ { o u t }$ are random variables that respectively correspond to the input and output representations of the problem. Let the distribution of $X _ { i n }$ be $r _ { i n }$ and the distribution of $X _ { o u t }$ be $r _ { o u t }$ . To solve a particular problem $P = p$ is to transform $X _ { i n } = x _ { i n }$ into $X _ { o u t } = x _ { o u t }$ . A composite problem $p _ { a } = p _ { b } \circ p _ { c }$ is that for which it is possible to solve by first solving $p _ { c }$ and then solving $p _ { b }$ with the output of $p _ { c }$ as input. $p _ { b }$ and $p _ { c }$ are subproblems with respect to $p _ { a }$ . The space of compositional problems form a compositional problem graph, whose nodes are the representation distributions $r$ . A problem is described as pair of nodes between which the learner must learn to construct an edge or a path to transform between the two representations.
|
| 42 |
+
|
| 43 |
+

|
| 44 |
+
Figure 1: (a) Consider a multitask family of problems, whose subproblems are shared within and across problems. Standard approaches either (b) train a separate learner per task or (c) train a single learner for all tasks. Both have difficulty generalizing to longer compositional problems. (d) Our goal is to re-use previously learned sub-solutions to solve new problems by composing computational modules in new ways.
|
| 45 |
+
|
| 46 |
+
Characteristics. First, there are many ways in which a problem can be solved. For example, translating an English expression to a Spanish one can be solved directly by learning such a transformation, or a learner could make an analogy with other problems by first translating English to French, and then French to Spanish as intermediate subproblems. Second, sometimes a useful (although not only) way to solve a problem is indicated by the recursive structure of the problem itself: solving the arithmetic expression $3 + 4 \times 7$ modulo 10 can be decomposed by first solving the subproblem $4 \times 7 = 8$ and then $3 + 8 = 1$ . Third, because a problem is just an (input, output) pair, standard problems in machine learning fit into this broadly applicable framework. For example, for a supervised classification problem, the input representation can be an image and the output representation a label, and intermediate subproblems can be transforming some intermediate representations to other intermediate representations. Sec. 4 demonstrates CRL on all three of the above examples.
|
| 47 |
+
|
| 48 |
+
Broad Applicability. Problems in supervised, unsupervised, and reinforcement learning can all be viewed under the framework of transformations between representations. What we gain from the compositional problem graph perspective is a methodological way to relate together different problems of various forms and complexity, which is especially useful in a lifelong learning setting: the knowledge required to solve one problem is composed of the knowledge required to solve subproblems seen in the past in the context of different problems. For example, we can view latent variable reinforcement learning architectures such as (Ha & Schmidhuber, 2018; Nair et al., 2018) as simultaneously solving an image reconstruction problem and an action prediction problem, both of which share the same subproblem of transforming a visual observation into a latent representation. Lifelong learning, then, can be formulated as not only modifying the connections between nodes in the compositional problem graph but also continuing to make more connections between nodes, gradually expanding the frontier of nodes explored. Sec. 4 describes how CRL takes advantage of this compositional formulation in a multi-task zero-shot generalization setup to solve new problems by re-using computations learned from solving past problems.
|
| 49 |
+
|
| 50 |
+

|
| 51 |
+
Figure 2: Compositional recursive learner (CRL): top-left: CRL is a symbiotic relationship between a controller and evaluator: the controller selects a module $m$ given an intermediate representation $x$ and the evaluator applies $m$ on $x$ to create a new representation. bottom-left: CRL learns dynamically learns the structure of a program customized for its problem, and this program can be viewed as a finite state machine. right: A series of computations in the program is equivalent to a traversal through a Meta-MDP, where module can be reused across different stages of computation, allowing for recursive computation.
|
| 52 |
+
|
| 53 |
+
Evaluation. To evaluate a learner’s capacity for compositional generalization, we introduce two challenges. The first is to generalize to problems with different subproblem combinations from what the learner has seen. The second is to generalize to problems with longer subproblems combinations than the learner has seen. Evaluating a learner’s capability for compositional generalization is one way to measure how readily old knowledge can be reused and hence built upon.
|
| 54 |
+
|
| 55 |
+
# 3 A LEARNER THAT PROGRAMS ITSELF
|
| 56 |
+
|
| 57 |
+
This paper departs from the popular representation-centric view of knowledge (Bengio et al., 2013) and instead adopts a computation-centric view of knowledge: our goal is to encapsulate useful functionality shared across tasks into specialized computational modules – atomic function operators that perform transformations between representations. This section introduces the compositional recursive learner (CRL), a framework for training modules to capture primitive subproblems and for composing together these modules as subproblem solutions to form a path between nodes of the compositional problem graph.
|
| 58 |
+
|
| 59 |
+
# 3.1 COMPOSITIONAL RECURSIVE LEARNER
|
| 60 |
+
|
| 61 |
+
The CRL framework consists of a controller $\pi$ , a set of modules $m \in M$ , and an evaluator $E$ . Training CRL on a diverse compositional problem distribution produces a modular recursive program that is trained to transform the input $X _ { i n }$ into its output $X _ { o u t }$ , the corresponding samples of which are drawn from pairs of nodes in the compositional problem graph. In this program, the controller looks at the current state $x _ { i }$ of the program and chooses a module $m$ to apply to the state. The evaluator executes the module on that state to produce the next state $x _ { i + 1 }$ of the program. $X _ { i n }$ is the initial state of the program, $\hat { X } _ { o u t }$ is the last, and the intermediate states $X _ { i }$ of the execution trace correspond to the other representations produced and consumed by the modules. The controller can choose to re-use modules across different program executions to solve different problems, making it straightforward to re-use computation learned from solving other problems to solve the current one. The controller can also choose to reuse modules several times within the same program execution, which produces recursive behavior.
|
| 62 |
+
|
| 63 |
+
# 3.2 DECIDING WHICH COMPUTATIONS TO EXECUTE
|
| 64 |
+
|
| 65 |
+
The sequential decision problem that the controller solves can be formalized as a meta-level Markov decision process (meta-MDP) (Hay et al., 2014), whose state space corresponds to the intermediate states of computation $X$ , whose action space corresponds to the modules $M$ , and whose transition model corresponds to the evaluator $E$ . The symbiotic relationship among these components is shown in Fig. 2. In the bounded-horizon version of CRL (Sec. 4.2), the meta-MDP has a finite horizon whose length is determined by the complexity of the current problem. In the infinite-horizon version of CRL (Sec. 4.1), the program itself determines when to halt when the controller selects the HALT signal. When the program halts, in both versions the current state of computation is produced as output $\hat { x } _ { o u t }$ , and CRL receives a terminal reward that reflects how $\hat { x } _ { o u t }$ matches the desired output $x _ { o u t }$ . The infinite-horizon CRL also incurs a cost for every computation it executes to encourage it to customize its complexity to the problem.
|
| 66 |
+
|
| 67 |
+
Note the following key characteristics of CRL. First, unlike standard reinforcement learning setups, the state space and action space can vary in dimensionality across and within episodes because CRL trains on problems of different complexity, reducing more complex problems to simpler ones (Sec. 4.1). Second, because the meta-MDP is internal to CRL, the controller shapes the meta-MDP by choosing which modules get trained and the meta-MDP in turn shapes the controller through its non-stationary state-distribution, action-distribution, and transition function. Thus CRL simultaneously designs and solves reinforcement learning problems “in its own mind,” whose dynamics depend just as much on the intrinsic complexity of the problem as well as the current problem-solving capabilities of CRL.
|
| 68 |
+
|
| 69 |
+
# 3.3 MAKING ANALOGIES IN THE COMPOSITIONAL PROBLEM GRAPH
|
| 70 |
+
|
| 71 |
+
The solution that we want CRL to discover lies between two extremes, both of which have their own drawbacks. One extreme is where CRL learns a module specialized for every pair of nodes in the compositional problem graph, and the other is where CRL only learns one module for all pairs of nodes. Both extremes yield a horizon-one meta-MDP and are undesirable for compositional generalization: the former does not re-use past knowledge and the latter cannot flexibly continuously learn without suffering from negative transfer.
|
| 72 |
+
|
| 73 |
+
What is the best solution that CRL could discover? For a given compositional problem graph, an optimal solution would be to recover the original compositional problem graph such that the modules exactly capture the subproblems and the controller composes these modules to reflect how the subproblems were originally generated. By learning both the parameters of the modules and the controller that composes them, during CRL would construct its own internal representation of the problem graph, where the functionality of the modules produces the nodes of the graph. How can we encourage CRL’s internal graph to reflect the original compositional problem graph?
|
| 74 |
+
|
| 75 |
+
We want to encourage the modules to capture the most primitive subproblems, such that they can be composed as atomic computations for other problems. To do this, we need to enforce that each module only has a local view of the global problem. If tasks are distinguished from each other based on the input (see Sec. 4.2), we can use domain knowledge to restrict the representation vocabulary and the function class of the modules. If we have access to a task specification (e.g. goal or task id) in addition to the input, we can additionally give only the controller access to the task specification while hiding it from the modules. This forces the modules to be task agnostic, which encourages that they learn useful functionality that generalizes across problems.
|
| 76 |
+
|
| 77 |
+
Because the the space of subproblem compositions is combinatorially large, we use a curriculum to encourage solutions for the simpler subproblems to converge somewhat before introducing more complex problems, for which CRL can learn to solve by composing together the modules that had been trained on simpler problems. Lastly, to encourage the controller to generalize to new node combinations it has not seen, we train on a diverse distribution of compositional problems, such that the controller does not overfit to any one problem. This encourages controller to make analogies between problems during training by re-using partial solutions learned while solving other problems. Our experiments show that this analogy-making ability helps with compositional generalization because the controller solves new or more complex subproblem combinations by re-using modules that it learned during training.
|
| 78 |
+
|
| 79 |
+

|
| 80 |
+
Figure 3: Multilingual Arithmetic (Quantitative). CRL generalizes significantly better than the RNN, which, even with ten times more data, does not generalize to 10-length multilingual arithmetic expressions. Pretraining the RNN on domain-specific auxiliary tasks does not help the 10-length case, highlighting a limitation of using monolithic learners for compositional problems. By comparing CRL with a version trained without a curriculum (“No Curr”: blue), we see the benefit of slowly growing the complexity of problems throughout training, although this benefit does not transfer to the RNN. The vertical black dashed line indicates at which point all the training data has been added when CRL is trained with a curriculum (red). The initial consistent rise of the red training curve before this point shows CRL exhibits forward transfer (Lopez-Paz et al., 2017) to expressions of longer length. Generalization becomes apparent only after a million iterations after all the training data has been added. (b, c) only show accuracy on the expressions with the maximum length of those added so far to the curriculum. “1e4” and “1e5” correspond to the order of magnitude of the number of samples in the dataset, of which $70 \%$ are used for training. 10, 50, and 90 percentiles are shown over 6 runs.
|
| 81 |
+
|
| 82 |
+
# 4 EXPERIMENTS
|
| 83 |
+
|
| 84 |
+
The main purpose of our experiments is to test the hypothesis that explicitly decomposing a learner around the structure of a compositional problem distribution yields significant generalization benefit over the standard paradigm of training a single monolithic architecture on the same distribution of problems. To evaluate compositional generalization, we select disjoint subsets of node pairs for training and evaluating the learner. Evaluating on problems distinct from those in training tests the learner’s ability to apply what it has learned to new problems. To demonstrate the broad applicability of the compositional graph, we consider the structured symbolic domain of multilingual arithmetic and the underconstrained and high-dimensional domain of transformed-MNIST classification. We find that composing representation transformations with CRL achieves significantly better generalization when compared to generic monolithic learners, especially when the learner needs to generalize to problems with longer subproblem combinations than those seen during training.
|
| 85 |
+
|
| 86 |
+
In our experiments, the controller and modules begin as randomly initialized neural networks. The loss is backpropagated through the modules, which are trained with Adam (Kingma & Ba, 2014). The controller receives a sparse reward derived from the loss at the end of the computation, and a small cost for each computational step. The model is trained with proximal policy optimization (Schulman et al., 2017).
|
| 87 |
+
|
| 88 |
+
# 4.1 MULTILINGUAL ARITHMETIC
|
| 89 |
+
|
| 90 |
+
This experiment evaluates the infinite-horizon CRL in a multi-objective, variable-length input, symbolic reasoning multi-task setting. A task is to simplify an arithmetic expression expressed in a source language, encoded as variable-length sequences of one-hot tokens, and produce the answer modulo 10 in a given target language. To evaluate compositional generalization, we test whether, after having trained on 46200 examples of 2, 3, 4, 5-length expressions $( 2 . 7 6 \cdot 1 0 ^ { - 4 }$ of the training distribution) involving 20 of the $5 \times 5 = 2 5$ pairs of five languages, the learner can generalize to 5-length and 10-length expressions involving the other five held-out language pairs (problem space: $4 . 9 2 \cdot 1 0 ^ { 1 5 }$ problems). To handle the multiple target languages, the CRL controller receives a onehot token for the target language at every computational step additional to the arithmetic expression. The CRL modules consist of two types of feedforward networks: reducers and translators, which do not know the target language and so can only make local progress on the global problem. Reducers transform a consecutive window of three tokens into one token, and translators transform all tokens in a sequence by the same transformation. The CRL controller also selects where in the arithmetic expression to apply a reducer. We trained by gradually increasing the complexity of arithmetic expressions from length two to length five.
|
| 91 |
+
|
| 92 |
+

|
| 93 |
+
Figure 4: Left: For multilingual arithmetic, blue denotes the language pairs for training and red denotes the language pairs held out for evaluation in Fig 3b,c. Center: For transformed MNIST classification, blue denotes the length-2 transformation combinations that produced the input for training, red denotes the length-2 transformation combinations held out for evaluation. Not shown are the more complex length-3 transformation combinations (scale then rotate then translate) we also tested on. Right: For transformed MNIST classification, each learner performs better than the others in a different metric: the CNN performs best on the training subproblem combinations, the STN on different subproblem combinations of the same length as training, and CRL on longer subproblem combinations than training. While CRL performs comparably with the others in the former two metrics, CRL’s $\sim 4 0 \%$ improvement for more complex image transformations is significant.
|
| 94 |
+
|
| 95 |
+
Quantitive results in Fig. 3 show that CRL achieves significantly better compositional generalization than a recurrent neural network (RNN) baseline (Cho et al., 2014) trained to directly map the expression to its answer, even when the RNN has been pretrained or receives $1 0 \mathrm { x }$ more data. Fig. 9 shows that CRL achieves about $6 0 \%$ accuracy for extrapolating to 100-term problems (problem space: $4 . 2 9 \cdot 1 0 ^ { 1 4 8 }$ ).
|
| 96 |
+
|
| 97 |
+
The curriculum-based training scheme encourages CRL to designs its own edges and paths to connect nodes in the compositional problem graph, solving harder problems with the solutions from simpler ones. It also encourages its internal representations to mirror the external representations it observes in the problem distribution, even though it has no direct supervision to do so. However, while this is often the case, qualitative results in Fig. 5 show that CRL also comes up with its own internal language – hybrid representations that mix different external representations together – to construct compositional solutions for novel problems. Rather than learn translators and reducers that are specific to single input and output language pair as we had expected, the modules, possibly due to their nonlinear nature, tended to learn operations specific to the output language only.
|
| 98 |
+
|
| 99 |
+
# 4.2 IMAGE TRANSFORMATIONS
|
| 100 |
+
|
| 101 |
+
This experiment evaluates the bounded-horizon CRL in a single-objective, latent-structured, highdimensional multi-task setting. A task is to classify an MNIST digit, where the MNIST digit has been randomly translated (left, right, up, down), rotated (left, right), and scaled (small, big). Suppose CRL has knowledge of what untransformed MNIST digits look like; is it possible that CRL can learn to compose appropriate spatial affine transformations in sequence to convert the transformed MNIST digit into a “canonical” one, such that it can use a pre-trained classifier to classify it? To reformulate a scenario to one that is more familar is characteristic of compositional generalization humans: humans view an object at different angles yet understand it is the same object; they may have an accustomed route to work, but can adapt to a detour if the route is blocked. To evaluate compositional generalization, we test whether, having trained on images produced by combinations of two spatial transformations, CRL can can generalize to different length-2 combinations as well as length-3 combinations. A challenge in this domain is that the compositional structure is latent, rather than apparent in the input for the learner to exploit.
|
| 102 |
+
|
| 103 |
+
CRL is initialized with four types of modules: a Spatial Transformer Network (STN) (Jaderberg et al., 2015) parametrized to only rotate, an STN that only scales, an STN that only translates, and an identity function. All modules are initialized to perform the identity transformation, such that symmetry breaking (and their eventual specialization) is due to the stochasticity of the controller.
|
| 104 |
+
|
| 105 |
+

|
| 106 |
+
Figure 5: Multilingual Arithmetic (Qualitative). A randomly selected execution trace for generalizing from length-5 to length-10 expressions. The input is $0 - 6 + 1 + 7 \times 3 \times 6 - 3 + 7 - 7 \times 7$ expressed in Pig Latin. The desired output is seis, which is the value of the expression, 6, expressed in Spanish. The purple modules are reducers and the red modules are translators. The input to a module is highlighted and the output of the module is boxed. The controller learns order of operations. Observe that reducer $m _ { 9 }$ learns to reduce to numerals and reducer $m _ { 1 0 }$ to English terms. The task-agnostic nature of the modules forces them to learn transformations that the controller would commonly reuse across problems. Even if the problem may not be compositionally structured, such as translating Pig Latin to Spanish, CRL learns to design a compositional solution $\mathrm { P i g }$ Latin to Numerals to Spanish) from previous experience (Pig Latin to Numerals and Numerals to Spanish) in order to generalize: it first reduces the Pig Latin expression to a numerical evaluation, and then translates that to its Spanish representation using the translator $m _ { 6 }$ . Note that all of this computation is happening internally to the learner, which computes on softmax distributions over the vocabulary; for visualization we show the token of the distribution with maximum probability.
|
| 107 |
+
|
| 108 |
+

|
| 109 |
+
Figure 6: Image Transformations: CRL reasonably applies a sequence of modules to transform a transformed MNIST digit into canonical position, and generalizes to different and longer compositions of generative transformations. $m _ { 0 }$ is constrained to output the sine and cosine of a rotation angle, $m _ { 1 }$ is constrained to output the scaling factor, and $m _ { 2 }$ through $m _ { 1 3 }$ are constrained to output spatial translations. Some modules like $m _ { 2 }$ and $m _ { 6 }$ learn to translate up, some like $m _ { 3 }$ and $m _ { 1 0 }$ learn to translate down, some like $m _ { 7 }$ learn to shift right, and some like $m _ { 1 3 }$ learn to shift left. Consider (d): the original generative transformations were “scale big” then “translate left,” so the correct inversion should be “translate right” then “scale small.” However, CRL chose to equivalently “scale small” and then “translate right.” CRL also creatively uses $m _ { 0 }$ to scale, as in (e) and (f), even though its original parametrization of outputting sine and cosine is biased towards rotation.
|
| 110 |
+
|
| 111 |
+
Quantitative results in Fig. 4 show that CRL achieves significantly better compositional generalization than both the standard practice of finetuning the convolutional neural network (Springenberg et al., 2014) pretrained classifier and training an affine-STN as a pre-processor to the classifier. Both baselines perform better than CRL on the training set, and the STN’s inductive bias surprisingly also allows it to generalize to different length-2 combinations. However, both baselines achieve only less than one-third of CRL’s generalization performance for length-3 combinations, which showcases the value of explicitly decomposing problems. Note that in Fig. 6 the sequence of transformations CRL performs are not necessarily the reverse of those that generated the original input, which shows that CRL has learned its own internal language for representing nodes in the problem graph.
|
| 112 |
+
|
| 113 |
+
# 5 RELATED WORK
|
| 114 |
+
|
| 115 |
+
Several recent and contemporaneous work (Lake & Baroni, 2017; Liska et al., 2018; Loula et al., ˇ 2018; Bahdanau et al., 2018) have tested in whether neural networks exhibit systematic compositionality (Fodor & Pylyshyn, 1988; Marcus, 1998; Fodor & Lepore, 2002; Marcus, 2018; Calvo & Symons, 2014) in parsing symbolic data. This paper draws inspiration from and builds upon research in several areas to propose an approach towards building a learner that exhibits compositional generalization. We hope this paper provides a point of unification among these areas through which further connections can be strengthened.
|
| 116 |
+
|
| 117 |
+
# 5.1 COMPOSITIONAL GENERALIZATION
|
| 118 |
+
|
| 119 |
+
Transformations between representations: Our work introduces a learner that exhibits compositional generalization in some sense by bridging deep learning and reformulation, or re-representing a problem to make it easier to solve (Holte & Choueiry, 2003; Simon, 1969; Anderson, 1990) by making analogies (Oh et al., 2017) to previously encountered problems. Taking inspiration from meta-reasoning (Russell & Wefald, 1991; Hay et al., 2014; Hamrick et al., 2017; Graves, 2016) in humans (Griffiths et al., 2015; Callaway et al., 2017; Lieder et al., 2017), CRL generalize to new problems by composing representation transformations (analogous to the subprograms in Schmidhuber (1990)), an approach for which recent and contemporaneous work (Schlag & Schmidhuber, 2018; Alet et al., 2018; Devin et al., 2017) provide evidence.
|
| 120 |
+
|
| 121 |
+
Meta-learning: Our modular perspective departs from recent work in meta-learning (Thrun & Pratt, 2012; Schmidhuber, 1987) which assume that the shared representation of monolithic architectures can be shaped by the diversity of tasks in the training distribution as good initializations for future learning (Finn et al., 2017; Nichol et al., 2018; Ravi & Larochelle, 2016; Andrychowicz et al., 2016; Grant et al., 2018; Mishra et al., 2018; Lake et al., 2015; Frans et al., 2017; Gupta et al., 2018b;a; Srinivas et al., 2018).
|
| 122 |
+
|
| 123 |
+
Graph-based architectures: Work in graph-based architectures have studied combinatorial generalization in the context of modeling physical systems (Battaglia et al., 2018; Chang et al., 2016; Battaglia et al., 2016; Santoro et al., 2017; Sanchez-Gonzalez et al., 2018; van Steenkiste et al., 2018). Whereas these works focus on factorizing representations, we focus on factorizing the computations that operate on representations.
|
| 124 |
+
|
| 125 |
+
# 5.2 NEURAL PROGRAM INDUCTION:
|
| 126 |
+
|
| 127 |
+
Just as the motivation behind disentangled representations (Whitney et al., 2016; Kulkarni et al., 2015; Chen et al., 2016; Thomas et al., 2017; Bengio et al., 2013; Higgins et al., 2018) is to uncover the latent factors of variation, the motivation behind disentangled programs is to uncover the latent organization of a task. Compositional approaches (as opposed to memory-augmented (Graves et al., 2014; Sukhbaatar et al., 2015; Joulin & Mikolov, 2015; Grefenstette et al., 2015; Kurach et al., 2015; Andrychowicz et al., 2016; Graves et al., 2016) or monolithic (Zaremba & Sutskever, 2014; Kaiser & Sutskever, 2015) approaches for learning programs) to the challenge of discovering reusable primitive transformations and their means of composition generally fall into two categories. The first assumes pre-specified transformations and learns the structure (from dense supervision on execution traces to sparse-rewards) (Reed & De Freitas, 2015; Cai et al., 2017; Xu et al., 2017; Chen et al., 2017; Ganin et al., 2018; Bunel et al., 2018; Feser et al., 2016; Dzeroski et al., 2001; ˇ Zaremba et al., 2016; Schmidhuber, 1990). The second learns the transformations but pre-specifies the structure (Andreas et al., 2016; Riedel et al., 2016; Lin & Lucey, 2017). These approaches are respectively analogous to our hardcoded-functions and hardcoded-controller ablations in Fig. 7. The closest works to ours from a program induction perspective are (Gaunt et al., 2016; Valkov et al., 2018), both neurosymbolic approaches for learning differentiable programs integrated in a high-level programming language. Our work complements theirs by casting the construction of a program as a reinforcement learning problem, and we believe that more tightly integrating CRL with types and combinators would be an exciting direction for future work.
|
| 128 |
+
|
| 129 |
+
# 5.3 SELF-ORGANIZING LEARNERS
|
| 130 |
+
|
| 131 |
+
Lifelong Learning: CRL draws inspiration from work (Schmidhuber, 1987; Dechter et al., 2013; Schmidhuber, 2009; 2012; Ellis et al., 2018) on learners that learn to design their own primitives and subprograms for solving an increasingly large number of tasks. The simultaneous optimization over the the continuous function parameters and their discrete compositional structure in CRL is inspired by the interplay between abstract and concrete knowledge that is hypothesized to characterize cognitive development: abstract structural priors serve as a scaffolding within which concrete, domain-specific learning takes place (Spelke, 1990; Pinker, 1994), but domain-specific learning about the continuous semantics of the world can also provide feedback to update the more discrete structural priors (Gopnik & Wellman, 2012; Carey, 2015).
|
| 132 |
+
|
| 133 |
+
Hierarchy: Several works have investigated the conditions in which hierarchy is useful for humans (Botvinick et al., 2009; Solway et al., 2014; Sanborn et al., 2018); our experiments show that the hierarchical structure of CRL is more useful than the flat structure of monolothic architectures for compositional generalization. Learning both the controller and modules relates CRL to the hierarchical reinforcement learning literature (Barto & Mahadevan, 2003), where recent work (Bacon et al., 2017; Kulkarni et al., 2016; Frans et al., 2017; Vezhnevets et al., 2017; Nachum et al., 2018) attempting to learn both lower-level policies as well as a higher-level policy that invokes them.
|
| 134 |
+
|
| 135 |
+
Modularity: Our idea of selecting different weights at different steps of computation is related to the fast-weights literature (Schmidhuber, 1992; Ba et al., 2016), but those works are motivated by learning context-dependent associative memory (Hopfield, 1982; Willshaw et al., 1969; Kohonen, 1972; Anderson & Hinton, 2014; Ha et al., 2016) rather than composing representation transformations, with the exception of (Schlag & Schmidhuber, 2017). CRL can be viewed as a recurrent mixture of experts (Jacobs et al., 1991), where each expert is a module, similar to other recent and contemporaneous work (Hinton et al., 2018; Rosenbaum et al., 2018; Kirsch et al., 2018; Fernando et al., 2017) that route through a choices of layers of a fixed-depth architecture for multi-task learning. The closest work to ours from an implementation perspective is Rosenbaum et al. (2018). However, these works do not address the problem of generalizing to more complex tasks because they do not allow for variable-length compositions of the modules. Parascandolo et al. (2017) focuses on a complementary direction to ours; whereas they focus on learning causal mechanisms for a single step, we focus on learning how to compose modules. We believe composing together causal mechanisms would be an exciting direction for future work.
|
| 136 |
+
|
| 137 |
+
# 6 DISCUSSION
|
| 138 |
+
|
| 139 |
+
This paper sought to tackle the question of how to build machines that leverage prior experience to solve more complex problems than they have seen. This paper makes three steps towards the solution. First, we formalized the compositional problem graph as a language for studying compositionally-structured problems of different complexity that can be applied on various problems in machine learning. Second, we introduced the compositional generalization evaluation scheme for measuring how readily old knowledge can be reused and hence built upon. Third, we presented the compositional recursive learner, a domain-general framework for learning a set of reusable primitive transformations and their means of composition that reflect the structural properties of the problem distribution. In doing so we leveraged tools from reinforcement learning to solve a program induction problem.
|
| 140 |
+
|
| 141 |
+
There are several directions for improvement. One is to stabilize the simultaneous optimization between discrete composition and continuous parameters; currently this is tricky to tune. Others are to generate computation graphs beyond a linear chain of functions, and to infer the number of functions required for a family of problems. A major challenge would be to discover the subproblem decomposition without a curriculum and without domain-specific constraints on the model class of the modules.
|
| 142 |
+
|
| 143 |
+
Griffiths et al. (2019) argued that the efficient use cognitive resources in humans may also explain their ability to generalize, and this paper provides evidence that reasoning about what computation to execute by making analogies to previously seen problems achieves significantly higher compositional generalization than non-compositional monolithic learners. Encapsulating computational modules grounded in the subproblem structure also may pave a way for improving interpretability of neural networks by allowing the modules to be unit-tested against the subproblems we desire them to capture. Because problems in supervised, unsupervised, and reinforcement learning can all be expressed under the framework of transformations between representations in the compositional problem graph, we hope that our work motivates further research for tackling the compositional generalization problem in many other domains to accelerate the long-range generalization capabilities that are characteristic of general-purpose learning machines.
|
| 144 |
+
|
| 145 |
+
# ACKNOWLEDGMENTS
|
| 146 |
+
|
| 147 |
+
The authors would like to thank the anonymous ICLR reviewers and commenters, Alyosha Efros, Dinesh Jayaraman, Pulkit Agrawal, Jason Peng, Erin Grant, Rachit Dubey, Thanard Kurutach, Parsa Mahmoudieh, Aravind Srinivas, Fred Callaway, Justin Fu, Ashvin Nair, Marvin Zhang, Shubham Tulsiani, Peter Battaglia, Jessica Hamrick, Rishabh Singh, Feras Saad, Michael Janner, Samuel Tenka, Kai-I Shan, David Chang, Mei-ling Hsu, Tony Chang and others in the Berkeley Artificial Intelligence Research Lab for helpful feedback, discussions, and support. The authors are grateful for computing support from Amazon, NVIDIA, and Google. This work was supported in part by the Berkeley EECS Department Fellowship for first-year Ph.D. students, travel funding from Bloomsbury AI, contract number FA8650-18-2-7832 from the Defence Advanced Research Projects Agency (DARPA) under the Lifelong Learning Machines program, contract number FA9550-18-1- 0077 from the Air Force Office of Scientific Research (AFOSR), and the National Science Foundation (NSF) Graduate Research Fellowship Program. Any opinions, findings, and conclusions or recommendations expressed in this material are those of the authors and do not necessarily reflect the views of DARPA, AFOSR, or the NSF.
|
| 148 |
+
|
| 149 |
+
# REFERENCES
|
| 150 |
+
|
| 151 |
+
Ferran Alet, Tomas Lozano-P ´ erez, and Leslie P Kaelbling. Modular meta-learning. ´ arXiv preprint arXiv:1806.10166, 2018.
|
| 152 |
+
|
| 153 |
+
James A Anderson and Geoffrey E Hinton. Models of information processing in the brain. In Parallel models of associative memory, pp. 33–74. Psychology Press, 2014.
|
| 154 |
+
|
| 155 |
+
John Robert Anderson. The adaptive character of thought. chapter 5, pp. 191–230. Psychology Press, 1990.
|
| 156 |
+
|
| 157 |
+
Jacob Andreas, Marcus Rohrbach, Trevor Darrell, and Dan Klein. Neural module networks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 39–48, 2016.
|
| 158 |
+
|
| 159 |
+
Marcin Andrychowicz, Misha Denil, Sergio Gomez, Matthew W Hoffman, David Pfau, Tom Schaul, Brendan Shillingford, and Nando De Freitas. Learning to learn by gradient descent by gradient descent. In Advances in Neural Information Processing Systems, pp. 3981–3989, 2016.
|
| 160 |
+
|
| 161 |
+
Jimmy Ba, Geoffrey E Hinton, Volodymyr Mnih, Joel Z Leibo, and Catalin Ionescu. Using fast weights to attend to the recent past. In Advances in Neural Information Processing Systems, pp. 4331–4339, 2016.
|
| 162 |
+
|
| 163 |
+
Pierre-Luc Bacon, Jean Harb, and Doina Precup. The option-critic architecture. In AAAI, pp. 1726– 1734, 2017.
|
| 164 |
+
|
| 165 |
+
Dzmitry Bahdanau, Shikhar Murty, Michael Noukhovitch, Thien Huu Nguyen, Harm de Vries, and Aaron Courville. Systematic generalization: What is required and can it be learned? arXiv preprint arXiv:1811.12889, 2018.
|
| 166 |
+
|
| 167 |
+
Andrew G Barto and Sridhar Mahadevan. Recent advances in hierarchical reinforcement learning. Discrete event dynamic systems, 13(1-2):41–77, 2003.
|
| 168 |
+
|
| 169 |
+
Peter Battaglia, Razvan Pascanu, Matthew Lai, Danilo Jimenez Rezende, et al. Interaction networks for learning about objects, relations and physics. In Advances in Neural Information Processing Systems, pp. 4502–4510, 2016.
|
| 170 |
+
|
| 171 |
+
Peter W Battaglia, Jessica B Hamrick, Victor Bapst, Alvaro Sanchez-Gonzalez, Vinicius Zambaldi, Mateusz Malinowski, Andrea Tacchetti, David Raposo, Adam Santoro, Ryan Faulkner, et al. Relational inductive biases, deep learning, and graph networks. arXiv preprint arXiv:1806.01261, 2018.
|
| 172 |
+
|
| 173 |
+
Yoshua Bengio, Aaron Courville, and Pascal Vincent. Representation learning: A review and new perspectives. IEEE transactions on pattern analysis and machine intelligence, 35(8):1798–1828, 2013.
|
| 174 |
+
|
| 175 |
+
Matthew M Botvinick, Yael Niv, and Andrew C Barto. Hierarchically organized behavior and its neural foundations: a reinforcement learning perspective. Cognition, 113(3):262–280, 2009.
|
| 176 |
+
Rudy Bunel, Matthew Hausknecht, Jacob Devlin, Rishabh Singh, and Pushmeet Kohli. Leveraging grammar and reinforcement learning for neural program synthesis. arXiv preprint arXiv:1805.04276, 2018.
|
| 177 |
+
Jonathon Cai, Richard Shin, and Dawn Song. Making neural programming architectures generalize via recursion. arXiv preprint arXiv:1704.06611, 2017.
|
| 178 |
+
Frederick Callaway, Falk Lieder, Paul Krueger, and Thomas L Griffiths. Mouselab-mdp: A new paradigm for tracing how people plan. 2017.
|
| 179 |
+
Paco Calvo and John Symons. The Architecture of Cognition: Rethinking Fodor and Pylyshyn’s Systematicity Challenge. MIT Press, 2014.
|
| 180 |
+
Susan Carey. 15 why theories of concepts should not ignore the problem of acquisition. The conceptual mind: New directions in the study of concepts, pp. 415, 2015.
|
| 181 |
+
Michael B Chang, Tomer Ullman, Antonio Torralba, and Joshua B Tenenbaum. A compositional object-based approach to learning physical dynamics. arXiv preprint arXiv:1612.00341, 2016.
|
| 182 |
+
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.
|
| 183 |
+
Xinyun Chen, Chang Liu, and Dawn Song. Learning neural programs to parse programs. arXiv preprint arXiv:1706.01284, 2017.
|
| 184 |
+
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.
|
| 185 |
+
Junyoung Chung, Caglar Gulcehre, KyungHyun Cho, and Yoshua Bengio. Empirical evaluation of gated recurrent neural networks on sequence modeling. arXiv preprint arXiv:1412.3555, 2014.
|
| 186 |
+
Eyal Dechter, Jonathan Malmaud, Ryan P Adams, and Joshua B Tenenbaum. Bootstrap learning via modular concept discovery. In IJCAI, pp. 1302–1309, 2013.
|
| 187 |
+
Coline Devin, Abhishek Gupta, Trevor Darrell, Pieter Abbeel, and Sergey Levine. Learning modular neural network policies for multi-task and multi-robot transfer. In Robotics and Automation (ICRA), 2017 IEEE International Conference on, pp. 2169–2176. IEEE, 2017.
|
| 188 |
+
Saso D ˇ zeroski, Luc De Raedt, and Kurt Driessens. Relational reinforcement learning. ˇ Machine learning, 43(1-2):7–52, 2001.
|
| 189 |
+
Kevin Ellis, Lucas Morales, Mathias Sable-Meyer, Armando Solar-Lezama, and Josh Tenenbaum. ´ Learning libraries of subroutines for neurally–guided bayesian program induction. In S. Bengio, H. Wallach, H. Larochelle, K. Grauman, N. Cesa-Bianchi, and R. Garnett (eds.), Advances in Neural Information Processing Systems 31, pp. 7805–7815. Curran Associates, Inc., 2018.
|
| 190 |
+
Chrisantha Fernando, Dylan Banarse, Charles Blundell, Yori Zwols, David Ha, Andrei A Rusu, Alexander Pritzel, and Daan Wierstra. Pathnet: Evolution channels gradient descent in super neural networks. arXiv preprint arXiv:1701.08734, 2017.
|
| 191 |
+
John K Feser, Marc Brockschmidt, Alexander L Gaunt, and Daniel Tarlow. Differentiable functional program interpreters. arXiv preprint arXiv:1611.01988, 2016.
|
| 192 |
+
Chelsea Finn, Pieter Abbeel, and Sergey Levine. Model-agnostic meta-learning for fast adaptation of deep networks. arXiv preprint arXiv:1703.03400, 2017.
|
| 193 |
+
Jerry A Fodor and Ernest Lepore. The compositionality papers. Oxford University Press, 2002.
|
| 194 |
+
Jerry A Fodor and Zenon W Pylyshyn. Connectionism and cognitive architecture: A critical analysis. Cognition, 28(1-2):3–71, 1988.
|
| 195 |
+
|
| 196 |
+
Kevin Frans, Jonathan Ho, Xi Chen, Pieter Abbeel, and John Schulman. Meta learning shared hierarchies. arXiv preprint arXiv:1710.09767, 2017.
|
| 197 |
+
|
| 198 |
+
Yaroslav Ganin, Tejas Kulkarni, Igor Babuschkin, S.M. Ali Eslami, and Orial Vinyals. Synthesizing programs for images using reinforced adversarial learning. arXiv preprint arXiv:1804.01118, 2018.
|
| 199 |
+
|
| 200 |
+
Alexander L Gaunt, Marc Brockschmidt, Nate Kushman, and Daniel Tarlow. Differentiable programs with neural libraries. arXiv preprint arXiv:1611.02109, 2016.
|
| 201 |
+
|
| 202 |
+
Alison Gopnik and Henry M Wellman. Reconstructing constructivism: Causal models, bayesian learning mechanisms, and the theory theory. Psychological bulletin, 138(6):1085, 2012.
|
| 203 |
+
|
| 204 |
+
Erin Grant, Chelsea Finn, Sergey Levine, Trevor Darrell, and Thomas Griffiths. Recasting gradientbased meta-learning as hierarchical bayes. arXiv preprint arXiv:1801.08930, 2018.
|
| 205 |
+
|
| 206 |
+
Alex Graves. Adaptive computation time for recurrent neural networks. arXiv preprint arXiv:1603.08983, 2016.
|
| 207 |
+
|
| 208 |
+
Alex Graves, Greg Wayne, and Ivo Danihelka. Neural turing machines. arXiv preprint arXiv:1410.5401, 2014.
|
| 209 |
+
|
| 210 |
+
Alex Graves, Greg Wayne, Malcolm Reynolds, Tim Harley, Ivo Danihelka, Agnieszka GrabskaBarwinska, Sergio G ´ omez Colmenarejo, Edward Grefenstette, Tiago Ramalho, John Agapiou, ´ et al. Hybrid computing using a neural network with dynamic external memory. Nature, 538 (7626):471, 2016.
|
| 211 |
+
|
| 212 |
+
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.
|
| 213 |
+
|
| 214 |
+
Thomas L Griffiths, Falk Lieder, and Noah D Goodman. Rational use of cognitive resources: Levels of analysis between the computational and the algorithmic. Topics in cognitive science, 7(2): 217–229, 2015.
|
| 215 |
+
|
| 216 |
+
Thomas L Griffiths, Fred Callaway, Michael B Chang, Erin Grant, Paul M Krueger, and Falk Lieder. Doing more with less: Meta-reasoning and meta-learning in humans and machines. Current Opinion in Behavioral Sciences, 01 2019.
|
| 217 |
+
|
| 218 |
+
Abhishek Gupta, Benjamin Eysenbach, Chelsea Finn, and Sergey Levine. Unsupervised metalearning for reinforcement learning. arXiv preprint arXiv:1806.04640, 2018a.
|
| 219 |
+
|
| 220 |
+
Abhishek Gupta, Russell Mendonca, YuXuan Liu, Pieter Abbeel, and Sergey Levine. Metareinforcement learning of structured exploration strategies. arXiv preprint arXiv:1802.07245, 2018b.
|
| 221 |
+
|
| 222 |
+
David Ha and Jurgen Schmidhuber. World models. ¨ arXiv preprint arXiv:1803.10122, 2018.
|
| 223 |
+
|
| 224 |
+
David Ha, Andrew Dai, and Quoc V Le. Hypernetworks. arXiv preprint arXiv:1609.09106, 2016.
|
| 225 |
+
|
| 226 |
+
Jessica B Hamrick, Andrew J Ballard, Razvan Pascanu, Oriol Vinyals, Nicolas Heess, and Peter W Battaglia. Metacontrol for adaptive imagination-based optimization. arXiv preprint arXiv:1705.02670, 2017.
|
| 227 |
+
|
| 228 |
+
Nicholas Hay, Stuart Russell, David Tolpin, and Solomon Eyal Shimony. Selecting computations: Theory and applications. arXiv preprint arXiv:1408.2048, 2014.
|
| 229 |
+
|
| 230 |
+
Irina Higgins, David Amos, David Pfau, Sebastien Racaniere, Loic Matthey, Danilo Rezende, and Alexander Lerchner. Towards a definition of disentangled representations. arXiv preprint arXiv:1812.02230, 2018.
|
| 231 |
+
|
| 232 |
+
Geoffrey Hinton, Nicholas Frosst, and Sara Sabour. Matrix capsules with em routing. 2018.
|
| 233 |
+
|
| 234 |
+
Robert C Holte and Berthe Y Choueiry. Abstraction and reformulation in artificial intelligence. Philosophical Transactions of the Royal Society of London B: Biological Sciences, 358(1435): 1197–1204, 2003.
|
| 235 |
+
|
| 236 |
+
John J Hopfield. Neural networks and physical systems with emergent collective computational abilities. Proceedings of the national academy of sciences, 79(8):2554–2558, 1982.
|
| 237 |
+
|
| 238 |
+
Robert A Jacobs, Michael I Jordan, Steven J Nowlan, and Geoffrey E Hinton. Adaptive mixtures of local experts. Neural computation, 3(1):79–87, 1991.
|
| 239 |
+
|
| 240 |
+
Max Jaderberg, Karen Simonyan, Andrew Zisserman, et al. Spatial transformer networks. In Advances in neural information processing systems, pp. 2017–2025, 2015.
|
| 241 |
+
|
| 242 |
+
Armand Joulin and Tomas Mikolov. Inferring algorithmic patterns with stack-augmented recurrent nets. In Advances in neural information processing systems, pp. 190–198, 2015.
|
| 243 |
+
|
| 244 |
+
Łukasz Kaiser and Ilya Sutskever. Neural gpus learn algorithms. arXiv preprint arXiv:1511.08228, 2015.
|
| 245 |
+
|
| 246 |
+
Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
|
| 247 |
+
|
| 248 |
+
Louis Kirsch, Julius Kunze, and David Barber. Modular networks: Learning to decompose neural computation. In Advances in Neural Information Processing Systems, pp. 2414–2423, 2018.
|
| 249 |
+
|
| 250 |
+
Teuvo Kohonen. Correlation matrix memories. IEEE transactions on computers, 100(4):353–359, 1972.
|
| 251 |
+
|
| 252 |
+
Tejas D Kulkarni, William F Whitney, Pushmeet Kohli, and Josh Tenenbaum. Deep convolutional inverse graphics network. In Advances in Neural Information Processing Systems, pp. 2539–2547, 2015.
|
| 253 |
+
|
| 254 |
+
Tejas D Kulkarni, Karthik Narasimhan, Ardavan Saeedi, and Josh Tenenbaum. Hierarchical deep reinforcement learning: Integrating temporal abstraction and intrinsic motivation. In Advances in neural information processing systems, pp. 3675–3683, 2016.
|
| 255 |
+
|
| 256 |
+
Karol Kurach, Marcin Andrychowicz, and Ilya Sutskever. Neural random-access machines. arXiv preprint arXiv:1511.06392, 2015.
|
| 257 |
+
|
| 258 |
+
BM Lake and Marco Baroni. Generalization without systematicity: On the compositional skills of sequence-to-sequence recurrent networks. arXiv preprint arXiv:1711.00350, 2017.
|
| 259 |
+
|
| 260 |
+
Brenden M Lake, Ruslan Salakhutdinov, and Joshua B Tenenbaum. Human-level concept learning through probabilistic program induction. Science, 350(6266):1332–1338, 2015.
|
| 261 |
+
|
| 262 |
+
Yann LeCun, Leon Bottou, Yoshua Bengio, Patrick Haffner, et al. Gradient-based learning applied ´ to document recognition. Proceedings of the IEEE, 86(11):2278–2324, 1998.
|
| 263 |
+
|
| 264 |
+
Falk Lieder, Frederick Callaway, Sayan Gul, Paul M Krueger, and Thomas L Griffiths. Learning to select computations. arXiv preprint arXiv:1711.06892, 2017.
|
| 265 |
+
|
| 266 |
+
Chen-Hsuan Lin and Simon Lucey. Inverse compositional spatial transformer networks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 2568–2576, 2017.
|
| 267 |
+
|
| 268 |
+
Adam Liska, Germ ˇ an Kruszewski, and Marco Baroni. Memorize or generalize? searching for a ´ compositional rnn in a haystack. arXiv preprint arXiv:1802.06467, 2018.
|
| 269 |
+
|
| 270 |
+
David Lopez-Paz et al. Gradient episodic memory for continual learning. In Advances in Neural Information Processing Systems, pp. 6467–6476, 2017.
|
| 271 |
+
|
| 272 |
+
Joao Loula, Marco Baroni, and Brenden M Lake. Rearranging the familiar: Testing compositional generalization in recurrent networks. arXiv preprint arXiv:1807.07545, 2018.
|
| 273 |
+
|
| 274 |
+
Gary F Marcus. Rethinking eliminative connectionism. Cognitive psychology, 37(3):243–282, 1998.
|
| 275 |
+
|
| 276 |
+
Gary F Marcus. The algebraic mind: Integrating connectionism and cognitive science. MIT press, 2018.
|
| 277 |
+
|
| 278 |
+
Nikhil Mishra, Mostafa Rohaninejad, Xi Chen, and Pieter Abbeel. A simple neural attentive metalearner. 2018.
|
| 279 |
+
|
| 280 |
+
Ofir Nachum, Shane Gu, Honglak Lee, and Sergey Levine. Data-efficient hierarchical reinforcement learning. arXiv preprint arXiv:1805.08296, 2018.
|
| 281 |
+
|
| 282 |
+
Ashvin V Nair, Vitchyr Pong, Murtaza Dalal, Shikhar Bahl, Steven Lin, and Sergey Levine. Visual reinforcement learning with imagined goals. In Advances in Neural Information Processing Systems, pp. 9209–9220, 2018.
|
| 283 |
+
|
| 284 |
+
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.
|
| 285 |
+
|
| 286 |
+
Alex Nichol, Joshua Achiam, and John Schulman. On first-order meta-learning algorithms. CoRR, abs/1803.02999, 2018.
|
| 287 |
+
|
| 288 |
+
Junhyuk Oh, Satinder Singh, Honglak Lee, and Pushmeet Kohli. Zero-shot task generalization with multi-task deep reinforcement learning. arXiv preprint arXiv:1706.05064, 2017.
|
| 289 |
+
|
| 290 |
+
Giambattista Parascandolo, Mateo Rojas-Carulla, Niki Kilbertus, and Bernhard Scholkopf. Learning ¨ independent causal mechanisms. arXiv preprint arXiv:1712.00961, 2017.
|
| 291 |
+
|
| 292 |
+
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-W, 2017.
|
| 293 |
+
|
| 294 |
+
S Pinker. Baby born talkingdescribes heaven. The language instinct: How the mind creates language, pp. 265–301, 1994.
|
| 295 |
+
|
| 296 |
+
Sachin Ravi and Hugo Larochelle. Optimization as a model for few-shot learning. 2016.
|
| 297 |
+
|
| 298 |
+
Scott Reed and Nando De Freitas. Neural programmer-interpreters. arXiv preprint arXiv:1511.06279, 2015.
|
| 299 |
+
|
| 300 |
+
Sebastian Riedel, Matko Bosnjak, and Tim Rocktaschel. Programming with a differentiable forth ¨ interpreter. CoRR, abs/1605.06640, 2016.
|
| 301 |
+
|
| 302 |
+
Clemens Rosenbaum, Tim Klinger, and Matthew Riemer. Routing networks: Adaptive selection of non-linear functions for multi-task learning. International Conference on Learning Representations, 2018.
|
| 303 |
+
|
| 304 |
+
Stuart Russell and Eric Wefald. Principles of metareasoning. Artificial intelligence, 49(1-3):361– 395, 1991.
|
| 305 |
+
|
| 306 |
+
S Sanborn, D Bourgin, M Chang, and T Griffiths. Representational efficiency outweighs action efficiency in human program induction. In Proceedings of the 40th annual Cognitive Science Society, July 2018.
|
| 307 |
+
|
| 308 |
+
Alvaro Sanchez-Gonzalez, Nicolas Heess, Jost Tobias Springenberg, Josh Merel, Martin Riedmiller, Raia Hadsell, and Peter Battaglia. Graph networks as learnable physics engines for inference and control. arXiv preprint arXiv:1806.01242, 2018.
|
| 309 |
+
|
| 310 |
+
Adam Santoro, David Raposo, David GT Barrett, Mateusz Malinowski, Razvan Pascanu, Peter Battaglia, and Timothy Lillicrap. A simple neural network module for relational reasoning. arXiv preprint arXiv:1706.01427, 2017.
|
| 311 |
+
|
| 312 |
+
Imanol Schlag and Jurgen Schmidhuber. Gated fast weights for on-the-fly neural program genera-¨ tion. In NIPS Metalearning Workshop, 2017.
|
| 313 |
+
|
| 314 |
+
Imanol Schlag and Jurgen Schmidhuber. Learning to reason with third order tensor products. In ¨ Advances in Neural Information Processing Systems, pp. 10003–10014, 2018.
|
| 315 |
+
|
| 316 |
+
Jurgen Schmidhuber. ¨ Evolutionary principles in self-referential learning, or on learning how to learn: the meta-meta-... hook. PhD thesis, Technische Universitat M¨ unchen, 1987. ¨
|
| 317 |
+
|
| 318 |
+
Jurgen Schmidhuber. ¨ Towards compositional learning with dynamic neural networks. Inst. fur¨ Informatik, 1990.
|
| 319 |
+
|
| 320 |
+
Jurgen Schmidhuber. Learning to control fast-weight memories: An alternative to dynamic recurrent ¨ networks. Neural Computation, 4(1):131–139, 1992.
|
| 321 |
+
|
| 322 |
+
Jurgen Schmidhuber. Ultimate cognition ¨ a la g \` odel. ¨ Cognitive Computation, 1(2):177–193, 2009.
|
| 323 |
+
|
| 324 |
+
Jurgen Schmidhuber. Self-delimiting neural networks. ¨ arXiv preprint arXiv:1210.0118, 2012.
|
| 325 |
+
|
| 326 |
+
John Schulman, Filip Wolski, Prafulla Dhariwal, Alec Radford, and Oleg Klimov. Proximal policy optimization algorithms. arXiv preprint arXiv:1707.06347, 2017.
|
| 327 |
+
|
| 328 |
+
Herbert A Simon. The sciences of the artificial. Cambridge, MA, pp. 132, 1969.
|
| 329 |
+
|
| 330 |
+
Herbert A Simon. The science of design: Creating the artificial. Design Issues, pp. 67–82, 1988.
|
| 331 |
+
|
| 332 |
+
Alec Solway, Carlos Diuk, Natalia Cordova, Debbie Yee, Andrew G Barto, Yael Niv, and Matthew M ´ Botvinick. Optimal behavioral hierarchy. PLoS computational biology, 10(8):e1003779, 2014.
|
| 333 |
+
|
| 334 |
+
Elizabeth S Spelke. Principles of object perception. Cognitive science, 14(1):29–56, 1990.
|
| 335 |
+
|
| 336 |
+
Jost Tobias Springenberg, Alexey Dosovitskiy, Thomas Brox, and Martin Riedmiller. Striving for simplicity: The all convolutional net. arXiv preprint arXiv:1412.6806, 2014.
|
| 337 |
+
|
| 338 |
+
Aravind Srinivas, Allan Jabri, Pieter Abbeel, Sergey Levine, and Chelsea Finn. Universal planning networks. arXiv preprint arXiv:1804.00645, 2018.
|
| 339 |
+
|
| 340 |
+
Sainbayar Sukhbaatar, Jason Weston, Rob Fergus, et al. End-to-end memory networks. In Advances in neural information processing systems, pp. 2440–2448, 2015.
|
| 341 |
+
|
| 342 |
+
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.
|
| 343 |
+
|
| 344 |
+
Valentin Thomas, Jules Pondard, Emmanuel Bengio, Marc Sarfati, Philippe Beaudoin, Marie-Jean Meurs, Joelle Pineau, Doina Precup, and Yoshua Bengio. Independently controllable features. arXiv preprint arXiv:1708.01289, 2017.
|
| 345 |
+
|
| 346 |
+
Sebastian Thrun and Lorien Pratt. Learning to learn. Springer Science & Business Media, 2012.
|
| 347 |
+
|
| 348 |
+
Lazar Valkov, Dipak Chaudhari, Akash Srivastava, Charles Sutton, and Swarat Chaudhuri. Houdini: Lifelong learning as program synthesis. In Advances in Neural Information Processing Systems, pp. 8701–8712, 2018.
|
| 349 |
+
|
| 350 |
+
Sjoerd van Steenkiste, Michael Chang, Klaus Greff, and Jurgen Schmidhuber. Relational neural ex- ¨ pectation maximization: Unsupervised discovery of objects and their interactions. arXiv preprint arXiv:1802.10353, 2018.
|
| 351 |
+
|
| 352 |
+
Alexander Sasha Vezhnevets, Simon Osindero, Tom Schaul, Nicolas Heess, Max Jaderberg, David Silver, and Koray Kavukcuoglu. Feudal networks for hierarchical reinforcement learning. arXiv preprint arXiv:1703.01161, 2017.
|
| 353 |
+
|
| 354 |
+
William F Whitney, Michael Chang, Tejas Kulkarni, and Joshua B Tenenbaum. Understanding visual concepts with continuation learning. arXiv preprint arXiv:1602.06822, 2016.
|
| 355 |
+
|
| 356 |
+
David J Willshaw, O Peter Buneman, and Hugh Christopher Longuet-Higgins. Non-holographic associative memory. Nature, 1969.
|
| 357 |
+
|
| 358 |
+
Danfei Xu, Suraj Nair, Yuke Zhu, Julian Gao, Animesh Garg, Li Fei-Fei, and Silvio Savarese. Neural task programming: Learning to generalize across hierarchical tasks. arXiv preprint arXiv:1710.01813, 2017.
|
| 359 |
+
|
| 360 |
+
Wojciech Zaremba and Ilya Sutskever. Learning to execute. arXiv preprint arXiv:1410.4615, 2014.
|
| 361 |
+
|
| 362 |
+
Wojciech Zaremba, Tomas Mikolov, Armand Joulin, and Rob Fergus. Learning simple algorithms from examples. In International Conference on Machine Learning, pp. 421–429, 2016.
|
| 363 |
+
|
| 364 |
+
# A DATA
|
| 365 |
+
|
| 366 |
+
Numerical arithmetic (Sec. D.1): The dataset contains arithmetic expressions of $k$ terms where the terms are integers $\in \ [ 0 , 9 ]$ and the operators are $\in \{ + , \times , - \}$ . The number of possible problems is $( 1 0 ^ { k } ) ( 3 ^ { k - 1 } )$ . The learner sees $5 8 1 0 / ( 2 . 0 4 \cdot 1 0 ^ { 1 4 } ) = 2 . 8 \dot { 5 } \cdot 1 0 ^ { - 1 1 } .$ of the training distribution. The number of possible problems in the extrapolation set is $( 1 0 ^ { 2 0 } ) ( 3 ^ { 1 9 } ) = 1 . 1 6 \cdot 1 \bar { 0 } ^ { 2 9 }$ . An input expression is a sequence of one-hot vectors of size 13.
|
| 367 |
+
|
| 368 |
+
Table 1: Numerical Arithmetic Dataset
|
| 369 |
+
|
| 370 |
+
<table><tr><td># Terms</td><td>Prob. Space</td><td># Train Samples</td><td>Frac.of Prob.Space</td></tr><tr><td>2</td><td>(10²)(31)=3.10²</td><td>210</td><td>7·10-1</td></tr><tr><td>3</td><td>(10³)(3²)=9.10³</td><td>700</td><td>7.78.10-2</td></tr><tr><td>4</td><td>(104)(3)=2.7.105</td><td>700</td><td>2.6.10-3</td></tr><tr><td>5</td><td>(10)(34)=8.1.106</td><td>700</td><td>8.64·10-5</td></tr><tr><td>6</td><td>(10)(35)=2.43.108</td><td>700</td><td>2.88:10-6</td></tr><tr><td>7</td><td>(107)(36)= 7.29·109</td><td>700</td><td>9.60·10-8</td></tr><tr><td>8</td><td>(108)(37) =2.19.1011</td><td>700</td><td>3.20·10-9</td></tr><tr><td>9</td><td>(109(38) = 6.56.1012</td><td>700</td><td>1.07:10-10</td></tr><tr><td>10</td><td>(1010)(39 = 1.97· 1014</td><td>700</td><td>3.56:10-12</td></tr><tr><td>Total</td><td>2.04:1014</td><td>5810</td><td>2.85:10-11</td></tr></table>
|
| 371 |
+
|
| 372 |
+
Multilingual arithmetic (Sec. 4.1): The dataset contains arithmetic expressions of $k$ terms where the terms are integers $\in \ [ 0 , 9 ]$ and the operators are $\in \{ + , \cdot , - \}$ , expressed in five different languages. With 5 choices for the source language and target language, the number of possible problems is $( 1 0 ^ { k } ) ( 3 ^ { k - 1 } ) ( 5 ^ { 2 } )$ . In training, each source language is seen with 4 target languages and each target language is seen with 4 source languages: 20 pairs are seen in training and 5 pairs are held out for testing. The learner sees $4 6 2 0 0 / ( 1 . 6 \bar { 8 } \cdot 1 \bar { 0 } ^ { 8 } ) = \bar { 2 . 7 } 6 \cdot 1 0 ^ { - 4 }$ of the training distribution. The entire space of possible problems in the extrapolation set is $( 1 0 ^ { 1 0 } ) ( 3 ^ { 9 } ) ( 5 ^ { 2 } ) = 4 . { \overset { \vartriangle } { } { \boldsymbol { \mathrm { 1 0 } } } } ^ { 1 0 }$ out of which we draw samples from the 5 held-out language pairs $( ( 1 0 ^ { 1 0 } ) ( 3 ^ { 9 } ) ( 5 ) = 9 . 8 4 \cdot 1 0 ^ { 1 4 }$ possible. An input expression is a sequence of one-hot vectors of size $1 3 \times 5 + 1 = 6 6$ where the single additional element is a STOP token (for training the RNN).
|
| 373 |
+
|
| 374 |
+
Table 2: Multilingual Arithmetic Dataset
|
| 375 |
+
|
| 376 |
+
<table><tr><td># Terms</td><td>Prob. Space</td><td>Train Prob. Space</td><td># Train Samples</td><td>Frac.of Train Dist.</td><td>Frac.of Prob. Space</td></tr><tr><td>2</td><td>(10²)(3)(25)= 7.5·10</td><td>(10²)(3)(20)=6:10</td><td>210:20=4.2:103</td><td>7:10-1</td><td>5.6:10-1</td></tr><tr><td>3</td><td>(10)(3²)(25)=2.25.105</td><td>(10³)(3²)(20)= 1.8·105</td><td>700· 20= 1.4· 104</td><td>7.78.10-2</td><td>6.22.10-2</td></tr><tr><td>4</td><td>(104)(33)(25) =6.75.106</td><td>(104)(33)(20)=5.4.106</td><td>700 · 20=1.4·104</td><td>2.6.10-3</td><td>2.07.10-3</td></tr><tr><td>5</td><td>(105)(3)(25)=2.02.108</td><td>(105)(34)(20)= 1.62·108</td><td>700· 20= 1.4· 104</td><td>8.64·10-5</td><td>6.91:10-5</td></tr><tr><td>Total</td><td>2.09.108</td><td>1.68:108</td><td>46200</td><td>2.76:10 -4</td><td>2.21·10 -4</td></tr></table>
|
| 377 |
+
|
| 378 |
+
Spatially transformed MNIST (Sec. 4.2): The generative process for transforming the standard MNIST dataset to the input the learner observes is described as follows. We first center the $2 8 \mathbf { x } 2 8$ MNIST image in a $4 2 \mathbf { x } 4 2$ black background. We have three types of transformations to apply to the image: scale, rotate, and translate. We can scale big or small (by a factor of 0.6 each way). We can rotate left or right (by 45 degrees each direction). We can translate left, right, up, and down, but the degree to which we translate depends on the size of the object: we translate the digit to the edge of the image, so smaller digits get translated more than large digits. Large digits are translated by $2 0 \%$ of the image width, unscaled digits are translated by $2 9 \%$ of the image width, and small digits are translated by $3 8 \%$ of the image width. In total there are $2 + 2 + 4 \times 3 = 1 6$ individual transformation operations used in the generative process. Because some transformation combinations are commutative, we defined an ordering with which we will apply the generative transformations: scale then rotate then translate. For length-2 compositions of generative transformations, there are scale-small-then-translate $\left( 1 \times 4 \right)$ , scale-big-then-translate $\left( 1 \times 4 \right)$ , rotate-then-translate $( 2 \times 4 )$ , and scale-then-rotate $( 2 \times 2 )$ . We randomly choose 16 of these 20 for training, 2 for validation, 2 for test, as shown in Figure 4 (center). For length-3 compositions of generative transformations, there are scale-small-then-rotate-then-translate $( 1 \times 2 \times 4 )$ and scale-big-then-rotate-then-translate $( 1 \times 2 \times 4 )$ . All 16 were held out for evaluation.
|
| 379 |
+
|
| 380 |
+
# B LEARNER DETAILS
|
| 381 |
+
|
| 382 |
+
All learners are implemented in PyTorch (Paszke et al., 2017) and the code is available at https: //github.com/mbchang/crl.
|
| 383 |
+
|
| 384 |
+
# B.1 ARITHMETIC
|
| 385 |
+
|
| 386 |
+
Baseline: The RNN is implemented as a sequence-to-sequence (Sutskever et al., 2014) gated recurrent unit (GRU) (Cho et al., 2014).
|
| 387 |
+
|
| 388 |
+
CRL Controller: The controller consists of a policy network and a value function, each implemented as GRUs that read in the input expression. The value function outputs a value estimate for the current expression. For the numerical arithmetic task, the policy network first selects a reducer and then conditioned on that choice selects the location in the input expression to apply the reducer. For the multilingual arithmetic task, the policy first samples whether to halt, reduce, or translate, and then conditioned on that choice (if it doesn’t halt) it samples the reducer (along with an index to apply it) or the translator.
|
| 389 |
+
|
| 390 |
+
CRL Modules: The reducers are initialized as a two-layer feedforward network with ReLU nonlinearities (Nair & Hinton, 2010). The translators are a linear weight matrices.
|
| 391 |
+
|
| 392 |
+
# B.2 IMAGE TRANSFORMATIONS
|
| 393 |
+
|
| 394 |
+
Baselines: The CNN is a variant of an all-convolutional network (Springenberg et al., 2014). This was also used as the pre-trained image classifier. The affine-STN predicts all 6 learnable affine parameters as in Jaderberg et al. (2015).
|
| 395 |
+
|
| 396 |
+
CRL Controller: The controller consists of a policy network and a value function, each implemented with the same architecture as the CNN baseline.
|
| 397 |
+
|
| 398 |
+
CRL Modules: The rotate-STN’s localization network is constrained to output the sine and cosine of a rotation angle, the scale-STN’s localization network is constrained to output the scaling factor, and the translate-STN’s localization network is constrained to output spatial translations
|
| 399 |
+
|
| 400 |
+
# C EXPERIMENT DETAILS
|
| 401 |
+
|
| 402 |
+
# C.1 MULTILINGUAL ARITHMETIC
|
| 403 |
+
|
| 404 |
+
Training procedure: The training procedure for the controller follows the standard Proximal Policy Optimization training procedure, where the learner samples a set of episodes, pushes them to a replay buffer, and every $k$ episodes updates the controller based on the episodes collected. Independently, every $k ^ { \prime }$ episodes we consolidate those $k ^ { \prime }$ episodes into a batch and use it to train the modules. We found via a grid search $k = 1 0 2 4$ and $k ^ { \prime } = 2 5 6$ . Through an informal search whose heuristic was performance on the training set, we settled on updating the curriculum of CRL every $1 0 ^ { 5 }$ episodes and updating the curriculum of the RNN every $5 \cdot 1 0 ^ { 4 }$ episodes.
|
| 405 |
+
|
| 406 |
+
Domain-specific details: In the case that HALT is called to early, CRL treats it as a no-op. Similarly, if a reduction operator is called when there is only one token in the expression, the learner also treats it as a no-op. There are other ways around this domain-specific nuance, such as to always halt whenever HALT is called but only do backpropagation from the loss if the expression has been fully reduced (otherwise it wouldn’t make sense to compute a loss on an expression that has not been fully reduced). The way we interpret these “invalid actions” is analogous to a standard practice in reinforcement learning of keeping an agent in the same state if it walks into a wall of a maze.
|
| 407 |
+
|
| 408 |
+
Symmetry breaking: We believe that the random initialization of the modules and the controller breaks the symmetry between the modules. For episodes 0 through $k$ the controller still has the same random initial weights, and for episodes 0 through $k ^ { \prime }$ the modules still have the same random initial weights. Because of the initial randomness, the initial controller will select certain modules more than others for certain inputs; similarly initially certain modules will perform better than others for certain inputs. Therefore, after $k$ episodes, the controller’s parameters will update in a direction that will make choosing the modules that luckily performed better for certain inputs more likely;
|
| 409 |
+
|
| 410 |
+
similarly, after $k ^ { \prime }$ episodes, the modules’ parameters will update in a direction that will make them better for the inputs they have been given. So gradually, modules that initially were slightly better at certain inputs will become more specialized towards those inputs and they will also get selected more for those inputs.
|
| 411 |
+
|
| 412 |
+
Training objective: The objective of the composition of modules is to minimize the negative log likelihood of the correct answer to the arithmetic problem. The objective of the controller is to maximize reward. It receives a reward of 1 if the token with maximum log likelihood is that of the correct answer, 0 if not, and $- 0 . 0 1$ for every computation step it takes. The step penalty was found by a scale search over $\{ - 1 , - 0 . 1 , - 0 . 0 1 , - \mathrm { { 0 . 0 0 1 } } \}$ and $- 0 . 0 1$ was a penalty that we found balanced accuracy and computation time to a reasonable degree during training. There is no explicit feedback on what the transformations should be and on how they are composed.
|
| 413 |
+
|
| 414 |
+
# C.2 IMAGE TRANSFORMATIONS
|
| 415 |
+
|
| 416 |
+
Training procedure: The training procedure is similar to the mulitlingual arithmetic case. We update the policy every 256 episodes and the modules everye 64 episodes. We observed that directly training for large translations was unstable, so to overcome this we used a curriculum. The curriculum began without any translation, then increased the direction of translation by $1 \%$ of the image width every $3 \cdot 1 0 ^ { 4 }$ episodes until the amount of translation matched $2 0 \%$ of the image width for large digits, $2 9 \%$ of the image width for unscaled digits, and $3 8 \%$ of the image width for small digits. Unlike in the multilingual arithmetic case, during later stages of the curriculum we do not continue training on earlier stages of the curriculum.
|
| 417 |
+
|
| 418 |
+
Domain-specific details: In the bounded-horizon setup, we manually halt CRL according to the length of the generative transformation combinations of the task: if the digit was generated by applying two transformations, then we halt CRL’s controller after it selects two modules. Therefore, we did not use a step-penalty in this experiment.
|
| 419 |
+
|
| 420 |
+
Symmetry breaking: The transformation parameters were initialized to output an identity transformation, although the the localization network were randomly initialized across modules, which breaks the symmetry among the modules.
|
| 421 |
+
|
| 422 |
+
Training objective: The objective is to classify a transformed MNIST digit correctly based on the negative log likelihood of the correct classification from a pre-trained classifier. The objective of the controller is to maximize reward. It receives a reward of 1 for a correct classification and 0 if not. There is no explicit feedback on what the transformations should be and on how they are composed.
|
| 423 |
+
|
| 424 |
+
# D ADDITIONAL EXPERIMENTS
|
| 425 |
+
|
| 426 |
+
# D.1 NUMERICAL MATH
|
| 427 |
+
|
| 428 |
+
The input is a numerical arithmetic expression (e.g. $3 + 4 \times 7 )$ ) and the desired output (e.g. 1) is the evaluation of the expression modulo 10. In our experiments we train on a curriculum of length-2 expressions to length-10 expressions, adding new expressions to an expanding dataset over the course of training. The first challenge is to learn from this limited data (only 6510 training expressions) to generalize well to unseen length-10 expressions in the test set $( \approx 2 ^ { 1 \bar { 4 } }$ possible). The second challenge is to extrapolate from this limited data to length-20 expressions $( \approx \dot { 1 } 0 ^ { 2 9 }$ possible). We compare with an RNN architecture (Chung et al., 2014) directly trained to map input to output.
|
| 429 |
+
|
| 430 |
+
Though the RNN eventually generalizes to different 10-length expressions and extrapolates to 20- length expressions (yellow in Fig. 7) with 10 times more data as CRL, it completely overfits when given the same amount of data (gray). In contrast, CRL (red) does not overfit, generalizing significantly better to both the 10-length and 20-length test sets. We believe that the modular disentangled structure in CRL biases it to cleave the problem distribution at its joints, yielding this 10-fold reduction in sample complexity relative to the RNN.
|
| 431 |
+
|
| 432 |
+
We found that the controller naturally learned windows centered around operators (e.g. $2 + 3$ rather than $\times 4 - \ i$ ), suggesting that it has discovered semantic role of these primitive two-term expressions by pattern-matching common structure across arithmetic expressions of different lengths. Note that CRL’s extrapolation accuracy here is not perfect compared to (Cai et al., 2017); however CRL achieves such high extrapolation accuracy with only sparse supervision, without the step-by-step supervision on execution traces, the stack-based model of execution, and hardcoded transformations.
|
| 433 |
+
|
| 434 |
+

|
| 435 |
+
Figure 7: Numerical math task. We compare our learner with the RNN baseline. As a sanity check, we also compare with a version of our learner which has a hardcoded controller (HCC) and a learner which has hardcoded modules (HCF) (in which case the controller is restricted to select windows of 3 with an operator in the middle). All models perform well on the training set. Only our method and its HCC, HCF modifications generalize to the testing and extrapolation set. The RNN requires 10 times more data to generalize to the testing and extrapolation set. For $( \mathbf { b } , \mathbf { c } )$ we only show accuracy on the expressions with the maximum length of those added so far to the curriculum. “1e3” and “1e4” correspond to the order of magnitude of the number of samples in the dataset, of which $70 \%$ are used for training. 10, 50, and 90 percentiles are shown over 6 runs.
|
| 436 |
+
|
| 437 |
+

|
| 438 |
+
Figure 8: Variations: The minimum number of reducers and translators that can solve the multilingual math problems is 1 and $m$ respectively, where $m$ is the number of languages. This is on an extrapolation task, which has more terms and different language pairs. (a, b): Four reducers and zero translators (red) is a pathological choice of modules that causes CRL to overfit, but it does not when translators are provided. (c) In the nonpathological cases, regardless of the number of modules, the learner metareasons about the resources it has to customize its computation to the problem. 10, 50, and 90 percentiles are shown over 6 runs.
|
| 439 |
+
|
| 440 |
+
# D.2 VARIATIONS
|
| 441 |
+
|
| 442 |
+
Here we study the effect of varying the number of modules available to our learner. Fig. 8a, 8b highlights a particular pathological choice of modules that causes CRL to overfit. If CRL uses four reducers and zero translators (red), it is not surprising that it fails to generalize to the test set: recall that each source language is only seen with four target languages during training with one held out; each reducer can just learn to reduce to one of the four target languages. What is interesting though is that when we add five translators to the four reducers (blue), we see certain runs achieve $100 \%$ generalization, even though CRL need not use the translators at all in order to fit the training set. That the blue training curve is slightly faster than the red offers a possible explanation: it may be harder to find a program where each reducer can reduce any source language to their specialized target language, and easier to find programs that involve steps of re-representation (through these translators), where the solution to a new problem is found merely by re-representing that problem into a problem that learner is more familiar with. The four-reducers-five-translators could have overfitted completely like the four-reducers-zero-translators case, but it consistently does not.
|
| 443 |
+
|
| 444 |
+
We find that when we vary the number of reducers (1 or 3) and the number of translators in (5 or 8) in Fig. 8c, the extrapolation performance is consistent across the choices of different numbers of modules, suggesting that CRL is quite robust to the number of modules in non-pathological cases.
|
| 445 |
+
|
| 446 |
+
# D.3 HOW FAR CAN WE PUSH EXTRAPOLATION?
|
| 447 |
+
|
| 448 |
+
Figure 9 shows the extrapolation accuracy from 6 to 100 terms after training on a curriculum from 2 to 5 terms (46200 examples) on the multilingual arithmetic task (Sec. 4.1). The number of possible 100-term problems is $( 1 0 ^ { 1 0 0 } ) ( 3 ^ { 9 9 } ) ( 5 ^ { 2 } ) = 4 . 2 9 \cdot 1 0 ^ { 1 4 8 }$ and CRL achieves about $6 0 \%$ accuracy on these problems; a random guess would be $1 0 \%$ .
|
| 449 |
+
|
| 450 |
+

|
| 451 |
+
Figure 9: Extrapolation
|
| 452 |
+
|
| 453 |
+

|
| 454 |
+
D.4 EXECUTION TRACES: FUNCTION SELECTION
|
| 455 |
+
Figure 10: Multilingual Arithmetic Execution Traces
|
| 456 |
+
|
| 457 |
+
Fig. 10 compares the execution traces of CRL on different language pairs from training of (a,b) length 5 and of (c) length 10. We observe that in many cases the controller chooses to take an additional step to translate the fully reduced answer into an answer in the target language, which shows that it composes together in a novel way knowledge of how to solve a arithmetic problem with knowledge of how to translate between languages.
|
| 458 |
+
|
| 459 |
+
# D.5 EXECUTION TRACES: EXAMPLES
|
| 460 |
+
|
| 461 |
+
Here are two randomly selected execution traces from the numerical arithmetic extrapolation task (train on 10 terms, extrapolate to 20 terms), where CRL’s accuracy hovers around $80 \%$ . These expressions are derived from the internal representations of CRL, which are softmax distributions over the vocabulary (except for the first expression, which is one-hot because it is the input). The expressions here show the maximum value for each internal representation.
|
| 462 |
+
|
| 463 |
+
This is a successful execution. The input is $6 \star 1 \star 3 - 4 + 6 \star 0 \star 0 + 1 - 7 - 3 + 3 + 3 \star 4 + 1 + 1 + 3 + 3 + 6 + 2 + 7$ and the correct answer is 3. Notice that the order in which controller applies its modules does not strictly follow the order of operations but respects the rules of order of operations: for example, it may decide to perform addition (A) before multiplication (B) if it doesn’t affect the final answer.
|
| 464 |
+
|
| 465 |
+
$6 \star 1 \star 3 - 4 + 6 \star 0 \star 0 + 1 - 7 - 3 + 3 + 3 \star 4 + 1 + 1 + 3 + 3 + 6 + 2 + 7$
|
| 466 |
+
$6 \star 1 \star 3 - 4 + 6 \star 0 \star 0 + 1 - 7 - 3 + 3 + 2 + 1 + 1 + 3 + 3 + 6 + 2 + 7$
|
| 467 |
+
6\*1\*3-4+6\*0\*0+1-7-3+5+1+1+3+3+6+2+7
|
| 468 |
+
6\*1\*3-4+6\*0\*0+4-3+5+1+1+3+3+6+2+7
|
| 469 |
+
6\*1\*3-4+6\*0+4-3+5+1+1+3+3+6+2+7
|
| 470 |
+
6\*1\*3-4+6\*0+1+5+1+1+3+3+6+2+7
|
| 471 |
+
6 1 3-4+6 0+1+5+1+4+3+6+2+7
|
| 472 |
+
6 1 3-4+6 0+1+6+4+3+6+2+7
|
| 473 |
+
6\*1\*3-4+6\*0+7+4+3+6+2+7
|
| 474 |
+
6\*1\*3-4+6\*0+7+4+3+6+9
|
| 475 |
+
6 1 3-4+6 0+7+4+9+9
|
| 476 |
+
6 1 3-4+0+7+4+9+9
|
| 477 |
+
6\*1\*3-4+0+7+4+9+9
|
| 478 |
+
6 1 3-4+0+7+4+8
|
| 479 |
+
6\*3-4+0+7+4+8
|
| 480 |
+
6 3-4+7+4+8
|
| 481 |
+
8-4+7+4+8
|
| 482 |
+
4+7+4+8
|
| 483 |
+
1+4+8
|
| 484 |
+
5+8
|
| 485 |
+
3
|
| 486 |
+
END
|
| 487 |
+
|
| 488 |
+
$\begin{array} { r l } { \frac { 1 } { 4 } } & { 3 \times \ 4 \ = \ 2 } \\ { \frac { 1 } { 4 } } & { 3 + \ 2 \ = \ 5 } \\ { \frac { 1 } { 4 } } & { 1 \ - \ 7 \ = \ 4 } \\ { \frac { 1 } { 4 } } & { 0 \ \times \ 0 \ = \ 0 } \\ { \frac { 1 } { 4 } } & { 4 \ - \ 3 \ = \ 1 } \\ { \frac { 1 } { 4 } } & { 1 \ + \ 3 \ = \ 4 } \\ { \frac { 1 } { 4 } } & { 5 \ + \ 1 \ = \ 6 } \\ { \frac { 1 } { 4 } } & { 1 \ + \ 6 \ = \ 7 } \\ { \frac { 1 } { 4 } } & { 2 \ + \ 7 \ = \ 9 } \\ { \frac { 1 } { 4 } } & { 3 \ + \ 6 \ = \ 9 } \\ { \frac { 1 } { 4 } } & { 6 \ \star \ 0 \ = \ 0 } \end{array}$ HALT
|
| 489 |
+
|
| 490 |
+
This is an unsuccessful execution trace.
|
| 491 |
+
|
| 492 |
+
The input is $5 + 6 - 4 + 5 \star 7 \star 3 \star 3 \star 8 \star 0 \star 1 - 4 + 6 - 3 \star 5 \star 3 + 6 - 0 + 0 - 4 - 6$ and the correct answer is 0. Notice that it tends to follow of order of operations by doing multiplication first, although it does make mistakes (D), which in this case was the reason for its incorrect answer. Note that CRL never receives explicit feedback about its mistakes on what its modules learn to do or the order in which it applies them; it only receives a sparse reward signal at the very end. Although (C) was a calculation mistake, it turns out that it does not matter because the subexpression would be multiplied by 0 anyways.
|
| 493 |
+
|
| 494 |
+
$5 + 6 - 4 + 5 \star 7 \star 3 \star 3 \star 8 \star 0 \star 1 - 4 + 6 - 3 \star 5 \star 3 + 6 - 0 + 0 - 4 - 6$
|
| 495 |
+
5+6-4+5\*7\*3\*4\*0\*1-4+6-3\*5\*3+6-0+0-4-6
|
| 496 |
+
5+6-4+5\*7\*3\*4\*0\*1-4+6-3\*5\*3+6-0+6-6
|
| 497 |
+
5+6-4+5\*3\*4\*0\*1-4+6-3\*5\*3+6-0+6-6
|
| 498 |
+
5+6-4+5 4 0 1-4+6-3 5 3+6-0+6-6
|
| 499 |
+
5+6-4+5\*4\*0\*1-4+6-3\*5\*3+6-0+6-6
|
| 500 |
+
5+6-4+0\*0\*1-4+6-3\*5\*3+6-0+6-6
|
| 501 |
+
5+6-4+0\*0\*1-4+6-3\*5\*3+6-0+0
|
| 502 |
+
5+6-4+0\*0\*1-4+3\*5\*3+6-0+0
|
| 503 |
+
5+6-4+0\*0\*1-4+3\*5\*3+6-0+0
|
| 504 |
+
5+6-4+0 0 1-4+3 5 3+6-0+0
|
| 505 |
+
5+6-4+0 0 1-4+3 5 3+6+0
|
| 506 |
+
5+6-4+0\*0\*1-4+5\*3+6+0
|
| 507 |
+
5+6-4+0\*1-4+5\*3+6+0
|
| 508 |
+
5+6-4+0\*1-4+5+6+0
|
| 509 |
+
5+6-4+0-4+5+6+0
|
| 510 |
+
5+6-4+0-4+5+6+0
|
| 511 |
+
5+6-4+0-4+5+6+0
|
| 512 |
+
5+6-4+0-4+5+6+0
|
| 513 |
+
5+6-4+0-4+5+6+0
|
| 514 |
+
5+6-4+0-4+5+6+0
|
| 515 |
+
5+6-4+0-4+5+6+0
|
| 516 |
+
5+6-4+0-4+5+6+0
|
| 517 |
+
5+6-4+0-4+5+6
|
| 518 |
+
5+6-4+0-4+1
|
| 519 |
+
5+6-4+6+1
|
| 520 |
+
1-4+6+1
|
| 521 |
+
7+6+1
|
| 522 |
+
3+1
|
| 523 |
+
4
|
| 524 |
+
END
|
| 525 |
+
|
| 526 |
+
# 3 \* 8 = 4
|
| 527 |
+
$\sharp { \begin{array} { l } { 0 } \end{array} } - { \begin{array} { r } { \mathrm { ~ ~ { ~ \nabla ~ } ~ } } \rVert } \ = { \begin{array} { l } { 6 } \end{array} } \end{array}$
|
| 528 |
+
# 5 \* 7 = 5
|
| 529 |
+
$\sharp \ = \ 3 \star \ 4 \ = \ 4$ (mistake)
|
| 530 |
+
# tried to HALT
|
| 531 |
+
$\sharp \{ \begin{array} { l } { { 5 } } \\ { { } } \end{array} \star \begin{array} { l } { { \mathrm { ~ ~ { ~ \cal ~ 4 ~ } ~ } = \ 0 } } \end{array}$ $\sharp \mathrm { ~ \bf ~ 6 ~ } - \mathrm { ~ \bf ~ 6 ~ } = 0$
|
| 532 |
+
$\sharp \{ \begin{array} { c } { { 6 } } \end{array} - \begin{array} { c } { { 3 } } \end{array} = \begin{array} { c } { { 3 } } \end{array}$
|
| 533 |
+
# tried to HALT
|
| 534 |
+
# tried to HALT
|
| 535 |
+
# tried to HALT
|
| 536 |
+
$\# \ : \ : 3 \ : \ : \star \ : 5 \ : = \ : 5$
|
| 537 |
+
$\# \times \hbar = 0$
|
| 538 |
+
$\# \quad 5 \quad \star \quad 3 \ = \ 5$ $\div 0 \star 1 = 0$
|
| 539 |
+
# tried to HALT
|
| 540 |
+
# tried to HALT
|
| 541 |
+
# tried to HALT
|
| 542 |
+
# tried to HALT
|
| 543 |
+
# tried to HALT
|
| 544 |
+
# tried to HALT
|
| 545 |
+
# tried to HALT
|
| 546 |
+
# $6 + 0 = 0$
|
| 547 |
+
$\# \ : \ : 5 \ : \ : + \ : \ : 6 \ : = \ : 1$
|
| 548 |
+
$\sharp { \begin{array} { l } { 0 } \end{array} } - { \begin{array} { r } { \mathrm { ~ ~ { ~ \nabla ~ } ~ } } \rVert } \ = { \begin{array} { l } { 6 } \end{array} } \end{array}$
|
| 549 |
+
$\# \ : \ : 5 \ : \ : + \ : \ : 6 \ : = \ : 1$
|
| 550 |
+
$\# \mathrm { ~ \bf ~ 1 ~ } - \mathrm { ~ \bf ~ 4 ~ } = \mathrm { ~ \bf ~ 7 ~ }$
|
| 551 |
+
$\# \mathrm { ~ 7 ~ } + \mathrm { ~ 6 ~ } = \mathrm { ~ 3 ~ }$
|
| 552 |
+
$\# \ : \ : 3 \ : \ : + \ : \ : 1 \ : = \ : \ : 4$
|
| 553 |
+
# HALT
|
| 554 |
+
|
| 555 |
+
(D: order of operations mistake)
|
md/train/B1kJ6H9ex/B1kJ6H9ex.md
ADDED
|
@@ -0,0 +1,397 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# COMBINING POLICY GRADIENT AND Q-LEARNING
|
| 2 |
+
|
| 3 |
+
Brendan O’Donoghue, Remi Munos, Koray Kavukcuoglu & Volodymyr Mnih ´ Deepmind {bodonoghue,munos,korayk,vmnih}@google.com
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
Policy gradient is an efficient technique for improving a policy in a reinforcement learning setting. However, vanilla online variants are on-policy only and not able to take advantage of off-policy data. In this paper we describe a new technique that combines policy gradient with off-policy Q-learning, drawing experience from a replay buffer. This is motivated by making a connection between the fixed points of the regularized policy gradient algorithm and the Q-values. This connection allows us to estimate the Q-values from the action preferences of the policy, to which we apply Q-learning updates. We refer to the new technique as ‘PGQL’, for policy gradient and Q-learning. We also establish an equivalency between action-value fitting techniques and actor-critic algorithms, showing that regularized policy gradient techniques can be interpreted as advantage function learning algorithms. We conclude with some numerical examples that demonstrate improved data efficiency and stability of PGQL. In particular, we tested PGQL on the full suite of Atari games and achieved performance exceeding that of both asynchronous advantage actor-critic (A3C) and Q-learning.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
In reinforcement learning an agent explores an environment and through the use of a reward signal learns to optimize its behavior to maximize the expected long-term return. Reinforcement learning has seen success in several areas including robotics (Lin, 1993; Levine et al., 2015), computer games (Mnih et al., 2013; 2015), online advertising (Pednault et al., 2002), board games (Tesauro, 1995; Silver et al., 2016), and many others. For an introduction to reinforcement learning we refer to the classic text by Sutton & Barto (1998). In this paper we consider model-free reinforcement learning, where the state-transition function is not known or learned. There are many different algorithms for model-free reinforcement learning, but most fall into one of two families: action-value fitting and policy gradient techniques.
|
| 12 |
+
|
| 13 |
+
Action-value techniques involve fitting a function, called the Q-values, that captures the expected return for taking a particular action at a particular state, and then following a particular policy thereafter. Two alternatives we discuss in this paper are SARSA (Rummery & Niranjan, 1994) and Q-learning (Watkins, 1989), although there are many others. SARSA is an on-policy algorithm whereby the action-value function is fit to the current policy, which is then refined by being mostly greedy with respect to those action-values. On the other hand, Q-learning attempts to find the Qvalues associated with the optimal policy directly and does not fit to the policy that was used to generate the data. Q-learning is an off-policy algorithm that can use data generated by another agent or from a replay buffer of old experience. Under certain conditions both SARSA and Q-learning can be shown to converge to the optimal Q-values, from which we can derive the optimal policy (Sutton, 1988; Bertsekas & Tsitsiklis, 1996).
|
| 14 |
+
|
| 15 |
+
In policy gradient techniques the policy is represented explicitly and we improve the policy by updating the parameters in the direction of the gradient of the performance (Sutton et al., 1999; Silver et al., 2014; Kakade, 2001). Online policy gradient typically requires an estimate of the action-value function of the current policy. For this reason they are often referred to as actor-critic methods, where the actor refers to the policy and the critic to the estimate of the action-value function (Konda & Tsitsiklis, 2003). Vanilla actor-critic methods are on-policy only, although some attempts have been made to extend them to off-policy data (Degris et al., 2012; Levine & Koltun, 2013).
|
| 16 |
+
|
| 17 |
+
In this paper we derive a link between the Q-values induced by a policy and the policy itself when the policy is the fixed point of a regularized policy gradient algorithm (where the gradient vanishes). This connection allows us to derive an estimate of the Q-values from the current policy, which we can refine using off-policy data and Q-learning. We show in the tabular setting that when the regularization penalty is small (the usual case) the resulting policy is close to the policy that would be found without the addition of the Q-learning update. Separately, we show that regularized actor-critic methods can be interpreted as action-value fitting methods, where the Q-values have been parameterized in a particular way. We conclude with some numerical examples that provide empirical evidence of improved data efficiency and stability of PGQL.
|
| 18 |
+
|
| 19 |
+
# 1.1 PRIOR WORK
|
| 20 |
+
|
| 21 |
+
Here we highlight various axes along which our work can be compared to others. In this paper we use entropy regularization to ensure exploration in the policy, which is a common practice in policy gradient (Williams & Peng, 1991; Mnih et al., 2016). An alternative is to use KL-divergence instead of entropy as a regularizer, or as a constraint on how much deviation is permitted from a prior policy (Bagnell & Schneider, 2003; Peters et al., 2010; Schulman et al., 2015; Fox et al., 2015). Natural policy gradient can also be interpreted as putting a constraint on the KL-divergence at each step of the policy improvement (Amari, 1998; Kakade, 2001; Pascanu & Bengio, 2013). In Sallans & Hinton (2004) the authors use a Boltzmann exploration policy over estimated Q-values which they update using TD-learning. In Heess et al. (2012) this was extended to use an actor-critic algorithm instead of TD-learning, however the two updates were not combined as we have done in this paper. In Azar et al. (2012) the authors develop an algorithm called dynamic policy programming, whereby they apply a Bellman-like update to the action-preferences of a policy, which is similar in spirit to the update we describe here. In Norouzi et al. (2016) the authors augment a maximum likelihood objective with a reward in a supervised learning setting, and develop a connection that resembles the one we develop here between the policy and the Q-values. Other works have attempted to combine on and off-policy learning, primarily using action-value fitting methods (Wang et al., 2013; Hausknecht & Stone, 2016; Lehnert & Precup, 2015), with varying degrees of success. In this paper we establish a connection between actor-critic algorithms and action-value learning algorithms. In particular we show that TD-actor-critic (Konda & Tsitsiklis, 2003) is equivalent to expected-SARSA (Sutton & Barto, 1998, Exercise 6.10) with Boltzmann exploration where the Q-values are decomposed into advantage function and value function. The algorithm we develop extends actor-critic with a Q-learning style update that, due to the decomposition of the Q-values, resembles the update of the dueling architecture (Wang et al., 2016). Recently, the field of deep reinforcement learning, i.e., the use of deep neural networks to represent action-values or a policy, has seen a lot of success (Mnih et al., 2015; 2016; Silver et al., 2016; Riedmiller, 2005; Lillicrap et al., 2015; Van Hasselt et al., 2016). In the examples section we use a neural network with PGQL to play the Atari games suite.
|
| 22 |
+
|
| 23 |
+
# 2 REINFORCEMENT LEARNING
|
| 24 |
+
|
| 25 |
+
We consider the infinite horizon, discounted, finite state and action space Markov decision process, with state space $s$ , action space $\mathcal { A }$ and rewards at each time period denoted by $r _ { t } \in \mathbb { R }$ . A policy $\pi : S \times A \to \mathbb { R } _ { + }$ is a mapping from state-action pair to the probability of taking that action at that state, so it must satisfy $\begin{array} { r } { \sum _ { a \in \mathcal { A } } \pi ( s , a ) = 1 } \end{array}$ for all states $s \in { \mathcal { S } }$ . Any policy $\pi$ induces a probability distribution over visited states, $d ^ { \pi } : S \to \mathbb { R } _ { + }$ (which may depend on the initial state), so the probability of seeing state-action pair $( s , a ) \in S \times A$ is $d ^ { \pi } ( s ) \pi ( s , a )$ .
|
| 26 |
+
|
| 27 |
+
In reinforcement learning an ‘agent’ interacts with an environment over a number of times steps. At each time step $t$ the agent receives a state $s _ { t }$ and a reward $r _ { t }$ and selects an action $a _ { t }$ from the policy $\pi _ { t }$ , at which point the agent moves to the next state $s _ { t + 1 } \sim P ( \cdot , s _ { t } , a _ { t } )$ , where $P ( s ^ { \prime } , s , a )$ is the probability of transitioning from state $s$ to state $s ^ { \prime }$ after taking action $a$ . This continues until the agent encounters a teto find a policy where the expec $\pi$ inal state (after which the process is typically restartthat maximizes the expected total discounted return tion is with respect to the initial state distribution, the $\begin{array} { r } { J ( \pi ) = \mathbf { \bar { E } } ( \sum _ { t = 0 } ^ { \infty } \gamma ^ { t } r _ { t } \ | \ \pi ) } \end{array}$ and the policy, and where $\gamma \in ( 0 , 1 )$ is the discount factor that, loosely speaking, controls how much the agent prioritizes long-term versus short-term rewards. Since the agent starts with no knowledge of the environment it must continually explore the state space and so will typically use a stochastic policy.
|
| 28 |
+
|
| 29 |
+
Action-values. The action-value, or Q-value, of a particular state under policy $\pi$ is the exaction at that state . The value of state d following under polic $\pi$ thereafter, i.e.,is denoted by $\begin{array} { r } { \dot { Q } ^ { \pi } ( s , a ) = \mathbf { E } ( \sum _ { t = 0 } ^ { \infty } \gamma ^ { t } r _ { t } \ | \ s _ { 0 } = s , a _ { 0 } = \overline { { \ a } } , \pi ) } \end{array}$ $s$ $\pi$ $\begin{array} { r } { V ^ { \pi } ( s ) = \mathbf { E } ( \sum _ { t = 0 } ^ { \infty } \gamma ^ { t } r _ { t } \mid s _ { 0 } = s , \pi ) } \end{array}$ , which is the expected total discounted return of policy $\pi$ from state $s$ . The optimal action-value function is denoted $Q ^ { \star }$ and satisfies $Q ^ { \star } ( s , a ) = \operatorname* { m a x } _ { \pi } Q ^ { \pi } ( s , a )$ for each $( s , a )$ . The policy that achieves the maximum is the optimal policy $\pi ^ { \star }$ , with value function $V ^ { \star }$ . The advantage function is the difference between the action-value and the value function, i.e., $A ^ { \pi } ( s , a ) = Q ^ { \pi } ( \bar { s _ { \bf { \Re } } } a ) - V ^ { \pi } ( s )$ , and represents the additional expected reward of taking action $a$ over the average performance of the policy from state $s$ . Since $\begin{array} { r } { V ^ { \bar { \pi } } ( s ) = \sum _ { a } \pi ( s , a ) Q ^ { \pi } \bar { ( } s , a ) } \end{array}$ we have the identity $\begin{array} { r } { \sum _ { a } \pi ( s , a ) A ^ { \pi } ( s , a ) ^ { - } = 0 } \end{array}$ , which simply states that the policy $\pi$ has no advantage over itself.
|
| 30 |
+
|
| 31 |
+
Bellman equation. The Bellman operator $\mathcal { T } ^ { \pi }$ (Bellman, 1957) for policy $\pi$ is defined as
|
| 32 |
+
|
| 33 |
+
$$
|
| 34 |
+
\mathcal { T } ^ { \pi } Q ( s , a ) = \mathrm { \bf ~ E } _ { s ^ { \prime } , r , b } ( r ( s , a ) + \gamma Q ( s ^ { \prime } , b ) ) ,
|
| 35 |
+
$$
|
| 36 |
+
|
| 37 |
+
where the expectation is over next state $s ^ { \prime } \sim P ( \cdot , s , a )$ , the reward $r ( s , a )$ , and the action $b$ from policy $\pi _ { s ^ { \prime } }$ . The Q-value function for policy $\pi$ is the fixed point of the Bellman operator for $\pi$ , i.e., ${ \mathcal { T } } ^ { \pi } Q ^ { \pi } = Q ^ { \pi }$ . The optimal Bellman operator $\mathcal { T } ^ { \star }$ is defined as
|
| 38 |
+
|
| 39 |
+
$$
|
| 40 |
+
\mathcal { T } ^ { \star } Q ( s , a ) = \mathbf { E } _ { s ^ { \prime } , r } ( r ( s , a ) + \gamma \operatorname* { m a x } _ { b } Q ( s ^ { \prime } , b ) ) ,
|
| 41 |
+
$$
|
| 42 |
+
|
| 43 |
+
where the expectation is over the next state $s ^ { \prime } \sim P ( \cdot , s , a )$ , and the reward $r ( s , a )$ . The optimal Q-value function is the fixed point of the optimal Bellman equation, i.e., ${ \mathcal { T } } ^ { \star } Q ^ { \star } = Q ^ { \star }$ . Both the $\pi$ -Bellman operator and the optimal Bellman operator are $\gamma$ -contraction mappings in the sup-norm, i.e., $\| T Q _ { 1 } - T Q _ { 2 } \| _ { \infty } \leq \gamma \| Q _ { 1 } - Q _ { 2 } \| _ { \infty }$ , for any $Q _ { 1 } , Q _ { 2 } \in \mathbb { R } ^ { S \times A }$ . From this fact one can show that the fixed point of each operator is unique, and that value iteration converges, i.e., $( T ^ { \pi } ) ^ { k } Q Q ^ { \pi }$ and $( T ^ { \star } ) ^ { \bar { k } } Q Q ^ { \star }$ from any initial $Q$ . (Bertsekas, 2005).
|
| 44 |
+
|
| 45 |
+
# 2.1 ACTION-VALUE LEARNING
|
| 46 |
+
|
| 47 |
+
In value based reinforcement learning we approximate the $\mathrm { Q }$ -values using a function approximator. We then update the parameters so that the Q-values are as close to the fixed point of a Bellman equation as possible. If we denote by $Q ( s , a ; \theta )$ the approximate Q-values parameterized by $\theta$ , then Q-learning updates the Q-values along direction $\mathbf { E } _ { s , a } ( \mathcal { T } ^ { \star } Q ( s , a ; \theta ) - Q ( \bar { s } , a ; \theta ) ) \nabla _ { \theta } Q ( s , a ; \theta )$ and SARSA updates the $\mathrm { Q }$ -values along direction $\begin{array} { r } { { \bf E } _ { s , a } ( \mathcal { T } ^ { \pi } Q ( s , a ; \theta ) - Q ( s , a ; \theta ) ) \nabla _ { \theta } Q ( s , a ; \theta ) . } \end{array}$ . In the online setting the Bellman operator is approximated by sampling and bootstrapping, whereby the Q-values at any state are updated using the Q-values from the next visited state. Exploration is achieved by not always taking the action with the highest $\mathrm { Q }$ -value at each time step. One common technique called ‘epsilon greedy’ is to sample a random action with probability $\epsilon > 0$ , where $\epsilon$ starts high and decreases over time. Another popular technique is ‘Boltzmann exploration’, where the policy is given by the softmax over the Q-values with a temperature $T$ , i.e., $\pi ( s , a ) = \mathrm { e x p } ( Q ( \dot { s , } a ) / \dot { T } ) / \bar { \sum _ { b } } \mathrm { e x p } \bar { ( } Q ( s , b ) / T )$ , where it is common to decrease the temperature over time.
|
| 48 |
+
|
| 49 |
+
# 2.2 POLICY GRADIENT
|
| 50 |
+
|
| 51 |
+
Alternatively, we can parameterize the policy directly and attempt to improve it via gradient ascent on the performance $J$ . The policy gradient theorem (Sutton et al., 1999) states that the gradient of $J$ with respect to the parameters of the policy is given by
|
| 52 |
+
|
| 53 |
+
$$
|
| 54 |
+
\nabla _ { \boldsymbol { \theta } } J ( \pi ) = \mathbf { \underline { { E } } } _ { s , a } Q ^ { \pi } ( s , a ) \nabla _ { \boldsymbol { \theta } } \log \pi ( s , a ) ,
|
| 55 |
+
$$
|
| 56 |
+
|
| 57 |
+
where the expectation is over $( s , a )$ with probability $d ^ { \pi } ( s ) \pi ( s , a )$ . In the original derivation of the policy gradient theorem the expectation is over the discounted distribution of states, i.e., over $\begin{array} { r } { d _ { \gamma } ^ { \pi , \overset { \cdot } { s _ { 0 } } } ( s ) \stackrel { \cdot } { = } \sum _ { t = 0 } ^ { \infty } \gamma ^ { t } P r \{ s _ { t } = s \mid \overset { \cdot } { s _ { 0 } } , \pi \} } \end{array}$ . However, the gradient update in that case will assign a low weight to states that take a long time to reach and can therefore have poor empirical performance. In practice the non-discounted distribution of states is frequently used instead. In certain cases this is equivalent to maximizing the average (i.e., non-discounted) policy performance, even when $Q ^ { \pi }$ uses a discount factor (Thomas, 2014). Throughout this paper we will use the non-discounted distribution of states.
|
| 58 |
+
|
| 59 |
+
In the online case it is common to add an entropy regularizer to the gradient in order to prevent the policy becoming deterministic. This ensures that the agent will explore continually. In that case the (batch) update becomes
|
| 60 |
+
|
| 61 |
+
$$
|
| 62 |
+
\begin{array} { r } { \Delta \theta \propto \underline { { \mathbf { E } } } _ { a } Q ^ { \pi } ( s , a ) \nabla _ { \theta } \log \pi ( s , a ) + \alpha \underline { { \mathbf { E } } } _ { s } \nabla _ { \theta } H ^ { \pi } ( s ) , } \end{array}
|
| 63 |
+
$$
|
| 64 |
+
|
| 65 |
+
where $\begin{array} { r } { H ^ { \pi } ( s ) = - \sum _ { a } \pi ( s , a ) \log \pi ( s , a ) } \end{array}$ denotes the entropy of policy $\pi$ , and $\alpha > 0$ is the regularization penalty parameter. Throughout this paper we will make use of entropy regularization, however many of the results are true for other choices of regularizers with only minor modification, e.g., KL-divergence. Note that equation (2) requires exact knowledge of the Q-values. In practice they can be estimated, e.g., by the sum of discounted rewards along an observed trajectory (Williams, 1992), and the policy gradient will still perform well (Konda & Tsitsiklis, 2003).
|
| 66 |
+
|
| 67 |
+
# 3 REGULARIZED POLICY GRADIENT ALGORITHM
|
| 68 |
+
|
| 69 |
+
In this section we derive a relationship between the policy and the Q-values when using a regularized policy gradient algorithm. This allows us to transform a policy into an estimate of the Q-values. We then show that for small regularization the $\mathrm { Q }$ -values induced by the policy at the fixed point of the algorithm have a small Bellman error in the tabular case.
|
| 70 |
+
|
| 71 |
+
# 3.1 TABULAR CASE
|
| 72 |
+
|
| 73 |
+
Consider the fixed points of the entropy regularized policy gradient update (2). Let us define $f ( \theta ) =$ $\mathbf { E } _ { s , a } Q ^ { \pi } ( s , a ) \nabla _ { \theta } \log \pi ( s , a ) + \alpha \mathbf { E } _ { s } \bar { \nabla } _ { \theta } H ( \pi _ { s } )$ , and $\begin{array} { r } { \dot { g } _ { s } ( \pi ) \stackrel { - } { = } \sum _ { a } \pi ( \stackrel { - } { s } , a ) } \end{array}$ for each $s$ . A fixed point is one where we can no longer update $\theta$ in the direction of $f ( \theta )$ without violating one of the constraints $g _ { s } ( \pi ) = 1$ , i.e., where $f ( \theta )$ is in the span of the vectors $\{ \dot { \nabla _ { \theta } } g _ { s } ( \pi ) \}$ . In other words, any fixed point must satisfy $\begin{array} { r } { f ( \theta ) = \sum _ { s } \lambda _ { s } \nabla _ { \theta } g _ { s } ( \pi ) } \end{array}$ , where for each $s$ the Lagrange multiplier $\lambda _ { s } \in \mathbb { R }$ ensures that $g _ { s } ( \pi ) = 1$ . Substituting in terms to this equation we obtain
|
| 74 |
+
|
| 75 |
+
$$
|
| 76 |
+
\underset { s , a } { \mathbf { E } } \left( Q ^ { \pi } ( s , a ) - \alpha \log \pi ( s , a ) - c _ { s } \right) \nabla _ { \theta } \log \pi ( s , a ) = 0 ,
|
| 77 |
+
$$
|
| 78 |
+
|
| 79 |
+
where we have absorbed all constants into $c \in \mathbb { R } ^ { | s | }$ . Any solution $\pi$ to this equation is strictly positive element-wise since it must lie in the domain of the entropy function. In the tabular case $\pi$ is represented by a single number for each state and action pair and the gradient of the policy with respect to the parameters is the indicator function, i.e., $\nabla _ { \boldsymbol { \theta } ( t , b ) } \pi ( s , a ) = \bar { \mathbf { 1 } } _ { ( t , b ) = ( s , a ) } .$ . From this we obtain $Q ^ { \pi } ( s , a ) - \alpha \log \pi ( s , a ) - c _ { s } = 0$ for each $s$ (assuming that the measure $d ^ { \pi } ( s ) > 0 )$ . Multiplying by $\pi ( \boldsymbol { a } , \boldsymbol { s } )$ and summing over $a \in { \mathcal { A } }$ we get $c _ { s } = \alpha H ^ { \pi } \bar { ( } s ) + V ^ { \pi } ( s )$ . Substituting $c$ into equation (3) we have the following formulation for the policy:
|
| 80 |
+
|
| 81 |
+
$$
|
| 82 |
+
\pi ( s , a ) = \exp ( A ^ { \pi } ( s , a ) / \alpha - H ^ { \pi } ( s ) ) ,
|
| 83 |
+
$$
|
| 84 |
+
|
| 85 |
+
for all $s \in \mathcal { S }$ and $a \in \mathcal A$ . In other words, the policy at the fixed point is a softmax over the advantage function induced by that policy, where the regularization parameter $\alpha$ can be interpreted as the temperature. Therefore, we can use the policy to derive an estimate of the Q-values,
|
| 86 |
+
|
| 87 |
+
$$
|
| 88 |
+
\tilde { Q } ^ { \pi } ( s , a ) = \tilde { A } ^ { \pi } ( s , a ) + V ^ { \pi } ( s ) = \alpha ( \log \pi ( s , a ) + H ^ { \pi } ( s ) ) + V ^ { \pi } ( s ) .
|
| 89 |
+
$$
|
| 90 |
+
|
| 91 |
+
With this we can rewrite the gradient update (2) as
|
| 92 |
+
|
| 93 |
+
$$
|
| 94 |
+
\begin{array} { r } { \Delta \theta \propto \underset { s , a } { \mathbf { E } } ( Q ^ { \pi } ( s , a ) - \tilde { Q } ^ { \pi } ( s , a ) ) \nabla _ { \theta } \log \pi ( s , a ) , } \end{array}
|
| 95 |
+
$$
|
| 96 |
+
|
| 97 |
+
since the update is unchanged by per-state constant offsets. When the policy is parameterized as a softmax, i.e., $\pi ( s , a ) = \bar { \exp ( W ( s , a ) ) } / \sum _ { b } \exp W ( s , b )$ , the quantity $W$ is sometimes referred to as the action-preferences of the policy (Sutton & Barto, 1998, Chapter 6.6). Equation (4) states that the action preferences are equal to the Q-values scaled by $1 / \alpha$ , up to an additive per-state constant.
|
| 98 |
+
|
| 99 |
+
# 3.2 GENERAL CASE
|
| 100 |
+
|
| 101 |
+
Consider the following optimization problem:
|
| 102 |
+
|
| 103 |
+
$$
|
| 104 |
+
\begin{array} { r l } { \mathrm { n i n i m i z e } } & { \mathbf { E } _ { s , a } ( q ( s , a ) - \alpha \log \pi ( s , a ) ) ^ { 2 } } \\ { \mathrm { u b j e c t ~ t o } } & { \sum _ { a } \pi ( s , a ) = 1 , \quad s \in S } \end{array}
|
| 105 |
+
$$
|
| 106 |
+
|
| 107 |
+
over variable $\theta$ which parameterizes $\pi$ , where we consider both the measure in the expectation and the values $\boldsymbol { q } ( s , a )$ to be independent of $\theta$ . The optimality condition for this problem is
|
| 108 |
+
|
| 109 |
+
$$
|
| 110 |
+
\mathbf { E } _ { s , a } ( q ( s , a ) - \alpha \log \pi ( s , a ) + c _ { s } ) \nabla _ { \theta } \log \pi ( s , a ) = 0 ,
|
| 111 |
+
$$
|
| 112 |
+
|
| 113 |
+
where $c \in \mathbb { R } ^ { | S | }$ is the Lagrange multiplier associated with the constraint that the policy sum to one at each state. Comparing this to equation (3), we see that if $q = Q ^ { \pi }$ and the measure in the expectation is the same then they describe the same set of fixed points. This suggests an interpretation of the fixed points of the regularized policy gradient as a regression of the log-policy onto the Q-values. In the general case of using an approximation architecture we can interpret equation (3) as indicating that the error between $Q ^ { \pi }$ and ${ \bf \bar { \cal Q } } ^ { \pi }$ is orthogonal to $\nabla _ { \theta _ { i } } \log \pi$ for each $i$ , and so cannot be reduced further by changing the parameters, at least locally. In this case equation (4) is unlikely to hold at a solution to (3), however with a good approximation architecture it may hold approximately, so that the we can derive an estimate of the Q-values from the policy using equation (5). We will use this estimate of the Q-values in the next section.
|
| 114 |
+
|
| 115 |
+
# 3.3 CONNECTION TO ACTION-VALUE METHODS
|
| 116 |
+
|
| 117 |
+
The previous section made a connection between regularized policy gradient and a regression onto the Q-values at the fixed point. In this section we go one step further, showing that actor-critic methods can be interpreted as action-value fitting methods, where the exact method depends on the choice of critic.
|
| 118 |
+
|
| 119 |
+
Actor-critic methods. Consider an agent using an actor-critic method to learn both a policy $\pi$ and a value function $V$ . At any iteration $k$ , the value function $V ^ { k }$ has parameters $w ^ { k }$ , and the policy is of the form
|
| 120 |
+
|
| 121 |
+
$$
|
| 122 |
+
\pi ^ { k } ( s , a ) = \exp ( W ^ { k } ( s , a ) / \alpha ) / \sum _ { b } \exp ( W ^ { k } ( s , b ) / \alpha ) ,
|
| 123 |
+
$$
|
| 124 |
+
|
| 125 |
+
where $W ^ { k }$ is parameterized by $\theta ^ { k }$ and $\alpha > 0$ is the entropy regularization penalty. In this case $\begin{array} { r l } { \nabla _ { \theta } \log \pi ^ { k } ( s , \dot { a _ { ) } } = ( 1 / \alpha ) ( \nabla _ { \theta } \dot { W } ^ { k } ( s , a ) - \sum _ { b } \pi ( s , b ) \nabla _ { \theta } W ^ { k } ( \dot { s } , b ) \overset { \sim } { ) } } & { { } } \end{array}$ . Using equation (6) the parameters are updated as
|
| 126 |
+
|
| 127 |
+
$$
|
| 128 |
+
\Delta \theta \propto \underset { s , a } { \mathbf { E } } \delta _ { \mathrm { a c } } ( \nabla _ { \theta } W ^ { k } ( s , a ) - \sum _ { b } \pi ^ { k } ( s , b ) \nabla _ { \theta } W ^ { k } ( s , b ) ) , \quad \Delta w \propto \underset { s , a } { \mathbf { E } } \delta _ { \mathrm { a c } } \nabla _ { w } V ^ { k } ( s )
|
| 129 |
+
$$
|
| 130 |
+
|
| 131 |
+
where $\delta _ { \mathrm { a c } }$ is the critic minus baseline term, which depends on the variant of actor-critic being used (see the remark below).
|
| 132 |
+
|
| 133 |
+
Action-value methods. Compare this to the case where an agent is learning Q-values with a dueling architecture (Wang et al., 2016), which at iteration $k$ is given by
|
| 134 |
+
|
| 135 |
+
$$
|
| 136 |
+
Q ^ { k } ( s , a ) = Y ^ { k } ( s , a ) - \sum _ { b } \mu ( s , b ) Y ^ { k } ( s , b ) + V ^ { k } ( s ) ,
|
| 137 |
+
$$
|
| 138 |
+
|
| 139 |
+
where $\mu$ is a probability distribution, $Y ^ { k }$ is parameterized by $\theta ^ { k } , V ^ { k }$ is parameterized by $w ^ { k }$ , and the exploration policy is Boltzmann with temperature $\alpha$ , i.e.,
|
| 140 |
+
|
| 141 |
+
$$
|
| 142 |
+
\pi ^ { k } ( s , a ) = \exp ( Y ^ { k } ( s , a ) / \alpha ) / \sum _ { b } \exp ( Y ^ { k } ( s , b ) / \alpha ) .
|
| 143 |
+
$$
|
| 144 |
+
|
| 145 |
+
In action value fitting methods at each iteration the parameters are updated to reduce some error, where the update is given by
|
| 146 |
+
|
| 147 |
+
$$
|
| 148 |
+
\Delta \theta \propto \underset { s , a } { \mathbf { E } } \delta _ { \mathrm { a v } } \bigl ( \nabla _ { \theta } Y ^ { k } ( s , a ) - \sum _ { b } \mu ( s , b ) \nabla _ { \theta } Y ^ { k } ( s , b ) \bigr ) , \quad \Delta w \propto \underset { s , a } { \mathbf { E } } \delta _ { \mathrm { a v } } \nabla _ { w } V ^ { k } ( s )
|
| 149 |
+
$$
|
| 150 |
+
|
| 151 |
+
where $\delta _ { \mathrm { a v } }$ is the action-value error term and depends on which algorithm is being used (see the remark below).
|
| 152 |
+
|
| 153 |
+
Equivalence. The two policies (8) and (10) are identical if $W ^ { k } = Y ^ { k }$ for all $k$ . Since $X ^ { 0 }$ and $Y ^ { \tilde { 0 } }$ can be initialized and parameterized in the same way, and assuming the two value function estimates are initialized and parameterized in the same way, all that remains is to show that the updates in equations (11) and (9) are identical. Comparing the two, and assuming that $\delta _ { \mathrm { a c } } = \delta _ { \mathrm { a v } }$ (see remark), we see that the only difference is that the measure is not fixed in (9), but is equal to the current policy and therefore changes after each update. Replacing $\mu$ in (11) with $\pi ^ { k }$ makes the updates identical, in which case $W ^ { \widetilde { k } } = Y ^ { k }$ at all iterations and the two policies (8) and (10) are always the same. In other words, the slightly modified action-value method is equivalent to an actor-critic policy gradient method, and vice-versa (modulo using the non-discounted distribution of states, as discussed in $\ S 2 . 2 )$ . In particular, regularized policy gradient methods can be interpreted as advantage function learning techniques (Baird III, 1993), since at the optimum the quantity $\begin{array} { r } { W ( s , a ) - \sum _ { b } \pi ( s , b ) W ( s , b ) = \alpha ( \log \pi ( s , a ) + H ^ { \pi } ( s ) ) } \end{array}$ will be equal to the advantage function values in the tabular case.
|
| 154 |
+
|
| 155 |
+
Remark. In SARSA (Rummery & Niranjan, 1994) we set $\delta _ { \mathrm { a v } } = r ( s , a ) + \gamma Q ( s ^ { \prime } , b ) - Q ( s , a )$ , where $b$ is the action selected at state $s ^ { \prime }$ , which would be equivalent to using a bootstrap critic in equation (6) where $Q ^ { \pi } ( s , a ) = r ( s , a ) + \gamma \tilde { Q } ( s ^ { \prime } , b )$ . In expected-SARSA (Sutton & Barto, 1998, Exercise 6.10), (Van Seijen et al., 2009)) we take the expectation over the Q-values at the next state, so $\delta _ { \mathrm { a v } } = r ( s , a ) + \gamma V ( \bar { s ^ { \prime } } ) - Q ( s , a )$ . This is equivalent to TD-actor-critic (Konda & Tsitsiklis, 2003) where we use the value function to provide the critic, which is given by $Q ^ { \pi } = r ( s , a ) + \gamma V ( s ^ { \prime } )$ . In Q-learning (Watkins, 1989) $\delta _ { \mathrm { a v } } = r ( s , a ) + \gamma \operatorname* { m a x } _ { b } Q ( s ^ { \prime } , b ) - Q ( s , a )$ , which would be equivalent to using an optimizing critic that bootstraps using the max Q-value at the next state, i.e., $Q ^ { \pi } ( s , a ) =$ $r ( s , a ) + \gamma \operatorname* { m a x } _ { b } \tilde { Q } ^ { \pi } ( s ^ { \prime } , b )$ . In REINFORCE the critic is the Monte Carlo return from that state on, i.e., $\begin{array} { r } { Q ^ { \pi } ( s , a ) = ( \sum _ { t = 0 } ^ { \infty } \gamma ^ { t } r _ { t } \ | \ s _ { 0 } = s , a _ { 0 } = a ) } \end{array}$ . If the return trace is truncated and a bootstrap is performed after $n$ -steps, this is equivalent to $n$ -step SARSA or $n$ -step Q-learning, depending on the form of the bootstrap (Peng & Williams, 1996).
|
| 156 |
+
|
| 157 |
+
# 3.4 BELLMAN RESIDUAL
|
| 158 |
+
|
| 159 |
+
In this section we show that $\| \mathcal { T } ^ { \star } Q ^ { \pi _ { \alpha } } - Q ^ { \pi _ { \alpha } } \| \to 0$ with decreasing regularization penalty $\alpha$ , where $\pi _ { \alpha }$ is the policy defined by (4) and $Q ^ { \pi _ { \alpha } }$ is the corresponding $\mathrm { Q }$ -value function, both of which are functions of $\alpha$ . We shall show that it converges to zero by bounding the sequence below by zero and above with a sequence that converges to zero. First, we have that ${ \mathcal { T } } ^ { \star } Q ^ { \pi _ { \alpha } } \geq { \mathcal { T } } ^ { \pi _ { \alpha } } Q ^ { \pi _ { \alpha } } = Q ^ { \pi _ { \alpha } }$ , since $\mathcal { T } ^ { \star }$ is greedy with respect to the Q-values. So ${ \mathcal { T } } ^ { \star } Q ^ { \pi _ { \alpha } } - Q ^ { \pi _ { \alpha } } \geq 0$ . Now, to bound from above we need the fact that $\begin{array} { r } { \pi _ { \alpha } ( s , a ) = \exp ( Q ^ { \pi _ { \alpha } } ( s , a ) / \alpha ) / \sum _ { b } \exp ( Q ^ { \pi _ { \alpha } } ( s , b ) / \alpha ) \leq \exp ( ( Q ^ { \pi _ { \alpha } } ( s , a ) - Q ^ { \pi _ { \alpha } } ( a , b ) ) ) . } \end{array}$ $\operatorname* { m a x } _ { c } Q ^ { \pi _ { \alpha } } ( s , c ) ) / \alpha )$ . Using this we have
|
| 160 |
+
|
| 161 |
+
$$
|
| 162 |
+
\begin{array} { r l r } { 0 } & { \leq } & { \mathcal { T } ^ { \star } Q ^ { \pi _ { \alpha } } ( s , a ) - Q ^ { \pi _ { \alpha } } ( s , a ) } \\ & { = } & { \mathcal { T } ^ { \star } Q ^ { \pi _ { \alpha } } ( s , a ) - \mathcal { T } ^ { \pi _ { \alpha } } Q ^ { \pi _ { \alpha } } ( s , a ) } \\ & { = } & { { \bf E } _ { s ^ { \prime } } \big ( \operatorname* { m a x } _ { c } Q ^ { \pi _ { \alpha } } ( s ^ { \prime } , c ) - \sum _ { b } \pi _ { \alpha } ( s ^ { \prime } , b ) Q ^ { \pi _ { \alpha } } ( s ^ { \prime } , b ) \big ) } \\ & { = } & { { \bf E } _ { s ^ { \prime } } \sum _ { b } \pi _ { \alpha } ( s ^ { \prime } , b ) \big ( \operatorname* { m a x } _ { c } Q ^ { \pi _ { \alpha } } ( s ^ { \prime } , c ) - Q ^ { \pi _ { \alpha } } ( s ^ { \prime } , b ) \big ) } \\ & { \leq } & { { \bf E } _ { s ^ { \prime } } \sum _ { b } \exp \big ( ( Q ^ { \pi _ { \alpha } } ( s ^ { \prime } , b ) - Q ^ { \pi _ { \alpha } } ( s ^ { \prime } , b ^ { \star } ) \big ) / \alpha \big ) \big ( \operatorname* { m a x } _ { c } Q ^ { \pi _ { \alpha } } ( s ^ { \prime } , c ) - Q ^ { \pi _ { \alpha } } ( s ^ { \prime } , b ) \big ) } \\ & { = } & { { \bf E } _ { s ^ { \prime } } \sum _ { b } f _ { \alpha } \big ( \operatorname* { m a x } _ { c } Q ^ { \pi _ { \alpha } } ( s ^ { \prime } , c ) - Q ^ { \pi _ { \alpha } } ( s ^ { \prime } , b ) \big ) , } \end{array}
|
| 163 |
+
$$
|
| 164 |
+
|
| 165 |
+
where we define $f _ { \alpha } ( x ) = x \exp ( - x / \alpha )$ . To conclude our proof we use the fact that $f _ { \alpha } ( x ) \ \leq$ $\begin{array} { r } { \operatorname* { s u p } _ { x } f _ { \alpha } ( x ) = f _ { \alpha } ( \alpha ) \stackrel { \cdot } { = } \alpha \mathrm { e } ^ { - 1 } } \end{array}$ , which yields
|
| 166 |
+
|
| 167 |
+
$$
|
| 168 |
+
0 \leq \mathcal T ^ { \star } Q ^ { \pi _ { \alpha } } ( s , a ) - Q ^ { \pi _ { \alpha } } ( s , a ) \leq | { \mathcal A } | \alpha \mathrm { e } ^ { - 1 }
|
| 169 |
+
$$
|
| 170 |
+
|
| 171 |
+
for all $( s , a )$ , and so the Bellman residual converges to zero with decreasing $\alpha$ . In other words, for small enough $\alpha$ (which is the regime we are interested in) the Q-values induced by the policy (4) will have a small Bellman residual. Moreover, this implies that $\mathrm { l i m } _ { \alpha \to 0 } Q ^ { \pi _ { \alpha } } = Q ^ { \star }$ , as one might expect.
|
| 172 |
+
|
| 173 |
+
# 4 PGQL
|
| 174 |
+
|
| 175 |
+
In this section we introduce the main contribution of the paper, which is a technique to combine policy gradient with Q-learning. We call our technique ‘PGQL’, for policy gradient and Q-learning. In the previous section we showed that the Bellman residual is small at the fixed point of a regularized policy gradient algorithm when the regularization penalty is sufficiently small. This suggests adding an auxiliary update where we explicitly attempt to reduce the Bellman residual as estimated from the policy, i.e., a hybrid between policy gradient and Q-learning.
|
| 176 |
+
|
| 177 |
+
We first present the technique in a batch update setting, with a perfect knowledge of $Q ^ { \pi }$ (i.e., a perfect critic). Later we discuss the practical implementation of the technique in a reinforcement learning setting with function approximation, where the agent generates experience from interacting with the environment and needs to estimate a critic simultaneously with the policy.
|
| 178 |
+
|
| 179 |
+
# 4.1 PGQL UPDATE
|
| 180 |
+
|
| 181 |
+
Define the estimate of $Q$ using the policy as
|
| 182 |
+
|
| 183 |
+
$$
|
| 184 |
+
\begin{array} { r } { \tilde { Q } ^ { \pi } ( s , a ) = \alpha ( \log \pi ( s , a ) + H ^ { \pi } ( s ) ) + V ( s ) , } \end{array}
|
| 185 |
+
$$
|
| 186 |
+
|
| 187 |
+
where $V$ has parameters $w$ and is not necessarily $V ^ { \pi }$ as it was in equation (5). In (2) it was unnecessary to estimate the constant since the update was invariant to constant offsets, although in practice it is often estimated for use in a variance reduction technique (Williams, 1992; Sutton et al., 1999).
|
| 188 |
+
|
| 189 |
+
Since we know that at the fixed point the Bellman residual will be small for small $\alpha$ , we can consider updating the parameters to reduce the Bellman residual in a fashion similar to Q-learning, i.e.,
|
| 190 |
+
|
| 191 |
+
$$
|
| 192 |
+
\Delta \theta \propto \underset { s , a } { \mathbf { E } } ( T ^ { \star } \tilde { Q } ^ { \pi } ( s , a ) - \tilde { Q } ^ { \pi } ( s , a ) ) \nabla _ { \theta } \log \pi ( s , a ) , \quad \Delta w \propto \underset { s , a } { \mathbf { E } } ( T ^ { \star } \tilde { Q } ^ { \pi } ( s , a ) - \tilde { Q } ^ { \pi } ( s , a ) ) \nabla _ { w } V ( s ) .
|
| 193 |
+
$$
|
| 194 |
+
|
| 195 |
+
This is Q-learning applied to a particular form of the $\mathrm { Q }$ -values, and can also be interpreted as an actor-critic algorithm with an optimizing (and therefore biased) critic.
|
| 196 |
+
|
| 197 |
+
The full scheme simply combines two updates to the policy, the regularized policy gradient update (2) and the Q-learning update (13). Assuming we have an architecture that provides a policy $\pi$ , a value function estimate $V$ , and an action-value critic $Q ^ { \pi }$ , then the parameter updates can be written as (suppressing the $( s , a )$ notation)
|
| 198 |
+
|
| 199 |
+
$$
|
| 200 |
+
\begin{array} { r l } & { \begin{array} { r l } & { \beth \theta \propto ( 1 - \eta ) \mathbf { E } _ { s , a } ( Q ^ { \pi } - \tilde { Q } ^ { \pi } ) \nabla _ { \theta } \log \pi + \eta \mathbf { E } _ { s , a } ( \mathcal { T } ^ { \star } \tilde { Q } ^ { \pi } - \tilde { Q } ^ { \pi } ) \nabla _ { \theta } \log \pi , } \end{array} } \\ & { \begin{array} { r l } & { \Delta w \propto ( 1 - \eta ) \mathbf { E } _ { s , a } ( Q ^ { \pi } - \tilde { Q } ^ { \pi } ) \nabla _ { w } V + \eta \mathbf { E } _ { s , a } ( \mathcal { T } ^ { \star } \tilde { Q } ^ { \pi } - \tilde { Q } ^ { \pi } ) \nabla _ { w } V , } \end{array} } \end{array}
|
| 201 |
+
$$
|
| 202 |
+
|
| 203 |
+
here $\eta \in [ 0 , 1 ]$ is a weighting parameter that controls how much of each update we apply. In the case where $\eta = 0$ the above scheme reduces to entropy regularized policy gradient. If $\eta = 1$ then it becomes a variant of (batch) Q-learning with an architecture similar to the dueling architecture (Wang et al., 2016). Intermediate values of $\eta$ produce a hybrid between the two. Examining the update we see that two error terms are trading off. The first term encourages consistency with critic, and the second term encourages optimality over time. However, since we know that under standard policy gradient the Bellman residual will be small, then it follows that adding a term that reduces that error should not make much difference at the fixed point. That is, the updates should be complementary, pointing in the same general direction, at least far away from a fixed point. This update can also be interpreted as an actor-critic update where the critic is given by a weighted combination of a standard critic and an optimizing critic. Yet another interpretation of the update is a combination of expected-SARSA and Q-learning, where the Q-values are parameterized as the sum of an advantage function and a value function.
|
| 204 |
+
|
| 205 |
+
# 4.2 PRACTICAL IMPLEMENTATION
|
| 206 |
+
|
| 207 |
+
The updates presented in (14) are batch updates, with an exact critic $Q ^ { \pi }$ . In practice we want to run this scheme online, with an estimate of the critic, where we don’t necessarily apply the policy gradient update at the same time or from same data source as the Q-learning update.
|
| 208 |
+
|
| 209 |
+
Our proposal scheme is as follows. One or more agents interact with an environment, encountering states and rewards and performing on-policy updates of (shared) parameters using an actor-critic algorithm where both the policy and the critic are being updated online. Each time an agent receives new data from the environment it writes it to a shared replay memory buffer. Periodically a separate learner process samples from the replay buffer and performs a step of Q-learning on the parameters of the policy using (13). This scheme has several advantages. The critic can accumulate the Monte
|
| 210 |
+
|
| 211 |
+

|
| 212 |
+
Figure 1: Grid world experiment.
|
| 213 |
+
|
| 214 |
+
Carlo return over many time periods, allowing us to spread the influence of a reward received in the future backwards in time. Furthermore, the replay buffer can be used to store and replay ‘important’ past experiences by prioritizing those samples (Schaul et al., 2015). The use of the replay buffer can help to reduce problems associated with correlated training data, as generated by an agent exploring an environment where the states are likely to be similar from one time step to the next. Also the use of replay can act as a kind of regularizer, preventing the policy from moving too far from satisfying the Bellman equation, thereby improving stability, in a similar sense to that of a policy ‘trust-region’ (Schulman et al., 2015). Moreover, by batching up replay samples to update the network we can leverage GPUs to perform the updates quickly, this is in comparison to pure policy gradient techniques which are generally implemented on CPU (Mnih et al., 2016).
|
| 215 |
+
|
| 216 |
+
Since we perform Q-learning using samples from a replay buffer that were generated by a old policy we are performing (slightly) off-policy learning. However, Q-learning is known to converge to the optimal Q-values in the off-policy tabular case (under certain conditions) (Sutton & Barto, 1998), and has shown good performance off-policy in the function approximation case (Mnih et al., 2013).
|
| 217 |
+
|
| 218 |
+
# 4.3 MODIFIED FIXED POINT
|
| 219 |
+
|
| 220 |
+
The PGQL updates in equation (14) have modified the fixed point of the algorithm, so the analysis of $\ S 3$ is no longer valid. Considering the tabular case once again, it is still the case that the policy $\pi \propto \exp ( \tilde { Q } ^ { \pi } / \bar { \alpha } )$ as before, where ${ \tilde { Q } } ^ { \pi }$ is defined by (12), however where previously the fixed point satisfied $\tilde { Q } ^ { \pi } = Q ^ { \pi }$ , with $Q ^ { \pi }$ corresponding to the Q-values induced by $\pi$ , now we have
|
| 221 |
+
|
| 222 |
+
$$
|
| 223 |
+
\begin{array} { r } { \tilde { Q } ^ { \pi } = ( 1 - \eta ) Q ^ { \pi } + \eta T ^ { \star } \tilde { Q } ^ { \pi } , } \end{array}
|
| 224 |
+
$$
|
| 225 |
+
|
| 226 |
+
Or equivalently, if $\eta < 1$ , we have $\begin{array} { r } { \tilde { Q } ^ { \pi } = ( 1 - \eta ) \sum _ { k = 0 } ^ { \infty } \eta ^ { k } ( \mathcal { T } ^ { \star } ) ^ { k } Q ^ { \pi } } \end{array}$ . In the appendix we show that $\lVert \tilde { Q } ^ { \pi } - Q ^ { \pi } \rVert \to 0$ and that $\lVert \mathcal { T } ^ { \star } Q ^ { \pi } - Q ^ { \pi } \rVert \to 0$ with decreasing $\alpha$ in the tabular case. That is, for small $\alpha$ the induced $\mathrm { Q }$ -values and the $\mathbf { Q }$ -values estimated from the policy are close, and we still have the guarantee that in the limit the $\mathrm { Q }$ -values are optimal. In other words, we have not perturbed the policy very much by the addition of the auxiliary update.
|
| 227 |
+
|
| 228 |
+
# 5 NUMERICAL EXPERIMENTS
|
| 229 |
+
|
| 230 |
+
# 5.1 GRID WORLD
|
| 231 |
+
|
| 232 |
+
In this section we discuss the results of running PGQL on a toy 4 by 6 grid world, as shown in Figure 1a. The agent always begins in the square marked $\mathbf { \partial } ^ { \bullet } \mathbf { S } ^ { \bullet }$ and the episode continues until it reaches the square marked ‘T’, upon which it receives a reward of 1. All other times it receives no reward. For this experiment we chose regularization parameter $\alpha = 0 . 0 0 1$ and discount factor $\gamma = 0 . 9 5$ .
|
| 233 |
+
|
| 234 |
+
Figure 1b shows the performance traces of three different agents learning in the grid world, running from the same initial random seed. The lines show the true expected performance of the policy from the start state, as calculated by value iteration after each update. The blue-line is standard TD-actor-critic (Konda & Tsitsiklis, 2003), where we maintain an estimate of the value function and use that to generate an estimate of the Q-values for use as the critic. The green line is Q-learning where at each step an update is performed using data drawn from a replay buffer of prior experience and where the Q-values are parameterized as in equation (12). The policy is a softmax over the Q-value estimates with temperature $\alpha$ . The red line is PGQL, which at each step first performs the TD-actor-critic update, then performs the Q-learning update as in (14).
|
| 235 |
+
|
| 236 |
+

|
| 237 |
+
Figure 2: PGQL network augmentation.
|
| 238 |
+
|
| 239 |
+
The grid world was totally deterministic, so the step size could be large and was chosen to be 1. A step-size any larger than this made the pure actor-critic agent fail to learn, but both PGQL and Q-learning could handle some increase in the step-size, possibly due to the stabilizing effect of using replay.
|
| 240 |
+
|
| 241 |
+
It is clear that PGQL outperforms the other two. At any point along the $\mathbf { X }$ -axis the agents have seen the same amount of data, which would indicate that PGQL is more data efficient than either of the vanilla methods since it has the highest performance at practically every point.
|
| 242 |
+
|
| 243 |
+
# 5.2 ATARI
|
| 244 |
+
|
| 245 |
+
We tested our algorithm on the full suite of Atari benchmarks (Bellemare et al., 2012), using a neural network to parameterize the policy. In figure 2 we show how a policy network can be augmented with a parameterless additional layer which outputs the Q-value estimate. With the exception of the extra layer, the architecture and parameters were chosen to exactly match the asynchronous advantage actor-critic (A3C) algorithm presented in Mnih et al. (2016), which in turn reused many of the settings from Mnih et al. (2015). Specifically we used the exact same learning rate, number of workers, entropy penalty, bootstrap horizon, and network architecture. This allows a fair comparison between A3C and PGQL, since the only difference is the addition of the Q-learning step. Our technique augmented A3C with the following change: After each actor-learner has accumulated the gradient for the policy update, it performs a single step of Q-learning from replay data as described in equation (13), where the minibatch size was 32 and the Q-learning learning rate was chosen to be 0.5 times the actor-critic learning rate (we mention learning rate ratios rather than choice of $\eta$ in (14) because the updates happen at different frequencies and from different data sources). Each actor-learner thread maintained a replay buffer of the last $1 0 0 k$ transitions seen by that thread. We ran the learning for 50 million agent steps (200 million Atari frames), as in (Mnih et al., 2016).
|
| 246 |
+
|
| 247 |
+
In the results we compare against both A3C and a variant of asynchronous deep Q-learning. The changes we made to Q-learning are to make it similar to our method, with some tuning of the hyperparameters for performance. We use the exact same network, the exploration policy is a softmax over the Q-values with a temperature of 0.1, and the Q-values are parameterized as in equation (12) (i.e., similar to the dueling architecture (Wang et al., 2016)), where $\alpha = 0 . 1$ . The $\mathrm { Q }$ -value updates are performed every 4 steps with a minibatch of 32 (roughly 5 times more frequently than PGQL). For each method, all games used identical hyper-parameters.
|
| 248 |
+
|
| 249 |
+
The results across all games are given in table 3 in the appendix. All scores have been normalized by subtracting the average score achieved by an agent that takes actions uniformly at random. Each game was tested 5 times per method with the same hyper-parameters but with different random seeds. The scores presented correspond to the best score obtained by any run from a random start evaluation condition (Mnih et al., 2016). Overall, PGQL performed best in 34 games, A3C performed best in 7 games, and Q-learning was best in 10 games. In 6 games two or more methods tied. In tables 1 and 2 we give the mean and median normalized scores as percentage of an expert human normalized score across all games for each tested algorithm from random and human-start conditions respectively. In a human-start condition the agent takes over control of the game from randomly selected human-play starting points, which generally leads to lower performance since the agent may not have found itself in that state during training. In both cases, PGQL has both the highest mean and median, and the median score exceeds $100 \%$ , the human performance threshold.
|
| 250 |
+
|
| 251 |
+
It is worth noting that PGQL was the worst performer in only one game, in cases where it was not the outright winner it was generally somewhere in between the performance of the other two algorithms. Figure 3 shows some sample traces of games where PGQL was the best performer. In these cases PGQL has far better data efficiency than the other methods. In figure 4 we show some of the games where PGQL under-performed. In practically every case where PGQL did not perform well it had better data efficiency early on in the learning, but performance saturated or collapsed. We hypothesize that in these cases the policy has reached a local optimum, or over-fit to the early data, and might perform better were the hyper-parameters to be tuned.
|
| 252 |
+
|
| 253 |
+
<table><tr><td></td><td>A3C</td><td>Q-learning</td><td>PGQL</td><td></td></tr><tr><td>Mean</td><td>636.8</td><td>756.3</td><td>877.2</td><td rowspan="3"></td></tr><tr><td>Median</td><td>107.3</td><td>58.9</td><td>145.6</td></tr></table>
|
| 254 |
+
|
| 255 |
+
Table 1: Mean and median normalized scores for the Atari suite from random starts, as a percentage of human normalized score.
|
| 256 |
+
|
| 257 |
+
Table 2: Mean and median normalized scores for the Atari suite from human starts, as a percentage of human normalized score.
|
| 258 |
+
|
| 259 |
+
<table><tr><td></td><td>A3C</td><td>Q-learning</td><td>PGQL</td></tr><tr><td>Mean</td><td>266.6</td><td>246.6</td><td>416.7</td></tr><tr><td>Median</td><td>58.3</td><td>30.5</td><td>103.3</td></tr></table>
|
| 260 |
+
|
| 261 |
+

|
| 262 |
+
Figure 3: Some Atari runs where PGQL performed well.
|
| 263 |
+
|
| 264 |
+

|
| 265 |
+
Figure 4: Some Atari runs where PGQL performed poorly.
|
| 266 |
+
|
| 267 |
+
# 6 CONCLUSIONS
|
| 268 |
+
|
| 269 |
+
We have made a connection between the fixed point of regularized policy gradient techniques and the Q-values of the resulting policy. For small regularization (the usual case) we have shown that the Bellman residual of the induced Q-values must be small. This leads us to consider adding an auxiliary update to the policy gradient which is related to the Bellman residual evaluated on a transformation of the policy. This update can be performed off-policy, using stored experience. We call the resulting method ‘PGQL’, for policy gradient and Q-learning. Empirically, we observe better data efficiency and stability of PGQL when compared to actor-critic or Q-learning alone. We verified the performance of PGQL on a suite of Atari games, where we parameterize the policy using a neural network, and achieved performance exceeding that of both A3C and Q-learning.
|
| 270 |
+
|
| 271 |
+
# 7 ACKNOWLEDGMENTS
|
| 272 |
+
|
| 273 |
+
We thank Joseph Modayil for many comments and suggestions on the paper, and Hubert Soyer for help with performance evaluation. We would also like to thank the anonymous reviewers for their constructive feedback.
|
| 274 |
+
|
| 275 |
+
# REFERENCES
|
| 276 |
+
|
| 277 |
+
Shun-Ichi Amari. Natural gradient works efficiently in learning. Neural computation, 10(2):251– 276, 1998.
|
| 278 |
+
|
| 279 |
+
Mohammad Gheshlaghi Azar, Vicenc¸ Gomez, and Hilbert J Kappen. Dynamic policy programming. ´ Journal of Machine Learning Research, 13(Nov):3207–3245, 2012.
|
| 280 |
+
|
| 281 |
+
J Andrew Bagnell and Jeff Schneider. Covariant policy search. In IJCAI, 2003.
|
| 282 |
+
|
| 283 |
+
Leemon C Baird III. Advantage updating. Technical Report WL-TR-93-1146, Wright-Patterson Air Force Base Ohio: Wright Laboratory, 1993.
|
| 284 |
+
|
| 285 |
+
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, 2012.
|
| 286 |
+
|
| 287 |
+
Richard Bellman. Dynamic programming. Princeton University Press, 1957.
|
| 288 |
+
|
| 289 |
+
Dimitri P Bertsekas. Dynamic programming and optimal control, volume 1. Athena Scientific, 2005.
|
| 290 |
+
|
| 291 |
+
Dimitri P. Bertsekas and John N. Tsitsiklis. Neuro-Dynamic Programming. Athena Scientific, 1996.
|
| 292 |
+
|
| 293 |
+
Thomas Degris, Martha White, and Richard S Sutton. Off-policy actor-critic. 2012.
|
| 294 |
+
|
| 295 |
+
Roy Fox, Ari Pakman, and Naftali Tishby. Taming the noise in reinforcement learning via soft updates. arXiv preprint arXiv:1207.4708, 2015.
|
| 296 |
+
|
| 297 |
+
Matthew Hausknecht and Peter Stone. On-policy vs. off-policy updates for deep reinforcement learning. Deep Reinforcement Learning: Frontiers and Challenges, IJCAI 2016 Workshop, 2016.
|
| 298 |
+
|
| 299 |
+
Nicolas Heess, David Silver, and Yee Whye Teh. Actor-critic reinforcement learning with energybased policies. In JMLR: Workshop and Conference Proceedings 24, pp. 43–57, 2012.
|
| 300 |
+
|
| 301 |
+
Sham Kakade. A natural policy gradient. In Advances in Neural Information Processing Systems, volume 14, pp. 1531–1538, 2001.
|
| 302 |
+
|
| 303 |
+
Vijay R Konda and John N Tsitsiklis. On actor-critic algorithms. SIAM Journal on Control and Optimization, 42(4):1143–1166, 2003.
|
| 304 |
+
|
| 305 |
+
Lucas Lehnert and Doina Precup. Policy gradient methods for off-policy control. arXiv preprint arXiv:1512.04105, 2015.
|
| 306 |
+
|
| 307 |
+
Sergey Levine and Vladlen Koltun. Guided policy search. In Proceedings of the 30th International Conference on Machine Learning (ICML), pp. 1–9, 2013.
|
| 308 |
+
|
| 309 |
+
Sergey Levine, Chelsea Finn, Trevor Darrell, and Pieter Abbeel. End-to-end training of deep visuomotor policies. arXiv preprint arXiv:1504.00702, 2015.
|
| 310 |
+
|
| 311 |
+
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 arXiv:1509.02971, 2015.
|
| 312 |
+
|
| 313 |
+
Long-Ji Lin. Reinforcement learning for robots using neural networks. Technical report, DTIC Document, 1993.
|
| 314 |
+
|
| 315 |
+
Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Alex Graves, Ioannis Antonoglou, Daan Wierstra, and Martin Riedmiller. Playing atari with deep reinforcement learning. In NIPS Deep Learning Workshop. 2013.
|
| 316 |
+
|
| 317 |
+
Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Andrei A. Rusu, Joel Veness, Marc G. Bellemare, Alex Graves, Martin Riedmiller, Andreas K. Fidjeland, Georg Ostrovski, Stig Petersen, Charles Beattie, Amir Sadik, Ioannis Antonoglou, Helen King, Dharshan Kumaran, Daan Wierstra, Shane Legg, and Demis Hassabis. Human-level control through deep reinforcement learning. Nature, 518(7540):529–533, 02 2015. URL http://dx.doi.org/10.1038/ nature14236.
|
| 318 |
+
|
| 319 |
+
Volodymyr Mnih, Adria Puigdomenech Badia, Mehdi Mirza, Alex Graves, Timothy P Lillicrap, Tim Harley, David Silver, and Koray Kavukcuoglu. Asynchronous methods for deep reinforcement learning. arXiv preprint arXiv:1602.01783, 2016.
|
| 320 |
+
|
| 321 |
+
Mohammad Norouzi, Samy Bengio, Zhifeng Chen, Navdeep Jaitly, Mike Schuster, Yonghui Wu, and Dale Schuurmans. Reward augmented maximum likelihood for neural structured prediction. arXiv preprint arXiv:1609.00150, 2016.
|
| 322 |
+
|
| 323 |
+
Razvan Pascanu and Yoshua Bengio. Revisiting natural gradient for deep networks. arXiv preprint arXiv:1301.3584, 2013.
|
| 324 |
+
|
| 325 |
+
Edwin Pednault, Naoki Abe, and Bianca Zadrozny. Sequential cost-sensitive decision making with reinforcement learning. In Proceedings of the eighth ACM SIGKDD international conference on Knowledge discovery and data mining, pp. 259–268. ACM, 2002.
|
| 326 |
+
|
| 327 |
+
Jing Peng and Ronald J Williams. Incremental multi-step Q-learning. Machine Learning, 22(1-3): 283–290, 1996.
|
| 328 |
+
|
| 329 |
+
Jan Peters, Katharina Mulling, and Yasemin Altun. Relative entropy policy search. In ¨ AAAI. Atlanta, 2010.
|
| 330 |
+
|
| 331 |
+
Martin Riedmiller. Neural fitted Q iteration–first experiences with a data efficient neural reinforcement learning method. In Machine Learning: ECML 2005, pp. 317–328. Springer Berlin Heidelberg, 2005.
|
| 332 |
+
|
| 333 |
+
Gavin A Rummery and Mahesan Niranjan. On-line Q-learning using connectionist systems. 1994.
|
| 334 |
+
|
| 335 |
+
Brian Sallans and Geoffrey E Hinton. Reinforcement learning with factored states and actions. Journal of Machine Learning Research, 5(Aug):1063–1088, 2004.
|
| 336 |
+
|
| 337 |
+
Tom Schaul, John Quan, Ioannis Antonoglou, and David Silver. Prioritized experience replay. arXiv preprint arXiv:1511.05952, 2015.
|
| 338 |
+
|
| 339 |
+
John Schulman, Sergey Levine, Pieter Abbeel, Michael Jordan, and Philipp Moritz. Trust region policy optimization. In Proceedings of The 32nd International Conference on Machine Learning, pp. 1889–1897, 2015.
|
| 340 |
+
|
| 341 |
+
David Silver, Guy Lever, Nicolas Heess, Thomas Degris, Daan Wierstra, and Martin Riedmiller. Deterministic policy gradient algorithms. In Proceedings of the 31st International Conference on Machine Learning (ICML), pp. 387–395, 2014.
|
| 342 |
+
|
| 343 |
+
David Silver, Aja Huang, Chris J Maddison, Arthur Guez, Laurent Sifre, George Van Den Driessche, Julian Schrittwieser, Ioannis Antonoglou, Veda Panneershelvam, Marc Lanctot, et al. Mastering the game of go with deep neural networks and tree search. Nature, 529(7587):484–489, 2016.
|
| 344 |
+
|
| 345 |
+
R. Sutton and A. Barto. Reinforcement Learning: an Introduction. MIT Press, 1998.
|
| 346 |
+
|
| 347 |
+
Richard S Sutton. Learning to predict by the methods of temporal differences. Machine learning, 3 (1):9–44, 1988.
|
| 348 |
+
|
| 349 |
+
Richard S Sutton, David A McAllester, Satinder P Singh, Yishay Mansour, et al. Policy gradient methods for reinforcement learning with function approximation. In Advances in Neural Information Processing Systems, volume 99, pp. 1057–1063, 1999.
|
| 350 |
+
|
| 351 |
+
Gerald Tesauro. Temporal difference learning and TD-Gammon. Communications of the ACM, 38 (3):58–68, 1995.
|
| 352 |
+
|
| 353 |
+
Philip Thomas. Bias in natural actor-critic algorithms. In Proceedings of The 31st International Conference on Machine Learning, pp. 441–448, 2014.
|
| 354 |
+
|
| 355 |
+
Hado Van Hasselt, Arthur Guez, and David Silver. Deep reinforcement learning with double Qlearning. In Proceedings of the Thirtieth AAAI Conference on Artificial Intelligence (AAAI-16), pp. 2094–2100, 2016.
|
| 356 |
+
|
| 357 |
+
Harm Van Seijen, Hado Van Hasselt, Shimon Whiteson, and Marco Wiering. A theoretical and empirical analysis of expected sarsa. In 2009 IEEE Symposium on Adaptive Dynamic Programming and Reinforcement Learning, pp. 177–184. IEEE, 2009.
|
| 358 |
+
|
| 359 |
+
Yin-Hao Wang, Tzuu-Hseng S Li, and Chih-Jui Lin. Backward q-learning: The combination of sarsa algorithm and q-learning. Engineering Applications of Artificial Intelligence, 26(9):2184–2193, 2013.
|
| 360 |
+
|
| 361 |
+
Ziyu Wang, Tom Schaul, Matteo Hessel, Hado van Hasselt, Marc Lanctot, and Nando de Freitas. Dueling network architectures for deep reinforcement learning. In Proceedings of the 33rd International Conference on Machine Learning (ICML), pp. 1995–2003, 2016.
|
| 362 |
+
|
| 363 |
+
Christopher John Cornish Hellaby Watkins. Learning from delayed rewards. PhD thesis, University of Cambridge England, 1989.
|
| 364 |
+
|
| 365 |
+
Ronald J Williams. Simple statistical gradient-following algorithms for connectionist reinforcement learning. Machine learning, 8(3-4):229–256, 1992.
|
| 366 |
+
|
| 367 |
+
Ronald J Williams and Jing Peng. Function optimization using connectionist reinforcement learning algorithms. Connection Science, 3(3):241–268, 1991.
|
| 368 |
+
|
| 369 |
+
# A PGQL BELLMAN RESIDUAL
|
| 370 |
+
|
| 371 |
+
Here we demonstrate that in the tabular case the Bellman residual of the induced Q-values for the PGQL updates of (14) converges to zero as the temperature $\alpha$ decreases, which is the same guarantee as vanilla regularized policy gradient (2). We will use the notation that $\pi _ { \alpha }$ is the policy at the fixed point of PGQL updates (14) for some $\alpha$ , i.e., $\pi _ { \alpha } \propto \exp ( \tilde { Q } ^ { \pi _ { \alpha } } )$ , with induced Q-value function $Q ^ { \pi _ { \alpha } }$ .
|
| 372 |
+
|
| 373 |
+
First, note that we can apply the same argument as in $\ S 3 . 4$ to show that $\begin{array} { r l } { { \operatorname* { l i m } _ { \alpha \to 0 } \| T ^ { \star } \tilde { Q } ^ { \pi _ { \alpha } } - } } \end{array}$ $\mathcal { T } ^ { \pi _ { \alpha } } \tilde { Q } ^ { \pi _ { \alpha } } \| \ = \ 0$ (the only difference is that we lack the property that ${ \tilde { Q } } ^ { \pi _ { \alpha } }$ is the fixed point of $\mathcal { T } ^ { \pi _ { \alpha } } )$ . Secondly, from equation (15) we can write $\tilde { Q } ^ { \pi _ { \alpha } } - Q ^ { \pi _ { \alpha } } = \eta ( { \cal T } ^ { \star } \tilde { Q } ^ { \pi _ { \alpha } } - Q ^ { \pi _ { \alpha } } )$ . Combining these two facts we have
|
| 374 |
+
|
| 375 |
+
$$
|
| 376 |
+
\begin{array} { r c l } { \| \tilde { Q } ^ { \pi _ { \alpha } } - Q ^ { \pi _ { \alpha } } \| } & { = } & { \eta \| { \cal T } ^ { \star } \tilde { Q } ^ { \pi _ { \alpha } } - Q ^ { \pi _ { \alpha } } \| } \\ & { = } & { \eta \| { \cal T } ^ { \star } \tilde { Q } ^ { \pi _ { \alpha } } - { \cal T } ^ { \pi _ { \alpha } } \tilde { Q } ^ { \pi _ { \alpha } } + { \cal T } ^ { \pi _ { \alpha } } \tilde { Q } ^ { \pi _ { \alpha } } - { Q } ^ { \pi _ { \alpha } } \| } \\ & { \leq } & { \eta ( \| { \cal T } ^ { \star } \tilde { Q } ^ { \pi _ { \alpha } } - { \cal T } ^ { \pi _ { \alpha } } \tilde { Q } ^ { \pi _ { \alpha } } \| + \| { \cal T } ^ { \pi _ { \alpha } } \tilde { Q } ^ { \pi _ { \alpha } } - { \cal T } ^ { \pi _ { \alpha } } Q ^ { \pi _ { \alpha } } \| ) } \\ & { \leq } & { \eta ( \| { \cal T } ^ { \star } \tilde { Q } ^ { \pi _ { \alpha } } - { \cal T } ^ { \pi _ { \alpha } } \tilde { Q } ^ { \pi _ { \alpha } } \| + \gamma \| \tilde { Q } ^ { \pi _ { \alpha } } - Q ^ { \pi _ { \alpha } } \| ) } \\ & { \leq } & { \eta / ( 1 - \eta \gamma ) \| { \cal T } ^ { \star } \tilde { Q } ^ { \pi _ { \alpha } } - { \cal T } ^ { \pi _ { \alpha } } \tilde { Q } ^ { \pi _ { \alpha } } \| , } \end{array}
|
| 377 |
+
$$
|
| 378 |
+
|
| 379 |
+
and so $\| \tilde { Q } ^ { \pi _ { \alpha } } - Q ^ { \pi _ { \alpha } } \| \to 0$ as $\alpha 0$ . Using this fact we have
|
| 380 |
+
|
| 381 |
+
$$
|
| 382 |
+
\begin{array} { r l } { \| T ^ { \star } \hat { Q } ^ { \pi _ { \alpha } } - \hat { Q } ^ { \pi _ { \alpha } } \| } & { = \| T ^ { \star } \hat { Q } ^ { \pi _ { \alpha } } - { \mathcal T } ^ { \pi _ { \alpha } } \hat { Q } ^ { \pi _ { \alpha } } + { \mathcal T } ^ { \pi _ { \alpha } } \hat { Q } ^ { \pi _ { \alpha } } - { Q } ^ { \pi _ { \alpha } } + { Q } ^ { \pi _ { \alpha } } - \tilde { Q } ^ { \pi _ { \alpha } } \| } \\ & { \leq \| { \mathcal T } ^ { \star } \tilde { Q } ^ { \pi _ { \alpha } } - { \mathcal T } ^ { \pi _ { \alpha } } \tilde { Q } ^ { \pi _ { \alpha } } \| + \| T ^ { \pi _ { \alpha } } \tilde { Q } ^ { \pi _ { \alpha } } - { \mathcal T } ^ { \pi _ { \alpha } } { Q } ^ { \pi _ { \alpha } } \| + \| { Q } ^ { \pi _ { \alpha } } - \tilde { Q } ^ { \pi _ { \alpha } } \| } \\ & { \leq \| { \mathcal T } ^ { \star } \tilde { Q } ^ { \pi _ { \alpha } } - { \mathcal T } ^ { \pi _ { \alpha } } \tilde { Q } ^ { \pi _ { \alpha } } \| + ( 1 + \gamma ) \| \tilde { Q } ^ { \pi _ { \alpha } } - { Q } ^ { \pi _ { \alpha } } \| } \\ & { < 3 / ( 1 - \eta \gamma ) \| { T } ^ { \star } \tilde { Q } ^ { \pi _ { \alpha } } - { \mathcal T } ^ { \pi _ { \alpha } } \tilde { Q } ^ { \pi _ { \alpha } } \| , } \end{array}
|
| 383 |
+
$$
|
| 384 |
+
|
| 385 |
+
which therefore also converges to zero in the limit. Finally we obtain
|
| 386 |
+
|
| 387 |
+
$$
|
| 388 |
+
\begin{array} { r l r } { \| T ^ { \star } Q ^ { \pi _ { \alpha } } - Q ^ { \pi _ { \alpha } } \| } & { = } & { \| T ^ { \star } Q ^ { \pi _ { \alpha } } - T ^ { \star } \tilde { Q } ^ { \pi _ { \alpha } } + T ^ { \star } \tilde { Q } ^ { \pi _ { \alpha } } - \tilde { Q } ^ { \pi _ { \alpha } } + \tilde { Q } ^ { \pi _ { \alpha } } - Q ^ { \pi _ { \alpha } } \| } \\ & { \leq } & { \| T ^ { \star } Q ^ { \pi _ { \alpha } } - T ^ { \star } \tilde { Q } ^ { \pi _ { \alpha } } \| + \| T ^ { \star } \tilde { Q } ^ { \pi _ { \alpha } } - \tilde { Q } ^ { \pi _ { \alpha } } \| + \| \tilde { Q } ^ { \pi _ { \alpha } } - Q ^ { \pi _ { \alpha } } \| } \\ & { \leq } & { ( 1 + \gamma ) \| \tilde { Q } ^ { \pi _ { \alpha } } - Q ^ { \pi _ { \alpha } } \| + \| T ^ { \star } \tilde { Q } ^ { \pi _ { \alpha } } - \tilde { Q } ^ { \pi _ { \alpha } } \| , } \end{array}
|
| 389 |
+
$$
|
| 390 |
+
|
| 391 |
+
which combined with the two previous results implies that $\begin{array} { r } { \operatorname* { l i m } _ { \alpha \to 0 } \| T ^ { \star } Q ^ { \pi _ { \alpha } } - Q ^ { \pi _ { \alpha } } \| = 0 } \end{array}$ , as before.
|
| 392 |
+
|
| 393 |
+
B ATARI SCORES
|
| 394 |
+
|
| 395 |
+
Table 3: Normalized scores for the Atari suite from random starts, as a percentage of human normalized score.
|
| 396 |
+
|
| 397 |
+
<table><tr><td rowspan="2">Game</td><td rowspan="2">A3C</td><td rowspan="2">Q-learning</td><td rowspan="2">PGQL</td></tr><tr><td>25.53</td></tr><tr><td>alien</td><td>38.43 68.69</td><td>12.29</td><td>46.70 71.00</td></tr><tr><td>amidar</td><td></td><td></td><td>2802.87</td></tr><tr><td>assault</td><td>854.64</td><td>1695.21</td><td></td></tr><tr><td>asterix</td><td>191.69</td><td>98.53</td><td>3790.08</td></tr><tr><td>asteroids</td><td>24.37</td><td>5.32</td><td>50.23</td></tr><tr><td>atlantis</td><td>15496.01</td><td>13635.88</td><td>16217.49</td></tr><tr><td>bank heist</td><td>210.28</td><td>91.80</td><td>212.15</td></tr><tr><td>battle zone</td><td>21.63</td><td>2.89</td><td>52.00</td></tr><tr><td>beam rider</td><td>59.55</td><td>79.94</td><td>155.71</td></tr><tr><td>berzerk</td><td>79.38</td><td>55.55</td><td>92.85</td></tr><tr><td>bowling</td><td>2.70</td><td>-7.09</td><td>3.85</td></tr><tr><td>boxing</td><td>510.30</td><td>299.49</td><td>902.77</td></tr><tr><td>breakout</td><td>2341.13</td><td>3291.22</td><td>2959.16</td></tr><tr><td>centipede</td><td>50.22</td><td>105.98</td><td>73.88</td></tr><tr><td>chopper command</td><td>61.13</td><td>19.18</td><td>162.93</td></tr><tr><td>crazy climber</td><td>510.25</td><td>189.01</td><td>476.11</td></tr><tr><td>defender</td><td>475.93</td><td>58.94</td><td>911.13</td></tr><tr><td>demon attack</td><td>4027.57</td><td>3449.27</td><td>3994.49</td></tr><tr><td>double dunk</td><td>1250.00</td><td>91.35</td><td>1375.00</td></tr><tr><td>enduro</td><td>9.94</td><td>9.94</td><td>9.94</td></tr><tr><td>fishing derby</td><td>140.84</td><td>-14.48</td><td>145.57</td></tr><tr><td>freeway</td><td>-0.26</td><td>-0.13</td><td>-0.13</td></tr><tr><td>frostbite</td><td>5.85</td><td>10.71</td><td>5.71</td></tr><tr><td>gopher</td><td>429.76</td><td>9131.97</td><td>2060.41</td></tr><tr><td>gravitar</td><td>0.71</td><td>1.35</td><td>1.74</td></tr><tr><td>hero</td><td>145.71</td><td>15.47</td><td>92.88</td></tr><tr><td>ice hockey</td><td>62.25</td><td>21.57</td><td>76.96</td></tr><tr><td>jamesbond</td><td>133.90</td><td>110.97</td><td>142.08</td></tr><tr><td>kangaroo</td><td>-0.94</td><td>-0.94</td><td>-0.75</td></tr><tr><td>krull</td><td>736.30</td><td>3586.30</td><td>557.44</td></tr><tr><td>kung fu master</td><td>182.34</td><td>260.14</td><td>254.42</td></tr><tr><td>montezuma revenge</td><td>-0.49</td><td>1.80</td><td>-0.48</td></tr><tr><td>ms pacman</td><td>17.91</td><td>10.71</td><td>25.76</td></tr><tr><td>name this game</td><td>102.01</td><td>113.89</td><td>188.90</td></tr><tr><td>phoenix</td><td>447.05</td><td>812.99</td><td>1507.07</td></tr><tr><td>pitfall</td><td>5.48</td><td>5.49 24.96</td><td>5.49 116.37</td></tr><tr><td>pong</td><td>116.37 -0.88</td><td>0.03</td><td>-0.04</td></tr><tr><td>private eye</td><td></td><td></td><td></td></tr><tr><td>qbert riverraid</td><td>186.91</td><td>159.71</td><td>136.17</td></tr><tr><td></td><td>107.25</td><td>65.01</td><td>128.63</td></tr><tr><td>road runner robotank</td><td>603.11 15.71</td><td>179.69</td><td>519.51</td></tr><tr><td></td><td></td><td>134.87</td><td>71.50</td></tr><tr><td>seaquest</td><td>3.81</td><td>3.71</td><td>5.88</td></tr><tr><td>skiing solaris</td><td>54.27</td><td>54.10</td><td>54.16</td></tr><tr><td>space invaders</td><td>27.05</td><td>34.61</td><td>28.66</td></tr><tr><td></td><td>188.65</td><td>146.39</td><td>608.44</td></tr><tr><td>star gunner</td><td>756.60</td><td>205.70</td><td>977.99</td></tr><tr><td>surround</td><td>28.29</td><td>-1.51</td><td>78.15</td></tr><tr><td>tennis</td><td>145.58</td><td>-15.35</td><td>145.58</td></tr><tr><td>time pilot</td><td>270.74</td><td>91.59</td><td>438.50</td></tr><tr><td>tutankham</td><td>224.76</td><td>110.11</td><td>239.58</td></tr><tr><td>up n down</td><td>1637.01</td><td>148.10</td><td>1484.43</td></tr><tr><td>venture</td><td>-1.76</td><td>-1.76</td><td>-1.76</td></tr><tr><td>video pinball</td><td>3007.37</td><td>4325.02</td><td>4743.68</td></tr><tr><td>wizard of wor</td><td>150.52</td><td>88.07</td><td>325.39</td></tr><tr><td>yars revenge</td><td>81.54</td><td>23.39</td><td>252.83</td></tr><tr><td>zaxxon</td><td>4.01</td><td>44.11</td><td>224.89</td></tr></table>
|
md/train/BJDEbngCZ/BJDEbngCZ.md
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
md/train/BJg866NFvB/BJg866NFvB.md
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
md/train/BJrFC6ceg/BJrFC6ceg.md
ADDED
|
@@ -0,0 +1,170 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# PIXELCNN++: IMPROVING THE PIXELCNN WITH DISCRETIZED LOGISTIC MIXTURE LIKELIHOOD AND OTHER MODIFICATIONS
|
| 2 |
+
|
| 3 |
+
Tim Salimans, Andrej Karpathy, Xi Chen, Diederik P. Kingma {tim,karpathy,peter,dpkingma}@openai.com
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
PixelCNNs are a recently proposed class of powerful generative models with tractable likelihood. Here we discuss our implementation of PixelCNNs which we make available at https://github.com/openai/pixel-cnn. Our implementation contains a number of modifications to the original model that both simplify its structure and improve its performance. 1) We use a discretized logistic mixture likelihood on the pixels, rather than a 256-way softmax, which we find to speed up training. 2) We condition on whole pixels, rather than R/G/B sub-pixels, simplifying the model structure. 3) We use downsampling to efficiently capture structure at multiple resolutions. 4) We introduce additional short-cut connections to further speed up optimization. 5) We regularize the model using dropout. Finally, we present state-of-the-art log likelihood results on CIFAR-10 to demonstrate the usefulness of these modifications.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
The PixelCNN, introduced by van den Oord et al. (2016b), is a generative model of images with a tractable likelihood. The model fully factorizes the probability density function on an image $\mathbf { x }$ over all its sub-pixels (color channels in a pixel) as $\begin{array} { r } { p ( \mathbf { x } ) = \prod _ { i } p ( x _ { i } | \boldsymbol { x } _ { < i } ) } \end{array}$ . The conditional distributions $p ( x _ { i } | \boldsymbol x _ { < i } )$ are parameterized by convolutional neural networks and all share parameters. The PixelCNN is a powerful model as the functional form of these conditionals is very flexible. In addition it is computationally efficient as all conditionals can be evaluated in parallel on a GPU for an observed image $\mathbf { x }$ . Thanks to these properties, the PixelCNN represents the current state-of-the-art in generative modeling when evaluated in terms of log-likelihood. Besides being used for modeling images, the PixelCNN model was recently extended to model audio (van den Oord et al., 2016a), video (Kalchbrenner et al., 2016b) and text (Kalchbrenner et al., 2016a).
|
| 12 |
+
|
| 13 |
+
For use in our research, we developed our own internal implementation of PixelCNN and made a number of modifications to the base model to simplify its structure and improve its performance. We now release our implementation at https://github.com/openai/pixel-cnn, hoping that it will be useful to the broader community. Our modifications are discussed in Section 2, and evaluated experimentally in Section 3. State-of-the-art log-likelihood results confirm their usefulness.
|
| 14 |
+
|
| 15 |
+
# 2 MODIFICATIONS TO PIXELCNN
|
| 16 |
+
|
| 17 |
+
We now describe the most important modifications we have made to the PixelCNN model architecure as described by van den Oord et al. (2016c). For complete details see our code release at https://github.com/openai/pixel-cnn.
|
| 18 |
+
|
| 19 |
+
# 2.1 DISCRETIZED LOGISTIC MIXTURE LIKELIHOOD
|
| 20 |
+
|
| 21 |
+
The standard PixelCNN model specifies the conditional distribution of a sub-pixel, or color channel of a pixel, as a full 256-way softmax. This gives the model a lot of flexibility, but it is also very costly in terms of memory. Moreover, it can make the gradients with respect to the network parameters very sparse, especially early in training. With the standard parameterization, the model does not know that a value of 128 is close to a value of 127 or 129, and this relationship first has to be learned before the model can move on to higher level structures. In the extreme case where a particular sub-pixel value is never observed, the model will learn to assign it zero probability. This would be especially problematic for data with higher accuracy on the observed pixels than the usual 8 bits: In the extreme case where very high precision values are observed, the PixelCNN, in its current form, would require a prohibitive amount of memory and computation, while learning very slowly. We therefore propose a different mechanism for computing the conditional probability of the observed discretized pixel values. In our model, like in the VAE of Kingma et al. (2016), we assume there is a latent color intensity $\nu$ with a continuous distribution, which is then rounded to its nearest 8-bit representation to give the observed sub-pixel value $x$ . By choosing a simple continuous distribution for modeling $\nu$ (like the logistic distribution as done by Kingma et al. (2016)) we obtain a smooth and memory efficient predictive distribution for $x$ . Here, we take this continuous univariate distribution to be a mixture of logistic distributions which allows us to easily calculate the probability on the observed discretized value $x$ , as shown in equation (2). For all sub-pixel values $x$ excepting the edge cases 0 and 255 we have:
|
| 22 |
+
|
| 23 |
+
$$
|
| 24 |
+
\begin{array} { l l l } { \displaystyle \nu } & { \sim } & { \displaystyle \sum _ { i = 1 } ^ { K } \pi _ { i } \mathrm { l o g i s t i c } ( \mu _ { i } , s _ { i } ) } \\ { P ( x | \pi , \mu , s ) } & { = } & { \displaystyle \sum _ { i = 1 } ^ { K } \pi _ { i } \left[ \sigma ( ( x + 0 . 5 - \mu _ { i } ) / s _ { i } ) - \sigma ( ( x - 0 . 5 - \mu _ { i } ) / s _ { i } ) \right] , } \end{array}
|
| 25 |
+
$$
|
| 26 |
+
|
| 27 |
+
where $\sigma ( )$ is the logistic sigmoid function. For the edge case of 0, replace $x - 0 . 5$ by $- \infty$ , and for 255 replace $x + 0 . 5$ by $+ \infty$ . Our provided code contains a numerically stable implementation for calculating the log of the probability in equation 2.
|
| 28 |
+
|
| 29 |
+
Our approach follows earlier work using continuous mixture models (Domke et al., 2008; Theis et al., 2012; Uria et al., 2013; Theis & Bethge, 2015), but avoids allocating probability mass to values outside the valid range of [0, 255] by explicitly modeling the rounding of $\nu$ to $x$ . In addition, we naturally assign higher probability to the edge values 0 and 255 than to their neighboring values, which corresponds well with the observed data distribution as shown in Figure 1. Experimentally, we find that only a relatively small number of mixture components, say 5, is needed to accurately model the conditional distributions of the pixels. The output of our network is thus of much lower dimension, yielding much denser gradients of the loss with respect to our parameters. In our experiments this greatly sped up convergence during optimization, especially early on in training. However, due to the other changes in our architecture compared to that of van den Oord et al. (2016c) we cannot say with certainty that this would also apply to the original PixelCNN model.
|
| 30 |
+
|
| 31 |
+

|
| 32 |
+
Figure 1: Marginal distribution of all sub-pixel values in CIFAR-10. The edge value of 255 is much more frequent than its neighbouring values: This is easy to model using our rounding based approach, but harder using continuous or truncated distributions.
|
| 33 |
+
|
| 34 |
+
# 2.2 CONDITIONING ON WHOLE PIXELS
|
| 35 |
+
|
| 36 |
+
The pixels in a color image consist of three real numbers, giving the intensities of the red, blue and green colors. The original PixelCNN factorizes the generative model over these 3 sub-pixels. This allows for very general dependency structure, but it also complicates the model: besides keeping track of the spatial location of feature maps, we now have to separate out all feature maps in 3 groups depending on whether or not they can see the R/G/B sub-pixel of the current location. This added complexity seems to be unnecessary as the dependencies between the color channels of a pixel are likely to be relatively simple and do not require a deep network to model. Therefore, we instead condition only on whole pixels up and to the left in an image, and output joint predictive distributions over all 3 channels of a predicted pixel. The predictive distribution on a pixel itself can be interpreted as a simple factorized model: We first predict the red channel using a discretized mixture of logistics as described in section 2.1. Next, we predict the green channel using a predictive distribution of the same form. Here we allow the means of the mixture components to linearly depend on the value of the red sub-pixel. Finally, we model the blue channel in the same way, where we again only allow linear dependency on the red and green channels. For the pixel $( r _ { i , j } , g _ { i , j } , b _ { i , j } )$ at location $( i , j )$ in our image, the distribution conditional on the context $C _ { i , j }$ , consisting of the mixture indicator and the previous pixels, is thus
|
| 37 |
+
|
| 38 |
+
$$
|
| 39 |
+
\begin{array} { r c l } { p ( r _ { i , j } , g _ { i , j } , b _ { i , j } | C _ { i , j } ) } & { = } & { P ( r _ { i , j } | \mu _ { r } ( C _ { i , j } ) , s _ { r } ( C _ { i , j } ) ) \times P ( g _ { i , j } | \mu _ { g } ( C _ { i , j } , r _ { i , j } ) , s _ { g } ( C _ { i , j } ) ) } \\ & & { \times P ( b _ { i , j } | \mu _ { b } ( C _ { i , j } , r _ { i , j } , g _ { i , j } ) , s _ { b } ( C _ { i , j } ) ) } \\ { \mu _ { g } ( C _ { i , j } , r _ { i , j } ) } & { = } & { \mu _ { g } ( C _ { i , j } ) + \alpha ( C _ { i , j } ) r _ { i , j } } \\ { \mu _ { b } ( C _ { i , j } , r _ { i , j } , g _ { i , j } ) } & { = } & { \mu _ { b } ( C _ { i , j } ) + \beta ( C _ { i , j } ) r _ { i , j } + \gamma ( C _ { i , j } ) b _ { i , j } , } \end{array}
|
| 40 |
+
$$
|
| 41 |
+
|
| 42 |
+
with $\alpha , \beta , \gamma$ scalar coefficients depending on the mixture component and previous pixels.
|
| 43 |
+
|
| 44 |
+
The mixture indicator is shared across all 3 channels; i.e. our generative model first samples a mixture indicator for a pixel, and then samples the color channels one-by-one from the corresponding mixture component. Had we used a discretized mixture of univariate Gaussians for the sub-pixels, instead of logistics, this would have been exactly equivalent to predicting the complete pixel using a (discretized) mixture of 3-dimensional Gaussians with full covariance. The logistic and Gaussian distributions are very similar, so this is indeed very close to what we end up doing. For full implementation details we refer to our code at https://github.com/openai/pixel-cnn.
|
| 45 |
+
|
| 46 |
+
# 2.3 DOWNSAMPLING VERSUS DILATED CONVOLUTION
|
| 47 |
+
|
| 48 |
+
The original PixelCNN only uses convolutions with small receptive field. Such convolutions are good at capturing local dependencies, but not necessarily at modeling long range structure. Although we find that capturing these short range dependencies is often enough for obtaining very good log-likelihood scores (see Table 2), explicitly encouraging the model to capture long range dependencies can improve the perceptual quality of generated images (compare Figure 3 and Figure 5). One way of allowing the network to model structure at multiple resolutions is to introduce dilated convolutions into the model, as proposed by van den Oord et al. (2016a) and Kalchbrenner et al. (2016b). Here, we instead propose to use downsampling by using convolutions of stride 2. Downsampling accomplishes the same multi-resolution processing afforded by dilated convolutions, but at a reduced computational cost: where dilated convolutions operate on input of ever increasing size (due to zero padding), downsampling reduces the input size by a factor of 4 (for stride of 2 in 2 dimensions) at every downsampling. The downside of using downsampling is that it loses information, but we can compensate for this by introducing additional short-cut connections into the network as explained in the next section. With these additional short-cut connections, we found the performance of downsampling to be the same as for dilated convolution.
|
| 49 |
+
|
| 50 |
+
# 2.4 ADDING SHORT-CUT CONNECTIONS
|
| 51 |
+
|
| 52 |
+
For input of size $3 2 \times 3 2$ our suggested model consists of 6 blocks of 5 ResNet layers. In between the first and second block, as well as the second and third block, we perform subsampling by strided convolution. In between the fourth and fifth block, as well as the fifth and sixth block, we perform upsampling by transposed strided convolution. This subsampling and upsampling process loses information, and we therefore introduce additional short-cut connections into the model to recover this information from lower layers in the model. The short-cut connections run from the ResNet layers in the first block to the corresponding layers in the sixth block, and similarly between blocks two and five, and blocks three and four. This structure resembles the VAE model with top down inference used by Kingma et al. (2016), as well as the U-net used by Ronneberger et al. (2015) for image segmentation. Figure 2 shows our model structure graphically.
|
| 53 |
+
|
| 54 |
+

|
| 55 |
+
Figure 2: Like van den Oord et al. (2016c), our model follows a two-stream (downward, and downward+rightward) convolutional architecture with residual connections; however, there are two significant differences in connectivity. First, our architecture incorporates downsampling and upsampling, such that the inner parts of the network operate over larger spatial scale, increasing computational efficiency. Second, we employ long-range skip-connections, such that each $k$ -th layer provides a direct input to the $( K - k )$ -th layer, where $K$ is the total number of layers in the network. The network is grouped into sequences of six layers, where most sequences are separated by downsampling or upsampling.
|
| 56 |
+
|
| 57 |
+
# 2.5 REGULARIZATION USING DROPOUT
|
| 58 |
+
|
| 59 |
+
The PixelCNN model is powerful enough to overfit on training data. Moreover, rather than just reproducing the training images, we find that overfitted models generate images of low perceptual quality, as shown in Figure 8. One effective way of regularizing neural networks is dropout (Srivastava et al., 2014). For our model, we apply standard binary dropout on the residual path after the first convolution. This is similar to how dropout is applied in the wide residual networks of Zagoruyko & Komodakis (2016). Using dropout allows us to successfully train high capacity models while avoiding overfitting and producing high quality generations (compare figure 8 and figure 3).
|
| 60 |
+
|
| 61 |
+
# 3 EXPERIMENTS
|
| 62 |
+
|
| 63 |
+
We apply our model to modeling natural images in the CIFAR-10 data set. We achieve state-of-theart results in terms of log-likelihood, and generate images with coherent global structure.
|
| 64 |
+
|
| 65 |
+
# 3.1 UNCONDITIONAL GENERATION ON CIFAR-10
|
| 66 |
+
|
| 67 |
+
We apply our PixelCNN model, with the modifications as described above, to generative modeling of the images in the CIFAR-10 data set. For the encoding part of the PixelCNN, the model uses 3 Resnet blocks consisting of 5 residual layers, with $2 \times 2$ downsampling in between. The same architecture is used for the decoding part of the model, but with upsampling instead of downsampling in between blocks. All residual layers use 192 feature maps and a dropout rate of 0.5. Table 1 shows the stateof-the-art test log-likelihood obtained by our model. Figure 3 shows some samples generated by the model.
|
| 68 |
+
|
| 69 |
+

|
| 70 |
+
|
| 71 |
+
Figure 3: Samples from our PixelCNN model trained on CIFAR-10.
|
| 72 |
+
Table 1: Negative log-likelihood for generative models on CIFAR-10 expressed as bits per sub-pixel.
|
| 73 |
+
|
| 74 |
+
<table><tr><td>Model</td><td>Bits per sub-pixel</td></tr><tr><td>Deep Diffusion (Sohl-Dickstein et al.,2015)</td><td>5.40</td></tr><tr><td>NICE (Dinh et al., 2014)</td><td>4.48</td></tr><tr><td>DRAW (Gregor et al., 2015)</td><td>4.13</td></tr><tr><td>Deep GMMs (van den Oord & Dambre,2015)</td><td>4.00</td></tr><tr><td>Conv DRAW (Gregor et al.,2016)</td><td>3.58</td></tr><tr><td>Real NVP (Dinh et al., 2016)</td><td>3.49</td></tr><tr><td>PixelCNN (van den Oord et al., 2016b)</td><td>3.14</td></tr><tr><td>VAE with IAF (Kingma et al., 2016)</td><td>3.11</td></tr><tr><td>Gated PixelCNN(van den Oord et al.,2016c)</td><td>3.03</td></tr><tr><td>PixelRNN (van den Oord et al., 2016b)</td><td>3.00</td></tr><tr><td>PixelCNN++</td><td>2.92</td></tr></table>
|
| 75 |
+
|
| 76 |
+
# 3.2 CLASS-CONDITIONAL GENERATION
|
| 77 |
+
|
| 78 |
+
Next, we follow van den Oord et al. (2016c) in making our generative model conditional on the class-label of the CIFAR-10 images. This is done by linearly projecting a one-hot encoding of the class-label into a separate class-dependent bias vector for each convolutional unit in our network. We find that making the model class-conditional makes it harder to avoid overfitting on the training data: our best test log-likelihood is 2.94 in this case. Figure 4 shows samples from the class-conditional model, with columns 1-10 corresponding the 10 classes in CIFAR-10. The images clearly look qualitatively different across the columns and for a number of them we can clearly identify their class label.
|
| 79 |
+
|
| 80 |
+

|
| 81 |
+
Figure 4: Class-conditional samples from our PixelCNN for CIFAR-10 (left) and real CIFAR-10 images for comparison (right).
|
| 82 |
+
|
| 83 |
+
# 3.3 EXAMINING NETWORK DEPTH AND FIELD OF VIEW SIZE
|
| 84 |
+
|
| 85 |
+
It is hypothesized that the size of the receptive field and additionally the removal of blind spots in the receptive field are important for PixelCNN’s performance (van den Oord et al., 2016b). Indeed van den Oord et al. (2016c) specifically introduced an improvement over the previous PixelCNN model to remove the blind spot in the receptive field that was present in their earlier model.
|
| 86 |
+
|
| 87 |
+
Here we present the surprising finding that in fact a PixelCNN with rather small receptive field can attain competitive generative modelling performance on CIFAR-10 as long as it has enough capacity. Specifically, we experimented with our proposed PixelC $\mathrm { N N } { + } { + }$ model without downsampling blocks and reduce the number of layers to limit the receptive field size. We investigate two receptive field sizes: 11x5 and $1 5 \mathrm { x } 8$ , and a receptive field size of 11x5, for example, means that the conditional distribution of a pixel can depends on a rectangle above the pixel of size 11x5 as well as $\frac { 1 1 - 1 } { 2 } = 5 \mathrm { x } 1$ block to the left of the pixel.
|
| 88 |
+
|
| 89 |
+
As we limit the size of the receptive field, the capacity of the network also drops significantly since it contains many fewer layers than a normal PixelCNN. We call the type of PixelCNN that’s simply limited in depth “Plain” Small PixelCNN. Interestingly, this model already has better performance than the original PixelCNN in van den Oord et al. (2016b) which had a blind spot. To increase capacity, we introduced two simple variants that make Small PixelCNN more expressive without growing the receptive field:
|
| 90 |
+
|
| 91 |
+
• NIN (Network in Network): insert additional gated ResNet blocks with 1x1 convolution between regular convolution blocks that grow receptive field. In this experiment, we inserted 3 NIN blocks between every other layer.
|
| 92 |
+
• Autoregressive Channel: skip connections between sets of channels via 1x1 convolution gated ResNet block.
|
| 93 |
+
|
| 94 |
+
Both modifications increase the capacity of the network, resulting in improved log-likelihood as shown in Table 2. Although the model with small receptive field already achieves an impressive likelihood score, its samples do lack global structure, as seen in Figure 5.
|
| 95 |
+
|
| 96 |
+
Table 2: CIFAR-10 bits per sub-pixel for Small PixelCNN
|
| 97 |
+
|
| 98 |
+
<table><tr><td>Model</td><td>Bits per sub-pixel</td></tr><tr><td>Field=11x5,Plain</td><td>3.11</td></tr><tr><td>Field=11x5,NIN</td><td>3.09</td></tr><tr><td>Field=11x5,Autoregressive Channel</td><td>3.07</td></tr><tr><td>Field=15x8,Plain</td><td>3.07</td></tr><tr><td>Field=15x8,NIN</td><td>3.04</td></tr><tr><td>Field=15x8,Autoregressive Channel</td><td>3.03</td></tr></table>
|
| 99 |
+
|
| 100 |
+

|
| 101 |
+
Figure 5: Samples from 3.03 bits/dim Small PixelCNN
|
| 102 |
+
|
| 103 |
+
# 3.4 ABLATION EXPERIMENTS
|
| 104 |
+
|
| 105 |
+
In order to test the effect of our modifications to PixelCNN, we run a number of ablation experiments where for each experiment we remove a specific modification.
|
| 106 |
+
|
| 107 |
+
# 3.4.1 SOFTMAX LIKELIHOOD INSTEAD OF DISCRETIZED LOGISTIC MIXTURE
|
| 108 |
+
|
| 109 |
+
In order to test the contribution of our logistic mixture likelihood, we re-run our CIFAR-10 experiment with the 256-way softmax as the output distribution instead. We allow the 256 logits for each sub-pixel to linearly depend on the observed value of previous sub-pixels, with coefficients that are given as output by the model. Our model with softmax likelihood is thus strictly more flexible than our model with logistic mixture likelihood, although the parameterization is quite different from that used by van den Oord et al. (2016c). The model now outputs 1536 numbers per pixel, describing the logits on the 256 potential values for each sub-pixel, as well as the coefficients for the dependencies between the sub-pixels. Figure 6 shows that this model trains more slowly than our original model. In addition, the running time per epoch is significantly longer for our tensorflow implementation. For our architecture, the logistic mixture model thus clearly performs better. Since our architecture differs from that of van den Oord et al. (2016c) in other ways as well, we cannot say whether this would also apply to their model.
|
| 110 |
+
|
| 111 |
+
# .4.2 CONTINUOUS MIXTURE LIKELIHOOD INSTEAD OF DISCRETIZATIO
|
| 112 |
+
|
| 113 |
+
Instead of directly modeling the discrete pixel values in an image, it is also possible to de-quantize them by adding noise from the standard uniform distribution, as used by Uria et al. (2013) and others, and modeling the data as being continuous. The resulting model can be interpreted as a variational autoencoder (Kingma & Welling, 2013; Rezende et al., 2014), where the dequantized pixels $\mathbf { z }$ form a latent code whose prior distribution is captured by our model. Since the original discrete pixels $\mathbf { x }$ can be perfectly reconstructed from z under this model, the usual reconstruction term vanishes from the variational lower bound. The entropy of the standard uniform distribution is zero, so the term that remains is the log likelihood of the dequantized pixels, which thus gives us a variational lower bound on the log likelihood of our original data.
|
| 114 |
+
|
| 115 |
+

|
| 116 |
+
Figure 6: Training curves for our model with logistic mixture likelihood versus our model with softmax likelihood.
|
| 117 |
+
|
| 118 |
+
We re-run our model for CIFAR-10 using the same model settings as those used for the 2.92 bits per dimension result in Table 1, but now we remove the discretization in our likelihood model and instead add standard uniform noise to the image data. The resulting model is a continuous mixture model in the same class as that used by Theis et al. (2012); Uria et al. (2013); Theis & Bethge (2015) and others. After optimization, this model gives a variational lower bound on the data log likelihood of 3.11 bits per dimension. The difference with the reported 2.92 bits per dimension shows the benefit of using discretization in the likelihood model.
|
| 119 |
+
|
| 120 |
+
# 3.4.3 NO SHORT-CUT CONNECTIONS
|
| 121 |
+
|
| 122 |
+
Next, we test the importance of the additional parallel short-cut connections in our model, indicated by the dotted lines in Figure 2. We re-run our unconditional CIFAR-10 experiment, but remove the short-cut connections from the model. As seen in Figure 7, the model fails to train without these connections. The reason for needing these extra short-cuts is likely to be our use of sub-sampling, which discards information that otherwise cannot easily be recovered,
|
| 123 |
+
|
| 124 |
+

|
| 125 |
+
Figure 7: Training curves for our model with and without short-cut connections.
|
| 126 |
+
|
| 127 |
+
# 3.4.4 NO DROPOUT
|
| 128 |
+
|
| 129 |
+
We re-run our CIFAR-10 model without dropout regularization. The log-likelihood we achieve on the training set is below 2.0 bits per sub-pixel, but the final test log-likelihood is above 6.0 bits per
|
| 130 |
+
|
| 131 |
+
sub-pixel. At no point during training does the unregularized model get a test-set log-likelihood below 3.0 bits per sub-pixel. Contrary to what we might naively expect, the perceptual quality of the generated images by the overfitted model is not great, as shown in Figure 8.
|
| 132 |
+
|
| 133 |
+

|
| 134 |
+
Figure 8: Samples from intentionally overfitted PixelCNN model trained on CIFAR-10, with train log-likelihood of 2.0 bits per dimension: Overfitting does not result in great perceptual quality.
|
| 135 |
+
|
| 136 |
+
# 4 CONCLUSION
|
| 137 |
+
|
| 138 |
+
We presented $\mathrm { P i x e l C N N + + }$ , a modification of PixelCNN using a discretized logistic mixture likelihood on the pixels among other modifications. We demonstrated the usefulness of these modifications with state-of-the-art results on CIFAR-10. Our code is made available at https: //github.com/openai/pixel-cnn and can easily be adapted for use on other data sets.
|
| 139 |
+
|
| 140 |
+
# REFERENCES
|
| 141 |
+
|
| 142 |
+
Laurent Dinh, David Krueger, and Yoshua Bengio. Nice: Non-linear independent components estimation. arXiv preprint arXiv:1410.8516, 2014.
|
| 143 |
+
|
| 144 |
+
Laurent Dinh, Jascha Sohl-Dickstein, and Samy Bengio. Density estimation using real nvp. arXiv preprint arXiv:1605.08803, 2016.
|
| 145 |
+
|
| 146 |
+
Justin Domke, Alap Karapurkar, and Yiannis Aloimonos. Who killed the directed model? In Computer Vision and Pattern Recognition, 2008. CVPR 2008. IEEE Conference on, pp. 1–8. IEEE, 2008.
|
| 147 |
+
|
| 148 |
+
Karol Gregor, Ivo Danihelka, Alex Graves, and Daan Wierstra. Draw: A recurrent neural network for image generation. In Proceedings of the 32nd International Conference on Machine Learning, 2015.
|
| 149 |
+
|
| 150 |
+
Karol Gregor, Frederic Besse, Danilo Jimenez Rezende, Ivo Danihelka, and Daan Wierstra. Towards conceptual compression. arXiv preprint arXiv:1604.08772, 2016.
|
| 151 |
+
|
| 152 |
+
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, 2016a.
|
| 153 |
+
|
| 154 |
+
Nal Kalchbrenner, Aaron van den Oord, Karen Simonyan, Ivo Danihelka, Oriol Vinyals, Alex Graves, and Koray Kavukcuoglu. Video pixel networks. arXiv preprint arXiv:1610.00527, 2016b.
|
| 155 |
+
|
| 156 |
+
Diederik P Kingma and Max Welling. Auto-Encoding Variational Bayes. Proceedings of the 2nd International Conference on Learning Representations, 2013.
|
| 157 |
+
|
| 158 |
+
Diederik P. Kingma, Tim Salimans, Rafal Jozefowicz, Xi Chen, Ilya Sutskever, and Max Welling. Improving variational inference with inverse autoregressive flow. In Advances in Neural Information Processing Systems, 2016.
|
| 159 |
+
Danilo J Rezende, Shakir Mohamed, and Daan Wierstra. Stochastic backpropagation and approximate inference in deep generative models. In ICML, pp. 1278–1286, 2014.
|
| 160 |
+
Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In International Conference on Medical Image Computing and Computer-Assisted Intervention, pp. 234–241. Springer, 2015.
|
| 161 |
+
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, 2015.
|
| 162 |
+
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.
|
| 163 |
+
Lucas Theis and Matthias Bethge. Generative image modeling using spatial lstms. In Advances in Neural Information Processing Systems, pp. 1927–1935, 2015.
|
| 164 |
+
Lucas Theis, Reshad Hosseini, and Matthias Bethge. Mixtures of conditional gaussian scale mixtures applied to multiscale image representations. PloS one, 7(7):e39857, 2012.
|
| 165 |
+
Benigno Uria, Iain Murray, and Hugo Larochelle. Rnade: The real-valued neural autoregressive density-estimator. In Advances in Neural Information Processing Systems, pp. 2175–2183, 2013.
|
| 166 |
+
Aaron van den Oord and Joni Dambre. Locally-connected transformations for deep gmms. In International Conference on Machine Learning (ICML) : Deep learning Workshop, 2015.
|
| 167 |
+
Aaron van den Oord, Sander Dieleman, Heiga Zen, Karen Simonyan, Oriol Vinyals, Alex Graves, Nal Kalchbrenner, Andrew Senior, and Koray Kavukcuoglu. Wavenet: A generative model for raw audio. arXiv preprint arXiv:1609.03499, 2016a.
|
| 168 |
+
Aaron van den Oord, Nal Kalchbrenner, and Koray Kavukcuoglu. Pixel recurrent neural networks. In International Conference on Machine Learning (ICML), 2016b.
|
| 169 |
+
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.
|
| 170 |
+
Sergey Zagoruyko and Nikos Komodakis. Wide residual networks. arXiv preprint arXiv:1605.07146, 2016.
|
md/train/BM64dm9HvN/BM64dm9HvN.md
ADDED
|
@@ -0,0 +1,395 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Persistent Homology Captures the Generalization of Neural Networks Without A Validation Set
|
| 2 |
+
|
| 3 |
+
Anonymous Author(s)
|
| 4 |
+
Affiliation
|
| 5 |
+
Address
|
| 6 |
+
email
|
| 7 |
+
|
| 8 |
+

|
| 9 |
+
Figure 1: Our proposal.
|
| 10 |
+
|
| 11 |
+
# Abstract
|
| 12 |
+
|
| 13 |
+
1 The training of neural networks is usually monitored with a validation (holdout)
|
| 14 |
+
2 set to estimate the generalization of the model. This is done instead of measuring
|
| 15 |
+
3 intrinsic properties of the model to determine whether it is learning appropriately.
|
| 16 |
+
4 In this work, we suggest studying the training of neural networks with Algebraic
|
| 17 |
+
5 Topology, specifically Persistent Homology (PH). Using simplicial complex repre
|
| 18 |
+
6 sentations of neural networks, we study the PH diagram distance evolution on the
|
| 19 |
+
7 neural network learning process with different architectures and several datasets.
|
| 20 |
+
8 Results show that the PH diagram distance between consecutive neural network
|
| 21 |
+
9 states correlates with the validation accuracy, implying that the generalization error
|
| 22 |
+
10 of a neural network could be intrinsically estimated without any holdout set.
|
| 23 |
+
|
| 24 |
+
# 11 1 Introduction
|
| 25 |
+
|
| 26 |
+
12 Generalization is what makes a machine learning model useful; the uncertainty of its behaviour with
|
| 27 |
+
13 unseen data is what makes it potentially dangerous. Thus, understanding the generalization error of a
|
| 28 |
+
14 model can be considered one of the holy grails of the entire machine learning field.
|
| 29 |
+
15 Machine learning practitioners typically monitor some metrics of the model to estimate its generaliza
|
| 30 |
+
16 tion error and stop the training even before the numerical convergence to prevent the overfitting of
|
| 31 |
+
17 the model. Usually, the error measure or the metric relevant to the task is computed for a holdout
|
| 32 |
+
18 set, the validation set. Since these data have not been directly used for updating the parameters, it
|
| 33 |
+
19 is assumed that the performance of the model on the validation set can be used as a proxy of the
|
| 34 |
+
|
| 35 |
+
generalization error, provided it is representative of the data that will be used in inference. One can, though, potentially overfit to this holdout set if is repeatedly used for guiding a hyperparameter search.
|
| 36 |
+
|
| 37 |
+
23 Instead of relying on an external set, though, the question of whether it could be possible to estimate
|
| 38 |
+
24 the generalization error with some intrinsic property of the model is highly relevant, and it has been
|
| 39 |
+
25 barely explored in the literature. On the other hand, Algebraic Topology has recently been gaining
|
| 40 |
+
26 momentum as a mathematical tool for studying graphs, machine learning algorithms, and data.
|
| 41 |
+
27 In this work, we have the goal of, once having characterized neural networks as weighted, acyclic
|
| 42 |
+
28 graphs, represented as Algebraic Topology objects (following previous works), computing distances
|
| 43 |
+
29 between consecutive neural network states. More specifically, we can calculate the Persistent
|
| 44 |
+
30 Homology (PH) diagram distances between a give state (i.e., when having a specific weights during
|
| 45 |
+
31 the training process) and the next one (i.e., after having updated the weights in a training step) (see
|
| 46 |
+
32 Figure 1. We observe that during the training procedure of neural networks we can measure this
|
| 47 |
+
33 distance in each learning step, and show that there exists a high correlation with the corresponding
|
| 48 |
+
34 validation accuracy of the model. We do so in a diverse set of deep learning benchmarks and model
|
| 49 |
+
35 hyperparameters. This shines light on the question of whether the generalization error could be
|
| 50 |
+
36 estimated from intrinsic properties of the model, and opens the path towards a better theoretical
|
| 51 |
+
37 understanding of the dynamics of the training of neural networks.
|
| 52 |
+
|
| 53 |
+
38 In summary, our contributions are as follows:
|
| 54 |
+
|
| 55 |
+
• Based on principles of Algebraic Topology, we propose measuring the distances (Silhouette and Heat) between the PH persistence diagrams obtained from a given state of a neural network during the training procedure and the one in the immediately previous weights update.
|
| 56 |
+
• We empirically show that the evolution of these measures during training correlate with the accuracy in the validation set. We do so in diverse benchmarks (MNIST, CIFAR10, CIFAR100, Reuters text classification), and models (MLPs in MNIST and Reuters, MLPs and CNNs in CIFAR100 and CIFAR100).
|
| 57 |
+
• We thus provide empirical proof of the fact that valuable information related to the learning process of neural networks can be obtained from PH distances between persistence diagrams (homological convergence). In particular, we show that homological convergence is related to learning process and the generalization properties of neural networks.
|
| 58 |
+
• In practice, we provide a new tool for monitoring the training of neural networks, and open the path to estimating their generalization error without a validation set.
|
| 59 |
+
|
| 60 |
+
53 The remainder of this article is as follows. In Section 2 we describe the theoretical background of our
|
| 61 |
+
54 proposal in terms of Algebraic Topology, while in Section 3 we go through the related work. Then, in
|
| 62 |
+
55 Section 4 we formalize our method. Finally, in sections 6 and 7 we present and discuss our empirical
|
| 63 |
+
56 results, respectively.
|
| 64 |
+
|
| 65 |
+
# 57 2 Background
|
| 66 |
+
|
| 67 |
+
58 In this section we introduce the mathematical foundations of this paper. A detailed mathematical
|
| 68 |
+
59 description is included in the Supplementary Material.
|
| 69 |
+
60 A simplicial complex is a set composed of points, line segments, triangles, and their n-dimensional
|
| 70 |
+
61 counterparts, named simplex $( K )$ . In particular, a simplicial complex must comply with two properties:
|
| 71 |
+
62 1. Every face of a simplex is also in the simplicial complex (of lower dimension). 2. The non-empty
|
| 72 |
+
63 intersection of any two simplices contained on a simplicial complex is a face of both. 0,1,2,3-simplex
|
| 73 |
+
64 and non simplex examples are shown in Figure 2.
|
| 74 |
+
65 We can associate to an undirected graph, $G = \left( V , E \right)$ , a simplicial complex where all the vertices
|
| 75 |
+
66 of $\mathbf { G }$ are the 0-simplex of the simplicial complex and the complete subgraphs with i vertices, in $G$
|
| 76 |
+
67 corresponds to a $( i - 1 )$ -simplex. This type of construction is usually called a complex clique on the
|
| 77 |
+
68 graph G, and is denoted by $C l ( G )$ . Figure 3 shows a graph clique complex Cl(G) example.
|
| 78 |
+
69 The boundary function is defined as a map, from
|
| 79 |
+
70 an $i$ -simplex to an $( i - 1 )$ -simplex, as the sum
|
| 80 |
+
71 of its $( i - 1 )$ -dimensional faces. A boundary
|
| 81 |
+
72 function sample is shown in Figure 4.
|
| 82 |
+
73 In algebraic topology, a $k$ -chain is a combination
|
| 83 |
+
74 of $k$ -simplices (sometimes symbolized as a lin
|
| 84 |
+
75 ear combination of simplices that compose the
|
| 85 |
+
76 chain). The boundary of a $k$ -chain is a $\left( k - 1 \right)$ -
|
| 86 |
+
77 chain. It is the linear and signed combination of
|
| 87 |
+
78 chain element boundary simplices. The space of
|
| 88 |
+
79 $i$ -chains is denoted by $C _ { i } ( K )$ .
|
| 89 |
+
|
| 90 |
+

|
| 91 |
+
Figure 2: Simplex and non-simplex examples.
|
| 92 |
+
|
| 93 |
+

|
| 94 |
+
Figure 4: Boundary function sample.
|
| 95 |
+
|
| 96 |
+

|
| 97 |
+
Figure 3: Graph clique complex Cl(G) example.
|
| 98 |
+
|
| 99 |
+
80 There are two special cases of chains that will be useful to define homology:
|
| 100 |
+
|
| 101 |
+
• Closed chain or $i$ -cycle: $i .$ -chain with empty boundary. An $i$ -chain $c$ is an $i$ -cycle if and only if $\partial _ { i } c = 0$ , i.e. $c \in \dot { k e r } ( \partial _ { i } )$ . This subspace of $C _ { i } ( K )$ is denoted as $\mathbb { Z } _ { i } ( K )$ . • Exact chain or $i$ -boundary: An $i \cdot$ -chain $c$ is an $i \cdot$ -boundary if there exists an $( i + 1 )$ -chain $d$ such that $c = \partial _ { i + 1 } ( d )$ , i.e. $c \in i m ( \partial i + 1 )$ . This subspace of $C _ { i } ( K )$ , the set of all such i-boundaries forms, is denoted by $\mathbb { B } _ { i } ( K )$ .
|
| 102 |
+
|
| 103 |
+
86 Now, if we think in the $i$ -cycles that do not bound an $( i + 1 )$ -simplicial complex, this is the definition
|
| 104 |
+
87 $i$ -th homology of the simplicial complex $K$ . The precise definition is the quotient space of $\mathbb { B } _ { i } ( K )$ a
|
| 105 |
+
88 subspace of $\mathbb { Z } _ { i } ( K )$ (see Supplementary Material). The number of non equivalent $i \cdot$ -cycles (Figure 5)
|
| 106 |
+
89 is the dimension of the homology group $H _ { i } ( K )$ , also named Betti numbers.
|
| 107 |
+
|
| 108 |
+
We can create a nested family of simplicial complexes, $K _ { \varepsilon }$ , where at each step $t$ , $K _ { \varepsilon _ { t } }$ is embedded in the simplicial complex $K _ { \varepsilon _ { t + 1 } }$ . We call this set a simplicial complex filtration.
|
| 109 |
+
|
| 110 |
+

|
| 111 |
+
Figure 5: The two blue dashed cycles are homologically equivalent, the pink isn’t.
|
| 112 |
+
|
| 113 |
+
For each filtration simplicial complex, we can calculate the homology groups. Then, we can look at the birth, that is, when a homology class appears, and death, the time when the homology class disappears. The PH treats the birth and the death of these homological features in $K _ { \varepsilon }$ for different ε values. The lifespan of each homological feature can be represented as an interval $( b \bar { i } r t h , d e a t h )$ , of the homological class. Given a filtration, this collection of intervals is named a Persistence Diagram (PD) [5].
|
| 114 |
+
|
| 115 |
+
105 It is possible to compare two PDs using specific distances (Wasserstein and Bottleneck). To efficiently
|
| 116 |
+
106 perform this operation, due to the size of these diagrams, it is sometimes necessary to simplify them
|
| 117 |
+
107 by means of a discretization process (such as Weighted Silhouette and Heat vectorizations).
|
| 118 |
+
|
| 119 |
+
# 108 3 Related Work
|
| 120 |
+
|
| 121 |
+
109 Algebraic Topology and Machine Learning The use of Algebraic Topology in the fields of
|
| 122 |
+
110 data science and machine learning has been gaining momentum in recent years (see Carlsson [5]).
|
| 123 |
+
111 Specifically in the case of neural networks, some works have applied topology for improving the
|
| 124 |
+
112 training procedure of the models [15, 8], or pruning the model afterwards [30]. Other works have
|
| 125 |
+
113 focused on analyzing the capacity of neural networks [14, 26, 17] or the complexity of input data
|
| 126 |
+
114 [17]. Furthermore, recent works have provided topological analysis of the decision boundaries of
|
| 127 |
+
115 classifiers based on PH and Betti numbers [24, 22].
|
| 128 |
+
116 Graph and topological representations of neural networks Gebhart et al. [12] suggest a method
|
| 129 |
+
117 for computing the PH over the graphical activation neural networks, while Watanabe and Yamana
|
| 130 |
+
118 [29] propose representing neural networks via simplicial complexes based on Taylor decomposition,
|
| 131 |
+
119 from which one can compute the PH. Chowdhury et al. [7] show that directed homology can be used
|
| 132 |
+
120 to represent MLPs. Anonymous [2] concurrently show neural networks, when represented as directed,
|
| 133 |
+
121 acyclic graphs, can be associated to an Algebraic Topology object. By computing the PH diagram,
|
| 134 |
+
122 one can effectively characterize neural networks, and even compute distances between two given
|
| 135 |
+
123 neural networks, which can be used to measure their similarity. This is unlike other works [11, 13]
|
| 136 |
+
124 approximating neural networks representations with regard to the input space.
|
| 137 |
+
125 Estimating the generalization and studying the learning process We are, though, specifically
|
| 138 |
+
126 interested in the use of PH for analyzing the learning process, especially with the goal of estimating
|
| 139 |
+
127 generalization. In this regard, the literature is perhaps more limited. Jiang et al. [16] work on
|
| 140 |
+
128 understanding what drives generalization in deep networks from a Bayesian of view. Neyshabur et al.
|
| 141 |
+
129 [23] study the generalization gap prediction from the training data and network parameters using a
|
| 142 |
+
130 margin distribution, which are the distances of training points to the decision boundary. In Li et al.
|
| 143 |
+
131 [21], authors propose an alternative to cross-validation for model selection based on training once on
|
| 144 |
+
132 the whole train set, without any data split, deriving a validation set with data augmentation.
|
| 145 |
+
133 Corneanu et al. [10] try to estimate the performance gap between training and testing using PH
|
| 146 |
+
134 measures. They claim. However, one can observe some caveats. The first one is that their regression
|
| 147 |
+
135 fitted to predict the test error has a considerably high error, making it not usable in practice. The
|
| 148 |
+
136 second caveat is that for fitting the regression one needs at least part of the sequestered testing set.
|
| 149 |
+
137 In this work, motivated by the interest of having a better understanding of whether it would be
|
| 150 |
+
138 possible to estimate the generalization of neural networks without a holdout set, we suggest using the
|
| 151 |
+
139 topological characterization and distances concurrently proposed in Anonymous [2] but, crucially,
|
| 152 |
+
140 measured between consecutive weight updates. We will show that the evolution of this distance
|
| 153 |
+
141 is similar to the one of the validation accuracy. Unlike Li et al. [21], we do not use any data at
|
| 154 |
+
142 all. Unlike [10], we do not build a statistical or machine learning model (linear regression) for
|
| 155 |
+
143 predicting the testing error. Instead, we propose a new measure, and we empirically show that it
|
| 156 |
+
144 highly correlates with the validation accuracy. Note that in this work we do not work with any input
|
| 157 |
+
145 data and activations, but with the parameters of the neural network themselves.
|
| 158 |
+
|
| 159 |
+
# 146 4 Approach
|
| 160 |
+
|
| 161 |
+
Representation For representing neural networks as graphs, we follow the approach proposed concurrently in Anonymous [2]. We associate to the neural network, at each learning state (defined by its weights), a weighted directed graph that is analyzed as an abstract simplicial complex. It is important to note that abstract simplicial complex are used in opposition to geometric simplicial complex.
|
| 162 |
+
|
| 163 |
+
152 For every training state, neural network connections are considered as directed and weighted edges
|
| 164 |
+
153 between neurons, represented by graph nodes. Biases are considered as new edges that join to isolate
|
| 165 |
+
154 vertices. In this representation, activation functions are lost. Bias information could also have been
|
| 166 |
+
155 ignored because, as we will see, it is not very informative in terms of homology, but we decided to
|
| 167 |
+
56 preserve it.
|
| 168 |
+
157 Negative edge weights are represented with reverse edges with the same weight absolute value. We
|
| 169 |
+
158 discard the use of weight absolute value as neural networks are not invariant under weight sign
|
| 170 |
+
159 transformations. This representation is consistent with the fact that every neuron can be replaced by a
|
| 171 |
+
160 neuron from which two edges with opposite weights emerge and converge again on another neuron
|
| 172 |
+
161 with opposite weights. From an homological point of view, this would be represented as a closed
|
| 173 |
+
162 cycle. Weights are normalized following the Equation 1. $\zeta$ is an smoothing parameter that we set to
|
| 174 |
+
163 1e-6. This smoothing parameter is necessary as we want to avoid normalized weights of edges to be
|
| 175 |
+
164 0 (in our representation 0 implies a lack of connection):
|
| 176 |
+
|
| 177 |
+
$$
|
| 178 |
+
m a x ( 1 - \frac { | w | } { m a x ( | m a x ( W ) | , | m i n ( W ) | ) } , \zeta )
|
| 179 |
+
$$
|
| 180 |
+
|
| 181 |
+
165 Algebraic Topology object For each weighted directed graph associated with the state of a neural
|
| 182 |
+
166 network, we link a directed flag complex to it. The topological properties of this directed flag complex
|
| 183 |
+
167 are studied using homology groups $H _ { n }$ . We calculate the homology groups up to degree 3 $\left( H _ { 0 } – H _ { 3 } \right)$ .
|
| 184 |
+
168 For each state, we use a family of simplicial complexes, $K _ { \varepsilon }$ , for a range of values of $\varepsilon \in \mathbb { R }$ . The
|
| 185 |
+
169 simplicial complex at step $\varepsilon _ { t }$ is embedded in the complex at $\varepsilon _ { t + 1 }$ , for $\varepsilon _ { t } \leq \varepsilon _ { t + 1 }$ , i.e. $K _ { \varepsilon } \subseteq K _ { \varepsilon _ { t + 1 } }$ . $\varepsilon$
|
| 186 |
+
170 is used as a filter that establish the minimum weight of the graph representation edges included on
|
| 187 |
+
171 the simplicial complex. This collection of contained simplicial complex (associated to a directed
|
| 188 |
+
172 weighted graph), called filtration, $K _ { \varepsilon _ { m i n } } \subseteq \ldots \subseteq K _ { \varepsilon _ { t } } \subseteq K _ { \varepsilon _ { t + 1 } } \subseteq \ldots \subseteq K _ { \varepsilon _ { m a x } }$ , where $t \in [ 0 , 1 ]$ and $\varepsilon _ { m i n } = 0$
|
| 189 |
+
173 $\varepsilon _ { m a x } = 1$ (remember that edge weights are normalized).
|
| 190 |
+
174 The sequence of homology groups is calculated by varying the $\varepsilon$ parameter to obtain the persistence
|
| 191 |
+
175 homology diagram. In our case, persistent homology calculations are performed on $\mathbb { Z } _ { 2 }$ . In other
|
| 192 |
+
176 words, once the corresponding filter has been applied to the weight of the edges, all connected edges
|
| 193 |
+
177 are considered equally.
|
| 194 |
+
178 Distances between persistence diagrams of consecutive states In this paper, we are interested in
|
| 195 |
+
179 comparing PDs between different simplicial complex associated to each training state of the neural
|
| 196 |
+
180 network. There are two distances traditionally used to compare PDs, Bottleneck distance (the length
|
| 197 |
+
181 of the longest edge) and Wasserstein distance (using the sum of all edges lengths, instead of the
|
| 198 |
+
182 maximum). Their stability with respect to perturbations on PDs has been object of different studies
|
| 199 |
+
183 [6, 9].
|
| 200 |
+
184 In order to make computations feasible and obviate noisy intervals, we filter the PDs by limiting
|
| 201 |
+
185 the minimum PD interval size. We do so by setting a minimum threshold $\eta = 0 . 0 1$ . Intervals with
|
| 202 |
+
186 a lifespan under this value are not considered (spurious homological features). Additionally, for
|
| 203 |
+
187 computing distances, we need to remove infinity values. As we are only interested in the deaths until
|
| 204 |
+
188 the maximum weight value, we replace all the infinity values by 1.0.
|
| 205 |
+
189 In our case, our neural networks have millions of persistence intervals per Persistence Diagram,
|
| 206 |
+
190 while Wasserstein distance calculations are computationally hard for large PDs. In order to make
|
| 207 |
+
191 calculations computationally feasible, we will use a vectorized version of PDs, also called PD
|
| 208 |
+
192 discretization. This vectorized version summaries have been proposed and used on recent literature
|
| 209 |
+
193 [1, 3, 4, 19, 25]. For persistence diagram distance calculation, we use weighted Silhouette and Heat
|
| 210 |
+
194 vectorizations, using the Giotto-TDA library [27].
|
| 211 |
+
|
| 212 |
+
# 95 5 Experiments
|
| 213 |
+
|
| 214 |
+
Data We validate our method in several heterogeneous (vision, natural language), well-known datasets, namely 1. MNIST [20], 2. CIFAR-10, 3. CIFAR-100 [18], and 4. the Reuters dataset [28] (multi-class and multi-label document classification dataset).
|
| 215 |
+
|
| 216 |
+
Models We experiment with two neural architectures,1. MLPs and 2. CNNs. In the latter case, we use the convolutional layers as a pre-trained model with frozen weights, and we learn an MLP on top of it. The reason we do so is that our method is based in a representation that, at least in the basic form, does not allow capturing information from convolutional layers. Thus, we need a single (exact
|
| 217 |
+
|
| 218 |
+
203 same weights) feature extractor, to abstract away distances related to the CNN layers and focus on
|
| 219 |
+
204 the MLP.
|
| 220 |
+
|
| 221 |
+
Conducted experiments We define the base MLP architecture as {Input, Linear(512), Dropout(0.2), Linear(512), Dropout(0.2), Output}. In the case of CNNs, the pre-trained model is defined as 3 convolutional blocks with kernel size 3 (starting with 32 channels), interleaved with max pooling (its linear layers are thrown away after the pre-training). On top of the pre-trained CNN, we also define the same base MLP architecture. Then, for each dataset and model (MLP and CNN), we experiment with varying (while keeping the rest fixed to the base architecture)
|
| 222 |
+
|
| 223 |
+
1. Layer size (number of units per layer): 4, 16, 32, 128, 256.
|
| 224 |
+
2. Number of labels (the other classes are removed): 2, 4, 6, 8, 10.
|
| 225 |
+
3. Learning rate: 1e-e05, 0.0001, 0.001, 0.01, 0.1
|
| 226 |
+
4. Dropout: 0.0, 0.2, 0.4, 0.5, 0.8.
|
| 227 |
+
5. Input order: 5 random input orders. As a control experiment, for each analyzed problem we run the same configuration with 5 different input orders. If the measured distances are, indeed, related with the learning process of neural networks, these variations should not have any noticeable effect.
|
| 228 |
+
|
| 229 |
+
We run each configuration 5 times with different random seeds (and, thus, weight initializations1) to see if the results are consistent across runs. All models are trained with the RMSProp optimizer with 221 a batch size of 256.
|
| 230 |
+
|
| 231 |
+
Distances and validation accuracy computation Note that homological distances are obtained at the end of each batch, while validation metrics are only computed on each epoch. The methodology we follow to analyze the learning process on each different problem can be summarized with the following steps:
|
| 232 |
+
|
| 233 |
+
1. In each training step (i.e., for each batch) we extract the weights from the MLP current state and use them to build an abstract simplicial complex from the associated weighted directed graph.
|
| 234 |
+
2. We calculate the homological persistence diagram of the simplicial complex.
|
| 235 |
+
3. We then calculate the distance between consecutive persistence diagrams (we will call this sequence homological convergence). We use two different distances, namely, Heat and Silhouette.
|
| 236 |
+
4. We compare the homological convergence with the evolution of the validation results on neural network learning process.
|
| 237 |
+
|
| 238 |
+
Hardware All experiments were executed in a machine with 2 NVIDIA V100 of 32GB, 2 Intel(R) Xeon(R) Platinum 8176 CPU $\textcircled { a } 2 . 1 0 \mathrm { G H z }$ , and of 1.5TB RAM, for a total of around 7 days. We note that our method is considerably demanding in terms of both compute and memory.
|
| 239 |
+
|
| 240 |
+
The code and outputs are fully available in the Supplementary Material under MIT License.
|
| 241 |
+
|
| 242 |
+
# 6 Results
|
| 243 |
+
|
| 244 |
+
In this section, we highlight the main results, omitting the ones with Silhouette (since the obtained results were clearer with Heat). See the Supplementary Material for the full results (plots and correlations), including the ones with Silhouette distance.
|
| 245 |
+
|
| 246 |
+
We study the relation between the evolution of the PH diagram distances with the one of the validation score with the cumulative values of the distance between homologous persistence diagrams because this value seems much more stable. The information of the distance between the persistence diagrams has been normalized to visualize clearly the type of evolution of each curve on the same scale. Some of the non-normalized plots can be found in the Supplementary Material. Figure 6 shows the cumulative and non-cumulative homology the MNIST experiment with layer size.
|
| 247 |
+
|
| 248 |
+

|
| 249 |
+
Figure 6: Heat distance and validation accuracy curves on the MNIST experiment with layer size. Normalized.
|
| 250 |
+
|
| 251 |
+
249 For each experiment (e.g., layer size in MNIST), we plot both the evolution of the PH diagram
|
| 252 |
+
250 distance and the validation score (accuracy). The plotted values are the corresponding means of
|
| 253 |
+
251 the 5 repetitions with different seeds. In addition, we compute the Pearson correlation for these
|
| 254 |
+
252 values. Plots show on the x-axis each training step (for each batch) of the evolution in the training
|
| 255 |
+
253 state of the neural network. On the y-axis, two scales are shown that apply to the distance curves
|
| 256 |
+
254 between accumulated persistence diagrams (solid lines), scale on the right side, and the neural
|
| 257 |
+
255 network validation (dotted lines), numerical scale on the left side. For each sub-experiment (for
|
| 258 |
+
256 example, different values of layer size) a different color was used.
|
| 259 |
+
257 The general result is that the evolution of the homological convergence of the MLPs seems to be
|
| 260 |
+
258 very similar to the one of the validation score. This is generally consistent across experiments (see
|
| 261 |
+
259 the Supplementary Material). Table 1 shows the mean (and standard deviations) of the Pearson
|
| 262 |
+
260 correlations for all datasets. All means are above 0.8, implying that there is strong correlation.
|
| 263 |
+
261 Intuitively, this is also observed in the plots, although once the distances are normalized it is not as
|
| 264 |
+
262 clear to visualize. Interestingly, we find that the very few exceptions in which the correlation is low
|
| 265 |
+
263 corresponds to extreme values (very small number of neurons per layer, very high learning rate, very
|
| 266 |
+
264 high dropout), in which the neural network doesn’t end up learning properly.
|
| 267 |
+
265 In the case of CNNs, the correlations are lower (although still almost always above 0.8 in experiments
|
| 268 |
+
266 such as the one of increasing the number of layers). Recall that in the case of CNN we froze a
|
| 269 |
+
267 single convolutional feature extractor, since our method only supports MLPs. We believe these lower
|
| 270 |
+
268 correlations can be explained because an important part of the learning process happened in the
|
| 271 |
+
269 convolutional layers (in the pre-training), which we do not capture.
|
| 272 |
+
70 Another finding is that the method obtains consistent results across runs, meaning that it is capturing
|
| 273 |
+
71 information related to important properties of the networks themselves instead of random artifacts.
|
| 274 |
+
272 When varying the studied hyperparameters, we observe that the curves for each configuration are
|
| 275 |
+
273 indeed, different. Remarkably, in the control experiments, this is not the case; results show that the
|
| 276 |
+
274 homological convergence during the learning of the same problem with the same model but with
|
| 277 |
+
275 different input order is very similar. The alteration of the order of the input doesn’t have any effect in
|
| 278 |
+
276 the homological convergence. The results of two of these experiments are shown in Figure 7.
|
| 279 |
+
277 In addition, we observe that when the neural network learns the given problem, homological conver
|
| 280 |
+
278 gence occurs. For example, when the layer size is modified, the capacity of the neural network to
|
| 281 |
+
279 learn the problem changes (Figure 6). When it can’t learn the problem, because the network does not
|
| 282 |
+
280 have sufficient capacity (the layer size is too small, 4 units), the homology does not seem to converge.
|
| 283 |
+
|
| 284 |
+
Regarding the learning rate, the results are coherent with the intuition that it is a fundamental parameter that controls how much to change the model in response to the estimated error during the learning process. A too small learning rate may result in a long training process that could be stalled, while a too large value may fall in a fast suboptimal solution or an unstable training process. Using homological convergence we find similar behaviour, as can be seen in Figure 9.
|
| 285 |
+
|
| 286 |
+

|
| 287 |
+
Figure 7: Learning evolution on input order experiments (control experiments). Normalized.
|
| 288 |
+
|
| 289 |
+
<table><tr><td colspan="2">Heat distance</td><td colspan="3">Silhouete distance</td></tr><tr><td>Dataset</td><td>Means mean</td><td>Deviations mean</td><td>Means mean</td><td>Deviations mean</td></tr><tr><td>MNIST</td><td>0.8910</td><td>0.0424</td><td>0.8910</td><td>0.0424</td></tr><tr><td>Reuters</td><td>0.6220</td><td>0.0700</td><td>0.6220</td><td>0.0700</td></tr><tr><td>CIFAR-10MLP</td><td>0.8233</td><td>0.0649</td><td>0.8233</td><td>0.0649</td></tr><tr><td>CIFAR-10 CNN</td><td>0.4241</td><td>0.1915</td><td>0.4241</td><td>0.1915</td></tr><tr><td>CIFAR-100MLP</td><td>0.8420</td><td>0.0566</td><td>0.8420</td><td>0.0566</td></tr><tr><td>CIFAR-100 CNN</td><td>0.6130</td><td>0.0800</td><td>0.6130</td><td>0.0800</td></tr></table>
|
| 290 |
+
|
| 291 |
+
Table 1: Correlation of validation values with topological difference cumulative. Correlation is computed with 20 points.
|
| 292 |
+
|
| 293 |
+
286 Finally, we note that even if the two convergences (validation and homological convergence) are
|
| 294 |
+
287 correlated, they are not the same process. This is especially visible in the case of the learning rate
|
| 295 |
+
288 experiments. For instance, in Figure 9, homological convergence is reached before the stabilization of
|
| 296 |
+
289 the validation accuracy. Presumably, they are not capturing the exact same information; specifically,
|
| 297 |
+
290 we believe that the difference is due to the fact that the validation accuracy depends on the specifics
|
| 298 |
+
291 of the data sampled in the validation subset, while the homological convergence is independent of the
|
| 299 |
+
292 validation data.
|
| 300 |
+
|
| 301 |
+
# 293 7 Discussion
|
| 302 |
+
|
| 303 |
+
We posed the of question whether homological convergence (in terms of distances between PH diagrams in consecutive neural network states) is related to the learning process of neural networks. We have seen that, indeed, it is the case, with strong empirical results backing our claim.
|
| 304 |
+
|
| 305 |
+
297 This finding has a remarkable implication. If the homological convergence evolution mirrors the
|
| 306 |
+
298 validation accuracy curve, one could ignore the validation set to monitor the training. This opens the
|
| 307 |
+
299 path towards estimating the generalization of neural networks without the need of any holdout set.
|
| 308 |
+
300 Researchers have wondered for a long time whether generalization could be predicted from intrinsic
|
| 309 |
+
301 properties of the model or training data alone (i.e., without a holdout set), and in fact other works
|
| 310 |
+
302 have claimed to do so. Although we do not provide any predictive model, we show that our proposed
|
| 311 |
+
303 measures strongly correlate with the validation accuracy. In addition, we do so by not using any data
|
| 312 |
+
304 at all; we just look at the neural network itself.
|
| 313 |
+
305 Our contribution aims pushing towards having a better understanding of the learning process of neural
|
| 314 |
+
306 networks, not targeting any specific direct application. However, we note that it can be effectively
|
| 315 |
+
307 used for monitoring the training of neural networks in terms of convergence expected generalization,
|
| 316 |
+
308 as we have extensively shown in the experiments. Apart from the cases without access to a validation
|
| 317 |
+
309 set, this is relevant because depending on a validation set has the risk of overfitting to it. Having an
|
| 318 |
+
310 intrinsic, well-principled measure should be more robust to random noise in a specific data sample.
|
| 319 |
+
311 The main limitation of our method is its computational scalability. As we said in Section 5, our
|
| 320 |
+
312 method took more than 7 days of compute in a HPC machine, even if we restricted the experiments
|
| 321 |
+
313 to small datasets and parameter count. However, we note that our approach computes the exact
|
| 322 |
+
314 persistence diagram distances, that is, we do not simplify the graph representation of the neural
|
| 323 |
+
315 networks (we keep every single neuron and connections) and we do not approximate any computation.
|
| 324 |
+
316 This leaves room for finding efficient approximations, opening a new research line. In addition, this
|
| 325 |
+
317 lack of scalability has prevented us from validating our method on bigger models and datasets.
|
| 326 |
+
318 Finally, we note that instead of computing correlations, serving as a basic quantitative study, it would
|
| 327 |
+
319 be interesting to perform a time-series analysis to gain more insights on how the two curves vary
|
| 328 |
+
320 together. Moreover, it would have been interesting to investigate how to build a predictive model of
|
| 329 |
+
321 the validation accuracy from the PH distances, but it is was of the scope of this work.
|
| 330 |
+
|
| 331 |
+

|
| 332 |
+
Figure 8: Learning evolution when dropout parameter is changed. Normalized.
|
| 333 |
+
|
| 334 |
+

|
| 335 |
+
Figure 9: Learning evolution when modifying the learning rate parameter. Not normalized.
|
| 336 |
+
|
| 337 |
+
# 22 8 Conclusions & Future Work
|
| 338 |
+
|
| 339 |
+
In this work, we have provided an empirical proof of the fact that homological convergence is related to the learning process and generalization properties of neural networks. Furthermore, we have shown that it can be used to monitor the training of a neural network (and potentially estimating its generalization) without a validation set. As future work, we suggest generalizing our representation to other neural architectures and scaling up the experiments to larger models and datasets, for which finding efficient approximations of our method will be crucial.
|
| 340 |
+
|
| 341 |
+
1. For all authors...
|
| 342 |
+
|
| 343 |
+
(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
|
| 344 |
+
(b) Did you describe the limitations of your work? [Yes] See the Discussion Section.
|
| 345 |
+
(c) Did you discuss any potential negative societal impacts of your work? [N/A]
|
| 346 |
+
(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
|
| 347 |
+
|
| 348 |
+
2. If you are including theoretical results...
|
| 349 |
+
|
| 350 |
+
(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]
|
| 351 |
+
|
| 352 |
+
3. If you ran experiments...
|
| 353 |
+
|
| 354 |
+
(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] Both code and outputs.
|
| 355 |
+
(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] Check the Experiments Section and the code.
|
| 356 |
+
(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes] We include means, standard deviations and raw outputs.
|
| 357 |
+
(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] Check Experiments Section.
|
| 358 |
+
|
| 359 |
+
4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
|
| 360 |
+
|
| 361 |
+
(a) If your work uses existing assets, did you cite the creators? [Yes] In the case of the datasets. We do not use any other additional asset.
|
| 362 |
+
(b) Did you mention the license of the assets? [No]
|
| 363 |
+
(c) Did you include any new assets either in the supplemental material or as a URL? [Yes] Code, results and pictures we have made for explanations.
|
| 364 |
+
(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A]
|
| 365 |
+
(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A]
|
| 366 |
+
|
| 367 |
+
5. If you used crowdsourcing or conducted research with human subjects...
|
| 368 |
+
|
| 369 |
+
(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
|
| 370 |
+
(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
|
| 371 |
+
(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A] References [1] H. Adams, T. Emerson, M. Kirby, R. Neville, C. Peterson, P. Shipman, S. Chepushtanova, E. Hanson, F. Motta, and L. Ziegelmeier. Persistence images: A stable vector representation of persistent homology. J. Mach. Learn. Res., 18:8:1–8:35, 2017. [2] A. Anonymous. Characterizing and measuring the similarity of neural networks with persistent homology, 2021. [3] E. Berry, Y.-C. Chen, J. Cisewski-Kehe, and B. T. Fasy. Functional summaries of persistence diagrams. Journal of Applied and Computational Topology, 4:211–262, 2020. [4] P. Bubenik. Statistical topological data analysis using persistence landscapes. J. Mach. Learn. Res., 16:77–102, 2015. [5] G. Carlsson. Topology and data. Bulletin of the American Mathematical Society, 46:255–308, 2009. [6] F. Chazal, V. D. Silva, and S. Oudot. Persistence stability for geometric complexes. Geometriae Dedicata, 173:193–214, 2012. [7] S. Chowdhury, T. Gebhart, S. Huntsman, and M. Yutin. Path homologies of deep feedforward networks. 2019 18th IEEE International Conference On Machine Learning And Applications (ICMLA), pages 1077–1082, 2019. [8] J. Clough, I. Öksüz, N. Byrne, V. Zimmer, J. A. Schnabel, and A. P. King. A topological loss function for deep-learning based image segmentation using persistent homology. IEEE transactions on pattern analysis and machine intelligence, PP, 2020. [9] D. Cohen-Steiner, H. Edelsbrunner, and J. Harer. Stability of persistence diagrams. Proceedings of the twenty-first annual symposium on Computational geometry, 2005.
|
| 372 |
+
390 [10] C. Corneanu, M. Madadi, S. Escalera, and A. Martínez. Computing the testing error without a testing set. 2020 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pages 2674–2682, 2020. [11] C. A. Corneanu, M. Madadi, S. Escalera, and A. M. Martinez. What does it mean to learn in deep networks? and, how does one detect adversarial attacks? In 2019 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pages 4752–4761, 2019. doi: 10.1109/ CVPR.2019.00489. [12] T. Gebhart, P. Schrater, and A. Hylton. Characterizing the shape of activation space in deep neural networks. 2019 18th IEEE International Conference On Machine Learning And Applications (ICMLA), pages 1537–1542, 2019. [13] W. H. Guss and R. Salakhutdinov. On characterizing the capacity of neural networks using algebraic topology. CoRR, abs/1802.04443, 2018. URL http://arxiv.org/abs/1802. 04443. [14] W. H. Guss and R. Salakhutdinov. On characterizing the capacity of neural networks using algebraic topology. ArXiv, abs/1802.04443, 2018. [15] C. Hofer, F. Graf, M. Niethammer, and R. Kwitt. Topologically densified distributions. ArXiv, abs/2002.04805, 2020.
|
| 373 |
+
407 [16] Y. Jiang, D. Krishnan, H. Mobahi, and S. Bengio. Predicting the generalization gap in deep networks with margin distributions. ArXiv, abs/1810.00113, 2019. [17] E. Konuk and K. Smith. An empirical study of the relation between network architecture and complexity. 2019 IEEE/CVF International Conference on Computer Vision Workshop (ICCVW), pages 4597–4599, 2019. [18] A. Krizhevsky. Learning multiple layers of features from tiny images. 2009. [19] P. Lawson, A. Sholl, J. Brown, B. T. Fasy, and C. Wenk. Persistent homology for the quantitative evaluation of architectural features in prostate cancer histology. Scientific Reports, 9, 2019. [20] Y. LeCun and C. Cortes. MNIST handwritten digit database. 2010. URL http://yann.lecun. com/exdb/mnist/. [21] W. Li, C. Geng, and S. Chen. Leave zero out: Towards a no-cross-validation approach for model selection. CoRR, abs/2012.13309, 2020. URL https://arxiv.org/abs/2012.13309.
|
| 374 |
+
|
| 375 |
+
419 [22] G. Naitzat, A. Zhitnikov, and L. Lim. Topology of deep neural networks. J. Mach. Learn. Res.,
|
| 376 |
+
420 21:184:1–184:40, 2020.
|
| 377 |
+
421 [23] B. Neyshabur, S. Bhojanapalli, D. McAllester, and N. Srebro. Exploring generalization in deep
|
| 378 |
+
422 learning. In NIPS, 2017.
|
| 379 |
+
423 [24] K. Ramamurthy, K. R. Varshney, and K. Mody. Topological data analysis of decision boundaries
|
| 380 |
+
424 with application to model selection. ArXiv, abs/1805.09949, 2019.
|
| 381 |
+
425 [25] B. A. Rieck, F. Sadlo, and H. Leitte. Topological machine learning with persistence indicator
|
| 382 |
+
426 functions. ArXiv, abs/1907.13496, 2019.
|
| 383 |
+
427 [26] B. A. Rieck, M. Togninalli, C. Bock, M. Moor, M. Horn, T. Gumbsch, and K. Borgwardt.
|
| 384 |
+
428 Neural persistence: A complexity measure for deep neural networks using algebraic topology.
|
| 385 |
+
429 ArXiv, abs/1812.09764, 2019.
|
| 386 |
+
430 [27] G. Tauzin, U. Lupo, L. Tunstall, J. B. Pérez, M. Caorsi, A. Medina-Mardones, A. Dassatti,
|
| 387 |
+
431 and K. Hess. giotto-tda: A topological data analysis toolkit for machine learning and data
|
| 388 |
+
432 exploration, 2020.
|
| 389 |
+
433 [28] M. Thoma. The reuters dataset, July 2017. URL https://martin-thoma.com/
|
| 390 |
+
434 nlp-reuters.
|
| 391 |
+
435 [29] S. Watanabe and H. Yamana. Topological measurement of deep neural networks using persistent
|
| 392 |
+
436 homology. In ISAIM, 2020.
|
| 393 |
+
437 [30] S. Watanabe and H. Yamana. Deep neural network pruning using persistent homology. In 2020
|
| 394 |
+
438 IEEE Third International Conference on Artificial Intelligence and Knowledge Engineering
|
| 395 |
+
439 (AIKE), pages 153–156. IEEE, 2020.
|
md/train/Bk9zbyZCZ/Bk9zbyZCZ.md
ADDED
|
@@ -0,0 +1,317 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# NEURAL MAP: STRUCTURED MEMORY FOR DEEP REINFORCEMENT LEARNING
|
| 2 |
+
|
| 3 |
+
Emilio Parisotto & Ruslan Salakhutdinov
|
| 4 |
+
Department of Machine Learning
|
| 5 |
+
Carnegie Mellon University
|
| 6 |
+
Pittsburgh, PA 15213, USA
|
| 7 |
+
{eparisot,rsalakhu}@cs.cmu.edu
|
| 8 |
+
|
| 9 |
+
# ABSTRACT
|
| 10 |
+
|
| 11 |
+
A critical component to enabling intelligent reasoning in partially observable environments is memory. Despite this importance, Deep Reinforcement Learning (DRL) agents have so far used relatively simple memory architectures, with the main methods to overcome partial observability being either a temporal convolution over the past $k$ frames or an LSTM layer. More recent work (Oh et al., 2016) has went beyond these architectures by using memory networks which can allow more sophisticated addressing schemes over the past $k$ frames. But even these architectures are unsatisfactory due to the reason that they are limited to only remembering information from the last $k$ frames. In this paper, we develop a memory system with an adaptable write operator that is customized to the sorts of 3D environments that DRL agents typically interact with. This architecture, called the Neural Map, uses a spatially structured 2D memory image to learn to store arbitrary information about the environment over long time lags. We demonstrate empirically that the Neural Map surpasses previous DRL memories on a set of challenging 2D and 3D maze environments and show that it is capable of generalizing to environments that were not seen during training.
|
| 12 |
+
|
| 13 |
+
# 1 INTRODUCTION
|
| 14 |
+
|
| 15 |
+
Memory is a crucial aspect of an intelligent agent’s ability to plan and reason in partially observable environments. Without memory, agents must act reflexively according only to their immediate percepts and cannot execute plans that occur over an extended time interval. Recently, Deep Reinforcement Learning agents have been capable of solving many challenging tasks such as Atari Arcade Games (Mnih et al., 2015), robot control (Levine et al., 2016) and 3D games such as Doom (Lample & Chaplot, 2016), but successful behaviours in these tasks have often only been based on a relatively short-term temporal context or even just a single frame. On the other hand, many tasks require long-term planning, such as a robot gathering objects or an agent searching a level to find a key in a role-playing game.
|
| 16 |
+
|
| 17 |
+
Neural networks that utilized external memories have recently had an explosion in variety, which can be distinguished along two main axes: memories with write operators and those without. Writeless external memory systems, often referred to as “Memory Networks” (Sukhbaatar et al., 2015; Oh et al., 2016), typically fix which memories are stored. For example, at each time step, the memory network would store the past M states seen in an environment. What is learnt by the network is therefore how to access or read from this fixed memory pool, rather than what contents to store within it.
|
| 18 |
+
|
| 19 |
+
The memory network approach has been successful in language modeling, question answering (Sukhbaatar et al., 2015) and was shown to be a sucessful memory for deep reinforcement learning agents in complex 3D environments (Oh et al., 2016). By side-steping the difficulty involved in learning what information is salient enough to store in memory, the memory network introduces two main disadvantages. The first disadvantage is that a potentially significant amount of redundant information could be stored. The second disadvantage is that a domain expert must choose what to store in the memory, e.g. for the DRL agent, the expert must set M to a value that is larger than the time horizon of the currently considered task.
|
| 20 |
+
|
| 21 |
+
On the other hand, external neural memories having write operations are potentially far more efficient, since they can learn to store salient information for unbounded time steps and ignore any other useless information, without explicitly needing any a priori knowledge on what to store. One prominent research direction within write-based architectures has been neural memories based on the types of memory structures that are found in computers, such as tapes, RAM, and GPUs. In contrast to typical recurrent neural networks, these neural computer emulators have far more structured memories which follow many of the same design paradigms that digital computers have traditionally utilized. One such model, the Differentiable Neural Computer (DNC) (Graves et al., 2016) and its predecessor the Neural Turing Machine (NTM) (Graves et al., 2014), structure the architecture to explicitly separate memory from computation. The DNC has a recurrent neural controller that can access an external memory resource by executing differentiable read and write operations. This allows the DNC to act and memorize in a structured manner resembling a computer processor, where read and write operations are sequential and data is store distinctly from computation. The DNC has been used sucessfully to solve complicated algorithmic tasks, such as finding shortest paths in a graph or querying a database for entity relations.
|
| 22 |
+
|
| 23 |
+
Building off these previous external memories, we introduce a new architecture called the Neural Map, a structured memory designed specifically for reinforcement learning agents in 3D environments. The Neural Map architecture overcomes some of the shortcomings of the previously mentioned neural memories. First, it uses an adaptable write operation and so its size and computational cost does not grow with the time horizon of the environment as it does with memory networks. Second, we impose a particular inductive bias on the write operation so that it is 1) well suited to 3D environments where navigation is a core component of sucessful behaviours, and 2) uses a sparse write operation that prevents frequent overwriting of memory locations that can occur with NTMs and DNCs. To accomplish this, we structure a DNC-style external memory in the form of a 2-dimensional map, where each position in the map is a distinct memory.
|
| 24 |
+
|
| 25 |
+
To demonstrate the effectiveness of the neural map, we run it on a variety of 2D partially-observable maze-based environments and test it against LSTM and memory network policies. Finally, to establish its scalability, we run a Neural Map agent on a set of challenging 3D maze environments based on the video game Doom.
|
| 26 |
+
|
| 27 |
+
# 2 BACKGROUND
|
| 28 |
+
|
| 29 |
+
A Markov Decision Process (MDP) is defined as a tuple $( S , { \mathcal { A } } , { \mathcal { T } } , \gamma , { \mathcal { R } } )$ where $s$ is a finite set of states, $\mathcal { A }$ is a finite set of actions, $\boldsymbol { \mathcal { T } } ( s ^ { \prime } | s , a )$ is the transition probability of arriving in state $s ^ { \prime }$ when executing action $a$ in initial state $s$ , $\gamma$ is a discount factor, and $\mathcal { R } ( s , a , s ^ { \prime } )$ is the reward function of executing action $a$ in state $s$ and ending up at state $s ^ { \prime }$ . We define a policy $\pi ( \cdot | s )$ as a mapping from a state $s$ to a distribution over actions, where $\pi ( a _ { i } | s )$ denotes the probability of action $a _ { i }$ given that we are in state $s$ . The value of a policy $V ^ { \pi } ( s )$ is the expected discounted cumulative reward when starting from state $s$ and sampling actions according to $\pi$ , i.e.: $\begin{array} { r } { V ^ { \pi } ( s ) = \mathbb { E } _ { \pi } \left[ \sum _ { t = 0 } ^ { \infty } \gamma ^ { t } R _ { t } | s _ { 0 } = s \right] } \end{array}$ .
|
| 30 |
+
|
| 31 |
+
An optimal value function, denoted $V ^ { * } ( s )$ , is the maximum value we can get from state $s$ according
|
| 32 |
+
to any policy, i.e. $V ^ { * } ( s ) = \operatorname* { m a x } _ { \pi } V ^ { \pi } ( s )$ . An optimal policy $\pi ^ { * }$ is defined as a policy which achieves
|
| 33 |
+
optimal value at each state, i.e. $V ^ { \pi ^ { * } } ( s ) = V ^ { * } ( s )$ . An optimal policy is guaranteed to exist (Sutton &
|
| 34 |
+
Barto, 1998). The REINFORCE algorithm (Williams, 1992) iteratively updates a given policy $\pi$ in the optimal policy. This update direction is defined by being the future cumulated reward for a particular ep $\nabla _ { \pi } \log \pi ( a _ { t } | s _ { t } ) G _ { t }$ with varia $G _ { t } =$
|
| 35 |
+
$\scriptstyle \sum _ { k = 0 } ^ { \infty } \gamma ^ { k } R _ { t + k }$ $b _ { t } ( s _ { t } )$
|
| 36 |
+
of the current state. Therefore the baseline-augmented update equation is $\begin{array} { r } { \nabla _ { \pi } \log \pi ( { a } _ { t } | { s } _ { t } ) ( G _ { t } - } \end{array}$
|
| 37 |
+
$b _ { t } ( s _ { t } ) )$ . The typically used baseline is the value function, $b _ { t } ( s _ { t } ) \stackrel { \textstyle - } { = } V ^ { \pi } ( s _ { t } )$ . This combination of
|
| 38 |
+
REINFORCE with value function baseline is commonly termed the “Actor-Critic” algorithm.
|
| 39 |
+
|
| 40 |
+
In this paper, we utilize Advantage Actor-Critic (A2C) (Mnih et al., 2016) with Generalized Advantage Estimation (Schulman et al., 2015), which can be seen as a specialization of the actor-critic framework when using deep networks to parameterize the policy and value function. The policy is a function of the state, parameterized as a deep neural network: ${ \dot { \pi } } ( a | s ) = f _ { \theta } ( s , a )$ , where f is a deep neural network with parameter vector $\theta$ .
|
| 41 |
+
|
| 42 |
+
# 3 NEURAL MAP
|
| 43 |
+
|
| 44 |
+
In this section, we will describe the details of the neural map. We assume we want our agent to act within some 2- or 3-dimensional environment. The neural map is the agent’s internal memory storage that can be read from and written to during interaction with its environment, but where the write operator is selectively limited to affect only the part of the neural map that represents the area where the agent is currently located. For this paper, we assume for simplicity that we are dealing with a 2-dimensional map. This can easily be extended to 3-dimensional or even higher-dimensional maps (i.e. a 4D map with a 3D sub-map for each cardinal direction the agent can face).
|
| 45 |
+
|
| 46 |
+
Let the agent’s position be $( x , y )$ with $x \in \mathbb { R }$ and $y \in \mathbb { R }$ and let the neural map $M$ be a $C \times H \times W$ feature block, where $C$ is the feature dimension, $H$ is the vertical extent of the map and $W$ is the horizontal extent. Assume there exists some coordinate normalization function $\psi ( x , y )$ such that every unique $( x , y )$ can be mapped into $( x ^ { \prime } , y ^ { \prime } )$ , where $x ^ { \prime } \in \{ 0 , \ldots , W { - } 1 \}$ and $y ^ { \prime } \in \{ 0 , \ldots , H { - } 1 \}$ . For ease of notation, suppose in the sequel that all coordinates have been normalized by $\psi$ into neural map space.
|
| 47 |
+
|
| 48 |
+
Let $s _ { t }$ be the current state embedding, $M _ { t }$ be the current neural map, and $( x _ { t } , y _ { t } )$ be the current position of the agent. The Neural Map is defined by the following set of equations:
|
| 49 |
+
|
| 50 |
+
$$
|
| 51 |
+
\begin{array} { r l } & { { r _ { t } } = r e a d ( M _ { t } ) , ~ { c _ { t } } = c o n t e x t ( M _ { t } , s _ { t } , r _ { t } ) , } \\ & { } \\ { w _ { t + 1 } ^ { ( x _ { t } , y _ { t } ) } = w r i t e ( s _ { t } , r _ { t } , c _ { t } , M _ { t } ^ { ( x _ { t } , y _ { t } ) } ) , ~ M _ { t + 1 } = u p d a t e ( M _ { t } , w _ { t + 1 } ^ { ( x _ { t } , y _ { t } ) } ) , } \\ & { } \\ { o _ { t } = [ { r _ { t } } , c _ { t } , w _ { t + 1 } ^ { ( x _ { t } , y _ { t } ) } ] , ~ \pi _ { t } ( a | s ) = \mathrm { S o f t m a x } ( f ( o _ { t } ) ) , } \end{array}
|
| 52 |
+
$$
|
| 53 |
+
|
| 54 |
+
where $w _ { t } ^ { ( x _ { t } , y _ { t } ) }$ represents the feature at position $( x _ { t } , y _ { t } )$ at time $t$ , $[ x _ { 1 } , \ldots , x _ { k } ]$ represents a concatenation operation, and $o _ { t }$ is the output of the neural map at time $t$ which is then processed by another deep network $f$ to get the policy outputs $\pi _ { t } ( a | s )$ . We will now separately describe each of the above operations in more detail:
|
| 55 |
+
|
| 56 |
+
Global Read Operation: The read operation passes the current neural map $M _ { t }$ through a deep convolutional network and produces a $C$ -dimensional feature vector $r _ { t }$ . The global read vector $r _ { t }$ summarizes information about the entire map.
|
| 57 |
+
|
| 58 |
+
Context Read Operation: The context operation performs context-based addressing to check whether certain features are stored in the map. It takes as input the current state embedding $s _ { t }$ and the current global read vector $r _ { t }$ and first produces a query vector $q _ { t }$ . The inner product of the query vector and each feature $M _ { t } ^ { ( x , y ) }$ in the neural map is then taken to get scores $a _ { t } ^ { ( x , y ) }$ at all positions $( x , y )$ . The scores are then normalized to get a probability distribution $\alpha _ { t } ^ { ( x , y ) }$ over every position in the map, also known as “soft attention” (Bahdanau et al., 2015). This probability distribution is used to compute a weighted average $c _ { t }$ over all features $M _ { t } ^ { ( x , y ) }$ . To summarize:
|
| 59 |
+
|
| 60 |
+
$$
|
| 61 |
+
\begin{array} { r c l } { { } } & { { } } & { { q _ { t } = W [ s _ { t } , r _ { t } ] , a _ { t } ^ { ( x , y ) } = q _ { t } \cdot M _ { t } ^ { ( x , y ) } , } } \\ { { } } & { { } } & { { \alpha _ { t } ^ { ( x , y ) } = \displaystyle \frac { e ^ { a _ { t } ^ { ( x , y ) } } } { \sum _ { ( w , z ) } e ^ { a _ { t } ^ { ( w , z ) } } } , c _ { t } = \sum _ { ( x , y ) } \alpha _ { t } ^ { ( x , y ) } M _ { t } ^ { ( x , y ) } , } } \end{array}
|
| 62 |
+
$$
|
| 63 |
+
|
| 64 |
+
where $W$ is a weight matrix. The context read operation allows the neural map to operate as an associative memory: the agent provides some possibly incomplete memory (the query vector $q _ { t } \mathrm { ~ . ~ }$ ) and the operation will return the completed memory that most closely matches $q _ { t }$ . So, for example, the agent can query whether it has seen something similar to a particular landmark that is currently within its view.
|
| 65 |
+
|
| 66 |
+
Local Write Operation: Given the agent’s current position $( x _ { t } , y _ { t } )$ at time $t$ , the write operation takes as input the current state embedding $s _ { t }$ , the global read output $r _ { t }$ , the context read vector $c _ { t }$ and the current feature at position $( x _ { t } , y _ { t } )$ in the neural map $M _ { t } ^ { ( x _ { t } , y _ { t } ) }$ and produces, using a deep neural network fw, a new C-dimensional vector w(xt,yt+1 . This vector functions as the new local write candidate vector at the current position $( x _ { t } , y _ { t } )$ : $w _ { t + 1 } ^ { ( x _ { t } , y _ { t } ) } = f _ { w } ( [ s _ { t } , r _ { t } , c _ { t } , M _ { t } ^ { ( x _ { t } , y _ { t } ) } ] )$
|
| 67 |
+
|
| 68 |
+
GRU-based Local Write Operation As previously defined, the write operation simply replaces the vector at the agent’s current position with a new feature produced by a deep network. Instead of this hard rewrite of the current position’s feature vector, we can use a gated write operation based on the recurrent update equations of the Gated Recurrent Unit (GRU) (Chung et al., 2014). Gated write operations have a long history in unstructured recurrent networks and they have shown a superior ability to maintain information over long time lags versus ungated networks. The GRU-based write operation is defined as:
|
| 69 |
+
|
| 70 |
+
$$
|
| 71 |
+
\begin{array} { r l } & { r _ { t + 1 } ^ { ( x _ { t } , y _ { t } ) } = \sigma ( W _ { r } [ s _ { t } , r _ { t } , c _ { t } , M _ { t } ^ { ( x _ { t } , y _ { t } ) } ] ) } \\ & { \hat { w } _ { t + 1 } ^ { ( x _ { t } , y _ { t } ) } = \operatorname { t a n h } ( W _ { \hat { h } } [ s _ { t } , r _ { t } , c _ { t } ] + U _ { \hat { h } } ( r _ { t + 1 } ^ { ( x _ { t } , y _ { t } ) } \odot M _ { t } ^ { ( x _ { t } , y _ { t } ) } ) ) } \\ & { z _ { t + 1 } ^ { ( x _ { t } , y _ { t } ) } = \sigma ( W _ { z } [ s _ { t } , r _ { t } , c _ { t } , M _ { t } ^ { ( x _ { t } , y _ { t } ) } ] ) } \\ & { w _ { t + 1 } ^ { ( x _ { t } , y _ { t } ) } = ( 1 - z _ { t + 1 } ^ { ( x _ { t } , y _ { t } ) } ) \odot M _ { t } ^ { ( x _ { t } , y _ { t } ) } + z _ { t + 1 } ^ { ( x _ { t } , y _ { t } ) } \odot \hat { w } _ { t + 1 } ^ { ( x _ { t } , y _ { t } ) } , } \end{array}
|
| 72 |
+
$$
|
| 73 |
+
|
| 74 |
+
where $x { \odot } y$ is the Hadamard product between vectors $x$ and $y , \sigma ( \cdot )$ is the sigmoid activation function and W∗ and U∗ are weight matrices. Using GRU terminology, r(xt,yt+1 ) is the reset gate, wˆ(xt,t+1 $\hat { w } _ { t + 1 } ^ { ( x _ { t } , y _ { t } ) }$ is the candidate activation and the GRU-based update can $z _ { t + 1 } ^ { ( x _ { t } , y _ { t } ) }$ is the update gate. By making use of the reset and update gates,e how much the new write vector should differ from the currently stored feature.
|
| 75 |
+
|
| 76 |
+
Map Update Operation: The update operation creates the neural map for the next time step. The new neural map $M _ { t + 1 }$ is equal to the old neural map $M _ { t }$ , except at the current agent position $( x _ { t } , y _ { t } )$ , where the current write candidate vector w(xt,yt+1 is stored:
|
| 77 |
+
|
| 78 |
+
$$
|
| 79 |
+
\begin{array} { r } { M _ { t + 1 } ^ { ( a , b ) } = \left\{ \begin{array} { l l } { w _ { t + 1 } ^ { ( x _ { t } , y _ { t } ) } , } & { \mathrm { f o r } ( a , b ) = ( x _ { t } , y _ { t } ) } \\ { M _ { t } ^ { ( a , b ) } , } & { \mathrm { f o r } ( a , b ) \neq ( x _ { t } , y _ { t } ) } \end{array} \right. } \end{array}
|
| 80 |
+
$$
|
| 81 |
+
|
| 82 |
+
# 4 EGO-CENTRIC NEURAL MAP
|
| 83 |
+
|
| 84 |
+
A major disadvantage of the neural map as previously described is that it requires some oracle to provide the current $( x , y )$ position of the agent. This is a difficult problem in and of itself, and, despite being well studied, it is far from solved. The alternative to using absolute positions within the map is to use relative positions. That is, whenever the agent moves between time steps with some velocity $( u , v )$ , the map is counter-transformed by $\left( - u , - v \right)$ , i.e. each feature in the map is shifted in the $H$ and $W$ dimensions. This will mean that the map will be ego-centric, i.e. the agent’s position will stay stationary in the center of the neural map while the world as defined by the map moves around them. Therefore in this setup we only need some way of extracting the agent’s velocity, which is typically a simpler task in real environments (for example, animals have inner ears and robots have accelerometers). Here we assume that there is some function $ { \boldsymbol { \xi } } ( u ^ { \prime } , v ^ { \prime } )$ that discretizes the agent velocities $( u ^ { \prime } , v ^ { \prime } )$ so that they represent valid velocities within the neural map $( u , v )$ . In the sequel, we assume that all velocies have been properly normalized by $\xi$ into neural map space.
|
| 85 |
+
|
| 86 |
+
Let $( p w , p h )$ be the center position of the neural map. The updated ego-centric neural map operations are shown below:
|
| 87 |
+
|
| 88 |
+
$$
|
| 89 |
+
\begin{array} { r l } & { \overline { { M } } _ { t } = C o u n t e r T r a n s f o r m ( M _ { t } , ( u _ { t } , v _ { t } ) ) } \\ & { \qquad r _ { t } = r e a d ( \overline { { M } } _ { t } ) \quad c _ { t } = c o n t e x t ( \overline { { M } } _ { t } , s _ { t } , r _ { t } ) } \\ & { w _ { t + 1 } ^ { ( p w , p h ) } = w r i t e \big ( s _ { t } , r _ { t } , c _ { t } , \overline { { M } } _ { t } ^ { ( p w , p h ) } \big ) \quad M _ { t + 1 } = e g o u p d a t e ( \overline { { M } } _ { t } , w _ { t + 1 } ^ { ( p w , p h ) } ) } \\ & { \qquad \quad o _ { t } = \big [ r _ { t } , c _ { t } , w _ { t + 1 } ^ { ( p w , p h ) } \big ] \quad \pi _ { t } = \mathrm { S o f t m a x } ( f ( o _ { t } ) ) } \end{array}
|
| 90 |
+
$$
|
| 91 |
+
|
| 92 |
+
Where $\overline { { M } } _ { t }$ is the current neural map $M _ { t }$ reverse transformed by the current velocity $\left( { { u } _ { t } } , { { v } _ { t } } \right)$ so that the agents map position remains in the center $( p w , p h )$ .
|
| 93 |
+
|
| 94 |
+
Counter Transform Operation: The CounterT ransform operation transforms the current neural map $M _ { t }$ by the inverse of the agent’s current velocity $\left( { { u } _ { t } } , { { v } _ { t } } \right)$ . Written formally:
|
| 95 |
+
|
| 96 |
+
$$
|
| 97 |
+
\overline { { { M } } } _ { t } ^ { ( a , b ) } = \left\{ \begin{array} { l r } { { M _ { t } ^ { ( a - u , b - v ) } , } } & { { \mathrm { f o r ~ } ( a - u ) \in \{ 1 , . . . , W \} \wedge ( b - v ) \in \{ 1 , . . . , H \} } } \\ { { 0 , } } & { { \mathrm { e l s e } } } \end{array} \right.
|
| 98 |
+
$$
|
| 99 |
+
|
| 100 |
+

|
| 101 |
+
Figure 1: Left: Images showing the 2D maze environment. The left side (Fig. 1a) represents the fully observable maze while the right side (Fig. 1b) represents the agent observations. The agent is represented by the yellow pixel with its orientation indicated by the black arrow within the yellow block. The starting position is always the topmost position of the maze. The red bounding box represents the area of the maze that is subsampled for the agent observation. In “Goal-Search”, the goal of the agent is to find a certain color block (either red or teal), where the correct color is provided by an indicator (either green or blue). This indicator has a fixed position near the start position of the agent. Right: State observations from the “Indicator” Doom maze environment. The agent starts in the middle of a maze looking in the direction of a torch indicator. The torch can be either green (top-left image) or red (bottom-left image) and indicates which of the goals to search for. The goals are two towers which are randomly located within the maze and match the indicator color. The episode ends whenever the agent touches a tower, whereupon it receives a positive reward if it reached the correct tower, while a negative reward otherwise.
|
| 102 |
+
|
| 103 |
+
While here we only deal with reverse translation, it is possible to handle rotations as well if the agent can measure it’s angular velocity.
|
| 104 |
+
|
| 105 |
+
Map Egoupdate Operation: The egoupdate operation is functionally equivalent to the update operation except only the center position $( p w , p h )$ is ever written to:
|
| 106 |
+
|
| 107 |
+
$$
|
| 108 |
+
M _ { t + 1 } ^ { \left( a , b \right) } = \left\{ \begin{array} { l l } { w _ { t + 1 } ^ { \left( p w , p h \right) } , } & { \mathrm { f o r } \left( a , b \right) = \left( p w , p h \right) } \\ { \overline { { M } } _ { t } ^ { \left( a , b \right) } , } & { \mathrm { f o r } \left( a , b \right) \neq \left( p w , p h \right) } \end{array} \right.
|
| 109 |
+
$$
|
| 110 |
+
|
| 111 |
+
# 5 EXPERIMENTS
|
| 112 |
+
|
| 113 |
+
To demonstrate the effectiveness of the Neural Map, we run it on 2D and 3D maze-based environments where memory is crucial to optimal behaviour. We compare to previous memory-based DRL agents, namely a simple LSTM-based agent which consists of a single pre-output LSTM layer as well as MemNN (Oh et al., 2016) agents.
|
| 114 |
+
|
| 115 |
+
# 5.1 2D GOAL-SEARCH ENVIRONMENT
|
| 116 |
+
|
| 117 |
+
The “Goal-Search” environment is adapted from Oh et al. (2016). Here the agent starts in a fixed starting position within some randomly generated maze with two randomly positioned goal states. It then observes an indicator at a fixed position near the starting state (i.e. the green tile at the top of the maze in Fig. 1a). This indicator will tell the agent which of the two goals it needs to go to (blue indicator teal goal, green indicator red goal). If the agent goes to the correct goal, it gains a positive reward while if it goes to the incorrect goal it gains a negative reward. Therefore the agent needs to remember the indicator as it searches for the correct goal state. In depth details of the 2D environment are given in Appendix B. The mazes during training are generated using a random generator. A held-out set of 1000 random mazes is kept for testing. This test set therefore represents maze geometries that have never been seen during training, and measure the agent’s ability to generalize to new environments.
|
| 118 |
+
|
| 119 |
+
The first baseline agent we evaluate is a recurrent network with 128 LSTM units. The other baseline is the MQN, which is a memory-network-based architecture that performs attention over the past K states it has seen (Oh et al., 2016). Both LSTM and MQN models receive a one-hot encoding of the agent’s current location, previous velocity, and current orientation at each time step, in order to make the comparison to the fixed-frame Neural Map fair. We test these baselines against several Neural Map architectures, with each architecture having a different design choice.
|
| 120 |
+
|
| 121 |
+
2D Goal-Search
|
| 122 |
+
Table 1: Results of several different agent architectures on the “Goal-Search” environment. The “train” columns represents the number of mazes solved (in $\%$ ) when sampling from the same distribution as used during training. The “test” columns represents the number of mazes solved when run on a set of held-out maze samples which are guaranteed not to have been sampled during training.
|
| 123 |
+
|
| 124 |
+
<table><tr><td rowspan="2">Agent</td><td colspan="3">Train</td><td colspan="3">Test</td></tr><tr><td>7-11</td><td>13-15</td><td>Total</td><td>7-11</td><td>13-15</td><td>Total</td></tr><tr><td>Random</td><td>41.9%</td><td>25.7%</td><td>38.1%</td><td>46.0%</td><td>29.6%</td><td>38.8%</td></tr><tr><td>LSTM</td><td>84.7%</td><td>74.1%</td><td>87.4%</td><td>96.3%</td><td>83.4%</td><td>91.4%</td></tr><tr><td>MQN-32</td><td>80.2%</td><td>64.4%</td><td>83.3%</td><td>95.9%</td><td>74.6%</td><td>87.4%</td></tr><tr><td>MQN-64</td><td>83.2%</td><td>69.6%</td><td>85.8%</td><td>96.5%</td><td>76.7%</td><td>88.3%</td></tr><tr><td>Neural Map (15x15)</td><td>92.4%</td><td>80.5%</td><td>89.2%</td><td>93.5%</td><td>87.9%</td><td>91.7%</td></tr><tr><td>Neural Map + GRU (15x15)</td><td>97.0%</td><td>89.2%</td><td>94.9%</td><td>97.7%</td><td>94.0%</td><td>96.4%</td></tr><tr><td>Neural Map + GRU(8x8)</td><td>94.9%</td><td>90.7%</td><td>95.6%</td><td>98.0%</td><td>95.8%</td><td>97.3%</td></tr><tr><td>Neural Map +GRU + Pos (8x8)</td><td>95.0%</td><td>91.0%</td><td>95.9%</td><td>98.3%</td><td>94.3%</td><td>96.5%</td></tr><tr><td>Neural Map + GRU + Pos (6x6)</td><td>90.9%</td><td>83.2%</td><td>91.8%</td><td>97.1%</td><td>90.5%</td><td>94.0%</td></tr><tr><td>Ego Neural Map + GRU (15x15)</td><td>94.6%</td><td>91.1%</td><td>95.4%</td><td>97.7%</td><td>92.1%</td><td>95.5%</td></tr><tr><td>Ego Neural Map +GRU + Pos (15x15)</td><td>74.6%</td><td>63.9%</td><td>78.6%</td><td>87.8%</td><td>73.2%</td><td>82.7%</td></tr></table>
|
| 125 |
+
|
| 126 |
+
The results are reported in Table 1. During testing, we extend the maximum episode length from 100 to 500 steps so that the agent is given more time to solve the maze. The brackets next to the model name represent the Neural Map dimensions of that particular model. From the results we can see that the Neural Map architectures solve the most mazes in both the training and test distributions compared to both LSTM and MQN baselines.
|
| 127 |
+
|
| 128 |
+
The results also demonstrate the effect of certain design decisions. One thing that can be observed is that using GRU updates adds several percentage points to the success rate (“Neural Map (15x15)” v.s. “Neural $\mathrm { M a p } + \mathrm { G R U } \left( 1 5 \mathrm { x } 1 5 \right) ^ { \circ } )$ . We also tried downsampled Neural Maps, such that a pixel in the memory map represents several discrete locations in the environment. The Neural Map seems quite robust to this downsampling, with a downsampling of around 3 (6x6 v.s. 15x15) doing just a few percentage points worse, and still beating all baseline models. The 6x6 model has approximately the same number of memory cells as “MQN- $. 3 2 ^ { \circ }$ , but its performance is much better, showing the benefit of having learnable write operations. For the egocentric model, in order to cover the entire map we set the pixels to be $2 \mathbf { x }$ smaller in each direction, so each pixel is only a quarter of a pixel in the fixed-frame map. Even with this coarser representation, the egocentric model did similarly to the fixed frame one. We demonstrate an example of what the Neural Map learned to address using its context operator in Appendix E.
|
| 129 |
+
|
| 130 |
+
Finally, we tried adding the one-hot position encoding as a state input to the Neural Map, as is done for the baselines. We can see that there is a small improvement, but it is largely marginal, with the Neural Map doing a decent job of learning how to represent its own position without needing to be told explicitly. One interesting thing that we observed is that having the one-hot position encoding as an input to the egocentric map decreased performance, perhaps because it is difficult for the network to learn a mapping between fixed and egocentric frames.
|
| 131 |
+
|
| 132 |
+
Note that sometimes the percentage results are lower for the training distribution. This is mainly because the training set encompases almost all random mazes except the fixed 1000 of the test set, thus making it likely that the agent sees each training map only once.
|
| 133 |
+
|
| 134 |
+
Beyond train/test splits, the results are further separated by maze size. This information reveals that the memory networks are hardest hit by increasing maze size with sometimes a $20 \%$ drop in success on 13-15 v.s. 7-11. This is perhaps unsurprising given the inherent fixed time horizon of memory netwoks, and further reveals the benefit of using write-based memories.
|
| 135 |
+
|
| 136 |
+

|
| 137 |
+
Figure 2: Top-down views showing succesful episodes in each of the 3 Doom maze tasks. The red lines indicate the path traveled by the agent. Indicator is shown in Fig. 2a, where the agent receives positive reward when entering the corresponding tower that matches the torch color it saw at the start of the episode and a negative reward otherwise. The episode terminates once the agent has reached a tower. Repeating, shown in Fig. 2b, has the same underlying mechanics except (1) the episode persists for $T$ time steps regardless of towers entered and (2) the torch indicator is removed from the maze after the agent has reached a tower once. Therefore the agent needs to find the correct tower and then optimize its path to that tower. Minotaur shown in Fig. 2c requires the agent to reach the red goal and then return to the green goal that is at its starting position. Here the torch does not have any function. This fully-observable top-down view was not made available to the agent and is only used for visualization.
|
| 138 |
+
|
| 139 |
+
# 5.2 3D DOOM ENVIRONMENT DESCRIPTION
|
| 140 |
+
|
| 141 |
+
To demonstrate that our method can work in much more complicated 3D environments with longer time lags, we implemented three 3D maze environments using the ViZDoom (Kempka et al., 2016) API and a random maze generator. Examples of all three environments are given in Figure 2.
|
| 142 |
+
|
| 143 |
+
Indicator Maze: The first environment is a recreation of the 2D indicator maze task, where an indicator is positioned in view of the player’s starting state which is either a torch of red or green color. The goals are corresponding red/green towers that are randomly positioned throughout the maze that the player must locate.
|
| 144 |
+
|
| 145 |
+
Repeating Maze: The second environment is a variant of this indicator maze but whenever the player enters a goal state, it is teleported back to the beginning of the maze without terminating the episode (i.e. it retains its memory of the current maze). It gains a positive reward if it reaches the correct goal and a negative reward if it reaches the incorrect goal. After the first goal is reached, the correct indicator color is no longer displayed within the maze and a red indicator is displayed afterwards instead (regardless if the correct goal is green). An episode ends after a predetermined number of steps which depends on the maze size. The goal is therefore to find a path to the correct goal, and then optimize that path so that it can reach it as many times as possible.
|
| 146 |
+
|
| 147 |
+
Minotaur Maze: The third environment has the agent start in a fixed starting position next to the green tower, while the red tower is randomly placed somewhere in the maze. The agent receives a small positive reward if it reaches the red tower, and a larger positive reward if after reaching the red tower it returns to the green tower. Therefore the agent must efficiently navigate to the red goal while accurately remember its entire path it so that it can backtrack to the start.
|
| 148 |
+
|
| 149 |
+
All three environments used a $\mathrm { R G B + D }$ image of size $1 0 0 \mathrm { x } 6 0$ as input. We generate maze geometries randomly at train time but make sure to exclude a test set of 10 mazes for each size [4, 5, 6, 7, 8] (50 total). For these environments, we tested out four architectures (see Appendix C for more details on both environments and architectures):
|
| 150 |
+
|
| 151 |
+
Neural Map with Controller LSTM: Standard Neural Map with fixed frame addressing and GRU updates. We combine the neural map design with an LSTM that aggregates past state, read and context vectors and produces the query vector for the next time step’s context read operation. See Appendix A for the modified Neural Map equations.
|
| 152 |
+
|
| 153 |
+
Ego Neural Map with Controller LSTM: Same as previous but with ego-centric addressing. The other difference is that the Ego Neural Map does not receive any positional input unlike the other 3 models, only receiving frame-by-frame ego-motion (quantized to a coarse grid).
|
| 154 |
+
|
| 155 |
+
LSTM: Single pre-output 256-dimensional LSTM layer.
|
| 156 |
+
|
| 157 |
+
<table><tr><td rowspan="2">Agent Maze Size</td><td colspan="6">Indicator</td><td colspan="6">Repeating</td><td colspan="4">Minotaur</td></tr><tr><td>4</td><td></td><td>5</td><td>6</td><td>8</td><td></td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td></tr><tr><td rowspan="2">LSTM</td><td>Acc</td><td>95.7</td><td>87.5</td><td>81.1</td><td>71.4</td><td>60.3</td><td>-</td><td>-</td><td>-</td><td>1</td><td>-</td><td>90.0</td><td>71.5</td><td>48.0</td><td>34.2</td><td>29.4</td></tr><tr><td>Rew</td><td>-</td><td>1</td><td>1</td><td>1</td><td>-</td><td>7.26</td><td>7.58</td><td>6.065.32</td><td></td><td>4.98</td><td>1.35</td><td>1.07</td><td>0.72</td><td>0.51</td><td>0.44</td></tr><tr><td rowspan="2">FRMQN</td><td>Acc</td><td>87.3</td><td>82.9</td><td>78.0</td><td>72.0</td><td>59.8</td><td>-</td><td>-</td><td>1</td><td>1</td><td>1</td><td>72.7</td><td>54.5</td><td>38.8</td><td>28.8</td><td>23.7</td></tr><tr><td>Rew</td><td>-</td><td>-</td><td>-</td><td>1</td><td>-</td><td>1.45</td><td>1.65</td><td>1.51</td><td>1.37</td><td>1.09</td><td>1.09</td><td>0.82</td><td>0.58</td><td>0.43</td><td>0.36</td></tr><tr><td rowspan="2">Controller</td><td>Acc</td><td>95.8</td><td>90.3</td><td>81.8</td><td>80.4</td><td>70.3</td><td>-</td><td>1</td><td>1</td><td></td><td></td><td>99.7</td><td>92.2</td><td>67.5</td><td>37.9</td><td>30.2</td></tr><tr><td>Rew</td><td>-</td><td>1</td><td>-</td><td>1</td><td>-</td><td>17.4</td><td>17.1</td><td>12.0</td><td>1 11.4</td><td>1 12.3</td><td>1.50</td><td>1.38</td><td>1.01</td><td>0.57</td><td>0.45</td></tr><tr><td>NMap Controller</td><td>Acc</td><td>94.6</td><td>91.0</td><td>87.6</td><td>85.8</td><td>72.2</td><td></td><td>-</td><td></td><td></td><td></td><td>98.6</td><td>90.0</td><td>65.2</td><td>44.7</td><td>33.8</td></tr><tr><td>Ego-NMap</td><td>Rew</td><td>1</td><td>-</td><td>-</td><td>1</td><td>1</td><td>- 12.8</td><td>14.1</td><td>1 11.0</td><td>- 10.4</td><td>- 9.72</td><td>1.48</td><td>1.35</td><td>0.98</td><td>0.67</td><td>0.51</td></tr></table>
|
| 158 |
+
|
| 159 |
+
Table 2: Doom results on mazes not observed during training for the three tasks: Indicator, Repeating and Minotaur. Acc stands for Accuracy and Rew for Reward. Accuracy for Indicator means $\%$ of correct goals reached, while for Minotaur it means $\%$ of episodes where the agent successfully reached the goal and then backtracked to the beginning. Reward for Repeating is number of times correct goal was visited within the allotted time steps $_ { + 1 }$ for correct goal, -1 for incorrect goal). Reward for Minotaur is $+ 0 . 5$ for reaching the goal and then $+ 1 . 0$ for backtracking to start after reaching goal (max episode reward is $+ 1 . 5$ ). We tested on maze sizes between [4,8] with 10 test mazes for each size. For each of the 50 total test mazes we ran 100 episodes with random goal locations and averaged the result.
|
| 160 |
+
|
| 161 |
+
FRMQN (Oh et al., 2016): Memory network with LSTM feedback. This design uses an LSTM to make recurrent context queries to the memory network database. In addition, for the memory network baselines we did not set a fixed $\mathbf { k }$ but instead let it access any state from its entire episode. This means no information is lost to the memory network, it only needs to process its history.
|
| 162 |
+
|
| 163 |
+
The results are shown in Table 2. We can see that the Neural Map architectures work better than the baseline models, even though the memory network has access to its entire episode history at every time step. The ego-centric Neural Map beats the fixed frame map at Indicator, and gets similar performance on both Repeating and Minotaur environments, showing the ability of the Neural Map to function effectively even without global position information. It is possible that having a fixed frame makes path optimization easier, which would explain the larger rewards that the fixed-frame model got in the Repeating task. We also investigated whether the neural map is robust to localization noise, which would be the case in a real world setting where we do not have access to a localization oracle and must instead rely on an error-prone odometry or SLAM-type algorithm to do localization. These results are presented in Appendix D.
|
| 164 |
+
|
| 165 |
+
For the baselines, we can see that FRMQN has difficulty learning on Repeating, only reaching the goal on average once. This could be because the indicator is only shown before the first goal is reached and so afterwards it needs to remember increasingly longer time horizons. Furthermore, because the red indicator is always shown after the first goal is reached, it might be difficult for the model to learn to do retrieval since the original correct indicator must be indexed by time and not image similarity. The FRMQN also has difficulty on Minotaur, probably due to needing to remember and organize a lot of spatial information (i.e. what actions were taken along the path). For Indicator, the FRMQN does similarly to the LSTM. We can see that the spatial structure of the Neural Map aids in optimizing the path in Repeating, averaging 12 goal reaches even in the largest maze size.
|
| 166 |
+
|
| 167 |
+
# 6 RELATED WORK
|
| 168 |
+
|
| 169 |
+
Other than the straightforward architectures of combining an LSTM with Deep Reinforcement Learning (DRL) (Mnih et al., 2016; Hausknecht & Stone, 2015), there has also been work on using more advanced external memory systems with DRL agents to handle partial observability. Oh et al. (2016) used a memory network (MemNN) to solve maze-based environments similar to the ones presented in this paper. MemNN keeps the last $M$ states in memory and encodes them into (key, value) feature pairs. It then queries this memory using a soft attention mechanism similar to the context operation of the Neural Map, except in the Neural Map the key/value features were written by the agent and aren’t just a stored representation of the last $M$ frames seen. Oh et al. (2016) tested a few variants of this basic model, including ones which combined both LSTM and memory-network style memories.
|
| 170 |
+
|
| 171 |
+
In contrast to memory networks, another research direction is to design recurrent architectures that mimic computer memory systems. These architectures explicitly separate computation and memory in a way anagolous to a modern digital computer, in which some neural controller (akin to a CPU) interacts with an external memory (RAM). One recent model is similar to the Neural Map, called the Differentiable Neural Computer (DNC) (Graves et al., 2016), which combines a recurrent controller with an external memory system that allows several types of read/write access. In addition to defining an unconstrained write operator (in contrast to the neural map’s write location being fixed), the DNC has a selective read operation that reads out the memory either by content or in the order that it was written. While the DNC is more specialized to solving algorithmic problems, the Neural Map can be seen as an extension of this Neural Computer framework to 3D environments, with a specific inductive bias on its write operator that allows sparse writes. Recently work has also been done toward sparsifying the read and write operations of the DNC (Rae et al., 2016). This work was not focused on 3D environments and did not make any use of task-specific biases like agent location, but instead used more general biases like “Least-Recently-Used” memory addresses to force sparsity. More recently, the DNC, in conjunction with a VIN planning network (Tamar et al., 2016), has been applied to the task of navigating partially-observable environments (Khan et al., 2018) although it still relied on supervised learning in order to train the complete system.
|
| 172 |
+
|
| 173 |
+
Gupta et al. (2017) designed a similar 2D map structured memory, with the aim to do robot navigation in 3D environments. These environments were based off image scans of real office buildings, and they were preprocessed into a grid-world by quantizing the possible positions and orientations the agent could assume. In contrast to our paper, which presents the Neural Map more as a general memory architecture for DRL agents, Gupta et al. (2017) focuses mainly on solving the task of robot navigation, with the internal map’s representation mainly used to represent free space around the robot. More concretely, the task in these environments was to navigate to a goal state, with the goal position either stated semantically (find a chair) or stated in terms of the position relative to the robot’s coordinate frame. Another key difference was that their formulation lacked a context addressing operation. Finally, their method used DAGGER (Ross et al., 2011), an imitation learning algorithm, to train their agent. Since Doom actions affect translational/rotational accelerations, training using imitation learning is more difficult since a search algorithm cannot be used directly as supervision. An interesting addition they made was the use of a multi-scale map representation and a Value Iteration network (Tamar et al., 2016) to do better path planning. Another related work, Neural SLAM (Zhang et al., 2017) extends spatial memories to settings where localization/odometry is not provided a priori, but instead has to be completed in tandem with the mapping of the environment. In order to accomplish that, a grid-based localization system was combined with a Neural Map-style memory in order to do differentiable SLAM-like combined localization and mapping.
|
| 174 |
+
|
| 175 |
+
# 7 CONCLUSION
|
| 176 |
+
|
| 177 |
+
In this paper we developed a neural memory architecture that organizes the spatial structure of its memory in the form of a 2D map, and allows sparse writes to this memory where the memory address of the write is in a correspondence to the agent’s current position in the environment. We showed its ability to learn, using a reinforcement signal, how to behave within challenging 2D and 3D maze tasks that required storing information over long time steps. The results demonstrated that our architecture surpassed baseline memories used in previous work. Additionally, we showed the benefit of certain design decisions made in our architecture: using GRU updates instead of hard writes, demonstrating that the ego-centric viewpoint does not diminish performance and that the Neural Map is robust to downsampling its memory. Finally, to show that our method can scale up to more difficult 3D environments, we implemented several new maze environments in Doom. Using a hybrid Neural $\mathbf { M a p } + \mathbf { L S T M }$ model, we were able to solve most of the scenarios at a performance higher than previous DRL memory-based architectures. Furthermore, we demonstrated the ability of the Neural Map to be robust to a certain level of drift noise in its localization estimate.
|
| 178 |
+
|
| 179 |
+
# Acknowledgements
|
| 180 |
+
|
| 181 |
+
This work was supported by Apple, DARPA award D17AP00001, the Google focused award. The authors would also like to thank NVidia NVAIL award for donating DGX-1 deep learning machine. This work used the Extreme Science and Engineering Discovery Environment (XSEDE), which is supported by National Science Foundation grant number OCI-1053575. Specifically, it used the Bridges system, which is supported by NSF award number ACI-1445606, at the Pittsburgh Supercomputing Center (PSC).
|
| 182 |
+
|
| 183 |
+
# REFERENCES
|
| 184 |
+
|
| 185 |
+
D. Bahdanau, K. H. Cho, and Y. Bengio. Neural machine translation by jointly learning to align and translate. In Proceedings of the 3rd International Conference on Learning Representations 2015, 2015.
|
| 186 |
+
|
| 187 |
+
J. Chung, C. Gulcehre, K. Cho, and Y. Bengio. Empirical evaluation of gated recurrent neural networks on sequence modeling. CoRR, abs/1412.3555, 2014. URL https://arxiv.org/ abs/1412.3555.
|
| 188 |
+
|
| 189 |
+
A. Graves, G. Wayne, and I. Danihelka. Neural turing machines. CoRR, abs/1410.5401, 2014. URL https://arxiv.org/abs/1410.5401.
|
| 190 |
+
|
| 191 |
+
A. Graves, G. Wayne, M. Reynolds, T. Harley, I. Danihelka, A. Grabska-Barwiska, S. G. Colmenarejo, E. Grefenstette, T. Ramalho, J. Agapiou, A. P. Badia, K. M. Hermann, Y. Zwols, G. Ostrovski, A. Cain, H. King, C. Summerfield, P. Blunsom, K. Kavukcuoglu, and D. Hassabis. Hybrid computing using a neural network with dynamic external memory. Nature, 538: 471–476, 2016.
|
| 192 |
+
|
| 193 |
+
S. Gupta, J. Davidson, S. Levine, R. Sukthankar, and J. Malik. Cognitive mapping and planning for visual navigation. CoRR, abs/1702.03920, 2017. URL https://arxiv.org/abs/1702. 03920.
|
| 194 |
+
|
| 195 |
+
M. Hausknecht and P. Stone. Deep recurrent q-learning for partially observable mdps. CoRR, abs/1507.06527, 2015. URL https://arxiv.org/abs/1507.06527.
|
| 196 |
+
|
| 197 |
+
Michał Kempka, Marek Wydmuch, Grzegorz Runc, Jakub Toczek, and Wojciech Jaskowski. ViZ- ´ Doom: A Doom-based AI research platform for visual reinforcement learning. In IEEE Conference on Computational Intelligence and Games, pp. 341–348, Santorini, Greece, Sep 2016. IEEE.
|
| 198 |
+
|
| 199 |
+
A. Khan, C. Zhang, N. Atanasov, K. Karydis, V. Kumar, and D. D. Lee. Memory augmented control networks. In Proceedings of the 6th International Conference on Learning Representations, 2018.
|
| 200 |
+
|
| 201 |
+
G. Lample and D. S. Chaplot. Playing fps games with deep reinforcement learning. CoRR, abs/1609.05521, 2016. URL https://arxiv.org/abs/1609.05521.
|
| 202 |
+
|
| 203 |
+
Sergey Levine, Chelsea Finn, Trevor Darrell, and Pieter Abbeel. End-to-end training of deep visuomotor policies. Journal of Machine Learning Research, 17(39):1–40, 2016.
|
| 204 |
+
|
| 205 |
+
V. Mnih, K. Kavukcuoglu, D. Silver, A. A. Rusu, J. Veness, M. G. Bellemare, A. Graves, M. Riedmiller, A. K. Fidjeland, G. Ostrovski, S. Petersen, C. Beattie, A. Sadik, I. Antonoglou, H. King, D. Kumaran, D. Wierstra, S. Legg, and D. Hassabis. Human-level control through deep reinforcement learning. Nature, 518:529–533, 2015.
|
| 206 |
+
|
| 207 |
+
V. Mnih, A. P. Badia, M. Mirza, A. Graves, T. Harley, T. P. Lillicrap, D. Silver, and K. Kavukcuoglu. Asynchronous methods for deep reinforcement learning. In Proceedings of the 33rd International Conference on Machine Learning (ICML), 2016.
|
| 208 |
+
|
| 209 |
+
J. Oh, V. Chockalingam, S. Singh, and H. Lee. Control of memory, active perception, and action in minecraft. In Proceedings of the 33rd International Conference on Machine Learning (ICML), 2016.
|
| 210 |
+
|
| 211 |
+
J. W. Rae, J. J. Hunt, T. Harley, I. Danihelka, A. Senior, G. Wayne, A. Graves, and T. Lillicrap. Scaling memory-augmented neural networks with sparse reads and writes. CoRR, abs/1610.09027, 2016. URL https://arxiv.org/abs/1610.09027.
|
| 212 |
+
|
| 213 |
+
Stephane Ross, Geoffrey J Gordon, and Drew Bagnell. A reduction of imitation learning and struc-´ tured prediction to no-regret online learning. In AISTATS, volume 1, pp. 6, 2011.
|
| 214 |
+
|
| 215 |
+
John Schulman, Philipp Moritz, Sergey Levine, Michael Jordan, and Pieter Abbeel. Highdimensional continuous control using generalized advantage estimation. In Proceedings of the 4th International Conference on Learning Representations 2016, 2015.
|
| 216 |
+
|
| 217 |
+
S. Sukhbaatar, A. Szlam, J. Weston, and R. Fergus. End-to-end memory networks. In Advances in Neural Information Processing Systems, pp. 2440–2448, 2015.
|
| 218 |
+
R. Sutton and A. Barto. Reinforcement Learning: an Introduction. MIT Press, 1998.
|
| 219 |
+
Aviv Tamar, Yi Wu, Garrett Thomas, Sergey Levine, and Pieter Abbeel. Value iteration networks. In Advances in Neural Information Processing Systems, pp. 2146–2154, 2016.
|
| 220 |
+
R. J. Williams. Simple statistical gradient-following algorithms for connectionist reinforcement learning. Machine Learning, 8(3):229–256, 1992.
|
| 221 |
+
J. Zhang, L. Tai, J. Boedecker, W. Burgard, and M. Liu. Neural slam: Learning to explore with external memory. CoRR, abs/1706.09520, 2017. URL https://arxiv.org/abs/1706. 09520.
|
| 222 |
+
|
| 223 |
+
# A CONTROLLER (EGO-)NEURAL MAP
|
| 224 |
+
|
| 225 |
+
Here we describe the modification to the Neural Map we utilized for the 3D maze tasks. We include an extra state $h$ that represents the hidden and cell state of an LSTM. The Neural Map equations are therefore:
|
| 226 |
+
|
| 227 |
+
$$
|
| 228 |
+
\begin{array} { r l } & { r _ { t } = r e a d ( M _ { t } ) , } \\ & { h _ { t } = L S T M ( s _ { t } , r _ { t } , c _ { t - 1 } , h _ { t - 1 } ) , } \\ & { c _ { t } = c o n t e x t ( M _ { t } , h _ { t } ) , } \\ & { w _ { t + 1 } ^ { ( x _ { t } , y _ { t } ) } = w r i t e ( s _ { t } , r _ { t } , c _ { t } , M _ { t } ^ { ( x _ { t } , y _ { t } ) } ) , } \\ & { M _ { t + 1 } = w p d a t e ( M _ { t } , w _ { t + 1 } ^ { ( x _ { t } , y _ { t } ) } ) , } \\ & { \qquad o _ { t } = [ r _ { t } , c _ { t } , w _ { t + 1 } ^ { ( x _ { t } , y _ { t } ) } ] , } \\ & { \pi _ { t } ( a | s ) = \mathrm { S o f t m a x } ( f ( o _ { t } ) ) , } \end{array}
|
| 229 |
+
$$
|
| 230 |
+
|
| 231 |
+
# B 2D ENVIRONMENT DETAILS
|
| 232 |
+
|
| 233 |
+
The state input for the 2D environment is a $5 \times 1 5 \times 3$ subsample of the complete maze so that the agent is able to see 15 pixel forward and 3 pixels on the side (center pixel $^ +$ one pixel on each side of the agent) which is depicted in Fig.1b. This view is obscured so the agent is prevented from seeing the identity of anything behind walls. The 5 binary channels in the observation represent object identities: channel 1 represents presence of walls, 2 represents the green indicator, 3 the blue indicator, 4 the red goal, and 5 the teal goal. The LSTM and MemNN networks were given auxiliary information such as the one-hot encoding of the current agent’s true position in the maze. Neural Map variants were not given position information in an auxiliary state unless specified by the $^ { 6 6 } +$ Pos” modifier in Table 1. Actions in the environment included moving forward and turning left/right 90 degrees.
|
| 234 |
+
|
| 235 |
+
For optimization, all architectures used the RMSprop optimization algorithm with gradients thresholded to norm 20 for LSTM, 100 for Neural Map variants, and no thresholding for memory networks. We used an auxiliary weighted entropy loss on the Synchronous Actor-Critic with weight 0.01. The learning rates for LSTM models was 0.0025, 0.005 for Neural Map variants, and 0.001 for memory networks. We obtained the hyperparameters during a limited hyperparameter sweep on a simpler version of the environment. We used A2C with number of time steps equal to 5. We trained for 10 million updates.
|
| 236 |
+
|
| 237 |
+
The mazes were generated using an algorithm based on Depth-First Search to form a fully-connected maze. Afterwards each wall was deleted with probability $p . p$ was sampled uniformly from between $[ 0 , 0 . 7 5 ]$ at maze generation time. Each episode, a random maze width was sampled uniformly from between [7, 15].
|
| 238 |
+
|
| 239 |
+
(Ego-)Neural Map Agent Details: For the global read operation, we used a convolutional network with 3 layers of 8 channels and kernel size 3. The strides were set to 1 on the first layer, and 2 to the second and third layers. Padding was 1 on the first layer and 0 on other layers. The 3 convolutional layers were then followed by a fully-connected layer of dimension 256 and then another fullyconnected layer of size 32. All activations were relu except the 32 dimension layer, which was set to tanh. Positions were normalized so that the largest map size used all positions, while smaller mazes used a subset of the map.
|
| 240 |
+
|
| 241 |
+
LSTM Agent Details: The LSTM agent had a single 128-dimension LSTM layer on top of the state embedding. The auxiliary state information was first processed into a 256-dimension embedding.
|
| 242 |
+
|
| 243 |
+
MQN Agent Details: Each past history state was 512-dimensional (256-dimensional key $+ \ 2 5 6$ - dimensional value feature). The input state was processed by a convolutional network with 32 channels, filter size 3, stride 1 and padding 1.
|
| 244 |
+
|
| 245 |
+
# C 3D ENVIRONMENT DETAILS
|
| 246 |
+
|
| 247 |
+
The state input for all 3D environments was a $1 0 0 \mathrm { x } 6 0 \ \mathrm { R G B + D }$ image. This was passed through a convolution network that was the same for all architectures. It first consists of a 2D convolution with 32 channels of filter size 8 with stride 4. This was then passed to another 2D convolution with 64 channels of filter size 4 and stride 2. Finally, the result was passed through a fully-connected layer with 512 features, which represented the current frame embedding. The frame embedding was then augmented with some auxiliary information about the map, which in the case of Neural Map, FRMQN and LSTM architectures was 1) a one-hot encoding of the current time step, 2) the current orientation (North/East/West/South), 3) the 2D velocity (change in x/y position in a top-down 2D quantized grid of possible environment positions), and 4) a one-hot encoding of the agent’s current quantized position. For Ego Neural Map, only 1, 2, 3 are used (i.e. it has no input of the agent’s current true position given by an oracle). The 512 frame encoding is concatenated with the auxiliary state information to form the complete state embedding. Actions in the maze consist of moving forward and turning left or right.
|
| 248 |
+
|
| 249 |
+
For optimization, all architectures used the Adam optimization algorithm with gradients thresholded to a norm of 40. We used an auxiliary weighted entropy loss on the Synchronous Actor-Critic with weight 0.01. The learning rate for LSTM models was 0.0005, while for other architectures it was set to 0.00075. The hyperparameters were obtained during a limited hyperparameter sweep on a simpler version of the Indicator Maze environment. We trained A2C with a number of steps equal to the episode length (no truncated backprop). We trained the agent for 3000 steps, where each step consisted of a gradient obtained from 100 full episodes. The effective batch size was thus upper bounded by $5 0 0 * 1 0 0 = 5 0 0 0 0$ . We used multithreading to calculate the batch gradients efficiently. Each update step took on the order of 1-3 minutes depending on the number of threads available, meaning each agent took on the order of a week to train.
|
| 250 |
+
|
| 251 |
+
The mazes were generated using an algorithm based on Depth-First Search. Once the completed fully-connected maze was generated, random walls were deleted with a probability $p$ . This $p$ probability was chosen at maze creation time and was sampled uniformly from between 0.0 and 0.6. Mazes were between size 4 to size 8. The size of a maze represents how many “cells” there are in the maze, where a cell is an area which can potentially have walls on each side. A set of 50 test maze geometries were sampled to act as a test set, and were made sure to never be sampled during training. These 50 test mazes were generated with $p = 0$ , so they represent the most difficult mazes seen during training due to their higher degree of partial-observability. Goal locations were sampled uniformly at random when the mazes are generated.
|
| 252 |
+
|
| 253 |
+
Indicator Maze Details: The indicator mazes used a curriculum approach to accelerate learning. In $50 \%$ of the episodes sampled, only one goal existed in the environment and the indicator color matched the single goal color, making entering an incorrect goal impossible. This curriculum prevented the agents from learning to always enter a single color goal, which happened often when learning on only double goal environments. The test environments only used double goals. A reward of $+ 1$ was given to correct goal entry, and a negative reward of -1 was given to incorrect goal entry or episode terminating after a maximum number of time steps. These time steps depended on the maze size and were [150, 250, 300, 400, 500] for maze sizes [4, 5, 6, 7, 8]. At test time, the maximum time steps were extended to [300, 500, 600, 800, 1000].
|
| 254 |
+
|
| 255 |
+
Repeating Maze Details We included the same curriculum as the indicator maze. Rewards were the same as the indicator maze. After the first time the agent reaches a goal, the red torch is shown at each subsequent episode (regardless of what the correct indicator was). Maximum time steps were again [150, 250, 300, 400, 500] for maze sizes [4, 5, 6, 7, 8]. At test time, the maximum time steps were extended to [300, 500, 600, 800, 1000].
|
| 256 |
+
|
| 257 |
+
Minotaur Maze Details: For minotaur maze, a reward of $+ 0 . 5$ was given when reaching the randomly located goal and a reward of $+ 1 . 0$ was given when returning to the initial position. Episodes are terminated once the agent completes the return path, otherwise a negative reward of -1 is given if the agent exceeds the maximum number of steps. The maximum time steps were again [150, 250, 300, 400, 500] for maze sizes [4, 5, 6, 7, 8]. At test time, the maximum time steps were extended to [300, 500, 600, 800, 1000].
|
| 258 |
+
|
| 259 |
+
<table><tr><td rowspan="2" colspan="2">Agent Maze Size</td><td colspan="3">Indicator</td><td colspan="3">Repeating</td><td colspan="3">Minotaur</td></tr><tr><td>4</td><td>5</td><td>6</td><td>4</td><td>5</td><td>6</td><td>4</td><td>5</td><td>6</td></tr><tr><td rowspan="2">σ=0</td><td>Acc</td><td>88.4</td><td>84.4</td><td>79.3</td><td>1</td><td>1</td><td>1</td><td>97.3</td><td>89.0</td><td>62.0</td></tr><tr><td>Rew</td><td>-</td><td>1</td><td>1</td><td>9.47</td><td>9.91</td><td>5.91</td><td>1.46</td><td>1.34</td><td>0.93</td></tr><tr><td rowspan="2">σ = 0.01</td><td>Acc</td><td>92.4</td><td>91.9</td><td>84.3</td><td>1</td><td>1</td><td>1</td><td>96.7</td><td>86.2</td><td>66.1</td></tr><tr><td>Rew</td><td>1</td><td>1</td><td>1</td><td>12.4</td><td>12.9</td><td>10.9</td><td>1.45</td><td>1.29</td><td>0.99</td></tr></table>
|
| 260 |
+
|
| 261 |
+
Table 3: Results on the three 3D Doom maze tasks for the fixed-frame Neural Map with Controller LSTM. We can see that adding small compounding error does not largely affect the ability of the Neural Map to learn memory tasks and even has a beneficial effect for some tasks. Hyperparameters and architectures used were the same as presented in the main results.
|
| 262 |
+
|
| 263 |
+
(Ego-)Neural Map Agent Details: For the global read operation, we used a convolutional network with 3 layers of 8 channels and kernel size 3. The strides were set to 1 on the first layer, and 2 to the second and third layers. Padding was 1 on the first layer and 0 on other layers. The 3 convolutional layers were then followed by a fully-connected layer of dimension 256 and then another fullyconnected layer of size 32. All activations were relu except the 32 dimension layer, which was set to tanh. The Neural Map itself was size $3 2 \mathrm { x } 1 5 \mathrm { x } 1 5$ . Positions were normalized so that the largest map size used all $1 5 \mathrm { x } 1 5$ positions, while smaller mazes used a subset of the map. Additionally, during writing we split the 32 channels of the map into 8 channels per orientation (so if the agent is facing north, it writes only to the first 8 dimensions, if south, the next 8, and so on).
|
| 264 |
+
|
| 265 |
+
LSTM Agent Details: The LSTM agent had a single 256-dimension LSTM layer on top of the state embedding.
|
| 266 |
+
|
| 267 |
+
FRMQN Agent Details: Each past history state was 64-dimensional (32-dimensional key $\pm \ 3 2 .$ - dimensional value feature). Due to large matrix multiplies from storing the entire episode history, having larger feature sizes causes the attention operation to start becoming prohibitively expensive.
|
| 268 |
+
|
| 269 |
+
# D NEURAL MAP WITH DRIFT NOISE MODEL
|
| 270 |
+
|
| 271 |
+
We did an additional experiment on the Neural Map that featured drift noise to simulate the effects of the agent using a local visual odometry model that had small error in predicting each frame-by-frame transformation. This is meant to represent a more realistic scenario (e.g. robotic navigation) where perfect localization is not feasible but a relatively accurate estimate can be provided, demonstrating the robustness of the architecture to noise. For example, we could assume the Neural Map is run in parallel with a SLAM algorithm which provides an estimate of the agent’s current position.
|
| 272 |
+
|
| 273 |
+
To model this noise, we add a zero-mean gaussian random variable to the oracle position with a variance that depends on the current time-step. In more detail, the noise-corrupted positions $( \hat { x } , \hat { y } )$ in an $W \times W$ size map provided to the Neural Map are:
|
| 274 |
+
|
| 275 |
+
$$
|
| 276 |
+
\begin{array} { r l } & { ( \hat { x } , \hat { y } ) = ( \operatorname* { m a x } \{ \operatorname* { m i n } \{ \lfloor x + \epsilon _ { x } \rfloor , W - 1 \} , 0 \} , \operatorname* { m a x } \{ \operatorname* { m i n } \{ \lfloor y + \epsilon _ { y } \rfloor , W - 1 \} , 0 \} ) , } \\ & { \epsilon _ { x } , \epsilon _ { y } \sim \mathcal { N } ( 0 , \sigma ^ { 2 } t ) } \end{array}
|
| 277 |
+
$$
|
| 278 |
+
|
| 279 |
+
This simulates the effect of an odometry algorithm which has independent zero-mean gaussian error with equal variance. This error compounds over time causing the variance to grow with the time step. We evaluate the Neural Map with noise $\sigma = 1 / 1 0 0$ on smaller versions of the 3D Doom maze tasks (maze sizes [4, 5, 6]) and compare it to the version with perfect odometry. We train for 1500 steps of 100 episodes each step. Results are shown in Table 3. We can see that adding a small amount of error at each time step does not largely affect the results of the memory and can even benefit it, with some noticeable improvements on Indicator and Repeating tasks. It’s possible that the noise acts as a regularizer to speed up learning. For the Minotaur task, since positional information is important because the agent must remember the entire path taken, adding noise causes slight decrease in reward in mazes of size 4 and 5, but otherwise performance is very similar. Therefore this means that the Neural Map is likely to work in the case where a localization oracle is not available and instead only error-prone odometry is.
|
| 280 |
+
|
| 281 |
+
We also plot some example trajectories to compare the effect of noise. We can see that the noise causes some slight aliasing in the position, which increases as time passes. The positions are quantized to a $1 5 \times 1 5$ grid.
|
| 282 |
+
|
| 283 |
+

|
| 284 |
+
Figure 3: Top: Noisy v.s. Groundtruth Position trajectory (quantized to a $1 5 \times 1 5$ grid). As time progresses, the colors get lighter. Center: Neural Map cells addressed by the write operator under the noisy positions. Bottom: Neural Map cells that would have been written to under perfect position estimates.
|
| 285 |
+
|
| 286 |
+
# E SAMPLES OF CONTEXT READ DISTRIBUTION
|
| 287 |
+
|
| 288 |
+
# E.1 2D ENVIRONMENT
|
| 289 |
+
|
| 290 |
+
To provide some insight into what the Neural Map learns, we show samples of the probability distribution given by the context read operation in a 2D maze example. We ran it on an example maze shown in Figure 4. In this figure, the top row of images are the agent observations, the center row are the fully observable mazes and the bottom row are the probability distributions over locations from the context operation, e.g. the $\alpha _ { t } ^ { ( x , y ) }$ values defined by Eq. 2. In this maze, the indicator is blue, which indicates that the teal goal should be visited. We can see that once the agent sees the incorrect red goal, the context distribution faintly focuses on the map location where the agent had observed the indicator. On the other hand, when the agent first observes the correct teal goal, the location where the agent observed the indicator lights up brightly. This means that the agent is using its context retrieval operation to keep track of the landmark (the indicator) that it has previously seen.
|
| 291 |
+
|
| 292 |
+

|
| 293 |
+
Figure 4: A few sampled states from an example episode demonstrating how the agent learns to use the context addressing operation of the Neural Map. The top row of images is the observations made by the agent, the center is the fully observable mazes and the bottom image is the probability distributions over locations induced by the context operation at that step.
|
| 294 |
+
|
| 295 |
+
# E.2 3D ENVIRONMENT
|
| 296 |
+
|
| 297 |
+
We draw some examples of the context addressing probability distribution in the 3D Doom environment in Figure 5 (allocentric) and Figure 6 (egocentric). We can see that the Neural Map learns to use its context addressing operator to retrieve the indicator torch identity, until it sees the correct corresponding tower. Once it sees the correct tower there is a shift in how the agent uses the map and the probability map seems to invert, addressing the parts of the map that were unexplored. This effect is consistent in both allocentric and egocentric variants. This might be because the Neural Map variant used on Doom had an internal LSTM which could enable it to remember the indicator identity for the short amount of time it took to walk up to the goal.
|
| 298 |
+
|
| 299 |
+
Indicator Prediction To determine whether the Neural Map was accurately storing the indicator identity within its memory, we train a logistic regression model on memory vectors sampled over 75 episodes. We then attempt to predict the indicator on a held-out set of 25 episodes by taking the max prediction over all positions of the memory at the end of the episode. We can see that a simple logistic regression is capable of recovering the indicator in $100 \%$ of the episodes, showing that the indicator identity can be easily extracted from, e.g., the context operator.
|
| 300 |
+
|
| 301 |
+
<table><tr><td>Agent</td><td>Indicator Accuracy</td></tr><tr><td>Controller NMap</td><td>100%</td></tr><tr><td>Controller Ego-NMap</td><td>100%</td></tr></table>
|
| 302 |
+
|
| 303 |
+
Table 4: Figure showing accuracy of a logistic model to determine indicator identity from the stored Neural Map features.
|
| 304 |
+
|
| 305 |
+

|
| 306 |
+
Figure 5: Three example episodes of the (allocentric) context addressing operator on Doom mazes. The top images of each row are the RGB inputs the agent sees, the center images are a top-down representation of the maze, and the bottom images are the $\alpha _ { t } ^ { ( x , y ) }$ of the context operation.
|
| 307 |
+
|
| 308 |
+

|
| 309 |
+
Figure 6: Three example episodes of the (egocentric) context addressing operator on Doom mazes. The top images of each row are the RGB inputs the agent sees, the center images are a top-down representation of the maze, and the bottom images are the (egocentric) $\alpha _ { t } ^ { ( x , y ) }$ of the context operation.
|
| 310 |
+
|
| 311 |
+
# F BACKTRACKING
|
| 312 |
+
|
| 313 |
+
We also explored whether the allocentric and egocentric Neural Maps were capable of using their memories in order to do backtracking, i.e. re-visiting unexplored areas of the maze. To measure this, we developed a variant of the Indicator Maze where the goal states were removed. We want to measure how much of the maze is explored by the agent under this setting where there are no terminal states. To measure how much of the maze was explored, we quantized the 50 test mazes into 11 discrete positions and counted how many of the quantized positions the agent visited. We report results below in Table 5
|
| 314 |
+
|
| 315 |
+
<table><tr><td>Agent</td><td>Visitation Score</td></tr><tr><td>Controller NMap</td><td>71.6%</td></tr><tr><td>Controller Ego-NMap LSTM</td><td>77.6% 68.5%</td></tr></table>
|
| 316 |
+
|
| 317 |
+
Table 5: Visitation scores of the Neural Map models which measure how much of a maze is explored within a set time limit. We can see that the egocentric neural map explores more of the mazes than the allocentric model, exploring on average $7 7 . 6 \%$ of the test mazes. The allocentric neural map explores $7 1 . 6 \%$ of the test mazes. The LSTM is reported to provide a point of comparison.
|
md/train/BkMWx309FX/BkMWx309FX.md
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
md/train/BkgWHnR5tm/BkgWHnR5tm.md
ADDED
|
@@ -0,0 +1,462 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# NEURAL GRAPH EVOLUTION: TOWARDS EFFICIENT AUTOMATIC ROBOT DESIGN
|
| 2 |
+
|
| 3 |
+
Tingwu Wang1,2∗, Yuhao Zhou1,2∗, Sanja Fidler1,2,3 & Jimmy $\mathbf { B a } ^ { 1 , 2 }$
|
| 4 |
+
|
| 5 |
+
1 Department of Computer Science, University of Toronto
|
| 6 |
+
2 Vector Institute
|
| 7 |
+
3 NVIDIA
|
| 8 |
+
{tingwuwang,henryzhou,fidler,jba}@cs.toronto.e
|
| 9 |
+
|
| 10 |
+
# ABSTRACT
|
| 11 |
+
|
| 12 |
+
Despite the recent successes in robotic locomotion control, the design of robots, i.e., the design of their body structure, still heavily relies on human engineering. Automatic robot design has been a long studied subject, however, progress has been slow due to large combinatorial search space and the difficulty to efficiently evaluate the candidate structures. Note that one needs to both, search over many possible body structures, and choose among them based on how the robot with that structure performs in an environment. The latter means training an optimal controller given a candidate structure, which in itself is costly to obtain. In this paper, we propose Neural Graph Evolution (NGE), which performs evolutionary search in graph space, by iteratively evolving graph structures using simple mutation primitives. Key to our approach is to parameterize the control policies with graph neural networks, which allows us to transfer skills from previously evaluated designs during the graph search. This significantly reduces evaluation cost of new candidates and makes the search process orders of magnitude more efficient than that of past work. In addition, NGE applies Graph Mutation with Uncertainty (GM-UC) by incorporating model uncertainty, which reduces the search space by balancing exploration and exploitation. We show that NGE significantly outperforms previous methods in terms of convergence rate and final performance. As shown in experiments, NGE is the first algorithm that can automatically discover kinematically preferred robotic graph structures, such as a fish with two symmetric flat side-fins and a tail, or a cheetah with athletic front and back legs. NGE is extremely efficient, it finds plausible robotic structures within a day on a single 64 CPU-core Amazon EC2 machine.
|
| 13 |
+
|
| 14 |
+
# 1 INTRODUCTION
|
| 15 |
+
|
| 16 |
+
The goal of robot design is to find an optimal body structure and its means of locomotion to best achieve a given objective in an environment. Robot design often relies on careful human-engineering and expert knowledge. The field of automatic robot design aims to search for these structures automatically. This has been a long-studied subject, however, with limited success. There are two major challenges: 1) the search space of all possible designs is large and combinatorial, and 2) the evaluation of each design requires learning or testing a separate optimal controller that is often expensive to obtain.
|
| 17 |
+
|
| 18 |
+
In (Sims, 1994), the authors evolved creatures with 3D-blocks. Recently, soft robots have been studied in (Joachimczak et al., 2014), which were evolved by adding small cells connected to the old ones. In (Cheney et al., 2014), the 3D voxels were treated as the minimum element of the robot. Most evolutionary robots (Duff et al., 2001; Neri, 2010) require heavy engineering of the initial structures, evolving rules and careful human-guidance. Due to the combinatorial nature of the problem, evolutionary, genetic or random structure search have been the de facto algorithms of automatic robot design in the pioneering works (Sims, 1994; Steels, 1993; Mitchell & Forrest, 1994; Langton, 1997; Lee, 1998; Taylor, 2017; Calandra et al., 2016). In terms of the underlying algorithm, most of these works have a similar population-based optimization loop to the one used in (Sims, 1994). None of these algorithms are able to evolve kinematically reasonable structures, as a result of large search space and the inefficient evaluation of candidates.
|
| 19 |
+
|
| 20 |
+
Similar in vein to automatic robot design, automatic neural architecture search also faces a large combinatorial search space and difficulty in evaluation. There have been several approaches to tackle these problems. Bayesian optimization approaches (Snoek et al., 2012) primarily focus on fine-tuning the number of hidden units and layers from a predefined set. Reinforcement learning (Zoph & Le, 2016) and genetic algorithms (Liu et al., 2017) are studied to evolve recurrent neural networks (RNNs) and convolutional neural networks (CNNs) from scratch in order to maximize the validation accuracy. These approaches are computationally expensive because a large number of candidate networks have to be trained from grounds up. (Pham et al., 2018) and (Stanley & Miikkulainen, 2002) propose weight sharing among all possible candidates in the search space to effectively amortize the inner loop training time and thus speed up the architecture search. A typical neural architecture search on ImageNet (Krizhevsky et al., 2012) takes 1.5 days using 200 GPUs (Liu et al., 2017).
|
| 21 |
+
|
| 22 |
+
In this paper, we propose an efficient search method for automatic robot design, Neural Graph Evolution (NGE), that co-evolves both, the robot design and the control policy. Unlike the recent reinforcement learning work, where the control policies are learnt on specific robots carefully designed by human experts (Mnih et al., 2013; Bansal et al., 2017; Heess et al., 2017), NGE aims to adapt the robot design along with policy learning to maximize the agent’s performance. NGE formulates automatic robot design as a graph search problem. It uses a graph as the main backbone of rich design representation and graph neural networks (GNN) as the controller. This is key in order to achieve efficiency of candidate structure evaluation during evolutionary graph search. Similar to previous algorithms like (Sims, 1994), NGE iteratively evolves new graphs and removes graphs based on the performance guided by the learnt GNN controller. The specific contributions of this paper are as follows:
|
| 23 |
+
|
| 24 |
+
• We formulate the automatic robot design as a graph search problem.
|
| 25 |
+
• We utilize graph neural networks (GNNs) to share the weights between the controllers, which greatly reduces the computation time needed to evaluate each new robot design.
|
| 26 |
+
• To balance exploration and exploitation during the search, we developed a mutation scheme that incorporates model uncertainty of the graphs.
|
| 27 |
+
|
| 28 |
+
We show that NGE automatically discovers robot designs that are comparable to the ones designed by human experts in MuJoCo (Todorov et al., 2012), while random graph search or naive evolutionary structure search (Sims, 1994) fail to discover meaningful results on these tasks.
|
| 29 |
+
|
| 30 |
+
# 2 BACKGROUND
|
| 31 |
+
|
| 32 |
+
# 2.1 REINFORCEMENT LEARNING
|
| 33 |
+
|
| 34 |
+
In reinforcement learning (RL), the problem is usually formulated as a Markov Decision Process (MDP). The infinite-horizon discounted MDP consists of a tuple of $( S , { \mathcal { A } } , \gamma , P , R )$ , respectively the state space, action space, discount factor, transition function, and reward function. The objective of the agent is to maximize the total expected reward $\begin{array} { r } { J ( \theta ) = \mathbb { E } _ { \pi } \left[ \sum _ { t = 0 } ^ { \infty } \gamma ^ { t } r ( s _ { t } , a _ { t } ) \right] } \end{array}$ , where the state transition follows the distribution $\bar { P ( } s _ { t + 1 } | s _ { t } , a _ { t } )$ . Here, $s _ { t }$ and $a _ { t }$ denotes the state and action at time step $t$ , and $r ( s _ { t } , a _ { t } )$ is the reward function. In this paper, to evaluate each robot structure, we use PPO to train RL agents (Schulman et al., 2017; Heess et al., 2017). PPO uses a neural network parameterized as $\pi _ { \boldsymbol { \theta } } ( a _ { t } | \boldsymbol { s } _ { t } )$ to represent the policy, and adds a penalty for the KL-divergence between the new and old policy to prevent over-optimistic updates. PPO optimizes the following surrogate objective function instead:
|
| 35 |
+
|
| 36 |
+
$$
|
| 37 |
+
J _ { \mathrm { P P O } } ( \theta ) = \mathbb { E } _ { \pi _ { \theta } } \left[ \sum _ { t = 0 } ^ { \infty } A ^ { t } ( s _ { t } , a _ { t } ) r ^ { t } ( s _ { t } , a _ { t } ) \right] - \beta \operatorname { K L } \left[ \pi _ { \theta } ( : | s _ { t } ) | \pi _ { \theta _ { o l d } } ( : | s _ { t } ) \right] .
|
| 38 |
+
$$
|
| 39 |
+
|
| 40 |
+
We denote the estimate of the expected total reward given the current state-action pair, the value and the advantage functions, as $Q ^ { t } ( s _ { t } , a _ { t } )$ , $V ( s _ { t } )$ and $A ^ { t } ( s _ { t } , a _ { t } )$ respectively. PPO solves the problem by iteratively generating samples and optimizing $J _ { \mathrm { P P O } }$ (Schulman et al., 2017).
|
| 41 |
+
|
| 42 |
+

|
| 43 |
+
Figure 1: In NGE, several mutation operations are allowed. By using Policy Sharing, child species reuse weights from parents, even if the graphs are different. The same color indicates shared and reused weights. For better visualization, we only plot the sharing of propagation model (yellow curves).
|
| 44 |
+
|
| 45 |
+
# 2.2 GRAPH NEURAL NETWORK
|
| 46 |
+
|
| 47 |
+
Graph Neural Networks (GNNs) are suitable for processing data in the form of graph (Bruna et al., 2014; Defferrard et al., 2016; Li et al., 2015; Kipf & Welling, 2017; Duvenaud et al., 2015; Henaff et al., 2015). Recently, the use of GNNs in locomotion control has greatly increased the transferability of controllers (Wang et al., 2018). A GNN operates on a graph whose nodes and edges are denoted respectively as $u \in V$ and $e \in E$ . We consider the following GNN, where at timestep $t$ each node in GNN receives an input feature and is supposed to produce an output at a node level.
|
| 48 |
+
|
| 49 |
+
Input Model: The input feature for node $u$ is denoted as $x _ { u } ^ { t }$ . $x _ { u } ^ { t }$ is a vector of size $d$ , where $d$ is the size of features. In most cases, $x _ { u } ^ { t }$ is produced by the output of an embedding function used to encode information about $u$ into $d$ -dimensional space.
|
| 50 |
+
|
| 51 |
+
Propagation Model: Within each timestep $t$ , the GNN performs $\tau$ internal propagations, so that each node has global (neighbourhood) information. In each propagation, every node communicates with its neighbours, and updates its hidden state by absorbing the input feature and message. We denote the hidden state at the internal propagation step $\tau$ $( \tau \leq \tau )$ as $h _ { u } ^ { t , \tau }$ . Note that $h _ { u } ^ { t , 0 }$ is usually initialized as $h _ { u } ^ { t - 1 , T }$ , i.e., the final hidden state in the previous time step. $\cdot _ { h ^ { 0 , 0 } }$ is usually initialized to zeros. The message that $u$ sends to its neighbors is computed as
|
| 52 |
+
|
| 53 |
+
$$
|
| 54 |
+
m _ { u } ^ { t , \tau } = M ( h _ { u } ^ { t , \tau - 1 } ) ,
|
| 55 |
+
$$
|
| 56 |
+
|
| 57 |
+
where $M$ is the message function. To compute the updated $h _ { u } ^ { t , \tau }$ , we use the following equations:
|
| 58 |
+
|
| 59 |
+
$$
|
| 60 |
+
r _ { u } ^ { t , \tau } = R ( \{ m _ { v } ^ { t , \tau } | \forall v \in \mathcal { N } _ { G } ( u ) \} ) , h _ { u } ^ { t , \tau } = U ( h _ { u } ^ { t , \tau - 1 } , ( r _ { u } ^ { t , \tau } ; x _ { u } ^ { t } ) )
|
| 61 |
+
$$
|
| 62 |
+
|
| 63 |
+
where $R$ and $U$ are the message aggregation function and the update function respectively, and $\mathcal { N } _ { G } ( u )$ denotes the neighbors of $u$ .
|
| 64 |
+
|
| 65 |
+
Output Model: Output function $F$ takes input the node’s hidden states after the last internal propagation. The node-level output for node $u$ is therefore defined as $\mu _ { u } ^ { t } = F ( h _ { u } ^ { t , T } )$ .
|
| 66 |
+
|
| 67 |
+
Functions $M , R , U , F$ in GNNs can be trainable neural networks or linear functions. For details of GNN controllers, we refer readers to (Wang et al., 2018).
|
| 68 |
+
|
| 69 |
+
# 3 NEURAL GRAPH EVOLUTION
|
| 70 |
+
|
| 71 |
+
In robotics design, every component, including the robot arms, finger and foot, can be regarded as a node. The connections between the components can be represented as edges. In locomotion control, the robotic simulators like MuJoCo (Todorov et al., 2012) use an XML file to record the graph of the robot. As we can see, robot design is naturally represented by a graph. To better illustrate Neural Graph Evolution (NGE), we first introduce the terminology and summarize the algorithm.
|
| 72 |
+
|
| 73 |
+
Graph and Species. We use an undirected graph $\mathcal { G } = ( V , E , A )$ to represent each robotic design. $V$ and $E$ are the collection of physical body nodes and edges in the graph, respectively. The mapping
|
| 74 |
+
|
| 75 |
+
# Algorithm 1 Neural Graph Evolution
|
| 76 |
+
|
| 77 |
+
<table><tr><td>1: Initialize generation P°←{(0,G)}1</td><td></td></tr><tr><td>2:while Evolving jth generation do</td><td>Evolution outer loop</td></tr><tr><td>3: for ith species (0²,G) ∈ Pj do</td><td> Species fitness inner loop</td></tr><tr><td>4: 0j+1←Update(0)</td><td>Train policy network</td></tr><tr><td>5: S←s(0+1,G)</td><td>Evaluate fitness</td></tr><tr><td>6: end for</td><td></td></tr><tr><td>7: pj+1←Pj\{(0k,Sk) ∈Pj,∀k ∈ argminx({Si})}.</td><td>Remove worst K species</td></tr><tr><td>P ←{(0h,9h =M(Gh,p)), whereGh,p ~ Uniform(Pj+1)}h=1 8:</td><td>Mutate from survivors</td></tr><tr><td>9: pj+1 √ pj+1 U{(0k,9k) ∈P, ∀k ∈ argmaxx({ξp(Gh)})}. 10: end while</td><td>Pruning</td></tr></table>
|
| 78 |
+
|
| 79 |
+
$A : V \Lambda$ maps the node $u \in V$ to its structural attributes $A ( u ) \in \Lambda$ , where $\Lambda$ is the attributes space. For example, the fish in Figure 1 consists of a set of ellipsoid nodes, and vector $A ( u )$ describes the configurations of each ellipsoid. The controller is a policy network parameterized by weights $\theta$ The tuple formed by the graph and the policy is defined as a species, denoted as $\Omega = ( \mathcal { G } , \theta )$ .
|
| 80 |
+
|
| 81 |
+
Generation and Policy Sharing. In the $j$ -th iteration, NGE evaluates a pool of species called a generation, denoted as $P ^ { j } = \{ ( \mathcal { G } _ { i } ^ { j } , \theta _ { i } ^ { j } ) , \forall i = 1 , 2 , . . . , \mathcal { N } \}$ , where $\mathcal { N }$ is the size of the generation. In NGE, the search space includes not only the graph space, but also the weight or parameter space of the policy network. For better efficiency of NGE, we design a process called Policy Sharing (PS), where weights are reused from parent to child species. The details of PS is described in Section 3.4.
|
| 82 |
+
|
| 83 |
+
Our model can be summarized as follows. NGE performs population-based optimization by iterating among mutation, evaluation and selection. The objective and performance metric of NGE are introduced in Section 3.1. In NGE, we randomly initialize the generation with $\mathcal { N }$ species. For each generation, NGE trains each species and evaluates their fitness separately, the policy of which is described in Section 3.2. During the selection, we eliminate $\kappa$ species with the worst fitness. To mutate $\kappa$ new species from surviving species, we develop a novel mutation scheme called Graph Mutation with Uncertainty (GM-UC), described in Section 3.3, and efficiently inherit policies from the parent species by Policy Sharing, described in Section 3.4. Our method is outlined in Algorithm 1.
|
| 84 |
+
|
| 85 |
+
# 3.1 AMORTIZED FITNESS AND OBJECTIVE FUNCTION
|
| 86 |
+
|
| 87 |
+
Fitness represents the performance of a given $\mathcal { G }$ using the optimal controller parameterized with $\theta ^ { * } ( { \mathcal { G } } )$ . However, $\overleftarrow { \theta ^ { * } } ( \mathcal G )$ is impractical or impossible to obtain for the following reasons. First, each design is computationally expensive to evaluate. To evaluate one graph, the controller needs to be trained and tested. Model-free (MF) algorithms could take more than one million in-game timesteps to train a simple 6-degree-of-freedom cheetah (Schulman et al., 2017), while model-based (MB) controllers usually require much more execution time, without the guarantee of having higher performance than MF controllers (Tassa et al., 2012; Nagabandi et al., 2017; Drews et al., 2017; Chua et al., 2018). Second, the search in robotic graph space can easily get stuck in local-optima. In robotic design, local-optima are difficult to detect as it is hard to tell whether the controller has converged or has reached a temporary optimization plateau. Learning the controllers is a computation bottleneck in optimization.
|
| 88 |
+
|
| 89 |
+
In population-based robot graph search, spending more computation resources on evaluating each species means that fewer different species can be explored. In our work, we enable transferablity between different topologies of NGE (described in Section 3.2 and 3.4). This allows us to introduce amortized fitness (AF) as the objective function across generations for NGE. AF is defined in the following equation as,
|
| 90 |
+
|
| 91 |
+
$$
|
| 92 |
+
\xi ( \mathcal { G } , \boldsymbol { \theta } ) = \mathbb { E } _ { \pi _ { \boldsymbol { \theta } } , \mathcal { G } } \left[ \sum _ { t = 0 } ^ { \infty } \gamma ^ { t } r ( s _ { t } , a _ { t } ) \right] .
|
| 93 |
+
$$
|
| 94 |
+
|
| 95 |
+
In NGE, the mutated species continues the optimization by initializing the parameters with the parameters inherited from its parent species. In past work (Sims, 1994), species in one generation are trained separately for a fixed number of updates, which is biased and potentially undertrained or
|
| 96 |
+
|
| 97 |
+
overtrained. In next generations, new species have to discard old controllers if the graph topology is different, which might waste valuable computation resources.
|
| 98 |
+
|
| 99 |
+
# 3.2 POLICY REPRESENTATION
|
| 100 |
+
|
| 101 |
+
Given a species with graph $\mathcal { G }$ , we train the parameters $\theta$ of policy network $\pi _ { \theta } ( a ^ { t } | s ^ { t } )$ using reinforcement learning. Similar to (Wang et al., 2018), we use a GNN as the policy network of the controller. A graphical representation of our model is shown in Figure 1. We follow notation in Section 2.2.
|
| 102 |
+
|
| 103 |
+
For the input model, we parse the input state vector $s ^ { t }$ obtained from the environment into a graph, where each node $u \in V$ fetches the corresponding observation $o ( u , t )$ from $s ^ { t }$ , and extracts the feature $x _ { u } ^ { O , t }$ with an embedding function $\Phi$ . We also encode the attribute information $A ( u )$ into $x _ { u } ^ { A }$ with an embedding function denoted as $\zeta$ . The input feature $x _ { u } ^ { t }$ is thus calculated as:
|
| 104 |
+
|
| 105 |
+
$$
|
| 106 |
+
\begin{array} { r } { x _ { u } ^ { O , t } = \Phi ( o ( u , t ) ) , ~ x _ { u } ^ { A } = \zeta ( A ( u ) ) , } \\ { x _ { u } ^ { t } = [ x _ { u } ^ { O , t } ; x _ { u } ^ { A } ] , ~ } \end{array}
|
| 107 |
+
$$
|
| 108 |
+
|
| 109 |
+
where $[ . ]$ denotes concatenation. We use $\theta _ { \Phi } , \theta _ { \zeta }$ to denote the weights of embedding functions.
|
| 110 |
+
|
| 111 |
+
The propagation model is described in Section 2.2. We recap the propagation model here briefly: Initial hidden state for node $u$ is denoted as $h _ { u } ^ { t , 0 }$ , which are initialized from hidden states from the last timestep $h _ { u } ^ { t - 1 , T }$ or simply zeros. $\tau$ internal propagation steps are performed for each timestep, during each step (denoted as $\tau \leq \tau \}$ ) of which, every node sends messages to its neighboring nodes, and aggregates the received messages. $h _ { u } ^ { t , \tau + 1 }$ is calculated by an update function that takes in $h _ { u } ^ { t , \tau }$ , node input feature $x _ { u } ^ { t }$ and aggregated message $m _ { u } ^ { t , \tau }$ . We use summation as the aggregation function and a GRU (Chung et al., 2014) as the update function.
|
| 112 |
+
|
| 113 |
+
For the output model, we define the collection of controller nodes as $\mathcal { F }$ , and define Gaussian distributions on each node’s controller as follows:
|
| 114 |
+
|
| 115 |
+
$$
|
| 116 |
+
\begin{array} { r } { \forall u \in \mathcal { F } , ~ \mu _ { u } ^ { t } = F _ { \mu } ( h _ { u } ^ { t , T } ) , } \\ { \sigma _ { u } ^ { t } = F _ { \sigma } ( h _ { u } ^ { t , T } ) , } \end{array}
|
| 117 |
+
$$
|
| 118 |
+
|
| 119 |
+
where $\mu _ { u }$ and $\sigma _ { u }$ are the mean and the standard deviation of the action distribution. The weights of output function are denoted as $\theta _ { F }$ . By combining all the actions produced by each node controller, we have the policy distribution of the agent:
|
| 120 |
+
|
| 121 |
+
$$
|
| 122 |
+
\pi ( a ^ { t } | s ^ { t } ) = \prod _ { u \in \mathcal { F } } \pi _ { u } ( a _ { u } ^ { t } | s ^ { t } ) = \prod _ { u \in \mathcal { F } } \frac { 1 } { \sqrt { 2 \pi ( \sigma _ { u } ^ { t } ) ^ { 2 } } } \mathrm { e x p } \left( \frac { ( a _ { u } ^ { t } - \mu _ { u } ^ { t } ) ^ { 2 } } { 2 ( \sigma _ { u } ^ { t } ) ^ { 2 } } \right)
|
| 123 |
+
$$
|
| 124 |
+
|
| 125 |
+
We optimize $\pi ( \boldsymbol { a } ^ { t } | \boldsymbol { s } ^ { t } )$ with PPO, the details of which are provided in Appendix A.
|
| 126 |
+
|
| 127 |
+
# 3.3 GRAPH MUTATION WITH UNCERTAINTY
|
| 128 |
+
|
| 129 |
+
Between generations, the graphs evolve from parents to children. We allow the following basic operations as the mutation primitives on the parent’s graph $\mathcal { G }$ :
|
| 130 |
+
|
| 131 |
+
$\mathcal { M } _ { 1 }$ , Add-Node: In the $\mathcal { M } _ { 1 }$ (Add-Node) operation, the growing of a new body part is done by sampling a node $v \in V$ from the parent, and append a new node $u$ to it. We randomly initialize $u$ ’s attributes from an uniform distribution in the attribute space.
|
| 132 |
+
|
| 133 |
+
$\mathcal { M } _ { 2 }$ , Add-Graph: The $\mathcal { M } _ { 2 }$ (Add-Graph) operation allows for faster evolution by reusing the subtrees in the graph with good functionality. We sample a sub-graph or leaf node $\bar { \mathcal { G } } ^ { \prime } = ( \bar { V ^ { \prime } } , E ^ { \prime } , A ^ { \prime } )$ from the current graph, and a placement node $u \in V ( { \mathcal { G } } )$ to which to append $\mathcal { G } ^ { \prime }$ . We randomly mirror the attributes of the root node in $\mathcal { G } ^ { \prime }$ to incorporate a symmetry prior.
|
| 134 |
+
|
| 135 |
+
$\mathcal { M } _ { 3 }$ , Del-Graph: The process of removing body parts is defined as $\mathcal { M } _ { 3 }$ (Del-Graph) operation. In this operation, a sub-graph $\mathcal { G } ^ { \prime }$ from $\mathcal { G }$ is sampled and removed from $\mathcal { G }$ .
|
| 136 |
+
|
| 137 |
+
$\mathcal { M } _ { 4 }$ , Pert-Graph: In the $\mathcal { M } _ { 4 }$ (Pert-Graph) operation, we randomly sample a sub-graph $\mathcal { G } ^ { \prime }$ and recursively perturb the parameter of each node $u \in V ( \mathcal { G } ^ { \prime } )$ by adding Gaussian noise to $A ( u )$ .
|
| 138 |
+
|
| 139 |
+
We visualize a pair of example fish in Figure 1. The fish in the top-right is mutated from the fish in the top-left by applying $\mathcal { M } _ { 1 }$ . The new node (2) is colored magenta in the figure. To mutate each new candidate graph, we sample the operation $\mathcal { M }$ and apply $\mathcal { M }$ on $\mathcal { G }$ as
|
| 140 |
+
|
| 141 |
+
$$
|
| 142 |
+
\mathcal { G } ^ { \prime } = \mathcal { M } ( \mathcal { G } ) , \mathrm { w h e r e } \mathcal { M } \in \{ \mathcal { M } _ { l } , l = 1 , 2 , 3 , 4 \} , \ : \mathrm { P } ( \mathcal { M } = \mathcal { M } _ { l } ) = p _ { m } ^ { l } .
|
| 143 |
+
$$
|
| 144 |
+
|
| 145 |
+
$p _ { m } ^ { l }$ is the probability of sampling each operation with $\begin{array} { r } { \sum _ { l } p _ { m } ^ { l } = 1 } \end{array}$
|
| 146 |
+
|
| 147 |
+
To facilitate evolution, we want to avoid wasting computation resources on species with low expected fitness, while encouraging NGE to test species with high uncertainty. We again employ a GNN to predict the fitness of the graph $\mathcal { G }$ , denoted as $\xi _ { P } ( \mathcal G )$ . The weights of this GNN are denoted as $\psi$ . In particular, we predict the AF score with a similar propagation model as our policy network, but the observation feature is only $x _ { u } ^ { A }$ , i.e., the embedding of the attributes. The output model is a graph-level output (as opposed to node-level used in our policy), regressing to the score $\xi$ . After each generation, we train the regression model using the L2 loss.
|
| 148 |
+
|
| 149 |
+
However, pruning the species greedily may easily overfit the model to the existing species since there is no modeling of uncertainty. We thus propose Graph Mutation with Uncertainty (GM-UC) based on Thompson Sampling to balance between exploration and exploitation. We denote the dataset of past species and their AF score as $\mathcal { D }$ . GM-UC selects the best graph candidates by considering the posterior distribution of the surrogate $P \left( \psi | \mathcal { D } \right)$ :
|
| 150 |
+
|
| 151 |
+
$$
|
| 152 |
+
\mathcal { G } ^ { * } = \arg \operatorname* { m a x } _ { \mathcal { G } } \mathbb { E } _ { P \left( \psi \left| \mathcal { D } \right. \right]} \left[ \xi _ { P } \left( \mathcal { G } \right| \psi \right) .
|
| 153 |
+
$$
|
| 154 |
+
|
| 155 |
+
Instead of sampling the full model with $\widetilde { \psi } \sim P \left( \psi | \mathcal { D } \right)$ , we follow Gal & Ghahramani (2016) and perform dropout during inference, which can be viewed as an approximate sampling from the model posterior. At the end of each generation, we randomly mutate ${ \mathcal { C } } \geq { \mathcal { N } }$ new species from surviving species. We then sample a single dropout mask for the surrogate model and only keep $\mathcal { N }$ species with highest $\xi _ { P }$ . The details of GM-UC are given in Appendix F.
|
| 156 |
+
|
| 157 |
+
# 3.4 RAPID ADAPTATION USING POLICY SHARING
|
| 158 |
+
|
| 159 |
+
To leverage the transferability of GNNs across different graphs, we propose Policy Sharing (PS) to reuse old weights from parent species. The weights of a species in NGE are as follows:
|
| 160 |
+
|
| 161 |
+
$$
|
| 162 |
+
\theta _ { G } = ( \theta _ { \Phi } , \theta _ { \zeta } , \theta _ { M } , \theta _ { U } , \theta _ { F } ) ,
|
| 163 |
+
$$
|
| 164 |
+
|
| 165 |
+
where $\theta _ { \Phi } , \theta _ { \zeta } , \theta _ { M } , \theta _ { U } , \theta _ { F }$ are the weights for the models we defined earlier in Section 3.2 and 2.2. Since our policy network is based on GNNs, as we can see from Figure 1, model weights of different graphs share the same cardinality (shape). A different graph will only alter the paths of message propagation. With PS, new species are provided with a strong weight initialization, and the evolution will less likely be dominated by species that are more ancient in the genealogy tree.
|
| 166 |
+
|
| 167 |
+
Previous approaches including naive evolutionary structure search (ESS-Sims) (Sims, 1994) or random graph search (RGS) utilize human-engineered one-layer neural network or a fully connected network, which cannot reuse controllers once the graph structure is changed, as the parameter space for $\theta$ might be different. And even when the parameters happen to be of the same shape, transfer learning with unstructured policy controllers is still hardly successful (Rajeswaran et al., 2017). We denote the old species in generation $j$ , and its mutated species with different topologies as $( \theta _ { B } ^ { j } , \mathcal { G } )$ , $( \theta _ { B } ^ { j + 1 } , \mathcal { G } ^ { \prime } )$ in baseline algorithm ESS-Sims and RGS, and $( \theta _ { G } ^ { j } , \mathcal { G } )$ , $( \theta _ { G } ^ { j + 1 } , \mathcal { G } ^ { \prime } )$ for NGE. We also denote the network initialization scheme for fully-connected networks as $\boldsymbol { B }$ . We show the parameter reuse between generations in Table 1.
|
| 168 |
+
|
| 169 |
+
<table><tr><td rowspan=1 colspan=1>Algorithm</td><td rowspan=1 colspan=1>Mutation</td><td rowspan=1 colspan=1>Parameter Space</td><td rowspan=1 colspan=1>Policy Initialization</td></tr><tr><td rowspan=1 colspan=1>ESS-Sims, RGSNGE</td><td rowspan=1 colspan=1>g→g'g→g'</td><td rowspan=1 colspan=1>{0B(9)}n {0B(S')}=0{0G(9)}={0G(S')}</td><td rowspan=1 colspan=1>B('),, 0 not reused01</td></tr></table>
|
| 170 |
+
|
| 171 |
+
Table 1: Parameter reuse between species and its mutated children if the topologies are different.
|
| 172 |
+
|
| 173 |
+

|
| 174 |
+
Figure 2: The performance of the graph search for RGS, ES and NGE. The figures on are the example creatures obtained from each of the method. The graph structure next to the figure are the corresponding graph structure. We included the original species for reference.
|
| 175 |
+
|
| 176 |
+
# 4 EXPERIMENTS
|
| 177 |
+
|
| 178 |
+
In this section, we demonstrate the effectiveness of NGE on various evolution tasks. In particular, we evaluate both, the most challenging problem of searching for the optimal body structure from scratch in Section 4.1, and also show a simpler yet useful problem where we aim to optimize humanengineered species in Section 4.2 using NGE. We also provide an ablation study on GM-UC in Section 4.3, and an ablation study on computational cost or generation size in Section 4.4.
|
| 179 |
+
|
| 180 |
+
Our experiments are simulated with MuJoCo. We design the following environments to test the algorithms. Fish Env: In the fish environment, graph consists of ellipsoids. The reward is the swimming-speed along the $y$ -direction. We denote the reference human-engineered graph (Tassa et al., 2018) as $\mathcal { G } _ { F }$ . Walker Env: We also define a 2D environment walker constructed by cylinders, where the goal is to move along $x$ -direction as fast as possible. We denote the reference humanengineered walker as $\mathcal { G } _ { W }$ and cheetah as $\mathcal { G } _ { C }$ (Tassa et al., 2018). To validate the effectiveness of NGE, baselines including previous approaches are compared. We do a grid search on the hyper-parameters as summarized in Appendix E, and show the averaged curve of each method. The baselines are introduced as follows:
|
| 181 |
+
|
| 182 |
+
ESS-Sims: This method was proposed in (Sims, 1994), and applied in (Cheney et al., 2014; Taylor, 2017), which has been the most classical and successful algorithm in automatic robotic design. In the original paper, the author uses evolutionary strategy to train a human-engineered one layer neural network, and randomly perturbs the graph after each generation. With the recent progress of robotics and reinforcement learning, we replace the network with a 3-layer Multilayer perceptron and train it with PPO instead of evolutionary strategy.
|
| 183 |
+
|
| 184 |
+
ESS-Sims-AF: In the original ESS-Sims, amortized fitness is not used. Although amortized fitness could not be fully applied, it could be applied among species with the same topology. We name this variant as ESS-Sims-AF.
|
| 185 |
+
|
| 186 |
+
ESS-GM-UC: ESS-GM-UC is a variant of ESS-Sims-AF, which combines GM-UC. The goal is to explore how GM-UC affects the performance without the use of a structured model like GNN.
|
| 187 |
+
|
| 188 |
+
ESS-BodyShare: We also want to answer the question of whether GNN is indeed needed. We use both an unstructured models like MLP, as well as a structured model by removing the message propagation model.
|
| 189 |
+
|
| 190 |
+
RGS: In the Random Graph Search (RGS) baseline, a large amount of graphs are generated randomly.
|
| 191 |
+
RGS focuses on exploiting given structures, and does not utilize evolution to generate new graphs.
|
| 192 |
+
|
| 193 |
+
# 4.1 EVOLUTION TOPOLOGY SEARCH
|
| 194 |
+
|
| 195 |
+
In this experiment, the task is to evolve the graph and the controller from scratch. For both fish and walker, species are initialized as random $( { \mathcal { G } } , \theta )$ . Computation cost is often a concern among structure search problems. In our comparison results, for fairness, we allocate the same computation budget to all methods, which is approximately 12 hours on a $\mathtt { E C 2 \ m 4 . 1 6 \times 1 a r g e }$ cluster with 64 cores for one session. A grid search over the hyper-parameters is performed (details in Appendix E). The averaged curves from different runs are shown in Figure 2. In both fish and walker environments, NGE is the best model. We find RGS is not able to efficiently search the space of $\mathcal { G }$ even after evaluating 12, 800 different graphs. The performance of ESS-Sims grows faster for the earlier generations, but is significantly worse than our method in the end. The use of AF and GM-UC on ESS-Sims can improve the performance by a large margin, which indicates that the sub-modules in NGE are effective. By looking at the generated species, ESS-Sims and its variants overfit to local species that dominate the rest of generations. The results of ESS-BodyShare indicates that, the use of structured graph models without message passing might be insufficient in environments that require global features, for example, walker.
|
| 196 |
+
|
| 197 |
+

|
| 198 |
+
Figure 3: The genealogy tree generated using NGE for fish. The number next to the node is the reward (the averaged speed of the fish). For better visualization, we down-sample genealogy sub-chain of the winning species. NGE agents gradually grow symmetrical side-fins.
|
| 199 |
+
|
| 200 |
+

|
| 201 |
+
Figure 4: Fine-tuning results on different creatures compared with baseline where structure is fixed. The figures included the species looking from 2 different angles.
|
| 202 |
+
|
| 203 |
+
To better understand the evolution process, we visualize the genealogy tree of fish using our model in Figure 3. Our fish species gradually generates three fins with preferred $\{ A ( u ) \}$ , with two side-fins symmetrical about the fish torso, and one tail-fin lying in the middle line. We obtain similar results for walker, as shown in Appendix C. To the best of our knowledge, our algorithm is the first to automatically discover kinematically plausible robotic graph structures.
|
| 204 |
+
|
| 205 |
+
# 4.2 FINE-TUNING SPECIES
|
| 206 |
+
|
| 207 |
+
Evolving every species from scratch is costly in practice. For many locomotion control tasks, we already have a decent human-engineered robot as a starting point. In the fine-tuning task, we verify the ability of NGE to improve upon the human-engineered design. We showcase both, unconstrained experiments with NGE where the graph $( V , E , A )$ is fine-tuned, and constrained fine-tuning experiments where the topology of the graph is preserved and only the node attributes $\{ A ( u ) \}$ are fine-tuned. In the baseline models, the graph $( V , E , A )$ is fixed, and only the controllers are trained. We can see in Figure 4 that when given the same wall-clock time, it is better to co-evolve the attributes and controllers with NGE than only training the controllers.
|
| 208 |
+
|
| 209 |
+
The figure shows that with NGE, the cheetah gradually transforms the forefoot into a claw, the 3D-fish rotates the pose of the side-fins and tail, and the 2D-walker evolves bigger feet. In general, unconstrained fine-tuning with NGE leads to better performance, but not necessarily preserves the initial structures.
|
| 210 |
+
|
| 211 |
+

|
| 212 |
+
Figure 5: Results of ablation study, NGE without uncertainty results and rapid evolution during experiments.
|
| 213 |
+
|
| 214 |
+
# 4.3 GREEDY SEARCH V.S. EXPLORATION UNDER UNCERTAINTY
|
| 215 |
+
|
| 216 |
+
We also investigate the performance of NGE with and without Graph Mutation with Uncertainty, whose hyper-parameters are summarized in Appendix E. In Figure 5a, we applied GM-UC to the evolution graph search task. The final performance of the GM-UC outperforms the baseline on both fish and walker environments. The proposed GM-UC is able to better explore the graph space, showcasing its importance.
|
| 217 |
+
|
| 218 |
+
# 4.4 COMPUTATION COST AND GENERATION SIZE
|
| 219 |
+
|
| 220 |
+
We also investigate how the generation size $\mathcal { N }$ affect the final performance of NGE. We note that as we increase the generation size and the computing resources, NGE achieves marginal improvement on the simple Fish task. A NGE session with 16-core m5.4xlarge $\$ 0.768$ per Hr) AWS machine can achieve almost the same performance with 64-core m4.16xlarge $\$ 3.20$ per Hr) in Fish environment in the same wall-clock time. However, we do notice that there is a trade off between computational resources and performance for the more difficult task. In general, NGE is effective even when the computing resources are limited and it significantly outperforms RGS and ES by using only a small generation size of 16.
|
| 221 |
+
|
| 222 |
+
# 5 DISCUSSION
|
| 223 |
+
|
| 224 |
+
In this paper, we introduced NGE, an efficient graph search algorithm for automatic robot design that co-evolves the robot design graph and its controllers. NGE greatly reduces evaluation cost by transferring the learned GNN-based control policy from previous generations, and better explores the search space by incorporating model uncertainties. Our experiments show that the search over the robotic body structures is challenging, where both random graph search and evolutionary strategy fail to discover meaning robot designs. NGE significantly outperforms the naive approaches in both the final performance and computation time by an order of magnitude, and is the first algorithm that can discovers graphs similar to carefully hand-engineered design. We believe this work is an important step towards automated robot design, and may show itself useful to other graph search problems.
|
| 225 |
+
|
| 226 |
+
Acknowledgements Partially supported by Samsung and NSERC. We also thank NVIDIA for their donation of GPUs.
|
| 227 |
+
|
| 228 |
+
# REFERENCES
|
| 229 |
+
|
| 230 |
+
Trapit Bansal, Jakub Pachocki, Szymon Sidor, Ilya Sutskever, and Igor Mordatch. Emergent complexity via multi-agent competition. arXiv preprint arXiv:1710.03748, 2017.
|
| 231 |
+
|
| 232 |
+
Joan Bruna, Wojciech Zaremba, Arthur Szlam, and Yann LeCun. Spectral networks and locally connected networks on graphs. ICLR, 2014.
|
| 233 |
+
|
| 234 |
+
Roberto Calandra, André Seyfarth, Jan Peters, and Marc Peter Deisenroth. Bayesian optimization for learning gaits under uncertainty. Annals of Mathematics and Artificial Intelligence, 76(1-2):5–23, 2016.
|
| 235 |
+
|
| 236 |
+
Nick Cheney, Robert MacCurdy, Jeff Clune, and Hod Lipson. Unshackling evolution: Evolving soft robots with multiple materials and a powerful generative encoding. ACM SIGEVOlution, 7(1): 11–23, 2014.
|
| 237 |
+
|
| 238 |
+
Kurtland Chua, Roberto Calandra, Rowan McAllister, and Sergey Levine. Deep reinforcement learning in a handful of trials using probabilistic dynamics models. arXiv preprint arXiv:1805.12114, 2018.
|
| 239 |
+
|
| 240 |
+
Junyoung Chung, Caglar Gulcehre, KyungHyun Cho, and Yoshua Bengio. Empirical evaluation of gated recurrent neural networks on sequence modeling. arXiv preprint arXiv:1412.3555, 2014.
|
| 241 |
+
|
| 242 |
+
Michaël Defferrard, Xavier Bresson, and Pierre Vandergheynst. Convolutional neural networks on graphs with fast localized spectral filtering. In NIPS, 2016.
|
| 243 |
+
|
| 244 |
+
Paul Drews, Grady Williams, Brian Goldfain, Evangelos A Theodorou, and James M Rehg. Aggressive deep driving: Combining convolutional neural networks and model predictive control. In Conference on Robot Learning, pp. 133–142, 2017.
|
| 245 |
+
|
| 246 |
+
David Duff, Mark Yim, and Kimon Roufas. Evolution of polybot: A modular reconfigurable robot. In Proc. of the Harmonic Drive Intl. Symposium, Nagano, Japan, 2001.
|
| 247 |
+
|
| 248 |
+
David K Duvenaud, Dougal Maclaurin, Jorge Iparraguirre, Rafael Bombarell, Timothy Hirzel, Alán Aspuru-Guzik, and Ryan P Adams. Convolutional networks on graphs for learning molecular fingerprints. In NIPS, 2015.
|
| 249 |
+
|
| 250 |
+
Yarin Gal and Zoubin Ghahramani. Dropout as a bayesian approximation: Representing model uncertainty in deep learning. In international conference on machine learning, pp. 1050–1059, 2016.
|
| 251 |
+
|
| 252 |
+
Nicolas Heess, Srinivasan Sriram, Jay Lemmon, Josh Merel, Greg Wayne, Yuval Tassa, Tom Erez, Ziyu Wang, Ali Eslami, Martin Riedmiller, et al. Emergence of locomotion behaviours in rich environments. arXiv preprint arXiv:1707.02286, 2017.
|
| 253 |
+
|
| 254 |
+
Mikael Henaff, Joan Bruna, and Yann LeCun. Deep convolutional networks on graph-structured data. arXiv preprint arXiv:1506.05163, 2015.
|
| 255 |
+
|
| 256 |
+
Michał Joachimczak, Reiji Suzuki, and Takaya Arita. Fine grained artificial development for bodycontroller coevolution of soft-bodied animats. Artificial life, 14:239–246, 2014.
|
| 257 |
+
|
| 258 |
+
Thomas N Kipf and Max Welling. Semi-supervised classification with graph convolutional networks. ICLR, 2017.
|
| 259 |
+
|
| 260 |
+
Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton. Imagenet classification with deep convolutional neural networks. In Advances in neural information processing systems, pp. 1097–1105, 2012.
|
| 261 |
+
|
| 262 |
+
Christopher G Langton. Artificial life: An overview. Mit Press, 1997.
|
| 263 |
+
|
| 264 |
+
Wei-Po Lee. An evolutionary system for automatic robot design. In Systems, Man, and Cybernetics, 1998. 1998 IEEE International Conference on, volume 4, pp. 3477–3482. IEEE, 1998.
|
| 265 |
+
|
| 266 |
+
Yujia Li, Daniel Tarlow, Marc Brockschmidt, and Richard Zemel. Gated graph sequence neural networks. arXiv preprint arXiv:1511.05493, 2015.
|
| 267 |
+
|
| 268 |
+
Hanxiao Liu, Karen Simonyan, Oriol Vinyals, Chrisantha Fernando, and Koray Kavukcuoglu. Hierarchical representations for efficient architecture search. arXiv preprint arXiv:1711.00436, 2017.
|
| 269 |
+
|
| 270 |
+
Melanie Mitchell and Stephanie Forrest. Genetic algorithms and artificial life. Artificial life, 1(3): 267–289, 1994.
|
| 271 |
+
|
| 272 |
+
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.
|
| 273 |
+
|
| 274 |
+
Volodymyr Mnih, Adria Puigdomenech Badia, Mehdi Mirza, Alex Graves, Timothy Lillicrap, Tim Harley, David Silver, and Koray Kavukcuoglu. Asynchronous methods for deep reinforcement learning. In International Conference on Machine Learning, pp. 1928–1937, 2016.
|
| 275 |
+
|
| 276 |
+
Anusha Nagabandi, Gregory Kahn, Ronald S Fearing, and Sergey Levine. Neural network dynamics for model-based deep reinforcement learning with model-free fine-tuning. arXiv preprint arXiv:1708.02596, 2017.
|
| 277 |
+
|
| 278 |
+
Ferrante Neri. Memetic compact differential evolution for cartesian robot control. IEEE Computational Intelligence Magazine, 5(2):54–65, 2010.
|
| 279 |
+
|
| 280 |
+
Hieu Pham, Melody Y Guan, Barret Zoph, Quoc V Le, and Jeff Dean. Efficient neural architecture search via parameter sharing. arXiv preprint arXiv:1802.03268, 2018.
|
| 281 |
+
|
| 282 |
+
Aravind Rajeswaran, Kendall Lowrey, Emanuel V Todorov, and Sham M Kakade. Towards generalization and simplicity in continuous control. In Advances in Neural Information Processing Systems, pp. 6553–6564, 2017.
|
| 283 |
+
|
| 284 |
+
John Schulman, Filip Wolski, Prafulla Dhariwal, Alec Radford, and Oleg Klimov. Proximal policy optimization algorithms. arXiv preprint arXiv:1707.06347, 2017.
|
| 285 |
+
|
| 286 |
+
Karl Sims. Evolving virtual creatures. In Proceedings of the 21st annual conference on Computer graphics and interactive techniques, pp. 15–22. ACM, 1994.
|
| 287 |
+
|
| 288 |
+
Jasper Snoek, Hugo Larochelle, and Ryan P Adams. Practical bayesian optimization of machine learning algorithms. In Advances in neural information processing systems, pp. 2951–2959, 2012.
|
| 289 |
+
|
| 290 |
+
Kenneth O Stanley and Risto Miikkulainen. Evolving neural networks through augmenting topologies. Evolutionary computation, 10(2):99–127, 2002.
|
| 291 |
+
|
| 292 |
+
Luc Steels. The artificial life roots of artificial intelligence. Artificial life, 1(1_2):75–110, 1993.
|
| 293 |
+
|
| 294 |
+
Yuval Tassa, Tom Erez, and Emanuel Todorov. Synthesis and stabilization of complex behaviors through online trajectory optimization. In Intelligent Robots and Systems (IROS), 2012 IEEE/RSJ International Conference on, pp. 4906–4913. IEEE, 2012.
|
| 295 |
+
|
| 296 |
+
Yuval Tassa, Yotam Doron, Alistair Muldal, Tom Erez, Yazhe Li, Diego de Las Casas, David Budden, Abbas Abdolmaleki, Josh Merel, Andrew Lefrancq, et al. Deepmind control suite. arXiv preprint arXiv:1801.00690, 2018.
|
| 297 |
+
|
| 298 |
+
Tim Taylor. Evolution in virtual worlds. arXiv preprint arXiv:1710.06055, 2017.
|
| 299 |
+
|
| 300 |
+
Emanuel Todorov, Tom Erez, and Yuval Tassa. Mujoco: A physics engine for model-based control. In Intelligent Robots and Systems (IROS), 2012 IEEE/RSJ International Conference on, pp. 5026– 5033. IEEE, 2012.
|
| 301 |
+
|
| 302 |
+
Li Wan, Matthew Zeiler, Sixin Zhang, Yann Le Cun, and Rob Fergus. Regularization of neural networks using dropconnect. In International Conference on Machine Learning, pp. 1058–1066, 2013.
|
| 303 |
+
|
| 304 |
+
Tingwu Wang, Renjie Liao, Jimmy Ba, and Sanja Fidler. Nervenet: Learning structured policy with graph neural networks. In ICLR, 2018.
|
| 305 |
+
|
| 306 |
+
Barret Zoph and Quoc V Le. Neural architecture search with reinforcement learning. arXiv preprint arXiv:1611.01578, 2016.
|
| 307 |
+
|
| 308 |
+

|
| 309 |
+
Figure 6: In this figure, we show the computation graph of NerveNet+ $^ +$ . At each timestep, every node in the graph updates its hidden state by absorbing the messages as well as the input feature. The output function takes the hidden states as input and outputs the controller (or policy) of the agent.
|
| 310 |
+
|
| 311 |
+
# A DETAILS OF NERVENET $^ { + + }$
|
| 312 |
+
|
| 313 |
+
Similar to NerveNet, we parse the agent into a graph, where each node in the graph corresponds to the physical body part of the agents. For example, the fish in Figure 1 can be parsed into a graph of five nodes, namely the torso (0), left-fin (1), right-fin (2), and tail-fin bodies (3, 4). By replacing MLP with NerveNet, the learnt policy has much better performance in terms of robustness and the transfer learning ability. We here propose minor but effective modifications to Wang et al. (2018), and refer to this model as NerveNet++.
|
| 314 |
+
|
| 315 |
+
In the original NerveNet, at every timestep, several propagation steps need to be performed such that every node is able to receive global information before producing the control signal. This is time and memory consuming, with the minimum number of propagation steps constrained by the depth of the graph.
|
| 316 |
+
|
| 317 |
+
Since the episode of each game usually lasts for several hundred timesteps, it is computationally expensive and ineffective to build the full back-propagation graph. Inspired by Mnih et al. (2016), we employ the truncated graph back-propagation to optimize the policy. NerveNet+ $^ { \cdot + }$ is suitable for an evolutionary search or population-based optimization, as it brings speed-up in wall-clock time, and decreases the amount of memory usage.
|
| 318 |
+
|
| 319 |
+
Therefore in NerveNe $^ { + + }$ , we propose a propagation model with the memory state, where each node updates its hidden state by absorbing the input feature and a message with time. The number of propagation steps is no longer constrained by the depth of the graph, and in back-propagation, we save memory and time consumption with truncated computation graph.
|
| 320 |
+
|
| 321 |
+
The computational performance evaluation is provided in Appendix B. NerveNet+ $^ +$ model is trained by the PPO algorithm Schulman et al. (2017); Heess et al. (2017),
|
| 322 |
+
|
| 323 |
+
# B OPTIMIZATION WITH TRUNCATED BACKPROPAGATION
|
| 324 |
+
|
| 325 |
+
During training, the agent generates the rollout data by sampling from the distribution $a _ { t } \sim \pi ( a _ { t } | s _ { t } )$ and stores the training data of $\mathcal { D } = \{ a ^ { t } , s ^ { t } , \{ h _ { u } ^ { t , \tau = 0 } \} \}$ . To train the reinforcement learning agents with memory, the original training objective is
|
| 326 |
+
|
| 327 |
+
$$
|
| 328 |
+
J ( \theta ) = \mathbb { E } _ { \pi } \left[ \sum _ { t = 0 } ^ { \infty } \gamma ^ { t } r ( s ^ { t } , a ^ { t } , \{ h _ { u } ^ { t , \tau = 0 } \} ) \right] ,
|
| 329 |
+
$$
|
| 330 |
+
|
| 331 |
+
where we denote the whole update model as $H$ and
|
| 332 |
+
|
| 333 |
+
$$
|
| 334 |
+
h _ { u } ^ { t + 1 , \tau = 0 } = H ( \{ h _ { v } ^ { t , \tau = 0 } \} , s ^ { t } , a ^ { t } ) .
|
| 335 |
+
$$
|
| 336 |
+
|
| 337 |
+

|
| 338 |
+
Figure 7: In these two figures, we show that to reach similar performance, NerveNet+ $^ +$ took shorter time comparing to original NerveNet.
|
| 339 |
+
|
| 340 |
+
The memory state $h _ { u } ^ { t + 1 , \tau }$ depends on the previous actions, observations, and states. Therefore, the full back-propagation graph will be the same length as the episode length, which is very computationally intensive. The intuition from the authors in Mnih et al. (2016) is that, for the RL agents, the dependency of the agents on timesteps that are far-away from the current timestep is limited. Thus, negligible accuracy of the gradient estimator will be lost if we truncate the back-propagation graph. We define a back-propagation length $\Gamma$ , and optimize the following objective function instead:
|
| 341 |
+
|
| 342 |
+
$$
|
| 343 |
+
\begin{array} { r l } & { \quad J _ { T } ( \theta ) = \mathbb E _ { \pi } \left[ \displaystyle \sum _ { t = 0 } ^ { \infty } \displaystyle \sum _ { \kappa = 0 } ^ { \Gamma - 1 } \gamma ^ { t + \kappa } r ( s _ { t + \kappa } , a _ { t + \kappa } , \{ h _ { u } ^ { t , \tau = 0 } \} ) \right] , \ : \mathrm { w h e r e } } \\ & { \quad h _ { u } ^ { t + \kappa , \tau = 0 } = \left\{ \begin{array} { l l } { H ( \{ h _ { v } ^ { t + \kappa - 1 , \tau = 0 } , \forall v \} , s _ { t + \kappa - 1 } , a _ { t + \kappa - 1 } ) \quad } & { \kappa \neq 0 , } \\ { h _ { u } ^ { t , \tau = 0 } \in \mathcal D \quad } & { \kappa = 0 , } \end{array} \right. } \end{array}
|
| 344 |
+
$$
|
| 345 |
+
|
| 346 |
+
Essentially this optimization means that we only back-propagate up to $\Gamma$ timesteps, namely at the places where $\kappa = 0$ , we treat the hidden state as input to the network and stop the gradient. To optimize the objective function, we follow same optimization procedure as in Wang et al. (2018), which is a variant of PPO Schulman et al. (2017), where a surrogate loss $J _ { \mathrm { p p o } } ( \theta )$ is optimized. We refer the readers to these papers for algorithm details.
|
| 347 |
+
|
| 348 |
+
# C FULL NGE RESULTS
|
| 349 |
+
|
| 350 |
+
Similar to the fish genealogy tree, in Fig. 8, the simple initial walking agent evolves into a cheetah-like structure, and is able to run with high speed. We also show the species generated by NGE, ESS-Sims (ESS-Sims-AF to be more specific, which has the best performance among all ESS-Sims variants.) and RGS.
|
| 351 |
+
|
| 352 |
+
# D RESETTING CONTROLLER FOR FAIR COMPETITION
|
| 353 |
+
|
| 354 |
+
Although amortized fitness is a better estimation of the ground-truth fitness, it is still biased. Species that appear earlier in the experiment will be trained for more updates if it survives. Indeed, intuitively, it is possible that in real nature, species that appear earlier on will dominate the generation by number, and new species are eliminated even if the new species has better fitness. Therefore, we design the experiment where we reset the weights for all species $\theta = ( \theta _ { \Phi } , \theta _ { \zeta } , \theta _ { M } , \theta _ { U } , \theta _ { F } )$ randomly. By doing this, we are forcing the species to compete fairly. From Fig 10, we notice that this method helps exploration, which leads to a higher reward in the end. However, it usually takes a longer time for the algorithm to converge. Therefore for the graph search task in Fig 2, we do not include the results with the controller-resetting.
|
| 355 |
+
|
| 356 |
+

|
| 357 |
+
Figure 8: Our walker species gradually grows two foot-like structures from randomly initialized body graph.
|
| 358 |
+
|
| 359 |
+

|
| 360 |
+
Figure 9: We present qualitative comparison between the three algorithms in the figure. Specifically, the aligned comparison between our method and naive baseline are the representative creatures at the same generation (using same computation resources). Our algorithm notably display stronger dominance in terms of its structure as well as reward.
|
| 361 |
+
|
| 362 |
+

|
| 363 |
+
Figure 10: The results of resetting controller scheme and baselines.
|
| 364 |
+
|
| 365 |
+
# E HYPER-PARAMETERS SEARCHED
|
| 366 |
+
|
| 367 |
+
All methods are given equal amount of computation budget. To be more specific, the number of total timesteps generated by all species for all generations is the same for all methods. For example, if we use 10 training epochs in one generation, each of the epoch with 2000 sampled timesteps, then the computation budget allows NGE to evolve for 200 generations, where each generation has a species size of 64. For NGE, RGS, ESS-Sims-AF models in Fig 11, we run a grid search over the hyper-parameters recorded in Table 2, and Table 3, and plot the curve with the best results respectively.
|
| 368 |
+
|
| 369 |
+

|
| 370 |
+
Figure 11: The results of the graph search
|
| 371 |
+
|
| 372 |
+
Since the number of generations for the RGS baseline can be regarded as 1, its curve is plotted with the number of updates normalized by the computation resource as $\mathbf { X }$ -axis.
|
| 373 |
+
|
| 374 |
+
Here we show the detail figures of six baselines, which are: RGS-20, RGS-100, RGS-200, and ESS-Sims-AF-20, ESS-Sims-AF-100, ESS-Sims-AF-200. The number attached to the baseline names indicates the number of inner-loop policy training epochs. In the case of RGS-20, where more than 12800 different graphs are searched over, the average reward is still very low. Increasing the number of inner-loop training of species to 100 and 200 does not help the final performance significantly.
|
| 375 |
+
|
| 376 |
+
To test the performance with and without GM-UC, we use 64-core clusters (generations of size 64).
|
| 377 |
+
Here, the hyper-parameters are chosen to be the first value available in Table 2 and Table 3.
|
| 378 |
+
|
| 379 |
+
Table 2: Hyperparameter grid search options.
|
| 380 |
+
|
| 381 |
+
<table><tr><td>Items</td><td>Value Tried</td></tr><tr><td>Number of Iteration Per Update Number of Species per Generation Elimination Rate Discrete Socket Timesteps per Updates</td><td>10,20,100,200 16,32,64,100 0.15, 0.20, 0.3 Yes, True 2000,4000,6000</td></tr><tr><td>Target KL Learning Rate Schedule Number of Maximum Generation</td><td>0.01 Adaptive</td></tr><tr><td>Prob of Add-Node,Add-Graph Prob of Pert-Graph Prob of Del-Graph</td><td>400 0.15</td></tr></table>
|
| 382 |
+
|
| 383 |
+
# F MODEL BASED SEARCH USING THOMPSON SAMPLING
|
| 384 |
+
|
| 385 |
+
Thompson Sampling is a simple heuristic search strategy that is typically applied to the multi-armed bandit problem. The main idea is to select an action proportional to the probability of the action being optimal. When applied to the graph search problem, Thompson Sampling allows the search to balance the trade-off between exploration and exploitation by maximizing the expected fitness under the posterior distribution of the surrogate model.
|
| 386 |
+
|
| 387 |
+
Table 3: Hyperparameters grid search options for NGE.
|
| 388 |
+
|
| 389 |
+
<table><tr><td>Items</td><td>Value Tried</td></tr><tr><td>Allow Graph-Add</td><td>True, False</td></tr><tr><td>Graph Mutation with Uncertainty</td><td>True,False</td></tr><tr><td>Pruning Temperature</td><td>0.01, 0.1, 1</td></tr><tr><td>Network Structure</td><td>NerveNet,NerveNet++</td></tr><tr><td>Number Candidates before Pruning</td><td>200,400</td></tr></table>
|
| 390 |
+
|
| 391 |
+
Formally, Thompson Sampling selects the best graph candidates at each round according to the expected estimated fitness $\xi _ { P }$ using a surrogate model. The expectation is taken under the posterior distribution of the surrogate $P$ (model|data):
|
| 392 |
+
|
| 393 |
+
$$
|
| 394 |
+
\mathcal { G } ^ { * } = \arg \operatorname* { m a x } _ { \mathcal { G } } \mathbb { E } _ { P ( \mathrm { m o d e l } | \mathrm { d a t a } ) } \left[ \xi _ { P } \left( \mathcal { G } | \mathrm { m o d e l } \right) \right] .
|
| 395 |
+
$$
|
| 396 |
+
|
| 397 |
+
# F.1 SURROGATE MODEL ON GRAPHS.
|
| 398 |
+
|
| 399 |
+
Here we consider a graph neural network (GNN) surrogate model to predict the average fitness of a graph as a Gaussian distribution, namely $\boldsymbol { P } \left( f ( \boldsymbol { \mathcal { G } } ) \right) \ \stackrel { \sim } { \sim } \mathcal { N } \left( \xi _ { P } ( \boldsymbol { \mathcal { G } } ) , \stackrel { \sim } { \sigma } ^ { 2 } ( \boldsymbol { \mathcal { G } } ) \right)$ . We use a simple architecture that predicts the mean of the Gaussian from the last hidden layer activations, $h _ { W } ( { \mathcal { G } } ) \in$ $\mathbb { R } ^ { D }$ , of the GNN, where $W$ are the weights in the GNN up to the last hidden layer.
|
| 400 |
+
|
| 401 |
+
Greedy search. We denoted the size of dataset as $N$ . The GNN weights are trained to predict the average fitness of the graph as a standard regression task:
|
| 402 |
+
|
| 403 |
+
$$
|
| 404 |
+
\operatorname* { m i n } _ { W , W _ { o u t } } \frac { \beta } { 2 } \sum _ { n = 1 } ^ { N } \left( \xi ( \mathcal { G } _ { n } ) - \xi _ { P } ( \mathcal { G } _ { n } ) \right) ^ { 2 } , \quad \mathrm { w h e r e } \quad \xi _ { P } ( \mathcal { G } _ { n } ) = W _ { o u t } ^ { T } h _ { W } ( \mathcal { G } _ { n } )
|
| 405 |
+
$$
|
| 406 |
+
|
| 407 |
+
# Algorithm 2 Greedy Search
|
| 408 |
+
|
| 409 |
+
1: Initialize generation $\mathcal { P } ^ { 0 }$
|
| 410 |
+
2: for $j <$ maximum generations do
|
| 411 |
+
3: Collect the $( \xi _ { i } ^ { k } , \mathcal { G } _ { i } ^ { k } )$ from previous $k \leq j$ generations . Update dataset
|
| 412 |
+
4: Train $W$ and $W _ { o u t }$ on $\{ ( \xi _ { i } ^ { k } , \mathcal { G } _ { i } ^ { k } ) \} _ { n = 1 } ^ { N }$ . Train GM-UC
|
| 413 |
+
5: Propose $\mathcal { C }$ new graph $\{ \mathcal { G } _ { i } \} _ { i = 1 } ^ { \mathcal { C } }$ , ${ \mathcal { C } } > > M$ . $\triangleright$ Propose new candidates
|
| 414 |
+
6: Rank $\{ \xi _ { P } ( \mathcal { G } _ { i } | W , W _ { o u t } ) \} _ { i = 1 } ^ { \mathcal { C } }$ on the proposals and pick the top $\kappa$ . Prune candidates
|
| 415 |
+
7: Update generation $\mathcal { P } ^ { j }$
|
| 416 |
+
8: for $m < \mathcal N$ do $\triangleright$ Train and evaluate each species
|
| 417 |
+
9: for $k <$ maximum parameter updates do
|
| 418 |
+
10: Train policy πGm
|
| 419 |
+
11: end for
|
| 420 |
+
12: Evaluate the fitness $\xi ( \mathcal { G } _ { m } , \theta _ { m } )$
|
| 421 |
+
13: end for
|
| 422 |
+
14: end for
|
| 423 |
+
|
| 424 |
+
Thompson Sampling In practice, Thompson Sampling is very similar to the previous greedy search algorithm. Instead of picking the top action according to the best model parameters, at each generation, it draws a sample of the model and takes a greedy action under the sampled model.
|
| 425 |
+
|
| 426 |
+
Approximating Thompson Sampling using Dropout Performing dropout during inference can be viewed as an approximately sampling from the model posterior. At each generation, we will sample a single dropout mask for the surrogate model and rank all the proposed graphs accordingly.
|
| 427 |
+
|
| 428 |
+
# Algorithm 3 Thompson Sampling using Bayesian Neural Networks
|
| 429 |
+
|
| 430 |
+
1: Initialize generation P0
|
| 431 |
+
2: for $j <$ maximum generations do
|
| 432 |
+
3: Collect the $( \xi _ { i } ^ { k } , \mathcal { G } _ { i } ^ { k } )$ from previous $k \leq j$ generations . Update dataset
|
| 433 |
+
4: Train $W$ and $W _ { o u t }$ on $\{ ( \xi _ { i } ^ { k } , \mathcal { G } _ { i } ^ { k } ) \} _ { n = 1 } ^ { N }$ . Train GM-UC
|
| 434 |
+
5: Propose $\mathcal { C }$ new graph $\{ \mathcal { G } _ { i } \} _ { i = 1 } ^ { \mathcal { C } } , \mathcal { C } > > M$ . . Propose new candidates
|
| 435 |
+
6: Sample a model from the posterior of the weights.
|
| 436 |
+
7: e.g. $\widetilde { W } , \widetilde { W } _ { o u t } \sim P \left( W , W _ { o u t } | D \right) \approx \mathcal { N } \left( [ W , W _ { o u t } ] , [ W , W _ { o u t } ] \right)$
|
| 437 |
+
8: (similar to DropConnect Wan et al. (2013))
|
| 438 |
+
9: Rank $\{ \xi _ { P } ( \mathcal { G } _ { i } | \widetilde { W } , \widetilde { W } _ { o u t } ) \} _ { i = 1 } ^ { \mathcal { C } }$ on the proposals and pick the top $\kappa$
|
| 439 |
+
10: for $m < \mathcal N$ do $\triangleright$ Train and evaluate each species
|
| 440 |
+
11: for $k <$ maximum parameter updates do
|
| 441 |
+
12: Train policy πGm
|
| 442 |
+
13: end for
|
| 443 |
+
14: Evaluate the fitness $\xi ( \mathcal { G } _ { m } , \theta _ { m } )$
|
| 444 |
+
15: end for
|
| 445 |
+
16: end for
|
| 446 |
+
|
| 447 |
+
# Algorithm 4 Thompson Sampling with Dropout
|
| 448 |
+
|
| 449 |
+
1: Initialize generation $\mathcal { P } ^ { 0 }$
|
| 450 |
+
2: for $j <$ maximum generations do
|
| 451 |
+
3: Collect the $( \xi _ { i } ^ { k } , \mathcal { G } _ { i } ^ { k } )$ from previous $k \leq j$ generations $\triangleright$ Update dataset
|
| 452 |
+
4: Train $W$ and $W _ { o u t }$ on $\{ { \mathcal G } _ { n } , \xi ( { \mathcal G } _ { n } ) \} _ { n = 1 } ^ { N }$ using dropout rate 0.5 on the inputs of the fc layers.
|
| 453 |
+
5: Propose $\mathcal { C }$ new graph $\{ \mathcal { G } _ { i } \} _ { i = 1 } ^ { \mathcal { C } } , \mathcal { C } > > M$ . . Propose new candidates
|
| 454 |
+
6: Sample a dropout mask $\mathrm { m } _ { i }$ for the hidden units
|
| 455 |
+
7: Rank $\{ \xi _ { P } ( \mathcal { G } _ { i } \bar { | } W , W _ { o u t } , \mathbf { m } _ { i } ) \} _ { i = 1 } ^ { J }$ on the proposals and pick the top $\kappa$
|
| 456 |
+
8: for $m < \mathcal N$ do $\triangleright$ Train and evaluate each species
|
| 457 |
+
9: for $k <$ maximum parameter updates do
|
| 458 |
+
10: Train policy πGm
|
| 459 |
+
11: end for
|
| 460 |
+
12: Evaluate the fitness $\xi ( \mathcal { G } _ { m } , \theta _ { m } )$
|
| 461 |
+
13: end for
|
| 462 |
+
14: end for
|
md/train/ByS1VpgRZ/ByS1VpgRZ.md
ADDED
|
@@ -0,0 +1,280 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# CGANS WITH PROJECTION DISCRIMINATOR
|
| 2 |
+
|
| 3 |
+
Takeru Miyato1, Masanori Koyama2 miyato@preferred.jp koyama.masanori@gmail.com 1Preferred Networks, Inc. 2Ritsumeikan University
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
We propose a novel, projection based way to incorporate the conditional information into the discriminator of GANs that respects the role of the conditional information in the underlining probabilistic model. This approach is in contrast with most frameworks of conditional GANs used in application today, which use the conditional information by concatenating the (embedded) conditional vector to the feature vectors. With this modification, we were able to significantly improve the quality of the class conditional image generation on ILSVRC2012 (ImageNet) 1000-class image dataset from the current state-of-the-art result, and we achieved this with a single pair of a discriminator and a generator. We were also able to extend the application to super-resolution and succeeded in producing highly discriminative super-resolution images. This new structure also enabled high quality category transformation based on parametric functional transformation of conditional batch normalization layers in the generator. The code with Chainer (Tokui et al., 2015), generated images and pretrained models are available at https://github.com/pfnet-research/sngan_projection.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
Generative Adversarial Networks (GANs) (Goodfellow et al., 2014) are a framework to construct a generative model that can mimic the target distribution, and in recent years it has given birth to arrays of state-of-the-art algorithms of generative models on image domain (Radford et al., 2016; Salimans et al., 2016; Ledig et al., 2017; Zhang et al., 2017; Reed et al., 2016). The most distinctive feature of GANs is the discriminator $D ( { \pmb x } )$ that evaluates the divergence between the current generative distribution $p _ { G } ( \pmb { x } )$ and the target distribution $q ( { \pmb x } )$ (Goodfellow et al., 2014; Nowozin et al., 2016; Arjovsky et al., 2017). The algorithm of GANs trains the generator model by iteratively training the discriminator and generator in turn, with the discriminator acting as an increasingly meticulous critic of the current generator.
|
| 12 |
+
|
| 13 |
+
Conditional GANs (cGANs) are a type of GANs that use conditional information (Mirza & Osindero, 2014) for the discriminator and generator, and they have been drawing attention as a promising tool for class conditional image generation (Odena et al., 2017), the generation of the images from text (Reed et al., 2016; Zhang et al., 2017), and image to image translation (Kim et al., 2017; Zhu et al., 2017). Unlike in standard GANs, the discriminator of cGANs discriminates between the generator distribution and the target distribution on the set of the pairs of generated samples $_ { \textbf { \em x } }$ and its intended conditional variable $\textbf { { y } }$ . To the authors’ knowledge, most frameworks of discriminators in cGANs at the time of writing feeds the pair the conditional information $\textbf { { y } }$ into the discriminator by naively concatenating (embedded) $\textbf { { y } }$ to the input or to the feature vector at some middle layer (Mirza & Osindero, 2014; Denton et al., 2015; Reed et al., 2016; Zhang et al., 2017; Perarnau et al., 2016; Saito et al., 2017; Dumoulin et al., 2017a; Sricharan et al., 2017). We would like to however, take into account the structure of the assumed conditional probabilistic models underlined by the structure of the discriminator, which is a function that measures the information theoretic distance between the generative distribution and the target distribution.
|
| 14 |
+
|
| 15 |
+
By construction, any assumption about the form of the distribution would act as a regularization on the choice of the discriminator. In this paper, we propose a specific form of the discriminator, a form motivated by a probabilistic model in which the distribution of the conditional variable $\textbf { { y } }$ given $_ { \textbf { \em x } }$ is
|
| 16 |
+
|
| 17 |
+

|
| 18 |
+
Figure 1: Discriminator models for conditional GANs
|
| 19 |
+
|
| 20 |
+

|
| 21 |
+
|
| 22 |
+

|
| 23 |
+
(a) Images generated with the projection model. (left) Tibetan terrier and (right) mushroom.
|
| 24 |
+
(b) (left) Consecutive category morphing with fixed $_ { z }$ . geyser Tibetan terrier mushroom robin. (right) category morphing from Tibetan terrier to mushroom with different value of fixed $_ { z }$
|
| 25 |
+
|
| 26 |
+
Figure 2: The generator trained with the projection model can generate diverse set of images. For more results, see the experiment section and the appendix section.
|
| 27 |
+
|
| 28 |
+
discrete or uni-modal continuous distributions. This model assumption is in fact common in many real world applications, including class-conditional image generation and super-resolution.
|
| 29 |
+
|
| 30 |
+
As we will explain in the next section, adhering to this assumption will give rise to a structure of the discriminator that requires us to take an inner product between the embedded condition vector $\textbf { { y } }$ and the feature vector (Figure 1d). With this modification, we were able to significantly improve the quality of the class conditional image generation on 1000-class ILSVRC2012 dataset (Russakovsky et al., 2015) with a single pair of a discriminator and generator (see the generated examples in Figure 2). Also, when we applied our model of cGANs to a super-resolution task, we were able to produce high quality super-resolution images that are more discriminative in terms of the accuracy of the label classifier than the cGANs based on concatenation, as well as the bilinear and the bicubic method.
|
| 31 |
+
|
| 32 |
+
# 2 THE ARCHITECTURE OF THE CGAN DISCRIMINATOR WITH A PROBABILISTIC MODEL ASSUMPTIONS
|
| 33 |
+
|
| 34 |
+
Let us denote the input vector by $_ { \textbf { \em x } }$ and the conditional information by $y ^ { 1 }$ . We also denote the cGAN discriminator by $D ( \pmb { x } , \pmb { y } ; \theta ) : = \mathcal { A } ( f ( \pmb { x } , \pmb { y } ; \theta ) )$ , where $f$ is a function of $_ { \textbf { \em x } }$ and $y , \theta$ is the parameters of $f$ , and $\mathcal { A }$ is an activation function of the users’ choice. Using $q$ and $p$ to designate the true distributions and the generator model respectively, the standard adversarial loss for the
|
| 35 |
+
|
| 36 |
+
discriminator is given by:
|
| 37 |
+
|
| 38 |
+
$$
|
| 39 |
+
\mathcal { L } ( D ) = - E _ { q ( y ) } \left[ E _ { q ( x | y ) } \left[ \log ( D ( x , y ) ) \right] \right] - E _ { p ( y ) } \left[ E _ { p ( x | y ) } \left[ \log ( 1 - D ( x , y ) ) \right] \right] ,
|
| 40 |
+
$$
|
| 41 |
+
|
| 42 |
+
with $\mathcal { A }$ in $D$ representing the sigmoid function. By construction, the nature of the ‘critic’ $D$ significantly affects the performance of $G$ . A conventional way of feeding $\textbf { { y } }$ to $D$ until now has been to concatenate the vector $\textbf { { y } }$ to the feature vector $_ { \textbf { \em x } }$ , either at the input layer (Mirza $\&$ Osindero, 2014; Denton et al., 2015; Saito et al., 2017), or at some hidden layer (Reed et al., 2016; Zhang et al., 2017; Perarnau et al., 2016; Dumoulin et al., 2017a; Sricharan et al., 2017) (see Figure 1a and Figure 1b). We would like to propose an alternative to this approach by observing the form of the optimal solution (Goodfellow et al., 2014) for the loss function, Eq. (1), can be decomposed into the sum of two log likelihood ratios:
|
| 43 |
+
|
| 44 |
+
$$
|
| 45 |
+
f ^ { * } ( x , y ) = \log { \frac { q ( x | y ) q ( y ) } { p ( x | y ) p ( y ) } } = \log { \frac { q ( y | x ) } { p ( y | x ) } } + \log { \frac { q ( x ) } { p ( x ) } } : = r ( y | x ) + r ( x ) .
|
| 46 |
+
$$
|
| 47 |
+
|
| 48 |
+
Now, we can model the log likelihood ratio $r ( \pmb { y } | \pmb { x } )$ and $r ( { \pmb x } )$ by some parametric functions $f _ { 1 }$ and $f _ { 2 }$ respectively. If we make a standing assumption that $p ( \pmb { y } | \pmb { x } )$ and $q ( \pmb { y } | \pmb { x } )$ are simple distributions like those that are Gaussian or discrete log linear on the feature space, then, as we will show, the parametrization of the following form becomes natural:
|
| 49 |
+
|
| 50 |
+
$$
|
| 51 |
+
f ( \pmb { x } , \pmb { y } ; \theta ) : = f _ { 1 } ( \pmb { x } , \pmb { y } ; \theta ) + f _ { 2 } ( \pmb { x } ; \theta ) = \pmb { y } ^ { \operatorname { T } } V \phi ( \pmb { x } ; \theta _ { \Phi } ) + \psi ( \phi ( \pmb { x } ; \theta _ { \Phi } ) ; \theta _ { \Psi } ) ,
|
| 52 |
+
$$
|
| 53 |
+
|
| 54 |
+
where $V$ is the embedding matrix of y, $, \phi ( \cdot , \theta _ { \Phi } )$ is a vector output function of $_ { \textbf { \em x } }$ , and $\psi ( \cdot , \theta _ { \Psi } )$ is a scalar function of the same $\phi ( \pmb { x } ; \theta _ { \Phi } )$ that appears in $f _ { 1 }$ (see Figure 1d). The learned parameters $\theta = \{ V , \theta _ { \Phi } , \theta _ { \Psi } \}$ are to be trained to optimize the adversarial loss. From this point on, we will refer to this model of the discriminator as projection for short. In the next section, we would like to elaborate on how we can arrive at this form.
|
| 55 |
+
|
| 56 |
+
# 3 MOTIVATION BEHIND THE projection DISCRIMINATOR
|
| 57 |
+
|
| 58 |
+
In this section, we will begin from specific, often recurring models and show that, with certain regularity assumption, we can write the optimal solution of the discriminator objective function in the form of (3). Let us first consider the a case of categorical variable. Assume that $y$ is a categorical variable taking a value in $\{ 1 , \ldots , C \}$ , which is often common for a class conditional image generation task. The most popular model for $p ( y | \mathbf { \boldsymbol { x } } )$ is the following log linear model:
|
| 59 |
+
|
| 60 |
+
$$
|
| 61 |
+
\log p ( y = c | \pmb { x } ) : = \pmb { v } _ { c } ^ { p \mathrm { T } } \phi ( \pmb { x } ) - \log Z ( \phi ( \pmb { x } ) ) ,
|
| 62 |
+
$$
|
| 63 |
+
|
| 64 |
+
where $\begin{array} { r } { Z ( \phi ( \pmb { x } ) ) : = \left( \sum _ { j = 1 } ^ { C } \exp \left( \pmb { v } _ { j } ^ { p \mathrm { T } } \phi ( \pmb { x } ) \right) \right) } \end{array}$ is the partition function, and $\phi : \pmb { x } \mapsto \mathbb { R } ^ { d ^ { L } }$ is the input to the final layer of the network model. Now, we assume that the target distribution $q$ can also be parametrized in this form, with the same choice of $\phi$ . This way, the log likelihood ratio would take the following form;
|
| 65 |
+
|
| 66 |
+
$$
|
| 67 |
+
r ( y | x ) = \log \frac { q ( y = c | x ) } { p ( y = c | x ) } = ( v _ { c } ^ { q } - v _ { c } ^ { p } ) ^ { \mathrm { T } } \phi ( x ) - ( \log Z ^ { q } ( \phi ( x ) ) - \log Z ^ { p } ( \phi ( x ) ) ) .
|
| 68 |
+
$$
|
| 69 |
+
|
| 70 |
+
If we make the values of $( v _ { c } ^ { q } , v _ { c } ^ { p } )$ implicit and put $\pmb { v } _ { c } : = ( \pmb { v } _ { c } ^ { q } - \pmb { v } _ { c } ^ { p } )$ , we can write $f _ { 1 } ( x , y = c ) =$ ${ \pmb v } _ { c } ^ { \mathrm { T } } \phi ( { \pmb x } )$ . Now, if we can put together the normalization constant $- \left( \log Z ^ { q } ( \phi ( { \pmb x } ) ) - \log Z ^ { p } ( \phi ( { \pmb x } ) ) \right)$ and $r ( { \pmb x } )$ into one expression $\bar { \psi } ( \phi ( { \pmb x } ) )$ , we can rewrite the equation above as
|
| 71 |
+
|
| 72 |
+
$$
|
| 73 |
+
f ( \pmb { x } , \pmb { y } ) : = \pmb { y } ^ { \mathrm { T } } V \phi ( \pmb { x } ) + \psi ( \phi ( \pmb { x } ) ) .
|
| 74 |
+
$$
|
| 75 |
+
|
| 76 |
+
by using $\textbf { { y } }$ to denote a one-hot vector of the label $y$ and using $V$ to denote the matrix consisting of the row vectors $v _ { c }$ . Most notably, this formulation introduces the label information via an inner product, as opposed to concatenation. The form (6) is indeed the form we proposed in (3).
|
| 77 |
+
|
| 78 |
+
We can also arrive at the form (3) for unimodal continuous distributions $p ( \pmb { y } | \pmb { x } )$ as well. Let $\textbf { \textit { y } } \in \ \mathbb { R } ^ { d }$ be a $d$ -dimensional continuous variable, and let us assume that conditional $q ( \pmb { y } | \pmb { x } )$ and $p ( \pmb { y } | \pmb { x } )$ are both given by Gaussian distributions, so that $q ( \pmb { y } | \pmb { x } ) = \mathcal { N } ( \pmb { y } | \pmb { \mu } _ { q } ( \pmb { x } ) , \pmb { \Lambda } _ { q } ^ { - 1 } )$ and
|
| 79 |
+
|
| 80 |
+
$p ( \pmb { y } | \pmb { x } ) = \mathcal { N } ( \pmb { y } | \pmb { \mu } _ { p } ( \pmb { x } ) , \pmb { \Lambda } _ { p } ^ { - 1 } )$ where $\pmb { \mu } _ { q } ( \pmb { x } ) : = W ^ { q } \pmb { \phi } ( \pmb { x } )$ and $\mu _ { p } ( { \pmb x } ) : = W ^ { p } \phi ( { \pmb x } )$ . Then the log density ratio $r ( { \pmb y } | { \pmb x } ) = \log \big ( q ( { \pmb y } | { \pmb x } ) / p ( { \pmb y } | { \pmb x } ) \big )$ is given by:
|
| 81 |
+
|
| 82 |
+
$$
|
| 83 |
+
\begin{array} { r } { r ( \pmb { y } | \pmb { x } ) = \log \left( \sqrt { \frac { | \mathbf { A } _ { q } | } { | \mathbf { A } _ { p } | } } \frac { \exp ( - ( 1 / 2 ) ( \pmb { y } - \pmb { \mu } _ { q } ( \pmb { x } ) ) ^ { \mathrm { T } } \mathbf { A } _ { q } ( \pmb { y } - \pmb { \mu } _ { q } ( \pmb { x } ) ) ) } { \exp ( - ( 1 / 2 ) ( \pmb { y } - \pmb { \mu } _ { p } ( \pmb { x } ) ) ^ { \mathrm { T } } \mathbf { A } _ { p } ( \pmb { y } - \pmb { \mu } _ { p } ( \pmb { x } ) ) ) } \right) } \\ { = - \frac { 1 } { 2 } \pmb { y } ^ { \mathrm { T } } \left( \pmb { \Lambda } _ { q } - \pmb { \Lambda } _ { p } \right) \pmb { y } + \pmb { y } ^ { \mathrm { T } } ( \pmb { \Lambda } _ { q } W ^ { q } - \pmb { \Lambda } _ { p } W ^ { p } ) \phi ( \pmb { x } ) + \psi ( \phi ( \pmb { x } ) ) , } \end{array}
|
| 84 |
+
$$
|
| 85 |
+
|
| 86 |
+
where $\psi ( \phi ( { \pmb x } ) )$ represents the terms independent of $\textbf { { y } }$ . Now, if we assume that $\pmb { \Lambda } _ { q } = \pmb { \Lambda } _ { p } : = \pmb { \Lambda }$ , we can ignore the quadratic term. If we further express $\pmb { \Lambda } _ { q } W ^ { q } - \pmb { \Lambda } _ { p } W ^ { p }$ in the form $V$ , we can arrive at the form (3) again.
|
| 87 |
+
|
| 88 |
+
Indeed, however, the way that this regularization affects the training of the generator $G$ is a little unclear in its formulation. As we have repeatedly explained, our discriminator measures the divergence between the generator distribution $p$ and the target distribution $q$ on the assumption that $p ( \pmb { y } | \pmb { x } )$ and $q ( \pmb { y } | \pmb { x } )$ are relatively simple, and it is highly possible that we are gaining stability in the training process by imposing a regularity condition on the divergence measure. Meanwhile, however, the actual $p ( \boldsymbol { y } | \boldsymbol { x } )$ can only be implicitly derived from $p ( { \pmb x } , { \pmb y } )$ in computation, and can possibly take numerous forms other than the ones we have considered here. We must admit that there is a room here for an important theoretical work to be done in order to assess the relationship between the choice of the function space for the discriminator and training process of the generator.
|
| 89 |
+
|
| 90 |
+
# 4 COMPARISON WITH OTHER METHODS
|
| 91 |
+
|
| 92 |
+
As described above, (3) is a form that is true for frequently occurring situations. In contrast, incorporation of the conditional information by concatenation is rather arbitrary and can possibly include into the pool of candidate functions some sets of functions for which it is difficult to find a logical basis. Indeed, if the situation calls for multimodal $p ( \pmb { y } | \pmb { x } )$ , it might be smart not to use the model that we suggest here. Otherwise, however, we expect our model to perform better; in general, it is preferable to use a discriminator that respects the presumed form of the probabilistic model.
|
| 93 |
+
|
| 94 |
+
Still another way to incorporate the conditional information into the training procedure is to directly manipulate the loss function. The algorithm of AC-GANs (Odena et al., 2017) use a discriminator $( D _ { 1 } )$ that shares a part of its structure with the classifier $( D _ { 2 } )$ , and incorporates the label information into the objective function by augmenting the original discriminator objective with the likelihood score of the classifier on both the generated and training dataset (see Figure 1c). Plug and Play Generative models (PPGNs) (Nguyen et al., 2017) is another approach for the generative model that uses an auxiliary classifier function. It is a method that endeavors to make samples from $p ( { \pmb x } | { \pmb y } )$ using an MCMC sampler based on the Langevin equation with drift terms consisting of the gradient of an autoencoder prior $p ( { \pmb x } )$ and a pretrained auxiliary classifier $p ( y | \mathbf { \boldsymbol { x } } )$ . With these method, one can generate a high quality image. However, these ways of using auxiliary classifier may unwittingly encourage the generator to produce images that are particularly easy for the auxiliary classifier to classify, and deviate the final $p ( { \pmb x } | { \pmb y } )$ from the true $\dot { \mathbf { \ b { q } } } ( \mathbf { \ b { x } } | \mathbf { \ b { y } } )$ . In fact, Odena et al. (2017) reports that this problem has a tendency to exacerbate with increasing number of labels. We were able to reproduce this phenomena in our experiments; when we implemented their algorithm on a dataset with 1000 class categories, the final trained model was able to generate only one image for most classes. Nguyen et al.’s PPGNs is also likely to suffer from the same problem because they are using an order of magnitude greater coefficient for the term corresponding to $p ( y | \mathbf { \boldsymbol { x } } )$ than for the other terms in the Langevin equation.
|
| 95 |
+
|
| 96 |
+
# 5 EXPERIMENTS
|
| 97 |
+
|
| 98 |
+
In order to evaluate the effectiveness of our newly proposed architecture for the discriminator, we conducted two sets of experiments: class conditional image generation and super-resolution on ILSVRC2012 (ImageNet) dataset (Russakovsky et al., 2015). For both tasks, we used the ResNet (He et al., 2016b) based discriminator and the generator used in Gulrajani et al. (2017), and applied spectral normalization (Miyato et al., 2018) to the all of the weights of the discriminator to regularize the Lipschitz constant. For the objective function, we used the following hinge version of the standard adversarial loss (1) (Lim & Ye, 2017; Tran et al., 2017)
|
| 99 |
+
|
| 100 |
+
$$
|
| 101 |
+
\begin{array} { r l r } & { \langle ( \hat { G } , D ) = E _ { q ( y ) } [ E _ { q ( x | y ) } [ \operatorname* { m a x } ( 0 , 1 - D ( \pmb { x } , y ) ] ] + E _ { q ( y ) } [ E _ { p ( z ) } [ \operatorname* { m a x } ( 0 , 1 + D ( \hat { G } ( z , y ) , y ) ) ] ] , } & \\ & { \langle ( G , \hat { D } ) = - E _ { q ( y ) } [ E _ { p ( z ) } [ \hat { D } ( G ( z , y ) , y ) ) ] ] , } & { ( 9 ) } \end{array}
|
| 102 |
+
$$
|
| 103 |
+
|
| 104 |
+
where the last activation function $\mathcal { A }$ of $D$ is identity function. $p ( z )$ is standard Gaussian distribution and $G ( z , y )$ is the generator network. For all experiments, we used Adam optimizer (Kingma & Ba, 2015) with hyper-parameters set to $\alpha = 0 . 0 0 0 2 , \beta _ { 1 } = 0 , \beta _ { 2 } = 0 . 9$ . We updated the discriminator five times per each update of the generator. We will use concat to designate the models (Figure $1 \mathsf { b } ) ^ { 2 }$ , and use projection to designate the proposed model (Figure 1d) .
|
| 105 |
+
|
| 106 |
+
# 5.1 CLASS-CONDITIONAL IMAGE GENERATION
|
| 107 |
+
|
| 108 |
+
The ImageNet dataset used in the experiment of class conditional image generation consisted of 1,000 image classes of approximately 1,300 pictures each. We compressed each images to $1 2 8 \times 1 2 8$ pixels. Unlike for AC-GANs3 we used a single pair of a ResNet-based generator and a discriminator. Also, we used conditional batch normalization (Dumoulin et al., 2017b; de Vries et al., 2017) for the generator. As for the architecture of the generator network used in the experiment, please see Figure 14 for more detail. Our proposed projection model discriminator is equipped with a ‘projection layer’ that takes inner product between the embedded one-hot vector $\textbf { { y } }$ and the intermediate output (Figure 14a). As for the structure of the the concat model discriminator to be compared against, we used the identical bulk architecture as the projection model discriminator, except that we removed the projection layer from the structure and concatenated the spatially replicated embedded conditional vector $\textbf { { y } }$ to the output of third ResBlock. We also experimented with AC-GANs as the current state of the art model. For AC-GANs, we placed the softmax layer classifier to the same structure shared by concat and projection. For each method, we updated the generator 450K times, and applied linear decay for the learning rate after 400K iterations so that the rate would be 0 at the end. For the comparative experiments, we trained the model for 450K iterations, which was ample for the training of concat to stabilize. AC-GANs collapsed prematurely before the completion of 450K iterations, so we reported the result from the peak of its performance ( 80K iterations). For all experiments throughout, we used the training over 450K iterations for comparing the performances. On a separate note, our method continued to improve even after 450K. We therefore also reported the inception score and FID of the extended training (850K iterations) for our method exclusively. See the table 1 for the exact figures.
|
| 109 |
+
|
| 110 |
+
We used inception score (Salimans et al., 2016) for the evaluation of the visual appearance of the generated images. It is in general difficult to evaluate how ‘good’ the generative model is. Indeed, however, either subjective or objective, some definite measures of ‘goodness’ exists, and essential two of them are ‘diversity’ and the sheer visual quality of the images. One possible candidate for quantitative measure of diversity and visual appearance is FID (Heusel et al., 2017). We computed FID between the generated images and dataset images within each class, and designated the values as intra FIDs. More precisely, FID (Heusel et al., 2017) measures the 2-Wasserstein distance between the two distributions $q _ { y }$ and $p _ { y }$ , and is given by $F ( q _ { y } , p _ { y } ) \ = \ \| { \pmb { \mu } } _ { q _ { y } } \ - { \pmb { \mu } } _ { p _ { y } } \| _ { 2 } ^ { 2 } \ +$ trace $\left( C _ { q _ { y } } + C _ { p _ { y } } - 2 ( C _ { q _ { y } } C _ { p _ { y } } ) ^ { 1 / 2 } \right)$ , where $\{ \mu _ { q _ { y } } , C _ { q _ { y } } \}$ , $\{ \mu _ { p _ { y } } , C _ { p _ { y } } \}$ are respectively the mean and the covariance of the final feature vectors produced by the inception model (Szegedy et al., 2015) from the true samples and generated samples of class $y$ . When the set of generated examples have collapsed modes, the trace of $C _ { p _ { y } }$ becomes small and the trace term itself becomes large. In order to compute $C _ { q _ { y } }$ we used all samples in the training data belonging to the class of concern, and used 5000 generated samples for the computation of $C _ { p _ { y } }$ . We empirically observed in our experiments that intra FID is, to a certain extent, serving its purpose well in measuring the diversity and the visual quality.
|
| 111 |
+
|
| 112 |
+
To highlight the effectiveness of our inner-product based approach (projection) of introducing the conditional information into the model, we compared our method against the state of the art ACGANs as well as the conventional incorporation of the conditional information via concatenation at hidden layer (concat). As we can see in the training curves Figure 3, projection outperforms inception score than concat throughout the training. Table 1 compares the intra class FIDs and the inception Score of the images generated by each method. The result shown here for the AC-GANs is that of the model at its prime in terms of the inception score, because the training collapsed at the end. We see that the images generated by projection have lower intra FID scores than both adversaries, indicating that the Wasserstein distance between the generative distribution by projection to the target distribution is smaller. For the record, our model performed better than other models on the CIFAR10 and CIFAR 100 as well (See Appendix A).
|
| 113 |
+
|
| 114 |
+

|
| 115 |
+
|
| 116 |
+

|
| 117 |
+
Figure 3: Learning curves of Figure 4: Comparison of intra FID scores for projection cGANs with concat and projection concat, and AC-GANs on ImageNet. Each dot corresponds on ImageNet. to a class.
|
| 118 |
+
|
| 119 |
+
Table 1: Inception score and intra FIDs on ImageNet.
|
| 120 |
+
|
| 121 |
+
<table><tr><td>Method</td><td>Inception Score</td><td>Intra FID</td></tr><tr><td>AC-GANs</td><td>28.5±.20</td><td>260.0</td></tr><tr><td>concat</td><td>21.1±.35</td><td>141.2</td></tr><tr><td>projection</td><td>29.7±.61</td><td>103.1</td></tr><tr><td>*projection (850K iteration)</td><td>36.8±.44</td><td>92.4</td></tr></table>
|
| 122 |
+
|
| 123 |
+
Figure 10a and 10b shows the set of classes for which (a) projection yielded results with better intra FIDs than the concat and (b) the reverse. From the top, the figures are listed in descending order of the ratio between the intra FID score between the two methods. Note that when the concat outperforms projection it only wins by a slight margin, whereas the projection outperforms concat by large margin in the opposite case. A quick glance on the cases in which the concat outperforms the projection suggests that the FID is in fact measuring the visual quality, because both sets looks similar to the human eyes in terms of appearance. Figure 5 shows an arbitrarily selected set of results yielded by AC-GANs from variety of ${ \boldsymbol { z } } \mathbf { s }$ . We can clearly observe the mode-collapse on this batch. This is indeed a tendency reported by the inventors themselves (Odena et al., 2017). ACGANs can generate easily recognizable (i.e classifiable) images, but at the cost of losing diversity and hence at the cost of constructing a generative distribution that is significantly different from the target distribution as a whole. We can also assess the low FID score of projection from different perspective. By construction, the trace term of intra FID measures the degree of diversity within the class. Thus, our result on the intra FID scores also indicates that that our projection is doing better in reproducing the diversity of the original. The GANs with the concat discriminator also suffered from mode-collapse for some classes (see Figure 6). For the set of images generated by projection, we were not able to detect any notable mode-collapse.
|
| 124 |
+
|
| 125 |
+
Figure 7a shows the samples generated with the projection model for the classes on which the cGAN achieved lowest intra FID scores (that is the classes on which the generative distribution were particularly close to target conditional distribution), and Figure 7b the reverse. While most of the images listed in Figure 7a are of relatively high quality, we still observe some degree of mode-collapse. Note that the images in the classes with high FID are featuring complex objects like human; that is, one can expect the diversity within the class to be wide. However, we note that we did not use the most complicated neural network available for the experiments presented on this paper, because we prioritized the completion of the training within a reasonable time frame. It is very possible that, by increasing the complexity of the model, we will be able to further improve the visual quality of the images and the diversity of the distribution. In Appendix D, we list images of numerous classes generated by cGANs trained with our projection model.
|
| 126 |
+
|
| 127 |
+

|
| 128 |
+
Figure 5: comparison of the images generated by (a) AC-GANs and (b) projection.
|
| 129 |
+
|
| 130 |
+

|
| 131 |
+
Figure 6: Collapsed images on the concat model.
|
| 132 |
+
|
| 133 |
+
Category Morphing With our new architecture, we were also able to successfully perform category morphism. When there are classes $y _ { 1 }$ and $y _ { 2 }$ , we can create an interpolated generator by simply mixing the parameters of conditional batch normalization layers of the conditional generator corresponding to these two classes. Figure 8 shows the output of the interpolated generator with the same $z$ . Interestingly, the combination is also yielding meaningful images when $y _ { 1 }$ and $y _ { 2 }$ are significantly different.
|
| 134 |
+
|
| 135 |
+
Fine-tuning with the pretrained model on the ILSVRC2012 classification task. As we mentioned in Section 4, the authors of Plug and Play Generative model (PPGNs) (Nguyen et al., 2017) were able to improve the visual appearance of the model by augmenting the cost function with that of the label classifier. We also followed their footstep and augmented the original generator loss with an additional auxiliary classifier loss. As warned earlier regarding this type of approach, however, this type of modification tends to only improve the visual performance of the images that are easy for the pretrained model to classify. In fact, as we can see in Appendix B, we were able to improve the visual appearance the images with the augmentation, but at the cost of diversity.
|
| 136 |
+
|
| 137 |
+
# 5.2 SUPER-RESOLUTION
|
| 138 |
+
|
| 139 |
+
We also evaluated the effectiveness of (3) in its application to the super-resolution task. Put formally, the super-resolution task is to infer the high resolution RGB image of dimension $\pmb { x } \in \mathbb { R } ^ { R _ { H } \times R _ { H } \times \hat { \mathbf { 3 } } }$ from the low resolution RGB image of dimension $\pmb { y } \in \mathbb { R } ^ { R _ { L } \times R _ { L } \times 3 } ; R _ { H } > R _ { L }$ . This task is very much the case that we presumed in our model construction, because $p ( \pmb { y } | \pmb { x } )$ is most likely unimodal even if $p ( { \pmb x } | { \pmb y } )$ is multimodal. For the super-resolution task, we used the following formulation for discriminator function:
|
| 140 |
+
|
| 141 |
+
$$
|
| 142 |
+
f ( { \pmb x } , { \pmb y } ; { \theta } ) = \sum _ { i , j , k } \left( y _ { i j k } F _ { i j k } ( { \phi } ( { \pmb x } ; { \theta } _ { \Phi } ) ) \right) + \psi ( { \phi } ( { \pmb x } ; { \theta } _ { \Phi } ) ; { \theta } _ { \Psi } ) ,
|
| 143 |
+
$$
|
| 144 |
+
|
| 145 |
+
where $\begin{array} { r } { F ( \phi ( \pmb { x } ; \theta _ { \Phi } ) ) = V * \phi ( \pmb { x } ; \theta _ { \Phi } ) } \end{array}$ where $V$ is a convolutional kernel and $^ *$ stands for convolution operator. Please see Figure 15 in the appendix section for the actual network architectures we used for this task. For this set of experiments, we constructed the concat model by removing the module in the projection model containing the the inner product layer and the accompanying convolution layer altogether, and simply concatenated $\textbf { { y } }$ to the output of the ResBlock preceding the inner product module in the original. As for the resolutions of the image datasets, we chose $R _ { H } = 1 2 8$ and $R _ { L } =$ 32, and created the low resolution images by applying bilinear downsampling on high resolution images. We updated the generators 150K times for all methods, and applied linear decay for the learning rate after 100K iterations so that the final learning rate was 0 at 150K-th iteration.
|
| 146 |
+
|
| 147 |
+

|
| 148 |
+
Figure 7: $1 2 8 \times 1 2 8$ pixel images generated by the projection method for the classes with (a) bottom five FID scores and (b) top five FID scores. The string and the value above each panel are respectively the name of the corresponding class and the FID score. The second row in each panel corresponds to the original dataset.
|
| 149 |
+
|
| 150 |
+
Figure 9 shows the result of our super-resolution. The bicubic super-resolution is very blurry, and concat result is suffering from excessively sharp and rough edges. On the other hand, the edges of the images generated by our projection method are much clearer and smoother, and the image itself is much more faithful to the original high resolution images. In order to qualitatively compare the performances of the models, we checked MS-SSIM (Wang et al., 2003) and the classification accuracy of the inception model on the generated images using the validation set of the ILSVRC2012 dataset. As we can see in Table 2, our projection model was able to achieve high inception accuracy and high MS-SSIM when compared to bicubic and concat. Note that the performance of superresolution with concat model even falls behind those of the bilinear and bicubic super-resolutions in terms of the inception accuracy. Also, we used projection model to generate multiple batches of images with different random values of $_ { z }$ to be fed to the generator and computed the average of the logits of the inception model on these batches (MC samples). We then used the so-computed average logits to make prediction of the labels. With an ensemble over 10 seeds ( $1 0 \mathrm { M C }$ in Table 2), we were able to improve the inception accuracy even further. This result indicates that our GANs are learning the super-resolution as an distribution, as opposed to deterministic function. Also, the success with the ensemble also suggests a room for a new way to improve the accuracy of classification task on low resolution images.
|
| 151 |
+
|
| 152 |
+

|
| 153 |
+
Figure 8: Category morphing. More results are in the appendix section.
|
| 154 |
+
|
| 155 |
+
Table 2: Inception accuracy and MS-SSIM on different super-resolution methods. We picked up dataset images from the validation set.
|
| 156 |
+
|
| 157 |
+
<table><tr><td>Method</td><td>biliear</td><td>bicubic</td><td>concat</td><td> projection</td><td> projection (10 MC)</td></tr><tr><td>Inception Acc.(%)</td><td>23.1</td><td>31.4</td><td>11.0</td><td>35.2</td><td>36.4</td></tr><tr><td>MS-SSIM</td><td>0.835</td><td>0.859</td><td>0.829</td><td>0.878</td><td>1</td></tr></table>
|
| 158 |
+
|
| 159 |
+
# 6 CONCLUSION
|
| 160 |
+
|
| 161 |
+
Any specification on the form of the discriminator imposes a regularity condition for the choice for the generator distribution and the target distribution. In this research, we proposed a model for the discriminator of cGANs that is motivated by a commonly occurring family of probabilistic models. This simple modification was able to significantly improve the performance of the trained generator on conditional image generation task and super-resolution task. The result presented in this paper is strongly suggestive of the importance of the choice of the form of the discriminator and the design of the distributional metric. We plan to extend this approach to other applications of cGANs, such as semantic segmentation tasks and image to image translation tasks.
|
| 162 |
+
|
| 163 |
+

|
| 164 |
+
Figure 9: 32x32 to $1 2 8 \mathrm { x } 1 2 8$ super-resolution by different methods
|
| 165 |
+
|
| 166 |
+
# ACKNOWLEDGMENTS
|
| 167 |
+
|
| 168 |
+
We would like to thank the members of Preferred Networks, Inc., especially Richard Calland, Sosuke Kobayashi and Crissman Loomis, for helpful comments. We would also like to thank Shoichiro Yamaguchi, a graduate student of Kyoto University, for helpful comments.
|
| 169 |
+
|
| 170 |
+

|
| 171 |
+
Figure 10: Comparison of concat vs. projection. The value attached above each panel represents the achieved FID score.
|
| 172 |
+
|
| 173 |
+
# REFERENCES
|
| 174 |
+
|
| 175 |
+
Martin Arjovsky, Soumith Chintala, and Leon Bottou. Wasserstein generative adversarial networks. In ´ ICML, pp. 214–223, 2017.
|
| 176 |
+
Harm de Vries, Florian Strub, Jer´ emie Mary, Hugo Larochelle, Olivier Pietquin, and Aaron C Courville. Mod- ´ ulating early visual processing by language. In NIPS, pp. 6576–6586, 2017.
|
| 177 |
+
Emily Denton, Soumith Chintala, Arthur Szlam, and Rob Fergus. Deep generative image models using a laplacian pyramid of adversarial networks. In NIPS, pp. 1486–1494, 2015.
|
| 178 |
+
Vincent Dumoulin, Ishmael Belghazi, Ben Poole, Alex Lamb, Martin Arjovsky, Olivier Mastropietro, and Aaron Courville. Adversarially learned inference. In ICLR, 2017a.
|
| 179 |
+
Vincent Dumoulin, Jonathon Shlens, and Manjunath Kudlur. A learned representation for artistic style. In ICLR, 2017b.
|
| 180 |
+
Ian Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. Generative adversarial nets. In NIPS, pp. 2672–2680, 2014.
|
| 181 |
+
Ishaan Gulrajani, Faruk Ahmed, Martin Arjovsky, Vincent Dumoulin, and Aaron Courville. Improved training of wasserstein GANs. arXiv preprint arXiv:1704.00028, 2017.
|
| 182 |
+
Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In CVPR, 2016a.
|
| 183 |
+
Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Identity mappings in deep residual networks. In European Conference on Computer Vision, pp. 630–645. Springer, 2016b.
|
| 184 |
+
Martin Heusel, Hubert Ramsauer, Thomas Unterthiner, Bernhard Nessler, Gunter Klambauer, and Sepp ¨ Hochreiter. Gans trained by a two time-scale update rule converge to a nash equilibrium. arXiv preprint arXiv:1706.08500, 2017.
|
| 185 |
+
Taeksoo Kim, Moonsu Cha, Hyunsoo Kim, Jungkwon Lee, and Jiwon Kim. Learning to discover cross-domain relations with generative adversarial networks. In ICML, pp. 1857–1865, 2017.
|
| 186 |
+
Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In ICLR, 2015.
|
| 187 |
+
Christian Ledig, Lucas Theis, Ferenc Huszar, Jose Caballero, Andrew Cunningham, Alejandro Acosta, Andrew ´ Aitken, Alykhan Tejani, Johannes Totz, Zehan Wang, and Wenzhe Shi. Photo-realistic single image superresolution using a generative adversarial network. In CVPR, 2017.
|
| 188 |
+
Jae Hyun Lim and Jong Chul Ye. Geometric GAN. arXiv preprint arXiv:1705.02894, 2017.
|
| 189 |
+
Mehdi Mirza and Simon Osindero. Conditional generative adversarial nets. arXiv preprint arXiv:1411.1784, 2014.
|
| 190 |
+
Takeru Miyato, Toshiki Kataoka, Masanori Koyama, and Yuichi Yoshida. Spectral normalization for generative adversarial networks. In ICLR, 2018.
|
| 191 |
+
Anh Nguyen, Jeff Clune, Yoshua Bengio, Alexey Dosovitskiy, and Jason Yosinski. Plug & play generative networks: Conditional iterative generation of images in latent space. In CVPR, 2017.
|
| 192 |
+
Sebastian Nowozin, Botond Cseke, and Ryota Tomioka. f-GAN: Training generative neural samplers using variational divergence minimization. In NIPS, pp. 271–279, 2016.
|
| 193 |
+
Augustus Odena, Christopher Olah, and Jonathon Shlens. Conditional image synthesis with auxiliary classifier GANs. In ICML, pp. 2642–2651, 2017.
|
| 194 |
+
Guim Perarnau, Joost van de Weijer, Bogdan Raducanu, and Jose M Alvarez. Invertible conditional gans for ´ image editing. In NIPS Workshop on Adversarial Training, 2016.
|
| 195 |
+
Alec Radford, Luke Metz, and Soumith Chintala. Unsupervised representation learning with deep convolutional generative adversarial networks. In ICLR, 2016.
|
| 196 |
+
Scott Reed, Zeynep Akata, Xinchen Yan, Lajanugen Logeswaran, Bernt Schiele, and Honglak Lee. Generative adversarial text to image synthesis. In ICML, pp. 1060–1069, 2016.
|
| 197 |
+
Olga Russakovsky, Jia Deng, Hao Su, Jonathan Krause, Sanjeev Satheesh, Sean Ma, Zhiheng Huang, Andrej Karpathy, Aditya Khosla, Michael Bernstein, Alexander C. Berg, and Li Fei-Fei. ImageNet Large Scale Visual Recognition Challenge. International Journal of Computer Vision (IJCV), 115(3):211–252, 2015. doi: 10.1007/s11263-015-0816-y.
|
| 198 |
+
Masaki Saito, Eiichi Matsumoto, and Shunta Saito. Temporal generative adversarial nets with singular value clipping. In ICCV, 2017.
|
| 199 |
+
Tim Salimans, Ian Goodfellow, Wojciech Zaremba, Vicki Cheung, Alec Radford, and Xi Chen. Improved techniques for training GANs. In NIPS, pp. 2226–2234, 2016.
|
| 200 |
+
Kumar Sricharan, Raja Bala, Matthew Shreve, Hui Ding, Kumar Saketh, and Jin Sun. Semi-supervised conditional GANs. arXiv preprint arXiv:1708.05789, 2017.
|
| 201 |
+
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.
|
| 202 |
+
Seiya Tokui, Kenta Oono, Shohei Hido, and Justin Clayton. Chainer: a next-generation open source framework for deep learning. In Proceedings of workshop on machine learning systems (LearningSys) in the twentyninth annual conference on neural information processing systems (NIPS), 2015.
|
| 203 |
+
Antonio Torralba, Rob Fergus, and William T Freeman. 80 million tiny images: A large data set for nonparametric object and scene recognition. IEEE transactions on pattern analysis and machine intelligence, 30 (11):1958–1970, 2008.
|
| 204 |
+
Dustin Tran, Rajesh Ranganath, and David M Blei. Deep and hierarchical implicit models. arXiv preprint arXiv:1702.08896, 2017.
|
| 205 |
+
Zhou Wang, Eero P Simoncelli, and Alan C Bovik. Multiscale structural similarity for image quality assessment. In Asilomar Conference on Signals, Systems and Computers, pp. 1398–1402, 2003.
|
| 206 |
+
Han Zhang, Tao Xu, Hongsheng Li, Shaoting Zhang, Xiaolei Huang, Xiaogang Wang, and Dimitris Metaxas. Stackgan: Text to photo-realistic image synthesis with stacked generative adversarial networks. In ICCV, 2017.
|
| 207 |
+
Jun-Yan Zhu, Taesung Park, Phillip Isola, and Alexei A Efros. Unpaired image-to-image translation using cycle-consistent adversarial networks. In ICCV, 2017.
|
| 208 |
+
|
| 209 |
+
# A RESULTS OF CLASS CONDITIONAL IMAGE GENERATION ON CIFAR-10 AND CIFAR-100
|
| 210 |
+
|
| 211 |
+
As a preliminary experiment, we compared the performance of conditional image generation on CIFAR-10 and CIFAR-100 3. For the discriminator and the generator, we reused the same architecture used in Miyato et al. (2018) for the task on CIFAR-10. For the adversarial objective functions, we used (9), and trained both machine learners with the same optimizer with same hyper parameters we used in Section 5. For our projection model, we added the projection layer to the discriminator in the same way we did in the ImageNet experiment (before the last linear layer). Our projection model achieved better performance than other methods on both CIFAR-10 and CIFAR-100. Concatenation at hidden layer (hidden concat) was performed on the output of second ResBlock of the discriminator. We tested hidden concat as a comparative method in our main experiments on ImageNet, because the concatenation at hidden layer performed better than the concatenation at the input layer (input concat) when the number of classes was large (CIFAR-100).
|
| 212 |
+
|
| 213 |
+
To explore how the hyper-parameters affect the performance of our proposed architecture, we conducted hyper-parameter search on CIFAR-100 about the Adam hyper-parameters (learning rate $\alpha$ and 1st order momentum $\beta _ { 1 . }$ ) for both our proposed architecture and the baselines. Namely, we varied each one of these parameters while keeping the other constant, and reported the inception scores for all methods including several versions of concat architectures to compare. We tested with concat module introduced at (a) input layer, (b) hidden layer, and at (c) output layer. As we can see in Figure 11, our projection architecture excelled over all other architectures for all choice of the parameters, and achieved the inception score of 9.53. Meanwhile, concat architectures were able to achieve all 8.82 at most. The best concat model in term of the inception score on CIFAR-100 was the hidden concat with $\alpha = 0 . 0 0 0 2$ and $\beta _ { 1 } = 0$ , which turns out to be the very choice of the parameters we picked for our ImageNet experiment.
|
| 214 |
+
|
| 215 |
+
Table 3: The performance of class conditional image generation on CIFAR-10 (C10) and CIFAR100 (C100).
|
| 216 |
+
|
| 217 |
+
<table><tr><td>Method</td><td>Inception score C10</td><td>C100</td><td>FID C10 C100</td></tr><tr><td>(Real data)</td><td>11.24</td><td>14.79</td><td>7.60 8.94</td></tr><tr><td>AC-GAN</td><td>8.22</td><td>8.80</td><td>19.7 25.4</td></tr><tr><td> input concat</td><td>8.25</td><td>7.93</td><td>19.2 31.4</td></tr><tr><td>hidden concat</td><td>8.14</td><td>8.82</td><td>19.2 24.8</td></tr><tr><td>(ours) projection</td><td>8.62</td><td>9.04</td><td>17.5 23.2</td></tr></table>
|
| 218 |
+
|
| 219 |
+

|
| 220 |
+
Figure 11: Inception scores on CIFAR-100 with different discriminator models varying hyperparameters ( $\overset { \cdot } { \alpha }$ and $\beta _ { 1 }$ ) of Adam optimizer.
|
| 221 |
+
|
| 222 |
+

|
| 223 |
+
Figure 12: Effect of the finetuning with auxiliary classifier loss. Same coordinate in panel (a) and (b) corresponds to same value of $_ z$
|
| 224 |
+
|
| 225 |
+
Table 4: Inception score and intra FIDs on ImageNet with a pretrained model on classification tasks for ILSVRC2012 dataset. $^ { \ddag \mathrm { N } }$ guyen et al. (2017)
|
| 226 |
+
|
| 227 |
+
<table><tr><td>Method</td><td>Inception Score</td><td>Intra FID</td></tr><tr><td>PPGNs+</td><td>47.4</td><td>N/A</td></tr><tr><td>projection(finetuned)</td><td>210</td><td>54.2</td></tr></table>
|
| 228 |
+
|
| 229 |
+
# B OBJECTIVE FUNCTION WITH AN AUXILIARY CLASSIFIER COST
|
| 230 |
+
|
| 231 |
+
In this experiment, we followed the footsteps of Plug and Play Generative model (PPGNs) (Nguyen et al., 2017) and augmented the original generator loss with an additional auxiliary classifier loss. In particular, we used the losses given by :
|
| 232 |
+
|
| 233 |
+
$$
|
| 234 |
+
L \left( G , \hat { D } , \hat { p } _ { \mathrm { p r e } } ( y | x ) \right) = - E _ { q ( y ) } \left[ E _ { p ( z ) } \left[ \hat { D } ( G ( z , y ) , y ) - L _ { C } ( \hat { p } _ { \mathrm { p r e } } ( y | G ( z , y ) ) ) \right] \right] ,
|
| 235 |
+
$$
|
| 236 |
+
|
| 237 |
+
where $\hat { p } _ { \mathrm { p r e } } ( y | \pmb { x } )$ is the fixed model pretrained for ILSVRC2012 classification task. For the actual experiment, we trained the generator with the original adversarial loss for the first 400K updates, and used the augmented loss for the last 50K updates. For the learning rate hyper parameter, we adopted the same values as other experiments we described above. For the pretrained classifier, we used ResNet50 model used in He et al. (2016a). Figure 12 compares the results generated by vanilla objective function and the results generated by the augmented objective function. As we can see in Table 4, we were able to significantly outperform PPGNs in terms of inception score. However, note that the images generated here are images that are easy to classify. The method with auxiliary classifier loss seems effective in improving the visual appearance, but not in training faithful generative model.
|
| 238 |
+
|
| 239 |
+

|
| 240 |
+
(b) ResBlock for the generator.
|
| 241 |
+
Figure 13: Architecture of the ResBlocks used in all experiments. For the generator generator’s Resblock, conditional batch normalization layer (Dumoulin et al., 2017b; de Vries et al., 2017) was used in place of the standard batch normalization layer. For the ResBlock in the generator for the super resolution tasks that implements the upsampling, the random vector $_ z$ was fed to the model by concatenating the vector to the embedded low resolution image vector $\textbf { { y } }$ prior to the first convolution layer within the block. For the procedure of downsampling and upsampling, we followed the implementation by Gulrajani et al. (2017). For the discriminator, we performed downsampling (average pool) after the second conv of the ResBlock. For the generator, we performed upsampling before the first conv of the ResBlock. For the ResBlock that is performing the downsampling, we replaced the identity mapping with 1x1 conv layer followed by downsampling to balance the dimension. We did the essentially same for the Resblock that is performing the upsampling, except that we applied the upsampling before the 1x1 conv.
|
| 242 |
+
|
| 243 |
+

|
| 244 |
+
Figure 14: The models we used for the conditional image generation task.
|
| 245 |
+
|
| 246 |
+

|
| 247 |
+
Figure 15: The models we used for the super resolution task.
|
| 248 |
+
|
| 249 |
+
# D MORE RESULTS ON THE CONDITIONAL IMAGE GENERATION TASK
|
| 250 |
+
|
| 251 |
+

|
| 252 |
+
Figure 16: $1 2 8 \times 1 2 8$ generated examples on various categories with projection architecture. Each panel corresponds to a class.
|
| 253 |
+
|
| 254 |
+

|
| 255 |
+
Figure 17: $1 2 8 \times 1 2 8$ generated examples on various categories with projection architecture. Each panel corresponds to a class. From top to bottom, tench, papillon, grey whale, desktop computer, altar, whiskey jug and volcano.
|
| 256 |
+
|
| 257 |
+
# E RESULTS OF CATEGORY MORPHING
|
| 258 |
+
|
| 259 |
+

|
| 260 |
+
Figure 18: Dog (Lhasa apso) to different categories
|
| 261 |
+
|
| 262 |
+

|
| 263 |
+
|
| 264 |
+

|
| 265 |
+
(a) Hip to Yellow lady’s slipper
|
| 266 |
+
|
| 267 |
+

|
| 268 |
+
(b) Pirate ship to Yawl
|
| 269 |
+
|
| 270 |
+

|
| 271 |
+
(c) Yurt to Castle
|
| 272 |
+
|
| 273 |
+

|
| 274 |
+
(d) Chiffonier to Chinese cabinet
|
| 275 |
+
Figure 19: Morphing between different categories
|
| 276 |
+
|
| 277 |
+
F MORE RESULTS WITH SUPER-RESOLUTION
|
| 278 |
+
|
| 279 |
+

|
| 280 |
+
Figure 20: $3 2 \mathrm { x } 3 2 $ to $1 2 8 \mathrm { x } 1 2 8$ super-resolution results
|
md/train/Byg3y3C9Km/Byg3y3C9Km.md
ADDED
|
@@ -0,0 +1,583 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# LEARNING PROTEIN STRUCTURE WITH A DIFFERENTIABLE SIMULATOR
|
| 2 |
+
|
| 3 |
+
John Ingraham1⇤, Adam Riesselman1, Chris Sander1,2,3, Debora Marks1,3 1Harvard Medical School 2Dana-Farber Cancer Institute 3Broad Institute of Harvard and MIT
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
The Boltzmann distribution is a natural model for many systems, from brains to materials and biomolecules, but is often of limited utility for fitting data because Monte Carlo algorithms are unable to simulate it in available time. This gap between the expressive capabilities and sampling practicalities of energy-based models is exemplified by the protein folding problem, since energy landscapes underlie contemporary knowledge of protein biophysics but computer simulations are challenged to fold all but the smallest proteins from first principles. In this work we aim to bridge the gap between the expressive capacity of energy functions and the practical capabilities of their simulators by using an unrolled Monte Carlo simulation as a model for data. We compose a neural energy function with a novel and efficient simulator based on Langevin dynamics to build an end-toend-differentiable model of atomic protein structure given amino acid sequence information. We introduce techniques for stabilizing backpropagation under long roll-outs and demonstrate the model’s capacity to make multimodal predictions and to, in some cases, generalize to unobserved protein fold types when trained on a large corpus of protein structures.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
Many natural systems, such as cells in a tissue or atoms in a protein, organize into complex structures from simple underlying interactions. Explaining and predicting how macroscopic structures such as these arise from simple interactions is a major goal of science and, increasingly, machine learning.
|
| 12 |
+
|
| 13 |
+
The Boltzmann distribution is a foundational model for relating local interactions to system behavior, but can be difficult to fit to data. Given an energy function $U _ { \pmb \theta } [ \pmb x ]$ , the probability of a system configuration $_ { \textbf { \em x } }$ scales exponentially with energy as
|
| 14 |
+
|
| 15 |
+
$$
|
| 16 |
+
p _ { \pmb \theta } ( \pmb x ) = \frac { 1 } { Z } \exp \left( - U _ { \pmb \theta } [ \pmb x ] \right) ,
|
| 17 |
+
$$
|
| 18 |
+
|
| 19 |
+
where the (typically intractable) constant $Z$ normalizes the distribution. Importantly, simple energy functions $\bar { U _ { \pmb \theta } [ \pmb x ] }$ consisting of weak, local interactions can collectively encode complex system behaviors, such as the structures of materials and molecules or, when endowed with latent variables, the statistics of images, sound, and text (Ackley et al., 1985; Salakhutdinov & Larochelle, 2010). Unfortunately, learning model parameters $\hat { \pmb { \theta } }$ and generating samples $\pmb { x } \sim p _ { \pmb { \theta } } ( \pmb { x } )$ of the Boltzmann distribution is difficult in practice, as these procedures depend on expensive Monte Carlo simulations that may struggle to mix effectively. These difficulties have driven a shift towards generative models that are easier to learn and sample from, such as directed latent variable models and autoregressive models (Goodfellow et al., 2016).
|
| 20 |
+
|
| 21 |
+
The protein folding problem provides a prime example of both the power of energy-based models at describing complex relationships in data as well as the challenge of generating samples from them. Decades of research in biochemistry and biophysics support an energy landscape theory of protein folding (Dill et al., 2017), in which the folds that natural protein sequences adopt are those that minimize free energy. Without the availability of external information such as coevolutionary information (Marks et al., 2012) or homologous structures (Mart´ı-Renom et al., 2000) to constrain the energy function, however, contemporary simulations are challenged to generate globally favorable low-energy structures in available time.
|
| 22 |
+
|
| 23 |
+

|
| 24 |
+
Figure 1: An unrolled simulator as a model for protein structure. NEMO combines a neural energy function for coarse protein structure, a stochastic simulator based on Langevin dynamics with learned (amortized) initialization, and an atomic imputation network to build atomic coordinate output from sequence information. It is trained end-to-end by backpropagating through the unrolled folding simulation.
|
| 25 |
+
|
| 26 |
+
How can we get the representational benefits of energy-based models with the sampling efficiency of directed models? Here we explore a potential solution of directly training an unrolled simulator of an energy function as a model for data. By directly training the sampling process, we eschew the question ‘when has the simulator converged’ and instead demand that it produce a useful answer in a fixed amount of time. Leveraging this idea, we construct an end-to-end differentiable model of protein structure that is trained by backpropagtion through folding (Figure 1). NEMO (Neural energy modeling and optimization) can learn at scale to generate 3D protein structures consisting of hundreds of points directly from sequence information. Our main contributions are:
|
| 27 |
+
|
| 28 |
+
• Neural energy simulator model for protein structure that composes a deep energy function, unrolled Langevin dynamics, and an atomic imputation network for an end-to-end differentiable model of protein structure given sequence information
|
| 29 |
+
• Efficient sampling algorithm that is based on a transform integrator for efficient sampling in transformed coordinate systems
|
| 30 |
+
• Stabilization techniques for long roll-outs of simulators that can exhibit chaotic dynamics and, in turn, exploding gradients during backpropagation
|
| 31 |
+
• Systematic analysis of combinatorial generalization with a new dataset of protein sequence and structure
|
| 32 |
+
|
| 33 |
+
# 1.1 RELATED WORK
|
| 34 |
+
|
| 35 |
+
Protein modeling Our model builds on a long history of coarse-grained modeling of protein structure (Kolinski et al., 1998; Kmiecik et al., 2016). Recently, multiple groups have demonstrated how to learn full force fields using likelihood-based approaches (Jumper et al., 2018; Krupa et al., 2017), similar to our maximum likelihood loss (but without backpropagtion through folding for fast sampling). While this work was in progress, two groups reported neural models of protein structure (AlQuraishi, 2018; Anand & Huang, 2018), where the former focused on modeling structure in terms of backbone angles and the latter in terms of residue-residue distances. We show how an energy function provides a natural framework to integrate both kinds of constraints, which in turn is important for achieving sample-efficient structural generalization.
|
| 36 |
+
|
| 37 |
+
Learning to infer or sample Structured prediction includes a long history of casting predictions in terms of energy minimization (LeCun et al., 2006). Recently, others have built hybrid neural networks that use differentiable optimization as a building block in neural architectures (Wang et al.,
|
| 38 |
+
|
| 39 |
+

|
| 40 |
+
Figure 2: A neural energy function models coarse grained structure and is sampled by internal coordinate dynamics. (A) The energy function is formulated as a Markov Random Field with structure-based features and sequence-based weights computed by neural networks (Figure 6). (B) To rapidly sample low-energy configurations, the Langevin dynamics simulator leverages both (i) an internal coordinate parameterization, which is more effective for global rearrangements, and (ii) a Cartesian parameterization, which is more effective for localized structural refinement. (C) The base features of the structure network are rotationally and translationally invariant internal coordinates (not shown), pairwise distances, and pairwise orientations.
|
| 41 |
+
|
| 42 |
+
2016; Amos & Kolter, 2017; Belanger & McCallum, 2016). Structured Prediction Energy Networks (SPENs) with unrolled optimization (Belanger et al., 2017) are a highly similar approach to ours, differing in terms of the use of optimization rather than sampling. Additional methodologically related work includes approaches to learn energy functions and samplers simultaneously (Kim & Bengio, 2016; Wang & Liu, 2017; Dai et al., 2017; Song et al., 2017; Chen et al., 2018a), to learn efficient MCMC operators (Song et al., 2017; Levy et al., 2018), to build expressive approximating distributions with unrolled Monte Carlo simulations (Salimans et al., 2015; Titsias, 2017), and to learn the parameters of simulators with implicitly defined likelihoods1 (Mohamed & Lakshminarayanan, 2016; Tran et al., 2017).
|
| 43 |
+
|
| 44 |
+
# 2 MODEL
|
| 45 |
+
|
| 46 |
+
Overview NEMO is an end-to-end differentiable model of protein structure $\boldsymbol { X }$ conditioned on sequence information $\pmb { s }$ consisting of three components (Figure 1): (i) a neural energy function $U _ { \pmb \theta } [ \pmb x ; \pmb s ]$ for coarse grained structure $_ { \textbf { \em x } }$ given sequence, (ii) an unrolled simulator that generates approximate samples from $U$ via internal coordinate Langevin dynamics (§ 2.3), and (iii) an imputation network that generates an atomic model $\boldsymbol { X }$ from the final coarse-grained sample $\pmb { x } ^ { ( T ) }$ $\ S 2 . 4 )$ . All components are trained simultaneously via backpropagation through the unrolled process.
|
| 47 |
+
|
| 48 |
+
# 2.1 REPRESENTATION
|
| 49 |
+
|
| 50 |
+
Proteins Proteins are linear polymers (sequences) of amino acids that fold into defined 3D structures. The 20 natural amino acids have a common monomer structure $[ - ( \mathrm { N - H } ) - ( \mathsf { C } \mathrm { - } \mathbb { R } ) - ( \mathsf { C } \mathrm { = } 0 ) - ]$ with variable side-chain R groups that can differ in properties such as hydrophobicity, charge, and ability to form hydrogen bonds. When placed in solvent (such as water or a lipid membrane), interactions between the side-chains, backbone, and solvent drive proteins into particular 3D configurations (‘folds’), which are the basis for understanding protein properties such as biochemical activity, ligand binding, and interactions with drugs.
|
| 51 |
+
|
| 52 |
+
Coordinate representations We predict protein structure $\boldsymbol { X }$ in terms of 5 positions per amino acid: the four heavy atoms of the backbone (N, $\mathrm { C } _ { \alpha }$ , and carbonyl ${ \mathrm { C } } { = } { \mathrm { O } } { \mathrm { \Omega } }$ ) and the center of mass of the side chain R group. While it is well-established that the locations of $\complement _ { \alpha }$ carbons are sufficient to reconstruct a full atomic structure (Kmiecik et al., 2016), we include these additional positions for evaluating backbone hydrogen bonding (secondary structure) and coarse side-chain placement. Internally, the differentiable simulator generates an initial coarse-grained structure (1-position-peramino-acid) with the loss function targeted to the midpoint of the $\complement _ { \alpha }$ carbon and the side chain center of mass.
|
| 53 |
+
|
| 54 |
+
Sequence conditioning We consider two modes for conditioning our model on sequence information: (1) 1-seq, in which $\pmb { s }$ is an $L \times 2 0$ matrix containing a one-hot encoding of the amino acid sequence, and (2) Profile, in which $\pmb { s }$ is an $L \times 4 0$ matrix encoding both the amino acid sequence and a profile of evolutionarily related sequences $( \ S \mathbf { B } . 7 )$ .
|
| 55 |
+
|
| 56 |
+
Internal coordinates In contrast to Cartesian coordinates $_ { \textbf { \em x } }$ , which parameterize structure in terms of absolute positions of points $\pmb { x } _ { i } \in \mathbb { R } ^ { 3 }$ , internal coordinates $_ { z }$ parameterize structure in terms of relative distances and angles between points. We adopt a standard convention for internal coordinates of chains (Parsons et al., 2005) where each point $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { i } }$ is placed in a spherical coordinate system defined by the three preceding points ${ \pmb x } _ { i - 1 } , { \pmb x } _ { i - 2 } , { \pmb x } _ { i - 3 }$ in terms of a radius (bond length2) $\bar { b _ { i } } \in ( 0 , \infty )$ , a polar angle (bond angle) $a _ { i } \in [ 0 , \pi )$ , and an azimuthal angle (dihedral angle) $d _ { i } \in [ 0 , 2 \pi )$ (Figure 2B). We define $z _ { i } = \{ \tilde { b } _ { i } , \tilde { a } _ { i } , d _ { i } \}$ , where $\tilde { b } _ { i } , \tilde { a } _ { i }$ are unconstrained parameterizations of $b _ { i }$ and $a _ { i }$ ( $\ S$ A.1). The transformation $\begin{array} { r } { \pmb { x } = \mathcal { F } ( z ) } \end{array}$ from internal coordinates to Cartesian is then defined by the recurrence
|
| 57 |
+
|
| 58 |
+
$$
|
| 59 |
+
\pmb { x } _ { i } = \pmb { x } _ { i - 1 } + b _ { i } \left[ \hat { \pmb { u } } _ { i - 1 } \ \hat { \pmb { n } } _ { i - 1 } \times \hat { \pmb { u } } _ { i - 1 } \ \hat { \pmb { n } } _ { i - 1 } \right] \left[ \begin{array} { c } { \cos ( \pi - a _ { i } ) } \\ { \sin ( \pi - a _ { i } ) \cos ( d _ { i } ) } \\ { \sin ( \pi - a _ { i } ) \sin ( d _ { i } ) } \end{array} \right] ,
|
| 60 |
+
$$
|
| 61 |
+
|
| 62 |
+
where uˆi = $\begin{array} { r } { \hat { \pmb { u } } _ { i } = \frac { { \pmb x } _ { i } - { \pmb x } _ { i - 1 } } { | | { \pmb x } _ { i } - { \pmb x } _ { i - 1 } | | } } \end{array}$ is a unit vector from ${ \bf { \mathbf { x } } } _ { i - 1 }$ to $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { i } }$ and $\begin{array} { r } { \hat { \pmb { n } } _ { i } = \frac { \hat { \pmb { u } } _ { i - 1 } \times \hat { \pmb { u } } _ { i } } { | | \hat { \pmb { u } } _ { i - 1 } \times \hat { \pmb { u } } _ { i } | | } } \end{array}$ is a unit vector normal to each bond plane. The inverse transformation $z = \mathcal { F } ^ { - 1 } ( \pmb { x } )$ is simpler to compute, as it only involves local (and fully parallelizable) calculations of distances and angles $( \ S \operatorname { A } . 1 )$ .
|
| 63 |
+
|
| 64 |
+
# 2.2 NEURAL ENERGY FUNCTION
|
| 65 |
+
|
| 66 |
+
Deep Markov Random Field We model the distribution of a structure $_ { \textbf { \em x } }$ conditioned on a sequence s with the Boltzmann distribution, $\begin{array} { r } { p _ { \pmb \theta } ( \pmb x | s ) = \frac { 1 } { Z } \exp \left( - U _ { \pmb \theta } [ \pmb x ; \pmb s ] \right) } \end{array}$ , where $U _ { \pmb \theta } [ \pmb x ; \pmb s ]$ is a sequenceconditioned energy function parameterized by a neural network. Our approach is compatible with any differentiable energy function $U [ { \pmb x } ; s ]$ , though we focus on a decomposition
|
| 67 |
+
|
| 68 |
+
$$
|
| 69 |
+
U _ { \pmb \theta } [ \pmb x ; \pmb s ] = \sum _ { i } l _ { i } ( \pmb s ; \pmb \theta ) f _ { i } ( \pmb x ; \pmb \theta ) ,
|
| 70 |
+
$$
|
| 71 |
+
|
| 72 |
+
which is a Markov Random Field with coefficients $\{ l _ { i } ( s ; \theta ) \} _ { i = 1 } ^ { M }$ computed by a sequence network and structural features $\{ f _ { i } ( \pmb { x } ; \pmb { \theta } ) \} _ { i = 1 } ^ { M }$ computed by a structure network (Figure 2A). This decomposition facilitates (i) increased interpretability, as the (learned) structural features are independent of sequence, and (ii) increased computational efficiency, as the sequence-based coefficients can be computed once and reused throughout a simulation.
|
| 73 |
+
|
| 74 |
+
Sequence network The sequence network takes as input one-dimensional sequence information $\pmb { s }$ and outputs: (1) Energetic coefficients, a set of 1- and 2-dimensional sequence features $\{ l _ { i } ( s ; \theta ) \} _ { i = 1 } ^ { M }$ (2) Simulator initial state $z ^ { ( 0 ) }$ , (3) Simulator hyperparameters preconditioning matrix $C$ , and (4) Predicted secondary structure (Figure 6). It is parameterized by a combination of 1D, 2D, and graph convolutions (Gilmer et al., 2017) $( \ S \mathrm { \ A } )$ .
|
| 75 |
+
|
| 76 |
+
Structure network The structure network takes as input a coarse-grained structure $_ { \textbf { \em x } }$ and outputs a set of 1D and 2D structural features $\{ f _ { i } ( { \pmb x } ; { \pmb \theta } ) \} _ { i = 1 } ^ { M }$ (Figure 6). We design the energy function to be invariant to rigid body motions (rotations and translations in SE(3)) by leveraging a set of invariant base features (Figure 2C) which are:
|
| 77 |
+
|
| 78 |
+
1. Internal coordinates $_ z$ All internal coordinates except 6 are invariant to rotation and translation3 and we mask these in the energy loss.
|
| 79 |
+
2. Distances $D _ { i j } = \| { \pmb x } _ { i } - { \pmb x } _ { j } \|$ between all pairs of points. We further process these by 4 radial basis functions with (learned) Gaussian kernels.
|
| 80 |
+
3. Orientation vectors $\hat { \mathbf { v } } _ { i j }$ , which are unit vectors encoding the relative position of point $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { j } }$ in a local coordinate system of $\mathbf { \boldsymbol { x } } _ { i }$ with base vectors $\frac { \hat { \pmb u } _ { i } - \hat { \pmb u } _ { i + 1 } } { \| \hat { \pmb u } _ { i } - \hat { \pmb u } _ { i + 1 } \| }$ , $\hat { \pmb { n } } _ { i + 1 }$ , and the cross product thereof.
|
| 81 |
+
|
| 82 |
+
# 2.3 EFFICIENT SIMULATOR
|
| 83 |
+
|
| 84 |
+
Langevin dynamics The Langevin dynamics is a stochastic differential equation that aymptotically samples from the Boltzmann distribution (Equation 1). It is typically simulated by a first-order discretization as
|
| 85 |
+
|
| 86 |
+
$$
|
| 87 |
+
\pmb { x } ^ { ( t + \epsilon ) } \pmb { x } ^ { ( t ) } - \frac { \epsilon } { 2 } \nabla _ { \pmb { x } } U ^ { ( t ) } + \sqrt { \epsilon } \mathbf { p } , \mathbf { p } \sim \mathcal { N } ( 0 , I ) .
|
| 88 |
+
$$
|
| 89 |
+
|
| 90 |
+
Internal coordinate dynamics The efficiency with which Langevin dynamics explores conformational space is highly dependent on the geometry (and thus parameterization) of the energy landscape $U ( { \pmb x } )$ . While Cartesian dynamics are efficient at local structural rearrangement, internal coordinate dynamics much more efficiently sample global, coherent changes to the topology of the fold (Figure 2B) . We interleave the Cartesian Langevin dynamics with preconditioned Internal Coordinate dynamics,
|
| 91 |
+
|
| 92 |
+
$$
|
| 93 |
+
\boldsymbol { z } ^ { ( t + \epsilon ) } \boldsymbol { z } ^ { ( t ) } - \frac { \epsilon C } { 2 } \nabla _ { \boldsymbol { z } } \boldsymbol { U } ^ { ( t ) } + \sqrt { \epsilon C } \mathbf { p } , ~ \mathbf { p } \sim \mathcal { N } ( 0 , I ) ,
|
| 94 |
+
$$
|
| 95 |
+
|
| 96 |
+
where $C$ is a preconditioning matrix that sets the relative scaling of changes to each degree of freedom. For all simulations we unroll $T = 2 5 0$ time steps, each of which is comprised of one Cartesian step followed by one internal coordinate step (Equation 9,§ A.3).
|
| 97 |
+
|
| 98 |
+
Transform integrator Simulating internal coordinate dynamics is often computationally intensive as it requires rebuilding Cartesian geometry $_ { \textbf { \em x } }$ from internal coordinates $_ { z }$ with $\mathcal { F } ( z )$ (Parsons et al., 2005) which is an intrinsically sequential process. Here we bypass the need for recomputing coordinate transformations at every step by instead computing on-the-fly transformation integration (Figure 3). The idea is to directly apply coordinate updates in one coordinate system to another by numerically integrating the Jacobian. This can be favorable when the Jacobian has a simple structure, such as in our case where it requires only distributed cross products.
|
| 99 |
+
|
| 100 |
+
# 2.4 ATOMIC IMPUTATION
|
| 101 |
+
|
| 102 |
+
Local reference frame reconstruction The imputation network builds an atomic model $\boldsymbol { X }$ from the final coarse coordinates $\pmb { x } ^ { ( T ) }$ . Each atomic coordinate $\mathbf { X } _ { i , j }$ of atom type $j$ at position $i$ is placed in a local reference frame as
|
| 103 |
+
|
| 104 |
+
$$
|
| 105 |
+
{ \bf X } _ { i , j } = { \pmb x } _ { i } + e _ { i , j } ( z ; \theta ) \left[ \hat { \pmb u } _ { i } \hat { \pmb n } _ { i + 1 } \hat { \pmb n } _ { i + 1 } \times \hat { \pmb u } _ { i } \right] { \bf r } _ { i , j } ( z ; \theta ) ,
|
| 106 |
+
$$
|
| 107 |
+
|
| 108 |
+
where $e _ { i , j } ( z ; \theta )$ and $\mathbf { r } _ { i , j } ( z ; \theta )$ are computed by a 1D convolutional neural network (Figure 6).
|
| 109 |
+
|
| 110 |
+
# 3 TRAINING
|
| 111 |
+
|
| 112 |
+
We train and evaluate the model on a set of ${ \sim } 6 7 { , } 0 0 0$ protein structures (domains) that are hierarchically and temporally split. The model is trained by gradient descent using a composite loss that combines terms from likelihood-based and empirical-risk minimization-based training.
|
| 113 |
+
|
| 114 |
+

|
| 115 |
+
Figure 3: A transform integrator simulates Langevin dynamics in a more favorable coordinate system (e.g. internal coordinates z) directly in terms of the untransformed state variables (e.g. Cartesian $\mathbf { x }$ ). This exchanges the cost of an inner-loop transformation step (e.g. geometry construction $\mathcal { F } ( z ) )$ for an extra Jacobian evaluation, which is fully parallelizable on modern hardware (e.g. GPUs).
|
| 116 |
+
|
| 117 |
+
# 3.1 DATA
|
| 118 |
+
|
| 119 |
+
Structural stratification There are several scales of generalization in protein structure prediction, which range from predicting the structure of a sequence that differs from the training set at a few positions to predicting a 3D fold topology that is absent from training set. To test these various levels of generalization systematically across many different protein families, we built a dataset on top of the CATH hierarchical classification of protein folds (Orengo et al., 1997). CATH hierarchically organizes proteins from the Protein Data Bank (Berman et al., 2000) into domains (individual folds) that are classified at the levels of Class, Architecture, Topology, and Homologous superfamily (from general to specific). We collected protein domains from CATH releases 4.1 and 4.2 up to length 200 and hierarchically and temporally split this set (§ B.1) into training $\mathrm { \sim } 3 5 \mathrm { k }$ folds), validation $\mathord { \sim } 2 1 \mathrm { k }$ folds), and test sets ( $\mathord { \sim } 1 0 \mathrm { k }$ folds).
|
| 120 |
+
|
| 121 |
+
Test subsets The final test set is subdivided into four subsets: C, A, T, and H, based on the level of maximal similarity between a given test domain and domains in the training set. For example, domains in the $\mathbf { C }$ or $\mathbf { A }$ sets may share class and potentially architecture classifications with train but will not share topology (i.e. fold).
|
| 122 |
+
|
| 123 |
+
# 3.2 LOSS
|
| 124 |
+
|
| 125 |
+
Likelihood The gradient of the data-averaged log likelihood of the Boltzmann distribution is
|
| 126 |
+
|
| 127 |
+
$$
|
| 128 |
+
\frac { \partial } { \partial \theta _ { i } } \mathbb { E } _ { \boldsymbol { x } \sim \mathrm { D a t a } } \left[ \log p ( \boldsymbol { x } | \boldsymbol { s } , \boldsymbol { \theta } ) \right] = \mathbb { E } _ { \boldsymbol { x } \sim p ( \boldsymbol { x } | \boldsymbol { \theta } ) } \left[ \frac { \partial } { \partial \theta _ { i } } U _ { \boldsymbol { \theta } } ( \boldsymbol { x } ; \boldsymbol { s } ) \right] - \mathbb { E } _ { \boldsymbol { x } \sim \mathrm { D a t a } } \left[ \frac { \partial } { \partial \theta _ { i } } U _ { \boldsymbol { \theta } } ( \boldsymbol { x } ; \boldsymbol { s } ) \right] ,
|
| 129 |
+
$$
|
| 130 |
+
|
| 131 |
+
which, when ascended, will minimize the average energy of samples from the data relative to samples from the model. In an automatic differentiation setting, we implement a Monte Carlo estimator for (the negative of) this gradient by adding the energy ${ g a p }$ ,
|
| 132 |
+
|
| 133 |
+
$$
|
| 134 |
+
\begin{array} { r } { \mathcal { L } _ { \mathrm { M L } } = U _ { \theta } ( \bot ( \pmb { x } ^ { \mathrm { ( D ) } } ) ; \pmb { s } ) - U _ { \theta } ( \bot ( \pmb { x } ^ { \mathrm { ( M ) } } ) ; \pmb { s } ) , } \end{array}
|
| 135 |
+
$$
|
| 136 |
+
|
| 137 |
+
to the loss, where $\perp$ is an identity operator that sets the gradient to zero4.
|
| 138 |
+
|
| 139 |
+
Empirical Risk In addition to the likelihood loss, which backpropagates through the energy function but not the whole simulation, we developed an empirical risk loss composing several measures of protein model quality. It takes the form
|
| 140 |
+
|
| 141 |
+
$$
|
| 142 |
+
{ \mathcal { L } } _ { \mathrm { E R } } = { \mathcal { L } } _ { \mathrm { D i s t a n c e s } } + { \mathcal { L } } _ { \mathrm { A n g l e s } } + { \mathcal { L } } _ { \mathrm { H \mathrm { - } b o n d s } } + { \mathcal { L } } _ { \mathrm { T M \mathrm { - } s c o r e } } + { \mathcal { L } } _ { \mathrm { I n i t } } + { \mathcal { L } } _ { \mathrm { T r a j e c t o r y } }
|
| 143 |
+
$$
|
| 144 |
+
|
| 145 |
+

|
| 146 |
+
Figure 4: Model generalizes and outperforms end-to-end baseline for unseen fold topologies. Colors indicate varying difficulty levels of protein domains in the test set, with the C (cyan) and A (magenta) subsets containing corresponding to test-set domains with topologies (folds) and superfamilies that were not represented in the training set. (Left) As the model exhibits higher confidence (reduced structural diversity), it becomes more accurate. (Center) The model occasionally achieves TM scores greater than 0.5 even for difficult C and A level generalization tasks. (Right) NEMO outperforms a strong RNN baseline for difficult generalization problems. All results for NEMO and RNN baselines are conditioned on profiles.
|
| 147 |
+
|
| 148 |
+
Table 1: Test set performance across different levels of generalization
|
| 149 |
+
|
| 150 |
+
<table><tr><td>Model</td><td>#params</td><td>Total</td><td>C</td><td>A</td><td>T</td><td>H</td></tr><tr><td>NEMO (ours, profile)</td><td>21.3m</td><td>0.366</td><td>0.274</td><td>0.361</td><td>0.331</td><td>0.431</td></tr><tr><td>NEMO (ours, sequence-only) RNN baseline model (profile)</td><td>19.1m</td><td>0.248</td><td>0.198</td><td>0.245</td><td>0.254</td><td>0.263</td></tr><tr><td>2x100</td><td>5.9m</td><td>0.293</td><td>0.213</td><td>0.230</td><td>0.247</td><td>0.388</td></tr><tr><td>2x300 (avg. of 3)</td><td>8.8m</td><td>0.335</td><td>0.229</td><td>0.282</td><td>0.278</td><td>0.446</td></tr><tr><td></td><td>13.7m</td><td>0.347</td><td>0.222</td><td></td><td></td><td></td></tr><tr><td>2x500</td><td></td><td></td><td></td><td>0.272</td><td>0.286</td><td>0.477</td></tr><tr><td>2x700</td><td>21.4m</td><td>0.309</td><td>0.223</td><td>0.259</td><td>0.261</td><td>0.403</td></tr><tr><td>Number of structures</td><td></td><td>10381</td><td>1537</td><td>1705</td><td>3198</td><td>3941</td></tr></table>
|
| 151 |
+
|
| 152 |
+
schematized in Figure 6. Our combined loss sums all of the terms $\begin{array} { r } { \mathcal { L } = \mathcal { L } _ { \mathrm { E R } } + \mathcal { L } _ { \mathrm { M L } } } \end{array}$ without weighting.
|
| 153 |
+
|
| 154 |
+
# 3.3 STABILIZING BACKPROPAGATION THROUGH TIME
|
| 155 |
+
|
| 156 |
+
We found that the long roll-outs of our simulator were prone to chaotic dynamics and exploding gradients, as seen in other work (Maclaurin et al., 2015; Parmas et al., 2018). Unfortunately, when chaotic dynamics do occur, it is typical for all gradients to explode (across learning steps) and standard techniques such as gradient clipping (Pascanu et al., 2013) are unable to rescue learning $( \ S \ B . 5 )$ . To stabilize training, we developed two complimentary techniques that regularize against chaotic simulator dynamics while still facilitating learning when they arise. They are
|
| 157 |
+
|
| 158 |
+
• Lyapunov regularization We regularize the simulator time-step function (rather than the energy function) to be approximately 1-Lipschitz. (If exactly satisfied, this eliminates the possibility of chaotic dynamics.)
|
| 159 |
+
|
| 160 |
+
• Damped backpropagation through time We exponentially decay gradient accumulation on the backwards pass of automatic differentiation by multiplying each backwards iteration by a damping factor $\gamma$ . We adaptively tune $\gamma$ to cancel the scale of the exploding gradients. This can be thought of as a continuous relaxation of and a quantitatively tunable alternative to truncated backpropagation through time.
|
| 161 |
+
|
| 162 |
+

|
| 163 |
+
Figure 5: Examples of fold generalization at topology and architecture level. These predicted structures show a range of prediction accuracy for structural generalization (C and A) tasks, with the TM-score comparing the top ranked 3D-Jury pick against the target. The largest clusters are the three most-populated clusters derived from 100 models per domain with a within-cluster cutoff of $\mathbf { T M } >$ 0.5. CATH IDs: 2oy8A03; 5c3uA02; 2y6xA00; 3cimB00; 4ykaC00; 2f09A00; 3i5qA02; 2ayxA01.
|
| 164 |
+
|
| 165 |
+
# 4 RESULTS
|
| 166 |
+
|
| 167 |
+
# 4.1 GENERALIZATION ACROSS CATH
|
| 168 |
+
|
| 169 |
+
For each of the 10,381 protein structures in our test set, we sampled 100 models from NEMO, clustered them by structural similarity, and selected a representative structure by a standard consensus algorithm (Ginalski et al., 2003). For evaluation of performance we focus on the TM-Score (Zhang & Skolnick, 2005), a measure of structural similarity between 0 and 1 for which $\mathrm { T M } > 0 . 5$ is typically considered an approximate reconstruction of a fold.
|
| 170 |
+
|
| 171 |
+
Calibrated uncertainty We find that, when the model is confident (i.e. the number of distinct structural clusters is low ${ \sim } 1 { - } 3$ ), it is also accurate with some predictions having average $\mathbf { T M } >$ 0.5 (Figure 4, left). Unsurprisingly, the confidence of the model tends to go with the difficulty of generalization, with the most confident predictions from the H test set and the least confident from C.
|
| 172 |
+
|
| 173 |
+
Structural generalization However, even when sequence identity is low and generalization difficulty is high (Figure 4, center), the model is still able to make some accurate predictions of 3D structures. Figure 5 illustrates some of these successful predictions at C and A levels, specifically 4ykaC00, 5c3uA02 and beta sheet formation in 2oy8A03. We observe that the predictive distribution is multimodal with non-trivial differences between the clusters representing alternate packing of the chain. In some of the models there is uneven distribition of uncertainty along the chain, which sometimes corresponded to loosely packed regions of the protein.
|
| 174 |
+
|
| 175 |
+
Comparison to an end-to-end baseline We constructed a baseline model that is a non-iterative replica of NEMO which replaces the coarse-grained simulator module (and energy function) with a two-layer bidirectional LSTM that directly predicts coarse internal coordinates $z ^ { ( 0 ) }$ (followed by transformation to Cartesian coordinates with $\mathcal { F }$ ). We trained this baseline across a range of hyperparameter values and found that for difficult C, A, and $\mathbf { T }$ tasks, NEMO generalized more effectively than the RNNs (Table 1). For the best performing $2 \mathrm { x } 3 0 0$ architecture, we trained two additional replicates and report the averaged perfomance in Figure 4 (right).
|
| 176 |
+
|
| 177 |
+
Additionally, we report the results of a sequence-only NEMO model in Table 1. Paralleling secondary structure prediction (Rost & Sander, 1993; McGuffin et al., 2000), we find that the availability of evolutionary information has significant impact on prediction quality.
|
| 178 |
+
|
| 179 |
+
# 4.2 ADVANTAGES AND DISADVANTAGES
|
| 180 |
+
|
| 181 |
+
This work presents a novel approach for protein structure prediction that combines the inductive bias of simulators with the speed of directed models. A major advantage of the approach is that model sampling (inference) times can be considerably faster than conventional approaches to protein structure prediction (Table 4). There are two major disadvantages. First, the computational cost of training and sampling is higher than that of angle-predicting RNNs (Figure 10) such as our baseline or AlQuraishi (2018). Consequently, those methods have been scaled to larger datasets than ours (in protein length and diversity) which are more relevant to protein structure prediction tasks. Second, the instability of backpropagating through long simulations is unavoidable and only partially remedied by our approaches of Lipschitz regularization and gradient damping. These approaches can also lead to slower learning and less expressive energy functions. Methods for efficient (i.e. subquadratic) $N$ -body simulations and for more principled stabilization of deep networks may be relevant to addressing both of these challenges in the future.
|
| 182 |
+
|
| 183 |
+
# 5 CONCLUSION
|
| 184 |
+
|
| 185 |
+
We described a model for protein structure given sequence information that combines a coarse-grained neural energy function and an unrolled simulation into an end-to-end differentiable model. To realize this idea at the scale of real proteins, we introduced an efficient simulator for Langevin dynamics in transformed coordinate systems and stabilization techniques for backpropagating through long simulator roll-outs. We find that that model is able to predict the structures of protein molecules with hundreds of atoms while capturing structural uncertainty, and that the model can structurally generalize to distant fold classifications more effectively than a strong baseline.
|
| 186 |
+
|
| 187 |
+
# ACKNOWLEDGEMENTS
|
| 188 |
+
|
| 189 |
+
We thank members of the Marks lab for useful discussions and feedback. Parts of this work were performed on the Orchestra compute cluster at Harvard Medical School.
|
| 190 |
+
|
| 191 |
+
# REFERENCES
|
| 192 |
+
|
| 193 |
+
David H Ackley, Geoffrey E Hinton, and Terrence J Sejnowski. A learning algorithm for boltzmann machines. Cognitive science, 9(1):147–169, 1985.
|
| 194 |
+
|
| 195 |
+
Mohammed AlQuraishi. End-to-end differentiable learning of protein structure. bioRxiv, pp. 265231, 2018.
|
| 196 |
+
|
| 197 |
+
Brandon Amos and J Zico Kolter. Optnet: Differentiable optimization as a layer in neural networks. In International Conference on Machine Learning, pp. 136–145, 2017.
|
| 198 |
+
|
| 199 |
+
Namrata Anand and Possu Huang. Generative modeling for protein structures. In Advances in Neural Information Processing Systems, pp. 7505–7516, 2018.
|
| 200 |
+
|
| 201 |
+
R Apweiler, A Bairoch, CH Wu, WC Barker, B Boeckmann, S Ferro, E Gasteiger, H Huang, R Lopez, M Magrane, et al. Uniprot: the universal protein knowledgebase. Nucleic acids research, 32(Database issue): D115–9, 2004.
|
| 202 |
+
|
| 203 |
+
David Belanger and Andrew McCallum. Structured prediction energy networks. In International Conference on Machine Learning, pp. 983–992, 2016.
|
| 204 |
+
|
| 205 |
+
David Belanger, Bishan Yang, and Andrew McCallum. End-to-end learning for structured prediction energy networks. In International Conference on Machine Learning, pp. 429–439, 2017.
|
| 206 |
+
|
| 207 |
+
Helen M Berman, John Westbrook, Zukang Feng, Gary Gilliland, Talapady N Bhat, Helge Weissig, Ilya N Shindyalov, and Philip E Bourne. The protein data bank. Nucleic acids research, 28(1):235–242, 2000.
|
| 208 |
+
|
| 209 |
+
Changyou Chen, Chunyuan Li, Liquan Chen, Wenlin Wang, Yunchen Pu, and Lawrence Carin Duke. Continuoustime flows for efficient inference and density estimation. In International Conference on Machine Learning, pp. 823–832, 2018a.
|
| 210 |
+
|
| 211 |
+
Minmin Chen, Jeffrey Pennington, and Samuel Schoenholz. Dynamical isometry and a mean field theory of rnns: Gating enables signal propagation in recurrent neural networks. In International Conference on Machine Learning, pp. 872–881, 2018b.
|
| 212 |
+
|
| 213 |
+
Zihang Dai, Amjad Almahairi, Philip Bachman, Eduard Hovy, and Aaron Courville. Calibrating energy-based generative adversarial networks. In International Conference on Learning Representations, 2017.
|
| 214 |
+
|
| 215 |
+
Ken Dill, Robert L Jernigan, and Ivet Bahar. Protein Actions: Principles and Modeling. Garland Science, 2017.
|
| 216 |
+
|
| 217 |
+
Sean R Eddy. Accelerated profile hmm searches. PLoS computational biology, 7(10):e1002195, 2011.
|
| 218 |
+
|
| 219 |
+
Justin Gilmer, Samuel S Schoenholz, Patrick F Riley, Oriol Vinyals, and George E Dahl. Neural message passing for quantum chemistry. arXiv preprint arXiv:1704.01212, 2017.
|
| 220 |
+
|
| 221 |
+
Krzysztof Ginalski, Arne Elofsson, Daniel Fischer, and Leszek Rychlewski. 3d-jury: a simple approach to improve protein structure predictions. Bioinformatics, 19(8):1015–1018, 2003.
|
| 222 |
+
|
| 223 |
+
Ian Goodfellow, Yoshua Bengio, and Aaron Courville. Deep Learning. MIT Press, 2016. http://www. deeplearningbook.org.
|
| 224 |
+
|
| 225 |
+
Mikael Henaff, Arthur Szlam, and Yann LeCun. Recurrent orthogonal networks and long-memory tasks. In International Conference on Machine Learning, pp. 2034–2042, 2016.
|
| 226 |
+
|
| 227 |
+
Sergey Ioffe. Batch renormalization: Towards reducing minibatch dependence in batch-normalized models. In Advances in Neural Information Processing Systems, pp. 1945–1953, 2017.
|
| 228 |
+
|
| 229 |
+
John M Jumper, Nabil F Faruk, Karl F Freed, and Tobin R Sosnick. Trajectory-based training enables protein simulations with accurate folding and boltzmann ensembles in cpu-hours. PLoS computational biology, 14 (12):e1006578, 2018.
|
| 230 |
+
|
| 231 |
+
Wolfgang Kabsch and Christian Sander. Dictionary of protein secondary structure: pattern recognition of hydrogen-bonded and geometrical features. Biopolymers: Original Research on Biomolecules, 22(12): 2577–2637, 1983.
|
| 232 |
+
|
| 233 |
+
Taesup Kim and Yoshua Bengio. Deep directed generative models with energy-based probability estimation. In International Conference on Learning Representations, 2016.
|
| 234 |
+
|
| 235 |
+
Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
|
| 236 |
+
|
| 237 |
+
Sebastian Kmiecik, Dominik Gront, Michal Kolinski, Lukasz Wieteska, Aleksandra Elzbieta Dawid, and Andrzej Kolinski. Coarse-grained protein models and their applications. Chemical Reviews, 116(14):7898–7936, 2016.
|
| 238 |
+
|
| 239 |
+
Andrzej Kolinski, Lukasz Jaroszewski, Piotr Rotkiewicz, and Jeffrey Skolnick. An efficient monte carlo model of protein chains. modeling the short-range correlations between side group centers of mass. The Journal of Physical Chemistry B, 102(23):4628–4637, 1998.
|
| 240 |
+
|
| 241 |
+
Paweł Krupa, Anna Hałabis, Wioletta Zmudzinska, Stanisław Ołdziej, Harold A Scheraga, and Adam Liwo. Maximum likelihood calibration of the unres force field for simulation of protein structure and dynamics. Journal of chemical information and modeling, 57(9):2364–2377, 2017.
|
| 242 |
+
|
| 243 |
+
Yann LeCun, Sumit Chopra, Raia Hadsell, M Ranzato, and F Huang. A tutorial on energy-based learning. Predicting structured data, 1(0), 2006.
|
| 244 |
+
|
| 245 |
+
Daniel Levy, Matthew D Hoffman, and Jascha Sohl-Dickstein. Generalizing hamiltonian monte carlo with neural networks. In International Conference on Learning Representations, 2018.
|
| 246 |
+
|
| 247 |
+
Xiaoyu Lu, Valerio Perrone, Leonard Hasenclever, Yee Whye Teh, and Sebastian Vollmer. Relativistic monte carlo. In Artificial Intelligence and Statistics, pp. 1236–1245, 2017.
|
| 248 |
+
|
| 249 |
+
Dougal Maclaurin, David Duvenaud, and Ryan Adams. Gradient-based hyperparameter optimization through reversible learning. In International Conference on Machine Learning, pp. 2113–2122, 2015.
|
| 250 |
+
|
| 251 |
+
Debora S Marks, Thomas A Hopf, and Chris Sander. Protein structure prediction from sequence variation. Nature biotechnology, 30(11):1072, 2012.
|
| 252 |
+
|
| 253 |
+
Marc A Mart´ı-Renom, Ashley C Stuart, Andras Fiser, Roberto S ´ anchez, Francisco Melo, and Andrej ´ Sali. ˇ Comparative protein structure modeling of genes and genomes. Annual review of biophysics and biomolecular structure, 29(1):291–325, 2000.
|
| 254 |
+
|
| 255 |
+
Liam J McGuffin, Kevin Bryson, and David T Jones. The psipred protein structure prediction server. Bioinformatics, 16(4):404–405, 2000.
|
| 256 |
+
|
| 257 |
+
Shakir Mohamed and Balaji Lakshminarayanan. Learning in implicit generative models. arXiv preprint arXiv:1610.03483, 2016.
|
| 258 |
+
|
| 259 |
+
Christine A Orengo, AD Michie, S Jones, David T Jones, MB Swindells, and Janet M Thornton. Cath–a hierarchic classification of protein domain structures. Structure, 5(8):1093–1109, 1997.
|
| 260 |
+
|
| 261 |
+
Paavo Parmas, Carl Edward Rasmussen, Jan Peters, and Kenji Doya. Pipps: Flexible model-based policy search robust to the curse of chaos. In International Conference on Machine Learning, pp. 4062–4071, 2018.
|
| 262 |
+
|
| 263 |
+
Jerod Parsons, J Bradley Holmes, J Maurice Rojas, Jerry Tsai, and Charlie EM Strauss. Practical conversion from torsion space to cartesian space for in silico protein synthesis. Journal of computational chemistry, 26 (10):1063–1068, 2005.
|
| 264 |
+
|
| 265 |
+
Razvan Pascanu, Tomas Mikolov, and Yoshua Bengio. On the difficulty of training recurrent neural networks. In International Conference on Machine Learning, pp. 1310–1318, 2013.
|
| 266 |
+
|
| 267 |
+
Michael Remmert, Andreas Biegert, Andreas Hauser, and Johannes Soding. Hhblits: lightning-fast iterative ¨ protein sequence searching by hmm-hmm alignment. Nature methods, 9(2):173, 2012.
|
| 268 |
+
|
| 269 |
+
Burkhard Rost and Chris Sander. Prediction of protein secondary structure at better than $70 \%$ accuracy. Journal of molecular biology, 232(2):584–599, 1993.
|
| 270 |
+
|
| 271 |
+
Ruslan Salakhutdinov and Hugo Larochelle. Efficient learning of deep boltzmann machines. In Proceedings of the thirteenth international conference on artificial intelligence and statistics, pp. 693–700, 2010.
|
| 272 |
+
|
| 273 |
+
Tim Salimans, Diederik Kingma, and Max Welling. Markov chain monte carlo and variational inference: Bridging the gap. In International Conference on Machine Learning, pp. 1218–1226, 2015.
|
| 274 |
+
|
| 275 |
+
Naomi Siew, Arne Elofsson, Leszek Rychlewski, and Daniel Fischer. Maxsub: an automated measure for the assessment of protein structure prediction quality. Bioinformatics, 16(9):776–785, 2000.
|
| 276 |
+
|
| 277 |
+
Jiaming Song, Shengjia Zhao, and Stefano Ermon. A-nice-mc: Adversarial training for mcmc. In Advances in Neural Information Processing Systems, pp. 5140–5150, 2017.
|
| 278 |
+
|
| 279 |
+
Steven H Strogatz. Nonlinear dynamics and chaos: with applications to physics, biology, chemistry, and engineering. CRC Press, 2018.
|
| 280 |
+
|
| 281 |
+
Baris E Suzek, Yuqi Wang, Hongzhan Huang, Peter B McGarvey, Cathy H Wu, and UniProt Consortium. Uniref clusters: a comprehensive and scalable alternative for improving sequence similarity searches. Bioinformatics, 31(6):926–932, 2014.
|
| 282 |
+
|
| 283 |
+
Michalis K Titsias. Learning model reparametrizations: Implicit variational inference by fitting mcmc distributions. arXiv preprint arXiv:1708.01529, 2017.
|
| 284 |
+
|
| 285 |
+
Dustin Tran, Rajesh Ranganath, and David Blei. Hierarchical implicit models and likelihood-free variational inference. In Advances in Neural Information Processing Systems, pp. 5523–5533, 2017.
|
| 286 |
+
|
| 287 |
+
Dilin Wang and Qiang Liu. Learning to draw samples with amortized stein variational gradient descent. In Uncertainty in Artificial Intelligence, 2017.
|
| 288 |
+
|
| 289 |
+
Shenlong Wang, Sanja Fidler, and Raquel Urtasun. Proximal deep structured models. In Advances in Neural Information Processing Systems, pp. 865–873, 2016.
|
| 290 |
+
|
| 291 |
+
Yang Zhang and Jeffrey Skolnick. Tm-align: a protein structure alignment algorithm based on the tm-score. Nucleic acids research, 33(7):2302–2309, 2005.
|
| 292 |
+
|
| 293 |
+

|
| 294 |
+
Figure 6: Model schematic. The model generates an atomic structure $\boldsymbol { X }$ (top right) from sequence information $\pmb { s }$ (top left) via 3 steps: First, a sequence network takes in the sequence information $\pmb { s }$ , processes it with a combination of 1D, 2D, and graph convolutions (MPNN, bottom left), and outputs energy function weights $l$ as well as simulator hyperparameters (top center). Second, the simulator iteratively modifies the structure via Langevin dynamics based on the gradient of the energy landscape (Forces, bottom center). Third, the imputation network constructs predicted atomic coordinates $\boldsymbol { X }$ from the final simulator time step $\pmb { x } ^ { ( T ) }$ . During training, the true atomic coordinates $X ^ { ( \mathsf { D a t a } ) }$ , predicted atomic coordinates $\boldsymbol { X }$ , simulator trajectory $\bar { \pmb { x } ^ { ( 1 ) } } , \dots , \bar { \pmb { x } ^ { ( T ) } }$ , and secondary structure predictions $S S ^ { ( \mathsf { M o d e l } ) }$ feed into a composite loss function (Loss, bottom right), which is then optimized via backpropagation.
|
| 295 |
+
|
| 296 |
+
APPENDICES
|
| 297 |
+
|
| 298 |
+
A MODEL
|
| 299 |
+
|
| 300 |
+
A.1 COORDINATE SYSTEMS
|
| 301 |
+
|
| 302 |
+
Inverse transformation The inverse transformation $z = \mathcal { F } ^ { - 1 } ( \pmb { x } )$ involves fully local computations of bong lengths and angles.
|
| 303 |
+
|
| 304 |
+
$$
|
| 305 |
+
b _ { i } = \left| \left| x _ { i } - \mathbf { x } _ { i - 1 } \right| \right| , \left. a _ { i } = \operatorname { a r c c o s } \left( - { \hat { u } } _ { i } \cdot { \hat { u } } _ { i - 1 } \right) , \right. \ d _ { i } = \operatorname { s i g n } \left( { \hat { u } } _ { i - 2 } \cdot { \hat { n } } _ { i } \right) \operatorname { a r c c o s } \left( { \hat { n } } _ { i - 1 } \cdot { \hat { n } } _ { i } \right) .
|
| 306 |
+
$$
|
| 307 |
+
|
| 308 |
+
Jacobian The Jacobian @x@z defines the infinitesimal response of the Cartesian coordinates x to perturbations of the internal coordinates $\mathbf { z }$ . It will be important for both converting Cartesian forces into angular torques and bond forces as well as the development of our transform integrator. It is
|
| 309 |
+
|
| 310 |
+

|
| 311 |
+
Figure 7: Component architectures. (Left) The energy function is the inner product of sequencebased weights and structure-based features. A combination of low- and high-level features capture multi-scale constraints on structure. (Center) The structure network is a lightweight convolutional network operating on both 1D (backbone) and 2D (interaction) features. (Right) Convolutional neural network modules used for sequence processing are composed of residual blocks that interleave spatial convolutions with 1x1 convolutions.
|
| 312 |
+
|
| 313 |
+
defined element-wise as
|
| 314 |
+
|
| 315 |
+
$$
|
| 316 |
+
\begin{array} { r l } & { \frac { \partial \pmb { x } _ { j } } { \partial b _ { i } } = \left\{ \begin{array} { l l } { \hat { \pmb { u } } _ { i } } & { i \leq j } \\ { 0 } & { i > j } \end{array} \right. , } \\ & { \frac { \partial \pmb { x } _ { j } } { \partial a _ { i } } = \left\{ \begin{array} { l l } { \hat { \pmb { n } } _ { i } \times ( \pmb { x } _ { j } - \pmb { x } _ { i - 1 } ) } & { i \leq j } \\ { 0 } & { i > j } \end{array} \right. , } \\ & { \frac { \partial \pmb { x } _ { j } } { \partial d _ { i } } = \left\{ \begin{array} { l l } { \hat { \pmb { u } } _ { i - 1 } \times ( \pmb { x } _ { j } - \pmb { x } _ { i - 1 } ) } & { i \leq j } \\ { 0 } & { i > j } \end{array} \right. . } \end{array}
|
| 317 |
+
$$
|
| 318 |
+
|
| 319 |
+
The Jacobian has a simple form that can be understood by imagining the protein backbone as a robot arm that is planted at $\scriptstyle { \pmb x } _ { 0 }$ (Figure 2B). Increasing or decreasing the bond length $b _ { i }$ extends or retracts all downstream coordinates along the bonds axis, moving a bond angle $a _ { i }$ drives circular motion of all downstream coordinates around the bond normal vector $\hat { \mathbf { \ b { n } } } _ { i }$ centered at $\mathbf { \delta } _ { \mathbf { \mathcal { X } } i - 1 }$ , and moving a dihedral angle $d _ { i }$ drives circular motion of downstream coordinate $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { j } }$ around bond vector $\hat { \pmb { u } } _ { i - 1 }$ centered at ${ \bf { \mathbf { \mathit { x } } } } _ { i - 1 }$ .
|
| 320 |
+
|
| 321 |
+
Unconstrained representations Bond lengths and angles are subject to the constraints $b _ { i } > 0$ and $0 < a _ { i } < \pi$ . We enforce these constraints by representing these degrees of freedom in terms of fully unconstrained variables $\tilde { b } _ { i }$ and $\tilde { a } _ { i }$ via the transformations $b _ { i } = \log \biggl ( 1 + e ^ { \tilde { b } _ { i } } \biggr )$ and $\begin{array} { r } { a _ { i } = \frac { \pi } { 1 + e ^ { - \bar { a } _ { i } } } } \end{array}$ ⇡1+e a˜i . All references to the internal coordinates $_ { z }$ and Jacobians $\textstyle { \frac { \partial { \boldsymbol { x } } } { \partial z } }$ will refer to the use of fully unconstrained representations (Table 2).
|
| 322 |
+
|
| 323 |
+
# A.2 ENERGY FUNCTION
|
| 324 |
+
|
| 325 |
+
Figure 6 provides an overall schematic of the model, including the components of the energy function.
|
| 326 |
+
|
| 327 |
+
CNN primitives All convolutional neural network primitives in the model schematic (Figure 6) follow a common structure consisting of stacks of residual blocks. Each residual block includes consists of a layer of channel mixing (1x1 convolution), a variable-sized convolution layer, and a second layer of channel mixing. We use dropout with $p = 0 . 9$ and Batch Renormalization (Ioffe, 2017) on all convolutional layers. Batch Renormalization rather than Normalization was necessary rather owing to the large variation in sizes of the structures of the proteins and resulting large variation in mini-batch statistics.
|
| 328 |
+
|
| 329 |
+
Table 2: Coordinate systems and representations for protein structure.
|
| 330 |
+
|
| 331 |
+
<table><tr><td>Variable</td><td>Notation</td><td>Shape</td></tr><tr><td>Sequence</td><td>S</td><td>[L,20]</td></tr><tr><td>Cartesian coordinates (coarse)</td><td>C</td><td>[3L,1]</td></tr><tr><td>Internal coordinates</td><td>之</td><td>[3L,1]</td></tr><tr><td>Cartesian coordinates (atomic)</td><td>X</td><td>[3L,A]</td></tr><tr><td>Cartesian coordinates forposition i</td><td>xi</td><td>[3,1]</td></tr><tr><td>Internal coordinate for position i</td><td>2=biaid]</td><td>[3,1]</td></tr><tr><td>Unit vector from xi-1 to xi</td><td>Wi</td><td>[3,1]</td></tr><tr><td>Unit vector normal to bond plane at xi-1</td><td>ni</td><td>[3,1]</td></tr><tr><td>Bond length ||xi- xi-1ll</td><td>bi</td><td>[1]</td></tr><tr><td>Bond angle ∠(ui,-ui-1)</td><td>ai</td><td>[1]</td></tr><tr><td>Dihedral angle ∠(ni,ni-1)</td><td>di</td><td>[1]</td></tr><tr><td>Unconstrained bond length</td><td>bi</td><td>[1]</td></tr><tr><td>Unconstrained bond angle</td><td>ai</td><td>[1]</td></tr><tr><td>Jacobian matrix</td><td>x dz</td><td>[3L,3L]</td></tr></table>
|
| 332 |
+
|
| 333 |
+
# A.3 INTERNAL COORDINATE DYNAMICS WITH A TRANSFORM INTEGRATOR
|
| 334 |
+
|
| 335 |
+
Why sampling vs. optimization Deterministic methods for optimizing the energy $U ( { \pmb x } ; { \pmb s } )$ such as gradient descent or quasi-Newton methods can effectively seek local minima of the energy surface, but are challenged to optimize globally and completely ignore the contribution of the widths of energy minima (entropy) to their probability. We prefer sampling to optimization for three reasons: (i) noise in sampling algorithms can facilitate faster global conformational exploration by overcoming local minima and saddle points, (ii) sampling generates populations of states that respect the width (entropy) of wells in $U$ and can be used for uncertainty quantification, and (iii) sampling allows training with an approximate Maximum Likelihood objective (Equation 5).
|
| 336 |
+
|
| 337 |
+
Langevin Dynamics The Langevin dynamics are a stochastic dynamics that sample from the canonical ensemble. They are defined as a continuous-time stochastic differential equation, and are simulated in discrete time with the first order discretization
|
| 338 |
+
|
| 339 |
+
$$
|
| 340 |
+
\pmb { x } ^ { ( t + \epsilon ) } \pmb { x } ^ { ( t ) } - \frac { \epsilon } { 2 } \nabla _ { \pmb { x } } U ^ { ( t ) } + \sqrt { \epsilon } \mathbf { p } , \mathbf { p } \sim \mathcal { N } ( 0 , I ) .
|
| 341 |
+
$$
|
| 342 |
+
|
| 343 |
+
Each time step of $\epsilon$ involves a descent step down the energy gradient plus a perturbation of Gaussian noise. Importantly, as time tends toward to infinity, the time-distribution of the Langevin dynamics converges to the canonical ensemble. Our goal is to design a dynamics that converge to an approximate sample in a very short period of time.
|
| 344 |
+
|
| 345 |
+
Table 3: Model architecture. Input number of channels $q = 2 0$ for sequence-only and $q = 4 0$ for profiles.
|
| 346 |
+
|
| 347 |
+
<table><tr><td>Location</td><td>Type</td><td>Channels</td><td>#Blocks</td><td>Width</td><td>Dilation</td><td>Stride</td></tr><tr><td>Pre-MPNN</td><td>1D</td><td>128</td><td>12</td><td>3</td><td>[1,2,4, 8] × 3</td><td>1</td></tr><tr><td>MPNN</td><td>1D</td><td>128</td><td>4</td><td>3</td><td>[1, 2, 4, 8]</td><td>1</td></tr><tr><td>MPNN</td><td>2D</td><td>50</td><td>1</td><td>7</td><td>1</td><td>1</td></tr><tr><td>Post-MPNN</td><td>1D</td><td>q+256</td><td>12</td><td>3</td><td>[1,2,4,8] × 3</td><td>1</td></tr><tr><td>Post-MPNN*</td><td>2D</td><td>100</td><td>1</td><td>9</td><td>1</td><td>1</td></tr><tr><td>Imputation</td><td>1D</td><td>q+256</td><td>12</td><td>3</td><td>[1,2,4, 8] × 3</td><td>1</td></tr></table>
|
| 348 |
+
|
| 349 |
+
Coordinate systems and preconditioning The efficiency with which Langevin dynamics explore conformational space is highly dependent on the geometry of the energy landscape $U ( { \pmb x } )$ , which in turn depends on how the system is parameterized. Molecular energy functions in Cartesian coordinates tend to exhibit strong correlations between variables that result from the requirement that underlying molecular geometries satisfy highly stereotyped bond lengths and angles. As a result, simulations of naive Cartesian Langevin dynamics require a small time step to satisfy these constraints and tend to be dominated by high-frequency, localized vibrations of the chain. The large, global motions that are essential to protein folding can require thousands to millions of times steps to manifest.
|
| 350 |
+
|
| 351 |
+
A well-known solution to the complex dependencies of Cartesian coordinates is to carry out optimization and simulation in internal coordinates, which directly parameterize molecular geometries in terms of the bond lengths and angles (Parsons et al., 2005). Internal coordinate parameterizations possess the advantages that (i) bond length and angle constraints are easy to satisfy and (ii) small changes to a single angle can drive large, coherent rearrangements of the chain (Figure 2B). For example, simply replacing x’s with $\mathbf { z }$ ’s in Equation 8 yields the dynamics
|
| 352 |
+
|
| 353 |
+
$$
|
| 354 |
+
\boldsymbol { z } ^ { ( t + \epsilon ) } \boldsymbol { z } ^ { ( t ) } - \frac { \epsilon } { 2 } \nabla _ { \boldsymbol { z } } \boldsymbol { U } ^ { ( t ) } + \sqrt { \epsilon } \mathbf { p } , \qquad \mathbf { p } \sim \mathcal { N } ( 0 , I ) .
|
| 355 |
+
$$
|
| 356 |
+
|
| 357 |
+
The advantages and disadvantages of the two coordinate systems are complementary: Cartesian dynamics efficiently sample local structural rearrangements and inefficiently sample global chain motions, while internal coordinate dynamics efficiently sample global, correlated motions of the chain but are challenged to make precise local rearrangements.
|
| 358 |
+
|
| 359 |
+
The time dynamics of these alternative parameterizations need not be kinetically realistic to converge to the correct distribution over conformational space. Different coordinate systems warp the local geometry of the energy landscape and will in turn rescale and redirect which global vibrational and local vibrations dominate the dynamics. This relative rescaling can be further optimized by applying a global linear transformation to the energy landscape with a preconditioning ‘inverse mass’ matrix $C$ , giving the update
|
| 360 |
+
|
| 361 |
+
$$
|
| 362 |
+
\boldsymbol { z } ^ { ( t + \epsilon ) } \boldsymbol { z } ^ { ( t ) } - \frac { \epsilon C } { 2 } \nabla _ { \boldsymbol { z } } \boldsymbol { U } ^ { ( t ) } + \sqrt { \epsilon C } \mathbf { p } , \mathbf { p } \sim \mathcal { N } ( 0 , I ) .
|
| 363 |
+
$$
|
| 364 |
+
|
| 365 |
+
Transform integrator The need to rebuild Cartesian geometry $_ { \textbf { \em x } }$ from internal coordinates $_ z$ with $\mathcal F ( z )$ at every time step is one of the major costs of conformational sampling codes based on Internal coordinates (Parsons et al., 2005) because it is intrinsically sequential. Here we show how it is possible to bypass the need for geometry reconstruction at every step by instead computing on-the-fly geometry modification.
|
| 366 |
+
|
| 367 |
+
Imagine following a change to the internal coordinates $\Delta z ^ { ( t ) }$ along a straight path from $z ^ { ( t ) }$ to $\tilde { \mathbf { \Lambda } } _ { Z } ( t + \bar { \mathbf { \Lambda } } \epsilon )$ and tracking the corresponding nonlinear path of the Cartesian coordinates from $\mathbf { \boldsymbol { x } } ^ { ( t ) }$ to $\mathbf { \boldsymbol { x } } ^ { ( t + \epsilon ) }$ . If this path is indexed by $u \in ( t , t + \epsilon )$ , then the dynamics of $\mathbf { x }$ with respect to $u$ are given by $\begin{array} { r } { \frac { \partial \pmb { x } } { \partial u } = \frac { \bar { \partial } \pmb { x } } { \partial z } \frac { \partial z } { \partial u } = \frac { \partial \pmb { x } } { \partial z } \frac { 1 } { \epsilon } \Delta z } \end{array}$ @x@z 1✏ z. Integrating the dynamics of x gives
|
| 368 |
+
|
| 369 |
+
$$
|
| 370 |
+
\begin{array} { l } { \displaystyle \pmb { x } ^ { ( t + \epsilon ) } = \mathcal { F } \left( \pmb { z } ^ { ( t ) } + \Delta \pmb { z } ^ { ( t ) } \right) } \\ { \displaystyle = \pmb { x } ^ { ( t ) } + \int _ { t } ^ { t + \epsilon } \frac { 1 } { \epsilon } \frac { \partial \pmb { x } } { \partial \pmb { z } } ^ { ( u ) } \Delta \pmb { z } ^ { ( t ) } d u . } \end{array}
|
| 371 |
+
$$
|
| 372 |
+
|
| 373 |
+
This illustrates that it is possible to convert coordinate changes in one coordinate system (e.g. Internal Coordinates) to coordinate changes in another (e.g. Cartesian) by integrating an autonomous system of ODEs with dynamics governed by the Jacobian. Since $\epsilon$ is small, we integrate this system with a single step of Heun’s method (improved Euler), where we first substitute an Euler approximation to predict $\pmb { x } ^ { ( t + \epsilon ) }$ as
|
| 374 |
+
|
| 375 |
+
$$
|
| 376 |
+
\tilde { \mathbf { x } } ^ { ( t + \epsilon ) } \approx \mathbf { x } ^ { ( t ) } + \frac { \partial \mathbf { x } } { \partial z } ^ { ( t ) } \Delta z ^ { ( t ) } ,
|
| 377 |
+
$$
|
| 378 |
+
|
| 379 |
+
and then substitute the Jacobian evaluated at the predicted state $\tilde { { \mathbf x } } ^ { ( t + \epsilon ) }$ to form trapezoidal approximation
|
| 380 |
+
|
| 381 |
+
$$
|
| 382 |
+
{ \pmb x } ^ { ( t + \epsilon ) } \approx { \pmb x } ^ { ( t ) } + \frac { 1 } { 2 } \left( \frac { \partial { \pmb x } ^ { ( t ) } } { \partial z } + \frac { \partial \tilde { \bf x } } { \partial z } ^ { ( t + \epsilon ) } \right) \Delta { \pmb z } ^ { ( t ) } .
|
| 383 |
+
$$
|
| 384 |
+
|
| 385 |
+

|
| 386 |
+
Figure 8: Accounting for second order errors is essential for internal coordinate dynamics. (Top) Discarding the corrector step rapidly accumulates errors due to the curvilinear motions of internal coordinate dynamics. (Bottom) Heun integration with a corrector step accounts for curvature in curvilinear motion.
|
| 387 |
+
|
| 388 |
+
The comparison of this algorithm with naive integration is given in Figure 8. The corrector step is important for eliminating the large second-order errors that arise in curvilinear motions caused by angle changes (Figure 2B and Figure 8). In principle higher-order numerical integration methods or more time steps could increase accuracy at the cost of more evaluations of the Jacobian, but we found that second-order effects seemed to be the most relevant on our timescales.
|
| 389 |
+
|
| 390 |
+
Mixed integrator Cartesian dynamics favor local structural rearrangements, such as the transitioning from a helical to an extended conformation, while internal coordinate dynamics favor global motions such as the change of the overall fold topology. Since both kinds of structural rearrangements are important to the folding process, we form a hybrid integrator (Algorithm 3) by taking one step with each integrator per force evaluation.
|
| 391 |
+
|
| 392 |
+
Translational and rotational detrending Both Cartesian and Internal coordinates are overparameterized with $3 L$ degrees of freedom, since only $3 L - 6$ degrees of freedom are necessary to encode a centered and un-oriented structure5. As a consequence, a significant fraction of the per time-step changes $\Delta \mathbfit { x }$ can be explained by rigid translational and rotational motions of the entire structure. We isolate and remove these components of motion by treating the system $\{ \pmb { x } _ { 1 } , \ldots , \pmb { x } _ { L } \}$ as a set of particles with unit mass, and computing effective structural translational and rotational velocities by summing point-wise momenta.
|
| 393 |
+
|
| 394 |
+
The translational component of motion is simply the average displacement across positions $\Delta { x } _ { i } ^ { \mathrm { { T r a n s } } } =$ $\langle \Delta \pmb { x } _ { i } \rangle$ . For rotational motion around the center of mass, it is convenient to define the non-translational motion as $\Delta \bar { \mathbf { x } } _ { i } = \Delta \mathbf { x } _ { i } - \Delta \mathbf { x } _ { i } ^ { \mathrm { { T r a n s } } }$ and the centered Cartesian coordinates as $\bar { \pmb x } _ { i } = \pmb x _ { i } - \langle \pmb x _ { i } \rangle$ . The point-wise angular momentum is then $\boldsymbol { l } _ { i } = \bar { \mathbf { x } } _ { i } \times \Delta \bar { \mathbf { x } } _ { i }$ and we define a total angular velocity of the structure $\omega$ by summing these and dividing by the moment of inertia as $\begin{array} { r } { \omega = ( \bar { \sum _ { i } } l _ { i } ) / \left( \sum _ { i } \bar { | } | \bar { \mathbf { x } } _ { i } | | _ { 2 } ^ { 2 } \right) } \end{array}$ . We convert the angular velocity $\omega$ into Cartesian displacements with an unrolled Heun integration as $\Delta \mathbf { x } _ { i } ^ { \mathrm { R o t } } = \frac { 1 } { 2 } \boldsymbol { \omega } \times \left( \bar { \mathbf { x } } _ { i } + \boldsymbol { \omega } \times \bar { \mathbf { x } } _ { i } \right)$ , which leaves the isolated structural motions as $\Delta \mathbf { x } _ { i } ^ { \mathrm { { S t r u c t } } } =$ $\Delta { { \bf { x } } _ { i } } - \Delta { { \bf { x } } _ { i } ^ { \mathrm { { T r a n s } } } } - \Delta { { \bf { x } } _ { i } ^ { \mathrm { R o t } } }$ .
|
| 395 |
+
|
| 396 |
+
# Algorithm 3: Mixed Integrator
|
| 397 |
+
|
| 398 |
+
Input : Initial state $z ^ { ( 0 ) }$ , energy $U ( { \pmb x } )$ , time steps $\epsilon _ { x } , \epsilon _ { z }$ , total time $T$ , preconditioners $\mathbf { C } _ { \mathbf { \mathcal { X } } } , \mathbf { C } _ { z }$ ,
|
| 399 |
+
Output :Trajectory $\pmb { x } ^ { ( 0 ) } , \ldots , \pmb { x } ^ { ( T ) }$
|
| 400 |
+
Initialize $\pmb { x } ^ { ( 0 ) } \mathcal { F } ( \pmb { z } ^ { ( 0 ) } )$ ;
|
| 401 |
+
while $t < T$ do $f _ { x } \gets \nabla _ { x } U$ ; x(Cart) CartesianStep $\begin{array} { r } { \langle \pmb { x } ^ { ( t ) } , \pmb { f } _ { \pmb { x } } , \epsilon _ { \pmb { x } } , \mathbf { C } _ { \pmb { x } } \rangle } \end{array}$ ; $\Delta \pmb { x } ^ { ( I n t ) } \mathsf { C 1 }$ ippedInternalStep $( \pmb { x } + \Delta \pmb { x } ^ { ( C a r t ) } , \pmb { f _ { x } } , \epsilon _ { z } , \mathbf { C } _ { z } ) ;$ ; x x + Detrend $( \Delta \pmb { x } ^ { ( C a r t ) } + \Delta \pmb { x } ^ { ( I n t ) } )$ ; $t t + \epsilon$ ;
|
| 402 |
+
end
|
| 403 |
+
|
| 404 |
+
Speed clipping We found it helpful to stabilize the model by enforcing a speed limit on overall structural motions for the internal coordinate steps. This prevents small changes to the energy function during learning from causing extreme dynamics that in turn produce a non-informative learning signal. To accomplish this, we translationally and rotationally detrend the update of the predictor step $\Delta \mathbf { x }$ and compute a hypothetical time step $\hat { \epsilon } _ { z }$ that would limit the fastest motion to 2 Angstroms per iteration. We then compute modified predictor and corrector steps subject to this new, potentially slower, time step. While this breaks the asymptotics of Langevin dynamics, (i) it is unlikely on our timescales that we achieve stationarity and (ii) it can be avoided by regularizing the dynamics away from situations where clipping is necessary. In the future, considering non-Gaussian perturbations with kinetic energies similar to Relativistic Monte Carlo (Lu et al., 2017) might accomplish a similar goal in a more principled manner. The final integrator combining these ideas is presented in Figure 3.
|
| 405 |
+
|
| 406 |
+
# B APPENDIX B: TRAINING
|
| 407 |
+
|
| 408 |
+
# B.1 DATA
|
| 409 |
+
|
| 410 |
+
For a training and validation set, we downloaded all protein domains of length $L \leq 2 0 0$ from Classes $\alpha , \beta$ , and $\alpha / \beta$ in CATH release 4.1 (2015), and then hierarchically purged a randomly selected set of A, $\mathbf { T }$ , and $\mathbf { H }$ categories. This created three validation sets of increasing levels of difficulty: $\mathbf { H }$ , which contains domains with superfamilies that are excluded from train (but fold topologies may be present), T, which contains fold topologies that were excluded from train (fold generalization), and A which contains secondary structure architectures that were excluded from train.
|
| 411 |
+
|
| 412 |
+
For a test set, we downloaded all folds that were new to CATH release 4.2 (2017), which (due to a propensity of structural biology to make new structures of previously solved folds), provided 10,381 test domains. We further stratified this test set into C, A, T, and $\mathbf { H }$ categories based on their nearest CATH classification in the training set.
|
| 413 |
+
|
| 414 |
+
We also analyzed test set stratifications based on nearest neighbors in both training and validation in figure Figure 12. We note that the validation set was not explicitly used to tune hyperparameters due to the large cost of training ( 2 months on 2 M40 GPUs), but we did keep track of validation statistics during training.
|
| 415 |
+
|
| 416 |
+
# B.2 SGD
|
| 417 |
+
|
| 418 |
+
We optimized all models for 200,000 iterations with Adam (Kingma & Ba, 2014).
|
| 419 |
+
|
| 420 |
+
# B.3 LOSS
|
| 421 |
+
|
| 422 |
+
We optimize the model using a composite loss containing several terms, which are detailed as follows.
|
| 423 |
+
|
| 424 |
+
Distance loss We score distances in the model with a contact-focused distance loss
|
| 425 |
+
|
| 426 |
+
$$
|
| 427 |
+
\sum _ { i < j } w _ { i j } \left| D _ { i j } ^ { ( \mathrm { M o d e l } ) } - D _ { i j } ^ { ( \mathrm { D a t a } ) } \right| ,
|
| 428 |
+
$$
|
| 429 |
+
|
| 430 |
+
where the contact-focusing weights are
|
| 431 |
+
|
| 432 |
+
$$
|
| 433 |
+
w _ { i j } = \frac { \sigma \left( \alpha ( D _ { 0 } - \mathrm { m i n } ( D _ { i j } ^ { ( \mathrm { M o d e l } ) } , D _ { i j } ^ { ( \mathrm { D a t a } ) } ) ) \right) } { \sum _ { k < l } \sigma \left( \alpha ( D _ { 0 } - \mathrm { m i n } ( D _ { k l } ^ { ( \mathrm { M o d e l } ) } , D _ { k l } ^ { ( \mathrm { D a t a } ) } ) ) \right) }
|
| 434 |
+
$$
|
| 435 |
+
|
| 436 |
+
and $\begin{array} { r } { \sigma ( u ) = \frac { 1 } { 1 + \exp ( - u ) } } \end{array}$ is the sigmoid function.
|
| 437 |
+
|
| 438 |
+
Angle loss We use the loss
|
| 439 |
+
|
| 440 |
+
$$
|
| 441 |
+
\mathcal { L } _ { \mathrm { a n g l e s } } = \sum _ { i } | | \mathcal { H } ( z _ { i } ^ { ( T ) } ) - \mathcal { H } ( z _ { i } ^ { ( \mathrm { D a t a } ) } ) | | ,
|
| 442 |
+
$$
|
| 443 |
+
|
| 444 |
+
where ${ \mathcal { H } } ( z ) = [ \cos ( a _ { i } ) \ \sin ( a _ { i } ) \cos ( d _ { i } ) \ \sin ( a _ { i } ) \sin ( d _ { i } ) ] ^ { T }$ are unit length feature vectors that map the angles $\{ a _ { i } , d _ { i } \}$ to the unit sphere.
|
| 445 |
+
|
| 446 |
+
Other angular losses, such as the negative log probability of a Von-Mises Fisher distribution, are based on the inner product of the feature vectors $\mathcal { H } ( z _ { a } ) \cdot \mathcal { H } ( z _ { b } )$ rather than the Euclidean distance $| | \mathcal { H } ( z _ { a } ) - \mathcal { H } ( z _ { b } ) | |$ between them. It is worth noting that these two quantities are directly related by $| | \mathcal { H } ( z _ { a } ) - \mathcal { H } ( z _ { b } ) | | = \sqrt { 2 ( 1 - \mathcal { H } ( z _ { a } ) \cdot \mathcal { H } ( z _ { b } ) ) } .$ . Taking $z _ { a }$ as fixed and $z _ { b }$ as the argument, the Euclidean loss has a cusp at $z _ { a }$ whereas the Von-Mises Fisher loss is smooth around $z _ { a }$ . This is analogous to the difference between $L ^ { 1 }$ and $L ^ { 2 }$ losses, where the cusped $L ^ { 1 }$ loss favors median behavior while the smooth $L ^ { 2 }$ loss favors average behavior.
|
| 447 |
+
|
| 448 |
+
Trajectory loss In a further analogy to reinforcement learning, damped backpropation through time necessitates an intermediate loss function that can criticize transient states of the simulator. We compute this by featurizing the per time step coordinates as the product $D _ { i j } \hat { \pmb { v } } _ { i j }$ (Figure 2C) and doing the same contact-weighted averaging as the distance loss.
|
| 449 |
+
|
| 450 |
+
Template Modelling (TM) Score The TM-score (Zhang & Skolnick, 2005),
|
| 451 |
+
|
| 452 |
+
$$
|
| 453 |
+
\sum _ { i } { \frac { 1 } { 1 + \left( { \frac { D _ { i } } { D _ { 0 } } } \right) ^ { 2 } } } ,
|
| 454 |
+
$$
|
| 455 |
+
|
| 456 |
+
is a measure of superposition quality between two protein structures on $[ 0 , 1 ]$ that was presented as an approximately length-independent alternative to RMSD. The TM-score is the best attainable value of the preceding quantity for all possible superpositions of two structures, where $D _ { i } \ =$ $| | \mathbf { \boldsymbol { x } } ^ { ( \mathrm { M o d e l } ) } - \mathbf { \bar { \boldsymbol { x } } } ^ { ( \mathrm { D a t a } ) } | |$ . This requires iterative optimization, which we implemented with a sign gradient descent with 100 iterations to optimally superimpose the model and target structure. We backpropagate through this unrolled optimization process as well as that of the simulator.
|
| 457 |
+
|
| 458 |
+
Hydrogen bond loss We determine intra-backbone hydrogen bonds using the electrostatic model of DSSP (Kabsch & Sander, 1983). First, we place virtual hydrogens at 1 Angstroms along the negative angle bisector of the $C _ { i - 1 } - N _ { i } - C \alpha _ { i }$ bond angle. Second, we compute a putative energy $U _ { i j } ^ { \mathrm { { h - b o n d } } }$ ( $\mathrm { n \ k c a l / m o l } )$ ) for each potential hydrogen bond from an amide donor at $i$ to a carbonyl acceptor at $j$ as
|
| 459 |
+
|
| 460 |
+
$$
|
| 461 |
+
\begin{array} { l } { { \displaystyle U _ { i j } ^ { \mathrm { h - b o n d } } ( { \bf X } ) = \left( \frac { q _ { N } q _ { O } } { D _ { N O } } + \frac { q _ { H } q _ { C } } { D _ { H C } } + \frac { q _ { H } q _ { O } } { D _ { H O } } + \frac { q _ { N } q _ { C } } { D _ { N C } } \right) ~ 3 3 2 } } \\ { { \displaystyle ~ = 0 . 0 8 4 \left( \frac { 1 } { D _ { N O } } + \frac { 1 } { D _ { H C } } - \frac { 1 } { D _ { H O } } - \frac { 1 } { D _ { N C } } \right) ~ 3 3 2 } } \end{array}
|
| 462 |
+
$$
|
| 463 |
+
|
| 464 |
+
where $D _ { a b } = | | \mathbf { X } _ { i , a } - \mathbf { X } _ { j , b } | |$ is the Euclidean distance between atom $a$ of residue $i$ and atom $b$ of residue $j$ . We then make hard assignments of hydrogen bonds for the data with
|
| 465 |
+
|
| 466 |
+
$$
|
| 467 |
+
y _ { i j } ^ { \mathrm { d a t a } } = { \bf 1 } \left( U _ { i j } ^ { \mathrm { h - b o n d } } ( { \bf X } ^ { \mathrm { ( d a t a ) } } ) < - 0 . 5 \right) .
|
| 468 |
+
$$
|
| 469 |
+
|
| 470 |
+
We ‘predict’ the probabilities of hydrogen bonds of the data given the model via logisitic regression of soft model assignments as
|
| 471 |
+
|
| 472 |
+
$$
|
| 473 |
+
y _ { i j } ^ { \mathrm { m o d e l } } = \sigma \left( a \sigma \left( b \left( - U _ { i j } ^ { \mathrm { h - b o n d } } ( \mathbf { X } ^ { ( m o d e l ) } ) + 0 . 5 \right) \right) + c \right) ,
|
| 474 |
+
$$
|
| 475 |
+
|
| 476 |
+
where $a , b , c$ are learned parameters with the softplus parameterizations enforcing $a , b > 0$ and $\sigma ( u ) = 1 / ( 1 + \exp ( - u )$ is the sigmoid function. The final hydrogen bond loss is the cross-entropy between these predictions and the data,
|
| 477 |
+
|
| 478 |
+
$$
|
| 479 |
+
{ \mathcal { L } } _ { \mathrm { h - b o n d } } = \sum _ { | i - j | > 2 } y _ { i j } ^ { \mathrm { d a t a } } \log y _ { i j } ^ { \mathrm { m o d e l } } + \left( 1 - y _ { i j } ^ { \mathrm { d a t a } } \right) \log \left( 1 - y _ { i j } ^ { \mathrm { m o d e l } } \right) .
|
| 480 |
+
$$
|
| 481 |
+
|
| 482 |
+
Secondary Structure Prediction We output standard 8-class predictions of secondary structure and score them with a cross-entropy loss.
|
| 483 |
+
|
| 484 |
+
# B.4 STABILIZING BACKPROPAGATION THROUGH TIME
|
| 485 |
+
|
| 486 |
+
The combination of energy function, simulator, and refinement network can build an atomic level model of protein structure from sequence, and our goal is to optimize (meta-learn) this entire procedure by gradient descent. Before going into specifics of the loss function, however, we will discuss a challenges and solutions for computing gradients of unrolled simulations in the face of chaos.
|
| 487 |
+
|
| 488 |
+
# B.5 CHAOS AND EXPLODING GRADIENTS
|
| 489 |
+
|
| 490 |
+
Gradient-based learning of iterative computational procedures such as Recurrent Neural Networks (RNNs) is well known to be subject to the problems of exploding and vanishing gradients (Pascanu et al., 2013). Informally, these occur when the sensitivities of model outputs to inputs become either extremely large or extremely small and the gradient is no longer an informative signal for optimization. We find that backpropagation through unrolled simulations such as those presented is no exception to this rule. Often we observed that a model would productively learn for tens of thousands of iterations, only to suddenly and catastrophically exhibit diverging gradients from which the optimizer could not recover - even when the observed simulation dynamics exhibited no obvious qualitative changes to behavior and the standard solutions of gradient clipping (Pascanu et al., 2013) were in effect. Similar phenomena have been observed previously in the context of meta-learning (Maclaurin et al., 2015) and are explored in detail in a concurrent work (Parmas et al., 2018).
|
| 491 |
+
|
| 492 |
+
In Figure 9, we furnish a minimal example that illustrates how chaos can lead to irrevocable loss of learning. We see that for even a simple particle-in-a-well, some choices of system parameters (such as too large a time step) can lead to chaotic dynamics which are synonymous with explosive gradients. This example is hardly contrived, and is in fact a simple model of the distance potentials between coordinates in our simulations. Moreover, it is important to note that chaos may not be easy to diagnose: for learning rates $\alpha \in [ 1 . 7 , 1 . 8 ]$ the position of the particle $x$ remains more or less confined in the well while the sensitivities diverge to $1 0 ^ { 2 0 0 }$ . It seems unlikely that meta-learning would be able to recover after descending into chaos.
|
| 493 |
+
|
| 494 |
+
The view per time step Exploding gradients and chaotic dynamics involve the same mechanism: a multiplicative accumulation of sensitivities. In dynamical systems this is frequently phrased as ‘exponentially diverging sensitivity to initial conditions’. Intuitively, this can be understood by examining how the Jacobian of an entire trajectory decomposes into a product of Jacobians as
|
| 495 |
+
|
| 496 |
+
$$
|
| 497 |
+
\frac { \partial \pmb { x } ^ { ( T ) } } { \partial \pmb { x } ^ { ( 0 ) } } = \frac { \partial \pmb { x } ^ { ( T ) } } { \partial \pmb { x } ^ { ( T - 1 ) } } \frac { \partial \pmb { x } ^ { ( T - 1 ) } } { \partial \pmb { x } ^ { ( T - 2 ) } } \cdot \cdot \cdot \frac { \partial \pmb { x } ^ { ( 1 ) } } { \partial \pmb { x } ^ { ( 0 ) } } .
|
| 498 |
+
$$
|
| 499 |
+
|
| 500 |
+
When the norms of the per time-step Jacobians @x(t)@x(t 1) are typically larger than 1, the sensitivity $\big | \big | \frac { \partial \pmb { x } ^ { ( T ) } } { \partial \pmb { x } ^ { ( 0 ) } } \big | \big |$ will grow exponentially with $T$ . Ideally, we would keep these norms well-behaved which is the rationale recent work on stabilization of RNNs (Henaff et al., 2016; Chen et al., 2018b). Next we will offer a general-purpose regularizer to approximately enforce this goal for any differentiable computational iteration with continuous state.
|
| 501 |
+
|
| 502 |
+

|
| 503 |
+
Figure 9: Chaos impedes meta-learning for gradient descent in a well. (a) Gradient descent of a particle in a well with initial conditions $x ^ { ( 0 ) }$ and step size $\alpha$ . (b) Orbit diagrams visualize long-term dynamics from iterations 1000 to 2000 of the position $x$ (top) and the gradient $\frac { d x ^ { ( t ) } } { d x ^ { ( 0 ) } }$ (bottom). When the step size $\alpha$ is small, these dynamics converge to a periodic orbit over $2 ^ { k }$ values where $0 \leq k < \infty$ . After some critical step size, the dynamics undergo a period-doubling bifurcation (Strogatz, 2018), become chaotic, and the gradients regularly diverge to huge numbers.
|
| 504 |
+
|
| 505 |
+
Approximate Lipschitz conditions One condition that guarantees that a deterministic map $F$ : $\mathbb { R } ^ { \tilde { N } } \to \mathbb { R } ^ { N }$ , ${ \pmb x } _ { t } = F ( { \pmb x } _ { t - 1 } , \theta )$ cannot exhibit exponential sensitivity to initial conditions is the condition of being non-expansive (also known as 1-Lipschitz or Metric). That is, for any two input points $\pmb { x } _ { a } , \pmb { x } _ { b } \in \bar { \mathbb { R } } ^ { N }$ , iterating the map cannot increase the distance between them as $\left| F ( \pmb { x } _ { a } , \theta ) - \right.$ $F ( \pmb { x } _ { b } , \theta ) | \leq | \pmb { x } _ { a } - \pmb { x } _ { b } |$ . Repplying the map to the bound immediately implies
|
| 506 |
+
|
| 507 |
+
$$
|
| 508 |
+
| F ^ { ( t ) } ( { \pmb x } , \theta ) - F ^ { ( t ) } ( { \pmb x } + \Delta { \pmb x } , \theta ) | \leq | \Delta { \pmb x } |
|
| 509 |
+
$$
|
| 510 |
+
|
| 511 |
+
for any number of iterations $t$ . Thus, two initially close trajectories iterated through a non-expansive mapping must remain at least that close for arbitrary time.
|
| 512 |
+
|
| 513 |
+
We approximately enforce non-expansivity by performing an online sensitivity analysis within simulations. At randomly selected time-steps, the current time step $\mathbf { \boldsymbol { x } } ^ { ( t ) }$ is rolled back to the preceding state and re-executed with small Gaussian perturbations to the state $\delta \sim \mathcal { N } ( 0 , 1 0 ^ { - 4 } I ) ^ { 6 }$ . We regularize the sensitivity by adding
|
| 514 |
+
|
| 515 |
+
$$
|
| 516 |
+
\mathcal { L } _ { L y a p u n o v } = \operatorname* { m a x } \left( 0 , \log \frac { | F ( { \pmb x } ^ { ( t ) } ) - F ( { \pmb x } ^ { ( t ) } + \pmb \delta ) | } { | \pmb \delta | } \right)
|
| 517 |
+
$$
|
| 518 |
+
|
| 519 |
+
to the loss. Interestingly, the stochastic nature of this approximate regularizer is likely a good thing - a truly non-expansive map is quite limited in what it can model. However, being ‘almost’ non-expansive seems to be incredibly helpful for learning.
|
| 520 |
+
|
| 521 |
+
Damped Backpropagation through Time The approximate Lipschitz conditions (or Lyapunov regularization) encourage but do not guarantee stable backpropagation. When chaotic phasetransitions or otherwise occur we need a fall-back plan to be able to continue learning. At the same time, we would like gradient descent to proceed in the usual manner when simulator dynamics are stable. To this end we introduce a damping factor to backpropagation that can adaptively combat exponentially diverging gradients with exponential discounting (Algorithm 4).
|
| 522 |
+
|
| 523 |
+
Algorithm 4: Damped Backpropagation Through Time
|
| 524 |
+
|
| 525 |
+
<table><tr><td></td><td>Input :Initial state x(O),time-stepping function F(x,s,0), external inputs S1,..., ST parameters 0,Loss function L(x1,.:.,xr),Damping factor O << γ <1 Output :Exponentially damped gradient Vθ L</td><td></td><td></td></tr><tr><td>Initialize x(O) ← F(z(0));</td><td></td><td></td><td></td></tr><tr><td>for t ← 2,...,T do</td><td></td><td></td><td></td></tr><tr><td></td><td>Compute time step Xt ← F(xt-1,St,0);</td><td></td><td></td></tr><tr><td>end</td><td>Decay the gradient† xt ← (1-γ)⊥(xt) + γxt;</td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td></tr><tr><td></td><td>Compute loss L(x1,..., xT) ;</td><td></td><td></td></tr><tr><td></td><td>Compute gradient VθL ← AutoDiff(L,θ) ;</td><td></td><td></td></tr><tr><td></td><td>twhere ⊥(-)is the stop-gradient function.</td><td></td><td></td></tr></table>
|
| 526 |
+
|
| 527 |
+
Damped backpropagation can be seen as a continuous alternative to the standard approach of Truncated Backpropagation through Time. Rather than setting the gradient to 0 after some fixed intervals of time-steps, we decay it on the backwards pass of reverse-mode differentiation by a factor of $\gamma$ . This is mildly evocative of the notion of discounted future rewards in reinforcement learning. During backpropagation this causes a biased estimate of Jacobians that favors short term sensitivities (or rewards) as
|
| 528 |
+
|
| 529 |
+
$$
|
| 530 |
+
\partial { \frac { \hat { \mathbf { x } ^ { ( t ) } } } { \partial x ^ { ( t - k ) } } } = \left( \left( \left( \gamma { \frac { \partial x ^ { ( t ) } } { \partial x ^ { ( t - 1 ) } } } \right) \gamma { \frac { \partial x ^ { ( t - 1 ) } } { \partial x ^ { ( t - 2 ) } } } \right) \cdot \cdot \cdot \gamma { \frac { \partial x ^ { ( t - k + 1 ) } } { \partial x ^ { ( t - k ) } } } \right) = \gamma ^ { k } { \frac { \partial x ^ { ( t ) } } { \partial x ^ { ( t - k ) } } } .
|
| 531 |
+
$$
|
| 532 |
+
|
| 533 |
+
# B.6 MULTIPLE SEQUENCE ALIGNMENT GENERATION
|
| 534 |
+
|
| 535 |
+
We use multiple sequence alignments of evolutionarily related sequences for both profile construction $( \ S \mathrm { B } . 7 )$ and (ii) data augmentation $( \ S \ B . 8 )$ . For every domain in the dataset, we extracted the sequence from the PDB and then used jackhmmer (Eddy, 2011), to iteratively search the Uniprot90 database (Suzek et al., 2014) (release 4/2016) with 5 iterations and a length-normalized bitscore threshold of 0.3. We then removed sequences with over $50 \%$ gaps relative to the query sequence and then redundancy-reduced the alignment with hhfilter (Remmert et al., 2012) such that all sequences are at least a normalized Hamming distance of 0.8 away from one another.
|
| 536 |
+
|
| 537 |
+
# B.7 PROFILE GENERATION
|
| 538 |
+
|
| 539 |
+
We briefly describe how we construct evolutionary profiles, or position-specific scoring matrices (PSSMs), for each protein domain. Let $\pmb { S } = \{ \pmb { S } ^ { ( 1 ) } , \dots , \pmb { S } ^ { ( L ) } \}$ be the set of $L$ columns of a multiple sequence alignment over $M$ sequences where each column $S ^ { ( i ) }$ is an $M \times q$ matrix that one-hot encodes the sequence data at position $i$ (for an alphabet of size $q$ ). The regularized empirical frequency of letter $a$ at site $i$ is then
|
| 540 |
+
|
| 541 |
+
$$
|
| 542 |
+
f _ { a } ^ { ( i ) } = \frac { \alpha + \sum _ { j } S _ { j a } ^ { ( i ) } } { \alpha + M } ,
|
| 543 |
+
$$
|
| 544 |
+
|
| 545 |
+
where $\alpha$ is a pseudocount that we set to 10. We compute our PSSM features for letter $a$ at site $i$ as
|
| 546 |
+
|
| 547 |
+
$$
|
| 548 |
+
w _ { a } ^ { ( i ) } = \sigma \left( \log \frac { f _ { a } ^ { ( i ) } } { B _ { a } } \right)
|
| 549 |
+
$$
|
| 550 |
+
|
| 551 |
+
where (u) = 11+exp( u) is the logistic sigmoid and $B _ { a }$ is the average frequency of amino acid $a$ in UniProt (Apweiler et al., 2004).
|
| 552 |
+
|
| 553 |
+
Table 4: Qualitative timings. †Results on CATH dataset and 2 M40 GPUs.
|
| 554 |
+
|
| 555 |
+
<table><tr><td>Method</td><td>Generation time</td><td>Training time</td></tr><tr><td>RNNbaseline†</td><td>milliseconds</td><td>~1week</td></tr><tr><td>NEMOt</td><td>seconds</td><td>~ 2 months</td></tr><tr><td>Coevolution-based methods</td><td>minutes to hours</td><td>Coupled to generation</td></tr><tr><td>Physical simulations</td><td>days to weeks</td><td>N/A</td></tr></table>
|
| 556 |
+
|
| 557 |
+
# B.8 EVOLUTIONARY DATA AUGMENTATION
|
| 558 |
+
|
| 559 |
+
To reduce our reliance on alignments and the generation of profiles for inference of new sequences while still leveraging evolutionary sequence data, we augmented our training set by dynamically spiking in diverse, related sequence into the model during training. Given a set of $M$ sequences in the alignment we sample a sequence $t$ based on its normalized Hamming distance $d _ { t }$ with probability
|
| 560 |
+
|
| 561 |
+
$$
|
| 562 |
+
p _ { t } = \frac { e ^ { \lambda _ { \mathrm { E D A } } d _ { t } } } { \sum _ { s = 1 } ^ { M } e ^ { \lambda _ { \mathrm { E D A } } d _ { s } } } ,
|
| 563 |
+
$$
|
| 564 |
+
|
| 565 |
+
where $\lambda _ { \mathrm { E D A } }$ is a scaling parameter that we set to 5. When the alternate sequence contains gaps, we construct a chimeric sequence that substitutes those sites with the query. This strategy increased the number of available sequence-structure pairs by several orders of magnitude, and we used it for both profile and 1-seq based training.
|
| 566 |
+
|
| 567 |
+
# C APPENDIX C: RESULTS
|
| 568 |
+
|
| 569 |
+
# C.1 STRUCTURE GENERATION AND PROCESSING
|
| 570 |
+
|
| 571 |
+
For each sequence from the CATH release 4.2 dataset, 100 structures were generated from both the profile and sequence-only models, while a single structure was generated from the RNN baseline models. The reported TM-scores were calculated using Maxcluster (Siew et al., 2000). A single representative structure was chosen from the ensemble of 100 structures using 3D-Jury (Ginalski et al., 2003). A pairwise distance matrix of TM-scores was calculated for all of the 100 structures in the ensemble. Clusters were determined by agglomerative hierarchical clustering with complete linkage using a TM-score threshold of 0.5 to determine cluster membership.
|
| 572 |
+
|
| 573 |
+

|
| 574 |
+
Figure 10: Sampling speed. Per-protein sampling times for various batch sizes across NEMO and one of the RNN baselines on a single Tesla M40 GPU with 12GB memory and 20 cores. For all results in the main paper, 100 models were sampled per protein followed by consensus clustering with 3D-jury, adding an additional factor of $1 0 ^ { 2 }$ cost between NEMO and the RNN.
|
| 575 |
+
|
| 576 |
+

|
| 577 |
+
Figure 11: Predictive performance of structures generated by the sequence-only model. (left) Structures in the test set are hierarchically organized by CATH classification. Groups further up the tree are broader generalization. (center-left) Ensembles of models with increasing certainty tend to have a better average TM-score. (center-right) TM-score of 3D-jury-selected models versus distance from the training data. Withheld (right) Comparing the energy-based model with and without profiles. Profile information greatly improves protein model accuracy as judged by TM-score.
|
| 578 |
+
|
| 579 |
+

|
| 580 |
+
Figure 12: Generalization results upon re-stratification. Profile-based model.
|
| 581 |
+
|
| 582 |
+

|
| 583 |
+
Figure 13: RNN baseline performance for different hyperparameters. Predictive performance of the two-layer bidirectional LSTM baseline models across a range of hidden unit dimensions compared to the energy model.
|
md/train/Dx3x05MlFwj/Dx3x05MlFwj.md
ADDED
|
@@ -0,0 +1,495 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Represent Your Own Policies: Learning with Policy-extended Value Function Approximator
|
| 2 |
+
|
| 3 |
+
Anonymous Author(s)
|
| 4 |
+
Affiliation
|
| 5 |
+
Address
|
| 6 |
+
email
|
| 7 |
+
|
| 8 |
+
# Abstract
|
| 9 |
+
|
| 10 |
+
1 We study Policy-extended Value Function Approximator (PeVFA) in Reinforce
|
| 11 |
+
2 ment Learning (RL), which extends conventional value function approximator
|
| 12 |
+
3 (VFA) to take as input not only the state (and action) but also an explicit policy
|
| 13 |
+
4 representation. Such an extension enables $\mathrm { P e V F A }$ to preserve values of multi
|
| 14 |
+
5 ple policies at the same time and brings an appealing characteristic, i.e., value
|
| 15 |
+
6 generalization among policies. We formally analyze the value generalization un
|
| 16 |
+
7 der Generalized Policy Iteration (GPI). From theoretical and empirical lens, we
|
| 17 |
+
8 show that generalized value estimates offered by PeVFA may have lower initial
|
| 18 |
+
9 approximation error to true values of successive policies, which is expected to
|
| 19 |
+
10 improve consecutive value approximation during GPI. Based on above clues, we
|
| 20 |
+
11 introduce a new form of GPI with PeVFA which leverages the value generalization
|
| 21 |
+
12 along policy improvement path. Moreover, we propose a representation learning
|
| 22 |
+
13 framework for RL policy, providing several approaches to learn effective policy em
|
| 23 |
+
14 beddings from policy network parameters or state-action pairs. In our experiments,
|
| 24 |
+
15 we evaluate the efficacy of value generalization offered by PeVFA and policy
|
| 25 |
+
16 representation learning in several OpenAI Gym continuous control tasks. For a
|
| 26 |
+
17 representative instance of algorithm implementation, Proximal Policy Optimization
|
| 27 |
+
18 (PPO) re-implemented under the paradigm of GPI with PeVFA achieves about $40 \%$
|
| 28 |
+
19 performance improvement on its vanilla counterpart in most environments.
|
| 29 |
+
|
| 30 |
+
# 20 1 Introduction
|
| 31 |
+
|
| 32 |
+
21 Reinforcement Learning (RL) has been widely considered as a promising way to learn optimal
|
| 33 |
+
22 policies in many decision-making problems [35, 31, 53, 65, 47, 62, 16]. One fundamental element of
|
| 34 |
+
23 RL is value function which defines the long-term evaluation of a policy. With function approximation
|
| 35 |
+
24 (e.g., deep neural networks), a value function approximator (VFA) is able to approximate the values
|
| 36 |
+
25 of a policy under large and continuous state spaces. As commonly recognized, most RL algorithms
|
| 37 |
+
26 can be described as Generalized Policy Iteration (GPI) [55]. As illustrated on the left of Figure 1,
|
| 38 |
+
27 at each iteration the VFA is trained to approximate the true values of current policy (i.e., policy
|
| 39 |
+
28 evaluation), regarding which the policy is further improved (i.e., policy improvement). The value
|
| 40 |
+
29 function approximation error hinders the effectiveness of policy improvement and then the overall
|
| 41 |
+
30 optimality of GPI [5, 46]. Unfortunately, such errors are inevitable under function approximation. A
|
| 42 |
+
31 large number of samples are usually required to ensure high-quality value estimates, resulting in the
|
| 43 |
+
32 sample-inefficiency of deep RL algorithms. Therefore, this raises an urgent need for more efficient
|
| 44 |
+
33 value approximation methods [61, 4, 12, 25].
|
| 45 |
+
34 An intuitive idea to improve the efficiency value approximation is to leverage the knowledge on
|
| 46 |
+
35 the values of previous encountered policies. However, a conventional VFA usually approximates
|
| 47 |
+
36 the values of one policy and values learned from old policies are over-written gradually during
|
| 48 |
+
37 the learning process. This means that the previously learned knowledge cannot be preserved and
|
| 49 |
+
38 utilized with one conventional VFA. Thus, such limitations prevent the potentials to leverage the
|
| 50 |
+
39 previous knowledge for future learning. In this paper, we study Policy-extended Value Function
|
| 51 |
+
40 Approximator (PeVFA), which additionally takes an explicit policy representation as input in contrast
|
| 52 |
+
41 to conventional VFA. Thanks to the policy representation input, PeVFA is able to approximate values
|
| 53 |
+
42 for multiple policies and induces value generalization among policies. We formally analyze the
|
| 54 |
+
43 generalization of approximate values among policies in a general form. From both theoretical and
|
| 55 |
+
44 empirical lens, we show that the generalized value estimates can be closer to the true values of
|
| 56 |
+
45 the successive policy, which can be beneficial to consecutive value approximation along the policy
|
| 57 |
+
46 improvement path, called local generalization. Based on above clues, we introduce a new form
|
| 58 |
+
47 of GPI with PeVFA (the right of Figure 1) that leverages the local generalization to improve the
|
| 59 |
+
48 efficiency of consecutive value approximation along the policy improvement path.
|
| 60 |
+
49 One key point of GPI with PeVFA is the representation of policy since it determines how PeVFA gen
|
| 61 |
+
50 eralizes the values. For this, we propose a framework to learn effective low-dimensional embedding
|
| 62 |
+
51 of RL policy. We use network parameters or state-action pairs as policy data and encode them into
|
| 63 |
+
52 low-dimensional embeddings; then the embeddings are trained to capture the effective information
|
| 64 |
+
53 through contrastive learning and policy recovery. Finally, we evaluate the efficacy of GPI with PeVFA
|
| 65 |
+
54 and our policy representations. In principle, GPI with PeVFA is general and can be implemented
|
| 66 |
+
55 in different ways. As a practical instance, we re-implement Proximal Policy Optimization (PPO)
|
| 67 |
+
56 with PeVFA and propose PPO-PeVFA algorithm. Our experimental results on several OpenAI Gym
|
| 68 |
+
57 continuous control tasks demonstrate the effectiveness of both value generalization offered by PeVFA
|
| 69 |
+
58 and learned policy representations, with an about $40 \%$ improvement in average returns achieved by
|
| 70 |
+
59 our best variants on standard PPO in most tasks.
|
| 71 |
+
60 We summarize our main contributions below. 1) We study the value generalization among policies
|
| 72 |
+
61 induced by PeVFA. From both theoretical and empirical aspects, we shed the light on the situations
|
| 73 |
+
62 where the generalization can be beneficial to the learning along policy improvement path. 2) We
|
| 74 |
+
63 propose a framework for policy representation learning. To our knowledge, we make the first attempt
|
| 75 |
+
64 to learn a low-dimensional embedding of over $1 0 \mathrm { k }$ network parameters for an RL policy. 3) We
|
| 76 |
+
65 introduce GPI with PeVFA that leverages the value generalization in a general form. Our experimental
|
| 77 |
+
66 results demonstrate the potential of PeVFA in deriving practical and more effective RL algorithms.
|
| 78 |
+
|
| 79 |
+

|
| 80 |
+
Figure 1: Generalized Policy Iteration (GPI) with function approximation. Left: GPI with conventional value function approximator $V _ { \phi }$ . Right: GPI with PeVFA $\mathbb { V } _ { \theta } ( \chi _ { \pi } )$ (Sec. 3) where extra generalization steps exist. The subscripts of policy $\pi$ and value function parameters $\phi , \theta$ denote the iteration number. The squiggle lines represent non-perfect approximation of true values.
|
| 81 |
+
|
| 82 |
+
# 67 2 Related Work
|
| 83 |
+
|
| 84 |
+
68 Extensions of Conventional Value Function. Sutton et al. [56] propose General Value Functions
|
| 85 |
+
69 (GVFs) as a general form of knowledge representation of rewards and arbitrary cumulants. Later,
|
| 86 |
+
70 conventional value functions are extended to take extra inputs for different purposes of generalization.
|
| 87 |
+
71 One notable work is Universal Value Function Approximator (UVFA) [45], which is proposed to
|
| 88 |
+
72 generalize values among different goals for goal-conditioned RL. UVFA is further developed in
|
| 89 |
+
73 [1, 37, 9] and influences the occurrence of other value function extensions in context-based Meta-RL
|
| 90 |
+
74 [43, 29], Hierarchical RL [64] and multiagent RL [19, 14] and etc. Most of the above works study
|
| 91 |
+
75 how to generalize the policy or value function among extrinsic factors, i.e., environments, tasks and
|
| 92 |
+
76 opponents; while we mainly study the value generalization among policies along policy improvement
|
| 93 |
+
77 path, an intrinsic learning process of the agent itself.
|
| 94 |
+
78 Policy Embedding and Representation. Although not well studied, representation (or embedding)
|
| 95 |
+
79 learning for RL policies is involved in a few works [18, 14, 3]. The most common way to learn a
|
| 96 |
+
80 policy representation is to extract from interaction experiences. As a representative, Grover et al. [14]
|
| 97 |
+
81 propose learning the representation of opponent policy from interaction trajectories with a generative
|
| 98 |
+
82 policy recovery loss and a discriminative triplet loss. These losses are later adopted in [64, 42].
|
| 99 |
+
83 Another straightforward idea is to represent policy parameters. Network Fingerprint [17] is such a
|
| 100 |
+
84 differentiable representation that uses the concatenation of the vectors of action distribution outputted
|
| 101 |
+
85 by policy network on a set of probing states. The probing state set is co-optimized along with the
|
| 102 |
+
86 primary learning objective, which can be non-trivial especially when the dimensionality of the set is
|
| 103 |
+
87 high. Besides, some early attempts in learning low-dimensional embedding of policy parameters are
|
| 104 |
+
88 studies in Evolutionary Algorithms [13, 44], mainly with the help of VAE [23]. Our work introduce a
|
| 105 |
+
89 learning framework of policy representation including both above two perspectives.
|
| 106 |
+
90 PVN and PVFs. Recently, several works study the generalization among policy space. Harb et al.
|
| 107 |
+
91 [17] propose Policy Evaluation Network (PVN) to directly approximate the distribution of policy
|
| 108 |
+
92 $\pi$ ’s objective function $J ( \pi ) = \mathbb { E } _ { \rho _ { 0 } } [ v ^ { \pi } ( s _ { 0 } ) ]$ with initial state $s _ { 0 } \sim \rho _ { 0 }$ . PVN takes as input Network
|
| 109 |
+
93 Fingerprint (mentioned above) of policy network. After training on a pre-collected set of policies, a
|
| 110 |
+
94 random initialized policy can be optimized in a zero-shot manner with the policy gradients of PVN by
|
| 111 |
+
95 backpropagting through the differentiable policy input. We call such gradients GTPI for short below.
|
| 112 |
+
96 Similar ideas are later integrated with task-specific context learning in multi-task RL [42], leveraging
|
| 113 |
+
97 the generalization among policies and tasks for fast policy adaptation on new tasks. In PVN [17],
|
| 114 |
+
98 as an early attempt, the generalization among policies is studied with small policy network and
|
| 115 |
+
99 simple tasks; besides, the most regular online learning setting is not studied. Concurrent to our work,
|
| 116 |
+
100 Faccio and Schmidhuber [10] propose a class of Parameter-based Value Functions (PVFs) that take
|
| 117 |
+
101 vectorized policy parameters as inputs. Based on PVFs, new policy gradient algorithms are introduced
|
| 118 |
+
102 in the form of a combination of conventional policy gradients and GTPI (i.e., by backpropagating
|
| 119 |
+
103 through policy parameters in PVFs). Except for zero-shot policy optimization as conducted in PVN,
|
| 120 |
+
104 PVFs are also evaluated for online policy learning. Due to directly taking parameters as input, PVFs
|
| 121 |
+
105 suffer from the curse of dimensionality when the number of parameters is high. Besides, GTPI can
|
| 122 |
+
106 be non-trivial to rein since policy parameter space are complex and extrapolation generalization
|
| 123 |
+
107 error can be large when the value function is only trained on finite policies (usually much fewer than
|
| 124 |
+
108 state-action samples) thus further resulting in erroneous policy gradients.
|
| 125 |
+
109 Our work differs with PVFs from several aspects. First, we make use of learned policy representation
|
| 126 |
+
110 rather than policy network parameters. Second, we do not resort to GTPI for the policy update
|
| 127 |
+
111 in our algorithms but focus on utilizing value generalization for more efficient value estimation in
|
| 128 |
+
112 GPI. Furthermore, we shed the light on two important problems — how value generalization among
|
| 129 |
+
113 policies can happen formally and whether it is beneficial to learning or not — which are neglected in
|
| 130 |
+
114 in previous works from both theoretical and empirical lens.
|
| 131 |
+
|
| 132 |
+
# 115 3 Policy-extended Value Function Approximator
|
| 133 |
+
|
| 134 |
+
116 In this section, we propose Policy-extended Value Function Approximator (PeVFA), an extension
|
| 135 |
+
117 of conventional VFA that explicitly takes as input a policy representation. First, we introduce the
|
| 136 |
+
118 formulation (Sec. 3.1), then we study value generalization among policies theoretically (Sec. 3.2)
|
| 137 |
+
119 along with some empirical evidences (Sec. 3.3). Finally, we derive a new form of GPI (Sec. 3.4).
|
| 138 |
+
|
| 139 |
+
# 3.1 Formulation
|
| 140 |
+
|
| 141 |
+
121 Consider a Markov Decision Process (MDP) defined as $\langle S , \mathcal { A } , r , \mathcal { P } , \gamma \rangle$ where $s$ is the state space, $\mathcal { A }$
|
| 142 |
+
122 is the action space, $r$ is the (bounded) reward function, $\mathcal { P }$ is the transition function and $\gamma \in [ 0 , 1 )$ is
|
| 143 |
+
123 the discount factor. A policy $\pi \in P ( { \cal A } ) ^ { | S | }$ defines the distribution over all actions for each state. The
|
| 144 |
+
124 goal of an RL agent is to find an optimal policy $\pi ^ { * }$ that maximizes the expected long-term discounted
|
| 145 |
+
125 126 return. The state-vafollowing the policy $\pi$ e function from a st $v ^ { \pi } ( s )$ $s$ $\begin{array} { r } { v ^ { \pi } ( s ) = \mathbb { E } _ { \pi } \left[ \sum _ { t = 0 } ^ { \infty } \bar { \gamma } ^ { t } r _ { t + 1 } \vert s _ { 0 } = s \right] } \end{array}$ ted return for where $r _ { t + 1 } = r ( s _ { t } , a _ { t } )$
|
| 146 |
+
127 to denote the vectorized form of value function.
|
| 147 |
+
128 In a general form, we define policy-extended value function $\mathbb { V } : \mathcal { S } \times \Pi \mathbb { R }$ over state and policy
|
| 148 |
+
129 space: $\mathbb { V } ( s , \pi ) = v ^ { \pi } ( s )$ for all $s \in { \mathcal { S } }$ and $\pi \in \Pi$ . In this paper, we focus on $\mathbb { V } ( s , \pi )$ and policy
|
| 149 |
+
130 extended action-value function $\mathbb { Q } ( s , a , \pi )$ can be obtained similarly. We use $\mathbb { V } ( \pi )$ to denote the value
|
| 150 |
+
131 vector for all states in the following. The key point is that PeVFA $\mathbb { V }$ is able to preserve the values of
|
| 151 |
+
132 multiple policies. With function approximation, a $\mathrm { P e V F A }$ is expected to approximate the values of
|
| 152 |
+
133 policies among policy space, i.e., $\bar { \{ V ^ { \pi } \} } _ { \pi \in \Pi }$ and then enable value generalization among policies.
|
| 153 |
+
134 Formally, given a function $g : \Pi \mathcal { X } \subseteq \mathbb { R } ^ { n }$ that maps any policy $\pi$ to an $n$ -dimensional represen
|
| 154 |
+
135 tation $\chi _ { \pi } \bar { = } g ( \pi ) \in \mathcal X$ , a PeVFA $\mathbb { V } _ { \theta }$ with parameter $\theta \in \Theta$ is to minimize the approximation error
|
| 155 |
+
136 over all possible states and policies generally:
|
| 156 |
+
|
| 157 |
+

|
| 158 |
+
Figure 2: Illustrations of value generalization among policies of $\mathrm { P e V F A }$ . Each circle denotes value function (estimate) of a policy. (a) Global Generalization: values learned from known policies can be generalized to unknown policies. (b) Local Generalization: values of previous policies (e.g., $\pi _ { t }$ ) can be generalized to successive policies (e.g., $\pi _ { t + 1 }$ ) along policy improvement path.
|
| 159 |
+
|
| 160 |
+
$$
|
| 161 |
+
F _ { \mu , p , \rho } ( \theta , g , \Pi ) = \sum _ { \pi \in \Pi } \mu ( \pi ) \| \mathbb { V } _ { \theta } ( \chi _ { \pi } ) - V ^ { \pi } \| _ { p , \rho } ,
|
| 162 |
+
$$
|
| 163 |
+
|
| 164 |
+
137 where $\mu , \rho$ are distributions over policies and states respectively, $\begin{array} { r } { \| f \| _ { p , \rho } = ( \int _ { s } \rho ( \mathrm { d } s ) | f ( s ) | ^ { p } ) ^ { 1 / p } } \end{array}$ is
|
| 165 |
+
138 $\rho$ -weighted $L _ { p }$ -norm [26, 46] for any $f : S \mathbb { R }$ . The policy distribution $\mu$ of interest depends on
|
| 166 |
+
139 the scenario where value generalization is considered. As illustrated in Figure 2, we provide two
|
| 167 |
+
140 value generalization scenarios. In the global generalization scenario, a uniform distribution over
|
| 168 |
+
141 known policy set may be considered with a general purpose of value generalization for unknown
|
| 169 |
+
142 policies. For the specific local generalization scenario along policy improvement path during GPI, a
|
| 170 |
+
143 sophisticated distribution that adaptively weights recent policies more during the learning process
|
| 171 |
+
144 may be more suitable in this case. In the following, we care more about the local generalization
|
| 172 |
+
145 scenario and use uniform state distribution $\rho$ and $L _ { 2 }$ -norm for demonstration. The subscripts are
|
| 173 |
+
146 omitted and we use $\| \cdot \|$ for clarity.
|
| 174 |
+
|
| 175 |
+
# 3.2 Theoretical Analysis on Value Generalization among Policies
|
| 176 |
+
|
| 177 |
+
148 In this part, we theoretically analyze the value generalization among policies induced by PeVFA. We
|
| 178 |
+
149 start from a two-policy case and study whether the value approximation learned for one policy can be
|
| 179 |
+
150 generalized to the other one. Later, we study the local generalization scenario (Figure $2 ( \mathbf { b } ) ,$ ) and shed
|
| 180 |
+
151 the light on the superiority of $\mathrm { P e V F A }$ for GPI. All the proofs are provided in Appendix A.
|
| 181 |
+
152 For the convenience of demonstration, we use an identical policy representation function, i.e., $\chi _ { \pi } = \pi$ ,
|
| 182 |
+
153 and define the approximation loss of PeVFA $\mathbb { V } _ { \theta }$ for any policy $\pi \in \Pi$ as $f _ { \theta } ( \pi ) = \| \mathbb { V } _ { \theta } ( \pi ) - V ^ { \bar { \pi } } \| \ge 0$ .
|
| 183 |
+
154 We use the following definitions for a formal description of value approximation process with PeVFA
|
| 184 |
+
155 and local property of loss function $f _ { \theta }$ that influences generalization [40, 63] respectively:
|
| 185 |
+
156 Definition 1 ( $\pi$ -Value Approximation) We define a value approximation process $\mathcal { P } _ { \pi } : \Theta \to \Theta$
|
| 186 |
+
157 with PeVFA as a $\gamma$ -contraction mapping on the approximation loss for policy $\pi$ , i.e., for $\hat { \theta } = \mathcal { P } _ { \pi } ( \theta )$ ,
|
| 187 |
+
158 we have $f _ { \hat { \theta } } ( \pi ) \leq \gamma f _ { \theta } ( \pi )$ where $\gamma \in [ 0 , 1 )$ .
|
| 188 |
+
|
| 189 |
+
Definition 2 ( $L$ -Continuity) We call $f _ { \theta }$ is $L$ -continuous at policy $\pi$ if fθ is Lipschitz continuous at π with a constant $L \in [ 0 , \infty )$ , i.e., $| f _ { \theta } ( { \boldsymbol \pi } ) - f _ { \theta } ( { \boldsymbol \pi } ^ { \prime } ) | \leq L \cdot d ( { \boldsymbol \pi } , { \boldsymbol \pi } ^ { \prime } )$ for $\pi ^ { \prime } \in \Pi$ with some distance metric d for policy space $\Pi$ .
|
| 190 |
+
|
| 191 |
+
162 With Definition 1, the consecutive value approximation for the policies along policy improvement path
|
| 192 |
+
163 during GPI can be described as: $\theta _ { - 1 } \xrightarrow { \mathcal { P } _ { \pi _ { 0 } } } \theta _ { 0 } \xrightarrow { \mathcal { P } _ { \pi _ { 1 } } } \theta _ { 1 } \xrightarrow { \mathcal { P } _ { \pi _ { 2 } } } \dots ,$ , as the green arrows illustrated in
|
| 193 |
+
164 Figure 1. One may refer to Appendix A.1 for a discussion on the rationality of the two definitions.
|
| 194 |
+
65 To start our analysis, we first study the generalized value approximation loss in a two-policy case
|
| 195 |
+
166 where only the value of policy $\pi _ { 1 }$ is approximated by PeVFA as below:
|
| 196 |
+
|
| 197 |
+
Lemma 1 For 67 $\theta \xrightarrow { \mathcal { P } _ { \pi _ { 1 } } } \hat { \theta } .$ , if $f _ { \hat { \theta } }$ is $\hat { L }$ -continuous at $\pi _ { 1 }$ and $f _ { \theta } ( \pi _ { 1 } ) \le f _ { \theta } ( \pi _ { 2 } )$ , we have: $f _ { \hat { \theta } } ( \pi _ { 2 } ) \leq$ 68 $\gamma f _ { \theta } ( \pi _ { 2 } ) + \mathcal { M } ( \pi _ { 1 } , \pi _ { 2 } , \hat { L } )$ , where $\mathcal { M } ( \pi _ { 1 } , \pi _ { 2 } , \hat { L } ) = \hat { L } \cdot d ( \pi _ { 1 } , \pi _ { 2 } )$ .
|
| 198 |
+
|
| 199 |
+
Corollary 1 Pπ1 is γg-contraction (γg ∈ [0, 1)) for π2 when fθ(π2) > Lˆ·d(π1,π2)1−γ169 .
|
| 200 |
+
|
| 201 |
+
170 Lemma 1 shows that the post- $\mathcal { P } _ { \pi _ { 1 } }$ approximation loss for $\pi _ { 2 }$ is upper bounded by a generalized
|
| 202 |
+
171 contraction of prior loss plus a locality margin term $\mathcal { M }$ which is related to $\pi _ { 1 } , \pi _ { 2 }$ and the locality
|
| 203 |
+
172 property of $f _ { \hat { \theta } }$ . In general, the form of $\mathcal { M }$ depends on the local property assumed. Some higher
|
| 204 |
+
173 order variants are provided in Appendix A.2. For a step further, Corollary 1 reveals the condition
|
| 205 |
+
174 where a contraction on value approximation loss for $\pi _ { 2 }$ is achieved when $\mathrm { P e V F A }$ is only trained to
|
| 206 |
+
175 approximate the values of $\pi _ { 1 }$ . Concretely, such a condition is apt to reach with tighter contraction for
|
| 207 |
+
176 policy $\pi _ { 1 }$ is, closer two policies, or smoother approximation loss function $f _ { \hat { \theta } }$ .
|
| 208 |
+
177 Then we consider the local generalization scenario as illustrated in Figure 2(b). For any iteration $t$
|
| 209 |
+
178 of GPI, the values of current policy $\pi _ { t }$ are approximated by $\mathrm { P e V F A }$ , followed by a improved policy
|
| 210 |
+
179 $\pi _ { t + 1 }$ whose values are to be approximated in the next iteration. The value generalization from each
|
| 211 |
+
180 $\pi _ { t }$ and $\pi _ { t + 1 }$ can be similarly considered as the two-policy case. In addition to the former results, we
|
| 212 |
+
181 shed the light on the value generalization loss of PeVFA along policy improvement path below:
|
| 213 |
+
|
| 214 |
+
Lemma 2 For $\theta _ { - 1 } \xrightarrow { \mathcal { P } _ { \pi _ { 0 } } } \theta _ { 0 } \xrightarrow { \mathcal { P } _ { \pi _ { 1 } } } \theta _ { 1 } \xrightarrow { \mathcal { P } _ { \pi _ { 2 } } } . . .$ Pπ2 −−−→ . . . with γt for each Pπt , if fθt is Lˆ t-continuous at πt for any $t \geq 0$ , we have $f _ { \theta _ { t } } ( \pi _ { t + 1 } ) \leq \gamma _ { t } f _ { \theta _ { t - 1 } } ( \pi _ { t } ) + \mathcal { M } _ { t }$ , where $\mathcal { M } _ { t } = L _ { t } \cdot d ( \pi _ { t } , \pi _ { t + 1 } )$ .
|
| 215 |
+
|
| 216 |
+
Corollary 2 By induction, we have 84 $\begin{array} { r } { f _ { \theta _ { t } } ( \pi _ { t + 1 } ) \leq \prod _ { i = 0 } ^ { t } \gamma _ { t } f _ { \theta _ { - 1 } } ( \pi _ { 0 } ) + \sum _ { i = 0 } ^ { t - 1 } \prod _ { j = i + 1 } ^ { t } \gamma _ { j } \mathcal M _ { i } + \mathcal M _ { t } . } \end{array}$
|
| 217 |
+
|
| 218 |
+
185 The above results indicate that the value generalization loss can be recursively bounded and has
|
| 219 |
+
186 a upper bound formed by a repeated contraction on initial loss plus the accumulation of locality
|
| 220 |
+
187 margins induced from each local generalization. An infinity-case discussion for Corollary 2 is in
|
| 221 |
+
188 Appendix A.5. The next question is whether $\mathrm { P e V F A }$ with value generalization among policies is
|
| 222 |
+
189 preferable to the conventional VFA. To this end, we introduce a desirable condition which reveals the
|
| 223 |
+
190 superiority of PeVFA during consecutive value approximation along the policy improvement path:
|
| 224 |
+
|
| 225 |
+
Theorem 1 During91 $\begin{array} { r l } & { \theta _ { - 1 } \xrightarrow { \mathcal { P } _ { \pi _ { 0 } } } \theta _ { 0 } \xrightarrow { \mathcal { P } _ { \pi _ { 1 } } } \theta _ { 1 } \xrightarrow { \mathcal { P } _ { \pi _ { 2 } } } \dots , f o r a n y t \ge 0 , \ i f f _ { \theta _ { t } } ( \pi _ { t } ) + f _ { \theta _ { t } } ( \pi _ { t + 1 } ) \le } \\ & { n f _ { \theta _ { t } } ( \pi _ { t + 1 } ) \le \| \mathbb { V } _ { \theta _ { t } } ( \pi _ { t } ) - V ^ { \pi _ { t + 1 } } \| . } \end{array}$ 92 $\| V ^ { \pi _ { t } } - V ^ { \pi _ { t + 1 } } \|$ , the
|
| 226 |
+
|
| 227 |
+
193 Theorem 1 shows that the generalized value estimates $\mathbb { V } _ { \boldsymbol { \theta } _ { t } } \big ( \pi _ { t + 1 } \big )$ can be closer to the true values of
|
| 228 |
+
194 policy $\pi _ { t + 1 }$ than $\mathbb { V } _ { \theta _ { t } } ( \pi _ { t } )$ . Note that $\mathbb { V } _ { \theta _ { t } } ( \pi _ { t } )$ is the value approximation for $\pi _ { t }$ which is equivalent
|
| 229 |
+
195 to the counterpart $V _ { \phi _ { t } }$ for a conventional VFA as value generalization among policies does not
|
| 230 |
+
196 exist. To consecutive value approximation along policy improvement path, this means that the value
|
| 231 |
+
197 generalization of $\mathrm { P e V F A }$ has the potential to offer closer start points at each iteration. If such closer
|
| 232 |
+
198 start points can often exist, we expect $\mathrm { P e V F A }$ to be preferable to conventional VFA since value
|
| 233 |
+
199 approximation can be more efficient with $\mathrm { P e V F A }$ and it in turn facilitates the overall GPI process.
|
| 234 |
+
200 However, the condition in Theorem 1 is not necessarily met in practice. Intuitively, it depends on the
|
| 235 |
+
201 locality margins that may be related to function family and optimization method of PeVFA, as well
|
| 236 |
+
202 as the scale of policy improvement. We leave these further theoretical investigations for future work.
|
| 237 |
+
203 Instead, we empirically examine the existence of such desirable generalizations in the following.
|
| 238 |
+
|
| 239 |
+
# 3.3 Empirical Evidences
|
| 240 |
+
|
| 241 |
+
We empirically investigate the value generalization of PeVFA with didactic environments. In this section, PeVFA $\mathbb { V } _ { \theta }$ is parameterized by neural network and we use the concatenation of all weights and biases of the policy network as a straightforward representation $\chi _ { \pi }$ for each policy, called Raw Policy Representation $( R P R )$ . Experimental details are provided in Appendix B.
|
| 242 |
+
|
| 243 |
+
209 First, we demonstrate the global generalization (illustrated in Figure 2(a)) in a continuous 2D Point
|
| 244 |
+
210 Walker environment. We build the policy set $\Pi$ with synthetic policies, each of which is a randomly
|
| 245 |
+
211 initialized 2-layer tanh-activated neural network with 2 units for each layer. The size of $\Pi$ is $2 0 \mathrm { k }$ and
|
| 246 |
+
212 the behavioral diversity of synthetic policies is verified (see Figure 7(b) in Appendix). We divide $\Pi$
|
| 247 |
+
213 into training set (i.e., known policies $\Pi _ { 0 }$ ) and testing set (i.e., unseen policies $\Pi _ { 1 }$ ). We rollout the
|
| 248 |
+
|
| 249 |
+

|
| 250 |
+
Figure 3: Empirical evidences of two kinds of generalization of $\mathrm { P e V F A }$ . (a) Global generalization: $\mathrm { P e V F A }$ shows comparable value estimation performance on testing policy set (red) after learning on training policy set (blue). (b) Local generalization: PeVFA $( \mathbb { V } _ { \theta } ( \chi _ { \pi } ) )$ shows lower losses than conventional VFA $( V _ { \phi } )$ before and after the value approximation training for successive policies along policy improvement path. In (b), the left axis is for approximation loss (lower is better) and the right axis is for average return as a reference of the policy learning process (green curve).
|
| 251 |
+
|
| 252 |
+
policies in the environment to collect trajectories, based on which we perform value approximation training. Our results show that a PeVFA trained on $\Pi _ { 0 }$ achieves reasonable generalization performance when evaluating on $\Pi _ { 1 }$ . The average losses on training and testing set are 1.782 and 2.071 over 6 trials. Figure 3(a) shows the value predictions for policies from training and testing set (100 for each).
|
| 253 |
+
|
| 254 |
+
Next, we investigate the value generalization along policy improvement path, i.e., local generalization as in Figure 2(b). We use a 2-layer 8-unit policy network trained by standard PPO algorithm [50] in MuJoCo continuous control tasks. Parallel to the conventional value network $V _ { \phi } ( s )$ (i.e., VFA) in PPO, we set a $\mathrm { P e V F A }$ network $\mathbb { V } _ { \theta } ( s , \chi _ { \pi } )$ as a reference for the comparison on value approximation loss. Compared to $V _ { \phi }$ , PeVFA $\mathbb { V } _ { \theta } ( s , \chi _ { \pi } )$ takes RPR as input and approximates the values of all historical policies $( \{ \pi _ { i } \} _ { i = 0 } ^ { t } )$ in addition. We compare the value approximation losses of $V _ { \phi }$ (red) and $\mathbb { V } _ { \theta }$ (blue) before (solid) and after (dashed) updating with on-policy samples collected by the improved policy $\pi _ { t + 1 }$ at each iteration. Figure 3(b) shows the results for InvertedPendulum-v1 and Ant-v1. Results for all 7 MuJoCo tasks can be found in Appendix B.2. By comparing approximation losses before updating (red and blue solid curves), we can observe that the approximation loss of $\mathbb { V } _ { \theta _ { t } } ( \chi _ { \pi _ { t + 1 } } )$ is almost consistently lower than that of $V _ { \phi _ { t } }$ . This means that the generalized value estimates offered by PeVFA are usually closer to the true values of $\pi _ { t + 1 }$ , demonstrating the consequence arrived in Theorem 1. For the dashed curves, it shows that PeVFA $\mathbb { V } _ { \theta _ { t + 1 } } ( \chi _ { \pi _ { t + 1 } } )$ can achieve lower approximation loss for $\pi _ { t + 1 }$ than conventional VFA $V _ { \phi _ { t + 1 } }$ after the same number of training with the same on-policy samples. The empirical evidence above indicates that $\mathrm { P e V F A }$ can be preferable to the conventional VFA for consecutive value approximation. The generalized value estimates along policy improvement path have the potential to expedite the process of GPI.
|
| 255 |
+
|
| 256 |
+
# 3.4 Reinforcement Learning with PeVFA
|
| 257 |
+
|
| 258 |
+
Based on the results above, we expect to leverage the value generalization of $\mathrm { P e V F A }$ to facilitate RL. In Algorithm 1, we propose a general description of RL algorithm under the paradigm of GPI with PeVFA. For each iteration, the interaction experiences of current policy and the policy
|
| 259 |
+
|
| 260 |
+
# Algorithm 1 RL under the paradigm of GPI with PeVFA $( \mathbb { V } ( s , \chi _ { \pi } )$ is used for demonstration)
|
| 261 |
+
|
| 262 |
+
1: Initialize policy $\pi _ { 0 }$ , policy representation model $g , \mathrm { P e V F A } \ \mathbb { V } _ { - 1 }$ and experience buffer $\mathcal { D }$
|
| 263 |
+
2: 3: for iteration Rollout $t = 0 , 1 , \ldots$ $\pi _ { t }$ dohe environment and obtain $k$ trajectories $\mathcal { T } _ { t } = \{ \tau _ { i } \} _ { i = 0 } ^ { k }$
|
| 264 |
+
4: Get representation $\chi _ { \pi _ { t } } = g ( \pi )$ for policy $\pi _ { t }$ and add experiences $( \chi _ { \pi _ { t } } , \tau _ { t } )$ in buffer $\mathcal { D }$
|
| 265 |
+
5: if $t \%$ $M = 0$ then
|
| 266 |
+
6: Update PeVFA $\mathbb { V } _ { t - 1 } ( s , \chi _ { \pi _ { i } } )$ for previous policies with data $\{ ( \chi _ { \pi _ { i } } , T _ { i } ) \} _ { i = 0 } ^ { t - 1 }$
|
| 267 |
+
7: Update policy representation model $g$ , e.g., with approaches provided in Sec. 4
|
| 268 |
+
8: end if
|
| 269 |
+
9: Update PeVFA $\mathbb { V } _ { t - 1 } ( s , \chi _ { \pi _ { t } } )$ for current policy $\chi _ { \pi _ { t } }$ and set $\mathbb { V } _ { t } \longleftarrow \mathbb { V } _ { t - 1 }$
|
| 270 |
+
10: Update $\pi _ { t }$ w.r.t $\mathbb { V } _ { t } ( s , \chi _ { \pi _ { t } } )$ by policy improvement algorithm and set $\pi _ { t + 1 } \longleftarrow \pi _ { t }$
|
| 271 |
+
11: end for
|
| 272 |
+
239 representation are stored in a buffer (line 3-4). At an interval of $M$ iterations, PeVFA is trained via
|
| 273 |
+
240 value approximation for previous policies with the stored data and the policy representation model
|
| 274 |
+
241 is updated according to the method used (line 5-8). This part is unique to PeVFA for preservation
|
| 275 |
+
242 and generalization of knowledge of historical policies. Next, value approximation for current policy
|
| 276 |
+
243 is performed with $\mathrm { P e V F A }$ (line 9). A key difference here is that the generalized value estimates
|
| 277 |
+
244 (i.e., $\mathbb { V } _ { t - 1 } ( \chi _ { \pi _ { t } } ) )$ are used as start points. Afterwards, a successive policy is obtained from typical
|
| 278 |
+
245 policy improvement (line 10). Algorithm 1 can be implemented in different ways and we propose an
|
| 279 |
+
246 instance implemented based on PPO [50] in our experiments later. In the next section, we introduce
|
| 280 |
+
247 our methods for policy representation learning.
|
| 281 |
+
|
| 282 |
+

|
| 283 |
+
Figure 4: The framework of policy representation training. Policy network parameters used for OPR or policy state-action pairs used for SPR are fed into policy encoder with permutation-invariant (PI) transformations followed by an MLP, producing the representation $\chi _ { \pi }$ . Afterwards, $\chi _ { \pi }$ can be trained by gradients from the value approximation loss of $\mathrm { P e V F A }$ (i.e., End-to-End), as well as (optionally) the auxiliary loss of policy recovery or the contrastive learning (i.e., InfoNCE) loss.
|
| 284 |
+
|
| 285 |
+
# 248 4 Policy Representation Learning
|
| 286 |
+
|
| 287 |
+
To derive practical deep RL algorithms, one key point is policy representation, i.e., a low-dimensional embedding of RL policy. Intuitively, policy representation influences the approximation and generalization of PeVFA. Thus, it is of interest to find an effective policy representation based on which the superiority of PeVFA can be leveraged to improve RL algorithms. To our knowledge, policy representation is not well studied and it remains unclear on how to obtain an effective representation for an RL policy in a general case in practice. In previous section, we demonstrate the effectiveness of using policy parameters as a naive representation when policy network is small, called RPR. However, a usual policy network may have large number of parameters, thus making it inefficient and even irrational to use RPR for approximation and generalization [17, 10]. More generally, policy parameters of the policy we wish to represent may not be accessible.
|
| 288 |
+
|
| 289 |
+
259 To this end, we propose a general framework of policy representation learning as illustrated in Figure
|
| 290 |
+
260 4. The first thing to consider is data source, i.e., from which we can extract the information for an
|
| 291 |
+
261 effective policy representation. Recall that the policy is a distribution over state and action space
|
| 292 |
+
262 of high dimensionality. The features of such a distribution is not directly available. Therefore, we
|
| 293 |
+
263 consider two kinds of data source below that indirectly contains the information of policies: 1) Surface
|
| 294 |
+
264 Policy Representation $( S P R )$ : The first data source is state-action pairs (or trajectories [14]), since
|
| 295 |
+
265 they reflect how policy may behave under such states. This data source is general since no explicit
|
| 296 |
+
266 form of policy is assumed. In a geometric view, learning policy representation from state-action pairs
|
| 297 |
+
267 can be viewed as capturing the features of policy via scattering sample points on the curved surface
|
| 298 |
+
268 of policy distribution. 2) Origin Policy Representation (OPR): The other data source is parameters of
|
| 299 |
+
269 policy since they determine the underlying form of policy distribution. Such a data source is often
|
| 300 |
+
270 available during the learning process of deep RL algorithms when policy is parameterized by neural
|
| 301 |
+
271 networks. Generally, we consider a policy network to be an MLP with well represented state features
|
| 302 |
+
272 (e.g., features extracted by CNN for pixels or by LSTM for sequences) as input.
|
| 303 |
+
273 The remaining question is how we extract the policy representation from the data sources mentioned
|
| 304 |
+
274 above. As shown in Figure 4, we use permutation-invariant (PI) transformations followed by an
|
| 305 |
+
275 MLP to encode the data of policy $\pi$ into an embedding $\chi _ { \pi }$ for both SPR and OPR. For SPR, each
|
| 306 |
+
|
| 307 |
+
276 state-action pair of $\{ ( s _ { i } , a _ { i } ) \} _ { i = 1 } ^ { k }$ is fed into a common MLP, followed by a Mean-Reduce operation on the outputted features across $k$ . For OPR, we perform PI transformation (similar as done for state-action pairs) inner-layer weights and biases $\{ ( w _ { i } , b _ { i } ) \} _ { i = 1 } ^ { h }$ for each layer first, where $h$ denotes the number of nodes in this layer and $w _ { i } , b _ { i }$ is the income weight vector from previous layer and the bias of ith node; then we concatenate encoding of layers and obtain the OPR. A illustrative description for the encoding of OPR is in Figure 12 of Appendix.
|
| 308 |
+
|
| 309 |
+
To train the policy embedding $\chi _ { \pi }$ obtained above, the most straightforward way is to backpropagate the value approximation loss of $\mathrm { P e V F A }$ in an End-to-End $( E 2 E )$ fashion as illustrated on the lowerright of Figure 4. In addition, we provide two self-supervised training losses for both OPR and SPR, as illustrated on the upper-right of Figure 4. The first one is an auxiliary loss (AUX) of policy recovery [14], i.e., to recover the action distributions of $\pi$ from $\chi _ { \pi }$ under different states. To be specific, an auxiliary policy decoder $\bar { \pi } ( \cdot | s , \chi _ { \pi } )$ is trained through behavioral cloning, formally to minimize cross-entropy objective $\mathcal { L } _ { \mathrm { A U X } } = - \mathbb { E } _ { ( s , a ) } \left[ \log \bar { \pi } ( a | s , \chi _ { \pi } ) \right]$ . For the second one, we propose to train $\chi _ { \pi }$ by Contrastive Learning $( C L )$ [54, 51]: policies are encouraged to be close to similar ones (i.e., positive samples $\pi ^ { + }$ ), and to be apart from different ones (i.e., negative samples $\pi ^ { - }$ ) in representation space. For each policy, we construct positive samples by data augmentation on policy data, depending on SPR or OPR considered; and different policies along the policy improvement path naturally the InfoNCE loss [41] below: provide negative samples for each other. Finally, the embedding $\begin{array} { r } { \mathcal { L } _ { \mathrm { C L } } = - \mathbb { E } _ { ( \pi ^ { + } , \{ \pi ^ { - } \} ) } \left[ \log \frac { \exp ( \chi _ { \pi } ^ { T } W \chi _ { \pi ^ { + } } ) } { \exp ( \chi _ { \pi } ^ { T } W \chi _ { \pi ^ { + } } ) + \sum _ { \pi ^ { - } } \exp ( \chi _ { \pi } ^ { T } W \chi _ { \pi ^ { - } } ) } \right] . } \end{array}$ $\chi _ { \pi }$ is optimized through minimizing
|
| 310 |
+
|
| 311 |
+
Now, the training of policy representation model in Algorithm 1 can be performed with any combination of data sources and training losses provided above. A pseudo-code of the overall policy representation training framework and complete implementation details are provided in Appendix D.
|
| 312 |
+
|
| 313 |
+
# 5 Experiments
|
| 314 |
+
|
| 315 |
+
In this section, we conduct experimental study with focus on the following questions:
|
| 316 |
+
|
| 317 |
+
Question 1 Can value generalization offered by PeVFA improve a deep RL algorithm in practice? Question 2 Can our proposed framework to learn effective policy representation?
|
| 318 |
+
|
| 319 |
+
Our experiments are conducted in several OpenAI Gym continuous control tasks (one from Box2D and five from MuJoCo) [6, 58]. All experimental details and curves can be found in Appendix B.
|
| 320 |
+
|
| 321 |
+
Algorithm Implementation. We use PPO [50] as the basic algorithm and propose a representative implementation of Algorithm 1, called PPO-PeVFA. PPO is a policy optimization algorithm that follows the paradigm of GPI (Figure 1, left). A value network $V _ { \phi } ( s )$ with parameters $\phi$ (i.e., conventional VFA) is trained to approximate the value of current policy $\pi$ ; while $\pi$ is optimized with respect to a surrogate objective [48] using advantages calculated by $V _ { \phi }$ and GAE [49]. Compared with original PPO, PPO-PeVFA makes use of a $\mathrm { P e V F A }$ network $\mathbb { V } _ { \theta } ( s , \chi _ { \pi } )$ with parameters $\theta$ rather than the conventional VFA $V _ { \phi } ( s )$ , and follows the training scheme as in Algorithm 1. Note PPO-PeVFA uses the same policy optimization method as original PPO and only differs at value approximation.
|
| 322 |
+
|
| 323 |
+
Baselines and Variants. Except for original PPO as a default baseline, we use another two baselines: 1) PPO-PeVFA with randomly generated policy representation for each policy, denoted by Ran PR; 2) PPO-PeVFA with Raw Policy Representation (RPR), i.e., use the vector of all parameters of policy network as representation as adopted in PVFs [10]. Our variants of PPO-PeVFA differ at the policy representation used. In total, we consider 6 variants denoted by the combination of the policy data choice (i.e., OPR, SPR) and representation principle choice (i.e., E2E, CL, AUX).
|
| 324 |
+
|
| 325 |
+
Experimental Details. For all baselines and variants, we use a normal-scale policy network with 2 layers and 64 units for each layer, resulting in over $3 \mathrm { k }$ to 10k (e.g., Ant-v1) policy parameters depending on the environments. We do not assume the access to pre-collected policies. Thus the size of policy set increases from 1 (i.e., the initial policy) during the learning process, to about 1k to 2 for a single trial. The dimensionality of all kinds of policy representation expect for RPR is set to 64. The buffer $D$ maintains recent $2 0 0 \mathrm { k }$ steps of interaction experience and the policy data of corresponding policy. The number of interaction step of each trial is 1M for InvDouPend-v1 and LunarLander-v2, 4M for Ant-v1 and 2M for the others.
|
| 326 |
+
|
| 327 |
+
Results. The overall experimental results are summarized in Table 1. In Figure 5, we provide aggregated results across all environments expect for InvDouPend-v1 and LunarLander-v2 (since
|
| 328 |
+
|
| 329 |
+
Table 1: Average returns $\pm$ half a std) over 10 trials for algorithms. Each result is the maximum evaluation along the training process. Top two values for each environment are bold.
|
| 330 |
+
|
| 331 |
+
<table><tr><td rowspan="2">Environments</td><td colspan="3">Benchmarks</td><td colspan="3">Origin Policy Representation (Ours)</td><td colspan="3">Surface Policy Representation (Ours)</td></tr><tr><td>PPO</td><td>Ran PR</td><td>RPR</td><td>E2E</td><td>CL</td><td>AUX</td><td>E2E</td><td>CL</td><td>AUX</td></tr><tr><td>HalfCheetah-v1</td><td>2621</td><td>2470</td><td>2325 ± 399.27</td><td>3171 ± 427.63</td><td>3725±348.55</td><td>3175±517.52</td><td>2774 ± 233.39</td><td>3349 ± 341.42</td><td>3216 ± 506.39</td></tr><tr><td>Hopper-v1</td><td>1639</td><td>1226</td><td>1097 ± 213.47</td><td>2085 ± 310.91</td><td>2351 ± 231.11</td><td>2214 ± 360.78</td><td>2227 ± 297.35</td><td>2392 ± 263.93</td><td>2577 ± 217.73</td></tr><tr><td>Walker2d-v1</td><td>1505</td><td>1269</td><td>317 ± 152.68</td><td>1856 ± 305.51</td><td>2038 ± 315.51</td><td>2044 ±316.32</td><td>1930.57 ± 456.02</td><td>2203 ± 381.95</td><td>1980 ± 325.54</td></tr><tr><td>Ant-v1</td><td>2835</td><td>2742</td><td>2143 ± 406.64</td><td>3581 ± 185.43</td><td>4019 ± 162.47</td><td>3784 ± 268.99</td><td>3173 ± 184.75</td><td>3632 ± 134.27</td><td>3397 ± 200.03</td></tr><tr><td>InvDouPend-v1</td><td>9344</td><td>9355</td><td>8856 ± 551.90</td><td>9357 ± 0.29</td><td>9355±0.64</td><td>9355±0.68</td><td>9355±0.89</td><td>9356±0.96</td><td>9355 ±1.42</td></tr><tr><td>LunarLander-v2</td><td>219</td><td>226</td><td>-22±35.08</td><td>238±3.37</td><td>239 ± 3.70</td><td>234 ± 3.47</td><td>236± 3.13</td><td>234 ± 3.13</td><td>235±5.70</td></tr></table>
|
| 332 |
+
|
| 333 |
+
28 most algorithms achieve near-optimal results), where all returns are normalized by the results of PPO
|
| 334 |
+
29 in Table 1. Full learning curves are omitted and can be found in Appendix F.2.
|
| 335 |
+
|
| 336 |
+
To Question 1. From Table 1, we can find that both PPOPeVFA w/ OPR (E2E) and PPO-PeVFA w/ SPR (E2E) outperforms PPO in all 6 tasks, and achieve over $20 \%$ improvement in Figure 5. This demonstrates the effectiveness of $\mathrm { P e V F A }$ . Moreover, the improvement is further enlarged (to about $40 \%$ ) by CL and AUX for both OPR and SPR. This indicates that the superiority of PeVFA can be further utilized with better policy representation that offers a more suitable space for value generalization.
|
| 337 |
+
|
| 338 |
+

|
| 339 |
+
Figure 5: Normalized averaged returns aggregated over 4 MuJoCo tasks.
|
| 340 |
+
|
| 341 |
+
To Question 2. In Table 1, consistent degeneration is observed for PPO-PeVFA w/ Ran PR due to the negative effects on generalization caused by the randomness and disorder of policy representation. This phenomenon seems to be more severe for PPO-PeVFA w/ RPR due to the complexity of high-dimensional parameter space. In contrast, the improvement achieved by our proposed PPO-PeVFA variants shows that effective policy representation can be learned from policy parameters (OPR) and state-action pairs (SPR) though value approximation loss (i.e., E2E) and further improved when additional selfsupervised representation learning is involved as CL and AUX. Overall, OPR slightly outperforms SPR as CL does over AUX. We hypothesize that it is due to the stochasticity of state-action pairs which serve as inputs of SPR and training samples for AUX. This reveals the space for future improvement. In addition, we visualize the learned representation in Figure 6. We can observe that policies from different trials are locally continuous and show different modes of embedding trajectories due to random initialization and optimization; while a global evolvement among trials emerges with respect to policy performance.
|
| 342 |
+
|
| 343 |
+

|
| 344 |
+
Figure 6: A t-SNE visualization for representations learned by PPO-PeVFA OPR (E2E) in Ant-v1. In total, 6k policies from 5 trials (denoted by different markers) are plotted, which are colored according to average return.
|
| 345 |
+
|
| 346 |
+
# 61 6 Conclusion and Future Work
|
| 347 |
+
|
| 348 |
+
In this paper, we propose Policy-extended Value Function Approximator (PeVFA) and study value generalization among policies. We propose a new form of GPI based on PeVFA which is potentially preferable to conventional VFA for value approximation. Moreover, we propose a general framework to learn low-dimensional embedding of RL policy. Our experiments demonstrate the effectiveness of the generalization characteristic of $\mathrm { P e V F A }$ and our proposed policy representation learning methods.
|
| 349 |
+
|
| 350 |
+
Our work opens up some research directions on value generalization among policies and policy representation. A possible future study on the theory of value generalization among policies is to consider the interplay between approximation error, policy improvement and local generalization during GPI with PeVFA. Besides, analysis on influence factors of value generalization among policies (e.g., policy representation, architecture of ${ \mathrm { P e V F A } }$ ) and other utilization of $\mathrm { P e V F A }$ are expected. For better policy representation, inspirations on OPR may be got from studies on Manifold Hypothesis of neural network; the selection of more informative state-action pairs for SPR is also worth research.
|
| 351 |
+
|
| 352 |
+
# References
|
| 353 |
+
|
| 354 |
+
[1] M. Andrychowicz, D. Crow, A. Ray, J. Schneider, R. Fong, P. Welinder, B. McGrew, J. Tobin, P. Abbeel, and W. Zaremba. Hindsight experience replay. In NeurIPS, pages 5048–5058, 2017.
|
| 355 |
+
[2] M. Andrychowicz, A. Raichuk, P. Stanczyk, M. Orsini, S. Girgin, R. Marinier, L. Hussenot, M. Geist, O. Pietquin, M. Michalski, S. Gelly, and O. Bachem. What matters in on-policy reinforcement learning? A large-scale empirical study. CoRR, abs/2006.05990, 2020. [3] I. Arnekvist, D. Kragic, and J. A. Stork. VPE: variational policy embedding for transfer reinforcement learning. In ICRA, pages 36–42, 2019.
|
| 356 |
+
[4] M. G. Bellemare, W. Dabney, and R. Munos. A distributional perspective on reinforcement learning. In ICML, volume 70, pages 449–458, 2017. [5] D. P. Bertsekas and J. N. Tsitsiklis. Neuro-dynamic programming, volume 3 of Optimization and neural computation series. 1996.
|
| 357 |
+
[6] G. Brockman, V. Cheung, L. Pettersson, J. Schneider, J. Schulman, J. Tang, and W. Zaremba. Openai gym. CoRR, abs/1606.01540, 2016. [7] T. Chen, S. Kornblith, M. Norouzi, and G. E. Hinton. A simple framework for contrastive learning of visual representations. CoRR, abs/2002.05709, 2020. [8] L. Engstrom, A. Ilyas, S. Santurkar, D. Tsipras, F. Janoos, L. Rudolph, and A. Madry. Implementation matters in deep RL: A case study on PPO and TRPO. In ICLR, 2020.
|
| 358 |
+
[9] B. Eysenbach, X. Geng, S. Levine, and R. R. Salakhutdinov. Rewriting history with inverse RL: hindsight inference for policy improvement. In NeurIPS, 2020.
|
| 359 |
+
[10] F. Faccio and J. Schmidhuber. Parameter-based value functions. CoRR, abs/2006.09226, 2020.
|
| 360 |
+
[11] H. Fu, H. Tang, J. Hao, C. Chen, X. Feng, D. Li, and W. Liu. Towards effective context for metareinforcement learning: an approach based on contrastive learning. CoRR, abs/2009.13891, 2020.
|
| 361 |
+
[12] S. Fujimoto, H. v. Hoof, and D. Meger. Addressing function approximation error in actor-critic methods. In ICML, 2018.
|
| 362 |
+
[13] A. Gaier, A. Asteroth, and J. Mouret. Discovering representations for black-box optimization. In GECCO, pages 103–111, 2020.
|
| 363 |
+
[14] A. Grover, M. Al-Shedivat, J. K. Gupta, Y. Burda, and H. Edwards. Learning policy representations in multiagent systems. In ICML, volume 80, pages 1797–1806, 2018.
|
| 364 |
+
[15] T. Haarnoja, A. Zhou, P. Abbeel, and S. Levine. Soft actor-critic: Off-policy maximum entropy deep reinforcement learning with a stochastic actor. In ICML, pages 1856–1865, 2018.
|
| 365 |
+
[16] D. Hafner, T. P. Lillicrap, J. Ba, and M. Norouzi. Dream to control: Learning behaviors by latent imagination. In ICLR, 2020.
|
| 366 |
+
[17] J. Harb, T. Schaul, D. Precup, and P. Bacon. Policy evaluation networks. CoRR, abs/2002.11833, 2020.
|
| 367 |
+
[18] K. Hausman, J. Tobias Springenberg, Z. Wang, N. Heess, and M. A. Riedmiller. Learning an embedding space for transferable robot skills. In ICLR, 2018.
|
| 368 |
+
[19] H. He and J. L. Boyd-Graber. Opponent modeling in deep reinforcement learning. In ICML, volume 48, pages 1804–1813, 2016.
|
| 369 |
+
[20] K. He, H. Fan, Y. Wu, S. Xie, and R. B. Girshick. Momentum contrast for unsupervised visual representation learning. In CVPR, pages 9726–9735, 2020.
|
| 370 |
+
[21] M. Igl, G. Farquhar, J. Luketina, W. Boehmer, and S. Whiteson. The impact of non-stationarity on generalisation in deep reinforcement learning. CoRR, abs/2006.05826, 2020.
|
| 371 |
+
[22] N. S. Keskar, D. Mudigere, J. Nocedal, M. Smelyanskiy, and P. T. P. Tang. On large-batch training for deep learning: Generalization gap and sharp minima. In ICLR, 2017.
|
| 372 |
+
[23] D. P. Kingma and M. Welling. Auto-encoding variational bayes. In ICLR, 2014.
|
| 373 |
+
[24] I. Kostrikov, D. Yarats, and R. Fergus. Image augmentation is all you need: Regularizing deep reinforcement learning from pixels. CoRR, abs/2004.13649, 2020.
|
| 374 |
+
|
| 375 |
+
421 [25] A. Kuznetsov, P. Shvechikov, A. Grishin, and D. P. Vetrov. Controlling overestimation bias with truncated
|
| 376 |
+
422 mixture of continuous distributional quantile critics. In ICML, volume 119, pages 5556–5566, 2020.
|
| 377 |
+
423 [26] M. G. Lagoudakis and R. Parr. Least-squares policy iteration. J. Mach. Learn. Res., 4:1107–1149, 2003.
|
| 378 |
+
424 [27] Q. Lan, Y. Pan, A. Fyshe, and M. White. Maxmin q-learning: Controlling the estimation bias of q-learning.
|
| 379 |
+
425 In ICLR, 2020.
|
| 380 |
+
426 [28] M. Laskin, K. Lee, A. Stooke, L. Pinto, P. Abbeel, and A. Srinivas. Reinforcement learning with augmented
|
| 381 |
+
427 data. CoRR, abs/2004.14990, 2020.
|
| 382 |
+
428 [29] K. Lee, Y. Seo, S. Lee, H. Lee, and J. Shin. Context-aware dynamics model for generalization in
|
| 383 |
+
429 model-based reinforcement learning. CoRR, abs/2005.06800, 2020.
|
| 384 |
+
430 [30] A. Levy, G. D. Konidaris, R. P. Jr., and K. Saenko. Learning multi-level hierarchies with hindsight. In
|
| 385 |
+
431 ICLR, 2019.
|
| 386 |
+
432 [31] T. P. Lillicrap, J. J. Hunt, A. Pritzel, N. Heess, T. Erez, Y. Tassa, D. Silver, and D. Wierstra. Continuous
|
| 387 |
+
433 control with deep reinforcement learning. In ICLR, 2015.
|
| 388 |
+
434 [32] H. Liu, K. Simonyan, and Y. Yang. DARTS: differentiable architecture search. In ICLR, 2019.
|
| 389 |
+
435 [33] R. Luo, F. Tian, T. Qin, E. Chen, and T. Liu. Neural architecture optimization. In NeurIPS, pages
|
| 390 |
+
436 7827–7838, 2018.
|
| 391 |
+
437 [34] L. V. D. Maaten and G. E. Hinton. Visualizing data using t-sne. Journal of Machine Learning Research, 9:
|
| 392 |
+
438 2579–2605, 2008.
|
| 393 |
+
439 [35] V. Mnih, K. Kavukcuoglu, D. Silver, A. A. Rusu, J. Veness, M. G. Bellemare, A. Graves, M. A. Riedmiller,
|
| 394 |
+
440 A. Fidjeland, G. Ostrovski, S. Petersen, C. Beattie, A. Sadik, I. Antonoglou, H. King, D. Kumaran,
|
| 395 |
+
441 D. Wierstra, S. Legg, and D. Hassabis. Human-level control through deep reinforcement learning. Nature,
|
| 396 |
+
442 518(7540):529–533, 2015.
|
| 397 |
+
443 [36] V. Mnih, A. P. Badia, M. Mirza, A. Graves, T. P. Lillicrap, T. Harley, D. Silver, and K. Kavukcuoglu.
|
| 398 |
+
444 Asynchronous methods for deep reinforcement learning. In ICML, 2016.
|
| 399 |
+
445 [37] O. Nachum, S. Gu, H. Lee, and S. Levine. Data-efficient hierarchical reinforcement learning. CoRR,
|
| 400 |
+
446 abs/1805.08296, 2018.
|
| 401 |
+
447 [38] O. Nachum, S. Gu, H. Lee, and S. Levine. Near-optimal representation learning for hierarchical reinforce
|
| 402 |
+
448 ment learning. In ICLR, 2019.
|
| 403 |
+
449 [39] Y. E. Nesterov and B. T. Polyak. Cubic regularization of newton method and its global performance. Math.
|
| 404 |
+
450 Program., 108(1):177–205, 2006.
|
| 405 |
+
451 [40] R. Novak, Y. Bahri, D. A. Abolafia, J. Pennington, and J. Sohl-Dickstein. Sensitivity and generalization in
|
| 406 |
+
452 neural networks: an empirical study. In ICLR, 2018.
|
| 407 |
+
453 [41] A. Oord, Y. Li, and O. Vinyals. Representation learning with contrastive predictive coding. CoRR,
|
| 408 |
+
454 abs/1807.03748, 2018.
|
| 409 |
+
455 [42] R. Raileanu, M. Goldstein, A. Szlam, and R. Fergus. Fast adaptation via policy-dynamics value functions.
|
| 410 |
+
456 CoRR, abs/2007.02879, 2020.
|
| 411 |
+
457 [43] K. Rakelly, A. Zhou, C. Finn, S. Levine, and D. Quillen. Efficient off-policy meta-reinforcement learning
|
| 412 |
+
458 via probabilistic context variables. In ICML, volume 97, pages 5331–5340, 2019.
|
| 413 |
+
459 [44] N. Rakicevic, A. Cully, and P. Kormushev. Policy manifold search: Exploring the manifold hypothesis for
|
| 414 |
+
460 diversity-based neuroevolution. CoRR, abs/2104.13424, 2021.
|
| 415 |
+
461 [45] T. Schaul, D. Horgan, K. Gregor, and D. Silver. Universal value function approximators. In ICML,
|
| 416 |
+
462 volume 37, pages 1312–1320, 2015.
|
| 417 |
+
463 [46] B. Scherrer, M. Ghavamzadeh, V. Gabillon, B. Lesner, and M. Geist. Approximate modified policy iteration
|
| 418 |
+
464 and its application to the game of tetris. J. Mach. Learn. Res., 16:1629–1676, 2015.
|
| 419 |
+
465 [47] J. S Schreck, C. W Coley, and K. JM Bishop. Learning retrosynthetic planning through simulated
|
| 420 |
+
466 experience. ACS central science, 5(6):970–981, 2019.
|
| 421 |
+
467 [48] J. Schulman, S. Levine, P. Abbeel, M. I. Jordan, and P. Moritz. Trust region policy optimization. In ICML,
|
| 422 |
+
468 pages 1889–1897, 2015.
|
| 423 |
+
469 [49] J. Schulman, P. Moritz, S. Levine, M. I. Jordan, and P. Abbeel. High-dimensional continuous control using
|
| 424 |
+
470 generalized advantage estimation. In ICLR, 2016.
|
| 425 |
+
471 [50] J. Schulman, F. Wolski, P. Dhariwal, A. Radford, and O. Klimov. Proximal policy optimization algorithms.
|
| 426 |
+
472 CoRR, abs/1707.06347, 2017.
|
| 427 |
+
473 [51] M. Schwarzer, A. Anand, R. Goel, R. D. Hjelm, A. C. Courville, and P. Bachman. Data-efficient
|
| 428 |
+
474 reinforcement learning with momentum predictive representations. CoRR, abs/2007.05929, 2020.
|
| 429 |
+
475 [52] D. Silver, G. Lever, N. Heess, T. Degris, D. Wierstra, and M. A. Riedmiller. Deterministic policy gradient
|
| 430 |
+
476 algorithms. In ICML, pages 387–395, 2014.
|
| 431 |
+
477 [53] D. Silver, A. Huang, C. J. Maddison, A. Guez, L. Sifre, G. van den Driessche, J. Schrittwieser,
|
| 432 |
+
478 I. Antonoglou, V. Panneershelvam, M. Lanctot, S. Dieleman, D. Grewe, J. Nham, N. Kalchbrenner,
|
| 433 |
+
479 I. Sutskever, T. P. Lillicrap, M. Leach, K. Kavukcuoglu, T. Graepel, and D. Hassabis. Mastering the game
|
| 434 |
+
480 of go with deep neural networks and tree search. Nature, 529(7587):484–489, 2016.
|
| 435 |
+
481 [54] A. Srinivas, M. Laskin, and P. Abbeel. CURL: contrastive unsupervised representations for reinforcement
|
| 436 |
+
482 learning. CoRR, abs/2004.04136, 2020.
|
| 437 |
+
483 [55] R. S. Sutton and A. G. Barto. Reinforcement learning - an introduction. Adaptive computation and machine
|
| 438 |
+
484 learning. MIT Press, 1998.
|
| 439 |
+
485 [56] R. S. Sutton, J. Modayil, M. Delp, T. Degris, P. M. Pilarski, A. White, and D. Precup. Horde: a scalable
|
| 440 |
+
486 real-time architecture for learning knowledge from unsupervised sensorimotor interaction. In AAMAS,
|
| 441 |
+
487 pages 761–768, 2011.
|
| 442 |
+
488 [57] A. Tacchetti, H. F. Song, P. A. M. Mediano, V. Flores Zambaldi, J. Kramár, N. C. Rabinowitz, Th. Graepel,
|
| 443 |
+
489 M. Botvinick, and P. W. Battaglia. Relational forward models for multi-agent learning. In ICLR, 2019.
|
| 444 |
+
490 [58] E. Todorov, T. Erez, and Y. Tassa. Mujoco: A physics engine for model-based control. 2012 IEEE/RSJ
|
| 445 |
+
491 International Conference on Intelligent Robots and Systems, pages 5026–5033, 2012.
|
| 446 |
+
492 [59] Y. H. Tsai, Y. Wu, R. Salakhutdinov, and L. Morency. Demystifying self-supervised learning: An
|
| 447 |
+
493 information-theoretical framework. CoRR, abs/2006.05576, 2020.
|
| 448 |
+
494 [60] T. Unterthiner, D. Keysers, S. Gelly, O. Bousquet, and I. O. Tolstikhin. Predicting neural network accuracy
|
| 449 |
+
495 from weights. CoRR, abs/2002.11448, 2020.
|
| 450 |
+
496 [61] H. v. Hasselt. Double q-learning. In J. D. Lafferty, C. K. I. Williams, J. Shawe-Taylor, R. S. Zemel, and
|
| 451 |
+
497 A. Culotta, editors, NeurIPS, pages 2613–2621, 2010.
|
| 452 |
+
498 [62] O. Vinyals, I. Babuschkin, W. M. Czarnecki, M. Mathieu, A. Dudzik, J. Chung, D. H. Choi, R. Powell,
|
| 453 |
+
499 T. Ewalds, P. Georgiev, J. Oh, D. Horgan, M. Kroiss, I. Danihelka, A. Huang, L. Sifre, T. Cai, J. P. Agapiou,
|
| 454 |
+
500 M. Jaderberg, A. S. Vezhnevets, R. Leblond, T. Pohlen, V. Dalibard, D. Budden, Y. Sulsky, J. Molloy,
|
| 455 |
+
501 T. L. Paine, C. Gulcehre, Z. Wang, T. Pfaff, Y. Wu, R. Ring, D. Yogatama, D. Wünsch, K. McKinney,
|
| 456 |
+
502 O. Smith, T. Schaul, T. Lillicrap, K. Kavukcuoglu, D. Hassabis, C. Apps, and D. Silver. Grandmaster level
|
| 457 |
+
503 in starcraft ii using multi-agent reinforcement learning. Nature, 575(7782):350–354, 2019.
|
| 458 |
+
504 [63] H. Wang, N. S. Keskar, C. Xiong, and R. Socher. Identifying generalization properties in neural networks.
|
| 459 |
+
505 CoRR, abs/1809.07402, 2018.
|
| 460 |
+
506 [64] R. Wang, R. Yu, B. An, and Z. Rabinovich. I2hrl: Interactive influence-based hierarchical reinforcement
|
| 461 |
+
507 learning. In IJCAI, pages 3131–3138, 2020.
|
| 462 |
+
508 [65] J. You, B. Liu, Z. Ying, V. S. Pande, and J. Leskovec. Graph convolutional policy network for goal-directed
|
| 463 |
+
509 molecular graph generation. In NeurIPS 2018, pages 6412–6422, 2018.
|
| 464 |
+
|
| 465 |
+
1. For all authors...
|
| 466 |
+
|
| 467 |
+
(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
|
| 468 |
+
(b) Did you describe the limitations of your work? [Yes] See the future work in Sec. 6.
|
| 469 |
+
(c) Did you discuss any potential negative societal impacts of your work? [No] Our work is on general Reinforcement Learning study. No specific practical application is considered.
|
| 470 |
+
(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
|
| 471 |
+
|
| 472 |
+
2. If you are including theoretical results...
|
| 473 |
+
|
| 474 |
+
(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]
|
| 475 |
+
|
| 476 |
+
3. If you ran experiments...
|
| 477 |
+
|
| 478 |
+
(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)? [No] Our experimental environment are public and standard. All the information needed to reproduce our results is provided in the main body and appendix. Code will be available publicly soon.
|
| 479 |
+
(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] Partially in main body and all details can be found in the appendix document.
|
| 480 |
+
(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes]
|
| 481 |
+
(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]
|
| 482 |
+
|
| 483 |
+
4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
|
| 484 |
+
|
| 485 |
+
(a) If your work uses existing assets, did you cite the creators? [Yes]
|
| 486 |
+
(b) Did you mention the license of the assets? [Yes] We use a free education licence for students for MuJoCo.
|
| 487 |
+
(c) Did you include any new assets either in the supplemental material or as a URL? [No]
|
| 488 |
+
(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A]
|
| 489 |
+
(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A]
|
| 490 |
+
|
| 491 |
+
5. If you used crowdsourcing or conducted research with human subjects...
|
| 492 |
+
|
| 493 |
+
(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
|
| 494 |
+
(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
|
| 495 |
+
(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
|
md/train/H1BLjgZCb/H1BLjgZCb.md
ADDED
|
@@ -0,0 +1,330 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# GENERATING NATURAL ADVERSARIAL EXAMPLES
|
| 2 |
+
|
| 3 |
+
# Zhengli Zhao
|
| 4 |
+
|
| 5 |
+
Dheeru Dua University of California Irvine, CA 92697, USA ddua@uci.edu
|
| 6 |
+
|
| 7 |
+
University of California Irvine, CA 92697, USA zhengliz@uci.edu
|
| 8 |
+
|
| 9 |
+
Sameer Singh University of California Irvine, CA 92697, USA sameer@uci.edu
|
| 10 |
+
|
| 11 |
+
# ABSTRACT
|
| 12 |
+
|
| 13 |
+
Due to their complex nature, it is hard to characterize the ways in which machine learning models can misbehave or be exploited when deployed. Recent work on adversarial examples, i.e. inputs with minor perturbations that result in substantially different model predictions, is helpful in evaluating the robustness of these models by exposing the adversarial scenarios where they fail. However, these malicious perturbations are often unnatural, not semantically meaningful, and not applicable to complicated domains such as language. In this paper, we propose a framework to generate natural and legible adversarial examples that lie on the data manifold, by searching in semantic space of dense and continuous data representation, utilizing the recent advances in generative adversarial networks. We present generated adversaries to demonstrate the potential of the proposed approach for black-box classifiers for a wide range of applications such as image classification, textual entailment, and machine translation. We include experiments to show that the generated adversaries are natural, legible to humans, and useful in evaluating and analyzing black-box classifiers.
|
| 14 |
+
|
| 15 |
+
# 1 INTRODUCTION
|
| 16 |
+
|
| 17 |
+
With the impressive success and extensive use of machine learning models in various securitysensitive applications, it has become crucial to study vulnerabilities in these systems. Dalvi et al. (2004) show that adversarial manipulations of input data often result in incorrect predictions from classifiers. This raises serious concerns regarding the security and integrity of existing machine learning algorithms, especially when even state-of-the-art models including deep neural networks have been shown to be highly vulnerable to adversarial attacks with intentionally worst-case perturbations to the input (Szegedy et al., 2014; Goodfellow et al., 2015; Kurakin et al., 2016; Papernot et al., 2016b; Kurakin et al., 2017). These adversaries are generated effectively with access to the gradients of target models, resulting in much higher successful attack rates than data perturbed by random noise of even larger magnitude. Further, training models by including such adversaries can provide machine learning models with additional regularization benefits (Goodfellow et al., 2015).
|
| 18 |
+
|
| 19 |
+
Although these adversarial examples expose “blind spots” in machine learning models, they are unnatural, i.e. these worst-case perturbed instances are not ones the classifier is likely to face when deployed. Due to this, it is difficult to gain helpful insights into the fundamental decision behavior inside the black-box classifier: why is the decision different for the adversary, what can we change in order to prevent this behavior, and is the classifier robust to natural variations in the data when not in an adversarial scenario? Moreover, there is often a mismatch between the input space and the semantic space that we can understand. Changes to the input we may not think meaningful, like slight rotation or translation in images, often lead to substantial differences in the input instance. For example, Pei et al. (2017) show that minimal changes in the lighting conditions can fool automated-driving systems, a behavior adversarial examples are unable to discover. Due to the unnatural perturbations, these approaches cannot be applied to complex domains such as language, in which enforcing grammar and semantic similarity is difficult when perturbing instances. Therefore, existing approaches that find adversarial examples for text often result in ungrammatical sentences, as in the examples generated by Li et al. (2016), or require manual intervention, as in Jia & Liang (2017).
|
| 20 |
+
|
| 21 |
+
In this paper, we introduce a framework to generate natural adversarial examples, i.e. instances that are meaningfully similar, valid/legible, and helpful for interpretation. The primary intuition behind our proposed approach is to perform the search for adversaries in a dense and continuous representation of the data instead of searching in the input data space directly. We use generative adversarial networks (GANs) (Goodfellow et al., 2014) to learn a projection to map normally distributed fixed-length vectors to data instances. Given an input instance, we search for adversaries in the neighborhood of its corresponding representation in latent space by sampling within a range that is recursively tightened. Figure 1 provides an example of adversaries for digit recognition. Given a multi-layer perceptron (MLP) for MNIST and an image from test data (Figure 1a), our approach generates a natural adversarial example (Figure 1e) which is classified incorrectly as $z '$ by the classifier. Compared to the adversary generated by the existing Fast Gradient Sign Method (FGSM) (Goodfellow et al., 2015) that adds gradient-based noise (Figures 1c and 1b), our adversary (Figure 1e) looks like a hand-written digit similar to the original input. Further, the difference (Figure 1d) provides some insight into the classifier’s behavior, such as the fact that slightly thickening (blue) the bottom stroke and thinning (red) the one above it, fools the classifier.
|
| 22 |
+
|
| 23 |
+

|
| 24 |
+
Figure 1: Adversarial examples. Given an instance (a), existing FGSM approach (Goodfellow et al., 2015) adds small perturbations in (b), that change the prediction of the model (to be “2”, in this case). Instead of such random-looking noise, our framework generates natural adversarial examples, such as in (e), where the differences, shown in (d) (with blue $^ { \prime } +$ , red/-), are meaningful changes to the strokes.
|
| 25 |
+
|
| 26 |
+
We apply our approach to both image and text domains, and generate adversaries that are more natural and grammatical, semantically close to the input, and helpful to interpret the local behavior of black-box models. We present examples of natural adversaries for image classification, textual entailment, and machine translation. Experiments and human evaluation also demonstrate that our approach can help evaluate the robustness of black-box classifiers, even without labeled training data.
|
| 27 |
+
|
| 28 |
+
# 2 FRAMEWORK FOR GENERATING NATURAL ADVERSARIES
|
| 29 |
+
|
| 30 |
+
In this section, we describe the problem setup and details of our framework for generating natural adversarial examples of both continuous images and discrete text data. Given a black-box classifier $f$ and a corpus of unlabeled data $X$ , the goal here is to generate adversarial example $x ^ { * }$ for a given data instance $x$ that results in a different prediction, i.e. $f ( x ^ { * } ) \neq f ( x )$ . In general, the instance $x$ may not be in $X$ , but comes from the same underlying distribution ${ \mathcal P } _ { x }$ , which is the distribution we want to generate $x ^ { * }$ from as well. We want $x ^ { * }$ to be the nearest such instance to $x$ in terms of the manifold that defines the data distribution ${ \mathcal P } _ { x }$ , instead of in the original data representation.
|
| 31 |
+
|
| 32 |
+
Unlike other existing approaches that search directly in the input space for adversaries, we propose to search in a corresponding dense representation of $z$ space. In other words, instead of finding the adversarial $x ^ { * }$ directly, we find the adversarial $z ^ { * }$ in an underlying dense vector space which defines the distribution ${ \mathcal P } _ { x }$ , and then map it back to $x ^ { * }$ with the help of a generative model. By searching for samples in the latent low-dimensional $z$ space and mapping them to $x$ space to identify the adversaries, we encourage these adversaries to be valid (legible for images, and grammatical for sentences) and semantically close to the original input.
|
| 33 |
+
|
| 34 |
+
Background: Generative Adversarial Networks To tackle the problem described above, we need powerful generative models to learn a mapping from the latent low-dimensional representation to the distribution ${ \mathcal P } _ { x }$ , which we estimate using samples in $X$ . GANs are a class of such generative models that can be trained via procedures of minimax game between two competing networks (Goodfellow et al., 2014): given a large amount of unlabeled instances $X$ as training data, the generator $\mathcal { G } _ { \theta }$ learns to map some noise with distribution $p _ { z } ( z )$ where $z \in \mathbb { R } ^ { \mathrm { d } }$ to synthetic data that is as close to the training data as possible; on the other hand, the critic $\mathcal { C } _ { \omega }$ is trained to discriminate the output of the generator from real data samples from $X$ . The original objective function of GANs has been found to be hard to optimize in practice, for reasons theoretically investigated in Arjovsky & Bottou (2017). Arjovsky et al. (2017) refine the objective with Wasserstein-1 distance as:
|
| 35 |
+
|
| 36 |
+

|
| 37 |
+
Figure 2: Training Architecture with a GAN and an Inverter. Loss of the inverter combines reconstruction error of $x$ with divergence between Gaussian distribution $z$ and $\mathcal { T } _ { \gamma } ( \mathcal { G } _ { \theta } ( z ) )$ .
|
| 38 |
+
|
| 39 |
+
$$
|
| 40 |
+
\operatorname* { m i n } _ { \theta } \operatorname* { m a x } _ { \omega } \mathbb { E } _ { x \sim p _ { x } ( x ) } [ \mathcal { C } _ { \omega } ( x ) ] - \mathbb { E } _ { z \sim p _ { z } ( z ) } [ \mathcal { C } _ { \omega } ( \mathcal { G } _ { \theta } ( z ) ) ] .
|
| 41 |
+
$$
|
| 42 |
+
|
| 43 |
+
Wasserstein GAN achieves improvement in the stability of learning and provides useful learning curves. A number of further improvements to the GAN framework have been introduced (Salimans et al., 2016; Arjovsky & Bottou, 2017; Gulrajani et al., 2017; Rosca et al., 2017) that we discuss in Section 6. We incorporate the structure of WGAN and relevant improvements as a part of our framework for generating natural examples close to the training data distribution, as we describe next.
|
| 44 |
+
|
| 45 |
+
Natural Adversaries In order to represent natural instances of the domain, we first train a WGAN on corpus $X$ , which provides a generator $\mathcal { G } _ { \theta }$ that maps random dense vectors $z \in \mathbb { R } ^ { \mathrm { d } }$ to samples $x$ from the domain of $X$ . We separately train a matching inverter $\mathcal { T } _ { \gamma }$ to map data instances to corresponding dense representations. As in Figure 2, we minimize the reconstruction error of $x$ , and the divergence between sampled $z$ and $\mathcal { T } _ { \gamma } ( \mathcal { G } _ { \theta } ( z ) )$ to encourage the latent space to be normally distributed:
|
| 46 |
+
|
| 47 |
+
$$
|
| 48 |
+
\operatorname* { m i n } _ { \gamma } \mathbb { E } _ { x \sim p _ { x } ( x ) } \lVert \mathcal { G } _ { \theta } ( \mathbb { Z } _ { \gamma } ( x ) ) - x \rVert + \lambda \cdot \mathbb { E } _ { z \sim p _ { z } ( z ) } [ \mathcal { L } ( z , \mathbb { Z } _ { \gamma } ( \mathcal { G } _ { \theta } ( z ) ) ) ] .
|
| 49 |
+
$$
|
| 50 |
+
|
| 51 |
+
Using these learned functions, we define the natural adversarial example $x ^ { * }$ as the following:
|
| 52 |
+
|
| 53 |
+
$$
|
| 54 |
+
\mathcal G _ { \boldsymbol \theta } ( z ^ { * } ) \mathrm { w h e r e } z ^ { * } = \mathrm { a r g m i n } \| \tilde { z } - \mathcal T _ { \gamma } ( x ) \| \mathrm { s . t . } f ( \mathcal G _ { \boldsymbol \theta } ( \tilde { z } ) ) \neq f ( x ) .
|
| 55 |
+
$$
|
| 56 |
+
|
| 57 |
+
Instead of $x$ , we perturb its dense representation $z ^ { \prime } = \mathcal { T } _ { \gamma } ( x )$ , and use the generator to test whether a perturbation $\tilde { z }$ fools the classifier by querying $f$ with $\dot { \tilde { x } } = \mathcal { G } _ { \theta } ( \tilde { z } )$ . Figure 3 shows our generation process. A synthetic example is included for further intuition in Appendix A. As for the divergence $\mathcal { L }$ , we use $L _ { 2 }$ distance with $\lambda = . 1$ for images and Jensen-Shannon distance with $\lambda = 1$ for text data.
|
| 58 |
+
|
| 59 |
+
Search Algorithms We propose two approaches to identify the adversary (pseudocode in Appendix B), both of which utilize the inverter to obtain the latent vector $z ^ { \prime } = \mathcal { T } _ { \gamma } ( x )$ of $x$ , and feed perturbations $\tilde { z }$ in the neighborhood of $z ^ { \prime }$ to the generator to generate natural samples $\tilde { x } = \mathcal { G } _ { \theta } ( \tilde { z } )$ . In iterative stochastic search (Algorithm 1), we incrementally increase the search range (by $\Delta r$ ) within which the perturbations $\tilde { z }$ are randomly sampled $N$ samples for each iteration), until we have generated samples $\check { x }$ that change the prediction. Among these samples $\check { x }$ , we choose the one which has the closest $z ^ { * }$ to the original $z ^ { \prime }$ as an adversarial example $x ^ { * }$ . To improve the efficiency beyond this naive search, we propose a coarse-to-fine strategy we call hybrid shrinking search (Algorithm 2). We first search for adversaries in a wide search range, and recursively tighten the upper bound of the search range with denser sampling in bisections. Extra iterative search steps are taken to further tighten the upper bound of the optimal $\Delta z$ . With the hybrid shrinking search in Algorithm 2, we observe a $4 \times$ speedup while achieving similar results as Algorithm 1. Both these search algorithms are sample-based and applicable to black-box classifiers with no need of access to their gradients. Further, they are guaranteed to find an adversary, i.e. one that upper bounds the optimal adversary.
|
| 60 |
+
|
| 61 |
+

|
| 62 |
+
Figure 3: Natural Adversary Generation. Given an instance $x$ , our framework generates natural adversaries by perturbing inverted $z ^ { \prime }$ and decoding perturbations $\tilde { z }$ via $\mathcal { G } _ { \theta }$ to query the classifier $f$ .
|
| 63 |
+
|
| 64 |
+

|
| 65 |
+
|
| 66 |
+
# 3 ILLUSTRATIVE EXAMPLES
|
| 67 |
+
|
| 68 |
+
We demonstrate the potential of our approach (Algorithm 1) in generating informative, legible, and natural adversaries by applying it to a number of classifiers for both visual and textual domains.
|
| 69 |
+
|
| 70 |
+
# 3.1 GENERATING IMAGE ADVERSARIES
|
| 71 |
+
|
| 72 |
+
Image classification has been a focus for adversarial example generation due to the recent successes in computer vision. We apply our approach to two standard datasets, MNIST and LSUN, and present generated natural adversaries. We use $\Delta r = 0 . 0 1$ and $N = 5 0 0 0$ with model details in Appendix C.
|
| 73 |
+
|
| 74 |
+
Handwritten Digits Scans of human-written text provide an intuitive definition of what is natural, i.e. do the generated images look like something a person would write? In other words, how would a human change a digit in order to fool a classifier? We train a WGAN with $z \in \mathbb { R } ^ { 6 4 }$ on 60,000 MNIST images following similar procedures as in Gulrajani et al. (2017), with the generator consisting of transposed convolutional layers and the critic consisting of convolutional layers. We include the inverter with fully connected layers on top of the critic’s last hidden layer. We train two target classifiers to generate adversaries against: Random Forests (RF) with 5 trees (test accuracy $9 0 . 4 5 \%$ ), and LeNet, as trained in LeCun et al. (1998) (test accuracy $9 8 . 7 1 \%$ ). We treat both these classifiers as black-boxes, and present the generated adversaries in Table 1 with examples of each digit (from test instances that the GAN or classifiers never observed). Adversaries generated by FGSM look like the original digits eroded by uninterpretable noise (these may not be representative of the approach, as changing $\epsilon$ for the method results in substantially different results). Our natural adversaries against both classifiers are quite similar to the original inputs in overall style and shape, yet provide informative insights into classifiers’ decision behavior around the input. Take the digit $\cdot 5 ^ { \mathrm { , } }$ as an example: dimming the vertical stroke can fool LeNet into predicting $\mathbf { \ddot { \delta } } ^ { 6 } 3 ^ { 9 }$ . Further we observe that adversaries against RF often look closer to the original images in overall shape than those against LeNet. Although generating as impressive natural adversaries against more accurate LeNet is difficult, it implies that compared to RF, LeNet requires more substantial changes to the inputs to be fooled; in other words, RF is less robust than LeNet in classification. We will return to this observation later.
|
| 75 |
+
|
| 76 |
+
Church vs Tower We apply our approach to outdoor, color images of higher resolution. We choose the category of “Church Outdoor” in LSUN dataset (Yu et al., 2015), randomly sample the same amount of 126,227 images from the category of “Tower”, and resize them to resolution of $6 4 \times 6 4$
|
| 77 |
+
|
| 78 |
+

|
| 79 |
+
|
| 80 |
+
Table 2: Adversarial examples against MLP classifier of LSUN by our approach. 4 original images each of “Church” and “Tower”, with their adversaries of the flipped class in the bottom row.
|
| 81 |
+
Table 3: Textual Entailment. For a pair of premise $( \mathbf { p } : )$ and hypothesis $( \mathbf { h } : )$ , we present the generated adversaries for three classifiers by perturbing the hypothesis $( \mathbf { h } ^ { \prime } : \mathbf { \epsilon } )$ . The last column provides the true label, followed by the changes in the prediction for each classifier.
|
| 82 |
+
|
| 83 |
+
<table><tr><td>Classifiers</td><td>Sentences</td><td>Label</td></tr><tr><td>Original</td><td>p : The man wearing blue jean shorts is grilling. h : The man is walking his dog.</td><td>Contradiction</td></tr><tr><td>Embedding</td><td>h' : The man is walking by the dog.</td><td>Contradiction →Entailment</td></tr><tr><td>LSTM</td><td>h': The person is walking a dog.</td><td>Contradiction →Entailment</td></tr><tr><td>TreeLSTM</td><td>h':A man is winning a race.</td><td>Contradiction →Neutral</td></tr></table>
|
| 84 |
+
|
| 85 |
+
The training procedure is similar to MNIST, except that the generator and critic in WGAN are deep residual networks (He et al., 2016) and $z \in \mathbb { R } ^ { 1 2 8 }$ . We train an MLP classifier on these two classes with test accuracy of $7 1 . 3 \%$ . Table 2 presents original images for both classes and corresponding adversarial examples. From looking at these pairs, we can observe that the generated adversaries make changes that are natural for this domain. For example, to change the classifier’s prediction from “Church” to “Tower”, the adversaries sharpen the roof, narrow the buildings, or change a tree into a tower. We can observe similar behavior in the other direction: the image with the Eiffel Tower is changed to a “church” by converting a woman into a building, and narrowing the tower.
|
| 86 |
+
|
| 87 |
+
# 3.2 GENERATING TEXT ADVERSARIES
|
| 88 |
+
|
| 89 |
+
Generating grammatical and linguistically coherent adversarial sentences is a challenging task due to the discrete nature of text: adding imperceptible noise is impossible, and most actual changes to $x$ may not result in grammatical text. Prior approaches on generating textual adversaries (Li et al., 2016; Alvarez-Melis & Jaakkola, 2017; Jia & Liang, 2017) perform word erasures and replacements directly on text input space $x$ , using domain-specific rule based or heuristic based approaches, or require manual intervention. Our approach, on the other hand, performs perturbations in the continuous space $z$ , that has been trained to produce semantically and syntactically coherent sentences automatically.
|
| 90 |
+
|
| 91 |
+
We use the adversarially regularized autoencoder (ARAE) (Zhao et al., 2017) for encoding discrete text into continuous codes. ARAE model encodes a sentence with an LSTM encoder into continuous code and then performs adversarial training on these codes to capture the data distribution. We introduce an inverter that maps these continuous codes into the Gaussian space of $z \in \mathbb { R } ^ { 1 0 0 }$ . We use a 4-layer strided CNN for the encoder as it yields more coherent sentences than LSTMs from the ARAE model, however LSTM works well as the decoder. We train two MLP models for the generator and the inverter, to learn mappings between noise and continuous codes. We train our framework on the Stanford Natural Language Inference (SNLI) (Bowman et al., 2015) data of 570k labeled human-written English sentence pairs with the same preprocessing as Zhao et al. (2017), using $\Delta r =$ 0.01 and $N = 1 0 0$ . We present details of the architecture and sample perturbations in Appendix D.
|
| 92 |
+
|
| 93 |
+
Textual Entailment Textual Entailment (TE) is a task designed to evaluate common-sense reasoning for language, requiring both natural language understanding and logical inferences for text snippets. In this task, we classify a pair of sentences, a premise and a hypothesis, into three categories depending on whether the hypothesis is entailed by the premise, contradicts the premise, or is neutral to it. For instance, the sentence “There are children present” is entailed by the sentence “Children smiling and waving at camera”, while the sentence “The kids are frowning” contradicts it. We use our approach to generate adversaries by perturbing the hypothesis to deceive classifiers, keeping the premise unchanged. We train three classifiers of varying complexity, namely, an embedding classifier that is a single layer on top of the average word embeddings, an LSTM based model consisting of a single layer on top of the sentence representations, and TreeLSTM (Chen et al., 2017) that uses a hierarchical LSTM on the parses and is a top-performing classifier for this task. A few examples comparing the three classifiers are shown in Table 3 (more examples in Appendix D.1). Although all classifiers correctly predict the label, as the classifiers get more accurate (from embedding to LSTM to TreeLSTM), they require much more substantial changes to the sentences to be fooled.
|
| 94 |
+
|
| 95 |
+
Table 4: Machine Translation. “Adversary” that introduces the word “stehen” into the translation.
|
| 96 |
+
|
| 97 |
+
<table><tr><td>Source Sentence (English)</td><td>Generated Translation (German)</td></tr><tr><td>s : A man and woman sitting on the sidewalk.</td><td>Ein Mann und eine Frau, die auf dem Bürgersteig sitzen.</td></tr><tr><td>s' : A man and woman stand on the bench.</td><td>Ein Mann und eine Frau stehen auf der Bank.</td></tr></table>
|
| 98 |
+
|
| 99 |
+
Table 5: “Adversaries” to find dropped verbs. The left column contains the original sentence s and its adversary $s ^ { \prime }$ , while the right contains their translations, with English translation in red.
|
| 100 |
+
|
| 101 |
+
<table><tr><td>Source Sentence (English)</td><td>Generated Translation (German)</td></tr><tr><td>s : People sitting in a dim restaurant eating. s' : People sitting in a living room eating.</td><td>Leute,die in einem dim Restaurant essen sitzen. Leute,die in einem Wohnzimmeressen sitzen.</td></tr><tr><td>s : Elderly people walking down a city street. s' : A man walking down a street playing.</td><td>(People sitting in a living room.) Altere Menschen,die eine StadtstraBe hinuntergehen. Ein Mann,der eine StraBe entlang spielt. (A man playing along a street.)</td></tr></table>
|
| 102 |
+
|
| 103 |
+
Machine translation We consider machine translation not only because it is one of the most successful applications of neural approaches to NLP, but also since most practical translation systems lie behind black-box access APIs. The notion of adversary, however, is not so clear here as the output of a translation system is not a class. Instead, we define adversary for machine translation relative to a probing function that tests the translation for certain properties, ones that may lead to linguistic insights into the languages, or detect potential vulnerabilities. We use the same generator and inverter as in entailment, and find such “adversaries” via API access to the currently deployed Google Translate model (as of October 15, 2017) from English to German.
|
| 104 |
+
|
| 105 |
+
First, let us consider the scenario in which we want to generate adversarial English sentences such that a specific German word is introduced into the German translation. The probing function here would test the translation for the presence of that word, and we would have found an adversary (an English sentence) if the probing function passes for a translation. We provide an example of such a probing function that introduces the word “stehen” (“stand” in English) to the translation in Table 4 (more examples in Appendix D.2). Since the translation system is quite strong, such adversaries are not surfacing the vulnerabilities of the model, but instead can be used as a tool to understand or learn different languages (in this example, help a German speaker learn English).
|
| 106 |
+
|
| 107 |
+
We can design more complex probing functions as well, especially ones that target specific vulnerabilities of the translation system. Let us consider translations of English sentences that contain two active verbs, e.g. “People sitting in a restaurant eating”, and see that the German translation has the two verbs as well, “essen” and “sitzen”, respectively. We now define a probing function that passes only if the perturbed English sentence $s ^ { \prime }$ contains both the verbs, but the translation only has one of them. An adversary for such a probing function will be an English sentence $( s ^ { \prime } )$ that is similar to the original sentence (s), but for some reason, its translation is missing one of the verbs. Table 5 presents examples of generated adversaries using such a probing function (with more in Appendix D.2). For example, one that tests whether “essen” is dropped from the translation when its English counterpart “eating” appears in the source sentence (“People sitting in a living room eating.”). These adversaries thus suggest a vulnerability in Google’s English to German translation system: a word acting as a gerund in English often gets dropped from the translation.
|
| 108 |
+
|
| 109 |
+
Table 6: Statistics of adversaries against models for both MNIST and TE. We include the average $\Delta z$ for the adversaries and the proportion where each classifier’s adversary has the largest $\Delta z$ compared to the others for the same instance (significant with $p < 0 . 0 0 0 5$ using the sign test). The higher values correspond to stronger robustness, as is demonstrated by higher test accuracy.
|
| 110 |
+
|
| 111 |
+
<table><tr><td colspan="2"></td><td>Average △z</td><td>P(largest △z)</td><td>Test accuracy (%)</td></tr><tr><td rowspan="2">MNIST</td><td>Random Forests</td><td>1.24</td><td>0.22</td><td>90.45</td></tr><tr><td>LeNet</td><td>1.61</td><td>0.78</td><td>98.71</td></tr><tr><td rowspan="3">Entailment</td><td>Embeddings</td><td>0.12</td><td>0.15</td><td>62.04</td></tr><tr><td>LSTM</td><td>0.14</td><td>0.18</td><td>69.60</td></tr><tr><td>TreeLSTM</td><td>0.26</td><td>0.66</td><td>89.04</td></tr></table>
|
| 112 |
+
|
| 113 |
+

|
| 114 |
+
Figure 4: Classifier accuracy and average $\Delta z$ of their adversaries. In (a) and (b) we vary the number of neurons and dropout rate, respectively. In (c) we present the correlation between accuracy and average $\Delta z$ for 80 different classifiers. (d) shows adversaries for an input image, against a set of classifiers with a single hidden layer, but varying number of neurons.
|
| 115 |
+
|
| 116 |
+
# 4 EXPERIMENTS
|
| 117 |
+
|
| 118 |
+
In this section, we demonstrate that our approach can be utilized to compare and evaluate the robustness of black-box models even without labeled data. We present experimental results on images and text data with evaluations from both statistical analysis and pilot user studies.
|
| 119 |
+
|
| 120 |
+
Robustness of Black-box Classifiers We apply our framework to various black-box classifiers for both images and text, and observe that it is useful for evaluating and interpreting these models via comparisons. The primary intuition behind this analysis is that more accurate classifiers often require more substantial changes to the instance to change their predictions, as noted in the previous section. In the following experiments, we apply the more efficient hybrid shrinking search (Algorithm 2).
|
| 121 |
+
|
| 122 |
+
In order to quantify the extent of change for an adversary, the change in the original $x$ representation may not be meaningful, such as RMSE of the pixels or string edit distances, for the same reason we are generating natural adversaries: they do not correspond to the semantic distance underlying the data manifold. Instead we use the distance of the adversary in the latent space, i.e. $\Delta z = \| \dot { z ^ { * } } - \bar { z } ^ { \prime } \|$ , in order to measure how much each adversary is modified to change the classifier prediction. We also consider the set of adversaries generated for each instance against a group of classifiers, and count how many times the adversary of each classifier has the highest $\Delta z$ . We present these statistics in Table 6 for both MNIST (over 100 test images, 10 per digit) and Textual Entailment (over 1260 test sentences), against the classifiers we described in Section 3. For both the tasks, we observe that more accurate classifiers require larger changes to the inputs (by both measures), indicating that generating such adversaries, even for unlabeled data, can evaluate the accuracy of black-box classifiers.
|
| 123 |
+
|
| 124 |
+
Table 7: Pilot study with MNIST
|
| 125 |
+
|
| 126 |
+
<table><tr><td></td><td>RF</td><td>LeNet</td></tr><tr><td>Looks handwritten?</td><td>0.88</td><td>0.71</td></tr><tr><td>Which closer to original?</td><td>0.87</td><td>0.13</td></tr></table>
|
| 127 |
+
|
| 128 |
+
Table 8: Pilot study with Textual Entailment
|
| 129 |
+
|
| 130 |
+
<table><tr><td></td><td>LSTM</td><td>TreeLSTM</td></tr><tr><td>Is adversary grammatical?</td><td>0.86</td><td>0.78</td></tr><tr><td>Is it similar to the original?</td><td>0.81</td><td>0.58</td></tr></table>
|
| 131 |
+
|
| 132 |
+
We now consider evaluation on a broader set of classifiers, and study the effect of changing hyperparameters of models on the results (focusing on MNIST). We train a set of neural networks with one hidden layer by varying the number of neurons exponentially from 2 to 1024. In Figure 4a, we observe that the average $\Delta z$ of adversaries against these models has a similar trend as their test accuracy. The generated adversaries for a single digit “3” in Figure 4d verify this observation: the adversaries become increasingly different from the original input as classifiers become more complex. We provide similar analysis by fixing the model structure but varying the dropout rates from 0.9 to 0.0 in Figure 4b, and observe a similar trend. To confirm that this correlation holds generally, we train 80 total classifiers that differ in the layer sizes, regularization, and amount of training data, and plot their test set accuracy against the average magnitude of change in their adversaries in Figure 4c. Given this strong correlation, we are confident that our framework for generating natural adversaries can be useful for automatically evaluating black-box classifiers, even in the absence of labeled data.
|
| 133 |
+
|
| 134 |
+
Human Evaluation We carry out a pilot study with human subjects to evaluate how natural the generated adversaries are, and whether the adversaries they think are similar to the original ones correspond with the less accurate classifiers (as in the evaluation above). For both image classification and textual entailment, we select a number of instances randomly, generate adversaries for each against two classifiers, and present a questionnaire to the subjects that evaluates: (1) how natural or legible each generated adversary is; (2) which of the two adversaries is closer to the original instance.
|
| 135 |
+
|
| 136 |
+
For hand-written digits from MNIST, we pick 20 images (2 for each digit), generate adversaries against RF and LeNet (two adversaries for each image), and obtain 13 responses for each of the questions. In Table 7, we see that the subjects agree that our generated adversaries are quite natural, and also, they find RF adversaries to be much closer to the original image than LeNet (i.e. more accurate classifiers, as per test accuracy on their provided labels, have more distant adversaries). We also compare adversaries against LeNet generated by FGSM and our approach, and find that $7 8 \%$ of the time the subjects agree that our adversaries make changes to the original images that are more natural (it is worth noting that FGSM is not applicable to RF for comparison). We carry out a similar pilot study for the textual entailment task to evaluate the quality of the perturbed sentences. We present a set of 20 pairs of sentences (premise and hypothesis), and adversarial hypotheses against both LSTM and TreeLSTM classifiers, and receive 4 responses for each of the questions above. The results in Table 8 also validate our previous results: the generated sentences are found to be grammatical and legible, and classifiers that need more substantial changes to the hypothesis tend to be more accurate. We leave a more detailed user study for future work.
|
| 137 |
+
|
| 138 |
+
# 5 RELATED WORK
|
| 139 |
+
|
| 140 |
+
The fast gradient sign method (FGSM) has been proposed in Goodfellow et al. (2015) to generate adversarial examples fast rather than optimally. Intuitively, the method shifts the input by $\epsilon$ in the direction of minimizing the cost function. Kurakin et al. (2016) propose a simple extension of FGSM by applying it multiple times, which generates adversarial examples with a higher attack rate, but the underlying idea is the same. Another method known as the Jacobian-based saliency map attack (JSMA) has been introduced by Papernot et al. (2016b). Unlike FGSM, JSMA generates adversaries by greedily modifying the input instance feature-wise. A saliency map is computed with gradients to indicate how important each feature is for the prediction, and the most important one is modified repeatedly until the instance changes the resulting classification. Moreover, it has been observed in practice that adversarial examples designed against a model are often likely to successfully attack another model for the same task that has not been given access to. This transferability property of adversarial examples makes it more practical to attack and evaluate deployed machine learning systems in realistic scenarios (Papernot et al., 2016a; 2017).
|
| 141 |
+
|
| 142 |
+
All these attacks above are based on gradients with access to the parameters of differentiable classifiers. Moosavi-Dezfooli et al. (2017) try to find a single noise vector which can cause imperceptible changes in most of data points, and meanwhile reduce the classifier accuracy significantly. Our method is capable of generating adversaries against black-box classifiers, even those without gradients such as Random Forests. Also, the noise added by these methods is uninterpretable, while the natural adversaries generated by our approach provide informative insights into classifiers’ decision behavior.
|
| 143 |
+
|
| 144 |
+
Due to the discrete domains involved in text, adversaries for text have received less attention. Jia & Liang (2017) generate adversarial examples for evaluating reading comprehension systems with predefined rules and candidate words for substitution after analyzing and rephrasing the input sentences. Li et al. (2016) introduce a framework to understand neural network through different levels of representation erasure. However, erasure of words or phrases directly often harms text integrity, resulting in semantically or grammatically incorrect sentences. Ribeiro et al. (2018) replace tokens by random words of the same POS tag with probability proportional to embedding similarity. Belinkov & Bisk (2018) explore approaches to increase the robustness of character-based machine translation models on text corrupted with character-level noise. With the help of expressive generative models, our approach instead perturbs the latent coding of sentences, resulting in legible generated sentences that are grammatical and semantically similar to the original input. These merits make our framework suitable for text applications such as sentiment analysis, textual entailment, and machine translation.
|
| 145 |
+
|
| 146 |
+
# 6 DISCUSSION AND FUTURE WORK
|
| 147 |
+
|
| 148 |
+
Our framework builds upon GANs as the generative models, and thus the capabilities of GANs directly effects the quality of generated examples. In visual domains, although there have been lots of appealing results produced by GANs, the training is well known to be brittle. Many recent approaches address how to improve the training stability and the objective function of GANs (Salimans et al., 2016; Arjovsky et al., 2017). Gulrajani et al. (2017) further improve the training of WGAN with regularization of gradient penalty instead of weight clipping. In our practice, we observe that we need to carefully balance the capacities of the generator, the critic, and the inverter that we introduced, to avoid situations such as model collapse. For natural languages, because of the discrete nature and non-differentiability, applications related to text generation have been relatively less studied. Zhao et al. (2017) propose to incorporate a discrete structure autoencoder with continuous code space regularized by WGAN for text generation. Given that there are some concerns about whether GANs actually learn the distribution (Arora & Zhang, 2017), it is worth noting that we can also incorporate other generative models such as Variational Auto-Encoders (VAEs) (Kingma & Welling, 2014) into our framework, as used in Hu et al. (2017) to generate text with controllable attributes, which we will explore in the future. We focus on GANs because adversarial training often results in higher quality images, while VAEs tend to produce blurrier ones (Goodfellow, 2016). We also plan to apply the fusion and variant of VAEs and GANs such as $\alpha$ -GAN in Rosca et al. (2017) and Wasserstein Auto-Encoders in Tolstikhin et al. (2018). Note that as more advanced GANs are introduced to address these issues, they can be directly incorporated into our framework.
|
| 149 |
+
|
| 150 |
+
Our iterative stochastic search algorithm for identifying adversaries is computationally expensive since it is based on naive sampling and local-search. Search based on gradients such as FGSM are not applicable to our setup because of black-box classifiers and discrete domain applications. We improve the efficiency with hybrid shrinking search by using a coarse-to-fine strategy that finds the upper-bounds by using fewer samples, and then performs finer search in the restricted range. We observe around $4 \times$ speedup with this search while achieving similar results as the iterative search. The accuracy of our inverter mapping the input to its corresponding dense vector in latent space is also important for searching adversaries in the right neighborhood. In our experiments, we find that fine-tuning the latent vector produced by the inverter with a fixed GAN can further refine the generated adversarial examples, and we will investigate other such extensions of the search in future. There is an implicit assumption in this work that the generated samples are within the same class if the added perturbations are small enough, and the generated samples look as if they belong to different classes when the perturbations are large. However, note that it is also the case for FGSM and other such approaches: when their $\epsilon$ is small, the noise is imperceptible; but with a large $\epsilon$ , one often finds noisy instances that might be in a different class (see Table 1, digit 8 for an example). While we do observe this behavior in some cases, the corresponding classifiers require much more substantial changes to the input, which is why we can utilize our approach to evaluate black-box classifiers.
|
| 151 |
+
|
| 152 |
+
# 7 CONCLUSIONS
|
| 153 |
+
|
| 154 |
+
In this paper, we propose a framework for generating natural adversaries against black-box classifiers, and apply the same approach to both visual and textual domains. We obtain adversaries that are legible, grammatical, and meaningfully similar to the input. We show that these natural adversaries can help in interpreting the decision behavior and evaluating the accuracy of black-box classifiers even in absence of labeled training data. We use our approach, built upon recent work in GANs, to generate adversaries for a wide range of applications including image classification, textual entailment, and machine translation (via the Google Translate API). Code used to generate such natural adversaries is available at https://github.com/zhengliz/natural-adversary.
|
| 155 |
+
|
| 156 |
+
# ACKNOWLEDGMENTS
|
| 157 |
+
|
| 158 |
+
We would like to thank Ananya, Casey Graff, Eric Nalisnick, Pouya Pezeshkpour, Robert Logan, and the anonymous reviewers for the discussions and feedback on earlier versions. We would also like to thank Ishaan Gulrajani and Junbo Jake Zhao for making their code available. This work is supported in part by Adobe Research and in part by FICO. The views expressed are those of the authors and do not reflect the official policy or position of the funding agencies.
|
| 159 |
+
|
| 160 |
+
# REFERENCES
|
| 161 |
+
|
| 162 |
+
David Alvarez-Melis and Tommi S. Jaakkola. A causal framework for explaining the predictions of black-box sequence-to-sequence models. In Empirical Methods in Natural Language Processing (EMNLP), 2017.
|
| 163 |
+
|
| 164 |
+
Martin Arjovsky and Leon Bottou. Towards principled methods for training generative adversarial ´ networks. In International Conference on Learning Representations (ICLR), 2017.
|
| 165 |
+
|
| 166 |
+
Martin Arjovsky, Soumith Chintala, and Leon Bottou. Wasserstein generative adversarial networks.´ In International Conference on Machine Learning (ICML), 2017.
|
| 167 |
+
|
| 168 |
+
Sanjeev Arora and Yi Zhang. Do gans actually learn the distribution? an empirical study. arXiv preprint 1706.08224, 2017.
|
| 169 |
+
|
| 170 |
+
Yonatan Belinkov and Yonatan Bisk. Synthetic and natural noise both break neural machine transla tion. In International Conference on Learning Representations (ICLR), 2018.
|
| 171 |
+
|
| 172 |
+
Samuel R. Bowman, Gabor Angeli, Christopher Potts, and Christopher D. Manning. A large annotated corpus for learning natural language inference. In Empirical Methods in Natural Language Processing (EMNLP), 2015.
|
| 173 |
+
|
| 174 |
+
Qian Chen, Xiaodan Zhu, Zhen-Hua Ling, Si Wei, Hui Jiang, and Diana Inkpen. Enhanced lstm for natural language inference. In Association for Computational Linguistics (ACL), 2017.
|
| 175 |
+
|
| 176 |
+
Nilesh Dalvi, Pedro Domingos, Sumit Sanghai, and Deepak Verma. Adversarial classification. In Proceedings of the ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, 2004.
|
| 177 |
+
|
| 178 |
+
Ian Goodfellow. NIPS 2016 Tutorial: Generative Adversarial Networks. arXiv preprint 1701.00160, 2016.
|
| 179 |
+
|
| 180 |
+
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 (NIPS), 2014.
|
| 181 |
+
|
| 182 |
+
Ian Goodfellow, Jonathon Shlens, and Christian Szegedy. Explaining and harnessing adversarial examples. In International Conference on Learning Representations (ICLR), 2015.
|
| 183 |
+
|
| 184 |
+
Ishaan Gulrajani, Faruk Ahmed, Martin Arjovsky, Vincent Dumoulin, and Aaron Courville. Improved training of wasserstein gans. In Advances in Neural Information Processing Systems (NIPS), 2017.
|
| 185 |
+
|
| 186 |
+
Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2016.
|
| 187 |
+
|
| 188 |
+
Zhiting Hu, Zichao Yang, Xiaodan Liang, Ruslan Salakhutdinov, and Eric P. Xing. Toward controlled generation of text. In International Conference on Machine Learning (ICML), 2017.
|
| 189 |
+
|
| 190 |
+
Robin Jia and Percy Liang. Adversarial examples for evaluating reading comprehension systems. In Empirical Methods in Natural Language Processing (EMNLP), 2017.
|
| 191 |
+
|
| 192 |
+
Diederik P. Kingma and Max Welling. Stochastic gradient vb and the variational auto-encoder. In International Conference on Learning Representations (ICLR), 2014.
|
| 193 |
+
|
| 194 |
+
Alexey Kurakin, Ian Goodfellow, and Samy Bengio. Adversarial examples in the physical world. arXiv preprint 1607.02533, 2016.
|
| 195 |
+
|
| 196 |
+
Alexey Kurakin, Ian Goodfellow, and Samy Bengio. Adversarial machine learning at scale. In International Conference on Learning Representations (ICLR), 2017.
|
| 197 |
+
|
| 198 |
+
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.
|
| 199 |
+
|
| 200 |
+
Jiwei Li, Will Monroe, and Dan Jurafsky. Understanding neural networks through representation erasure. arXiv preprint 1612.08220, 2016.
|
| 201 |
+
|
| 202 |
+
Seyed-Mohsen Moosavi-Dezfooli, Alhussein Fawzi, Omar Fawzi, and Pascal Frossard. Universal adversarial perturbations. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2017.
|
| 203 |
+
|
| 204 |
+
Nicolas Papernot, Patrick McDaniel, and Ian Goodfellow. Transferability in machine learning: from phenomena to black-box attacks using adversarial samples. arXiv preprint 1605.07277, 2016a.
|
| 205 |
+
|
| 206 |
+
Nicolas Papernot, Patrick McDaniel, Somesh Jha, Matt Fredrikson, Z. Berkay Celik, and Ananthram Swami. The limitations of deep learning in adversarial settings. In IEEE European Symposium on Security and Privacy, 2016b.
|
| 207 |
+
|
| 208 |
+
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 ACM on Asia Conference on Computer and Communications Security, 2017.
|
| 209 |
+
|
| 210 |
+
Kexin Pei, Yinzhi Cao, Junfeng Yang, and Suman Jana. Deepxplore: Automated whitebox testing of deep learning systems. In the ACM Symposium on Operating Systems Principles, 2017.
|
| 211 |
+
|
| 212 |
+
Marco Tulio Ribeiro, Sameer Singh, and Carlos Guestrin. Anchors: High-precision model-agnostic explanations. In AAAI Conference on Artificial Intelligence, 2018.
|
| 213 |
+
|
| 214 |
+
Mihaela Rosca, Balaji Lakshminarayanan, David Warde-Farley, and Shakir Mohamed. Variational approaches for auto-encoding generative adversarial networks. arXiv preprint 1706.04987, 2017.
|
| 215 |
+
|
| 216 |
+
Tim Salimans, Ian Goodfellow, Wojciech Zaremba, Vicki Cheung, Alec Radford, and Xi Chen. Improved techniques for training gans. In Advances in Neural Information Processing Systems (NIPS), 2016.
|
| 217 |
+
|
| 218 |
+
Christian Szegedy, Wojciech Zaremba, Ilya Sutskever, Joan Bruna, Dumitru Erhan, Ian Goodfellow, and Rob Fergus. Intriguing properties of neural networks. In International Conference on Learning Representations (ICLR), 2014.
|
| 219 |
+
|
| 220 |
+
Ilya Tolstikhin, Olivier Bousquet, Sylvain Gelly, and Bernhard Schoelkopf. Wasserstein auto-encoders. In International Conference on Learning Representations (ICLR), 2018.
|
| 221 |
+
|
| 222 |
+
Fisher Yu, Yinda Zhang, Shuran Song, Ari Seff, and Jianxiong Xiao. Lsun: Construction of a large-scale image dataset using deep learning with humans in the loop. arXiv preprint 1506.03365, 2015.
|
| 223 |
+
|
| 224 |
+
Junbo Jake Zhao, Yoon Kim, Kelly Zhang, Alexander M. Rush, and Yann LeCun. Adversarially regularized autoencoders. arXiv preprint 1706.04223, 2017.
|
| 225 |
+
|
| 226 |
+
# APPENDIX
|
| 227 |
+
|
| 228 |
+
# A ILLUSTRATION WITH SYNTHETIC DATA
|
| 229 |
+
|
| 230 |
+
As shown in Figure 5 with a toy example of synthetic data, we can effectively map data instance $x$ to its corresponding latent dense vector $z ^ { \prime }$ with the help of the inverter via ${ \mathcal { T } } _ { \gamma } ( x )$ , and then reconstruct $x$ with the help of the generator via $\mathcal { G } _ { \boldsymbol { \theta } } ( \mathcal { T } _ { \boldsymbol { \gamma } } ( \boldsymbol { x } ) )$ . For a naive classifier with the horizontal line as decision boundary, adversarial examples should be points above the line given input data $x$ in Figure 5c. By searching in corresponding latent space, our approach finds $x ^ { * }$ on the left as a natural adversary because it is the closest one in semantic space (along the curve trace) and it exists within the data manifold. However, the gradient-based approaches may find the $x ^ { * }$ right above $x$ as adversarial in input space regardless of the actual data distribution.
|
| 231 |
+
|
| 232 |
+
# B ALGORITHMS
|
| 233 |
+
|
| 234 |
+
Algorithm 1 shows the pseudocode of the iterative search of our framework. Starting from the corresponding $z$ of the input instance $x$ , we iteratively move the search range outward in latent space until we have generated samples that change the prediction of the classifier $f$ . We improve the efficiency with Algorithm 2 by using a coarse-to-fine strategy and combining recursive and iterative search. We first search for adversaries in a wide search range, and recursively tighten the upper bound of the search range with denser sampling in bisections. Extra iterative search steps are taken to further tighten the upper bound of the optimal $\Delta z$ . This hybrid shrinking search approach, shown in detail in Algorithm 2, is four times faster to achieve similar adversaries as the iterative search.
|
| 235 |
+
|
| 236 |
+
# C ARCHITECTURE FOR CONTINUOUS IMAGES
|
| 237 |
+
|
| 238 |
+
Figure 3 shows the architecture of our framework for continuous images. We adopt WGAN (Arjovsky et al., 2017) with the objective function in Equation 1, and apply gradient penalty as proposed in Gulrajani et al. (2017). On top of the generator obtained from WGAN, we train an inverter by optimizing Equation 2. For handwritten digits from MNIST dataset, we train a WGAN of latent $ { z ^ { \cdot } } \in \mathbb { R } ^ { 6 4 }$ , with a generator consisting of 3 transposed convolutional layers and ReLU activation, and a critic consisting of 3 convolutional layers with filter sizes (64, 128, 256) and strides (2, 2, 2). We include an inverter with 2 fully connected layers of dimensions (4096, 1024) on top of the critic’s last hidden layer. For “Church Outdoor” and “Tower” images from LSUN dataset, we follow similar procedures as in Gulrajani et al. (2017) training a WGAN of latent $z \in \mathbb { R } ^ { 1 2 8 }$ . The generator and critic are both residual networks. We use pre-activation residual blocks with two $3 \times 3$ convolutional layers each and ReLU activation. The critic of 4 residual blocks performs downsampling using mean pooling after the second convolution, while the generator contains 4 residual blocks performing nearest-neighbor upsampling before the second convolution. We include an inverter with 3 fully connected layers of dimensions (8192, 2048, 512) on top of the critic’s last hidden layer.
|
| 239 |
+
|
| 240 |
+

|
| 241 |
+
Figure 5: Illustration with synthetic data. With training data that lies on a complex manifold (a), the inverter maps input to compact gaussian latent $z ^ { \prime } = \mathcal { T } _ { \gamma } ( x )$ in (b), while the generator reconstructs the data via $\mathcal { G } _ { \boldsymbol { \theta } } ( \mathcal { T } _ { \boldsymbol { \gamma } } ( \boldsymbol { x } ) )$ in (c). Given $f$ as a binary classifier with decision boundary as the horizontal line in (c), for an input $x$ , our approach returns $x ^ { * }$ on the left as natural adversary that lies on the manifold, while existing approaches may find $x ^ { * }$ on the right as the adversary, which is the nearest but impossible.
|
| 242 |
+
|
| 243 |
+
Algorithm 1 Iterative stochastic search in latent space for adversaries
|
| 244 |
+
|
| 245 |
+
Require: a target black-box classifier $f$ , an input instance $x$ , and a corpus of relevant data $X$
|
| 246 |
+
1: Hyper-parameters: $N$ : number of samples in each iteration, $\Delta r$ : increment of search range
|
| 247 |
+
2: Train a generator $\mathcal { G } _ { \theta }$ and an inverter $\mathcal { T } _ { \gamma }$ on $X$
|
| 248 |
+
3: $y f ( x )$ , $z ^ { \prime } \gets \mathcal { T } _ { \gamma } ( x )$ , radius $r \gets 0$
|
| 249 |
+
4: loop $\triangleright$ loop till we find an adversary
|
| 250 |
+
5: $\mathbf { \boldsymbol { \bar { S } } } \emptyset$
|
| 251 |
+
6: for sample $N$ random noise vectors $\epsilon$ of norms within $( r , r + \Delta r ]$ do
|
| 252 |
+
7: $\tilde { z } z ^ { \prime } + \epsilon$ , $\tilde { x } \mathcal G _ { \theta } ( \tilde { z } ) , \tilde { y } f ( \tilde { x } )$ $\triangleright$ perturbation, sample generation, prediction
|
| 253 |
+
8: if $\tilde { y } \ne y$ then
|
| 254 |
+
9: $S \gets S \cup \langle \tilde { x } , \tilde { y } , \tilde { z } \rangle$
|
| 255 |
+
10: if $S = \emptyset$ then $\triangleright$ no adversary generated
|
| 256 |
+
11: $r \gets r + \Delta r$ $\triangleright$ move search range outward
|
| 257 |
+
12: else $\triangleright$ certain adversary generated
|
| 258 |
+
13: $\begin{array} { r } { \mathbf { r e t u r n } \left. x ^ { * } , y ^ { * } , z ^ { * } \right. = \operatorname * { a r g m i n } _ { \langle \check { x } , \check { y } , \check { z } \rangle \in S } \| \check { z } - z ^ { \prime } \| } \end{array}$ $\triangleright$ return the closest sample
|
| 259 |
+
Require: a target black-box classifier $f$ , an input instance $x$ , and a corpus of relevant data $X$
|
| 260 |
+
1: Hyper-parameters: $N$ : number of samples in each iteration, $\Delta r$ : increment of search range, $B$ :
|
| 261 |
+
limit of iterations, $r$ : upper limit of search range
|
| 262 |
+
2: Train a generator $\mathcal { G } _ { \theta }$ and an inverter $\mathcal { T } _ { \gamma }$ on $X$
|
| 263 |
+
3: $y f ( x )$ , $z ^ { \prime } \gets \mathcal { T } _ { \gamma } ( x )$ , $l \gets 0 , i \gets 0$
|
| 264 |
+
4: First, recursive search:
|
| 265 |
+
5: while $r - l \geq \Delta r$ do
|
| 266 |
+
6: $S \gets \emptyset$
|
| 267 |
+
7: for sample $N$ random noise vectors $\epsilon$ of magnitude within $( l , r ]$ do
|
| 268 |
+
8: z˜ ← z0 + , $\tilde { x } \mathcal G _ { \theta } ( \tilde { z } ) , \tilde { y } f ( \tilde { x } )$
|
| 269 |
+
9: if $\tilde { y } \ne y$ then
|
| 270 |
+
10: $S \gets S \cup \langle \tilde { x } , \tilde { y } , \tilde { z } \rangle$
|
| 271 |
+
11: if $S = \emptyset$ then $\triangleright$ no adversary generated
|
| 272 |
+
12: $l \gets ( l + r ) / 2$ $\triangleright$ shrink search range by half
|
| 273 |
+
13: else $\triangleright$ certain adversary generated
|
| 274 |
+
14: $\begin{array} { r l } & { \langle x ^ { * } , y ^ { * } , z ^ { * } \rangle = \mathrm { a r g m i n } _ { \langle \check { x } , \check { y } , \check { z } \rangle \in S } \| \check { z } - z ^ { \prime } \| } \\ & { l 0 , r \| z ^ { * } - z ^ { \prime } \| } \end{array}$ $\triangleright$ store the closest sample
|
| 275 |
+
15: $\triangleright$ update upper bound of $\Delta z$
|
| 276 |
+
16: Then, iterative search:
|
| 277 |
+
17: while $i < B$ and $r > 0$ do
|
| 278 |
+
18: $S \gets \emptyset , l \gets \operatorname* { m a x } ( 0 , r - \Delta r )$
|
| 279 |
+
19: for sample $N$ random noise vectors $\epsilon$ of norms within $( l , r ]$ do
|
| 280 |
+
20: $\tilde { z } \gets z ^ { \prime } + \epsilon , \tilde { x } \gets \mathcal G _ { \theta } ( \tilde { z } ) , \tilde { y } \gets f ( \tilde { x } )$
|
| 281 |
+
21: if $\tilde { y } \ne y$ then
|
| 282 |
+
22: $S \gets S \cup \langle \tilde { x } , \tilde { y } , \tilde { z } \rangle$
|
| 283 |
+
23: if $S = \emptyset$ then
|
| 284 |
+
24: $i \gets i + 1 , r \gets r - \Delta r$ $\triangleright$ increase counter, continue searching
|
| 285 |
+
25: else
|
| 286 |
+
26: $\begin{array} { r l } & { \langle x ^ { * } , y ^ { * } , z ^ { * } \rangle = \mathrm { a r g m i n } _ { \langle \check { x } , \check { y } , \check { z } \rangle \in S } \| \check { z } - z ^ { \prime } \| } \\ & { i 0 , r \| z ^ { * } - z ^ { \prime } \| } \end{array}$ $\triangleright$ store the closest sample
|
| 287 |
+
27: $\triangleright$ reset counter, update upper bound of $\Delta z$
|
| 288 |
+
28: return $\langle x ^ { * } , y ^ { * } , z ^ { * } \rangle$
|
| 289 |
+
|
| 290 |
+
# D ARCHITECTURE FOR DISCRETE TEXT
|
| 291 |
+
|
| 292 |
+
We use the adversarially regularized autoencoder (ARAE) (Zhao et al., 2017) for encoding discrete text into continuous codes as shown in Figure 6. ARAE model encodes a sentence with an LSTM encoder into continuous code and performs adversarial training on the codes generated from noise and data to approximate the data distribution. We introduce an inverter that maps these continuous codes
|
| 293 |
+
|
| 294 |
+
$$
|
| 295 |
+
\begin{array}{c} \begin{array} { r l } & { \mathrm { , ~ } \mathrm { ~ n o i s e ~ } \tilde { z } [ \mathrm { g e n e r a t o r ~ } \mathcal { G } _ { \theta } ] \mathrm { ~ c o d e s ~ } \tilde { c } [ \operatorname* { d e c o d e r } \mathcal { D } _ { \psi } ] \mathrm { ~ s a m p l e s ~ } \tilde { x } } \\ & { \mathrm { , ~ } } \\ & { \mathrm { ~ } \mathrm { ~ } \mathrm { ~ p e r t u r b a t i o n s ~ } } \\ & { \mathrm { ~ } \cdot } \\ & { \mathrm { ~ } \mathrm { ~ l a t e n t ~ } z ^ { \prime } [ \mathrm { i n v e r t e r ~ } \mathcal { Z } _ { \gamma } ] \mathrm { ~ c o d e ~ } c [ \mathrm { e n c o d e r ~ } \mathcal { E } _ { \phi } ] \mathrm { ~ d i s c r e t e ~ } x } \end{array} \sum _ { \mathrm { ~ } \alpha = \nu \mathrm { ~ r a t e r s a r y ~ } } ^ { \mathrm { ~ n a t u r a l ~ } } \end{array}
|
| 296 |
+
$$
|
| 297 |
+
|
| 298 |
+
Figure 6: Model Architecture for Text. Our model incorporates in the adversarially regularized autoencoder (ARAE) (Zhao et al., 2017) for encoding discrete $x$ into continuous code $c$ and decoding continuous $\tilde { c }$ into discrete $\tilde { x }$ when generating samples.
|
| 299 |
+
|
| 300 |
+
into the Gaussian space of $z \in \mathbb { R } ^ { 1 0 0 }$ . We use 4 layers of CNN with varying filter sizes (300, 500, 700, and 1000), strides (2, 2, 2) and context windows (5, 5, 3) for encoding text $x$ , into continuous space $c \in \mathbb { R } ^ { 3 0 0 }$ . For the decoder, we use a single-layer LSTM with hidden dimension of 300. We also train two MLPs, one each for the generator and the inverter, to learn mappings from noise to continuous codes and continuous codes to noise respectively. The loss functions for different components of the ARAE model, which are autoencoder reconstruction loss and WGAN loss functions for generator and critic, are described in Equations (4), (5), (6) respectively. We first train the ARAE components of encoder, decoder and generator using WGAN strategy, followed by the inverter on top of these with loss function in (7), by minimizing the Jensen-Shannon divergence between the inverted continuous codes and noise samples.
|
| 301 |
+
|
| 302 |
+
$$
|
| 303 |
+
\begin{array} { r l } & { \displaystyle \operatorname* { m i n } _ { \phi , \phi } \mathcal { L } _ { \mathcal { E } , \mathcal { D } } ( \phi , \psi ) = \operatorname* { m a x } _ { \phi , \psi } \mathbb { E } _ { x } [ \log p _ { \psi } ( x | \mathcal { E } _ { \phi } ( x ) ) ] } \\ & { \quad \quad \quad \quad \quad \operatorname* { m i n } _ { \omega } \mathcal { L } _ { \mathcal { C } } ( \omega ) = \operatorname* { m a x } _ { \omega } \mathbb { E } _ { x } [ \mathcal { C } _ { \omega } ( \mathcal { E } _ { \phi } ( x ) ) ] - \mathbb { E } _ { z } [ \mathcal { C } _ { \omega } ( \mathcal { G } _ { \theta } ( z ) ) ] } \\ & { \displaystyle \operatorname* { m i n } _ { \phi , \theta } \mathcal { L } _ { \mathcal { E } , \mathcal { G } } ( \phi , \theta ) = \operatorname* { m i n } _ { \phi , \theta } \mathbb { E } _ { x } [ \mathcal { C } _ { \omega } ( \mathcal { E } _ { \phi } ( x ) ) ] - \mathbb { E } _ { z } [ \mathcal { C } _ { \omega } ( \mathcal { G } _ { \theta } ( z ) ) ] } \\ & { \quad \quad \quad \quad \operatorname* { m i n } _ { \gamma } \mathcal { L } _ { \mathcal { T } } ( \gamma ) = \operatorname* { m i n } _ { \gamma } \mathbb { E } _ { x } \| \mathcal { G } _ { \theta } ( \mathcal { I } _ { \gamma } ( \mathcal { E } _ { \phi } ( x ) ) ) - \mathcal { E } _ { \phi } ( x ) \| + \mathbb { E } _ { z } [ \mathbf { J } \mathbf { S } \mathbf { D } ( z , \mathcal { L } _ { \gamma } ( \mathcal { G } _ { \theta } ( z ) ) ) ] } \end{array}
|
| 304 |
+
$$
|
| 305 |
+
|
| 306 |
+
We train our framework on the sentences up to length 10 from Stanford Natural Language Inference (SNLI) (Bowman et al., 2015) dataset, with hyper-parameters of $\Delta r = 0 . 0 1$ and $N = 1 0 0$ . Table 9 shows some examples of the perturbations generated automatically by our approach, which are grammatical and semantically close to the original sentences.
|
| 307 |
+
|
| 308 |
+
# D.1 TEXTUAL ENTAILMENT EXAMPLES
|
| 309 |
+
|
| 310 |
+
We provide additional examples of generated adversarial hypotheses for sentences from the SNLI corpus in Table 10, which corresponds to the examples in the main text in Table 3.
|
| 311 |
+
|
| 312 |
+
# D.2 MACHINE TRANSLATION EXAMPLES
|
| 313 |
+
|
| 314 |
+
We provide additional examples of the two probing functions in Table 11 and Table 12, corresponding to Table 4 and Table 5 in the main text, respectively.
|
| 315 |
+
|
| 316 |
+
Table 9: Text perturbations. Examples are generated by perturbing the origins in semantic space.
|
| 317 |
+
|
| 318 |
+
<table><tr><td>Original</td><td></td><td>Some dogs are running on a deserted beach.A man playing an electric guitar on stage.</td></tr><tr><td rowspan="5">Perturbation</td><td>Some dogs are running on a grassy field.</td><td>A man is playing an electric guitar.</td></tr><tr><td>Some dogs are walking along a path.</td><td>A man is playing an acoustic guitar.</td></tr><tr><td>Some dogs are running down a hill.</td><td>A man is playing an accordion.</td></tr><tr><td>A dog is running on a grassy field.</td><td>A man is playing with an electronic device.</td></tr><tr><td>A dog is running down a trail.</td><td>A man is playing with an elephant.</td></tr></table>
|
| 319 |
+
|
| 320 |
+
Table 10: Textual Entailment. For a pair of premise $\left( \mathbf { p } : \right)$ and hypothesis $( \mathbf { h } : )$ , we present the generated adversaries for three classifiers by perturbing the hypothesis $( \mathbf { h } ^ { \prime } : \mathbf { \epsilon } )$ . The last column provides the true label, followed by the changes in the prediction from each classifier.
|
| 321 |
+
|
| 322 |
+
<table><tr><td>Classifiers</td><td>Sentences</td><td>Label</td></tr><tr><td>Original</td><td>p : The man walks among the large trees. h : The man is lost in the woods.</td><td>Neutral</td></tr><tr><td>Embedding</td><td>h': The man is lost at the woods.</td><td>Contradiction →Neutral</td></tr><tr><td>LSTM</td><td>h' : The man is crying in the woods.</td><td>Neutral→Contradiction</td></tr><tr><td>TreeLSTM</td><td>h':The man is lost ina bed.</td><td>Neutral → Contradiction</td></tr></table>
|
| 323 |
+
|
| 324 |
+
Table 11: Machine Translation. “Adversaries” that introduce the word “stehen” into the Google translation system by perturbing English sentences.
|
| 325 |
+
|
| 326 |
+
<table><tr><td>Source Sentence (English)</td><td>Generated Translation (German)</td></tr><tr><td>s :Asian women are sitting in a Restraunt.</td><td>Asiatische Frauen sitzen in einem Restaurant. s :Asian kids are standing in a Restraunt.Asiatische Kinder stehen in einem Restaurant.</td></tr><tr><td></td><td></td></tr><tr><td>s : People sitting on the floor.</td><td>Leute sitzen auf dem Boden.</td></tr><tr><td>s' : People standing on the field.</td><td>Leute,die auf dem Feld stehen.</td></tr></table>
|
| 327 |
+
|
| 328 |
+
Table 12: “Adversaries” that find dropped verbs in English-To-German translation. The left column contains the original sentence $s$ and its adversary $s ^ { \prime }$ . The right column contains the translations of $s$ and $s ^ { \prime }$ , with English translation provided for legibility.
|
| 329 |
+
|
| 330 |
+
<table><tr><td>Source Sentence (English)</td><td>Generated Translation (German)</td></tr><tr><td>s : A man looks back while laughing and walking. s : A man is laughing walking down the ground.</td><td>Ein Mann schaut beim Lachen und Gehen zurck. Ein Mann lacht auf dem Boden. (A man laughs on the floor.)</td></tr><tr><td>s : She is cooking food while wearing a dress. s' : She is cooking dressed for a wedding.</td><td>Sie kocht Essen, whrend sie ein Kleid trgt. Sie kocht fr eine Hochzeit. (She cooks for a wedding.)</td></tr></table>
|
md/train/H1e5GJBtDr/H1e5GJBtDr.md
ADDED
|
@@ -0,0 +1,198 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# AXIAL ATTENTION IN MULTIDIMENSIONAL TRANSFORMERS
|
| 2 |
+
|
| 3 |
+
Anonymous authors Paper under double-blind review
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
We propose Axial Transformers, a self-attention-based autoregressive model for images and other data organized as high dimensional tensors. Existing autoregressive models either suffer from excessively large computational resource requirements for high dimensional data, or make compromises in terms of distribution expressiveness or ease of implementation in order to decrease resource requirements. Our architecture, by contrast, maintains both full expressiveness over joint distributions over data and ease of implementation with standard deep learning frameworks, while requiring reasonable memory and computation and achieving state-of-the-art results on standard generative modeling benchmarks. Our models are based on axial attention, a simple generalization of self-attention that naturally aligns with the multiple dimensions of the tensors in both the encoding and the decoding settings. Notably the proposed structure of the layers allows for the vast majority of the context to be computed in parallel during decoding without introducing any independence assumptions. This semi-parallel structure goes a long way to making decoding from even a very large Axial Transformer broadly applicable. We demonstrate state-of-the-art results for the Axial Transformer on the ImageNet-32 and ImageNet-64 image benchmarks as well as on the BAIR Robotic Pushing video benchmark. We open source the implementation of Axial Transformers.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
Autoregressive models are a family of exact likelihood-based generative models that represent the joint distribution of data ${ \boldsymbol x } = ( x _ { 1 } , \dots , x _ { N } )$ as a product of conditionals $\begin{array} { r } { p _ { \theta } ( x ) = \prod _ { i = 1 } ^ { N } \bar { p _ { \theta } } ( x _ { i } | x _ { < i } ) } \end{array}$ . Neural network models in this family have achieved state-of-the-art log likelihoods on highdimensional image and video datasets (van den Oord et al., 2016a; Chen et al., 2018; Menick & Kalchbrenner, 2018; Parmar et al., 2018; Child et al., 2019; Weissenborn et al., 2019; Salimans et al., 2017; Kalchbrenner et al., 2017; Uria et al., 2016; Parikh et al., 2016; Theis & Bethge, 2015; van den Oord et al., 2016b) due to architectural innovations that enable the following capabilities:
|
| 12 |
+
|
| 13 |
+
1. Large, high information bandwidth receptive fields for each pixel $x _ { i }$ , capable of expressing long-range dependencies over previous pixels $x _ { < i }$ , and 2. Computationally efficient, vectorizable computation of the log likelihood and its gradient.
|
| 14 |
+
|
| 15 |
+
Autoregressive model architectures that can read long-range dependencies over large receptive fields are able to express all joint distributions over the data. Meanwhile, architectures that admit fast log likelihood gradient computation are suitable for training using a stochastic gradient method on a maximum likelihood objective—a straightforward, stable training procedure for generative models.
|
| 16 |
+
|
| 17 |
+
These desiderata make self-attention a compelling building block for autoregressive model architectures. Self-attention is a neural network operation that is able to transform a sequence $y _ { 1 } , \ldots , y _ { N }$ into a sequence $y _ { 1 } ^ { \prime } , \ldots , y _ { N } ^ { \prime }$ , where each $y _ { i } ^ { \prime }$ depends on all $y _ { i }$ by way of a single vectorizable computation (Vaswani et al., 2017). Self-attention is remarkably effective at learning long-range dependencies between data dimensions and neural networks that incorporate self-attention in their designs are state-of-the-art on many tasks from language modelling and machine translation to image and video modelling (Parmar et al., 2018; Child et al., 2019).
|
| 18 |
+
|
| 19 |
+

|
| 20 |
+
Figure 1: The Axial Transformer model for 2-dimensional tensors. Before sampling a channel we encode all previous channels and frames with 8 blocks of unmasked row and unmasked column attention (left). Then, for each row, we apply 4 blocks of unmasked row and masked column attention to integrate the previously sampled rows for the active channels into our encoded representation (middle). Finally, we shift the encoded representation up to make sure the conditioning information satisfies causality, and we run the inner decoder consisting of 4 blocks of masked row attention to sample a new row in the image (right).
|
| 21 |
+
|
| 22 |
+
But the power of self-attention comes at the price of computational complexity. The memory and computation it consumes grow quadratically with the sequence length $N$ making it prohibitively expensive to directly apply self-attention to long sequences. In the case of autoregressive models of multidimensional tensors such as images or videos, the aim to capture large receptive fields in multiple dimensions further exacerbates the problem as even a modest number of receptive field steps in each dimension can encompass a large total number of locations. Various approaches have been proposed to alleviate this difficulty at the cost of either limiting the receptive field or requiring operations that may not be broadly available on GPUs or TPUs.
|
| 23 |
+
|
| 24 |
+
We propose the Axial Transformer, a simple yet effective self-attention-based autoregressive model for data organized as multidimensional tensors. Rather than applying attention to a flattened string of tensor elements, our model instead applies attention along a single axis of the tensor without flattening—we refer to this as “axial attention.” Since the length of any single axis (that is, the height or width of an image) is typically much smaller than the total number of elements, an axial attention operation enjoys a significant saving in computation and memory over standard self-attention: for a $d$ -dimensional tensor with shape $\bar { N } = N ^ { 1 / d } \times \dots \times N ^ { 1 / d }$ , axial attention saves a $O ( N ^ { ( d - 1 ) / d } )$ factor of resources over standard self-attention.
|
| 25 |
+
|
| 26 |
+
Our Axial Transformer architecture allows for the majority of the context $x _ { < i }$ to be embedded with a high degree of parallelism without introducing conditional independence assumptions among any of the locations, but has an interesting property that it is amenable to a simple-to-implement fast sampling procedure. To sample one row of an image, the Axial Transformer only runs an autoregressive Transformer over that one row only, without re-embedding pixels from previous rows. We structure the Axial Transformer, however, so that it always defines a fully expressive joint distribution. No dependencies on previous pixels are ever lost.
|
| 27 |
+
|
| 28 |
+
We evaluate Axial Transformers on image and video modelling benchmarks. We show that Axial Transformer achieves state-of-the-art results on ImageNet-32 and on ImageNet-64. We also show that, simply by stacking a video along the channel dimension, the Axial Transformer can be directly applied to the channel-stacked video without nearly any modification. On the BAIR Robot Pushing benchmark, the Axial Transformer significantly outperforms previous results without using an architecture specially designed for videos. The generated samples on these datasets are of the expected high quality.
|
| 29 |
+
|
| 30 |
+
Axial Transformers do not require subroutines for GPUs or TPUs that may exhibit unfavorable memory bandwidth and computation trade-offs. Axial Transformers are simple to implement using efficient operations that are widely available in deep learning frameworks (primarily dense-dense MatMuls). An open source implementation of our models is available at anonymized URL.
|
| 31 |
+
|
| 32 |
+

|
| 33 |
+
Figure 2: Types of axial attention layers that are the building blocks of the Axial Transformer. The blue locations correspond to the receptive field of the output red location.
|
| 34 |
+
|
| 35 |
+
# 2 BACKGROUND
|
| 36 |
+
|
| 37 |
+
To set the stage for our discussion, we first review self-attention and its computational resource requirements in the context of autoregressive modeling. A self-attention layer takes as input a length $N$ sequence of $D$ -dimensional embeddings $X$ (a $N \times D$ matrix) and produces an output sequence $Y$ (also a $N \times D$ matrix) via:
|
| 38 |
+
|
| 39 |
+
$$
|
| 40 |
+
\begin{array} { r l } & { Q = X W _ { Q } , \quad K = X W _ { K } , \quad V = X W _ { V } } \\ & { A = \operatorname { s o f t m a x } \left( Q K ^ { \top } / \sqrt { D } \right) , \quad Y = A V } \end{array}
|
| 41 |
+
$$
|
| 42 |
+
|
| 43 |
+
$W _ { Q }$ , $W _ { K }$ , and $W _ { V }$ are $D \times D$ parameter matrices responsible for projecting the entries of the sequence $X$ into keys, queries, and values, respectively. Each entry of the output sequence $Y$ is a linear combination of values in $V$ weighted by the attention matrix $A$ , which itself is computed from similarities between all pairs of query and key vectors. Both the expressive power and the resource cost of self-attention come from computing $A$ and $Y$ : it takes $O ( N ^ { 2 } )$ time and space to compute the pairwise similarities between $Q$ and $K$ and to compute the linear combination of $V$ vectors.
|
| 44 |
+
|
| 45 |
+
This quadratic complexity makes it impractical to apply self-attention to images and videos directly as flattened vectors: a small $3 2 \times 3 2 \times 3$ image has 3072 dimensions. Sequences such as these are too long for self-attention, so attempts to scale self-attention to these modalities generally involve restricting these sequence lengths in a modality-aware manner while attempting to preserve modeling performance.
|
| 46 |
+
|
| 47 |
+
One strategy is to restrict the conditioning context $x _ { < i }$ to a carefully designed small subset of the data dimensions. While this reduces the cost of attention, which is only performed over these small subsets instead of the full data, the model can no longer express all joint distributions over the data. Parmar et al. (2018) propose image models with conditioning context $x _ { < i }$ restricted to a small window of the full image, but the implementation requires redundant data copies to extract and process these windows. Weissenborn et al. (2019) similarly scale video autoregressive models by restricting the context, again preventing their model from expressing all joint distributions over pixels. Our models do not restrict context and hence we obtain better log likelihoods, as we will see in section 4.
|
| 48 |
+
|
| 49 |
+
A different strategy is to stack multiple sparse attention layers, each with restricted context for computational efficiency, but in a manner that overlapping these layers yields a full-context model. Child et al. (2019) propose two sparse attention patterns with this property. However, the architecture they propose that works best for images (the Strided Sparse Transformer) requires custom sparse attention GPU kernels to implement a specific block-sparse variant of matrix-matrix-multiply. The model cannot be easily implemented on other hardware such as TPUs.
|
| 50 |
+
|
| 51 |
+
See table 1 for a summary of these architecture design tradeoffs. Our goal in this paper is to design attention-based autoregressive models that attain the best of all worlds. Our Axial Transformer, described in subsequent sections, has a full conditioning context, so its ability to express joint distributions is never limited. The Axial Transformer also does not require any redundant data copies or custom kernels to implement in an efficient way. Indeed, we designed, and will make open source, an efficient implementation that uses only standard operations in deep learning libraries.
|
| 52 |
+
|
| 53 |
+
Table 1: Trade-offs of recently proposed multidimensional Transformer architectures.
|
| 54 |
+
|
| 55 |
+
<table><tr><td>Model</td><td>Full receptive field</td><td>Attention faster than O(N²)</td><td>Needs no custom kernels</td><td>Semi-parallel context aggregation</td></tr><tr><td>Transformer (Vaswani et al.,2017)</td><td></td><td></td><td></td><td></td></tr><tr><td>Image Transformer (Parmar et al.,2018)</td><td>yes no</td><td>no</td><td>yes</td><td>no</td></tr><tr><td>Block Transformer (Weissenborn et al.,2019)</td><td>no</td><td>yes yes</td><td>yes yes</td><td>no no</td></tr><tr><td>Strided Sparse Transformer (Child et al., 2019)</td><td>yes</td><td>yes</td><td>no</td><td>no</td></tr><tr><td>Axial Transformer (ours)</td><td>yes</td><td>yes</td><td>yes</td><td>yes</td></tr></table>
|
| 56 |
+
|
| 57 |
+
# 3 AXIAL TRANSFORMERS
|
| 58 |
+
|
| 59 |
+
We now describe Axial Transformers, our self-attention-based autoregressive models for highdimensional data tensors. We describe its basic building block in section 3.1 and then we complete the description into a full autoregressive model in section 3.2.
|
| 60 |
+
|
| 61 |
+
# 3.1 AXIAL ATTENTION
|
| 62 |
+
|
| 63 |
+
We first introduce our basic building block for developing self-attention-based autoregressive models for high-dimensional data tensors. The proposed approach does not change the original shape of the multidimensional data tensor and performs a masked or unmasked attention over a single axis of the tensor at a time. We call this operation axial attention, denoted by Attention $\mathbf { \Psi } _ { k } ( x )$ . It performs attention over axis $k$ of the tensor $x$ , mixing information along axis $k$ while keeping information along other axes independent. It is straightforward to implement: axial attention over axis $k$ can be implemented by transposing all axes except $k$ to the batch axis, calling standard attention as a subroutine, then undoing the transpose (an alternative is to use the einsum operation available in most deep learning libraries).
|
| 64 |
+
|
| 65 |
+
When the data is an image, we call Attention $^ { - 1 }$ column attention, as it mixes information within columns while keeping separate columns independent. We call Attention2 row attention for analogous reasons. Axial attention on a square image of size $N = S \times S$ performs attention on $S$ sequences of length $S .$ —this is a total of $O ( S \cdot S ^ { 2 } ) = O ( N { \sqrt { N } } )$ computation—an $O ( { \sqrt { N } } )$ savings in computation over standard self-attention. In general, for a $d$ -dimensional tensor with $N = \check { S ^ { d } }$ , axial attention saves $O ( N ^ { ( d - 1 ) / d } )$ computation over standard attention. Of course, a single layer of axial attention along some axis $k$ does not have the full receptive field since it covers a single axis, but we will see in section 3.2 that stacking two axial attention layers allows the model to obtain a global receptive field.
|
| 66 |
+
|
| 67 |
+
It will be important for us to also define MaskedAttention $k$ to be the causally masked variant of Attentionk: component $i$ of the result of MaskedAttention $_ k ( x )$ along axis $k$ depends on only components $1 , \ldots , i$ of $x$ along axis $k$ . The receptive fields of these attention patterns, both unmasked and masked, are illustrated in fig. 2. We will use these masked blocks to build our autoregressive model in section 3.2.
|
| 68 |
+
|
| 69 |
+
Axial attention can be used within standard Transformer layers in a straightforward manner to produce Axial Transformer layers. The basic building blocks are the same as those found in the standard Transformer architecture:
|
| 70 |
+
|
| 71 |
+
• LayerNorm $( x )$ : layer normalization (Ba et al., 2016), and • Dense $_ D ( x )$ : a dense layer operating over the last axis of the input $x$ . The letter $D$ denotes the dimension of the output activations. If the input has shape $H \times W \times C$ , then this operation is identical to a $1 \times 1$ convolution, and the output has shape $H \times W \times D$ .
|
| 72 |
+
|
| 73 |
+
We use these to define ResNet axial attention blocks operating on tensors of $D$ -dimensional embeddings (Vaswani et al., 2017; Child et al., 2019):
|
| 74 |
+
|
| 75 |
+
• FeedforwardBlock $\mathbf { \boldsymbol { { \cdot } } } ( \mathbf { \boldsymbol { { x } } } ) = \mathbf { \boldsymbol { { x } } } + \mathbf { D e n s e } _ { D }$ (Nonlinearity(DenseD0 (LayerNorm(x)))) • AttentionBlockk(x) = x + DenseD(Attention $k$ (LayerNorm(x))) • TransformerBloc $\operatorname { k } _ { k } ( x ) =$ FeedforwardBlock(AttentionBlockk(x))
|
| 76 |
+
|
| 77 |
+
$D ^ { \prime }$ is chosen to be some constant factor larger than $D$ , from 1 to 4 (Vaswani et al., 2017). We also define a MaskedTransformer $\mathbf { B l o c k } _ { k }$ using MaskedAttention $k$ in place of Attention $k$ .
|
| 78 |
+
|
| 79 |
+
Operations similar to unmasked axial attention have been proposed in other contexts in computer vision (Huang et al., 2019). Our focus in forthcoming sections is the use of masked axial attention and its utility in autoregressive image modeling, which is not explored in these works.
|
| 80 |
+
|
| 81 |
+
# 3.2 AXIAL TRANSFORMERS
|
| 82 |
+
|
| 83 |
+
We now describe Axial Transformers, our axial attention-based autoregressive models for images and videos. We will use the axial attention operations described in section 3.1 as building blocks in a multi-layer autoregressive model of the form $\begin{array} { r } { p _ { \theta } ( x ) = \prod _ { i = 1 } ^ { N } p _ { \theta } ( x _ { i } \mid x _ { < i } ) } \end{array}$ following the raster scan ordering of pixels. We will accomplish this by building an autoregressive model over rows (section 3.2.1), then conditioning each row on previous rows (section 3.2.1), then further conditioning on previous channels and frames (section 3.2.2). Decomposing the model in this manner also leads to a simple fast and partly parallel sampling procedure (section 3.2.1).
|
| 84 |
+
|
| 85 |
+
# 3.2.1 A MODEL FOR SINGLE-CHANNEL IMAGES
|
| 86 |
+
|
| 87 |
+
We begin with an autoregressive model for a single-channel image $x$ with shape $H \times W$ , with each pixel taking an integer value in $[ 0 , 2 5 5 ]$ representing its intensity. As is standard practice with Transformers, pixel intensities are first embedded into a $H \times W \times D$ tensor of $D$ -dimensional embeddings, which we call $h$ . The architecture’s responsibility is to transform $h$ into a $H \times W \times 2 5 6$ tensor of logits suitable for classification or sampling. These logits must depend only on previous pixels in the input $x$ along the raster scan ordering to ensure that the architecture defines a valid autoregressive model.
|
| 88 |
+
|
| 89 |
+
Inner Decoder: a row-wise model Our idea is to begin with masked row attention layers to create a “row-wise” model:
|
| 90 |
+
|
| 91 |
+
$$
|
| 92 |
+
\begin{array} { r l } & { h \gets \mathrm { E m b e d } ( x ) } \\ & { h \gets \mathrm { S h i f t R i g h t } ( h ) + \mathrm { P o s i t i o n E m b e d d i n g s } } \\ & { h \gets \mathrm { M a s k e d T r a n s f o r m e r B l o c k } _ { 2 } ( h ) } \end{array}
|
| 93 |
+
$$
|
| 94 |
+
|
| 95 |
+
Here, $L _ { \mathrm { r o w } }$ is the number of masked row attention blocks applied to $h$ . PositionEmbeddings is a $H \times$ $W \times D$ tensor of position embeddings that inform the attention layers of the position. For parameter efficiency we use “additively factorized” position embeddings, meaning that we parameterize them as a broadcasted sum of $H \times 1 \times D$ embeddings for rows and $1 \times W \times D$ embeddings for columns.
|
| 96 |
+
|
| 97 |
+
The operation ShiftRight shifts the input right by one pixel, which has the effect of shifting the receptive field left by one pixel. This ensures that the masked row attention layers exclude the current pixel from their receptive field, which is crucial for architecture to define a correct autoregressive model.
|
| 98 |
+
|
| 99 |
+
As this model employs row attention only, it enjoys the computational efficiency benefits described in section 3.1. However, it clearly does not define a full-context model because each location in the output does not depend on input pixels in previous rows. If we were to use the resulting $h$ as logits for pixel intensity prediction, we would obtain a set of $H$ independent autoregressive models $p ( x _ { i , j } | x _ { i , 1 } , \dots , x _ { i , j - 1 } )$ for each row $i \in [ 1 , H ]$ , not a single autoregressive model with full context. We address this issue next.
|
| 100 |
+
|
| 101 |
+
Outer Decoder: capturing the rows above Each pixel $x _ { i , j }$ in the aforementioned model already depends on previous pixels in its own row $x _ { i , < j }$ . We just need to make it depend on all previous rows $x _ { < i , }$ : too. So, we insert unmasked row and masked column layers in the beginning of the model as follows (newly inserted operations are underlined):
|
| 102 |
+
|
| 103 |
+

|
| 104 |
+
Figure 3: Arrangement of inputs to the encoding network of the Axial Transformer. Previously available or generated channels of an image or video are sequentially stacked in the input. A variable number of padding planes are used as placeholders for future generated channels. A final integer plane signals to the Axial Transformer the channel that is being generated at that step.
|
| 105 |
+
|
| 106 |
+
The tensor $u$ represents context captured above the current pixel. It is computed by unmasked row and masked column attention layers, repeated to a total of $L _ { \mathrm { u p p e r } }$ layers to increase model capacity, which make $u$ cover the receptive field at all rows above and including the current pixel. The ShiftDown operation shifts $u$ down one pixel, which shifts its receptive field up one pixel. Thus we have a context which captures all pixels above while excluding the current row, which we add to $h$ as input to the masked row layers. We have thus converted the row-wise model into a fully expressive autoregressive model that captures not only pixels in the current row but also those above.
|
| 107 |
+
|
| 108 |
+
Following standard practice, we pass the final $h$ through layer normalization and a final dense layer to produce logits with shape $H \times W \times 2 5 6$ . The logits at each location depend on all previous pixel locations in the raster scan ordering.
|
| 109 |
+
|
| 110 |
+
Semi-Parallel Sampling Naive implementations of sampling from sequential models are notoriously slow because they require re-evaluating the entire network to sample each location. In the case of our model for a $\dot { \sqrt { N } } \times \sqrt { N }$ square image, each network evaluation takes $O ( N \sqrt { N } ( L _ { \mathrm { u p p e r } } +$ $L _ { \mathrm { r o w } } )$ ) time, so sampling the whole image would take $O ( N ^ { 2 } \sqrt { N } ( L _ { \mathrm { u p p e r } } + L _ { \mathrm { r o w } } ) )$ ), which is far too large.
|
| 111 |
+
|
| 112 |
+
Fortunately, our architecture is amenable to a particularly simple implementation of a faster sampling that is able to compute large sections of the model in parallel (see Figure 1). Pseudocode is as follows:
|
| 113 |
+
|
| 114 |
+
1. For each row $i \in [ 1 , H ]$ :
|
| 115 |
+
|
| 116 |
+
(a) Compute the upper context $u$ including information about all $x _ { < i , * }$ using the upper layers
|
| 117 |
+
(b) For each column $j \in [ 1 , W ]$ : i. Sample $x _ { i , j }$ conditioned on $u$ and prior elements of row i $( x _ { i , < j } )$ .
|
| 118 |
+
|
| 119 |
+
Because the $L _ { \mathrm { r o w } }$ row-wise layers are independent over rows (they depend on other rows only through the upper context, as explained in section 3.2.1), sampling one row can be accomplished by evaluating the row-wise layers for that one row only, completely ignoring other rows. Thus,√ in one row of $\sqrt { N }$ pixels, each pixel can be sampled in √ $O ( N L _ { \mathrm { r o w } } )$ , so all pixels can be sampled in $O ( N ^ { 2 } L _ { \mathrm { r o w } } )$ . Before each of the √ $\sqrt { N }$ rows can be sampled, the upper context must be computed in $O ( N \sqrt { N } L _ { \mathrm { u p p e r } } )$ , for a total of $O ( N ^ { 2 } L _ { \mathrm { u p p e r } } )$ over the course of all rows. Thus we arrive at $O ( N ^ { 2 } ( L _ { \mathrm { u p p e r } } { + } L _ { \mathrm { r o w } } ) )$ in total, which is $\sqrt { N }$ faster than the naive implementation. To our knowledge, sampling speedups of this type are not possible with contemporary work on scaling Transformers to images and videos (Child et al., 2019; Weissenborn et al., 2019).
|
| 120 |
+
|
| 121 |
+
# 3.2.2 CHANNEL ENCODER FOR MULTI-CHANNEL IMAGES AND VIDEOS
|
| 122 |
+
|
| 123 |
+
We have just described an architecture for a single-channel image of shape $H \times W$ . Here, we show how to extend the architecture to multi-channel images or videos of shape $H \times W \times C$ (here $C$ is either the number of channels in a multi-channel image, or the product of the number of channels and timesteps in a video). One way to model such data of shape $H \times W \times C$ is to simply stack the channels on top of each other into a single-channel image of shape $( H \cdot C ) \times W$ or $H \times ( W \cdot C )$ . This is simple to implement, but does increase the sequence length for column attention or row attention, which can be undesirable for large $C$ . We instead opt to model one channel at a time as a singlechannel image, but now conditioned on previous channels using an extra set of unmasked row and unmasked column attention layers. This means that we have a model of the form $p ( x _ { : , : , c } | x _ { : , : , < c } )$ , where previous channels $x _ { : , : , < c }$ are processed into a $H \times W \times D$ tensor of context information, which is then added into the first encoding blocks of the model in section 3.2.1 (Figure 3).
|
| 124 |
+
|
| 125 |
+
Table 2: Unconditional and class-conditional image modeling results (bits/dim)
|
| 126 |
+
|
| 127 |
+
<table><tr><td>Model</td><td>ImageNet 32x32</td><td>ImageNet 64x64</td></tr><tr><td>Multiscale PixelCNN (Reed et al., 2017)</td><td>3.95</td><td>3.70</td></tr><tr><td>PixelCNN/RNN (van den Oord et al., 2016a)</td><td>3.86</td><td>3.63</td></tr><tr><td>Gated PixelCNN (van den Oord et al.,2016b)</td><td>3.83</td><td>3.57</td></tr><tr><td>PixelSNAIL (Chen et al., 2018)</td><td></td><td>3.52</td></tr><tr><td>SPN (Menick&Kalchbrenner,2018)</td><td>3.80 3.79</td><td>3.52</td></tr><tr><td>Image Transformer (Parmar et al., 2018)</td><td></td><td></td></tr><tr><td>Strided Sparse Transformer (Child et al.,2019)</td><td>3.77</td><td>1 3.44</td></tr><tr><td></td><td>1</td><td></td></tr><tr><td>Axial Transformer+LSTMinnerdecoder</td><td>3.77</td><td>3.46</td></tr><tr><td>Axial Transformer</td><td>3.76 (3.758)</td><td>3.44 (3.439)</td></tr></table>
|
| 128 |
+
|
| 129 |
+
Table 3: Video modeling results (bits/dim) on the BAIR Robotic Pushing dataset (Ebert et al., 2017). We condition on a single video frame and model the next 15 frames, similar to Weissenborn et al. (2019). Kumar et al. (2019) instead condition on the 3 prior frames of the video.
|
| 130 |
+
|
| 131 |
+
<table><tr><td>Model</td><td>bits/dim next 15 frames</td></tr><tr><td>VideoFlow (Kumar etal.,2019)</td><td>1.87</td></tr><tr><td>Video Transformer(Weissenborn etal.,2019)</td><td>1.35</td></tr><tr><td>Axial Transformer (ours)</td><td>1.29</td></tr><tr><td></td><td></td></tr></table>
|
| 132 |
+
|
| 133 |
+
We do not share any parameters among any of these layers. At training time, we train on a random channel slice of each image: we process the previous slices using these unmasked attention layers to produce a context tensor, and maximize the likelihood of the randomly chosen slice conditioned on this context. This amounts to training on an unbiased estimate of log likelihood for the whole data tensor. See fig. 1 for an illustration of this complete model.
|
| 134 |
+
|
| 135 |
+
# 4 EXPERIMENTS
|
| 136 |
+
|
| 137 |
+
We benchmarked our models on standard datasets for generative image and video models: downsampled ImageNet (van den Oord et al., 2016a) and BAIR Robot Pushing (Ebert et al., 2017). All Axial Transformers have 8 total layers in the encoder, 8 layers in the outer decoder and 4 layers in the inner decoder. We use a hidden size of 2048 neurons throughout and for all setups and 16 heads with 128 neurons each for the attention component. We train for approximately 200k steps on ImageNet32 and ImageNet64 and for 200k steps on BAIR Robot Pushing. Our models can overfit on ImageNet32, but on the other datasets the models keep on gradually improving with more steps. See table 2 and table 3 for our results.
|
| 138 |
+
|
| 139 |
+
# 4.1 ABLATION STUDY
|
| 140 |
+
|
| 141 |
+
To push the limits of the semi-parallel sampling by making the inner decoder as small as possible, we train an Axial Transformer with the inner decoder replaced by a single LSTM layer of 2048 units. This slows down training time by about $20 \%$ on ImageNet32 and about $80 \%$ on ImageNet64 when maintaining the number of steps and all else fixed. We find that the Axial Transformer $+ \mathrm { L S T M }$ inner decoder performs rather well on the ImageNet32 and ImageNet64 benchmarks (table 2), thereby also showing the effectiveness of the remaining parts of the Axial Transformer that capture the context of the rows above. We also find however that the full four layers of the inner decoder of the Axial
|
| 142 |
+
|
| 143 |
+
Transformer provide an additional boost in performance as well as significantly faster training. The Axial Transformer $+ \mathrm { L S T M }$ inner decoder has the advantage of requiring only a couple of matrixvector products to compute the layers at each autogressive step, comparing favourably with about the 12 matrix-vector products required by the Axial Transformer, but the slower training time would make the LSTM inner decoder quickly impractical for larger tensors.
|
| 144 |
+
|
| 145 |
+
# 4.2 SAMPLES
|
| 146 |
+
|
| 147 |
+
In fig. 4 and fig. 5, we show samples from our $6 4 \times 6 4$ and $3 2 \times 3 2$ ImageNet models. The samples are globally coherent and show visibly recognizable scenes, meaning that our Axial Transformer architecture successfully captures long-range dependencies across thousands of data dimensions in these image datasets. The samples also don’t show any architecture-correlated artefacts. In addition, in fig. 6 we show samples from the BAIR Robotic Pushing dataset. The first frame is each row is given by the dataset and the rest are continuation. We note the high quality exactness of details and the very large diversity (at temperature 1.0).
|
| 148 |
+
|
| 149 |
+
# 5 CONCLUSION
|
| 150 |
+
|
| 151 |
+
We proposed the Axial Transformer, an self-attention-based autoregressive model for data organized as high dimensional tensors. It is based on axial attention, a simple generalization of self-attention that scales better with the dimension of input data, achieving a $O ( N ^ { ( d - 1 ) / d } )$ savings in computation and memory for a $d$ -dimensional input tensor with $N$ elements. Axial attention is easy to implement and does not require custom kernels to run efficiently on modern accelerators. Axial Transformers use axial self-attention layers and a shift operation to naturally and efficiently build full receptive fields of multidimensional tensors. Our model matches or outperforms the state-of-theart on ImageNet-32 and ImageNet-64 image benchmarks and sets a significant new state-of-the-art on the BAIR Robot Pushing video benchmark.
|
| 152 |
+
|
| 153 |
+

|
| 154 |
+
Figure 4: $6 4 \times 6 4$ ImageNet samples at temperature 1.0
|
| 155 |
+
|
| 156 |
+

|
| 157 |
+
Figure 5: $3 2 \times 3 2$ ImageNet samples at temperature 0.99
|
| 158 |
+
|
| 159 |
+

|
| 160 |
+
Figure 6: $1 5 \times 6 4 \times 6 4$ BAIR Robot Pushing samples at temperature 1.0
|
| 161 |
+
|
| 162 |
+
# REFERENCES
|
| 163 |
+
|
| 164 |
+
Jimmy Lei Ba, Jamie Ryan Kiros, and Geoffrey E Hinton. Layer normalization. arXiv preprint arXiv:1607.06450, 2016.
|
| 165 |
+
|
| 166 |
+
Xi Chen, Nikhil Mishra, Mostafa Rohaninejad, and Pieter Abbeel. PixelSNAIL: An improved autoregressive generative model. In International Conference on Machine Learning, pp. 863–871, 2018.
|
| 167 |
+
|
| 168 |
+
Rewon Child, Scott Gray, Alec Radford, and Ilya Sutskever. Generating long sequences with sparse transformers. arXiv preprint arXiv:1904.10509, 2019.
|
| 169 |
+
|
| 170 |
+
Frederik Ebert, Chelsea Finn, Alex X Lee, and Sergey Levine. Self-supervised visual planning with temporal skip connections. In Conference on Robot Learning, pp. 344–356, 2017.
|
| 171 |
+
|
| 172 |
+
Zilong Huang, Xinggang Wang, Lichao Huang, Chang Huang, Yunchao Wei, and Wenyu Liu. Ccnet: Criss-cross attention for semantic segmentation. In Proceedings of the IEEE International Conference on Computer Vision, pp. 603–612, 2019.
|
| 173 |
+
|
| 174 |
+
Nal Kalchbrenner, Aaron Oord, Karen Simonyan, Ivo Danihelka, Oriol Vinyals, Alex Graves, and ¨ Koray Kavukcuoglu. Video pixel networks. In International Conference on Machine Learning, pp. 1771–1779, 2017.
|
| 175 |
+
|
| 176 |
+
Manoj Kumar, Mohammad Babaeizadeh, Dumitru Erhan, Chelsea Finn, Sergey Levine, Laurent Dinh, and Durk Kingma. Videoflow: A flow-based generative model for video. arXiv preprint arXiv:1903.01434, 2019.
|
| 177 |
+
|
| 178 |
+
Jacob Menick and Nal Kalchbrenner. Generating high fidelity images with subscale pixel networks and multidimensional upscaling. arXiv preprint arXiv:1812.01608, 2018.
|
| 179 |
+
|
| 180 |
+
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.
|
| 181 |
+
|
| 182 |
+
Niki Parmar, Ashish Vaswani, Jakob Uszkoreit, Lukasz Kaiser, Noam Shazeer, Alexander Ku, and Dustin Tran. Image transformer. In International Conference on Machine Learning, pp. 4052– 4061, 2018.
|
| 183 |
+
|
| 184 |
+
Scott Reed, Aaron van den Oord, Nal Kalchbrenner, Sergio G ¨ omez Colmenarejo, Ziyu Wang, Yutian ´ Chen, Dan Belov, and Nando de Freitas. Parallel multiscale autoregressive density estimation. In Proceedings of the 34th International Conference on Machine Learning-Volume 70, pp. 2912– 2921. JMLR. org, 2017.
|
| 185 |
+
|
| 186 |
+
Tim Salimans, Andrej Karpathy, Xi Chen, and Diederik P Kingma. PixelCNN $^ { + + }$ : Improving the PixelCNN with discretized logistic mixture likelihood and other modifications. In International Conference on Learning Representations (ICLR), 2017.
|
| 187 |
+
|
| 188 |
+
Lucas Theis and Matthias Bethge. Generative image modeling using spatial lstms. In Advances in Neural Information Processing Systems, pp. 1927–1935, 2015.
|
| 189 |
+
|
| 190 |
+
Benigno Uria, Marc-Alexandre Cotˆ e, Karol Gregor, Iain Murray, and Hugo Larochelle. Neural ´ autoregressive distribution estimation. The Journal of Machine Learning Research, 17(1):7184– 7220, 2016.
|
| 191 |
+
|
| 192 |
+
Aaron van den Oord, Nal Kalchbrenner, and Koray Kavukcuoglu. Pixel recurrent neural networks. International Conference on Machine Learning (ICML), 2016a.
|
| 193 |
+
|
| 194 |
+
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, 2016b.
|
| 195 |
+
|
| 196 |
+
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.
|
| 197 |
+
|
| 198 |
+
Dirk Weissenborn, Oscar Tackstr ¨ om, and Jakob Uszkoreit. Scaling autoregressive video models.¨ arXiv preprint arXiv:1906.02634, 2019.
|
md/train/Hkemdj09YQ/Hkemdj09YQ.md
ADDED
|
@@ -0,0 +1,433 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# RECTIFIED GRADIENT: LAYER-WISE THRESHOLDING FOR SHARP AND COHERENT ATTRIBUTION MAPS
|
| 2 |
+
|
| 3 |
+
Anonymous authors Paper under double-blind review
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
Saliency map, or the gradient of the score function with respect to the input, is the most basic means of interpreting deep neural network decisions. However, saliency maps are often visually noisy. Although several hypotheses were proposed to account for this phenomenon, there is no work that provides a rigorous analysis of noisy saliency maps. This may be a problem as numerous advanced attribution methods were proposed under the assumption that the existing hypotheses are true. In this paper, we identify the cause of noisy saliency maps. Then, we propose Rectified Gradient, a simple method that significantly improves saliency maps by alleviating that cause. Experiments showed effectiveness of our method and its superiority to other attribution methods. Codes and examples for the experiments will be released in public.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
The gradient of the score function with respect to the input, also called the saliency map (Erhan et al., 2009; Baehrens et al., 2010; Simonyan et al., 2014), is the most basic means of interpreting deep neural networks (DNNs). It is also a baseline method for other advanced attribution-based methods. However, our understanding of saliency maps is still poor.
|
| 12 |
+
|
| 13 |
+
Previous studies such as Springenberg et al. (2015) and Selvaraju et al. (2017) have noted that saliency maps tend to be visually noisy. To explain this phenomenon, Sundararajan et al. (2016) and Smilkov et al. (2017) suggested saturation and discontinuous gradients as the causes (see Section 2.1 for further explanation). There were several studies attempting to improve saliency maps by tackling these hypothesized causes (Bach et al., 2015; Montavon et al., 2017; Sundararajan et al., 2016; Shrikumar et al., 2017; Smilkov et al., 2017; Sundararajan et al., 2017).
|
| 14 |
+
|
| 15 |
+
Even though such attribution methods generally produce better visualizations, we find troubling that the hypotheses regarding noisy saliency maps have not been rigorously verified (see Section 2.2 for more detail on attribution methods). In other words, numerous attribution methods were built upon unproven claims that gradient discontinuity or saturation truly causes saliency maps to be noisy. This situation gives rise to two major problems. First, if the hypotheses regarding noisy saliency maps are incorrect, current and future works based on those hypotheses will also be erroneous. Second, as we do not know precisely why saliency maps are noisy, we have to rely on heuristics and guessworks to develop better attribution methods.
|
| 16 |
+
|
| 17 |
+
In this paper, we address these problems by identifying saliency maps are noisy because DNNs do not filter out irrelevant features during forward propagation. We then introduce Rectified Gradient, or RectGrad in short, a simple technique that significantly improves the quality of saliency maps by alleviating the cause through layer-wise thresholding during backpropagation. Finally, we demonstrate that RectGrad produces attributions qualitatively superior and quantitatively comparable to other attribution methods. Specifically, we have the following key contributions:
|
| 18 |
+
|
| 19 |
+
• We explain why saliency maps are noisy. Noise occurs in saliency maps when irrelevant features have positive pre-activation values and consequently pass through ReLU activation functions. This causes gradients to be nonzero at unimportant regions. We perform experiments with networks trained on CIFAR-10 to justify our claims (Section 3).
|
| 20 |
+
|
| 21 |
+

|
| 22 |
+
Figure 1: Comparison of attribution methods. See Section 5 for details on the visualization.
|
| 23 |
+
|
| 24 |
+
• We introduce Rectified Gradient, a method that removes noise from saliency maps by thresholding irrelevant units at ReLU binary gates during backpropagation (Section 4). We first explain the rationale behind Rectified Gradient (Section 4.1). We then prove that Rectified Gradient generalizes Deconvolution and Guided Backpropagation (Section 4.2). In addition, we discuss two techniques that enhance the visual quality of Rectified Gradient attribution maps (Appendix C). We first investigate the effect of threshold level on attribution maps produced by Rectified Gradient (Section 5.1). Then, we apply Rectified Gradient to networks trained on CIFAR10 and ImageNet to demonstrate that it produces qualitatively superior attribution maps (Section 5.2). We also compare Rectified Gradient with other attribution methods using several quantitative metrics (Section 5.3).
|
| 25 |
+
|
| 26 |
+
# 2 BACKGROUND OVERVIEW
|
| 27 |
+
|
| 28 |
+
Let $S : \mathbb { R } ^ { d } \mapsto \mathbb { R } ^ { | C | }$ be an image classification network, where $x \in \mathbb { R } ^ { d }$ is a single image instance and $C$ is the set of image classes. Then, we can define a score function $S _ { c } : \mathbb { R } ^ { d } \stackrel { - } { \mapsto } \mathbb { R }$ for each class $c \in C$ and the final class of the image $x$ is given by $c l a s s ( x ) = \arg \operatorname* { m a x } _ { c \in C } S _ { c } ( x )$ . A typical score function is constructed by alternately composing affine transformations and nonlinear activation functions. A squashing function such as softmax is applied to the final layer.
|
| 29 |
+
|
| 30 |
+
Since functions comprising $S _ { c }$ are differentiable or piecewise linear, the score function is also piecewise differentiable. Using this fact, Erhan et al. (2009), Baehrens et al. (2010) and Simonyan et al. (2014) proposed the saliency map, or the gradient of $S _ { c }$ with respect to $x$ , to highlight features within $x$ that the network associates with the given class. In an ideal case, saliency maps highlight objects of interest. However, previous studies such as Springenberg et al. (2015) and Selvaraju et al. (2017) have pointed out that saliency maps tend to be visually noisy, as verified by Figure 1. Three hypotheses were proposed to account for this phenomenon. We describe them in the next section.
|
| 31 |
+
|
| 32 |
+
# 2.1 PREVIOUS HYPOTHESES
|
| 33 |
+
|
| 34 |
+
Saliency Maps are Truthful. Smilkov et al. (2017) suggested that noisy saliency maps are faithful descriptions of what the network is doing. That is, pixels scattered seemingly at random are actually crucial to how the network makes a decision. In short, this hypothesis claims that noise is actually informative.
|
| 35 |
+
|
| 36 |
+
Discontinuous Gradients. Smilkov et al. (2017) and Shrikumar et al. (2017) proposed that saliency maps are noisy due to the piece-wise linearity of the score function. Specifically, since typical DNNs use ReLU activation functions and max pooling, the derivative of the score function with respect to the input will not be continuously differentiable. Under this hypothesis, noise is caused by meaningless local variations in the gradient.
|
| 37 |
+
|
| 38 |
+
Saturating Score Function. Shrikumar et al. (2017) and Sundararajan et al. (2017) suggested that important features may have small gradient due to saturation. In other words, the score function can flatten in the proximity of the input and have a small derivative. This hypothesis explains why informative features may not be highlighted in the saliency map even though they contributed significantly to the decision of the DNN.
|
| 39 |
+
|
| 40 |
+
# 2.2 PREVIOUS WORKS ON IMPROVING SALIENCY MAPS
|
| 41 |
+
|
| 42 |
+
DNN interpretation methods that assign a signed attribution value to each input feature are collectively called attribution methods. Attributions are usually visualized as a heatmap by arranging them to have the same shape as the input sample. Such heatmaps are called attribution maps. We now describe attribution methods that have been proposed to improve saliency maps.
|
| 43 |
+
|
| 44 |
+
Attribution Methods Addressing Discontinuity. SmoothGrad (Smilkov et al., 2017) attempts to smooth discontinuous gradient with a Gaussian kernel. Since calculating the local average in a high dimensional space is intractable, the authors proposed a stochastic approximation which takes random samples in a neighborhood of the input $x$ and then averages their gradients.
|
| 45 |
+
|
| 46 |
+
Attribution Methods Addressing Saturation. Since saliency maps estimate the local importance of each input feature, they are vulnerable to saturation. Therefore, attribution methods such as Gradient \* Input (Shrikumar et al., 2017), Layer-wise Relevance Propagation (LRP) (Bach et al., 2015), DeepLIFT (Shrikumar et al., 2017) and Integrated Gradient (Sundararajan et al., 2017) attempt to alleviate saturation by estimating the global importance of each pixel (Ancona et al., 2018). Ancona et al. (2018) has also shown that several global attribution methods are closely related under certain conditions.
|
| 47 |
+
|
| 48 |
+
Other Attribution Methods. Some attribution methods take a different approach to improving saliency maps. Deconvolution (Zeiler & Fergus, 2014) and Guided Backpropagation (Springenberg et al., 2015) remove negative gradient during backpropagation. Due to this imputation procedure, Deconvolution and Guided Backpropagation yield attribution maps sharper than those of other methods. However, Nie et al. (2018) has recently proven that these methods are actually doing partial image recovery which is unrelated to DNN decisions.
|
| 49 |
+
|
| 50 |
+
# 3 OUR EXPLANATION FOR NOISY SALIENCY MAPS
|
| 51 |
+
|
| 52 |
+
For brevity, we refer to pixels on the background as background features and pixels on the object as object features. Then, noise in a saliency map corresponds to background gradient, or gradient that highlights background features. We assume the DNN uses ReLU activation functions. Under this condition, nonzero background gradient indicates the presence of at least one positive pre-activation in each network layer corresponding to background features.
|
| 53 |
+
|
| 54 |
+
To verify this, we visualized intermediate layer activations of a convolutional neural network (CNN) trained on CIFAR-10. Figure 2b shows convolutional layer feature maps for an image that produced a noisy saliency map. Since CNN filters act as feature extractors, we expected the CNN to remove most background feature activations through convolutions. However, we found significant amounts of background feature activations in all convolution layers. As the last convolution layer is connected to fully connected layers, the majority of activations in the last convolution layer will have nonzero gradient. Hence, the gradient flowed through background feature activations up to the input. This gradient flow caused background gradient, as shown in Figure 2a. From our perspective, the answer to “why are saliency maps noisy?” is trivial. Saliency maps are noisy because background features pass through ReLU activation functions.
|
| 55 |
+
|
| 56 |
+
Therefore, rather than asking why saliency maps are noisy, we ask “do activations of background features highlighted by background gradient have nontrivial influence on the decision?” If the answer is yes, noise in saliency maps is informative as suggested by Smilkov et al. (2017), and saliency maps do not need any major improvement. However, if the answer is no, we should find a way to remove background gradient. We investigated this question through two experiments.
|
| 57 |
+
|
| 58 |
+
Feature Map Occlusion. We evaluated the significance of background features by occluding activations at intermediate layers. Then, we analyzed the effect of this perturbation on the final decision. Note that this is different from the Sensitivity metric (Bach et al., 2015; Samek et al., 2017). Sensitivity measures the impact of occlusion in the data space (e.g. pixel occlusion) while we measured the impact of occlusion in each feature space.
|
| 59 |
+
|
| 60 |
+

|
| 61 |
+
Figure 2: Feature map visualization for an image with a noisy saliency map.
|
| 62 |
+
|
| 63 |
+
We first created a background mask that covers background features in the images. We then plotted the average class logits as we incrementally occluded intermediate layer activations that fell on the background mask. We carried out occlusion following a random ordering and took the average over 50 trials. Figures 3a and 3b give an example of a background mask and a completely occluded feature map respectively. Figure 3c shows that the final decision did not change throughout the occlusion process for all convolution layers. Moreover, the difference between the top label logit and the next largest logit remained constant. Therefore, background feature activations are irrelevant to the classification task. To further support this claim, we conducted a larger-scale version of this experiment, and we describe the procedure and results in Appendix A.1.
|
| 64 |
+
|
| 65 |
+
Training Dataset Occlusion. Next, we show that gradient can be nonzero for completely uninformative features. We occluded the upper left corner of all images in the training dataset with a $1 0 \times 1 0$ random patch and trained a randomly initialized CNN on the modified dataset. We used the same patch for all images. Since the test accuracy did not change significantly $( 7 9 . 4 \%$ to $7 9 . 3 \%$ ), we expected the CNN to have learned to extract important features and ignore irrelevant ones. However, Figure 4 shows that gradient is nonzero for the patch although it is completely irrelevant to the classification task.
|
| 66 |
+
|
| 67 |
+
We can draw three conclusions from these experiments:
|
| 68 |
+
|
| 69 |
+
1. DNNs do not filter out irrelevant features during forward propagation.
|
| 70 |
+
2. DNNs are capable of making correct decisions even if we occlude the majority of background feature activations in intermediate layers. This implies that most background feature activations are irrelevant to the classification task.
|
| 71 |
+
3. Since DNNs do not remove irrelevant features through ReLU activation functions, zero threshold at ReLU binary gates during backpropagation also allow irrelevant information to flow through the gradient.
|
| 72 |
+
|
| 73 |
+
With the conclusions above, we can refute the first of three previous hypotheses. As for the second hypothesis, we can interpret meaningless local variation in the gradient as a side effect of irrelevant features contaminating the gradient. Why the network does not learn to filter out irrelevant features is (c) Average class logits as background feature activations are incrementally occluded in a random order. The average is taken over 50 trials. Image class is illustrated by a solid line and other classes by dotted lines.
|
| 74 |
+
|
| 75 |
+

|
| 76 |
+
Figure 3: Impact of background feature activation occlusion on the final decision.
|
| 77 |
+
|
| 78 |
+

|
| 79 |
+
Figure 4: Saliency maps produced from a CNN trained on occluded images. The upper left corner of all the images in the training dataset is replaced with a $1 0 \times 1 0$ random patch, as shown above. Readers should examine the $8 \times 8$ patch enclosed by the red square instead of the entire $1 0 \times 1 0$ patch due to the receptive field of filters in the first convolution layer $( 3 \times 3 )$ .
|
| 80 |
+
|
| 81 |
+
a matter of optimization, which is out of scope of this paper. However, we believe it is a phenomenon worth investigating.
|
| 82 |
+
|
| 83 |
+
# 4 RECTIFIED GRADIENT
|
| 84 |
+
|
| 85 |
+
We now introduce our technique to improve saliency maps. As we have shown in Section 3, zero is a poor threshold at ReLU binary gates during backpropagation. This indicates that we need better thresholds at ReLU binary gates in order to remove uninformative gradient from saliency maps. To this end, we propose Rectified Gradient, or RectGrad in short, where the gradient propagates only through units whose importance scores exceed some threshold. Importance score for an unit is calculated by multiplying its activation with gradient propagated up to the unit. Formally, RectGrad is given as follows:
|
| 86 |
+
|
| 87 |
+
ifuncti Suppose we have a $l$ as $\bar { z } _ { i } ^ { ( l ) }$ , its activation as ien, the relation between (L) $L$ -layer ReLU DNN. Denote input feature $a _ { i } ^ { ( l ) }$ and gradient propagated up to $a _ { i } ^ { ( l ) }$ and ) $z _ { i } ^ { ( l ) }$ iis given by $a _ { i } ^ { ( l ) }$ $i$ as $a _ { i } ^ { ( l ) } = R e L U ( z _ { i } ^ { ( l ) } ) = \operatorname* { m a x } ( z _ { i } ^ { ( l ) } , 0 )$ as $x _ { i }$ $R _ { i } ^ { \bar { ( l + 1 ) } }$ , pre-activation of unit . Let $\mathbb { I } ( \cdot )$ be the indicator $i$ in layer when $l < L$ and $a _ { i } ^ { ( L ) } = s o f t m a x ( z _ { i } ^ { ( L ) } )$ . By the chain rule, backward pass through the ReLU nonlinearity for vanilla gradient is achieved by $R _ { i } ^ { ( l ) } = \mathbb { I } ( a _ { i } ^ { ( l ) } > 0 ) \cdot R _ { i } ^ { ( l + 1 ) }$ .
|
| 88 |
+
|
| 89 |
+
We modify this rule such that $R _ { i } ^ { ( l ) } = \mathbb { I } ( a _ { i } ^ { ( l ) } \cdot R _ { i } ^ { ( l + 1 ) } > \tau ) \cdot R _ { i } ^ { ( l + 1 ) }$ for some threshold $\tau$ . Backward pass through affine transformations and pooling operations is carried out in the same manner as backpropagation. Finally, importance scores for input features are calculated by multiplying gradient propagated up to input layer $l = 0$ ) with input features: $x _ { i } \cdot R _ { i } ^ { ( 1 ) }$ . Instead of setting $\tau$ to a constant value, we use the $q ^ { \mathrm { t h } }$ percentile of importance scores at each layer. This prevents the gradient from entirely dying out during the backward pass.
|
| 90 |
+
|
| 91 |
+
Due to the simplicity of the propagation rule, RectGrad can easily be applied to DNNs in graph computation frameworks such as TensorFlow (Abadi et al., 2016) or PyTorch (Paszke et al., 2017). Listing 1 in Appendix D.1 shows how to implement RectGrad in TensorFlow. In Appendix C we also introduce two techniques, namely the padding trick and the proportional redistribution rule (PRR) that enhance the visual quality of RectGrad attribution maps.
|
| 92 |
+
|
| 93 |
+
# 4.1 RATIONALE BEHIND THE PROPAGATION RULE FOR RECTIFIED GRADIENT
|
| 94 |
+
|
| 95 |
+
This subsection explains the reason we have chosen $R _ { i } ^ { ( l ) } = \mathbb { I } ( a _ { i } ^ { ( l ) } \cdot R _ { i } ^ { ( l + 1 ) } > \tau ) \cdot R _ { i } ^ { ( l + 1 ) }$ and not $R _ { i } ^ { ( l ) } = \mathbb { I } ( a _ { i } ^ { ( l ) } > \tau ) \cdot R _ { i } ^ { ( l + 1 ) }$ or $R _ { i } ^ { ( l ) } = \mathbb { I } ( R _ { i } ^ { ( l + 1 ) } > \tau ) \cdot R _ { i } ^ { ( l + 1 ) }$ as the definition of RectGrad. The significance of multiplying an unit’s activation with gradient propagated up to the unit is that it estimates the marginal effect of that unit on the output (Ancona et al., 2018). For instance, consider the following linear model: $f ( a _ { 1 } , a _ { 2 } , a _ { 3 } ) = 2 \cdot \bar { a } _ { 1 } + 1 \cdot a _ { 2 } + 3 \cdot a _ { 3 }$ . We have $\partial f / \partial a _ { 1 } \ = \ 2$ , $\partial f / \partial a _ { 2 } = 1$ , and $\partial f / a _ { 3 } = 3$ . Suppose we are given inputs $a _ { 1 } = 2$ , $a _ { 2 } = 3$ , $a _ { 3 } = 1$ and we apply RectGrad with $q \ = \ 6 7$ , i.e., we propagate the gradient through the unit with the highest importance score. Clearly $a _ { 1 }$ has the largest contribution of $2 \cdot 2 = 4$ to the final output compared to $1 \cdot 3 = 3 \cdot 1 = 3$ of $a _ { 2 }$ and $a _ { 3 }$ . Only the first rule correctly propagates gradient through the most influential unit $a _ { 1 }$ while the latter two rules mistakenly choose $a _ { 2 }$ and $a _ { 3 }$ respectively. Since the latter two rules fail even for this simple example, it is highly likely that they will not work for DNNs which are constructed by composing multiple linear layers. On the other hand, the first rule propagates gradient through units with the largest marginal effect in a layer-wise manner. Hence, it makes sense to select the first propagation rule as the definition of RectGrad. Next, we show that RectGrad generalizes Deconvolution and Guided Backpropagation.
|
| 96 |
+
|
| 97 |
+
4.2 RELATION TO DECONVOLUTION AND GUIDED BACKPROPAGATION
|
| 98 |
+
|
| 99 |
+
Claim 1. Deconvolution \* Input is equivalent to Rectified Gradient with the propagation rule
|
| 100 |
+
|
| 101 |
+
$$
|
| 102 |
+
R _ { i } ^ { ( l ) } = \mathbb { I } \left[ \left( a _ { i } ^ { ( l ) } + \epsilon \right) \cdot R _ { i } ^ { ( l + 1 ) } > 0 \right] \cdot R _ { i } ^ { ( l + 1 ) }
|
| 103 |
+
$$
|
| 104 |
+
|
| 105 |
+
for some small $\epsilon > 0$
|
| 106 |
+
|
| 107 |
+
Claim 2. Guided Backpropagation $^ *$ Input is equivalent to Rectified Gradient when $\tau = 0$ :
|
| 108 |
+
|
| 109 |
+
$$
|
| 110 |
+
R _ { i } ^ { ( l ) } = \mathbb { I } \left( a _ { i } ^ { ( l ) } \cdot R _ { i } ^ { ( l + 1 ) } > 0 \right) \cdot R _ { i } ^ { ( l + 1 ) } .
|
| 111 |
+
$$
|
| 112 |
+
|
| 113 |
+
The proofs for Claims 1 and 2 are provided in Appendix E.1 and E.2 respectively. These results indicate that RectGrad generalizes Deconvolution and Guided Backpropagation. Figure 1 illustrates the relation between the saliency map, Deconvolution, Guided Backpropagation and RectGrad.
|
| 114 |
+
|
| 115 |
+
However, Nie et al. (2018) has recently proven that Deconvolution and Guided Backpropagation are actually doing partial image recovery which is unrelated to DNN decisions. RectGrad does not suffer from this problem as it does not satisfy the assumptions of the analyses of Nie et al. (2018) for two reasons. First, the threshold criterion is based on the product of activation and gradient which is not Gaussian distributed.1 Second, we set $\tau$ as the $q ^ { \mathrm { t h } }$ percentile of importance scores and therefore $\tau$ will vary layer by layer. We also show in Section 5.2 with adversarial attacks that attributions produced by RectGrad are class sensitive. Therefore, RectGrad inherits the sharp visualizations of Deconvolution and Guided Backpropagation while amending their disadvantages with layer-wise importance score thresholding.
|
| 116 |
+
|
| 117 |
+
# 5 EXPERIMENTS
|
| 118 |
+
|
| 119 |
+
To evaluate RectGrad, we performed a series of experiments using Inception V4 network (Szegedy et al., 2017) trained on ImageNet (Russakovsky et al., 2015) and CNNs trained on CIFAR-10 (Krizhevsky & Hinton, 2009). See Appendix F.1 for details on the attribution map visualization method.
|
| 120 |
+
|
| 121 |
+

|
| 122 |
+
Figure 5: Effect of threshold $\tau$ (columns) on RectGrad for 3 images of the cabbage butterfly class in ImageNet (rows). The second column shows attribution maps with $\tau = 0$ , which is equivalent to Guided Backpropagation \* Input. For the following columns, $\tau$ is set to $q ^ { \mathrm { t h } }$ percentile of importance scores. The padding trick was used for all attribution maps above.
|
| 123 |
+
|
| 124 |
+
# 5.1 EFFECT OF THRESHOLD PERCENTILE
|
| 125 |
+
|
| 126 |
+
RectGrad has one hyper-parameter $\tau$ , which is set to $q ^ { \mathrm { t h } }$ percentile of importance scores for each layer. Figure 5 shows the effect of threshold percentile for several images from ImageNet. While the attribution maps were incomprehensible for $q = 0$ , the visual quality dramatically improved as we incremented $q$ up to 20. There was no significant change up to $q = 8 0$ . Then the attribution maps began to sparse out again as we incremented $q$ further. We also observed that regions of high attributions did not change from $q > 2 0$ .
|
| 127 |
+
|
| 128 |
+
We speculate that the attributions stay constant between $q = 2 0$ and 80 because of zero activations. That is, since we use ReLU activation functions, the majority of activations and consequently importance scores will be zero. Hence, $\tau \approx 0$ for $2 0 \leq q \leq 8 0$ . This causes RectGrad attribution maps to resemble those produced by Guided Backpropagation \* Input. It indicates that we have to increment $q > 8 0$ in order to produce sparser attribution maps that highlight important regions instead of reconstruct input images.
|
| 129 |
+
|
| 130 |
+
# 5.2 QUALITATIVE COMPARISON WITH BASELINE METHODS
|
| 131 |
+
|
| 132 |
+
We used the saliency map, Gradient \* Input, Guided Backpropagation, SmoothGrad, Integrated Gradient, Epsilon-LRP and DeepLIFT as baseline methods. As for RectGrad, we used the padding trick and $q = 9 8$ for all attribution maps. We show attributions both with and without application of the proportional redistribution rule. In this subsection, we compare RectGrad with other attribution methods through three experiments that each focus on different aspect of qualitative evaluation.
|
| 133 |
+
|
| 134 |
+
We also show applying simple final thresholding to baseline methods is not enough to replicate the benefits of RectGrad. To demonstrate this, we applied 95 percentile final threshold to baseline attribution methods such that RectGrad and baseline attribution maps have similar levels of sparsity.2
|
| 135 |
+
|
| 136 |
+
Coherence. Following prior work (Simonyan et al., 2014; Zeiler & Fergus, 2014), we inspected two types of visual coherence. First, the attributions should fall on discriminative features (e.g. the object of interest), not the background. Second, the attributions should highlight similar features for images of the same class.
|
| 137 |
+
|
| 138 |
+
For the first type of visual coherence, Figure 6 shows a side-by-side comparison between our method and baseline methods. It can clearly be seen that RectGrad produced attribution maps more visually coherent and focused than other methods—background noise was nearly nonexistent. This phenomenon may be due to noise accumulation. Specifically, irrelevant features may have trivial gradient near the output layer. However, since gradient is calculated by successive multiplication, the noise can grow exponentially as gradient is propagated towards the input layer. This can result in confusing attribution maps which assign high attribution to irrelevant regions (e.g. uniform background in “lighter”), especially for deep networks such as Inception. RectGrad does not suffer from this problem since it thresholds irrelevant features at every layer and hence stops noise accumulation. In this situation, final thresholding cannot replicate RectGrad’s ability to remove noise. In Appendix A.2, we corroborate this claim by comparing Saliency map and RectGrad attributions as they are propagated towards the input layer.
|
| 139 |
+
|
| 140 |
+

|
| 141 |
+
Figure 6: Evaluation of coherence across different classes without and with final thresholding.
|
| 142 |
+
|
| 143 |
+

|
| 144 |
+
Figure 7: Comparison of attribution maps for images (left column) and their adversarial examples (right column) without and with final thresholding. This figure shows examples where attribution maps produced by RectGrad changed significantly.
|
| 145 |
+
|
| 146 |
+
For the second type of visual coherence, Figure 11 in Appendix A.3 shows attribution maps for a pair of images belonging to the same class. Attribution maps generated by RectGrad consistently emphasized similar parts of the object of interest. On the contrary, Saliency map, Gradient \* Input and Epsilon-LRP emphasized different regions for each image instance. Attributions for Smooth
|
| 147 |
+
|
| 148 |
+

|
| 149 |
+
Figure 8: Comparison of amount of attribution on occluded patch. The left and right charts compare the amount of attribution inside occluded patch without and with final thresholding respectively. The numbers in parentheses show the custom threshold levels.
|
| 150 |
+
|
| 151 |
+
Grad, Guided Backpropagation, Integrated Gradient and DeepLIFT were generally coherent across images of the same class. Nevertheless, they also highlighted background features and hence failed to satisfy the first type of visual coherence. This observation also holds for attribution maps with final thresholding.
|
| 152 |
+
|
| 153 |
+
Adversarial Attack. We evaluated class sensitivity following prior work by Nie et al. (2018). Specifically, we compared the attributions for an image and its adversarial example. If the attribution method is class sensitive, attribution maps should change significantly since ReLU activations and consequently the predicted class have changed. On the other hand, if the attribution method merely does image reconstruction, attribution maps will not change much since we add an indistinguishable adversarial perturbation to the image. In this experiment, we used the fast gradient sign method (Goodfellow et al., 2015) with $\epsilon = 0 . 0 1$ to generate adversarial examples.
|
| 154 |
+
|
| 155 |
+
Figure 7 shows large changes in attribution maps produced by RectGrad. We observed that only RectGrad attributions were coherent with the class labels. Figure 12 in Appendix A.3 shows some instances where there was no significant change in attribution maps produced by RectGrad. In those cases, attribution maps for other methods also showed little change. Hence, we can conclude that RectGrad is equally or more class sensitive than baseline attribution methods. We observed that this conclusion also holds with final thresholding. It is also possible that adversarial attacks only modified a tiny amount of ReLU activations (i.e. the images were near the decision boundary), causing little change in attribution maps.
|
| 156 |
+
|
| 157 |
+
# 5.3 QUANTITATIVE COMPARISON WITH BASELINE METHODS
|
| 158 |
+
|
| 159 |
+
In this section, we quantitatively compare RectGrad with baseline methods using DNNs trained on CIFAR-10. We did not include Epsilon-LRP since it is equivalent to Gradient \* Input for ReLU DNNs (Ancona et al., 2018). We divided baseline attribution methods into local and global methods following the criterion proposed by Ancona et al. (2018). We also repeated the same experiments with final thresholding to the baselines to compare them with RectGrad in similar sparsity setting.
|
| 160 |
+
|
| 161 |
+
Training Dataset Occlusion. Just like the training dataset occlusion experiment in Section 3, we occluded the upper left corner of all images in CIFAR-10 training dataset with a $1 0 \times 1 0$ random patch and trained a randomly initialized CNN on the modified dataset. We then summed all absolute attribution within the patch and averaged across the test dataset. A reasonable attribution method should assign nearly zero attribution to the patch as it is completely irrelevant to the classification task. Figure 8 compares the amount of average attribution in the patch between attribution methods. We observed that without final thresholding, RectGrad assigned little or no attribution to the random patch. However, all other methods failed to do so. For this test, we found using $q \ = \ 9 5$ final threshold led to trivially different averages. Hence we used a custom threshold for each baseline method such that they had similar average attribution in the patch as RectGrad. We observed that RectGrad had smaller standard deviation than baseline methods. This indicates that RectGrad more consistently assigns near-zero attribution to the patch. Therefore RectGrad has advantages over baseline methods regardless of whether final threshold is used or not. Figures for the following quantitative experiment outcomes are in Appendix A.4.
|
| 162 |
+
|
| 163 |
+
Noise Level. We evaluated whether RectGrad really reduces noise through two experiments. For the first test, we created segmentation masks for 10 correctly classified images of each class (total 100 images) and measured how much attribution falls on the background. Specifically, we compared the sum of absolute value of attribution on the background. For the second test, we measured the average total variation of attribution maps for each attribution method. The average was taken over the test dataset. Figure 13 shows that RectGrad assigned significantly less attribution to the background than baseline methods. Moreover, even with final thresholding, RectGrad outperformed baseline methods. In addition, Figure 14 shows that even though the total variation reduces for baseline methods after final thresholding, RectGrad outperforms baseline methods in both cases. The results imply that baselines with final thresholding cannot replicate RectGrad’s ability to reduce noise.
|
| 164 |
+
|
| 165 |
+
Sensitivity. We evaluated RectGrad using the Sensitivity metric proposed by Bach et al. (2015) and Samek et al. (2017). Specifically, we measured how the logit for the initial class changed as features were occluded based on the ordering assigned by the attribution method. We split the image into non-overlapping patches of $2 \times 2$ pixels. Next, we computed attributions and summed all the values within each patch. We sorted the patches in decreasing order based on the aggregate attribution values. We then incrementally replaced the first 100 patches with per-channel mean computed using the entire training set and measured the change in class logit. We calculated the average across 500 randomly chosen test set images. An attribution method is better if it has a lower sensitivity AUC.
|
| 166 |
+
|
| 167 |
+
The results are shown in Figure 15. All attribution methods outperformed the random baseline in which we randomly removed patches. We observed that RectGrad performed better than local attribution methods. In comparison with global attribution methods, RectGrad showed similar performance up to approximately 10 patches (red vertical line) but the performance dropped as more patches were removed. In Appendix B.1, we offer an explanation for this behavior. Figure 16 shows that after final thresholding, RectGrad still outperforms local attribution methods. For global attribution methods, RectGrad now shows similar performance.
|
| 168 |
+
|
| 169 |
+
ROAR and KAR. We evaluated RectGrad using Remove and Retrain (ROAR) and Keep and Retrain (KAR) proposed by Hooker et al. (2018). Specifically, we measured how the performance of the classifier changed as features were occluded based on the ordering assigned by the attribution method. For ROAR, given an attribution method, we replaced a fraction of all CIFAR-10 pixels that were estimated to be most important with a constant value. We then retrained a CNN on the modified dataset and measured the change in test accuracy. For KAR, we replaced a fraction of all CIFAR-10 pixels that were estimated to be least important. We trained 3 CNNs per estimator for each fraction $\{ 0 . 1 , 0 . 3 , 0 . 5 , 0 . 7 , 0 . 9 \}$ . We measured test accuracy as the average of theses 3 CNNs. An attribution method is better if it has a lower ROAR AUC and a higher KAR AUC.
|
| 170 |
+
|
| 171 |
+
Figure 17 presents ROAR scores. All attribution methods outperformed the random baseline in which we randomly removed pixels. RectGrad showed similar performance to local attribution methods but performed worse than all global attribution methods. Next, Figure 18 shows KAR scores. Interestingly, all baseline attribution methods failed to exceed even the random baseline. Only RectGrad had similar or better performance than the random baseline. In Appendix B.2, we offer an explanation for why RectGrad performed poorly in ROAR.
|
| 172 |
+
|
| 173 |
+
# 6 CONCLUSIONS
|
| 174 |
+
|
| 175 |
+
Saliency map is the most basic means of interpreting deep neural network decisions. However, it is often visually noisy. Although several hypotheses were proposed to account for this phenomenon, there is no work that provides a thorough analysis of noisy saliency maps. Therefore, we first identified saliency maps are noisy because DNNs do not filter out irrelevant features during forward propagation. We then proposed RectGrad Gradient which significantly improves saliency maps by alleviating this problem through layer-wise thresholding during backpropagation. We showed that Rectified Gradient generalizes Deconvolution and Guided Backpropagation and moreover, overcomes the class-insensitivity problem. We also demonstrated through extensive experiments that Rectified Gradient outperforms previous attribution methods.
|
| 176 |
+
|
| 177 |
+
# REFERENCES
|
| 178 |
+
|
| 179 |
+
Mart´ın Abadi, Paul Barham, Jianmin Chen, Zhifeng Chen, Andy Davis, Jeffrey Dean, Matthieu Devin, Sanjay Ghemawat, Geoffrey Irving, Michael Isard, Manjunath Kudlur, Josh Levenberg, Rajat Monga, Sherry Moore, Derek G. Murray, Benoit Steiner, Paul Tucker, Vijay Vasudevan, Pete Warden, Martin Wicke, Yuan Yu, and Xiaoqiang Zheng. Tensorflow: A system for largescale machine learning. In Proceedings of the 12th USENIX Conference on Operating Systems Design and Implementation, OSDI’16, pp. 265–283, Berkeley, CA, USA, 2016. USENIX Association. ISBN 978-1-931971-33-1. URL http://dl.acm.org/citation.cfm?id $=$ 3026877.3026899.
|
| 180 |
+
|
| 181 |
+
Marco Ancona, Enea Ceolini, Cengiz Oztireli, and Markus Gross. Towards better understanding ¨ of gradient-based attribution methods for deep neural networks. In International Conference on Learning Representations, 2018.
|
| 182 |
+
|
| 183 |
+
Sebastian Bach, Alexander Binder, Gregoire Montavon, Frederick Klauschen, Klaus Robert M ´ uller, ¨ and Wojciech Samek. On pixel-wise explanations for non-linear classifier decisions by layer-wise relevance propagation. PLoS ONE, 10(7):1–46, 2015. ISSN 19326203. doi: 10.1371/journal. pone.0130140.
|
| 184 |
+
|
| 185 |
+
David Baehrens, Timon Schroeter, Stefan Harmeling, Motoaki Kawanabe, Katja Hansen, and KlausRobert Muller. How to explain individual classification decisions. ¨ Journal of Machine Learning Research, 11(Jun):1803–1831, 2010.
|
| 186 |
+
|
| 187 |
+
Dumitru Erhan, Yoshua Bengio, Aaron Courville, and Pascal Vincent. Visualizing higher-layer features of a deep network. University of Montreal 1341.3, 2009.
|
| 188 |
+
|
| 189 |
+
Ian J. Goodfellow, Jonathon Shlens, and Christian Szegedy. Striving for simplicity: The all convolutional net. In International Conference on Learning Representations, 2015.
|
| 190 |
+
|
| 191 |
+
Sara Hooker, Dumitru Erhan, Pieter-Jan Kindermans, and Been Kim. Evaluating feature importance estimates. In ICML Workshop on Human Interpretability in Machine Learning, 2018.
|
| 192 |
+
|
| 193 |
+
ALex Krizhevsky and Geoffrey Hinton. Learning multiple layers of features from tiny images. 2009.
|
| 194 |
+
|
| 195 |
+
Gregoire Montavon, Sebastian Lapuschkin, Alexander Binder, Wojciech Samek, and Klaus-Robert ´ Muller. Explaining nonlinear classification decisions with deep taylor decomposition. ¨ Pattern Recognition, 65:211–222, 2017.
|
| 196 |
+
|
| 197 |
+
Weili Nie, Yang Zhang, and Ankit Patel. A theoretical explanation for perplexing behaviors of backpropagation-based visualizations. In International Conference on Machine Learning, 2018.
|
| 198 |
+
|
| 199 |
+
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 Workshop on Autodiff, 2017.
|
| 200 |
+
|
| 201 |
+
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.
|
| 202 |
+
|
| 203 |
+
Wojciech Samek, Alexander Binder, Gregoire Montavon, Sebastian Lapuschkin, and Klaus-Robert ´ Muller. Evaluating the visualization of what a deep neural network has learned. ¨ IEEE transactions on neural networks and learning systems, 28(11):2660–2673, 2017.
|
| 204 |
+
|
| 205 |
+
Ramprasaath R. Selvaraju, Michael Cogswell, Abhishek Das, Ramakrishna Vedantam, Devi Parikh, and Dhruv Batra. Grad-cam: Visual explanations from deep networks via gradient-based localization. In The IEEE International Conference on Computer Vision, Oct 2017.
|
| 206 |
+
|
| 207 |
+
Avanti Shrikumar, Peyton Greenside, and Anshul Kundaje. Learning important features through propagating activation differences. In International Conference on Machine Learning, 2017.
|
| 208 |
+
|
| 209 |
+
Karen Simonyan, Andrea Vedaldi, and Andrew Zisserman. Deep inside convolutional networks: Visualising image classification models and saliency maps. In International Conference on Learning Representations Workshop, 2014.
|
| 210 |
+
|
| 211 |
+
Daniel Smilkov, Nikhil Thorat, Been Kim, Fernanda Viegas, and Martin Wattenberg. Smoothgrad: ´ removing noise by adding noise. In ICML Workshop on Visualization for Deep Learning, 2017.
|
| 212 |
+
|
| 213 |
+
Jost Tobias Springenberg, Alexey Dosovitskiy, Thomas Brox, and Martin Riedmiller. Striving for simplicity: The all convolutional net. International Conference on Learning Representations Workshop, 2015.
|
| 214 |
+
|
| 215 |
+
Mukund Sundararajan, Ankur Taly, and Qiqi Yan. Gradients of counterfactuals. arXiv preprint arXiv:1611.02639, 2016.
|
| 216 |
+
|
| 217 |
+
Mukund Sundararajan, Ankur Taly, and Qiqi Yan. Axiomatic attribution for deep networks. In International Conference on Machine Learning, 2017.
|
| 218 |
+
|
| 219 |
+
Christian Szegedy, Sergey Ioffe, Vincent Vanhoucke, and Alexander A Alemi. Inception-v4, inception-resnet and the impact of residual connections on learning. In AAAI Conference on Artificial Intelligence, 2017.
|
| 220 |
+
|
| 221 |
+
Matthew D Zeiler and Rob Fergus. Visualizing and understanding convolutional networks. In European Conference on Computer Vision, pp. 818–833. Springer, 2014.
|
| 222 |
+
|
| 223 |
+
# A EXPERIMENT RESULTS
|
| 224 |
+
|
| 225 |
+
A.1 SUPPLEMENTARY EXPERIMENT FOR FEATURE MAP OCCLUSION
|
| 226 |
+
|
| 227 |
+

|
| 228 |
+
(c) Average of (class logit) − (largest logit among the other 9 classes) as background feature activations are incrementally occluded in a random order (average is taken over 50 random trials). The average is taken over 100 images. The average is illustrated by a solid red line, standard deviation by the shaded blue region, and 10 randomly selected instances by green dotted lines.
|
| 229 |
+
Figure 9: Larger-scale study of the impact of background feature activation occlusion on the final decision.
|
| 230 |
+
|
| 231 |
+
To further support our claim that background feature activations are irrelevant to the classification task, we conducted a larger-scale experiment. We created segmentation masks for 10 correctly classified images of each class (total 100 images) and repeated the feature map occlusion for each image. We then took the average of (class logit) − (largest logit among the other 9 classes) across all 100 images. Figures 9a and 9b give an example of a background segmentation mask and a completely occluded feature map. Figure 9c shows that the difference is generally positive throughout the occlusion process, that is, the class does not change for most images. From this, we can infer that background features are generally irrelevant to the classification task.
|
| 232 |
+
|
| 233 |
+
# A.2 SUPPLEMENTARY EXPERIMENT FOR NOISE ACCUMULATION
|
| 234 |
+
|
| 235 |
+
<table><tr><td>Tiger</td><td>Saliency Map</td><td>RectGrad</td></tr><tr><td></td><td></td><td></td></tr></table>
|
| 236 |
+
|
| 237 |
+

|
| 238 |
+
|
| 239 |
+

|
| 240 |
+
|
| 241 |
+

|
| 242 |
+
|
| 243 |
+

|
| 244 |
+
|
| 245 |
+

|
| 246 |
+
|
| 247 |
+

|
| 248 |
+
|
| 249 |
+

|
| 250 |
+
|
| 251 |
+

|
| 252 |
+
|
| 253 |
+

|
| 254 |
+
|
| 255 |
+

|
| 256 |
+
|
| 257 |
+
<table><tr><td></td><td></td><td></td><td></td><td>中</td><td>+</td><td>A</td><td>美</td><td>E 中</td><td>山 ■</td></tr></table>
|
| 258 |
+
|
| 259 |
+

|
| 260 |
+
Figure 10: Saliency map and RectGrad attributions at Inception v4 intermediate layers as they are propagated toward the input layer. We show channel-wise average attributions for hidden layer inputs with respect to the output layer. For each subfigure, first row shows the input image and Saliency map and RectGrad attribution maps. Second and third rows show Saliency map and RectGrad attributions at intermediate layers, respectively. An attribution map is closer to the output layer if it is closer to the right.
|
| 261 |
+
|
| 262 |
+
To verify our claims on the noise accumulation phenomenon, we compared Saliency map and RectGrad attributions as they are propagated towards the input layer. As Figure 10 shows, at higher layers, Saliency map attributions for objects of interest are generally larger than or equal to attributions on the background. However, as they are propagated towards the input layer, attributions for objects of interest diminish while background attributions grow. On the other hand, RectGrad removes background attributions from higher layers through importance score based thresholding, stopping noise accumulation in the first place.
|
| 263 |
+
|
| 264 |
+
# A.3 QUALITATIVE EXPERIMENTS
|
| 265 |
+
|
| 266 |
+

|
| 267 |
+
Figure 11: Evaluation of coherence within the same class (rows) without and with final thresholding.
|
| 268 |
+
|
| 269 |
+

|
| 270 |
+
Figure 12: Comparison of attribution maps for images (left column) and their adversarial examples (right column) without and with final thresholding. This figure shows examples where attribution maps produced by RectGrad did not change significantly.
|
| 271 |
+
|
| 272 |
+

|
| 273 |
+
Figure 13: Comparison of amount of attribution on the background. The left and right charts compare the amount of attribution outside mask (on background) without and with final thresholding respectively.
|
| 274 |
+
|
| 275 |
+

|
| 276 |
+
Figure 14: Comparison of average total variation. The left and right charts compare average total variation without and with final thresholding respectively.
|
| 277 |
+
|
| 278 |
+

|
| 279 |
+
Figure 15: Comparison of Sensitivity. The left plot compares RectGrad with local attribution methods and the right plot with with global attribution methods. We also include the random baseline (patches are randomly removed) for reference. Lower AUC indicates a better attribution method. The red vertical line in the right plot indicates where RectGrad starts to perform worse than baseline global attribution methods (10 patches). We took the average over 500 randomly chosen test set images.
|
| 280 |
+
|
| 281 |
+

|
| 282 |
+
Figure 16: Comparison of Sensitivity after final thresholding. The left plot compares RectGrad with local attribution methods and the right plot with with global attribution methods. We also include the random baseline (patches are randomly removed) for reference. Lower AUC indicates a better attribution method. We took the average over 500 randomly chosen test set images.
|
| 283 |
+
|
| 284 |
+

|
| 285 |
+
Figure 17: Comparison of ROAR. The left plot compares RectGrad with local attribution methods and the right plot with with global attribution methods. We also include the random baseline (pixels are randomly removed) for reference. Lower AUC indicates a better attribution method.
|
| 286 |
+
|
| 287 |
+

|
| 288 |
+
Figure 18: Comparison of KAR. The left plot compares RectGrad with local attribution methods and the right plot with with global attribution methods. We also include the random baseline (pixels are randomly removed) for reference. Higher AUC indicates a better attribution method.
|
| 289 |
+
|
| 290 |
+
# B ADDITIONAL EXPLANATION FOR QUANTITATIVE EXPERIMENTS
|
| 291 |
+
|
| 292 |
+
# B.1 SENSITIVITY
|
| 293 |
+
|
| 294 |
+
In comparison with global attribution methods, RectGrad showed similar performance up to approximately 10 patches (red vertical line) but the performance dropped as more patches were removed (Figure 15). We speculate this happens due to the sparseness of RectGrad attribution maps. Since RectGrad attribution maps are sparser than those of other methods, occluding approximately 10 features will be enough to remove core features highlighted by RectGrad. Attributions for other features will not be as informative since they have trivial values. Figure 19 shows that it is indeed the case. For RectGrad, after occluding 10 top $2 \times 2$ patches, only attributions of small values remained. For Gradient \* Input, on the other hand, still had significant amount of nontrivial leftover attributions. We also see from Figure 16 that this phenomenon also happens for baseline methods with final thresholding. This implies that such behavior may be an inevitable consequence of sparseness.
|
| 295 |
+
|
| 296 |
+

|
| 297 |
+
Figure 19: Comparison of attribution methods in sensitivity. The first row shows the image as top N $2 \times 2$ patches are occluded according to RectGrad. The second and third rows show the positive parts (indicated by $+$ ) of RectGrad and Gradient \* Input attribution maps as top $N \ : 2 \times 2$ patches are occluded respectively. We did not cap outlying values in this visualization.
|
| 298 |
+
|
| 299 |
+
# B.2 ROAR
|
| 300 |
+
|
| 301 |
+
We believe that the poor performance of RectGrad in ROAR is also due to its sparseness. Since RectGrad produces visually coherent attribution maps, the occluded regions can act as discriminative features. To verify this, we replaced $1 0 \%$ of all CIFAR-10 pixels that were estimated to be most important with the channel-wise mean. We then trained a CNN on the occluded dataset and visualized RectGrad attribution maps for images whose original and occluded versions were both classified correctly. Figure 20 shows the results. Attribution maps highlighted pixels around the occluded regions and moreover, similar regions were emphasized in the original image. This corroborates our claim that the occluded regions act as discriminative features. The assumption behind ROAR is that the occluded features do not influence the classification task (Hooker et al., 2018). Since the above observation contradicts this assumption, ROAR may not be suitable for objectively evaluating RectGrad.
|
| 302 |
+
|
| 303 |
+

|
| 304 |
+
Figure 20: RectGrad attribution maps produced from a CNN trained on images occluded according to RectGrad. We show images whose original and occluded versions were both classified correctly.
|
| 305 |
+
|
| 306 |
+
# C USEFUL TECHNIQUES
|
| 307 |
+
|
| 308 |
+
Here, we present two useful techniques that can enhance the visual quality of attribution maps produced by RectGrad.
|
| 309 |
+
|
| 310 |
+
# C.1 PADDING TRICK
|
| 311 |
+
|
| 312 |
+
Convolution inputs are typically zero padded along the border in order to preserve the spatial dimension of feature maps.3 This occasionally leads to high activation values along the border if zero is out of input distribution. Since importance scores are calculated by multiplying activation with gradient, outlying border activation can cause RectGrad to be propagated through the border instead of relevant features. To solve this problem, we masked the border of gradient to zero before the backward pass through convolutions with padding. One possible concern with the padding trick is that attributions may be faint for features adjacent to the border of the image. However, we did not find this to be a significantly problem experimentally. Listing 2 in Appendix D.2 shows how to implement the padding trick in TensorFlow.
|
| 313 |
+
|
| 314 |
+
C.2 PROPORTIONAL REDISTRIBUTION RULE (PRR) FOR POOLING LAYERS.
|
| 315 |
+
|
| 316 |
+
Attribution maps produced by RectGrad tend to be rough due to the discrete nature of thresholding. This discontinuity can be compensated by using the proportional redistribution rule proposed by Montavon et al. (2017) for the backward pass through max-pooling layers. Instead of propagating the gradient through only the most activated unit in the pool, gradient is redistributed proportional to unit activations. Since the redistribution operation is continuous, attribution maps generated with the proportional redistribution rule are smoother. Listing 3 in Appendix D.3 shows how to implement the proportional redistribution rule in TensorFlow.
|
| 317 |
+
|
| 318 |
+
# D TENSORFLOW CODES
|
| 319 |
+
|
| 320 |
+
# D.1 IMPLEMENTATION OF RECTIFIED GRADIENT
|
| 321 |
+
|
| 322 |
+
1 import tensorflow as tf
|
| 323 |
+
2
|
| 324 |
+
3 from tensorflow.contrib.distributions import percentile
|
| 325 |
+
4
|
| 326 |
+
5 @tf.RegisterGradient("RectifiedRelu")
|
| 327 |
+
6 def _RectifiedReluGrad(op, grad):
|
| 328 |
+
7
|
| 329 |
+
8 def threshold(x, q):
|
| 330 |
+
9
|
| 331 |
+
10 if len(x.shape.as_list()) $> 3$ :
|
| 332 |
+
11 thresh $=$ percentile(x, q, axis $=$ [1,2,3], keep_dims $=$ True)
|
| 333 |
+
12 else:
|
| 334 |
+
13 thresh $=$ percentile(x, q, axis $^ { = 1 }$ , keep_dims $=$ True)
|
| 335 |
+
14
|
| 336 |
+
15 return thresh
|
| 337 |
+
16
|
| 338 |
+
17 activation_grad $=$ op.outputs[0] $\star$ grad
|
| 339 |
+
18 thresh $=$ threshold(activation_grad, q)
|
| 340 |
+
19
|
| 341 |
+
20 return tf.where(thresh $<$ activation_grad, grad, tf.zeros_like(grad))
|
| 342 |
+
|
| 343 |
+
Listing 1: Implementation of Rectified Gradient in TensorFlow. After registering this function as the gradient for ReLU activation functions, call tf.gradients() and multiply with inputs to generate attributions.
|
| 344 |
+
|
| 345 |
+
# D.2 IMPLEMENTATION OF THE PADDING TRICK
|
| 346 |
+
|
| 347 |
+
import tensorflow as tf
|
| 348 |
+
2
|
| 349 |
+
3 @tf.RegisterGradient("RectifiedConv2D")
|
| 350 |
+
4 def _RectifiedConv2DGrad(op, grad):
|
| 351 |
+
5
|
| 352 |
+
6 if op.get_attr(’padding’) $= =$ b’SAME’:
|
| 353 |
+
7
|
| 354 |
+
8 shape $=$ tf.shape(grad)
|
| 355 |
+
9 mask $=$ tf.ones([shape[0], shape[1] - 2, shape[2] - 2, shape[3]])
|
| 356 |
+
10 mask $=$ tf.pad(mask, [[0,0],[1,1],[1,1],[0,0]])
|
| 357 |
+
11 grad $=$ grad $\star$ mask
|
| 358 |
+
12
|
| 359 |
+
13 input_grad $=$ tf.nn.conv2d_backprop_input(tf.shape(op.inputs[0]), op.
|
| 360 |
+
inputs[1], grad, op.get_attr(’strides’), op.get_attr(’padding’))
|
| 361 |
+
14 filter_grad $=$ tf.nn.conv2d_backprop_filter(op.inputs[0], tf.shape(op.
|
| 362 |
+
inputs[1]), grad, op.get_attr(’strides’), op.get_attr(’padding’))
|
| 363 |
+
15
|
| 364 |
+
16 return input_grad, filter_grad
|
| 365 |
+
|
| 366 |
+
Listing 2: Implementation of the padding trick in TensorFlow. After registering this function as the gradient for convolution operations, call tf.gradients() and multiply with inputs to generate attributions.
|
| 367 |
+
|
| 368 |
+
# D.3 IMPLEMENTATION OF THE PROPORTIONAL REDISTRIBUTION RULE
|
| 369 |
+
|
| 370 |
+
1 import tensorflow as tf
|
| 371 |
+
2
|
| 372 |
+
3 from tensorflow.python.ops import gen_nn_ops
|
| 373 |
+
4
|
| 374 |
+
5 @tf.RegisterGradient("RectifiedMaxPool")
|
| 375 |
+
6 def _RectifiedMaxPoolGrad(op, grad):
|
| 376 |
+
7
|
| 377 |
+
8 $_ { \textrm { } \textrm { } \textrm { } \textrm { } } \textrm { } \textrm { }$ tf.nn.avg_pool(op.inputs[0], op.get_attr(’ksize’), op.get_attr(’
|
| 378 |
+
strides’), op.get_attr(’padding’)) $^ +$ 1e-10
|
| 379 |
+
9 $_ { \textrm { { S } } } =$ grad / z
|
| 380 |
+
10 $\mathbf { \Sigma } _ { \subset } ~ =$ gen_nn_ops._avg_pool_grad(tf.shape(op.inputs[0]), s, op.get_attr(
|
| 381 |
+
’ksize’), op.get_attr(’strides’), op.get_attr(’padding’))
|
| 382 |
+
11
|
| 383 |
+
12 return op.inputs[0] \* c
|
| 384 |
+
|
| 385 |
+
# E PROOF OF CLAIMS
|
| 386 |
+
|
| 387 |
+
# E.1 PROOF OF CLAIM 1
|
| 388 |
+
|
| 389 |
+
Proof. Note that the backward propagation rule for Deconvolution through the ReLU nonlinearity is given by
|
| 390 |
+
|
| 391 |
+
$$
|
| 392 |
+
R _ { i } ^ { ( l ) } = \mathbb { I } \left( R _ { i } ^ { ( l + 1 ) } > 0 \right) \cdot R _ { i } ^ { ( l + 1 ) } .
|
| 393 |
+
$$
|
| 394 |
+
|
| 395 |
+
Since the DNN uses ReLU activation functions, $a _ { i } ^ { ( l ) } + \epsilon > 0$ and therefore
|
| 396 |
+
|
| 397 |
+
$$
|
| 398 |
+
\mathbb { I } \left[ \left( a _ { i } ^ { ( l ) } + \epsilon \right) \cdot R _ { i } ^ { ( l + 1 ) } > 0 \right] = \mathbb { I } \left( R _ { i } ^ { ( l + 1 ) } > 0 \right)
|
| 399 |
+
$$
|
| 400 |
+
|
| 401 |
+
for all $l$ and $i$ . The result follows from Equation 2.
|
| 402 |
+
|
| 403 |
+
# E.2 PROOF OF CLAIM 2
|
| 404 |
+
|
| 405 |
+
Proof. Note that the backward propagation rule for Guided Backpropagation through the ReLU nonlinearity is given by
|
| 406 |
+
|
| 407 |
+
$$
|
| 408 |
+
R _ { i } ^ { ( l ) } = \mathbb { I } \left( z _ { i } ^ { ( l ) } > 0 \right) \cdot \mathbb { I } \left( R _ { i } ^ { ( l + 1 ) } > 0 \right) \cdot R _ { i } ^ { ( l + 1 ) } .
|
| 409 |
+
$$
|
| 410 |
+
|
| 411 |
+
Since the DNN uses ReLU activation functions, $a _ { i } ^ { ( l ) } \geq 0$ and therefore
|
| 412 |
+
|
| 413 |
+
$$
|
| 414 |
+
\mathbb { I } \left( a _ { i } ^ { ( l ) } \cdot R _ { i } ^ { ( l + 1 ) } > 0 \right) = \mathbb { I } \left( z _ { i } ^ { ( l ) } > 0 \right) \cdot \mathbb { I } \left( R _ { i } ^ { ( l + 1 ) } > 0 \right)
|
| 415 |
+
$$
|
| 416 |
+
|
| 417 |
+
for all $l$ and $i$ . The result follows from Equation 4.
|
| 418 |
+
|
| 419 |
+
# F EXPERIMENTS SETUP
|
| 420 |
+
|
| 421 |
+
# F.1 ATTRIBUTION MAP VISUALIZATION
|
| 422 |
+
|
| 423 |
+
To visualize the attributions, we summed up the attributions along the color channel and then capped low outlying values to $0 . 5 ^ { \mathrm { t h } }$ percentile and high outlying values to $9 9 . 5 ^ { \mathrm { t h } }$ percentile for RGB images. We only capped outlying values for grayscale images.
|
| 424 |
+
|
| 425 |
+
# F.2 CIFAR-10
|
| 426 |
+
|
| 427 |
+
The CIFAR-10 dataset (Krizhevsky & Hinton, 2009) was pre-processed to normalize the input images into range $[ - 1 ; 1 ]$ . We trained a CNN using ReLU activation functions with Adam for 20 epochs to achieve $7 9 . 4 \%$ test accuracy. For the dataset occluded with the random patch, we used the same settings to achieve $7 9 . 3 \%$ test accuracy.
|
| 428 |
+
|
| 429 |
+
<table><tr><td rowspan=1 colspan=1>CIFAR-10 CNN</td></tr><tr><td rowspan=1 colspan=1>Conv 2D (3 × 3,32 kernels)</td></tr><tr><td rowspan=1 colspan=1>Conv 2D (3 × 3,32 kernels)</td></tr><tr><td rowspan=1 colspan=1>Max-pooling (2 × 2)</td></tr><tr><td rowspan=1 colspan=1>Dropout (0.25)</td></tr><tr><td rowspan=1 colspan=1>Conv 2D (3 × 3, 64 kernels)</td></tr><tr><td rowspan=1 colspan=1>Conv 2D (3 × 3, 64 kernels)</td></tr><tr><td rowspan=1 colspan=1>Max-pooling (2 × 2)</td></tr><tr><td rowspan=1 colspan=1>Dropout (0.25)</td></tr><tr><td rowspan=1 colspan=1>Dense (256)</td></tr><tr><td rowspan=1 colspan=1>Dropout (0.5)</td></tr><tr><td rowspan=1 colspan=1>Dense (10)</td></tr></table>
|
| 430 |
+
|
| 431 |
+
# F.3 INCEPTION V4
|
| 432 |
+
|
| 433 |
+
We used a pre-trained Inception V4 network. The details of this architecture can be found in Szegedy et al. (2017). For the adversarial attack, we used the fast gradient sign method with $\epsilon = 0 . 0 1$ .
|
md/train/HksioDcxl/HksioDcxl.md
ADDED
|
@@ -0,0 +1,254 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# JOINT TRAINING OF RATINGS AND REVIEWS WITHRECURRENT RECOMMENDER NETWORKS
|
| 2 |
+
|
| 3 |
+
Chao-Yuan Wu
|
| 4 |
+
University of Texas at Austin Austin, TX, USA
|
| 5 |
+
cywu@cs.utexas.edu
|
| 6 |
+
Amr Ahmed & Alex Beutel∗
|
| 7 |
+
Google
|
| 8 |
+
Mountain View, CA, USA
|
| 9 |
+
{amra,alexbeutel}@google.com
|
| 10 |
+
|
| 11 |
+
Alexander J. Smola Carnegie Mellon University Pittsburgh, PA, USA alex@smola.org
|
| 12 |
+
|
| 13 |
+
# ABSTRACT
|
| 14 |
+
|
| 15 |
+
Accurate modeling of ratings and text reviews is at the core of successful recommender systems. While neural networks have been remarkably successful in modeling images and natural language, they have been largely unexplored in recommender system research. In this paper, we provide a neural network model that combines ratings, reviews, and temporal patterns to learn highly accurate recommendations. We co-train for prediction on both numerical ratings and natural language reviews, as well as using a recurrent architecture to capture the dynamic components of users’ and items’ states. We demonstrate that incorporating text reviews and temporal dynamic gives state-of-the-art results over the IMDb dataset.
|
| 16 |
+
|
| 17 |
+
# 1 INTRODUCTION
|
| 18 |
+
|
| 19 |
+
Designing highly accurate recommender systems has been the focus of research in many communities and at the center of many products for the past decade. The core goal is to predict which items a given user will like or dislike, typically based on a database of previous ratings and reviews. In particular, a good recommender system has been defined as one that predicts the rating for randomly chosen and unseen (user,item) pairs. During the Netflix Prize contest, a variety of factorization models were proposed to capture the latent embeddings of users and items that would lead to accurate recommendations (Bell & Koren, 2007; Koren et al., 2009). Generative models for personalized ratings have recently become popular, due to impressive and robust results (Mnih & Salakhutdinov, 2007; Salakhutdinov & Mnih, 2008; Stern et al., 2009; Beutel et al., 2015).
|
| 20 |
+
|
| 21 |
+
More recently, there has been an interest in the recommender system community to also make use of the rich natural language reviews provided by users. Most often, these reviews have been transformed into a bag-of-words-model and used as a sort of regularization for the rating predictions (McAuley & Leskovec, 2013; Diao et al., 2014; Almahairi et al., 2015; Wu et al., 2016b). Using reviews in this way has been found to improve prediction accuracy, and in some cases provide detailed explanations for the recommendations.
|
| 22 |
+
|
| 23 |
+
This previous research has been remarkably successful, but has two significant limitations that we discuss and address in this paper. First, prediction accuracy has rarely been measured by the ability of a model to predict future ratings. Rather, recommendation accuracy has been derived from a random split of the ratings data, which undermines our understanding of the models’ usefulness in practice. Here, we focus on predicting future ratings, splitting our training and testing data by date. In order to be successful at this task, we incorporate the time of ratings and reviews in our model structure and training. Koren (2010) previously derived temporal features of ratings data, but used these features to remove temporal effects since the metric of success was interpolation, not extrapolation. More recently, Recurrent Recommender Networks (RNN) use a recurrent neural network to capture changes in both user preferences and item perceptions, and extrapolate future ratings in an autoregressive way (Wu et al., 2016a). However, temporal patterns in reviews are largely unexplored. Note that just like ratings, reviews also depend on changing factors, such as user writing styles, user preferences, movie perceptions, or the popularity of certain slang words or emoticons. Here we use a generative LSTM model that is able to jointly model the temporal effects in ratings and reviews.
|
| 24 |
+
|
| 25 |
+
Second, models of reviews in recommender system fall significantly behind the state-of-the-art in natural language processing. The bag-of-words model used in previous research improves over not using text, but is limited in the degree to which it can understand the review. In fact, the drawback of an underfitting model is especially salient in the case of reviews, because they are much more diverse and unstructured than regular documents. Recently there has been significant research attention on modeling natural language with neural networks, with encouraging results (Lipton et al., 2015; Yang et al., 2016). Here, we combine these powerful neural-based language models with recurrent neural network to learn both accurate recommendations and accurate reviews. Our main contributions are as follows:
|
| 26 |
+
|
| 27 |
+
• Joint generative model: We propose a novel joint model of ratings and reviews via interacting recurrent networks (particularly LSTM).
|
| 28 |
+
• Nonlinear nonparametric review model: By learning a function of user and movie state dynamics, we can capture the evolution of reviews (as well as ratings) over time.
|
| 29 |
+
• Experiments show that by jointly modeling ratings and reviews along with temporal patterns, our model achieves state-of-the-art results on IMDb dataset in terms of forward prediction, i.e. in the realistic scenario where we use only ratings strictly prior to prediction time to predict future ratings.
|
| 30 |
+
|
| 31 |
+
# 2 RELATED WORK
|
| 32 |
+
|
| 33 |
+
Collaborative Filtering As mentioned in the introduction, recommender systems have been the focus of many different research communities. The Netflix Prize generated a flurry of research to improve recommendation accuracy, with a variety of matrix factorization models being proposed (Bell & Koren, 2007; Koren et al., 2009; Koren, 2008). During the Netflix competition and more afterwards, a stream of research has focused on designing generative Bayesian models for user ratings data (Mnih & Salakhutdinov, 2007; Salakhutdinov & Mnih, 2008; Stern et al., 2009; Beutel et al., 2014; 2015). Nearly all of these models predict ratings by an inner product between a latent user embedding and a latent item embedding; different approaches primarily regularization, e.g., Bayesian models and learning algorithms capture uncertainty in the data.
|
| 34 |
+
|
| 35 |
+
Other models have tried to capture interesting patterns discovered in ratings data. As an example, Beutel et al. (2014) finds that some ratings form bimodal rather than Gaussian distributions and designs a model to accommodate this diversity. More closely related to this work, Koren (2010) designs many features to capture and remove the temporal effects in ratings data. By removing these temporal effects, Koren (2010) learns better stationary embeddings for users and items. Work such as this improves prediction accuracy, but has two drawbacks: (1) it requires time consuming feature engineering, and (2) it focuses on interpolation rather than extrapolation into the future. Wu et al. (2016a) addresses both of these concerns by learning a function for the evolution of user preferences and item properties. However, this work focuses exclusively on modeling ratings over time and, in a large part, on the qualitative patterns discovered in the Netflix dataset. Here we focus on the model itself and, in particular, the interaction of jointly understanding ratings, reviews, and temporal patterns.
|
| 36 |
+
|
| 37 |
+
Review Modeling Although the most common metric for recommendation accuracy has been rating prediction, natural language reviews provide rich, detailed insight into user preferences. Most often, reviews have been used in a bag-of-words model to regularize rating prediction (McAuley & Leskovec, 2013; Diao et al., 2014; Wu et al., 2016b). For example, McAuley & Leskovec (2013) effectively learns a topic model of reviews regularize item embeddings. By using such coarse models, the impact of and insight from reviews is limited. More recently, Almahairi et al. (2015) use neural network based review models to regularize hidden factors, but their model assumes only stationary states.
|
| 38 |
+
|
| 39 |
+

|
| 40 |
+
Figure 1: As shown on the left, previous recommendation models learn static stationary embeddings for users and movies to predict ratings. As shown on the right, we can also capture temporal effects present in the data. We have both user and movie embeddings follow a Markov chain, and use these dynamic embeddings (along with stationary ones not shown) to predict both ratings and text reviews.
|
| 41 |
+
|
| 42 |
+
Interestingly, data mining research has found that review patterns are dynamic, with different language being adopted by communities over time (Danescu-Niculescu-Mizil et al., 2013). Therefore, it is important to capture not just the dynamics of ratings, but also the language used to justify those ratings.
|
| 43 |
+
|
| 44 |
+
Neural Networks Neural networks have recently offered large improvements in natural language processing. More recently, a few papers have focused these natural language models on online reviews (Lipton et al., 2015; Yang et al., 2016). However, while these papers do model online reviews, they differ greatly from our work in that they are not actually used for recommendation.
|
| 45 |
+
|
| 46 |
+
With the recent remarkable successes of neural networks in other domains, there has been growing attention on using neural networks for model graphs and ratings data. Most similar, Sedhain et al. (2015) design an autoencoder for collaborative filtering.
|
| 47 |
+
|
| 48 |
+
LSTM and Recurrent Network Recurrent neural network provides a powerful tool to nonparametrically model temporal data by using a latent variable autoregressive model as follows:
|
| 49 |
+
|
| 50 |
+
$$
|
| 51 |
+
\hat { z } _ { t + 1 } = f ( h _ { t } , z _ { t } ) \mathrm { a n d } h _ { t + 1 } = g ( h _ { t } , z _ { t + 1 } ) .
|
| 52 |
+
$$
|
| 53 |
+
|
| 54 |
+
Where $z _ { t }$ is the observation at time $t$ , $\hat { z } _ { t }$ is the model associated estimate, and $h _ { t }$ denotes the latent state. A popular class of RNN is the Long Short Term Memory (LSTM) (Hochreiter $\&$ Schmidhuber, 1997) and we use this as a building block in our model .The state updates is given below:
|
| 55 |
+
|
| 56 |
+
$$
|
| 57 |
+
\begin{array} { r l } & { [ f _ { t } , i _ { t } , o _ { t } ] = \sigma \left[ W \left[ h _ { t - 1 } , z _ { t } \right] + b \right] } \\ & { \quad \quad \quad l _ { t } = \operatorname { t a n h } \left[ V \left[ h _ { t - 1 } , z _ { t } \right] + d \right] } \\ & { \quad \quad \quad c _ { t } = f _ { t } \cdot c _ { t - 1 } + i _ { t } \cdot l _ { t } } \\ & { \quad \quad \quad h _ { t } = o _ { t } \cdot \operatorname { t a n h } ( c _ { t } ) , } \end{array}
|
| 58 |
+
$$
|
| 59 |
+
|
| 60 |
+
where $f _ { t } , i _ { t } , o _ { t }$ denote the forget gate, input gate and the output gate respectively. For simplicity in the following we denote this set of operations by $h _ { t } = \mathrm { L S T M } ( h _ { t - 1 } , z _ { t } )$ . We will refer to $h _ { t }$ as the output embedding from the LSTM.
|
| 61 |
+
|
| 62 |
+
# 3 MODEL
|
| 63 |
+
|
| 64 |
+
A comparison of our model with traditional recommender systems is illustrated in Figure 1. In previous recommender systems, ratings are assumed to be a function of stationary user and movie embeddings. Here we consider dynamic embeddings that predict both ratings and text reviews at a given time step.
|
| 65 |
+
|
| 66 |
+
Figure 2 shows a depiction of our model: Joint Review-Rating Recurrent Recommender Network. In addition to stationary embeddings as used in traditional recommender systems, here we use two
|
| 67 |
+
|
| 68 |
+

|
| 69 |
+
Figure 2: Joint Review-Rating Recurrent Recommender Networks: We use recurrent networks to capture the temporal evolution of user and movies states. The recurrent networks depend on the ratings of a user (and movie) in previous time steps. We combine these dynamic states with classic stationary states. We directly use all of these states to predict ratings, and use them within an LSTM to model review text.
|
| 70 |
+
|
| 71 |
+
LSTM RNNs that take user/movie history as input to capture the temporal dynamics in both user and movie states. Given stationary and dynamic states of user $i$ and movie $j$ , we define generator functions that emit both rating $r _ { i j } | t$ and reviews $o _ { i j } | t$ at time step $t$ . Formally,
|
| 72 |
+
|
| 73 |
+
$$
|
| 74 |
+
\begin{array} { r } { r _ { i j } | t = f ( u _ { i } , m _ { j } , u _ { i t } , m _ { j t } ) \quad \mathrm { a n d } \quad o _ { i j } | t = \psi ( u _ { i } , m _ { j } , u _ { i t } , m _ { j t } ) } \\ { u _ { i , t + 1 } = g ( u _ { i t } , \{ r _ { i j } | t \} ) \quad \mathrm { a n d } \quad m _ { j , t + 1 } = h ( m _ { j t } , \{ r _ { i j } | t \} ) , } \end{array}
|
| 75 |
+
$$
|
| 76 |
+
|
| 77 |
+
where $u _ { i }$ and $m _ { j }$ denote stationary states, and $u _ { i t }$ and $m _ { i t }$ denote the dynamic state at $t$ . Note that with learned $f , \psi , g$ and $h$ and given user/movie history, an user/movie state can be inferred without further optimization. In other words, different from traditional recommender systems, here we learn the functions that find the states instead of learning the states directly.
|
| 78 |
+
|
| 79 |
+
# 3.1 DYNAMIC USER AND MOVIE STATE
|
| 80 |
+
|
| 81 |
+
Here we give a detailed description on the RNNs that find the dynamic states. The key idea is to use user/movie rating history as inputs to update the states. In this way we are able to model causality instead of just finding correlation. That is, we can model e.g. the change of user (movie) state caused by having watched and liked/disliked a movie (being liked/disliked by certain users). At each step, the network takes
|
| 82 |
+
|
| 83 |
+
$$
|
| 84 |
+
y _ { t } : = W _ { \mathrm { e m b e d } } \left[ x _ { t } , 1 _ { \mathrm { n e w b i e } } , \tau _ { t } , \tau _ { t - 1 } \right] ,
|
| 85 |
+
$$
|
| 86 |
+
|
| 87 |
+
where $x _ { t }$ is the rating vector, $1 _ { \mathrm { n e w b i e } }$ is the indicator for new users, and $\tau _ { t }$ is wall-clock time. The $j$ th element of $x _ { t }$ is the rating the user gives for movie $j$ at time $t$ , and 0 otherwise. $1 _ { \mathrm { n e w b i e } }$ effectively select a default embedding for a new user, and $\tau _ { t }$ and $\tau _ { t - 1 }$ gives the model the information to synchronize between RNNs and model the effects such as rating scale change or movie age. Note that with the inclusion of $\tau \mathrm { s }$ , we do not need to include the steps where a user did not rate any movie, and this can drastically speed up training. The state update is given by standard $u _ { t } : = \mathrm { L S T M } ( u _ { t - 1 } , y _ { t } )$ . In the above we omit user index for clarity. In cases where we need to distinguish different users (and movies) such as in Figure 2, we use additional index $i$ for user $i$ as in $u _ { i t }$ , and similarly for movie $j$ in $m _ { j t }$ .
|
| 88 |
+
|
| 89 |
+
# 3.2 RATING EMISSIONS
|
| 90 |
+
|
| 91 |
+
We supplement the time-varying profile vectors $u _ { i t }$ and $m _ { j t }$ with stationary ones $u _ { i }$ and $m _ { j }$ respectively. These stationary components encode time-invariant properties such as long-term preference of a user or the genre of a movie.
|
| 92 |
+
|
| 93 |
+
The review rating is thus modeled as a function of both dynamic and stationary states, i.e.
|
| 94 |
+
|
| 95 |
+
$$
|
| 96 |
+
r _ { i j } = f ( u _ { i t } , m _ { j t } , u _ { i } , m _ { j } ) : = \langle \tilde { u } _ { i t } , \tilde { m } _ { j t } \rangle + \langle u _ { i } , m _ { j } \rangle
|
| 97 |
+
$$
|
| 98 |
+
|
| 99 |
+
where $\tilde { u } _ { i t }$ and $\tilde { m } _ { j t }$ are affine functions of $u _ { i t }$ and $m _ { j t }$ respectively. That is, we have
|
| 100 |
+
|
| 101 |
+
$$
|
| 102 |
+
\tilde { u } _ { i t } = W _ { \mathrm { u s e r } } u _ { i t } + b _ { \mathrm { u s e r } } \ \mathrm { a n d } \ \tilde { m } _ { j t } = W _ { \mathrm { m o v i e } } m _ { j t } + b _ { \mathrm { m o v i e } }
|
| 103 |
+
$$
|
| 104 |
+
|
| 105 |
+
This makes the model a strict superset of popular matrix factorization recommender systems that accounts for stationary effects, while we use LSTMs, on top of that, to model longer-range dynamic updates.
|
| 106 |
+
|
| 107 |
+
# 3.3 REVIEW TEXT MODEL
|
| 108 |
+
|
| 109 |
+
Review text is modeled by a character-level LSTM network. This network shares the same user/movie latent states with the rating model. After all, the purpose of a review is to explain its rating score. We fuse the stationary and dynamic states of both user of movie by the bottleneck layer $x _ { \mathrm { j o i n t } , i j }$ given below:
|
| 110 |
+
|
| 111 |
+
$$
|
| 112 |
+
\begin{array} { r l } & { x _ { \mathrm { j o i n t } , i j } : = \phi ( W _ { \mathrm { j o i n t } } \left[ u _ { i t } , m _ { j t } , u _ { i } , m _ { j } \right] + b _ { \mathrm { j o i n t } } ) } \\ & { \quad \tilde { x } _ { i j , k } : = \left[ x _ { o _ { i j , k } } , x _ { \mathrm { j o i n t } , i j } \right] } \end{array}
|
| 113 |
+
$$
|
| 114 |
+
|
| 115 |
+
where $o _ { i j , k }$ denotes the character at position $k$ for the review given by user $i$ to movie $j$ , and $x _ { o _ { i j , k } }$ denotes the embedding of the character. $\phi$ here is some non-linear function.
|
| 116 |
+
|
| 117 |
+
The review text emission model is itself an RNN, specifically a character-level LSTM generative model. For character index $k = 1 , 2 , \dots$ ,
|
| 118 |
+
|
| 119 |
+
$$
|
| 120 |
+
\begin{array} { r l } & { h _ { i j , k } : = \mathrm { L S T M } ( h _ { i j , k - 1 } , \tilde { x } _ { i j , k } ) } \\ & { \hat { o } _ { i j , k } : = \mathrm { s o f t m a x } \left( W _ { \mathrm { o u t } } h _ { i j , k } + b _ { \mathrm { o u t } } \right) } \end{array}
|
| 121 |
+
$$
|
| 122 |
+
|
| 123 |
+
Here a softmax layer at output of LSTM is used to predict the next character. Generating text conditioned on contents has been applied to various areas, such as machine translation (Sutskever et al., 2014), question answering (Gao et al., 2015), or image captioning (Vinyals et al., 2015). Probably the most similar approach is Lipton et al. (2015), but it conditions review generation on observed ratings instead of latent states.
|
| 124 |
+
|
| 125 |
+
# 3.4 PREDICTION
|
| 126 |
+
|
| 127 |
+
In prediction time, we make rating predictions based on predicted future states. That is, we take the latest ratings as input to update the states, and use the newly predicted states to predict ratings. This differs from traditional approaches where embeddings are estimated instead of inferred.
|
| 128 |
+
|
| 129 |
+
# 3.5 TRAINING
|
| 130 |
+
|
| 131 |
+
Our goal is to predict both accurate ratings and accurate reviews, and thus we minimize
|
| 132 |
+
|
| 133 |
+
$$
|
| 134 |
+
L : = \sum _ { ( i , j ) \in \mathcal { D } _ { \mathrm { t r a i n } } } \left[ \left( \hat { r } _ { i j } ( \theta ) - r _ { i j } \right) ^ { 2 } - \lambda \sum _ { k = 1 } ^ { n _ { i j } } \log \left( \operatorname* { P r } ( o _ { i j , k } | \theta ) \right) \right] ,
|
| 135 |
+
$$
|
| 136 |
+
|
| 137 |
+
where $\mathcal { D } _ { \mathrm { t r a i n } }$ is the training set of $( i , j )$ pairs, $\theta$ denotes all model parameters, and $n _ { i j }$ is the number of characters in the review user $i$ gives to movie $j$ . The first term corresponds to the deviation of the prediction from the actual rating, and the second term is the likelihood of the text reviews. $\lambda$ controls the weight between predicting accurate ratings and predicting accurate reviews. Our training follows the subspace descent strategy in $\mathrm { { W u } }$ et al. (2016a). That is, while the review generative model is updated in every iteration, the user-state and movie-state RNNs are updated in an alternating way.
|
| 138 |
+
|
| 139 |
+
Table 1: IMDb dataset comprises reviews and ratings collected from July 1998 to September 2013. Netflix 6 months data is a subset of original Netflix prize dataset that is split based on time.
|
| 140 |
+
|
| 141 |
+
<table><tr><td>Data</td><td></td><td></td><td>#users</td><td>#items</td><td># ratings (reviews)</td><td># characters</td></tr><tr><td>IMDb</td><td>Train Test</td><td>Jul 98 - Dec 12 Jan 13 - Sep 13</td><td>6,127</td><td>8,002</td><td>402.3k 11.0k</td><td>690.6M 21.6M</td></tr><tr><td>Netflix 6 months</td><td>Train Test</td><td>Jun - Nov 11 Dec 11</td><td>311.3k</td><td>17.7k</td><td>13.7M 2.1M</td><td>1 1</td></tr></table>
|
| 142 |
+
|
| 143 |
+
The gradients are calculated with standard backpropagation. Furthermore, we pre-warm train the review LSTM over the review text excluding the auxiliary input from the user and movie states. It is undesirable if the review likelihood overwhelms the rating. We hence normalize review likelihood by the number of characters in a review so that it does not dominates the rating likelihood. This technique is common in NLP literature (Wang & McCallum, 2006).
|
| 144 |
+
|
| 145 |
+
# 4 EXPERIMENTS
|
| 146 |
+
|
| 147 |
+
In this section we empirically demonstrate the ability of our model to accurately predict both ratings and reviews, and capture temporal dynamics.
|
| 148 |
+
|
| 149 |
+
# 4.1 EXPERIMENTAL SETUP
|
| 150 |
+
|
| 151 |
+
In the following experiments, we select hyperparameters, optimization parameters and model architecture by cross-validation. The details are as follows. We use 1-layer LSTM recurrent neural networks with 40 hidden factors for user/movie state transitions. The input of this LSTM is an user/item embedding of dimension 40. Stationary and dynamic factors are 160 and 40-dimensional respectively. A 2-layer LSTM network is used to model texts, which takes 30-dimensional character embedding $x _ { \mathrm { c h a r } }$ , 40-dimensional state vector $x _ { \mathrm { j o i n t } }$ , and a 50-dimensional movie embedding $x _ { \mathrm { m o v i e } }$
|
| 152 |
+
|
| 153 |
+
To speed up convergence, we initialize the text model by a character-level RNN pre-trained without considering rating. Stationary factors are initialized by a pre-trained iAutoRec (Sedhain et al., 2015) model based on the last layer. We initialize all the other parameters from uniform distribution between $[ - a , a ]$ with $a = \sqrt { 1 . 5 ( f _ { i n } + f _ { o u t } ) }$ , where $f _ { i n }$ and $f _ { o u t }$ are fan-in and fan-out of transition matrices. $\ell _ { 2 }$ regularization with magnitude 0.001 is applied to all parameters. Dropout with a 0.5 rate is applied after all fully-connected layers. To prevent exploding gradients in of LSTM, gradients are clipped to $[ - 1 5 , 1 5 ]$ . ADAM (Kingma & Ba, 2014) with learning rate 0.0015 is used for optimization.
|
| 154 |
+
|
| 155 |
+

|
| 156 |
+
Figure 3: Characteristics of IMDb dataset.
|
| 157 |
+
|
| 158 |
+
Data Here we focus on movie recommendations, where the opinions are highly dynamic. We evaluate our model on IMDb dataset, first used in Diao et al. (2014), that is the only large-scale movie
|
| 159 |
+
|
| 160 |
+
<table><tr><td></td><td>PMF</td><td>Time-SVD++</td><td>U-AutoRec</td><td>I-AutoRec</td><td>RRN (rating)</td><td>RRN (rating + text)</td></tr><tr><td>IMDb</td><td>1.7355</td><td>1.7348</td><td>1.7332</td><td>1.7135</td><td>1.7047</td><td>1.7012</td></tr><tr><td>Netflix 6 months</td><td>0.9584</td><td>0.9589</td><td>0.9836</td><td>0.9778</td><td>0.9427</td><td></td></tr></table>
|
| 161 |
+
|
| 162 |
+
Table 2: RRN outperforms competing models in terms of RMSE. In addition, jointly modeling ratings and reviews achieves even better accuracy.
|
| 163 |
+
|
| 164 |
+
review dataset available. Restaurant recommendations (e.g. Yelp) could be also a suitable domain, but full rating history is not available in publicly available datasets1.
|
| 165 |
+
|
| 166 |
+
The IMDb dataset contains full review and rating history of all users and all movies from 1998 to 2013. The characteristics of this dataset is shown in Figure 3. We see that the user and movie ratings follow heavy tail distributions, and thus the majority of users and movies have very few reviews, making accurate recommendation challenging for these users and movies. Review length is summarized in Figure 3 (c). Since one of the major goal of this project is to study temporal dynamics, we focus on users and items that have multiple interactions with the system. Specifically, we select a subset of $\mathbf { k }$ -core of the graph with $k = 1 5$ . That is, each user and movie has at least 15 ratings in this subset. Note that the resulting subgraph is still very sparse – with only $0 . 8 \%$ density, which is sparser than for example, $1 . 2 \%$ density of Netflix dataset . For completeness, we also include the 6-month Netflix dataset as used in $\mathrm { W u }$ et al. (2016a), which has only ratings, to study RRN’s ability to model temporal patterns.
|
| 167 |
+
|
| 168 |
+
The dataset is split by date instead of random sampling to simulate the real recommendation settings where we need to predict into the future instead of interpolating the past. IMDb training set contains all ratings from July 1998 to December 2012, and the ratings from January to September 2013 are randomly split into a validation set and a test set. Similarly, the 6-month Netflix dataset is split into January to November 2011 (training) and December 2011 (testing and validation). We report the results on testing set with the model that gives the best results on validation set. The summary of this dataset is given in Table 1.
|
| 169 |
+
|
| 170 |
+
Baselines We compare our model with models including the state-of-the-art temporal model, and a state-of-the-art neural network-based model.
|
| 171 |
+
|
| 172 |
+
• PMF (Mnih & Salakhutdinov, 2007): Our model extends matrix factorization by including a dynamic part and a joint review model. Comparing to PMF directly shows us the advantage of our approaches. LIBPMF (Yu et al., 2012) is used in experiments. • Time- $\mathbf { S V D + + }$ (Koren, 2010): Time- ${ \mathrm { S V D } } + +$ is the state-of-the-art model for temporal effects. It achieves excellent performance in Netflix contest. Implementation in GraphChi (Kyrola et al., 2012) is used in experiments. AutoRec (Sedhain et al., 2015): AutoRec is the state-of-the-art neural network recommender system. It learns an autoencoder that encodes user (item) histories into a lowdimensional space and then predict ratings by decoding. No temporal effects or causality are considered in this model. We use the software the authors provide in experiments.
|
| 173 |
+
|
| 174 |
+
All models use comparable number of factor sizes. Parameters of PMF and Time- $S _ { Ḋ } \mathrm { Ḋ } \mathrm { Ḋ } + + Ḍ Ḍ Ḍ$ are selected by grid-search. Settings of AutoRec follow the original paper. We also include the performance of rating-only RRN, as in Wu et al. (2016a), to separate the benefits obtained from temporal modeling and review texts.
|
| 175 |
+
|
| 176 |
+
# 4.2 RATING PREDICTION
|
| 177 |
+
|
| 178 |
+
One important goal of recommender systems is making accurate rating predictions. Here we evaluate the accuracy by root-mean-square error (RMSE) of prediction from the true rating. The results are summarized in Table 2. For completeness, we include the results from Wu et al. (2016a) on
|
| 179 |
+
|
| 180 |
+
6-month Netflix dataset that use ratings only to compare the behavior of different models on different datasets. We see that rating-only RRN outperforms all baseline models in terms of rating prediction consistently in both dataset. More importantly, joint-modeling ratings and reviews boosts the performance even more, compared to rating-only RRN. This implies that by sharing statistical strength between ratings and reviews, the rich information in reviews helps us estimate the latent factors better. Note that while the absolute improvements in RMSE might not appear to be huge, the $1 . 9 8 \%$ improvement over PMF is actually considerable in terms of recommendations2. We also see that while Time- $S _ { Ḋ } \mathrm { Ḋ } \mathrm { Ḋ } \mathrm { Ḋ } \mathrm { Ḍ + + Ḍ } Ḍ Ḍ$ performs well in Netflix contest, it does not work as well for predicting future ratings. After all, the goal of Time- ${ \mathrm { S V D } } + +$ is estimating the temporal bias in hindsight instead of extrapolating into future states.
|
| 181 |
+
|
| 182 |
+
# 4.3 TEXT MODELING
|
| 183 |
+
|
| 184 |
+
Here we examine the impact of conditioning on user and item states for text modeling. Towards this end, we compare perplexity of characters in testing set with and without using the user/item factors. Perplexity is defined as
|
| 185 |
+
|
| 186 |
+
$$
|
| 187 |
+
\mathrm { p p x } ( D _ { t e s t } ) = \exp \left( - \frac { 1 } { N _ { c } } \sum _ { c \in D _ { t e s t } } \log \mathrm { P r } ( c ) \right) ,
|
| 188 |
+
$$
|
| 189 |
+
|
| 190 |
+
where $N _ { c }$ is the total number of characters in $D _ { t e s t }$ , and $\operatorname* { P r } ( c )$ is the likelihood of character $c$ Interestingly, we found that by jointly training with user and item states, the perplexity improves from 3.3442 to 3.3362.
|
| 191 |
+
|
| 192 |
+
# 4.4 TEMPORAL DYNAMICS
|
| 193 |
+
|
| 194 |
+
Here we study if RRN is able to automatically capture the overall rating trends in IMDb by adaptively updating states along history sequence. Specifically, at each time step, we randomly sample up to 1000 users, and see what ratings the users would have given to each of the movie given their states at the time step, even in reality the user might not have given a rating to the movie. This gives us an unbiased estimation of average behavior of our model on each of the ratings. Figure 4 shows the average predicted ratings in this setting and the true average rating in the data set. We see that RRN clearly captures the overall trend in IMDb smoothly.
|
| 195 |
+
|
| 196 |
+

|
| 197 |
+
Figure 4: RRN is able to capture the overall trend of data. (a) show the average ratings of all movies on IMDb over time. In (b) we see the predicted ratings are consistent with this trend.
|
| 198 |
+
|
| 199 |
+
# 5 DISCUSSION & CONCLUSION
|
| 200 |
+
|
| 201 |
+
We present a novel approach that jointly models ratings, reviews, and their temporal dynamics with RRN. The contributions we have provided are as follows:
|
| 202 |
+
|
| 203 |
+
1. Joint rating-review modeling: We offer an LSTM-based joint rating-review model that provides advantages in both rating prediction and text modeling.
|
| 204 |
+
2. Nonparametric dynamic review modeling: RRN is based on an autoregressive method to model temporal dynamics of users and movies, allowing us to capture how reviews change over time.
|
| 205 |
+
3. Empirical results: We demonstrate that our joint model offers state-of-the-art results on rating prediction in real recommendation settings, i.e. predicting into the future.
|
| 206 |
+
|
| 207 |
+
# REFERENCES
|
| 208 |
+
|
| 209 |
+
Amjad Almahairi, Kyle Kastner, Kyunghyun Cho, and Aaron Courville. Learning distributed representations from reviews for collaborative filtering. In Proceedings of the 9th ACM Conference on Recommender Systems, pp. 147–154. ACM, 2015.
|
| 210 |
+
|
| 211 |
+
R. M. Bell and Y. Koren. Lessons from the netflix prize challenge. SIGKDD Explorations, 2007. URL http://doi.acm.org/10.1145/1345448.1345465.
|
| 212 |
+
|
| 213 |
+
Alex Beutel, Kenton Murray, Christos Faloutsos, and Alexander J Smola. Cobafi: collaborative bayesian filtering. In WWW, 2014.
|
| 214 |
+
|
| 215 |
+
Alex Beutel, Amr Ahmed, and Alexander J Smola. ACCAMS: Additive Co-Clustering to Approximate Matrices Succinctly. In WWW, 2015.
|
| 216 |
+
|
| 217 |
+
Cristian Danescu-Niculescu-Mizil, Robert West, Dan Jurafsky, Jure Leskovec, and Christopher Potts. No country for old members: User lifecycle and linguistic change in online communities. In WWW, 2013.
|
| 218 |
+
|
| 219 |
+
Qiming Diao, Minghui Qiu, Chao-Yuan Wu, Alexander J Smola, Jing Jiang, and Chong Wang. Jointly modeling aspects, ratings and sentiments for movie recommendation (jmars). In KDD. ACM, 2014.
|
| 220 |
+
|
| 221 |
+
Haoyuan Gao, Junhua Mao, Jie Zhou, Zhiheng Huang, Lei Wang, and Wei Xu. Are you talking to a machine? dataset and methods for multilingual image question answering. In NIPS, 2015.
|
| 222 |
+
|
| 223 |
+
Sepp Hochreiter and Jürgen Schmidhuber. Long short-term memory. Neural computation, 9(8): 1735–1780, 1997.
|
| 224 |
+
|
| 225 |
+
Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
|
| 226 |
+
|
| 227 |
+
Y. Koren. Factorization meets the neighborhood: a multifaceted collaborative filtering model. In KDD, 2008. URL http://doi.acm.org/10.1145/1401890.1401944.
|
| 228 |
+
|
| 229 |
+
Y. Koren, R.M. Bell, and C. Volinsky. Matrix factorization techniques for recommender systems. IEEE Computer, 2009. URL http://doi.ieeecomputersociety.org/10.1109/MC. 2009.263.
|
| 230 |
+
|
| 231 |
+
Yehuda Koren. Collaborative filtering with temporal dynamics. Communications of the ACM, 53(4): 89–97, 2010.
|
| 232 |
+
|
| 233 |
+
Aapo Kyrola, Guy Blelloch, and Carlos Guestrin. Graphchi: Large-scale graph computation on just a pc. In OSDI, 2012.
|
| 234 |
+
|
| 235 |
+
Zachary Chase Lipton, Sharad Vikram, and Julian McAuley. Capturing meaning in product reviews with character-level generative text models. CoRR, 2015.
|
| 236 |
+
|
| 237 |
+
J. McAuley and J. Leskovec. Hidden Factors and Hidden Topics: Understanding Rating Dimensions with Review Text. In RecSys, 2013. URL http://doi.acm.org/10.1145/2507157. 2507163.
|
| 238 |
+
|
| 239 |
+
Andriy Mnih and Ruslan Salakhutdinov. Probabilistic matrix factorization. In NIPS, 2007.
|
| 240 |
+
|
| 241 |
+
R. Salakhutdinov and A. Mnih. Bayesian probabilistic matrix factorization using markov chain monte carlo. In W.W. Cohen, A. McCallum, and S.T. Roweis (eds.), ICML, 2008.
|
| 242 |
+
|
| 243 |
+
Suvash Sedhain, Aditya Krishna Menon, Scott Sanner, and Lexing Xie. Autorec: Autoencoders meet collaborative filtering. In WWW Companion, 2015.
|
| 244 |
+
|
| 245 |
+
David H Stern, Ralf Herbrich, and Thore Graepel. Matchbox: large scale online bayesian recommendations. In WWW. ACM, 2009.
|
| 246 |
+
|
| 247 |
+
Ilya Sutskever, Oriol Vinyals, and Quoc V Le. Sequence to sequence learning with neural networks. In NIPS, 2014.
|
| 248 |
+
|
| 249 |
+
Oriol Vinyals, Alexander Toshev, Samy Bengio, and Dumitru Erhan. Show and tell: A neural image caption generator. In CVPR, 2015.
|
| 250 |
+
Xuerui Wang and Andrew McCallum. Topics over time: a non-markov continuous-time model of topical trends. In KDD. ACM, 2006.
|
| 251 |
+
C.-Y. Wu, A. Beutel, A. Ahmed, A. J. Smola, and H. Jing. Recurrent recommender networks. In Web Science and Data Mining (WSDM), 2016a.
|
| 252 |
+
Chao-Yuan Wu, Alex Beutel, Amr Ahmed, and Alexander J. Smola. Explaining reviews and ratings with PACO: poisson additive co-clustering. In WWW Companion, 2016b. doi: 10.1145/2872518. 2889400. URL http://doi.acm.org/10.1145/2872518.2889400.
|
| 253 |
+
Zichao Yang, Diyi Yang, Chris Dyer, Xiaodong He, Alexander J. Smola, and Eduard Hovy. Hierarchical attention networks for document classification. In NAACL, 2016.
|
| 254 |
+
Hsiang-Fu Yu, Cho-Jui Hsieh, Si Si, and Inderjit S. Dhillon. Scalable coordinate descent approaches to parallel matrix factorization for recommender systems. In ICDM, 2012.
|
md/train/IDFQI9OY6K/IDFQI9OY6K.md
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
md/train/O0ow9RQW1nP/O0ow9RQW1nP.md
ADDED
|
@@ -0,0 +1,441 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Neurocoder: Learning General-Purpose Computation Using Stored Neural Programs
|
| 2 |
+
|
| 3 |
+
Anonymous Author(s)
|
| 4 |
+
Affiliation
|
| 5 |
+
Address
|
| 6 |
+
email
|
| 7 |
+
|
| 8 |
+
# Abstract
|
| 9 |
+
|
| 10 |
+
Artificial Neural Networks are functionally equivalent to special-purpose computers. Their inter-neuronal connection weights represent the learnt Neural Program that instructs the networks on how to compute the data. However, without storing Neural Programs, they are restricted to only one, overwriting learnt programs when trained on new data. Here we design Neurocoder, a new class of generalpurpose neural networks in which the neural network “codes” itself in a dataresponsive way by composing relevant programs from a set of shareable, modular programs stored in external memory. For the first time, a Neural Program is efficiently treated as a datum in memory. Integrating Neurocoder into current neural architectures, we demonstrate new capacity to learn modular programs, reuse simple programs to build complex ones, handle pattern shifts and remember old programs as new ones are learnt, and show substantial performance improvement in solving object recognition, playing video games and continual learning tasks.
|
| 11 |
+
|
| 12 |
+
# 14 1 Introduction
|
| 13 |
+
|
| 14 |
+
15 From its inception in 1943 until recently, the fundamental architectures of Artificial Neural Net
|
| 15 |
+
16 works remained largely unchanged - a program is executed by passing data through a network of
|
| 16 |
+
17 artificial neurons whose inter-neuronal connection weights are learnt through training with data.
|
| 17 |
+
18 These inter-neuronal connection weights, or Neural Programs, correspond to a program in modern
|
| 18 |
+
19 computers [32]. Memory Augmented Neural Networks (MANN) are an innovative solution allow
|
| 19 |
+
20 ing networks to access external memory for manipulating data [11, 12]. But they were still unable
|
| 20 |
+
21 to store Neural Programs in such external memory, and this severely limits machine learning. Stor
|
| 21 |
+
22 ing inter-neuronal connection weights only in their network does not permit modular separation of
|
| 22 |
+
23 Neural programs and is analogous to a computer with one fixed program. Recent works introduce
|
| 23 |
+
24 conditional computation via adjusting or activating parts of a network in an input-dependent manner
|
| 24 |
+
25 [39, 33, 4, 13, 28], but networks remain monolithic. Current networks forget when retrained, old
|
| 25 |
+
26 inter-neuronal connection weights are merged with new ones or erased.
|
| 26 |
+
27 The brain is modular, not a monolithic system [8, 6]. Neuroscience research indicates that the brain is
|
| 27 |
+
28 divided into functional modules [19, 7, 9]. If the neural program for each module is kept in separate
|
| 28 |
+
29 networks, networks proliferate. Modular neural networks, another form of conditional computation,
|
| 29 |
+
30 combine the output of multiple expert networks, but as the experts grow, the networks grow drasti
|
| 30 |
+
31 cally [20, 14, 35, 29]. This requires huge computational storage and introduces redundancy as these
|
| 31 |
+
32 experts do not share common basic programs.
|
| 32 |
+
33 A pathway out of this bind is to keep such basic programs in memory and combine them as required.
|
| 33 |
+
34 This brings neural networks towards modern general-purpose computers that use the stored-program
|
| 34 |
+
35 principle [37, 40] to efficiently access reusable programs in external memory. Here we show how
|
| 35 |
+
36 Neurocoder, a new neural framework, introduces a new class of general-purpose conditional compu
|
| 36 |
+
37 tation machines in which a neural network can be “coded” in an input-dependent manner. Efficient
|
| 37 |
+
38 decomposition of Neural Programs creates shareable modular components that can reconstruct the
|
| 38 |
+
39 whole program space. These components change their “shapes” based on training and are stored
|
| 39 |
+
40 in an external Program Memory. Then, in a data-responsive way, a Program Controller retrieves
|
| 40 |
+
41 relevant components to build the Neural Program. This is analogous to shape-shifting Lego bricks
|
| 41 |
+
42 that can be reused to build unlimited shapes and structures (See Appendix Fig. 4).
|
| 42 |
+
43 Using adaptive modular components vastly increases the learning capacity of the neural network
|
| 43 |
+
44 by allowing re-utilisation of parameters, effectively curbing network growth as programs increase.
|
| 44 |
+
45 More importantly, unlike pre-defined sub-networks or modules [20, 1] that combine at activation
|
| 45 |
+
46 level, the construction of our modular components is dynamic and performed on the weight space.
|
| 46 |
+
47 The Neural Program construction is learnt through training via traditional backpropagation [30] as
|
| 47 |
+
48 the architecture is end-to-end differentiable.
|
| 48 |
+
|
| 49 |
+

|
| 50 |
+
Figure 1: Neurocoder (a) The Main Network uses a working program to compute the output for the input. Here only the final layer of the Main Network is adaptively loaded with the working program $( I )$ . Other layers use traditional Neural Programs as connection weights (fixed-after-training). (b) The Program Controller’s composition network controls access to the Program Memory, emitting queries and interpolating gate control signals in response to the input (2). It then performs recurrent multi-head program attention to the Program Status (3), triggering attention weights to the Singular Programs (4). The attended Singular Programs form an active program using low-rank approximation (5). Residual program produced by the Program Controller’s integration network (6) plus the active program derives the working program. (c) The Program Memory stores the representations (singular programs) required to reconstruct the active program to be used by the Program Controller. Access is controlled through the Program Status including keys $( k )$ , and slot usage $( m )$ that are updated during the training and computation (7).
|
| 51 |
+
|
| 52 |
+
# 49 2 Methods
|
| 53 |
+
|
| 54 |
+
# 2.1 System overview
|
| 55 |
+
|
| 56 |
+
51 A Neurocoder is a neural network (Main Network) coupled to an external Program Memory through
|
| 57 |
+
52 a Program Controller. The working program of the Main Network processes the input data to pro
|
| 58 |
+
53 duce the output. This working program is “coded” by the Program Controller by creating an input
|
| 59 |
+
54 dependent active program from the Program Memory (Fig. 1). The following gives a high-level
|
| 60 |
+
55 description of the Neurocoder framework and then the details.
|
| 61 |
+
|
| 62 |
+
# 56 Neurocoder stores Singular Value Decomposition of Neural Programs in Program Memory
|
| 63 |
+
|
| 64 |
+
57 The Neural Program needs to be stored efficiently in Program Memory. This is challenging as there
|
| 65 |
+
58 may be millions of inter-neuronal connection weights, thus storing them directly ([22]) is grossly
|
| 66 |
+
59 inefficient. Instead, the Neurocoder forms the basis of a subspace spanned by Neural Programs and
|
| 67 |
+
60 stores the singular values and vectors of this subspace in memory slots of the Program Memory
|
| 68 |
+
61 (hereafter referred to as singular programs). Based on the input, relevant singular programs are
|
| 69 |
+
62 retrieved, a new program is reconstructed and then loaded in the Main Network to process the input.
|
| 70 |
+
63 This representational choice significantly reduces the number of stored elements and allows each
|
| 71 |
+
64 singular program to effectively represent a unitary function of the active program.
|
| 72 |
+
|
| 73 |
+
65 The active program matrix $\mathbf { P }$ can be composed by standard low-rank approximation as
|
| 74 |
+
|
| 75 |
+
$$
|
| 76 |
+
\mathbf { P } = \mathbf { U S V } ^ { \mathbf { T } } = \sum _ { n } ^ { r _ { m } } \sigma _ { n } u _ { n } v _ { n } ^ { \top }
|
| 77 |
+
$$
|
| 78 |
+
|
| 79 |
+
66 where $\mathbf { U }$ and $\mathbf { V }$ are matrices of the left and right singular vectors, and S the matrix of singular values.
|
| 80 |
+
67 $r _ { m }$ is the total number of components we want to retrieve. $\left\{ \sigma _ { n } \right\} _ { n = 1 } ^ { r _ { m } }$ is the attended singular values,
|
| 81 |
+
68 {un} mn= and $\{ v _ { n } \} _ { n = 1 } ^ { r _ { m } }$ the attended singular vectors of S, U, and $\mathbf { V }$ , respectively. The Program
|
| 82 |
+
69 Memory is crafted as three singular program memories $\{ { \bf M } _ { U } , { \bf M } _ { V } , { \bf M } _ { S } \}$ –each of their memory
|
| 83 |
+
70 slot stores a singular component or singular program. The process “codes” the active program
|
| 84 |
+
71 using singular programs from the program memories. The coding is conditioned on input $x _ { t }$ , yet
|
| 85 |
+
72 we drop index $t$ for notation simplification and leave the details on the computation of $\sigma _ { n } , u _ { n } , v _ { n }$ in
|
| 86 |
+
73 Sec. 2.2.
|
| 87 |
+
74 The Program Memory also maintains the status for each singular program in terms of access and
|
| 88 |
+
75 usage. To access a singular program, program keys $( k )$ are used. These keys are low-dimensional
|
| 89 |
+
76 vectors that represent the singular program function and computed by a neural network that ef
|
| 90 |
+
77 fectively compresses the singular program. The program usage $( m )$ measures memory utilisation,
|
| 91 |
+
78 recording how much a memory slot is used in constructing a program. The components of the
|
| 92 |
+
79 Program Memory are summarised in Fig. 1 (c).
|
| 93 |
+
80 Recurrent multi-head program attention mechanisms for program storage and retrieval
|
| 94 |
+
81 Neural networks use the concept of differentiable attention to access memory [11, 2]. This de
|
| 95 |
+
82 fines a weighting distribution over the memory slots essentially weighting the degree to which each
|
| 96 |
+
83 memory slot participates in a read or write operation. This is unlike conventional computers that use
|
| 97 |
+
84 a unique address to access a single memory slot.
|
| 98 |
+
85 Here we use two kinds of attention. First is content-based attention [11, 12] to ensure that the singu
|
| 99 |
+
86 lar program is selected based on its functionality and the data input. This is achieved by producing
|
| 100 |
+
87 a query vector based on the input and comparing it to the program keys $( k )$ using cosine similarity.
|
| 101 |
+
88 Higher cosine similarity scores indicate higher attention weights to the singular programs associated
|
| 102 |
+
89 with those program keys. Second, to encourage better memory utilisation, higher attention weights
|
| 103 |
+
90 are assigned to slots with lower program usage $( m )$ through usage-based attention [12, 31]. The
|
| 104 |
+
91 attention weights from the two schemas are then combined using interpolating gates to compose the
|
| 105 |
+
92 final attention weights to the Program Memory.
|
| 106 |
+
93 We adapt multi-head attention [11, 38] that applies multiple attentions in parallel to retrieve $H$ singu
|
| 107 |
+
94 lar components. Besides, we introduce a recurrent attention mechanism, in which multi-head access
|
| 108 |
+
95 is performed recurrently in $J$ steps. The $j$ -th set of $H$ retrieved components is conditioned on the
|
| 109 |
+
96 previous ones. This recurrent, multi-head attention allows the composition network to incrementally
|
| 110 |
+
97 search for optimal components for building relevant active programs.
|
| 111 |
+
|
| 112 |
+
# 98 Neurocoder learns to “code” a relevant working program via training
|
| 113 |
+
|
| 114 |
+
99 The structure of the Program Memory and the role of the Program Controller facilitates the au
|
| 115 |
+
100 tomatic construction of working programs via training. The Program Controller controls memory
|
| 116 |
+
101 access through its composition network that creates the attention weight defining how to weight the
|
| 117 |
+
102 singular programs in the memories. A weighted summation of the singular programs results in the
|
| 118 |
+
103 attended singular program. Applying the recurrent multi-head attention described earlier, multiple
|
| 119 |
+
104 attended singular programs are retrieved to construct an active program (Eq. 1). Then the Program
|
| 120 |
+
105 Controller generates a residual program using its integration network, adding to the active program
|
| 121 |
+
106 to produce the working program of the Main Network. This addition enables creation of flexible
|
| 122 |
+
107 higher-rank working programs, which compensates for the low-rank coding process. The structure
|
| 123 |
+
108 of the Program Controller is illustrated in Fig. 1 (b).
|
| 124 |
+
109 The singular programs are trained to represent unitary functions necessary for any computation
|
| 125 |
+
110 whilst the composition and integration networks are trained to compose the relevant programs for
|
| 126 |
+
111 the considering task. As such, beside minimising the task loss, we enforce orthogonality of stored
|
| 127 |
+
112 singular vectors by minimising $\mathcal { L } _ { o } = \mathbf { M } _ { U } \mathbf { M } _ { U } ^ { \top } - \mathbf { \bar { I } } + \mathbf { M } _ { V } \mathbf { M } _ { V } ^ { \top } - \mathbf { I }$ . The parameters of the networks,
|
| 128 |
+
113 and the stored singular programs are adjusted using gradient training via minimising the total loss
|
| 129 |
+
|
| 130 |
+
$$
|
| 131 |
+
\mathscr { L } = \mathcal { L } _ { t a s k } + a \mathcal { L } _ { o }
|
| 132 |
+
$$
|
| 133 |
+
|
| 134 |
+
where $\mathcal { L } _ { t a s k }$ represents the supervised task loss and $\mathcal { L } _ { o }$ represents the orthogonal loss weighted by a hyper-parameter $a$ to enforce orthogonality of the singular vectors.
|
| 135 |
+
|
| 136 |
+
# 2.2 Attention mechanisms for Program Memory
|
| 137 |
+
|
| 138 |
+
117 Here we ddenoted as $w _ { i n } ^ { u , v , \sigma }$ progra)–the a attention mechanintion weight to the $i$ ms used in this paper. Given -th slot of the singular progra $w _ { i n } ^ { u }$ , e $w _ { i n } ^ { v }$ , i $w _ { i n } ^ { \sigma }$ $\mathbf { M } _ { U }$ o, $\mathbf { M } _ { V }$
|
| 139 |
+
119 , we retrieve the $n$ -th singular vector as follows,
|
| 140 |
+
|
| 141 |
+
$$
|
| 142 |
+
u _ { n } = \sum _ { i = 1 } ^ { P _ { u } } w _ { i n } ^ { u } \mathbf { M } _ { U } \left( i \right)
|
| 143 |
+
$$
|
| 144 |
+
|
| 145 |
+
$$
|
| 146 |
+
v _ { n } = \sum _ { i = 1 } ^ { P _ { v } } w _ { i n } ^ { v } \mathbf { M } _ { V } \left( i \right)
|
| 147 |
+
$$
|
| 148 |
+
|
| 149 |
+
120 For the singular values, we need to enforce $\sigma _ { 1 } > \sigma _ { 2 } > . . . > \sigma _ { r _ { m } } > 0$ , thus we retrieve using
|
| 150 |
+
|
| 151 |
+
$$
|
| 152 |
+
\sigma _ { n } = \left\{ \begin{array} { l l } { \mathrm { s o f t p l u s } \left( \sum _ { i = 1 } ^ { P _ { s } } w _ { i n } ^ { \sigma } \mathbf { M } _ { S } \left( i \right) \right) } & { n = r _ { m } } \\ { \sigma _ { n + 1 } + \mathrm { s o f t p l u s } \left( \sum _ { i = 1 } ^ { P _ { s } } w _ { i n } ^ { \sigma } \mathbf { M } _ { S } \left( i \right) \right) } & { n < r _ { m } } \end{array} \right.
|
| 153 |
+
$$
|
| 154 |
+
|
| 155 |
+
121 Here, $P _ { u } , P _ { v }$ and $P _ { s }$ are the number of memory slots of $\mathbf { M } _ { U }$ , $\mathbf { M } _ { V }$ and $\mathbf { M } _ { S }$ , respectively. In this
|
| 156 |
+
122 paper, we set $P = P _ { u } = P _ { v } = P _ { s }$ as the number of memory slots of the Program Memory. We note
|
| 157 |
+
123 that thead ese notations are speci, and an attention step ed for some data input , hence the full notatio $x _ { t }$ and the hould be $n$ later maps to an attention To simplify notations, we
|
| 158 |
+
$h$ $j$ $w _ { t i j h } ^ { u , v , \sigma }$
|
| 159 |
+
125 will drop $u , v , \sigma$ from now and describe the computation of a representative $w _ { t i j h }$ for any of the
|
| 160 |
+
126 three program memories in the following parts.
|
| 161 |
+
|
| 162 |
+
# 127 Recurrent Access to the Program Memory via the composition network
|
| 163 |
+
|
| 164 |
+
128 To perform program attention, the Program Controller employs a composition network (denoted
|
| 165 |
+
129 as $f _ { \theta } )$ ), which takes the current input $x _ { t }$ and produce program composition control signals $( \pmb { \xi } _ { t } ^ { p } )$ .
|
| 166 |
+
130 If $f _ { \theta }$ performs all attentions concurrently via multi-head attention as in [11, 38], it may lead to
|
| 167 |
+
131 program collapse [22]. To have a better control of the component formation and alleviate program
|
| 168 |
+
132 collapse, we propose to recurrently attend to the program memory. To this end, we implement $f _ { \theta }$ as
|
| 169 |
+
133 $\pmb { \xi } _ { t } ^ { p } = \left\{ \pmb { \xi } _ { t j } ^ { p } \right\} _ { j = 1 } ^ { J }$ al network (LST. At access step $j$ M [16]) and let it access the program memory , the recurrent network updates its hidden sta $J$ times, resultin and generates $\xi _ { t j } ^ { p }$
|
| 170 |
+
135 using recurrent dynamics as
|
| 171 |
+
|
| 172 |
+
$$
|
| 173 |
+
{ \pmb { \xi } } _ { t j } ^ { p } , h _ { j } = f _ { \theta } \left( x _ { t } , h _ { j - 1 } \right)
|
| 174 |
+
$$
|
| 175 |
+
|
| 176 |
+
136 where $h _ { 0 }$ is initialized as zeros and $\xi _ { t j } ^ { p }$ is the program composition control signal at step $j$ that
|
| 177 |
+
137 depends on both on the input data $x _ { t }$ and the the previous state $h _ { j - 1 }$ . Particularly, the control signal
|
| 178 |
+
138 contains the queries and the interpolation gates for each head to compute the program attention
|
| 179 |
+
139 weight: $\pmb { \xi } _ { t j } ^ { p } = \{ q _ { t j h } , g _ { t i j h } \} _ { h = 1 } ^ { H }$ . Here, at each attention step, we perform multi-head attention with
|
| 180 |
+
140 $H$ as the number of attention heads and thus, each $\xi _ { t j } ^ { p }$ consists of $H$ pairs of queries and gates.
|
| 181 |
+
141 Hence, the total number of retrieved components $\boldsymbol { r } _ { m } = \boldsymbol { \bar { J } } \times \boldsymbol { H }$ and the index $n = j \times H + h$ .
|
| 182 |
+
|
| 183 |
+
# 142 Attending to Programs by “Name”
|
| 184 |
+
|
| 185 |
+
143 Inspired by the content-based attention mechanism for data memory [11], we use the query to look
|
| 186 |
+
144 for the singular programs. In computer programming, to find the appropriate program for some
|
| 187 |
+
145 computation, we often refer to the program description or at least the name of the program. Here, we
|
| 188 |
+
146 create the “name” for our neural programs by compressing the program content to a low-dimensional
|
| 189 |
+
147 key vector. As such, we employ a neural network $( f _ { \varphi } )$ to compute the program memory keys as
|
| 190 |
+
|
| 191 |
+
$$
|
| 192 |
+
k _ { i } = f _ { \varphi } \left( \mathbf { M } \left( i \right) \right)
|
| 193 |
+
$$
|
| 194 |
+
|
| 195 |
+
148 where $\boldsymbol { k } _ { i } \in \mathbb { R } ^ { K }$ and $i$ is the row index of the program memory. Here, $f _ { \varphi }$ learns to compress each
|
| 196 |
+
149 memory slot into a $K$ -dimensional vector. As the singular programs evolve, their keys get updated.
|
| 197 |
+
150 In this paper, we update the program keys after each learning iteration during training.
|
| 198 |
+
151 Finally the content-based program memory attention $c _ { t i j h }$ is computed using cosine distance be
|
| 199 |
+
152 tween the program keys $k _ { i }$ and the queries $q _ { t j h }$ as
|
| 200 |
+
|
| 201 |
+
$$
|
| 202 |
+
c _ { t i j h } = \mathrm { s o f t m a x } ^ { ( i ) } \left( \frac { q _ { t j h } \cdot k _ { i } } { \left| \left| q _ { t j h } \right| \right| \cdot \left| \left| k _ { i } \right| \right| } \right)
|
| 203 |
+
$$
|
| 204 |
+
|
| 205 |
+
# 153 Making Every Program Count
|
| 206 |
+
|
| 207 |
+
154 Similarly to [12, 31], in addition to the content-based attention, we employ a least-used reading
|
| 208 |
+
155 strategy to encourage the Program Controller to assign different singular programs to different com
|
| 209 |
+
156 ponents. In particular, we calculate the memory usage for each program slot across attentions as
|
| 210 |
+
157
|
| 211 |
+
|
| 212 |
+
$$
|
| 213 |
+
m _ { t i j h } = \operatorname* { m a x } _ { \tilde { j } \leq j } \left( w _ { t i \tilde { j } h } \right)
|
| 214 |
+
$$
|
| 215 |
+
|
| 216 |
+
158 Since we want to consider only $l _ { I }$ amongst $P$ memory slots that have smallest usages, let $\hat { m } _ { t j h } ^ { l _ { I } }$
|
| 217 |
+
159 denote the value of the $l _ { I }$ -th smallest usage, then the least-used attention is computed as
|
| 218 |
+
|
| 219 |
+
$$
|
| 220 |
+
l _ { t i j h } = \left\{ \begin{array} { l l } { \underset { i } { \operatorname* { m a x } } \left( m _ { t i j h } \right) - m _ { t i j h } } & { ; m _ { t i j h } \leq \hat { m } _ { t j h } ^ { l _ { I } } } \\ { 0 } & { ; m _ { t i j h } > \hat { m } _ { t j h } ^ { l _ { I } } } \end{array} \right.
|
| 221 |
+
$$
|
| 222 |
+
|
| 223 |
+
160 The final program memory attention is computed as
|
| 224 |
+
|
| 225 |
+
$$
|
| 226 |
+
w _ { t i j h } = \mathrm { s i g m o i d } \left( g _ { t i j h } \right) c _ { t i j h } + \left( 1 - \mathrm { s i g m o i d } \left( g _ { t i j h } \right) \right) l _ { t i j h }
|
| 227 |
+
$$
|
| 228 |
+
|
| 229 |
+
161 Since the usage record are computed along the memory accesses, the multi-step Neurocoder utilises
|
| 230 |
+
162 this attention mechanism better than the single-step Neurocoder, creating different attention styles
|
| 231 |
+
163 (see Sec. 3.2). The composition the active program $\mathbf { P } _ { t }$ is illustrated in Appendix’s Fig. 5.
|
| 232 |
+
|
| 233 |
+
# 2.3 Program Integration via the integration network
|
| 234 |
+
|
| 235 |
+
165 Since the working program $\mathbf { P } _ { t }$ only contains top $r _ { m }$ principal components, it is low-rank and may
|
| 236 |
+
166 be not flexible enough for sophisticated computation. We propose to enhance $\mathbf { P } _ { t }$ with a residual
|
| 237 |
+
167 program $\mathbf { R } -$ a traditional connection weight trained as the integration network’s parameters, which
|
| 238 |
+
168 is constant after training w.r.t $t$ . The residual program represents the sum of the remaining less
|
| 239 |
+
169 important components. To this end, we suppress $\mathbf { R }$ with a multiplier that is smaller than $\sigma _ { t r _ { m } } .$ – the
|
| 240 |
+
170 smallest singular value of the main components - resulting in the integration formula
|
| 241 |
+
|
| 242 |
+
$$
|
| 243 |
+
W _ { t } = \mathbf { P } _ { t } + w _ { t } ^ { r } \sigma _ { t r _ { m } } \mathbf { R }
|
| 244 |
+
$$
|
| 245 |
+
|
| 246 |
+
171 where $w _ { t } ^ { r } = \mathrm { s i g m o i d } \left( f _ { \phi } \left( x _ { t } \right) \right)$ is an adaptive gating value that controls the contribution of the
|
| 247 |
+
172 residual program. $f _ { \phi }$ is the integration network in the Program Controller and hence, in our imple
|
| 248 |
+
173 mentation, the integration control signal sent by the Program Controller is $\lambda _ { t } ^ { p } = \{ w _ { t } ^ { r } , \sigma _ { t r _ { m } } \}$ . We
|
| 249 |
+
174 note that in our experiments, the program integration can be disabled ( $W _ { t }$ is directly set to $\mathbf { P } _ { t }$ ) to
|
| 250 |
+
175 prove the contribution of $\mathbf { P } _ { t }$ or reduce the number of parameters. The working program $W _ { t }$ is then
|
| 251 |
+
176 used by the Main Network to execute the input data $x _ { t }$ (see (Fig. 1 (a))). For example, with linear
|
| 252 |
+
177 classifier Main Network, the execution is $y _ { t } = x _ { t } W _ { t }$ . Appendix’s Table 2 summarises the notations
|
| 253 |
+
178 used for important parameters of Neurocoder.
|
| 254 |
+
|
| 255 |
+

|
| 256 |
+
Figure 2: (a) MNIST test set classification error vs the number of steps $( J )$ in Neurocoder (blue), compared with a linear classifier (red). (b) 1st column: Digit images; Middle column: Single-step attention weights for 30 slots in $\mathbf { M } _ { U }$ (vertical axis) for first 3 singular vectors (horizontal axis) for each digit; Last column: Multi-step attention weights for 10 slots in $\mathbf { M } _ { U }$ (vertical axis) for first 3 singular vectors (horizontal axis). Multi-step attention is able to produce far more diverse patterns with fewer slots - 10 slots compared to single-step 30 slots. (c) Two attention patterns of singlestep Neurocoder. The binary decision tree derived from single-step Neurocoder’s attention patterns. The two patterns across components represent the decisions going up and down across the binary tree. Visualisation for (d) multi-step $J = 5$ , 20 memory slots) and (e) single-step $J = 1$ , 10 memory slots) cases showing while processing a sequence of the polynomial auto-regression task. The Neurocoder’s attentions to $\mathbf { M } _ { U }$ that form the first component of the active program are shown over sequence timesteps (upper) with Neurocoder’s $y _ { t }$ prediction (orange) and ground truth (blue) (lower). The vertical dash green lines separate polynomial chunks. Each chuck represents a local pattern, and thus ideally requires a specific active program to compute the input $x _ { t }$ . Although both predict well, only the multi-step Neurocoder discovers the chunk boundaries, assigning program attention to the first component in accordance with sequence changes.
|
| 257 |
+
|
| 258 |
+
# 179 3 Results
|
| 259 |
+
|
| 260 |
+
180 To demonstrate the flexibility of Neurocoder framework, we consider different learning paradigms:
|
| 261 |
+
181 instance-based, sequential, multi-task and continual learning. We do not focus on breaking perfor
|
| 262 |
+
182 mance records by augmenting state-of-the-art models with Neurocoder. Rather our inquiry is on
|
| 263 |
+
183 re-coding feed-forward layers with the Neurocoder’s programs and testing on varied data types to
|
| 264 |
+
184 demonstrate its intrinsic properties. For some experiments, we include ablation studies.
|
| 265 |
+
185 We compare the performance of diverse Main Networks (MN) with and without Neurocoder. We
|
| 266 |
+
186 also augment the Main Networks with other recent conditional computing methods, either modular
|
| 267 |
+
187 (sparse Mixture of Experts, Neural Stored-program Memory) or monolithic (HyperNets, FiLM) to
|
| 268 |
+
188 form stronger baselines across our experiments. In our experiments, we always apply Neurocoder
|
| 269 |
+
189 to all layers of multi-layer perceptrons (MLP) or just the final feed-forward layer of deep CNN
|
| 270 |
+
190 networks (LeNet, DenseNet, ResNet), RNNs (GRU, LSTM), MANN (NTM). Other competitors
|
| 271 |
+
191 such as MOE, NSM, HyperNet and FiLM are applied to the Main Networks in the same manner.
|
| 272 |
+
|
| 273 |
+

|
| 274 |
+
Figure 3: Learning curves (mean and std. over 5 runs) on representative Atari 2600 games. All baselines are applied to the actor/critic networks in the A3C agent.
|
| 275 |
+
|
| 276 |
+
# 192 3.1 Instance-based learning - Object Recognition
|
| 277 |
+
|
| 278 |
+
We tested Neurocoder on instance-based learning through classical image classification tasks using MNIST [24] and CIFAR [21] datasets. The first experiment interpreted Neurocoder’s behaviour in classifying digits into 10 classes $( 0 - 9 )$ using linear classifier Main Network. With equivalent model size, Neurocoder using the novel recurrent attention surpasses the performance of the linear classifier [24] by up to $5 \%$ (Fig. 2 (a)).
|
| 279 |
+
|
| 280 |
+
To differentiate the input, Neurocoder attends to different components of the active program to guide the decision-making process. Fig. 2 (b) shows single-step and multi-step attention to the first 3 singular vectors for each digit across memory slots. Multi-step attention produces richer patterns compared to single-step Neurocoder that manages only 2 attention weight patterns.
|
| 281 |
+
|
| 282 |
+
Fig. 2 (c) illustrates how Neurocoder performs modular learning by showing the attention assignment for top 3 singular vectors as a binary decision tree. Digits under the same parental node share similar attention paths, and thereby similar active programs. Some digits look unique (e.g. 7) resulting in active programs composed of unique attention paths, discriminating themselves early in the decision tree. Some digits (e.g. 0 and 9) share the same attention pattern for the first 3 components and are thus unclassifiable. They can only be distinguished by considering more singular vectors.
|
| 283 |
+
|
| 284 |
+
We integrated Neurocoder with deep networks - 5-layer LeNet and 100-layer DenseNet - and tested on CIFAR datasets. Neurocoder significantly outperformed the original Main Networks with performance gain $1 - 5 \%$ . Compared with recent conditional computing models such as sparse Mixture of Experts (MOE [35]) and Neural Stored-program Memory (NSM [22]), Neurocoder required a tenth of the number of parameters and performed better by up to $8 - 1 0 \%$ (see Appendix’s Table 3).
|
| 285 |
+
|
| 286 |
+
# 3.2 Sequential learning - Adaption to sequence changes and game playing using reinforcement learning
|
| 287 |
+
|
| 288 |
+
Recurrent neural networks (RNN) can learn from sequential data by updating the hidden states of the networks. However, this does not suffice when local patterns shift, as is often the case. We now demonstrate that Neurocoder helps RNNs overcome this limitation by composing diverse programs to handle sequence changes.
|
| 289 |
+
|
| 290 |
+
Synthetic polynomial auto-regression We created a simple auto-regression task in which data points are sampled from polynomial function chunks that change over time. The Main Network is a strong RNN–Gated Recurrent Unit (GRU [5]). We found that GRU integrated with a single-step or multi-step Neurocoder converged much faster than all other baselines. The other conditional computing counterparts (HyperNet [13], FiLM [28]) adapt by re-scaling weights or activation of the GRU, which were shown inferior to our modular approach (Appendix’s Fig. 6).
|
| 291 |
+
|
| 292 |
+
225 Visualising the first singular vector attention weights in $\mathbf { M } _ { U }$ , we find that the multi-step attention
|
| 293 |
+
226 Neurocoder changes its attention following polynomial changes - it attends to the same singular pro
|
| 294 |
+
227 gram when processing data from the same polynomial and alters attention for data from a different
|
| 295 |
+
228 polynomial (Fig. 2(d)). In contrast, the single-step Neurocoder only changes its attention when
|
| 296 |
+
229 there is a remarkable change in $y$ -coordinate values (Fig. 2(e)). Although single-step Neurocoder
|
| 297 |
+
230 converges well, it did not discover the underlying structure of the data, and thus underperformed
|
| 298 |
+
231 the multi-step Neurocoder. We hypothesise that when recurrence is employed, usage-based atten
|
| 299 |
+
232 tion takes effect, stipulating better memory utilisation and diverse attentions over timesteps. We ran
|
| 300 |
+
233 multi-step Neurocoder without usage-based attention. The results were worse than the full multi
|
| 301 |
+
234 step Neurocoder, which confirms our hypothesis (Appendix’s Fig. 6).
|
| 302 |
+
|
| 303 |
+
<table><tr><td>Method</td><td>MN (MLP[17])</td><td>MN (MLP ours)</td><td>NSM</td><td>Neurocoder</td></tr><tr><td>Adam</td><td>55.16±1.38</td><td>53.55±1.27</td><td>54.85±2.81</td><td>58.46±0.46</td></tr><tr><td>Adagrad</td><td>58.08±1.06</td><td>57.83±2.74</td><td>58.42±1.87</td><td>62.28±4.03</td></tr><tr><td>L2</td><td>66.00±3.73</td><td>64.37±2.40</td><td>62.83±7.21</td><td>69.89±1.72</td></tr><tr><td>SI</td><td>64.76±3.09</td><td>64.41±3.36</td><td>64.36±2.99</td><td>67.96±3.22</td></tr><tr><td>EWC</td><td>58.85±2.59</td><td>58.41±2.37</td><td>58.12±3.24</td><td>65.66±1.25</td></tr><tr><td>O-EWC</td><td>57.33±1.44</td><td>57.78±1.84</td><td>58.55±3.40</td><td>73.97±1.50</td></tr></table>
|
| 304 |
+
|
| 305 |
+
Table 1: Incremental domain continual learning with Split MNIST. Final test accuracy (mean and std.) over 10 runs.
|
| 306 |
+
|
| 307 |
+
Atari game reinforcement learning We used reinforcement learning as a further testbed to show the ability to adapt to environmental changes. We performed experiments on several Atari 2600 games [3] wherein the agent was implemented as the Asynchronous Advantage Actor-Critic (A3C [26]). In the Atari platform, agents are allowed to observe the screen snapshot of the games and act to earn the highest score. We augmented the A3C by employing Neurocoder’s working programs for feed-forward layers of the actor and critic networks, aiming to decompose the policy and value function into singular programs that were selected depending on the game state.
|
| 308 |
+
|
| 309 |
+
242 Frostbite and Montezuma’s Revenge. These games are known to be challenging for A3C and other
|
| 310 |
+
243 algorithms [26]. We trained A3C and HyperNet-based A3C for over 300 million steps, yet these
|
| 311 |
+
244 models did not show any sign of learning, performing equivalently to random agents. For such com
|
| 312 |
+
245 plicated environments with sparse rewards, both the monolithic neural networks and the HyperNet’s
|
| 313 |
+
246 unstored fast-weights fail to learn (almost zero scores). In contrast, Neurocoder enabled A3C to
|
| 314 |
+
247 achieve from 1, 500 to 3, 000 scores on these environments (Fig. 3), confirming the importance of
|
| 315 |
+
248 decomposing a complex solution to smaller, simple stored programs.
|
| 316 |
+
|
| 317 |
+
# 49 3.3 Multi-task learning - Solving mutliple algorithms simultenously
|
| 318 |
+
|
| 319 |
+
Here we explore the modular learning capability of Neurocoder in multi-task setting. Inspired by algorithmic sequencing tasks [22], we created a challenging sequential multi-task benchmark wherein the input sequence is a series of sub-sequences from 4 algorithms: Copy, Repeat Copy, Associative Recall and Priority Sort [11]. Each sub-sequence, following a task identification vector, represents the input for each task. In each input sequence, $n$ tasks were sampled from the set of 4 algorithms randomly with replacement and the output sequences were created correspondingly.
|
| 320 |
+
|
| 321 |
+
We trained a MANN–Neural Turing Machine (NTM [11]) Main Network with FiLM, HyperNet and our Neurocoder augmentation on sequences of $n = 4$ tasks, and tested with sequences of $n = 4$ and $n = 8$ tasks. Appendix’s Fig. 7 demonstrates that Neurocoder was performant in both test settings, not only achieving lowest error on $n = 4$ , but also being the only one generalised well to $n = 8$ scenario, which was unseen during training.
|
| 322 |
+
|
| 323 |
+
# 3.4 Continual learning $-$ Learning tasks sequentially without catastrophic forgetting
|
| 324 |
+
|
| 325 |
+
In continual learning, standard neural networks often suffer from “catastrophic forgetting” in which they cannot retain knowledge acquired from old tasks upon learning new ones [10]. Our Neurocoder offers natural mitigation of such catastrophic forgetting in neural networks by attending to different singular programs whilst learning different tasks.
|
| 326 |
+
|
| 327 |
+
In this case, in addition to the Main Network, we examine several continual learning algorithms with and without Neurocoder. These algorithms, including Elastic Weight Consolidation (EWC [41]) and Synaptic Intelligence (SI [41]), work by regularising the loss function and thus can be easily combined with Neurocoder by modifying the loss $\mathcal { L } _ { t a s k }$ . We demonstrate that Neurocoder
|
| 328 |
+
|
| 329 |
+
70 can improve these continual learning algorithms without requiring additional assumptions as in other
|
| 330 |
+
1 approaches [25, 36, 34] that either utilise task embedding or replay memory.
|
| 331 |
+
|
| 332 |
+
Split MNIST We first considered the split MNIST dataset–a standard continual learning benchmark wherein the original MNIST was split into a 5 2-way classification tasks, consecutively presented to a Multi-layer Perceptron Main Network (MLP). We followed the benchmarking as in [17] in which various optimisers and state-of-the-art continual learning methods were examined under incremental task and domain scenarios. We measured the performance of the MLP versus Neurocoder and NSM under each continual learning method. In both scenarios, Neurocoder was compatible with all continual leaning methods, demonstrating superior performance over MLP and NSM with performance gain between 1 to $1 6 \%$ (see Appendix’s Table 5 and 1).
|
| 333 |
+
|
| 334 |
+
280 Split CIFAR We verified the scalability of Neurocoder to more challenging datasets. We split
|
| 335 |
+
281 CIFAR datasets as in the split MNIST, resulting in 5-task 2-way split CIFAR10 and a 20-task 5-way
|
| 336 |
+
282 split CIFAR100. We used Main Network ResNet [15]–a very deep CNN architecture.
|
| 337 |
+
283 When we stressed the orthogonal loss $a = 1 0$ ) and used bigger program memory (100 slots), Neu
|
| 338 |
+
284 rocoder improved ResNet classification by $1 5 \%$ and $1 0 \%$ on CIFAR10 and CIFAR100, respectively.
|
| 339 |
+
285 When we integrated Neurocoder with Synaptic Intelligence (SI [41]), the performance was further
|
| 340 |
+
286 improved, maintaining a stable performance above $8 0 \%$ accuracy for CIFAR10 and outperforming
|
| 341 |
+
287 using SI alone by $1 0 \%$ for CIFAR100 (see Appendix’s Fig. 8).
|
| 342 |
+
|
| 343 |
+
# 288 4 Discussion
|
| 344 |
+
|
| 345 |
+
Our experiments demonstrate that Neurocoder is capable of re-coding Neural Programs in distinctive neural networks, amplifying their capabilities in diverse learning scenarios: instance-based, sequential, multi-task and continual learning. This consistently results in significant performance increase, and further creates novel robustness to pattern shift and catastrophic forgetting. This ability for each architecture to re-code itself is made possible without changing the way it is trained, or majorly increasing the number of parameters it needs to learn (see Appendix Table 7).
|
| 346 |
+
|
| 347 |
+
The MNIST problem illustrates the reasoning process of Neurocoder when classifying digit images wherein its singular program assignment resembles a binary tree decision-making process - it shows how some singular programs are shared, others are not. The polynomial auto-regression problem highlights the importance of efficient memory utilisation in re-constructing the working program enabling discovery of hidden structures in sequential data. Training our framework with reinforcement learning, we enable neural agents to solve complex games wherein traditional methods fail or learn slowly. Neurocoder also works well with multi-task setting, as shown in the challenging multi-algorithm benchmark. Finally, continual learning problems show that Neurocoder mitigates catastrophic forgetting efficiently under different learning settings/algorithms.
|
| 348 |
+
|
| 349 |
+
304 Our solution offers a single framework that is scalable and adaptable to various problems and learn
|
| 350 |
+
305 ing paradigms. Unlike previous attempts to employ a bank of separate big programs [20, 35, 22],
|
| 351 |
+
306 Neurocoder maintains only shareable, smaller components that can reconstruct the whole program
|
| 352 |
+
307 space, thereby heavily utilising the parameters and preventing the model from proliferating. We
|
| 353 |
+
308 note that Neurocoder is orthogonal to approaches employing tensor decomposition to reduce the
|
| 354 |
+
309 number of parameters or hasten the computation [27, 23]. Neurocoder composes rather than decom
|
| 355 |
+
310 pose the neural weights. Our aim is not only to enable efficient parameter usage, but also achieve
|
| 356 |
+
311 general-purpose computing power, outperforming other methods in numerous learning problems.
|
| 357 |
+
312 One limitation of this work is the number of additional hyperparameters, which prevents us from
|
| 358 |
+
313 fully tuning Neurocoder. Our research aims to add new capabilities to current neural networks to
|
| 359 |
+
314 improve their performance and make them robust in different learning scenario. Hence, we do
|
| 360 |
+
315 not see any intermediate negative societal impact. In future work, we will extend Neurocoder’s
|
| 361 |
+
316 application beyond feed-forward layers. It would be interesting to efficiently replace all neural layers
|
| 362 |
+
317 including CNN or Transformer by Neurocoder’s programs. We can also further extend Neurocoder’s
|
| 363 |
+
318 ability by allowing a growing Program Memory, in which the model decides to add or erase memory
|
| 364 |
+
319 slots as the number of data patterns grows or shrinks beyond the current program space’s capacity.
|
| 365 |
+
320 Such a system represents a more flexible general-purpose computer that can dynamically allocate
|
| 366 |
+
321 computing resources by itself without human pre-specification.
|
| 367 |
+
|
| 368 |
+
References
|
| 369 |
+
[1] Jacob Andreas, Marcus Rohrbach, Trevor Darrell, and Dan Klein. Neural module networks. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 39–48, 2016.
|
| 370 |
+
[2] Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. Neural machine translation by jointly learning to align and translate. In International Conference on Learning Representations, 2015.
|
| 371 |
+
[3] 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:253–279, 2013.
|
| 372 |
+
[4] Yoshua Bengio, Nicholas Léonard, and Aaron Courville. Estimating or propagating gradients through stochastic neurons for conditional computation. arXiv preprint arXiv:1308.3432, 2013.
|
| 373 |
+
[5] Kyunghyun Cho, Bart van Merriënboer, Caglar Gulcehre, Dzmitry Bahdanau, Fethi Bougares, Holger Schwenk, and Yoshua Bengio. Learning phrase representations using RNN encoder– decoder for statistical machine translation. In Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 1724–1734. Association for Computational Linguistics, October 2014.
|
| 374 |
+
[6] JC Eccles. The modular operation of the cerebral neocortex considered as the material basis of mental events. Neuroscience, 6(10):1839–1855, 1981.
|
| 375 |
+
[7] Gerald M Edelman. Neural darwinism: selection and reentrant signaling in higher brain function. Neuron, 10(2):115–125, 1993.
|
| 376 |
+
[8] Gerald M Edelman and Vernon B Mountcastle. The mindful brain: cortical organization and the group-selective theory of higher brain function. Massachusetts Inst of Technology Pr, 1978.
|
| 377 |
+
[9] Richard SJ Frackowiak. Human brain function. Elsevier, 2004.
|
| 378 |
+
[10] Robert M French. Catastrophic forgetting in connectionist networks. Trends in cognitive sciences, 3(4):128–135, 1999.
|
| 379 |
+
[11] Alex Graves, Greg Wayne, and Ivo Danihelka. Neural turing machines. arXiv preprint arXiv:1410.5401, 2014.
|
| 380 |
+
[12] Alex Graves, Greg Wayne, Malcolm Reynolds, Tim Harley, Ivo Danihelka, Agnieszka Grabska-Barwinska, Sergio Gómez Colmenarejo, Edward Grefenstette, Tiago Ramalho, John ´ Agapiou, et al. Hybrid computing using a neural network with dynamic external memory. Nature, 538(7626):471–476, 2016.
|
| 381 |
+
[13] David Ha, Andrew M. Dai, and Quoc V. Le. Hypernetworks. In International Conference on Learning Representations, 2017.
|
| 382 |
+
[14] Bart LM Happel and Jacob MJ Murre. Design and evolution of modular neural network architectures. Neural networks, 7(6-7):985–1004, 1994.
|
| 383 |
+
[15] 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.
|
| 384 |
+
[16] Sepp Hochreiter and Jürgen Schmidhuber. Long short-term memory. Neural computation, 9(8):1735–1780, 1997.
|
| 385 |
+
[17] Yen-Chang Hsu, Yen-Cheng Liu, Anita Ramasamy, and Zsolt Kira. Re-evaluating continual learning scenarios: A categorization and case for strong baselines. In NeurIPS Continual learning Workshop, 2018.
|
| 386 |
+
[18] 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, pages 4700–4708, 2017.
|
| 387 |
+
[19] D.H. Hubel. Eye, Brain, and Vision. Scientific American Library series. Scientific American Library, 1988.
|
| 388 |
+
[20] Robert A Jacobs, Michael I Jordan, Steven J Nowlan, and Geoffrey E Hinton. Adaptive mixtures of local experts. Neural computation, 3(1):79–87, 1991.
|
| 389 |
+
[21] Alex Krizhevsky, Geoffrey Hinton, et al. Learning multiple layers of features from tiny images. TR-2009, 2009.
|
| 390 |
+
[22] Hung Le, Truyen Tran, and Svetha Venkatesh. Neural stored-program memory. In International Conference on Learning Representations, 2020.
|
| 391 |
+
[23] V Lebedev, Y Ganin, M Rakhuba, I Oseledets, and V Lempitsky. Speeding-up convolutional neural networks using fine-tuned cp-decomposition. In International Conference on Learning Representations, 2015.
|
| 392 |
+
[24] 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.
|
| 393 |
+
[25] David Lopez-Paz and Marc’Aurelio Ranzato. Gradient episodic memory for continual learning. In Advances in neural information processing systems, pages 6467–6476, 2017.
|
| 394 |
+
[26] Volodymyr Mnih, Adria Puigdomenech Badia, Mehdi Mirza, Alex Graves, Timothy Lillicrap, Tim Harley, David Silver, and Koray Kavukcuoglu. Asynchronous methods for deep reinforcement learning. In International conference on machine learning, pages 1928–1937, 2016.
|
| 395 |
+
[27] Alexander Novikov, Dmitrii Podoprikhin, Anton Osokin, and Dmitry P Vetrov. Tensorizing neural networks. In Advances in neural information processing systems, pages 442–450, 2015.
|
| 396 |
+
[28] Ethan Perez, Florian Strub, Harm De Vries, Vincent Dumoulin, and Aaron Courville. FiLM: Visual Reasoning with a General Conditioning Layer. In AAAI Conference on Artificial Intelligence, New Orleans, United States, February 2018.
|
| 397 |
+
[29] Clemens Rosenbaum, Tim Klinger, and Matthew Riemer. Routing networks: Adaptive selection of non-linear functions for multi-task learning. In International Conference on Learning Representations, 2018.
|
| 398 |
+
[30] David E Rumelhart, Geoffrey E Hinton, and Ronald J Williams. Learning representations by back-propagating errors. Nature, 323(6088):533–536, 1986.
|
| 399 |
+
[31] Adam Santoro, Sergey Bartunov, Matthew Botvinick, Daan Wierstra, and Timothy Lillicrap. Meta-learning with memory-augmented neural networks. In International conference on machine learning, pages 1842–1850, 2016.
|
| 400 |
+
[32] Jürgen Schmidhuber. Making the world differentiable: On using self-supervised fully recurrent neural networks for dynamic reinforcement learning and planning in non-stationary environm nts. TR FKI-126-90, 1990.
|
| 401 |
+
[33] Jürgen Schmidhuber. Learning to control fast-weight memories: An alternative to dynamic recurrent networks. Neural Computation, 4(1):131–139, 1992.
|
| 402 |
+
[34] Joan Serra, Didac Suris, Marius Miron, and Alexandros Karatzoglou. Overcoming catastrophic forgetting with hard attention to the task. In International Conference on Machine Learning, pages 4548–4557, 2018.
|
| 403 |
+
[35] Noam Shazeer, Azalia Mirhoseini, Krzysztof Maziarz, Andy Davis, Quoc V. Le, Geoffrey E. Hinton, and Jeff Dean. Outrageously large neural networks: The sparsely-gated mixture-ofexperts layer. In International Conference on Learning Representations, 2017.
|
| 404 |
+
[36] Hanul Shin, Jung Kwon Lee, Jaehong Kim, and Jiwon Kim. Continual learning with deep generative replay. In Advances in Neural Information Processing Systems, pages 2990–2999, 2017.
|
| 405 |
+
[37] A.M Turing. On computable numbers, with an application to the entscheidungsproblem. In Proceedings of the London Mathematical Society, 1936.
|
| 406 |
+
[38] 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.
|
| 407 |
+
[39] Christoph von der Malsburg. The correlation theory of brain function, 1981.
|
| 408 |
+
[40] John Von Neumann. First draft of a report on the edvac. IEEE Annals of the History of Computing, 15(4):27–75, 1993.
|
| 409 |
+
[41] Friedemann Zenke, Ben Poole, and Surya Ganguli. Continual learning through synaptic intelligence. Proceedings of machine learning research, 70:3987, 2017.
|
| 410 |
+
|
| 411 |
+
1. For all authors...
|
| 412 |
+
|
| 413 |
+
(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
|
| 414 |
+
(b) Did you describe the limitations of your work? [Yes] See Discussion and Appendix’s "Training procedure and hyper-parameter selections."
|
| 415 |
+
(c) Did you discuss any potential negative societal impacts of your work? [Yes] See Discussion.
|
| 416 |
+
(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
|
| 417 |
+
|
| 418 |
+
2. If you are including theoretical results...
|
| 419 |
+
|
| 420 |
+
(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]
|
| 421 |
+
|
| 422 |
+
3. If you ran experiments...
|
| 423 |
+
|
| 424 |
+
(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)? [No] Data is public, provided with link. Code will be avaialble after published. All training details are available and can be used to implement and reproduce the results.
|
| 425 |
+
(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] See Appendix’s "Training procedure and hyper-parameter selections."
|
| 426 |
+
(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes] See Experimental Results.
|
| 427 |
+
(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’s "Training procedure and hyper-parameter selections.
|
| 428 |
+
|
| 429 |
+
4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
|
| 430 |
+
|
| 431 |
+
(a) If your work uses existing assets, did you cite the creators? [Yes]
|
| 432 |
+
(b) Did you mention the license of the assets? [No] All assets are public. We will mention the license detail after the paper is published.
|
| 433 |
+
(c) Did you include any new assets either in the supplemental material or as a URL? [No]
|
| 434 |
+
(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [No]
|
| 435 |
+
(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [No]
|
| 436 |
+
|
| 437 |
+
5. If you used crowdsourcing or conducted research with human subjects...
|
| 438 |
+
|
| 439 |
+
(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
|
| 440 |
+
(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
|
| 441 |
+
(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
|
md/train/OKrNPg3xR3T/OKrNPg3xR3T.md
ADDED
|
@@ -0,0 +1,274 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Mastering Atari Games with Limited Data
|
| 2 |
+
|
| 3 |
+
Weirui $\mathbf { Y e ^ { * } }$ Shaohuai Liu∗ Thanard Kurutach† Pieter Abbeel† Yang Gao∗‡ ∗Tsinghua University, †UC Berkeley, ‡ Shanghai Qi Zhi Institute
|
| 4 |
+
|
| 5 |
+
# Abstract
|
| 6 |
+
|
| 7 |
+
Reinforcement learning has achieved great success in many applications. However, sample efficiency remains a key challenge, with prominent methods requiring millions (or even billions) of environment steps to train. Recently, there has been significant progress in sample efficient image-based RL algorithms; however, consistent human-level performance on the Atari game benchmark remains an elusive goal. We propose a sample efficient model-based visual RL algorithm built on MuZero, which we name EfficientZero. Our method achieves $1 9 0 . 4 \%$ mean human performance and $1 1 6 . 0 \%$ median performance on the Atari 100k benchmark with only two hours of real-time game experience and outperforms the state SAC in some tasks on the DMControl $1 0 0 \mathrm { k }$ benchmark. This is the first time an algorithm achieves super-human performance on Atari games with such little data. EfficientZero’s performance is also close to DQN’s performance at 200 million frames while we consume 500 times less data. EfficientZero’s low sample complexity and high performance can bring RL closer to real-world applicability. We implement our algorithm in an easy-to-understand manner and it is available at https://github.com/YeWR/EfficientZero. We hope it will accelerate the research of MCTS-based RL algorithms in the wider community.
|
| 8 |
+
|
| 9 |
+

|
| 10 |
+
Figure 1: Our proposed method EfficientZero is $170 \%$ and $180 \%$ better than the previous SoTA performance in mean and median human normalized score and is the first to outperform the average human performance on the Atari $1 0 0 \mathrm { k }$ benchmark. The high sample efficiency and performance of EfficientZero can bring RL closer to the real-world applications.
|
| 11 |
+
|
| 12 |
+
# 1 Introduction
|
| 13 |
+
|
| 14 |
+
Reinforcement learning has achieved great success on many challenging problems. Notable work includes DQN [24], AlphaGo [33] and OpenAI Five [5]. However, most of these works come at the cost of a large number of environmental interactions. For example, AlphaZero [34] needs to play 21 million games at training time. On the contrary, a professional human player can only play around 5 games per day, meaning it would take a human player 11,500 years to achieve the same amount of experience. The sample complexity might be less of an issue when applying RL algorithms in simulation and games. However, when it comes to real-world problems, such as robotic manipulation, healthcare, and advertisement recommendation systems, achieving high performance while maintaining low sample complexity is the key to viability.
|
| 15 |
+
|
| 16 |
+
People have made a lot of progress in sample efficient RL in the past years [8, 10, 35, 22, 21, 32, 18]. Among them, model-based methods have attracted a lot of attention, since both the data from real environments and the “imagined data” from the model can be used to train the policy, making these methods particularly sample-efficient [8, 10]. However, most of the successes are in state-based environments. In image-based environments, some model-based methods such as MuZero [27] and Dreamer V2 [14] achieve super-human performance, but they are not sample efficient; other methods such as SimPLe [18] is quite efficient but achieve inferior performance (0.144 human normalized median scores). Recently, data-augmented and self-supervised methods applied to modelfree methods have achieved more success in the data-efficient regime [32]. However, they still fail to achieve the levels which can be expected of a human.
|
| 17 |
+
|
| 18 |
+
Therefore, for improving the sample efficiency as well as keeping superior performance, we find the following three components are essential to the model-based visual RL agent: a self-supervised environment model, a mechanism to alleviate the model compounding error, and a method to correct the off-policy issue. In this work, we propose EfficientZero, a model-based RL algorithm that achieves high performance with limited data. Our proposed method is built on MuZero. We make three critical changes: (1) use self-supervised learning to learn a temporally consistent environment model, (2) learn the value prefix in an end-to-end manner, thus helping to alleviate the compounding error in the model, (3) use the learned model to correct off-policy value targets.
|
| 19 |
+
|
| 20 |
+
As illustrated as Figure 1, our model achieves state-of-the-art performance on the widely used Atari [4] 100k benchmark and it achieves super-human performance with only 2 hours of real-time gameplay. More specifically, our model achieves $1 9 0 . 4 \%$ mean human normalized performance and $1 1 6 . 0 \%$ median human normalized performance. As a reference, DQN [24] achieves $220 \%$ mean human normalized performance, and $96 \%$ median human normalized performance, at the cost of 500 times more data (200 million frames). To further verify the effectiveness of EfficientZero, we conduct experiments on some simulated robotics environments of the DeepMind Control (DMControl) suite. It achieves state-of-the-art performance and outperforms the state SAC which directly learns from the ground truth states. Our sample efficient and high-performance algorithm opens the possibility of having more impact on many real-world problems.
|
| 21 |
+
|
| 22 |
+
# 2 Related Work
|
| 23 |
+
|
| 24 |
+
# 2.1 Sample Efficient Reinforcement Learning
|
| 25 |
+
|
| 26 |
+
Sample efficiency has attracted significant work in the past. In RL with image inputs, model-based approaches [13, 12] which model the world with both a stochastic and a deterministic component, have achieved promising results for simulated robotic control. Kaiser et al. [18] propose to use an action-conditioned video prediction model, along with a policy learning algorithm. It achieves the first strong performance on Atari games with as little as $4 0 0 \mathrm { k }$ frames. However, Kielak [19] and van Hasselt et al. [39] argue that this is not necessary to achieve strong results with model-based methods, and they show that when tuned appropriately, Rainbow [16] can achieve comparable results.
|
| 27 |
+
|
| 28 |
+
Recent advances in self-supervised learning, such as SimCLR [6], MoCo [15], SimSiam [7] and BYOL [11] have inspired representation learning in image-based RL. Srinivas et al. [35] propose to use contrastive learning in RL algorithms and their work achieves strong performance on image-based continuous and discrete control tasks. Later, Laskin et al. [22] and Kostrikov et al. [21] find that contrastive learning is not necessary, but with data augmentations alone, they can achieve better performance. Schwarzer et al. [32] propose a temporal consistency loss, which is combined with data augmentations and achieves state-of-the-art performance. Notably, our self-supervised consistency loss is quite similar to Schwarzer et al. [32], except we use SimSiam [6] while they use BYOL [11] as the base self-supervised learning framework. However, Schwarzer et al. [32] only apply the learned representations in a model-free manner, while we combine the learned model with model-based exploration and policy improvement, thus leading to more efficient use of the environment model.
|
| 29 |
+
|
| 30 |
+
Despite the recent progress in the sample-efficient RL, today’s RL algorithms are still well behind human performance when the amount of data is limited. Although traditional model-based RL is considered more sample efficient than model-free ones, current model-free methods dominate in terms of performance for image-input settings. In this paper, we propose a model-based RL algorithm that for the first time, achieves super-human performance on Atari games with limited data.
|
| 31 |
+
|
| 32 |
+
# 2.2 Reinforcement Learning with MCTS
|
| 33 |
+
|
| 34 |
+
Temporal difference learning [24, 38, 40, 16] and policy gradient based methods [25, 23, 29, 31] are two types of popular reinforcement learning algorithms. Recently, Silver et al. [33] propose to use MCTS as a policy improvement operator and has achieved great success in many board games, such as Go, Chess, and Shogi [34]. Later, the algorithm is adapted to learn the world model at the same time [27]. It has also been extended to deal with continuous action spaces [17] and offline data [28]. These MCTS RL algorithms are a hybrid of model-based learning and model-free learning.
|
| 35 |
+
|
| 36 |
+
However, most of them are trained with a lot of environmental samples. Our method is built on top of MuZero [27], and we demonstrate that our method can achieve higher sample efficiency while still achieving competitive performance on the Atari $1 0 0 \mathrm { k }$ benchmark. de Vries et al. [9] have studied the potential of using auxiliary loss similar to our self-supervised consistency loss. However, they only test on two low dimensional state-based environments and find the auxiliary loss has mixed effects on the performance. On the contrary, we find that the consistency loss is critical in most environments with high dimensional observations and limited data.
|
| 37 |
+
|
| 38 |
+
# 2.3 Multi-Step Value Estimation
|
| 39 |
+
|
| 40 |
+
In Q-learning [41], the target Q vaincorporating multiple steps of re s computed bys at once, i.e. $z _ { t } = \bar { \sum _ { i = 0 } ^ { k - 1 } } \gamma ^ { i } \bar { u } _ { t + i } \stackrel { } { + } \gamma ^ { k } v _ { t + k }$ people fi, where $u _ { t + i }$ atis $v _ { t + k }$ the value target $z _ { t }$ leads to faster convergence [24, 16]. However, the use of multi-step value has off-policy issues, since $u _ { t + i }$ are not generated by the current policy. In practice, this issue is usually ignored when there is a large amount of data since the data can be thought as approximately on-policy. $\mathrm { T D } ( \lambda )$ [36] and GAE [30] improve the value estimation by better trading off the bias and the variance, but they do not deal with the off-policy issue. Recently, image input model-based algorithms such as Kaiser et al. [18] and Hafner et al. [12] use model imaginary rollouts to avoid the off-policy issue. However, this approach has the risk of model exploitation. Asadi et al. [2] proposed a multi-step model to combat the compounding error. Our proposed model-based off-policy correction method starts from the rewards in the real-world experience and uses model-based value estimate to bootstrap. Our approach balances between the off-policy issue and model exploitation.
|
| 41 |
+
|
| 42 |
+
# 3 Background
|
| 43 |
+
|
| 44 |
+
# 3.1 MuZero
|
| 45 |
+
|
| 46 |
+
Our method is built on top of the MuZero Reanalyze [27] algorithm. For brevity, we refer to it as MuZero throughout the paper. MuZero is a policy learning method based on the Monte-Carlo Tree Search (MCTS) algorithm. The MCTS algorithm operates with an environment model, a prior policy function, and a value function. The environment model is represented as the reward function $\mathcal { R }$ and the dynamic function $\mathcal { G }$ : $r _ { t } = \mathcal { R } ( s _ { t } , a _ { t } )$ , $\hat { s } _ { t + 1 } = \mathcal G ( s _ { t } , a _ { t } )$ , which are needed when MCTS expands a new node. In MuZero, the environment model is learned. Thus the reward and the next state are approximated. Besides, the predicted policy $p _ { t } =$ acts as a search prior over actions of a node. It helps the MCTS focus on more promising actions when expanding the node. MCTS also needs a value function $\mathcal { V } ( s _ { t } )$ that measures the expected return of the node $s _ { t }$ , which provides a long-term evaluation of the tree’s leaf node without further search. MCTS will output an action visit distribution $\pi _ { t }$ over the root node, which is potentially a better policy, compared to the current neural network. Thus, the MCTS algorithm can be thought of as a policy improvement operator.
|
| 47 |
+
|
| 48 |
+
In practice, the environment model, policy function, and value function operate on a hidden abstract state $s _ { t }$ , both for computational efficiency and ease of environment modeling. The abstract state is extracted by a representation function $\mathcal { H }$ on observations $o _ { t }$ : $s _ { t } = \mathcal { H } ( o _ { t } )$ . All of the mentioned models above are usually represented as neural networks. During training, the algorithm collects roll-out data in the environment using MCTS, resulting in potentially higher quality data than the current neural network policy. The data is stored in a replay buffer. The optimizer minimizes the following loss on the data sampled from the replay buffer:
|
| 49 |
+
|
| 50 |
+
$$
|
| 51 |
+
\mathcal { L } ( u _ { t } , r _ { t } ) + \lambda _ { 1 } \mathcal { L } ( \pi _ { t } , p _ { t } ) + \lambda _ { 2 } \mathcal { L } ( z _ { t } , v _ { t } )
|
| 52 |
+
$$
|
| 53 |
+
|
| 54 |
+
Here, visit c $u _ { t }$ is the reward from the ennt distribution of the MCT $r _ { t } = \mathcal { R } ( s _ { t } , a _ { t } )$ is the predted policy, $\pi _ { t }$ $p _ { t } = \mathcal { P } ( s _ { t } )$ $\begin{array} { r } { z _ { t } = \sum _ { i = 0 } ^ { k - 1 } \gamma ^ { i } u _ { t + i } + \gamma ^ { k } v _ { t + k } } \end{array}$ $v _ { t } = \mathcal { V } ( s _ { t } )$
|
| 55 |
+
$\mathcal { R }$ , policy function $\mathcal { P }$ , value function $\nu$ , the representation function $\mathcal { H }$ and the dynamics function $\mathcal { G }$
|
| 56 |
+
are trainable neural networks. It is worth noting that MuZero does not explicitly learn the environment
|
| 57 |
+
model. Instead, it solely relies on the reward, value, and policy prediction to learn the model.
|
| 58 |
+
|
| 59 |
+
# 3.2 Monte-Carlo Tree Search
|
| 60 |
+
|
| 61 |
+
Monte-Carlo Tree Search [1, 33, 34, 14], or MCTS, is a heuristic search algorithm. In our setup, MCTS is used to find an action policy that is better than the current neural network policy.
|
| 62 |
+
|
| 63 |
+
More specifically, MCTS needs an environment model, including the reward function and the nextstate function. It also needs a value function and a policy function, which act as heuristics for the tree search. MCTS operates by expanding a search tree from the current node. It saves computation by selectively expanding a few nodes. In order to find a high-quality decision, the tree expansion process has to balance between exploration versus exploitation, i.e. balance between expanding a node that is promising with many visits versus expanding a node with lower performance but fewer visits. MCTS employs the UCT [26, 20] rule, i.e. UCB [3] on trees. At every node expansion step, UCT will select a node as follows [14]:
|
| 64 |
+
|
| 65 |
+
$$
|
| 66 |
+
a ^ { k } = \arg \operatorname* { m a x } _ { a } \left\{ Q ( s , a ) + P ( s , a ) { \frac { \sqrt { \sum _ { b } N ( s , b ) } } { 1 + N ( s , a ) } } \left( c _ { 1 } + \log \left( { \frac { \sum _ { b } N ( s , b ) + c _ { 2 } + 1 } { c _ { 2 } } } \right) \right) \right\}
|
| 67 |
+
$$
|
| 68 |
+
|
| 69 |
+
where, $Q ( s , a )$ is the current estimate of the Q-value, $P ( s , a )$ is the current neural network policy for selecting this action, helping the MCTS prioritize exploring promising part of the tree. During training time, $P ( s , a )$ is usually perturbed by noises to allow explorations. $N ( s , a )$ denotes how many times this state-action pair is visited in the tree search, and $N ( s , b )$ denote that of $a$ ’s siblings. Thus this term will encourage the search to visit the nodes whose siblings are visited often, but itself less visited. Finally, the last term gives a weights to the previous terms.
|
| 70 |
+
|
| 71 |
+
After expanding the nodes for a pre-defined number of times, the MCTS will return how many times each action under the root node is visited, as the improved policy to the root node. Thus, MCTS can be considered as a policy improvement operator in the RL setting.
|
| 72 |
+
|
| 73 |
+
# 4 EfficientZero
|
| 74 |
+
|
| 75 |
+
Model-based algorithms have achieved great success in sample-efficient learning from lowdimensional states. However, current visual model-based algorithms either require large amounts of training data or exhibit inferior performance to model-free algorithms in data-limited settings [32]. Many previous works even suspect whether model-based algorithms can really offer data efficiency when using image observations [39]. We provide a positive answer here. We propose the EfficientZero, a model-based algorithm built on the MCTS, that achieves super-human performance on the $1 0 0 \mathrm { k }$ Atari benchmark, outperforming the previous SoTA to a large degree.
|
| 76 |
+
|
| 77 |
+
When directly running MCTS-based RL algorithms such as MuZero, we find that they do not perform well on the limited-data benchmark. Through our ablations, we confirm the following three issues which pose challenges to algorithms like MuZero in data-limited settings.
|
| 78 |
+
|
| 79 |
+
Lack of supervision on environment model. First, the learned model in the environment dynamics is only trained through the reward, value and policy functions. However, the reward is only a scalar signal and in many scenarios, the reward will be sparse. Value functions are trained with bootstrapping, and thus are noisy. Policy functions are trained with the search process. None of the reward, value and policy losses can provide enough training signals to learn the environment model.
|
| 80 |
+
|
| 81 |
+
Hardness to deal with aleatoric uncertainty. Second, we find that even with enough data, the predicted rewards still have large prediction errors. This is caused by the aleatoric uncertainty of the underlying environment. For example, the environment is hard to model. The reward prediction errors will accumulate when expanding the MCTS tree to a large depth, resulting in sub-optimal performance in exploration and evaluation.
|
| 82 |
+
|
| 83 |
+
Off-policy issues of multi-step value. Lastly, when computing the value target, MuZero uses the multi-step reward observed in the environment. Although this allows the reward to be propagated to the value function faster, we find that it suffers from severe off-policy issues and hinders convergence in the limited data scenario.
|
| 84 |
+
|
| 85 |
+
To address the above issues, we propose the following three critical modifications, which can greatly improve performance when samples are limited.
|
| 86 |
+
|
| 87 |
+
# 4.1 Self-Supervised Consistency Loss
|
| 88 |
+
|
| 89 |
+
In previous MCTS RL algorithms, the environment model is either given or only trained with rewards, values, and policies, which cannot provide sufficient training signals due to their scalar nature. The problem is more severe when the reward is sparse or the bootstrapped value is not accurate. The MCTS policy improvement operator heavily relies on the environment model. Thus, it is vital to have an accurate one.
|
| 90 |
+
|
| 91 |
+
We notice that the output $\hat { s } _ { t + 1 }$ from the dynamic function $\mathcal { G }$ should be the same as $s _ { t + 1 }$ , i.e. the output of the representation function $\mathcal { H }$ with input of the next observation $o _ { t + 1 }$ (Fig. 2). This can help to supervise the predicted next state $\hat { s } _ { t + 1 }$ using the actual $s _ { t + 1 }$ , which is a tensor with at least a few hundred dimensions. This provides $\hat { s } _ { t + 1 }$ with much more training signals than the default scalar reward and value.
|
| 92 |
+
|
| 93 |
+

|
| 94 |
+
Figure 2: The self-supervised consistency loss.
|
| 95 |
+
|
| 96 |
+
More specifically, we adopt the recently proposed SimSiam [7] self-supervised framework. SimSiam [7] is a self-supervised method that takes two augmentation views of the same image and pulls the output of the second branch close to that of the first branch, where the first branch is an encoder network without gradient, and the second branch is the same encoder network with the gradient and a predictor head. The predictor head can simply be a two-layer MLP.
|
| 97 |
+
|
| 98 |
+
Note that SimSiam only learns the representation of individual images, and is not aware of how different images are connected. The learned image representations of SimSiam might not be a good candidate for learning the environment transition function, since adjacent observations might be encoded to very different representation encodings. We propose a self-supervised method that learns the transition function, along with the image representation function in an end-to-end manner. Figure 2 shows our method. Since we aim to learn the transition between adjacent observations, we pull $o _ { t }$ and $o _ { t + 1 }$ close to each other. The transition function is applied after the representation of $o _ { t }$ , such that $s _ { t }$ is transformed to $\hat { s } _ { t + 1 }$ , which now represents the same entity as the other branch. Then both of $s _ { t + 1 }$ and $\hat { s } _ { t + 1 }$ go through a common projector network. Since $s _ { t + 1 }$ is potentially a more accurate description of $o _ { t + 1 }$ compared to $\hat { s } _ { t + 1 }$ , we make the $o _ { t + 1 }$ branch as the target branch. It is common in self-supervised learning that the second or the third layer from the last is chosen as the features for some reason. Here, we choose the outputs from the representation network or the dynamics network as the hidden states rather than those from the projector or the predictor.
|
| 99 |
+
|
| 100 |
+
The two adjacent observations provide two views of the same entity. In practice, we find that applying augmentations to observations such as a random small shift of 0-4 pixels on the image helps to further improve the learned representation quality [35, 32]. We also unroll the dynamic function recurrently for 5 further steps and also pull $\hat { s } _ { t + k }$ close to $s _ { t + k }$ $k = 1 , . . . , 5 )$ ). Please see the Appendix for more implementation details.
|
| 101 |
+
|
| 102 |
+
# 4.2 End-To-End Prediction of the Value Prefix
|
| 103 |
+
|
| 104 |
+
In model-based learning, the agent needs to predict the future states conditioned on the current state and a series of hypothetical actions. The longer the prediction, the harder to predict it accurately, due to the compounding error in the recurrent rollouts. This is called the state aliasing problem. The environment model plays an important role in MCTS. The state aliasing problem harms the MCTS expansion, which will result in sub-optimal exploration as well as sub-optimal action search.
|
| 105 |
+
|
| 106 |
+
Predicting the reward from an aliased state is a hard problem. For example, as shown in Figure 3, the right agent loses the ball. If we only see the first observation, along with future actions, it is very hard both for an agent and a human to predict at which exact future timestep the player would lose a point. However, it is easy to predict the agent will miss the ball after a sufficient number of timesteps if he does not
|
| 107 |
+
|
| 108 |
+

|
| 109 |
+
Figure 3: A sample trajectory from the Atari Pong game. In this case, the right player didn’t move and missed the ball.
|
| 110 |
+
|
| 111 |
+
move. In practice, a human will never try to predict the exact step that he loses the point but will imagine over a longer horizon and thus get a more confident prediction.
|
| 112 |
+
|
| 113 |
+
Inspired by this intuition, we propose an end-to-end method to predict the value prefix. We notice that the predicted reward is always used in the estimation of the Q-value $Q ( s , a )$ in UCT of Equation 2
|
| 114 |
+
|
| 115 |
+
$$
|
| 116 |
+
Q ( s _ { t } , a ) = \sum _ { i = 0 } ^ { k - 1 } \gamma ^ { i } r _ { t + i } + \gamma ^ { k } v _ { t + k }
|
| 117 |
+
$$
|
| 118 |
+
|
| 119 |
+
$r _ { t + i }$ is the reward predicted from unrolled state as the value prefix, since it is used as a prefix i $\hat { s } _ { t + i }$ . W later name the sum of rewards-value computation. $\sum _ { i = 0 } ^ { k - 1 } \gamma ^ { i } r _ { t + i }$ $\mathrm { Q }$
|
| 120 |
+
|
| 121 |
+
We propose to predict value prefix from the unrolled states $( s _ { t } , \hat { s } _ { t + 1 } , \cdot \cdot \cdot , \hat { s } _ { t + k - 1 } )$ in an end-to-end manner, i.e. value-prefix $= f ( s _ { t } , \hat { s } _ { t + 1 } , \cdot \cdot \cdot , \hat { s } _ { t + k - 1 } )$ . Here $f$ is some neural network architecture that takes in a variable number of inputs and outputs a scalar. We choose the LSTM in our experiment. During the training time, the LSTM is supervised at every time step, since the value prefix can be computed whenever a new state comes in. This per-step rich supervision allows the LSTM can be trained well even with limited data. Compared with the naive per step reward prediction and summation approach, the end-to-end value prefix prediction is more accurate, because it can automatically handle the intermediate state aliasing problem. See Experiment Section 5.3 for empirical evaluations. As a result, it helps the MCTS to explore better, and thus increases the performance. See the Appendix for architectural details.
|
| 122 |
+
|
| 123 |
+
# 4.3 Model-Based Off-Policy Correction
|
| 124 |
+
|
| 125 |
+
In MCTS RL algorithms, the value function fits the value of the current neural network policy. However, in practice as MuZero Reanalyze doetrajectory from the replay buffer and computing: $\begin{array} { r } { z _ { t } = \sum _ { i = 0 } ^ { k - 1 } \gamma ^ { i } \dot { u _ { t + i } } + \gamma ^ { k } \dot { v _ { t + k } } } \end{array}$ ted by sampling a. This value target suffers from off-policy issues, since the trajectory is rolled out using an older policy, and thus the value target is no longer accurate. When data is limited, we have to reuse the data sampled from a much older policy, thus exaggerating the inaccurate value target issue.
|
| 126 |
+
|
| 127 |
+
In previous model-free settings, there is no straightforward approach to fix this issue. On the contrary, since we have a model of the environment, we can use the model to imagine an "online experience". More specifically, we propose to use rewards of a dynamic horizon $l$ from the old trajectory, where $l < k$ and $l$ should be smaller if the trajectory is older. This reduces the policy divergence by fewer rollout steps. Further, we redo an MCTS search with the current policy on the last state $s _ { t + l }$ and compute the empirical mean value at the root node. This effectively corrects the off policy issue using imagined rollouts with current policy and reduces the increased bias caused by setting $l$ less than $k$ . Formally, we propose to use the following value target:
|
| 128 |
+
|
| 129 |
+
$$
|
| 130 |
+
z _ { t } = \sum _ { i = 0 } ^ { l - 1 } \gamma ^ { i } u _ { t + i } + \gamma ^ { l } \nu _ { t + l } ^ { \mathrm { M C T S } }
|
| 131 |
+
$$
|
| 132 |
+
|
| 133 |
+
where $l < = k$ and the older the sampled trajectory, the smaller the $l$ . $\nu ^ { \mathrm { M C T S } } ( \mathbf { s } _ { t + l } )$ is the root value of the MCTS tree expanded from $s _ { t + l }$ with the current policy, as MuZero non-Reanalyze does. See the Appendix for how to choose $l$ . In practice, the computation cost of the correction is two times on the reanalyzed side. However, the training will not be affected due to the parallel implementation.
|
| 134 |
+
|
| 135 |
+
# 5 Experiments
|
| 136 |
+
|
| 137 |
+
In this section, we aim to evaluate the sample efficiency of the proposed algorithm. Here, the sample efficiency is measured by the performance of each algorithm at a common, small amount of environment transitions, i.e. the better the performance, the higher the sample efficiency. More specifically, we use the Atari 100k benchmark. Intuitively, this benchmark asks the agent to learn to play Atari games within two hours of real-world game time. Additionally, we conduct some ablation studies to investigate and analyze each component on Atari 100k. To further show the sample efficiency, we apply EfficientZero to some simulated robotics environments on the DMControl $1 0 0 \mathrm { k }$ benchmark, which contains the same $1 0 0 \mathrm { k }$ environment steps.
|
| 138 |
+
|
| 139 |
+
# 5.1 Environments
|
| 140 |
+
|
| 141 |
+
Atari 100k Atari $1 0 0 \mathrm { k }$ was first proposed by the SimPLe [18] method, and is now used by many sample-efficient RL works, such as Srinivas et al. [35], Laskin et al. [22], Kostrikov et al. [21], Schwarzer et al. [32]. The benchmark contains 26 Atari games, and the diverse set of games can effectively measure the performance of different algorithms. The benchmark allows the agent to interact with 100 thousand environment steps, i.e. 400 thousand frames due to a frameskip of 4, with each environment. $1 0 0 \mathrm { k }$ steps roughly correspond to 2 hours of real-time gameplay, which is far less than the usual RL settings. For example, DQN [24] uses 200 million frames, which is around 925 hours of real-time gameplay. Note that the human player’s performance is tested after allowing the human to get familiar with the game after 2 hours as well. We report the raw performance on each game, as well as the mean and median of the human normalized score. The human normalized score is defined as: $\left( \mathrm { s c o r e } _ { \mathrm { a g e n t } } - \mathrm { s c o r e } _ { \mathrm { r a n d o m } } \right) / ( \mathrm { s c o r e } _ { \mathrm { h u m a n } } - \mathrm { s c o r e } _ { \mathrm { r a n d o m } } )$ .
|
| 142 |
+
|
| 143 |
+
We compare our method to the following baselines. (1) SimPLe [18], a model-based RL algorithm that learns an action conditional video prediction model and trains PPO within the learned environment. (2) OTRainbow [19], which tunes the hyper-parameters of the Rainbow [16] method to achieve higher sample efficiency. (3) CURL [35], which uses contrastive learning as a side task to improve the image representation quality. (4) DrQ [21], which adds data augmentations to the input images while learning the original RL objective. (5) SPR [32], the previous SoTA in Atari $1 0 0 \mathrm { k }$ which proposes to augment the Rainbow [16] agent with data augmentations as well as a multi-step consistency loss using BYOL-style self-supervision. (6) MuZero [27] with our implementations and the same hyper-parameters as EfficientZero. (7) Random Agent (8) Human performance.
|
| 144 |
+
|
| 145 |
+
DeepMind Control 100k Tassa et al. [37] propose the DMControl suite, which includes some challenging visual robotics tasks with continuous action space. And some works [12, 35] have benchmarked for the sample efficiency on the DMControl $1 0 0 \mathrm { k }$ which contains $1 0 0 \mathrm { k }$ environment steps data. Since the MCTS-based methods cannot deal with tasks with continuous action space, we discretize each dimension into 5 discrete slots in MuZero [27] and EfficientZero. To avoid the dimension explosion, we evaluate EfficientZero in three low-dimensional tasks.
|
| 146 |
+
|
| 147 |
+
We compare our method to the following baselines. (1) Pixel SAC, which applies SAC directly to pixels. (2) SAC-AE [42], which combines the SAC and an auto-encoder to handle image-based inputs. (3) State SAC, which applies SAC directly to ground truth low dimensional states rather than the pixels. (4) Dreamer [12], which learns a world model and is trained in dreamed scenarios. (5) CURL [35], the previous SoTA in DMControl 100k. (6) MuZero [27] with action discretizations.
|
| 148 |
+
|
| 149 |
+
# 5.2 Results
|
| 150 |
+
|
| 151 |
+
Table 1 shows the results of EfficientZero on the Atari $1 0 0 \mathrm { k }$ benchmark. Normalizing our score with the score of human players, EfficientZero achieves a mean score of 1.904 and a median score of 1.160. As a reference, DQN [24] achieves a mean and median performance of 2.20 and 0.959 on these 26 games. However, it is trained with 500 times more data (200 million frames). For the first time, an agent trained with only 2 hours of game data can outperform the human player in terms of the mean and median performance. Among all games, our method outperforms the human in 14 out of 26 games. Compared with the previous state-of-the-art method (SPR [32]), we are $170 \%$ and $180 \%$ better in terms of mean and median score respectively.
|
| 152 |
+
|
| 153 |
+
Apart from the Atari games, EffcientZero achieves remarkable results in the simulated tasks with continuous action space. As shown in Table 2, EffcientZero outperforms CURL, the previous SoTA, to a considerable degree and keeps a smaller variance but MuZero cannot work well here. Notably, EfficientZero achieves comparable results to the state SAC, which consumes the ground truth states as input and is considered as the oracles.
|
| 154 |
+
|
| 155 |
+
Table 1: Scores achieved on the Atari $1 0 0 \mathrm { k }$ benchmark (32 seeds). EfficientZero achieves superhuman performance with only 2 hours of real-time game play. Our method is $170 \%$ and $180 \%$ better than the previous SoTA performance, in mean and median human normalized score respectively.
|
| 156 |
+
|
| 157 |
+
<table><tr><td>Game</td><td>Random</td><td>Human</td><td>SimPLe</td><td>OTRainbow</td><td>CURL</td><td>DrQ</td><td>SPR</td><td>MuZero</td><td>Ours</td></tr><tr><td>Alien</td><td>227.8</td><td>7127.7</td><td>616.9</td><td>824.7</td><td>558.2</td><td>771.2</td><td>801.5</td><td>530.0</td><td>1140.3</td></tr><tr><td>Amidar</td><td>5.8</td><td>1719.5</td><td>88.0</td><td>82.8</td><td>142.1</td><td>102.8</td><td>176.3</td><td>38.8</td><td>101.9</td></tr><tr><td>Assault</td><td>222.4</td><td>742.0</td><td>527.2</td><td>351.9</td><td>600.6</td><td>452.4</td><td>571.0</td><td>500.1</td><td>1407.3</td></tr><tr><td>Asterix</td><td>210.0</td><td>8503.3</td><td>1128.3</td><td>628.5</td><td>734.5</td><td>603.5</td><td>977.8</td><td>1734.0</td><td>16843.8</td></tr><tr><td>Bank Heist</td><td>14.2</td><td>753.1</td><td>34.2</td><td>182.1</td><td>131.6</td><td>168.9</td><td>380.9</td><td>192.5</td><td>361.9</td></tr><tr><td>BattleZone</td><td>2360.0</td><td>37187.5</td><td>5184.4</td><td>4060.6</td><td>14870.0</td><td>12954.0</td><td>16651.0</td><td>7687.5</td><td>17938.0</td></tr><tr><td>Boxing</td><td>0.1</td><td>12.1</td><td>9.1</td><td>2.5</td><td>1.2</td><td>6.0</td><td>35.8</td><td>15.1</td><td>44.1</td></tr><tr><td>Breakout</td><td>1.7</td><td>30.5</td><td>16.4</td><td>9.8</td><td>4.9</td><td>16.1</td><td>17.1</td><td>48.0</td><td>406.5</td></tr><tr><td>ChopperCmd</td><td>811.0</td><td>7387.8</td><td>1246.9</td><td>1033.3</td><td>1058.5</td><td>780.3</td><td>974.8</td><td>1350.0</td><td>1794.0</td></tr><tr><td>Crazy Climber</td><td>10780.5</td><td>35829.4</td><td>62583.6</td><td>21327.8</td><td>12146.5</td><td>20516.5</td><td>42923.6</td><td>56937.0</td><td>80125.3</td></tr><tr><td>Demon Attack</td><td>152.1</td><td>1971.0</td><td>208.1</td><td>711.8</td><td>817.6</td><td>1113.4</td><td>545.2</td><td>3527.0</td><td>13298.0</td></tr><tr><td>Freeway</td><td>0.0</td><td>29.6</td><td>20.3</td><td>25.0</td><td>26.7</td><td>9.8</td><td>24.4</td><td>21.8</td><td>21.8</td></tr><tr><td>Frostbite</td><td>65.2</td><td>4334.7</td><td>254.7</td><td>231.6</td><td>1181.3</td><td>331.1</td><td>1821.5</td><td>255.0</td><td>313.8</td></tr><tr><td>Gopher</td><td>257.6</td><td>2412.5</td><td>771.0</td><td>778.0</td><td>669.3</td><td>636.3</td><td>715.2</td><td>1256.0</td><td>3518.5</td></tr><tr><td>Hero</td><td>1027.0</td><td>30826.4</td><td>2656.6</td><td>6458.8</td><td>6279.3</td><td>3736.3</td><td>7019.2</td><td>3095.0</td><td>8530.1</td></tr><tr><td>Jamesbond</td><td>29.0</td><td>302.8</td><td>125.3</td><td>112.3</td><td>471.0</td><td>236.0</td><td>365.4</td><td>87.5</td><td>459.4</td></tr><tr><td>Kangaroo</td><td>52.0</td><td>3035.0</td><td>323.1</td><td>605.4</td><td>872.5</td><td>940.6</td><td>3276.4</td><td>62.5</td><td>962.0</td></tr><tr><td>Krull</td><td>1598.0</td><td>2665.5</td><td>4539.9</td><td>3277.9</td><td>4229.6</td><td>4018.1</td><td>3688.9</td><td>4890.8</td><td>6047.0</td></tr><tr><td>Kung Fu Master</td><td>258.5</td><td>22736.3</td><td>17257.2</td><td>5722.2</td><td>14307.8</td><td>9111.0</td><td>13192.7</td><td>18813.0</td><td>31112.5</td></tr><tr><td>Ms Pacman</td><td>307.3</td><td>6951.6</td><td>1480.0</td><td>941.9</td><td>1465.5</td><td>960.5</td><td>1313.2</td><td>1265.6</td><td>1387.0</td></tr><tr><td>Pong</td><td>-20.7</td><td>14.6</td><td>12.8</td><td>1.3</td><td>-16.5</td><td>-8.5</td><td>-5.9</td><td>-6.7</td><td>20.6</td></tr><tr><td>Private Eye</td><td>24.9</td><td>69571.3</td><td>58.3</td><td>100.0</td><td>218.4</td><td>-13.6</td><td>124.0</td><td>56.3</td><td>100.0</td></tr><tr><td>Qbert</td><td>163.9</td><td>13455.0</td><td>1288.8</td><td>509.3</td><td>1042.4</td><td>854.4</td><td>669.1</td><td>3952.0</td><td>15458.1</td></tr><tr><td>Road Runner</td><td>11.5</td><td>7845.0</td><td>5640.6</td><td>2696.7</td><td>5661.0</td><td>8895.1</td><td>14220.5</td><td>2500.0</td><td>18512.5</td></tr><tr><td>Seaquest</td><td>68.4</td><td>42054.7</td><td>683.3</td><td>286.9</td><td>384.5</td><td>301.2</td><td>583.1</td><td>208.0</td><td>1020.5</td></tr><tr><td>Up N Down</td><td>533.4</td><td>11693.2</td><td>3350.3</td><td>2847.6</td><td>2955.2</td><td>3180.8</td><td>28138.5</td><td>2896.9</td><td>16095.7</td></tr><tr><td>Normed Mean</td><td>0.000</td><td>1.000</td><td>0.443</td><td>0.264</td><td>0.381</td><td>0.357</td><td>0.704</td><td>0.562</td><td>1.904</td></tr><tr><td>Normed Median</td><td>0.000</td><td>1.000</td><td>0.144</td><td>0.204</td><td>0.175</td><td>0.268</td><td>0.415</td><td>0.227</td><td>1.160</td></tr></table>
|
| 158 |
+
|
| 159 |
+
Table 2: Scores achieved by EfficientZero (mean & standard deviation for 10 seeds) and some baselines on some low-dimensional environments on the DMControl $1 0 0 \mathrm { k }$ benchmark. EfficientZero achieves state-of-art performance and comparable results to the state-based SAC.
|
| 160 |
+
|
| 161 |
+
<table><tr><td>Task</td><td>CURL</td><td>Dreamer</td><td>MuZero</td><td>SAC-AE</td><td>Pixel SAC</td><td>State SAC</td><td>EfficientZero</td></tr><tr><td>Cartpole,Swingup</td><td>582±146</td><td>326±27</td><td>218.5± 122</td><td>311±11</td><td>419±40</td><td>835±22</td><td>813±19</td></tr><tr><td>Reacher,Easy</td><td>538±233</td><td>314±155</td><td>493±145</td><td>274±14</td><td>145±30</td><td>746±25</td><td>952±34</td></tr><tr><td>Ball in cup, Catch</td><td>769±43</td><td>246±174</td><td>542±270</td><td>391±82</td><td>312±63</td><td>746±91</td><td>942±17</td></tr></table>
|
| 162 |
+
|
| 163 |
+
# 5.3 Ablations
|
| 164 |
+
|
| 165 |
+
In Section 4, we discuss three issues that prevent MuZero from achieving high performance when data is limited: (1) the lack of environment model supervision, (2) the state aliasing issue, and (3) the off-policy target value issue. We propose three corresponding approaches to fix those issues and demonstrate the usefulness of the combination of those approaches on a wide range of 26 Atari games. In this section, we will analyze each component individually.
|
| 166 |
+
|
| 167 |
+
Each Component Firstly, we do an ablation study by removing the three components from our full model one at a time. As shown in Table 3, we find that removing any one of the three components will lead to a performance drop compared to our full model. Furthermore, the richer learning signals are the aspect Muzero lacks most in the low-data regime as the largest performance drop is from the version without consistency supervision. As for the performance in the high-data regime, We find that the temporal consistency can significantly accelerate the training. The value prefix seems to be helpful during the early learning process, but not as much in the later stage. The off-policy correction is not necessary as it is specifically designed under limited data.
|
| 168 |
+
|
| 169 |
+
Table 3: Ablations of the self-supervised consistency, end-to-end value prefix and model-based off-policy correction. We remove one component at a time and evaluate the corresponding version on the 26 Atari games. Each component matters and the consistency one is the most significant. The detailed results are attached in the Appendix .
|
| 170 |
+
|
| 171 |
+

|
| 172 |
+
Figure 4: Evaluations of image reconstructions based on latent states extracted from the model with or without self-supervised consistency. The predicted next states with consistency can basically be reconstructed into observations while the ones without consistency cannot.
|
| 173 |
+
|
| 174 |
+
Temporal Consistency As the version without self-supervised consistency cannot work well in most of the games, we attempt to dig into the reason for such phenomenon. We design a decoder $\mathcal { D }$ to reconstruct the original observations, taking the latent states as inputs. Specifically, the architecture of $\mathcal { D }$ and the $\mathcal { H }$ are symmetrical, which means that all the convolutional layers are replaced by deconvolutional layers in $\mathcal { D }$ and the order of the layers are reversed in $\mathcal { D }$ . Therefore, $\mathcal { H }$ is an encoder to obtain state $s _ { t }$ from observation $o _ { t }$ and $\mathcal { D }$ tries to decode the $o _ { t }$ from $s _ { t }$ . In this ablation, we freeze all parameters of the trained EfficientZero network with or without consistency respectively and the reconstructed results are shown in different columns of Figure 4. We regard the decoder as a tool to visualize the current states and unrolled states, shown in different rows of Figure 4. Here we note that $\mathcal { M } _ { \mathrm { c o n } }$ is the trained EfficientZero model with consistency and $\mathcal { M } _ { \mathrm { n o n } }$ is the one without consistency.
|
| 175 |
+
|
| 176 |
+
As shown in Figure 4, in terms of the current state $s _ { t }$ , the observation is reconstructed well enough in the two versions. However, it is remarkable that the the decoder given $\mathcal { M } _ { \mathrm { n o n } }$ can not reconstruct images from the unrolled predicted states $\hat { s } _ { t + k }$ while the one given $\mathcal { M } _ { \mathrm { c o n } }$ can reconstruct the basic observations.
|
| 177 |
+
|
| 178 |
+
To sum up, there are some distributional shifts between the latent states from the representation network and the states from the dynamics function without consistency. The consistency component can reduce the shift and provide more supervision for training the dynamics network.
|
| 179 |
+
|
| 180 |
+
Value Prefix We further validate our assumptions in the end-to-end learning of value prefix, i.e. the state aliasing problem will cause difficulty in predicting the reward, and end-to-end learning of value prefix can alleviate this phenomenon.
|
| 181 |
+
|
| 182 |
+
To fairly compare directly predicting the reward versus end-to-end learning of the value prefix, we need to control for the dataset that both methods are trained on. Since during the RL training, the dataset distribution is determined by the method, we opt to load a half-trained Pong model and rollout total 100k steps as the common static dataset. We split this dataset into a training set and a validation set. Then we run both the direct reward prediction and the value prefix method on the training split.
|
| 183 |
+
|
| 184 |
+
As shown in Figure 5, we find that the direct reward prediction method has lower losses on the training set. However, the value prefix’s validation error is much smaller when unrolled for 5 steps. This shows that the value prefix method avoids overfitting the hard reward prediction problem, and thus it can reduce the state aliasing problem, reaching a better generalization performance.
|
| 185 |
+
|
| 186 |
+

|
| 187 |
+
Figure 5: Training and validation losses of direct reward prediction method and the value prefix method.
|
| 188 |
+
|
| 189 |
+
# Off-Policy Correction To prove
|
| 190 |
+
|
| 191 |
+
the effectiveness of the off-policy correction component, we compare the error between the target values and the ground truth values with or without off-policy correction. Specifically, the ground truth values are estimated by Monte Carlo sampling.
|
| 192 |
+
|
| 193 |
+
We train a model for the game UpNDown with total 100k training steps, and collect the trajectories at different training stages respectively (20k, 40k, ..., 100k steps). Then we calculate the ground truth values with the final model. We choose the trajectories at the same stage (20k) and use the final model to evaluate the target values with or without off-policy correction, following the Equation 4. We evaluate the L1 error of the target values and the ground truth, as shown in Table 4. The error of unrolled next 5 states means the average error of the unrolled 1-5 states with dynamics network from current states. The error is smaller in both current states and the unrolled states with off-policy correction. Thus, the correction component does reduce the bias caused by the off-policy issue.
|
| 194 |
+
|
| 195 |
+
Table 4: Ablations of the off-policy correction: L1 error of the target values versus the ground truth values. Take UpNDown as an example.
|
| 196 |
+
|
| 197 |
+
<table><tr><td>States</td><td>Current state </td><td>Unrolled next 5 states (Avg.)All states (Avg.)</td><td></td></tr><tr><td>Value error without correction</td><td>0.765</td><td>0.636</td><td>0.657</td></tr><tr><td>Value error with correction</td><td>0.533</td><td>0.576</td><td>0.569</td></tr></table>
|
| 198 |
+
|
| 199 |
+
Furthermore, we also ablate the value error of the trajectories at distinct stages in Table 5. We can find that the value error becomes smaller as the trajectories are fresher. This indicates that the off-policy issue is severe due to the staleness of the data. More significantly, the off-policy correction can provide more accurate target value estimation for the trajectories at distinct time-steps as all the errors with correction shown in the table are smaller than those without correction at the same stage.
|
| 200 |
+
|
| 201 |
+
Table 5: Ablations of the off-policy correction: Average L1 error of the values of the trajectories at distinct stages. Take UpNDown as an example.
|
| 202 |
+
|
| 203 |
+
<table><tr><td>Stages of trajectories</td><td>20k</td><td>40k</td><td>60k</td><td>80k</td><td>100k</td></tr><tr><td>Value error without correction</td><td>0.657</td><td>0.697</td><td>0.628</td><td>0.574</td><td>0.441</td></tr><tr><td>Value error with correction</td><td>0.569</td><td>0.552</td><td>0.537</td><td>0.488</td><td>0.397</td></tr></table>
|
| 204 |
+
|
| 205 |
+
# 6 Discussion
|
| 206 |
+
|
| 207 |
+
In this paper, we propose a sample-efficient model-based method EfficientZero. It achieves superhuman performance on the Atari games with as little as 2 hours of the gameplay experience and state-of-the-art performance on some DMControl tasks. Apart from the full results, we do detailed ablation studies to examine the effectiveness of the proposed components. This work is one step towards running RL in the physical world with complex sensory inputs. In the future, we plan to extend it to more directions, such as a better design for the continuous action space. And we also plan to study the acceleration of MCTS and how to combine this framework with life-long learning.
|
| 208 |
+
|
| 209 |
+
# Acknowledgments and Disclosure of Funding
|
| 210 |
+
|
| 211 |
+
This work is supported by the Ministry of Science and Technology of the People’s Republic of China, the 2030 Innovation Megaprojects “Program on New Generation Artificial Intelligence” (Grant No. 2021AAA0150000).
|
| 212 |
+
|
| 213 |
+
# References
|
| 214 |
+
|
| 215 |
+
[1] Bruce Abramson. The expected-outcome model of two-player games. Morgan Kaufmann, 2014.
|
| 216 |
+
[2] Kavosh Asadi, Dipendra Misra, Seungchan Kim, and Michel L Littman. Combating the compounding-error problem with a multi-step model. arXiv preprint arXiv:1905.13320, 2019.
|
| 217 |
+
[3] Peter Auer, Nicolo Cesa-Bianchi, and Paul Fischer. Finite-time analysis of the multiarmed bandit problem. Machine learning, 47(2):235–256, 2002.
|
| 218 |
+
[4] 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:253–279, 2013.
|
| 219 |
+
[5] Christopher Berner, Greg Brockman, Brooke Chan, Vicki Cheung, Przemysław D˛ebiak, Christy Dennison, David Farhi, Quirin Fischer, Shariq Hashme, Chris Hesse, et al. Dota 2 with large scale deep reinforcement learning. arXiv preprint arXiv:1912.06680, 2019.
|
| 220 |
+
[6] Ting Chen, Simon Kornblith, Mohammad Norouzi, and Geoffrey Hinton. A simple framework for contrastive learning of visual representations. In International conference on machine learning, pages 1597–1607. PMLR, 2020.
|
| 221 |
+
[7] Xinlei Chen and Kaiming He. Exploring simple siamese representation learning. arXiv preprint arXiv:2011.10566, 2020.
|
| 222 |
+
[8] Kurtland Chua, Roberto Calandra, Rowan McAllister, and Sergey Levine. Deep reinforcement learning in a handful of trials using probabilistic dynamics models. arXiv preprint arXiv:1805.12114, 2018.
|
| 223 |
+
[9] Joery A de Vries, Ken S Voskuil, Thomas M Moerland, and Aske Plaat. Visualizing muzero models. arXiv preprint arXiv:2102.12924, 2021.
|
| 224 |
+
[10] Marc Deisenroth and Carl E Rasmussen. Pilco: A model-based and data-efficient approach to policy search. In Proceedings of the 28th International Conference on machine learning (ICML-11), pages 465–472. Citeseer, 2011.
|
| 225 |
+
[11] Jean-Bastien Grill, Florian Strub, Florent Altché, Corentin Tallec, Pierre H Richemond, Elena Buchatskaya, Carl Doersch, Bernardo Avila Pires, Zhaohan Daniel Guo, Mohammad Gheshlaghi Azar, et al. Bootstrap your own latent: A new approach to self-supervised learning. arXiv preprint arXiv:2006.07733, 2020.
|
| 226 |
+
[12] Danijar Hafner, Timothy Lillicrap, Jimmy Ba, and Mohammad Norouzi. Dream to control: Learning behaviors by latent imagination. arXiv preprint arXiv:1912.01603, 2019.
|
| 227 |
+
[13] Danijar Hafner, Timothy Lillicrap, Ian Fischer, Ruben Villegas, David Ha, Honglak Lee, and James Davidson. Learning latent dynamics for planning from pixels. In International Conference on Machine Learning, pages 2555–2565. PMLR, 2019.
|
| 228 |
+
[14] Danijar Hafner, Timothy Lillicrap, Mohammad Norouzi, and Jimmy Ba. Mastering atari with discrete world models. arXiv preprint arXiv:2010.02193, 2020.
|
| 229 |
+
[15] Kaiming He, Haoqi Fan, Yuxin Wu, Saining Xie, and Ross 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.
|
| 230 |
+
|
| 231 |
+
[16] Matteo Hessel, Joseph Modayil, Hado Van Hasselt, Tom Schaul, Georg Ostrovski, Will Dabney, Dan Horgan, Bilal Piot, Mohammad Azar, and David Silver. Rainbow: Combining improvements in deep reinforcement learning. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 32, 2018.
|
| 232 |
+
|
| 233 |
+
[17] Thomas Hubert, Julian Schrittwieser, Ioannis Antonoglou, Mohammadamin Barekatain, Simon Schmitt, and David Silver. Learning and planning in complex action spaces. arXiv preprint arXiv:2104.06303, 2021.
|
| 234 |
+
|
| 235 |
+
[18] Lukasz Kaiser, Mohammad Babaeizadeh, Piotr Milos, Blazej Osinski, Roy H Campbell, Konrad Czechowski, Dumitru Erhan, Chelsea Finn, Piotr Kozakowski, Sergey Levine, et al. Modelbased reinforcement learning for atari. arXiv preprint arXiv:1903.00374, 2019.
|
| 236 |
+
|
| 237 |
+
[19] Kacper Kielak. Do recent advancements in model-based deep reinforcement learning really improve data efficiency? arXiv preprint arXiv:2003.10181, 2020.
|
| 238 |
+
|
| 239 |
+
[20] Levente Kocsis and Csaba Szepesvári. Bandit based monte-carlo planning. In European conference on machine learning, pages 282–293. Springer, 2006.
|
| 240 |
+
|
| 241 |
+
[21] Ilya Kostrikov, Denis Yarats, and Rob Fergus. Image augmentation is all you need: Regularizing deep reinforcement learning from pixels. arXiv preprint arXiv:2004.13649, 2020.
|
| 242 |
+
|
| 243 |
+
[22] Michael Laskin, Kimin Lee, Adam Stooke, Lerrel Pinto, Pieter Abbeel, and Aravind Srinivas. Reinforcement learning with augmented data. arXiv preprint arXiv:2004.14990, 2020.
|
| 244 |
+
|
| 245 |
+
[23] 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 arXiv:1509.02971, 2015.
|
| 246 |
+
|
| 247 |
+
[24] 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.
|
| 248 |
+
|
| 249 |
+
[25] Volodymyr Mnih, Adria Puigdomenech Badia, Mehdi Mirza, Alex Graves, Timothy Lillicrap, Tim Harley, David Silver, and Koray Kavukcuoglu. Asynchronous methods for deep reinforcement learning. In International conference on machine learning, pages 1928–1937. PMLR, 2016.
|
| 250 |
+
|
| 251 |
+
[26] Christopher D Rosin. Multi-armed bandits with episode context. Annals of Mathematics and Artificial Intelligence, 61(3):203–230, 2011.
|
| 252 |
+
|
| 253 |
+
[27] Julian Schrittwieser, Ioannis Antonoglou, Thomas Hubert, Karen Simonyan, Laurent Sifre, Simon Schmitt, Arthur Guez, Edward Lockhart, Demis Hassabis, Thore Graepel, et al. Mastering atari, go, chess and shogi by planning with a learned model. Nature, 588(7839):604–609, 2020.
|
| 254 |
+
|
| 255 |
+
[28] Julian Schrittwieser, Thomas Hubert, Amol Mandhane, Mohammadamin Barekatain, Ioannis Antonoglou, and David Silver. Online and offline reinforcement learning by planning with a learned model. arXiv preprint arXiv:2104.06294, 2021.
|
| 256 |
+
|
| 257 |
+
[29] John Schulman, Sergey Levine, Pieter Abbeel, Michael Jordan, and Philipp Moritz. Trust region policy optimization. In International conference on machine learning, pages 1889–1897. PMLR, 2015.
|
| 258 |
+
|
| 259 |
+
[30] John Schulman, Philipp Moritz, Sergey Levine, Michael Jordan, and Pieter Abbeel. Highdimensional continuous control using generalized advantage estimation. arXiv preprint arXiv:1506.02438, 2015.
|
| 260 |
+
|
| 261 |
+
[31] John Schulman, Filip Wolski, Prafulla Dhariwal, Alec Radford, and Oleg Klimov. Proximal policy optimization algorithms. arXiv preprint arXiv:1707.06347, 2017.
|
| 262 |
+
|
| 263 |
+
[32] Max Schwarzer, Ankesh Anand, Rishab Goel, R Devon Hjelm, Aaron Courville, and Philip Bachman. Data-efficient reinforcement learning with self-predictive representations.
|
| 264 |
+
|
| 265 |
+
[33] David Silver, Aja Huang, Chris J Maddison, Arthur Guez, Laurent Sifre, George Van Den Driessche, Julian Schrittwieser, Ioannis Antonoglou, Veda Panneershelvam, Marc Lanctot, et al. Mastering the game of go with deep neural networks and tree search. nature, 529(7587):484–489, 2016.
|
| 266 |
+
[34] David Silver, Julian Schrittwieser, Karen Simonyan, Ioannis Antonoglou, Aja Huang, Arthur Guez, Thomas Hubert, Lucas Baker, Matthew Lai, Adrian Bolton, et al. Mastering the game of go without human knowledge. nature, 550(7676):354–359, 2017.
|
| 267 |
+
[35] Aravind Srinivas, Michael Laskin, and Pieter Abbeel. Curl: Contrastive unsupervised representations for reinforcement learning. arXiv preprint arXiv:2004.04136, 2020.
|
| 268 |
+
[36] Richard S Sutton and Andrew G Barto. Reinforcement learning: An introduction. MIT press, 2018.
|
| 269 |
+
[37] Yuval Tassa, Yotam Doron, Alistair Muldal, Tom Erez, Yazhe Li, Diego de Las Casas, David Budden, Abbas Abdolmaleki, Josh Merel, Andrew Lefrancq, et al. Deepmind control suite. arXiv preprint arXiv:1801.00690, 2018.
|
| 270 |
+
[38] Hado Van Hasselt, Arthur Guez, and David Silver. Deep reinforcement learning with double q-learning. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 30, 2016.
|
| 271 |
+
[39] Hado van Hasselt, Matteo Hessel, and John Aslanides. When to use parametric models in reinforcement learning? arXiv preprint arXiv:1906.05243, 2019.
|
| 272 |
+
[40] Ziyu Wang, Tom Schaul, Matteo Hessel, Hado Hasselt, Marc Lanctot, and Nando Freitas. Dueling network architectures for deep reinforcement learning. In International conference on machine learning, pages 1995–2003. PMLR, 2016.
|
| 273 |
+
[41] Christopher John Cornish Hellaby Watkins. Learning from delayed rewards. 1989.
|
| 274 |
+
[42] Denis Yarats, Amy Zhang, Ilya Kostrikov, Brandon Amos, Joelle Pineau, and Rob Fergus. Improving sample efficiency in model-free reinforcement learning from images. arXiv preprint arXiv:1910.01741, 2019.
|
md/train/S1cZsf-RW/S1cZsf-RW.md
ADDED
|
@@ -0,0 +1,310 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# WHAI: WEIBULL HYBRID AUTOENCODING INFERENCE FOR DEEP TOPIC MODELING
|
| 2 |
+
|
| 3 |
+
Hao Zhang, Bo Chen∗ & Dandan Guo
|
| 4 |
+
National Laboraory of Radar Signal Processing,
|
| 5 |
+
Collaborative Innovation Center of Information Sensing and Understanding, Xidian University, Xi’an, China.
|
| 6 |
+
zhanghao_xidian@163.com bchen@mail.xidian.edu.cn gdd_xidian@126.com
|
| 7 |
+
|
| 8 |
+
# Mingyuan Zhou
|
| 9 |
+
|
| 10 |
+
McCombs School of Business, The University of Texas at Austin, Austin, TX 78712, USA. Mingyuan.Zhou@mccombs.utexas.edu
|
| 11 |
+
|
| 12 |
+
# ABSTRACT
|
| 13 |
+
|
| 14 |
+
To train an inference network jointly with a deep generative topic model, making it both scalable to big corpora and fast in out-of-sample prediction, we develop Weibull hybrid autoencoding inference (WHAI) for deep latent Dirichlet allocation, which infers posterior samples via a hybrid of stochastic-gradient MCMC and autoencoding variational Bayes. The generative network of WHAI has a hierarchy of gamma distributions, while the inference network of WHAI is a Weibull upward-downward variational autoencoder, which integrates a deterministicupward deep neural network, and a stochastic-downward deep generative model based on a hierarchy of Weibull distributions. The Weibull distribution can be used to well approximate a gamma distribution with an analytic Kullback-Leibler divergence, and has a simple reparameterization via the uniform noise, which help efficiently compute the gradients of the evidence lower bound with respect to the parameters of the inference network. The effectiveness and efficiency of WHAI are illustrated with experiments on big corpora.
|
| 15 |
+
|
| 16 |
+
# 1 INTRODUCTION
|
| 17 |
+
|
| 18 |
+
There is a surge of research interest in multilayer representation learning for documents. To analyze the term-document count matrix of a text corpus, Srivastava et al. (2013) extend the deep Boltzmann machine (DBM) with the replicated softmax topic model of Salakhutdinov & Hinton (2009) to infer a multilayer representation with binary hidden units, but its inference network is not trained to match the true posterior (Mnih & Gregor, 2014) and the higher-layer neurons learned by DBM are difficult to visualize. The deep Poisson factor models of Gan et al. (2015) are introduced to generalize Poisson factor analysis (Zhou et al., 2012), with a deep structure restricted to model binary topic usage patterns. Deep exponential families (DEF) of Ranganath et al. (2015) construct more general probabilistic deep networks with non-binary hidden units, in which a count matrix can be factorized under the Poisson likelihood, with the gamma distributed hidden units of adjacent layers linked via the gamma scale parameters. The Poisson gamma belief network (PGBN) (Zhou et al., 2015; 2016) also factorizes a count matrix under the Poisson likelihood, but factorizes the shape parameters of the gamma distributed hidden units of each layer into the product of a connection weight matrix and the gamma hidden units of the next layer, resulting in strong nonlinearity and readily interpretable multilayer latent representations.
|
| 19 |
+
|
| 20 |
+
Those multilayer probabilistic models are often characterized by a top-down generative structure, with the distribution of a hidden layer typically acting as a prior for the layer below. Despite being able to infer a multilayer representation of a text corpus with scalable inference (Patterson &
|
| 21 |
+
|
| 22 |
+
Teh, 2013; Ruiz et al., 2016; Cong et al., 2017a), they usually rely on an iterative procedure to infer the latent representation of a new document at the testing stage, regardless of whether variational inference or Markov chain Monte Carlo (MCMC) is used. The potential need of a large number of iterations per testing document makes them unattractive when real-time processing is desired. For example, one may need to rapidly extract the topic-proportion vector of a document and use it for downstream analysis, such as identifying key topics and retrieving related documents. A potential solution is to construct a variational autoencoder (VAE) that learns the parameters of an inference network (recognition model or encoder) jointly with those of the generative model (decoder) (Kingma & Welling, 2014; Rezende et al., 2014). However, most existing VAEs rely on Gaussian latent variables, with the neural networks (NNs) acting as nonlinear transforms between adjacent layers (Sonderby et al., 2016; Dai et al., 2016; Ishaan et al., 2017). A primary reason is that there is a simple reparameterization trick for Gaussian latent variables that allows efficiently computing the noisy gradients of the evidence lower bound (ELBO) with respect to the NN parameters. Unfortunately, Gaussian based distributions often fail to well approximate the posterior distributions of sparse, nonnegative, and skewed document latent representations. For example, Srivastava & Sutton (2017) propose autoencoding variational inference for topic models (AVITM), as shown in Fig. 2b, which utilizes the logistic-normal distribution to approximate the posterior of the latent representation of a document; even though the generative model is latent Dirichlet allocation (LDA) (Blei et al., 2003), a basic single-hidden-layer topic model, due to the insufficient ability of the logistic-normal distribution to model sparsity, AVITM has to rely on some heuristic to force the latent representation of a document to be sparse. Another common shortcoming of existing VAEs is that they often only provide a point estimate for the global parameters of the generative model, and hence their inference network is optimized to approximate the posteriors of the local parameters conditioning on the data and the point estimate, rather than a full posterior, of the global parameters. In addition, from the viewpoint of probabilistic modeling, the inference network of a VAE is often merely a shallow probabilistic model, whose parameters, though, are deterministically nonlinearly transformed from the observations via a non-probabilistic deep neural network.
|
| 23 |
+
|
| 24 |
+
To address these shortcomings and move beyond Gaussian latent variable based deep models and inference procedures, we develop Weibull hybrid autoencoding inference (WHAI), a hybrid Bayesian inference for deep topic modeling that integrates both stochastic-gradient MCMC (Welling & Teh, 2011; Ma et al., 2015; Cong et al., 2017a) and a multilayer Weibull distribution based VAE. WHAI is related to a VAE in having both a decoder and encoder, but differs from a usual VAE in the following ways: 1) deep latent Dirichlet allocation (DLDA), a probabilistic deep topic model equipped with a gamma belief network, acts as the generative model; 2) inspired by the upward-downward Gibbs sampler of DLDA, as sketched in Fig. 2c, the inference network of WHAI uses a upwarddownward structure, as shown in Fig. 2a, to combine a non-probabilistic bottom-up deep NN and a probabilistic top-down deep generative model, with the \`th hidden layer of the generative model linked to both the $( \ell + 1 )$ th hidden layer of itself and the \`th hidden layer of the deep NN; 3) a hybrid of stochastic-gradient MCMC and autoencoding variational inference is employed to infer both the posterior distribution of the global parameters, represented as collected posterior MCMC samples, and a VAE that approximates the posterior distribution of the local parameters given the data and a posterior sample (rather than a point estimate) of the global parameters; 4) we use the Weibull distributions in the inference network to approximate gamma distributed conditional posteriors, exploiting the fact that the Weibull and gamma distributions have similar probability density functions (PDFs), the Kullback-Leibler (KL) divergence from the Weibull to gamma distributions is analytic, and a Weibull random variable can be efficiently reparameterized with a uniform noise.
|
| 25 |
+
|
| 26 |
+
Note that we have also tried gamma hybrid autoencoding inference (GHAI), which directly uses the gamma distribution in the probabilistic top-down part of the inference network, while using rejection sampling variational inference (RSVI) of Naesseth et al. to approximately compute the gradient of the ELBO. While RSVI is a very general technique that can be applied to a wide variety of non-reparameterizable distributions, we find that for replacing the reparameterizable Weibull with non-reparameterizable gamma distributions in the inference network, the potential gains are overshadowed by the disadvantages of having to rely on an approximate reparameterization scheme guided by rejection sampling. In the experiments for deep topic modeling, we show that WHAI clearly outperforms GHAI, and both WHAI and GHAI outperform their counterparts that remove the top-down links of the inference network, referred to as WHAI-independent and GHAI-independent, respectively; WHAI is comparable to Gibbs sampling in terms performance, but is scalable to big training data via mini-batch stochastic-gradient based inference and is considerably fast in out-ofsample prediction via the use of an inference network.
|
| 27 |
+
|
| 28 |
+
# 2 WHAI FOR MULTILAYER DOCUMENT REPRESENTATION
|
| 29 |
+
|
| 30 |
+
Below we first describe the decoder and encoder of WHAI, and then provide a hybrid stochasticgradient MCMC and autoencoding variational inference that is fast in both training and testing.
|
| 31 |
+
|
| 32 |
+
2.1 DOCUMENT DECODER: DEEP LATENT DIRICHLET ALLOCATION
|
| 33 |
+
|
| 34 |
+
In order to capture the hierarchical document latent representation, WHAI uses the Poisson gamma belief network (PGBN) of Zhou et al. (2016), a deep probabilistic topic model, as the generative network (encoder). Choosing a deep generative model as its decoder distinguishes WHAI from both AVITM, which uses a “shallow” LDA as its decoder, and a conventional VAE, which often uses as its decoder a “shallow” (transformed) Gaussian distribution, whose parameters are deterministically nonlinearly transformed from the observation via “black-box” deep neural networks. With all the gamma latent variables marginalized out, as shown in Cong et al. (2017a), the PGBN can also be represented as deep LDA (DLDA). For simplicity, below we use DLDA to refer to both the PGBN and DLDA representations of the same underlying deep generative model, as briefly described below. Note the single-hidden-layer version of DLDA reduces to Poisson factor analysis of Zhou et al. (2012), which is closely related to LDA. Let us denote $\Phi ^ { ( 1 ) } \in \mathbb { R } _ { + } ^ { K _ { 0 } \times K _ { 1 } }$ and $\pmb { \theta } _ { n } ^ { ( 1 ) } \in \mathbb { R } _ { + } ^ { K _ { 1 } }$ as the factor loading and latent representation of the first hidden layer of DLDA, respectively, where $\mathbb { R } _ { + } = \{ x , x \geq \bar { 0 } \}$ and $K _ { 1 }$ is the number of topics (factors) of the first layer. We further restrict that the sum of each column of $\Phi ^ { ( 1 ) }$ is equal to one. To model high-dimensional multivariate sparse count vectors ${ \pmb x } _ { n } \in \mathbb { Z } ^ { K _ { 0 } }$ , where $\mathbb { Z } = \{ 0 , 1 , \ldots \}$ , under the Poisson likelihood, the DLDA generative model with $L$ hidden layers, from top to bottom, can be expressed as
|
| 35 |
+
|
| 36 |
+
$$
|
| 37 |
+
\begin{array} { r l } & { \pmb { \theta } _ { n } ^ { ( L ) } \sim \mathrm { G a m } \left( \boldsymbol { r } , c _ { n } ^ { ( L + 1 ) } \right) , \ldots , \pmb { \theta } _ { n } ^ { ( l ) } \sim \mathrm { G a m } \left( \Phi ^ { ( l + 1 ) } \pmb { \theta } _ { n } ^ { ( l + 1 ) } , c _ { n } ^ { ( l + 1 ) } \right) , \ldots , } \\ & { \pmb { \theta } _ { n } ^ { ( 1 ) } \sim \mathrm { G a m } \left( \Phi ^ { ( 2 ) } \pmb { \theta } _ { n } ^ { ( 2 ) } , c _ { n } ^ { ( 2 ) } \right) , \pmb { x } _ { n } \sim \mathrm { P o i s } \left( \Phi ^ { ( 1 ) } \pmb { \theta } _ { n } ^ { ( 1 ) } \right) . } \end{array}
|
| 38 |
+
$$
|
| 39 |
+
|
| 40 |
+
where the hidden units $\pmb { \theta } _ { n } ^ { ( l ) } \in \mathbb { R } _ { + } ^ { K _ { l } }$ of layer $l$ are factorized into the product of the factor loading $\Phi ^ { ( l ) } \in \mathbb { R } _ { + } ^ { K _ { l - 1 } \times K _ { l } }$ and hidden units of the next layer. It infers a multilayer data representation, and can visualize its topic $\phi _ { k } ^ { ( l ) }$ at hidden layer $l$ as $\left[ \prod _ { t = 1 } ^ { l - 1 } \Phi ^ { ( t ) } \right] \phi _ { k } ^ { ( l ) }$ , which tend to be very specific in the bottom layer and become increasingly more general when moving upward. The unsupervisedly extracted multilayer latent representations θ(l)n are well suited for additional downstream analysis, such as document classification and retrieval.
|
| 41 |
+
|
| 42 |
+
The upward-downward Gibbs sampling for DLDA, as described in detail in Zhou et al. (2016), is sketched in Fig. 2c, where $\mathbf { Z } ^ { l }$ represent augmented latent counts that are sampled upward given the observations and model parameters. While having closed-form update equations, the Gibbs sampler requires processing all documents in each iteration and hence has limited scalability. Consequently, a topic-layer-adaptive stochastic gradient Riemannian (TLASGR) MCMC for DLDA, referred to as DLDA-TLASGR, is proposed to process big corpora (Cong et al., 2017a). Different from AVITM (Srivastava & Sutton, 2017) that models a probabilistic simplex with the expanded-natural representation (Patterson & Teh, 2013), DLDA-TLASGR uses a more elegant simplex constraint and increases the sampling efficiency via the use of the Fisher information matrix (FIM) (Cong et al., $2 0 1 7 \mathrm { a } ; \mathrm { b } )$ , with adaptive step-sizes for the topics of different layers. Specifically, suppose $\phi _ { k } ^ { ( l ) }$ is the $k$ th topic in layer $\ell$ with prior $\phi _ { k } ^ { ( l ) } \sim \mathrm { D i r i c h l e t } ( \eta _ { k } ^ { ( l ) } )$ , sampling it can be efficiently realized as
|
| 43 |
+
|
| 44 |
+
$$
|
| 45 |
+
( \phi _ { k } ) _ { t + 1 } = \left[ ( \phi _ { k } ) _ { t } + \frac { \varepsilon _ { t } } { M _ { k } } \left[ ( \rho \tilde { z } _ { : k } , + \eta _ { k } ^ { ( l ) } ) - ( \rho \tilde { z } _ { : k } , + \eta _ { k } ^ { ( l ) } V ) ( \phi _ { k } ) _ { t } \right] + \mathcal { N } \left( \mathbf { 0 } , \frac { 2 \varepsilon _ { t } } { M _ { k } } d i a g ( \phi _ { k } ) _ { t } \right) \right] _ { \angle } ,
|
| 46 |
+
$$
|
| 47 |
+
|
| 48 |
+
where $M _ { k }$ is calculated using the estimated FIM, both $\tilde { z } _ { : k }$ · and $\tilde { z } _ { \cdot k }$ · come from the augmented latent counts $\mathbf { Z }$ , and $[ \cdot ] _ { \angle }$ denotes a simplex constraint; more details about TLASGR-MCMC for DLDA can be found in Cong et al. (2017a) and are omitted here for brevity.
|
| 49 |
+
|
| 50 |
+

|
| 51 |
+
Figure 1: The $\mathrm { K L }$ divergence from the inferred Weibull distribution to the target gamma one as (a) Gamma(0.05, 1), (b) Gamma(0.5, 1), and (c) $\operatorname { G a m m a } ( 5 , 1 )$ . Subplot (d) shows the KL divergence as a function of the gamma shape parameter, where the gamma scale parameter is fixed at 1.
|
| 52 |
+
|
| 53 |
+
Despite the attractive properties, neither the Gibbs sampler nor TLASGR-MCMC of DLDA can avoid taking a potentially large number of MCMC iterations to infer the latent representation of a testing document, which hinders real-time processing of the incoming documents and motivates us to construct an inference network with fast out-of-sample prediction, as described below.
|
| 54 |
+
|
| 55 |
+
# 2.2 DOCUMENT ENCODER: WEIBULL UPWARD-DOWNWARD VARIATIONAL ENCODER
|
| 56 |
+
|
| 57 |
+
A VAE uses an inference network to map the observations directly to their latent representations. However, their success so far is mostly restricted to Gaussian distributed latent variables, and does not generalize well to model sparse, nonnegative, and skewed latent document representations. To move beyond latent Gaussian models, below we propose Weibull upward-downward variational encoder (WUDVE) to efficiently produce a document’s multilayer latent representation under DLDA.
|
| 58 |
+
|
| 59 |
+
Assuming the global parameters $\phi _ { k } ^ { ( l ) }$ of DLDA shown in (1) are given and the task is to infer the local parameters $\pmb { \theta } _ { n } ^ { ( l + 1 ) }$ , the usual strategy of mean-field variational Bayes (Jordan et al., 1999) is to maximize the ELBO that can be expressed as
|
| 60 |
+
|
| 61 |
+
$$
|
| 62 |
+
L = \sum _ { n = 1 } ^ { N } \mathbb { E } \left[ \ln p \left( x _ { n } \mid \Phi ^ { ( 1 ) } , \pmb { \theta } _ { n } ^ { ( 1 ) } \right) \right] - \sum _ { n = 1 } ^ { N } \sum _ { l = 1 } ^ { L } \mathbb { E } \left[ \ln \frac { q \left( \pmb { \theta } _ { n } ^ { ( l ) } \right) } { p \left( \pmb { \theta } _ { n } ^ { ( l ) } \mid \Phi ^ { ( l + 1 ) } , \pmb { \theta } _ { n } ^ { ( l + 1 ) } \right) } \right] ,
|
| 63 |
+
$$
|
| 64 |
+
|
| 65 |
+
where the expectations are taken with respect to (w.r.t.) a fully factorized distribution as
|
| 66 |
+
|
| 67 |
+
$$
|
| 68 |
+
q \left( \{ \pmb { \theta } _ { n } ^ { ( l ) } \} _ { n = 1 , l = 1 } ^ { N , L } \right) = \prod _ { n = 1 } ^ { N } \prod _ { l = 1 } ^ { L } q \left( \pmb { \theta } _ { n } ^ { ( l ) } \right) .
|
| 69 |
+
$$
|
| 70 |
+
|
| 71 |
+
Instead of using a conventional latent Gaussian based VAE, in order to model sparse and nonnegative latent document representation, it might be more appropriate to use a gamma distribution based inference network defined as $q ( \pmb { \theta } _ { n } | \bar { \bf x } _ { n } ) = \mathrm { G a m m a } \bar { ( } f _ { \bf W } ( \pmb { x } _ { n } ) , g _ { \bf W } ( \pmb { x } _ { n } ) \bar { ) }$ , where $f$ and $g$ are two related deep neural networks parameterized by W. However, it is hard to efficiently compute the gradient of the ELBO with respect to $\mathbf { W }$ , due to the difficulty to reparameterize a gamma distributed random variable (Kingma & Welling, 2014; Ruiz et al., 2016; Knowles, 2015), motivating us to identify a surrogate distribution that can not only well approximate the gamma distribution, but also be easily reparameterized. Below we show the Weibull distribution is an ideal choice.
|
| 72 |
+
|
| 73 |
+
# 2.2.1 WEIBULL AND GAMMA DISTRIBUTIONS
|
| 74 |
+
|
| 75 |
+
A main reason that we choose the Weibull distribution to construct the inference network is that the Weibull and gamma distributions have similar PDFs:
|
| 76 |
+
|
| 77 |
+
Weibull PD $\mathsf { F } \colon P ( x \mid k , \lambda ) = \frac { k } { \lambda ^ { k } } x ^ { k - 1 } e ^ { ( x / \lambda ) ^ { k } } , \mathrm { G a m m a } \mathrm { P D F } \colon P ( x \mid \alpha , \beta ) = \frac { \beta ^ { \alpha } } { \Gamma ( \alpha ) } x ^ { \alpha - 1 } e ^ { - \beta x } ,$ where $x \in \mathbb { R } _ { + }$ . Another reason is due to a simple reparameterization for $x \sim { \mathrm { W e i b u l l } } ( k , \lambda )$ as
|
| 78 |
+
|
| 79 |
+
$$
|
| 80 |
+
x = \lambda ( - \ln ( 1 - \epsilon ) ) ^ { 1 / k } , \epsilon \sim \mathrm { U n i f o r m } ( 0 , 1 ) .
|
| 81 |
+
$$
|
| 82 |
+
|
| 83 |
+
Moreover, its KL-divergence from the gamma distribution has an analytic expression as
|
| 84 |
+
|
| 85 |
+
$$
|
| 86 |
+
\small \mathsf { \displaystyle { K L } } ( \mathbf { W e i b u l l } ( k , \lambda ) | | \mathbf { G a m m a } ( \alpha , \beta ) ) = \alpha \ln \lambda - \frac { \gamma \alpha } { k } - \ln k - \beta \lambda \Gamma \Big ( 1 + \frac { 1 } { k } \Big ) + \gamma + 1 + \alpha \ln \beta - \ln \Gamma ( \alpha ) .
|
| 87 |
+
$$
|
| 88 |
+
|
| 89 |
+
Minimizing this KL divergence, one can identify the two parameters of a Weibull distribution to approximate a given gamma one. As shown in Fig. 1, the inferred Weibull distribution in general quite accurately approximates the target gamma one, as long as the gamma shape parameter is neither too close to zero nor too large.
|
| 90 |
+
|
| 91 |
+
# 2.2.2 UPWARD-DOWNWARD INFORMATION PROPAGATION
|
| 92 |
+
|
| 93 |
+
For the DLDA upward-downward Gibbs sampler sketched in Fig. 2c, the corresponding Gibbs sampling update equation for $\pmb { \theta } _ { n } ^ { ( l ) }$ can be expressed as
|
| 94 |
+
|
| 95 |
+
$$
|
| 96 |
+
( \pmb { \theta } _ { n } ^ { ( l ) } | - ) \sim \mathrm { G a m m a } \left( \pmb { m } _ { n } ^ { ( l ) ( l + 1 ) } + \pmb { \Phi } ^ { ( l + 1 ) } \pmb { \theta } _ { n } ^ { ( l + 1 ) } , f ( p _ { n } ^ { ( l ) } , c _ { n } ^ { ( l + 1 ) } ) \right) ,
|
| 97 |
+
$$
|
| 98 |
+
|
| 99 |
+
where $m _ { n } ^ { ( l ) ( l + 1 ) }$ and $p _ { n } ^ { ( l ) }$ are latent random variables constituted by information upward propagated to layer $l$ , as described in detail in Zhou et al. (2016) and hence omitted here for brevity. It is clear from (5) that the conditional posterior of $\pmb { \theta } _ { n } ^ { ( l ) }$ is related to both the information at the higher (prior) layer, and that upward propagated to the current layer via a series of data augmentation and marginalization steps described in Zhou et al. (2016). Inspired by this instructive upwarddownward information propagation in Gibbs sampling, as shown in Fig. 2a, we construct WUDVE, the inference network of our model, as $\begin{array} { r } { q ( \pmb { \theta } _ { n } ^ { ( L ) } | \hat { \pmb { h } _ { n } ^ { ( L ) } } ) \bar { \prod } _ { l = 1 } ^ { L - 1 } q ( \pmb { \theta } _ { n } ^ { ( l ) } | \bar { \Phi ^ { ( l + 1 ) } } , \pmb { h } _ { n } ^ { ( l ) } , \pmb { \theta } _ { n } ^ { ( l + 1 ) } ) } \end{array}$ , where
|
| 100 |
+
|
| 101 |
+
$$
|
| 102 |
+
{ q ( \theta _ { n } ^ { ( l ) } | \Phi ^ { ( l + 1 ) } , h _ { n } ^ { ( l ) } , \theta _ { n } ^ { ( l + 1 ) } ) } = \mathrm { { W e i b u l l } } ( k _ { n } ^ { ( l ) } + \Phi ^ { ( l + 1 ) } \theta _ { n } ^ { ( l + 1 ) } , \lambda _ { n } ^ { ( l ) } ) .
|
| 103 |
+
$$
|
| 104 |
+
|
| 105 |
+
The Weibull distribution is used to approximate the gamma distributed conditional posterior, and its parameters $\pmb { k } _ { n } ^ { ( l ) } \in \mathbb { R } ^ { K _ { l } }$ and $\pmb { \lambda } _ { n } ^ { ( l ) } \in \mathbb { R } ^ { K _ { l } }$ are both deterministically transformed from the observation ${ \mathbf { \mathcal { x } } } _ { n }$ using the neural networks, as illustrated in Fig. 2a and specified as
|
| 106 |
+
|
| 107 |
+
$$
|
| 108 |
+
\begin{array} { r l } & { \mathbf { \boldsymbol { k } } _ { n } ^ { ( l ) } = \ln [ 1 + \exp ( \mathbf { \boldsymbol { W } } _ { 1 } ^ { ( l ) } \boldsymbol { h } _ { n } ^ { ( l ) } + \boldsymbol { b } _ { 1 } ^ { ( l ) } ) ] , } \\ & { \lambda _ { n } ^ { ( l ) } = \ln [ 1 + \exp ( \mathbf { \boldsymbol { W } } _ { 2 } ^ { ( l ) } \boldsymbol { h } _ { n } ^ { ( l ) } + \boldsymbol { b } _ { 2 } ^ { ( l ) } ) ] , } \\ & { \boldsymbol { h } _ { n } ^ { ( l ) } = \ln [ 1 + \exp ( \mathbf { \boldsymbol { W } } _ { 3 } ^ { ( l ) } \boldsymbol { h } _ { n } ^ { ( l - 1 ) } + \boldsymbol { b } _ { 3 } ^ { ( l ) } ) ] , } \end{array}
|
| 109 |
+
$$
|
| 110 |
+
|
| 111 |
+
where $\pmb { h } _ { n } ^ { ( 0 ) } = \log ( 1 + \pmb { x } _ { n } )$ , $\mathbf { W } _ { 1 } ^ { ( l ) } \in \mathbb { R } ^ { K _ { l } \times K _ { l } }$ , $\mathbf { W } _ { 2 } ^ { ( l ) } \in \mathbb { R } ^ { K _ { l } \times K _ { l } }$ , $\mathbf { W } _ { 3 } ^ { ( l ) } \in \mathbb { R } ^ { K _ { l } \times K _ { l - 1 } }$ , $b _ { 1 } ^ { ( l ) } \in \mathbb { R } ^ { K _ { l } }$ , $b _ { 2 } ^ { ( l ) } \in \mathbb { R } ^ { K _ { l } }$ , and $b _ { 3 } ^ { ( l ) } \in \mathbb { R } ^ { K _ { l } }$ . This upward-downward inference network is distinct from that of a usual VAE, where it is common that the inference network has a pure bottom-up structure and only interacts with the generative model via the ELBO (Kingma $\&$ Welling, 2014; Ishaan et al., 2017). Note that WUDVE no longer follows mean-field variational Bayes to make a fully factorized assumption as in (4).
|
| 112 |
+
|
| 113 |
+
Comparing Figs. 2c and 2a show that in each iteration, both Gibbs sampling and WUDVE have not only an upward information propagation (orange arrows), but also a downward one (blue arrows), but their underlying implementations are distinct from each other. Gibbs sampling in Fig. 2c does not have an inference network and needs the local variables $\pmb { \theta } _ { n } ^ { ( l ) }$ to help perform stochastic upward information propagation, whereas WUDVE in Fig. 2a uses its non-probabilistic part to perform deterministic upward information propagation, without relying on the local variables $\pmb { \theta } _ { n } ^ { ( l ) }$ . It is also interesting to notice that the upward-downward structure of WUDVE, motivated by the upwarddownward Gibbs sampler of DLDA, is closely related to that used in the ladder VAE of Sonderby et al. (2016). However, to combine the bottom-up and top-down information, ladder VAE relies on some heuristic restricted to Gaussian latent variables.
|
| 114 |
+
|
| 115 |
+
# 2.3 HYBRID MCMC/VAE INFERENCE
|
| 116 |
+
|
| 117 |
+
In Section 2.1, we describe how to use TLASGR-MCMC of Cong et al. (2017a), a stochasticgradient MCMC algorithm for DLDA, to sample the global parameters $\{ \Phi ^ { ( l ) } \} _ { 1 , L }$ ; whereas in Section 2.2.2, we describe how to use WUDVE, an autoencoding variational inference network, to approximate the conditional posterior of the local parameters $\{ \pmb { \theta } _ { n } ^ { ( l ) } \} _ { 1 , L }$ given $\{ \Phi ^ { ( l ) } \} _ { 1 , L }$ and observation ${ \mathbf { \mathcal { x } } } _ { n }$ . Rather than merely finding a point estimate of the global parameters $\{ \Phi ^ { ( l ) } \} _ { 1 , L }$ we describe in Algorithm 1 how to combine TLASGR-MCMC and the proposed WUDVE into a hybrid MCMC/VAE inference algorithm, which infers posterior samples for both the global parameters $\{ \Phi ^ { ( l ) } \} _ { 1 , L }$ of the generative network, and the corresponding neural network parameters $\boldsymbol \Omega = \{ \mathbf { W } _ { 1 } ^ { ( l ) } , \boldsymbol { b } _ { 1 } ^ { ( l ) } , \mathbf { W } _ { 2 } ^ { ( l ) } , \boldsymbol { b } _ { 2 } ^ { ( l ) } , \mathbf { W } _ { 3 } ^ { ( l ) } , \boldsymbol { b } _ { 3 } ^ { ( l ) } \} _ { 1 , L }$ of the inference network. Being able to efficiently evaluating the gradient of the ELBO is important to the success of a variational inference algorithm (Hoffman et al., 2013; Paisley et al., 2012; Kingma & Welling, 2014; Mnih & Gregor, 2014; Ranganath et al., 2015; Ruiz et al., 2016; Rezende et al., 2014). An important step of Algorithm 1 is calculating the gradient of the ELBO in (3) with respect to the NN parameters $\pmb { \Omega }$ . Thanks to the choice of the Weibull distribution, the second term of the ELBO in (3) is analytic, and due to simple reparameterization of the Weibull distribution, the gradient of the first term of the ELBO with respect to $\pmb { \Omega }$ can be accurately evaluated, achieving satisfactory performance using even a single Monte Carlo sample, as shown in our experimental results. Thanks to the architecture of WUDVE, using the inference network, for a new mini-batch, we can directly find the conditional posteriors of $\{ \pmb { \theta } _ { n } ^ { ( l ) } \} _ { 1 , L }$ given $\{ \Phi ^ { ( l ) } \} _ { 1 , L }$ and the stochastically updated $\pmb { \Omega }$ , with which we can sample the local parameters and then use TLASGR-MCMC to stochastically update the global parameters $\{ \Phi ^ { ( l ) } \} _ { 1 , L }$ .
|
| 118 |
+
|
| 119 |
+

|
| 120 |
+
Figure 2: (a-b): Inference (or encoder/recognition) and generative (or decoder) models for (a) WHAI and (b) AVITM; (c) the generative model and a sketch of the upward-downward Gibbs sampler of DLDA, where $\mathbf { Z } ^ { l }$ are augmented latent counts that are upward sampled in each Gibbs sampling iteration. Circles are stochastic variables and squares are deterministic variables. The orange and blue arrows denote the upward and downward information propagation respectively, and the red ones denote the data generation.
|
| 121 |
+
|
| 122 |
+
# 2.4 VARIATIONS OF WHAI
|
| 123 |
+
|
| 124 |
+
To clearly understand how each component contributes to the overall performance of WHAI, below we consider two different variations: GHAI and WAI. We first consider gamma hybrid autoencoding inference (GHAI). In WUDVE, the inference network for WHAI, we have a deterministic-upward and stochastic-downward structure, where the reparameterizable Weilbull distribution is used to connect adjacent stochastic layers. Although we choose to use the Weibull distribution for the reasons specified in Section 2.2.1, one may also choose some other distribution in the downward structure. For example, one may choose the gamma distribution and replace (6) with
|
| 125 |
+
|
| 126 |
+
$$
|
| 127 |
+
q ( \theta _ { n } ^ { ( l ) } | \Phi ^ { ( l + 1 ) } , \mathbf { h } _ { n } ^ { ( l ) } , \pmb { \theta } _ { n } ^ { ( l + 1 ) } ) = \mathrm { G a m m a } ( \pmb { k } _ { n } ^ { ( l ) } + \Phi ^ { ( l + 1 ) } \pmb { \theta } _ { n } ^ { ( l + 1 ) } , \pmb { \lambda } _ { n } ^ { ( l ) } ) .
|
| 128 |
+
$$
|
| 129 |
+
|
| 130 |
+
Even though the gamma distribution does not have a simple reparameteriation, one may use the RSVI of Naesseth et al. to define an approximate reparameterization procedure via rejection sampling. More specifically, following Naesseth et al., to generate a gamma random variable $z \sim \mathrm { G a m m a } ( \alpha , \beta )$ , one may first use the rejection sampler of Marsaglia & Tsang (2000) to generate $\tilde { z } \sim \mathrm { G a m m a } ( \alpha + B , 1 )$ , for which the proposal distribution is expressed as
|
| 131 |
+
|
| 132 |
+
$$
|
| 133 |
+
\tilde { z } = \left( \alpha + B - \frac { 1 } { 3 } \right) \left( 1 + \frac { \varepsilon } { \sqrt { 9 ( \alpha + B ) - 3 } } \right) ^ { 3 } , \mathrm { ~ } \varepsilon \sim \mathcal { N } ( 0 , 1 ) ,
|
| 134 |
+
$$
|
| 135 |
+
|
| 136 |
+
Set mini-batch size $m$ and the number of layer $L$
|
| 137 |
+
Initialize encoder parameter $\pmb { \Omega }$ and model parameter $\{ \Phi ^ { ( l ) } \} _ { 1 , L }$ .
|
| 138 |
+
for $i t e r = 1 , 2 , \cdots$ do Randomly select a mDraw random noise $m$ documents to form a subset m uniform distribution; $\mathbf { X } = \{ \pmb { x } _ { i } \} _ { 1 , m }$ ; $\left\{ \varepsilon _ { i } ^ { l } \right\} _ { i = 1 , l = 1 } ^ { m , L }$ Calculate $\nabla _ { \Omega } L \left( \Omega , \Phi ^ { \{ l \} } ; \mathbf { X } , \varepsilon _ { i } ^ { l } \right)$ according to (3), and update $\pmb { \Omega }$ ; Sample ${ \pmb \theta } _ { i } ^ { \{ l \} }$ from (6) via $\pmb { \Omega }$ to update topics $\{ \Phi ^ { ( l ) } \} _ { l = 1 } ^ { L }$ according to (2);
|
| 139 |
+
end for
|
| 140 |
+
|
| 141 |
+
where $B$ is a pre-set integer to make the acceptance probability be close to 1; one then lets $z = \beta ^ { - 1 } \tilde { z } \prod _ { i = 1 } ^ { B } { u _ { i } } ^ { 1 / ( \alpha + i - 1 ) }$ , where $u _ { i } \sim \mathrm { U n i f o r m } ( 0 , 1 )$ . The gradients of the ELBO, however, could still suffer from relatively high variance, as how likely a proposed $\varepsilon$ will be accepted depends on the gamma distribution parameters, and $B$ extra uniform random variables $\{ u _ { i } \} _ { 1 , B }$ need to be introduced.
|
| 142 |
+
|
| 143 |
+
To demonstrate the advantages of the proposed hybrid inference for WHAI, which infers posterior samples of the global parameters, including $\{ \Phi ^ { ( l ) } \} _ { 1 , L }$ and $\pmb { \Omega }$ , using TLASGR-MCMC, we also consider Weibull autoencoding inference (WAI) that has the same inference network as WHAI but infers $\{ \Phi ^ { ( l ) } \} _ { 1 , L }$ and $\pmb { \Omega }$ using stochastic gradient decent (SGD) (Kingma & Ba, 2015). Note that as argued in Mandt et al. (2017), SGD can also be used for approximate Bayesian inference. We will show in experiments that sampling the global parameters via TLASGR-MCMC provides improved performance in comparison to sampling them via SGD.
|
| 144 |
+
|
| 145 |
+
To understand the importance of the stochastic-downward structure used in the inference network, and further understand the differences between using the Weibull distribution with simple reparameterization and using the gamma distribution with RSVI, we also consider DLDA-GHAI-Independent and DLDA-WHAI-Independent that remove the stochastic-downward connections of DLDA-GHAI and DLDAas Weilbull spec and fically, they define , respectively, and $q ( \pmb \theta _ { n } ^ { ( l ) } \mid \Phi ^ { ( l + 1 ) } , \pmb h _ { n } ^ { ( l ) } , \pmb \theta _ { n } ^ { ( l + 1 ) } )$ in (6) RSVI, (k(l)n , λ(l)n ) $\mathrm { G a m m a } ( \boldsymbol { k } _ { n } ^ { ( l ) } , \bar { \lambda } _ { n } ^ { ( l ) } )$
|
| 146 |
+
|
| 147 |
+
# 3 EXPERIMENTAL RESULTS
|
| 148 |
+
|
| 149 |
+
We compare the performance of different algorithms on 20Newsgroups (20News), Reuters Corpus Volume I (RCV1), and Wikipedia (Wiki). 20News consists of 18,845 documents with a vocabulary size of 2,000. RCV1 consists of 804,414 documents with a vocabulary size of 10,000. Wiki, with a vocabulary size of 7,702, consists of 10 million documents randomly downloaded from Wikipedia using the script provided for Hoffman et al. (2010). Similar to Cong et al. (2017a), we randomly select 100,000 documents for testing. To be consistent with previous settings (Gan et al., 2015; Henao et al., 2015; Cong et al., 2017a), no precautions are taken in the Wikipedia downloading script to prevent a testing document from being downloaded into a mini-batch for training. Our code is written in Theano (Theano Development Team, 2016).
|
| 150 |
+
|
| 151 |
+
For comparison, we consider the deep Poisson factor analysis (DPFA) of Gan et al. (2015), DLDAGibbs of Zhou et al. (2016), DLDA-TLASGR of Cong et al. (2017a), and AVITM of Srivastava & Sutton (2017), using the code provided by the authors. Note that as shown in Cong et al. (2017a), DLDA-Gibbs and DLDA-TLASGR are state-of-the-art topic modeling algorithms that clearly outperform a large number of previously proposed ones, such as the replicated softmax of Salakhutdinov & Hinton (2009) and the nested Hierarchical Dirichlet process of Paisley et al. (2015).
|
| 152 |
+
|
| 153 |
+
# 3.1 PER-HELDOUT-WORD PERPLEXITY
|
| 154 |
+
|
| 155 |
+
Per-heldout-word perplexity is a widely-used performance measure. Similar to Wallach et al. (2009), Paisley et al. (2011), and Zhou et al. (2012), for each corpus, we randomly select $7 0 \%$ of the word
|
| 156 |
+
|
| 157 |
+
Table 1: Comparison of per-heldout-word perplexity and testing time (average seconds per document) on three different datasets.
|
| 158 |
+
|
| 159 |
+
<table><tr><td rowspan="2">Model</td><td rowspan="2">Size</td><td colspan="3">Perplexity</td><td colspan="3">Test Time</td></tr><tr><td>20News</td><td>RCV1</td><td>Wiki</td><td>20News</td><td>RCV1</td><td>Wiki</td></tr><tr><td>DLDA-Gibbs</td><td>128-64-32</td><td>571</td><td>938</td><td>966</td><td>10.46</td><td>23.38</td><td>23.69</td></tr><tr><td>DLDA-Gibbs</td><td>128-64</td><td>573</td><td>942</td><td>968</td><td>8.73</td><td>18.50</td><td>19.79</td></tr><tr><td>DLDA-Gibbs</td><td>128</td><td>584</td><td>951</td><td>981</td><td>4.69</td><td>12.57</td><td>13.31</td></tr><tr><td>DLDA-TLASGR</td><td>128-64-32</td><td>579</td><td>950</td><td>978</td><td>10.46</td><td>23.38</td><td>23.69</td></tr><tr><td>DLDA-TLASGR</td><td>128-64</td><td>581</td><td>955</td><td>979</td><td>8.73</td><td>18.50</td><td>19.79</td></tr><tr><td>DLDA-TLASGR</td><td>128</td><td>590</td><td>963</td><td>993</td><td>4.69</td><td>12.57</td><td>13.31</td></tr><tr><td>DPFA</td><td>128-64-32</td><td>637</td><td>1041</td><td>1056</td><td>20.12</td><td>34.21</td><td>35.41</td></tr><tr><td>AVITM</td><td>128</td><td>654</td><td>1062</td><td>1088</td><td>0.23</td><td>0.68</td><td>0.80</td></tr><tr><td>DLDA-GHAI-Independent</td><td>128-64-32</td><td>613</td><td>970</td><td>999</td><td>0.62</td><td>1.22</td><td>1.47</td></tr><tr><td>DLDA-GHAI-Independent</td><td>128-64</td><td>614</td><td>970</td><td>1000</td><td>0.41</td><td>0.94</td><td>1.01</td></tr><tr><td>DLDA-GHAI-Independent</td><td>128</td><td>615</td><td>972</td><td>1003</td><td>0.22</td><td>0.69</td><td>0.80</td></tr><tr><td>DLDA-GHAI</td><td>128-64-32</td><td>604</td><td>963</td><td>994</td><td>0.66</td><td>1.25</td><td>1.49</td></tr><tr><td>DLDA-GHAI</td><td>128-64</td><td>608</td><td>965</td><td>997</td><td>0.44</td><td>0.96</td><td>1.05</td></tr><tr><td>DLDA-GHAI</td><td>128</td><td>615</td><td>972</td><td>1003</td><td>0.22</td><td>0.69</td><td>0.80</td></tr><tr><td>DLDA-WHAI-Independent</td><td>128-64-32</td><td>588</td><td>964</td><td>990</td><td>0.58</td><td>1.15</td><td>1.38</td></tr><tr><td>DLDA-WHAI-Independent</td><td>128-64</td><td>589</td><td>965</td><td>992</td><td>0.38</td><td>0.87</td><td>0.97</td></tr><tr><td>DLDA-WHAI-Independent</td><td>128</td><td>592</td><td>966</td><td>996</td><td>0.20</td><td>0.66</td><td>0.78</td></tr><tr><td>DLDA-WAI</td><td>128-64-32</td><td>581</td><td>954</td><td>984</td><td>0.63</td><td>1.20</td><td>1.43</td></tr><tr><td>DLDA-WAI</td><td>128-64</td><td>583</td><td>958</td><td>986</td><td>0.42</td><td>0.91</td><td>1.02</td></tr><tr><td>DLDA-WAI</td><td>128</td><td>593</td><td>967</td><td>999</td><td>0.20</td><td>0.66</td><td>0.78</td></tr><tr><td>DLDA-WHAI</td><td>128-64-32</td><td>581</td><td>953</td><td>980</td><td>0.63</td><td>1.20</td><td>1.43</td></tr><tr><td>DLDA-WHAI</td><td>128-64</td><td>582</td><td>957</td><td>982</td><td>0.42</td><td>0.91</td><td>1.02</td></tr><tr><td>DLDA-WHAI</td><td>128</td><td>591</td><td>965</td><td>996</td><td>0.20</td><td>0.66</td><td>0.78</td></tr></table>
|
| 160 |
+
|
| 161 |
+
tokens from each document to form a training matrix $\mathbf { T }$ , holding out the remaining $3 0 \%$ to form a testing matrix $\mathbf { Y }$ . We use $\mathbf { T }$ to train the model and calculate the per-heldout-word perplexity as
|
| 162 |
+
|
| 163 |
+
$$
|
| 164 |
+
\exp \left\{ - \frac { 1 } { y . . } \sum _ { v = 1 } ^ { V } \sum _ { n = 1 } ^ { N } y _ { v n } \ln \frac { \sum _ { s = 1 } ^ { S } \sum _ { k = 1 } ^ { K ^ { 1 } } \phi _ { v k } ^ { ( 1 ) s } \theta _ { k n } ^ { ( 1 ) s } } { \sum _ { s = 1 } ^ { S } \sum _ { v = 1 } ^ { V } \sum _ { k = 1 } ^ { K ^ { 1 } } \phi _ { v k } ^ { ( 1 ) s } \theta _ { k n } ^ { ( 1 ) s } } \right\} ,
|
| 165 |
+
$$
|
| 166 |
+
|
| 167 |
+
where $S$ is the total number of collected samples and $\begin{array} { r } { y _ { \cdot \cdot } = \sum _ { v = 1 } ^ { V } \sum _ { n = 1 } ^ { N ^ { ' } } y _ { v n } } \end{array}$ PVv=1 PNn=1 yvn. For the proposed model, we set the mini-batch size as 200, and use as burn-in 2000 mini-batches for both 20News and RCV1 and 3500 for wiki. We collect 3000 samples after burn-in to calculate perplexity. The hyperparameters of WHAI are set as: $\eta ^ { ( l ) } = 1 / K _ { l }$ , $\mathbf r = \mathbf 1$ , and $c _ { n } ^ { ( l ) } = 1$ .
|
| 168 |
+
|
| 169 |
+
Table 1 lists for various algorithms both the perplexity and the average run time per testing document given a single sample (estimate) of the global parameters. Clearly, given the same generative network structure, DLDA-Gibbs performs the best in terms of predicting heldout word tokens, which is not surprising as this batch algorithm can sample from the true posteriors given enough Gibbs sampling iterations. DLDA-TLASGR is a mini-batch algorithm that is much more scalable in training than DLDA-Gibbs, at the expense of slighted degraded performance in out-of-sample prediction. Both DLDA-WAI, using SGD to infer the global parameters, and DLDA-WHAI, using a stochasticgradient MCMC to infer the global parameters, slightly underperform DLDA-TLASGR; all minibatch based algorithms are scalable to a big training corpus, but due to the use of the WUDVE inference network, both DLDA-GHAI and DLDA-WHAI, as well as their variations, are considerably fast in processing a testing document. In terms of perplexity, all algorithms with DLDA as the generative model clearly outperform both DPFA of Gan et al. (2015) and AVITM of Srivastava & Sutton (2017), while in terms of the computational cost for testing, all algorithms with an inference network, such as AVITM, DLDA-GHAI, and DLDA-WHAI, clearly outperform these relying on an interactive procedure for out-of-sample prediction, including DPFA, DLDA-Gibbs, and DLDA-TLASGR. It is also clear that except for DLDA-GHAI-Independent and DLDA-WHAI-Independent that have no stochastic-downward components in their inference, all the other algorithms with DLDA as the generative model have a clear trend of improvement as the generative network becomes deeper, indicating the importance of having stochastic-downward information propagation during posterior inference; and DLDA-WHAI with a single hidden layer already clearly outperforms AVITM, indicating that using the Weibull distribution is more appropriate than using the logistic-normal distribution to model the document latent representation. Furthermore, thanks to the use of the stochastic gradient based TLASGR-MCMC rather than a simple SGD procedure, DLDA-WHAI consistently outperforms DLDA-WAI. Last but not least, while DLDA-GHAI that relies on RSVI to approximately reparameterize the gamma distributions clearly outperforms AVITM and DPFA, it clearly underperforms DLDA-WHAI that has simple reparameterizations for its Weibull distributions.
|
| 170 |
+
|
| 171 |
+

|
| 172 |
+
Figure 3: Plot of per-heldout-word perplexity as a function of time for (a) 20News, (b) RCV1, and (c) Wiki. Except for AVITM that has a single hidden layer with 128 topics, all the other algorithms have the same network size of 128-64-32 for their deep generative models.
|
| 173 |
+
|
| 174 |
+
Below we examine how various inference algorithms progress over time during training, evaluated with per-holdout-word perplexity. As clearly shown in Fig. 3, DLDA-WHAI outperforms DPFA and AVITM in providing lower perplexity as time progresses, which is not surprising as the DLDA multilayer generative model is good at document representation, while AVITM is only "deep" in the deterministic part of its inference network and DPFA is restricted to model binary topic usage patterns via its deep network. When DLDA is used as the generative model, in comparison to Gibbs sampling and TLASGR-MCMC on two large corpora, RCV1 and Wiki, the mini-batch based WHAI converges slightly slower than TLASGR-MCMC but much faster than Gibbs sampling; WHAI consistently outperforms WAI, which demonstrates the advantage of the hybrid MCMC/VAE inference; in addition, the RSVI based DLDA-GHAI clearly converges more slowly in time than DLDAWHAI. Note that for all three datasets, the perplexity of TLASGR decreases at a fast rate, followed by closely by WHAI, while that of Gibbs sampling decreases slowly, especially for RCV1 and Wiki, as shown in Figs. 3(b-c). This is expected as both RCV1 and Wiki are much larger corpora, for which a mini-batch based inference algorithm can already make significant progress in inferring the global model parameters, before a batch-learning Gibbs sampler finishes a single iteration that needs to go through all documents. We also notice that although AVITM is fast for testing via the use of a VAE, its representation power is limited due to not only the use of a shallow topic model, but also the use of a latent Gaussian based inference network that is not naturally suited to model document latent representation.
|
| 175 |
+
|
| 176 |
+
# 3.2 TOPIC HIERARCHY AND MANIFOLD
|
| 177 |
+
|
| 178 |
+
In addition to quantitative evaluations, we have also visually inspected the inferred topics at different layers and the inferred connection weights between the topics of adjacent layers. Distinct from many existing deep learning models that build nonlinearity via “black-box” neural networks, we can easily visualize the whole stochastic network, whose hidden units of layer $l - 1$ and those of layer $l$ are connected by $\phi _ { k ^ { \prime } k } ^ { ( l ) }$ that are sparse. In particular, we can understand the meaning of each hidden unit by projecting it back to the original data space via $\left[ \prod _ { t = 1 } ^ { l - 1 } \Phi ^ { ( t ) } \right] \phi _ { k } ^ { ( l ) }$ . We show in Fig. 4 a subnetwork, originating from units 16, 19, and 24 of the top hidden layer, taken from the generative network of size 128-64-32 inferred on Wiki. The semantic meaning of each topic and the connections between different topics are highly interpretable. We provide several additional topic hierarchies for Wiki in the Appendix.
|
| 179 |
+
|
| 180 |
+

|
| 181 |
+
Figure 4: An example of hierarchical topics learned from Wiki by a three-hidden-layer WHAI of size 128-64-32.
|
| 182 |
+
|
| 183 |
+

|
| 184 |
+
Figure 5: Learned topics on MNIST digits with a three-hidden-layer WHAI of size 128-64- 32. Shown in (a)-(c) are example topics for layers 1, 2 and 3, respectively, learned with a deterministic-upward-stochastic-downward encoder, and shown in (d)-(f) are the ones learned with a deterministic-upward encoder.
|
| 185 |
+
|
| 186 |
+
To further illustrate the effectiveness of our multilayer representation in our model, we apply a threehidden-layer WHAI to MNIST digits and present the learned dictionary atoms. We use the Poisson likelihood directly to model the MNIST digit pixel values that are nonnegative integers ranging from 0 to 255. As shown in Figs. 5a-5c, it is clear that the factors at layers one to three represent localized points, strokes, and digit components, respectively, that cover increasingly larger spatial regions. This type of hierarchical visual representation is difficult to achieve with other types of deep neural networks (Srivastava et al., 2013; Kingma & Welling, 2014; Rezende et al., 2014; Sonderby et al., 2016).
|
| 187 |
+
|
| 188 |
+
WUDVE, the inference network of WHAI, has a deterministic-upward-stochastic-downward structure, in contrast to a conventional VAE that often has a pure deterministic bottom-up structure. Here, we further visualize the importance of the stochastic-downward part of WUDVE through a simple experiment. We remove the stochastic-downward part of WUDVE shown in (6) and define the inference network as $q ( \pmb { \theta } _ { n } ^ { ( l ) } | \pmb { h } _ { n } ^ { ( l ) } ) = \mathrm { W e i b u l l } ( \pmb { k } _ { n } ^ { ( l ) } , \mathbf { \bar { \lambda } } _ { n } ^ { ( l ) } )$ , in other words, we ignore the top-down information. As shown in Figs. 5d-5f, although some latent structures are learned, the hierarchical relationships between adjacent layers almost all disappear, indicating the importance of having a stochastic-downward structure together with a deterministic-upward one in the inference network.
|
| 189 |
+
|
| 190 |
+

|
| 191 |
+
Figure 6: Latent space interpolations on the MNIST test set. Left and right columns correspond to the images generated frominterpolated linearly from $z _ { 1 } ^ { ( 3 ) }$ 3) and z(3)2 , a nd the others are generated from the latent representations $z _ { 1 } ^ { ( 3 ) }$ to z 2 $z _ { 2 } ^ { ( 3 ) }$
|
| 192 |
+
|
| 193 |
+
As a sanity check for latent representation and overfitting, we shown in Fig. 6 the latent space interpolations between the test set examples on MNIST dataset, and provide related results in the Appendix for the 20News corpus. With the 3-layer model learned before, following Dumoulin et al. (2016), we sample pairs of test set examples x1 and x2 and project them into z(3)1 a nd z 2 . We then linearly interpolate between $z _ { 1 } ^ { ( 3 ) }$ and $z _ { 2 } ^ { ( 3 ) }$ , and pass the intermediary points through the generative model to generate the input-space interpolations. In Fig. 6, the left and right column are the digits generated from $z _ { 1 } ^ { ( 3 ) }$ and $\bar { z } _ { 2 } ^ { ( 3 ) }$ , while the middle ones are generated from the interpolation latent space. We observe a smooth transitions between pairs of example, and intermediary images remain interpretable. In other words, the latent space the model learned is on a manifold, indicating that WHAI has learned a generalizable latent feature representation rather than concentrating its probability mass exclusively around training examples.
|
| 194 |
+
|
| 195 |
+
# 4 CONCLUSION
|
| 196 |
+
|
| 197 |
+
To infer a hierarchical latent representations of a big corpus, we develop Weibull hybrid autoencoding inference (WHAI) for deep latent Dirichlet allocation (DLDA), a deep probabilistic topic model that factorizes the observed high-dimensional count vectors under the Poisson likelihood and models the latent representation under the gamma likelihood at multiple different layers. WHAI integrates topic-layer-adaptive stochastic gradient Riemannian (TLASGR) MCMC to update the global parameters given the posterior sample of a mini-batch’s local parameters, and a Weibull distribution based upward-downward variational autoencoder to infer the conditional posterior of the local parameters given the stochastically updated global parameters. The use of the Weibull distribution, which resembles the gamma distribution and has a simple reparameterization, makes one part of the evidence lower bound (ELBO) analytic, and makes it efficient to compute the gradient of the non-analytic part of the ELBO with respect to the parameters of the inference network. Moving beyond deep models and inference procedures based on Gaussian latent variables, WHAI provides posterior samples for both the global parameters of the generative model and these of the inference network, yields highly interpretable multilayer latent document representation, is scalable to a big training corpus due to the use of a stochastic-gradient MCMC, and is fast in out-of-sample prediction due to the use of an inference network. Compelling experimental results on big text corpora demonstrate the advantages of WHAI in both quantitative and qualitative analysis.
|
| 198 |
+
|
| 199 |
+
# 5 ACKNOWLEDGE
|
| 200 |
+
|
| 201 |
+
This work is partially supported by the Fund for Foreign Scholars in University Research and Teaching Programs (the 111 Project) (No. B18039), the Thousand Young Talent Program of China, NSFC (61771361) , NSFC for Distinguished Young Scholars (61525105), and Innovation Fund of International Exchange Program for Graduate Student of Xidian University.
|
| 202 |
+
|
| 203 |
+
# REFERENCES
|
| 204 |
+
|
| 205 |
+
David M Blei, Andrew $\mathrm { ~ Y ~ N ~ g ~ }$ , and Michael I Jordan. Latent Dirichlet allocation. Journal of Machine Learning Research, 3(Jan):993–1022, 2003.
|
| 206 |
+
|
| 207 |
+
Yulai Cong, Bo Chen, Hongwei Liu, and Mingyuan Zhou. Deep latent Dirichlet allocation with topic-layer-adaptive stochastic gradient riemannian mcmc. In ICML, 2017a.
|
| 208 |
+
|
| 209 |
+
Yulai Cong, Bo Chen, and Mingyuan Zhou. Fast simulation of hyperplane-truncated multivariate normal distributions. Bayesian Analysis, 2017b.
|
| 210 |
+
|
| 211 |
+
Zhenwen Dai, Andreas C Damianou, Javier Gonzalez, and Neil D Lawrence. Variational autoencoded deep Gaussian processes. In ICLR, 2016.
|
| 212 |
+
|
| 213 |
+
Vincent Dumoulin, Ishmael Belghazi, Ben Poole, Alex Lamb, Martin Arjovsky, Olivier Mastropietro, and Aaron Courville. Adversarially learned inference. arXiv:1606.00704, 2016.
|
| 214 |
+
|
| 215 |
+
Zhe Gan, Changyou Chen, Ricardo Henao, David Carlson, and Lawrence Carin. Scalable deep Poisson factor analysis for topic modeling. In ICML, pp. 1823–1832, 2015.
|
| 216 |
+
|
| 217 |
+
Ricardo Henao, Zhe Gan, James Lu, and Lawrence Carin. Deep Poisson factor modeling. In NIPS, pp. 2800–2808, 2015.
|
| 218 |
+
|
| 219 |
+
M. Hoffman, D. Blei, and F. Bach. Online learning for latent Dirichlet allocation. In NIPS, 2010.
|
| 220 |
+
|
| 221 |
+
Matthew D Hoffman, David M Blei, Chong Wang, and John William Paisley. Stochastic variational inference. Journal of Machine Learning Research, 14(1):1303–1347, 2013.
|
| 222 |
+
|
| 223 |
+
Gulrajani Ishaan, Kumar Kundan, Ahmed Faruk, Taiga Adrien, Ali, Visin Francesco, Vazquez David, and Courville Aaron. Pixelvae: A latent variable model for natural images. In ICLR, 2017.
|
| 224 |
+
|
| 225 |
+
Michael I Jordan, Zoubin Ghahramani, Tommi S Jaakkola, and Lawrence K Saul. An introduction to variational methods for graphical models. Machine learning, 37(2):183–233, 1999.
|
| 226 |
+
|
| 227 |
+
Diederik P Kingma and Jimmy Lei Ba. Adam: A method for stochastic optimization. In ICLR, 2015.
|
| 228 |
+
|
| 229 |
+
Diederik P Kingma and Max Welling. Stochastic gradient VB and the variational auto-encoder. In ICLR, 2014.
|
| 230 |
+
|
| 231 |
+
David A Knowles. Stochastic gradient variational Bayes for gamma approximating distributions. arXiv preprint arXiv:1509.01631, 2015.
|
| 232 |
+
|
| 233 |
+
Y. Ma, T. Chen, and E. Fox. A complete recipe for stochastic gradient MCMC. In NIPS, pp. 2899–2907, 2015.
|
| 234 |
+
|
| 235 |
+
Stephan Mandt, Matthew D Hoffman, and David M Blei. Stochastic gradient descent as approximate Bayesian inference. arXiv:1704.04289, to appear in Journal of Machine Learning Research, 2017.
|
| 236 |
+
|
| 237 |
+
George Marsaglia and Wai Wan Tsang. A simple method for generating gamma variables. ACM Transactions on Mathematical Software (TOMS), 26(3):363–372, 2000.
|
| 238 |
+
|
| 239 |
+
Andriy Mnih and Karol Gregor. Neural variational inference and learning in belief networks. In ICML, pp. 1791–1799, 2014.
|
| 240 |
+
|
| 241 |
+
Christian Naesseth, Francisco Ruiz, Scott Linderman, and David Blei. Reparameterization gradients through acceptance-rejection sampling algorithms. In AISTATS.
|
| 242 |
+
|
| 243 |
+
J. Paisley, C. Wang, and D. Blei. The discrete infinite logistic normal distribution for mixedmembership modeling. In AISTATS, 2011.
|
| 244 |
+
|
| 245 |
+
J. Paisley, C. Wang, D. M. Blei, and M. I. Jordan. Nested hierarchical Dirichlet processes. IEEE Trans. Pattern Anal. Mach. Intell., 2015.
|
| 246 |
+
|
| 247 |
+
John Paisley, David M Blei, and Michael I Jordan. Variational Bayesian inference with stochastic search. In Proceedings of the 29th International Coference on International Conference on Machine Learning, pp. 1363–1370. Omnipress, 2012.
|
| 248 |
+
|
| 249 |
+
Sam Patterson and Yee Whye Teh. Stochastic gradient Riemannian Langevin dynamics on the probability simplex. In NIPS, pp. 3102–3110, 2013.
|
| 250 |
+
|
| 251 |
+
Rajesh Ranganath, Linpeng Tang, Laurent Charlin, and David Blei. Deep exponential families. In AISTATS, pp. 762–771, 2015.
|
| 252 |
+
|
| 253 |
+
Danilo J 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 (ICML-14), pp. 1278–1286, 2014.
|
| 254 |
+
|
| 255 |
+
Francisco JR Ruiz, Michalis K Titsias, and David M Blei. The generalized reparameterization gradient. In NIPS, pp. 460–468, 2016.
|
| 256 |
+
|
| 257 |
+
Ruslan Salakhutdinov and Geoffrey E Hinton. Replicated softmax: an undirected topic model. In NIPS, pp. 1607–1614, 2009.
|
| 258 |
+
|
| 259 |
+
Casper Kaae Sonderby, Tapani Raiko, Lars Maaloe, Soren Kaae Sonderby, and Ole Winther. Ladder variational autoencoders. In NIPS, pp. 3738–3746, 2016.
|
| 260 |
+
|
| 261 |
+
Akash Srivastava and Charles Sutton. Autoencoding variational inference for topic models. In ICLR, 2017.
|
| 262 |
+
|
| 263 |
+
Nitish Srivastava, Ruslan Salakhutdinov, and Geoffrey E Hinton. Modeling documents with deep Boltzmann machines. In Uncertainty in Artificial Intelligence, 2013.
|
| 264 |
+
|
| 265 |
+
Theano Development Team. Theano: A Python framework for fast computation of mathematical expressions. arXiv e-prints, abs/1605.02688, May 2016.
|
| 266 |
+
|
| 267 |
+
H. M. Wallach, I. Murray, R. Salakhutdinov, and D. Mimno. Evaluation methods for topic models. In ICML, 2009.
|
| 268 |
+
|
| 269 |
+
M. Welling and Y. W. Teh. Bayesian learning via stochastic gradient Langevin dynamics. In ICML, pp. 681–688, 2011.
|
| 270 |
+
|
| 271 |
+
Mingyuan Zhou, Lauren Hannah, David B Dunson, and Lawrence Carin. Beta-negative binomial process and Poisson factor analysis. In AISTATS, pp. 1462–1471, 2012.
|
| 272 |
+
|
| 273 |
+
Mingyuan Zhou, Yulai Cong, and Bo Chen. The Poisson gamma belief network. In NIPS, pp. 3043–3051, 2015.
|
| 274 |
+
|
| 275 |
+
Mingyuan Zhou, Yulai Cong, and Bo Chen. Augmentable gamma belief networks. J. Mach. Learn. Res., 17(163):1–44, 2016.
|
| 276 |
+
|
| 277 |
+
# A HIERARCHICAL TOPICS LEARNED FROM WIKI
|
| 278 |
+
|
| 279 |
+

|
| 280 |
+
Figure 7: An example of hierarchical topics learned from Wiki by a three-hidden-layer WHAI of size 128-64-32.
|
| 281 |
+
|
| 282 |
+

|
| 283 |
+
Figure 8: An example of hierarchical topics learned from Wiki by a four-hidden-layer WHAI of size 256-128-64-32.
|
| 284 |
+
|
| 285 |
+
# B MANIFOLD ON DOCUMENTS
|
| 286 |
+
|
| 287 |
+
# From a sci.medicine document to an eci.space one
|
| 288 |
+
|
| 289 |
+
1. com, writes, article, edu, medical, pitt, pain, blood, disease, doctor, medicine, treatment, patients, health, ibm
|
| 290 |
+
2. com, writes, article, edu, space, medical, pitt, pain, blood, disease, doctor, data, treatment, patients, health
|
| 291 |
+
3. space, com, writes, article, edu, data, medical, launch, earth, states, blood, moon, disease, satellite, medicine,
|
| 292 |
+
4. space, data, com, writes, article, edu, launch, earth, states, moon, satellite, shuttle, nasa, price, lunar
|
| 293 |
+
5. space, data, launch, earth, states, moon, satellite, case, com, shuttle, price, nasa, price, lunar, writes,
|
| 294 |
+
6. space, data, launch, earth, states, moon, orbit, satellite, case, shuttle, price, nasa, system, lunar, spacecraft
|
| 295 |
+
|
| 296 |
+
# From a alt.atheism document to a soc.religion.christian one
|
| 297 |
+
|
| 298 |
+
1. god, just, want, moral, believe, religion, atheists, atheism, christian, make, atheist, good, say, bible, faith
|
| 299 |
+
2. god, just, want, believe, jesus, christian, atheists, bible, atheism faith, say, make, religious, christians, atheist
|
| 300 |
+
3. god, jesus, just, faith, believe, christian, bible, want, church, say, religion, moral, lord, world, writes
|
| 301 |
+
4. god, jesus, faith, just, bible, church, christ, believe, say, writes, lord, religion, world, want, sin 5. god, jesus, faith, church, christ, bible, christian, say, write, lord, believe, truth, world, human, holy
|
| 302 |
+
6. god, jesus, faith, church, christ, bible, writes, say, christian, lord, sin, human, father, spirit, truth
|
| 303 |
+
|
| 304 |
+
# From a com.graphics document to a comp.sys.ibm.pc.hardware one
|
| 305 |
+
|
| 306 |
+
1. image, color, windows, files, image, thanks, jpeg, gif, card, bit, window, win, help, colors, format 2. image, windows, color, files, card, images, jpeg, thanks, gif, bit, window, win, colors, monitor, program
|
| 307 |
+
3. windows, image, color, card, files, gov, writes, nasa, article, images, program, jpeg, vidio, display, monitor
|
| 308 |
+
4. windows, gov, writes, nasa, article, card, going, program, image, color, memory, files, software, know, screen
|
| 309 |
+
5. gov, windows, writes, nasa, article, going, dos, card, memory, know, display, says, screen, work, ram
|
| 310 |
+
6. gov, writes, nasa, windows, article, going, dos, program, card, memory, software, says, ram, work, running
|
md/train/S1jE5L5gl/S1jE5L5gl.md
ADDED
|
@@ -0,0 +1,567 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# THE CONCRETE DISTRIBUTION: A CONTINUOUS RELAXATION OF DISCRETE RANDOM VARIABLES
|
| 2 |
+
|
| 3 |
+
Chris J. Maddison1,2, Andriy $\mathbf { M n i h 1 }$ , & Yee Whye Teh1
|
| 4 |
+
|
| 5 |
+
1DeepMind, London, United Kingdom 2University of Oxford, Oxford, United Kingdom cmaddis@stats.ox.ac.uk
|
| 6 |
+
|
| 7 |
+
# ABSTRACT
|
| 8 |
+
|
| 9 |
+
The reparameterization trick enables optimizing large scale stochastic computation graphs via gradient descent. The essence of the trick is to refactor each stochastic node into a differentiable function of its parameters and a random variable with fixed distribution. After refactoring, the gradients of the loss propagated by the chain rule through the graph are low variance unbiased estimators of the gradients of the expected loss. While many continuous random variables have such reparameterizations, discrete random variables lack useful reparameterizations due to the discontinuous nature of discrete states. In this work we introduce CONCRETE random variables – CONtinuous relaxations of disCRETE random variables. The Concrete distribution is a new family of distributions with closed form densities and a simple reparameterization. Whenever a discrete stochastic node of a computation graph can be refactored into a one-hot bit representation that is treated continuously, Concrete stochastic nodes can be used with automatic differentiation to produce low-variance biased gradients of objectives (including objectives that depend on the log-probability of latent stochastic nodes) on the corresponding discrete graph. We demonstrate the effectiveness of Concrete relaxations on density estimation and structured prediction tasks using neural networks.
|
| 10 |
+
|
| 11 |
+
# 1 INTRODUCTION
|
| 12 |
+
|
| 13 |
+
Software libraries for automatic differentiation (AD) (Abadi et al., 2015; Theano Development Team, 2016) are enjoying broad use, spurred on by the success of neural networks on some of the most challenging problems of machine learning. The dominant mode of development in these libraries is to define a forward parametric computation, in the form of a directed acyclic graph, that computes the desired objective. If the components of the graph are differentiable, then a backwards computation for the gradient of the objective can be derived automatically with the chain rule. The ease of use and unreasonable effectiveness of gradient descent has led to an explosion in the diversity of architectures and objective functions. Thus, expanding the range of useful continuous operations can have an outsized impact on the development of new models. For example, a topic of recent attention has been the optimization of stochastic computation graphs from samples of their states. Here, the observation that AD “just works” when stochastic nodes1 can be reparameterized into deterministic functions of their parameters and a fixed noise distribution (Kingma & Welling, 2013; Rezende et al., 2014), has liberated researchers in the development of large complex stochastic architectures (e.g. Gregor et al., 2015).
|
| 14 |
+
|
| 15 |
+
Computing with discrete stochastic nodes still poses a significant challenge for AD libraries. Deterministic discreteness can be relaxed and approximated reasonably well with sigmoidal functions or the softmax (see e.g., Grefenstette et al., 2015; Graves et al., 2016), but, if a distribution over discrete states is needed, there is no clear solution. There are well known unbiased estimators for the gradients of the parameters of a discrete stochastic node from samples. While these can be made to work with AD, they involve special casing and defining surrogate objectives (Schulman et al., 2015), and even then they can have high variance. Still, reasoning about discrete computation comes naturally to humans, and so, despite the difficulty associated, many modern architectures incorporate discrete stochasticity (Mnih et al., 2014; Xu et al., 2015; Kocisk ˇ y et al., 2016). ´
|
| 16 |
+
|
| 17 |
+
This work is inspired by the observation that many architectures treat discrete nodes continuously, and gradients rich with counterfactual information are available for each of their possible states. We introduce a CONtinuous relaxation of disCRETE random variables, CONCRETE for short, which allow gradients to flow through their states. The Concrete distribution is a new parametric family of continuous distributions on the simplex with closed form densities. Sampling from the Concrete distribution is as simple as taking the softmax of logits perturbed by fixed additive noise. This reparameterization means that Concrete stochastic nodes are quick to implement in a way that “just works” with AD. Crucially, every discrete random variable corresponds to the zero temperature limit of a Concrete one. In this view optimizing an objective over an architecture with discrete stochastic nodes can be accomplished by gradient descent on the samples of the corresponding Concrete relaxation. When the objective depends, as in variational inference, on the log-probability of discrete nodes, the Concrete density is used during training in place of the discrete mass. At test time, the graph with discrete nodes is evaluated.
|
| 18 |
+
|
| 19 |
+
The paper is organized as follows. We provide a background on stochastic computation graphs and their optimization in Section 2. Section 3 reviews a reparameterization for discrete random variables, introduces the Concrete distribution, and discusses its application as a relaxation. Section 4 reviews related work. In Section 5 we present results on a density estimation task and a structured prediction task on the MNIST and Omniglot datasets. In Appendices C and F we provide details on the practical implementation and use of Concrete random variables. When comparing the effectiveness of gradients obtained via Concrete relaxations to a state-of-the-art-method (VIMCO, Mnih & Rezende, 2016), we find that they are competitive — occasionally outperforming and occasionally underperforming — all the while being implemented in an AD library without special casing.
|
| 20 |
+
|
| 21 |
+
# 2 BACKGROUND
|
| 22 |
+
|
| 23 |
+
# 2.1 OPTIMIZING STOCHASTIC COMPUTATION GRAPHS
|
| 24 |
+
|
| 25 |
+
Stochastic computation graphs (SCGs) provide a formalism for specifying input-output mappings, potentially stochastic, with learnable parameters using directed acyclic graphs (see Schulman et al. (2015) for a review). The state of each non-input node in such a graph is obtained from the states of its parent nodes by either evaluating a deterministic function or sampling from a conditional distribution. Many training objectives in supervised, unsupervised, and reinforcement learning can be expressed in terms of SCGs.
|
| 26 |
+
|
| 27 |
+
To optimize an objective represented as a SCG, we need estimates of its parameter gradients. We will concentrate on graphs with some stochastic nodes (backpropagation covers the rest). For simplicity, we restrict our attention to graphs with a single stochastic node $X$ . We can interpret the forward pass in the graph as first sampling $X$ from the conditional distribution $p _ { \phi } ( x )$ of the stochastic node given its parents, then evaluating a deterministic function $f _ { \boldsymbol { \theta } } ( \boldsymbol { x } )$ at $X$ . We can think of $f _ { \theta } ( X )$ as a noisy objective, and we are interested in optimizing its expected value $L ( \theta , \phi ) = \mathbb { E } _ { X \sim p _ { \phi } ( x ) } [ f _ { \theta } ( X ) ]$ w.r.t. parameters $\theta , \phi$ .
|
| 28 |
+
|
| 29 |
+
In general, both the objective and its gradients are intractable. We will side-step this issue by estimating them with samples from $p _ { \phi } ( x )$ . The gradient w.r.t. to the parameters $\theta$ has the form
|
| 30 |
+
|
| 31 |
+
$$
|
| 32 |
+
\nabla _ { \theta } L ( \theta , \phi ) = \nabla _ { \theta } \mathbb { E } _ { X \sim p _ { \phi } ( x ) } [ f _ { \theta } ( X ) ] = \mathbb { E } _ { X \sim p _ { \phi } ( x ) } [ \nabla _ { \theta } f _ { \theta } ( X ) ]
|
| 33 |
+
$$
|
| 34 |
+
|
| 35 |
+
and can be easily estimated using Monte Carlo sampling:
|
| 36 |
+
|
| 37 |
+
$$
|
| 38 |
+
\nabla _ { \boldsymbol { \theta } } L ( \boldsymbol { \theta } , \boldsymbol { \phi } ) \simeq \frac { 1 } { S } \sum _ { s = 1 } ^ { S } \nabla _ { \boldsymbol { \theta } } f _ { \boldsymbol { \theta } } ( X ^ { s } ) ,
|
| 39 |
+
$$
|
| 40 |
+
|
| 41 |
+
where $X ^ { s } \sim p _ { \phi } ( x )$ i.i.d. The more challenging task is to compute the gradient w.r.t. the parameters $\phi$ of $p _ { \phi } ( x )$ . The expression obtained by differentiating the expected objective,
|
| 42 |
+
|
| 43 |
+
$$
|
| 44 |
+
\nabla _ { \phi } L ( \theta , \phi ) = \nabla _ { \phi } \int p _ { \phi } ( x ) f _ { \theta } ( x ) \mathrm { d } x = \int f _ { \theta } ( x ) \nabla _ { \phi } p _ { \phi } ( x ) \mathrm { d } x ,
|
| 45 |
+
$$
|
| 46 |
+
|
| 47 |
+
does not have the form of an expectation w.r.t. $x$ and thus does not directly lead to a Monte Carlo gradient estimator. However, there are two ways of getting around this difficulty which lead to the two classes of estimators we will now discuss.
|
| 48 |
+
|
| 49 |
+
# 2.2 SCORE FUNCTION ESTIMATORS
|
| 50 |
+
|
| 51 |
+
The score function estimator (SFE, Fu, 2006), also known as the REINFORCE (Williams, 1992) or likelihood-ratio estimator (Glynn, 1990), is based on the identity $\nabla _ { \phi } p _ { \phi } ( x ) = p _ { \phi } ( x ) \nabla _ { \phi } \log p _ { \phi } ( x )$ , which allows the gradient in Eq. 3 to be written as an expectation:
|
| 52 |
+
|
| 53 |
+
$$
|
| 54 |
+
\nabla _ { \phi } L ( \theta , \phi ) = \mathbb { E } _ { X \sim p _ { \phi } ( x ) } \left[ f _ { \theta } ( X ) \nabla _ { \phi } \log p _ { \phi } ( X ) \right] .
|
| 55 |
+
$$
|
| 56 |
+
|
| 57 |
+
Estimating this expectation using naive Monte Carlo gives the estimator
|
| 58 |
+
|
| 59 |
+
$$
|
| 60 |
+
\nabla _ { \phi } L ( \theta , \phi ) \simeq \frac { 1 } { S } \sum _ { s = 1 } ^ { S } f _ { \theta } ( X ^ { s } ) \nabla _ { \phi } \log p _ { \phi } ( X ^ { s } ) ,
|
| 61 |
+
$$
|
| 62 |
+
|
| 63 |
+
where $X ^ { s } \sim p _ { \phi } ( x )$ i.i.d. This is a very general estimator that is applicable whenever $\log p _ { \phi } ( x )$ is differentiable w.r.t. $\phi$ . As it does not require $f _ { \boldsymbol { \theta } } ( \boldsymbol { x } )$ to be differentiable or even continuous as a function of $x$ , the SFE can be used with both discrete and continuous random variables.
|
| 64 |
+
|
| 65 |
+
Though the basic version of the estimator can suffer from high variance, various variance reduction techniques can be used to make the estimator much more effective (Greensmith et al., 2004). Baselines are the most important and widely used of these techniques (Williams, 1992).
|
| 66 |
+
|
| 67 |
+
# 2.3 REPARAMETERIZATION TRICK
|
| 68 |
+
|
| 69 |
+
In many cases we can sample from $p _ { \phi } ( x )$ by first sampling $Z$ from some fixed distribution $q ( z )$ and then transforming the sample using some function $g _ { \phi } ( z )$ . For example, a sample from $\operatorname { N o r m a l } ( \mu , \sigma ^ { 2 } )$ can be obtained by sampling $Z$ from the standard form of the distribution $\mathrm { { N o r m a l } } ( 0 , 1 )$ and then transforming it using $g _ { \mu , \sigma } ( Z ) = \mu + \sigma Z$ . This two-stage reformulation of the sampling process, called the reparameterization trick, allows us to transfer the dependence on $\phi$ from $p$ into $f$ by writing $f _ { \theta } ( x ) = \bar { f } _ { \theta } ( g _ { \phi } ( z ) )$ for $x = g _ { \phi } ( z )$ , making it possible to reduce the problem of estimating the gradient w.r.t. parameters of a distribution to the simpler problem of estimating the gradient w.r.t. parameters of a deterministic function.
|
| 70 |
+
|
| 71 |
+
Having reparameterized $p _ { \phi } ( x )$ , we can now express the objective as an expectation w.r.t. $q ( z )$ :
|
| 72 |
+
|
| 73 |
+
$$
|
| 74 |
+
L ( \theta , \phi ) = \mathbb { E } _ { X \sim p _ { \phi } ( x ) } [ f _ { \theta } ( X ) ] = \mathbb { E } _ { Z \sim q ( z ) } [ f _ { \theta } ( g _ { \phi } ( Z ) ) ] .
|
| 75 |
+
$$
|
| 76 |
+
|
| 77 |
+
As $q ( z )$ does not depend on $\phi$ , we can estimate the gradient w.r.t. $\phi$ in exactly the same way we estimated the gradient w.r.t. $\theta$ in Eq. 1. Assuming differentiability of $f _ { \boldsymbol { \theta } } ( \boldsymbol { x } )$ w.r.t. $x$ and of $g _ { \phi } ( z )$ w.r.t. $\phi$ and using the chain rule gives
|
| 78 |
+
|
| 79 |
+
$$
|
| 80 |
+
\nabla _ { \phi } L ( \theta , \phi ) = \mathbb { E } _ { Z \sim q ( z ) } [ \nabla _ { \phi } f _ { \theta } ( g _ { \phi } ( Z ) ) ] = \mathbb { E } _ { Z \sim q ( z ) } \left[ f _ { \theta } ^ { \prime } ( g _ { \phi } ( Z ) ) \nabla _ { \phi } g _ { \phi } ( Z ) \right] .
|
| 81 |
+
$$
|
| 82 |
+
|
| 83 |
+
The reparameterization trick can be applied to many continuous random variables (Kingma & Welling, 2014) and is usually the estimator of choice when it is applicable. It is in large part responsible for the wide adoption of variational autoencoders and related models. Unfortunately, it cannot be applied to discrete latent variables or in cases for which $f$ is not differentiable.
|
| 84 |
+
|
| 85 |
+
# 2.4 APPLICATION: VARIATIONAL TRAINING OF LATENT VARIABLE MODELS
|
| 86 |
+
|
| 87 |
+
We will now see how the task of training latent variable models can be formulated in the SCG framework. Such models assume that each observation $x$ is obtained by first sampling a vector of latent variables $Z$ from the prior $p _ { \theta } ( z )$ before sampling the observation itself from $\bar { p } _ { \theta } ( x \mid z )$ . Thus the probability of observation $x$ is $\begin{array} { r } { \dot { p _ { \theta } } ( x ) = \sum _ { z } \bar { p _ { \theta } } ( \bar { z } ) p _ { \theta } ( x \mid z ) } \end{array}$ . Maximum likelihood training of such models is infeasible, because the log-likelihood (LL) objective $L ( \theta ) = \log p _ { \theta } ( x ) =$ $\log \mathbb { E } _ { Z \sim p _ { \theta } ( z ) } [ p _ { \theta } ( x \mid Z ) ]$ is typically intractable and does not fit into the above framework due to the expectation being inside the log. The multi-sample variational objective (Burda et al., 2016),
|
| 88 |
+
|
| 89 |
+
$$
|
| 90 |
+
\mathcal { L } _ { m } ( \theta , \phi ) = \underset { Z ^ { i } \sim q _ { \phi } ( z | x ) } { \mathbb { E } } \left[ \log \left( \frac { 1 } { m } \sum _ { i = 1 } ^ { m } \frac { p _ { \theta } ( Z ^ { i } , x ) } { q _ { \phi } ( Z ^ { i } \mid x ) } \right) \right] .
|
| 91 |
+
$$
|
| 92 |
+
|
| 93 |
+

|
| 94 |
+
Figure 1: Visualization of sampling graphs for 3-ary discrete $D \sim \mathrm { D i s c r e t e } ( \alpha )$ and 3-ary Concrete $X \sim \mathrm { C o n c r e t e } ( \alpha , \lambda )$ . White operations are deterministic, blue are stochastic, rounded are continuous, square discrete. The top node is an example state; brightness indicates a value in [0,1].
|
| 95 |
+
|
| 96 |
+
provides a convenient alternative which has precisely the form we considered in Section 2.1. This approach relies on introducing an auxiliary distribution $q _ { \phi } ( z \mid x )$ with its own parameters, which serves as approximation to the intractable posterior $p _ { \theta } ( z \mid x )$ . The model is trained by jointly maximizing the objective w.r.t. to the parameters of $p$ and $q$ . The number of samples used inside the objective $m$ allows trading off the computational cost against the tightness of the bound. For $m = 1$ , ${ \mathcal { L } } _ { m } ( \theta , \phi )$ becomes is the widely used evidence lower bound (ELBO, Hoffman et al., 2013) on $\log p _ { \theta } ( x )$ , while for $m > 1$ , it is known as the importance weighted bound (Burda et al., 2016).
|
| 97 |
+
|
| 98 |
+
The reparameterization trick, introduced in the context of variational inference independently by Kingma & Welling (2014), Rezende et al. (2014), and Titsias & Lazaro-Gredilla (2014), is the ´ method of choice for training variational autoencoders and related models with continuous latent variables. For models with discrete latent variables, the discontinuous nature of which makes reparameterization not useful, a number of score function estimators have been developed (Paisley et al., 2012; Gregor et al., 2013; Ranganath et al., 2014; Mnih & Gregor, 2014; Titsias & Lazaro-Gredilla, ´ 2015; Gu et al., 2016), which differ primarily in the variance reduction techniques used. Recently, new hybrid estimators have also been developed for continuous latent variables which are not directly reparameterizable, by combining partial reparameterizations with score function estimators (Ruiz et al., 2016; Naesseth et al., 2016).
|
| 99 |
+
|
| 100 |
+
# 3 THE CONCRETE DISTRIBUTION
|
| 101 |
+
|
| 102 |
+
# 3.1 DISCRETE RANDOM VARIABLES AND THE GUMBEL-MAX TRICK
|
| 103 |
+
|
| 104 |
+
To motivate the construction of Concrete random variables, we review a method for sampling from discrete distributions called the Gumbel-Max trick (Luce, 1959; Yellott, 1977; Papandreou & Yuille, 2011; Hazan & Jaakkola, 2012; Maddison et al., 2014). We restrict ourselves to a representation of discrete states as vectors $d \in \{ 0 , 1 \} ^ { n }$ of bits that are one-hot, or $\textstyle \sum _ { k = 1 } ^ { n } d _ { k } = 1$ . This is a flexible representation in a computation graph; to achieve an integral representation take the inner product of $d$ with $( 1 , \ldots , n )$ , and to achieve a point mass representation in $\mathbb { R } ^ { m }$ take $W d$ where $W \in \mathbf { \overline { { R } } } ^ { m \times n }$ .
|
| 105 |
+
|
| 106 |
+
Consider an unnormalized parameterization $( \alpha _ { 1 } , \ldots , \alpha _ { n } )$ where $\alpha _ { k } \in \mathsf { \Gamma } ( 0 , \infty )$ of a discrete distribution $D \sim \mathrm { D i s c r e t e } ( \alpha )$ — we can assume that states with 0 probability are excluded. The Gumbel-Max trick proceeds as follows: sample $U _ { k } \sim \mathrm { U n i f o r m } ( 0 , 1 )$ i.i.d. for each $k$ , find $k$ that maximizes $\{ \log \alpha _ { k } - \log ( - \log U _ { k } ) \}$ , set $D _ { k } = 1$ and the remaining $D _ { i } = 0$ for $i \neq k$ . Then
|
| 107 |
+
|
| 108 |
+
$$
|
| 109 |
+
\mathbb { P } ( D _ { k } = 1 ) = \frac { \alpha _ { k } } { \sum _ { i = 1 } ^ { n } \alpha _ { i } } .
|
| 110 |
+
$$
|
| 111 |
+
|
| 112 |
+
In other words, the sampling of a discrete random variable can be refactored into a deterministic function — componentwise addition followed by argmax — of the parameters $\log \alpha _ { k }$ and fixed distribution $- \log ( - \log U _ { k } )$ . See Figure 1a for a visualization.
|
| 113 |
+
|
| 114 |
+
The apparently arbitrary choice of noise gives the trick its name, $\mathrm { ~ } \ s - \log ( - \log U )$ has a Gumbel distribution. This distribution features in extreme value theory (Gumbel, 1954) where it plays a central role similar to the Normal distribution: the Gumbel distribution is stable under max operations, and for some distributions, the order statistics (suitably normalized) of i.i.d. draws approach the Gumbel in distribution. The Gumbel can also be recognized as a $- \log$ -transformed exponential random variable. So, the correctness of (9) also reduces to a well known result regarding the argmin of exponential random variables. See (Hazan et al., 2016) for a collection of related work, and particularly the chapter (Maddison, 2016) for a proof and generalization of this trick.
|
| 115 |
+
|
| 116 |
+

|
| 117 |
+
Figure 2: A discrete distribution with unnormalized probabilities $( \alpha _ { 1 } , \alpha _ { 2 } , \alpha _ { 3 } ) \ = \ ( 2 , 0 . 5 , 1 )$ and three corresponding Concrete densities at increasing temperatures $\lambda$ . Each triangle represents the set of points $( y _ { 1 } , y _ { 2 } , y _ { 3 } )$ in the simplex $\Delta ^ { 2 } = \{ ( y _ { 1 } , y _ { 2 } , y _ { 3 } ) ~ | ~ y _ { k } \in ( 0 , 1 ) , y _ { 1 } + y _ { 2 } ^ { - } + y _ { 3 } ^ { - } = 1 \}$ . For $\lambda = 0$ the size of white circles represents the mass assigned to each vertex of the simplex under the discrete distribution. For $\lambda \in \{ 2 , \bar { 1 } , 0 . 5 \}$ the intensity of the shading represents the value of $p _ { \alpha , \lambda } ( y )$ .
|
| 118 |
+
|
| 119 |
+
# 3.2 CONCRETE RANDOM VARIABLES
|
| 120 |
+
|
| 121 |
+
The derivative of the argmax is 0 everywhere except at the boundary of state changes, where it is undefined. For this reason the Gumbel-Max trick is not a suitable reparameterization for use in SCGs with AD. Here we introduce the Concrete distribution motivated by considering a graph, which is the same as Figure 1a up to a continuous relaxation of the argmax computation, see Figure 1b. This will ultimately allow the optimization of parameters $\alpha _ { k }$ via gradients.
|
| 122 |
+
|
| 123 |
+
The argmax computation returns states on the vertices of the simplex $\Delta ^ { n - 1 } = \{ x \in \mathbb { R } ^ { n } \mid x _ { k } \in $ $[ 0 , 1 ] , { \overset { \vartriangle } { \sum } } _ { k = 1 } ^ { n } x _ { k } = { \overset { \vartriangle } { 1 } } \}$ . The idea behind Concrete random variables is to relax the state of a discrete variable from the vertices into the interior where it is a random probability vector—a vector of numbers between 0 and 1 that sum to 1. To sample a Concrete random variable $X \in \Delta ^ { n - 1 }$ at temperature $\lambda \in ( 0 , \infty )$ with parameters $\alpha _ { k } \in ( 0 , \infty )$ , sample $G _ { k } \sim$ Gumbel i.i.d. and set
|
| 124 |
+
|
| 125 |
+
$$
|
| 126 |
+
X _ { k } = \frac { \exp ( ( \log \alpha _ { k } + G _ { k } ) / \lambda ) } { \sum _ { i = 1 } ^ { n } \exp ( ( \log \alpha _ { i } + G _ { i } ) / \lambda ) } .
|
| 127 |
+
$$
|
| 128 |
+
|
| 129 |
+
The softmax computation of (10) smoothly approaches the discrete argmax computation as $\lambda 0$ while preserving the relative order of the Gumbels $\log \alpha _ { k } + G _ { k }$ . So, imagine making a series of forward passes on the graphs of Figure 1. Both graphs return a stochastic value for each forward pass, but for smaller temperatures the outputs of Figure 1b become more discrete and eventually indistinguishable from a typical forward pass of Figure 1a.
|
| 130 |
+
|
| 131 |
+
The distribution of $X$ sampled via (10) has a closed form density on the simplex. Because there may be other ways to sample a Concrete random variable, we take the density to be its definition.
|
| 132 |
+
|
| 133 |
+
Definition 1 (Concrete Random Variables). Let $\alpha \in ( 0 , \infty ) ^ { n }$ and $\lambda \in ( 0 , \infty )$ . $X \in \Delta ^ { n - 1 }$ has a Concrete distribution $X \sim \operatorname { C o n c r e t e } ( \alpha , \lambda )$ with location $\alpha$ and temperature $\lambda$ , if its density is:
|
| 134 |
+
|
| 135 |
+
$$
|
| 136 |
+
p _ { \alpha , \lambda } ( x ) = ( n - 1 ) ! \lambda ^ { n - 1 } \prod _ { k = 1 } ^ { n } \left( \frac { \alpha _ { k } x _ { k } ^ { - \lambda - 1 } } { \sum _ { i = 1 } ^ { n } \alpha _ { i } x _ { i } ^ { - \lambda } } \right) .
|
| 137 |
+
$$
|
| 138 |
+
|
| 139 |
+
Proposition 1 lists a few properties of the Concrete distribution. (a) is confirmation that our definition corresponds to the sampling routine (10). (b) confirms that rounding a Concrete random variable results in the discrete random variable whose distribution is described by the logits $\log \alpha _ { k }$ , (c) confirms that taking the zero temperature limit of a Concrete random variable is the same as rounding. Finally, (d) is a convexity result on the density. We prove these results in Appendix A.
|
| 140 |
+
|
| 141 |
+
Proposition 1 (Some Properties of Concrete Random Variables). Let $X \sim \mathrm { C o n c r e t e } ( \alpha , \lambda )$ with location parameters $\alpha \in ( 0 , \infty ) ^ { n }$ and temperature $\lambda \in ( 0 , \infty )$ , then
|
| 142 |
+
|
| 143 |
+
(a) (Reparameterization) If $G _ { k } \sim$ Gumbel i.i.d., then $\begin{array} { r } { X _ { k } \overset { d } { = } \frac { \exp ( ( \log \alpha _ { k } + G _ { k } ) / \lambda ) } { \sum _ { i = 1 } ^ { n } \exp ( ( \log \alpha _ { i } + G _ { i } ) / \lambda ) } } \end{array}$ , $\begin{array} { r } { \mathrm { ( ) } \ \left( R o u n d i n g \right) \mathbb { P } \left( X _ { k } > X _ { i } \ f o r \ i \neq k \right) = \alpha _ { k } / ( \sum _ { i = 1 } ^ { n } \alpha _ { i } ) , } \end{array}$ (c) (Zero temperature) $\begin{array} { r } { \mathbb { P } ( \operatorname* { l i m } _ { \lambda 0 } X _ { k } = 1 ) = \alpha _ { k } / ( \sum _ { i = 1 } ^ { n } \alpha _ { i } ) , } \end{array}$ (d) (Convex eventually) If $\lambda \le ( n - 1 ) ^ { - 1 }$ , then $p _ { \alpha , \lambda } ( x )$ is log-convex in $x$ .
|
| 144 |
+
|
| 145 |
+

|
| 146 |
+
Figure 3: A visualization of the binary special case. (a) shows the discrete trick, which works by passing a noisy logit through the unit step function. (b), (c), (d) show Concrete relaxations; the horizontal blue densities show the density of the input distribution and the vertical densities show the corresponding Binary Concrete density on $( 0 , 1 )$ for varying $\lambda$ .
|
| 147 |
+
|
| 148 |
+
The binary case of the Gumbel-Max trick simplifies to passing additive noise through a step function. The corresponding Concrete relaxation is implemented by passing additive noise through a sigmoid—see Figure 3. We cover this more thoroughly in Appendix B, along with a cheat sheet (Appendix F) on the density and implementation of all the random variables discussed in this work.
|
| 149 |
+
|
| 150 |
+
# 3.3 CONCRETE RELAXATIONS
|
| 151 |
+
|
| 152 |
+
Concrete random variables may have some intrinsic value, but we investigate them simply as surrogates for optimizing a SCG with discrete nodes. When it is computationally feasible to integrate over the discreteness, that will always be a better choice. Thus, we consider the use case of optimizing a large graph with discrete stochastic nodes from samples. Here we outline some considerations when using Concrete relaxations and when we expect it to work.
|
| 153 |
+
|
| 154 |
+
The basic paradigm we propose is the following: during training replace every discrete node with a Concrete stochastic node at some fixed temperature (or with an annealing schedule). When an objective depends on the log-probability of discrete variables in the SCG, as the variational lowerbound does, we propose that the log-probability terms are also “relaxed” to represent the true distribution of the relaxed node. By ensuring that the log-probability terms for the latent variables match their sampling distribution, this preserves the property that the variational objective bounds the log-probability of the observed data. Note that this is possible, because the Concrete-discrete pairing satisfies this valuable property: the discretization of any Concrete distribution has a closed form mass function, and the relaxation of any discrete distribution into a Concrete distribution has a closed form density. It is generally easy to go from a continuous process to a discrete one by quantizing and backwards by relaxing, but maintaining analytic tractability both ways is not always possible. For example, there is no closed form for the mass function of the multinomial probit model — the Gumbel-Max trick but with Gaussians replacing Gumbels. We cover all of these suggestions for a simple variational autoencoder with discrete units example in Appendix C.
|
| 155 |
+
|
| 156 |
+
Because the graphs are identical up to the softmax / argmax computations, the parameters of the relaxed graph and discrete graph are the same. The random states of the Concrete relaxation approach the corresponding discrete random states almost surely in the zero-temperature limit, Proposition 1 (c). Still, the success of Concrete relaxations will depend on the choice of temperature during training. It is important that the relaxed nodes are not able to represent a precise real valued mode in the interior of the simplex as in Figure 2d. If this is the case, it is possible for the relaxed random variable to communicate much more than $\log _ { 2 } ( n )$ bits of information about its $\alpha$ parameters. This might lead the relaxation to prefer the interior of the simplex to the vertices, and as a result there will be a large integrality gap in the overall performance of the discrete graph. Therefore Proposition 1 (d) is a conservative guideline for generic $n$ -ary Concrete relaxations; at temperatures lower than $( n - 1 ) ^ { - 1 }$ we are guaranteed not to have any modes in the interior for any $\alpha \in ( 0 , \infty ) ^ { n }$ . We discuss the subtleties of choosing the temperature in more detail in Appendix C. Ultimately the best choice of $\lambda$ and the performance of the relaxation for any specific $n$ will be an empirical question.
|
| 157 |
+
|
| 158 |
+
# 4 RELATED WORK
|
| 159 |
+
|
| 160 |
+
Perhaps the most common distribution over the simplex is the Dirichlet with density $p _ { \alpha } ( x ) \ \propto$ $\scriptstyle \prod _ { k = 1 } ^ { n } x _ { k } ^ { \alpha _ { k } - 1 }$ on $x \in \Delta ^ { n - 1 }$ . The Dirichlet can be characterized by strong independence properties, and a great deal of work has been done to generalize it (Connor & Mosimann, 1969; Aitchison, 1985; Rayens & Srinivasan, 1994; Favaro et al., 2011). Of note is the logistic Normal distribution (Atchison & Shen, 1980), which can be simulated by taking the softmax of $n - 1$ normal random variables and an nth logit that is deterministically zero. The logistic Normal is an important distribution, because it can effectively model correlations within the simplex (Blei & Lafferty, 2006). To our knowledge the Concrete distribution does not fall completely into any family of distributions previously described. For $\lambda \leq 1$ the Concrete is in a class of normalized infinitely divisible distributions (S. Favaro, personal communication), and the results of Favaro et al. (2011) apply.
|
| 161 |
+
|
| 162 |
+
The idea of using a softmax of Gumbels as a relaxation for a discrete random variable was concurrently considered by (Jang et al., 2016), where it was called the Gumbel-Softmax. They do not use the density in the relaxed objective, opting instead to compute all aspects of the graph, including discrete log-probability computations, with the relaxed stochastic state of the graph. In the case of variational inference, this relaxed objective is not a lower bound on the marginal likelihood of the observations, and care needs to be taken when optimizing it. The idea of using sigmoidal functions with additive input noise to approximate discreteness is also not a new idea. (Frey, 1997) introduced nonlinear Gaussian units which computed their activation by passing Gaussian noise with the mean and variance specified by the input to the unit through a nonlinearity, such as the logistic function. Salakhutdinov & Hinton (2009) binarized real-valued codes of an autoencoder by adding (Gaussian) noise to the logits before passing them through the logistic function. Most recently, to avoid the difficulty associated with likelihood-ratio methods (Kocisk ˇ y et al., 2016) relaxed the discrete sampling ´ operation by sampling a vector of Gaussians instead and passing those through a softmax.
|
| 163 |
+
|
| 164 |
+
There is another family of gradient estimators that have been studied in the context of training neural networks with discrete units. These are usually collected under the umbrella of straightthrough estimators (Bengio et al., 2013; Raiko et al., 2014). The basic idea they use is passing forward discrete values, but taking gradients through the expected value. They have good empirical performance, but have not been shown to be the estimators of any loss function. This is in contrast to gradients from Concrete relaxations, which are biased with respect to the discrete graph, but unbiased with respect to the continuous one.
|
| 165 |
+
|
| 166 |
+
# 5 EXPERIMENTS
|
| 167 |
+
|
| 168 |
+
# 5.1 PROTOCOL
|
| 169 |
+
|
| 170 |
+
The aim of our experiments was to evaluate the effectiveness of the gradients of Concrete relaxations for optimizing SCGs with discrete nodes. We considered the tasks in (Mnih & Rezende, 2016): structured output prediction and density estimation. Both tasks are difficult optimization problems involving fitting probability distributions with hundreds of latent discrete nodes. We compared the performance of Concrete reparameterizations to two state-of-the-art score function estimators: VIMCO (Mnih & Rezende, 2016) for optimizing the multisample variational objective $( m > 1$ ) and NVIL (Mnih & Gregor, 2014) for optimizing the single-sample one $\mathbf { \Phi } _ { m } = 1 \mathbf { \Phi } _ { \mathbf { \Phi } _ { \mathbf { \Lambda } } }$ ). We performed the experiments using the MNIST and Omniglot datasets. These are datasets of $2 8 \times 2 8$ images of handwritten digits (MNIST) or letters (Omniglot). For MNIST we used the fixed binarization of Salakhutdinov & Murray (2008) and the standard $5 0 , 0 0 0 / 1 0 , 0 0 0 / 1 0 , 0 0 0$ split into training/validation/testing sets. For Omniglot we sampled a fixed binarization and used the standard 24,345/8,070 split into training/testing sets. We report the negative log-likelihood (NLL) of the discrete graph on the test data as the performance metric.
|
| 171 |
+
|
| 172 |
+
All of our models were neural networks with layers of $n$ -ary discrete stochastic nodes with values on the corners of the hypercube $\{ - 1 , 1 \} ^ { \log _ { 2 } ( n ) }$ . The distributions were parameterized by $n$ real values $\log \alpha _ { k } \in \mathbb { R }$ , which we took to be the logits of a discrete random variable $D \sim \mathrm { D i s c r e t e } ( \alpha )$ with $n$ states. Model descriptions are of the form “ $( 2 0 0 \mathrm { V } { - } 2 0 0 \mathrm { H } { \sim } 7 8 4 \mathrm { V } ) ^ { \cdot }$ , read from left to right. This describes the order of conditional sampling, again from left to right, with each integer representing the number of stochastic units in a layer. The letters $\mathrm { v }$ and $_ \mathrm { H }$ represent observed and latent
|
| 173 |
+
|
| 174 |
+
MNIST NLL
|
| 175 |
+
Omniglot NLL
|
| 176 |
+
|
| 177 |
+
<table><tr><td rowspan="2">binary model</td><td rowspan="2"></td><td colspan="2">Test</td><td colspan="2">Train</td><td colspan="2">Test</td><td colspan="2">Train</td></tr><tr><td>Concrete</td><td>VIMCO</td><td>Concrete</td><td>VIMCO</td><td>Concrete</td><td>VIMCO</td><td>Concrete</td><td>VIMCO</td></tr><tr><td>(200H</td><td>1</td><td>107.3</td><td>104.4</td><td>107.5</td><td>104.2</td><td>118.7</td><td>115.7</td><td>117.0</td><td>112.2</td></tr><tr><td>- 784V)</td><td>5</td><td>104.9</td><td>101.9</td><td>104.9</td><td>101.5</td><td>118.0</td><td>113.5</td><td>115.8</td><td>110.8</td></tr><tr><td></td><td>50</td><td>104.3</td><td>98.8</td><td>104.2</td><td>98.3</td><td>118.9</td><td>113.0</td><td>115.8</td><td>110.0</td></tr><tr><td>(200H</td><td>1</td><td>102.1</td><td>92.9</td><td>102.3</td><td>91.7</td><td>116.3</td><td>109.2</td><td>114.4</td><td>104.8</td></tr><tr><td>-200H</td><td>5</td><td>99.9</td><td>91.7</td><td>100.0</td><td>90.8</td><td>116.0</td><td>107.5</td><td>113.5</td><td>103.6</td></tr><tr><td>- 784V)</td><td>50</td><td>99.5</td><td>90.7</td><td>99.4</td><td>89.7</td><td>117.0</td><td>108.1</td><td>113.9</td><td>103.6</td></tr><tr><td>(200H</td><td>1</td><td>92.1</td><td>93.8</td><td>91.2</td><td>91.5</td><td>108.4</td><td>116.4</td><td>103.6</td><td>110.3</td></tr><tr><td>~784V)</td><td>5</td><td>89.5</td><td>91.4</td><td>88.1</td><td>88.6</td><td>107.5</td><td>118.2</td><td>101.4</td><td>102.3</td></tr><tr><td></td><td>50</td><td>88.5</td><td>89.3</td><td>86.4</td><td>86.5</td><td>108.1</td><td>116.0</td><td>100.5</td><td>100.8</td></tr><tr><td>(200H</td><td>1</td><td>87.9</td><td>88.4</td><td>86.5</td><td>85.8</td><td>105.9</td><td>111.7</td><td>100.2</td><td>105.7</td></tr><tr><td>~200H</td><td>5</td><td>86.3</td><td>86.4</td><td>84.1</td><td>82.5</td><td>105.8</td><td>108.2</td><td>98.6</td><td>101.1</td></tr><tr><td>~784V) 50</td><td></td><td>85.7</td><td>85.5</td><td>83.1</td><td>81.8</td><td>106.8</td><td>113.2</td><td>97.5</td><td>95.2</td></tr></table>
|
| 178 |
+
|
| 179 |
+
Table 1: Density estimation with binary latent variables. When $m = 1$ , VIMCO stands for NVIL.
|
| 180 |
+
|
| 181 |
+
variables, respectively. If the leftmost layer is H, then it was sampled unconditionally from some parameters. Conditioning functions are described by $\{ - , \sim \}$ , where “–” means a linear function of the previous layer and $^ { \mathfrak { s } } \sim ^ { \mathfrak { s } }$ means a non-linear function. A “layer” of these units is simply the concatenation of some number of independent nodes whose parameters are determined as a function the previous layer. For example a 240 binary layer is a factored distribution over the $\{ - 1 , 1 \} ^ { 2 4 0 }$ hypercube. Whereas a 240 8-ary layer can be seen as a distribution over the same hypercube where each of the 80 triples of units are sampled independently from an 8 way discrete distribution over $\{ - 1 , 1 \} ^ { 3 }$ . All models were initialized with the heuristic of Glorot & Bengio (2010) and optimized using Adam (Kingma & Ba, 2014). All temperatures were fixed throughout training. Appendix D for hyperparameter details.
|
| 182 |
+
|
| 183 |
+
# 5.2 DENSITY ESTIMATION
|
| 184 |
+
|
| 185 |
+
Density estimation, or generative modelling, is the problem of fitting the distribution of data. We took the latent variable approach described in Section 2.4 and trained the models by optimizing the variational objective ${ \mathcal { L } } _ { m } ( \theta , \phi )$ given by Eq. 8 averaged uniformly over minibatches of data points $x$ . Both our generative models $p _ { \theta } ( z , \ x )$ and variational distributions $q _ { \phi } ( z \mid x )$ were parameterized with neural networks as described above. We trained models with ${ \mathcal { L } } _ { m } ( \theta , \phi )$ for $m \in \mathsf { \bar { \{ 1 , 5 , 5 0 \} } }$ and approximated the NLL with $\mathcal { L } _ { 5 0 , 0 0 0 } ( \theta , \phi )$ averaged uniformly over the whole dataset.
|
| 186 |
+
|
| 187 |
+
The results are shown in Table 1. In general, VIMCO outperformed Concrete relaxations for linear models and Concrete relaxations outperformed VIMCO for non-linear models. We also tested the effectiveness of Concrete relaxations on generative models with $n$ -ary layers on the ${ \mathcal { L } } _ { 5 } ( \theta , \phi )$ objective. The best 4-ary model achieved test/train NLL 86.7/83.3, the best 8-ary achieved 87.4/84.6 with Concrete relaxations, more complete results in Appendix E. The relatively poor performance of the 8-ary model may be because moving from 4 to 8 results in a more difficult objective without much added capacity. As a control we trained $n$ -ary models using logistic normals as relaxations of discrete distributions (with retuned temperature hyperparameters). Because the discrete zero temperature limit of logistic Normals is a multinomial probit whose mass function is not known, we evaluated the discrete model by sampling from the discrete distribution parameterized by the logits learned during training. The best 4-ary model achieved test/train NLL of 88.7/85.0, the best 8-ary model achieved 89.1/85.1.
|
| 188 |
+
|
| 189 |
+
# 5.3 STRUCTURED OUTPUT PREDICTION
|
| 190 |
+
|
| 191 |
+
Structured output prediction is concerned with modelling the high-dimensional distribution of the observation given a context and can be seen as conditional density estimation. We considered the task of predicting the bottom half $x _ { 1 }$ of an image of an MNIST digit given its top half $x _ { 2 }$ , as introduced by Raiko et al. (2014). We followed Raiko et al. (2014) in using a model with layers of discrete stochastic units between the context and the observation. Conditioned on the top half $x _ { 2 }$ the network samples from a distribution $p _ { \phi } ( z \mid x _ { 2 } )$ over layers of stochastic units $z$ then predicts $x _ { 1 }$ by sampling from a distribution $p _ { \theta } ( x _ { 1 } \mid z )$ . The training objective for a single pair $( x _ { 1 } , x _ { 2 } )$ is
|
| 192 |
+
|
| 193 |
+
<table><tr><td>binary model</td><td></td><td>Test NLL</td><td></td><td>Train NLL</td></tr><tr><td rowspan="3">(392V-240H -240H-392V)</td><td>m 1</td><td>Concrete</td><td>VIMCO Concrete</td><td>VIMCO 59.3</td></tr><tr><td>5</td><td>58.5 54.3</td><td>61.4 54.5</td><td>54.2 49.2 52.7</td></tr><tr><td>50</td><td>53.4</td><td>51.8</td><td>48.2 49.6</td></tr><tr><td rowspan="2">(392V-240H -240H-240H</td><td>1</td><td>56.3</td><td>59.7</td><td>51.6 58.4</td></tr><tr><td>5</td><td>52.7</td><td>53.5</td><td>46.9 51.6</td></tr><tr><td>-392V)</td><td>50</td><td>52.0</td><td>50.2 45.9</td><td>47.9</td></tr></table>
|
| 194 |
+
|
| 195 |
+

|
| 196 |
+
Figure 4: Results for structured prediction on MNIST comparing Concrete relaxations to VIMCO. When $m = 1$ VIMCO stands for NVIL. The plot on the right shows the objective (lower is better) for the continuous and discrete graph trained at temperatures $\lambda$ . In the shaded region, units prefer to communicate real values in the interior of $( - 1 , 1 )$ and the discretization suffers an integrality gap.
|
| 197 |
+
|
| 198 |
+
$$
|
| 199 |
+
\mathcal { L } _ { m } ^ { S P } ( \theta , \phi ) = \underset { Z _ { i } \sim p _ { \phi } ( z | x _ { 2 } ) } { \mathbb { E } } \left[ \log \left( \frac { 1 } { m } \sum _ { i = 1 } ^ { m } p _ { \theta } ( x _ { 1 } \mid Z _ { i } ) \right) \right] .
|
| 200 |
+
$$
|
| 201 |
+
|
| 202 |
+
This objective is a special case of ${ \mathcal { L } } _ { m } ( \theta , \phi )$ (Eq. 8) where we use the prior $p _ { \phi } ( z | x _ { 2 } )$ as the variational distribution. Thus, the objective is a lower bound on $\log p _ { \theta , \phi } ( x _ { 1 } \mid x _ { 2 } )$ .
|
| 203 |
+
|
| 204 |
+
We trained the models by optimizing $\mathcal { L } _ { m } ^ { S P } ( \theta , \phi )$ for $m \in \{ 1 , 5 , 5 0 \}$ averaged uniformly over minibatches and evaluated them by computing $\mathcal { L } _ { 1 0 0 } ^ { S P } ( \theta , \phi )$ averaged uniformly over the entire dataset. The results are shown in Figure 4. Concrete relaxations more uniformly outperformed VIMCO in this instance. We also trained $n$ -ary (392V–240H–240H–240H–392V) models on the $\mathcal { L } _ { 1 } ^ { S P } ( \theta , \phi )$ objective using the best temperature hyperparameters from density estimation. 4-ary achieved a test/train NLL of $5 5 . 4 / 4 6 . 0$ and 8-ary achieved 54.7/44.8. As opposed to density estimation, increasing arity uniformly improved the models. We also investigated the hypothesis that for higher temperatures Concrete relaxations might prefer the interior of the interval to the boundary points $\{ - 1 , 1 \bar { \} }$ . Figure 4 was generated with binary (392V–240H–240H–240H–392V) model trained on $\mathcal { L } _ { 1 } ^ { S P } ( \theta , \phi )$ .
|
| 205 |
+
|
| 206 |
+
# 6 CONCLUSION
|
| 207 |
+
|
| 208 |
+
We introduced the Concrete distribution, a continuous relaxation of discrete random variables. The Concrete distribution is a new distribution on the simplex with a closed form density parameterized by a vector of positive location parameters and a positive temperature. Crucially, the zero temperature limit of every Concrete distribution corresponds to a discrete distribution, and any discrete distribution can be seen as the discretization of a Concrete one. The application we considered was training stochastic computation graphs with discrete stochastic nodes. The gradients of Concrete relaxations are biased with respect to the original discrete objective, but they are low variance unbiased estimators of a continuous surrogate objective. We showed in a series of experiments that stochastic nodes with Concrete distributions can be used effectively to optimize the parameters of a stochastic computation graph with discrete stochastic nodes. We did not find that annealing or automatically tuning the temperature was important for these experiments, but it remains interesting and possibly valuable future work.
|
| 209 |
+
|
| 210 |
+
# ACKNOWLEDGMENTS
|
| 211 |
+
|
| 212 |
+
We thank Jimmy Ba for the excitement and ideas in the early days, Stefano Favarro for some analysis of the distribution. We also thank Gabriel Barth-Maron and Roger Grosse.
|
| 213 |
+
|
| 214 |
+
# REFERENCES
|
| 215 |
+
|
| 216 |
+
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
|
| 217 |
+
|
| 218 |
+
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. URL http://tensorflow.org/. Software available from tensorflow.org.
|
| 219 |
+
J Aitchison. A general class of distributions on the simplex. Journal of the Royal Statistical Society. Series B (Methodological), pp. 136–146, 1985.
|
| 220 |
+
J Atchison and Sheng M Shen. Logistic-normal distributions: Some properties and uses. Biometrika, 67(2):261–272, 1980.
|
| 221 |
+
Yoshua Bengio, Nicholas Leonard, and Aaron Courville. Estimating or propagating gradients ´ through stochastic neurons for conditional computation. arXiv preprint arXiv:1308.3432, 2013.
|
| 222 |
+
David Blei and John Lafferty. Correlated topic models. 2006.
|
| 223 |
+
Yuri Burda, Roger Grosse, and Ruslan Salakhutdinov. Importance weighted autoencoders. ICLR, 2016.
|
| 224 |
+
Robert J Connor and James E Mosimann. Concepts of independence for proportions with a generalization of the dirichlet distribution. Journal of the American Statistical Association, 64(325): 194–206, 1969.
|
| 225 |
+
Stefano Favaro, Georgia Hadjicharalambous, and Igor Prunster. On a class of distributions on the ¨ simplex. Journal of Statistical Planning and Inference, 141(9):2987 – 3004, 2011.
|
| 226 |
+
Brendan Frey. Continuous sigmoidal belief networks trained using slice sampling. In NIPS, 1997.
|
| 227 |
+
Michael C Fu. Gradient estimation. Handbooks in operations research and management science, 13:575–616, 2006.
|
| 228 |
+
Xavier Glorot and Yoshua Bengio. Understanding the difficulty of training deep feedforward neural networks. In Aistats, volume 9, pp. 249–256, 2010.
|
| 229 |
+
Peter W Glynn. Likelihood ratio gradient estimation for stochastic systems. Communications of the ACM, 33(10):75–84, 1990.
|
| 230 |
+
Alex Graves, Greg Wayne, Malcolm Reynolds, Tim Harley, Ivo Danihelka, Agnieszka GrabskaBarwinska, Sergio G ´ omez Colmenarejo, Edward Grefenstette, Tiago Ramalho, John Agapiou, ´ et al. Hybrid computing using a neural network with dynamic external memory. Nature, 538 (7626):471–476, 2016.
|
| 231 |
+
Evan Greensmith, Peter L. Bartlett, and Jonathan Baxter. Variance reduction techniques for gradient estimates in reinforcement learning. JMLR, 5, 2004.
|
| 232 |
+
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.
|
| 233 |
+
Karol Gregor, Ivo Danihelka, Andriy Mnih, Charles Blundell, and Daan Wierstra. Deep autoregressive networks. arXiv preprint arXiv:1310.8499, 2013.
|
| 234 |
+
Karol Gregor, Ivo Danihelka, Alex Graves, Danilo Jimenez Rezende, and Daan Wierstra. Draw: A recurrent neural network for image generation. arXiv preprint arXiv:1502.04623, 2015.
|
| 235 |
+
Shixiang Gu, Sergey Levine, Ilya Sutskever, and Andriy Mnih. MuProp: Unbiased backpropagation for stochastic neural networks. ICLR, 2016.
|
| 236 |
+
Emil Julius Gumbel. Statistical theory of extreme values and some practical applications: a series of lectures. Number 33. US Govt. Print. Office, 1954.
|
| 237 |
+
Tamir Hazan and Tommi Jaakkola. On the partition function and random maximum a-posteriori perturbations. In ICML, 2012.
|
| 238 |
+
Tamir Hazan, George Papandreou, and Daniel Tarlow. Perturbation, Optimization, and Statistics. MIT Press, 2016.
|
| 239 |
+
Matthew D Hoffman, David M Blei, Chong Wang, and John William Paisley. Stochastic variational inference. JMLR, 14(1):1303–1347, 2013.
|
| 240 |
+
E. Jang, S. Gu, and B. Poole. Categorical Reparameterization with Gumbel-Softmax. ArXiv e-prints, November 2016.
|
| 241 |
+
Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
|
| 242 |
+
Diederik P Kingma and Max Welling. Auto-encoding variational bayes. arXiv preprint arXiv:1312.6114, 2013.
|
| 243 |
+
Diederik P Kingma and Max Welling. Auto-encoding variational bayes. ICLR, 2014.
|
| 244 |
+
Toma´s Ko ˇ cisk ˇ y, G ´ abor Melis, Edward Grefenstette, Chris Dyer, Wang Ling, Phil Blunsom, and ´ Karl Moritz Hermann. Semantic parsing with semi-supervised sequential autoencoders. In EMNLP, 2016.
|
| 245 |
+
R. Duncan Luce. Individual Choice Behavior: A Theoretical Analysis. New York: Wiley, 1959.
|
| 246 |
+
Chris J Maddison. A Poisson process model for Monte Carlo. In Tamir Hazan, George Papandreou, and Daniel Tarlow (eds.), Perturbation, Optimization, and Statistics, chapter 7. MIT Press, 2016.
|
| 247 |
+
Chris J Maddison, Daniel Tarlow, and Tom Minka. $\mathbf { A } ^ { * }$ Sampling. In NIPS, 2014.
|
| 248 |
+
Andriy Mnih and Karol Gregor. Neural variational inference and learning in belief networks. In ICML, 2014.
|
| 249 |
+
Andriy Mnih and Danilo Jimenez Rezende. Variational inference for monte carlo objectives. In ICML, 2016.
|
| 250 |
+
Volodymyr Mnih, Nicolas Heess, Alex Graves, and koray kavukcuoglu. Recurrent Models of Visual Attention. In NIPS, 2014.
|
| 251 |
+
Christian A Naesseth, Francisco JR Ruiz, Scott W Linderman, and David M Blei. Rejection sampling variational inference. arXiv preprint arXiv:1610.05683, 2016.
|
| 252 |
+
John William Paisley, David M. Blei, and Michael I. Jordan. Variational bayesian inference with stochastic search. In ICML, 2012.
|
| 253 |
+
George Papandreou and Alan L Yuille. Perturb-and-map random fields: Using discrete optimization to learn and sample from energy models. In ICCV, 2011.
|
| 254 |
+
Tapani Raiko, Mathias Berglund, Guillaume Alain, and Laurent Dinh. Techniques for learning binary stochastic feedforward neural networks. arXiv preprint arXiv:1406.2989, 2014.
|
| 255 |
+
Rajesh Ranganath, Sean Gerrish, and David M. Blei. Black box variational inference. In AISTATS, 2014.
|
| 256 |
+
William S Rayens and Cidambi Srinivasan. Dependence properties of generalized liouville distributions on the simplex. Journal of the American Statistical Association, 89(428):1465–1470, 1994.
|
| 257 |
+
Danilo Jimenez Rezende, Shakir Mohamed, and Daan Wierstra. Stochastic backpropagation and approximate inference in deep generative models. In ICML, 2014.
|
| 258 |
+
Francisco JR Ruiz, Michalis K Titsias, and David M Blei. The generalized reparameterization gradient. arXiv preprint arXiv:1610.02287, 2016.
|
| 259 |
+
Ruslan Salakhutdinov and Geoffrey Hinton. Semantic hashing. International Journal of Approximate Reasoning, 50(7):969–978, 2009.
|
| 260 |
+
Ruslan Salakhutdinov and Iain Murray. On the quantitative analysis of deep belief networks. In ICML, 2008.
|
| 261 |
+
John Schulman, Nicolas Heess, Theophane Weber, and Pieter Abbeel. Gradient estimation using stochastic computation graphs. In NIPS, 2015.
|
| 262 |
+
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.
|
| 263 |
+
Michalis Titsias and Miguel Lazaro-Gredilla. Doubly stochastic variational bayes for non-conjugate ´ inference. In Tony Jebara and Eric P. Xing (eds.), ICML, 2014.
|
| 264 |
+
Michalis Titsias and Miguel Lazaro-Gredilla. Local expectation gradients for black box variational ´ inference. In NIPS, 2015.
|
| 265 |
+
Ronald J Williams. Simple statistical gradient-following algorithms for connectionist reinforcement learning. Machine learning, 8(3-4):229–256, 1992.
|
| 266 |
+
Kelvin Xu, Jimmy Ba, Ryan Kiros, Kyunghyun Cho, Aaron Courville, Ruslan Salakhudinov, Rich Zemel, and Yoshua Bengio. Show, attend and tell: Neural image caption generation with visual attention. In ICML, 2015.
|
| 267 |
+
|
| 268 |
+
John I Yellott. The relationship between luce’s choice axiom, thurstone’s theory of comparative judgment, and the double exponential distribution. Journal of Mathematical Psychology, 15(2): 109–144, 1977.
|
| 269 |
+
|
| 270 |
+
# A PROOF OF PROPOSITION 1
|
| 271 |
+
|
| 272 |
+
Let $X \sim \operatorname { C o n c r e t e } ( \alpha , \lambda )$ with location parameters $\alpha \in ( 0 , \infty ) ^ { n }$ and temperature $\lambda \in ( 0 , \infty )$ .
|
| 273 |
+
|
| 274 |
+
1. Let $G _ { k } \sim$ Gumbel i.i.d., consider
|
| 275 |
+
|
| 276 |
+
$$
|
| 277 |
+
Y _ { k } = \frac { \exp ( ( \log { \alpha _ { k } } + G _ { k } ) / \lambda ) } { \sum _ { i = 1 } ^ { n } \exp ( ( \log { \alpha _ { i } } + G _ { i } ) / \lambda ) }
|
| 278 |
+
$$
|
| 279 |
+
|
| 280 |
+
Let $Z _ { k } = \log \alpha _ { k } + G _ { k }$ , which has density
|
| 281 |
+
|
| 282 |
+
$$
|
| 283 |
+
\alpha _ { k } \exp ( - z _ { k } ) \exp ( - \alpha _ { k } \exp ( - z _ { k } ) )
|
| 284 |
+
$$
|
| 285 |
+
|
| 286 |
+
We will consider the invertible transformation
|
| 287 |
+
|
| 288 |
+
$$
|
| 289 |
+
F ( z _ { 1 } , \dots , z _ { n } ) = ( y _ { 1 } , \dots , y _ { n - 1 } , c )
|
| 290 |
+
$$
|
| 291 |
+
|
| 292 |
+
where
|
| 293 |
+
|
| 294 |
+
$$
|
| 295 |
+
\begin{array} { r } { y _ { k } = \exp ( z _ { k } / \lambda ) c ^ { - 1 } } \\ { c = \displaystyle \sum _ { i = 1 } ^ { n } \exp ( z _ { i } / \lambda ) } \end{array}
|
| 296 |
+
$$
|
| 297 |
+
|
| 298 |
+
then
|
| 299 |
+
|
| 300 |
+
$$
|
| 301 |
+
F ^ { - 1 } ( y _ { 1 } , \dots , y _ { n - 1 } , c ) = ( \lambda ( \log y _ { 1 } + \log c ) , \dots , \lambda ( \log y _ { n - 1 } + \log c ) , \lambda ( \log y _ { n } + \log c ) )
|
| 302 |
+
$$
|
| 303 |
+
|
| 304 |
+
where $\begin{array} { r } { y _ { n } = 1 - \sum _ { i = 1 } ^ { n - 1 } y _ { i } } \end{array}$ . This has Jacobian
|
| 305 |
+
|
| 306 |
+
$$
|
| 307 |
+
\left[ \begin{array} { c c c c c c c } { { \lambda y _ { 1 } ^ { - 1 } } } & { { 0 } } & { { 0 } } & { { 0 } } & { { . . . } } & { { 0 } } & { { \lambda c ^ { - 1 } } } \\ { { 0 } } & { { \lambda y _ { 2 } ^ { - 1 } } } & { { 0 } } & { { 0 } } & { { . . . } } & { { 0 } } & { { \lambda c ^ { - 1 } } } \\ { { 0 } } & { { 0 } } & { { \lambda y _ { 3 } ^ { - 1 } } } & { { 0 } } & { { . . . } } & { { 0 } } & { { \lambda c ^ { - 1 } } } \\ & & & { \vdots } & & & \\ { { - \lambda y _ { n } ^ { - 1 } } } & { { - \lambda y _ { n } ^ { - 1 } } } & { { - \lambda y _ { n } ^ { - 1 } } } & { { - \lambda y _ { n } ^ { - 1 } } } & { { . . . } } & { { - \lambda y _ { n } ^ { - 1 } } } & { { \lambda c ^ { - 1 } } } \end{array} \right]
|
| 308 |
+
$$
|
| 309 |
+
|
| 310 |
+
by adding $y _ { i } / y _ { n }$ times each of the top $n { - } 1$ rows to the bottom row we see that this Jacobian has the same determinant as
|
| 311 |
+
|
| 312 |
+
$$
|
| 313 |
+
\left[ \begin{array} { c c c c c c c } { \lambda y _ { 1 } ^ { - 1 } } & { 0 } & { 0 } & { 0 } & { . . . } & { 0 } & { \lambda c ^ { - 1 } } \\ { 0 } & { \lambda y _ { 2 } ^ { - 1 } } & { 0 } & { 0 } & { . . . } & { 0 } & { \lambda c ^ { - 1 } } \\ { 0 } & { 0 } & { \lambda y _ { 3 } ^ { - 1 } } & { 0 } & { . . . } & { 0 } & { \lambda c ^ { - 1 } } \\ & & & { \vdots } \\ { 0 } & { 0 } & { 0 } & { 0 } & { . . . } & { 0 } & { \lambda ( c y _ { n } ) ^ { - 1 } } \end{array} \right]
|
| 314 |
+
$$
|
| 315 |
+
|
| 316 |
+
and thus the determinant is equal to
|
| 317 |
+
|
| 318 |
+
$$
|
| 319 |
+
\frac { \lambda ^ { n } } { c \prod _ { i = 1 } ^ { k } y _ { i } }
|
| 320 |
+
$$
|
| 321 |
+
|
| 322 |
+
all together we have the density
|
| 323 |
+
|
| 324 |
+
$$
|
| 325 |
+
\begin{array} { r } { \frac { \lambda ^ { n } \prod _ { k = 1 } ^ { n } \alpha _ { k } \exp \left( - \lambda \log y _ { k } - \lambda \log c \right) \exp \left( - \alpha _ { k } \exp \left( - \lambda \log y _ { k } - \lambda \log c \right) \right) } { c \prod _ { i = 1 } ^ { n } y _ { i } } } \end{array}
|
| 326 |
+
$$
|
| 327 |
+
|
| 328 |
+
with $r = \log c$ change of variables we have density
|
| 329 |
+
|
| 330 |
+
$$
|
| 331 |
+
\begin{array} { l } { \displaystyle \frac { \lambda ^ { n } \prod _ { k = 1 } ^ { n } \alpha _ { k } \exp ( - \lambda r ) \exp \left( - \alpha _ { k } \exp \left( - \lambda \log y _ { k } - \lambda r \right) \right) } { \prod _ { i = 1 } ^ { n } y _ { i } ^ { \lambda + 1 } } = } \\ { \displaystyle \frac { \lambda ^ { n } \prod _ { k = 1 } ^ { n } \alpha _ { k } } { \prod _ { i = 1 } ^ { n } y _ { i } ^ { \lambda + 1 } } \exp ( - n \lambda r ) \exp ( - \sum _ { i = 1 } ^ { n } \alpha _ { i } \exp ( - \lambda \log y _ { i } - \lambda r ) ) = } \end{array}
|
| 332 |
+
$$
|
| 333 |
+
|
| 334 |
+
letting $\begin{array} { r } { \gamma = \log ( \sum _ { n = 1 } ^ { n } \alpha _ { k } y _ { k } ^ { - \lambda } ) } \end{array}$
|
| 335 |
+
|
| 336 |
+
$$
|
| 337 |
+
{ \frac { \lambda ^ { n } \prod _ { k = 1 } ^ { n } \alpha _ { k } } { \prod _ { i = 1 } ^ { n } y _ { i } ^ { \lambda + 1 } \exp ( \gamma ) } } \exp ( - n \lambda r + \gamma ) \exp ( - \exp ( - \lambda r + \gamma ) ) =
|
| 338 |
+
$$
|
| 339 |
+
|
| 340 |
+
integrating out $r$
|
| 341 |
+
|
| 342 |
+
$$
|
| 343 |
+
\begin{array} { r l } & { \frac { \lambda ^ { n } \prod _ { k = 1 } ^ { n } \alpha _ { k } } { \prod _ { i = 1 } ^ { n } y _ { i } ^ { \lambda + 1 } \exp ( \gamma ) } \left( \frac { \exp ( - \gamma n + \gamma ) \Gamma ( n ) } { \lambda } \right) = } \\ & { \frac { \lambda ^ { n - 1 } \prod _ { k = 1 } ^ { n } \alpha _ { k } } { \prod _ { i = 1 } ^ { n } y _ { i } ^ { \lambda + 1 } } \left( \exp ( - \gamma n ) \Gamma ( n ) \right) = } \\ & { ( n - 1 ) ! \lambda ^ { n - 1 } \frac { \prod _ { k = 1 } ^ { n } \alpha _ { k } y _ { k } ^ { - \lambda - 1 } } { \left( \sum _ { n = 1 } ^ { n } \alpha _ { k } y _ { k } ^ { - \lambda } \right) ^ { n } } } \end{array}
|
| 344 |
+
$$
|
| 345 |
+
|
| 346 |
+
Thus $Y { \overset { d } { = } } X$
|
| 347 |
+
|
| 348 |
+
2. Follows directly from (a) and the Gumbel-Max trick (Maddison, 2016).
|
| 349 |
+
|
| 350 |
+
3. Follows directly from (a) and the Gumbel-Max trick (Maddison, 2016).
|
| 351 |
+
|
| 352 |
+
4. Let $\lambda \le ( n - 1 ) ^ { - 1 }$ . The density of $X$ can be rewritten as
|
| 353 |
+
|
| 354 |
+
$$
|
| 355 |
+
\begin{array} { c } { { p _ { \alpha , \lambda } ( x ) \propto \displaystyle \prod _ { k = 1 } ^ { n } \frac { \alpha _ { k } y ^ { - \lambda - 1 } } { \sum _ { i = 1 } ^ { n } \alpha _ { i } y _ { i } ^ { - \lambda } } } } \\ { { = \displaystyle \prod _ { k = 1 } ^ { n } \frac { \alpha _ { k } y _ { k } ^ { \lambda ( n - 1 ) - 1 } } { \sum _ { i = 1 } ^ { n } \alpha _ { i } \prod _ { j \neq i } y _ { j } ^ { \lambda } } } } \end{array}
|
| 356 |
+
$$
|
| 357 |
+
|
| 358 |
+
Thus, the log density is up to an additive constant $C$
|
| 359 |
+
|
| 360 |
+
$$
|
| 361 |
+
\log p _ { \alpha , \lambda } ( x ) = \sum _ { k = 1 } ^ { n } ( \lambda ( n - 1 ) - 1 ) \log y _ { k } - n \log \left( \sum _ { k = 1 } ^ { n } \alpha _ { k } \prod _ { j \neq k } y _ { j } ^ { \lambda } \right) + C
|
| 362 |
+
$$
|
| 363 |
+
|
| 364 |
+
If $\lambda \le ( n - 1 ) ^ { - 1 }$ , then the first $n$ terms are convex, because $- \log$ is convex. For the last term, $- \log$ is convex and non-increasing and $\textstyle \prod _ { j \neq k } y _ { j } ^ { \lambda }$ is concave for $\lambda \le ( n - 1 ) ^ { - 1 }$ . Thus, their composition is convex. The sum of convex terms is convex, finishing the proof.
|
| 365 |
+
|
| 366 |
+
# B BINARY GUMBEL-MAX TRICK AND BINARY CONCRETE RANDOM VARIABLES
|
| 367 |
+
|
| 368 |
+
Bernoulli random variables are an important special case of discrete distributions taking states in $\{ 0 , 1 \}$ . Here we consider the binary special case of the Gumbel-Max trick from Figure 1a along with the corresponding Concrete relaxation.
|
| 369 |
+
|
| 370 |
+
Let $D \sim \mathrm { D i s c r e t e } ( \alpha )$ for $\alpha \in ( 0 , \infty ) ^ { 2 }$ be a two state discrete random variable on $\{ 0 , 1 \} ^ { 2 }$ such that $D _ { 1 } + D _ { 2 } = 1$ , parameterized as in Figure 1a by $\alpha _ { 1 } , \alpha _ { 2 } > 0$ :
|
| 371 |
+
|
| 372 |
+
$$
|
| 373 |
+
\mathbb { P } ( D _ { 1 } = 1 ) = \frac { \alpha _ { 1 } } { \alpha _ { 1 } + \alpha _ { 2 } }
|
| 374 |
+
$$
|
| 375 |
+
|
| 376 |
+
The distribution is degenerate, because $D _ { 1 } = 1 - D _ { 2 } $ . Therefore we consider just $D _ { 1 }$ . Under the Gumbel-Max reparameterization, the event that $D _ { 1 } ~ = ~ 1$ is the event that $\left\{ G _ { 1 } + \log \alpha _ { 1 } \ > \right.$
|
| 377 |
+
|
| 378 |
+
$G _ { 2 } + \log \alpha _ { 2 } \}$ where $G _ { k } \sim \mathrm { G u m b e l }$ i.i.d. The difference of two Gumbels is a Logistic distribution $G _ { 1 } - G _ { 2 } \sim$ Logistic, which can be sampled in the following way, $G _ { 1 } - G _ { 2 } \stackrel { d } { = } \log U - \log ( 1 - U )$ where $U \sim \mathrm { U n i f o r m } ( 0 , 1 )$ . So, if $\alpha = \alpha _ { 1 } / \alpha _ { 2 }$ , then we have
|
| 379 |
+
|
| 380 |
+
$$
|
| 381 |
+
\begin{array} { r } { { \mathbb P } ( D _ { 1 } = 1 ) = { \mathbb P } ( G _ { 1 } + \log \alpha _ { 1 } > G _ { 2 } + \log \alpha _ { 2 } ) = { \mathbb P } ( \log U - \log ( 1 - U ) + \log \alpha > 0 ) } \end{array}
|
| 382 |
+
$$
|
| 383 |
+
|
| 384 |
+
Thus, $\begin{array} { r } { D _ { 1 } \overset { d } { = } H ( \log \alpha + \log U - \log ( 1 - U ) ) } \end{array}$ , where $H$ is the unit step function.
|
| 385 |
+
|
| 386 |
+
Correspondingly, we can consider the Binary Concrete relaxation that results from this circuit. As in the $n$ -ary case, we consider the sampling routine for a Binary Concrete random variable $X \in ( 0 , 1 )$ first. To sample $X$ , sample $L \sim$ Logistic and set
|
| 387 |
+
|
| 388 |
+
$$
|
| 389 |
+
X = { \frac { 1 } { 1 + \exp ( - ( \log \alpha + L ) / \lambda ) } }
|
| 390 |
+
$$
|
| 391 |
+
|
| 392 |
+
We define the Binary Concrete random variable $X$ by its density on the unit interval.
|
| 393 |
+
|
| 394 |
+
Definition 2 (Binary Concrete Random Variables). Let $\alpha \in ( 0 , \infty )$ and $\lambda \in ( 0 , \infty )$ . $X \in ( 0 , 1 )$ has a Binary Concrete distribution $X \sim \mathrm { B i n C o n c r e t e } ( \alpha , \lambda )$ with location $\alpha$ and temperature $\lambda$ , if its density is:
|
| 395 |
+
|
| 396 |
+
$$
|
| 397 |
+
p _ { \alpha , \lambda } ( x ) = \frac { \lambda \alpha x ^ { - \lambda - 1 } ( 1 - x ) ^ { - \lambda - 1 } } { ( \alpha x ^ { - \lambda } + ( 1 - x ) ^ { - \lambda } ) ^ { 2 } } .
|
| 398 |
+
$$
|
| 399 |
+
|
| 400 |
+
We state without proof the special case of Proposition 1 for Binary Concrete distributions
|
| 401 |
+
|
| 402 |
+
Proposition 2 (Some Properties of Binary Concrete Random Variables). Let $X \sim$ BinConcrete $( \alpha , \lambda )$ with location parameter $\alpha \in ( 0 , \infty )$ and temperature $\lambda \in ( 0 , \infty )$ , then
|
| 403 |
+
|
| 404 |
+
(a) (Reparameterization) If $L \sim$ Logistic, then $\begin{array} { r } { X \stackrel { d } { = } \frac { 1 } { 1 + \exp ( - ( \log \alpha + L ) / \lambda ) } , } \end{array}$
|
| 405 |
+
|
| 406 |
+
(b) (Rounding) $\mathbb { P } \left( X > 0 . 5 \right) = \alpha / ( 1 + \alpha ) ,$ ,
|
| 407 |
+
|
| 408 |
+
(c) (Zero temperature) $\begin{array} { r } { \mathbb { P } ( \operatorname* { l i m } _ { \lambda 0 } X = 1 ) = \alpha / ( 1 + \alpha ) , } \end{array}$
|
| 409 |
+
|
| 410 |
+
(d) (Convex eventually) If $\lambda \leq 1$ , then $p _ { \alpha , \lambda } ( x )$ is log-convex in $x$ .
|
| 411 |
+
|
| 412 |
+
We can generalize the binary circuit beyond logistic random variables. Consider an arbitrary random variable $X$ with infinite support on $\mathbb { R }$ . If $\Phi : \bar { \mathbb { R } } [ 0 , 1 ]$ is the CDF of $X$ , then
|
| 413 |
+
|
| 414 |
+
$$
|
| 415 |
+
\mathbb { P } ( H ( X ) = 1 ) = 1 - \Phi ( 0 )
|
| 416 |
+
$$
|
| 417 |
+
|
| 418 |
+
If we want this to have a Bernoulli distribution with probability $\alpha / ( 1 + \alpha )$ , then we should solve the equation
|
| 419 |
+
|
| 420 |
+
$$
|
| 421 |
+
1 - \Phi ( 0 ) = { \frac { \alpha } { 1 + \alpha } } .
|
| 422 |
+
$$
|
| 423 |
+
|
| 424 |
+
This gives $\Phi ( 0 ) = 1 / ( 1 + \alpha )$ , which can be accomplished by relocating the random variable $Y$ with CDF $\Phi$ to be $X = Y - \Phi ^ { - 1 } ( 1 / ( 1 + \alpha ) )$ .
|
| 425 |
+
|
| 426 |
+
# C TIPS AND DETAILS FOR CONCRETE RELAXATIONS
|
| 427 |
+
|
| 428 |
+
In this section we include some tips for implementing and using the Concrete distribution. We use the following notation
|
| 429 |
+
|
| 430 |
+
$$
|
| 431 |
+
\sigma ( x ) = { \frac { 1 } { 1 + \exp ( - x ) } } \qquad { \underset { k = 1 } { \overset { n } { \operatorname { L S E } } } } \{ x _ { k } \} = \log \left( \sum _ { k = 1 } ^ { n } \exp ( x _ { k } ) \right)
|
| 432 |
+
$$
|
| 433 |
+
|
| 434 |
+
Both sigmoid and log-sum-exp are common operations in libraries like TensorFlow or theano.
|
| 435 |
+
|
| 436 |
+
# C.1 THE BASIC PROBLEM
|
| 437 |
+
|
| 438 |
+
For the sake of exposition, we consider a simple variational autoencoder with a single discrete random variable and objective ${ \mathcal { L } } _ { 1 } ( \theta , \phi )$ given by Eq. 8 for a single data point $x$ . This scenario will allow us to discuss all of the decisions one might make when using Concrete relaxations.
|
| 439 |
+
|
| 440 |
+
In particular, let $p _ { \theta } ( d )$ be the mass function of some one-hot discrete variable $d \in ( 0 , 1 ) ^ { n }$ whose probabilities depend in some continuous way on parameters $\theta$ , let $p _ { \theta } ( x | d )$ be some continuous likelihood (possibly computed by a neural network) function of $d$ also depending on parameters $\theta$ , let $D \sim \mathrm { D i s c r e t e } ( \alpha ( \phi , x ) )$ be a one-hot discrete random variable in $( 0 , 1 ) ^ { n }$ whose unnormalized probabilities $\alpha ( \phi , x )$ are some function (possible a neural net) of $x$ with parameters $\phi$ . Let $Q _ { \phi } ( d | x )$ be the mass function of $D$ . Then, we care about optimizing
|
| 441 |
+
|
| 442 |
+
$$
|
| 443 |
+
\mathcal { L } _ { 1 } ( \theta , \phi ) = \underset { D \sim q _ { \phi } ( d | x ) } { \mathbb { E } } \left[ \log \frac { p _ { \theta } ( x | D ) p _ { \theta } ( D ) } { q _ { \phi } ( D | x ) } \right]
|
| 444 |
+
$$
|
| 445 |
+
|
| 446 |
+
with respect to both $\theta$ and $\phi$ from samples of the SCG required to simulate an estimator of ${ \mathcal { L } } _ { 1 } ( \theta , \phi )$ .
|
| 447 |
+
|
| 448 |
+
# C.2 WHAT YOU MIGHT RELAX AND WHY
|
| 449 |
+
|
| 450 |
+
The first consideration when relaxing an estimator of Eq. 16 is how to relax the stochastic computation. The only sampling required to simulate ${ \mathcal { L } } _ { 1 } ( \theta , \phi )$ is $D \sim \mathrm { D i s c r e t e } ( \alpha ( \phi , x ) )$ . The corresponding Concrete relaxation is to sample $Z \sim { \mathrm { C o n c r e t e } } ( \alpha ( \phi , x ) , \lambda _ { 1 } )$ with temperature $\lambda _ { 1 }$ and location parameters are the the unnormalized probabilities $\alpha ( \phi , x )$ of $D$ . Let density $\tilde { q } _ { \phi , \lambda _ { 1 } } ( z | x )$ be the density of $Z$ . We get a relaxed objective of the form:
|
| 451 |
+
|
| 452 |
+
$$
|
| 453 |
+
\underline { { \mathbb { E } } } _ { \sim q _ { \phi } ( d | x ) } [ \cdot ] \ \ \underline { { \mathbb { E } } } _ { Z \sim \tilde { q } _ { \phi , \lambda _ { 1 } } ( z | x ) } [ \cdot ]
|
| 454 |
+
$$
|
| 455 |
+
|
| 456 |
+
This choice allows us to take derivatives through the stochastic computaitons of the graph, and we can interpet $\tilde { q } _ { \phi , \lambda _ { 1 } } ( z | x )$ as the Concrete relaxation of the variational posterior $q _ { \phi } ( d | x )$ .
|
| 457 |
+
|
| 458 |
+
The second consideration is which objective to put in place of $[ \cdot ]$ in Eq. 17. We will consider the ideal scenario irrespective of numerical issues. In Subsection C.3 we address those numerical issues. The central question is how to treat the expectation of the ratio $p _ { \theta } ( D ) / q _ { \phi } ( D | x )$ (which is the KL component of the loss) when $Z$ replaces $D$ . There are at least three options for how to modify the objective. They are, (18) replace the discrete mass with Concrete densities, (19) relax the computation of the discrete log mass, (20) replace it with the analytic discrete KL.
|
| 459 |
+
|
| 460 |
+
$$
|
| 461 |
+
\begin{array} { l } { { \displaystyle { \cal Z } \sim \tilde { q } _ { \phi , \lambda _ { 1 } } ( z | x ) \left[ \log p _ { \theta } ( x | Z ) + \log \frac { \tilde { p } _ { \theta , \lambda _ { 2 } } ( Z ) } { \tilde { q } _ { \phi , \lambda _ { 1 } } ( Z | x ) } \right] } } \\ { { \displaystyle { \cal Z } \sim \tilde { q } _ { \phi , \lambda _ { 1 } } ( z | x ) \left[ \log p _ { \theta } ( x | Z ) + \sum _ { i = 1 } ^ { n } Z _ { i } \log \frac { p _ { \theta } ( d ^ { ( i ) } ) } { q _ { \phi } ( d ^ { ( i ) } ) } \right] } } \\ { { \displaystyle { \cal Z } \sim \tilde { q } _ { \phi , \lambda _ { 1 } } ( z | x ) \left[ \log p _ { \theta } ( x | Z ) \right] + \sum _ { i } q _ { \phi } ( d ^ { ( i ) } ) \log \frac { p _ { \theta } ( d ^ { ( i ) } ) } { q _ { \phi } ( d ^ { ( i ) } ) } } } \end{array}
|
| 462 |
+
$$
|
| 463 |
+
|
| 464 |
+
where $\boldsymbol { d } ^ { ( i ) }$ is a one-hot binary vector with $d _ { i } ^ { ( i ) } = 1$ and $\tilde { p } _ { \boldsymbol { \theta } , \lambda _ { 2 } } ( z )$ is the density of some Concrete random variable with temperature $\lambda _ { 2 }$ whose location parameters depend on $\theta$ in the same way as the logits of $p _ { \theta } ( d )$ . Although (20) or (19) is tempting, we emphasize that these are NOT necessarily lower bounds on $\log p ( x )$ in the relaxed model. (18) is the only objective guaranteed to be a lower bound:
|
| 465 |
+
|
| 466 |
+
$$
|
| 467 |
+
\underset { Z \sim \tilde { q } _ { \phi , \lambda _ { 1 } } ( z | x ) } { \mathbb { E } } \left[ \log p _ { \theta } ( x | Z ) + \log \frac { \tilde { p } _ { \theta , \lambda _ { 2 } } ( Z ) } { \tilde { q } _ { \phi , \lambda _ { 1 } } ( Z | x ) } \right] \leq \log \int p _ { \theta } ( x | z ) \tilde { p } _ { \theta , \lambda _ { 2 } } ( z ) d x
|
| 468 |
+
$$
|
| 469 |
+
|
| 470 |
+
For this reason we consider objectives of the form (18). Choosing (20) or (19) is possible, but the value of these objectives is not interpretable and one should early stop otherwise it will overfit to the spurious “KL” component of the loss. We now consider practical issues with (18) and how to address them. All together we can interpret $\tilde { p } _ { \boldsymbol { \theta } , \lambda _ { 2 } } ( z )$ as the Concrete relaxation of the prior in the variational autoencoder.
|
| 471 |
+
|
| 472 |
+
# C.3 WHICH RANDOM VARIABLE TO TREAT AS THE STOCHASTIC NODE
|
| 473 |
+
|
| 474 |
+
When implementing a SCG like the variational autoencoder example, we need to compute logprobabilities of Concrete random variables. This computation can suffer from underflow, so where possible it’s better to take a different node on the relaxed graph as the stochastic node on which loglikelihood terms are computed. For example, it’s tempting in the case of Concrete random variables to treat the Gumbels as the stochastic node on which the log-likelihood terms are evaluated and the softmax as downstream computation. This will be a looser bound in the context of variational inference than the corresponding bound when treating the Concrete relaxed states as the node.
|
| 475 |
+
|
| 476 |
+
The solution we found to work well was to work with Concrete random variables in log-space. Consider the following vector in $\mathbb { R } ^ { n }$ for location parameters $\alpha \in ( 0 , \infty ) ^ { n }$ and $\lambda \in \mathsf { \Gamma } ( 0 , \infty )$ and $G _ { k } \sim$ Gumbel,
|
| 477 |
+
|
| 478 |
+
$$
|
| 479 |
+
Y _ { k } = { \frac { \log \alpha _ { k } + G _ { k } } { \lambda } } - \operatorname { L } _ { i = 1 } ^ { n } \left\{ { \frac { \log \alpha _ { i } + G _ { i } } { \lambda } } \right\}
|
| 480 |
+
$$
|
| 481 |
+
|
| 482 |
+
$Y ~ \in ~ \mathbb { R } ^ { n }$ has the property that $\begin{array} { l l l } { \exp ( Y ) } & { \sim } & { \mathrm { C o n c r e t e } ( \alpha , \lambda ) } \end{array}$ , therefore we call $Y$ an $\mathrm { E x p C o n c r e t e } ( \alpha , \lambda )$ . The advantage of this reparameterization is that the KL terms of a variational loss are invariant under invertible transformation. exp is invertible, so the KL between two ExpConcrete random variables is the same as the KL between two Concrete random variables. The log-density $\log \kappa _ { \alpha , \lambda } ( y )$ of an ExpConcrete $( \alpha , \lambda )$ is also simple to compute:
|
| 483 |
+
|
| 484 |
+
$$
|
| 485 |
+
\log \kappa _ { \alpha , \lambda } ( y ) = \log ( ( n - 1 ) ! ) + ( n - 1 ) \log \lambda + \left( \sum _ { k = 1 } ^ { n } \log \alpha _ { k } - \lambda y _ { k } \right) - n \operatorname { L i p } _ { k = 1 } ^ { n } \left\{ \log \alpha _ { k } - \lambda y _ { k } \right\}
|
| 486 |
+
$$
|
| 487 |
+
|
| 488 |
+
for $y \in \mathbb { R } ^ { n }$ such that $\mathrm { L } \Sigma \mathrm { E } _ { k = 1 } ^ { n } \{ y _ { k } \} = 0$ . Note that the sample space of the ExpConcrete distribution is still interpretable in the zero temperature limit. In the limit of $\lambda 0$ ExpConcrete random variables become discrete random variables over the one-hot vectors of $d \in { \mathsf { \{ - \infty } } , 0 \} ^ { n }$ where $\mathrm { L } \Sigma \mathrm { E } _ { k = 1 } ^ { n } \{ d _ { k } \} = 0$ . $\exp ( Y )$ in this case results in the one-hot vectors in $\{ 0 , 1 \} ^ { n }$ .
|
| 489 |
+
|
| 490 |
+
Returning to our initial task of relaxing ${ \mathcal { L } } _ { 1 } ( \theta , \phi )$ , let $Y \sim \mathrm { E x p C o n c r e t e } ( \alpha ( \phi , x ) , \lambda _ { 1 } )$ with density $\kappa _ { \phi , \lambda _ { 1 } } ( y | x )$ be the ExpConcrete latent variable corresponding to the Concrete relaxation $\tilde { q } _ { \phi , \lambda _ { 1 } } ( z | x )$ of the variational posterior $q _ { \phi } ( d | x )$ . Let $\rho _ { \theta , \lambda _ { 1 } } ( y )$ be the density of an ExpConcrete random variable corresponding to the Concrete relaxation $\tilde { p } _ { \boldsymbol { \theta } , \lambda _ { 2 } } ( \boldsymbol { y } )$ of $p _ { \theta } ( d )$ . All together we can see that
|
| 491 |
+
|
| 492 |
+
$$
|
| 493 |
+
\underset { \substack { \tau \sim \tilde { q } _ { \phi , \lambda _ { 1 } } ( z | x ) } } { \mathbb { E } } \left[ \log p \theta ( x | Z ) + \log \frac { \tilde { p } \theta _ { \delta , \lambda _ { 2 } } ( Z ) } { \tilde { q } _ { \phi , \lambda _ { 1 } } ( Z | x ) } \right] = \underset { \substack { Y \sim \kappa _ { \phi , \lambda _ { 1 } } ( z | x ) } } { \mathbb { E } } \left[ \log p \theta ( x | \exp ( Y ) ) + \log \frac { \rho \theta _ { \delta , \lambda _ { 2 } } ( Y ) } { \kappa _ { \phi , \lambda _ { 1 } } ( Y | x ) } \right]
|
| 494 |
+
$$
|
| 495 |
+
|
| 496 |
+
Therefore, we used ExpConcrete random variables as the stochastic nodes and treated exp as a downstream computation.
|
| 497 |
+
|
| 498 |
+
In the binary case, the logistic function is invertible, so it makes most sense to treat the logit plus noise as the stochastic node. In particular, the binary random node was sample from:
|
| 499 |
+
|
| 500 |
+
$$
|
| 501 |
+
Y = { \frac { \log \alpha + \log U - \log ( 1 - U ) } { \lambda } }
|
| 502 |
+
$$
|
| 503 |
+
|
| 504 |
+
where $U \sim \mathrm { U n i f o r m } ( 0 , 1 )$ and always followed by $\sigma$ as downstream computation. $\log U - \log ( 1 -$ $U$ ) is a logistic random variable, details in the cheat sheet, and so the log-density $\log \kappa _ { \alpha , \lambda } ( y )$ of this node (before applying $\sigma$ ) is
|
| 505 |
+
|
| 506 |
+
$$
|
| 507 |
+
\log \kappa _ { \alpha , \lambda } ( y ) = \log \lambda - \lambda y + \log \alpha - 2 \log ( 1 + \exp ( - \lambda y + \log \alpha ) )
|
| 508 |
+
$$
|
| 509 |
+
|
| 510 |
+
This section had a dense array of densities, so we summarize the relevant ones, along with how to sample from them, in Appendix F.
|
| 511 |
+
|
| 512 |
+
# C.4 CHOOSING THE TEMPERATURE
|
| 513 |
+
|
| 514 |
+
The success of Concrete relaxations will depend heavily on the choice of temperature during training. It is important that the relaxed nodes are not able to represent a precise real valued mode in the interior of the simplex as in Figure 2d. For example, choosing additive Gaussian noise $\epsilon \sim \mathrm { N o r m a l } ( 0 , 1 )$ with the logistic function $\sigma ( x )$ to get relaxed Bernoullis of the form $\sigma ( \epsilon + \mu )$ will result in a large mode in the centre of the interval. This is because the tails of the Gaussian distribution drop off much faster than the rate at which $\sigma$ squashes. Even including a temperature parameter does not completely solve this problem; the density of $\sigma ( ( \epsilon + \mu ) / \lambda )$ at any temperature still goes to 0 as its approaches the boundaries 0 and 1 of the unit interval. Therefore (d) of Proposition 1 is a conservative guideline for generic $n$ -ary Concrete relaxations; at temperatures lower than $( n - 1 ) ^ { - 1 }$ we are guaranteed not to have any modes in the interior for any $\bar { \alpha } \in ( 0 , \infty ) ^ { n }$ . In the case of the Binary Concrete distribution, the tails of the logistic additive noise are balanced with the logistic squashing function and for temperatures $\lambda \leq 1$ the density of the Binary Concrete distribution is log-convex for all parameters $\alpha$ , see Figure 3b. Still, practice will often disagree with theory here. The peakiness of the Concrete distribution increases with $n$ , so much higher temperatures are tolerated (usually necessary).
|
| 515 |
+
|
| 516 |
+
For $n = 1$ temperatures $\lambda \le ( n - 1 ) ^ { - 1 }$ is a good guideline. For $n > 1$ taking $\lambda \le ( n - 1 ) ^ { - 1 }$ is not necessarily a good guideline, although it will depend on $n$ and the specific application. As $n \infty$ the Concrete distribution becomes peakier, because the random normalizing constant $\begin{array} { r } { \sum _ { k = 1 } ^ { n } \exp ( ( \log \alpha _ { k } + G _ { k } ) / \lambda ) } \end{array}$ grows. This means that practically speaking the optimization can tolerate much higher temperatures than $( n - 1 ) ^ { - 1 }$ . We found in the cases $n = 4$ that $\lambda = 1$ was the best temperature and in $n = 8$ , $\lambda = 2 / 3$ was the best. Yet $\lambda = 2 / 3$ was the best single performing temperature across the $n \in \{ 2 , 4 , 8 \}$ cases that we considered. We recommend starting in that ball-park and exploring for any specific application.
|
| 517 |
+
|
| 518 |
+
When the loss depends on a KL divergence between two Concrete nodes, it’s possible to give the nodes distinct temperatures. We found this to improve results quite dramatically. In the context of our original problem and it’s relaxation:
|
| 519 |
+
|
| 520 |
+
$$
|
| 521 |
+
\mathcal { L } _ { 1 } ( \theta , \phi ) \stackrel { \mathrm { r e l a x } } { \sim } \underset { Y \sim \kappa _ { \phi , \lambda _ { 1 } } ( z | x ) } { \mathbb { E } } \left[ \log p _ { \theta } ( x | \exp ( Y ) ) + \log \frac { \rho _ { \theta , \lambda _ { 2 } } ( Y ) } { \kappa _ { \phi , \lambda _ { 1 } } ( Y | x ) } \right]
|
| 522 |
+
$$
|
| 523 |
+
|
| 524 |
+
The two temperatures to tune would be $\lambda _ { 1 }$ for the posterior temperature and $\lambda _ { 2 }$ for the prior temperature.
|
| 525 |
+
|
| 526 |
+
# D EXPERIMENTAL DETAILS
|
| 527 |
+
|
| 528 |
+
D.1 — VS ∼
|
| 529 |
+
|
| 530 |
+
The conditioning functions we used were either linear or non-linear. Non-linear consisted of two tanh layers of the same size as the preceding stochastic layer in the computation graph.
|
| 531 |
+
|
| 532 |
+
# D.2 $n$ -ARY LAYERS
|
| 533 |
+
|
| 534 |
+
All our models are neural networks with layers of $n$ -ary discrete stochastic nodes with $\log _ { 2 } ( n )$ - dimensional states on the corners of the hypercube $\{ - 1 , 1 \} ^ { \log _ { 2 } ( n ) }$ . For a generic $n$ -ary node sampling proceeds as follows. Sample a $n$ -ary discrete random variable $D \sim \mathrm { D i s c r e t e } ( \alpha )$ for $\alpha \in ( 0 , \infty ) ^ { n }$ . If $C$ is the $\log _ { 2 } ( n ) \times n$ matrix, which lists the corners of the hypercube $\{ - 1 , 1 \} ^ { \log _ { 2 } ( n ) }$ as columns, then we took $Y = C D$ as downstream computation on $D$ . The corresponding Concrete relaxation is to take $X \sim \mathrm { C o n c r e t e } ( \alpha , \lambda )$ for some fixed temperature $\lambda \in \mathsf { \Gamma } ( 0 , \infty )$ and set $\tilde { Y } = C X$ . For the binary case, this amounts to simply sampling $U \sim \mathrm { U n i f o r m } ( 0 , 1 )$ and taking $Y = 2 H ( \log U - \log ( 1 - U ) + \log \alpha ) - 1$ . The corresponding Binary Concrete relaxation is $\tilde { Y } = 2 \sigma ( ( \log U - \log ( 1 - U ) + \log \alpha ) / \lambda ) - 1$ .
|
| 535 |
+
|
| 536 |
+
# D.3 BIAS INITIALIZATION
|
| 537 |
+
|
| 538 |
+
All biases were initialized to 0 with the exception of the biases in the prior decoder distribution over the 784 or 392 observed units. These were initialized to the logit of the base rate averaged over the respective dataset (MNIST or Omniglot).
|
| 539 |
+
|
| 540 |
+
# D.4 CENTERING
|
| 541 |
+
|
| 542 |
+
We also found it beneficial to center the layers of the inference network during training. The activity in $( - 1 , 1 ) ^ { d }$ of each stochastic layer was centered during training by maintaining a exponentially decaying average with rate 0.9 over minibatches. This running average was subtracted from the activity of the layer before it was updated. Gradients did not flow throw this computation, so it simply amounted to a dynamic offset. The averages were not updated during the evaluation.
|
| 543 |
+
|
| 544 |
+
# D.5 HYPERPARAMETER SELECTION
|
| 545 |
+
|
| 546 |
+
All models were initialized with the heuristic of Glorot & Bengio (2010) and optimized using Adam (Kingma & Ba, 2014) with parameters $\beta _ { 1 } = 0 . 9 , \beta _ { 2 } = 0 . 9 9 9$ for $1 0 ^ { 7 }$ steps on minibatches of size 64. Hyperparameters were selected on the MNIST dataset by grid search taking the values that performed best on the validation set. Learning rates were chosen from $\{ 1 0 ^ { - 4 } , 3 \cdot \overline { { 1 } } 0 ^ { - 4 } , 1 0 ^ { - 3 } \}$ and weight decay from $\{ 0 , 1 0 ^ { - 2 } , 1 0 ^ { - 1 } , 1 \}$ . Two sets of hyperparameters were selected, one for linear models and one for non-linear models. The linear models’ hyperparameters were selected with the $2 0 0 \mathrm { H } { - } 2 0 0 \mathrm { H } { - } 7 8 4 \mathrm { V }$ density model on the ${ \mathcal { L } } _ { 5 } ( \theta , \phi )$ objective. The non-linear models’ hyperparameters were selected with the $2 0 0 \mathrm { H } { \sim } 2 0 0 \mathrm { H } { \sim } 7 8 4 \mathrm { V }$ density model on the $\mathcal { L } _ { 5 } ( \theta , \phi )$ objective. For density estimation, the Concrete relaxation hyperparameters were (weight decay $= 0$ , learning rate $= 3 \cdot \mathrm { i } 0 ^ { - 4 }$ ) for linear and (weight decay $= 0$ , learning rate $= 1 0 ^ { - 4 }$ ) for non-linear. For structured prediction Concrete relaxations used (weight decay $= \bar { 1 } 0 ^ { - 3 }$ , learning rate $= 3 \cdot 1 0 ^ { - 4 }$ ).
|
| 547 |
+
|
| 548 |
+
In addition to tuning learning rate and weight decay, we tuned temperatures for the Concrete relaxations on the density estimation task. We found it valuable to have different values for the prior and posterior distributions. In particular, for binary we found that (prior $\lambda = 1 / 2$ , posterior $\lambda = 2 / 3 ,$ ) was best, for 4-ary we found (prior $\lambda = 2 / 3$ , posterior $\lambda = 1$ ) was best, and (prior $\lambda = 2 / 5$ , posterior $\lambda = 2 / 3$ ) for 8-ary. No temperature annealing was used. For structured prediction we used just the corresponding posterior $\lambda$ .
|
| 549 |
+
|
| 550 |
+
We performed early stopping when training with the score function estimators (VIMCO/NVIL) as they were much more prone to overfitting.
|
| 551 |
+
|
| 552 |
+
# E EXTRA RESULTS
|
| 553 |
+
|
| 554 |
+
Table 2: Density estimation using Concrete relaxations with distinct arity of layers.
|
| 555 |
+
|
| 556 |
+
<table><tr><td rowspan="2"></td><td rowspan="2"></td><td colspan="2">MNIST NLL</td><td colspan="2">Omniglot NLL</td></tr><tr><td>Test</td><td>Train</td><td>Test</td><td>Train</td></tr><tr><td>binary</td><td>1</td><td>91.9</td><td>90.7</td><td>108.0</td><td>102.2</td></tr><tr><td>(240H</td><td>5</td><td>89.0</td><td>87.1</td><td>107.7</td><td>100.0</td></tr><tr><td>~784V)</td><td>50</td><td>88.4</td><td>85.7</td><td>109.0</td><td>99.1</td></tr><tr><td>4-ary</td><td>1</td><td>91.4</td><td>89.7</td><td>110.7</td><td>1002.7</td></tr><tr><td>(240H</td><td>5</td><td>89.4</td><td>87.0</td><td>110.5</td><td>100.2</td></tr><tr><td>~784V)</td><td>50</td><td>89.7</td><td>86.5</td><td>113.0</td><td>100.0</td></tr><tr><td>8-ary</td><td>1</td><td>92.5</td><td>89.9</td><td>119.61</td><td>105.3</td></tr><tr><td>(240H</td><td>5</td><td>90.5</td><td>87.0</td><td>120.7</td><td>102.7</td></tr><tr><td>~784V)</td><td>50</td><td>90.5</td><td>86.7</td><td>121.7</td><td>101.0</td></tr><tr><td>binary</td><td>1</td><td>87.9</td><td>86.0</td><td>106.6</td><td>99.0</td></tr><tr><td>(240H~240H</td><td>5</td><td>86.6</td><td>83.7</td><td>106.9</td><td>97.1</td></tr><tr><td>~784V)</td><td>50</td><td>86.0</td><td>82.7</td><td>108.7</td><td>95.9</td></tr><tr><td>4-ary</td><td>1</td><td>87.4</td><td>85.0</td><td>106.6</td><td>97.8</td></tr><tr><td>(240H~240H</td><td>5</td><td>86.7</td><td>83.3</td><td>108.3</td><td>97.3</td></tr><tr><td>~784V)</td><td>50</td><td>86.7</td><td>83.0</td><td>109.4</td><td>96.8</td></tr><tr><td>8-ary</td><td>1</td><td>88.2</td><td>85.9</td><td>111.3</td><td>102.5</td></tr><tr><td>(240H~240H</td><td>5</td><td>87.4</td><td>84.6</td><td>110.5</td><td>100.5</td></tr><tr><td>~784V)</td><td>50</td><td>87.2</td><td>84.0</td><td>111.1</td><td>99.5</td></tr></table>
|
| 557 |
+
|
| 558 |
+
# F CHEAT SHEET
|
| 559 |
+
|
| 560 |
+
$$
|
| 561 |
+
\begin{array} { c l l } { \displaystyle \sigma ( \boldsymbol { x } ) = \frac { 1 } { 1 + \exp ( - x ) } \qquad } & { \displaystyle \mathrm { L E E } ^ { n } \{ x _ { k } \} = \log \left( \sum _ { k = 1 } ^ { n } \exp ( x _ { k } ) \right) } \\ { \log \Delta ^ { n - 1 } = \left\{ x \in \mathbb { R } ^ { n } \mid x _ { k } \in ( - \infty , 0 ) , \underset { k = 1 } { \overset { n } { \mathrm { L E E } } } \{ x _ { k } \} = 0 \right\} } \end{array}
|
| 562 |
+
$$
|
| 563 |
+
|
| 564 |
+
Distribution and Domains Reparameterization/How To Sample Mass/Density
|
| 565 |
+
Table 3: Cheat sheet for the random variables we use in this work. Note that some of these are atypical parameterizations, particularly the Bernoulli and logistic random variables. The table only assumes that you can sample uniform random numbers $U \stackrel { \textstyle \circ } { \sim } \mathrm { U n i f o r m } ( 0 , 1 )$ . From there on it may define random variables and reuse them later on. For example, $L \sim$ Logistic is defined in the second row, and after that point $L$ represents a Logistic random variable that can be replaced by $\log U - \log ( 1 - U )$ . Whenever random variables are indexed, e.g. $G _ { k }$ , they represent separate independent calls to a random number generator.
|
| 566 |
+
|
| 567 |
+
<table><tr><td>G~ Gumbel G∈R</td><td>G -log(-log(U))</td><td>exp(-g-exp(-g))</td></tr><tr><td>L ~Logistic L∈R</td><td>L = log(U)-log(1-U)</td><td>exp(-l) (1 + exp(-)2</td></tr><tr><td>X ~ Logistic(μ,λ) μ∈R 入∈(0,00)</td><td>xL+μ 入</td><td>Xexp(-λx+ μ) (1+exp(-λx+μ))²</td></tr><tr><td>X ~ Bernoulli(α) X∈{0,1} α∈ (0,∞0)</td><td>x 1 if L+logα≥0 10 otherwise</td><td>α ifx=1 1+α</td></tr><tr><td>X ~ BinConcrete(α,入) X ∈ (0,1) α∈(0,∞0) 入∈(0,00)</td><td>X =σ(L + logα)/λ)</td><td>λax-λ-1(1-x)-λ-1 (ax->+(1-x)-1)2</td></tr><tr><td>X ~ Discrete(α) X ∈{0,1}n Ω=1 Xk =1 a∈ (0,∞0)n</td><td>if log αk +Gk > logαi +Gi for i≠k Xk 1 10 otherwise</td><td>Qk ifxk=1 In ∑i=1 ai</td></tr><tr><td>X ~ Concrete(α, λ) X∈△n-1 α ∈ (0,∞0)n 入∈(0,00)</td><td>exp(log ak + Gk)/λ) x ∑i=1 exp((log ak + Gi)/)) n</td><td>(n - 1)! n akxk -入-1 1-(n-1) ∑i=1aixi n 入 k=1</td></tr><tr><td>X ~ ExpConcrete(α,λ) X∈log△n-1 α ∈ (0,∞)𝑛 入∈(0,00)</td><td>{ log ai + Gi} Xk logak+Gk n LE 入 i=1 入</td><td>(n-1)! n ak exp(-入xk) 1 1-(n-1) ∑i=1 ai exp(-Xxi) n k=1</td></tr></table>
|
md/train/S1lIMn05F7/S1lIMn05F7.md
ADDED
|
@@ -0,0 +1,380 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# A DIRECT APPROACH TO ROBUST DEEP LEARNINGUSING ADVERSARIAL NETWORKS
|
| 2 |
+
|
| 3 |
+
Huaxia Wang
|
| 4 |
+
Department of Electrical and Computer Engineering
|
| 5 |
+
Stevens Institute of Technology
|
| 6 |
+
Hoboken, NJ 07030, USA
|
| 7 |
+
hwang38@stevens.edu
|
| 8 |
+
Chun-Nam Yu
|
| 9 |
+
Nokia Bell Labs
|
| 10 |
+
600 Mountain Avenue
|
| 11 |
+
Murray Hill, NJ 07974, USA
|
| 12 |
+
chun-nam.yu@nokia-bell-labs.com
|
| 13 |
+
|
| 14 |
+
# ABSTRACT
|
| 15 |
+
|
| 16 |
+
Deep neural networks have been shown to perform well in many classical machine learning problems, especially in image classification tasks. However, researchers have found that neural networks can be easily fooled, and they are surprisingly sensitive to small perturbations imperceptible to humans. Carefully crafted input images (adversarial examples) can force a well-trained neural network to provide arbitrary outputs. Including adversarial examples during training is a popular defense mechanism against adversarial attacks. In this paper we propose a new defensive mechanism under the generative adversarial network (GAN) framework. We model the adversarial noise using a generative network, trained jointly with a classification discriminative network as a minimax game. We show empirically that our adversarial network approach works well against black box attacks, with performance on par with state-of-art methods such as ensemble adversarial training and adversarial training with projected gradient descent.
|
| 17 |
+
|
| 18 |
+
# 1 INTRODUCTION
|
| 19 |
+
|
| 20 |
+
Deep neural networks have been successfully applied to a variety of tasks, including image classification (Krizhevsky et al., 2012), speech recognition (Graves et al., 2013), and human-level playing of video games through deep reinforcement learning (Mnih et al., 2015). However, Szegedy et al. (2014) showed that convolutional neural networks (CNN) are extremely sensitive to carefully crafted small perturbations added to the input images. Since then, many adversarial examples generating methods have been proposed, including Jacobian based saliency map attack (JSMA) (Papernot et al., 2016a), projected gradient descent (PGD) attack (Madry et al., 2018), and C&W’s attack (Carlini & Wagner, 2017). In general, there are two types of attack models: white box attack and black box attack. Attackers in white box attack model have complete knowledge of the target network, including network’s architecture and parameters. Whereas in black box attacks, attackers only have partial or no information on the target network (Papernot et al., 2017).
|
| 21 |
+
|
| 22 |
+
Various defensive methods have been proposed to mitigate the effect of the adversarial examples. Adversarial training which augments the training set with adversarial examples shows good defensive performance in terms of white box attacks (Kurakin et al., 2017; Madry et al., 2018). Apart from adversarial training, there are many other defensive approaches including defensive distillation (Papernot et al., 2016b), using randomization at inference time (Xie et al., 2018), and thermometer encoding (Buckman et al., 2018), etc.
|
| 23 |
+
|
| 24 |
+
In this paper, we propose a defensive method based on generative adversarial network (GAN) (Goodfellow et al., 2014). Instead of using the generative network to generate samples that can fool the discriminative network as real data, we train the generative network to generate (additive) adversarial noise that can fool the discriminative network into misclassifying the input image. This allows flexible modeling of the adversarial noise by the generative network, which can take in the original image or a random vector or even the class label to create different types of noise. The discriminative networks used in our approach are just the usual neural networks designed for their specific classification tasks. The purpose of the discriminative network is to classify both clean and adversarial example with correct label, while the generative network aims to generate powerful perturbations to fool the discriminative network. This approach is simple and it directly uses the minimax game concept employed by GAN. Our main contributions include:
|
| 25 |
+
|
| 26 |
+
• We show that our adversarial network approach can produce neural networks that are robust towards black box attacks. In the experiments they show similar, and in some cases better, performance when compared to state-of-art defense methods such as ensemble adversarial training (Tramer et al., 2018) and adversarial training with projected gradient \` descent (Madry et al., 2018). To our best knowledge we are also the first to study the joint training of a generative attack network and a discriminative network. • We study the effectiveness of different generative networks in attacking a trained discriminative network, and show that a variety of generative networks, including those taking in random noise or labels as inputs, can be effective in attacks. We also show that training against these generative networks can provide robustness against different attacks.
|
| 27 |
+
|
| 28 |
+
The rest of the paper is organized as follows. In Section 2, related works including multiple attack and defense methods are discussed. Section 3 presents our defensive method in details. Experimental results are shown in Section 4, with conclusions of the paper in Section 5.
|
| 29 |
+
|
| 30 |
+
# 2 RELATED WORKS
|
| 31 |
+
|
| 32 |
+
In this section, we briefly review the attack and defense methods in neural network training.
|
| 33 |
+
|
| 34 |
+
# 2.1 ATTACK MODEL
|
| 35 |
+
|
| 36 |
+
Given a neural network model $D _ { \theta }$ parameterized by $\theta$ trained for classification, an input image $\boldsymbol { x } \in \mathbb { R } ^ { d }$ and its label $y$ , we want to find a small adversarial perturbation $\Delta x$ such that $x + \Delta x$ is not classified as $y$ . The minimum norm solution $\Delta x$ can be described as:
|
| 37 |
+
|
| 38 |
+
$$
|
| 39 |
+
\operatorname* { a r g m i n } _ { \Delta x } \| \Delta x \| \quad \mathrm { s . t . } \ \arg \operatorname* { m a x } D _ { \theta } ( x + \Delta x ) \neq y ,
|
| 40 |
+
$$
|
| 41 |
+
|
| 42 |
+
where arg max $D _ { \theta } ( x )$ gives the predicted class for input $x$ . Szegedy et al. (2014) introduced the first method to generate adversarial examples by considering the following optimization problem,
|
| 43 |
+
|
| 44 |
+
$$
|
| 45 |
+
\Delta x = \underset { z } { \arg \operatorname* { m i n } } \lambda \| z \| + L ( D _ { \theta } ( x + z ) , \hat { y } ) , \quad x + z \in [ 0 , 1 ] ^ { d }
|
| 46 |
+
$$
|
| 47 |
+
|
| 48 |
+
where $L$ is a distance function measuring the closeness of the output $D _ { \theta } ( x + z )$ with some target $\hat { y } \neq$ $y$ . The objective is minimized using box-constrained L-BFGS. Goodfellow et al. (2015) introduced the fast gradient sign method (FGS) to generate adversarial examples in one step, which can be represented as $\Delta x { \mathbf { \bar { \phi } } } = \epsilon \cdot \mathrm { s i g n } \left( \nabla _ { x } l ( D _ { \theta } ( { \bar { { x } } } ) , y ) \right)$ , where $l$ is the cross-entropy loss used in neural networks training. Madry et al. (2018) argues with strong evidence that projected gradient descent (PGD), which can be viewed as an iterative version of the fast gradient sign method, is the strongest attack using only first-order gradient information. Papernot et al. (2017) presented a Jacobian-based saliency-map attack (J-BSMA) model to generate adversarial examples by changing a small number of pixels. Moosavi-Dezfooli et al. (2017) showed that there exist a single/universal small image perturbation that fools all natural images. Papernot et al. (2017) introduced the first demonstration of black-box attacks against neural network classifiers. The adversary has no information about the architecture and parameters of the neural networks, and does not have access to large training dataset.
|
| 49 |
+
|
| 50 |
+
# 2.2 DEFENSE MODEL
|
| 51 |
+
|
| 52 |
+
In order to mitigate the effect of the generated adversarial examples, various defensive methods have been proposed. Papernot et al. (2016b) introduced distillation as a defense to adversarial examples. Lou et al. (2016) introduced a foveation-based mechanism to alleviate adversarial examples.
|
| 53 |
+
|
| 54 |
+
The idea of adversarial training was first proposed by Szegedy et al. (2014). The effect of adversarial examples can be reduced through explicitly training the model with both original and perturbed adversarial images. Adversarial training can be viewed as a minimax game,
|
| 55 |
+
|
| 56 |
+
$$
|
| 57 |
+
\theta ^ { * } = \underset { \theta } { \arg \operatorname* { m i n } } \operatorname { E } _ { x , y } \underset { \Delta x } { \operatorname* { m a x } } l ( D _ { \theta } ( x + \Delta x ) , y ) .
|
| 58 |
+
$$
|
| 59 |
+
|
| 60 |
+

|
| 61 |
+
Figure 1: Architecture diagram of our adversarial networks
|
| 62 |
+
|
| 63 |
+
The inner maximization requires a separate oracle for generating the perturbations $\Delta x$ . FGS is a common method for generating the adversarial perturbations $\Delta x$ due to its speed. Madry et al. (2018) advocates the use of PGD in generating adversarial examples. Moreover, a cascade adversarial training is presented in Na et al. (2018), which injects adversarial examples from an already defended network added with adversarial images from the network being trained.
|
| 64 |
+
|
| 65 |
+
There are a few recent works on using GANs for generating and defending against adversarial examples. Samangouei et al. (2018) and Ilyas et al. (2017) use GAN for defense by learning the manifold of input distribution with GAN, and then project any input examples onto this learned manifold before classification to filter out any potential adversarial noise. Our approach is more direct because we do not learn the input distribution and no input denoising is involved. Both Baluja & Fischer (2018) and Xiao et al. (2018) train neural networks to generate adversarial examples by maximizing the loss over a fixed pre-trained discriminative network. They show that they can train neural networks to effectively attack undefended discriminative networks while ensuring the generated adversarial examples look similar to the original samples. Our work is different from these because instead of having a fixed discriminative network, we co-train the discriminative network together with the adversarial generative network in a minimax game. Xiao et al. (2018) also train a second discriminative network as in typical GANs, but their discriminative network is used for ensuring the generated images look like the original samples, and not for classification. Lee et al. (2017) also considered the use of GAN to train robust discriminative networks. However, the inputs to their generative network is the gradient of the discriminative network with respect to the input image $x$ , not just the image $x$ as in our current work. This causes complex dependence of the gradient of the generative network parameters to the discriminative network parameters, and makes the parameter updates for the generative network more complicated. Also there is no single minimax objective that they are solving for in their work; the update rules for the discriminative and generative networks optimize related but different objectives.
|
| 66 |
+
|
| 67 |
+
# 3 METHOD
|
| 68 |
+
|
| 69 |
+
In generative adversarial networks (GAN) (Goodfellow et al., 2014), the goal is to learn a generative neural network that can model a distribution of unlabeled training examples. The generative network transforms a random input vector into an output that is similar to the training examples, and there is a separate discriminative network that tries to distinguish the real training examples against samples generated by the generative network. The generative and discriminative networks are trained jointly with gradient descent, and at equilibrium we want the samples from the generative network to be indistinguishable from the real training data by the discriminative network, i.e., the discriminative network does no better than doing a random coin flip.
|
| 70 |
+
|
| 71 |
+
We adopt the GAN approach in generating adversarial noise for a discriminative model to train against. This approach has already been hinted at in Tramer et al. (2018), but they decided to train \` against a static set of adversarial models instead of training against a generative noise network that can dynamically adapt in a truly GAN fashion. In this work we show that this idea can be carried out fruitfully to train robust discriminative neural networks.
|
| 72 |
+
|
| 73 |
+
Given an input $x$ with correct label $y$ , from the viewpoint of the adversary we want to find additive noise $\Delta x$ such that $x + \Delta x$ will be incorrectly classified by the discriminative neural network to some other labels $\hat { y } \ne y$ . We model this additive noise as $\epsilon G ( x )$ , where $G$ is a generative neural network that generates instance specific noise based on the input $x$ and $\epsilon$ is the scaling factor that controls the size of the noise. Notice that unlike white box attack methods such as FGS or PGD, once trained $G$ does not need to know the parameters of the discriminative network that it is attacking. $G$ can also take in other inputs to generate adversarial noise, e.g., Gaussian random vector $z \in { \mathbb { R } ^ { d } }$ as in typical GAN, or even the class label $y$ . For simplicity we assume $G$ takes in $x$ as input in the descriptions below.
|
| 74 |
+
|
| 75 |
+
Suppose we have a training set $\left\{ ( x _ { 1 } , y _ { 1 } ) , \dotsc , ( x _ { n } , y _ { n } ) \right\}$ of image-label pairs. Let $D _ { \theta }$ be the discriminator network (for classification) parameterized by $\theta$ , and $G _ { \phi }$ be the generator network parameterized by $\phi$ . We want to solve the following minimax game between $D _ { \theta }$ and $G _ { \phi }$ :
|
| 76 |
+
|
| 77 |
+
$$
|
| 78 |
+
\operatorname* { m i n } _ { \theta } \operatorname* { m a x } _ { \phi } \sum _ { i = 1 } ^ { n } l ( D _ { \theta } ( x _ { i } ) , y _ { i } ) + \lambda \sum _ { i = 1 } ^ { n } l ( D _ { \theta } ( x _ { i } + \epsilon G _ { \phi } ( x _ { i } ) ) , y _ { i } ) ,
|
| 79 |
+
$$
|
| 80 |
+
|
| 81 |
+
where $l$ is the cross-entropy loss, $\lambda$ is the trade-off parameter between minimizing the loss on normal examples versus minimizing the loss on the adversarial examples, and $\epsilon$ is the magnitude of the noise. See Figure 1 for an illustration of the model.
|
| 82 |
+
|
| 83 |
+
In this work we focus on perturbations based on $\ell _ { \infty }$ norm. This can be achieved easily by adding a tanh layer as the final layer of the generator network $G _ { \phi }$ , which normalizes the output to the range of $[ - 1 , 1 ]$ . Perturbations based on $\ell _ { 1 }$ or $\ell _ { 2 }$ norms can be accommodated by having the appropriate normalization layers in the final layer of $G _ { \phi }$ .
|
| 84 |
+
|
| 85 |
+
We now explain the intuition of our approach. Ideally, we would like to find a solution $\theta$ that has small risk on clean examples
|
| 86 |
+
|
| 87 |
+
$$
|
| 88 |
+
R \left( \theta \right) = \sum _ { i = 1 } ^ { n } l ( D _ { \theta } ( x _ { i } ) , y _ { i } ) ,
|
| 89 |
+
$$
|
| 90 |
+
|
| 91 |
+
and also small risk on the adversarial examples under maximum perturbation of size $\epsilon$
|
| 92 |
+
|
| 93 |
+
$$
|
| 94 |
+
R _ { a d v } ( \theta ) = \sum _ { i = 1 } ^ { n } \operatorname* { m a x } _ { \Delta x , \| \Delta x \| \leq \epsilon } l ( D _ { \theta } ( x _ { i } + \Delta x ) , y _ { i } ) .
|
| 95 |
+
$$
|
| 96 |
+
|
| 97 |
+
However, except for simple datasets like MNIST, there are usually fairly large differences between the solutions of $R ( \theta )$ and solutions of $R _ { a d v } ( \theta )$ under the same model class $D _ { \theta }$ (Tsipras et al., 2018). Optimizing for the risk under white box attacks $R _ { a d v } ( \theta )$ involves tradeoff on the risk on clean data $R ( \theta )$ . Note that $R _ { a d v } ( \theta )$ represent the risk under white box attacks, since we are free to choose the perturbation $\Delta x$ with knowledge of $\theta$ . This can be approximated using the powerful PGD attack.
|
| 98 |
+
|
| 99 |
+
Instead of allowing the perturbations $\Delta x$ to be completely free, we model the adversary as a neural network $G _ { \phi }$ with finite capacity
|
| 100 |
+
|
| 101 |
+
$$
|
| 102 |
+
R _ { G } ( \theta ) = \operatorname* { m a x } _ { \phi } \sum _ { i = 1 } ^ { n } l ( D _ { \theta } ( x _ { i } + \epsilon G _ { \phi } ( x _ { i } ) ) , y _ { i } ) .
|
| 103 |
+
$$
|
| 104 |
+
|
| 105 |
+
Here the adversarial noise $G _ { \phi } ( x _ { i } )$ is not allowed to directly depend on the discriminative network parameters $\theta$ . Also, the generative network parameter $\phi$ is shared across all examples, not computed per example like $\Delta x$ . We believe this is closer to the situation of defending against black box attacks, when the adversary does not know the discriminator network parameters. However, we still want $G _ { \phi }$ to be expressive enough to represent powerful attacks, so that $D _ { \theta }$ has a good adversary to train against. Previous work (Xiao et al., 2018; Baluja & Fischer, 2018) show that there are powerful classes of $G _ { \phi }$ that can attack trained classifiers $D _ { \theta }$ effectively.
|
| 106 |
+
|
| 107 |
+
In traditional GANs we are most interested in the distributions learned by the generative network. The discriminative network is a helper that drives the training, but can be discarded afterwards. In our setting we are interested in both the discriminative network and the generative network. The generative network in our formulation can give us a powerful adversary for attacking, while the discriminative network can give us a robust classifier that can defend against adversarial noise.
|
| 108 |
+
|
| 109 |
+
# 3.1 STABILIZING THE GAN TRAINING
|
| 110 |
+
|
| 111 |
+
The stability and convergence of GAN training is still an area of active research (Mescheder et al., 2018). In this paper we adopt gradient regularization (Mescheder et al., 2017) to stabilize the gradient descent/ascent training. Denote the minimax objective in Eq. 4 as $F ( \theta , \phi )$ . With the generative
|
| 112 |
+
|
| 113 |
+
network parameter fixed at $\phi _ { k }$ , instead of minimizing the usual objective $F ( \theta , \phi _ { k } )$ to update $\theta$ for the discriminator network, we instead try to minimize the regularized objective
|
| 114 |
+
|
| 115 |
+
$$
|
| 116 |
+
F ( \theta , \phi _ { k } ) + \frac { \gamma } { 2 } \| \nabla _ { \phi } F ( \theta , \phi _ { k } ) \| ^ { 2 } ,
|
| 117 |
+
$$
|
| 118 |
+
|
| 119 |
+
where $\gamma$ is the regularization parameter for gradient regularization. Minimizing the gradient norm $\| \nabla _ { \phi } F ( \theta , \phi _ { k } ) \| ^ { 2 }$ jointly makes sure that the norm of the gradient for $\phi$ at $\phi _ { k }$ does not grow when we update $\theta$ to reduce the objective $F ( \theta , \phi _ { k } )$ . This is important because if the gradient norm $\| \nabla _ { \phi } \bar { F } ( \theta , \phi _ { k } ) \| ^ { 2 }$ becomes large after an update of $\theta$ , it is easy to update $\phi$ to make the objective large again, leading to zigzagging behaviour and slow convergence. Note that the gradient norm term is zero at a saddle point according to the first-order optimality conditions, so the regularizer does not change the set of solutions. With these we update $\theta$ using SGD with step size $\eta _ { D }$ :
|
| 120 |
+
|
| 121 |
+
$$
|
| 122 |
+
\begin{array} { l } { { \displaystyle \theta _ { l + 1 } = \theta _ { l } - \eta _ { D } \nabla _ { \theta } [ F ( \theta _ { l } , \phi _ { k } ) + \frac { \gamma } { 2 } \| \nabla _ { \phi } F ( \theta _ { l } , \phi _ { k } ) \| ^ { 2 } ] } } \\ { { \displaystyle \quad \quad = \theta _ { l } - \eta _ { D } [ \nabla _ { \theta } F ( \theta _ { l } , \phi _ { k } ) + \gamma \nabla _ { \theta \phi } ^ { 2 } F ( \theta _ { l } , \phi _ { k } ) \nabla _ { \phi } F ( \theta _ { l } , \phi _ { k } ) ] } } \end{array}
|
| 123 |
+
$$
|
| 124 |
+
|
| 125 |
+
The Hessian-vector product term $\nabla _ { \theta \phi } ^ { 2 } F ( \theta _ { l } , \phi _ { k } ) \nabla _ { \phi } F ( \theta _ { l } , \phi _ { k } )$ can be computed with double backpropagation provided by packages like Tensorflow/PyTorch, but we find it faster to compute it with finite difference approximation. Recall that for a function $f ( x )$ with gradient $g ( x )$ and Hessian $H ( x )$ , the Hessian-vector product $H ( x ) v$ can be approximated by $( g ( x + h v ) - g ( x ) ) / h$ for small $h$ (Pearlmutter, 1994). Therefore we approximate:
|
| 126 |
+
|
| 127 |
+
$$
|
| 128 |
+
\nabla _ { \theta \phi } ^ { 2 } F ( \theta _ { l } , \phi _ { k } ) \nabla _ { \phi } F ( \theta _ { l } , \phi _ { k } ) \approx \nabla _ { \theta } [ \frac { F ( \theta _ { l } , \phi _ { k } + h v ) - F ( \theta _ { l } , \phi _ { k } ) } { h } ] ,
|
| 129 |
+
$$
|
| 130 |
+
|
| 131 |
+
where $v = \nabla _ { \phi } F ( \theta _ { l } , \phi _ { k } )$ . Note that $\phi _ { k } + h v$ is exactly a gradient step for generative network $G _ { \phi }$ . Setting $h$ to be too small can lead to numerical instability. We therefore correlate $h$ with the gradient step size and set $h = \eta _ { G } / 1 0$ to capture the curvature at the scale of the gradient ascent algorithm.
|
| 132 |
+
|
| 133 |
+
We update the generative network parameters $\phi$ with using (stochastic) gradient ascent. With the discriminative network parameters fixed at $\theta _ { l }$ and step size $\eta _ { G }$ , we update:
|
| 134 |
+
|
| 135 |
+
$$
|
| 136 |
+
\phi _ { k + 1 } = \phi _ { k } + \eta _ { G } \nabla _ { \phi } F ( \theta _ { l } , \phi _ { k } ) .
|
| 137 |
+
$$
|
| 138 |
+
|
| 139 |
+
We do not add a gradient regularization term for $\phi$ , since empirically we find that adding gradient regularization to $\theta$ is sufficient to stabilize the training.
|
| 140 |
+
|
| 141 |
+
# 3.2 GENERATIVE AND DISCRIMINATIVE NETWORK PARAMETER UPDATES
|
| 142 |
+
|
| 143 |
+
In the experiments we train both the discriminative network and generative network from scratch with random weight initializations. We do not need to pre-train the discriminative network with clean examples, or the generative network against some fixed discriminative networks, to arrive at good saddle point solutions.
|
| 144 |
+
|
| 145 |
+
In our experiments we find that the discriminative networks $D _ { \theta }$ we use tend to overpower the generative network $G _ { \phi }$ if we just perform simultaneous parameter updates to both networks. This can lead to saddle point solutions where it seems $G _ { \phi }$ cannot be improved locally against $D _ { \theta }$ , but in reality can be made more powerful by just running more gradient steps on $\phi$ . In other words we want the region around the saddle point solution to be relatively flat for $G _ { \phi }$ . To make the generative network more powerful so that the discriminative network has a good adversary to train against, we adopt the following strategy. For each update of $\theta$ for $D _ { \theta }$ , we perform multiple gradient steps on $\phi$ using the same mini-batch. This allows the generative network to learn to map the inputs in the mini-batch to adversarial noises with high loss directly, compared to running multiple gradient steps on different mini-batches. In the experiments we run 5 gradient steps on each mini-batch. We fix the tradeoff parameter $\lambda$ (Eq. 4) over loss on clean examples and adversarial loss at 1. We also fix the gradient regularization parameter $\gamma$ (Eq. 8) at 0.01, which works well for different datasets.
|
| 146 |
+
|
| 147 |
+
# 4 EXPERIMENTS
|
| 148 |
+
|
| 149 |
+
We implemented our adversarial network approach using Tensorflow(Abadi et al., 2016), with the experiments run on several machines each with 4 GTX1080 Ti GPUs. In addition to our adversarial
|
| 150 |
+
|
| 151 |
+
networks, we also train standard undefended models and models trained with adversarial training using PGD for comparison. For attacks we focus on the commonly used fast gradient sign (FGS) method, and the more powerful projected gradient descent (PGD) method.
|
| 152 |
+
|
| 153 |
+
For the fast gradient sign (FGS) attack, we compute the adversarial image by
|
| 154 |
+
|
| 155 |
+
$$
|
| 156 |
+
\begin{array} { r } { \hat { x } _ { i } = \mathrm { P r o j } _ { X } \left( x _ { i } + \epsilon \mathrm { s i g n } \nabla _ { x } l ( D _ { \theta } ( x _ { i } ) , y _ { i } ) \right) , } \end{array}
|
| 157 |
+
$$
|
| 158 |
+
|
| 159 |
+
where $\mathrm { P r o j } _ { X }$ projects onto the feasible range of rescaled pixel values $X$ (e.g., [-1,1]).
|
| 160 |
+
|
| 161 |
+
For the projected gradient descent (PGD) attack, we iterate the fast gradient sign attack multiple times with projection, with random initialization near the starting point neighbourhood.
|
| 162 |
+
|
| 163 |
+
$$
|
| 164 |
+
\begin{array} { r l } & { ~ \hat { x } _ { i } ^ { 0 } = \mathrm { P r o j } _ { X } \left( x _ { i } + \epsilon u \right) } \\ & { \hat { x } _ { i } ^ { k + 1 } = \mathrm { P r o j } _ { B _ { \epsilon } ^ { \infty } ( x _ { i } ) \cap X } \left( \hat { x } _ { i } ^ { k } + \delta \operatorname { s i g n } \nabla _ { x } \boldsymbol { l } ( D _ { \theta } ( \hat { x } _ { i } ^ { k } ) , y _ { i } ) \right) , } \end{array}
|
| 165 |
+
$$
|
| 166 |
+
|
| 167 |
+
where $u \in \mathbb { R } ^ { d }$ is a uniform random vector in $[ - 1 , 1 ] ^ { d }$ , $\delta$ is the step size, and $B _ { \epsilon } ^ { \infty } ( x _ { i } )$ is an $\ell _ { \infty }$ ball centered around the input $x _ { i }$ with radius $\epsilon$ . In the experiments we set $\delta$ to be a quarter of the perturbation $\epsilon$ , i.e., $\epsilon / 4$ , and the number of PGD steps $k$ to be 10. We adopt exactly the same PGD attack procedure when generating adversarial examples in PGD adversarial training. Our implementation is available at https://github.com/whxbergkamp/RobustDL_GAN.
|
| 168 |
+
|
| 169 |
+
# 4.1 MNIST
|
| 170 |
+
|
| 171 |
+
For MNIST the inputs are black and white images of digits of size $2 8 \mathbf { x } 2 8$ with pixel values scaled between 0 and 1. We rescale the inputs to the range of [-1,1]. Following previous work (Kannan et al., 2018), we study perturbations of $\epsilon = 0 . 3$ (in the original scale of [0,1]). We use a simple convolutional neural network similar to LeNet5 as our discriminator networks for all training methods. For our adversarial approach we use an encoder-decoder network for the generator. See Model D1 and Model G0 in the Appendix for the details of these networks. We use SGD with learning rate of $\eta _ { D } = 0 . 0 1$ and momentum 0.9, batch size of 64, and run for 200k iterations for all the discriminative networks. The learning rates are decreased by a factor of 10 after $1 0 0 \mathrm { k }$ iterations. We use SGD with a fixed learning rate $\eta _ { G } = 0 . 0 1$ with momentum 0.9 for the generative network. We use weight decay of 1E-4 for standard and adversarial PGD training, and 1E-5 for our adversarial network approach (for both $D _ { \theta }$ and $G _ { \phi }$ ). For this dataset we find that we can improve the robustness of $D _ { \theta }$ by running more updates on $G _ { \phi }$ , so we run 5 updates on $G _ { \phi }$ (each update contains 5 gradient steps described in Section 3.2 ) for each update on $D _ { \theta }$ .
|
| 172 |
+
|
| 173 |
+
Table 1(left) shows the white box attack accuracies of different models, under perturbations of $\epsilon =$ 0.3 for input pixel values between 0 and 1. Adversarial training with PGD performs best under white box attacks. Its accuracies stay above $90 \%$ under FGS and PGD attacks. Our adversarial network model performs much better than the undefended standard training model, but there is still a gap in accuracies compared to the PGD model. However, the PGD model has a small but noticeable drop in accuracy on clean examples compared to the standard model and adversarial network model.
|
| 174 |
+
|
| 175 |
+
Table 1(right) shows the black box attack accuracies of different models. We generate the black box attack images by running the FGS and PGD attacks on surrogate models A’, B’ and $\mathrm { C } '$ . These surrogate models are trained in the same way as their counterparts (standard - A, PGD - B, adversarial network - C) with the same network architecture, but using a different random seed. We notice that the black box attacks tend to be the most effective on models trained with the same method (A’ on A, $\mathbf { B } ^ { \prime }$ on B, and $\mathrm { C } '$ on C). Although adversarial PGD beats our adversarial network approach on white box attacks, they have comparable performance on these black box attacks. Interestingly, the adversarial examples from adversarial PGD (B’) and adversarial networks $\mathbf { \pi } ( \mathbf { C } ^ { \prime } )$ do not transfer well to the undefended standard model. The undefended model still have accuracies between $8 5 - 9 5 \%$ .
|
| 176 |
+
|
| 177 |
+
# 4.2 SVHN
|
| 178 |
+
|
| 179 |
+
For the Street View House Number(SVHN) data, we use the original training set, augmented with $8 0 \mathrm { k }$ randomly sampled images from the extra set as our training data. The test set remains the same and we do not perform any preprocessing on the images apart from scaling it to the range of [-1,1]. We study perturbations of size $\epsilon = 0 . 0 5$ (in the range of [0,1]). We use a version of ResNet-18(He
|
| 180 |
+
|
| 181 |
+
Table 1: Classification accuracies under white box and black box attack on MNIST $\epsilon = 0 . 3$ )
|
| 182 |
+
|
| 183 |
+
<table><tr><td rowspan="2">training method\attack</td><td colspan="2">white box</td><td rowspan="2">black box</td><td colspan="6"></td></tr><tr><td>No Noise FGS</td><td>PGD</td><td>FGS(A)</td><td>PGD(A')</td><td></td><td>FGS(B')PGD(B'))</td><td>)FGS(C')</td><td>PGD(C')</td></tr><tr><td>standard(A)</td><td>99.40%</td><td>23.70%</td><td>0.00%</td><td>39.49%</td><td>3.41%</td><td>90.56%</td><td>86.10%</td><td>94.21%</td><td>91.36%</td></tr><tr><td>adversarial PGD(B)</td><td>98.70%</td><td>95.46%</td><td>92.92%</td><td>95.78%</td><td>96.18%</td><td>95.58%</td><td>95.01%</td><td>97.05%</td><td>96.48%</td></tr><tr><td>adversarial network(C)</td><td>99.32%</td><td>94.66%</td><td>87.09%</td><td>95.75%</td><td>96.19%</td><td>96.15%</td><td>95.24%</td><td>96.96%</td><td>95.78%</td></tr></table>
|
| 184 |
+
|
| 185 |
+
<table><tr><td rowspan="2">training method\attack</td><td colspan="2">white box</td><td rowspan="2"></td><td colspan="5">black box</td></tr><tr><td>No Noise FGS</td><td>PGD</td><td>FGS(A')PGD(A')</td><td>FGS(B’)PGD(B')</td><td></td><td>FGS(C')]</td><td>PGD(C')</td></tr><tr><td>standard(A)</td><td>96.34%</td><td>64.64%</td><td>3.69%</td><td>69.47% 49.92%</td><td>56.46%</td><td>44.25%</td><td></td><td>89.71%</td><td>83.02%</td></tr><tr><td>adversarial PGD(B)</td><td>87.45%</td><td>55.94%</td><td>42.96%</td><td>85.21%</td><td>83.46% 59.09%</td><td></td><td>48.20%</td><td>87.41%</td><td>83.23%</td></tr><tr><td>adversarial network(C)</td><td>96.34%</td><td>91.51%</td><td>37.97%</td><td>90.02%</td><td>88.04%</td><td>75.34%</td><td>57.52%</td><td>91.48%</td><td>81.68%</td></tr></table>
|
| 186 |
+
|
| 187 |
+
Table 2: Classification accuracies under white box and black box attacks on SVHN $\epsilon = 0 . 0 5$ )
|
| 188 |
+
|
| 189 |
+
et al., 2016) adapted to $3 2 \mathrm { x } 3 2 $ images as our discriminative networks. For the generator in our adversarial network we use an encoder-decoder network based on residual blocks from ResNet. See Model D2 and Model G1 in the Appendix for details. For the discriminative networks we use SGD with learning rate of $\eta _ { D } = 0 . 0 1$ and momentum 0.9, batch size of 64, weight decay of 1E-4 and run for $1 0 0 \mathrm { k }$ iterations, and then decrease the learning rate to 0.001 and run for another $1 0 0 \mathrm { k }$ iterations. For the generative network we use SGD with a fixed learning rate of $\eta _ { G } = 0 . 0 1$ and momentum 0.9, and use weight decay of 1E-4.
|
| 190 |
+
|
| 191 |
+
Table 2(left) shows the white box attack accuracies of the models. Adversarial PGD performs best against PGD attacks, but has lower accuracies on clean data and against FGS attacks, since it is difficult to optimize over all three objectives with finite network capacity. Our adversarial network approach has the best accuracies on clean data and against FGS attacks, and also improved accuracies against PGD over standard training.
|
| 192 |
+
|
| 193 |
+
Table 2(right) shows the black box attack accuracies of the models. As before A’, B’, C’ are networks trained in the same ways as their counterparts, but with a different random seed. We can see that the adversarial network approach performs best across most attacks, except the PGD attack from its own copy $\mathbf { C } '$ . It is also interesting to note that for this dataset, adversarial examples generated from the adversarial PGD model $\mathbf { B } ^ { \ast }$ have the strongest attack power across all models. In the other two datasets, adversarial examples generated from a model are usually most effective against their counterparts that are trained in the same way.
|
| 194 |
+
|
| 195 |
+
# 4.3 CIFAR10
|
| 196 |
+
|
| 197 |
+
For CIFAR10 we scale the $3 2 \mathrm { x } 3 2 $ inputs to the range of [-1,1]. We also perform data augmentation by randomly padding and cropping the images by at most 4 pixels, and randomly flipping the images left to right. In this experiment we use the same discriminative and generative networks as in SVHN. We study perturbations of size $\epsilon = 8 / 2 5 6$ . We train the discriminative networks with batch size of 64, and learning rate of $\eta _ { D } = 0 . 1$ for 100k iterations, and decrease learning rate to 0.01 for another 100k iterations. We use Adam with learning rate $\eta _ { G } ~ = ~ 0 . 0 0 2$ , $\beta _ { 1 } ~ = ~ 0 . 5$ , $\beta _ { 2 } ~ = ~ 0 . 9 9 9$ for the generative network. We use weight decay 1E-4 for standard training, and 1E-5 for adversarial PGD and our adversarial networks.
|
| 198 |
+
|
| 199 |
+
Table 3(left) shows the white box accuracies of different models under attack with $\epsilon = 8 / 2 5 6$ . The PGD model has the best accuracy under PGD attack, but suffer a considerably lower accuracy on clean data and FGS attack. One reason for this is that it is difficult to balance between the objective of getting good accuracies on clean examples and good accuracies on very hard PGD attack adversarial examples with a discriminative network of limited capacity. Our adversarial model is able to keep up with the standard model in terms of accuracies on clean examples, and improve upon it on accuracies against FGS and PGD attacks.
|
| 200 |
+
|
| 201 |
+
Table 3(right) shows the black box attack accuracies of the models. Our adversarial network method works better than the other approaches in general, except for the PGD attack from the most similar model C’. The adversarial PGD model also works quite well except against its own closest model $\mathbf { B } ^ { \prime }$ , and offers the smallest drop in accuracies in general. But its overall results are not the best since it suffers from the disadvantage of having a lower baseline accuracy on clean examples.
|
| 202 |
+
|
| 203 |
+
Table 3: Classification accuracies under white box and black box attack on CIFAR10 $\epsilon = 8 / 2 5 6 )$
|
| 204 |
+
|
| 205 |
+
<table><tr><td rowspan="2">training method\attack</td><td colspan="2">white box</td><td rowspan="2">black box</td><td colspan="5"></td></tr><tr><td>No Noise FGS</td><td>PGD</td><td>FGS(A') PGD(A')</td><td></td><td>FGS(B') PGD(B')</td><td>FGS(C')</td><td>PGD(C')</td></tr><tr><td>standard(A)</td><td>91.59%</td><td>57.31%</td><td>1.32%</td><td>67.99%</td><td>22.88%</td><td>77.13%</td><td>75.06%</td><td>73.34%</td><td>55.34%</td></tr><tr><td>adversarial PGD(B)</td><td>75.30%</td><td>47.63%</td><td>41.16%</td><td>74.04%</td><td>74.23%</td><td>57.73%</td><td>55.72%</td><td>73.31%</td><td>73.09%</td></tr><tr><td>adversarial network(C)</td><td>91.08%</td><td>72.81%</td><td>44.28%</td><td>81.74%</td><td>79.48%</td><td>77.23%</td><td>74.04%</td><td>78.51%</td><td>66.74%</td></tr></table>
|
| 206 |
+
|
| 207 |
+
Table 4: Classification accuracies under white box and black box attacks on ensemble adversarial training and adversarial networks on different datasets
|
| 208 |
+
|
| 209 |
+
<table><tr><td rowspan="2">training method\attack</td><td colspan="3">white box</td><td colspan="5">black box</td></tr><tr><td>No Noise FGS</td><td></td><td>PGD</td><td>FGS(A') PGD(A')</td><td>FGS(B') PGD(B') I</td><td></td><td>FGS(C')</td><td>PGD(C')</td></tr><tr><td>ensemble(MNIST,ε=0.3)</td><td>98.65%</td><td>2.52%</td><td>0.00%</td><td>90.91% 93.91%</td><td>90.94%</td><td>88.12%</td><td>90.79%</td><td>89.61%</td></tr><tr><td>adv. net(MNIST,ε=0.3)</td><td>99.03%</td><td>94.66%</td><td>87.09%</td><td>95.75% 96.19%</td><td>96.15%</td><td>95.24%</td><td>96.96%</td><td>95.78%</td></tr><tr><td>ensemble(SVHN,e=0.05)</td><td>95.30%</td><td>79.16%</td><td>2.74%</td><td>95.32% 93.88%</td><td>67.97%</td><td>54.81%</td><td>95.60%</td><td>93.21%</td></tr><tr><td>adv. net(SVHN,e=0.05)</td><td>96.34%</td><td>91.51%</td><td>37.97%</td><td>90.02% 88.04%</td><td>75.34%</td><td>57.52%</td><td>91.48%</td><td>81.68%</td></tr><tr><td>ensemble(CIFAR10,e= 8</td><td>87.17%</td><td>57.91%</td><td>11.35%</td><td>85.01% 85.19%</td><td>68.76%</td><td>67.41%</td><td>79.64%</td><td>70.98%</td></tr><tr><td>adv. net(CIFAR10,ε= 25</td><td>91.08%</td><td>72.81%</td><td>44.28%</td><td>81.74%</td><td>79.48% 77.23%</td><td>74.04%</td><td>78.51%</td><td>66.74%</td></tr></table>
|
| 210 |
+
|
| 211 |
+
We have also performed experiments on CIFAR10 using a wider version of ResNet (Zagoruyko & Komodakis, 2016) by multiplying the number of filters by 10 in each of the convolutional layers. These wider version of ResNets have higher accuracies, but the relative strengths of the methods are similar to those presented here. In addition we have experiments on CIFAR100, and the results are qualitatively similar to CIFAR10. All these results are presented in the Appendix due to space restrictions.
|
| 212 |
+
|
| 213 |
+
# 4.4 COMPARING AGAINST ENSEMBLE ADVERSARIAL TRAINING
|
| 214 |
+
|
| 215 |
+
We also compare against a version of ensemble adversarial training (Tramer et al., 2018) on the \` above 3 datasets. Ensemble adversarial training works by including adversarial examples generated from static pre-trained models to enlarge the training set, and then train a new model on top of it. The quality of solutions depends on the type of adversarial examples included. Here we construct adversarial examples by running FGS (Eq. 10) and PGD (Eq. 11) on an undefended model, i.e., FGS(A) and PGD(A) in the previous tables. Here for FGS we substitute the target label $y$ with the most likely class arg max $\bar { D _ { \theta } } ( x )$ to avoid the problem of label leakage. Following Tramer et al. \` (2018) we also include another attack using the least likely class:
|
| 216 |
+
|
| 217 |
+
$$
|
| 218 |
+
\hat { x } _ { i } = \mathrm { P r o j } _ { X } \left( x _ { i } - \epsilon \mathrm { s i g n } \nabla _ { x } l ( D _ { \theta } ( x _ { i } ) , y _ { L L } ) \right) ,
|
| 219 |
+
$$
|
| 220 |
+
|
| 221 |
+
where $y _ { L L } = \arg \operatorname* { m i n } D _ { \theta } ( x _ { i } )$ is the least likely class. We include all these adversarial examples together with the original clean data for training. We use the same perturbations $\epsilon$ as in the respective experiments above.
|
| 222 |
+
|
| 223 |
+
Table 4 shows the results comparing ensemble adversarial training (EAT) with our adversarial networks approach. On MNIST, adversarial networks is better on white box attacks and also better on all black box attacks using models trained with standard training(A’), adversarial PGD(B’), and our adversarial networks approach(C’) with different random seeds. On SVHN and CIFAR10 adversarial networks is better on white box attacks, and both methods have wins and losses on the black box attacks, depending on the attacks used. In general adversarial networks seem to have better white box attack accuracies since they are trained dynamically with a varying adversary. The black box accuracies depend a lot on the dataset and the type of attacks used. There is no definitive conclusion on whether training against a static set of adversaries as in EAT or training against a dynamically adjusting adversary as in adversarial networks is a better approach against black box attacks. This is an interesting question requiring further research.
|
| 224 |
+
|
| 225 |
+
Table 5: Attack performance of various generator networks against an undefended network in terms of test accuracies. First column is the accuracy on the discriminative model $D _ { \theta }$ that the generative attacker $G _ { \phi }$ is trained on (similar to white box attacks). The next three columns are the attack accuracies on other models by the learned $G _ { \phi }$ (similar to black box attacks)
|
| 226 |
+
|
| 227 |
+
<table><tr><td>Generator</td><td>Original (A)</td><td>standard(A')</td><td>adversarial PGD(B')</td><td>adversarial network(C')</td></tr><tr><td>original accuracy</td><td>91.59%</td><td>90.54%</td><td>75.71%</td><td>89.21%</td></tr><tr><td>autoencoder(8 filters)</td><td>31.07%</td><td>41.40%</td><td>74.56%</td><td>84.59%</td></tr><tr><td>autoencoder(64 filters)</td><td>6.08%</td><td>14.74%</td><td>75.52%</td><td>86.64%</td></tr><tr><td>random Gaussian</td><td>45.27%</td><td>58.68%</td><td>75.02%</td><td>87.33%</td></tr><tr><td>label</td><td>11.17%</td><td>23.29%</td><td>74.78%</td><td>82.43%</td></tr></table>
|
| 228 |
+
|
| 229 |
+
Table 6: Classification accuracies under white box and black box attacks on CIFAR10 for adversarial networks trained with different generative adversaries $\zeta = 8 / 2 5 6 )$ )
|
| 230 |
+
|
| 231 |
+
<table><tr><td rowspan="2">training method\attack</td><td colspan="3">white box</td><td colspan="4">black box</td></tr><tr><td>No Noise</td><td>FGS</td><td>PGD</td><td>FGS(A')</td><td>PGD(A')</td><td>FGS(B')</td><td>PGD(B')</td></tr><tr><td>autoencoder(8 filters)</td><td>88.70%</td><td>67.28%</td><td>33.56%</td><td>78.94%</td><td>74.15%</td><td>70.70%</td><td>68.54%</td></tr><tr><td>autoencoder(64 filters)</td><td>89.10%</td><td>67.05%</td><td>33.38%</td><td>79.56%</td><td>74.40%</td><td>70.52%</td><td>68.66%</td></tr><tr><td>random Gaussian</td><td>89.73%</td><td>69.43%</td><td>35.16%</td><td>80.09%</td><td>76.02%</td><td>71.22%</td><td>69.66%</td></tr><tr><td>label</td><td>88.72%</td><td>67.09%</td><td>37.70%</td><td>80.95%</td><td>77.80%</td><td>70.90%</td><td>68.81%</td></tr></table>
|
| 232 |
+
|
| 233 |
+
# 4.5 EXAMINING THE GENERATIVE NETWORKS
|
| 234 |
+
|
| 235 |
+
We also did a more in-depth study on the generative network with CIFAR10. We want to understand how the capacity of the generative network affects the quality of saddle point solution, and also the power of the generative networks themselves as adversarial attack methods. First we study the ability of the generative networks to learn to attack a fixed undefended discriminative network. The architectures of the generative networks (G1, G2, G3) are described in the Appendix. Here we study a narrow (G1, $k = 8$ ) and a wide version (G1, $k = 6 4$ ) of autoencoder networks using the input images as inputs, and also decoder networks $G ( z )$ using random Gaussian vectors $z \in \mathring { \mathbb { R } } ^ { d }$ (G2) or networks $G ( y )$ using the labels $y$ (G3) as inputs. We run SGD for $2 0 0 \mathrm { k }$ iterations with step size 0.01 and momentum of 0.9, and use weight decay of 1E-5. We report test accuracies on the original discriminator after attacks.
|
| 236 |
+
|
| 237 |
+
From Table 5 the wide autoencoder is more powerful than the narrow autoencoder in attacking the undefended discriminator network across different models. As a white-box attack method, the wide autoencoder is close to PGD in terms of attack power $( 6 . 0 8 \%$ vs $1 . 3 2 \%$ in Table 3(left)) on the undefended model. As a black-box attack method on the undefended model $\mathbf { A } '$ , it works even better than PGD ( $1 4 . 7 4 \%$ vs $2 2 . 8 8 \%$ in Table 3(right)). However, on defended models trained with PGD and our adversarial network approach the trained generator networks do not have much effect. PGD is especially robust with very small drops in accuracies against these attacks.
|
| 238 |
+
|
| 239 |
+
It is interesting that generator network $G ( z )$ with random Gaussian $z$ as inputs and $G ( y )$ with label as input works well against undefended models A and $\mathbf { A } '$ , reducing the accuracies by more than $30 \%$ , even though they are not as effective as using the image as input. $G ( z )$ is essentially a distribution of random adversarial noise that we add to the image without knowing the image or label. $G ( y )$ is a generator network with many parameters, but after training it is essentially a set of 10 class conditional $3 2 \mathbf { x } 3 2 \mathbf { x } 3$ filters. We have also performed similar experiments on attacking models trained with adversarial PGD and our adversarial networks using the above generative networks. The results are included in the Appendix due to space restrictions.
|
| 240 |
+
|
| 241 |
+
We also co-train these different generative networks with our discriminative network (D2) on CIFAR10. The results are shown in Table 6. It is slightly surprising that they all produce very similar performance in terms of white box and black box attacks, even as they have different attack powers against undefended networks. The generative networks do have very similar decoder portions, and this could be a reason why they all converge to saddle points of similar quality.
|
| 242 |
+
|
| 243 |
+
# 4.6 DISCUSSIONS
|
| 244 |
+
|
| 245 |
+
In the experiments above we see that adversarial PGD training usually works best on white box attacks, but there is a tradeoff between accuracies on clean data against accuracies on adversarial examples due to finite model capacity. We can try to use models with larger capacity, but there is always a tradeoff between the two, especially for larger perturbations $\epsilon$ . There are some recent works that indicate training for standard accuracy and training for adversarial accuracy (e.g., with PGD) are two fairly different problems (Schmidt et al., 2018; Tsipras et al., 2018). Examples generated from PGD are particularly difficult to train against. This makes adversarial PGD training disadvantaged in many black box attack situations, when compared with models trained with weaker adversaries, e.g., ensemble adversarial training and our adversarial networks method.
|
| 246 |
+
|
| 247 |
+
We have also observed in the experiments that for black box attacks, the most effective adversarial examples are usually those constructed from models trained using the same method but with different random seed. This suggests hiding the knowledge of the training method from the attacker could be an important factor in defending against black box attacks. Defending against black box attacks is closely related to the question of the transferability of adversarial examples. Although there are some previous works exploring this question (Liu et al., 2017), the underlying factors affecting transferability are still not well understood.
|
| 248 |
+
|
| 249 |
+
In our experimentation with the architectures of the discriminative and generative networks, the choice of architectures of $G _ { \phi }$ does not seem to have a big effect on the quality of solution. The dynamics of training, such as the step size used and the number of iterations to run for each network during gradient descent/ascent, seem to have a bigger effect on the saddle point solution quality than the network architecture. It would be interesting to find classes of generative network architectures that lead to substantially different saddle points when trained against a particular discriminative network architecture. Also, recent works have shown that there are connected flat regions in the minima of neural network loss landscapes (Garipov et al., 2018; Draxler et al., 2018). We believe that the same might hold true for GANs, and it would be interesting to explore how the training dynamics can lead to different GAN solutions that might have different robustness properties.
|
| 250 |
+
|
| 251 |
+
Our approach can be extended with multiple discriminative networks playing against multiple generative networks. It can also be combined with ensemble adversarial training, where some adversarial examples come from static pre-trained models, while some other come from dynamically adjusting generative networks.
|
| 252 |
+
|
| 253 |
+
# 5 CONCLUSIONS
|
| 254 |
+
|
| 255 |
+
We have proposed an adversarial network approach to learning discriminative neural networks that are robust to adversarial noise, especially under black box attacks. For future work we are interested in extending the experiments to ImageNet, and exploring the choice of architectures of the discriminative and generative networks and their interaction.
|
| 256 |
+
|
| 257 |
+
# REFERENCES
|
| 258 |
+
|
| 259 |
+
Mart´ın Abadi, Paul Barham, Jianmin Chen, Zhifeng Chen, Andy Davis, Jeffrey Dean, Matthieu Devin, Sanjay Ghemawat, Geoffrey Irving, Michael Isard, et al. Tensorflow: a system for largescale machine learning. In OSDI, volume 16, pp. 265–283, 2016.
|
| 260 |
+
|
| 261 |
+
Shumeet Baluja and Ian Fischer. Adversarial transformation networks: Learning to generate adversarial examples. In AAAI Conference on Artificial Intelligence, 2018.
|
| 262 |
+
|
| 263 |
+
Jacob Buckman, Aurko Roy, Colin Raffel, and Ian Goodfellow. Thermometer encoding: One hot way to resist adversarial examples. In International Conference on Learning Representations, 2018.
|
| 264 |
+
|
| 265 |
+
Nicholas Carlini and David Wagner. Towards evaluating the robustness of neural networks. In 2017 IEEE Symposium on Security and Privacy (SP), pp. 39–57. IEEE, 2017.
|
| 266 |
+
|
| 267 |
+
Felix Draxler, Kambis Veschgini, Manfred Salmhofer, and Fred A Hamprecht. Essentially no barriers in neural network energy landscape. In International Conference on Machine Learning, 2018.
|
| 268 |
+
|
| 269 |
+
Timur Garipov, Pavel Izmailov, Dmitrii Podoprikhin, Dmitry P Vetrov, and Andrew Gordon Wilson. Loss surfaces, mode connectivity, and fast ensembling of DNNs. Advances in Neural Information Processing Systems, 2018.
|
| 270 |
+
|
| 271 |
+
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.
|
| 272 |
+
|
| 273 |
+
Ian Goodfellow, Jonathon Shlens, and Christian Szegedy. Explaining and harnessing adversarial examples. In International Conference on Learning Representations, 2015.
|
| 274 |
+
|
| 275 |
+
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.
|
| 276 |
+
|
| 277 |
+
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.
|
| 278 |
+
|
| 279 |
+
Andrew Ilyas, Ajil Jalal, Eirini Asteri, Constantinos Daskalakis, and Alexandros G Dimakis. The robust manifold defense: Adversarial training using generative models. arXiv preprint arXiv:1712.09196, 2017.
|
| 280 |
+
|
| 281 |
+
Harini Kannan, Alexey Kurakin, and Ian Goodfellow. Adversarial logit pairing. arXiv preprint arXiv:1803.06373, 2018.
|
| 282 |
+
|
| 283 |
+
Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton. Imagenet classification with deep convolutional neural networks. In Advances in Neural Information Processing Systems, pp. 1097–1105, 2012.
|
| 284 |
+
|
| 285 |
+
Alexey Kurakin, Ian Goodfellow, and Samy Bengio. Adversarial machine learning at scale. In International Conference on Learning Representations, 2017.
|
| 286 |
+
|
| 287 |
+
Hyeungill Lee, Sungyeob Han, and Jungwoo Lee. Generative adversarial trainer: Defense to adversarial perturbations with GAN. arXiv preprint arXiv:1705.03387, 2017.
|
| 288 |
+
|
| 289 |
+
Yanpei Liu, Xinyun Chen, Chang Liu, and Dawn Song. Delving into transferable adversarial examples and black-box attacks. In International Conference on Learning Representations, 2017.
|
| 290 |
+
|
| 291 |
+
Yan Lou, Xavier Boix, Gemma Roig, Tomaso Poggio, and Qi Zhao. Foveation-based mechanisms alleviate adversarial examples. Technical report, Center for Brains, Minds and Machines (CBMM), arXiv, 2016.
|
| 292 |
+
|
| 293 |
+
Aleksander Madry, Aleksandar Makelov, Ludwig Schmidt, Dimitris Tsipras, and Adrian Vladu. Towards deep learning models resistant to adversarial attacks. In International Conference on Learning Representations, 2018.
|
| 294 |
+
|
| 295 |
+
Lars Mescheder, Sebastian Nowozin, and Andreas Geiger. The numerics of GANs. In Advances in Neural Information Processing Systems, pp. 1825��1835, 2017.
|
| 296 |
+
|
| 297 |
+
Lars Mescheder, Andreas Geiger, and Sebastian Nowozin. Which training methods for GANs do actually converge? In International Conference on Machine Learning, pp. 3478–3487, 2018.
|
| 298 |
+
|
| 299 |
+
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, 2015.
|
| 300 |
+
|
| 301 |
+
Seyed-Mohsen Moosavi-Dezfooli, Alhussein Fawzi, Omar Fawzi, and Pascal Frossard. Universal adversarial perturbations. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 1765–1773, 2017.
|
| 302 |
+
|
| 303 |
+
Taesik Na, Jong Hwan Ko, and Saibal Mukhopadhyay. Cascade adversarial machine learning regularized with a unified embedding. In International Conference on Learning Representations, 2018.
|
| 304 |
+
|
| 305 |
+
Nicolas Papernot, Patrick McDaniel, Somesh Jha, Matt Fredrikson, Z Berkay Celik, and Ananthram Swami. The limitations of deep learning in adversarial settings. In Security and Privacy (EuroS&P), 2016 IEEE European Symposium on, pp. 372–387. IEEE, 2016a.
|
| 306 |
+
|
| 307 |
+
Nicolas Papernot, Patrick McDaniel, Xi Wu, Somesh Jha, and Ananthram Swami. Distillation as a defense to adversarial perturbations against deep neural networks. In 2016 IEEE Symposium on Security and Privacy $( S P )$ , pp. 582–597. IEEE, 2016b.
|
| 308 |
+
|
| 309 |
+
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.
|
| 310 |
+
|
| 311 |
+
Barak A Pearlmutter. Fast exact multiplication by the Hessian. Neural computation, 6(1):147–160, 1994.
|
| 312 |
+
|
| 313 |
+
Pouya Samangouei, Maya Kabkab, and Rama Chellappa. Defense-GAN: Protecting classifiers against adversarial attacks using generative models. In International Conference on Learning Representations, 2018.
|
| 314 |
+
|
| 315 |
+
Ludwig Schmidt, Shibani Santurkar, Dimitris Tsipras, Kunal Talwar, and Aleksander Madry. Adversarially robust generalization requires more data. In Advances in Neural Information Processing Systems, 2018.
|
| 316 |
+
|
| 317 |
+
Christian Szegedy, Wojciech Zaremba, Ilya Sutskever, Joan Bruna, Dumitru Erhan, Ian Goodfellow, and Rob Fergus. Intriguing properties of neural networks. In International Conference on Learning Representations, 2014.
|
| 318 |
+
|
| 319 |
+
Florian Tramer, Alexey Kurakin, Nicolas Papernot, Ian Goodfellow, Dan Boneh, and Patrick Mc- \` Daniel. Ensemble adversarial training: Attacks and defenses. In International Conference on Learning Representations, 2018.
|
| 320 |
+
|
| 321 |
+
Dimitris Tsipras, Shibani Santurkar, Logan Engstrom, Alexander Turner, and Aleksander Madry. Robustness may be at odds with accuracy. arXiv preprint arXiv:1805.12152, 2018.
|
| 322 |
+
|
| 323 |
+
Chaowei Xiao, Bo Li, Jun-Yan Zhu, Warren He, Mingyan Liu, and Dawn Song. Generating adversarial examples with adversarial networks. In Proceedings of the Twenty-Seventh International Joint Conference on Artificial Intelligence, 2018.
|
| 324 |
+
|
| 325 |
+
Cihang Xie, Jianyu Wang, Zhishuai Zhang, Zhou Ren, and Alan Yuille. Mitigating adversarial effects through randomization. In International Conference on Learning Representations, 2018.
|
| 326 |
+
|
| 327 |
+
Sergey Zagoruyko and Nikos Komodakis. Wide residual networks. In British Machine Vision Confernece (BMVC), 2016.
|
| 328 |
+
|
| 329 |
+
# APPENDIX
|
| 330 |
+
|
| 331 |
+
# NETWORK ARCHITECTURES
|
| 332 |
+
|
| 333 |
+
Our networks are mostly based on ResNet. Figure 2 shows the residual block used in our networks. We denote a residual block with $k$ copies of $d \times d$ filters, with a stride of $s$ in the first convolution as residual-block $( d , s , k )$ . A stride of 2 means the inputs are downsampled by a factor of 2. The notation $\mathrm { c o n v } 2 \mathrm { d } ( d , \ : s , \ : k )$ refers to a convolutional layer with $k$ copies of $d \times d$ filters, convolved with stride $s$ , and similarly for the deconvolution deconv $2 \mathrm { d } ( d , s , k )$ . The notations maxpool $( s )$ and avgpool(s) denote max-pooling and average pooling operations with strides $s$ . FC denotes a fully connected layer, while BN denotes a batch normalization layer.
|
| 334 |
+
|
| 335 |
+
Figure 3 shows the discriminative networks used in this paper. D1 is a simple convolutional neural network used in the MNIST experiments. D2 is the standard version of ResNet. Figure 4 shows the generative networks used in this paper. G0 and G1 are encoder-decoder networks, while G2 and G3 are decoder networks using a random vector and a one-hot encoding of the label respectively. The generative networks are parameterized by a factor $k$ determining the number of filters used (width of network). As default we use $k = 6 4$ , and $k = 1 6$ for networks using labels as inputs.
|
| 336 |
+
|
| 337 |
+

|
| 338 |
+
Figure 2: Residual block used in the network definitions
|
| 339 |
+
|
| 340 |
+

|
| 341 |
+
Figure 3: Discriminative networks used in this paper
|
| 342 |
+
|
| 343 |
+
# EXTRA RESULTS ON CIFAR100 AND WIDE RESNET ON CIFAR10
|
| 344 |
+
|
| 345 |
+
The discriminative and generative networks in our CIFAR100 experiment have the same network architecture as the CIFAR10 experiment, except that the output layer dimension of the D network is 100 other than 10 in CIFAR10. We use learning rate of 0.1 for the first $1 0 0 \mathrm { k }$ iterations, and 0.01 for another $1 0 0 \mathrm { k }$ iterations. The batch size is 64 and weight decay is 1E-5.
|
| 346 |
+
|
| 347 |
+
Table 7(left) presents the white box attack accuracies of different models with $\epsilon = 8 / 2 5 6$ . From the table we can see that the PGD adversarial training has the best defensive performance under PGD attack, but still suffers performance degradation on clean image and FGS attack. Our adversarial model gives similar classification performance as the standard model on clean image, and improves classification accuracies on FGS and PGD attack. Table 7(right) shows the black box attack accuracies of different models. Our adversarial network approach gives the best classification accuracy in most cases, except the FGS and PGD attack from model $\mathbf { C } '$ .
|
| 348 |
+
|
| 349 |
+
<table><tr><td rowspan="2">training method attack</td><td colspan="2">white box</td><td rowspan="2">black box</td><td colspan="6"></td></tr><tr><td>No Noise FGS</td><td>PGD</td><td></td><td>FGS(A') PGD(A') FGS(B') PGD(B') FGS(C') PGD(C')</td><td></td><td></td><td></td><td></td></tr><tr><td>standard(A)</td><td>70.11%</td><td>31.27%</td><td>4.61%</td><td>44.24%</td><td>32.55%</td><td>53.65%</td><td>50.51%</td><td>47.82%</td><td>34.99%</td></tr><tr><td>adversarial PGD(B)</td><td>55.53%</td><td>32.13%</td><td>28.48%</td><td>53.91%</td><td>54.62%</td><td>41.80%</td><td>40.61%</td><td>54.55%</td><td> 53.57%</td></tr><tr><td>adversarial network(C)</td><td>70.99 %</td><td>41.86%</td><td>18.25%</td><td>58.11%</td><td>56.94%</td><td> 53.15%</td><td> 51.87%</td><td>53.35%</td><td>46.61%</td></tr></table>
|
| 350 |
+
|
| 351 |
+
Table 7: Classification accuracies under white box and black box attacks on CIFAR100 $\epsilon = 8 / 2 5 6 )$ )
|
| 352 |
+
|
| 353 |
+

|
| 354 |
+
Figure 4: Generative networks used in this paper
|
| 355 |
+
|
| 356 |
+
Table 8: Classification accuracies under white box and black box attacks on CIFAR10 with Wide ResNet $( \epsilon = 8 / 2 5 6 )$ )
|
| 357 |
+
|
| 358 |
+
<table><tr><td rowspan="2">training method\attack</td><td colspan="2">white box</td><td rowspan="2">black box</td><td colspan="5"></td></tr><tr><td>No Noise FGS</td><td>PGD</td><td>FGS(A)]</td><td>)PGD(A') FGS(B')PGD(B') FGS(C') PGD(C")</td><td></td><td></td><td></td></tr><tr><td>standard(A)</td><td>94.69%</td><td>62.36%</td><td>1.08%</td><td>69.89% 9.14%</td><td>85.05%</td><td>82.82%</td><td>76.27%</td><td>45.16%</td></tr><tr><td>adversarial PGD(B)</td><td>83.50%</td><td>67.92%</td><td>60.15%</td><td>83.21% 82.96%</td><td>72.66%</td><td>68.82%</td><td>82.01%</td><td>78.59%</td></tr><tr><td>adversarial network(C)</td><td>91.32%</td><td>73.77%</td><td>49.55%</td><td>83.29 % 81.65%</td><td>79.32%</td><td>76.00%</td><td>79.32%</td><td>62.71%</td></tr></table>
|
| 359 |
+
|
| 360 |
+
Table 8 gives the results on CIFAR10 using a wider version of Resnet (Model D2), by multiplying the number of filters in each convolutional layer by a factor of 10. Some of the previous works in the literature use models of larger capacity for training adversarially robust models, so we perform experiments on these large capacity models here. First the accuracies increase across the board with larger capacity models. The accuracy gap on clean data between adversarial PGD and standard training still exists, but now there is also a small accuracy gap between our adversarial network approach and standard training. For the rest of the white box and black accuracies the story is similar, the models are weakest against attacks trained with the same method but with a different random seed. Our adversarial network approach has very good performance across different attacks, even as it is not always the winner for each individual attack. Table 9 gives the results of Wide ResNet on CIFAR100, and the results are qualitatively similar.
|
| 361 |
+
|
| 362 |
+
# EXTRA RESULTS ON ATTACKING USING GENERATIVE NETWORKS AND THEIR TRANSFERABILITY
|
| 363 |
+
|
| 364 |
+
Following Section 4.5, we run extra experiments on using different generative networks to attack networks trained with adversarial PGD and our adversarial networks approach, in addition to the
|
| 365 |
+
|
| 366 |
+
<table><tr><td rowspan="2">training method\attack</td><td colspan="2">white box</td><td rowspan="2"></td><td colspan="5">black box</td></tr><tr><td>No Noise FGS</td><td>PGD</td><td>FGS(A) PGD(A)]</td><td></td><td>FGS(B') PGD(B’) FGS(C')</td><td></td><td>PGD(C')</td></tr><tr><td>standard(A)</td><td>79.22%</td><td>44.86%</td><td>6.38%</td><td>48.52% 13.42%</td><td>65.18%</td><td>63.56%</td><td>53.17%</td><td>28.04%</td></tr><tr><td>adversarial PGD(B)</td><td>66.68%</td><td>45.54%</td><td>38.36%</td><td>64.81% 64.84%</td><td>53.41%</td><td>49.77%</td><td>64.35%</td><td>62.44%</td></tr><tr><td>adversarial network(C)</td><td>80.21%</td><td>57.21%</td><td>30.27%</td><td>65.37% 58.27%</td><td>67.38%</td><td>64.28%</td><td>61.11%</td><td>40.27%</td></tr></table>
|
| 367 |
+
|
| 368 |
+
Table 9: Classification accuracies under white box and black box attacks on CIFAR100 with Wide Resnet $\epsilon = 8 / 2 5 6 )$
|
| 369 |
+
|
| 370 |
+
Table 10: Attack performance of various generator networks against a network trained with adversarial PGD in terms of test accuracies. First column is the accuracy on the discriminative model $D _ { \theta }$ that the generative attacker $G _ { \phi }$ is trained on (similar to white box attacks). The next three columns are the attack accuracies on other models by the learned $G _ { \phi }$ (similar to black box attacks)
|
| 371 |
+
|
| 372 |
+
<table><tr><td>Generator</td><td>Original (B)</td><td>standard(A')</td><td>adversarial PGD(B')</td><td>adversarial network(C')</td></tr><tr><td>original accuracy</td><td>75.30%</td><td>90.54%</td><td>75.71%</td><td>89.21%</td></tr><tr><td>autoencoder(8 filters)</td><td>72.74%</td><td>88.38%</td><td>73.07%</td><td>87.89%</td></tr><tr><td>autoencoder(64 filters)</td><td>71.26%</td><td>87.64%</td><td>71.98%</td><td>87.02%</td></tr><tr><td>random Gaussian</td><td>74.13%</td><td>88.71%</td><td>74.70%</td><td>88.45%</td></tr><tr><td>label</td><td>70.15%</td><td>84.95%</td><td>70.10%</td><td>84.96%</td></tr></table>
|
| 373 |
+
|
| 374 |
+
Table 11: Attack performance of various generator networks against our adversarial network in terms of test accuracies. First column is the accuracy on the discriminative model $D _ { \theta }$ that the generative attacker $G _ { \phi }$ is trained on (similar to white box attacks). The next three columns are the attack accuracies on other models by the learned $G _ { \phi }$ (similar to black box attacks)
|
| 375 |
+
|
| 376 |
+
<table><tr><td>Generator</td><td>Original (C)</td><td>standard(A')</td><td>adversarial PGD(B')</td><td>adversarial network(C')</td></tr><tr><td>original accuracy</td><td>91.08%</td><td>90.54%</td><td>75.71%</td><td>89.21%</td></tr><tr><td>autoencoder(8 filters)</td><td>74.66%</td><td>66.95%</td><td>74.42%</td><td>80.55%</td></tr><tr><td>autoencoder(64 filters)</td><td>53.68%</td><td>46.37%</td><td>73.08%</td><td>72.18%</td></tr><tr><td>random Gaussian</td><td>85.91%</td><td>71.00%</td><td>75.00%</td><td>86.55%</td></tr><tr><td>label</td><td>81.46%</td><td>77.46%</td><td>73.09%</td><td>83.98%</td></tr></table>
|
| 377 |
+
|
| 378 |
+
undefended network in Section 4.5. Table 10 shows the results of various generative networks in attacking a network trained with adversarial PGD. The adversarial PGD network is very robust, and the generative networks can at most reduce the accuracy by $5 \%$ . Interestingly, the strongest attack come from the more restrictive generative network using only the label as input. It is also the most successful in transferring to other networks. However, since the adversarial PGD network is so robust, none of the generative networks can learn much from it in generating adversarial examples.
|
| 379 |
+
|
| 380 |
+
Table 11 shows the results of various generative networks in attacking our adversarial network. Our adversarial network is not as robust as adversarial PGD under white box attack, and the autoencoder(64 filters) network can reduce its accuracy from over $90 \%$ to $53 \%$ . Nonetheless, it is still much more robust than the undefended network. Interestingly, in addition to transferring well to the adversarial network trained with a different random seed $\mathbf { \pi } ( \mathbf { C } )$ , the autoencoder(64 filters) network also transfers well to the undefended network, reducing its accuracy to $46 \%$ .
|
md/train/S1lOTC4tDS/S1lOTC4tDS.md
ADDED
|
@@ -0,0 +1,346 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# DREAM TO CONTROL: LEARNING BEHAVIORS BY LATENT IMAGINATION
|
| 2 |
+
|
| 3 |
+
Jimmy Ba University of Toronto
|
| 4 |
+
|
| 5 |
+
Danijar Hafner ∗ Timothy Lillicrap University of Toronto DeepMind Google Brain
|
| 6 |
+
|
| 7 |
+
Mohammad Norouzi Google Brain
|
| 8 |
+
|
| 9 |
+
# Abstract
|
| 10 |
+
|
| 11 |
+
Learned world models summarize an agent’s experience to facilitate learning complex behaviors. While learning world models from high-dimensional sensory inputs is becoming feasible through deep learning, there are many potential ways for deriving behaviors from them. We present Dreamer, a reinforcement learning agent that solves long-horizon tasks from images purely by latent imagination. We efficiently learn behaviors by propagating analytic gradients of learned state values back through trajectories imagined in the compact state space of a learned world model. On 20 challenging visual control tasks, Dreamer exceeds existing approaches in data-efficiency, computation time, and final performance.
|
| 12 |
+
|
| 13 |
+
# 1 INTRODUCTION
|
| 14 |
+
|
| 15 |
+
Intelligent agents can achieve goals in complex environments even though they never encounter the exact same situation twice. This ability requires building representations of the world from past experience that enable generalization to novel situations. World models offer an explicit way to represent an agent’s knowledge about the world in a parametric model that can make predictions about the future.
|
| 16 |
+
|
| 17 |
+

|
| 18 |
+
Dataset of Experience
|
| 19 |
+
|
| 20 |
+
When the sensory inputs are high-dimensional images, latent dynamics models can abstract observations to predict forward in compact state spaces (Watter et al., 2015; Oh et al., 2017; Gregor et al., 2019). Compared to predictions in image space, latent states have a small memory footprint that enables imagining thousands of trajectories in parallel. Learning effective latent dynamics models is becoming feasible through advances in deep learning and latent variable models (Krishnan et al., 2015; Karl et al., 2016; Doerr et al., 2018; Buesing et al., 2018).
|
| 21 |
+
|
| 22 |
+

|
| 23 |
+
Learned Latent Dynamics
|
| 24 |
+
|
| 25 |
+
Behaviors can be derived from dynamics models in many ways. Often, imagined rewards are maximized with a parametric policy (Sutton, 1991; Ha and Schmidhuber, 2018; Zhang et al., 2019) or by online planning (Chua et al., 2018; Hafner et al., 2018). However, considering only rewards within a fixed imagination horizon results in shortsighted behaviors (Wang et al., 2019). Moreover, prior work commonly resorts to derivative-free optimization for robustness to model errors (Ebert et al., 2017; Chua et al., 2018; Parmas et al., 2019), rather than leveraging analytic gradients offered by neural network dynamics (Henaff et al., 2019; Srinivas et al., 2018).
|
| 26 |
+
|
| 27 |
+
Value and Action Learned by Latent Imagination
|
| 28 |
+
|
| 29 |
+
We present Dreamer, an agent that learns long-horizon behaviors from images purely by latent imagination. A novel actor critic algorithm accounts for rewards beyond the imagination horizon while making efficient use of the neural network dynamics. For this, we predict state values and actions in the learned latent space as summarized in Figure 1. The values optimize Bellman consistency for imagined rewards and the policy maximizes the values by propagating their analytic gradients back through the dynamics.
|
| 30 |
+
|
| 31 |
+
In comparison to actor critic algorithms that learn online or by experience replay (Lillicrap et al., 2015; Mnih et al., 2016; Schulman et al., 2017; Haarnoja et al., 2018; Lee et al., 2019), world models can interpolate past experience and offer analytic gradients of multi-step returns for efficient policy optimization.
|
| 32 |
+
|
| 33 |
+

|
| 34 |
+
Figure 1: Dreamer learns a world model from past experience and efficiently learns farsighted behaviors in its latent space by backpropagating value estimates back through imagined trajectories.
|
| 35 |
+
|
| 36 |
+

|
| 37 |
+
Figure 2: Image observations for 5 of the 20 visual control tasks used in our experiments. The tasks pose a variety of challenges including contact dynamics, sparse rewards, many degrees of freedom, and 3D environments. Several of these tasks could previously not be solved through world models.
|
| 38 |
+
|
| 39 |
+
The key contributions of this paper are summarized as follows:
|
| 40 |
+
|
| 41 |
+
• Learning long-horizon behaviors by latent imagination Model-based agents can be shortsighted if they use a finite imagination horizon. We approach this limitation by predicting both actions and state values. Training purely by imagination in a latent space lets us efficiently learn the policy by propagating analytic value gradients back through the latent dynamics. • Empirical performance for visual control We pair Dreamer with existing representation learning methods and evaluate it on the DeepMind Control Suite with image inputs, illustrated in Figure 2. Using the same hyper parameters for all tasks, Dreamer exceeds previous model-based and model-free agents in terms of data-efficiency, computation time, and final performance.
|
| 42 |
+
|
| 43 |
+
# 2 CONTROL WITH WORLD MODELS
|
| 44 |
+
|
| 45 |
+
Reinforcement learning We formulate visual control as a partially observable Markov decision process (POMDP) with discrete time step $t \in [ 1 ; T ]$ , continuous vector-valued actions $a _ { t } \sim p ( a _ { t } \ |$ $o _ { \leq t } , a _ { < t } )$ generated by the agent, and high-dimensional observations and scalar rewards $o _ { t } , r _ { t } \sim$ $p ( o _ { t } , r _ { t } \mid o _ { < t } , a _ { < t } )$ generated by the unknown environment. The goal is to develop an agent that maximizes the expected sum of rewards $\textstyle \mathrm { E } _ { p } { \big ( } \sum _ { t = 1 } ^ { T } r _ { t } { \big ) }$ . Figure 2 shows a selection of our tasks.
|
| 46 |
+
|
| 47 |
+
Agent components The classical components of agents that learn in imagination are dynamics learning, behavior learning, and environment interaction (Sutton, 1991). In the case of Dreamer, the behavior is learned by predicting hypothetical trajectories in the compact latent space of the world model. As outlined in Figure 3 and detailed in Algorithm 1, Dreamer performs the following operations throughout the agent’s life time, either interleaved or in parallel:
|
| 48 |
+
|
| 49 |
+
• Learning the latent dynamics model from the dataset of past experience to predict future rewards from actions and past observations. Any learning objective for the world model can be incorporated with Dreamer. We review existing methods for learning latent dynamics in Section 4. • Learning action and value models from predicted latent trajectories, as described in Section 3. The value model optimizes Bellman consistency for imagined rewards and the action model is updated by propagating gradients of value estimates back through the neural network dynamics. • Executing the learned action model in the world to collect new experience for growing the dataset.
|
| 50 |
+
|
| 51 |
+
Latent dynamics Dreamer uses a latent dynamics model that consists of three components. The representation model encodes observations and actions to create continuous vector-valued model states $s _ { t }$ with Markovian transitions (Watter et al., 2015; Zhang et al., 2019; Hafner et al., 2018). The transition model predicts future model states without seeing the corresponding observations that will later cause them. The reward model predicts the rewards given the model states,
|
| 52 |
+
|
| 53 |
+
$$
|
| 54 |
+
\begin{array} { l l } { { \mathrm { R e p r e s e n t a t i o n ~ m o d e l : } \qquad } } & { { p ( s _ { t } \mid s _ { t - 1 } , a _ { t - 1 } , o _ { t } ) } } \\ { { \mathrm { T r a n s i t i o n ~ m o d e l : } \qquad } } & { { q ( s _ { t } \mid s _ { t - 1 } , a _ { t - 1 } ) } } \\ { { \mathrm { R e w a r d ~ m o d e l : } \qquad } } & { { q ( r _ { t } \mid s _ { t } ) . } } \end{array}
|
| 55 |
+
$$
|
| 56 |
+
|
| 57 |
+
We use $p$ for distributions that generate samples in the real environment and $q$ for their approximations that enable latent imagination. Specifically, the transition model lets us predict ahead in the compact latent space without having to observe or imagine the corresponding images. This results in a low memory footprint and fast predictions of thousands of imagined trajectories in parallel.
|
| 58 |
+
|
| 59 |
+
The model mimics a non-linear Kalman filter (Kalman, 1960), latent state space model, or HMM with real-valued states. However, it is conditioned on actions and predicts rewards, allowing the agent to imagine the outcomes of potential action sequences without executing them in the environment.
|
| 60 |
+
|
| 61 |
+

|
| 62 |
+
Figure 3: Components of Dreamer. (a) From the dataset of past experience, the agent learns to encode observations and actions into compact latent states $\left( \bigcirc \right)$ , for example via reconstruction, and predicts environment rewards $\mathbf { \Pi } ( \circledast )$ . (b) In the compact latent space, Dreamer predicts state values $( \ I ^ { \prime } )$ and actions $( \triangleq )$ that maximize future value predictions by propagating gradients back through imagined trajectories. (c) The agent encodes the history of the episode to compute the current model state and predict the next action to execute in the environment. See Algorithm 1 for pseudo code of the agent.
|
| 63 |
+
|
| 64 |
+
# 3 LEARNING BEHAVIORS BY LATENT IMAGINATION
|
| 65 |
+
|
| 66 |
+
Dreamer learns long-horizon behaviors in the compact latent space of a learned world model by efficiently leveraging the neural network latent dynamics. For this, we propagate stochastic gradients of multi-step returns through neural network predictions of actions, states, rewards, and values using reparameterization. This section describes the main contribution of our paper.
|
| 67 |
+
|
| 68 |
+
Imagination environment The latent dynamics define a Markov decision process (MDP; Sutton, 1991) that is fully observed because the compact model states $s _ { t }$ are Markovian. We denote imagined quantities with $\tau$ as the time index. Imagined trajectories start at the true model states $s _ { t }$ of observation sequences drawn from the agent’s past experience. They follow predictions of the transition model $s _ { \tau } \sim q ( s _ { \tau } \mid s _ { \tau - 1 } , a _ { \tau - 1 } )$ , reward model $\boldsymbol { r } _ { \ u { \tau } } \sim \boldsymbol { q } ( \boldsymbol { r } _ { \ u { \tau } } \mid s _ { \tau } )$ , and a policy $\smash { a _ { \tau } \sim q ( a _ { \tau } \mid s _ { \tau } ) }$ . The objective is to maximize expected imagined rewards $\begin{array} { r } { \mathrm { E } _ { q } \big ( \sum _ { \tau = t } ^ { \infty } \gamma ^ { \tau - \bar { t } } r _ { \tau } \big ) } \end{array}$ with respect to the policy.
|
| 69 |
+
|
| 70 |
+
# Algorithm 1: Dreamer
|
| 71 |
+
|
| 72 |
+
Initialize dataset $\mathcal { D }$ with $S$ random seed episodes.
|
| 73 |
+
|
| 74 |
+
Initialize neural network parameters $\theta , \phi , \psi$ randomly. while not converged do
|
| 75 |
+
|
| 76 |
+
for update step $c = 1 . . C$ do
|
| 77 |
+
|
| 78 |
+
# Model components
|
| 79 |
+
|
| 80 |
+
Representation $p _ { \theta } ( s _ { t } \mid s _ { t - 1 } , a _ { t - 1 } , o _ { t } )$ Transition $q _ { \theta } ( s _ { t } \mid s _ { t - 1 } , a _ { t - 1 } )$ Reward $q _ { \theta } ( r _ { t } \mid s _ { t } )$ Action $q _ { \phi } ( a _ { t } \mid s _ { t } )$ Value $\boldsymbol { v } _ { \boldsymbol { \psi } } ( s _ { t } )$
|
| 81 |
+
|
| 82 |
+
// DDraw $B$ amics leardata sequences $\{ ( a _ { t } , o _ { t } , r _ { t } ) \} _ { t = k } ^ { k + L } \sim \mathcal { D }$ .
|
| 83 |
+
Compute model states $s _ { t } \sim p _ { \theta } \left( s _ { t } ~ | ~ s _ { t - 1 } , a _ { t - 1 } , o _ { t } \right)$ .
|
| 84 |
+
Update $\theta$ using representation learning.
|
| 85 |
+
|
| 86 |
+
# Hyper parameters
|
| 87 |
+
|
| 88 |
+
Seed episodes $S$ Collect interval $C$ Batch size $B$ Sequence length $L$ Imagination horizon $H$ Learning rate $\alpha$ // Environment interaction $o _ { 1 } \gets \in \mathrm { { n v } }$ .reset() for time step $t = 1 . . T$ do
|
| 89 |
+
|
| 90 |
+
Compute $s _ { t } \sim p _ { \theta } \left( s _ { t } ~ | ~ s _ { t - 1 } , a _ { t - 1 } , o _ { t } \right)$ from history.
|
| 91 |
+
Compute $\boldsymbol { a } _ { t } \sim q _ { \phi } ( \boldsymbol { a } _ { t } \mid \boldsymbol { s } _ { t } )$ with the action model.
|
| 92 |
+
Add exploration noise to action.
|
| 93 |
+
$r _ { t } , o _ { t + 1 } \gets \mathsf { e n v }$ .step $( a _ { t } )$ .
|
| 94 |
+
|
| 95 |
+
Add experience to dataset $\mathcal { D } \mathcal { D } \cup \{ ( o _ { t } , a _ { t } , r _ { t } ) _ { t = 1 } ^ { T } \} .$ .
|
| 96 |
+
|
| 97 |
+

|
| 98 |
+
Figure 4: Imagination horizons. We compare the final performance of Dreamer, learning an action model without value prediction, and online planning using PlaNet. Learning a state value model to estimate rewards beyond the imagination horizon makes Dreamer more robust to the horizon length. The agents use pixel reconstruction for representation learning and an action repeat of $R = 2$ .
|
| 99 |
+
|
| 100 |
+
Action and value models Consider imagined trajectories with a finite horizon $H$ . Dreamer uses an actor critic approach to learn behaviors that consider rewards beyond the horizon. We learn an action model and a value model in the latent space of the world model for this. The action model implements the policy and aims to predict actions that solve the imagination environment. The value model estimates the expected imagined rewards that the action model achieves from each state $s _ { \tau }$ ,
|
| 101 |
+
|
| 102 |
+
Value model:
|
| 103 |
+
|
| 104 |
+
$$
|
| 105 |
+
\begin{array} { r l } & { a _ { \tau } \sim q _ { \phi } ( a _ { \tau } \mid s _ { \tau } ) } \\ & { v _ { \psi } ( s _ { \tau } ) \approx \mathrm { E } _ { q ( \cdot \mid s _ { \tau } ) } \big ( \sum _ { \tau = t } ^ { t + H } \gamma ^ { \tau - t } r _ { \tau } \big ) . } \end{array}
|
| 106 |
+
$$
|
| 107 |
+
|
| 108 |
+
The action and value models are trained cooperatively as typical in policy iteration: the action model aims to maximize an estimate of the value, while the value model aims to match an estimate of the value that changes as the action model changes.
|
| 109 |
+
|
| 110 |
+
We use dense neural networks for the action and value models with parameters $\phi$ and $\psi$ , respectively. The action model outputs a tanh-transformed Gaussian (Haarnoja et al., 2018) with sufficient statistics predicted by the neural network. This allows for reparameterized sampling (Kingma and Welling, 2013; Rezende et al., 2014) that views sampled actions as deterministically dependent on the neural network output, allowing us to backpropagate analytic gradients through the sampling operation,
|
| 111 |
+
|
| 112 |
+
$$
|
| 113 |
+
\begin{array} { r } { a _ { \tau } = \operatorname { t a n h } \bigl ( \mu _ { \phi } ( s _ { \tau } ) + \sigma _ { \phi } ( s _ { \tau } ) \epsilon \bigr ) , \quad \epsilon \sim \mathrm { N o r m a l } ( 0 , \mathbb { I } ) . } \end{array}
|
| 114 |
+
$$
|
| 115 |
+
|
| 116 |
+
Value estimation To lof imagined trajectories $\{ s _ { \tau } , a _ { \tau } , r _ { \tau } \} _ { \tau = t } ^ { t + H }$ and value models, we need to estimate the state v. These trajectories branch off of the model states $s _ { t }$ esof horizon $H$ using actions sampled from the action model. State values can be estimated in multiple ways that trade off bias and variance (Sutton and Barto, 2018),
|
| 117 |
+
|
| 118 |
+
$$
|
| 119 |
+
\begin{array} { l } { { \displaystyle \mathrm { V } _ { \mathrm { R } } ( s _ { \tau } ) \doteq \mathrm { E } _ { q _ { \theta } , q _ { \phi } } \biggl ( \displaystyle \sum _ { n = \tau } ^ { t + H } r _ { n } \biggr ) , } } \\ { { \displaystyle \mathrm { V } _ { \mathrm { N } } ^ { k } ( s _ { \tau } ) \doteq \mathrm { E } _ { q _ { \theta } , q _ { \phi } } \biggl ( \displaystyle \sum _ { n = \tau } ^ { h - 1 } \gamma ^ { n - \tau } r _ { n } + \gamma ^ { h - \tau } v _ { \psi } ( s _ { h } ) \biggr ) \quad \mathrm { w i t h } \quad h = \mathrm { m i n } ( \tau + k , t + H ) , } } \\ { { \displaystyle \mathrm { V } _ { \lambda } ( s _ { \tau } ) \doteq ( 1 - \lambda ) \sum _ { n = 1 } ^ { H - 1 } \lambda ^ { n - 1 } \mathrm { V } _ { \mathrm { N } } ^ { n } ( s _ { \tau } ) + \lambda ^ { H - 1 } \mathrm { V } _ { \mathrm { N } } ^ { H } ( s _ { \tau } ) , } } \end{array}
|
| 120 |
+
$$
|
| 121 |
+
|
| 122 |
+
where the expectations are estimated under the imagined trajectories. $\mathrm { V _ { R } }$ simply sums the rewards from $\tau$ until the horizon and ignores rewards beyond it. This allows learning the action model without a value model, an ablation we compare to in our experiments. $\mathrm { V } _ { \mathrm { N } } ^ { k }$ estimates rewards beyond $k$ steps with the learned value model. Dreamer uses $\mathrm { V } _ { \lambda }$ , an exponentially-weighted average of the estimates for different $k$ to balance bias and variance. Figure 4 shows that learning a value model in imagination enables Dreamer to solve long-horizon tasks while being robust to the imagination horizon. The experimental details and results on all tasks are described in Section 6.
|
| 123 |
+
|
| 124 |
+

|
| 125 |
+
Figure 5: Reconstructions of long-term predictions. We apply the representation model to the first 5 images of two hold-out trajectories and predict forward for 45 steps using the latent dynamics, given only the actions. The recurrent state space model (RSSM; Hafner et al., 2018) performs accurate long-term predictions, enabling Dreamer to learn successful behaviors in a compact latent space.
|
| 126 |
+
|
| 127 |
+
Learning objective To update the action and value models, we first compute the value estimates $\mathrm { V } _ { \lambda } ( s _ { \tau } )$ for all states $s _ { \tau }$ along the imagined trajectories. The objective for the action model $q _ { \phi } ( a _ { \tau } \mid s _ { \tau } )$ is to predict actions that result in state trajectories with high value estimates. The objective for the value model $v _ { \psi } ( s _ { \tau } )$ , in turn, is to regress the value estimates,
|
| 128 |
+
|
| 129 |
+
$$
|
| 130 |
+
\operatorname* { m a x } _ { \phi } \mathrm { E } _ { q _ { \theta } , q _ { \phi } } \left( \sum _ { \tau = t } ^ { t + H } \mathrm { V } _ { \lambda } ( s _ { \tau } ) \right) , \qquad ( 7 ) \qquad \operatorname* { m i n } _ { \psi } \mathrm { E } _ { q _ { \theta } , q _ { \phi } } \left( \sum _ { \tau = t } ^ { t + H } \frac { 1 } { 2 } \Big \| v _ { \psi } ( s _ { \tau } ) - \mathrm { V } _ { \lambda } ( s _ { \tau } ) ) \Big \| ^ { 2 } \right) .
|
| 131 |
+
$$
|
| 132 |
+
|
| 133 |
+
The value model is updated to regress the targets, around which we stop the gradient as typical (Sutton and Barto, 2018). The action model uses analytic gradients through the learned dynamics to maximize the value estimates. To understand this, we note that the value estimates depend on the reward and value predictions, which depend on the imagined states, which in turn depend on $\begin{array} { r } { \nabla _ { \phi } \mathrm { E } _ { q _ { \theta } , q _ { \phi } } \big ( \sum _ { \tau = t } ^ { t + H } \mathrm { V } _ { \lambda } ( s _ { \tau } ) \big ) } \end{array}$ all steps are implemented as neural networks, we analytically compute by stochastic backpropagation (Kingma and Welling, 2013; Rezende et al., 2014). We use reparameterization for continuous actions and latent states and straight-through gradients (Bengio et al., 2013) for discrete actions. The world model is fixed while learning behaviors. In tasks with early termination, the world model also predicts the discount factor from each latent state to weigh the time steps in Equations 7 and 8 by the cumulative product of the predicted discount factors, so terms are weighted down based on how likely the imagined trajectory would have ended.
|
| 134 |
+
|
| 135 |
+
Comparison to actor critic methods Agents using Reinforce gradients (Williams, 1992), such as A3C and PPO (Mnih et al., 2016; Schulman et al., 2017), employ value baselines to reduce gradient variance, while Dreamer backpropagates through the value model. This is similar to deterministic or reparameterized actor critics (Silver et al., 2014), such as DDPG and SAC (Lillicrap et al., 2015; Haarnoja et al., 2018). However, these do not leverage gradients through transitions and only maximize immediate Q-values. MVE and STEVE (Feinberg et al., 2018; Buckman et al., 2018) extend them to multi-step Q-learning with learned dynamics to provide more accurate Q-value targets. We predict state values, which is sufficient for policy optimization since we backpropagate through the dynamics. Refer to Section 5 for a more detailed comparison to related work.
|
| 136 |
+
|
| 137 |
+
# 4 LEARNING LATENT DYNAMICS
|
| 138 |
+
|
| 139 |
+
Learning behaviors in imagination requires a world model that generalizes well. We focus on latent dynamics models that predict forward in a compact latent space, facilitating long-term predictions and allowing the agent to imagine thousands of trajectories in parallel. Several objectives for learning representations for control have been proposed (Watter et al., 2015; Jaderberg et al., 2016; Oord et al., 2018; Eslami et al., 2018). We review three approaches for learning representations to use with Dreamer: reward prediction, image reconstruction, and contrastive estimation.
|
| 140 |
+
|
| 141 |
+
Reward prediction Latent imagination requires a representation model $p ( s _ { t } \mid s _ { t - 1 } , a _ { t - 1 } , o _ { t } )$ , transition model $q ( s _ { t } \mid s _ { t - 1 } , a _ { t - 1 } , \bar { ) }$ , and reward model $q ( r _ { t } \mid s _ { t } )$ , as described in Section 2. In principle, this could be achieved by simply learning to predict future rewards given actions and past observations (Oh et al., 2017; Gelada et al., 2019; Schrittwieser et al., 2019). With a large and diverse dataset, such representations should be sufficient for solving a control task. However, with a finite dataset and especially when rewards are sparse, learning about observations that correlate with rewards is likely to improve the world model (Jaderberg et al., 2016; Gregor et al., 2019).
|
| 142 |
+
|
| 143 |
+

|
| 144 |
+
Figure 6: Performance comparison to existing methods. Dreamer inherits the data-efficiency of PlaNet while exceeding the asymptotic performance of the best model-free agents. After $5 \times 1 0 ^ { 6 }$ environment steps, Dreamer reaches an average performance of 823 across tasks, compared to PlaNet at 332 and the top model-free D4PG agent at 786 after $1 0 ^ { 9 }$ steps. Results are averages over 5 seeds.
|
| 145 |
+
|
| 146 |
+
Reconstruction We first describe the world model used by PlaNet (Hafner et al., 2018) that learns latent dynamics by reconstructing images as shown in Figure 3a. The world model consists of the following components, where the observation model is only used to provide a learning signal,
|
| 147 |
+
|
| 148 |
+
$$
|
| 149 |
+
{ \begin{array} { r l r l } & { { \mathrm { R e p r e s e n t a t i o n ~ m o d e l : } } \quad } & & { p _ { \theta } ( s _ { t } \mid s _ { t - 1 } , a _ { t - 1 } , o _ { t } ) } \\ & { { \mathrm { O b s e r v a t i o n ~ m o d e l : } } \quad } & & { q _ { \theta } ( o _ { t } \mid s _ { t } ) } \\ & { { \mathrm { R e w a r d ~ m o d e l : } } \quad } & & { q _ { \theta } ( r _ { t } \mid s _ { t } ) } \\ & { { \mathrm { T r a n s i t i o n ~ m o d e l : } } \quad } & & { q _ { \theta } ( s _ { t } \mid s _ { t - 1 } , a _ { t - 1 } ) . } \end{array} }
|
| 150 |
+
$$
|
| 151 |
+
|
| 152 |
+
The components are optimized jointly to increase the variational lower bound (ELBO; Jordan et al., 1999) or more generally the variational information bottleneck (VIB; Tishby et al., 2000; Alemi et al., 2016). As derived in Appendix B, the bound includes reconstruction terms for observations and rewards and a KL regularizer. The expectation is taken under the dataset and representation model,
|
| 153 |
+
|
| 154 |
+
$$
|
| 155 |
+
\begin{array} { r l } & { \mathcal { T } _ { \mathrm { R E C } } \doteq \mathrm { E } _ { p } \Bigg ( \displaystyle \sum _ { t } \left( \mathcal { T } _ { \mathrm { O } } ^ { t } + \mathcal { T } _ { \mathrm { R } } ^ { t } + \mathcal { I } _ { \mathrm { D } } ^ { t } \right) \Bigg ) + \mathrm { c o n s t } \qquad \mathcal { I } _ { \mathrm { O } } ^ { t } \doteq \mathrm { l n } q ( o _ { t } \mid s _ { t } ) } \\ & { \mathcal { I } _ { \mathrm { R } } ^ { t } \doteq \mathrm { l n } q ( r _ { t } \mid s _ { t } ) \qquad \mathcal { I } _ { \mathrm { D } } ^ { t } \doteq \ - \beta \operatorname { K L } \big ( p ( s _ { t } \mid s _ { t - 1 } , a _ { t - 1 } , o _ { t } ) \big \parallel q ( o _ { t } \mid s _ { t - 1 } , a _ { t - 1 } ) \big ) . } \end{array}
|
| 156 |
+
$$
|
| 157 |
+
|
| 158 |
+
We implement the transition model as a recurrent state space model (RSSM; Hafner et al., 2018), the representation model by combining the RSSM with a convolutional neural network (CNN; LeCun et al., 1989) applied to the image observation, the observation model as a transposed CNN, and the reward model as a dense network. The combined parameter vector $\theta$ is updated by stochastic backpropagation (Kingma and Welling, 2013; Rezende et al., 2014). Figure 5 shows video predictions of this model. We refer to Appendix A and Hafner et al. (2018) model details.
|
| 159 |
+
|
| 160 |
+
Contrastive estimation Predicting pixels can require high model capacity. We can also encourage mutual information between model states and observations by instead predicting the states from the images (Guo et al., 2018). This replaces the observation model with a state model,
|
| 161 |
+
|
| 162 |
+
State model:
|
| 163 |
+
|
| 164 |
+
$$
|
| 165 |
+
q _ { \theta } { \left( s _ { t } \mid o _ { t } \right) } .
|
| 166 |
+
$$
|
| 167 |
+
|
| 168 |
+
While the reconstruction objective used the fact that the observation marginal is a constant, we now face the state marginal. As shown in Appendix B, this can be estimated via noise contrastive estimation (NCE; Gutmann and Hyvärinen, 2010; Oord et al., 2018) by averaging the state model over observations $o ^ { \prime }$ of the current sequence batch. Intuitively, $q ( s _ { t } \mid o _ { t } )$ makes the state predictable from the current image while $\ln { \textstyle \sum _ { o ^ { \prime } } \bar { q } } ( s _ { t } \mid o ^ { \prime } )$ keeps it diverse to prevent collapse,
|
| 169 |
+
|
| 170 |
+
$$
|
| 171 |
+
\mathcal { I } _ { \mathrm { N C E } } \doteq \mathrm { E } \biggl ( \sum _ { t } \Big ( \mathcal { I } _ { \mathrm { S } } ^ { t } + \mathcal { I } _ { \mathrm { R } } ^ { t } + \mathcal { I } _ { \mathrm { D } } ^ { t } \Big ) \biggr ) \quad \mathcal { I } _ { \mathrm { S } } ^ { t } \doteq \ln q ( s _ { t } \mid o _ { t } ) - \ln \left( \sum _ { o ^ { \prime } } q ( s _ { t } \mid o ^ { \prime } ) \right) .
|
| 172 |
+
$$
|
| 173 |
+
|
| 174 |
+
We implement the state model as a CNN and again optimize the bound with respect to the combined parameter vector $\theta$ using stochastic backpropagation. While avoiding pixel prediction, the amount of information this bound can extract efficiently is limited (McAllester and Statos, 2018). We empirically compare reward, reconstruction, and contrastive objectives in our experiments in Figure 8.
|
| 175 |
+
|
| 176 |
+

|
| 177 |
+
Figure 7: Dreamer succeeds at visual control tasks that require long-horizon credit assignment, such as the acrobot and hopper tasks. Optimizing only imagined rewards within the horizon via an action model or by online planning yields shortsighted behaviors that only succeed in reactive tasks, such as in the walker domain. The performance on all 20 tasks is summarized in Figure 6 and training curves are shown in Appendix D. See Tassa et al. (2018) for performance curves of D4PG and A3C.
|
| 178 |
+
|
| 179 |
+
# 5 RELATED WORK
|
| 180 |
+
|
| 181 |
+
Prior works learn latent dynamics for visual control by derivative-free policy learning or online planning, augment model-free agents with multi-step predictions, or use analytic gradients of Qvalues or multi-step rewards, often for low-dimensional tasks. In comparison, Dreamer uses analytic gradients to efficiently learn long-horizon behaviors for visual control purely by latent imagination.
|
| 182 |
+
|
| 183 |
+
Control with latent dynamics E2C (Watter et al., 2015) and RCE (Banijamali et al., 2017) embed images to predict forward in a compact space to solve simple tasks. World Models (Ha and Schmidhuber, 2018) learn latent dynamics in a two-stage process to evolve linear controllers in imagination. PlaNet (Hafner et al., 2018) learns them jointly and solves visual locomotion tasks by latent online planning. SOLAR (Zhang et al., 2019) solves robotic tasks via guided policy search in latent space. I2A (Weber et al., 2017) hands imagined trajectories to a model-free policy, while Lee et al. (2019) and Gregor et al. (2019) learn belief representations to accelerate model-free agents.
|
| 184 |
+
|
| 185 |
+
Imagined multi-step returns VPN (Oh et al., 2017), MVE (Feinberg et al., 2018), and STEVE (Buckman et al., 2018) learn dynamics for multi-step Q-learning from a replay buffer. AlphaGo (Silver et al., 2017) combines predictions of actions and state values with planning, assuming access to the true dynamics. Also assuming access to the dynamics, POLO (Lowrey et al., 2018) plans to explore by learning a value ensemble. MuZero (Schrittwieser et al., 2019) learns task-specific reward and value models to solve challenging tasks but requires large amounts of experience. PETS (Chua et al., 2018), VisualMPC (Ebert et al., 2017), and PlaNet (Hafner et al., 2018) plan online using derivative-free optimization. POPLIN (Wang and Ba, 2019) improves over online planning by self-imitation. Piergiovanni et al. (2018) learn robot policies by imagination with a latent dynamics model. Planning with neural network gradients was shown on small problems (Schmidhuber, 1990; Henaff et al., 2018) but has been challenging to scale (Parmas et al., 2019).
|
| 186 |
+
|
| 187 |
+
Analytic value gradients DPG (Silver et al., 2014), DDPG (Lillicrap et al., 2015), and SAC (Haarnoja et al., 2018) leverage gradients of learned immediate action values to learn a policy by experience replay. SVG (Heess et al., 2015) reduces the variance of model-free on-policy algorithms by analytic value gradients of one-step model predictions. Concurrent work by Byravan et al. (2019) uses latent imagination with deterministic models for navigation and manipulation tasks. ME-TRPO (Kurutach et al., 2018) accelerates an otherwise model-free agent via gradients of predicted rewards for proprioceptive inputs. DistGBP (Henaff et al., 2017; 2019) uses model gradients for online planning in simple tasks.
|
| 188 |
+
|
| 189 |
+

|
| 190 |
+
Figure 8: Comparison of representation learning objectives to be used with Dreamer. Pixel reconstruction performs best for the majority of tasks. The contrastive objective solves about half of the tasks, while predicting rewards alone was not sufficient in our experiments. The results suggest that future developments in learning representations are likely to translate into improved task performance for Dreamer. The performance curves for all tasks are included in Appendix E.
|
| 191 |
+
|
| 192 |
+
# 6 EXPERIMENTS
|
| 193 |
+
|
| 194 |
+
We experimentally evaluate Dreamer on a variety of control tasks. We designed the experiments to compare Dreamer to current best methods in the literature, and to evaluate its ability to solve tasks with long horizons, continuous actions, discrete actions, and early termination. We further compare the orthogonal choice of learning objective for the world model. The source code for all our experiments and videos of Dreamer are available at https://danijar.com/dreamer.
|
| 195 |
+
|
| 196 |
+
Control tasks We evaluate Dreamer on 20 visual control tasks of the DeepMind Control Suite (Tassa et al., 2018), illustrated in Figure 2. These tasks pose a variety of challenges, including sparse rewards, contact dynamics, and 3D scenes. We selected the tasks on which Tassa et al. (2018) report non-zero performance from image inputs. Agent observations are images of shape $6 4 \times 6 4 \times 3$ , actions range from 1 to 12 dimensions, rewards range from 0 to 1, episodes last for 1000 steps and have randomized initial states. We use a fixed action repeat of $R = 2$ across tasks. We further evaluate the applicability of Dreamer to discrete actions and early termination on a subset of Atari games (Bellemare et al., 2013) and DeepMind Lab levels (Beattie et al., 2016) as detailed in Appendix C.
|
| 197 |
+
|
| 198 |
+
Implementation Our implementation uses TensorFlow Probability (Dillon et al., 2017). We use a single Nvidia V100 GPU and 10 CPU cores for each training run. The training time for our Dreamer implementation is below 5 hours per $1 0 ^ { 6 }$ environment steps on the control suite, compared to 11 hours for online planning using PlaNet, and the 24 hours used by D4PG to reach similar performance. We use the same hyper parameters across all continuous tasks, and similarly across all discrete tasks, detailed in Appendix A. The world models are learned via reconstruction unless specified.
|
| 199 |
+
|
| 200 |
+
Baseline methods The highest reported performance on the continuous tasks is achieved by D4PG (Barth-Maron et al., 2018), an improved variant of DDPG (Lillicrap et al., 2015) that uses distributed collection, distributional Q-learning, multi-step returns, and prioritized replay. We include the scores for D4PG with pixel inputs and A3C (Mnih et al., 2016) with state inputs from Tassa et al. (2018). PlaNet (Hafner et al., 2018) learns the same world model as Dreamer and selects actions via online planning without an action model and drastically improves over D4PG and A3C in data efficiency. We re-run PlaNet with $R = 2$ for a unified experimental setup. For Atari, we show the final performance of SimPLe (Kaiser et al., 2019), DQN (Mnih et al., 2015) and Rainbow (Hessel et al., 2018) reported by Castro et al. (2018), and for DeepMind Lab that of IMPALA (Espeholt et al., 2018) as a guideline.
|
| 201 |
+
|
| 202 |
+
Performance To evaluate the performance of Dreamer, we compare it to state-of-the-art reinforcement learning agents. The results are summarized in Figure 6. With an average score of 823 across tasks after $5 \times \bar { 1 0 ^ { 6 } }$ environment steps, Dreamer exceeds the performance of the strong model-free D4PG agent that achieves an average of 786 within $1 0 ^ { 9 }$ environment steps. At the same time, Dreamer inherits the data-efficiency of PlaNet, confirming that the learned world model can help to generalize from small amounts of experience. The empirical success of Dreamer shows that learning behaviors by latent imagination with world models can outperform top methods based on experience replay.
|
| 203 |
+
|
| 204 |
+
Long horizons To investigate its ability to learn long-horizon behaviors, we compare Dreamer to alternatives for deriving behaviors from the world model at various horizon lengths. For this, we learn an action model to maximize imagined rewards without a value model and compare to online planning using PlaNet. Figure 4 shows the final performance for different imagination horizons, confirming that the value model makes Dreamer more robust to the horizon and performs well even for short horizons. Performance curves for all 19 tasks with horizon of 20 are shown in Appendix D, where Dreamer outperforms the alternatives on 16 of 20 tasks, with 4 ties.
|
| 205 |
+
|
| 206 |
+
Representation learning Dreamer can be used with any differentiable dynamics model that predicts future rewards given actions and past observations. Since the representation learning objective is orthogonal to our algorithm, we compare three natural choices described in Section 4: pixel reconstruction, contrastive estimation, and pure reward prediction. Figure 8 shows clear differences in task performance for different representation learning approaches, with pixel reconstruction outperforming contrastive estimation on most tasks. This suggests that future improvements in representation learning are likely to translate to higher task performance with Dreamer. Reward prediction alone was not sufficient in our experiments. Further ablations are included in the appendix of the paper.
|
| 207 |
+
|
| 208 |
+
# 7 CONCLUSION
|
| 209 |
+
|
| 210 |
+
We present Dreamer, an agent that learns long-horizon behaviors purely by latent imagination. For this, we propose an actor critic method that optimizes a parametric policy by propagating analytic gradients of multi-step values back through learned latent dynamics. Dreamer outperforms previous methods in data-efficiency, computation time, and final performance on a variety of challenging continuous control tasks with image inputs. We further show that Dreamer is applicable to tasks with discrete actions and early episode termination. Future research on representation learning can likely scale latent imagination to environments of higher visual complexity.
|
| 211 |
+
|
| 212 |
+
Acknowledgements We thank Simon Kornblith, Benjamin Eysenbach, Ian Fischer, Amy Zhang, Geoffrey Hinton, Shane Gu, Adam Kosiorek, Jacob Buckman, Calvin Luo, and Rishabh Agarwal, and our anonymous reviewers for feedback and discussions. We thank Yuval Tassa for adding the quadruped environment to the control suite.
|
| 213 |
+
|
| 214 |
+
# REFERENCES
|
| 215 |
+
|
| 216 |
+
A. A. Alemi, I. Fischer, J. V. Dillon, and K. Murphy. Deep variational information bottleneck. arXiv preprint arXiv:1612.00410, 2016.
|
| 217 |
+
E. Banijamali, R. Shu, M. Ghavamzadeh, H. Bui, and A. Ghodsi. Robust locally-linear controllable embedding. arXiv preprint arXiv:1710.05373, 2017.
|
| 218 |
+
G. Barth-Maron, M. W. Hoffman, D. Budden, W. Dabney, D. Horgan, A. Muldal, N. Heess, and T. Lillicrap. Distributed distributional deterministic policy gradients. arXiv preprint arXiv:1804.08617, 2018.
|
| 219 |
+
C. Beattie, J. Z. Leibo, D. Teplyashin, T. Ward, M. Wainwright, H. Küttler, A. Lefrancq, S. Green, V. Valdés, A. Sadik, et al. Deepmind lab. arXiv preprint arXiv:1612.03801, 2016.
|
| 220 |
+
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.
|
| 221 |
+
Y. Bengio, N. Léonard, and A. Courville. Estimating or propagating gradients through stochastic neurons for conditional computation. arXiv preprint arXiv:1308.3432, 2013.
|
| 222 |
+
J. Buckman, D. Hafner, G. Tucker, E. Brevdo, and H. Lee. Sample-efficient reinforcement learning with stochastic ensemble value expansion. In Advances in Neural Information Processing Systems, pages 8224–8234, 2018.
|
| 223 |
+
L. Buesing, T. Weber, S. Racaniere, S. Eslami, D. Rezende, D. P. Reichert, F. Viola, F. Besse, K. Gregor, D. Hassabis, et al. Learning and querying fast generative models for reinforcement learning. arXiv preprint arXiv:1802.03006, 2018.
|
| 224 |
+
A. Byravan, J. T. Springenberg, A. Abdolmaleki, R. Hafner, M. Neunert, T. Lampe, N. Siegel, N. Heess, and M. Riedmiller. Imagined value gradients: Model-based policy optimization with transferable latent dynamics models. arXiv preprint arXiv:1910.04142, 2019.
|
| 225 |
+
P. S. Castro, S. Moitra, C. Gelada, S. Kumar, and M. G. Bellemare. Dopamine: A research framework for deep reinforcement learning. arXiv preprint arXiv:1812.06110, 2018.
|
| 226 |
+
K. Chua, R. Calandra, R. McAllister, and S. Levine. Deep reinforcement learning in a handful of trials using probabilistic dynamics models. In Advances in Neural Information Processing Systems, pages 4754–4765, 2018.
|
| 227 |
+
D.-A. Clevert, T. Unterthiner, and S. Hochreiter. Fast and accurate deep network learning by exponential linear units (elus). arXiv preprint arXiv:1511.07289, 2015.
|
| 228 |
+
J. V. Dillon, I. Langmore, D. Tran, E. Brevdo, S. Vasudevan, D. Moore, B. Patton, A. Alemi, M. Hoffman, and R. A. Saurous. Tensorflow distributions. arXiv preprint arXiv:1711.10604, 2017.
|
| 229 |
+
A. Doerr, C. Daniel, M. Schiegg, D. Nguyen-Tuong, S. Schaal, M. Toussaint, and S. Trimpe. Probabilistic recurrent state-space models. arXiv preprint arXiv:1801.10395, 2018.
|
| 230 |
+
F. Ebert, C. Finn, A. X. Lee, and S. Levine. Self-supervised visual planning with temporal skip connections. arXiv preprint arXiv:1710.05268, 2017.
|
| 231 |
+
S. A. Eslami, D. J. Rezende, F. Besse, F. Viola, A. S. Morcos, M. Garnelo, A. Ruderman, A. A. Rusu, I. Danihelka, K. Gregor, et al. Neural scene representation and rendering. Science, 360(6394): 1204–1210, 2018.
|
| 232 |
+
L. Espeholt, H. Soyer, R. Munos, K. Simonyan, V. Mnih, T. Ward, Y. Doron, V. Firoiu, T. Harley, I. Dunning, et al. Impala: Scalable distributed deep-rl with importance weighted actor-learner architectures. arXiv preprint arXiv:1802.01561, 2018.
|
| 233 |
+
V. Feinberg, A. Wan, I. Stoica, M. I. Jordan, J. E. Gonzalez, and S. Levine. Model-based value estimation for efficient model-free reinforcement learning. arXiv preprint arXiv:1803.00101, 2018.
|
| 234 |
+
C. Gelada, S. Kumar, J. Buckman, O. Nachum, and M. G. Bellemare. Deepmdp: Learning continuous latent space models for representation learning. arXiv preprint arXiv:1906.02736, 2019.
|
| 235 |
+
K. Gregor, D. J. Rezende, F. Besse, Y. Wu, H. Merzic, and A. v. d. Oord. Shaping belief states with generative environment models for rl. arXiv preprint arXiv:1906.09237, 2019.
|
| 236 |
+
Z. D. Guo, M. G. Azar, B. Piot, B. A. Pires, T. Pohlen, and R. Munos. Neural predictive belief representations. arXiv preprint arXiv:1811.06407, 2018.
|
| 237 |
+
M. Gutmann and A. Hyvärinen. Noise-contrastive estimation: A new estimation principle for unnormalized statistical models. In Proceedings of the Thirteenth International Conference on Artificial Intelligence and Statistics, pages 297–304, 2010.
|
| 238 |
+
D. Ha and J. Schmidhuber. World models. arXiv preprint arXiv:1803.10122, 2018.
|
| 239 |
+
T. Haarnoja, A. Zhou, P. Abbeel, and S. Levine. Soft actor-critic: Off-policy maximum entropy deep reinforcement learning with a stochastic actor. arXiv preprint arXiv:1801.01290, 2018.
|
| 240 |
+
D. Hafner, T. Lillicrap, I. Fischer, R. Villegas, D. Ha, H. Lee, and J. Davidson. Learning latent dynamics for planning from pixels. arXiv preprint arXiv:1811.04551, 2018.
|
| 241 |
+
N. Heess, G. Wayne, D. Silver, T. Lillicrap, T. Erez, and Y. Tassa. Learning continuous control policies by stochastic value gradients. In Advances in Neural Information Processing Systems, pages 2944–2952, 2015.
|
| 242 |
+
M. Henaff, W. F. Whitney, and Y. LeCun. Model-based planning in discrete action spaces. CoRR, abs/1705.07177, 2017.
|
| 243 |
+
M. Henaff, W. F. Whitney, and Y. LeCun. Model-based planning with discrete and continuous actions. arXiv preprint arXiv:1705.07177, 2018.
|
| 244 |
+
M. Henaff, A. Canziani, and Y. LeCun. Model-predictive policy learning with uncertainty regularization for driving in dense traffic. arXiv preprint arXiv:1901.02705, 2019.
|
| 245 |
+
M. Hessel, J. Modayil, H. Van Hasselt, T. Schaul, G. Ostrovski, W. Dabney, D. Horgan, B. Piot, M. Azar, and D. Silver. Rainbow: Combining improvements in deep reinforcement learning. In Thirty-Second AAAI Conference on Artificial Intelligence, 2018.
|
| 246 |
+
M. Jaderberg, V. Mnih, W. M. Czarnecki, T. Schaul, J. Z. Leibo, D. Silver, and K. Kavukcuoglu. Reinforcement learning with unsupervised auxiliary tasks. arXiv preprint arXiv:1611.05397, 2016.
|
| 247 |
+
M. I. Jordan, Z. Ghahramani, T. S. Jaakkola, and L. K. Saul. An introduction to variational methods for graphical models. Machine learning, 37(2):183–233, 1999.
|
| 248 |
+
L. Kaiser, M. Babaeizadeh, P. Milos, B. Osinski, R. H. Campbell, K. Czechowski, D. Erhan, C. Finn, P. Kozakowski, S. Levine, et al. Model-based reinforcement learning for atari. arXiv preprint arXiv:1903.00374, 2019.
|
| 249 |
+
R. E. Kalman. A new approach to linear filtering and prediction problems. Journal of basic Engineering, 82(1):35–45, 1960.
|
| 250 |
+
M. Karl, M. Soelch, J. Bayer, and P. van der Smagt. Deep variational bayes filters: Unsupervised learning of state space models from raw data. arXiv preprint arXiv:1605.06432, 2016.
|
| 251 |
+
D. P. Kingma and J. Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
|
| 252 |
+
D. P. Kingma and M. Welling. Auto-encoding variational bayes. arXiv preprint arXiv:1312.6114, 2013.
|
| 253 |
+
R. G. Krishnan, U. Shalit, and D. Sontag. Deep kalman filters. arXiv preprint arXiv:1511.05121, 2015.
|
| 254 |
+
T. Kurutach, I. Clavera, Y. Duan, A. Tamar, and P. Abbeel. Model-ensemble trust-region policy optimization. arXiv preprint arXiv:1802.10592, 2018.
|
| 255 |
+
Y. LeCun, B. Boser, J. S. Denker, D. Henderson, R. E. Howard, W. Hubbard, and L. D. Jackel. Backpropagation applied to handwritten zip code recognition. Neural computation, 1(4):541–551, 1989.
|
| 256 |
+
A. X. Lee, A. Nagabandi, P. Abbeel, and S. Levine. Stochastic latent actor-critic: Deep reinforcement learning with a latent variable model. arXiv preprint arXiv:1907.00953, 2019.
|
| 257 |
+
T. P. Lillicrap, J. J. Hunt, A. Pritzel, N. Heess, T. Erez, Y. Tassa, D. Silver, and D. Wierstra. Continuous control with deep reinforcement learning. arXiv preprint arXiv:1509.02971, 2015.
|
| 258 |
+
K. Lowrey, A. Rajeswaran, S. Kakade, E. Todorov, and I. Mordatch. Plan online, learn offline: Efficient learning and exploration via model-based control. arXiv preprint arXiv:1811.01848, 2018.
|
| 259 |
+
M. C. Machado, M. G. Bellemare, E. Talvitie, J. Veness, M. Hausknecht, and M. Bowling. Revisiting the arcade learning environment: Evaluation protocols and open problems for general agents. Journal of Artificial Intelligence Research, 61:523–562, 2018.
|
| 260 |
+
D. McAllester and K. Statos. Formal limitations on the measurement of mutual information. arXiv preprint arXiv:1811.04251, 2018.
|
| 261 |
+
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, 2015.
|
| 262 |
+
V. Mnih, A. P. Badia, M. Mirza, A. Graves, T. Lillicrap, T. Harley, D. Silver, and K. Kavukcuoglu. Asynchronous methods for deep reinforcement learning. In International Conference on Machine Learning, pages 1928–1937, 2016.
|
| 263 |
+
J. Oh, S. Singh, and H. Lee. Value prediction network. In Advances in Neural Information Processing Systems, pages 6118–6128, 2017.
|
| 264 |
+
A. v. d. Oord, Y. Li, and O. Vinyals. Representation learning with contrastive predictive coding. arXiv preprint arXiv:1807.03748, 2018.
|
| 265 |
+
P. Parmas, C. E. Rasmussen, J. Peters, and K. Doya. Pipps: Flexible model-based policy search robust to the curse of chaos. arXiv preprint arXiv:1902.01240, 2019.
|
| 266 |
+
A. Piergiovanni, A. Wu, and M. S. Ryoo. Learning real-world robot policies by dreaming. arXiv preprint arXiv:1805.07813, 2018.
|
| 267 |
+
B. Poole, S. Ozair, A. v. d. Oord, A. A. Alemi, and G. Tucker. On variational bounds of mutual information. arXiv preprint arXiv:1905.06922, 2019.
|
| 268 |
+
D. J. Rezende, S. Mohamed, and D. Wierstra. Stochastic backpropagation and approximate inference in deep generative models. arXiv preprint arXiv:1401.4082, 2014.
|
| 269 |
+
J. Schmidhuber. Making the world differentiable: On using self-supervised fully recurrent neural networks for dynamic reinforcement learning and planning in non-stationary environments. 1990.
|
| 270 |
+
J. Schrittwieser, I. Antonoglou, T. Hubert, K. Simonyan, L. Sifre, S. Schmitt, A. Guez, E. Lockhart, D. Hassabis, T. Graepel, et al. Mastering atari, go, chess and shogi by planning with a learned model. arXiv preprint arXiv:1911.08265, 2019.
|
| 271 |
+
J. Schulman, F. Wolski, P. Dhariwal, A. Radford, and O. Klimov. Proximal policy optimization algorithms. arXiv preprint arXiv:1707.06347, 2017.
|
| 272 |
+
D. Silver, G. Lever, N. Heess, T. Degris, D. Wierstra, and M. Riedmiller. Deterministic policy gradient algorithms. In Proceedings of the 31st International Conference on Machine Learning, 2014.
|
| 273 |
+
D. Silver, J. Schrittwieser, K. Simonyan, I. Antonoglou, A. Huang, A. Guez, T. Hubert, L. Baker, M. Lai, A. Bolton, et al. Mastering the game of go without human knowledge. Nature, 550(7676): 354, 2017.
|
| 274 |
+
A. Srinivas, A. Jabri, P. Abbeel, S. Levine, and C. Finn. Universal planning networks. arXiv preprint arXiv:1804.00645, 2018.
|
| 275 |
+
R. S. Sutton. Dyna, an integrated architecture for learning, planning, and reacting. ACM SIGART Bulletin, 2(4):160–163, 1991.
|
| 276 |
+
R. S. Sutton and A. G. Barto. Reinforcement learning: An introduction. MIT press, 2018.
|
| 277 |
+
Y. Tassa, Y. Doron, A. Muldal, T. Erez, Y. Li, D. d. L. Casas, D. Budden, A. Abdolmaleki, J. Merel, A. Lefrancq, et al. Deepmind control suite. arXiv preprint arXiv:1801.00690, 2018.
|
| 278 |
+
N. Tishby, F. C. Pereira, and W. Bialek. The information bottleneck method. arXiv preprint physics/0004057, 2000.
|
| 279 |
+
T. Wang and J. Ba. Exploring model-based planning with policy networks. arXiv preprint arXiv:1906.08649, 2019.
|
| 280 |
+
T. Wang, X. Bao, I. Clavera, J. Hoang, Y. Wen, E. Langlois, S. Zhang, G. Zhang, P. Abbeel, and J. Ba. Benchmarking model-based reinforcement learning. CoRR, abs/1907.02057, 2019.
|
| 281 |
+
M. Watter, J. Springenberg, J. Boedecker, and M. Riedmiller. Embed to control: A locally linear latent dynamics model for control from raw images. In Advances in neural information processing systems, pages 2746–2754, 2015.
|
| 282 |
+
T. Weber, S. Racanière, D. P. Reichert, L. Buesing, A. Guez, D. J. Rezende, A. P. Badia, O. Vinyals, N. Heess, Y. Li, et al. Imagination-augmented agents for deep reinforcement learning. arXiv preprint arXiv:1707.06203, 2017.
|
| 283 |
+
R. J. Williams. Simple statistical gradient-following algorithms for connectionist reinforcement learning. Machine learning, 8(3-4):229–256, 1992.
|
| 284 |
+
M. Zhang, S. Vikram, L. Smith, P. Abbeel, M. Johnson, and S. Levine. Solar: deep structured representations for model-based reinforcement learning. In International Conference on Machine Learning, 2019.
|
| 285 |
+
|
| 286 |
+
# A HYPER PARAMETERS
|
| 287 |
+
|
| 288 |
+
Model components We use the convolutional encoder and decoder networks from Ha and Schmidhuber (2018), the RSSM of Hafner et al. (2018), and implement all other functions as three dense layers of size 300 with ELU activations (Clevert et al., 2015). Distributions in latent space are 30-dimensional diagonal Gaussians. The action model outputs a tanh mean scaled by a factor of 5 and a softplus standard deviation for the Normal distribution that is then transformed using tanh (Haarnoja et al., 2018). The scaling factor allows the agent to saturate the action distribution.
|
| 289 |
+
|
| 290 |
+
Learning updates We draw batches of 50 sequences of length 50 to train the world model, value model, and action model models using Adam (Kingma and Ba, 2014) with learning rates $6 \times 1 0 ^ { - 4 }$ , $8 \times 1 0 ^ { - 5 }$ , $8 \times 1 0 ^ { - 5 }$ , respectively and scale down gradient norms that exceed 100. We do not scale the KL regularizers ( $\beta = 1 \AA$ ) but clip them below 3 free nats as in PlaNet. The imagination horizon is $H = 1 5$ and the same trajectories are used to update both action and value models. We compute the $\mathrm { V } _ { \lambda }$ targets with $\gamma = 0 . 9 9$ and $\lambda = 0 . 9 5$ . We did not find latent overshooting for learning the model, an entropy bonus for the action model, or target networks for the value model necessary.
|
| 291 |
+
|
| 292 |
+
Environment interaction The dataset is initialized with $S = 5$ episodes collected using random actions. We iterate between 100 training steps and collecting 1 episode by executing the predicted mode action with Norma $_ { . ( 0 , 0 . 3 ) }$ exploration noise. Instead of manually selecting the action repeat for each environment as in Hafner et al. (2018) and Lee et al. (2019), we fix it to 2 for all environments. See Figure 12 for an assessment of the robustness to different action repeat values.
|
| 293 |
+
|
| 294 |
+
Discrete control For experiments on Atari games and DeepMind Lab levels, the action model predicts the logits of a categorical distribution. We use straight-through gradients for the sampling step during latent imagination. The action noise is epsilon greedy where $\epsilon$ is linearly scheduled from $0 . 4 0 . 1$ over the first 200, 000 gradient steps. To account for the higher complexity of these tasks, we use an imagination horizon of $H = 1 0$ , scale the KL regularizers by $\beta = 0 . 1$ , and bound rewards using tanh. We predict the discount factor from the latent state with a binary classifier that is trained towards the soft labels of 0 and $\gamma$ .
|
| 295 |
+
|
| 296 |
+
# B DERIVATIONS
|
| 297 |
+
|
| 298 |
+
e define the information bottleneck objective (Tishby et al., 2000) for latent dynamics models,
|
| 299 |
+
|
| 300 |
+
$$
|
| 301 |
+
\operatorname* { m a x } { \mathrm { I } \big ( } s _ { 1 : T } ; { \big ( } o _ { 1 : T } , r _ { 1 : T } { \big ) } \mid a _ { 1 : T } { \big ) } - \beta { \mathrm { I } \big ( } s _ { 1 : T } , i _ { 1 : T } { \mathrm { ~ \big | ~ } } a _ { 1 : T } { \big ) } ,
|
| 302 |
+
$$
|
| 303 |
+
|
| 304 |
+
where $\beta$ is scalar and $i _ { t }$ are dataset indices that determine the observations $p ( o _ { t } \mid i _ { t } ) \doteq \delta ( o _ { t } - \bar { o } _ { t } )$ as in Alemi et al. (2016).
|
| 305 |
+
|
| 306 |
+
Maximizing the objective leads to model states that can predict the sequence of observations and rewards while limiting the amount of information extracted at each time step. This encourages the model to reconstruct each image by relying on information extracted at preceeding time steps to the extent possible, and only accessing additional information from the current image when necessary. As a result, the information regularizer encourages the model to learn long-term dependencies.
|
| 307 |
+
|
| 308 |
+
For the generative objective, we lower bound the first term using the non-negativity of the KL divergence and drop the marginal data probability as it does not depend on the representation model,
|
| 309 |
+
|
| 310 |
+
$$
|
| 311 |
+
\begin{array} { r l } & { \mathrm { I } \big ( { { s _ { 1 : T } } ; \big ( { o _ { 1 : T } } , { r _ { 1 : T } } \big ) \ } \big | { a _ { 1 : T } } \big ) } \\ & { = \mathrm { E } _ { p \big ( { o _ { 1 : T } } , { r _ { 1 : T } } , { s _ { 1 : T } } , { a _ { 1 : T } } \big ) } \bigg ( \displaystyle \sum _ { t } \ln p \big ( { o _ { 1 : T } } , { r _ { 1 : T } } \big | { s _ { 1 : T } } , { a _ { 1 : T } } \big ) - \displaystyle \frac { \ln p \big ( { o _ { 1 : T } } , { r _ { 1 : T } } \big | { a _ { 1 : T } } \big ) } { \cos { \mathrm { s i } } } \bigg ) } \\ & { \stackrel { \mathrm { \scriptsize ~ \pm ~ } } { = } \mathrm { E } \bigg ( \displaystyle \sum _ { t } \ln p \big ( { o _ { 1 : T } } , { r _ { 1 : T } } \big | { s _ { 1 : T } } , { a _ { 1 : T } } \big ) \bigg ) } \\ & { \geq \mathrm { E } \bigg ( \displaystyle \sum _ { t } \ln p \big ( { o _ { 1 : T } } , { r _ { 1 : T } } \big | { s _ { 1 : T } } , { a _ { 1 : T } } \big ) \bigg ) - \mathrm { K L } \bigg ( p \big ( { o _ { 1 : T } } , { r _ { 1 : T } } \big | { s _ { 1 : T } } , { a _ { 1 : T } } \big ) \bigg | \bigg | \displaystyle \prod _ { t } q ( { o _ { t } } \mid { s _ { t } } ) q \big ( { r _ { t } } \mid { s _ { t } } \big ) } \\ & { = \mathrm { E } \bigg ( \displaystyle \sum _ { t } \ln q \big ( { o _ { t } } \mid { s _ { t } } \big ) + \ln q \big ( { r _ { t } } \mid { s _ { t } } \big ) \bigg ) . } \end{array}
|
| 312 |
+
$$
|
| 313 |
+
|
| 314 |
+
For the contrastive objective, we subtract the constant marginal probability of the data under the variational encoder, apply Bayes rule, and use the InfoNCE mini-batch bound (Poole et al., 2019),
|
| 315 |
+
|
| 316 |
+
$$
|
| 317 |
+
\begin{array} { l } { \displaystyle \operatorname { E } \big ( \ln q ( o _ { t } \mid s _ { t } ) + \ln q ( r _ { t } \mid s _ { t } ) \big ) } \\ { \displaystyle \pm \ \operatorname { E } \big ( \ln q ( o _ { t } \mid s _ { t } ) - \ln q ( o _ { t } ) + \ln q ( r _ { t } \mid s _ { t } ) \big ) } \\ { \displaystyle = \ \operatorname { E } \big ( \ln q ( s _ { t } \mid o _ { t } ) - \ln q ( s _ { t } ) + \ln q ( r _ { t } \mid s _ { t } ) \big ) } \\ { \displaystyle \geq \ \operatorname { E } \bigg ( \ln q ( s _ { t } \mid o _ { t } ) - \ln \sum _ { o ^ { \prime } } q ( s _ { t } \mid o ^ { \prime } ) + \ln q ( r _ { t } \mid s _ { t } ) \bigg ) . } \end{array}
|
| 318 |
+
$$
|
| 319 |
+
|
| 320 |
+
For the second term, we use the non-negativity of the KL divergence to obtain an upper bound,
|
| 321 |
+
|
| 322 |
+
$$
|
| 323 |
+
\begin{array} { r l } & { \quad \operatorname { I } ( s _ { 1 : T } ; i _ { 1 : T } \mid a _ { 1 : T } ) } \\ & { = \operatorname { E } _ { p ( o _ { 1 : T } , r _ { 1 : T } , s _ { 1 : T } , a _ { 1 : T } , i _ { 1 : T } ) } \Big ( \displaystyle \sum _ { t } \ln p ( s _ { t } \mid s _ { t - 1 } , a _ { t - 1 } , i _ { t } ) - \ln p ( s _ { t } \mid s _ { t - 1 } , a _ { t - 1 } ) \Big ) } \\ & { = \operatorname { E } \Big ( \displaystyle \sum _ { t } \ln p ( s _ { t } \mid s _ { t - 1 } , a _ { t - 1 } , o _ { t } ) - \ln p ( s _ { t } \mid s _ { t - 1 } , a _ { t - 1 } ) \Big ) } \\ & { \le \operatorname { E } \Big ( \displaystyle \sum _ { t } \ln p ( s _ { t } \mid s _ { t - 1 } , a _ { t - 1 } , o _ { t } ) - \ln q ( s _ { t } \mid s _ { t - 1 } , a _ { t - 1 } ) \Big ) } \\ & { = \operatorname { E } \Big ( \displaystyle \sum _ { t } \operatorname { K L } ( p ( s _ { t } \mid s _ { t - 1 } , a _ { t - 1 } , o _ { t } ) q ( s _ { t } \mid s _ { t - 1 } , a _ { t - 1 } ) ) \Big ) . } \end{array}
|
| 324 |
+
$$
|
| 325 |
+
|
| 326 |
+
This lower bounds the objective.
|
| 327 |
+
|
| 328 |
+
# C DISCRETE CONTROL
|
| 329 |
+
|
| 330 |
+
We evaluate Dreamer on a subset of tasks with discrete actions from the Atari suite (Bellemare et al., 2013) and DeepMind Lab (Beattie et al., 2016). While agents that purely learn through world models are not yet competitive in these domains (Kaiser et al., 2019), the tasks offer a diverse test bed with visual complexity, sparse rewards, and early termination. Agents observe $6 4 \times 6 4 \times 3$ images and select one of between 3 and 18 actions. For Atari, we follow the evaluation protocol of Machado et al. (2018) with sticky actions. Refer to Figure 9 for these experiments.
|
| 331 |
+
|
| 332 |
+

|
| 333 |
+
Figure 9: Performance of Dreamer in environments with discrete actions and early termination. Dreamer learns successful behaviors on this subset of Atari games and the object collection level of DMLab. We highlight representation learning for these environments as a direction of future work that could enable competitive performance across all Atari games and DMLab levels using Dreamer.
|
| 334 |
+
|
| 335 |
+

|
| 336 |
+
Figure 10: Comparison of action selection schemes on the continuous control tasks of the DeepMind Control Suite from pixel inputs. The lines show mean scores over environment steps and the shaded areas show the standard deviation across 5 seeds. We compare Dreamer that learns both actions and values in imagination, to only learning actions in imagination, and Planet that selects actions by online planning instead of learning a policy. The baselines include the top model-free algorithm D4PG, the well-known A3C agent, and the hybrid SLAC agent.
|
| 337 |
+
|
| 338 |
+

|
| 339 |
+
Figure 11: Comparison of representation learning methods for Dreamer. The lines show mean scores and the shaded areas show the standard deviation across 5 seeds. We compare generating both images and rewards, generating rewards and using a contrastive loss to learn about the images, and only predicting rewards. Image reconstruction provides the best learning signal across most of the tasks, followed by the contrastive objective. Learning purely from rewards was not sufficient in our experiments and might require larger amounts of experience.
|
| 340 |
+
|
| 341 |
+

|
| 342 |
+
Figure 12: Robustness of Dreamer to different control frequencies. Reinforcement learning methods can be sensitive to this hyper parameter, which could be amplified when learning dynamics models at the control frequency of the environment. For this experiment, we train Dreamer with different amounts of action repeat. The areas show one standard deviation across 2 seeds. We used a previous hyper parameter setting for this experiment. We find that a value of $R = 2$ works best across tasks.
|
| 343 |
+
|
| 344 |
+
G CONTINUOUS CONTROL SCORES
|
| 345 |
+
|
| 346 |
+
<table><tr><td></td><td>A3C</td><td>D4PG</td><td>PlaNet1</td><td>Dreamer</td></tr><tr><td>Modality</td><td>proprio</td><td>pixels 109</td><td>pixels 5×106</td><td>pixels</td></tr><tr><td>Steps</td><td>109</td><td></td><td></td><td>5×106</td></tr><tr><td>Acrobot Swingup</td><td>41.90</td><td>91.70</td><td>3.21</td><td>365.26</td></tr><tr><td>Cartpole Balance</td><td>951.60</td><td>992.80</td><td>452.56</td><td>979.56</td></tr><tr><td>Cartpole Balance Sparse</td><td>857.40</td><td>1000.00</td><td>164.74</td><td>941.84</td></tr><tr><td>Cartpole Swingup</td><td>558.40</td><td>862.00</td><td>312.56</td><td>833.66</td></tr><tr><td>Cartpole Swingup Sparse</td><td>179.80</td><td>482.00</td><td>0.64</td><td>812.22</td></tr><tr><td>Cheetah Run</td><td>213.90</td><td>523.80</td><td>496.12</td><td>894.56</td></tr><tr><td>Cup Catch</td><td>104.70</td><td>980.50</td><td>455.98</td><td>962.48</td></tr><tr><td>Finger Spin</td><td>129.40</td><td>985.70</td><td>495.25</td><td>498.88</td></tr><tr><td>Finger Turn Easy</td><td>167.30</td><td>971.40</td><td>451.22</td><td>825.86</td></tr><tr><td>Finger Turn Hard</td><td>88.70</td><td>966.00</td><td>312.55</td><td>891.38</td></tr><tr><td>Hopper Hop</td><td>0.50</td><td>242.00</td><td>0.37</td><td>368.97</td></tr><tr><td>Hopper Stand</td><td>27.90</td><td>929.90</td><td>5.96</td><td>923.72</td></tr><tr><td>Pendulum Swingup</td><td>48.60</td><td>680.90</td><td>3.27</td><td>833.00</td></tr><tr><td>Quadruped Run</td><td>1</td><td>1</td><td>280.45</td><td>888.39</td></tr><tr><td>Quadruped Walk</td><td>一</td><td>1</td><td>238.90</td><td>931.61</td></tr><tr><td>Reacher Easy</td><td>95.60</td><td>967.40</td><td>468.50</td><td>935.08</td></tr><tr><td>Reacher Hard</td><td>39.70</td><td>957.10</td><td>187.02</td><td>817.05</td></tr><tr><td>Walker Run</td><td>191.80</td><td>567.20</td><td>626.25</td><td>824.67</td></tr><tr><td>Walker Stand</td><td>378.40</td><td>985.20</td><td>759.19</td><td>977.99</td></tr><tr><td>Walker Walk</td><td>311.00</td><td>968.30</td><td>944.70</td><td>961.67</td></tr><tr><td>Average</td><td>243.70</td><td>786.32</td><td>332.97</td><td>823.39</td></tr></table>
|
md/train/S1ldO2EFPr/S1ldO2EFPr.md
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
md/train/S5S3eTEmouw/S5S3eTEmouw.md
ADDED
|
@@ -0,0 +1,471 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# OFFLINE META-REINFORCEMENT LEARNING WITHADVANTAGE WEIGHTING
|
| 2 |
+
|
| 3 |
+
Anonymous authors Paper under double-blind review
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
This paper introduces the offline meta-reinforcement learning (offline meta-RL) problem setting and proposes an algorithm that performs well in this setting. Offline meta-RL is analogous to the widely successful supervised learning strategy of pretraining a model on a large batch of fixed, pre-collected data (possibly from various tasks) and fine-tuning the model to a new task with relatively little data. That is, in offline meta-RL, we meta-train on fixed, pre-collected data from several tasks and adapt to a new task with a very small amount (less than 5 trajectories) of data from the new task. By nature of being offline, algorithms for offline meta-RL can utilize the largest possible pool of training data available and eliminate potentially unsafe or costly data collection during meta-training. This setting inherits the challenges of offline RL, but it differs significantly because offline RL does not generally consider a) transfer to new tasks or b) limited data from the test task, both of which we face in offline meta-RL. Targeting the offline meta-RL setting, we propose Meta-Actor Critic with Advantage Weighting (MACAW). MACAW is an optimization-based meta-learning algorithm that uses simple, supervised regression objectives for both the inner and outer loop of meta-training. On offline variants of common meta-RL benchmarks, we empirically find that this approach enables fully offline meta-reinforcement learning and achieves notable gains over prior methods.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
Meta-reinforcement learning (meta-RL) has emerged as a promising strategy for tackling the high sample complexity of reinforcement learning algorithms, when the goal is to ultimately learn many tasks. Meta-RL algorithms exploit shared structure among tasks during meta-training, amortizing the cost of learning across tasks and enabling rapid adaptation to new tasks during meta-testing from only a small amount of experience. Yet unlike in supervised learning, where large amounts of pre-collected data can be pooled from many sources to train a single model, existing meta-RL algorithms assume the ability to collect millions of environment interactions online during meta-training. Developing offline meta-RL methods would enable such methods, in principle, to leverage existing data from any source, making them easier to scale to real-world problems where large amounts of data might be necessary to generalize broadly. To this end, we propose the offline meta-RL problem setting and a corresponding algorithm that uses only offline (or batch) experience from a set of training tasks to enable efficient transfer to new tasks without any further interaction with either the training or testing environments. See Figure 1 for a comparison of offline meta-RL and standard meta-RL.
|
| 12 |
+
|
| 13 |
+
Because the offline setting does not allow additional data collection during training, it highlights the desirability of a consistent meta-RL algorithm. A meta-RL algorithm is consistent if, given enough diverse data on the test task, adaptation can find a good policy for the task regardless of the training task distribution. Such an algorithm would provide a) rapid adaptation to new tasks from the same distribution as the train tasks while b) allowing for improvement even for out of distribution test tasks. However, designing a consistent meta-RL algorithm in the offline setting is difficult: the consistency requirement suggests we might aim to extend the model-agnostic meta-learning (MAML) algorithm (Finn et al., 2017a), since it directly corresponds to fine-tuning at meta-test time. However, existing MAML approaches use online policy gradients, and only value-based approaches have proven effective in the offline setting. Yet combining MAML with value-based RL subroutines is not straightforward: the higher-order optimization in MAML-like methods demands stable and efficient gradient-descent updates, while TD backups are both somewhat unstable and require a large number of steps to propagate reward information across long time horizons.
|
| 14 |
+
|
| 15 |
+
To address these challenges, one might combine MAML with a supervised, bootstrap-free RL subroutine, such as advantage-weighted regression (AWR) (Peters and Schaal, 2007; Peng et al., 2019), for both for the inner and outer loop of a gradient-based meta-learning algorithm, yielding a ‘MAML+AWR’ algorithm. However, as we will discuss in Section 4 and find empirically in Section 5, naïvely combining MAML and AWR in this way does not provide satisfactory performance because the AWR policy update is not sufficiently expressive. Motivated by prior work that studies the expressive power of MAML (Finn and Levine, 2018), we increase the expressive power of the meta-learner by introducing a carefully chosen policy update in the inner loop. We theoretically prove that this change increases the richness of the policy’s update and find empirically that this policy update dramatically improves adaptation performance and stability in some settings. We further observe that standard feedforward neural network architectures used in reinforcement learning are not well-suited to optimization-based meta-learning and suggest an alternative that proves critical for good performance across four different environments. We call the resulting meta-RL algorithm and architecture Meta-Actor Critic with Advantage Weighting, or MACAW.
|
| 16 |
+
|
| 17 |
+
Our main contributions are the offline meta-RL problem setting itself and MACAW, an offline meta-reinforcement learning algorithm that possesses three key properties: sample efficiency, offline meta-training, and consistency at meta-test time. To our knowledge, MACAW is the first algorithm to successfully combine gradient-based meta-learning and off-policy value-based RL. Our evaluations include experiments on offline variants of standard continuous control meta-RL benchmarks as well as settings specifically designed to test the robustness of an offline meta-learner when training tasks are scarce. In all of these settings, MACAW significantly outperforms fully offline variants state-of-the-art off-policy RL and meta-RL baselines.
|
| 18 |
+
|
| 19 |
+
# 2 PRELIMINARIES
|
| 20 |
+
|
| 21 |
+
In reinforcement learning, an agent interacts with a Markov Decision Process (MDP) to maximize its cumulative reward. An MDP is a tuple $( \boldsymbol { S } , \boldsymbol { A } , \boldsymbol { T } , \boldsymbol { r } )$ consisting of a state space $s$ , an action space $\mathcal { A }$ , stochastic transition dynamics $T : \mathcal { S } \times \mathcal { A } \times \mathcal { S } [ 0 , 1 ]$ , and a reward function $r$ . At each time step, the agent receives reward $r _ { t } = r ( s _ { t } , a _ { t } , s _ { t + 1 } )$ . The agent’s objective is to maximize the expected return (i.e. discounted sum of rewards) $\begin{array} { r } { \mathcal { R } = \sum _ { t } \gamma ^ { t } r _ { t } } \end{array}$ , where $\gamma \in [ 0 , 1 ]$ is a discount factor. To extend this setting to meta-RL, we consider tasks drawn from a distribution $\mathcal { T } _ { i } \sim p ( \mathcal { T } )$ , where each task $\mathcal { T } _ { i } = ( \mathcal { S } , \bar { \mathcal { A } } , p _ { i } , r _ { i } )$ represents a different MDP. Both the dynamics and reward function may vary across tasks. The tasks are generally assumed to exhibit some (unknown) shared structure. During meta-training, the agent is presented with tasks sampled from $p ( \mathcal T )$ ; at meta-test time, an agent’s objective is to rapidly find a high-performing policy for a (potentially unseen) task $\mathcal { T } ^ { \prime } \sim p ( \mathcal { T } )$ . That is, with only a small amount of experience on $\mathcal { T } ^ { \prime }$ , the agent should find a policy that achieves high expected return on that task. During meta-training, the agent meta-learns parameters or update rules that enables such rapid adaptation at test-time.
|
| 22 |
+
|
| 23 |
+
Model-agnostic meta-learning One class of algorithms for addressing the meta-RL problem (as well as meta-supervised learning) are variants of the MAML algorithm (Finn et al., 2017a), which involves a bi-level optimization that aims to achieve fast adaptation via a few gradient updates. Specifically, MAML optimizes a set of initial policy parameters $\theta$ such that a few gradient-descent steps from $\theta$ leads to policy parameters that achieve good task performance. At each meta-training step, the inner loop adapts $\theta$ to a task $\tau$ by computing $\theta ^ { \prime } = \theta - \alpha \nabla _ { \theta } \mathcal { L } _ { T } ( \theta )$ , where $\mathcal { L }$ is the loss function for task $\tau$ and $\alpha$ is the step size (in general, $\theta ^ { \prime }$ might be computed from multiple gradient steps, rather than just one as is written here). The outer loop updates the initial parameters as $\theta \doteq \theta - \beta \nabla _ { \theta } \mathcal { L } _ { T } ^ { \prime } ( \bar { \theta } ^ { \prime } )$ , where $\mathcal { L } _ { \mathcal { T } } ^ { \prime }$ is a loss function for task $\tau$ , which may or may not be the same as the inner-loop loss function $\mathcal { L } _ { T }$ , and $\beta$ is the step size. MAML has been previously instantiated with policy gradient updates in the inner and outer loops (Finn et al., $2 0 1 7 \mathrm { a }$ ; Rothfuss et al., 2018), which can only be applied to on-policy meta-RL settings; we address this shortcoming in this work.
|
| 24 |
+
|
| 25 |
+
Advantage-weighted regression. To develop an offline meta-RL algorithm, we build upon advantage-weighted regression (AWR) (Peng et al., 2019), a simple offline RL method. The AWR policy objective is given by
|
| 26 |
+
|
| 27 |
+
$$
|
| 28 |
+
\mathcal { L } ^ { \mathrm { A W R } } ( \vartheta , \varphi , B ) = \mathbb { E } _ { \mathbf { s } , \mathbf { a } \sim B } \left[ - \log \pi _ { \vartheta } ( \mathbf { a } | \mathbf { s } ) \exp \left( \frac { 1 } { T } \left( \mathcal { R } _ { B } ( \mathbf { s } , \mathbf { a } ) - V _ { \varphi } ( \mathbf { s } ) \right) \right) \right] ,
|
| 29 |
+
$$
|
| 30 |
+
|
| 31 |
+
where $B = \{ \mathbf { s } _ { j } , \mathbf { a } _ { j } , \mathbf { s } _ { j } ^ { \prime } , r _ { j } \}$ can be an arbitrary dataset of transition tuples sampled from some behavior policy, and $\mathcal { R } _ { B } ( \mathbf { s } , \mathbf { a } )$ is the return recorded in the dataset for performing action a in state s, $V _ { \varphi } ( \mathbf { s } )$ is the learned value function for the behavior policy evaluated at state s, and $T > 0$ is a temperature parameter. The term $\mathcal { R } _ { B } ( \mathbf { s } , \mathbf { a } ) - V _ { \varphi } ( \mathbf { s } )$ represents the advantage of a particular action. The objective can be interpreted as a weighted regression problem, where actions that lead to higher advantages are assigned larger weights. The value function parameters $\varphi$ are typically trained using simple regression onto Monte Carlo returns, and the policy parameters $\vartheta$ are trained using $\mathcal { L } ^ { \mathrm { A W R } }$ . Next, we discuss the offline meta-RL problem and some of the challenges it poses.
|
| 32 |
+
|
| 33 |
+

|
| 34 |
+
Figure 1: Comparing the standard meta-RL setting (left), which includes on-policy and off-policy meta-RL, with offline meta-RL (right). In standard meta-RL, new interactions are sampled from the environment during both meta-training and meta-testing, potentially storing experiences in a replay buffer (off-policy meta-RL). In offline meta-RL, a batch of data is provided for each training task $\mathcal { T } _ { i }$ . This data could be the result of prior skills learned, demonstrations, or other means of data collection. The meta-learner uses these static buffers of data for meta-training and can then learn a new test task when given a small buffer of data for that task.
|
| 35 |
+
|
| 36 |
+
# 3 THE OFFLINE META-RL PROBLEM
|
| 37 |
+
|
| 38 |
+
In the offline meta-RL problem setting, we aim to leverage offline multi-task experience to enable fast adaptation to new downstream tasks. Each task $\mathcal { T } _ { i }$ is drawn from a task distribution $p ( \mathcal { T } )$ . In the offline setting, the meta-training algorithm is not permitted to directly interact with the meta-training tasks $\mathcal { T } _ { i }$ , but instead is provided with a fixed dataset of transition tuples $B _ { i } = \{ s _ { i , j } , a _ { i , j } , s _ { i , j } ^ { \prime } , r _ { i , j } \}$ for each task. Each $B _ { i }$ is populated with trajectories sampled from a corresponding behavior policy $\mu _ { i }$ . Each $\mu _ { i }$ might be an expert policy, sub-optimal demonstrations, other RL agents, or some mixture thereof. Regardless of the behavior policies $\mu _ { i }$ , the objective of offline meta-RL is to maximize return after adaptation on the test tasks. However, depending on the quality of the behavior policies, the maximum attainable return may vary. We observe such a phenomenon in a offline data quality ablation experiment in Section 5.
|
| 39 |
+
|
| 40 |
+
Sampling data from a fixed dataset at both meta-training and meta-testing time, rather than from the learned policy itself, distinguishes offline meta-RL from the standard meta-RL setting. This constraint is significant, because most algorithms for meta-RL require a large amount of on-policy experience from the environment during meta-training; these algorithms are generally unable to fully make use of data collected by external sources. During meta-testing, a (generally unseen) test task $\mathcal { T } _ { \mathrm { t e s t } }$ is drawn from $p ( \mathcal T )$ , and the meta-trained agent is presented with a new batch of experience $D$ sampled from a distribution $B _ { \mathrm { t e s t } }$ . The agent’s objective is to use this batch of data to find the highest-performing policy for the test task. We consider the case where only $B _ { i }$ is fixed during meta-training and $B _ { \mathrm { t e s t } }$ corresponds to sampling online trajectories to be the offline meta-RL problem. The case where both $B _ { i }$ and $B _ { \mathrm { t e s t } }$ are fixed data buffers is called the fully offline meta-RL problem, which is especially applicable in situations when allowing online exploration might be difficult or dangerous. In the fully offline case, we might also consider the setting where we perform additional online rollouts with our adapted policy and fine-tune with this online data after the initial offline adaptation step. We call this the fully offline meta-RL problem with online fine-tuning. The experiments performed in this paper mostly correspond to the fully offline setting. In Appendix C.2 we also conduct an experiment in the setting of fully offline meta-RL with online fine-tuning.
|
| 41 |
+
|
| 42 |
+
Prior meta-RL methods require interaction with the MDP for each of the meta-training tasks (Finn et al., 2017a), and though some prior methods build on off-policy RL algorithms (Rakelly et al., 2019), these algorithms are known to perform poorly in the fully offline setting (Levine et al., 2020). Both of the offline meta-RL settings described above inherit the distributional difficulties of offline RL, which means that addressing this problem setting requires a new type of meta-RL method that is capable of meta-training from offline data.
|
| 43 |
+
|
| 44 |
+
# 4 MACAW: META ACTOR-CRITIC WITH ADVANTAGE WEIGHTING
|
| 45 |
+
|
| 46 |
+
# Algorithm 1 MACAW Meta-Training
|
| 47 |
+
|
| 48 |
+
# Algorithm 2 MACAW Meta-Testing
|
| 49 |
+
|
| 50 |
+
1: Input: Tasks $\{ \mathcal { T } _ { i } \}$ , offline buffers $\{ D _ { i } \}$
|
| 51 |
+
2: Hyperparameters: learning rates $\alpha _ { 1 }$ , $\alpha _ { 2 }$ , $\eta _ { 1 }$
|
| 52 |
+
$\eta _ { 2 }$ , training iterations $n$ , temperature $T$
|
| 53 |
+
3: Randomly initialize meta-parameters $\theta , \phi$
|
| 54 |
+
4: for $n$ steps do
|
| 55 |
+
5: for task $\mathcal { T } _ { i } \in \{ \mathcal { T } _ { i } \}$ do
|
| 56 |
+
6: Sample disjoint batches $D _ { i } ^ { \mathrm { t r } } , D _ { i } ^ { \mathrm { t s } } \sim D _ { i }$
|
| 57 |
+
7: $\begin{array}{c} \begin{array} { r l } & { \quad \phi _ { i } ^ { \prime } \xleftarrow { * } \phi - \check { \eta } _ { 1 } \nabla _ { \phi } \mathcal { L } _ { V } ( \phi , D _ { i } ^ { \mathrm { t r } } ) } \\ & { \quad \theta _ { i } ^ { \prime } \xleftarrow \theta - \alpha _ { 1 } \nabla _ { \theta } \mathcal { L } _ { \pi } ( \theta , \phi _ { i } ^ { \prime } , D _ { i } ^ { \mathrm { t r } } ) } \\ & { \quad \phi \xleftarrow \phi - \eta _ { 2 } \sum _ { i } \left[ \nabla _ { \phi } \mathcal { L } _ { V } ( \phi _ { i } ^ { \prime } , D _ { i } ^ { \mathrm { t s } } ) \right] } \\ & { \quad \theta \xleftarrow \theta - \alpha _ { 2 } \sum _ { i } \left[ \nabla _ { \theta } \mathcal { L } ^ { \mathrm { A W R } } ( \theta _ { i } ^ { \prime } , \phi _ { i } ^ { \prime } , \right.} \end{array} \end{array}$
|
| 58 |
+
8:
|
| 59 |
+
9:
|
| 60 |
+
10:
|
| 61 |
+
|
| 62 |
+
1: Input: Test task $\tau _ { j }$ , offline experience $D$ , meta-policy $\pi _ { \theta }$ , meta-value function $V _ { \phi }$
|
| 63 |
+
2: Hyperparameters: learning rates $\alpha _ { 1 } , \eta$ , adaptation iterations $n$ , temperature $T$
|
| 64 |
+
3: Initialize $\theta _ { 0 } \theta$ , $\phi _ { 0 } \phi$ .
|
| 65 |
+
4: for $n$ steps do
|
| 66 |
+
5: 6: $\begin{array} { r l } & { \phi _ { t + 1 } \dot { } \phi _ { t } - \eta _ { 1 } \nabla _ { \phi _ { t } } \mathcal { L } _ { V } ( \phi _ { t } , D ) } \\ & { \theta _ { t + 1 } \theta _ { t } - \alpha _ { 1 } \nabla _ { \theta _ { t } } \mathcal { L } _ { \pi } ( \theta _ { t } , \phi _ { t + 1 } , D ) } \end{array}$
|
| 67 |
+
|
| 68 |
+
In addition to satisfying the demands of the offline setting, an ideal method for offline meta-RL should not be limited to the distribution of tasks observed at training time. This is especially important in the offline meta-RL setting, in which the sampling of the training data is out of the control of the agent. In other words, it is critical that an offline meta-RL algorithm be consistent, in the sense that given enough, sufficiently diverse adaptation data at meta-test time, the algorithm can find a good solution to that task, regardless of the meta-training tasks.
|
| 69 |
+
|
| 70 |
+
To address the numerous challenges posed by offline meta-RL, we propose meta actor-critic with advantage weighting (MACAW). MACAW is an offline meta-RL algorithm that learns initializations $\phi$ and $\theta$ for a value function $V _ { \phi }$ and policy $\pi _ { \theta }$ , respectively, that can rapidly adapt to a new task seen at meta-test time via gradient descent. Both the value function and the policy objectives correspond to simple regression losses in both the inner and outer loop, leading to a stable and consistent inner-loop adaptation process and outer-loop meta-training signal. While these objectives build upon AWR, we show that the naive application of an AWR update in the inner loop leads to unsatisfactory performance, motivating the enriched policy update that we describe in Section 4.1. In Sections 4.2 and 4.3, we detail the full meta-training procedure and an important architectural component of the policy and value networks.
|
| 71 |
+
|
| 72 |
+
# 4.1 INNER-LOOP MACAW PROCEDURE
|
| 73 |
+
|
| 74 |
+
The adaptation process for MACAW consists of a value function update followed by a policy update and can be found in lines 6-8 in Algorithm 1. Optimization-based meta-learning methods typically rely on truncated optimization for the adaptation process (Finn et al., 2017a), to satisfy both computational and memory constraints (Wu et al., 2018; Rajeswaran et al., 2019), and MACAW also uses a truncated optimization. However, value-based algorithms that use bootstrapping, such as Q-learning, can require many iterations for values to propagate. Therefore, we use a bootstrap-free update for the value function that simply performs supervised regression onto Monte-Carlo returns.
|
| 75 |
+
|
| 76 |
+

|
| 77 |
+
Figure 2: MACAW policy architecture. Solid lines show the forward pass; dashed lines show gradient flow during the backward pass during adaptation only; the advantage head is not used in the outer loop policy update.
|
| 78 |
+
|
| 79 |
+
Given a batch of training data $D _ { i } ^ { \mathrm { t r } }$ collected for $\mathcal { T } _ { i }$ , MACAW adapts the value function by taking one or a few gradient steps on the following supervised objective:
|
| 80 |
+
|
| 81 |
+
$$
|
| 82 |
+
\phi _ { i } ^ { \prime } \xleftarrow { } \phi - \eta _ { 1 } \nabla _ { \phi } \mathcal { L } _ { V } ( \phi , D _ { i } ^ { \mathrm { I } } ) , \qquad \mathrm { w h e r e } \qquad \mathcal { L } _ { V } ( \phi , D ) \triangleq \mathbb { E } _ { \mathbf { s } , \mathbf { a } \sim D } \left[ ( V _ { \phi } ( \mathbf { s } ) - \mathcal { R } _ { D } ( \mathbf { s } , \mathbf { a } ) ) ^ { 2 } \right]
|
| 83 |
+
$$
|
| 84 |
+
|
| 85 |
+
and where $\mathcal { R } _ { D } ( \mathbf { s } , \mathbf { a } )$ is the Monte Carlo return from the state s taking action a observed in $D$ .
|
| 86 |
+
|
| 87 |
+
After adapting the value function, we proceed to updating the policy. The AWR algorithm updates its policy by performing supervised regression onto actions weighted by the estimated advantage, where the advantage is given by the return minus the value: $\mathcal { R } _ { D } ( \mathbf { s } , \mathbf { a } ) - V _ { \phi _ { i } ^ { \prime } } ( \mathbf { s } )$ . While it is tempting to use this same update rule here, we observe that this update does not provide the meta-learner with sufficient expressive power to be a universal update procedure for the policy, using universality in the sense used by Finn and Levine (2018). For MAML-based methods to approximate any learning procedure, the inner gradient must not discard information needed to infer the task (Finn and Levine,
|
| 88 |
+
|
| 89 |
+
2018). The gradient of the AWR objective does not contain full information of both the regression weight and the regression target. That is, one cannot recover both the advantage weight and the action from the gradient. We formalize this problem in Theorem 1 in Appendix A. To address this issue and make our meta-learner sufficiently expressive, the MACAW policy update performs both advantage-weighted regression onto actions as well as an additional regression onto action advantages. This enriched policy update is only used during adaptation, and the predicted advantage is used only to enrich the inner loop policy update during meta-training; during meta-test, this predicted advantage is discarded. We prove the universality of the enriched policy update in Theorem 2 in Appendix A. We observe empirically the practical impact of the universality property with an ablation study presented in Figure 4 (left).
|
| 90 |
+
|
| 91 |
+
To make predictions for both the AWR loss and advantage regression, our policy architecture has two output heads corresponding to the predicted action given the state, $\pi _ { \boldsymbol { \theta } } ( \cdot | \mathbf { s } )$ , and the predicted advantage given both state and action $A _ { \boldsymbol { \theta } } ( \mathbf { s } , \mathbf { a } )$ . This architecture is shown in Figure 2. Policy adaptation then proceeds as follows:
|
| 92 |
+
|
| 93 |
+
$$
|
| 94 |
+
\theta _ { i } ^ { \prime } \theta - \alpha _ { 1 } \nabla _ { \theta } \mathcal { L } _ { \pi } ( \theta , \phi _ { i } ^ { \prime } , D _ { i } ^ { \mathrm { t r } } ) , \qquad \mathrm { w h e r e } \qquad \mathcal { L } _ { \pi } = \mathcal { L } ^ { \mathrm { A W R } } + \lambda \mathcal { L } ^ { \mathrm { A D V } } .
|
| 95 |
+
$$
|
| 96 |
+
|
| 97 |
+
In our policy update, we show only one gradient step for conciseness of notation, but it can be easily extended to multiple gradient steps. The AWR loss is given in Equation 1, and the advantage regression loss is given by:
|
| 98 |
+
|
| 99 |
+
$$
|
| 100 |
+
\mathcal { L } ^ { \mathrm { A D V } } ( \theta , \phi _ { i } ^ { \prime } , D ) \triangleq \underset { \mathbf { s } , \mathbf { a } \sim D } { \triangleq } \left[ ( \hat { A } ( \mathbf { s } , \mathbf { a } ) - \left( \mathcal { R } _ { D } ( \mathbf { s } , \mathbf { a } ) - V _ { \phi _ { i } ^ { \prime } } ( \mathbf { s } ) \right) ) ^ { 2 } \right]
|
| 101 |
+
$$
|
| 102 |
+
|
| 103 |
+
Adapting with ${ \mathcal { L } } _ { \pi }$ rather than $\mathcal { L } ^ { \mathrm { A W R } }$ addresses the expressiveness problems noted earlier. This adaptation process is done both in the inner loop of meta-training and during meta-test time, as outlined in Algorithm 2. MACAW is consistent at meta-test time because it executes a well-defined RL fine-tuning subroutine based on AWR during adaptation. Next, we describe the meta-training procedure for learning the meta-parameters $\theta$ and $\phi$ , the initializations of the policy and value function, respectively.
|
| 104 |
+
|
| 105 |
+
# 4.2 OUTER-LOOP MACAW PROCEDURE
|
| 106 |
+
|
| 107 |
+
To enable rapid adaptation at meta-test time, we meta-train a set of initial parameters for both the value function and policy to optimize the AWR losses ${ \mathcal { L } } _ { V }$ and $\mathcal { L } ^ { \mathrm { A W R } }$ , respectively, after adaptation (L9-10 in Algorithm 1). We sample a batch of data $D _ { i } ^ { \mathrm { t s } }$ for the outer loop update that is disjoint from the adaptation data $D _ { i } ^ { \mathrm { t r } }$ in order to promote few-shot generalization rather than memorization of the adaptation data. The meta-learning procedure for the value function follows MAML, using the supervised Monte Carlo objective:
|
| 108 |
+
|
| 109 |
+
$$
|
| 110 |
+
\operatorname* { m i n } _ { \phi } \mathbb { E } _ { T _ { i } } \left[ \mathcal { L } _ { V } ( \phi _ { i } ^ { \prime } , D _ { i } ^ { \mathrm { t s } } ) \right] ~ = ~ \operatorname* { m i n } _ { \phi } \mathbb { E } _ { T _ { i } } \left[ \mathcal { L } _ { V } ( \phi - \eta _ { 1 } \nabla _ { \phi } \mathcal { L } _ { V } ( \phi , D _ { i } ^ { \mathrm { t } } ) , D _ { i } ^ { \mathrm { t s } } ) \right] .
|
| 111 |
+
$$
|
| 112 |
+
|
| 113 |
+
where ${ \mathcal { L } } _ { V }$ is defined in Equation 2. This objective optimizes for a set of initial value function parameters such that one or a few inner gradient steps lead to an accurate value estimator.
|
| 114 |
+
|
| 115 |
+
Unlike the inner loop, we optimize the initial policy parameters in the outer loop with a standard advantage-weighted regression objective, since expressiveness concerns only pertain to the inner loop where only a small number of gradient steps are taken. Hence, the meta-objective for our initial policy parameters is as follows:
|
| 116 |
+
|
| 117 |
+
$$
|
| 118 |
+
\operatorname* { m i n } _ { \theta } \mathbb { E } _ { \mathcal { T } _ { i } } \left[ \mathcal { L } ^ { \mathrm { A W R } } ( \theta _ { i } ^ { \prime } , \phi _ { i } ^ { \prime } , D _ { i } ^ { \mathrm { t s } } ) \right] \ = \ \operatorname* { m i n } _ { \theta } \mathbb { E } _ { \mathcal { T } _ { i } } \left[ \mathcal { L } ^ { \mathrm { A W R } } ( \theta - \alpha _ { 1 } \nabla _ { \theta } \mathcal { L } _ { \pi } ( \theta , \phi _ { i } ^ { \prime } , D _ { i } ^ { \mathrm { t r } } ) , \phi _ { i } ^ { \prime } , D _ { i } ^ { \mathrm { t s } } ) \right] ,
|
| 119 |
+
$$
|
| 120 |
+
|
| 121 |
+
where ${ \mathcal { L } } _ { \pi }$ is defined in Equation 3 and $\mathcal { L } ^ { \mathrm { A W R } }$ is defined in Equation 1. Note we use the adapted value function for policy adaptation. The complete MACAW algorithm is summarized in Algorithm 1.
|
| 122 |
+
|
| 123 |
+
# 4.3 MACAW ARCHITECTURE
|
| 124 |
+
|
| 125 |
+
MACAW’s enriched policy update (Equation 3) is motivated by the desire to make inner loop policy updates more expressive. In addition to augmenting the objective, we can also take an architectural approach to increasing gradient expressiveness. Recall that for an MLP, a single step of gradient descent can only make a rank-1 update to each weight matrix. Finn and Levine (2018) show that this implies that MLPs must be impractically deep for MAML to be able to produce any learning procedure. However, we can shortcut this rank-1 limitation with a relatively simple change to the layers of an MLP, which we call a weight transform layer. This layer maps a latent code into the weight matrix and bias, which are then used to compute the layer’s output just as in a typical fully-connected layer. This ‘layer-wise linear hypernetwork’ (Ha et al., 2016) doesn’t change the class of functions computable by the layer on its input, but it increases the expressivity of MAML’s gradient. Because we update the latent code by gradient descent (which is mapped back into a new weight matrix and bias in the forward pass) we can, in theory, acquire weight matrix updates of rank up to the dimensionality of the latent code. We use this strategy for all of the weights in both the value function network and the policy network. This architecture is similar to latent embedding optimization (LEO) (Rusu et al., 2019), but the choice of using simple linear mapping functions allows us to apply weight transform layers to the entire network while still providing more expressive gradients. For a more detailed explanation of this strategy, see Appendix B. Our experiments find that this layer significantly improves learning speed and stability.
|
| 126 |
+
|
| 127 |
+

|
| 128 |
+
Figure 3: Comparing MACAW with (i) an offline variant of PEARL (Rakelly et al., 2019), a state-of-the-art off-policy meta-RL method, (ii) an offline multi-task training $^ +$ fine tuning method based on AWR (Peng et al., 2019), and (iii) a meta-behavior cloning baseline. Shaded regions show one standard error of the mean reward of four seeds. MACAW is the only algorithm to consistently outperform the imitation learning baseline, and also learns with the fewest number of training steps in every environment (note the log x axis).
|
| 129 |
+
|
| 130 |
+
# 5 EXPERIMENTS
|
| 131 |
+
|
| 132 |
+
The primary goal of our empirical evaluations is to test whether we can acquire priors from offline multi-task data that facilitate rapid transfer to new tasks. Our evaluation compares MACAW with three sensible approaches to this problem: a meta-imitation learning, multi-task offline RL with fine-tuning, and an offline variant of the state-of-the-art off-policy meta-RL method, PEARL (Rakelly et al., 2019). Further, we analyze a) the importance of MACAW’s enriched policy update (Equation 3) in various data quality regimes; b) the effect of the proposed weight transformation; and c) how each method’s performance is affected when the sampling of the task space during training is very sparse. The first two settings highlight the differences between MACAW and the naïve combination of MAML and AWR; the third setting represents a realistic setting where fewer tasks are available during meta-training. See Appendix C for additional experiments a) ablating the weight transform layer b) investigating the performance of MACAW and PEARL when online fine-tuning is available and c) a richer task distribution.
|
| 133 |
+
|
| 134 |
+
For our experiments, we construct offline variants of the widely-used simulated continuous control benchmark problems introduced by Finn et al. (2017a); Rothfuss et al. (2018), including the halfcheetah with varying directions and varying velocities, the walker with varying physical parameters, and the ant with varying directions. If not noted otherwise, the offline data for each experiment is generated from the replay buffer of a RL agent trained from scratch. This reflects a practical scenario where an agent has previously learned a set of tasks via RL, stored its experiences, and now would like to quickly learn a related task. Data collection information is available in Appendix D.
|
| 135 |
+
|
| 136 |
+

|
| 137 |
+
Ablating MACAW's Weight Transform
|
| 138 |
+
|
| 139 |
+

|
| 140 |
+
Test Performance with Sparse Task Sampling
|
| 141 |
+
|
| 142 |
+

|
| 143 |
+
Ablating MACAW's Enriched Policy Update
|
| 144 |
+
Figure 4: Left: Ablating MACAW’s enriched policy update when varying the quality of the inner loop adaptation data. Solid lines correspond to MACAW, dashed lines correspond to MACAW without the auxiliary policy loss (equivalently, MAML $^ +$ AWR with weight transforms). Both perform similarly with good quality adaptation data (orange), but the policy adaptation step without the auxiliary loss begins to fail as adaptation data is increasingly sub-optimal (blue and red). Bad, medium, and good data correspond to the first, middle, and last 500 trajectories from the lifetime replay buffer of the behavior policy for each task; see Appendix D for learning curves of the individual offline policies. Center: Ablating MACAW’s weight transform layer in the same experimental setting as the cheetah-velocity experiment in Figure 3. Without the additional expressiveness, learning is much slower and less stable. Right: Train task sparsity split performance of MACAW, Offline PEARL, and Offline $\mathbf { M T + }$ fine tune. Each curve corresponds to the performance of a method as the number of tasks available for training is varied. MACAW shows the most consistent performance when different numbers of tasks are used, performing well even when only three tasks are used for training.
|
| 145 |
+
|
| 146 |
+
Can we learn to adapt to new tasks quickly from purely offline data? Our first evaluation compares three approaches to the offline meta-RL problem setting, testing their ability to leverage the offline task datasets in order to quickly adapt to a new task. Specifically, we compare MACAW with i) offline PEARL (Rakelly et al., 2019), ii) multi-task AWR (Peng et al., 2019), which uses 20 steps of Adam (Kingma and Ba, 2015) to adapt to a new task at meta-test time (Offline $\mathrm { M T + F T }$ ) and iii) a meta-behavior cloning baseline. We choose PEARL and AWR because they achieve state-of-the-art performance in off-policy meta-RL and offline RL, respectively, and are readily adaptable to the offline meta-RL problem. As in Rakelly et al. (2019), for each experiment, we sample a finite set of training tasks and held out test tasks upfront and keep these fixed throughout training. Figure 3 shows the results. We find that MACAW is the only algorithm to consistently outperform the meta-behavior cloning baseline. Multi-task AWR $^ +$ fine-tuning makes meaningful progress on the simpler cheetah problems, but it is unable to adapt well on the more challenging walker and ant problems. Offline PEARL shows initial progress on cheetah-velocity and walker-params, but struggles to make steady progress on any of the problems. We attribute PEARL’s failure to Q-function extrapolation error, a problem known to affect many off-policy RL algorithms (Fujimoto et al., 2019), as well as generally unstable offline bootstrapping. MACAW’s and AWR’s value function is bootstrap-free and their policy updates maximize a weighted maximum likelihood objective during training, which biases the policy toward safer actions (Peng et al., 2019), implicitly avoiding problems caused by extrapolation error. In contrast to Offline PEARL and multi-task AWR, MACAW trains efficiently and relatively stably on all problems, providing an effective approach to learning representations from multi-task offline data that can be effectively adapted to new tasks at meta-test time.
|
| 147 |
+
|
| 148 |
+
How does MACAW’s performance differ from MAML $^ +$ AWR? MACAW has two key features distinguishing it from MAML $^ +$ AWR: the enriched policy loss and weight transform layers. Here, we use the Cheetah-Velocity setting to test the effects of both of these changes. We first ablate the enriched policy loss used in MACAW’s inner loop update. This experiment compares MACAW and MAML $+ .$ AWR $^ +$ weight transform layers, which optimize Equation 3 and Equation 1 in the policy inner-loop, respectively. To identify when policy update expressiveness is most crucial, we repeat this ablation study three times, meta-training and meta-testing with various qualities of inner-loop data, using good outer loop data for all experiments. Figure 4 (left) shows the results. MAML $^ +$ AWR performs well when the offline adaptation data comes from a near-optimal policy, which is essentially a one-shot imitation setting (orange); however, when the offline adaptation data comes from a policy pre-convergence, the difference between MACAW and MAML $+$ AWR becomes significant (blue and red). This result supports the intuition that policy update expressiveness is of greater importance when the adaptation data is more random, because in this case the adaptation data includes a weaker signal from which to infer the task (e.g. the task cannot be inferred by simply looking at the states visited). Because an agent is unable to collect further experience from the environment during offline adaptation, it is effectively at the mercy of the quality of the behavior policy that produced the data. An important property of a meta-RL algorithm is thus its robustness to sub-optimal behavior policies, a property that MACAW exhibits. Next, we ablate the weight transform layers, comparing
|
| 149 |
+
|
| 150 |
+
MAML $+ .$ AWR $^ +$ enriched policy update with MACAW. Figure 4 (center) suggests that the weight transform layers significantly improve both learning speed and stability. The No WT-Equal Width variant removes the weight transform from each fully-connected layer, replacing it with a regular fully-connected layer of equal width in the forward pass. The No WT-Equal Params variant replaces each of MACAW’s weight transform layers with a regular fully-connected layer of greater width, to keep the total number of learnable parameters in the network roughly constant. In either case, we find that MACAW provides a significant improvement in learning speed, as well as stability when compared to the Equal Width variant. Figure 5 in the appendix shows that this result is consistent across problems.
|
| 151 |
+
|
| 152 |
+
How do algorithms perform with varying numbers of meta-training tasks? Generally, we prefer an offline meta-RL algorithm that can generalize to new tasks when presented with only a small number of meta-training tasks sampled from $p ( \mathcal { T } )$ . In this section, we conduct an experiment to evaluate the extent to which various algorithms rely on dense sampling of the space of tasks during training in order to generalize well. We compare the test performance of MACAW, offline PEARL, and offline multi-task AWR $^ +$ fine-tuning as we hold out an increasingly large percentage of the Cheetah-Velocity task space. The results are presented in Figure 4 (right). Surprisingly, Offline PEARL completely fails to learn both when training tasks are plentiful and when they are scarce, but learns relatively effectively in the middle regime (5-20 tasks). In our experiments, we often observe instability in Offline PEARL’s task inference and value function networks when training on too many offline tasks. On the other hand, with too few tasks, the task inference network simply learns a degenerate solution, providing no useful information for the value functions or policy to identify the task. The multi-task learning $^ +$ fine-tuning baseline exhibits a steadier degradation in performance as training tasks are removed, likely owing to its bootstrap-free learning procedure. Similarly to Offline PEARL, it is not able to learn a useful prior for fine-tuning when only presented with 3 tasks for training. However, MACAW finds a solution of reasonable quality for any sampling of the task space, even for very dense or very sparse samplings of the training tasks. In practice, this property is desirable, because it allows the same algorithm to scale to very large offline datasets while still producing useful adaptation behaviors for small datasets. Ultimately, MACAW effectively exploits the available data when meta-training tasks are plentiful and shows by far the greatest robustness when tasks are scarce, which we attribute to its SGD-based adaptation procedure during both meta-training and meta-testing.
|
| 153 |
+
|
| 154 |
+
# 6 RELATED WORK
|
| 155 |
+
|
| 156 |
+
Meta-learning algorithms enable efficient learning of new tasks by learning elements of the learning process itself (Schmidhuber, 1987; Bengio et al., 1992; Thrun and Pratt, 1998; Finn, 2018). We specifically consider the problem of meta-reinforcement learning. Prior methods for meta-RL can generally be categorized into two groups. Contextual meta-RL methods condition a neural network on experience using a recurrent network (Wang et al., 2016; Duan et al., 2016; Fakoor et al., 2020), a recursive network (Mishra et al., 2017), or a stochastic inference network (Rakelly et al., 2019; Zintgraf et al., 2020; Humplik et al., 2019; Sæmundsson et al., 2018). Optimization-based meta-RL methods embed an optimization procedure such as gradient descent into the meta-level optimization (Finn et al., 2017a; Nagabandi et al., 2019; Rothfuss et al., 2018; Zintgraf et al., 2019; Gupta et al., 2018; Mendonca et al., 2019; Yang et al., 2019), potentially using a learned loss function (Houthooft et al., 2018; Bechtle et al., 2019; Kirsch et al., 2020b;a). In prior works, the former class of approaches tend to reach higher asymptotic performance, while the latter class is typically more robust to out-of-distribution tasks, since the meta-test procedure corresponds to a well-formed optimization. Concurrent work by Dorfman and Tamar (2020) investigates the offline meta-RL setting, directly applying an existing meta-RL algorithm, VariBAD (Zintgraf et al., 2020), to the offline setting. The proposed method further assumes knowledge of the reward function for each task to relabel rewards and share data across tasks with shared dynamics. MACAW does not rely on this knowledge nor the assumption that some tasks share dynamics, but this technique could be readily combined with MACAW when these assumptions do hold.
|
| 157 |
+
|
| 158 |
+
Unlike these prior works, we aim to develop an optimization-based meta-RL algorithm that can both learn from entirely offline data and produces a monotonic learning procedure. Only a handful of previous model-free meta-RL methods leverage off-policy data at all (Rakelly et al., 2019; Mendonca et al., 2019), and none have considered the fully offline setting. Guided meta-policy search (Mendonca et al., 2019) is optimization-based, but is not applicable to the batch setting as it partially relies on policy gradients. This only leaves PEARL (Rakelly et al., 2019) and its relatives (Fakoor et al., 2020), which correspond to a contextual meta-learning approach that is sensitive to the meta-training task distribution without fine-tuning (Fakoor et al., 2020) at test time. We also compare to PEARL, and find that, as expected, it performs worse than in the off-policy setting, since the fully offline setting is substantially more challenging than the off-policy setting that it was designed for.
|
| 159 |
+
|
| 160 |
+
The proposed algorithm builds on the idea of batch off-policy or offline reinforcement learning (Fujimoto et al., 2019; Kumar et al., 2019b; Wu et al., 2019; Levine et al., 2020; Agarwal et al., 2020), extending the problem setting to the meta-learning setting. There are a number of recent works that have demonstrated successful results with offline reinforcement learning and deep neural networks (Fujimoto et al., 2019; Jaques et al., 2019; Kumar et al., 2019a; Wu et al., 2019; Peng et al., 2019; Agarwal et al., 2020). We specifically choose to build upon the advantage-weighted regression (AWR) algorithm (Peng et al., 2019). We find that AWR performs well without requiring dynamic programming, instead using Monte Carlo estimation to infer the value function. This property is appealing, as it is difficult to combine truncated optimization-based meta-learners such as MAML (Finn et al., 2017a) with TD learning, which requires a larger number of gradient steps to effectively back-up values.
|
| 161 |
+
|
| 162 |
+
# 7 CONCLUSION
|
| 163 |
+
|
| 164 |
+
In this work, we formulated the problem of offline meta-reinforcement learning and presented MACAW, a practical algorithm that achieves good performance on various continuous control tasks compared with other state-of-the-art meta-RL algorithms. We motivated the design of MACAW by the desire to build an offline meta-RL algorithm that is both sample-efficient (using value-based RL subroutines) and consistent (running a full-fledged RL algorithm at test time). We hope that this work serves as the basis for future research in offline meta-RL, enabling more sample-efficient learning algorithms to make better use of purely observational data from previous tasks and adapt to new tasks more quickly.
|
| 165 |
+
|
| 166 |
+
We consider fully offline meta-training and meta-testing with and without online fine-tuning, showing that MACAW is effective both when collecting online data is totally infeasible as well as when some online data collection is possible at meta-test time. However, an interesting direction for future work is to consider how we might enable online adaptation from purely offline meta-training while preserving the consistency property of MACAW. This would require an offline strategy for learning to explore, a problem that has largely been considered in on-policy settings in the past (Gupta et al., 2018; Zintgraf et al., 2020) but also recently in offline settings (Dorfman and Tamar, 2020).
|
| 167 |
+
|
| 168 |
+
# REFERENCES
|
| 169 |
+
|
| 170 |
+
Rishabh Agarwal, Dale Schuurmans, and Mohammad Norouzi. An optimistic perspective on offline reinforcement learning. In International Conference on Machine Learning, 2020.
|
| 171 |
+
|
| 172 |
+
Sarah Bechtle, Artem Molchanov, Yevgen Chebotar, Edward Grefenstette, Ludovic Righetti, Gaurav Sukhatme, and Franziska Meier. Meta-learning via learned loss. arXiv preprint arXiv:1906.05374, 2019.
|
| 173 |
+
|
| 174 |
+
Samy Bengio, Yoshua Bengio, Jocelyn Cloutier, and Jan Gecsei. On the optimization of a synaptic learning rule. In Preprints Conf. Optimality in Artificial and Biological Neural Networks, volume 2. Univ. of Texas, 1992.
|
| 175 |
+
|
| 176 |
+
Tristan Deleu, Tobias Würfl, Mandana Samiei, Joseph Paul Cohen, and Yoshua Bengio. Torchmeta: A Meta-Learning library for PyTorch, 2019. URL https://arxiv.org/abs/1909.06576. Available at: https://github.com/tristandeleu/pytorch-meta.
|
| 177 |
+
|
| 178 |
+
Ron Dorfman and Aviv Tamar. Offline meta reinforcement learning. arXiv preprint arXiv:2008.02598, 2020.
|
| 179 |
+
|
| 180 |
+
Yan Duan, John Schulman, Xi Chen, Peter L Bartlett, Ilya Sutskever, and Pieter Abbeel. Rl2: Fast reinforcement learning via slow reinforcement learning. arXiv preprint arXiv:1611.02779, 2016.
|
| 181 |
+
|
| 182 |
+
Rasool Fakoor, Pratik Chaudhari, Stefano Soatto, and Alexander J. Smola. Meta-q-learning. In International Conference on Learning Representations, 2020.
|
| 183 |
+
|
| 184 |
+
Chelsea Finn and Sergey Levine. Meta-learning and universality: Deep representations and gradient descent can approximate any learning algorithm. International Conference on Learning Representations, 10 2018.
|
| 185 |
+
|
| 186 |
+
Chelsea Finn, Pieter Abbeel, and Sergey Levine. Model-agnostic meta-learning for fast adaptation of deep networks. In International Conference on Machine Learning, 2017a.
|
| 187 |
+
|
| 188 |
+
Chelsea Finn, Tianhe Yu, Tianhao Zhang, Pieter Abbeel, and Sergey Levine. One-shot visual imitation learning via meta-learning. CoRL, abs/1709.04905, 2017b. URL http://arxiv.org/abs/ 1709.04905.
|
| 189 |
+
|
| 190 |
+
Chelsea B Finn. Learning to Learn with Gradients. University of California, Berkeley, 2018.
|
| 191 |
+
|
| 192 |
+
Scott Fujimoto, Herke Hoof, and David Meger. Addressing function approximation error in actorcritic methods. In International Conference on Machine Learning, pages 1582–1591, 2018.
|
| 193 |
+
|
| 194 |
+
Scott Fujimoto, David Meger, and Doina Precup. Off-policy deep reinforcement learning without exploration. In Kamalika Chaudhuri and Ruslan Salakhutdinov, editors, Proceedings of the 36th International Conference on Machine Learning, volume 97 of Proceedings of Machine Learning Research, pages 2052–2062, Long Beach, California, USA, 09–15 Jun 2019. PMLR. URL http://proceedings.mlr.press/v97/fujimoto19a.html.
|
| 195 |
+
|
| 196 |
+
Abhishek Gupta, Russell Mendonca, YuXuan Liu, Pieter Abbeel, and Sergey Levine. Metareinforcement learning of structured exploration strategies. In Advances in Neural Information Processing Systems, pages 5302–5311, 2018.
|
| 197 |
+
|
| 198 |
+
David Ha, Andrew Dai, and Quoc V. Le. Hypernetworks, 2016.
|
| 199 |
+
|
| 200 |
+
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 arXiv:1801.01290, 2018.
|
| 201 |
+
|
| 202 |
+
Rein Houthooft, Yuhua Chen, Phillip Isola, Bradly Stadie, Filip Wolski, OpenAI Jonathan Ho, and Pieter Abbeel. Evolved policy gradients. In Advances in Neural Information Processing Systems, pages 5400–5409, 2018.
|
| 203 |
+
|
| 204 |
+
Jan Humplik, Alexandre Galashov, Leonard Hasenclever, Pedro A Ortega, Yee Whye Teh, and Nicolas Heess. Meta reinforcement learning as task inference. arXiv preprint arXiv:1905.06424, 2019.
|
| 205 |
+
|
| 206 |
+
Natasha Jaques, Asma Ghandeharioun, Judy Hanwen Shen, Craig Ferguson, Agata Lapedriza, Noah Jones, Shixiang Gu, and Rosalind Picard. Way off-policy batch deep reinforcement learning of implicit human preferences in dialog. arXiv preprint arXiv:1907.00456, 2019.
|
| 207 |
+
|
| 208 |
+
Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In Yoshua Bengio and Yann LeCun, editors, 3rd International Conference on Learning Representations, ICLR 2015, San Diego, CA, USA, May 7-9, 2015, Conference Track Proceedings, 2015. URL http://arxiv.org/abs/1412.6980.
|
| 209 |
+
|
| 210 |
+
Louis Kirsch, Sjoerd van Steenkiste, and Juergen Schmidhuber. Improving generalization in meta reinforcement learning using learned objectives. In International Conference on Learning Representations, 2020a. URL https://openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } }$ S1evHerYPr.
|
| 211 |
+
|
| 212 |
+
Louis Kirsch, Sjoerd van Steenkiste, and Jurgen Schmidhuber. Improving generalization in metareinforcement learning using learned objectives. ICLR, 2020b.
|
| 213 |
+
|
| 214 |
+
Aviral Kumar, Justin Fu, Matthew Soh, George Tucker, and Sergey Levine. Stabilizing off-policy q-learning via bootstrapping error reduction. In Advances in Neural Information Processing Systems, pages 11761–11771, 2019a.
|
| 215 |
+
|
| 216 |
+
Aviral Kumar, Justin Fu, George Tucker, and Sergey Levine. Stabilizing off-policy q-learning via bootstrapping error reduction. NeurIPS, 2019b. URL http://arxiv.org/abs/1906. 00949.
|
| 217 |
+
|
| 218 |
+
B. M. Lake, R. Salakhutdinov, and J. B. Tenenbaum. Human-level concept learning through probabilistic program induction. Science, 350(6266):1332–1338, December 2015. doi: 10.1126/science. aab3050. URL https://doi.org/10.1126/science.aab3050.
|
| 219 |
+
|
| 220 |
+
Sergey Levine, Aviral Kumar, George Tucker, and Justin Fu. Offline reinforcement learning: Tutorial, review, and perspectives on open problems. arXiv preprint arXiv:2005.01643, 2020.
|
| 221 |
+
|
| 222 |
+
Russell Mendonca, Abhishek Gupta, Rosen Kralev, Pieter Abbeel, Sergey Levine, and Chelsea Finn. Guided meta-policy search. In Advances in Neural Information Processing Systems, pages 9653–9664, 2019.
|
| 223 |
+
|
| 224 |
+
Nikhil Mishra, Mostafa Rohaninejad, Xi Chen, and Pieter Abbeel. Meta-learning with temporal convolutions. arXiv:1707.03141, 2017.
|
| 225 |
+
|
| 226 |
+
Anusha Nagabandi, Ignasi Clavera, Simin Liu, Ronald S Fearing, Pieter Abbeel, Sergey Levine, and Chelsea Finn. Learning to adapt in dynamic, real-world environments through meta-reinforcement learning. International Conference on Learning Representations (ICLR), 2019.
|
| 227 |
+
|
| 228 |
+
Ashvin Nair, Murtaza Dalal, Abhishek Gupta, and Sergey Levine. Accelerating online reinforcement learning with offline datasets, 2020.
|
| 229 |
+
|
| 230 |
+
Xue Bin Peng, Aviral Kumar, Grace Zhang, and Sergey Levine. Advantage-weighted regression: Simple and scalable off-policy reinforcement learning, 2019.
|
| 231 |
+
|
| 232 |
+
Jan Peters and Stefan Schaal. Reinforcement learning by reward-weighted regression for operational space control. In Proceedings of the 24th International Conference on Machine Learning, ICML ’07, page 745–750, New York, NY, USA, 2007. Association for Computing Machinery. ISBN 9781595937933. doi: 10.1145/1273496.1273590. URL https: //doi.org/10.1145/1273496.1273590.
|
| 233 |
+
|
| 234 |
+
Aravind Rajeswaran, Chelsea Finn, Sham M Kakade, and Sergey Levine. Meta-learning with implicit gradients. In Advances in Neural Information Processing Systems, pages 113–124, 2019.
|
| 235 |
+
|
| 236 |
+
Kate Rakelly, Aurick Zhou, Deirdre Quillen, Chelsea Finn, and Sergey Levine. Efficient off-policy meta-reinforcement learning via probabilistic context variables. In International Conference on Machine Learning, 2019.
|
| 237 |
+
|
| 238 |
+
Jonas Rothfuss, Dennis Lee, Ignasi Clavera, Tamim Asfour, and Pieter Abbeel. Promp: Proximal meta-policy search. arXiv preprint arXiv:1810.06784, 2018.
|
| 239 |
+
|
| 240 |
+
Andrei A. Rusu, Dushyant Rao, Jakub Sygnowski, Oriol Vinyals, Razvan Pascanu, Simon Osindero, and Raia Hadsell. Meta-learning with latent embedding optimization. In International Conference on Learning Representations, 2019. URL https://openreview.net/forum?id= BJgklhAcK7.
|
| 241 |
+
|
| 242 |
+
Steindór Sæmundsson, Katja Hofmann, and Marc Peter Deisenroth. Meta reinforcement learning with latent variable gaussian processes. arXiv preprint arXiv:1803.07551, 2018.
|
| 243 |
+
|
| 244 |
+
Jurgen Schmidhuber. Evolutionary principles in self-referential learning. On learning how to learn: The meta-meta-... hook.) Diploma thesis, Institut f. Informatik, Tech. Univ. Munich, 1:2, 1987.
|
| 245 |
+
|
| 246 |
+
Sebastian Thrun and Lorien Pratt. Learning to learn: Introduction and overview. In Learning to learn, pages 3–17. Springer, 1998.
|
| 247 |
+
|
| 248 |
+
Oriol Vinyals, Charles Blundell, Timothy Lillicrap, koray kavukcuoglu, and Daan Wierstra. Matching networks for one shot learning. In D. Lee, M. Sugiyama, U. Luxburg, I. Guyon, and R. Garnett, editors, Advances in Neural Information Processing Systems, volume 29, pages 3630–3638. Curran Associates, Inc., 2016. URL https://proceedings.neurips.cc/paper/2016/ file/90e1357833654983612fb05e3ec9148c-Paper.pdf.
|
| 249 |
+
|
| 250 |
+
Jane X Wang, Zeb Kurth-Nelson, Dhruva Tirumala, Hubert Soyer, Joel Z Leibo, Remi Munos, Charles Blundell, Dharshan Kumaran, and Matt Botvinick. Learning to reinforcement learn. arXiv preprint arXiv:1611.05763, 2016.
|
| 251 |
+
|
| 252 |
+
Yifan Wu, George Tucker, and Ofir Nachum. Behavior regularized offline reinforcement learning. arXiv preprint arXiv:1911.11361, 2019.
|
| 253 |
+
|
| 254 |
+
Yuhuai Wu, Mengye Ren, Renjie Liao, and Roger Grosse. Understanding short-horizon bias in stochastic meta-optimization. arXiv preprint arXiv:1803.02021, 2018.
|
| 255 |
+
|
| 256 |
+
Yuxiang Yang, Ken Caluwaerts, Atil Iscen, Jie Tan, and Chelsea Finn. Norml: No-reward meta learning. In Proceedings of the 18th International Conference on Autonomous Agents and MultiAgent Systems, pages 323–331. International Foundation for Autonomous Agents and Multiagent Systems, 2019.
|
| 257 |
+
|
| 258 |
+
Tianhe Yu, Deirdre Quillen, Zhanpeng He, Ryan Julian, Karol Hausman, Chelsea Finn, and Sergey Levine. Meta-world: A benchmark and evaluation for multi-task and meta reinforcement learning. In Conference on Robot Learning, 2019.
|
| 259 |
+
|
| 260 |
+
Luisa Zintgraf, Kyriacos Shiarlis, Maximilian Igl, Sebastian Schulze, Yarin Gal, Katja Hofmann, and Shimon Whiteson. Varibad: A very good method for bayes-adaptive deep rl via meta-learning. In International Conference on Learning Representations, 2020.
|
| 261 |
+
|
| 262 |
+
Luisa M Zintgraf, Kyriacos Shiarlis, Vitaly Kurin, Katja Hofmann, and Shimon Whiteson. Fast context adaptation via meta-learning. In International Conference on Machine Learning, 2019.
|
| 263 |
+
|
| 264 |
+
# Appendix
|
| 265 |
+
|
| 266 |
+
# A MACAW AUXILIARY LOSS AND UPDATE EXPRESSIVENESS
|
| 267 |
+
|
| 268 |
+
Finn and Levine (2018) lay out conditions under which the MAML update procedure is universal, in the sense that it can approximate any function $f ( \mathbf { x } , \mathbf { y } , \mathbf { x } ^ { * } )$ arbitrarily well (given enough capacity), where $\mathbf { x }$ and y are the support set inputs and labels, respectively, and $\mathbf { x } ^ { * }$ is the test input. Universality in this sense is an attractive property because it implies that the update is expressive enough to approximate any update procedure; a method that does not possess the universality property might be limited in its asymptotic post-adaptation performance because it cannot express (or closely approximate) the true optimal update procedure. In order for the MAML update procedure to be universal, several requirements of the network architecture, hyperparameters, and loss function must be satisfied. Most of these are not method-specific in that they stipulate minimum network depth, activation functions, and non-zero learning rate for any neural network. However, the condition placed on the loss function require more careful treatment. The requirement is described in Definition 1.
|
| 269 |
+
|
| 270 |
+
Definition 1. A loss function is ‘universal’ if the gradient of the loss with respect to the prediction(s) is an invertible function of the label(s) used to compute the loss.
|
| 271 |
+
|
| 272 |
+
We note that Definition 1 is a necessary but not sufficient condition for an update procedure to be universal (see other conditions above and Finn and Levine (2018)). For the AWR loss function (copied below from Equation 1 with minor changes), the labels are the ground truth action a and the corresponding advantage $\mathcal { R } ( \mathbf { s } , \mathbf { a } ) - V _ { \phi _ { i } ^ { \prime } } ( \mathbf { s } )$ .
|
| 273 |
+
|
| 274 |
+
$$
|
| 275 |
+
\mathcal { L } ^ { \mathrm { A W R } } ( \mathbf { s } , \mathbf { a } , \theta , \phi _ { i } ^ { \prime } ) = - \log \pi _ { \theta } ( \mathbf { a } | \mathbf { s } ) \exp \left( \frac { 1 } { T } \left( \mathcal { R } ( \mathbf { s } , \mathbf { a } ) - V _ { \phi _ { i } ^ { \prime } } ( \mathbf { s } ) \right) \right)
|
| 276 |
+
$$
|
| 277 |
+
|
| 278 |
+
For simplicity and without loss of generality (see Finn and Levine (2018), Sections 4 & 5), we will consider the loss for only a single sample, rather than averaged over a batch.
|
| 279 |
+
|
| 280 |
+
In the remainder of this section, we first state in Theorem 1 that the standard AWR policy loss function does not satisfy the condition for universality described in Definition 1. The proof is by a simple counterexample. Next, we state in Theorem 2 that the MACAW auxiliary loss does satisfy the universality condition, enabling a universal update procedure given the other generic universality conditions are satisfied (note that the MACAW value function loss satisfies the condition in Definition 1 because it uses L2 regression Finn and Levine (2018)).
|
| 281 |
+
|
| 282 |
+
# A.1 NON-UNIVERSALITY OF STANDARD AWR POLICY LOSS FUNCTION
|
| 283 |
+
|
| 284 |
+
Intuitively, the AWR gradient does not satisfy the invertibility condition because it does not distinguish between a small error in the predicted action that has a large corresponding advantage weight and a large error in the predicted action (in the same direction) that has a small corresponding advantage weight. The following theorem formalizes this statement.
|
| 285 |
+
|
| 286 |
+
Theorem 1. The AWR loss function $\mathcal { L } ^ { A W R }$ is not universal according to Definition 1.
|
| 287 |
+
|
| 288 |
+
The proof is by counterexample; we will show that there exist different sets of labels $\{ \mathbf { a } _ { 1 } , A _ { 1 } ( \mathbf { s } , \mathbf { a } _ { 1 } ) \}$ and $\{ \mathbf { a } _ { 2 } , A _ { 2 } ( \mathbf { s } , \mathbf { a } _ { 1 } ) \}$ that produce the same gradient for some output of the model. First, rewriting Equation 7 with $A ( \mathbf { s } , \mathbf { a } ) = \left( \mathcal { R } ( \mathbf { s } , \mathbf { a } ) - V _ { \phi _ { i } ^ { \prime } } ( \mathbf { s } ) \right)$ , we have
|
| 289 |
+
|
| 290 |
+
$$
|
| 291 |
+
{ \mathcal { L } } ^ { \mathrm { A W R } } ( \mathbf { s } , \mathbf { a } , \theta ) = - \log \pi _ { \theta } ( \mathbf { a } | \mathbf { s } ) \exp \left( { \frac { A ( \mathbf { s } , \mathbf { a } ) } { T } } \right)
|
| 292 |
+
$$
|
| 293 |
+
|
| 294 |
+
Because our policy is parameterized as a Gaussian with fixed diagonal covariance $\sigma ^ { 2 } I$ , we can again rewrite this loss as
|
| 295 |
+
|
| 296 |
+
$$
|
| 297 |
+
\mathcal { L } ^ { \mathrm { A W R } } ( \mathbf { s } , \mathbf { a } , \hat { \mathbf { a } } _ { \mu } ) = \left( \log \frac { 1 } { ( 2 \pi \sigma ^ { 2 } ) ^ { \frac { k } { 2 } } } + \frac { | | \mathbf { a } - \hat { \mathbf { a } } _ { \mu } | | ^ { 2 } } { 2 \sigma ^ { 2 } } \right) \exp \left( \frac { A ( \mathbf { s } , \mathbf { a } ) } { T } \right)
|
| 298 |
+
$$
|
| 299 |
+
|
| 300 |
+
where $\hat { \mathbf { a } } _ { \mu }$ is the mean of the Gaussian output by the policy and $k = \dim ( \mathbf { a } )$ . For the purpose of the simplicity of the counterexample, we assume the policy output $\hat { \mathbf { a } } _ { \mu }$ is 0. The gradient of this loss with respect to the policy output is
|
| 301 |
+
|
| 302 |
+
$$
|
| 303 |
+
\nabla _ { \hat { \mathbf { a } } _ { \mu } } { \mathcal { L } } ^ { \mathrm { A W R } } ( \mathbf { s } , \mathbf { a } , \mathbf { 0 } ) = - { \frac { 1 } { \sigma ^ { 2 } } } \exp \left( { \frac { A ( \mathbf { s } , \mathbf { a } ) } { T } } \right) \mathbf { a }
|
| 304 |
+
$$
|
| 305 |
+
|
| 306 |
+
To demonstrate that the gradient operator applied to this loss function is not invertible, we pick two distinct label values and show that they give the same gradient. We pick $\mathbf { a } _ { 1 } = [ 1 , . . . , 1 ] ^ { T }$ , $A _ { 1 } ( \mathbf { s } , \mathbf { a } _ { 1 } ) =$ $T$ and $\mathbf { a } _ { 2 } = [ 0 . 1 , . . . , 0 . 1 ] ^ { T }$ , $A _ { 2 } ( \mathbf { s } , \mathbf { a } _ { 2 } ) \stackrel { - } { = } \log ( 1 0 ) T$ . Inserting these values into Equation A.1, this gives gradients $\begin{array} { r } { g _ { 1 } ~ = ~ \frac { - e } { \sigma ^ { 2 } } [ 1 , . . . , 1 ] ^ { T } } \end{array}$ and $\begin{array} { r } { g _ { 2 } ^ { \sim } = \frac { - 1 0 e } { \sigma ^ { 2 } } [ 0 . 1 , . . . , 0 . 1 ] ^ { T } = \frac { - e } { \sigma ^ { 2 } } [ 1 , . . . , 1 ] ^ { T } = g _ { 1 } } \end{array}$ . Thus the gradient of the standard AWR loss does not possess sufficient information to recover the labels uniquely and using this loss for policy adaptation does not produce a universal policy update procedure. Next, we show how the auxiliary loss used in MACAW alleviates this problem.
|
| 307 |
+
|
| 308 |
+
# A.2 UNIVERSALITY OF THE MACAW POLICY ADAPTATION LOSS FUNCTION
|
| 309 |
+
|
| 310 |
+
In this section, we show that by adding an additional term to the AWR loss function, we acquire a loss that satisfies the condition stated in Definition 1, which we state in Theorem 2. Intuitively, the additional loss term allows the gradient to distinguish between the cases that were problematic for the AWR loss (large action error and small advantage weight vs small action error and large advantage weight).
|
| 311 |
+
|
| 312 |
+
Theorem 2. The MACAW policy loss function ${ \mathcal { L } } _ { \pi }$ is universal according to Definition 1.
|
| 313 |
+
|
| 314 |
+
The MACAW policy adaptation loss (given in Equation 3) is the sum of the AWR loss and an auxiliary advantage regression loss (the following is adapted from Equation 8):
|
| 315 |
+
|
| 316 |
+
$$
|
| 317 |
+
\mathcal { L } _ { \pi } ( \mathbf { s } , \mathbf { a } , \hat { \mathbf { a } } _ { \mu } , \hat { A } ) = \left( \log \frac { 1 } { ( 2 \pi \sigma ^ { 2 } ) ^ { \frac { k } { 2 } } } + \frac { \| \mathbf { a } - \hat { \mathbf { a } } _ { \mu } \| ^ { 2 } } { 2 \sigma ^ { 2 } } \right) \exp \left( \frac { A ( \mathbf { s } , \mathbf { a } ) } { T } \right) + \lambda ( A ( \mathbf { s } , \mathbf { a } ) - \hat { A } ) ^ { 2 }
|
| 318 |
+
$$
|
| 319 |
+
|
| 320 |
+
where $\hat { A }$ is the predicted advantage output from the policy advantage head and $\lambda$ is the advantage regression coefficient. The gradient of this loss with respect to the predicted advantage $\hat { A }$ is
|
| 321 |
+
|
| 322 |
+
$$
|
| 323 |
+
g _ { \mathrm { A D V } } = \nabla _ { \hat { A } } \mathcal { L } _ { \pi } ( \mathbf { s } , \mathbf { a } , \hat { \mathbf { a } } _ { \mu } , \hat { A } ) = 2 \lambda ( \hat { A } - A ( \mathbf { s } , \mathbf { a } ) )
|
| 324 |
+
$$
|
| 325 |
+
|
| 326 |
+
and the gradient of the loss with respect to $\hat { \mathbf { a } } _ { \mu }$ is
|
| 327 |
+
|
| 328 |
+
$$
|
| 329 |
+
\mathbf { g } _ { \mathrm { A W R } } = \nabla _ { \hat { \mathbf { a } } _ { \mu } } \mathcal { L } _ { \pi } ( \mathbf { s } , \mathbf { a } , \hat { \mathbf { a } } _ { \mu } , \hat { A } ) = \frac { 1 } { \sigma ^ { 2 } } \exp \left( \frac { A ( \mathbf { s } , \mathbf { a } ) } { T } \right) ( \hat { \mathbf { a } } _ { \mu } - \mathbf { a } )
|
| 330 |
+
$$
|
| 331 |
+
|
| 332 |
+
We write the combined gradient as $\mathbf { g } = \left[ \mathbf { \mathcal { G } } _ { \mathrm { A W R } } \right]$ . In order to provide a universal update procedure, we must be able to recover both the action label a and the advantage label $A ( \mathbf { s } , \mathbf { a } )$ from g. First, because $g _ { \mathrm { A D V } }$ is an invertible function of $A ( \mathbf { s } , \mathbf { a } )$ , we can directly extract the advantage label by re-arranging Equation 9:
|
| 333 |
+
|
| 334 |
+
$$
|
| 335 |
+
A ( \mathbf { s } , \mathbf { a } ) = \frac { g _ { \mathrm { A D V } } - 2 \lambda \hat { A } } { - 2 \lambda }
|
| 336 |
+
$$
|
| 337 |
+
|
| 338 |
+
Similarly, gAWR is an invertible function of a, so we can then extract the action label by re-arranging Equation 10:
|
| 339 |
+
|
| 340 |
+
$$
|
| 341 |
+
\mathbf { a } = { \frac { \mathbf { g } _ { \mathrm { A W R } } - { \frac { 1 } { \sigma ^ { 2 } } } \exp \left( { \frac { A ( \mathbf { s } , \mathbf { a } ) } { T } } \right) \hat { \mathbf { a } } _ { \mu } } { - { \frac { 1 } { \sigma ^ { 2 } } } \exp \left( { \frac { A ( \mathbf { s } , \mathbf { a } ) } { T } } \right) } }
|
| 342 |
+
$$
|
| 343 |
+
|
| 344 |
+
Because we can compute $A ( \mathbf { s } , \mathbf { a } )$ from $g _ { \mathrm { A D V } }$ , there are no unknowns in the RHS of Equation 11 and we can compute a (here, $\sigma , \lambda$ , and $T$ are known constants); it is thus the additional information provided by $g _ { \mathrm { A D V } }$ that resolves the ambiguity that is problematic for the standard AWR policy loss gradient. We have now shown that both the action label and advantage label used in the MACAW policy adaptation loss are recoverable from its gradient, implying that the update procedure is universal under the conditions given by Finn and Levine (2018), which concludes the proof.
|
| 345 |
+
|
| 346 |
+
# B WEIGHT TRANSFORM LAYERS
|
| 347 |
+
|
| 348 |
+
Here, we describe in detail the ‘weight transformation’ layer that augments the expressiveness of the MAML update in MACAW. First, we start with the observation in past work (Finn et al., 2017b) that adding a ‘bias transformation’ to each layer improves the expressiveness of the MAML update.
|
| 349 |
+
|
| 350 |
+
To understand the bias transform, we compare with a typical fully-connected layer, which has the forward pass
|
| 351 |
+
|
| 352 |
+
$$
|
| 353 |
+
\mathbf { y } = \sigma \left( W \mathbf { x } + \mathbf { b } \right)
|
| 354 |
+
$$
|
| 355 |
+
|
| 356 |
+
where $\mathbf { x }$ is the previous layer’s activations, $\mathbf { b }$ is the bias vector, $W$ is the weight matrix, and $\mathbf { y }$ is this layer’s activations. For a bias transformation layer, the forward pass is
|
| 357 |
+
|
| 358 |
+
$$
|
| 359 |
+
\mathbf { y } = \sigma \left( W \mathbf { x } + W ^ { b } \mathbf { z } \right)
|
| 360 |
+
$$
|
| 361 |
+
|
| 362 |
+
where $\mathbf { z }$ and $W ^ { b }$ are learnable parameters of the bias transformation. During adaptation, either only the vector $\mathbf { z }$ or both the vector $\mathbf { z }$ and the bias matrix $W ^ { b }$ are adapted. The vector $\mathbf { \bar { \boldsymbol { W } } } ^ { b } \mathbf { z }$ has the same dimensionality as the bias in the previous equation. This formulation does not increase the expressive power of the forward pass of the layer, but it does allow for a more expressive update of the ‘bias vector’ $W ^ { b } \mathbf { z }$ (in the case of $\dim ( \mathbf { z } ) = \dim ( \mathbf { b } )$ and $W ^ { b } = I$ , we recover the standard fully-connected layer).
|
| 363 |
+
|
| 364 |
+
For a weight transformation layer (used in MACAW), we extend the idea of computing the bias from a latent vector to the weight matrix itself. We now present the forward pass for a weight transformation layer layer with $d$ input and $d$ output dimensions and latent dimension $c$ . First, we compute $w =$ $W ^ { \mathrm { w t } } \mathbf { z }$ , where $W ^ { \mathrm { w t } } \in \mathbf { \mathbb { R } } ^ { ( d ^ { 2 } + d ) \times c }$ . The first $d ^ { 2 }$ components of $w$ are reshaped into the $d \times d$ weight matrix of the layer $W ^ { * }$ , and the last $d$ components are used as the bias vector $b ^ { * }$ . The forward pass is then the same as a regular fully-connected layer, but using the computed matrix and bias $W ^ { * }$ and $b ^ { * }$ instead of a fixed matrix and bias vector; that is $y = \bar { \sigma } ( W ^ { * } \mathbf { x } + \mathbf { \bar { b } } ^ { * } )$ . During adaptation, both the latent vector $\mathbf { z }$ and the transform matrix $W ^ { \mathrm { w t } }$ are adapted. We note that adapting $\mathbf { z }$ enables the post-adaptation weight matrix used in the forward pass, $W ^ { * ^ { \prime } }$ , to differ from the pre-adaptation weight matrix $W ^ { * }$ by a matrix of rank up to the dimension of $\mathbf { z }$ , whereas gradient descent with normal layers makes rank-1 updates to weight matrices. We hypothesize it is this added expressivity that makes the weight transform layer effective. A comparison of MACAW with and without weight transformation layers can be found in Figures 4-center and 6.
|
| 365 |
+
|
| 366 |
+
# C ADDITIONAL EXPERIMENTS AND ABLATIONS
|
| 367 |
+
|
| 368 |
+
# C.1 WEIGHT TRANSFORM ABLATION STUDY
|
| 369 |
+
|
| 370 |
+
In addition to the results shown in Figure 4 (center), we include an ablation of the weight transform here for all tasks. Figure 5 shows these results. We find that across environments, the weight transform plays a significant role in increasing training speed, stability, and even final performance. On the relatively simple cheetah direction benchmark, it does not affect the quality of the final meta-trained agent, but it does improve the speed and stability of training. On the other three (more difficult) tasks, we see a much more noticeable affect in terms of both training stability as well as final performance.
|
| 371 |
+
|
| 372 |
+
Additionally, we investigate the effect of the weight transform in a few-shot image classification setting. We use the 20-way 1-shot Omniglot digit classification setup (Lake et al., 2015), specifically the train/val split used by (Vinyals et al., 2016) as implemented by Deleu et al. (2019). We compare three MLP models, all with 4 hidden layers:
|
| 373 |
+
|
| 374 |
+
1. An MLP with weight transform layers of 128 hidden units and a latent layer dimension of 32 (4,866,048 parameters; Weight Transform in Figure 6).
|
| 375 |
+
2. An MLP without weight transform layers, with 128 hidden units (152,596 parameters; No WT-Equal Width in Figure 6)
|
| 376 |
+
3. An MLP without weight transform layers, with 1150 hidden units (4,896,720 parameters; No WT-Equal Params in Figure 6)
|
| 377 |
+
|
| 378 |
+
We find that the model with weight transform layers shows the best combination of fast convergence and good asymptotic performance compared with baselines with regular fully-connected layers. No WT-Equal Width has the same number of hidden units as the weight transform model (128), which means the model has fewer parameters in total (because the weight transform layers include a larger weight matrix). The No WT-Equal Params baseline uses wider hidden layers to equalize the number of parameters in the entire model with the Weight Transform model. Somewhat surprisingly, the smaller baseline model (Equal Width) outperforms the larger baseline model (Equal Params).
|
| 379 |
+
|
| 380 |
+

|
| 381 |
+
Figure 5: Ablating the weight transformation in MACAW on the MuJoCo benchmark environments. All networks have the same number of hidden units. Although MACAW is able to learn with regular fully-connected layers, the weight transformation significantly improves performance on all tasks that require adaptation to unseen tasks.
|
| 382 |
+
|
| 383 |
+
When using MAML-style meta-learners, it is important to consider that adding parameters to the model affects the expressiveness of both the forward computation of the model and the updates computable with a finite number of steps of gradient descent.
|
| 384 |
+
|
| 385 |
+
Generally, increasing the number of parameters in the model should improve the model’s ability to fit the training set (because the inner loop of MAML is more expressive), which we observe here. Increasing the expressiveness of the inner loop of MAML can also speed convergence, which we also observe in Figure 6. However, by simply adding neurons to a typical MLP, the post-adaptation model tends to overfit the training set more, as we see in Figure 6. On the other hand, adding parameters through weight transformation layers increases expressiveness of the adaptation step by enabling weight updates with rank greater than 1 without changing the expressiveness of the forward computation of the model.
|
| 386 |
+
|
| 387 |
+

|
| 388 |
+
Figure 6: Faster convergence provided by the weight transform layer (orange) on Omniglot 20- way 1-shot image classification (Lake et al., 2015).
|
| 389 |
+
|
| 390 |
+
# C.2 ONLINE FINE-TUNING FOROUT-OF-DISTRIBUTION TEST TASKS
|
| 391 |
+
|
| 392 |
+
In some cases, it may be necessary or desirable to perform online fine-tuning after the initial offline adaptation step. This is the fully offline meta-RL problem with online fine-tuning described in Section 3, where an algorithm is given a small amount of initial adaptation data from the test task, just as in the fully offline setting, and then is able to interact with the environment to collect additional training data and perform on-policy updates. This ability to continually improve with additional training after the initial offline adaptation step is what makes a consistent meta-reinforcement learner advantageous.
|
| 393 |
+
|
| 394 |
+
This hybrid setting (offline training with additional online fine-tuning) is known to be extremely challenging in traditional reinforcement learning. These difficulties are clearly documented by recent work (Nair et al., 2020). In short, this setting is challenging in traditional RL because while offline pre-training might produce a policy that performs well, online fine-tuning often leads to a significant drop in initial performance, which can take a very long time to recover from (see Nair et al. (2020)).
|
| 395 |
+
|
| 396 |
+
<table><tr><td rowspan="2">Additional Env. Steps</td><td colspan="2">Offline PEARL+FT</td><td colspan="2">MACAW</td></tr><tr><td>Reward</td><td>Improvement</td><td>Reward</td><td>Improvement</td></tr><tr><td>0</td><td>-553.4 (21.2)</td><td>一</td><td>-323.1 (42.9)</td><td></td></tr><tr><td>20k</td><td>-565.0 (4.7)</td><td>-11.5 (3.5)</td><td>-279.1 (16.8)</td><td>44.0 (14.5)</td></tr><tr><td>200k</td><td>-533.6 (19.8)</td><td>19.8 (3.7)</td><td>-272.0 (15.2)</td><td>51.1 (12.7)</td></tr></table>
|
| 397 |
+
|
| 398 |
+
Table 1: Absolute reward as well as improvement (in terms of reward) of Offline PEARL $+ \mathrm { F T }$ and MACAW after 0, 20k, and $2 0 0 \mathrm { k }$ additional environment steps are gathered and used for online fine tuning. Standard errors of the mean over the 13 test tasks are reported in parentheses. Averages are taken over 10 rollouts of each policy. We find that MACAW achieves both better out-of-distribution performance before online training as well as faster improvement during online fine-tuning. Note that Offline PEARL $+ \mathrm { F T }$ experiences an initial drop in average performance on the test task after $2 0 \mathrm { k }$ steps, compared with the performance of the policy conditioned only on the initial batch of offline data. A similar effect has been reported in recent work in offline RL (Nair et al., 2020).
|
| 399 |
+
|
| 400 |
+
In many cases, online fine-tuning can take a very long time to recover the performance of the offlineonly policy, if it does so at all. In offline meta-RL, we have a similar challenge; an offline meta-RL algorithm must not only meta-train for good performance on a single batch of offline test data, but it must also learn a set of parameters that enables fine-tuning to make productive updates to its policy and/or value function without completely destroying the meta-learned knowledge about the task distribution.
|
| 401 |
+
|
| 402 |
+
In this section, we use a hybrid setting as described above to evaluate not only MACAW’s consistency (its ability to continue to improve after an initial offline adaptation step), but its ability to continue to improve even when the test task distribution differs from the train distribution. Because significant distribution shift means that some train tasks are irrelevant, or even detrimental to test performance, this setting is very difficult. In order to make a meaningful comparison, we compare with an "Offline PEARL $^ +$ fine-tuning" (Offline PEARL ${ \bf \Phi } + \mathrm { F T }$ ) algorithm, which is also technically consistent (because it essentially performs the SAC algorithm on the test task after the initial task inference step). However, we hypothesize that MACAW will have an advantage over this Offline PEARL $+ \mathrm { F T }$ algorithm because while both algorithms are consistent, MACAW explicitly trains for good fine-tunability with gradient descent, unlike task inference-based meta-RL algorithms.
|
| 403 |
+
|
| 404 |
+
The training procedure for Offline PEARL+FT is the same at the regular Offline PEARL training procedure. However, at test time, after receiving an initial small batch of offline data for task inference, we alternative between performing rollouts of the task-conditioned policy to collect additional data from the test task and perform gradient descent on the PEARL policy and value function objectives with this off-policy data. Similarly, for MACAW test time involves first using the small batch of offline test task data to take an initial gradient step on the value and policy loss functions (Eqns 2 and 3), then alternating between rolling out the adapted policy and taking more steps of gradient descent on the MACAW losses.
|
| 405 |
+
|
| 406 |
+
The specific experimental setup is as follows. We partition the individual tasks in the Cheetah-Vel problem such that training tasks correspond to target velocities in the range [0,2] and test tasks correspond to target velocities in the range [2,3]. After meta-training, for each test task, we provide the algorithm with a small batch of offline data for adaptation just as in the fully offline setting. However, we allow the algorithm to then collect and train on up to $2 0 0 \mathrm { k }$ additional interactions from the environment. Both algorithms alternate between sampling a single trajectory (200 environment interactions) and performing 100 steps of gradient descent on the aggregate buffer of data for the test task, which contains both the initial offline batch of data as well as all online data collected so far. We evaluate both algorithms on their performance after $2 0 \mathrm { k }$ and $2 0 0 \mathrm { k }$ additional interactions with the environment. The results of this experiment are reported in Table 1. We observe that MACAW achieves both higher absolute reward on the OOD test tasks as well as faster relative improvement over the offline-only adapted policy compared to the Offline PEARL+FT baseline.
|
| 407 |
+
|
| 408 |
+
# C.3 METAWORLD ML45 BENCHMARK
|
| 409 |
+
|
| 410 |
+
As an additional experiment, we test the training and generalization capabilities of MACAW on a much broader distribution of tasks, and where test tasks differ significantly from training tasks (e.g. picking up an object as opposed to opening a window or hammering a nail). Recently,
|
| 411 |
+
|
| 412 |
+

|
| 413 |
+
Figure 7: Average success rates of MACAW, PEARL, and $\mathrm { M T } +$ fine-tuning (with 20 fine-tuning steps) on the 5 test tasks the Meta-World ML45 suite of continuous control tasks. Dashed line shows final PEARL average success rate after $1 0 \mathrm { m }$ training steps.
|
| 414 |
+
|
| 415 |
+
Yu et al. (2019) proposed the Meta-World (Yu et al., 2019) suite of continuous control benchmark environments as a more realistic distribution of tasks for multi-task and meta-learning algorithms. This benchmark includes 45 meta-training tasks and 5 meta-testing tasks. The results of this experiment are summarized in Figure 7.
|
| 416 |
+
|
| 417 |
+
We find that all methods are able to make meaningful progress on the test tasks, with gradient-based methods (MACAW and MT $^ +$ fine tune) learning much more quickly than PEARL. MACAW does achieve a quite high level of performance quite early on in training; however, it begins to overfit with further training. In the regime where periodic online evaluations are available for the purpose of early stopping, we could avoid this issue, in which case MACAW would slightly underperform the multi-task learning baseline. A possible reason for some inconsistency between the performance of each algorithm on Meta-World and the results reported in Figure 3 is the difficult scaling of the rewards in the current version of the Meta-World benchmark. Rewards can vary by 5 orders of magnitude, from negative values to values on the order of 100,000. This has been documented to adversely impact training performance even in single-task RL and increase hyperparameter sensitivity (see https://github.com/rlworkgroup/metaworld/issues/226). Because of the problems stemming from the current reward functions in Meta-World, the maintainers of the benchmark are updating them for the next version of the benchmark, which has not been released as of November 2020.
|
| 418 |
+
|
| 419 |
+
# D EXPERIMENTAL SET-UP AND DATA COLLECTION
|
| 420 |
+
|
| 421 |
+
D.1 OVERVIEW OF PROBLEM SETTINGS
|
| 422 |
+
|
| 423 |
+
The problems of interest include:
|
| 424 |
+
|
| 425 |
+
1. Half-Cheetah Direction Train a simple cheetah to run in one of two direction: forward and backward. Thus, there are no held-out test tasks for this problem, making it more ‘proof of concept’ than benchmark.
|
| 426 |
+
2. Half-Cheetah Velocity Train a cheetah to run at a desired velocity, which fully parameterizes each task. For our main experiment, values of the task parameters are sampled from a uniform interval of 40 velocities in the range [0, 3]. A subset of 5 target velocities is sampled randomly for evaluation. For ablation experiments
|
| 427 |
+
3. Ant-2D Direction Train a simulated ant with 8 articulated joints to run in a random 2D direction. For our experiments, we sample 50 random directions uniformly, holding out 5 for testing.
|
| 428 |
+
4. Walker-2D Params Train a simulated agent to move forward, where different tasks correspond to different randomized dynamics parameters rather than reward functions. For our experiments, we sample 50 random sets of dynamics parameters, holding out 5 for testing.
|
| 429 |
+
5. Meta-World ML45 Train a simulated Sawyer robot to complete 45 different robotics manipulation tasks (for training). 5 additional tasks are included for testing, making 50 tasks in total. Tasks include opening a window, hammering a nail, pulling a lever, picking & placing
|
| 430 |
+
|
| 431 |
+
Table 2: Hyperparameters used for the PEARL experiments. For the MuJoCo tasks, we generally used the same parameters as reported in (Rakelly et al., 2019), with some minor modifications. The different parameters used for the MetaWorld ML45 environment are reported above.
|
| 432 |
+
|
| 433 |
+
<table><tr><td>Parameter</td><td>Standard Configuration</td><td>Meta-World</td></tr><tr><td>Optimizer</td><td>Adam</td><td>一</td></tr><tr><td>Meta batch size</td><td>4-10</td><td>16</td></tr><tr><td>Batch size</td><td>256</td><td>1</td></tr><tr><td>Embedding batch size</td><td>100-256</td><td>750</td></tr><tr><td>KL penalty</td><td>0.1</td><td>、</td></tr><tr><td>Hidden layers</td><td>3</td><td>1</td></tr><tr><td>Neurons per hidden layer</td><td>300</td><td>512</td></tr><tr><td>Latent space size</td><td>5</td><td>8</td></tr><tr><td>Policy learning rate</td><td>3e-4</td><td>1</td></tr><tr><td>Value function learning rate</td><td>3e-4</td><td></td></tr><tr><td>Context embedding learning rate</td><td>3e-4</td><td></td></tr><tr><td>Q-Function learning rate</td><td>3e-4</td><td></td></tr><tr><td>Reward scale</td><td>5.0</td><td></td></tr><tr><td>Recurrent</td><td>False</td><td></td></tr></table>
|
| 434 |
+
|
| 435 |
+
an object. See Yu et al. (2019) for more information. Our experiments use a continuous space randomization for each task setup, unlike the experiments in (Yu et al., 2019), which sample from a fixed number of task states. This creates a much more challenging environment, as seen in the success rate curves above.
|
| 436 |
+
|
| 437 |
+
For the first 4 MuJoCo domains, each trajectory is 200 time steps (as in Rakelly et al. (2019)); for Meta-World, trajectories are 150 time steps long.
|
| 438 |
+
|
| 439 |
+
# D.2 DATA COLLECTION
|
| 440 |
+
|
| 441 |
+
We adapt each task to the offline setting by restricting the data sampling procedure to sample data only from a fixed offline buffer of data. For each task, we train a separate policy from scratch, using Soft Actor-Critic (Haarnoja et al., 2018) for all tasks except Cheetah-Velocity, for which we use TD3 (Fujimoto et al., 2018) as it proved more stable across the various Cheetah-Velocity tasks. We save complete replay buffers from the entire lifetime of training for each task, which includes 5M steps for Meta-World, 2.5M steps for Cheetah-Velocity, 2.5M steps for Cheetah-Dir, 2M steps for Ant-Direction, and 1M steps for Walker-Params. We use these buffers of trajectories, one per task for each problem, to sample data in both the inner and outer loop of the algorithm during training. See Figures 8 and 9 for the learning curves of the offline policies for each train and test task.
|
| 442 |
+
|
| 443 |
+
# D.3 ABLATION EXPERIMENTS
|
| 444 |
+
|
| 445 |
+
For the data quality experiment, we compare the post-adaptation performance when MACAW is trained with 3 different sampling regimes for the Cheetah-Vel problem setting. Bad, medium, and good data quality mean that adaptation data (during both training and evaluation) is drawn from the first, middle, and last 500 trajectories from the offline replay buffers. For the task quantity experiment, we order the tasks by the target velocity in ascending order, giving equally spaced tasks with target velocities $g _ { 0 } = 0 . 0 7 5$ , $g _ { 2 } = 0 . 1 5 , . . . , g _ { 3 9 } = 3 . 0$ . For the 20 task experiment, we use $g _ { i }$ with even $i$ for training and odd $i$ for testing. For the 10 task experiment, we move every other train task to the test set (e.g. tasks $i = 2 , 6 , 1 0 , . . . )$ . For the 5 task experiment, we move every other remaining train task to the test set (e.g. tasks $i = 4 , 1 2 , 2 0 , . . . )$ , and for the 3 task experiment, we again move every other task to the test set, so that the train set only contains tasks 0, 16, and 32. Task selection was performed this way to ensure that even in sparse task environments, the train tasks provide coverage of most of the task space.
|
| 446 |
+
|
| 447 |
+
# E IMPLEMENTATION DETAILS AND HYPERPARAMETERS
|
| 448 |
+
|
| 449 |
+
Peng et al. (2019) note several strategies used to increase the stability of their advantage-weighted regression implementation. We normalize the advantage logits in the policy update step to have zero mean and unit standard deviation, as in Peng et al. (2019). Advantage weight logits are also clipped
|
| 450 |
+
|
| 451 |
+

|
| 452 |
+
Figure 8: Learning curves for offline policies for the 4 different MuJoCo environments used in the experimental evaluations. Each curve corresponds to a policy trained on a unique task. Various levels of smoothing are applied for the purpose of easier visualization.
|
| 453 |
+
|
| 454 |
+

|
| 455 |
+
Figure 9: Learning curves and success rates for all tasks in the MetaWorld 45 benchmark. Each curve corresponds to a policy trained on a unique task. Various levels of smoothing are applied for the purpose of plotting.
|
| 456 |
+
|
| 457 |
+
Table 3: Hyperparameters used for the multi-task learning $^ +$ fine tuning baseline. \*For the Walker environment, the value learning rate was 1e-5 for stability.
|
| 458 |
+
|
| 459 |
+
<table><tr><td>Parameter</td><td>Standard Configuration</td><td>Meta-World</td></tr><tr><td>Optimizer</td><td>Adam</td><td>一</td></tr><tr><td>Value learning rate</td><td>1e-4*</td><td>1e-6</td></tr><tr><td>Policy learning rate</td><td>1e-4</td><td>1</td></tr><tr><td>Value fine-tuning learning rate</td><td>1e-4</td><td>1e-6</td></tr><tr><td>Policy fine-tuning learning rate</td><td>1e-3</td><td>1</td></tr><tr><td>Train outer loop batch size</td><td>256</td><td>一</td></tr><tr><td>Fine-tuning batch size</td><td>256</td><td>1</td></tr><tr><td>Number of hidden layers</td><td>3</td><td>1</td></tr><tr><td>Neurons per hidden layer</td><td>100</td><td>300</td></tr><tr><td>Task batch size</td><td>5</td><td>1</td></tr><tr><td>Max advantage clip</td><td>20</td><td>一</td></tr></table>
|
| 460 |
+
|
| 461 |
+
<table><tr><td>Parameter</td><td>Standard Configuration</td><td>Meta-World</td></tr><tr><td>Optimizer</td><td>Adam</td><td>一</td></tr><tr><td>Auxiliary advantage loss coefficient</td><td>1e-2</td><td>1e-3</td></tr><tr><td>Outer value learning rate</td><td>1e-5</td><td>1e-6</td></tr><tr><td>Outer policy learning rate</td><td>1e-4</td><td></td></tr><tr><td>Inner policy learning rate</td><td>1e-3 (learned)</td><td>1e-2 (learned)</td></tr><tr><td>Inner value learning rate</td><td>1e-3 (learned)</td><td>1e-4 (learned)</td></tr><tr><td>Train outer loop batch size</td><td>256</td><td>1</td></tr><tr><td>Train adaptation batch size</td><td>256</td><td>256</td></tr><tr><td>Eval adaptation batch size</td><td>256</td><td>1</td></tr><tr><td>Number of adaptation steps</td><td>1</td><td>1</td></tr><tr><td>Learning rate for learnable learning rate</td><td>1e-3</td><td>1</td></tr><tr><td>Number of hidden layers</td><td>3</td><td>1</td></tr><tr><td>Neurons per hidden layer</td><td>100</td><td>300</td></tr><tr><td>Task batch size</td><td>5</td><td>10</td></tr><tr><td>Max advantage clip</td><td>20</td><td>1</td></tr><tr><td>AWR policy temperature</td><td>1</td><td>1</td></tr></table>
|
| 462 |
+
|
| 463 |
+
Table 4: Hyperparameters used for MACAW. The Standard Configuration is used for all experiments and all environments except for Meta-World (due to the extreme difference in magnitude of rewards in Meta-World, which has typical rewards $1 0 0 { - } 1 0 0 0 \mathrm { x }$ larger than in the other tasks). For the Meta-World configuration, only parameters that differ from the standard configuration are listed.
|
| 464 |
+
|
| 465 |
+
to avoid exploding gradients and numerical overflow. To train the value function, we use simple least squares regression onto Monte Carlo returns, rather than $\mathrm { T D } ( \lambda )$ . Finally, our policy is parameterized by a single Gaussian with fixed variance of 0.04; our policy network thus predicts only the mean of the Gaussian distribution.
|
| 466 |
+
|
| 467 |
+
In addition to using weight transformation layers instead of regular fully-connected layers, we also learn learning rates for each layer of our network by gradient descent. To speed up training, we compute our loss using a ‘task minibatch’ of 5 tasks at each step of optimization, rather than using all of the training tasks. Finally, specific to the RL setting, we sample experiences in contiguous chunks from the replay buffers during train-time adaptation and uniformly (non-contiguously) from the replay buffers for outer-loop updates and test-time adaptation. For outer loop updates, we sample data selectively towards the end of the replay buffers.
|
| 468 |
+
|
| 469 |
+
# E.1 HYPERPARAMETERS
|
| 470 |
+
|
| 471 |
+
Tables 2, 3, and 4 describe the hyperparameters used for each algorithm in our empirical evaluations. We performed some manual tuning of hyperparameters for all algorithms, but found that the performance was not significantly affected for environments other than Meta-World, likely due to the difficult reward scaling in the current release of Meta-World.
|
md/train/SQxuiYf2TT/SQxuiYf2TT.md
ADDED
|
@@ -0,0 +1,296 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# History Aware Multimodal Transformer for Vision-and-Language Navigation
|
| 2 |
+
|
| 3 |
+
Shizhe Chen, Pierre-Louis Guhur, Cordelia Schmid, Ivan Laptev
|
| 4 |
+
|
| 5 |
+
Inria, École normale supérieure, CNRS, PSL Research University {shizhe.chen, pierre-louis.guhur, cordelia.schmid, ivan.laptev}@inria.fr
|
| 6 |
+
|
| 7 |
+
https://cshizhe.github.io/projects/vln_hamt.html
|
| 8 |
+
|
| 9 |
+
# Abstract
|
| 10 |
+
|
| 11 |
+
Vision-and-language navigation (VLN) aims to build autonomous visual agents that follow instructions and navigate in real scenes. To remember previously visited locations and actions taken, most approaches to VLN implement memory using recurrent states. Instead, we introduce a History Aware Multimodal Transformer (HAMT) to incorporate a long-horizon history into multimodal decision making. HAMT efficiently encodes all the past panoramic observations via a hierarchical vision transformer (ViT), which first encodes individual images with ViT, then models spatial relation between images in a panoramic observation and finally takes into account temporal relation between panoramas in the history. It, then, jointly combines text, history and current observation to predict the next action. We first train HAMT end-to-end using several proxy tasks including single step action prediction and spatial relation prediction, and then use reinforcement learning to further improve the navigation policy. HAMT achieves new state of the art on a broad range of VLN tasks, including VLN with fine-grained instructions (R2R, RxR), high-level instructions (R2R-Last, REVERIE), dialogs (CVDN) as well as long-horizon VLN (R4R, R2R-Back). We demonstrate HAMT to be particularly effective for navigation tasks with longer trajectories.
|
| 12 |
+
|
| 13 |
+
# 1 Introduction
|
| 14 |
+
|
| 15 |
+
Vision-and-language navigation (VLN) has recently received growing attention [1, 2, 3, 4, 5]. VLN requires an agent to understand natural language instructions, perceive the visual world, and perform navigation actions to arrive at a target location. A number of datasets have been proposed to support various VLN tasks such as indoor and outdoor navigation with fine-grained instructions [2, 6, 7], language-driven remote object finding [8] and navigation in dialogs [9].
|
| 16 |
+
|
| 17 |
+
VLN agents are faced with several challenges. First, as opposed to static vision-text grounding [10], the agent continuously receives new visual observations and should align them with instructions. Most of existing works adopt recurrent neural networks (RNNs) [6, 11, 12, 13, 14, 15, 16] to encode historical observations and actions within a fixed-size state vector to predict the next action. Such condensed states might be sub-optimal for capturing essential information in extended trajectories [17]. For instance, “bring the spoon to me” requires the agent to remember its start location after navigating to the “spoon”, while early memories are prone to fade in the recurrent state. Few endeavors [18, 19] construct external map-like memories for received observations. Nevertheless, these approaches still rely on RNNs to track the navigation state. As the history plays an important role in environment understanding and instruction grounding, we propose to explicitly encode the history as a sequence of previous actions and observations instead of using recurrent states.
|
| 18 |
+
|
| 19 |
+

|
| 20 |
+
Figure 1: The architecture of History Aware Multimodal Tranformer (HAMT). HAMT jointly encodes textual instruction, full history of previous observations and actions, and current observation to predict the next action.
|
| 21 |
+
|
| 22 |
+
Another VLN challenge concerns the generalizations of agents to new environments that have not been observed during training [4]. One direction is to learn more generic text-image representations. The PRESS model [20] improves language representation with a pretrained BERT encoder [21], and PREVALENT [22] uses pairs of instruction and single-step observations to pretrain a multimodal transformer. Though achieved promising results, these works do not optimize visual representation for the target navigation task. Moreover, lack of history in training [22] makes it hard to learn cross-modal alignment and increases the risk of overfitting to training environments. Another direction towards better generalization is to overcome exposure bias [23] due to discrepancy between training and inference. Different methods have been adopted for VLN including DAgger [6, 24] and scheduled sampling [20, 25]. Reinforcement Learning (RL) [12, 26] is one of the most effective approach among them, but it is considered unstable to directly train large-scale transformers via RL [27].
|
| 23 |
+
|
| 24 |
+
To address the above challenges, we propose the History Aware Multimodal Transformer (HAMT), a fully transformer-based architecture for multimodal decision making in VLN tasks. As illustrated in Figure 1, HAMT consists of unimodal transformers for text, history and observation encoding, and a cross-modal transformer to capture long-range dependencies of the history sequence, current observation and instruction. Since our history contains a sequence of all previous observations, its encoding is computationally expensive. To resolve complexity issues, we propose a hierarchical vision transformer as shown in Figure 2, which progressively learns representations for a single view, spatial relationships among views within a panorama and, finally, the temporal dynamics across panoramas of the history. In order to learn better visual representations, we propose auxiliary proxy tasks for end-to-end training. Such tasks include single-step action prediction based on imitation learning, self-supervised spatial relationship reasoning, masked language and image predictions and instructiontrajectory matching. We empirically show that our training facilitates the subsequent fine-tuning of our model with RL [28]. We carry out extensive experiments on various VLN tasks, including VLN with fine-grained instructions (R2R [6] and RxR [7]), high-level instructions (REVERIE [8] and our proposed R2R-Last), dialogs [9] as well as long-horizon VLN (R4R [3] and our proposed R2R-Back which requires the agent to return back after arriving at the target location). HAMT outperforms state of the art on both seen and unseen environments in all the tasks.
|
| 25 |
+
|
| 26 |
+
We summarize our contributions as follows: (1) We introduce HAMT to efficiently model longhorizon history of observed panoramas and actions via hierarchical vision transformer; (2) We train HAMT with auxiliary proxy tasks in an end-to-end fashion and use RL to improve the navigation policy; (3) We validate our method and outperform state of the art in a diverse range of VLN tasks, while demonstrating larger gains for long-horizon navigation.
|
| 27 |
+
|
| 28 |
+
# 2 Related work
|
| 29 |
+
|
| 30 |
+
Vision-and-language navigation. Training instruction-following navigation agents has attracted increasing research attention [1, 2, 6, 7, 8, 29]. Anderson et al. [6] propose a sequence-to-sequence
|
| 31 |
+
|
| 32 |
+

|
| 33 |
+
(a) Hierarchical vision transformer for history encoding.(a) Hierarchical history encoding. It first encodes individual view imagesViT, then models the spatial relation between images in each panorama, and finally capture the temporal relation between panoramas in the history. ViT, then models the spatial relation between images in each panorama, and finally capture the (c) with ViT, then models the spatial relation between images in each panorama,temporal relation between panoramas in the history. co and finally captures the temporal relation between panoramas in the history. po
|
| 34 |
+
(c) Temporal-only history encoonly considers temporal relation of only considers temporal relation of Temporal-only history enagent’s oriented images in the history.ding. It only considers temral relation of oriented views.
|
| 35 |
+
|
| 36 |
+
Figure 2: A comparison of history encoding methods. Circle nodes in different colors denote view images of panorama at different steps. Darker circle nodes are the oriented view of the agent.
|
| 37 |
+
|
| 38 |
+
LSTM baseline for the VLN task. Fried et al. [11] extend it with panoramic action space and synthesized instructions. To improve cross-modal alignment, the self-monitoring agent [13] proposes co-grounding and progress estimation, and RelGraph [15] uses graphs to model relationships across scene, objects and directions. Reinforcement learning (RL) is typically used to improve navigation policy. The EnvDrop model [12] mixes imitation learning and A3C [28]. The RCM [14] utilizes intrinsic reward of cross-modal matching in REINFORCE algorithm. Wang et al. [30] propose to learn rewards via soft expert distillation. Due to the success of transformer [31], recent works explore transformer architectures in VLN. PRESS [20] replaces LSTM instruction encoder with pretrained BERT [21]. SIA [16] uses transformer for single-step multimodal fusion and LSTM for sequential action prediction. PTA [32] is a transformer VLN model using CNNs to extract visual features [33]. Here we propose the first full transformer architecture for VLN and train it end-to-end.
|
| 39 |
+
|
| 40 |
+
Memory-based policy for navigation. LSTMs [34] have been the dominant approach to encode memories for navigation [6, 11, 12, 14]. Condensing all history into one feature vector, however, is prone to the loss of information. Alternative approaches include topological map memory structures [35, 36]. Deng et al. [18] use graphs to capture environment layout and enable long-term planing. A similar graph is adopted in [19] with frontier-exploration based decision making. But these works still utilize LSTMs for state tracking. To exploit long-term spatio-temporal dependencies, Fang et al. [17] store histories in a sequence encoded with transformer. Recurrent VLN-BERT [5] injects a recurrent unit to encode histories in transformer for VLN. The most similar work to ours is Episodic Transformer (E.T.) [37]. Differently from [37], we propose a hierarchical encoding of the panoramic observation history and optimize the whole model in end-to-end training.
|
| 41 |
+
|
| 42 |
+
Multimodal pretraining with transformers. Recent works show significant progress in vision and language tasks using multimodal pretraining. In particular, transformer architectures such as one-stream [38, 39] and dual-stream [40, 41] achieve state of the art for a number of downstream tasks including visual question answering, image-text retrieval and image captioning. While most previous methods rely on CNN to extract image representations, ViLT [42] adopts Vision Transformer (ViT) [43] and trains it with associated texts in an end-to-end manner thanks to the efficiency of ViT. A few endeavors [22, 44] explore multimodal pretraining for VLN. PREVALENT [22] pretrains a transformer using instructions and single-step observations without referring to trajectory history. VLN-BERT [44] measures the compatibility between an instruction and images in a path but does not support action prediction. Our work presents the first end-to-end trainable VLN transformer that jointly encodes text, history and observation, and is able to sequentially predict actions.
|
| 43 |
+
|
| 44 |
+
# 3 Method
|
| 45 |
+
|
| 46 |
+
Problem definition The VLN problem [6] is formulated as a partially observable Markov decision process, where future observations are independent of the past conditioning on current state $s _ { t }$ . Given an instruction $\mathcal { W }$ containing a sequence of $L$ words $( w _ { 1 } , w _ { 2 } , \cdot \cdot \cdot , w _ { L } )$ , an agent should follow the instruction to move in a connectivity graph to reach the goal location. At each step $t$ , the agent receives an observation ${ \mathcal { O } } _ { t }$ , a panorama of its surrounding environment. The ${ \mathcal { O } } _ { t }$ consists of $K$ single view images split from the panorama $\mathcal { O } _ { t } \triangleq \left( [ v _ { 1 } ^ { o } ; a _ { 1 } ^ { o } ] , \cdot \cdot \cdot , [ v _ { K } ^ { o } ; a _ { K } ^ { o } ] \right)$ , where $v _ { i } ^ { o }$ is the visual feature of the $i$ -th view and $a _ { i } ^ { o }$ denotes the relative angle to face the view (subscript $t$ is omitted for simplicity). There are $n$ navigable viewpoints among all the $K$ views1, denoted as $\mathcal { O } _ { t } ^ { c } \triangleq \left( [ v _ { 1 } ^ { c } ; a _ { 1 } ^ { c } ] , \cdot \cdot \cdot , [ v _ { n } ^ { c } ; a _ { n } ^ { c } ] \right)$ We follow the setup in [11] and use ${ \mathcal { O } } _ { t } ^ { c }$ as the decision space, so the agent only needs to select a candidate in ${ \mathcal { O } } _ { t } ^ { c }$ at each step. All observations $\mathcal { O } _ { i }$ and performed actions $a _ { i } ^ { h }$ before step $t$ form the history $\mathcal { H } _ { t } \triangleq \left( [ \mathscr { O } _ { 1 } ; a _ { 1 } ^ { h } ] , \cdots , [ \mathscr { O } _ { t - 1 } ; a _ { t - 1 } ^ { h } ] \right)$ , where $a _ { i } ^ { h }$ denotes the turned angles at step $i$ . The goal is to learn a policy $\pi$ parametrized by $\Theta$ to predict the next action based on the instruction, history and the current observation, which is $\bar { \pi } ( a _ { t } | \mathcal { W } , \mathcal { H } _ { t } , \mathcal { O } _ { t } , \mathcal { O } _ { t } ^ { c } ; \Theta )$ .
|
| 47 |
+
|
| 48 |
+
Unlike dominant recurrent approaches to condense $\mathcal { H } _ { t }$ into a fixed-size vector, in this section, we present the History Aware Multimodal Transformer (HAMT) that jointly encodes text, long-horizon history, and observation for sequential action prediction. The model architecture is described in Section 3.1. We propose end-to-end training for HAMT in Section 3.2 to learn unimodal and multimodal representations, and then use RL to fine-tune the navigation policy in Section 3.3.
|
| 49 |
+
|
| 50 |
+
# 3.1 HAMT: History Aware Multimodal Transformer
|
| 51 |
+
|
| 52 |
+
Figure 1 illustrates the model architecture of HAMT. The inputs text $\mathcal { W }$ , history $\mathcal { H } _ { t }$ and observation ${ \mathcal { O } } _ { t }$ are first encoded via the corresponding unimodal transformers respectively, and then fed into the cross-modal transformer encoder to capture multimodal relationships.
|
| 53 |
+
|
| 54 |
+
Text Encoding. For each token $i$ in the instruction $\mathcal { W }$ , we embed it as the summation of its word embedding $w _ { i }$ , position embedding $E _ { i } ^ { P }$ and type embedding of text $E _ { 0 } ^ { T }$ . Then we employ a transformer with $N _ { L }$ layers to obtain contextual representation $x _ { i }$ following the standard BERT [21].
|
| 55 |
+
|
| 56 |
+
Observation Encoding. For each view $[ v _ { i } ^ { o } ; a _ { i } ^ { o } ]$ in the panoramic observation ${ \mathcal { O } } _ { t }$ , we first represent the relative angle $a _ { i } ^ { o }$ as $E _ { a _ { i } ^ { o } } ^ { A } = ( \sin \theta _ { i } , \cos \theta _ { i } , \sin \phi _ { i } , \cos \phi _ { i } )$ where $\theta _ { i }$ and $\phi _ { i }$ are the relative heading and elevation angle to the agent’s orientation. Then the observation embedding $o _ { i }$ is as follows:
|
| 57 |
+
|
| 58 |
+
$$
|
| 59 |
+
o _ { i } = \mathrm { L N } ( W _ { v } ^ { o } v _ { i } ^ { o } ) + \mathrm { L N } ( W _ { a } ^ { o } E _ { a _ { i } ^ { o } } ^ { A } ) + E _ { o _ { i } } ^ { N } + E _ { 1 } ^ { T }
|
| 60 |
+
$$
|
| 61 |
+
|
| 62 |
+
where $W _ { v } ^ { o } , W _ { a } ^ { o }$ are learnable weights. The $E _ { o _ { i } } ^ { N }$ denotes the navigable embedding to differentiate types of views, with $E _ { 0 } ^ { N }$ for non-navigable view, $E _ { 1 } ^ { N }$ for navigable view and $E _ { 2 } ^ { N }$ for stop view (we append a stop token in observation to support stop action). The $E _ { 1 } ^ { T }$ is the type embedding of observation. We omit bias terms for simplicity. The LN denotes layer normalization [45]. Because $a _ { i } ^ { o }$ has much lower feature dimensions than $v _ { i } ^ { o }$ , we apply LN to balance the encoded $a _ { i } ^ { o }$ and $v _ { i } ^ { o }$ .
|
| 63 |
+
|
| 64 |
+
Hierarchical History Encoding. As $\mathcal { H } _ { t }$ consists of all the past panoramic observations $\mathcal { O } _ { i }$ and performed actions $a _ { i } ^ { h }$ before step $t .$ , it is important to encode $\mathcal { H } _ { t }$ efficiently as context. Figures 2b-2c depict the flattened and temporal-only history encoding approaches used in VLN-BERT [44] and E.T. [37] respectively. The flattened approach treats each view image in $\mathcal { O } _ { i }$ as a token, so the history sequence contains $t K$ tokens. Though it enables to learn relationships among all image views, the computation cost quadratically increases with the sequence length, making it inefficient for long-horizon tasks. In the temporal-only approach, only the oriented view of the agent in each $\mathcal { O } _ { i }$ is taken as inputs instead of the whole panorama, so only $t$ temporal tokens are encoded. However, this approach can lose critical information in past observations. For example, in the instruction “with the windows on your left, walk through the large room past the sitting areas”, the object “window” does not appear in the oriented view of the agent. Therefore, the encoded history is insufficient to tell whether the agent passed the window or not, making the model confused to take the next action.
|
| 65 |
+
|
| 66 |
+
In order to balance computational efficiency and information integrity, we propose a hierarchical history encoding approach as illustrated in Figure 2a. It hierarchically encodes view images within each panorama and then temporal relationships across panoramas, similar to the factorized spatialtemporal video transformer [46]. For each $\mathcal { O } _ { i }$ , its constituent view images are first embeded via ViT and Eq (1), and then encoded via a panoramic transformer with $N _ { h }$ layers to learn spatial relationships within the panorama. We apply average pooling to obtain panorama embedding, and add it with the oriented view image feature in residual connection. The parameters in ViT and panoramic transformer are shared for different steps. In this way, each historical observation $\mathcal { O } _ { i }$ is represented as $v _ { i } ^ { h }$ , and the final temporal token $h _ { i }$ is computed as:
|
| 67 |
+
|
| 68 |
+
Table 1: Comparison of HAMT and previous VLN transformers.
|
| 69 |
+
|
| 70 |
+
<table><tr><td rowspan="2">Models</td><td colspan="4">Inputs</td><td colspan="4">Proxy Tasks</td></tr><tr><td>Text</td><td>History</td><td>Observation</td><td>MLM</td><td>MRM</td><td>ITM</td><td>SAP/SAR</td><td>SPREL</td></tr><tr><td>PREVALENT [22]</td><td>√</td><td></td><td>√</td><td>√</td><td></td><td></td><td>√</td><td></td></tr><tr><td>VLN-BERT [44]</td><td>√</td><td></td><td></td><td>√</td><td>√</td><td>√</td><td></td><td></td></tr><tr><td>HAMT (Ours)</td><td>√</td><td>√</td><td>√</td><td>√</td><td>√</td><td></td><td>√</td><td>√</td></tr></table>
|
| 71 |
+
|
| 72 |
+
$$
|
| 73 |
+
h _ { i } = \mathrm { L N } ( W _ { v } ^ { h } v _ { i } ^ { h } ) + \mathrm { L N } ( W _ { a } ^ { h } E _ { a _ { i } ^ { h } } ^ { A } ) + E _ { i } ^ { S } + E _ { 2 } ^ { T }
|
| 74 |
+
$$
|
| 75 |
+
|
| 76 |
+
where $E _ { i } ^ { S }$ denotes the $i$ -th step embedding, $E _ { 2 } ^ { T }$ is the type embedding of history. The computational cost is $\dot { O ( t K ^ { 2 } + t ^ { 2 } ) }$ , which significantly reduces from $\bar { O ( } t ^ { 2 } K ^ { 2 } )$ in the flattened approach. To be noted, we add a special token $\boldsymbol { \left[ c \mathbf { 1 s } \right] }$ to the start of the history sequence to obtain a global representation. The embedding of [cls] is a parameter to learn, which is initialized from a zero vector.
|
| 77 |
+
|
| 78 |
+
Cross-modal Encoding. We concatenate history and observation as the vision modality, and use cross-modal transformer with $N _ { x }$ layers to fuse features from text, history and observation as shown in the right of Figure 1. The reason of using such dual-stream architecture rather than onestream is that the length of different modalities can be highly imbalanced, and the dual-stream architecture can balance the importance of intra- and inter-modal relationships by model design [47]. In each cross-modal layer, a vision-text cross-attention is firstly performed for vision modality to attend relevant text information and vice versa for text modality. Then each modality uses selfattention to learn intra-modal relationship such as interaction between observation and history, followed by a fully-connected neural network. Finally, the HAMT model outputs embeddings $X ^ { ' } = ( x _ { \mathrm { c l s } } ^ { \prime } , x _ { 1 } ^ { \prime } , \cdots , x _ { L } ^ { \prime } ) , H _ { t } ^ { ' } = ( h _ { \mathrm { c l s } } ^ { \prime } , h _ { 1 } ^ { \prime } , \cdots , h _ { t - 1 } ^ { \prime } ) , \dot { O _ { t } } = ( o _ { 1 } ^ { \prime } , \cdots , o _ { K } ^ { \prime } , o _ { \mathrm { s t o p } } ^ { \prime } )$ for tokens in text, history and observation respectively.
|
| 79 |
+
|
| 80 |
+
# 3.2 End-to-end training with proxy tasks
|
| 81 |
+
|
| 82 |
+
As it is difficult to train large-scale transformers with RL due to sparse supervision [27], we propose to first end-to-end train HAMT via several proxy tasks to learn unimodal and multimodal representation.
|
| 83 |
+
|
| 84 |
+
Table 1 compares our HAMT with previous VLN transformers PREVALENT [22] and VLNBERT [44] in inputs and proxy tasks. As neither PREVALENT nor VLN-BERT jointly encodes text, history and observation, a limited choice of proxy tasks can be applied in training. Our model instead can take advantage of various proxy tasks to learn cross-modal alignment, spatial and temporal reasoning, and history-aware action prediction. Given the input pair $( \mathcal { W } , \mathcal { H } _ { T } )$ where $T$ is the length of full trajectory, we can apply common proxy tasks as in vision-and-language pretraining [40, 44], including Masked Language Modeling (MLM), Masked Region Modeling (MRM) and Instruction Trajectory Matching (ITM). Details of the three proxy tasks are presented in the supplementary material. In the following, we introduce new proxy tasks given the triplet input $( \mathcal { W } , \mathcal { H } _ { t } , \mathcal { O } _ { t } )$ specifically for VLN tasks.
|
| 85 |
+
|
| 86 |
+
Single-step Action Prediction/Regression (SAP/SAR). The task deploys imitation learning to predict the next action based on instruction, history from expert demonstration and the current observation. We formulate it as a classification and a regression task respectively. In the SAP classification task, we predict action probability for each navigable view in $\mathcal { O } _ { t } ^ { c }$ which is $\begin{array} { r } { p _ { t } ( o _ { i } ^ { \prime } ) = \frac { \exp ( f _ { \mathrm { S A P } } ( o _ { i } ^ { \prime } \odot x _ { \mathrm { c l s } } ^ { \prime } ) ) } { \sum _ { j } \exp ( f _ { \mathrm { S A P } } ( o _ { j } ^ { \prime } \odot x _ { \mathrm { c l s } } ^ { \prime } ) ) } } \end{array}$ , where $f _ { \mathrm { S A P } }$ is a two-layer fully-connected network, $\odot$ is element-wise multiplication and $x _ { \mathrm { c l s } } ^ { \prime }$ is output embedding of special text token [cls]. The objective is to minimize negative log probability of the target view action $o _ { * } ^ { \prime }$ : $L _ { \mathrm { S A P } } = - { \log { p _ { t } ( o _ { * } ^ { \prime } ) } }$ . In SAR regression task, we directly predict the action heading and elevation angles based on the text token $\boldsymbol { \left[ \mathsf { c } \mathrm { 1 s } \right] }$ which is $\hat { \theta _ { t } } , \hat { \phi _ { t } } = f _ { \mathrm { S A R } } ( x _ { \mathrm { c l s } } ^ { \prime } )$ . The loss function is $L _ { \mathrm { S A R } } = ( \hat { \theta _ { t } } - \theta _ { t } ) ^ { 2 } + ( \hat { \phi _ { t } } - \phi _ { t } ) ^ { 2 }$ . The two proxy tasks enable the model to learn how to make action decision conditioning on instruction and contextual history.
|
| 87 |
+
|
| 88 |
+
Spatial Relationship Prediction (SPREL). Expressions of egocentric and allocentric spatial relations are frequent in navigational instructions, such as “walk into the room on your left” and “enter the bedroom next to the stairs”. In order to learn spatial relation aware representations, we propose the SPREL self-supervised task to predict relative spatial position of two views in a panorama based on only visual feature, angle feature or both. Assume $[ v _ { i } ^ { o } ; a _ { i } ^ { o } ]$ and $[ v _ { j } ^ { o } ; a _ { j } ^ { o } ]$ are two views in ${ \mathcal { O } } _ { t }$ , we randomly zero out $v _ { * } ^ { o }$ or $a _ { * } ^ { o }$ with probability of 0.3. Their encoded representations are $o _ { i } ^ { \prime }$ and $o _ { j } ^ { \prime }$ , and their relative heading and elevation angles are $\theta _ { i j } , \phi _ { i j }$ . We then predict $\begin{array} { r } { \hat { \theta } _ { i j } , \hat { \phi } _ { i j } = f _ { \mathrm { S P R E L } } ( [ \hat { o _ { i } ^ { \prime } } ; o _ { j } ^ { \prime } ] ) } \end{array}$ where $[ ; ]$ denotes vector concatenation and optimize $L _ { \mathrm { S P R E L } } = ( \hat { \theta } _ { i j } - \theta _ { i j } ) ^ { 2 } + ( \hat { \phi } _ { i j } - \phi _ { i j } ) ^ { 2 }$ . The task helps for spatial relationship reasoning in the observation.
|
| 89 |
+
|
| 90 |
+
Training Strategy. Instead of directly training the whole HAMT model at once, we propose to progressively train HAMT in two stages. In the first stage, we freeze ViT pretrained on ImageNet [48] and train the rest of the modules which are randomly initialized. This aims to avoid catastrophic forgetting of the pretrained weights in ViT. Then we unfreeze ViT and train the whole model end-toend. The learning rate for ViT is set to be higher than for others modules to avoid vanishing gradients and to speedup convergence. We empirically show that the proposed two-stage training outperforms one-stage training in the supplementary material.
|
| 91 |
+
|
| 92 |
+
# 3.3 Fine-tuning for sequential action prediction
|
| 93 |
+
|
| 94 |
+
Structure Variants. We present two variants of HAMT for action prediction in the following. 1) MLP action head: we directly reuse the action prediction network $f _ { \mathrm { S A P } }$ in the SAP task to predict navigable views. We use it as default for VLN tasks. 2) MLP action head based on encoder-decoder structure: the original HAMT model applies cross-modal attention for both vision-to-text and text-tovision, which is computationally expensive when instructions are long. Therefore, we remove the cross-modal attention from text to vision. In this way, we separate the cross-modal transformer into an encoder which only takes instruction as input, and a decoder that inputs history and observation as query and attends over encoded text tokens. Please see supplementary material for details.
|
| 95 |
+
|
| 96 |
+
$\mathbf { R L + I L }$ Objective. We combine Reinforcement Learning (RL) and Imitation Learning (IL) to finetune HAMT for sequential action prediction. The IL relies on the SAP loss defined in Section 3.2 and follows the expert action at each step while RL samples actions according to the policy $\pi$ . Specifically, we use the Asynchronous Advantage Actor-Critic (A3C) RL algorithm [28]. At each step $t$ , the agent samples an action based on policy $\pi \colon \hat { a } _ { t } ^ { h } \sim \pi ( a _ { t } | \mathcal { W } , \mathcal { H } _ { t } , \mathcal { O } _ { t } , \bar { \mathcal { O } } _ { t } ^ { c } )$ and receives an immediate reward $r _ { t }$ . For non-stop actions, we set $r _ { t }$ as the reduced distance of taking the action to the target and the increased alignment score [3] compared to expert demonstration as defined in [5]; for the stop action, to estiimplem $r _ { t } = 2$ arrives which is . As the $^ { - 2 }$ ritic network is trainedis discount factor. Weistance, we empirically $s _ { t }$ $\begin{array} { r } { R _ { t } = \dot { \sum _ { k = 0 } ^ { T - t } } \gamma ^ { k } r _ { t + k } } \end{array}$ $\gamma$
|
| 97 |
+
$V _ { t } = f _ { \mathrm { c r i t i c } } ( x _ { \mathrm { c l s } } ^ { \prime } \odot h _ { \mathrm { c l s } } ^ { \prime } )$
|
| 98 |
+
find it benefits to combine A3C RL with $\mathrm { I L }$ weighted by $\lambda$ , which is:
|
| 99 |
+
|
| 100 |
+
$$
|
| 101 |
+
\Theta \gets \Theta + \underbrace { \mu \frac { 1 } { T } \sum _ { t = 1 } ^ { T } \nabla \mathrm { e l o g } \pi ( \hat { a } _ { t } ^ { h } ; \Theta ) ( R _ { t } - V _ { t } ) } _ { \mathrm { ~ } } + \underbrace { \lambda \mu \frac { 1 } { T ^ { * } } \sum _ { t = 1 } ^ { T ^ { * } } \nabla \mathrm { e l o g } \pi ( a _ { t } ^ { * } ; \Theta ) } _ { T ^ { * } }
|
| 102 |
+
$$
|
| 103 |
+
|
| 104 |
+
where $\mu$ is the learning rate, $a _ { t } ^ { * }$ is the expert action at step $t$ of the expert trajectory of length $T ^ { * }$ .
|
| 105 |
+
|
| 106 |
+
# 4 Experiments
|
| 107 |
+
|
| 108 |
+
# 4.1 Experimental setup
|
| 109 |
+
|
| 110 |
+
Datasets. We evaluate our method on four VLN tasks (seven datasets): VLN with fine-grained instructions (R2R [6], RxR [7]); VLN with high-level instructions (REVERIE [8], R2R-Last); visionand-dialogue navigation (CVDN [9]); and long-horizon VLN (R4R [3], R2R-Back).
|
| 111 |
+
|
| 112 |
+
• R2R [1] builds upon Matterport3D [49] and includes 90 photo-realistic houses with 10,567 panoramas. It contains 7,189 shortest-path trajectories, each associated with 3 instructions. The dataset is split into train, val seen, val unseen and test unseen sets with 61, 56, 11 and 18 houses respectively. Houses in val seen split are the same as training, while houses in val unseen and test splits are different from training.
|
| 113 |
+
|
| 114 |
+
• RxR [7] is a large multilingual VLN dataset based on Matterport 3D. The instructions are in three different languages (English, Hindi and Telugu). The dataset emphasizes the role of language in VLN by addressing biases in paths and describing more visible entities than R2R.
|
| 115 |
+
R4R [3] extends R2R dataset by concatenating two adjacent tail-to-head trajectories in R2R. Therefore, it has longer instructions and trajectories. The trajectories are also less biased as they are not necessarily the shortest-path from start to end location.
|
| 116 |
+
• R2R-Back is a new VLN setup proposed in this work. The agent is required to return to its start location after arriving at the destination. The agent needs to remember its navigation histories to solve the task. We add a return command at the end of each instruction in R2R and a reverse path from the end to start locations as expert demonstration. CVDN [9] defines a navigation from dialog history task, which requires an agent to arrive at goal regions based on multi-turn question-answering dialogs. Such types of instructions are often ambiguous and under-specified. The lengths of instructions and paths are also long.
|
| 117 |
+
REVERIE [8] replaces step-by-step instructions in R2R with high-level instructions, which mainly describe the target location and object. The agent, hence, is required to navigate to the goal without detailed guidance and depends on its past experiences.
|
| 118 |
+
• R2R-Last is our proposed VLN setup similar to REVERIE. It only uses the last sentence from the original R2R instructions describing the final destination.
|
| 119 |
+
|
| 120 |
+
Evaluation metrics. We adopt standard metrics [1], including (1) Trajectory Length (TL): the agent’s navigated path in meters; (2) Navigation Error (NE): the average distance in meters between the agent’s final position and the target; (3) Success Rate (SR): the ratio of trajectories reaching the destination with a maximum error of 3 meters to the target; and (4) Success Rate normalized by the ratio between the length of the shortest path and the predicted path (SPL). SPL is more relevant than SR as it balances the navigation accuracy and efficiency. For long-horizon VLN task (R4R and R2R-Back), we further employ three metrics to measure the path fidelity between the predicted path and target path, including (5) Coverage weighted by Length Score (CLS) [3]; (6) the normalized Dynamic Time Warping (nDTW) [50]; and (7) the Success weighted by nDTW (SDTW).
|
| 121 |
+
|
| 122 |
+
Implementation details. For the HAMT model, we set $N _ { L } = 9$ for language transformer, $N _ { h } = 2$ for panoramic transformer in hierarchical history encoding, and $N _ { x } = 4$ for cross-modal transformer. There are $K = 3 6$ view images in each panoramic observation. We use ViT-B/16 [43] for image encoding if not otherwise specified. In training with proxy tasks, we randomly select proxy tasks for each mini-batch with predefined ratio. We train HAMT for $2 0 0 \mathrm { k }$ iterations with fixed ViT using learning rate of 5e-5 and batch size of 64 on 4 NVIDIA Tesla P100 GPUs ( $_ { \sim 1 }$ day). The whole HAMT model is trained end-to-end for $2 0 \mathrm { k }$ iterations on 20 NVIDIA V100 GPUs with learning rate of 5e-5 for ViT and 1e-5 for the others ${ \sim } 2 0$ hours). We use R2R training set and augmented pairs from [22] for training unless otherwise noted. In fine-tuning with $\mathrm { R L + I L }$ , we set $\lambda = 0 . 2$ in Eq (3) and $\gamma = 0 . 9$ . The model is fine-tuned for $1 0 0 \mathrm { k }$ iterations with learning rate of 1e-5 and batch size of 8 on a single GPU. Unimodal encoders are fixed by default. The best model is selected according to performance on val unseen split. We use the same augmented data as [5] for R2R for fair comparison, while no augmented data is used for other datasets. Greedy search is applied in inference following the single-run setting. Please see supplementary material for more details.
|
| 123 |
+
|
| 124 |
+
# 4.2 Ablation studies
|
| 125 |
+
|
| 126 |
+
In this section, we evaluate each component in the HAMT model, including: hierarchical history encoding, end-to-end training with proxy tasks, and fine-tuning objectives.
|
| 127 |
+
|
| 128 |
+
How important is the history encoding for VLN? For fair comparison with the state-of-the-art recurrent architecture RecBERT [5], we use the same Resnet152 visual features and train all the models from scratch with $\mathrm { R L + I L }$ objectives to avoid the influence of different weight initialization. The models are optimized for $3 0 0 \mathrm { k }$ iterations end-to-end except for the visual feature. Table 2 compares different history encoding approaches on
|
| 129 |
+
|
| 130 |
+
Table 2: R2R navigation results for alternative methods of history encoding. All methods use Resnet152 visual features and are trained from scratch on R2R dataset.
|
| 131 |
+
|
| 132 |
+
<table><tr><td rowspan="2">History Encoding</td><td colspan="2">Val Seen</td><td colspan="2">Val Unseen</td></tr><tr><td>SR↑</td><td>SPL↑</td><td>SR↑</td><td>SPL↑</td></tr><tr><td>RecBERT[5]</td><td>62</td><td>59</td><td>50</td><td>46</td></tr><tr><td>Recurrent</td><td>60.9±1.0</td><td>56.6±1.1</td><td>52.2±0.7</td><td>47.0±0.5</td></tr><tr><td>Temporal-only</td><td>61.5±0.8</td><td>57.7±0.7</td><td>53.2±0.1</td><td>48.0±0.4</td></tr><tr><td>Hierarchical</td><td>65.5±1.2</td><td>61.3±1.4</td><td>54.4±0.4</td><td>48.7±0.4</td></tr></table>
|
| 133 |
+
|
| 134 |
+
R2R dataset. Our recurrent model slightly differs from RecBERT (no init. OSCAR) [5] in trans
|
| 135 |
+
|
| 136 |
+
Table 3: Ablations for end-to-end HAMT training on R2R dataset using proposed proxy tasks.
|
| 137 |
+
(a) Comparison of visual features and end-to-end training. The “PT” stands for proxy tasks in training; “e2e” for optimizing the visual representation.
|
| 138 |
+
|
| 139 |
+
<table><tr><td>feature PT e2e</td><td>SR↑</td><td>Val Seen SPL↑</td><td>Val Unseen SR↑ SPL↑</td></tr><tr><td>Resnet ×</td><td>×</td><td>65.5±1.2 61.3±1.4</td><td>54.4±0.4 48.7±0.4</td></tr><tr><td>152</td><td>√×</td><td>69.3±1.0 64.8±1.2</td><td>63.5±0.557.5±0.5</td></tr><tr><td rowspan="2">ViT</td><td>√ ×</td><td>75.7±1.0</td><td>72.5±1.0 64.4±0.3 58.8±0.0</td></tr><tr><td>√ √</td><td>75.0±0.9 71.7±0.7</td><td>65.7±0.7 60.9±0.7</td></tr></table>
|
| 140 |
+
|
| 141 |
+
(b) Comparison of different proxy tasks. The “SAP(R)” denotes the single step action prediction and regression task, and “SPREL” is the spatial relationship prediction task.
|
| 142 |
+
|
| 143 |
+
<table><tr><td>SAP SP (R) REL</td><td>Val Seen SR↑ SPL↑</td><td>Val Unseen SR↑ SPL↑</td></tr><tr><td>×</td><td>× 71.2±2.3</td><td>67.2±2.0 62.8±1.3 57.7±1.0</td></tr><tr><td>√</td><td>×</td><td>74.7±0.6 71.1±0.9 63.6±0.1 58.1±0.4</td></tr><tr><td>√</td><td>√</td><td>75.7±1.0 72.5±1.0 64.4±0.3 58.8±0.0</td></tr></table>
|
| 144 |
+
|
| 145 |
+
former architecture as shown in Figure 1. It achieves slightly better performance on val unseen split. The temporal-only model uses transformer to encode agent’s oriented visual observations in history sequence, and outperforms the recurrent method by relative gains of $1 . 9 \%$ on SR and $2 . 1 \%$ on SPL for val unseen split. Adding panoramic observations in a hierarchical way results in $4 . 2 \%$ (SR) and $3 . 6 \%$ (SLP) relative improvements on the val unseen split compared to the recurrent method. Even larger improvements are achieved on val seen split as the hierarchical model has a larger capacity to fit the seen environments. This evaluation demonstrates the advantage of our hierarchical history representation compared to the recurrent and temporal-only history representation.
|
| 146 |
+
|
| 147 |
+
How much does training with proxy tasks help? We next evaluate the advantage of training HAMT end-to-end with proxy tasks. In Table 3a, the first row uses $\mathrm { R L + I L }$ objectives to train HAMT from scratch, while the second row uses proxy tasks for training prior to $\mathrm { R L + I L }$ fine-tuning. We can see that it significantly boosts the performance to first train with proxy tasks. It improves on val unseen split with $1 6 . 7 \%$ and $1 8 . 0 \%$ relative gains on SR and SPL respectively, indicating that training with auxiliary proxy tasks enables better generalization. In the third row, we replace the visual feature from Resnet152 to ViT. The ViT feature improves the performance on both val seen and val unseen splits, showing that more powerful visual representations matter. Finally, training ViT end-to-end obtains $2 . 1 \%$ gains on SPL on val unseen split. This is the first time to show that optimizing visual representations end-to-end is beneficial for VLN tasks. In Table 3b, we evaluate the benefit of the two new proxy tasks for frozen ViT features using the other proxy tasks by default. The SAP(R) uses imitation learning to predict actions, which directly influences the navigation policy and improves the performance by a large margin. The SPREL is a self-supervised proxy task that forces the model to learn spatial relationships in panorama and helps generalization in unseen environments. More experiments to ablate contributions from history encoding and proxy tasks, contributions of proxy tasks in end-to-end training etc. are presented in supplementary material.
|
| 148 |
+
|
| 149 |
+
What is the impact of the fine-tuning objectives? Table 4 presents results using different objectives in fine-tuning. The first row directly applies HAMT trained by proxy tasks, which achieves lower performance than that after IL finetuning, because we mainly use augmented data in proxy task training to increase visual diversity, but such noisy data deteriorates action prediction performance. Previous work [12] has shown that RL alone performs poorly. However, training with
|
| 150 |
+
|
| 151 |
+
Table 4: Ablations for fine-tuning objectives of sequential action prediction on R2R dataset.
|
| 152 |
+
|
| 153 |
+
<table><tr><td rowspan="2">IL RL</td><td rowspan="2"></td><td colspan="2">Val Seen</td><td colspan="2">Val Unseen</td></tr><tr><td>SR↑</td><td>SPL↑</td><td>SR↑</td><td>SPL个</td></tr><tr><td>×</td><td>×</td><td>57.9</td><td>54.8</td><td>51.8</td><td>48.9</td></tr><tr><td>√</td><td>×</td><td>63.7±2.1</td><td>61.7±2.2</td><td>57.2±0.1</td><td>54.7±0.3</td></tr><tr><td>×</td><td>√</td><td>70.5±2.9</td><td>65.6±2.8</td><td>63.5±1.4</td><td>57.5±1.1</td></tr><tr><td>√</td><td>√</td><td>75.0±0.9</td><td>71.7±0.7</td><td>65.7±0.7</td><td>60.9±0.7</td></tr></table>
|
| 154 |
+
|
| 155 |
+
proxy tasks stabilizes the followup RL fine-tuning. HAMT optimized by RL achieves much better performance than that when fine-tuning with IL on the SR metric. It indicates that RL is able to learn better exploration strategy on unseen environments. However, as the reward for RL focuses more on shortest paths rather than path fidelity with instructions, the improvement on SPL metric is relatively small compared to SR metric. Moreover, the fluctuation of the pure RL objective is larger than IL. Therefore, mixing the RL and IL achieves the best performance.
|
| 156 |
+
|
| 157 |
+
# 4.3 Comparison to state of the art
|
| 158 |
+
|
| 159 |
+
VLN with fine-grained instructions: R2R and RxR. Table 5 compares HAMT with previous VLN methods on the R2R benchmark. Our model outperforms state-of-the-art results of RecBERT [5] by relative $5 . 9 \%$ and $7 . 0 \%$ improvements in SPL on val seen and unseen splits respectively. We achieve state-of-the-art performance under the single-run setting on the unseen testing split of the leaderboard2. It demonstrates the effectiveness and generalization of our model. We further provide computation time in inference for HAMT and RecBERT in the supplementary material to show the efficiency of our HAMT model. We also achieve large improvements on $\mathbf { R x R }$ dataset. The full results are presented in supplementary material.
|
| 160 |
+
|
| 161 |
+
Table 5: Comparison with state-of-the-art methods on R2R dataset.
|
| 162 |
+
|
| 163 |
+
<table><tr><td rowspan="2">Methods</td><td colspan="4">Validation Seen</td><td colspan="4">Validation Unseen</td><td colspan="4">Test Unseen</td></tr><tr><td>TL</td><td>NE↓</td><td>SR↑</td><td>SPL↑</td><td>TL</td><td>NE↓</td><td>SR↑</td><td>SPL个</td><td>TL</td><td>NE↓</td><td>SR↑</td><td>SPL↑</td></tr><tr><td>Seq2Seq [6]</td><td>11.33</td><td>6.01</td><td>39</td><td>1</td><td>8.39</td><td>7.81</td><td>22</td><td></td><td>8.13</td><td>7.85</td><td>20</td><td>18</td></tr><tr><td>SF[11]</td><td>-</td><td>3.36</td><td>66</td><td>1</td><td>1</td><td>6.62</td><td>35</td><td>1</td><td>14.82</td><td>6.62</td><td>35</td><td>28</td></tr><tr><td>PRESS [20]</td><td>10.57</td><td>4.39</td><td>58</td><td>55</td><td>10.36</td><td>5.28</td><td>49</td><td>45</td><td>10.77</td><td>5.49</td><td>49</td><td>45</td></tr><tr><td>EnvDrop[12]</td><td>11.00</td><td>3.99</td><td>62</td><td>59</td><td>10.70</td><td>5.22</td><td>52</td><td>48</td><td>11.66</td><td>5.23</td><td>51</td><td>47</td></tr><tr><td>AuxRN[51]</td><td>-</td><td>3.33</td><td>70</td><td>67</td><td>-</td><td>5.28</td><td>55</td><td>50</td><td>1</td><td>5.15</td><td>55</td><td>51</td></tr><tr><td>PREVALENT [22]</td><td>10.32</td><td>3.67</td><td>69</td><td>65</td><td>10.19</td><td>4.71</td><td>58</td><td>53</td><td>10.51</td><td>5.30</td><td>54</td><td>51</td></tr><tr><td>RelGraph [15]</td><td>10.13</td><td>3.47</td><td>67</td><td>65</td><td>9.99</td><td>4.73</td><td>57</td><td>53</td><td>10.29</td><td>4.75</td><td>55</td><td>52</td></tr><tr><td>RecBERT[5]</td><td>11.13</td><td>2.90</td><td>72</td><td>68</td><td>12.01</td><td>3.93</td><td>63</td><td>57</td><td>12.35</td><td>4.09</td><td>63</td><td>57</td></tr><tr><td>HAMT (Ours)</td><td>11.15</td><td>2.51</td><td>76</td><td>72</td><td>11.46</td><td>2.29</td><td>66</td><td>61</td><td>12.27</td><td>3.93</td><td>65</td><td>60</td></tr></table>
|
| 164 |
+
|
| 165 |
+
Long-horizon VLN: R4R and R2R-Back. Table 6 shows navigation results on R4R dataset. As R4R contains longer instructions and trajectories compared to R2R, we use the encoder-decoder variant of HAMT for better efficiency. Our method outperforms previous approaches in all metrics and shows particularly large improvements for the path fidelity related metrics. Compared to RecBERT, HAMT achives $8 . 2 \%$ and $9 . 5 \%$ relative improvement in CLS and nDTW respectively. The large improvements on these path fidelity related metrics indicate that HAMT is better to follow the designated path of the fine-grained instruction. Figure 3 evaluates the performance of HAMT and RecBERT with respect to instruction length measured by words. Though the nDTW decreases for longer instructions, the relative improvement of HAMT increases with the instruction length.
|
| 166 |
+
|
| 167 |
+
Table 6: Comparison on R4R val unseen split.
|
| 168 |
+
|
| 169 |
+
<table><tr><td>Methods</td><td>NE↓</td><td>SR↑</td><td>CLS↑</td><td>nDTW↑</td><td>SDTW↑</td></tr><tr><td>SF[11]</td><td>8.47</td><td>24</td><td>30</td><td>-</td><td>1</td></tr><tr><td>RCM[14]</td><td>1</td><td>29</td><td>35</td><td>30</td><td>13</td></tr><tr><td>PTA [32]</td><td>8.25</td><td>24</td><td>37</td><td>32</td><td>10</td></tr><tr><td>EGP[18]</td><td>8.0</td><td>30.2</td><td>44.4</td><td>37.4</td><td>17.5</td></tr><tr><td>RelGraph [15]</td><td>7.43</td><td>36</td><td>41</td><td>47</td><td>34</td></tr><tr><td>RecBERT† [5]</td><td>6.67</td><td>43.6</td><td>51.4</td><td>45.1</td><td>29.9</td></tr><tr><td>HAMT (Ours)</td><td>6.09</td><td>44.6</td><td>57.7</td><td>50.3</td><td>31.8</td></tr></table>
|
| 170 |
+
|
| 171 |
+

|
| 172 |
+
Figure 3: nDTW with respect to instruction length on R4R val unseen split.
|
| 173 |
+
|
| 174 |
+
The navigation performance on R2R-Back dataset is presented in Table 7. We compare with two state-of-the-art recurrent models EnvDrop [12] and RecBERT [5] based on LSTM and transformer respectively (both models are trained on R2R-Back for fair comparison). The improvements are more significant on this task as it requires the agent to remember the way it came to the target to successfully return back. The recurrent state is insufficient to capture such history and leads to inferior performance compared to the HAMT model.
|
| 175 |
+
|
| 176 |
+
Table 7: Comparison of methods on the R2R-Back dataset.
|
| 177 |
+
|
| 178 |
+
<table><tr><td rowspan="2">Methods</td><td colspan="6">Val Seen</td><td colspan="4">Val Unseen</td></tr><tr><td>TL</td><td>SR↑</td><td>SPL↑</td><td>nDTW↑</td><td>SDTW↑</td><td>TL</td><td>SR↑</td><td>SPL↑</td><td>nDTW↑</td><td>SDTW↑</td></tr><tr><td>EnvDropt[12]</td><td>23.83</td><td>44.1</td><td>42.0</td><td>61.3</td><td>39.4</td><td>24.57</td><td>32.4</td><td>30.2</td><td>51.1</td><td>28.0</td></tr><tr><td>RecBERTt [5]</td><td>22.33</td><td>51.4</td><td>48.4</td><td>67.3</td><td>45.7</td><td>23.35</td><td>41.1</td><td>37.7</td><td>58.2</td><td>35.6</td></tr><tr><td>HAMT (Ours)</td><td>22.76</td><td>64.8</td><td>61.8</td><td>73.7</td><td>58.9</td><td>23.78</td><td>57.2</td><td>53.1</td><td>65.1</td><td>49.5</td></tr></table>
|
| 179 |
+
|
| 180 |
+
Table 8: Navigation performance on CVDN dataset.
|
| 181 |
+
|
| 182 |
+
<table><tr><td>Val Seen</td><td>Val Unseen</td><td>Test Unseen</td></tr><tr><td>PREVALENT [22]</td><td>3.15</td><td>2.44</td></tr><tr><td>VISITRON [52]</td><td>3.25</td><td>3.11</td></tr><tr><td>MT-RCM+EnvAg[53]</td><td>4.65</td><td>3.91</td></tr><tr><td>HAMT (Ours)</td><td>5.13</td><td>5.58</td></tr></table>
|
| 183 |
+
|
| 184 |
+
Vision-and-Dialog Navigation: CVDN. The CVDN dataset contains dialogs as instructions and use Goal Progress (GP) in meters as the primary evaluation metric. GP measures the difference between completed distance and left distance to the goal, so the higher the better. There are two types of demonstrations in the dataset. One is shortest-path trajectory and the other is
|
| 185 |
+
|
| 186 |
+
player’s navigation trajectory. We mix the two types of demonstrations as supervision in training which has shown to be the most effective in previous works [22, 52, 53]. As navigation paths in CVDN dataset are much longer than R2R dataset, we adopt the encoder-decoder variant of HAMT. As shown in Table 8, HAMT outperforms existing recurrent approaches on both seen and unseen environments, and achieves the top position in the leaderboard3. It demonstrates that our HAMT model is generalizable to different types of instructions in new VLN tasks.
|
| 187 |
+
|
| 188 |
+
VLN with high-level instructions: R2R-Last and REVERIE. Table 9 shows results on the R2R-Last dataset that specifies the goal location and contains no step-by-step instructions. The HAMT model with the hierarchical history encoding is able to better accumulate the knowledge of the environment and achieves $9 . 8 \%$ and $1 0 . 5 \%$ relative gains on SPL metric on seen and unseen splits respectively compared to RecBERT [5]. The REVERIE dataset also
|
| 189 |
+
|
| 190 |
+
Table 9: Comparison on the R2R-Last dataset.
|
| 191 |
+
|
| 192 |
+
<table><tr><td>Methods</td><td>Val Seen SR↑</td><td>SPL↑</td><td>Val Unseen SR↑ SPL↑</td></tr><tr><td>EnvDrop+ [12]</td><td>42.8</td><td>38.4</td><td>34.3 28.3</td></tr><tr><td>RecBERT† [5]</td><td>50.2</td><td>45.8 41.6</td><td>37.3</td></tr><tr><td>HAMT (Ours)</td><td>53.3</td><td>50.3</td><td>45.2 41.2</td></tr></table>
|
| 193 |
+
|
| 194 |
+
contains high-level instructions but requires object grounding at the target location besides navigation. We provide results on REVERIE dataset in supplementary material. Our HAMT achieves SPL 30.20 and 26.67 on val unseen and test splits respectively, outperforming the state of the art navigation performance [5] by $5 . 3 \%$ and $2 . 7 \%$ .
|
| 195 |
+
|
| 196 |
+
# 5 Conclusion
|
| 197 |
+
|
| 198 |
+
This paper presents the first end-to-end transformer for vision-and-language navigation, denoted as History Aware Multimodal Transformer (HAMT). Our method efficiently encodes long-horizon history and combines it with instructions and observations to derive multimodal action prediction. The HAMT is first trained with proxy tasks in an end-to-end manner, and is then fine-tuned with RL to improve the navigation policy. We achieve state-of-the-art navigation performance on a diverse range of challenging VLN tasks, demonstrating improved accuracy and generalization of our approach compared to the dominant recurrent methods. Future work could extend our history-aware transformer to VLN with continuous actions [54] and could benefit from pretraining on larger navigation datasets. This paper has minimal ethical, privacy and safety concerns.
|
| 199 |
+
|
| 200 |
+
# Acknowledgments and Disclosure of Funding
|
| 201 |
+
|
| 202 |
+
This work was granted access to the HPC resources of IDRIS under the allocation 101002 made by GENCI. It was funded in part by the French government under management of Agence Nationale de la Recherche as part of the “Investissements d’avenir” program, reference ANR19-P3IA-0001 (PRAIRIE 3IA Institute) and by Louis Vuitton ENS Chair on Artificial Intelligence.
|
| 203 |
+
|
| 204 |
+
# References
|
| 205 |
+
|
| 206 |
+
[1] Peter Anderson, Angel Chang, Devendra Singh Chaplot, Alexey Dosovitskiy, Saurabh Gupta, Vladlen Koltun, Jana Kosecka, Jitendra Malik, Roozbeh Mottaghi, Manolis Savva, et al. On evaluation of embodied navigation agents. arXiv preprint arXiv:1807.06757, 2018. 1, 2, 6, 7
|
| 207 |
+
[2] Howard Chen, Alane Suhr, Dipendra Misra, Noah Snavely, and Yoav Artzi. Touchdown: Natural language navigation and spatial reasoning in visual street environments. In Proceedings of the
|
| 208 |
+
|
| 209 |
+
[3] Vihan Jain, Gabriel Magalhaes, Alexander Ku, Ashish Vaswani, Eugene Ie, and Jason Baldridge. Stay on the path: Instruction fidelity in vision-and-language navigation. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 1862–1872, 2019. 1, 2, 6, 7
|
| 210 |
+
|
| 211 |
+
[4] Yubo Zhang, Hao Tan, and Mohit Bansal. Diagnosing the environment bias in vision-andlanguage navigation. International Joint Conferences on Artificial Intelligence, 2020. 1, 2
|
| 212 |
+
|
| 213 |
+
[5] Yicong Hong, Qi Wu, Yuankai Qi, Cristian Rodriguez-Opazo, and Stephen Gould. Vln bert: A recurrent vision-and-language bert for navigation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 1643–1653, 2021. 1, 3, 4, 6, 7, 8, 9, 10 [6] Peter Anderson, Qi Wu, Damien Teney, Jake Bruce, Mark Johnson, Niko Sünderhauf, Ian Reid, Stephen Gould, and Anton Van Den Hengel. Vision-and-language navigation: Interpreting visually-grounded navigation instructions in real environments. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 3674–3683, 2018. 1, 2, 3, 6, 9 [7] Alexander Ku, Peter Anderson, Roma Patel, Eugene Ie, and Jason Baldridge. Room-acrossroom: Multilingual vision-and-language navigation with dense spatiotemporal grounding. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 4392–4412, 2020. 1, 2, 6, 7
|
| 214 |
+
|
| 215 |
+
[8] Yuankai Qi, Qi Wu, Peter Anderson, Xin Wang, William Yang Wang, Chunhua Shen, and Anton van den Hengel. Reverie: Remote embodied visual referring expression in real indoor environments. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 9982–9991, 2020. 1, 2, 6, 7
|
| 216 |
+
|
| 217 |
+
[9] Jesse Thomason, Michael Murray, Maya Cakmak, and Luke Zettlemoyer. Vision-and-dialog navigation. In Conference on Robot Learning, pages 394–406. PMLR, 2020. 1, 2, 6, 7
|
| 218 |
+
|
| 219 |
+
[10] Licheng Yu, Zhe Lin, Xiaohui Shen, Jimei Yang, Xin Lu, Mohit Bansal, and Tamara L Berg. Mattnet: Modular attention network for referring expression comprehension. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 1307–1315, 2018. 1 [11] Daniel Fried, Ronghang Hu, Volkan Cirik, Anna Rohrbach, Jacob Andreas, Louis-Philippe Morency, Taylor Berg-Kirkpatrick, Kate Saenko, Dan Klein, and Trevor Darrell. Speakerfollower models for vision-and-language navigation. In Proceedings of the 32nd International Conference on Neural Information Processing Systems, pages 3318–3329, 2018. 1, 3, 4, 9
|
| 220 |
+
|
| 221 |
+
[12] Hao Tan, Licheng Yu, and Mohit Bansal. Learning to navigate unseen environments: Back translation with environmental dropout. 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 2610–2621, 2019. 1, 2, 3, 4, 8, 9, 10
|
| 222 |
+
|
| 223 |
+
[13] Chih-Yao Ma, Jiasen Lu, Zuxuan Wu, Ghassan AlRegib, Zsolt Kira, Richard Socher, and Caiming Xiong. Self-monitoring navigation agent via auxiliary progress estimation. In Proceedings of the International Conference on Learning Representations, 2019. 1, 3
|
| 224 |
+
|
| 225 |
+
[14] Xin Wang, Qiuyuan Huang, Asli Celikyilmaz, Jianfeng Gao, Dinghan Shen, Yuan-Fang Wang, William Yang Wang, and Lei Zhang. Reinforced cross-modal matching and self-supervised imitation learning for vision-language navigation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 6629–6638, 2019. 1, 3, 9
|
| 226 |
+
|
| 227 |
+
[15] Yicong Hong, Cristian Rodriguez, Yuankai Qi, Qi Wu, and Stephen Gould. Language and visual entity relationship graph for agent navigation. Advances in Neural Information Processing Systems, 33:7685–7696, 2020. 1, 3, 9
|
| 228 |
+
|
| 229 |
+
[16] Xiangru Lin, Guanbin Li, and Yizhou Yu. Scene-intuitive agent for remote embodied visual grounding. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 7036–7045, 2021. 1, 3
|
| 230 |
+
|
| 231 |
+
[17] Kuan Fang, Alexander Toshev, Li Fei-Fei, and Silvio Savarese. Scene memory transformer for embodied agents in long-horizon tasks. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 538–547, 2019. 1, 3
|
| 232 |
+
|
| 233 |
+
[18] Zhiwei Deng, Karthik Narasimhan, and Olga Russakovsky. Evolving graphical planner: Contextual global planning for vision-and-language navigation. In Advances in Neural Information Processing Systems, volume 33, 2020. 1, 3, 9
|
| 234 |
+
|
| 235 |
+
[19] Hanqing Wang, Wenguan Wang, Wei Liang, Caiming Xiong, and Jianbing Shen. Structured scene memory for vision-language navigation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 8455–8464, 2021. 1, 3
|
| 236 |
+
|
| 237 |
+
[20] Xiujun Li, Chunyuan Li, Qiaolin Xia, Yonatan Bisk, Asli Celikyilmaz, Jianfeng Gao, Noah A Smith, and Yejin Choi. Robust navigation with language pretraining and stochastic sampling. 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), pages 1494–1499, 2019. 2, 3, 9
|
| 238 |
+
|
| 239 |
+
[21] 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. 2, 3, 4 [22] Weituo Hao, Chunyuan Li, Xiujun Li, Lawrence Carin, and Jianfeng Gao. Towards learning a generic agent for vision-and-language navigation via pre-training. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 13137–13146, 2020. 2, 3, 5, 7, 9, 10
|
| 240 |
+
|
| 241 |
+
[23] Marc’Aurelio Ranzato, Sumit Chopra, Michael Auli, and Wojciech Zaremba. Sequence level training with recurrent neural networks. International Conference on Learning Representations, 2016. 2
|
| 242 |
+
|
| 243 |
+
[24] Stéphane Ross, Geoffrey Gordon, and Drew Bagnell. A reduction of imitation learning and structured prediction to no-regret online learning. In Proceedings of the fourteenth international conference on artificial intelligence and statistics, pages 627–635. JMLR Workshop and Conference Proceedings, 2011. 2
|
| 244 |
+
|
| 245 |
+
[25] Samy Bengio, Oriol Vinyals, Navdeep Jaitly, and Noam Shazeer. Scheduled sampling for sequence prediction with recurrent neural networks. In Advances in Neural Information Processing Systems, volume 28, 2015. 2
|
| 246 |
+
|
| 247 |
+
[26] Richard S Sutton and Andrew G Barto. Reinforcement learning: An introduction. MIT press, 2018. 2
|
| 248 |
+
|
| 249 |
+
[27] Emilio Parisotto, Francis Song, Jack Rae, Razvan Pascanu, Caglar Gulcehre, Siddhant Jayakumar, Max Jaderberg, Raphael Lopez Kaufman, Aidan Clark, Seb Noury, et al. Stabilizing transformers for reinforcement learning. In International Conference on Machine Learning, pages 7487–7498. PMLR, 2020. 2, 5
|
| 250 |
+
|
| 251 |
+
[28] Volodymyr Mnih, Adria Puigdomenech Badia, Mehdi Mirza, Alex Graves, Timothy Lillicrap, Tim Harley, David Silver, and Koray Kavukcuoglu. Asynchronous methods for deep reinforcement learning. In International conference on machine learning, pages 1928–1937. PMLR, 2016. 2, 3, 6
|
| 252 |
+
|
| 253 |
+
[29] Mohit Shridhar, Jesse Thomason, Daniel Gordon, Yonatan Bisk, Winson Han, Roozbeh Mottaghi, Luke Zettlemoyer, and Dieter Fox. Alfred: A benchmark for interpreting grounded instructions for everyday tasks. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pages 10740–10749, 2020. 2
|
| 254 |
+
|
| 255 |
+
[30] Hu Wang, Qi Wu, and Chunhua Shen. Soft expert reward learning for vision-and-language navigation. In Computer Vision–ECCV 2020: 16th European Conference, Glasgow, UK, August 23–28, 2020, Proceedings, Part IX 16, pages 126–141. Springer, 2020. 3
|
| 256 |
+
|
| 257 |
+
[31] 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. 3
|
| 258 |
+
|
| 259 |
+
[32] Federico Landi, Lorenzo Baraldi, Marcella Cornia, Massimiliano Corsini, and Rita Cucchiara. Perceive, transform, and act: Multi-modal attention networks for vision-and-language navigation. arXiv preprint arXiv:1911.12377, 2019. 3, 9
|
| 260 |
+
|
| 261 |
+
[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. 3
|
| 262 |
+
|
| 263 |
+
[34] Sepp Hochreiter and Jürgen Schmidhuber. Long short-term memory. Neural computation, 9(8):1735–1780, 1997. 3
|
| 264 |
+
|
| 265 |
+
[35] Saurabh Gupta, James Davidson, Sergey Levine, Rahul Sukthankar, and Jitendra Malik. Cognitive mapping and planning for visual navigation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 2616–2625, 2017. 3
|
| 266 |
+
|
| 267 |
+
[36] Nikolay Savinov, Alexey Dosovitskiy, and Vladlen Koltun. Semi-parametric topological memory for navigation. International Conference on Learning Representations, 2018. 3
|
| 268 |
+
|
| 269 |
+
[37] Alexander Pashevich, Cordelia Schmid, and Chen Sun. Episodic transformer for vision-andlanguage navigation. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 15942–15952, 2021. 3, 4
|
| 270 |
+
|
| 271 |
+
[38] Yen-Chun Chen, Linjie Li, Licheng Yu, Ahmed El Kholy, Faisal Ahmed, Zhe Gan, Yu Cheng, and Jingjing Liu. Uniter: Universal image-text representation learning. In European Conference on Computer Vision, pages 104–120. Springer, 2020. 3
|
| 272 |
+
|
| 273 |
+
[39] Xiujun Li, Xi Yin, Chunyuan Li, Pengchuan Zhang, Xiaowei Hu, Lei Zhang, Lijuan Wang, Houdong Hu, Li Dong, Furu Wei, et al. Oscar: Object-semantics aligned pre-training for vision-language tasks. In European Conference on Computer Vision, pages 121–137. Springer, 2020. 3
|
| 274 |
+
|
| 275 |
+
[40] Jiasen Lu, Dhruv Batra, Devi Parikh, and Stefan Lee. ViLBERT: Pretraining task-agnostic visiolinguistic representations for vision-and-language tasks. In Advances in Neural Information Processing Systems, volume 32, 2019. 3, 5
|
| 276 |
+
|
| 277 |
+
[41] Hao Tan and Mohit Bansal. LXMERT: Learning cross-modality encoder representations from transformers. 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), pages 5103–5114, 2019. 3
|
| 278 |
+
|
| 279 |
+
[42] Wonjae Kim, Bokyung Son, and Ildoo Kim. Vilt: Vision-and-language transformer without convolution or region supervision. In Proceedings of the 38th International Conference on Machine Learning, pages 5583–5594, 2021. 3
|
| 280 |
+
|
| 281 |
+
[43] 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 $1 6 \times 1 6$ words: Transformers for image recognition at scale. International Conference on Learning Representations, 2020. 3, 7
|
| 282 |
+
|
| 283 |
+
[44] Arjun Majumdar, Ayush Shrivastava, Stefan Lee, Peter Anderson, Devi Parikh, and Dhruv Batra. Improving vision-and-language navigation with image-text pairs from the web. In European Conference on Computer Vision, pages 259–274. Springer, 2020. 3, 4, 5
|
| 284 |
+
|
| 285 |
+
[45] Jimmy Lei Ba, Jamie Ryan Kiros, and Geoffrey E Hinton. Layer normalization. arXiv preprint arXiv:1607.06450, 2016. 4
|
| 286 |
+
|
| 287 |
+
[46] Anurag Arnab, Mostafa Dehghani, Georg Heigold, Chen Sun, Mario Luciˇ c, and Cordelia ´ Schmid. Vivit: A video vision transformer. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 6836–6846, 2021. 4
|
| 288 |
+
|
| 289 |
+
[47] Jize Cao, Zhe Gan, Yu Cheng, Licheng Yu, Yen-Chun Chen, and Jingjing Liu. Behind the scene: Revealing the secrets of pre-trained vision-and-language models. In European Conference on Computer Vision, pages 565–580. Springer, 2020. 5
|
| 290 |
+
[48] Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. ImageNet: A largescale hierarchical image database. In 2009 IEEE conference on computer vision and pattern recognition, pages 248–255. IEEE, 2009. 6
|
| 291 |
+
[49] Angel Chang, Angela Dai, Thomas Funkhouser, Maciej Halber, Matthias Niebner, Manolis Savva, Shuran Song, Andy Zeng, and Yinda Zhang. Matterport3d: Learning from rgb-d data in indoor environments. In 2017 International Conference on 3D Vision (3DV), pages 667–676. IEEE, 2017. 6
|
| 292 |
+
[50] Gabriel Ilharco, Vihan Jain, Alexander Ku, Eugene Ie, and Jason Baldridge. General evaluation for instruction conditioned navigation using dynamic time warping. In Visually Grounded Interaction and Language (ViGIL), NeurIPS 2019 Workshop, 2019. 7
|
| 293 |
+
[51] Fengda Zhu, Yi Zhu, Xiaojun Chang, and Xiaodan Liang. Vision-language navigation with self-supervised auxiliary reasoning tasks. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 10012–10022, 2020. 9
|
| 294 |
+
[52] Ayush Shrivastava, Karthik Gopalakrishnan, Yang Liu, Robinson Piramuthu, Gokhan Tür, Devi Parikh, and Dilek Hakkani-Tür. Visitron: Visual semantics-aligned interactively trained object-navigator. arXiv preprint arXiv:2105.11589, 2021. 10
|
| 295 |
+
[53] Xin Eric Wang, Vihan Jain, Eugene Ie, William Yang Wang, Zornitsa Kozareva, and Sujith Ravi. Environment-agnostic multitask learning for natural language grounded navigation. In Computer Vision–ECCV 2020: 16th European Conference, Glasgow, UK, August 23–28, 2020, Proceedings, Part XXIV 16, pages 413–430. Springer, 2020. 10
|
| 296 |
+
[54] Jacob Krantz, Erik Wijmans, Arjun Majumdar, Dhruv Batra, and Stefan Lee. Beyond the navgraph: Vision-and-language navigation in continuous environments. In European Conference on Computer Vision, pages 104–120. Springer, 2020. 10
|
md/train/Skl4mRNYDr/Skl4mRNYDr.md
ADDED
|
@@ -0,0 +1,449 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# DEEP IMITATIVE MODELS FOR FLEXIBLE INFERENCE, PLANNING, AND CONTROL
|
| 2 |
+
|
| 3 |
+
Nicholas Rhinehart UC Berkeley nrhinehart@berkeley.edu
|
| 4 |
+
|
| 5 |
+
Rowan McAllister UC Berkeley rmcallister@berkeley.edu
|
| 6 |
+
|
| 7 |
+
Sergey Levine
|
| 8 |
+
UC Berkeley
|
| 9 |
+
svlevine@berkeley.edu
|
| 10 |
+
|
| 11 |
+
# ABSTRACT
|
| 12 |
+
|
| 13 |
+
Imitation Learning $\left( \operatorname { I L } \right)$ is an appealing approach to learn desirable autonomous behavior. However, directing IL to achieve arbitrary goals is difficult. In contrast, planning-based algorithms use dynamics models and reward functions to achieve goals. Yet, reward functions that evoke desirable behavior are often difficult to specify. In this paper, we propose “Imitative Models” to combine the benefits of $\mathrm { I L }$ and goal-directed planning. Imitative Models are probabilistic predictive models of desirable behavior able to plan interpretable expert-like trajectories to achieve specified goals. We derive families of flexible goal objectives, including constrained goal regions, unconstrained goal sets, and energy-based goals. We show that our method can use these objectives to successfully direct behavior. Our method substantially outperforms six IL approaches and a planning-based approach in a dynamic simulated autonomous driving task, and is efficiently learned from expert demonstrations without online data collection. We also show our approach is robust to poorly specified goals, such as goals on the wrong side of the road.
|
| 14 |
+
|
| 15 |
+
# 1 INTRODUCTION
|
| 16 |
+
|
| 17 |
+
Imitation learning (IL) is a framework for learning a model to mimic behavior. At test-time, the model pursues its best-guess of desirable behavior. By letting the model choose its own behavior, we cannot direct it to achieve different goals. While work has augmented IL with goal conditioning (Dosovitskiy & Koltun, 2016; Codevilla et al., 2018), it requires goals to be specified during training, explicit goal labels, and are simple (e.g., turning). In contrast, we seek flexibility to achieve general goals for which we have no demonstrations.
|
| 18 |
+
|
| 19 |
+
In contrast to IL, planning-based algorithms like model-based reinforcement learning (MBRL) methods do not require expert demonstrations. MBRL can adapt to new tasks specified through reward functions (Kuvayev & Sutton, 1996; Deisenroth & Rasmussen, 2011). The “model” is a dynamics model, used to plan under the user-supplied reward function. Planning enables these approaches to perform new tasks at test-time. The key drawback is that these models learn dynamics of possible behavior rather than dynamics of desirable behavior. This means that the responsibility of evoking desirable behavior is entirely deferred to engineering the input reward function. Designing reward functions that cause MBRL to evoke complex, desirable behavior is difficult when the space of possible undesirable behaviors is large. In order to succeed, the rewards cannot lead the model astray towards observations significantly different than those with which the model was trained.
|
| 20 |
+
|
| 21 |
+
Our goal is to devise an algorithm that combines the advantages of MBRL and IL by offering MBRL’s flexibility to achieve new tasks at test-time and IL’s potential to learn desirable behavior entirely from offline data. To accomplish this, we first train a model to forecast expert trajectories with a density function, which can score trajectories and plans by how likely they are to come from the expert. A probabilistic model is necessary because expert behavior is stochastic: e.g. at an intersection, the expert could choose to turn left or right. Next, we derive a principled probabilistic inference objective to create plans that incorporate both (1) the model and (2) arbitrary new tasks. Finally, we derive families of tasks that we can provide to the inference framework. Our method can accomplish new tasks specified as complex goals without having seen an expert complete these tasks before.
|
| 22 |
+
|
| 23 |
+

|
| 24 |
+
Figure 1: Our method: deep imitative models. Top Center. We use demonstrations to learn a probability density function $q$ of future behavior and deploy it to accomplish various tasks. Left: A region in the ground plane is input to a planning procedure that reasons about how the expert would achieve that task. It coarsely specifies a destination, and guides the vehicle to turn left. Right: Goal positions and potholes yield a plan that avoids potholes and achieves one of the goals on the right.
|
| 25 |
+
|
| 26 |
+
We investigate properties of our method on a dynamic simulated autonomous driving task (see Fig. 1). Videos are available at https://sites.google.com/view/imitative-models. Our contributions are as follows:
|
| 27 |
+
|
| 28 |
+
1. Interpretable expert-like plans with minimal reward engineering. Our method outputs multistep expert-like plans, offering superior interpretability to one-step imitation learning models. In contrast to MBRL, our method generates expert-like behaviors with minimal reward engineering.
|
| 29 |
+
2. Flexibility to new tasks: In contrast to IL, our method flexibly incorporates and achieves goals not seen during training, and performs complex tasks that were never demonstrated, such as navigating to goal regions and avoiding test-time only potholes, as depicted in Fig. 1.
|
| 30 |
+
3. Robustness to goal specification noise: We show that our method is robust to noise in the goal specification. In our application, we show that our agent can receive goals on the wrong side of the road, yet still navigate towards them while staying on the correct side of the road.
|
| 31 |
+
4. State-of-the-art CARLA performance: Our method substantially outperforms MBRL, a custom IL method, and all five prior CARLA IL methods known to us. It learned near-perfect driving through dynamic and static CARLA environments from expert observations alone.
|
| 32 |
+
|
| 33 |
+
# 2 DEEP IMITATIVE MODELS
|
| 34 |
+
|
| 35 |
+
We begin by formalizing assumptions and notation. We model continuous-state, discrete-time, Partially-Observed Markov Decision Processes (POMDPs). For brevity, we call the components of state of which we have direct observations the agent’s “state”, although we explicitly assume these states do not represent the full Markovian world state. Our agent’s state at time $t$ is $\bar { \bf s } _ { t } \in \mathbb { R } ^ { D }$ ; $t = 0$ refers to the current time step, and $\phi$ is all of the agent’s observations. Variables are bolded. Random variables are capitalized. Absent subscripts denote all future time steps, e.g. $\mathbf { S } \doteq \mathbf { S } _ { 1 : T } \in \mathbb { R } ^ { T \times D }$ . We denote a probability density function of a random variable $\mathbf { S }$ as $p ( \mathbf { S } )$ , and its value as $p ( \mathbf { s } ) \doteq p ( \mathbf { S } = \mathbf { s } )$ .
|
| 36 |
+
|
| 37 |
+
To learn agent dynamics that are possible and preferred, we construct a model of expert behavior. We fit an “Imitative Model” $\begin{array} { r } { q ( \mathbf { S } _ { 1 : T } | \phi ) = \prod _ { t = 1 } ^ { T } q ( \mathbf { S } _ { t } | \mathbf { S } _ { 1 : t - 1 } , \phi ) } \end{array}$ to a dataset of expert trajectories $\mathcal { D } = \{ ( s ^ { i } , \phi ^ { i } ) \} _ { i = 1 } ^ { N }$ drawn from a (unknown) distribution of expert behavior $s ^ { i } \sim p ( \mathbf { S } | \phi ^ { i } )$ . By training $q ( \mathbf { S } | \phi )$ to forecast expert trajectories with high likelihood, we model the scene-conditioned expert dynamics, which can score trajectories by how likely they are to come from the expert.
|
| 38 |
+
|
| 39 |
+
# 2.1 IMITATIVE PLANNING TO GOALS
|
| 40 |
+
|
| 41 |
+
After training, $q ( \mathbf { S } | \phi )$ can generate trajectories that resemble those that the expert might generate – e.g. trajectories that navigate roads with expert-like maneuvers. However, these maneuvers will not have a specific goal. Beyond generating human-like behaviors, we wish to direct our agent to goals and have the agent automatically reason about the necessary mid-level details. We define general tasks by a set of goal variables $\mathcal { G }$ . The probability of a plan s conditioned on the goal $\mathcal { G }$ is modelled by a posterior $p ( \mathbf { s } | \mathcal { G } , \phi )$ . This posterior is implemented with $q ( \mathbf { s } | \boldsymbol { \phi } )$ as a learned imitation prior and $p ( \mathcal { G } | \mathbf { s } , \phi )$ as a test-time goal likelihood. We give examples of $p ( { \mathcal { G } } | \mathbf { s } , \phi )$ after deriving a maximum a posteriori inference procedure to generate expert-like plans that achieve abstract goals:
|
| 42 |
+
|
| 43 |
+
$$
|
| 44 |
+
\begin{array} { r l } { \mathbf { s } ^ { * } \ \stackrel { } { = } \ \underset { \mathbf { s } } { \arg \operatorname* { m a x } } \ \log p ( \mathbf { s } | \mathcal { G } , \boldsymbol { \phi } ) \ = \ \underset { \mathbf { s } } { \arg \operatorname* { m a x } } \ \log q ( \mathbf { s } | \boldsymbol { \phi } ) + \log p ( \mathcal { G } | \mathbf { s } , \boldsymbol { \phi } ) - \log p ( \mathcal { G } | \boldsymbol { \phi } ) } & { } \\ { \ \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad = \ \underset { \mathbf { s } } { \arg \operatorname* { m a x } } \ \log \underset { \underset { \mathrm { i m i t a t i o n ~ p r i o r } } { \underbrace { q ( \mathbf { s } | \boldsymbol { \phi } ) } } } { \underbrace { q ( \mathbf { s } | \boldsymbol { \phi } ) } } + \log \underset { \mathrm { g o a l l i k e l i h o o d } } { \underbrace { p ( \mathcal { G } | \mathbf { s } , \boldsymbol { \phi } ) } } . } \end{array}
|
| 45 |
+
$$
|
| 46 |
+
|
| 47 |
+
We perform gradient-based optimization of Eq. 1, and defer this discussion to Appendix A. Next, we discuss several goal likelihoods, which direct the planning in different ways. They communicate goals they desire the agent to achieve, but not how to achieve them. The planning procedure determines how to achieve them by producing paths similar to those an expert would have taken to reach the given goal. In contrast to black-box one-step IL that predicts controls, our method produces interpretable multi-step plans accompanied by two scores. One estimates the plan’s “expertness”, the second estimates its probability to achieve the goal. Their sum communicates the plan’s overall quality.
|
| 48 |
+
|
| 49 |
+
Our approach can also be viewed as a learning-based method to integrate mid-level and high-level controllers together, where demonstrations from both are available at train-time, only the highlevel controller is available at test-time, and the high-level controller can vary. The high-level controller’s action specifies a subgoal for the mid-level controller. A density model of future trajectories of an expert mid-level controller is learned at train-time, and is amenable to different types of direction as specified by the high-level controller. In this sense, the model is an “apprentice”, having learned to imitate mid-level behaviors. In our application, the high-level controller is composed of an $A ^ { * }$ path-planning algorithm and one of a library of components that forms goal likelihoods from the waypoints produced by $A ^ { * }$ . Connecting this to related approaches, learning the midlevel controller (Imitative Model) resembles offline IL, whereas inference with an Imitative Model resembles trajectory optimization in MBRL, given goals provided by the high-level controller.
|
| 50 |
+
|
| 51 |
+
# 2.2 CONSTRUCTING GOAL LIKELIHOODS
|
| 52 |
+
|
| 53 |
+
Constraint-based planning to goal sets (hyperparameter-free): Consider the setting where we have access to a set of desired final states, one of which the agent should achieve. We can model this by applying a Dirac-delta distribution on the final state, to ensure it lands in a goal set $\mathbb { G } \subset \mathbb { R } ^ { D }$ :
|
| 54 |
+
|
| 55 |
+
$$
|
| 56 |
+
p ( \mathcal { G } | \mathbf { s } , \phi ) \delta _ { \mathbf { s } _ { T } } ( \mathbb { G } ) , \quad \delta _ { \mathbf { s } _ { T } } ( \mathbb { G } ) = 1 \mathrm { i f ~ } \mathbf { s } _ { T } \in \mathbb { G } , \quad \delta _ { \mathbf { s } _ { T } } ( \mathbb { G } ) = 0 \mathrm { i f ~ } \mathbf { s } _ { T } \ncong \mathbb { G } .
|
| 57 |
+
$$
|
| 58 |
+
|
| 59 |
+
$\delta _ { \mathbf { s } _ { T } } ( \mathbb { G } )$ ’s partial support of $\mathbf { s } _ { T } \in \mathbb { G } \subset \mathbb { R } ^ { D }$ constrains ${ \bf s } _ { T }$ and introduces no hyperparameters into $p ( \mathcal { G } | \mathbf { s } , \phi )$ . For each choice of $\mathbb { G }$ , we have a different way to provide high-level task information to the agent. The simplest choice for $\mathbb { G }$ is a finite set of points: a (A) Final-State Indicator likelihood. We applied (A) to a sequence of waypoints received from a standard $\mathbf { A } ^ { * }$ planner (provided by the CARLA simulator), and outperformed all prior dynamic-world CARLA methods known to us. We can also consider providing an infinite number of points. Providing a set of line-segments as $\mathbb { G }$ yields a (B) Line-Segment Final-State Indicator likelihood, which encourages the final state to land along one of the segments. Finally, consider a (C) Region Final-State Indicator likelihood in which $\mathbb { G }$ is a polygon (see Figs. 1 and 4). Solving Eq. 1 with (C) amounts to planning the most expert-like trajectory that ends inside a goal region. Appendix B provides derivations, implementation details, and additional visualizations. We found these methods to work well when $\mathbb { G }$ contains “expert-like” final position(s), as the prior strongly penalizes plans ending in non-expert-like positions.
|
| 60 |
+
|
| 61 |
+
Unconstrained planning to goal sets (hyperparameter-based): Instead of constraining that the final state of the trajectory reach a goal, we can use a goal likelihood with full support $( \mathbf { s } _ { T } \in \mathbb { R } ^ { D } )$ , centered at a desired final state. This lets the goal likelihood encourage goals, rather than dictate them. If there is a single desired goal $\langle \mathbf { G } = \{ \mathbf { g } _ { T } \}$ ), the $\mathbf { \eta } ^ { ( \mathbf { D } ) }$ Gaussian Final-State likelihood $p ( { \mathcal { G } } | \mathbf { s } , \phi ) \gets$ $\mathcal { N } ( \mathbf { g } _ { T } ; \mathbf { s } _ { T } , \epsilon I )$ treats ${ \bf g } _ { T }$ as a noisy observation of a final future state, and encourages the plan to arrive at a final state. We can also plan to $K$ successive states $\mathcal { G } = ( \mathbf { g } _ { T - K + 1 } , \dots , \mathbf { g } _ { T } )$ with a $\mathbf { ( E ) }$ Gaussian State Sequence: $\begin{array} { r } { p ( \mathcal { G } | \mathbf { s } , \acute { \phi } ) \prod _ { k = T - K + 1 } ^ { T } \mathcal { N } ( \mathbf { g } _ { k } ; \mathbf { s } _ { k } , \epsilon I ) } \end{array}$ if a program wishes to specify a desired end velocity or acceleration when reaching the final state ${ \bf g } _ { T }$ (Fig. 2). Alternatively, a planner may propose a set of states with the intention that the agent should reach any one of them. This is possible by using a $\mathbf { \Pi } ^ { ( \mathbf { F } ) }$ Gaussian Final-State Mixture: $\begin{array} { r } { p ( \mathcal { G } | \mathbf { s } , \boldsymbol { \phi } ) \gets \frac { 1 } { K } \sum _ { k = 1 } ^ { K } \mathcal { N } ( \mathbf { g } _ { T } ^ { k } ; \mathbf { s } _ { T } , \boldsymbol { \epsilon } I ) } \end{array}$ and is useful if some of those final states are not reachable with an expert-like plan. Unlike A–C, D–F introduce a hyperparameter $\cdot \epsilon ^ { * }$ . However, they are useful when no states in $\mathbb { G }$ correspond to observed expert behavior, as they allow the imitation prior to be robust to poorly specified goals.
|
| 62 |
+
|
| 63 |
+
Costed planning: Our model has the additional flexibility to accept arbitrary user-specified costs $c$ at test-time. For example, we may have updated knowledge of new hazards at test-time, such as a given map of potholes or a predicted cost map. Cost-based knowledge $c ( \mathbf { s } _ { i } | \phi )$ can be incorporated as an (G) Energy-based likelihood: $\begin{array} { r } { p ( \mathcal { G } | \mathbf { s } , \boldsymbol { \phi } ) \overset { } { \propto } \prod _ { t = 1 } ^ { T } e ^ { - c ( \mathbf { s } _ { t } | \boldsymbol { \phi } ) } } \end{array}$ (Todorov, 2007; Levine, 2018). This can be combined with other goal-seeking objectives by simply multiplying the likelihoods together. Examples of combining G (energy-based) with F (Gaussian mixture) were shown in Fig. 1 and are shown in Fig. 3. Next, we describe instantiating $q ( \mathbf { S } | \phi )$ in CARLA (Dosovitskiy et al., 2017).
|
| 64 |
+
|
| 65 |
+
Designing general goal likelihoods can be considered a form of reward engineering if there are no restrictions on the goal likelihoods. This connection is best seen in (G), which has an explicit cost term. One reason why it is easier to design goal likelihoods than to design reward functions is that the task of evoking most aspects of goal-driven behavior is already learned by the prior $q ( \mathbf { s } | \boldsymbol { \phi } )$ , which models desirable behavior. This is in contrast to model-free RL, which entirely relies on the reward design to evoke goal-driven behavior, and in contrast to model-based RL, which heavily relies on the reward design to evoke goal-driven behavior, as its dynamics model learns what is possible, rather than what is desirable. Additionally, it is easy to design goal likelihoods when goals provide a significant amount of information that obviates the need to do any manual tuning. The main assumption is that one of the goals in the goal set is reachable within the model’s time-horizon.
|
| 66 |
+
|
| 67 |
+

|
| 68 |
+
Figure 2: Imitative planning with the Gaussian State Sequence enables finegrained control of the plans.
|
| 69 |
+
|
| 70 |
+

|
| 71 |
+
Figure 3: Costs can be assigned to “potholes” only seen at test-time. The planner prefers routes avoiding potholes.
|
| 72 |
+
|
| 73 |
+

|
| 74 |
+
Figure 4: Goal regions can be coarsely specified to give directions.
|
| 75 |
+
|
| 76 |
+
# 2.3 APPLYING DEEP IMITATIVE MODELS TO AUTONOMOUS DRIVING
|
| 77 |
+
|
| 78 |
+
In our autonomous driving application, we model the agent’s state at time $t$ as $\mathbf { s } _ { t } \in \mathbb { R } ^ { D }$ with $D = 2$ ; $\mathbf { s } _ { t }$ represents our agent’s location on the ground plane. The agent has access to environment perception $\phi { \bf \bar { \omega } } \{ { \bf s } _ { - \tau : 0 } , \chi , { \bf \bar { \omega } } \}$ , where $\tau$ is the number of past positions we condition on, $x$ is a high-dimensional observation of the scene, and $\boldsymbol { \lambda }$ is a low-dimensional traffic light signal. $x$ could represent either LIDAR or camera images (or both), and is the agent’s observation of the world. In our setting, we featurize LIDAR to $\chi = \mathrm { \mathbb { R } ^ { 2 0 0 \times 2 0 0 \times 2 } }$ , with $\chi _ { i j }$ representing a 2-bin histogram of points above and at ground level in a $0 . 5 \mathrm { m } ^ { 2 }$ cell at position $( i , j )$ . CARLA provides ground-truth ${ \bf s } _ { - \tau : 0 }$ and $\boldsymbol { \lambda }$ . Their availability is a realistic input assumption in perception-based autonomous driving pipelines.
|
| 79 |
+
|
| 80 |
+
Model requirements: A deep imitative model forecasts future expert behavior. It must be able to compute $\bar { q ( \mathbf { s } | \boldsymbol { \phi } ) } \forall \mathbf { s } \in \mathbb { R } ^ { T \times D }$ . The ability to compute $\nabla _ { \mathbf { s } } q ( \mathbf { s } | \phi )$ enables gradient-based optimization for planning. Rudenko et al. (2019) provide a recent survey on forecasting agent behavior. As many forecasting methods cannot compute trajectory probabilities, we must be judicious in choosing $q ( \mathbf { S } | \phi )$ . A model that can compute probabilities R2P2 (Rhinehart et al., 2018), a generative autoregressive flow (Rezende & Mohamed, 2015; Oord et al., 2017). We extend R2P2 to instantiate the deep imitative model $q ( \mathbf { S } | \phi )$ . R2P2 was previously used to forecast vehicle trajectories: it was not demonstrated or developed to plan or execute controls. Although we used R2P2, other future-trajectory density estimation techniques could be used – designing ${ \dot { \mathbf { \zeta } } } _ { q } ( \mathbf { s } | \phi )$ is not the primary focus of this work. In R2P2, $q _ { \theta } ( \mathbf { S } | \phi )$ is induced by an invertible, differentiable function: $\mathbf { S } = f _ { \theta } ( \mathbf { Z } ; \phi ) : \mathbb { R } ^ { T \times 2 } \mapsto \mathbb { R } ^ { T \times 2 }$ ; $f _ { \theta }$ warps a latent sample from a base distribution $\mathbf { Z } \sim q _ { 0 } = \mathcal { N } ( 0 , I )$ to S. $\theta$ is trained to maximize $q _ { \theta } ( \mathbf { S } | \phi )$ of expert trajectories. $f _ { \theta }$ is defined for $1 . . T$ as follows:
|
| 81 |
+
|
| 82 |
+

|
| 83 |
+
Figure 5: Illustration of our method applied to autonomous driving. Our method trains an imitative model from a dataset of expert examples. After training, the model is repurposed as an imitative planner. At test-time, a route planner provides waypoints to the imitative planner, which computes expert-like paths to each goal. The best plan is chosen according to the planning objective and provided to a low-level PID-controller in order to produce steering and throttle actions. This procedure is also described with pseudocode in Appendix A.
|
| 84 |
+
|
| 85 |
+
$$
|
| 86 |
+
\mathbf { S } _ { t } = f _ { t } ( \mathbf { Z } _ { 1 : t } ) = \mu _ { \theta } ( \mathbf { S } _ { 1 : t - 1 } , \phi ) + \sigma _ { \theta } ( \mathbf { S } _ { 1 : t - 1 } , \phi ) \mathbf { Z } _ { t } ,
|
| 87 |
+
$$
|
| 88 |
+
|
| 89 |
+
where µ $\begin{array} { r } { \phantom { \frac { 1 } { \theta } } \theta ( \mathbf { S } _ { 1 : t - 1 } , \phi ) = \mathbf { S } _ { t - 1 } + ( \mathbf { S } _ { t - 1 } - \mathbf { S } _ { t - 2 } ) \phantom { \frac { 1 } { \theta } } + m _ { \theta } ( \mathbf { S } _ { 1 : t - 1 } , \phi ) = 2 \mathbf { S } _ { t - 1 } - \mathbf { S } _ { t - 2 } + m _ { \theta } ( \mathbf { S } _ { 1 : t - 1 } , \phi ) , } \end{array}$ encodes a constant-velocity inductive bias. The $m _ { \theta } \in \mathbb { R } ^ { 2 }$ and $\sigma _ { \theta } \in \mathbb { R } ^ { 2 \times 2 }$ are computed by expressive neural networks. The resulting trajectory distribution is complex and multimodal (Appendix C.1 depicts samples). Because traffic light state was not included in the $\phi$ of R2P2’s “RNN” model, it could not react to traffic lights. We created a new model that includes $\boldsymbol { \lambda }$ . It fixed cases where $q ( \mathbf { S } | \phi )$ exhibited no forward-moving preference when the agent was already stopped, and improved $q ( \mathbf { S } | \phi )$ ’s stopping preference at red lights. We used $T = 4 0$ trajectories at $1 0 \mathrm { H z }$ (4 seconds), and $\tau = 3$ . Fig. 12 in Appendix C depicts the architecture of $\mu _ { \theta }$ and $\sigma _ { \theta }$ .
|
| 90 |
+
|
| 91 |
+
# 2.4 IMITATIVE DRIVING
|
| 92 |
+
|
| 93 |
+
We now instantiate a complete autonomous driving framework based on imitative models to study in our experiments, seen in Fig. 5. We use three layers of spatial abstraction to plan to a faraway destination, common to autonomous vehicle setups: coarse route planning over a road map, path planning within the observable space, and feedback control to follow the planned path (Paden et al., 2016; Schwarting et al., 2018). For instance, a route planner based on a conventional GPS-based navigation system might output waypoints roughly in the lanes of the desired direction of travel, but not accounting for environmental factors such as the positions of other vehicles. This roughly communicates possibilities of where the vehicle could go, but not when or how it could get to them, or any environmental factors like other vehicles. A goal likelihood from Sec. 2.2 is formed from the route and passed to the planner, which generates a state-space plan according to the optimization in Eq. 1. The resulting plan is fed to a simple PID controller on steering, throttle, and braking. Pseudocode of the driving and inference algorithms are given in Algs 1 and 2. The PID algorithm is given in Appendix A.
|
| 94 |
+
|
| 95 |
+
# 3 RELATED WORK
|
| 96 |
+
|
| 97 |
+
A body of previous work has explored offline IL (Behavior Cloning – BC) in the CARLA simulator (Li et al., 2018; Liang et al., 2018; Sauer et al., 2018; Codevilla et al., 2018; 2019). These BC approaches condition on goals drawn from a small discrete set of directives. Despite BC’s theoretical drift shortcomings (Ross et al., 2011), these methods still perform empirically well. These approaches and ours share the same high-level routing algorithm: an $A ^ { * }$ planner on route nodes that generates waypoints. In contrast to our approach, these approaches use the waypoints in a Waypoint Classifier, which reasons about the map and the geometry of the route to classify the waypoints into one of several directives: {Turn left, Turn right, Follow Lane, Go Straight}. One of the original motivations for
|
| 98 |
+
|
| 99 |
+
Algorithm 1 IMITATIVEDRIVING(ROUTEPLAN, IMITATIVEPLAN, PIDCONTROLLER, $q _ { \theta } , f , p , H )$
|
| 100 |
+
|
| 101 |
+
1: $\phi \mathrm { E N V I R O N M E N T } ( \emptyset )$ {Initialize the robot}
|
| 102 |
+
2: while not at destination do
|
| 103 |
+
3: $\mathcal { G } \gets \mathsf { R o u r r E P L A N } ( \phi )$ {Generate goals from a route}
|
| 104 |
+
4: $\mathbf { s } _ { 1 : T } ^ { \mathcal { G } } \gets \mathrm { I M I T A T I V E P L A N } ( q _ { \theta } , f , p , \mathcal { G } , \phi )$ {Plan path}
|
| 105 |
+
5: for $h = 0$ to $H$ do
|
| 106 |
+
6: u ← PIDCONTROLLER $( \phi , \mathbf { s } _ { 1 : T } ^ { \mathcal { G } } , h , H )$
|
| 107 |
+
7: $\phi \gets \mathrm { E N V I R O N M E N T } ( u )$ {Execute control}
|
| 108 |
+
8: end for
|
| 109 |
+
9: end while
|
| 110 |
+
|
| 111 |
+
# Algorithm 2 IMITATIVEPLAN(qθ, f, p, G, φ)
|
| 112 |
+
|
| 113 |
+
1: Initialize ${ \mathbf z } _ { 1 : T } \sim q _ { 0 }$
|
| 114 |
+
2: while not converged do
|
| 115 |
+
3: $\mathbf { z } _ { 1 : T } \gets \mathbf { z } _ { 1 : T } + \mathbf { \bar { V } } _ { \mathbf { z } _ { 1 : T } } \left[ \log q ( f ( \mathbf { z } _ { 1 : T } ) | \phi ) + \log p ( \mathcal { G } | f ( \mathbf { z } _ { 1 : T } ) , \phi ) \right]$ {Gradient ascent on Eq. 1}
|
| 116 |
+
4: end while
|
| 117 |
+
5: return ${ \bf s } _ { 1 : T } = f ( { \bf z } _ { 1 : T } )$
|
| 118 |
+
|
| 119 |
+
these type of controls was to enable a human to direct the robot (Codevilla et al., 2018). However, in scenarios where there is no human in the loop (i.e. autonomous driving), we advocate for approaches to make use of the detailed spatial information inherent in these waypoints. Our approach and several others we designed make use of this spatial information. One of these is CIL-States (CILS): whereas the approach in Codevilla et al. (2018) uses images to directly generate controls, CILS uses identical inputs and PID controllers as our method. With respect to prior conditional IL methods, our main approach has more flexibility to handle more complex directives post-training, the ability to learn without goal labels, and the ability to generate interpretable planned and unplanned trajectories. These contrasting capabilities are illustrated in Table 1.
|
| 120 |
+
|
| 121 |
+
Our approach is also related to MBRL. MBRL can also plan with a predictive model, but its model only represents possible dynamics. The task of evoking expert-like behavior is offloaded to the reward function, which can be difficult and time-consuming to craft properly. We know of no MBRL approach previously applied to CARLA, so we devised one for comparison. This MBRL approach also uses identical inputs to our method, instead to plan a reachability tree (LaValle, 2006) over an dynamic obstacle-based reward function. See Appendix D for further details of the MBRL and CILS methods, which we emphasize use the same inputs as our method.
|
| 122 |
+
|
| 123 |
+
Several prior works (Tamar et al., 2016; Amos et al., 2018; Srinivas et al., 2018) used imitation learning to train policies that contain planning-like modules as part of the model architecture. While our work also combines planning and imitation learning, ours captures a distribution over possible trajectories, and then plan trajectories at test-time that accomplish a variety of given goals with high probability under this distribution. Our approach is suited to offline-learning settings where interactively collecting data is costly (time-consuming or dangerous). However, there exists online IL approaches that seek to be safe (Menda et al., 2017; Sun et al., 2018; Zhang & Cho, 2017).
|
| 124 |
+
|
| 125 |
+
# 4 EXPERIMENTS
|
| 126 |
+
|
| 127 |
+
We evaluate our method using the CARLA driving simulator (Dosovitskiy et al., 2017). We seek to answer four primary questions: (1) Can we generate interpretable, expert-like plans with offline learning and minimal reward engineering? Neither IL nor MBRL can do so. It is straightforward to interpret the trajectories by visualizing them on the ground plane; we thus seek to validate whether these plans are expert-like by equating expert-like behavior with high performance on the CARLA benchmark. (2) Can we achieve state-of-the-art CARLA performance using resources commonly available in real autonomous vehicle settings? There are several differences between the approaches, as discussed in Sec 3 and shown in Tables 1 and 2. Our approach uses the CARLA toolkit’s resources that are commonly available in real autonomous vehicle settings: waypoint-based routes (all prior approaches use these), LIDAR and traffic-light observations (both are CARLAprovided, but only the approaches we implemented use it). Furthermore, the two additional methods of comparison we implemented (CILS and MBRL) use the exact same inputs as our algorithm. These reasons justify an overall performance comparison to answer (2): whether we can achieve state-of-the-art performance using commonly available resources. We advocate that other approaches also make use of such resources. (3) How flexible is our approach to new tasks? We investigate (3) by applying each of the goal likelihoods we derived and observing the resulting performance. (4) How robust is our approach to error in the provided goals? We do so by injecting two different types of error into the waypoints and observing the resulting performance.
|
| 128 |
+
|
| 129 |
+
Table 1: Desirable attributes of each approach. A green check denotes that a method has a desirable attribute, whereas a red cross denotes the opposite. A “†” indicates an approach we implemented.
|
| 130 |
+
|
| 131 |
+
<table><tr><td>Approach</td><td></td><td>Flexible to New GoalsTrains without goal labelsOutputs PlansTrains OflineHas Expert P.D.F.</td><td></td><td></td><td></td></tr><tr><td>CIRL*(Liang et al., 2018)</td><td>X</td><td>X</td><td>X</td><td>X</td><td>X</td></tr><tr><td>CAL* (Sauer et al.,2018)</td><td>xxxxxν</td><td></td><td></td><td></td><td></td></tr><tr><td>MT*(Li et al.,2018)</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>CIL*(Codevilla et al., 2018)</td><td></td><td></td><td></td><td></td><td>xxx</td></tr><tr><td>CILRS*(Codevilla et al.,2019)</td><td></td><td></td><td></td><td></td><td>X</td></tr><tr><td>CILSt</td><td></td><td>xxxx//</td><td>xxxxx/</td><td></td><td>X</td></tr><tr><td>MBRL†</td><td></td><td></td><td></td><td>X</td><td>X</td></tr><tr><td>Imitative Models (Ours)t</td><td>√</td><td></td><td></td><td></td><td></td></tr><tr><td colspan="6">Table 2: Algorithmic components of each approach. A “t” i indicates an approach we implemented.</td></tr><tr><td>Approach</td><td>Control Algorithm← Learning Algorithm</td><td></td><td>←Goal-Generation Algorithm ←Routing Algorithm</td><td></td><td>High-Dim. Obs.</td></tr><tr><td>CIRL*(Liang et al.,2018)</td><td></td><td></td><td>Waypoint Classifier</td><td>A*Waypointer</td><td></td></tr><tr><td></td><td>Policy</td><td>Behavior Cloning+RL Affordance Learning</td><td>Waypoint Classifier</td><td>A*Waypointer</td><td>Image Image</td></tr><tr><td>CAL*(Sauer et al.,2018) MT*(Li et al., 2018)</td><td>PID Policy</td><td>Behavior Cloning</td><td>Waypoint Classifier</td><td>A*Waypointer</td><td>Image</td></tr><tr><td>CIL*(Codevilla et al., 2018)</td><td>Policy</td><td>Behavior Cloning</td><td>Waypoint Classifier</td><td>A*Waypointer</td><td>Image</td></tr><tr><td>CILRS*(Codevilla et al., 2019)</td><td>Policy</td><td>Behavior Cloning</td><td>Waypoint Classifier</td><td>A*Waypointer</td><td>Image</td></tr><tr><td>CILSt</td><td>PID</td><td>Trajectory Regressor</td><td>Waypoint Classifier</td><td>A*Waypointer</td><td>(LIDAR,入)</td></tr><tr><td>MBRL†</td><td>Reachability Tree</td><td>State Regressor</td><td>Waypoint Selector</td><td>A*Waypointer</td><td>(LIDAR,λ)</td></tr><tr><td>Imitative Models (Ours)†</td><td>Imitative Plan+PID</td><td>Traj. Density Est.</td><td>Goal Likelihoods</td><td>A*Waypointer</td><td>(LIDAR,λ)</td></tr></table>
|
| 132 |
+
|
| 133 |
+
We begin by training $q ( \mathbf { S } | \phi )$ on a dataset of 25 hours of driving we collected in Town01, detailed in Appendix C.2. Following existing protocol, each test episode begins with the vehicle starting in one of a finite set of starting positions provided by the CARLA simulator in Town01 or Town02 maps in one of two settings: static-world (no other vehicles) or dynamic-world (with other vehicles). We ran the same benchmark 3 times across different random seeds to quantify means and their standard errors. We construct the goal set $\mathbb { G }$ for the Final-State Indicator (A) directly from the route output by CARLA’s waypointer. B’s line segments are formed by connecting the waypoints to form a piecewise linear set of segments. C’s regions are created a polygonal goal region around the segments of (B). Each represents an increasing level of coarseness of direction. Coarser directions are easier to specify when there is ambiguity in positions (both the position of the vehicle and the position of the goals). Further details are discussed in Appendix B.3. Visualizations of (C) are shown in Figures 6 and 7. Visualizations of (A) and (B) are shown in Figures 8 and 9. We use three metrics: (a) success rate in driving to the destination without any collisions (which all prior work reports); (b) red-light violations; and (c) proportion of time spent driving in the wrong lane and off road. With the exception of metric (a), lower numbers are better.
|
| 134 |
+
|
| 135 |
+
Results: Towards questions (1) and (3) (expert-like plans and flexibility), we apply our approach with a variety of goal likelihoods to the CARLA simulator. Towards question (2), we compare our methods against CILS, MBRL, and prior work. These results are shown in Table 3. The metrics for the methods we did not implement are from the aggregation reported in Codevilla et al. (2019). We observe our method to outperform all other approaches in all settings: static world, dynamic world, training conditions, and test conditions. We observe the Goal Indicator methods are able to perform well, despite having no hyperparameters to tune. We found that we could further improve our approach’s performance if we use the light state to define different goal sets, which defines a “smart” waypointer. The settings where we use this are suffixed with “S.” in the Tables. We observed the planner prefers closer goals when obstructed, when the vehicle was already stopped, and when a red light was detected; we observed the planner prefers farther goals when unobstructed and when green lights or no lights were observed. Examples of these and other interesting behaviors are best seen in the videos on the website (https://sites.google.com/view/imitative-models). These behaviors follow from the method leveraging $q ( \mathbf { S } | \phi )$ ’s internalization of aspects of expert behavior in order to reproduce them in new situations. Altogether, these results provide affirmative answers to questions (1) and (2). Towards question (3), these results show that our approach is flexible to different directions defined by these goal likelihoods.
|
| 136 |
+
|
| 137 |
+
Table 3: We evaluate different autonomous driving methods on CARLA’s Dynamic Navigation task. A “†” indicates methods we have implemented (each observes the same waypoints and LIDAR as input). A “∗” indicates results reported in Codevilla et al. (2019). A “–” indicates an unreported statistic. A “‡” indicates an optimistic estimate in transferring a result from the static setting to the dynamic setting. “S.” denotes a “smart” waypointer reactive to light state, detailed in Appendix B.2. Results accompanied by standard errors are computed with $N = 3$ trials across environment seeds.
|
| 138 |
+
|
| 139 |
+
<table><tr><td rowspan="2">Dynamic Nav. Method</td><td colspan="4">TownO1 (training conditions)</td><td colspan="4">Town02 (test conditions)</td></tr><tr><td>Success↑</td><td>Ran Red Light↓</td><td>Wrong lane↓</td><td>Off road↓</td><td>Success↑</td><td>Ran Red Light↓</td><td>Wrong lane↓</td><td>Off road↓</td></tr><tr><td>CIRL*(Liang et al., 2018)</td><td>82%</td><td></td><td></td><td></td><td>41%</td><td></td><td></td><td></td></tr><tr><td>CAL*(Sauer et al.,2018)</td><td>83%</td><td></td><td></td><td></td><td>64%</td><td></td><td></td><td></td></tr><tr><td>MT* (Li et al., 2018)</td><td>81%</td><td></td><td></td><td></td><td>53%</td><td></td><td></td><td></td></tr><tr><td>CIL*(Codevilla et al., 2018)</td><td>83%</td><td>83%</td><td></td><td></td><td>38%</td><td>82%t</td><td></td><td></td></tr><tr><td>CILRS*(Codevilla et al., 2019)</td><td>92%</td><td>27%</td><td></td><td></td><td>66%</td><td>64%</td><td></td><td></td></tr><tr><td>CILS,Waypoint Input†</td><td>17%</td><td>0.0%</td><td>0.20%</td><td>12.1%</td><td>36%</td><td>0.0%</td><td>1.11%</td><td>11.70%</td></tr><tr><td>MBRL,Waypoint Input</td><td>64%</td><td>72%</td><td>11.1%</td><td>2.96%</td><td>48%</td><td>54%</td><td>20.6%</td><td>13.3 %</td></tr><tr><td>Ourmethod,RegionFinal-St.IndicatorS.t</td><td>96%±1.9</td><td>0.89%±0.4</td><td>0.05%±0.01</td><td>0.11%±0.01</td><td>88%±3.3</td><td>2.60%±0.04</td><td>0.49%±0.32</td><td>2.60%±1.1</td></tr><tr><td>Ourmethod,RegionFinal-St.Inictor</td><td>93%±2.2</td><td>18%±0.5</td><td>0.023%±0.002</td><td>0.195%±0.004</td><td>81%±2.2</td><td>54.7%±1.5</td><td>0.12%±0.01</td><td>1.32%±0.69</td></tr><tr><td>Ourmethod,LineegmentFinal-St.Indicatort</td><td>91%±1.1</td><td>32%±1.3</td><td>0.055%±0.002</td><td>0.013%±0.001</td><td>88%±3.3</td><td>35.2%±2.4</td><td>0.52%±0.03</td><td>0.18%±0.02</td></tr><tr><td>Ourmethod,Final-StateIndicatort</td><td>92%</td><td>26%</td><td>0.05%</td><td>0.012%</td><td>84%</td><td>35%</td><td>0.13%</td><td>0.38%</td></tr><tr><td>Ourmethod,Gussianinal-t.</td><td>92% 100%</td><td>6.3% 1.7%</td><td>0.04%</td><td>0.005%</td><td>100%</td><td>12%</td><td>0.11%</td><td>0.04%</td></tr><tr><td>Our method, Gaussian Final-St.Mix.S.t</td><td></td><td></td><td>0.03%</td><td>0.005%</td><td>92%</td><td>0.0%</td><td>0.05%</td><td>0.15%</td></tr><tr><td></td><td colspan="4">Town01 (training conditions)</td><td colspan="4">Town02 (test conditions)</td></tr><tr><td>Static Nav. Method</td><td>Success↑</td><td>Ran RedLight↓</td><td>Wrong lane↓</td><td>Off road↓</td><td>Success↑</td><td>Ran RedLight↓</td><td>Wrong lane↓</td><td>Off road↓</td></tr><tr><td>CIRL*(Liang et al., 2018)</td><td>93%</td><td></td><td></td><td></td><td>68%</td><td></td><td></td><td></td></tr><tr><td>CAL*(Sauer et al.,2018)</td><td>92%</td><td></td><td></td><td></td><td>68%</td><td></td><td></td><td></td></tr><tr><td>MT*(Li et al.,2018)</td><td>81%</td><td></td><td></td><td></td><td>78%</td><td></td><td></td><td></td></tr><tr><td>CIL*(Codevilla et al., 2018)</td><td>86%</td><td>83%</td><td></td><td></td><td>44%</td><td>82%</td><td></td><td></td></tr><tr><td>CILRS*(Codevilla et al., 2019)</td><td>95%</td><td>27%</td><td></td><td></td><td>90%</td><td>64%</td><td></td><td></td></tr><tr><td>CILS,Waypoint Inputt</td><td>28%</td><td>0.0%</td><td>0.38%</td><td>10.23%</td><td>36%</td><td>0.0%</td><td>1.69%</td><td>16.82%</td></tr><tr><td>MBRL,Waypoint Input†</td><td>96%</td><td>78%</td><td>14.3%</td><td>1.94%</td><td>96%</td><td>73%</td><td>19.6 %</td><td>0.75%</td></tr><tr><td>Ourmethod,Final-StateIndicatort</td><td>100%</td><td>48%</td><td>0.05%</td><td>0.002%</td><td>100%</td><td>52%</td><td>0.10%</td><td>0.13%</td></tr><tr><td>Our method,GaussianFinal-St. Mixturet</td><td>96%</td><td>0.83%</td><td>0.01%</td><td>0.08%</td><td>96%</td><td>0.0%</td><td>0.03%</td><td>0.14%</td></tr><tr><td>Ourmethod,GaussianFinal-St.ix..t</td><td>96%</td><td>0.0%</td><td>0.04%</td><td>0.07%</td><td>92%</td><td>0.0%</td><td>0.18%</td><td>0.27%</td></tr></table>
|
| 140 |
+
|
| 141 |
+

|
| 142 |
+
Figure 6: Planning with the Region Final State Indicator yields plans that end inside the region. The orange polygon indicates the region. The red circles indicate the chosen plan.
|
| 143 |
+
|
| 144 |
+

|
| 145 |
+
Figure 7: Even with a wider goal region than Fig. 6, the vehicle remains in its lane. Despite their coarseness, these wide goal regions still provide useful guidance to the vehicle.
|
| 146 |
+
|
| 147 |
+
# 4.1 ROBUSTNESS TO ERRORS IN GOAL-SPECIFICATION
|
| 148 |
+
|
| 149 |
+
Towards questions (3) (flexibility) and (4) (noise-robustness), we analyze the performance of our method when the path planner is heavily degraded, to understand its stability and reliability. We use the Gaussian Final-State Mixture goal likelihood.
|
| 150 |
+
|
| 151 |
+
Navigating with high-variance waypoints. As a test of our model’s capability to stay in the distribution of demonstrated behavior, we designed a “decoy waypoints” experiment, in which half of the waypoints are highly perturbed versions of the other half, serving as distractions for our Gaussian Final-State Mixture imitative planner. We observed surprising robustness to decoy waypoints. Examples of this robustness are shown in Fig. 10. In Table 4, we report the success rate and the mean number of planning rounds for failed episodes in the $^ { 6 6 } \%$ distractors” row. These numbers indicate our method can execute dozens of planning rounds without decoy waypoints causing a catastrophic failure, and often it can execute the hundreds necessary to achieve the goal. See Appendix E for details.
|
| 152 |
+
|
| 153 |
+
Navigating with waypoints on the wrong side of the road. We also designed an experiment to test our method under systemic bias in the route planner. Our method is provided waypoints on the wrong side of the road (in CARLA, the left side), and tasked with following the directions of these waypoints while staying on the correct side of the road (the right side). In order for the value of $q ( \mathbf { s } | \boldsymbol { \phi } )$ to outweigh the influence of these waypoints, we increased the $\epsilon$ hyperparameter. We found our method to still be very effective at navigating, and report results in Table 4. We also investigated providing very coarse 8-meter wide regions to the Region Final-State likelihood; these always include space in the wrong lane and off-road (Fig. 7 in Appendix ?? provides visualization). Nonetheless, on Town01 Dynamic, this approach still achieved an overall success rate of $4 8 \%$ . Taken together towards question (4), our results indicate that our method is fairly robust to errors in goal-specification.
|
| 154 |
+
|
| 155 |
+

|
| 156 |
+
Figure 8: Planning with the Final State Indicator yields plans that end at one of the provided locations. Orange diamonds indicate the locations in the goal set. Red circles indicate the chosen plan.
|
| 157 |
+
|
| 158 |
+

|
| 159 |
+
Figure 9: Planning with the Line Segment Final State Indicator yields plans that end along a segment. Orange diamonds indicate line segment endpoints. Red circles indicate the chosen plan.
|
| 160 |
+
|
| 161 |
+

|
| 162 |
+
Figure 10: Tolerating bad goals. The planner prefers goals in the distribution of expert behavior (on the road at a reasonable distance). Left: Planning with $^ 1 / 2$ decoy goals. Right: Planning with all goals on the wrong side of the road.
|
| 163 |
+
Figure 11: Testtime plans steering around potholes.
|
| 164 |
+
|
| 165 |
+
# 4.2 PRODUCING UNOBSERVED BEHAVIORS TO AVOID NOVEL OBSTACLES
|
| 166 |
+
|
| 167 |
+
Table 4: Robustness to waypoint noise and test-time pothole adaptation. Our method is robust to waypoints on the wrong side of the road and fairly robust to decoy waypoints. Our method is flexible enough to safely produce behavior not demonstrated (pothole avoidance) by incorporating a test-time cost. Ten episodes are collected in each Town.
|
| 168 |
+
|
| 169 |
+
<table><tr><td></td><td></td><td colspan="3">Town01 (training conditions)</td><td colspan="3">Town02 (test conditions)</td></tr><tr><td>Waypointer</td><td>Extra Cost</td><td>Success</td><td>Wrong lane</td><td>Potholes hit</td><td>Success</td><td>Wrong lane</td><td>Potholes hit</td></tr><tr><td>Noiseless waypointer</td><td></td><td>100%</td><td>0.00%</td><td>177/230</td><td>100%</td><td>0.41%</td><td>82/154</td></tr><tr><td>Waypoints wrong lane</td><td></td><td>100%</td><td>0.34%</td><td>1</td><td>70%</td><td>3.16%</td><td>二</td></tr><tr><td>1/2 waypoints distracting</td><td></td><td>70%</td><td>1</td><td></td><td>50%</td><td>1</td><td>二</td></tr><tr><td>Noiseless waypointer</td><td>Pothole</td><td>90%</td><td>1.53%</td><td>10/230</td><td>70%</td><td>1.53%</td><td>35/154</td></tr></table>
|
| 170 |
+
|
| 171 |
+
To further investigate our model’s flexibility to test-time objectives (question 3), we designed a pothole avoidance experiment. We simulated potholes in the environment by randomly inserting them in the cost map near waypoints. We ran our method with a test-time-only cost map of the simulated potholes by combining goal likelihoods (F) and (G), and compared to our method that did not incorporate the cost map (using (F) only, and thus had no incentive to avoid potholes). We recorded the number of collisions with potholes. In Table 4, our method with cost incorporated avoided most potholes while avoiding collisions with the environment. To do so, it drove closer to the centerline, and occasionally entered the opposite lane. Our model internalized obstacle avoidance by staying on the road and demonstrated its flexibility to obstacles not observed during training. Fig. 11 shows an example of this behavior. See Appendix F for details of the pothole generation.
|
| 172 |
+
|
| 173 |
+
# 5 DISCUSSION
|
| 174 |
+
|
| 175 |
+
We proposed “Imitative Models” to combine the benefits of IL and MBRL. Imitative Models are probabilistic predictive models able to plan interpretable expert-like trajectories to achieve new goals. Inference with an Imitative Model resembles trajectory optimization in MBRL, enabling it to both incorporate new goals and plan to them at test-time, which IL cannot. Learning an Imitative Model resembles offline IL, enabling it to circumvent the difficult reward-engineering and costly online data collection necessities of MBRL. We derived families of flexible goal objectives and showed our model can successfully incorporate them without additional training. Our method substantially outperformed six IL approaches and an MBRL approach in a dynamic simulated autonomous driving task. We showed our approach is robust to poorly specified goals, such as goals on the wrong side of the road. We believe our method is broadly applicable in settings where expert demonstrations are available, flexibility to new situations is demanded, and safety is paramount. Future work could investigate methods to handle both observation noise and out-of-distribution observations to enhance the applicability to robust real systems — we expand on this issue in Appendix E. Finally, to facilitate more general planning, future work could extend our approach to explicitly reason about all agents in the environment in order to inform a closed-loop plan for the controlled agent.
|
| 176 |
+
|
| 177 |
+
# ACKNOWLEDGEMENTS
|
| 178 |
+
|
| 179 |
+
This research was supported by ONR N000141712623, DARPA Assured Autonomy, ARL DCIST CRA W911NF-17-2-0181, Google, NVIDIA, and Amazon.
|
| 180 |
+
|
| 181 |
+
# REFERENCES
|
| 182 |
+
|
| 183 |
+
Brandon Amos, Ivan Dario Jimenez Rodriguez, Jacob Sacks, Byron Boots, and Zico Kolter. Differentiable MPC for end-to-end planning and control. In Neural Information Processing Systems (NeurIPS), 2018.
|
| 184 |
+
|
| 185 |
+
Felipe Codevilla, Matthias Miiller, Antonio López, Vladlen Koltun, and Alexey Dosovitskiy. Endto-end driving via conditional imitation learning. In International Conference on Robotics and Automation (ICRA), pp. 1–9. IEEE, 2018.
|
| 186 |
+
|
| 187 |
+
Felipe Codevilla, Eder Santana, Antonio M López, and Adrien Gaidon. Exploring the limitations of behavior cloning for autonomous driving. arXiv preprint arXiv:1904.08980, 2019.
|
| 188 |
+
|
| 189 |
+
Marc Deisenroth and Carl E Rasmussen. PILCO: A model-based and data-efficient approach to policy search. In International Conference on Machine Learning (ICML), pp. 465–472, 2011.
|
| 190 |
+
|
| 191 |
+
Alexey Dosovitskiy and Vladlen Koltun. Learning to act by predicting the future. arXiv preprint arXiv:1611.01779, 2016.
|
| 192 |
+
|
| 193 |
+
Alexey Dosovitskiy, German Ros, Felipe Codevilla, Antonio Lopez, and Vladlen Koltun. CARLA: An open urban driving simulator. In Conference on Robot Learning (CoRL), pp. 1–16, 2017.
|
| 194 |
+
|
| 195 |
+
Leonid Kuvayev and Richard S. Sutton. Model-based reinforcement learning with an approximate, learned model. In Yale Workshop on Adaptive and Learning Systems, pp. 101–105, 1996.
|
| 196 |
+
|
| 197 |
+
Balaji Lakshminarayanan, Alexander Pritzel, and Charles Blundell. Simple and scalable predictive uncertainty estimation using deep ensembles. In Neural Information Processing Systems (NeurIPS), pp. 6402–6413, 2017.
|
| 198 |
+
|
| 199 |
+
Steven M LaValle. Planning algorithms. Cambridge University Press, 2006.
|
| 200 |
+
|
| 201 |
+
Sergey Levine. Reinforcement learning and control as probabilistic inference: Tutorial and review. arXiv preprint arXiv:1805.00909, 2018.
|
| 202 |
+
|
| 203 |
+
Zhihao Li, Toshiyuki Motoyoshi, Kazuma Sasaki, Tetsuya Ogata, and Shigeki Sugano. Rethinking self-driving: Multi-task knowledge for better generalization and accident explanation ability. arXiv preprint arXiv:1809.11100, 2018.
|
| 204 |
+
|
| 205 |
+
Xiaodan Liang, Tairui Wang, Luona Yang, and Eric Xing. CIRL: Controllable imitative reinforcement learning for vision-based self-driving. arXiv preprint arXiv:1807.03776, 2018.
|
| 206 |
+
|
| 207 |
+
Kunal Menda, Katherine Driggs-Campbell, and Mykel J Kochenderfer. DropoutDAgger: A Bayesian approach to safe imitation learning. arXiv preprint arXiv:1709.06166, 2017.
|
| 208 |
+
|
| 209 |
+
Aaron van den Oord, Yazhe Li, Igor Babuschkin, Karen Simonyan, Oriol Vinyals, Koray Kavukcuoglu, George van den Driessche, Edward Lockhart, Luis C Cobo, Florian Stimberg, et al. Parallel WaveNet: Fast high-fidelity speech synthesis. arXiv preprint arXiv:1711.10433, 2017.
|
| 210 |
+
|
| 211 |
+
Brian Paden, Michal Cáp, Sze Zheng Yong, Dmitry Yershov, and Emilio Frazzoli. A survey of ˇ motion planning and control techniques for self-driving urban vehicles. Transactions on Intelligent Vehicles, 1(1):33–55, 2016.
|
| 212 |
+
|
| 213 |
+
Danilo Rezende and Shakir Mohamed. Variational inference with normalizing flows. In International Conference on Machine Learning (ICML), pp. 1530–1538, 2015.
|
| 214 |
+
|
| 215 |
+
Nicholas Rhinehart, Kris M. Kitani, and Paul Vernaza. R2P2: A reparameterized pushforward policy for diverse, precise generative path forecasting. In European Conference on Computer Vision (ECCV), September 2018.
|
| 216 |
+
|
| 217 |
+
Stéphane Ross, Geoffrey Gordon, and Drew Bagnell. A reduction of imitation learning and structured prediction to no-regret online learning. In Artificial Intelligence and Statistics (AISTATS), pp. 627–635, 2011.
|
| 218 |
+
|
| 219 |
+
Andrey Rudenko, Luigi Palmieri, Michael Herman, Kris M Kitani, Dariu M Gavrila, and Kai O Arras. Human motion trajectory prediction: A survey. arXiv preprint arXiv:1905.06113, 2019.
|
| 220 |
+
|
| 221 |
+
Axel Sauer, Nikolay Savinov, and Andreas Geiger. Conditional affordance learning for driving in urban environments. arXiv preprint arXiv:1806.06498, 2018.
|
| 222 |
+
|
| 223 |
+
Wilko Schwarting, Javier Alonso-Mora, and Daniela Rus. Planning and decision-making for autonomous vehicles. Annual Review of Control, Robotics, and Autonomous Systems, 1:187–210, 2018.
|
| 224 |
+
|
| 225 |
+
Aravind Srinivas, Allan Jabri, Pieter Abbeel, Sergey Levine, and Chelsea Finn. Universal planning networks: Learning generalizable representations for visuomotor control. In International Conference on Machine Learning (ICML), pp. 4739–4748, 2018.
|
| 226 |
+
|
| 227 |
+
Liting Sun, Cheng Peng, Wei Zhan, and Masayoshi Tomizuka. A fast integrated planning and control framework for autonomous driving via imitation learning. In Dynamic Systems and Control Conference. American Society of Mechanical Engineers, 2018.
|
| 228 |
+
|
| 229 |
+
Aviv Tamar, Yi Wu, Garrett Thomas, Sergey Levine, and Pieter Abbeel. Value iteration networks. In Neural Information Processing Systems (NeurIPS), pp. 2154–2162, 2016.
|
| 230 |
+
|
| 231 |
+
Emanuel Todorov. Linearly-solvable Markov decision problems. In Neural Information Processing Systems (NeurIPS), pp. 1369–1376, 2007.
|
| 232 |
+
|
| 233 |
+
Jiakai Zhang and Kyunghyun Cho. Query-efficient imitation learning for end-to-end simulated driving. In Association for the Advancement of Artificial Intelligence (AAAI), pp. 2891–2897, 2017.
|
| 234 |
+
|
| 235 |
+
# A ALGORITHMS
|
| 236 |
+
|
| 237 |
+
In Algorithm 1, we provided pseudocode for receding-horizon control via our imitative model. In Algorithm 2 we provided pesudocode that describes how we plan in the latent space of the trajectory. In Algorithm 3, we detail the speed-based throttle and position-based steering PID controllers.
|
| 238 |
+
|
| 239 |
+
$$
|
| 240 |
+
\mathbf { A l g o r i t h m 3 } \quad \mathbf { P I D C O N T R O L L E R } ( \phi = \left\{ \mathbf { s } _ { 0 } , \mathbf { s } _ { - 1 } , \ldots \right\} , \mathbf { s } _ { 1 : T } ^ { \mathcal { G } } , h , H ; K _ { p } ^ { \dot { s } } , K _ { p } ^ { \alpha } )
|
| 241 |
+
$$
|
| 242 |
+
|
| 243 |
+
1: $i T - H + h$ {Compute the index of the target position}
|
| 244 |
+
2: s˙process-speed $ ( \mathbf { s } _ { 0 , x } - \mathbf { s } _ { - 1 , x } )$ {Compute the current forward speed from the observations}
|
| 245 |
+
3: $s _ { \mathrm { s e t p o i n t - p o s i t i o n } } \mathbf { s } _ { i , x } ^ { \mathcal { G } }$ {Retrieve the target position $\mathbf { X }$ -coordinate from the plan}
|
| 246 |
+
4: $\dot { s } _ { \mathrm { s e t p o i n t - s p e e d } } s _ { \mathrm { s e t p o i n t - p o s i t i o n } } \Big / i$ {Compute the forward target speed}
|
| 247 |
+
5: $e _ { \dot { s } } \gets \dot { s } _ { \mathrm { s e t p o i n t - s p e e d } } - \dot { s } _ { \mathrm { p r o c e } }$ ss-speed {Compute the forward speed error} 6: $u _ { \dot { s } } \gets K _ { p } ^ { \dot { s } } e _ { \dot { s } }$ {Compute the accelerator control with a nonzero proportional term} 7: throttle $\iff \mathbb { 1 } ( e > 0 ) \cdot u + \mathbb { 1 } ( e \leq 0 ) \cdot 0$ {Use the control as throttle if the speed error is positive}
|
| 248 |
+
8: brake $ \mathbb { 1 } ( e > 0 ) \cdot 0 + \mathbb { 1 } ( e \leq 0 ) \cdot u$ {Use the control as brake if the speed error is negative}
|
| 249 |
+
9: 10: 11: $\boldsymbol { \iota } _ { \mathrm { p r o c e s s } } \gets \arctan ( \mathbf { s } _ { 0 , y } - \mathbf { s } _ { - 1 , y } , \mathbf { s } _ { 0 , x } - \mathbf { s } _ { - 1 , x } )$ {Compute current heading}{Compute target forward heading}g error} $\alpha _ { \mathrm { s e t p o i n t } } \arctan ( \mathbf { s } _ { i , y } ^ { \mathcal { G } } - \mathbf { s } _ { 0 , y } , | \mathbf { s } _ { i , x } ^ { \mathcal { G } } - \mathbf { s } _ { 0 , x } | ) _ { . }$ $e _ { \alpha } \gets \alpha _ { \mathrm { s e t p o i n t } } - \alpha _ { \mathrm { p r o c } }$
|
| 250 |
+
12: steering $\ L _ { \ S } K _ { p } ^ { \alpha } e _ { \alpha }$ {Compute the steering with a nonzero proportional term}
|
| 251 |
+
13: $u \gets$ [throttle, steering, brake]
|
| 252 |
+
14: return $u$
|
| 253 |
+
|
| 254 |
+
# A.1 LATENT PLAN OPTIMIZATION
|
| 255 |
+
|
| 256 |
+
Since $\mathbf { s } _ { 1 : T } = f ( \mathbf { z } _ { 1 : T } )$ in our implementation, and $f$ is differentiable, we can perform gradient descent of the same objective in terms of $\mathbf { z } _ { 1 : T }$ , as shown in Algorithm 2.Since $q$ is trained with $\mathbf { z } _ { 1 : T } \sim \mathcal { N } ( 0 , I )$ , the latent space is likelier to be better numerically conditioned than the space of $\mathbf { s } _ { 1 : T }$ , although we did not compare the two approaches formally. We implemented the following optimizations to improve this procedure’s output and practical run time. 1) We started with $N = 1 2 0$ different $\mathbf { z }$ initializations, optimized them in batch, and returned the highest-scoring value across the entire optimization. 2) We observed the resulting planning procedure to usually converge quickly, so instead of specifying a convergence threshold, we simply ran the optimization for a small number of steps, $M = 1 0$ , and found that we obtained good performance. Better performance could be obtained by performing a larger number of steps.
|
| 257 |
+
|
| 258 |
+
# B GOAL DETAILS
|
| 259 |
+
|
| 260 |
+
# B.1 OPTIMIZING GOAL LIKELIHOODS WITH SET CONSTRAINTS
|
| 261 |
+
|
| 262 |
+
We now derive an approach to optimize our main objective with set constraints. Although we could apply a constrained optimizer, we find that we are able to exploit properties of the model and constraints to derive differentiable objectives that enable approximate optimization of the corresponding closed-form optimization problems. These enable us to use the same straightforward gradient-descent-based optimization approach described in Algorithm 2.
|
| 263 |
+
|
| 264 |
+
Shorthand notation: In this section we omit dependencies on $\phi$ for brevity, and use short hand $\mu _ { t } \doteq \mu _ { \theta } \bigl ( \mathbf { s } _ { 1 : t - 1 } \bigr )$ and $\Sigma _ { t } \doteq \Sigma _ { \theta } \bigl ( \mathbf { s } _ { 1 : t - 1 } \bigr )$ . For example, $q ( \mathbf { s } _ { t } | \mathbf { s } _ { 1 : t - 1 } ) = \mathcal { N } \left( \mathbf { s } _ { t } ; \mu _ { t } , \Sigma _ { t } \right)$ .
|
| 265 |
+
|
| 266 |
+
Let us begin by defining a useful delta function:
|
| 267 |
+
|
| 268 |
+
$$
|
| 269 |
+
\delta _ { \mathbf { s } _ { T } } ( \mathbb { G } ) \doteq { \left\{ \begin{array} { l l } { 1 } & { { \mathrm { i f ~ } } \mathbf { s } _ { T } \in \mathbb { G } } \\ { 0 } & { { \mathrm { i f ~ } } \mathbf { s } _ { T } \notin \mathbb { G } , } \end{array} \right. }
|
| 270 |
+
$$
|
| 271 |
+
|
| 272 |
+
which serves as our goal likelihood when using goal with set constraints: $p ( \mathcal { G } | \mathbf { s } _ { 1 : T } ) \gets \delta _ { S _ { T } } ( \mathbb { G } )$ . We now derive the corresponding maximum a posteriori optimization problem:
|
| 273 |
+
|
| 274 |
+
$$
|
| 275 |
+
\begin{array} { r l } { \mathbf { f } _ { \perp \perp } } & { = \frac { \lambda _ { \mathrm { R } } \tau } { \lambda _ { \mathrm { R } } \tau } \exp \{ ( \mathbf { J } _ { \perp \perp } \cdot \boldsymbol { F } _ { \perp } ) \cdot \boldsymbol { F } _ { \perp \perp } ^ { \perp } \} } \\ & { = \frac { \lambda _ { \mathrm { R } } \tau } { \lambda _ { \mathrm { R } } \tau } \exp \lambda _ { \mathrm { R } } \{ [ \mathbf { S } _ { \parallel } \cdot \mathbf { u } _ { \mathrm { L } } \cdot \boldsymbol { F } _ { \perp } ] \cdot \boldsymbol { F } _ { \perp } ^ { \perp } \} } \\ & { = \frac { \lambda _ { \mathrm { R } } \tau } { \lambda _ { \mathrm { R } } \tau } \exp \lambda _ { \mathrm { R } } \{ [ \mathbf { J } _ { \perp \perp } \cdot \boldsymbol { F } _ { \perp } ] \cdot \boldsymbol { F } _ { \perp } ^ { \perp } \} } \\ & { = \frac { \lambda _ { \mathrm { R } } \tau } { \lambda _ { \mathrm { R } } \tau } \exp \lambda _ { \mathrm { R } } \{ [ \mathbf { J } _ { \perp \perp } \cdot \boldsymbol { F } _ { \perp } ] \cdot \boldsymbol { F } _ { \perp } ^ { \perp } \} } \\ & { = \frac { \lambda _ { \mathrm { R } } \tau } { \lambda _ { \mathrm { R } } \tau } \exp \lambda _ { \mathrm { R } } \exp \lambda _ { \mathrm { R } } \exp \lambda _ { \mathrm { R } } \exp \lambda _ { \mathrm { R } } } \\ & { = \frac { \lambda _ { \mathrm { R } } \tau } { \lambda _ { \mathrm { R } } \tau } \exp \lambda _ { \mathrm { R } } \{ [ \mathbf { J } _ { \perp \perp } \cdot \boldsymbol { F } _ { \perp } ] \cdot \frac { \boldsymbol { F } _ { \perp } \lambda _ { \mathrm { R } } ^ { \perp } } { \lambda _ { \mathrm { R } } ^ { \perp } \sin { \mathrm { R } } } } \\ & { = \frac { \lambda _ { \mathrm { R } } \tau } { \lambda _ { \mathrm { R } } \tau } \exp \lambda _ { \mathrm { R } } \{ \mathbf { J } _ { \perp \perp } \cdot \boldsymbol { F } _ { \perp } \} } \\ & = \frac { \lambda _ { \mathrm { R } } \tau } { \lambda _ { \mathrm { R } } \tau } \exp \lambda _ { \mathrm { R } } \{ \mathbf { J } _ { \perp } \cdot \mathbf { J } _ { \perp } \end{array}
|
| 276 |
+
$$
|
| 277 |
+
|
| 278 |
+
By exploiting the fact that $q ( \mathbf { s } _ { T } | \mathbf { s } _ { 1 : T - 1 } ) = \mathcal { N } \left( \mathbf { s } _ { T } ; \mu _ { T } , \Sigma _ { T } \right)$ , we can derive closed-form solutions for
|
| 279 |
+
|
| 280 |
+
$$
|
| 281 |
+
\mathbf { s } _ { T } ^ { * } \ = \ \underset { \mathbf { s } _ { T } \in \mathbb { G } } { \arg \operatorname* { m a x } } \ \mathcal { N } \left( \mathbf { s } _ { T } ; \mu _ { T } , \Sigma _ { T } \right)
|
| 282 |
+
$$
|
| 283 |
+
|
| 284 |
+
when $\mathbb { G }$ has special structure, which enables us to apply gradient descent to solve this constrainedoptimization problem (examples below). With a closed form solution to equation 6, we can easily compute equation 5 using unconstrained-optimization as follows:
|
| 285 |
+
|
| 286 |
+
$$
|
| 287 |
+
\begin{array} { r l } & { { \bf s } _ { 1 : T } ^ { * } = \underset { { \bf s } _ { 1 : T - 1 } \in \mathbb { R } ^ { 2 ( T - 1 ) } { \bf s } _ { T } \in \mathbb { G } _ { \mathrm { i n e - s e g m a x } } } { \arg \operatorname* { m a x } } q ( { \bf s } _ { T } | { \bf s } _ { 1 : T - 1 } ) \prod _ { t = 1 } ^ { T - 1 } q ( { \bf s } _ { t } | { \bf s } _ { 1 : t - 1 } ) } \\ & { { \bf s } _ { 1 : T - 1 } ^ { * } = \underset { { \bf s } _ { 1 : T - 1 } \in \mathbb { R } ^ { 2 ( T - 1 ) } } { \arg \operatorname* { m a x } } q ( { \bf s } _ { T } ^ { * } | { \bf s } _ { 1 : t - 1 } ) \prod _ { t = 1 } ^ { T - 1 } q ( { \bf s } _ { t } | { \bf s } _ { 1 : t - 1 } ) . } \end{array}
|
| 288 |
+
$$
|
| 289 |
+
|
| 290 |
+
Note that equation 8 only helps solve equation 5 if equation 6 has a closed-form solution. We detail example of goal-sets with such closed-form solutions in the following subsections.
|
| 291 |
+
|
| 292 |
+
# B.1.1 POINT GOAL-SET
|
| 293 |
+
|
| 294 |
+
The solution to equation 6 in the case of a single desired goal $g \in \mathbb { R } ^ { D }$ is simply:
|
| 295 |
+
|
| 296 |
+
$$
|
| 297 |
+
\begin{array} { r l } { \mathbb { G } _ { \mathrm { p o i n t } } ~ \doteq ~ \{ \mathbf { g } _ { T } \} , } & { } \\ { \mathbf { s } _ { T , \mathrm { p o i n t } } ^ { * } ~ \doteq ~ \mathrm { a r g } \operatorname* { m a x } \mathcal { N } \left( \mathbf { s } _ { T } ; \mu _ { T } , \boldsymbol { \Sigma } _ { T } \right) } & { } \\ & { ~ \mathbf { s } _ { T } \in \mathbb { G } _ { \mathrm { p o i n t } } } \\ { ~ } & { = ~ \mathbf { g } _ { T } . } \end{array}
|
| 298 |
+
$$
|
| 299 |
+
|
| 300 |
+
More generally, multiple point goals help define optional end points for planning: where the agent only need reach one valid end point (see Fig. 8 for examples), formulated as:
|
| 301 |
+
|
| 302 |
+
$$
|
| 303 |
+
\begin{array} { r c l } { \displaystyle \mathbb { G } _ { \mathrm { p o i n t s } } } & { \doteq } & { \displaystyle \{ \mathbf { g } _ { T } ^ { k } \} _ { k = 1 } ^ { K } , } \\ { \displaystyle \mathbf { s } _ { T , \mathrm { p o i n t s } } ^ { * } } & { \stackrel { \cdot } { = } } & { \arg \operatorname* { m a x } _ { T } \mathcal { N } \left( \mathbf { g } _ { T } ^ { k } ; \boldsymbol { \mu } _ { T } , \boldsymbol { \Sigma } _ { T } \right) . } \end{array}
|
| 304 |
+
$$
|
| 305 |
+
|
| 306 |
+
# B.1.2 LINE-SEGMENT GOAL-SET
|
| 307 |
+
|
| 308 |
+
We can form a goal-set as a finite-length line segment, connecting point $\mathbf { a } \in \mathbb { R } ^ { D }$ to point $\mathbf { b } \in \mathbb { R } ^ { D }$ :
|
| 309 |
+
|
| 310 |
+
$$
|
| 311 |
+
\begin{array} { r l } { g _ { \mathrm { l i n e } } ( u ) } & { \doteq \mathbf { a } + u \cdot ( \mathbf { b } - \mathbf { a } ) , ~ u \in \mathbb { R } , } \\ { \mathbb { G } _ { \mathrm { l i n e - s e g m e n t } } ^ { \mathbf { a } \to \mathbf { b } } } & { \doteq \{ g _ { \mathrm { l i n e } } ( u ) : u \in [ 0 , 1 ] \} . } \end{array}
|
| 312 |
+
$$
|
| 313 |
+
|
| 314 |
+
The solution to equation 6 in the case of line-segment goals is:
|
| 315 |
+
|
| 316 |
+
$$
|
| 317 |
+
\begin{array} { r l } & { \mathbf { s } _ { T , \mathrm { l i n e - s e g m e n t } } ^ { * } \ \doteq \ \underset { \mathbf { s } _ { T } \in \mathbb { G } _ { \mathrm { l i n e - s e m e n t } } ^ { \mathrm { a v } } } { \arg \operatorname* { m a x } } \ N \left( \mathbf { s } _ { T } ; \mu _ { T } , \Sigma _ { T } \right) } \\ & { \quad \quad \quad \quad \quad \quad \quad = \ \mathbf { a } + \operatorname* { m i n } \left( 1 , \ \operatorname* { m a x } \left( 0 , \ \frac { ( \mathbf { b } - \mathbf { a } ) ^ { \top } \Sigma _ { T } ^ { - 1 } ( \mu _ { T } - \mathbf { a } ) } { ( \mathbf { b } - \mathbf { a } ) ^ { \top } \Sigma _ { T } ^ { - 1 } ( \mathbf { b } - \mathbf { a } ) } \right) \right) \cdot ( \mathbf { b } - \mathbf { a } ) . } \end{array}
|
| 318 |
+
$$
|
| 319 |
+
|
| 320 |
+
# Proof:
|
| 321 |
+
|
| 322 |
+
To solve equation 15 is to find which point along the line $g _ { \mathrm { l i n e } } ( u )$ maximizes $\mathcal { N } ( \cdot ; \mu _ { T } , \Sigma _ { T } )$ subject to the constraint $0 \leq u \leq 1$ :
|
| 323 |
+
|
| 324 |
+
$$
|
| 325 |
+
\begin{array} { r l } & { u ^ { * } \ \doteq \ \underset { u \in [ 0 , 1 ] } { \arg \operatorname* { m a x } } \ \mathcal { N } \left( g _ { \mathrm { l i n e } } ( u ) ; \boldsymbol { \mu } _ { T } , \Sigma _ { T } \right) ) } \\ & { \quad = \ \underset { u \in [ 0 , 1 ] } { \arg \operatorname* { m i n } } \ \underbrace { \left( g _ { \mathrm { l i n e } } ( u ) - \boldsymbol { \mu } _ { T } \right) ^ { \top } \Sigma _ { T } ^ { - 1 } ( g _ { \mathrm { l i n e } } ( u ) - \boldsymbol { \mu } _ { T } ) } _ { \mathcal { L } _ { u } ( u ) } . } \end{array}
|
| 326 |
+
$$
|
| 327 |
+
|
| 328 |
+
Since $\mathcal { L } _ { u }$ is convex, the optimal value $u ^ { * }$ is value closest to the unconstrained arg max of $\mathcal { L } _ { u } ( u )$ , subject to $0 \leq u \leq 1$ :
|
| 329 |
+
|
| 330 |
+
$$
|
| 331 |
+
\begin{array} { r l } & { u _ { \mathbb { R } } ^ { * } \doteq \underset { u \in \mathbb { R } } { \arg \operatorname* { m a x } } \mathcal { L } _ { u } ( u ) , } \\ & { u ^ { * } = \underset { u \in [ 0 , 1 ] } { \arg \operatorname* { m i n } } \mathcal { L } _ { u } ( u ) } \\ & { \quad = \underset { \quad \operatorname* { m i n } \big ( 1 , \ : \operatorname* { m a x } \big ( 0 , \ : u _ { \mathbb { R } } ^ { * } \big ) \big ) . } { \operatorname* { m i n } } } \end{array}
|
| 332 |
+
$$
|
| 333 |
+
|
| 334 |
+
We now solve for $u _ { \mathbb { R } } ^ { * }$
|
| 335 |
+
|
| 336 |
+
$$
|
| 337 |
+
\begin{array} { r l } & { u _ { \mathbb { R } } ^ { * } = u : 0 = \frac { \mathrm { d } \mathcal { L } ( u ) } { \mathrm { d } u } = \frac { \mathrm { d } \left( \left( g _ { \mathrm { l i n e } } ( u ) - \mu _ { T } \right) ^ { \top } \Sigma _ { T } ^ { - 1 } \left( g _ { \mathrm { l i n e } } ( u ) - \mu _ { T } \right) \right) } { \mathrm { d } u } } \\ & { \phantom { \quad \quad \quad } = 2 \cdot \frac { \mathrm { d } \left( g _ { \mathrm { l i n e } } ( u ) - \mu _ { T } \right) ^ { \top } } { \mathrm { d } u } \Sigma _ { T } ^ { - 1 } ( g _ { \mathrm { l i n e } } ( u ) - \mu _ { T } ) } \\ & { \phantom { \quad \quad \quad \quad } = 2 \cdot \frac { \mathrm { d } \left( \mathbf { a } + u \cdot \left( \mathbf { b } - \mathbf { a } \right) - \mu _ { T } \right) ^ { \top } } { \mathrm { d } u } \Sigma _ { T } ^ { - 1 } ( \mathbf { a } + u \cdot ( \mathbf { b } - \mathbf { a } ) - \mu _ { T } ) } \\ & { \phantom { \quad \quad \quad \quad } = 2 \cdot ( \mathbf { b } - \mathbf { a } ) ^ { \top } \Sigma _ { T } ^ { - 1 } \left( \mathbf { a } + u \cdot ( \mathbf { b } - \mathbf { a } ) - \mu _ { T } \right) , } \\ & { \quad \quad \quad u _ { \mathbb { R } } ^ { * } = \frac { \left( \mathbf { b } - \mathbf { a } \right) ^ { \top } \Sigma _ { T } ^ { - 1 } \left( \mu _ { T } - \mathbf { a } \right) } { \left( \mathbf { b } - \mathbf { a } \right) ^ { \top } \Sigma _ { T } ^ { - 1 } \left( \mathbf { b } - \mathbf { a } \right) } , } \end{array}
|
| 338 |
+
$$
|
| 339 |
+
|
| 340 |
+
which gives us:
|
| 341 |
+
|
| 342 |
+
$$
|
| 343 |
+
\begin{array} { r l } & { \mathbf { s } _ { T , \mathrm { l i n e - s e g m e n t } } ^ { * } \ = \ g _ { \mathrm { l i n e } } ( u ^ { * } ) } \\ & { \ = \ \mathbf { a } + u ^ { * } \cdot ( \mathbf { b } - \mathbf { a } ) } \\ & { \ = \ \mathbf { a } + \operatorname* { m i n } \big ( 1 , \ \operatorname* { m a x } \big ( 0 , \ u _ { \mathtt { R } } ^ { * } \big ) \big ) \cdot ( \mathbf { b } - \mathbf { a } ) } \\ & { \ = \ \mathbf { a } + \operatorname* { m i n } \bigg ( 1 , \ \operatorname* { m a x } \bigg ( 0 , \ \frac { \big ( \mathbf { b } - \mathbf { a } \big ) ^ { \top } \Sigma _ { T } ^ { - 1 } ( \mu _ { T } - \mathbf { a } ) } { \big ( \mathbf { b } - \mathbf { a } \big ) ^ { \top } \Sigma _ { T } ^ { - 1 } ( \mathbf { b } - \mathbf { a } ) } \bigg ) \bigg ) \cdot ( \mathbf { b } - \mathbf { a } ) . } \end{array}
|
| 344 |
+
$$
|
| 345 |
+
|
| 346 |
+
# B.1.3 MULTIPLE-LINE-SEGMENT GOAL-SET:
|
| 347 |
+
|
| 348 |
+
More generally, we can combine multiple line-segments to form piecewise linear “paths” we wish y defining a path that con select the optimal segment $\left( \mathbf { p } _ { 0 } , \mathbf { p } _ { 1 } , . . . , \mathbf { p } _ { N } \right)$ , we can e segment aluate ’s sol $\mathcal { L } _ { u } ^ { i }$ forn to chto
|
| 349 |
+
$\mathbb { G } _ { \mathsf { l i n e - s e o m e n t } } ^ { \mathbf { p } _ { i } \to \mathbf { p } _ { i + 1 } }$ $i ^ { * } = \arg \operatorname* { m a x } _ { i } \mathcal { L } _ { u } ^ { i }$ $i ^ { * }$ $u ^ { * }$ $s _ { T } ^ { * }$
|
| 350 |
+
|
| 351 |
+
# B.1.4 POLYGON GOAL-SET
|
| 352 |
+
|
| 353 |
+
Instead of a route or path, a user (or program) may wish to provide a general region the agent should go to, and state within that region being equally valid. Polygon regions (including both boundary and interior) offer closed form solution to equation 6 and are simple to specify. A polygon can be specified by an ordered sequence of vertices $( { \bf p } _ { 0 } , { \bf p } _ { 1 } , . . . , { \bf p } _ { N } ) \in \bar { \mathbb { R } } ^ { N \times 2 }$ . Edges are then defined as the sequence of line-segments between successive vertices (and a final edge between first and last vertex): $\big ( \big ( \mathbf { p } _ { 0 } , \mathbf { p } _ { 1 } \big ) , . . . , \big ( \mathbf { p } _ { N - 1 } , \mathbf { p } _ { N } \big ) , \big ( \mathbf { p } _ { N } , \mathbf { p } _ { 0 } \big ) \big )$ . Examples shown in Fig. 6 and 7.
|
| 354 |
+
|
| 355 |
+
Solving equation 6 with a polygon has two cases: depending whether $\mu _ { T }$ is inside the polygon, or outside. If $\mu _ { T }$ lies inside the polygon, then the optimal value for $\mathbf { s } _ { T } ^ { * }$ that maximizes $\mathcal { N } ( \mathbf { s } _ { T } ^ { * } ; \mu _ { T } , \boldsymbol { \Sigma _ { T } } )$ is simply $\mu _ { T }$ : the mode of the Gaussian distribution. Otherwise, if $\mu _ { T }$ lies outside the polygon, then the optimal value $\mathbf { s } _ { T } ^ { \ast }$ will lie on one of the polygon’s edges, solved using B.1.3.
|
| 356 |
+
|
| 357 |
+
# B.2 WAYPOINTER DETAILS
|
| 358 |
+
|
| 359 |
+
The waypointer uses the CARLA planner’s provided route to generate waypoints. In the constrainedbased planning goal likelihoods, we use this route to generate waypoints without interpolating between them. In the relaxed goal likelihoods, we interpolate this route to every 2 meters, and use the first 20 waypoints. As mentioned in the main text, one variant of our approach uses a “smart” waypointer. This waypointer simply removes nearby waypoints closer than 5 meters from the vehicle when a green light is observed in the measurements provided by CARLA, to encourage the agent to move forward, and removes far waypoints beyond 5 meters from the vehicle when a red light is observed in the measurements provided by CARLA. Note that the performance differences between our method without the smart waypointer and our method with the smart waypointer are small: the only signal in the metrics is that the smart waypointer improves the vehicle’s ability to stop for red lights, however, it is quite adept at doing so without the smart waypointer.
|
| 360 |
+
|
| 361 |
+
# B.3 CONSTRUCTING GOAL SETS
|
| 362 |
+
|
| 363 |
+
Given the in-lane waypoints generated by CARLA’s route planner, we use these to create Point goal sets, Line-Segment goal sets, and Polygon Goal-Sets, which respectively correspond to the (A) Final-State Indicator, (B) Line-Segment Final-State Indicator, and (C) Final-State Region Indicator described in Section 2.2. For (A), we simply feed the waypoints directly into the Final-State Indicator, which results in a constrained optimization to ensure that the vehicle’s current position in the goal set, in order to allo $S _ { T } \in \mathbb { G } \overset { \cdot } { = } \{ g _ { T } ^ { k } \} _ { k = 1 } ^ { K }$ . We also includeddient-descent based optimization is then formed from combining Eq. 8 with Eq. 12. The gradient to the nearest goal of the final state of the partially-optimized plan encourage the optimization to move the plan closer to that goal. We used $K = 1 0$ . We applied the same procedure to generate the goal set for the (B) Line Segment indicator, as the waypoints returned by the planner are ordered. Finally, for the (C) Final-State Region Indicator (polygon), we used the ordered waypoints as the “skeleton” of a polygon that surrounds. It was created by adding a two vertices for each point $\mathbf { v } _ { t }$ in the skeleton at a distance 1 meter from $\mathbf { v } _ { t }$ perpendicular to the segment connecting the surrounding points $\left( \mathbf { v } _ { t - 1 } , \mathbf { v } _ { t + 1 } \right)$ . This resulted in a goal set $\mathbb { G } _ { \mathrm { p o l y g o n } } \supset \mathbb { G } _ { \mathrm { l i n e - s e g m e n t } } .$ , as it surrounds the line segments. The (F) Gaussian Final-State Mixture goal set was constructed in the same way as (A), and also used when the pothole costs were added.
|
| 364 |
+
|
| 365 |
+
For the methods we implemented, the task is to drive the furthest road location from the vehicle’s initial position. Note that this protocol more difficult than the one used in prior work Codevilla et al. (2018); Liang et al. (2018); Sauer et al. (2018); Li et al. (2018); Codevilla et al. (2019), which has no distance guarantees between start positions and goals, and often results in shorter paths.
|
| 366 |
+
|
| 367 |
+
# C ARCHITECTURE AND TRAINING DETAILS
|
| 368 |
+
|
| 369 |
+
The architecture of $q ( \mathbf { S } | \phi )$ is shown in Table 5.
|
| 370 |
+
|
| 371 |
+
# C.1 PRIOR VISUALIZATION AND STATISTICS
|
| 372 |
+
|
| 373 |
+
We show examples of the priors multimodality in Fig. 13
|
| 374 |
+
|
| 375 |
+

|
| 376 |
+
Figure 12: Architecture of $m _ { \theta }$ and $\sigma _ { \theta }$ , which parameterize $q _ { \theta } ( \mathbf { S } | \phi = \{ \chi , \mathbf { s } _ { - \tau : 0 } , \lambda \} )$ . Inputs: LIDAR $\chi$ , past-states ${ \bf s } _ { - \tau : 0 }$ , light-state $\lambda$ , and latent noise $\mathbf { Z } _ { 1 : T }$ . Output: trajectory $\mathbf { S } _ { 1 : T }$ . Details in Appendix C.
|
| 377 |
+
|
| 378 |
+
Table 5: Detailed Architecture that implements $\mathbf { s } _ { 1 : T } = f ( \mathbf { z } _ { 1 : T } , \phi )$ . Typically, $T = 4 0$ , $D = 2 , H =$ $W = 2 0 0$ .
|
| 379 |
+
|
| 380 |
+
<table><tr><td></td><td>ComponentInput [dimensionality]Layer or Operation</td><td></td><td>Output [dimensionality]</td><td>Details</td></tr><tr><td colspan="5">Static featurizationofcontext:={x,s:A}.</td></tr><tr><td>MapFeat</td><td>x[H,W,2]</td><td>2D Convolution</td><td>1x[H,W,32]</td><td>3 ×3 stride 1,ReLu</td></tr><tr><td>MapFeat</td><td>1-1x[H,W,32]</td><td>2D Convolution</td><td>x[H,W,32]</td><td>3 × 3 stride 1,ReLu,i∈[2,...,8]</td></tr><tr><td>MapFeat</td><td>8x[H,W,32]</td><td>2D Convolution</td><td>r[H,W,8]</td><td>3 × 3 stride 1,ReLu</td></tr><tr><td>PastRNN</td><td>S-T:0[T+1,D]</td><td>RNN</td><td>[32]</td><td>GRU across time dimension</td></tr><tr><td colspan="5">Dynamic generation via loop:fort∈{0,...,T-1}.</td></tr><tr><td>MapFeat</td><td>s[D]</td><td>Interpolate</td><td>t=F(st)[8]</td><td>Differentiable interpolation</td></tr><tr><td>JointFeat</td><td>t,S0,²n,</td><td>s0²n田a入</td><td>pt [D+50+32+1]</td><td>Concatenate ()</td></tr><tr><td>FutureRNN</td><td>pt[D+50+32+1]</td><td>RNN</td><td>pt[50]</td><td>GRU</td></tr><tr><td>FutureMLP</td><td>1pt[50]</td><td>Affine (FC)</td><td>2pt[200]</td><td>Tanh activation</td></tr><tr><td>FutureMLP</td><td>2pt[200]</td><td>Affine (FC)</td><td>mt [D],εt [D,D]</td><td>Identity activation</td></tr><tr><td>MatrixExp</td><td>[D,D]</td><td></td><td>Tt[D,D]</td><td>Differentiable Matrix Exponential Rhinehart et al. (2018)</td></tr><tr><td>VerletStep</td><td>St,St-1,mt,Ot,Zt</td><td>2st-St-1+mt+OtZt</td><td>St+1[D]</td><td></td></tr></table>
|
| 381 |
+
|
| 382 |
+
# C.1.1 STATISTICS OF PRIOR AND GOAL LIKELIHOODS
|
| 383 |
+
|
| 384 |
+
Following are the values of the planning criterion on $N \approx 8 \cdot 1 0 ^ { 3 }$ rounds from applying the “Gaussian Final-State Mixture” to Town01 Dynamic. Mean of log $q ( \mathbf { s } ^ { * } | \boldsymbol { \phi } ) \approx 1 0 4$ . Mean of $\bar { \log { p ( \mathcal { G } | \mathbf { s } ^ { * } , \boldsymbol { \phi } ) } } = - 4$ . This illustrates that while the prior’s value mostly dominates the values of the final plans, the Gaussian Final-State Goal Mixture likelihood has a moderate amount of influence on the value of the final plan.
|
| 385 |
+
|
| 386 |
+
# C.2 DATASET
|
| 387 |
+
|
| 388 |
+
Before training $q ( \mathbf { S } | \phi )$ , we ran CARLA’s expert in the dynamic world setting of Town01 to collect a dataset of examples. We have prepared the dataset of collected data for public release upon publication. We ran the autopilot in Town01 for over 900 episodes of 100 seconds each in the presence of 100 other vehicles, and recorded the trajectory of every vehicle and the autopilot’s LIDAR observation. We randomized episodes to either train, validation, or test sets. We created sets of 60,701 train, 7586 validation, and 7567 test scenes, each with 2 seconds of past and 4 seconds of future position information at $1 0 \mathrm { H z }$ . The dataset also includes 100 episodes obtained by following the same procedure in Town02.
|
| 389 |
+
|
| 390 |
+
# D BASELINE DETAILS
|
| 391 |
+
|
| 392 |
+
# D.1 CONDITIONAL IMITATION LEARNING OF STATES (CILS):
|
| 393 |
+
|
| 394 |
+
We designed a conditional imitation learning baseline that predicts the setpoint for the PID-controller. Each receives the same scene observations (LIDAR) and is trained with the same set of trajectories as our main method. It uses nearly the same architecture as that of the original CIL, except it outputs setpoints instead of controls, and also observes the traffic light information. We found it very effective for stable control on straightaways. When the model encounters corners, however, prediction is more difficult, as in order to successfully avoid the curbs, the model must implicitly plan a safe path. We found that using the traffic light information allowed it to stop more frequently.
|
| 395 |
+
|
| 396 |
+

|
| 397 |
+
Figure 13: Left: Samples from the prior, $q ( \mathbf { S } | \phi )$ , go left or right. Right: Samples go forward or right.
|
| 398 |
+
|
| 399 |
+
# D.2 MODEL-BASED REINFORCEMENT LEARNING:
|
| 400 |
+
|
| 401 |
+
Static-world To compare against a purely model-based reinforcement learning algorithm, we propose a model-based reinforcement learning baseline. This baseline first learns a forwards dynamics model $\mathbf { s } _ { t + 1 } = f ( \mathbf { s } _ { t - 3 : t } , \mathbf { a } _ { t } )$ given observed expert data $\cdot { a } _ { t }$ are recorded vehicle actions). We use an MLP with two hidden layers, each 100 units. Note that our forwards dynamics model does not imitate the expert preferred actions, but only models what is physically possible. Together with the same LIDAR map $x$ our method uses to locate obstacles, this baseline uses its dynamics model to plan a reachability tree LaValle (2006) through the free-for the lowest-cost path that ends ncost of a position is determined by $\begin{array} { r } { C ( \mathbf { s } _ { 1 : T } ; \mathbf { g } _ { T } ) = | | \mathbf { s } _ { T } - \mathbf { g } _ { T } | | _ { 2 } + \sum _ { t = 1 } ^ { T } c ( \mathbf { s } _ { t } ) } \end{array}$ $c ( \mathbf { s } _ { t } ) = 1 . 5 \mathbb { 1 } ( \mathbf { s } _ { t } < 1 $ $+ 0 . 7 5 \mathbb { 1 } ( 1 < =$ $\mathbf { s } _ { t } < 2$ meters from any obstacle) $+ \ddot { \mathbf { s } _ { t } }$ .
|
| 402 |
+
|
| 403 |
+
We plan forwards over 20 time steps using a breadth-first search over CARLA steering angle $\{ - 0 . 3 , - 0 . 1 , 0 . , 0 . 1 , 0 . 3 \}$ , noting valid steering angles are normalized to $[ - 1 , 1 ]$ , with constant throttle at 0.5, noting the valid throttle range is [0, 1]. Our search expands each state node by the available actions and retains the 50 closest nodes to the waypoint. The planned trajectory efficiently reaches the waypoint, and can successfully plan around perceived obstacles to avoid getting stuck. To convert the LIDAR images into obstacle maps, we expanded all obstacles by the approximate radius of the car, 1.5 meters.
|
| 404 |
+
|
| 405 |
+
Dynamic-world We use the same setup as the Static-MBRL method, except we add a discrete temporal dimension to the search space (one $\mathbb { R } ^ { 2 }$ spatial dimension per T time steps into the future). All static obstacles remain static, however all LIDAR points that were known to collide with a vehicle are now removed: and replaced at every time step using a constant velocity model of that vehicle. We found that the main failure mode was due to both to inaccuracy in constant velocity prediction as well as the model’s inability to perceive lanes in the LIDAR. The vehicle would sometimes wander into the opposing traffic’s lane, having failed to anticipate an oncoming vehicle blocking its path.
|
| 406 |
+
|
| 407 |
+
# E ROBUSTNESS
|
| 408 |
+
|
| 409 |
+
# E.1 DECOY WAYPOINTS EXPERIMENTS
|
| 410 |
+
|
| 411 |
+
In the decoy waypoints experiment, the perturbation distribution is $\mathcal { N } ( 0 , \sigma = 8 m )$ : each waypoint is perturbed with a standard deviation of 8 meters. One failure mode of this approach is when decoy waypoints lie on a valid off-route path at intersections, which temporarily confuses the planner about the best route. Additional visualizations are shown in Fig. 14.
|
| 412 |
+
|
| 413 |
+

|
| 414 |
+
Figure 14: Tolerating bad waypoints. The planner prefers waypoints in the distribution of expert behavior (on the road at a reasonable distance). Columns 1,2: Planning with $^ 1 / 2$ decoy waypoints. Columns 3,4: Planning with all waypoints on the wrong side of the road.
|
| 415 |
+
|
| 416 |
+
# E.2 PLAN RELIABILITY ESTIMATION
|
| 417 |
+
|
| 418 |
+
Besides using our model to make a best-effort attempt to reach a user-specified goal, the fact that our model produces explicit likelihoods can also be leveraged to test the reliability of a plan by evaluating whether reaching particular waypoints will result in human-like behavior or not. This capability can be quite important for real-world safety-critical applications, such as autonomous driving, and can be used to build a degree of fault tolerance into the system. We designed a classification experiment to evaluate how well our model can recognize safe and unsafe plans. We planned our model to known good waypoints (where the expert actually went) and known bad waypoints (off-road) on 1650 held-out test scenes. We used the planning criterion to classify these as good and bad plans and found that we can detect these bad plans with $9 \bar { 7 } . 5 \%$ recall and $9 0 . { \dot { 2 } } \%$ precision. This result indicates imitative models could be effective in estimating the reliability of plans.
|
| 419 |
+
|
| 420 |
+
We determined a threshold on the planning criterion by single-goal planning to the expert’s final location on offline validation data and setting it to the criterion’s mean minus one stddev. Although a more intelligent calibration could be performed by analyzing the information retrieval statistics on the offline validation, we found this simple calibration to yield reasonably good performance. We used 1650 test scenes to perform classification of plans to three different types of waypoints 1) where the expert actually arrived at time $T$ $8 9 . 4 \%$ reliable), 2) waypoints $2 0 \mathrm { m }$ ahead along the waypointer-provided route, which are often near where the expert arrives $7 3 . 8 \%$ reliable) 3) the same waypoints from 2), shifted $2 . 5 \mathrm { m }$ off of the road $( 2 . 5 \%$ reliable). This shows that our learned model exhibits a strong preference for valid waypoints. Therefore, a waypointer that provides expert waypoints via 1) half of the time, and slightly out-of-distribution waypoints via 3) in the other half, an “unreliable” plan classifier achieves $9 \hat { 7 } . 5 \hat { \% }$ recall and $9 0 . 2 \%$ precision.
|
| 421 |
+
|
| 422 |
+
# E.3 OUT-OF-DISTRIBUTION ROBUSTNESS
|
| 423 |
+
|
| 424 |
+
The existence of both (1) observation noise and (2) uncertain/out-of-distribution observations is an important practical issue for autonomous vehicles. Although our current method only conditions on our current observation, several extensions could help mitigate the negative effects of both (1) and (2). For (1), a Bayesian filtering formulation is arguably most ideal, to better estimate (and track) the location of static and dynamic obstacles under noise. However, such high-dimensional filtering are often intractable, and might necessitate approximate Bayesian deep learning techniques, RNNs, or frame stacking, to benefit from multiple observations. Addressing (2) would ideally be done by placing a prior over our neural network weights, to derive some measure of confidence in our density estimation of how expert each plan is, such that unfamiliar scenes generate large uncertainty on our density estimate that we could detect, and react cautiously (pessimistically) to. One way to address the situation if the distributions are very different is to adopt an ensembling approach Lakshminarayanan et al. (2017) in order for the method to determine when the inputs are out of distribution — the ensemble will usually have higher variance (i.e. disagree) when each element of the ensemble is provided with an out-of-distribution input. For instance, this variance could be used as a penalization in the planning criterion.
|
| 425 |
+
|
| 426 |
+
# E.4 TRAFFIC-LIGHT NOISE
|
| 427 |
+
|
| 428 |
+
As discussed, our model assumes access to the traffic-light state provided by the simulator, which we call $\lambda$ . However, access to this state would be noisy in practice, because it relies on a sensor-based (usually image-based) detection and classification module.
|
| 429 |
+
|
| 430 |
+
We performed an experiment to assess robustness to noise in $\lambda$ : we simulated noise in $\lambda$ by “flipping" the light state with $20 \%$ probability, corresponding to a light state detector that has $80 \%$ accuracy on average. “Flipping" means that if the light is green, then changingλ to indicate red, and if the light is red, then changing $\lambda$ to indicate green. We performed this following the experimental method of “Region Final-St. Indicator S.” in dynamic Town02, and ran it with three separate seeds. The means and their standard errors are reported in Table 6. The conclusion we draw is that the approach can still achieve success most of the time, although it tends to violate red-lights more often. Qualitatively, we observed the resulting behavior near intersections to sometimes be “jerky”, with the model alternating between stopping and non-stopping plans. We hypothesize that the model itself could be made more robust if the noise in $\lambda$ was also present in the training data.
|
| 431 |
+
|
| 432 |
+
Table 6: We evaluate the effect of noise in the traffic-light state $( \lambda )$ on CARLA’s Dynamic Navigation task. Noise in the light state predictably degrades overall and red-light performance, but not to the point of preventing the method from operating at all.
|
| 433 |
+
|
| 434 |
+
<table><tr><td>Town02 Dynamic Navigation Method</td><td>Success</td><td>Ran Red Light</td><td>Wrong lane</td><td>Off road</td></tr><tr><td>Region Final-St. Indicator S. (original)</td><td>88%±3.3</td><td>2.57%±0.04</td><td>0.49%±0.32</td><td>2.6%±1.06</td></tr><tr><td>Region Final-St. Indicator S. (noisy λ)</td><td>76%±5.0</td><td>34.8%± 2.4</td><td>0.15%±0.04</td><td>1.79% ±0.34</td></tr></table>
|
| 435 |
+
|
| 436 |
+
# F POTHOLE EXPERIMENT DETAILS
|
| 437 |
+
|
| 438 |
+
We simulated potholes in the environment by randomly inserting them in the cost map near each waypoint $i$ with offsets distributed $\mathcal { N } _ { i } ( \mu { = } [ - 1 5 \mathrm { m } , 0 \mathrm { m } ]$ , $\Sigma = \mathrm { d i a g } ( [ 1 , 0 . 0 1 ] ) )$ , (i.e. mean-centered on the right side of the lane $1 5 \mathrm { m }$ before each waypoint). We inserted pixels of root cost $- 1 e 3$ in the cost map at a single sample of each ${ \mathcal { N } } _ { i }$ , binary-dilated the cost map by $^ 1 / 3$ of the lane-width (spreading the cost to neighboring pixels), and then blurred the cost map by convolving with a normalized truncated Gaussian filter of $\sigma = 1$ and truncation width 1.
|
| 439 |
+
|
| 440 |
+
# G BASELINE VISUALIZATIONS
|
| 441 |
+
|
| 442 |
+
See Fig. 15 for a visualization of our baseline methods.
|
| 443 |
+
|
| 444 |
+
# H HYPERPARAMETERS
|
| 445 |
+
|
| 446 |
+
In order to tune the $\epsilon$ hyperparameter of the unconstrained likelihoods, we undertook the following binary-search procedure. When the prior frequently overwhelmed the posterior, we set $\epsilon \gets 0 . 2 \epsilon$ , to yield tighter covariances, and thus more penalty for failing to satisfy the goals. When the posterior frequently overwhelmed the prior, we set $\epsilon 5 \epsilon$ , to yield looser covariances, and thus less penalty for failing to satisfy the goals. We executed this process three times: once for the “Gaussian Final-State Mixture” experiments (Section 4), once for the “Noise Robustness” Experiments (Section 4.1), and once for the pothole-planning experiments (Section 4.2). Note that the Constrained-Goal Likelihoods introduced no hyperparameters to tune.
|
| 447 |
+
|
| 448 |
+

|
| 449 |
+
Figure 15: Baseline methods we compare against. The red crosses indicate the past 10 positions of the agent. Left: Imitation Learning baseline: the green cross indicates the provided goal, and the yellow plus indicates the predicted setpoint for the controller. Right: Model-based RL baseline: the green regions indicate the model’s predicted reachability, the red regions are post-processed LIDAR used to create its obstacle map.
|
md/train/WtmMyno9Tq2/WtmMyno9Tq2.md
ADDED
|
@@ -0,0 +1,253 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Multimodal Few-Shot Learning with Frozen Language Models
|
| 2 |
+
|
| 3 |
+
Maria Tsimpoukelli∗ DeepMind mrts@deepmind.com
|
| 4 |
+
|
| 5 |
+
Serkan Cabi∗ DeepMind cabi@deepmind.com
|
| 6 |
+
|
| 7 |
+
Jacob Menick∗
|
| 8 |
+
DeepMind
|
| 9 |
+
University College London
|
| 10 |
+
jmenick@deepmind.com
|
| 11 |
+
|
| 12 |
+
# S. M. Ali Eslami
|
| 13 |
+
|
| 14 |
+
Oriol Vinyals DeepMind vinyals@deepmind.com
|
| 15 |
+
|
| 16 |
+
DeepMind aeslami@deepmind.com
|
| 17 |
+
|
| 18 |
+
Felix Hill DeepMind felixhill@deepmind.com
|
| 19 |
+
|
| 20 |
+
# Abstract
|
| 21 |
+
|
| 22 |
+
When trained at sufficient scale, auto-regressive language models exhibit the notable ability to learn a new language task after being prompted with just a few examples. Here, we present a simple, yet effective, approach for transferring this few-shot learning ability to a multimodal setting (vision and language). Using aligned image and caption data, we train a vision encoder to represent each image as a sequence of continuous embeddings, such that a pre-trained, frozen language model prompted with this prefix generates the appropriate caption. The resulting system is a multimodal few-shot learner, with the surprising ability to learn a variety of new tasks when conditioned on examples, represented as a sequence of multiple interleaved image and text embeddings. We demonstrate that it can rapidly learn words for new objects and novel visual categories, do visual question-answering with only a handful of examples, and make use of outside knowledge, by measuring a single model on a variety of established and new benchmarks.
|
| 23 |
+
|
| 24 |
+
# 1 Introduction
|
| 25 |
+
|
| 26 |
+
Auto-regressive transformers have been shown to be very impressive models of natural language [42]. Large-scale language transformers exhibit several surprising abilities beyond that of standard text generation [4, 31]. Perhaps most notably, they are few-shot learners; they can learn to perform a new task from a few examples without any further gradient updates. Equipped with this ability, these models have been shown to rapidly adapt to new tasks and styles of generation via prompting (e.g. switching from formal to informal language) [4], to retrieve relevant encyclopedic or general knowledge when primed with a relevant context (e.g. answering questions such as ‘When did the French Revolution begin?’) [34, 1, 28] and to use new words in appropriate ways straight after being taught what those words mean (sometimes referred to as ‘fast binding’) [12, 4].
|
| 27 |
+
|
| 28 |
+
Despite these impressive capabilities, such large scale language models are ‘blind’ to modalities other than text, preventing us from communicating visual tasks, questions or concepts to them. Indeed, philosophers and linguists have questioned whether an un-grounded language model can ever achieve true understanding of the language it processes [5, 2]. Here, we present Frozen, a method for giving a pre-trained language model access to visual information in a way that extends its few-shot learning capabilities to a multimodal setting, without changing its weights. Frozen consists of a neural network trained to encode images into the word embedding space of a large pre-trained language model such that the language model generates captions for those images. The weights of the language model are kept frozen, but gradients are back-propagated through it to train the image encoder from scratch (Figure 2). Although Frozen is trained on single image-text pairs, once trained it can respond effectively to interleaved sequences of multiple images and text. This allows users to ‘prompt’ it with several examples of new multimodal tasks before evaluating its performance, or to ‘teach’ it the name of a new visual category before immediately asking about that category.
|
| 29 |
+
|
| 30 |
+

|
| 31 |
+
Figure 1: Curated samples with about five seeds required to get past well-known language model failure modes of either repeating text for the prompt or emitting text that does not pertain to the image. These samples demonstrate the ability to generate open-ended outputs that adapt to both images and text, and to make use of facts that it has learned during language-only pre-training.
|
| 32 |
+
|
| 33 |
+
By exploiting its pre-trained language model, Frozen exhibits nontrivial zero-shot performance on multimdodal tasks that it was not trained on, such as visual question answering (VQA). More surprisingly, it gets better at these tasks after seeing a handful of examples ‘in-context’ as in [4], and also performs above chance on tests of fast category learning such as miniImageNet [43]. In each case, comparisons with ‘blind’ baselines show that the model is adapting not only to the language distribution of these new tasks, but also to the relationship between language and images. Frozen is therefore a multimodal few-shot learner, bringing the aforementioned language-only capabilities of rapid task adaptation, encyclopedic knowledge and fast category binding to a multimodal setting.
|
| 34 |
+
|
| 35 |
+

|
| 36 |
+
Figure 2: Gradients through a frozen language model’s self attention layers are used to train the vision encoder.
|
| 37 |
+
|
| 38 |
+
Our goal in developing Frozen was not to maximise performance on any specific task, and in many cases it is far from state-of-the-art. Nonetheless, it performs well above trivial baselines across a wide range of tasks without ever seeing more than a handful of the training examples provided by these benchmarks. Moreover, as illustrated in Figure 1, Frozen is a system for genuinely open-ended and unconstrained linguistic interpretation of images that often produces compelling output.
|
| 39 |
+
|
| 40 |
+

|
| 41 |
+
Figure 3: Inference-Time interface for Frozen. The figure demonstrates how we can support (a) visual question answering, (b) outside-knowledge question answering and (c) few-shot image classification via in-context learning.
|
| 42 |
+
|
| 43 |
+
To summarise, our contributions are as follows: 1. We present Frozen, a modular, scalable and efficient approach to training vision front-ends for large language models. The resulting combined model retains all of the capabilities of large language models, but can also process text and image inputs in any arbitrary sequence. 2. We show that such models transfer their capacity for rapid task adaptation, encyclopedic knowledge and fast category binding from a language-only to a multimodal setting, and verify that prompting them with both visual and language information can be strictly more effective than doing so with language information alone. 3. We quantify these capabilities on a range of existing and new benchmarks, paving the way for future analysis of these capabilities.
|
| 44 |
+
|
| 45 |
+
# 2 Related Work
|
| 46 |
+
|
| 47 |
+
The Frozen method is inspired by lots of recent work. [26] show that the knowledge encoded in transformer language models can be a valuable prior for tasks involving reasoning and memory across discrete sequences, and even classification of images presented as sequences of spatial regions. In that approach, a small subset of the pre-trained language model weights are fine-tuned to the various final applications. In contrast, applying Frozen to different tasks does not involve any weight updates to the transformer whatsoever; the system adapts to and improves at multimodal (vision and language) tasks as activations propagate through the model. The two studies thus reveal different ways in which knowledge acquired from text can transfer to non-linguistic settings.
|
| 48 |
+
|
| 49 |
+
The effectiveness of prefix tuning [23] or prompt tuning [20] was another important motivation for Frozen. Prefix tuning is a method for prompting a language model to produce output of a particular style using gradient descent to learn a task-specific bias term which functions like the continuous embedding of a text prompt. Using prefix tuning, language models can be adapted to different natural language generation tasks like summarization. Frozen could also be considered a type of image-conditional prefix tuning, in which this continuous prefix is not a bias but an image-conditional activation produced by an external neural network.
|
| 50 |
+
|
| 51 |
+
Learning to embed image representations into the ‘word’ space of a large pretrained language model was done previously by [16]. This work focused on image-text classification, and uses a BERT-style language model that is fine-tuned (rather than frozen) on multimodal data. [36] extend a similar image embedding+BERT system to create a generative model of text, using a pre-trained object extraction system to embed images into word space. Neither of these studies consider the problem of learning image-text correspondences in a few shots.
|
| 52 |
+
|
| 53 |
+
A large body of work has applied either text-specific or multimodal representation-learning approaches like BERT [8] to visual question answering (VQA) and captioning (see e.g. [25, 40] and many more). In these approaches, models are first trained with aligned data on task-agnostic cross-modal objectives and then fine-tuned to specific tasks. This approach can yield state-of-the-art performance on a range of classification tasks. Unlike Frozen, the resulting systems are highly specialized to one task, and cannot learn new categories or adapt to new tasks in a few shots.
|
| 54 |
+
|
| 55 |
+
By contrast, [7] propose text generation as an objective for task-general multimodal models, yielding a system that, like Frozen, produces unconstrained language output. Unlike Frozen, they do not use a pre-trained model trained on text only, and do not consider zero or few-shot learning, instead updating all weights of the system with training data for each task they consider – thus, again, specializing the models to one task at a time. Similarly, [46] and [6] show that a large pre-trained language model as decoder can improve a captioning performance when training data is limited. Unlike Frozen, they use pre-trained frozen visual encoders or object extractors and fine-tune the pre-trained weights in the text decoder on the captioning data. Similarly, they do not consider zero or few-shot adaptation across different multimodal tasks. Past work has also explored alternative approaches for post-hoc combination of models for different modalities using latent variables [41].
|
| 56 |
+
|
| 57 |
+
Multimodal pre-training has recently been shown to enable strong zero-shot generalization in the discriminative setting using large-scale contrastive learning [29, 14]. Also in a discriminative setting, [45] has observed signs of emergent few-shot-learning from large-scale training. In contrast, our work enables strong generalization to new multimodal tasks both zero-shot or few-shot with completely open-ended generative text output.
|
| 58 |
+
|
| 59 |
+
# 3 The Frozen Method
|
| 60 |
+
|
| 61 |
+
Frozen is a method for grounding a large language model without changing its weights, closely related to prefix tuning [23, 20]. Prefix tuning trains a task-specific continuous bias term to function like the embedding of a constant, static text prompt used for all test-time examples. Frozen extends this approach by making this prefix dynamic, in that it is not a constant bias but an input-conditional activation emitted by a neural network.
|
| 62 |
+
|
| 63 |
+
# 3.1 Architecture
|
| 64 |
+
|
| 65 |
+
Pre-trained Autoregressive Language Models Our method starts from a pre-trained deep autoregressive language model, based on the Transformer architecture [42, 30], which parametrizes a probability distribution over text y. Text is decomposed into a sequence of discrete tokens $\mathbf { y } = y _ { 1 } , y _ { 2 } , . . . , y _ { L }$ by the SentencePiece tokenizer [18]. We use a vocabulary of size 32,000. The language model makes use of an embedding function $g _ { \theta }$ which independently transforms each token into a continuous embedding $t _ { l } : = g _ { \theta } ( y _ { l } )$ , as well as a transformer neural network $f _ { \theta }$ whose output is a vector of logits parameterizing a categorical distribution over the vocabulary. The distribution $p _ { \boldsymbol { \theta } } ( \mathbf { y } )$ is represented as follows:
|
| 66 |
+
|
| 67 |
+
$$
|
| 68 |
+
\log p _ { \theta } ( \mathbf { y } ) = \sum _ { l } \log p _ { \theta } ( y _ { l } | y _ { 1 } , y _ { 2 } , . . . , y _ { l - 1 } ) = \sum _ { l } f _ { \theta } ( t _ { 1 } , t _ { 2 } , . . . , t _ { l - 1 } ) _ { y _ { l } }
|
| 69 |
+
$$
|
| 70 |
+
|
| 71 |
+
The model we start from is pre-trained, i.e. $\theta$ has been optimised via the standard maximum-likelihood objective on a large dataset of text from the internet. We use a 7 billion parameter transformer trained on the public dataset C4 [31] – previous work has shown that the multi-billion parameter scale is sufficient to exhibit the key capacities we are interested in studying [30, 34].
|
| 72 |
+
|
| 73 |
+
Vision Encoder Our vision encoder is based on NF-ResNet-50 [3]. We define $v _ { \phi }$ as a function that takes a raw image and emits a continuous sequence to be consumed by the transformer. We use the final output vector of the NF-Resnet after the global pooling layer.
|
| 74 |
+
|
| 75 |
+
Visual Prefix One important requirement is to represent images in a form that the transformer already understands: a sequence of continuous embeddings, each having the same dimensionality $D$ as a token embedding $t _ { l }$ . We therefore form the visual prefix by linearly mapping the vision encoder’s output to $D * k$ channels, and then reshaping the result as a sequence of $k$ embeddings, each with dimensionality $D$ . We call this sequence a visual prefix since it plays the same functional role in the transformer architecture as (part of) an embedding sequence of prefix tokens. We experimented using different number of tokens $k$ , specifically 1, 2 and 4 and found that 2 performs best, though certainly this would be sensitive to other architectural details. See Appendix for more details on the architecture.
|
| 76 |
+
|
| 77 |
+
# 3.2 Training
|
| 78 |
+
|
| 79 |
+
During training, we update only the parameters $\phi$ of the vision encoder using paired image-caption data from the Conceptual Captions dataset [37]. Our experiments show that fine-tuning $\theta$ hurts generalization, as much less paired image-caption data is available than the amount of text-only data used to pre-train $\theta$ . Training only the parameters $\phi$ makes our system modular – it can use an existing language model off the shelf – and also quite simple: we only train a visual encoder and rely on the capabilities of an existing language model.
|
| 80 |
+
|
| 81 |
+
Following standard captioning systems [22, 13], we treat captioning as conditional generation of caption text $\mathbf { y }$ given an image $\mathbf { x }$ . We represent $\mathbf { x }$ as $v _ { \phi } ( \mathbf { x } ) = i \bar { 1 } , i _ { 2 } , . . . , \bar { i } _ { n }$ and train $\phi$ to maximise the likelihood:
|
| 82 |
+
|
| 83 |
+
$$
|
| 84 |
+
\begin{array} { c } { { \log p _ { \theta , \phi } ( { \bf y } | x ) = \displaystyle \sum _ { l } \log p _ { \theta , \phi } ( y _ { l } | { \bf x } , y _ { 1 } , y _ { 2 } , . . . , y _ { l - 1 } ) } } \\ { { { } } } \\ { { = \displaystyle \sum _ { l } f _ { \theta } ( i _ { 1 } , i _ { 2 } , . . . , i _ { n } , t _ { 1 } , t _ { 2 } , . . . , t _ { l - 1 } ) _ { y _ { l } } } } \end{array}
|
| 85 |
+
$$
|
| 86 |
+
|
| 87 |
+
Whilst the parameters $\theta$ are frozen, each element $i _ { k }$ of the visual prefix receives gradients $\sum _ { l } \nabla _ { i _ { k } } f _ { \theta } ( i _ { 1 } \dot { , } i _ { 2 } , . . . , i _ { n } , t _ { 1 } , t _ { 2 } , . . . , t _ { l - 1 } ) _ { y _ { l } }$ , enabling the parameters of the visual encoder to be optimised with standard backpropagation and SGD (Figure 2).
|
| 88 |
+
|
| 89 |
+
As the notation $f _ { \theta } ( i _ { 1 } , i _ { 2 } , . . . , i _ { n } , t _ { 1 } , t _ { 2 } , . . . , t _ { l - 1 } )$ suggests, we present the visual prefix during training as if it were a sequence of embeddings occurring earlier in time than the caption (token embeddings) $t _ { 1 } , t _ { 2 } , \ldots$ . We use relative positional encoding [38], which enables the transformer to generalize to prefix sequences where an image is not always in the first absolute positions, and where more than one image may be present. In particular, we use the version of relative attention described in transformerxlDai.We leave improvements of this simple scheme for future work.
|
| 90 |
+
|
| 91 |
+
# 3.3 Interface at Inference Time
|
| 92 |
+
|
| 93 |
+
At inference time, a vanilla language model, conditioned upon an arbitrary text prompt $y _ { 1 } , y _ { 2 } , . . . , y _ { p }$ , generates text sequences $y _ { p + 1 } , y _ { p + 2 } , . . .$ autoregressively. In Frozen it is straightforward to include images in such prompt by placing an image’s embedding $i _ { 1 } , i _ { 2 }$ as a prefix to a text embedding subsequence $t _ { 1 } , t _ { 2 } , . . . , t _ { p }$ . Because the transformer $f _ { \theta }$ is modality-agnostic, we can interleave a sub-sequence of text token embeddings with a sub-sequence of image embeddings in any arbitrary order. In Figure 3, we show how this can support zero-shot visual question-answering (Figure 3a), few-shot visual question-answering (Figure 3b), and few-shot image classification (Figure 3c).
|
| 94 |
+
|
| 95 |
+
To evaluate these tasks, the model decodes output sequences greedily and these outputs are compared against the ground truth answers of the task following the normalization technique used in [19]. To probe the open-ended capabilities of Frozen, we decided not to use common practice of short-lists of pre-canned answers, even though in some tasks this may hurt its performance in accuracy percentages.
|
| 96 |
+
|
| 97 |
+
# 3.4 Few-Shot Learning Definitions
|
| 98 |
+
|
| 99 |
+
The ability of Frozen to be conditioned on a sequence of interleaved images and text allows it not only to be able to perform different multimodal tasks, but also gives rise to different ways of ‘inducing’ the task to the model in order to improve its performance. We briefly define the terminology used in our settings, common amongst all the different tasks. See Figure 5 in the appendix for a visual illustration of these concepts.
|
| 100 |
+
|
| 101 |
+
• Task induction Explanatory text that precedes the sequence of images and text. It is intended to describe the task to the model in natural language, for example ‘Please answer the question.’ Number of shots The number of distinct full examples of the task presented to the model prior to the evaluated example. For example, in Visual Question-Answering, a shot is an image along with the question and the answer.
|
| 102 |
+
|
| 103 |
+
For tasks involving fast category binding (e.g., few-shot image classification), we define further specific terminology. See also Figure 4a and Figure 6 in the appendix.
|
| 104 |
+
|
| 105 |
+
• Number of ways The number of object classes in the task (e.g. dog vs cat).
|
| 106 |
+
• Number of inner-shots The number of distinct exemplars from each category that are presented to the model (i.e. number of images of different dogs). In previous work with MiniImagenet, these were known as shots, but we modify the term here to distinguish from the more general usage of the term described above. Number of repeats The number of times each inner-shot is repeated in the context presented to the model. We use this setting as an ablation to explore how the model integrates visual information about a category.
|
| 107 |
+
|
| 108 |
+
# 4 Experiments: A Multi-Modal Few-Shot Learner
|
| 109 |
+
|
| 110 |
+
Our experiments are designed to quantify three capacities that should be characteristic of a MultiModal Few-Shot Learner: rapid adaptation to new tasks, fast access to general knowledge and fast binding of visual and linguistic elements. We train Frozen on Conceptual Captions, a public dataset that consists of around three million image-caption pairs [37]. We do early stopping on the validation set perplexity which usually reaches an optimum just after a single epoch with batch size 128. All experiments used the Adam optimizer with $\beta _ { 1 } = 0 . 9$ and $\beta _ { 2 } = 0 . 9 5$ and a constant learning rate of $3 e$ -4 unless otherwise noted. We operate on $2 2 4 \times 2 2 4$ images at both train and test-time. Images which are not square are first padded with zeroes to square and then resized to $2 2 4 \times 2 2 4$ .
|
| 111 |
+
|
| 112 |
+
Table 1: Transfer from Conceptual Captions to VQAv2. The $\tau$ column indicates whether a model uses training data from the VQAv2 training set. The row denoted Frozen train-blind is the blind baseline described in subsection 4.1. Frozen VQA is a baseline which mixes in VQAv2 training data.
|
| 113 |
+
|
| 114 |
+
<table><tr><td rowspan=1 colspan=1>n-shot Acc. 1</td><td rowspan=1 colspan=1>n=0</td><td rowspan=1 colspan=1>n=1</td><td rowspan=1 colspan=1>n=4</td><td rowspan=1 colspan=1>T</td></tr><tr><td rowspan=2 colspan=1>FrozenFrozen seratchFrozen finetunedFrozen train-blind</td><td rowspan=2 colspan=1>29.50.024.026.2</td><td rowspan=1 colspan=1>35.7</td><td rowspan=2 colspan=1>38.20.029.233.3</td><td rowspan=2 colspan=1>xxxx</td></tr><tr><td rowspan=1 colspan=1>0.028.233.5</td></tr><tr><td rowspan=1 colspan=1>Frozen vQAFrozen vQA-blind</td><td rowspan=1 colspan=1>48.439.1</td><td rowspan=1 colspan=1>11</td><td rowspan=1 colspan=1>11</td><td rowspan=1 colspan=1>1√</td></tr><tr><td rowspan=1 colspan=1>Oscar [24] 1</td><td rowspan=1 colspan=1>173.8</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>1 【</td><td rowspan=1 colspan=1>【</td></tr></table>
|
| 115 |
+
|
| 116 |
+
Table 2: Transfer from Conceptual Captions to OKVQA. The $\tau$ column indicates if a model uses training data from the OKVQA training set. Frozen does not train on VQAv2 except in the baseline row, and it never trains on OKVQA.
|
| 117 |
+
|
| 118 |
+
<table><tr><td rowspan=1 colspan=1>n-shot Acc. 1</td><td rowspan=1 colspan=1>n=0</td><td rowspan=1 colspan=1>n=1</td><td rowspan=1 colspan=1>n=4</td><td rowspan=1 colspan=1>T</td></tr><tr><td rowspan=3 colspan=1>FrozenFrozen 400mLMFrozen finetunedFrozen train-blind</td><td rowspan=1 colspan=1>5.9</td><td rowspan=1 colspan=1>9.7</td><td rowspan=1 colspan=1>12.6</td><td rowspan=1 colspan=1>X</td></tr><tr><td rowspan=2 colspan=1>4.04.23.3</td><td rowspan=1 colspan=1>5.9</td><td rowspan=2 colspan=1>6.64.60.0</td><td rowspan=2 colspan=1>xxxx</td></tr><tr><td rowspan=1 colspan=1>4.17.2</td></tr><tr><td rowspan=1 colspan=1>Frozen vQAFrozen vQA-blind</td><td rowspan=1 colspan=1>19.612.5</td><td rowspan=1 colspan=1>11</td><td rowspan=1 colspan=1>11</td><td rowspan=1 colspan=1>××</td></tr><tr><td rowspan=1 colspan=1>MAVEx 44] 三</td><td rowspan=1 colspan=1>39.4</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=2>1 √</td></tr></table>
|
| 119 |
+
|
| 120 |
+
# 4.1 Rapid Task Adaptation
|
| 121 |
+
|
| 122 |
+
We first examine zero-shot and few-shot generalization from captioning to visual question-answering. This is a type of rapid adaptation from captioning behaviour to question-answering behaviour analogous to transfer from language modelling to open-domain question-answering in the text-only setting [34]. We evaluate on the VQAv2 [10] validation set.
|
| 123 |
+
|
| 124 |
+
Zero-shot transfer from captioning to VQA We first observe that a version of our model in which the ability to embed images into a prefix is trained solely with a captioning objective can transfer moderately well to visual question-answering in the zero-shot setting, with no specific training towards that goal. We simply have to provide the system with an image and a textual prompt of the form Question: what colour is the dog sitting on the grass? Answer:, then observe how it completes the prompt. The ability to adapt to input of this form is presumably transferred from the training data of the pretrained language model component of the system.
|
| 125 |
+
|
| 126 |
+
The strength of the pre-trained language model in the system is a double-edged sword. It powers the generalization abilities of Frozen but also enables the model to perform surprisingly well without considering the visual input at all. To guard against this possibility we also train blind baselines, in which the image presented to the visual encoder is blacked out, but the convnet weights are still trained (see Table 1). This amounts to prefix tuning [23]. We outperform this blind baseline which also inherits the few-shot learning abilities of the language model.
|
| 127 |
+
|
| 128 |
+
In these experiments we also include two additional and important baselines: Frozen finetuned in which the language model is instead finetuned starting from the pretrained weights and Frozen scratch, wherein the whole system is trained from scratch end-to-end, both using the same dataset as Frozen. These baselines preferred a smaller learning rate of 1e-5. Results in Table 1 show that keeping the language model frozen generalizes substantially better to visual question-answering than finetuning. The model trained from scratch is not able to transfer at all from captioning to VQA; we interpret this to suggest that the tremendous generalization abilities of large language models are reliant upon large-scale training datasets in which the task of predicting the next token mimics the test setting (here question-answering) with non-negligible frequency.
|
| 129 |
+
|
| 130 |
+
Improving performance with few-shot learning More importantly, for the present work, we observe that the ability of the model to transfer knowledge from captioning and text-modelling to visual question-answering improves if the model is presented with several examples of VQA data sequentially. We repeat the previous experiments with up to four examples of image-question-answer triples shown to the model as conditioning information in the continuous prefix sequence (using the interface in Figure 3).
|
| 131 |
+
|
| 132 |
+

|
| 133 |
+
Figure 4: Examples of (a) the Open-Ended miniImageNet evaluation (b) the Fast VQA evaluation.
|
| 134 |
+
|
| 135 |
+
These results are presented in Table 1. For contrast, we compare this performance to a condition in which we mix in some data from the VQAv2 training set with the captioning data. As we might expect, few-shot learning on four examples is outperformed by SGD on tens of thousands of examples, but few-shot performance clearly improves with more examples, and goes some way $( 3 8 . 2 \% )$ toward closing the gap from zero-shot performance $( 2 9 . 5 \% )$ to full SGD training performance $( 4 8 . 4 \% )$
|
| 136 |
+
|
| 137 |
+
There are two important takeaways from the results presented in this section. First, they show that training a visual encoder through a pretrained and frozen language model results in a system capable of strong out-of-distribution (zero-shot) generalization. Second, they confirm that the ability to rapidly adapt to new tasks given appropriate cntext is inherited from the pretrained language model and transfers directly to multimodal tasks.
|
| 138 |
+
|
| 139 |
+
# 4.2 Encyclopedic Knowledge
|
| 140 |
+
|
| 141 |
+
Here we study the extent to which Frozen can leverage the encyclopedic knowledge in the language model towards visual tasks. The Conceptual Captions dataset is hypernymed (e.g. proper names are replaced with a general word like person). This enables us to rigorously study the transfer of factual knowledge because all knowledge of named entities comes from language model pretraining.
|
| 142 |
+
|
| 143 |
+
Consequently, when we show the model an image of an airplane and ask “who invented this?” (Figure 1), the visual encoder has determined that the image contains an airplane, and the language model has used this to retrieve the factual knowledge that airplanes were invented by the Wright brothers, a fact which is referenced in the C4 training set through (text-only) articles about airplanes. This is a fascinating chain of deduction. A detailed analysis of this behaviour with more examples is included in the Appendix (e.g. Figure 9, Figure 10, Figure 11).
|
| 144 |
+
|
| 145 |
+
We bolster this finding quantitatively by evaluating performance on OKVQA [27], a visual questionanswering dataset designed to require outside knowledge in order to answer correctly. The pretrained language model’s command of factual knowledge is of course dependent upon its scale, so we examine the performance of Frozen using pretrained language models of varying sizes: the base model with 7 billion parameters, and a much smaller 400 million parameter language model pretrained on the same dataset. Table 2 shows the results: task performance scales with model size. Again finetuning performs worse than leaving the model frozen in terms of generalization performance. We stress that Frozen is never trained on OKVQA.
|
| 146 |
+
|
| 147 |
+
# 4.3 Fast Word-to-Visual-Category Binding
|
| 148 |
+
|
| 149 |
+
In the multi-modal setting, fast-binding refers to a model’s ability to associate a word with a visual category in a few shots and immediately use that word in an appropriate way.
|
| 150 |
+
|
| 151 |
+
Open-Ended miniImageNet and Real-Name miniImageNet To quantify the fast-binding capacity of of Frozen, we evaluate it on the miniImageNet meta-learning task [43]. Note that there are important differences with how we attempt miniImageNet and how it is approached in previous work. First, unlike standard meta-learning, we do not train Frozen on the (meta) task. Second, we evaluate Frozen in an open-ended fashion, where it must successfully generate a correct category name (and then the EOS token) in order to be credited with a correct answer. Finally, although we use the same image classes as the miniImageNet test set, they are at higher resolution $( 2 2 4 \times 2 2 4 )$ and with integer class labels [0, 1] replaced with nonsense words (‘dax’, ‘blicket’ etc). We make this adjustment because the nonsense words should have no (or less) intrinsic meaning to the language model than integers, whose relative order (for instance) should have been reflected in a massive text training corpus. We refer to this task as Open-Ended miniImageNet. To assess how much difficulty is added by binding visual categories to nonsense words versus simply adapting to an image recognition task per se, we also consider a version – Real-Name miniImagenet – in which visual categories in both the support set and the answer retain their original names. See Figure 4a for an illustration.
|
| 152 |
+
|
| 153 |
+
On both versions of this evaluation, we experiment by exposing the model to different numbers of inner-shots, repeats and task induction. On two-way Open-Ended miniImagenet, we observe that when Frozen is presented with a sequence of images and descriptions of new names for them, it is able to learn new names for the objects presented and then use these new names immediately with substantially above chance accuracy. Importantly, the ability of the model to use these new words improves with more examples of the corresponding category. Notably, this upward trend is more pronounced when this supporting information involves different exemplars from the visual category (inner-shots) rather than repetitions of a single exemplar (repeats). The fast-binding capacities of the model can thus be improved with richer and more varied visual support or prompting.
|
| 154 |
+
|
| 155 |
+
On two-way Real-Name miniImagenet, we observe a similar trend but with higher absolute performance. This underlines the difficulty in Open-Ended miniImagenet introduced by having to assign novel words to categories that may otherwise be already known to the model, and because the real names may carry visual information leveraged from the captioning data the model was trained on.
|
| 156 |
+
|
| 157 |
+
In Table 4, we show that the observed effects on Open-Ended miniImagenet do not transfer to the 5-way setting, where Frozen is not significantly above chance. This shows that learning to bind five new names to five visual categories in a single forward pass is beyond the current capabilities of Frozen. As before, however, we do observe an upward trend in the model’s capacity to return the actual name for a visual category among the five possibilities as the number of inner-shots or repeats increases. Further work is required and we look forward to progress in this more challenging setting.
|
| 158 |
+
|
| 159 |
+
<table><tr><td>Task Induction Inner Shots Repeats</td><td>× 1 0</td><td>√ 1 0</td><td>√ 3 0</td><td>√ 5 0</td><td>√ 1 1</td><td>√ 1</td><td>√ 1</td></tr><tr><td>Frozen</td><td>29.0</td><td>54.1</td><td>55.2</td><td>57.6</td><td>51.8</td><td>3 57.7</td><td>5 58.6</td></tr><tr><td>Frozen (Real-Name)</td><td>1.7</td><td>49.2</td><td>67.0</td><td>68.4</td><td>63.8</td><td>65.2</td><td>64.0</td></tr><tr><td>Frozen test-blind</td><td>1</td><td>48.5</td><td>46.7</td><td>45.3</td><td>、</td><td></td><td>1</td></tr><tr><td>Frozen test-blind (Real-Name)</td><td></td><td>1.0</td><td>12.6</td><td>33.0</td><td>一</td><td></td><td></td></tr><tr><td>ANIL Baseline [32]</td><td>1</td><td>73.9</td><td>81.7</td><td>84.2</td><td>1</td><td>1</td><td>1</td></tr></table>
|
| 160 |
+
|
| 161 |
+
Table 3: Performance of Frozen and baselines on Open-Ended miniImageNet 2-Way Tasks. Randomly picking between the two class labels (then emitting the EOS token) would yield $50 \%$ accuracy. As the model has to generate the answer, and is not counted correct if it paraphrases, this is not the best blind baseline, which is why we include open-ended blind baselines that also generate.
|
| 162 |
+
|
| 163 |
+
Fast-VQA and Guided-VQA As transformers are trained to model text, their attention weights learn to associate – or ‘bind’– pairs of words across sentences. The experiments with miniImageNet show that this capacity can transfer directly to binding visual categories to their names, enabling the system to generate the name on demand. This raises the question of whether Frozen can integrate a newly-acquired visual category (and its names) more fully into the model’s language system, so that it can, for instance, describe or answer questions about that category.
|
| 164 |
+
|
| 165 |
+
To test this capacity, we constructed a new task – Fast-VQA – out of two well-known datasets, ImageNet [35] and Visual Genome [17]. For each question, the model is presented with nonsense words (‘dax’ and ‘blicket’) and $n$ images of the referents of those words (e.g. of a ‘cat’ or a ‘dog’) taken from ImageNet. It is then asked a question containing at least one of those two words, about a further image (taken from Visual Genome) in which both of the referents appear (see Figure 4b). As with miniImagenet, the words ‘dax’ and ‘blicket’ (and how they refer) should be new to Frozen, but the corresponding visual categories may be known from the Conceptual Captions training data, albeit by different names.
|
| 166 |
+
|
| 167 |
+
Table 4: Performance of Frozen and baselines on Open-Ended miniImageNet 5-Way Tasks. Randomly picking between the five class labels (then emitting the EOS token) would yield $20 \%$ accuracy.
|
| 168 |
+
|
| 169 |
+
<table><tr><td rowspan=3 colspan=1>Task InductionInner ShotsRepeats</td><td rowspan=2 colspan=1>X1</td><td rowspan=1 colspan=1>√ √ √</td><td rowspan=2 colspan=1>√ √ √1 1 1</td></tr><tr><td rowspan=1 colspan=1>1 3 5</td></tr><tr><td rowspan=1 colspan=1>0</td><td rowspan=1 colspan=1>0 0 0</td><td rowspan=1 colspan=1>1 3 5</td></tr><tr><td rowspan=1 colspan=1>FrozenFrozen (Real-Name)</td><td rowspan=1 colspan=1>18.00.9</td><td rowspan=1 colspan=1>21.3 22.4 22.112.4 34.0 31.0</td><td rowspan=1 colspan=1>21.5 21.1 20.932.0 33.2 33.8</td></tr><tr><td rowspan=3 colspan=1>Frozen test-blindFrozen test-blind (Real-Name)ANIL Baseline [32]</td><td rowspan=3 colspan=1>、1</td><td rowspan=1 colspan=1>18.6 19.9 19.8</td><td rowspan=2 colspan=1>1 1</td></tr><tr><td rowspan=1 colspan=1>4.6 22.6 20.8</td></tr><tr><td rowspan=1 colspan=1>45.5 57.7 62.6</td><td rowspan=1 colspan=1>1 1 1</td></tr></table>
|
| 170 |
+
|
| 171 |
+
To quantify how much harder the introduction of new words for known categories makes this task, we also created a variant (Guided-VQA) in which the original category names (‘cat’ or ‘dog’) are used instead of ‘dax’ and ‘blicket’. Guided-VQA is a special case of Fast-VQA involving questions from Visual Genome, where the model is reminded what the important entities in the question look like prior to answering the question by labeling sample images with real category names. Guided-VQA does not require the same ability to bind categories to new words, but it does measure how well a model can exploit task-relevant multimodal guidance when attempting a new task in an otherwise zero-shot manner.
|
| 172 |
+
|
| 173 |
+
Fast-VQA and Guided-VQA are very challenging tasks because they are attempted without taskspecific training, and because the underlying questions come from Visual Genome (VQAv2 images do not come with the necessary meta-data to construct the task). Visual Genome questions are particularly challenging because only a single answer exists for each question. When scoring models, for simplicity we credit only an exact match with the output generated by the model, modulo the same post-processing applied for VQAv2. Because of the inherent difficulty of the task, we use strong baselines that can still utilize the large language model to verify strength of observed effects.
|
| 174 |
+
|
| 175 |
+
Table 5: Performance of Frozen versus an equivalent blind model on Fast and Guided-VQA.
|
| 176 |
+
|
| 177 |
+
<table><tr><td></td><td colspan="5">Fast-VQA</td><td colspan="4">Guided-VQA</td></tr><tr><td>Inner Shots</td><td>0</td><td>1</td><td>3</td><td>5</td><td>0</td><td>1</td><td>3</td><td>5</td></tr><tr><td>Frozen</td><td>1.6</td><td>2.8</td><td>7.0</td><td>7.9</td><td>3.7</td><td>7.8</td><td>10.1</td><td>10.5</td></tr><tr><td>Frozen train-blind</td><td>0.7</td><td>0.3</td><td>1.3</td><td>0.4</td><td>1.9</td><td>2.3</td><td>3.7</td><td>3.7</td></tr></table>
|
| 178 |
+
|
| 179 |
+
As shown in Table 5, the fact that the model improves with more shots in both Fast-VQA and GuidedVQA confirms that Frozen has some capacity to integrate novel words into its general capacity to process and generate natural language in a multimodal context. It is notable that a prefix-tuned model with no access to images improves moderately at Guided-VQA as more categories are presented, showing that additional linguistic cues (just being reminded of the words involved and the linguistic form of the task) goes some way to preparing for the upcoming question. As exemplified in Figure 4, inspection of the model output confirms that in many cases it is indeed the multimodal (and not just linguistic) support that enables Frozen to improve performance as the number of shots increases. We observed that there are diminishing returns in performance gain as the number of shots increase. One possible explanation is that the shift from the training distribution of contexts with single images to multiple images causes inaccuracies in the model.
|
| 180 |
+
|
| 181 |
+
The Open-Ended miniImagenet, Real-Name miniImagenet, Fast-VQA and Guided-VQA evaluation sets are available to download at https://fh295.github.io/frozen.html.
|
| 182 |
+
|
| 183 |
+
# 5 Discussion
|
| 184 |
+
|
| 185 |
+
# 5.1 Limitations
|
| 186 |
+
|
| 187 |
+
We believe this work is an important proof-of-concept for a desired, much more powerful system capable of open-ended multimodal few-shot learning. Frozen achieves the necessary capacities to some degree, but a key limitation is that it achieves far from state-of-the-art performance on the specific tasks that it learns in a few shots, compared to systems that use the full training set for those tasks. As such, the main contribution of this work should be seen as a starting point or baseline for this exciting area of research of multimodal few-shot learning.
|
| 188 |
+
|
| 189 |
+
Further improvement can make the impressive zero-shot and few-shot generalization we observed more robust as reflected by higher accuracy and fewer seeds required to demonstrate our most compelling samples. Finally, there are many technical questions that were not explored in this proofof-concept study, such as whether performance could be improved with more elaborate architectures for mixing vision and language. We leave the exploration of these possibilities to future investigations. The Open-Ended miniImageNet, Real-Name miniImagenet, Fast-VQA and Guided-VQA benchmarks that we provide with this manuscript should facilitate the evaluation and analysis of future systems of this type.
|
| 190 |
+
|
| 191 |
+
# 5.2 Societal Impact
|
| 192 |
+
|
| 193 |
+
With the emergence of this new class of general purpose vision-language models, new capabilities of massive surveillance can be feasible. Both surveillance footage and publicly shared images can be analyzed for arbitrary questions without requiring any new labeled data or training of the system. As a mitigation for individuals, personal assistant software with similar capabilities can analyze publicly available documents about themselves to identify unintended exposures, even when novel concerns emerge either due to societal change or change of personal preferences.
|
| 194 |
+
|
| 195 |
+
Generative models of text that can incorporate visual information can elevate the misuse of languagemodel generated content by making them even more convincing. Moreover, at this point we do not have sufficient tools to identify bias and toxicity issues of general purpose vision-guided language models. We invite the community to think about effective methods and benchmarks on this front.
|
| 196 |
+
|
| 197 |
+
More positively, systems like Frozen could be applied to assist visually impaired users of technology. Frozen’s ability to adapt to different styles of caption or question could enable a more personalised user experience in these cases.
|
| 198 |
+
|
| 199 |
+
There are environmental costs associated with training the large networks in systems like Frozen. On the other hand, a system that can be trained once and then flexibly adapted to different settings could have a lower energy footprint overall than one that requires re-training for different applications.
|
| 200 |
+
|
| 201 |
+
# 5.3 Conclusion
|
| 202 |
+
|
| 203 |
+
We have presented a method for transforming large language models into multimodal few-shot learning systems by extending the soft-prompting philosophy of prefix tuning [23] to ordered sets of images and text while preserving text prompting abilities of the language model. Our experiments confirm that the resulting system, Frozen, is capable both of open-ended interpretation of images and genuinely multimodal few-shot learning even though the system is only trained to do captioning. One corollary of these results is that the knowledge required to quickly bind together or associate different words in language is also pertinent to rapidly binding language to visual elements across an ordered set of inputs. This finding extends the conclusion of [26] – that knowledge in transformer language models can transfer to non-linguistic tasks – to the specific case of knowledge about few-shot learning.
|
| 204 |
+
|
| 205 |
+
Acknowledgements We wish to thank Sebastian Borgeaud and Jack Rae for preparing the pretraining text dataset and pretraining a selection of transformer language models, as well as Trevor Cai for help with experiments and infrastructure. We also wish to thank Pauline Luc, Jeff Donahue, Malcolm Reynolds, Andy Brock, Karen Simonyan, Jean-Baptiste Alayrac, Antoine Miech, Charlie Nash, Aaron van den Oord, Marc Deisenroth, Aida Nematzadeh, Roman Ring, Francis Song, Eliza Rutherford, Kirsty Anderson, Esme Sutherland, Alexander Novikov, Daan Wierstra, and Nando de Freitas for insightful discussions during the course of the project.
|
| 206 |
+
|
| 207 |
+
# References
|
| 208 |
+
|
| 209 |
+
[1] Daniel Adiwardana, Minh-Thang Luong, David R. So, Jamie Hall, Noah Fiedel, Romal Thoppilan, Zi Yang, Apoorv Kulshreshtha, Gaurav Nemade, Yifeng Lu, and Quoc V. Le. Towards a human-like open-domain chatbot. CoRR, abs/2001.09977, 2020. [2] Emily M Bender and Alexander Koller. Climbing towards nlu: On meaning, form, and understanding in the age of data. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 5185–5198, 2020.
|
| 210 |
+
[3] Andrew Brock, Soham De, Samuel L Smith, and Karen Simonyan. High-performance largescale image recognition without normalization. arXiv preprint arXiv:2102.06171, 2021.
|
| 211 |
+
[4] Tom B Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, et al. Language models are few-shot learners. arXiv preprint arXiv:2005.14165, 2020.
|
| 212 |
+
[5] David Chalmers. Gpt3 and general intelligence. Published in Daily Nous, 2021.
|
| 213 |
+
[6] Jun Chen, Han Guo, Kai Yi, Boyang Li, and Mohamed Elhoseiny. Visualgpt: Data-efficient adaptation of pretrained language models for image captioning. arXiv preprint arXiv:2102.10407, 2021.
|
| 214 |
+
[7] Jaemin Cho, Jie Lei, Hao Tan, and Mohit Bansal. Unifying vision-and-language tasks via text generation. arXiv preprint arXiv:2102.02779, 2021.
|
| 215 |
+
[8] 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.
|
| 216 |
+
[9] Allen Institute for AI. C4 search. https://c4-search.apps.allenai.org/. Accessed: 2021-04-06.
|
| 217 |
+
[10] Yash Goyal, Tejas Khot, Douglas Summers-Stay, Dhruv Batra, and Devi Parikh. Making the v in vqa matter: Elevating the role of image understanding in visual question answering. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 6904–6913, 2017.
|
| 218 |
+
[11] Kelvin Guu, Kenton Lee, Zora Tung, Panupong Pasupat, and Ming-Wei Chang. Realm: Retrieval-augmented language model pre-training, 2020.
|
| 219 |
+
[12] Tracy H Heibeck and Ellen M Markman. Word learning in children: An examination of fast mapping. Child development, pages 1021–1034, 1987.
|
| 220 |
+
[13] MD Zakir Hossain, Ferdous Sohel, Mohd Fairuz Shiratuddin, and Hamid Laga. A comprehensive survey of deep learning for image captioning. ACM Computing Surveys (CsUR), 51(6):1–36, 2019.
|
| 221 |
+
[14] Chao Jia, Yinfei Yang, Ye Xia, Yi-Ting Chen, Zarana Parekh, Hieu Pham, Quoc V. Le, Yunhsuan Sung, Zhen Li, and Tom Duerig. Scaling up visual and vision-language representation learning with noisy text supervision, 2021.
|
| 222 |
+
[15] Norman P. Jouppi, Cliff Young, Nishant Patil, David Patterson, Gaurav Agrawal, Raminder Bajwa, Sarah Bates, Suresh Bhatia, Nan Boden, Al Borchers, Rick Boyle, Pierre luc Cantin, Clifford Chao, Chris Clark, Jeremy Coriell, Mike Daley, Matt Dau, Jeffrey Dean, Ben Gelb, Tara Vazir Ghaemmaghami, Rajendra Gottipati, William Gulland, Robert Hagmann, C. Richard Ho, Doug Hogberg, John Hu, Robert Hundt, Dan Hurt, Julian Ibarz, Aaron Jaffey, Alek Jaworski, Alexander Kaplan, Harshit Khaitan, Andy Koch, Naveen Kumar, Steve Lacy, James Laudon, James Law, Diemthu Le, Chris Leary, Zhuyuan Liu, Kyle Lucke, Alan Lundin, Gordon MacKean, Adriana Maggiore, Maire Mahony, Kieran Miller, Rahul Nagarajan, Ravi Narayanaswami, Ray Ni, Kathy Nix, Thomas Norrie, Mark Omernick, Narayana Penukonda, Andy Phelps, Jonathan Ross, Matt Ross, Amir Salek, Emad Samadiani, Chris Severn, Gregory Sizikov, Matthew Snelham, Jed Souter, Dan Steinberg, Andy Swing, Mercedes Tan, Gregory Thorson, Bo Tian, Horia Toma, Erick Tuttle, Vijay Vasudevan, Richard Walter, Walter Wang, Eric Wilcox, and Doe Hyun Yoon. In-datacenter performance analysis of a tensor processing unit, 2017.
|
| 223 |
+
[16] Douwe Kiela, Suvrat Bhooshan, Hamed Firooz, Ethan Perez, and Davide Testuggine. Supervised multimodal bitransformers for classifying images and text. arXiv preprint arXiv:1909.02950, 2019.
|
| 224 |
+
[17] Ranjay Krishna, Yuke Zhu, Oliver Groth, Justin Johnson, Kenji Hata, Joshua Kravitz, Stephanie Chen, Yannis Kalantidis, Li-Jia Li, David A Shamma, et al. Visual genome: Connecting language and vision using crowdsourced dense image annotations. International journal of computer vision, 123(1):32–73, 2017.
|
| 225 |
+
[18] Taku Kudo and John Richardson. Sentencepiece: A simple and language independent subword tokenizer and detokenizer for neural text processing. arXiv preprint arXiv:1808.06226, 2018.
|
| 226 |
+
[19] Georgia Tech Visual Intelligence Lab. Vqa python api and evaluation code. https://github. com/GT-Vision-Lab/VQA.
|
| 227 |
+
[20] Brian Lester, Rami Al-Rfou, and Noah Constant. The power of scale for parameter-efficient prompt tuning. arXiv preprint arXiv:2104.08691, 2021.
|
| 228 |
+
[21] Patrick Lewis, Ethan Perez, Aleksandra Piktus, Fabio Petroni, Vladimir Karpukhin, Naman Goyal, Heinrich Küttler, Mike Lewis, Wen tau Yih, Tim Rocktäschel, Sebastian Riedel, and Douwe Kiela. Retrieval-augmented generation for knowledge-intensive nlp tasks, 2021.
|
| 229 |
+
[22] Sheng Li, Zhiqiang Tao, Kang Li, and Yun Fu. Visual to text: Survey of image and video captioning. IEEE Transactions on Emerging Topics in Computational Intelligence, 3(4):297– 312, 2019.
|
| 230 |
+
[23] Xiang Lisa Li and Percy Liang. Prefix-tuning: Optimizing continuous prompts for generation. arXiv preprint arXiv:2101.00190, 2021.
|
| 231 |
+
[24] Xiujun Li, Xi Yin, Chunyuan Li, Pengchuan Zhang, Xiaowei Hu, Lei Zhang, Lijuan Wang, Houdong Hu, Li Dong, Furu Wei, Yejin Choi, and Jianfeng Gao. Oscar: Object-semantics aligned pre-training for vision-language tasks, 2020.
|
| 232 |
+
[25] Jiasen Lu, Dhruv Batra, Devi Parikh, and Stefan Lee. Vilbert: Pretraining task-agnostic visiolinguistic representations for vision-and-language tasks. arXiv preprint arXiv:1908.02265, 2019.
|
| 233 |
+
[26] Kevin Lu, Aditya Grover, Pieter Abbeel, and Igor Mordatch. Pretrained transformers as universal computation engines. arXiv preprint arXiv:2103.05247, 2021.
|
| 234 |
+
[27] Kenneth Marino, Mohammad Rastegari, Ali Farhadi, and Roozbeh Mottaghi. Ok-vqa: A visual question answering benchmark requiring external knowledge. In 2019 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pages 3190–3199. IEEE Computer Society, 2019.
|
| 235 |
+
[28] Fabio Petroni, Tim Rocktäschel, Patrick S. H. Lewis, Anton Bakhtin, Yuxiang Wu, Alexander H. Miller, and Sebastian Riedel. Language models as knowledge bases? CoRR, abs/1909.01066, 2019.
|
| 236 |
+
[29] Alec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh, Sandhini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, Gretchen Krueger, and Ilya Sutskever. Learning transferable visual models from natural language supervision, 2021.
|
| 237 |
+
[30] Alec Radford, Jeffrey Wu, R. Child, David Luan, Dario Amodei, and Ilya Sutskever. Language models are unsupervised multitask learners, 2019.
|
| 238 |
+
[31] Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J Liu. Exploring the limits of transfer learning with a unified text-to-text transformer. arXiv preprint arXiv:1910.10683, 2019.
|
| 239 |
+
[32] Aniruddh Raghu, Maithra Raghu, Samy Bengio, and Oriol Vinyals. Rapid learning or feature reuse? towards understanding the effectiveness of maml. arXiv preprint arXiv:1909.09157, 2019.
|
| 240 |
+
[33] Sachin Ravi and Hugo Larochelle. Optimization as a model for few-shot learning, 2016.
|
| 241 |
+
[34] Adam Roberts, Colin Raffel, and Noam Shazeer. How much knowledge can you pack into the parameters of a language model? arXiv preprint arXiv:2002.08910, 2020.
|
| 242 |
+
[35] 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.
|
| 243 |
+
[36] Thomas Scialom, Patrick Bordes, Paul-Alexis Dray, Jacopo Staiano, and Patrick Gallinari. What bert sees: Cross-modal transfer for visual question generation. arXiv preprint arXiv:2002.10832, 2020.
|
| 244 |
+
[37] Piyush Sharma, Nan Ding, Sebastian Goodman, and Radu Soricut. Conceptual captions: A cleaned, hypernymed, image alt-text dataset for automatic image captioning. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 2556–2565, 2018.
|
| 245 |
+
[38] Peter Shaw, Jakob Uszkoreit, and Ashish Vaswani. Self-attention with relative position representations, 2018.
|
| 246 |
+
[39] Mohammad Shoeybi, Mostofa Patwary, Raul Puri, Patrick LeGresley, Jared Casper, and Bryan Catanzaro. Megatron-lm: Training multi-billion parameter language models using model parallelism, 2020.
|
| 247 |
+
[40] Weijie Su, Xizhou Zhu, Yue Cao, Bin Li, Lewei Lu, Furu Wei, and Jifeng Dai. Vl-bert: Pre-training of generic visual-linguistic representations. arXiv preprint arXiv:1908.08530, 2019.
|
| 248 |
+
[41] Yingtao Tian and Jesse Engel. Latent translation: Crossing modalities by bridging generative models, 2019.
|
| 249 |
+
[42] 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.
|
| 250 |
+
[43] Oriol Vinyals, Charles Blundell, Timothy Lillicrap, Koray Kavukcuoglu, and Daan Wierstra. Matching networks for one shot learning. arXiv preprint arXiv:1606.04080, 2016.
|
| 251 |
+
[44] Jialin Wu, Jiasen Lu, Ashish Sabharwal, and Roozbeh Mottaghi. Multi-modal answer validation for knowledge-based vqa, 2021.
|
| 252 |
+
[45] Xiaohua Zhai, Alexander Kolesnikov, Neil Houlsby, and Lucas Beyer. Scaling vision transformers, 2021.
|
| 253 |
+
[46] Zachary M Ziegler, Luke Melas-Kyriazi, Sebastian Gehrmann, and Alexander M Rush. Encoderagnostic adaptation for conditional language generation. arXiv preprint arXiv:1908.06938, 2019.
|
md/train/X2K8KVEaAXG/X2K8KVEaAXG.md
ADDED
|
@@ -0,0 +1,219 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Unsupervised Object-Level Representation Learning from Scene Images
|
| 2 |
+
|
| 3 |
+
Jiahao Xie1 Xiaohang Zhan2 Ziwei Liu1 Yew Soon Ong1,3 Chen Change Loy1
|
| 4 |
+
|
| 5 |
+
1Nanyang Technological University 2The Chinese University of Hong Kong 3A\*STAR, Singapore {jiahao003, ziwei.liu, asysong, ccloy}@ntu.edu.sg xiaohangzhan@outlook.com
|
| 6 |
+
|
| 7 |
+
# Abstract
|
| 8 |
+
|
| 9 |
+
Contrastive self-supervised learning has largely narrowed the gap to supervised pre-training on ImageNet. However, its success highly relies on the object-centric priors of ImageNet, i.e., different augmented views of the same image correspond to the same object. Such a heavily curated constraint becomes immediately infeasible when pre-trained on more complex scene images with many objects. To overcome this limitation, we introduce Object-level Representation Learning (ORL), a new self-supervised learning framework towards scene images. Our key insight is to leverage image-level self-supervised pre-training as the prior to discover object-level semantic correspondence, thus realizing object-level representation learning from scene images. Extensive experiments on COCO show that ORL significantly improves the performance of self-supervised learning on scene images, even surpassing supervised ImageNet pre-training on several downstream tasks. Furthermore, ORL improves the downstream performance when more unlabeled scene images are available, demonstrating its great potential of harnessing unlabeled data in the wild. We hope our approach can motivate future research on more general-purpose unsupervised representation learning from scene data.1
|
| 10 |
+
|
| 11 |
+
# 1 Introduction
|
| 12 |
+
|
| 13 |
+
Unsupervised visual representation learning aims at obtaining transferable features with abundant unlabeled data. Recent self-supervised learning (SSL) methods based on contrastive learning [60, 22, 37, 5, 19, 4, 7] have largely narrowed the gap and even surpassed the supervised counterpart on a number of downstream tasks [30, 49, 15, 47, 35, 23]. These methods build upon the instance discrimination task that maximizes the agreement between different data-augmented views of the same image. Despite their success, current SSL methods are primarily pre-trained on the unlabeled ImageNet [8] dataset that contains iconic images with single object as shown in Figure 1(a). The underlying object-centric constraint of ImageNet makes it hard to be applied in real world scenarios where more complex scene images with multiple objects are available. Meanwhile, naïvely adopting the off-the-shelf contrastive learning methods on scene images introduces inconsistent learning signals since random crops of the same image may correspond to different objects as shown in Figure 1(b). Indeed, it has been shown that current contrastive learning methods tend to struggle on more complex scene datasets [19, 50, 34, 58] like COCO [33] or Places365 [72]. Therefore, it is imperative to design an effective object-level representation learning paradigm as illustrated in Figure 1(c) to harness massive unlabeled scene images in the wild.
|
| 14 |
+
|
| 15 |
+

|
| 16 |
+
|
| 17 |
+
Figure 1: (a) Current image-level contrastive learning methods heavily rely on the object-centric bias of ImageNet, i.e., different crops correspond to the same object. Prior works use either the different views of the same image [60, 22, 37, 5, 19, 7] (i.e., intra-image) or similar images [74, 63, 1, 11] (i.e., inter-image) to form positive pairs. (b) Directly adopting image-level contrastive learning methods on scene images can cause inconsistent learning signals since different crops may correspond to different objects. (c) Object-level contrastive learning can overcome the limitation in (b) by enforcing object-level consistency. (d) We find that image-level contrastive learning encodes priors for region correspondence discovery across images, and high-response regions are usually objects or object parts (we show one discovered object-instance pair per image pair for clarity), which is useful for object-level representation learning.
|
| 18 |
+
|
| 19 |
+
In this work, we are interested in going beyond ImageNet to obtain better representations on noniconic images. Apparently, it is challenging to learn representations from scene-level images since they are entangled with many concepts including structures, objects, backgrounds and relationships. It remains an open question how to take advantages of spatial information of multiple objects naturally residing in the scene images when no object annotations are available, let alone further deriving object-level correspondence to construct positive object-instance pairs.
|
| 20 |
+
|
| 21 |
+
To tackle these challenges, we introduce a novel object-level unsupervised representation learning framework tailored for scene images. Our framework is based on a key insight of the current contrastive learning methods: they can implicitly group different images with similar visual concepts together even though they are explicitly optimized to group different views of the same image. This phenomenon reveals that image-level contrastive learning has already induced a latent space with rich visual concepts. Though the latent space usually entangles other scene concepts like structures, backgrounds and relationships, it will be useful for object discovery if appropriately deployed. Through computing the similarity of sampled regions between $k$ -nearest-neighbor (KNN) images, we conclude two observations: 1) image-level contrastive learning encodes priors for region correspondence discovery across images; 2) high-response regions are usually objects or object parts.
|
| 22 |
+
|
| 23 |
+
Based on the observation above, we propose a multi-stage framework for unsupervised object-level representation learning. Specifically, we first extract potential object-based regions in scene images using the unsupervised region proposal algorithms (e.g., selective search [56]). We then propose a region correspondence generation scheme to leverage the off-the-shelf image-level contrastive learning pre-trained model to discover corresponding object-instance pairs for the proposed regions in the embedding space. Finally, we use the obtained object-instance pairs to construct positive sample pairs for object-level representation learning. Figure 1(d) shows several cross-image object-instance pairs discovered by our framework on COCO dataset using the latent prior of BYOL [19], the state-of-the-art image-level contrastive learning method. The discovered inter-corresponding pairs substantially provide diverse intra-class variances at the object-instance level to aid object-level representation learning.
|
| 24 |
+
|
| 25 |
+
Overall, our main contributions are summarized as follows:
|
| 26 |
+
|
| 27 |
+
1) We observe that existing image-level contrastive learning methods have priors to discover objectlevel correspondence across images. We leverage this prior for the first time for unsupervised cross-image object-level correspondence discovery.
|
| 28 |
+
|
| 29 |
+
2) With the obtained correspondence, we introduce a novel multi-stage self-supervised learning pipeline, termed as ORL, for object-level representation learning from scene images, going beyond object-centric ImageNet.
|
| 30 |
+
|
| 31 |
+
3) We contribute the first study for object-level SSL. ORL substantially outperforms image-level contrastive learning approaches pre-trained on COCO dataset $\mathord { \sim } 1 1 8 \mathrm { k }$ images with labels discarded), setting a new state of the art on this challenging dataset that contains diverse scenes in the wild. The COCO pre-trained ORL even surpasses supervised ImageNet pre-training on several considered downstream tasks. When SSL is conducted on a larger ${ } ^ { 6 6 } \mathrm { C O C O + } { } ^ { , }$ dataset (COCO train2017 set plus COCO unlabeled2017 set, ${ \sim } 2 4 1 \mathrm { k }$ images in total), ORL further improves the performance, demonstrating its potential to benefit from more unlabeled scene data.
|
| 32 |
+
|
| 33 |
+
# 2 Related work
|
| 34 |
+
|
| 35 |
+
Self-supervised learning. Self-supervised learning builds unsupervised representations by exploiting the internal priors or structures of data in the form of a pretext task. A wide range of pretext tasks have been proposed in the past few years. Examples include patch context prediction [10], jigsaw puzzles [39], inpainting [43], colorization [31, 70], cross-channel prediction [71], visual primitive counting [40], and rotation prediction [14]. Although good representations emerge with these pretext tasks, they are prone to lose generality due to their hand-crafted nature.
|
| 36 |
+
|
| 37 |
+
Recently, contrastive learning [20] that performs instance discrimination [60, 22, 37, 5, 19, 4, 7] has shown great potential in this field, largely narrowing the gap to fully supervised learning. The core idea of contrastive learning is to gather positive pairs and separate negative pairs in the embedding space. A positive pair is usually formed with two transformed views of the same image while the negative pairs are formed with different images. Typically, contrastive learning methods require a large number of negative samples to avoid mode collapse. These samples can be maintained within a mini-batch [42, 27, 66, 26, 2, 5], a memory bank [60, 53, 74, 37] or a queue [22, 6]. BYOL [19] and SwAV [4] further remove the necessity of involving negative pairs. BYOL directly predicts the features of one view from another view, while SwAV predicts the cluster assignments between multiple views of the same image. Despite their improved performance, the existing image-level contrastive learning methods are largely confined to the underlying object-centric bias of ImageNet.
|
| 38 |
+
|
| 39 |
+
More recently, a group of works that perform pixel-level [45, 58, 64, 50, 34, 25] or region-level [48, 65, 61, 62, 9] representation learning have emerged. Our work is more related to region-level representation learning but substantially different from this line of research in the following aspects: 1) they still largely pre-train on object-centric ImageNet while we pre-train on non-iconic scene images, 2) they align pre-training specifically for dense prediction downstream tasks while we target at more general-purpose representation learning that improves performance in both dense prediction and classification tasks, 3) their randomly cropped local regions do not contain the explicit object notion as ours, and 4) they only rely on intra-image transformations (e.g., random cropping) to construct corresponding positive pairs from the same image while we leverage the discovered high-level semantic correspondence to construct positive pairs across images.
|
| 40 |
+
|
| 41 |
+
There are also a few prior attempts [18, 3, 16] for self-supervised learning on non-curated scene images. As opposed to our work, most of them consider larger models and datasets to explore the limit of current self-supervised learning methods without further considering the object-level information residing in scene images.
|
| 42 |
+
|
| 43 |
+
Visual correspondence. Visual correspondence aims at finding pairwise pixels or regions across images that result from the same scene [67], which can be regarded as similarity learning of visual descriptors among matched points or patches. While early efforts learn dense correspondence with labeled data [21, 68, 29, 55, 41], some recent works learn the similarity between the parts or landmarks of the data in an unsupervised manner [52, 51]. Our work substantially differs from this line of research from original intention. Previous works aim at accurately detecting all correspondence given two images, whereas our work focuses on retrieving high-quality correspondence to improve representation learning.
|
| 44 |
+
|
| 45 |
+

|
| 46 |
+
Figure 2: Overview of our three-stage pipeline. In Stage 1, we pre-train an image-level contrastive learning model, e.g., BYOL. In Stage 2, we first use the pre-trained model to retrieve KNNs for each image in the embedding space to obtain image-level visually similar pairs. We then use unsupervised region proposal algorithms (e.g., selective search) to generate rough RoIs for each image pair. Afterwards, we reuse the pre-trained model to retrieve the top-ranked RoI pairs, i.e., correspondence. We find these pairs of RoIs are almost objects or object parts. In Stage 3, with the corresponding RoI pairs discovered across images, we finally perform object-level contrastive learning using the same architecture as Stage 1.
|
| 47 |
+
|
| 48 |
+
# 3 Methodology
|
| 49 |
+
|
| 50 |
+
We propose a new multi-stage self-supervised learning framework, i.e., ORL, for object-level representation learning from scene images. ORL extends the existing image-level contrastive learning framework to object level by leveraging priors from image-level instance discrimination. The overall pipeline of ORL is illustrated in Figure 2. It contains three stages: image-level pre-training, correspondence discovery, and object-level pre-training. We detail each stage as follows.
|
| 51 |
+
|
| 52 |
+
# 3.1 ORL pipeline
|
| 53 |
+
|
| 54 |
+
Preliminary: Contrastive learning. Our pipeline contains several contrastive learning modules in Stage 1 and 3. Without loss of generality, we consider BYOL [19] as our basic contrastive learning module. BYOL uses two neural networks: the online network $f _ { \boldsymbol { \theta } } ( \boldsymbol { x } )$ and the target network $g _ { \xi } ( x )$ The target network provides the regression target to train the online network while its weights $\xi$ are updated by an exponential moving average of the online parameters $\theta$ with a decay rate $\tau \in [ 0 , 1 ]$ following BYOL. Given two input images $x _ { 1 }$ and $x _ { 2 }$ , the loss function is defined as:
|
| 55 |
+
|
| 56 |
+
$$
|
| 57 |
+
\mathcal { L } \left( \boldsymbol { x } _ { 1 } , \boldsymbol { x } _ { 2 } \right) \triangleq \left. \boldsymbol { f } _ { \boldsymbol { \theta } } \left( \boldsymbol { x } _ { 1 } \right) - \boldsymbol { g } _ { \boldsymbol { \xi } } \left( \boldsymbol { x } _ { 2 } \right) \right. _ { 2 } ^ { 2 } ,
|
| 58 |
+
$$
|
| 59 |
+
|
| 60 |
+
We name it an “intra-” version of BYOL if $x _ { 1 }$ and $x _ { 2 }$ are two augmented views from the same image, otherwise an “inter-” one.
|
| 61 |
+
|
| 62 |
+
Stage 1: Image-level pre-training. The foremost stage is to obtain an unsupervised pre-trained model from image-level tasks. As shown in Figure 2 Stage 1, given two augmented views $v$ and $v ^ { \prime }$ from the same input image $x$ , we pre-train the network following the loss function ${ \mathcal { L } } _ { \mathrm { i m a g e } } = { \mathcal { L } } \left( v , v ^ { \prime } \right)$ constituting a standard image-level BYOL pre-training. This stage can be freely replaced with other image-level contrastive learning methods. We adopt BYOL here for its simplicity and effectiveness.
|
| 63 |
+
|
| 64 |
+
Stage 2: Correspondence discovery. We employ the pre-trained image-level contrastive learning model in Stage 1 to mine object-level correspondence for the whole dataset. As shown in Figure 2 Stage 2, the overall discovery process comprises three steps.
|
| 65 |
+
|
| 66 |
+
(i) Image-level nearest-neighbor retrieval. Specifically, for each query image $x$ in the training set $\mathcal { D }$ , we first retrieve its top $K$ nearest neighbors $\mathcal { N } _ { k }$ , $k = 1 , . . . , K$ , by cosine distance in the embedding space using the features learned from the first stage to form image-level pairs that contain similar visual context.
|
| 67 |
+
|
| 68 |
+
(ii) Region-of-interest (RoI) generation. To generate object-based RoIs, we apply unsupervised region proposal algorithms, e.g., selective search [56], for each image in the pair. Considering the redundancy of generated proposals (each image can have thousands of proposals), we filter certain number of them with some pre-defined thresholds2 including the minimal scale, the range of aspect ratio, and the maximal intersection-over-union (IoU) among the filtered boxes. After the filtering operation, we select the top 100 proposals ranked with objectiveness as the candidate RoI set for subsequent RoI pair retrieval. To extract features with the equally-sized input that is compatible with the backbone, we crop and resize each RoI to $2 2 4 \times 2 2 4$ . Note that even top RoIs ranked with objectiveness are still very noisy, containing a large proportion of non-object regions.
|
| 69 |
+
|
| 70 |
+
(iii) Top-ranked RoI pair retrieval. For each query RoI from $x$ , we compute its cosine similarity in the embedding space with all RoIs from its nearest-neighbor image $\mathcal { N } _ { k }$ using the features learned from Stage 1 again. Within the calculated cosine similarity matrix $\bar { \mathbf { M } } _ { k } \in \mathbb { R } ^ { 1 0 0 \bar { \times } 1 0 0 }$ , we retrieve top-ranked $N$ RoI pairs to construct the set of object-level corresponding pairs $\{ B _ { k } ^ { n } \}$ , where $n = \{ 1 , . . . , N \}$ These high-response corresponding regions are almost objects or object parts. Finally, we save the nearest-neighbor image id and bounding box coordinate information of each corresponding pair.
|
| 71 |
+
|
| 72 |
+
Stage 3: Object-level pre-training. With the corresponding inter-image RoI (inter-RoI) pairs obtained in Stage 2, we perform object-level representation learning following the BYOL framework as shown in Figure 2 Stage 3. Specifically, given an input image $x$ , we first randomly select one nearest-neighbor image $\mathcal { N } _ { k }$ to obtain the corresponding set of inter-RoI pairs $\{ B _ { k } ^ { n } \}$ . We then randomly select one inter-RoI pair $B _ { k } ^ { n }$ as a positive pair. With the bounding box coordinate stored in $B _ { k } ^ { n }$ , we crop the corresponding inter-RoIs from $x$ and $\mathcal { N } _ { k }$ , respectively, and resize each patch to $9 \ddot { 6 } \times 9 6$ , constituting two patches $p _ { 1 }$ and $p _ { 2 }$ . We feed the two patches to the online network and target network separately to compute the loss $\mathcal { L } _ { \mathrm { i n t e r - R o I } } = \mathcal { L } \left( p _ { 1 } , p _ { 2 } \right)$ .
|
| 73 |
+
|
| 74 |
+
To make full use of discovered objects, we introduce the intra-RoI contrastive learning via augmenting object patches. Specifically, we randomly select one filtered bounding box from $x$ obtained in Stage 2, and spatially jitter the box around its original location with the following operations3: (i) a random box center shifting within $50 \%$ of its width and height, (ii) a random area scaling between $50 \%$ and $200 \%$ of the original box, and (iii) a random aspect ratio between $1 / 2$ and $2 / 1$ . Similarly, we crop the two intra-RoIs $p$ and $p ^ { \prime }$ , and resize each patch to $9 6 \times 9 6$ for forward propagation to compute the loss $\mathcal { L } _ { \mathrm { \scriptsize { i n t r a - R o I } } } = \mathcal { L } \left( p , p ^ { \prime } \right)$ . The diverse spatial jittering of the bounding box encourages the network to preserve common object information and disregard the background, thus further improving the localization ability.
|
| 75 |
+
|
| 76 |
+
We keep the two original global views in BYOL as well since they preserve the global image-level information compared with the local patches. The final loss for our ORL can thus be formulated as:
|
| 77 |
+
|
| 78 |
+
$$
|
| 79 |
+
\mathcal { L } _ { \mathrm { O R L } } = \lambda _ { 1 } \mathcal { L } _ { \mathrm { i m a g e } } + \lambda _ { 2 } \mathcal { L } _ { \mathrm { i n t r a - R o I } } + \lambda _ { 3 } \mathcal { L } _ { \mathrm { i n t e r - R o I } } ,
|
| 80 |
+
$$
|
| 81 |
+
|
| 82 |
+
where $\lambda _ { 1 } , \lambda _ { 2 } , \lambda _ { 3 }$ are the loss weights to balance each term. We set all loss weights to 1 by default. Following BYOL, we also compute the symmetric loss $\widetilde { \mathcal { L } } _ { \mathrm { { o R L } } }$ by separately feeding $v ^ { \prime } , p ^ { \prime } , p _ { 2 }$ to the online network and $v , p , p _ { 1 }$ to the target network.
|
| 83 |
+
|
| 84 |
+
# 3.2 Implementation details
|
| 85 |
+
|
| 86 |
+
Dataset. We pre-train our models on the COCO train2017 set that contains ${ \sim } 1 1 8 \mathrm { k }$ images without using labels. Compared with the heavily curated object-centric ImageNet dataset, COCO contains more natural and diverse scenes in the wild, which is closer to real-world scenarios. We also perform self-supervised learning on a larger ${ } ^ { \cdot \cdot } \mathrm { C O C O } { + } ^ { \prime \cdot }$ dataset (COCO train2017 set plus COCO unlabeled2017 set) to verify whether our method can benefit from more unlabeled scene data.
|
| 87 |
+
|
| 88 |
+
Image augmentations. The global image augmentation setting is the same as BYOL [19]: a $2 2 4 \times 2 2 4$ -pixel random resized crop with a random horizontal flip, followed by a random color distortion, random grayscale conversion, random Gaussian blur and solarization. For the local patch augmentation, we directly crop the corresponding intra-RoI and inter-RoI on the input images, and resize each cropped patch to $9 6 \times 9 6$ to take place of the random resized cropping. The subsequent augmentations exactly follow the global ones.
|
| 89 |
+
|
| 90 |
+
Network architecture. We adopt ResNet-50 [24] as the default backbone. We use the same MLP projector and predictor as in BYOL: a linear layer with output size 4096 followed by batch normalization (BN) [28], rectified linear units (ReLU) [38], and a final linear layer with output dimension 256. We share the backbone and projector weights among the global and two local branches while the weights of predictor are not shared.
|
| 91 |
+
|
| 92 |
+
Optimization. For pre-training in Stage 1 and Stage 3, we use the same training hyper-parameters. Specifically, we use the SGD optimizer with a weight decay of 0.0001 and a momentum of 0.9. We adopt the cosine learning rate decay schedule [36] with a base learning rate of 0.2, linearly scaled[17] with the batch size $l r = 0 . 2 \times \mathrm { ~ F ~ }$ atchSize/256). The batch size is set to 512 by default, which is friendly to typical 8-GPU implementations. To keep the training iterations comparable with the ImageNet supervised pre-training, we train our models for 800 epochs with a warm-up period of 4 epochs. The exponential moving average parameter $\tau$ starts from 0.99 and is increased to 1 during training, following [19]. For correspondence generation in Stage 2, we retrieve top $K = 1 0$ nearest neighbors for each image and select top-ranked $N = 1 0 \%$ RoI pairs for each image-level nearest-neighbor pair.
|
| 93 |
+
|
| 94 |
+
# 4 Experiments
|
| 95 |
+
|
| 96 |
+
# 4.1 Transferring to downstream tasks
|
| 97 |
+
|
| 98 |
+
We evaluate the quality of learned representations by transferring them to multiple downstream tasks. Following common protocol [18, 37], we use two evaluation setups: (i) the pre-trained network is frozen as a feature extractor, and (ii) the network parameters are fully fine-tuned as weight initialization. We provide more experimental details in the supplementary material.
|
| 99 |
+
|
| 100 |
+
Table 1: Image classification with linear models. All unsupervised methods are based on 800-epoch pretraining on $\mathrm { C O C O ( + ) }$ with ResNet-50. We report mAP on the VOC07 dataset and top-1 center-crop accuracy on all other datasets. Numbers for all other methods are reproduced by us.
|
| 101 |
+
|
| 102 |
+
<table><tr><td>Method</td><td>Pre-train data</td><td>VOC07 mAP</td><td>ImageNet Top-1</td><td>Places205 Top-1</td><td>iNat. Top-1</td></tr><tr><td>Random [18]</td><td>=</td><td>9.6</td><td>13.7</td><td>16.6</td><td>4.8</td></tr><tr><td>Supervised [37]</td><td>ImageNet</td><td>87.5</td><td>75.9</td><td>51.5</td><td>45.4</td></tr><tr><td>SimCLR [5]</td><td>COCO</td><td>78.1</td><td>50.9</td><td>48.0</td><td>22.7</td></tr><tr><td>MoCo v2 [6]</td><td>COCO</td><td>82.2</td><td>55.1</td><td>48.8</td><td>27.8</td></tr><tr><td>BYOL[19]</td><td>COCO</td><td>84.5</td><td>57.8</td><td>50.5</td><td>29.5</td></tr><tr><td>ORL (ours)</td><td>COCO</td><td>86.7</td><td>59.0</td><td>52.7</td><td>31.8</td></tr><tr><td>BYOL [19]</td><td>COCO+</td><td>87.0</td><td>59.6</td><td>52.7</td><td>30.9</td></tr><tr><td>ORL (ours)</td><td>COCO+</td><td>88.6</td><td>60.7</td><td>54.1</td><td>32.0</td></tr></table>
|
| 103 |
+
|
| 104 |
+
<table><tr><td rowspan="2">Method</td><td rowspan="2">Pre-train data</td><td colspan="7">VOC07 low-shot (mAP)</td></tr><tr><td>1</td><td>2</td><td>4</td><td>8</td><td>16</td><td>32</td><td>64</td></tr><tr><td>Random</td><td>=</td><td>9.2</td><td>9.4</td><td>11.1</td><td>12.3</td><td>14.3</td><td>17.4</td><td>21.3</td><td>23.8</td></tr><tr><td>Supervied</td><td>ImageNet</td><td>53.0</td><td>63.6</td><td>73.7</td><td>78.8</td><td>81.8</td><td>83.8</td><td>85.2</td><td>86.0</td></tr><tr><td>SimCLR [5] MoCo v2 [6]</td><td>CoCo</td><td>33.3</td><td>43.5</td><td>52.5</td><td>61.1</td><td>66.7</td><td>70.5</td><td>73.7</td><td>75.0</td></tr><tr><td>BYOL [19]</td><td>COCO</td><td>39.5</td><td>49.3</td><td>60.4</td><td>69.3</td><td>74.1</td><td>76.8</td><td>79.1</td><td>80.1</td></tr><tr><td>ORL (ours)</td><td>COCO COCO</td><td>39.4</td><td>50.9</td><td>62.2</td><td>71.7</td><td>76.6</td><td>79.2</td><td>81.3</td><td>82.2</td></tr><tr><td></td><td></td><td>39.6</td><td>51.2</td><td>63.4</td><td>72.6</td><td>78.2</td><td>81.3</td><td>83.6</td><td>84.7</td></tr><tr><td>BYOL [19] ORL (ours)</td><td>COCO+</td><td>41.1</td><td>54.3</td><td>66.6</td><td>75.2</td><td>80.1</td><td>82.6</td><td>84.6</td><td>85.4</td></tr><tr><td></td><td>COCO+</td><td>42.1</td><td>54.9</td><td>67.4</td><td>75.7</td><td>81.3</td><td>83.7</td><td>85.8</td><td>86.7</td></tr></table>
|
| 105 |
+
|
| 106 |
+
Table 2: Low-shot image classification on VOC07 using linear SVMs trained on the fixed representations. All unsupervised methods are pre-trained on $\mathrm { C O C O ( + ) }$ for 800 epochs with ResNet-50. We report mAP for each case across five runs.
|
| 107 |
+
|
| 108 |
+
Image classification with linear models. Following [18, 37], we assess the quality of features by training linear classifiers on top of the fixed representations extracted from different depths of the network for four datasets: VOC07 [12], ImageNet [8], Places205 [73], and iNaturalist18 [57]. These datasets involve diverse classification tasks ranging from object classification, scene recognition to fine-grained recognition. For VOC07, we train linear SVMs using LIBLINEAR package [13]
|
| 109 |
+
|
| 110 |
+
Table 3: Semi-supervised learning on ImageNet. All unsupervised methods are pre-tained on $\mathrm { C O C O ( + ) }$ for 800 epochs with ResNet-50. We fine-tune all models with $1 \%$ and $10 \%$ ImageNet labels, and report both top-1 and top-5 center-crop accuracy on the ImageNet validation set.
|
| 111 |
+
|
| 112 |
+
<table><tr><td>Method</td><td>Pre-train</td><td colspan="2">1% labels</td><td colspan="2">10% labels</td></tr><tr><td></td><td>data</td><td>Top-1</td><td>Top-5</td><td>Top-1</td><td>Top-5</td></tr><tr><td>Random</td><td></td><td>1.6</td><td>5.0</td><td>21.8</td><td>44.2</td></tr><tr><td>Supervised [69]</td><td>ImageNet</td><td>25.4</td><td>48.4</td><td>56.4</td><td>80.4</td></tr><tr><td>SimCLR [5]</td><td>CoCo</td><td>23.4</td><td>46.4</td><td>52.2</td><td>77.4</td></tr><tr><td>MoCo v2 [6]</td><td>COCO</td><td>28.2</td><td>54.7</td><td>57.1</td><td>81.7</td></tr><tr><td>BYOL[19]</td><td>COCO</td><td>28.4</td><td>55.9</td><td>58.4</td><td>82.7</td></tr><tr><td>ORL (ours)</td><td>CoCo</td><td>31.0</td><td>58.9</td><td>60.5</td><td>84.2</td></tr><tr><td>BYOL[19]</td><td>COCO+</td><td>28.3</td><td>56.0</td><td>59.4</td><td>83.6</td></tr><tr><td>ORL (ours)</td><td>COCO+</td><td>31.8</td><td>60.1</td><td>60.9</td><td>84.4</td></tr></table>
|
| 113 |
+
|
| 114 |
+
<table><tr><td rowspan="2">Method</td><td rowspan="2">Pre-train data</td><td colspan="3">COCO detection</td><td colspan="3">COCO instance seg.</td></tr><tr><td>Ap66</td><td>AP</td><td>AP</td><td>Apmk</td><td>APk</td><td>AP</td></tr><tr><td>Random [54]</td><td></td><td>32.8</td><td>50.9</td><td>35.3</td><td>29.9</td><td>47.9</td><td>32.0</td></tr><tr><td>Supervised [54]</td><td>ImageNet</td><td>39.7</td><td>59.5</td><td>43.3</td><td>35.9</td><td>56.6</td><td>38.6</td></tr><tr><td>SimCLR [5]</td><td>COCO</td><td>37.0</td><td>56.8</td><td>40.3</td><td>33.7</td><td>53.8</td><td>36.1</td></tr><tr><td>MoCo v2 [6]</td><td>COCO</td><td>38.5</td><td>58.1</td><td>42.1</td><td>34.8</td><td>55.3</td><td>37.3</td></tr><tr><td>Self-EMD [34]</td><td>COCo</td><td>39.3</td><td>60.1</td><td>42.8</td><td>-</td><td>-</td><td>-</td></tr><tr><td>DenseCL [58]</td><td>COCo</td><td>39.6</td><td>59.3</td><td>43.3</td><td>35.7</td><td>56.5</td><td>38.4</td></tr><tr><td>BYOL[19]</td><td>COCO</td><td>39.5</td><td>59.3</td><td>43.2</td><td>35.6</td><td>56.5</td><td>38.2</td></tr><tr><td>ORL (ours)</td><td>COCO</td><td>40.3</td><td>60.2</td><td>44.4</td><td>36.3</td><td>57.3</td><td>38.9</td></tr><tr><td>BYOL[19]</td><td>COCO+</td><td>40.0</td><td>60.1</td><td>44.0</td><td>36.2</td><td>57.1</td><td>39.0</td></tr><tr><td>ORL (ours)</td><td>COCO+</td><td>40.6</td><td>60.8</td><td>44.5</td><td>36.7</td><td>57.9</td><td>39.3</td></tr></table>
|
| 115 |
+
|
| 116 |
+
Table 4: Object detection and instance segmentation fine-tuned on COCO. All unsupervised methods are based on 800-epoch pre-training on $\mathrm { C O C O ( + ) }$ . We use Mask R-CNN R50-FPN ( $1 \times$ schedule), and report bounding-box AP $( \mathrm { A } \mathbf { \hat { P } } ^ { b b } )$ and mask AP $( \mathbf { A } \mathbf { P } ^ { m k } )$ . Numbers for MoCo v2 are adopted from [58].
|
| 117 |
+
|
| 118 |
+
following the setup in [18, 37]. We train on trainval split of VOC07 and evaluate mAP on test split. For ImageNet, Places205 and iNaturalist18, we follow [71, 18, 37] and train a 1000-way, 205-way and 8142-way linear classifier, respectively. We train on train split of each dataset, and report top-1 center-crop accuracy on the respective val split. Table 1 reports the results for the best-performing layer of each method. ORL substantially outperforms the BYOL baseline on all four datasets. We also observe that the COCO pre-trained ORL surpasses the supervised ImageNet pre-trained counterpart on Places205 by $1 . 2 \%$ in top-1 accuracy. This is the first time that a selfsupervised learner outperforms the ImageNet pre-training using only ${ \sim } 1 / 1 0$ images compared with ImageNet. When pre-trained on a larger $\mathrm { C O C O + }$ dataset, ORL again outperforms BYOL. Note that apart from Places205 $2 . 6 \%$ gains), ORL also surpasses the supervised ImageNet counterpart on VOC07 by $1 . 1 \%$ mAP, using merely ${ \sim } 1 / 5$ images.
|
| 119 |
+
|
| 120 |
+
Low-shot image classification. We perform low-shot image classification with few training examples per class on VOC07 dataset following the same setup in [18]. We vary the number of labeled examples per category used to train linear SVMs on train split of VOC07 and report the average mAP across five independent samples for each low-shot case evaluated on test split. Table 2 provides the results. ORL shows consistent performance improvement over BYOL for each low-shot value, with larger gains achieved as the number of labeled examples per class is increasing. ORL also gradually bridges the gap to the supervised ImageNet pre-training under this scenario. We observe consistent performance boost when pre-training on the $\mathrm { C O C O + }$ dataset. Note that the $\mathrm { C O C O + }$ pre-trained ORL again outperforms the supervised ImageNet pre-training when the low-shot samples are 64 and 96.
|
| 121 |
+
|
| 122 |
+
Semi-supervised learning. We perform semi-supervised learning on ImageNet following the protocol of previous studies [60, 26, 37, 5, 19]. Specifically, we first randomly select $1 \%$ and $10 \%$ labeled data from ImageNet train split. We then fine-tune our models on these two training subsets and report both top-1 and top-5 accuracy on the official val split of ImageNet in Table 3. Again, ORL outperforms BYOL as well as the supervised ImageNet counterpart by large margins.
|
| 123 |
+
|
| 124 |
+
Object detection and segmentation. We train a Mask R-CNN model [23] with R50-FPN backbone [32] implemented in Detectron2 [59]. We fine-tune all layers end-to-end on COCO train2017 split with the standard $1 \times$ schedule and evaluate on COCO val2017 split. We follow the same setup in [54], with batch normalization layers synchronized across GPUs [44]. As shown in Table 4, ORL yields $0 . 8 \%$ AP and $0 . 7 \%$ AP improvements over BYOL for object detection and instance segmentation, respectively. The improvements are consistent over all evaluation metrics. When pre-trained on the $\mathrm { C O C O + }$ dataset, ORL again outperforms BYOL. It should be well noted that ORL even outperforms the most recent Self-EMD and DenseCL that are specifically designed for dense prediction downstream tasks. More importantly, either COCO or $\mathrm { C O C O + }$ pre-trained ORL can surpass the supervised ImageNet pre-training on all metrics. This further demonstrates the superiority of learning unsupervised representations at the object level.
|
| 125 |
+
|
| 126 |
+
Table 5: Ablations for ORL. (a) Effect of intra-RoI and inter-RoI losses. (b) Effect of NNs and RoI pairs. (c) Comparison with multi-crop BYOL. (d) Comparison with ground truth bounding boxes. (e) Pre-trainig schedules. We report mAP of linear SVMs on VOC07 classification benchmark.
|
| 127 |
+
|
| 128 |
+
<table><tr><td colspan="5">(a)</td><td colspan="9">(b)</td></tr><tr><td colspan="2">pre-train</td><td>intra-RoI</td><td>inter-RoI</td><td>VOC07</td><td></td><td colspan="4"># of NNs</td><td colspan="4"># of RoI pairs</td></tr><tr><td colspan="2">BYOL</td><td></td><td></td><td>84.5 85.7</td><td></td><td></td><td>1</td><td>10</td><td></td><td>20</td><td>5%</td><td>10%</td><td>20%</td></tr><tr><td colspan="3">ORL</td><td>√ √</td><td>85.9</td><td></td><td>VOC07</td><td>84.7</td><td></td><td>86.7</td><td>87.0</td><td>86.1</td><td>86.7</td><td>86.4</td></tr><tr><td colspan="3"></td><td></td><td>86.7</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td colspan="5">(C)</td><td>(d)</td><td></td><td></td><td></td><td></td><td>(e)</td><td></td><td></td><td></td></tr><tr><td colspan="2">pre-train</td><td>input views</td><td>VOC07</td><td></td><td>boxes</td><td>VOC07</td><td>pre-train</td><td></td><td>100</td><td>200</td><td>400</td><td>800</td><td>1600</td></tr><tr><td colspan="2">BYOL</td><td>2 × 224+4×96</td><td>84.0</td><td></td><td>GT</td><td>85.4</td><td>BYOL</td><td>77.1</td><td></td><td>81.8</td><td>83.7</td><td>84.5</td><td>84.9</td></tr><tr><td colspan="2">ORL</td><td>2 × 224+4×96</td><td>86.7</td><td></td><td>SS</td><td>86.7</td><td>ORL</td><td></td><td>83.5</td><td>85.2</td><td>86.3</td><td>86.7</td><td>87.1</td></tr></table>
|
| 129 |
+
|
| 130 |
+
# 4.2 Ablation study
|
| 131 |
+
|
| 132 |
+
In this subsection, we conduct extensive ablation experiments to examine the effect of each component that contributes to ORL. We pre-train our models on COCO and observe the downstream performance of all ablations on VOC07 SVM classification benchmark as introduced in Section 4.1.
|
| 133 |
+
|
| 134 |
+
Effect of intra-RoI and inter-RoI losses. Table 5a ablates the effect of our introduced $\mathcal { L } _ { \mathrm { i n t r a - R o I } }$ and $\mathcal { L } _ { \mathrm { i n t e r - R o I } }$ losses in Equation 2. Adding either $\mathcal { L } _ { \mathrm { i n t r a - R o I } }$ or $\mathcal { L } _ { \mathrm { i n t e r - R o I } }$ can improve the performance, with the best results obtained by adding both terms.
|
| 135 |
+
|
| 136 |
+
Effect of nearest neighbors and RoI pairs. Table 5b ablates the effect of the number of nearest neighbors $K$ and RoI pairs $N$ used for generating inter-RoI pairs in Stage 2 of ORL. We set $N = 1 0 \%$ when ablating $K$ , and set $K = 1 0$ when ablating $N$ . We observe that retrieving more nearest neighbors leads to better performance since more nearest neighbors provide more diverse image-level pairs to the subsequent generation of inter-RoI pairs. Although setting $K = 2 0$ produces a slightly better performance, we choose $K = 1 0$ by default as a trade-off considering the tendency of the saturated performance. Our method is more robust to the number of retrieved top-ranked RoI pairs after image-level nearest-neighbor retrieval, with $N = 1 0 \%$ performing slightly better.
|
| 137 |
+
|
| 138 |
+
Comparison with multi-crop BYOL. Prior work [4] has indicated that cropping multiple views of the same image can improve the performance of self-supervised learning methods pre-trained on ImageNet. To investigate whether our gains are due to more accurate object-instance comparison or simply more number of mixed views, we randomly crop four additional smaller views for BYOL to ensure the number and size of the input patches are equal to ORL (i.e., $2 \times 2 2 4 + 4 \times 9 6 )$ . As shown in Table 5c, different from the observation on ImageNet, simply adding more low-resolution crops tends to hurt the performance since it will further intensify the inconsistent noise on scene images. In contrast, ORL substantially outperforms this multi-crop variant, validating that the gains are truly due to our object-level representation learning mechanism.
|
| 139 |
+
|
| 140 |
+
Comparison with ground truth bounding boxes. In Stage 2, ORL requires an unsupervised region proposal algorithm to extract approximate object-based regions, which is inaccurate to some extent. We further investigate whether the performance can be improved when more accurate object regions are available, i.e., with bounding box annotations. To this end, we replace our selective-search generated object proposals with ground truth bounding boxes provided from COCO train2017 set, while keeping all other procedures unchanged. As shown in Table 5d, adopting ground truth (GT) bounding boxes performs inferior to selective search (SS). This is mainly due to that although the ground truth bounding boxes can provide more accurate object location, their numbers are too scarce compared with a large amount of region proposals generated by selective search. The more diverse region proposals can potentially induce more unknown object or object-part discovery beyond the manually annotated objects. In this case, the diversity can make up for the inaccuracy.
|
| 141 |
+
|
| 142 |
+

|
| 143 |
+
Figure 3: Top-ranked region correspondence discovered by ORL in Stage 2. We show a pair of discovered object-instance per image pair for clarity. More discovered correspondence pairs are provided in the supplementary material.
|
| 144 |
+
|
| 145 |
+

|
| 146 |
+
Figure 4: Attention maps generated by BYOL and ORL. ORL can activate more object regions and produce more accurate object boundary in the heatmap than BYOL. We provide more attention maps in the supplementary material. Best viewed with zoom in.
|
| 147 |
+
|
| 148 |
+
Pre-training schedules. Table 5e shows the results with different pre-training schedules, from 100 epochs to 1600 epochs. The performance of both ORL and BYOL improves when pre-trained for longer epochs, while ORL consistently outperforms BYOL by at least $2 . 2 \%$ mAP. Note that our 200-epoch ORL has already surpassed the 1600-epoch BYOL $8 5 . 2 \%$ mAP vs. $8 4 . 9 \%$ mAP), demonstrating that the performance efficiency of ORL is at least $8 \times$ than BYOL below 1600 epochs.
|
| 149 |
+
|
| 150 |
+
# 4.3 Visualization
|
| 151 |
+
|
| 152 |
+
Correspondence pairs. Figure 3 visualizes some top-ranked region correspondence discovered in Stage 2 of ORL. We observe that each generated inter-RoI pair largely correspond to the regions with similar visual concepts (i.e., objects or object parts) across images. In contrast to typical contrastive learning methods that perform aggressive intra-image augmentations to simulate intra-class variances, our discovered inter-RoI pairs can substantially provide more natural and diverse intra-class variances at the object-instance level.
|
| 153 |
+
|
| 154 |
+
Attention maps. Figure 4 visualizes the attention maps generated by BYOL and ORL. We observe that both BYOL and ORL can produce relatively high-quality attention maps that focus on the foreground objects. This reflects from the side that current image-level contrastive learning methods have already induced a latent space with rich visual concepts. Nevertheless, ORL can activate more object regions and produce more accurate object boundary than BYOL in the generated attention maps. It is mainly due to introducing object-level similarity learning into ORL, which can minimize the inconsistent noise caused by image-level contrastive learning. In contrast, BYOL only uses the whole image to extract features, thus activating the most discriminative region.
|
| 155 |
+
|
| 156 |
+
# 5 Conclusion
|
| 157 |
+
|
| 158 |
+
In this work, we have presented a new self-supervised learning framework, ORL, for object-level representation learning from scene images. We leverage the latent prior of image-level self-supervised pre-training for discovering object-based region correspondence across images. The generated objectinstance correspondence enables us to perform pairwise contrastive learning at the object level. ORL significantly improves the performance of self-supervised learning from scene images in a variety of downstream tasks. We expect that our method can be applied to larger-scale unlabeled data in the wild to fully realize its potential, and hope that our study can attract the community’s attention to more general-purpose unsupervised representation learning from scene images.
|
| 159 |
+
|
| 160 |
+
# Limitations
|
| 161 |
+
|
| 162 |
+
In this paper, we mainly perform pre-training experiments with ResNet-50 on COCO dataset, and further scale them up on $\mathrm { C O C O + }$ dataset. However, the promise of self-supervised learning is to harness massive unlabeled data by scaling up to ever-larger datasets. Some prior works [18, 3, 16] have attempted to leverage larger models and datasets to explore the limit of current self-supervised learning methods. For instance, a recent representative work SEER [16] performs billion-scale selfsupervised pre-training on internet images using the RegNet architectures [46] with 700M parameters over 512 GPUs. Training at scale requires huge computational resources that are inaccessible to many researchers, which is not the core of our paper. We wish to highlight that our general-purpose ORL has yielded better performance than concurrent works [58, 34] that are tailored for dense prediction downstream tasks when pre-trained on COCO (Table 4), even surpassing the supervised ImageNet pre-training on several downstream tasks (Table 1-4). We expect that scaling ORL with larger architectures and datasets can further unleash its potential. Besides, ORL may not handle well on images with cluttered backgrounds since they will deviate the generated proposals to focus on these background regions. A possible remedy is to use some heuristic algorithms like saliency estimation to avoid the background regions. Another limitation is that ORL is a multi-stage framework. We expect an end-to-end framework to further improve the efficiency. We leave these explorations to future work.
|
| 163 |
+
|
| 164 |
+
# Broader impact
|
| 165 |
+
|
| 166 |
+
We present a more effective approach for learning unsupervised visual representations. Compared to supervised learning, it can liberate humans from expensive annotations as well as take advantages of rapidly growing real-world data. Like other learning algorithms, self-supervised learning should be applied with cautions when deployed in the real-world scenario. First, it is susceptible to biased learning if the algorithm is given with biased data. The exposure to unlabeled data may amplify such biases. Thus, debiasing measures have to be taken. Second, it remains non-trivial to dissect what is learned by self-supervised models. Similar concerns about the calibration, robustness, and interpretability of supervised models are equally applicable to the unsupervised counterpart. Our work is limited to the improvement of self-supervised learning within our scope. However, we acknowledge the importance of providing more transparent explanations for classification decisions, as well as the credibility of each prediction. Finally, our method still relies on the traditional regime of centralized learning. Privacy can be compromised if the method is applied on an unsaved platform. Federated learning can be a solution. How to scale self-supervised learning to the regime of decentralized learning will be an interesting research question to answer.
|
| 167 |
+
|
| 168 |
+
# Acknowledgements
|
| 169 |
+
|
| 170 |
+
This study is supported under the RIE2020 Industry Alignment Fund – Industry Collaboration Projects (IAF-ICP) Funding Initiative, as well as cash and in-kind contribution from the industry partner(s). The project is also supported by Singapore MOE AcRF Tier 2 (T2EP20120-0005), the Data Science and Artificial Intelligence Research Center at NTU.
|
| 171 |
+
|
| 172 |
+
# References
|
| 173 |
+
|
| 174 |
+
Nair, Max Dabagia, Keith B Hengen, William Gray-Roncal, Michal Valko, et al. Mine your own view: Self-supervised learning through across-sample prediction. arXiv preprint arXiv:2102.10106, 2021. 2
|
| 175 |
+
[2] Philip Bachman, R Devon Hjelm, and William Buchwalter. Learning representations by maximizing mutual information across views. In NeurIPS, pages 15509–15519, 2019. 3
|
| 176 |
+
[3] Mathilde Caron, Piotr Bojanowski, Julien Mairal, and Armand Joulin. Unsupervised pre-training of image features on non-curated data. In ICCV, pages 2959–2968, 2019. 3, 10
|
| 177 |
+
[4] Mathilde Caron, Ishan Misra, Julien Mairal, Priya Goyal, Piotr Bojanowski, and Armand Joulin. Unsupervised learning of visual features by contrasting cluster assignments. In NeurIPS, 2020. 1, 3, 8
|
| 178 |
+
[5] Ting Chen, Simon Kornblith, Mohammad Norouzi, and Geoffrey Hinton. A simple framework for contrastive learning of visual representations. In ICML, 2020. 1, 2, 3, 6, 7
|
| 179 |
+
[6] Xinlei Chen, Haoqi Fan, Ross Girshick, and Kaiming He. Improved baselines with momentum contrastive learning. arXiv preprint arXiv:2003.04297, 2020. 3, 6, 7
|
| 180 |
+
[7] Xinlei Chen and Kaiming He. Exploring simple siamese representation learning. In CVPR, pages 15750–15758, 2021. 1, 2, 3
|
| 181 |
+
[8] 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, 2009. 1, 6
|
| 182 |
+
[9] Jian Ding, Enze Xie, Hang Xu, Chenhan Jiang, Zhenguo Li, Ping Luo, and Gui-Song Xia. Unsupervised pretraining for object detection by patch reidentification. arXiv preprint arXiv:2103.04814, 2021. 3
|
| 183 |
+
[10] Carl Doersch, Abhinav Gupta, and Alexei A Efros. Unsupervised visual representation learning by context prediction. In ICCV, 2015. 3
|
| 184 |
+
[11] Debidatta Dwibedi, Yusuf Aytar, Jonathan Tompson, Pierre Sermanet, and Andrew Zisserman. With a little help from my friends: Nearest-neighbor contrastive learning of visual representations. In ICCV, 2021. 2
|
| 185 |
+
[12] Mark Everingham, Luc Van Gool, Christopher KI Williams, John Winn, and Andrew Zisserman. The pascal visual object classes (voc) challenge. IJCV, 88(2):303–338, 2010. 6
|
| 186 |
+
[13] Rong-En Fan, Kai-Wei Chang, Cho-Jui Hsieh, Xiang-Rui Wang, and Chih-Jen Lin. Liblinear: A library for large linear classification. JMLR, 9:1871–1874, 2008. 6
|
| 187 |
+
[14] Spyros Gidaris, Praveer Singh, and Nikos Komodakis. Unsupervised representation learning by predicting image rotations. In ICLR, 2018. 3
|
| 188 |
+
[15] Ross Girshick, Jeff Donahue, Trevor Darrell, and Jitendra Malik. Rich feature hierarchies for accurate object detection and semantic segmentation. In CVPR, pages 580–587, 2014. 1
|
| 189 |
+
[16] Priya Goyal, Mathilde Caron, Benjamin Lefaudeux, Min Xu, Pengchao Wang, Vivek Pai, Mannat Singh, Vitaliy Liptchinsky, Ishan Misra, Armand Joulin, et al. Self-supervised pretraining of visual features in the wild. arXiv preprint arXiv:2103.01988, 2021. 3, 10
|
| 190 |
+
[17] Priya Goyal, Piotr Dollár, Ross Girshick, Pieter Noordhuis, Lukasz Wesolowski, Aapo Kyrola, Andrew Tulloch, Yangqing Jia, and Kaiming He. Accurate, large minibatch sgd: Training imagenet in 1 hour. arXiv preprint arXiv:1706.02677, 2017. 6
|
| 191 |
+
[18] Priya Goyal, Dhruv Mahajan, Abhinav Gupta, and Ishan Misra. Scaling and benchmarking self-supervised visual representation learning. In ICCV, pages 6391–6400, 2019. 3, 6, 7, 10
|
| 192 |
+
[19] Jean-Bastien Grill, Florian Strub, Florent Altché, Corentin Tallec, Pierre H Richemond, Elena Buchatskaya, Carl Doersch, Bernardo Avila Pires, Zhaohan Daniel Guo, Mohammad Gheshlaghi Azar, et al. Bootstrap your own latent: A new approach to self-supervised learning. In NeurIPS, 2020. 1, 2, 3, 4, 5, 6, 7
|
| 193 |
+
[20] Raia Hadsell, Sumit Chopra, and Yann LeCun. Dimensionality reduction by learning an invariant mapping. In CVPR, 2006. 3
|
| 194 |
+
[21] Xufeng Han, Thomas Leung, Yangqing Jia, Rahul Sukthankar, and Alexander C Berg. Matchnet: Unifying feature and metric learning for patch-based matching. In CVPR, 2015. 3
|
| 195 |
+
[22] Kaiming He, Haoqi Fan, Yuxin Wu, Saining Xie, and Ross Girshick. Momentum contrast for unsupervised visual representation learning. In CVPR, pages 9729–9738, 2020. 1, 2, 3
|
| 196 |
+
[23] Kaiming He, Georgia Gkioxari, Piotr Dollár, and Ross Girshick. Mask r-cnn. In ICCV, pages 2961–2969, 2017. 1, 7
|
| 197 |
+
[24] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In CVPR, 2016. 6
|
| 198 |
+
[25] Olivier J Hénaff, Skanda Koppula, Jean-Baptiste Alayrac, Aaron van den Oord, Oriol Vinyals, and João Carreira. Efficient visual pretraining with contrastive detection. In ICCV, 2021. 3
|
| 199 |
+
[26] Olivier J Hénaff, Aravind Srinivas, Jeffrey De Fauw, Ali Razavi, Carl Doersch, SM Eslami, and Aaron van den Oord. Data-efficient image recognition with contrastive predictive coding. arXiv preprint arXiv:1905.09272, 2019. 3, 7
|
| 200 |
+
[27] R Devon Hjelm, Alex Fedorov, Samuel Lavoie-Marchildon, Karan Grewal, Phil Bachman, Adam Trischler, and Yoshua Bengio. Learning deep representations by mutual information estimation and maximization. In ICLR, 2019. 3 internal covariate shift. In ICML, 2015. 6 [29] Angjoo Kanazawa, David W Jacobs, and Manmohan Chandraker. Warpnet: Weakly supervised matching for single-view reconstruction. In CVPR, 2016. 3 [30] Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton. Imagenet classification with deep convolutional neural networks. In NeurIPS, 2012. 1 [31] Gustav Larsson, Michael Maire, and Gregory Shakhnarovich. Learning representations for automatic colorization. In ECCV, pages 577–593, 2016. 3 [32] Tsung-Yi Lin, Piotr Dollár, Ross Girshick, Kaiming He, Bharath Hariharan, and Serge Belongie. Feature pyramid networks for object detection. In CVPR, pages 2117–2125, 2017. 7 [33] Tsung-Yi Lin, Michael Maire, Serge Belongie, James Hays, Pietro Perona, Deva Ramanan, Piotr Dollár, and C Lawrence Zitnick. Microsoft coco: Common objects in context. In ECCV, 2014. 1 [34] Songtao Liu, Zeming Li, and Jian Sun. Self-emd: Self-supervised object detection without imagenet. arXiv preprint arXiv:2011.13677, 2020. 1, 3, 7, 10 [35] Jonathan Long, Evan Shelhamer, and Trevor Darrell. Fully convolutional networks for semantic segmentation. In CVPR, 2015. 1 [36] Ilya Loshchilov and Frank Hutter. Sgdr: Stochastic gradient descent with warm restarts. arXiv preprint arXiv:1608.03983, 2016. 6 [37] Ishan Misra and Laurens van der Maaten. Self-supervised learning of pretext-invariant representations. In CVPR, pages 6707–6717, 2020. 1, 2, 3, 6, 7 [38] Vinod Nair and Geoffrey E Hinton. Rectified linear units improve restricted boltzmann machines. In ICML,
|
| 201 |
+
2010. 6 [39] Mehdi Noroozi and Paolo Favaro. Unsupervised learning of visual representations by solving jigsaw puzzles. In ECCV, 2016. 3 [40] Mehdi Noroozi, Hamed Pirsiavash, and Paolo Favaro. Representation learning by learning to count. In ICCV, pages 5898–5906, 2017. 3 [41] Yuki Ono, Eduard Trulls, Pascal Fua, and Kwang Moo Yi. Lf-net: Learning local features from images. arXiv preprint arXiv:1805.09662, 2018. 3 [42] Aaron van den Oord, Yazhe Li, and Oriol Vinyals. Representation learning with contrastive predictive coding. arXiv preprint arXiv:1807.03748, 2018. 3 [43] Deepak Pathak, Philipp Krahenbuhl, Jeff Donahue, Trevor Darrell, and Alexei A Efros. Context encoders: Feature learning by inpainting. In CVPR, 2016. 3 [44] Chao Peng, Tete Xiao, Zeming Li, Yuning Jiang, Xiangyu Zhang, Kai Jia, Gang Yu, and Jian Sun. Megdet: A large mini-batch object detector. In CVPR, pages 6181–6189, 2018. 7 [45] Pedro O Pinheiro, Amjad Almahairi, Ryan Y Benmaleck, Florian Golemo, and Aaron Courville. Unsupervised learning of dense visual representations. In NeurIPS, 2020. 3 [46] Ilija Radosavovic, Raj Prateek Kosaraju, Ross Girshick, Kaiming He, and Piotr Dollár. Designing network design spaces. In CVPR, pages 10428–10436, 2020. 10 [47] Shaoqing Ren, Kaiming He, Ross Girshick, and Jian Sun. Faster r-cnn: Towards real-time object detection with region proposal networks. In NeurIPS, pages 91–99, 2015. 1 [48] Byungseok Roh, Wuhyun Shin, Ildoo Kim, and Sungwoong Kim. Spatially consistent representation learning. In CVPR, pages 1144–1153, 2021. 3 [49] 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. IJCV, 115(3):211–252, 2015. 1 [50] Ramprasaath R Selvaraju, Karan Desai, Justin Johnson, and Nikhil Naik. Casting your model: Learning to localize improves self-supervised representations. In CVPR, pages 11058–11067, 2021. 1, 3 [51] James Thewlis, Samuel Albanie, Hakan Bilen, and Andrea Vedaldi. Unsupervised learning of landmarks by descriptor vector exchange. In ICCV, 2019. 3 [52] James Thewlis, Andrea Vedaldi, and Hakan Bilen. Unsupervised object learning from dense equivariant image labelling. In NeurIPS, 2017. 3 [53] Yonglong Tian, Dilip Krishnan, and Phillip Isola. Contrastive multiview coding. arXiv preprint arXiv:1906.05849, 2019. 3 [54] Yonglong Tian, Chen Sun, Ben Poole, Dilip Krishnan, Cordelia Schmid, and Phillip Isola. What makes for good views for contrastive learning. In NeurIPS, 2020. 7 [55] Nikolai Ufer and Bjorn Ommer. Deep semantic feature matching. In CVPR, 2017. 3 [56] Jasper RR Uijlings, Koen EA Van De Sande, Theo Gevers, and Arnold WM Smeulders. Selective search for object recognition. IJCV, 104(2):154–171, 2013. 2, 5 [57] Grant Van Horn, Oisin Mac Aodha, Yang Song, Yin Cui, Chen Sun, Alex Shepard, Hartwig Adam, Pietro Perona, and Serge Belongie. The inaturalist species classification and detection dataset. In CVPR, pages
|
| 202 |
+
8769–8778, 2018. 6
|
| 203 |
+
[58] Xinlong Wang, Rufeng Zhang, Chunhua Shen, Tao Kong, and Lei Li. Dense contrastive learning for self-supervised visual pre-training. In CVPR, pages 3024–3033, 2021. 1, 3, 7, 10
|
| 204 |
+
[59] Yuxin Wu, Alexander Kirillov, Francisco Massa, Wan-Yen Lo, and Ross Girshick. Detectron2, 2019. 7
|
| 205 |
+
[60] Zhirong Wu, Yuanjun Xiong, Stella X Yu, and Dahua Lin. Unsupervised feature learning via non-parametric instance discrimination. In CVPR, pages 3733–3742, 2018. 1, 2, 3, 7
|
| 206 |
+
[61] Tete Xiao, Colorado J Reed, Xiaolong Wang, Kurt Keutzer, and Trevor Darrell. Region similarity representation learning. In ICCV, 2021. 3
|
| 207 |
+
[62] Enze Xie, Jian Ding, Wenhai Wang, Xiaohang Zhan, Hang Xu, Peize Sun, Zhenguo Li, and Ping Luo. Detco: Unsupervised contrastive learning for object detection. In ICCV, pages 8392–8401, 2021. 3
|
| 208 |
+
[63] Jiahao Xie, Xiaohang Zhan, Ziwei Liu, Yew Soon Ong, and Chen Change Loy. Delving into inter-image invariance for unsupervised visual representations. arXiv preprint arXiv:2008.11702, 2020. 2
|
| 209 |
+
[64] Zhenda Xie, Yutong Lin, Zheng Zhang, Yue Cao, Stephen Lin, and Han Hu. Propagate yourself: Exploring pixel-level consistency for unsupervised visual representation learning. In CVPR, pages 16684–16693, 2021. 3
|
| 210 |
+
[65] Ceyuan Yang, Zhirong Wu, Bolei Zhou, and Stephen Lin. Instance localization for self-supervised detection pretraining. In CVPR, pages 3987–3996, 2021. 3
|
| 211 |
+
[66] Mang Ye, Xu Zhang, Pong C Yuen, and Shih-Fu Chang. Unsupervised embedding learning via invariant and spreading instance feature. In CVPR, pages 6210–6219, 2019. 3
|
| 212 |
+
[67] Ramin Zabih and John Woodfill. Non-parametric local transforms for computing visual correspondence. In ECCV, 1994. 3
|
| 213 |
+
[68] Sergey Zagoruyko and Nikos Komodakis. Learning to compare image patches via convolutional neural networks. In CVPR, 2015. 3
|
| 214 |
+
[69] Xiaohua Zhai, Avital Oliver, Alexander Kolesnikov, and Lucas Beyer. S4l: Self-supervised semi-supervised learning. In ICCV, pages 1476–1485, 2019. 7
|
| 215 |
+
[70] Richard Zhang, Phillip Isola, and Alexei A Efros. Colorful image colorization. In ECCV, 2016. 3
|
| 216 |
+
[71] Richard Zhang, Phillip Isola, and Alexei A Efros. Split-brain autoencoders: Unsupervised learning by cross-channel prediction. In CVPR, 2017. 3, 7
|
| 217 |
+
[72] Bolei Zhou, Agata Lapedriza, Aditya Khosla, Aude Oliva, and Antonio Torralba. Places: A 10 million image database for scene recognition. TPAMI, 40(6):1452–1464, 2017. 1
|
| 218 |
+
[73] Bolei Zhou, Agata Lapedriza, Jianxiong Xiao, Antonio Torralba, and Aude Oliva. Learning deep features for scene recognition using places database. In NeurIPS, pages 487–495, 2014. 6
|
| 219 |
+
[74] Chengxu Zhuang, Alex Lin Zhai, and Daniel Yamins. Local aggregation for unsupervised learning of visual embeddings. In ICCV, pages 6002–6012, 2019. 2, 3
|
md/train/XPZIaotutsD/XPZIaotutsD.md
ADDED
|
@@ -0,0 +1,454 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# DEBERTA: DECODING-ENHANCED BERT WITH DISENTANGLED ATTENTION
|
| 2 |
+
|
| 3 |
+
Pengcheng $\mathbf { H e } ^ { 1 }$ , Xiaodong $\mathbf { L i u ^ { 2 } }$ , Jianfeng $\mathbf { G a o ^ { 2 } }$ , Weizhu Chen1 1 Microsoft Dynamics 365 AI 2 Microsoft Research {penhe,xiaodl,jfgao,wzchen}@microsoft.com
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
Recent progress in pre-trained neural language models has significantly improved the performance of many natural language processing (NLP) tasks. In this paper we propose a new model architecture DeBERTa (Decoding-enhanced BERT with disentangled attention) that improves the BERT and RoBERTa models using two novel techniques. The first is the disentangled attention mechanism, where each word is represented using two vectors that encode its content and position, respectively, and the attention weights among words are computed using disentangled matrices on their contents and relative positions, respectively. Second, an enhanced mask decoder is used to incorporate absolute positions in the decoding layer to predict the masked tokens in model pre-training. In addition, a new virtual adversarial training method is used for fine-tuning to improve models’ generalization. We show that these techniques significantly improve the efficiency of model pre-training and the performance of both natural language understand (NLU) and natural langauge generation (NLG) downstream tasks. Compared to RoBERTa-Large, a DeBERTa model trained on half of the training data performs consistently better on a wide range of NLP tasks, achieving improvements on MNLI by $+ 0 . 9 \%$ $9 0 . 2 \%$ vs. $9 1 . 1 \%$ , on SQuAD $\mathrm { v } 2 . 0$ by $+ 2 . 3 \%$ $8 8 . 4 \%$ vs. $9 0 . 7 \% )$ and RACE by $+ 3 . 6 \%$ ( $8 3 . 2 \%$ vs. $8 6 . 8 \%$ ). Notably, we scale up DeBERTa by training a larger version that consists of 48 Transform layers with 1.5 billion parameters. The significant performance boost makes the single DeBERTa model surpass the human performance on the SuperGLUE benchmark (Wang et al., 2019a) for the first time in terms of macro-average score (89.9 versus 89.8), and the ensemble DeBERTa model sits atop the SuperGLUE leaderboard as of January 6, 2021, outperforming the human baseline by a decent margin (90.3 versus 89.8). The pre-trained DeBERTa models and the source code were released at: https://github.com/microsoft/DeBERTa1.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
The Transformer has become the most effective neural network architecture for neural language modeling. Unlike recurrent neural networks (RNNs) that process text in sequence, Transformers apply self-attention to compute in parallel every word from the input text an attention weight that gauges the influence each word has on another, thus allowing for much more parallelization than RNNs for large-scale model training (Vaswani et al., 2017). Since 2018, we have seen the rise of a set of large-scale Transformer-based Pre-trained Language Models (PLMs), such as GPT (Radford et al., 2019; Brown et al., 2020), BERT (Devlin et al., 2019), RoBERTa (Liu et al., 2019c), XLNet (Yang et al., 2019), UniLM (Dong et al., 2019), ELECTRA (Clark et al., 2020), T5 (Raffel et al., 2020), ALUM (Liu et al., 2020), StructBERT (Wang et al., 2019c) and ERINE (Sun et al., 2019) . These PLMs have been fine-tuned using task-specific labels and created new state of the art in many downstream natural language processing (NLP) tasks (Liu et al., 2019b; Minaee et al., 2020; Jiang et al., 2020; He et al., 2019a;b; Shen et al., 2020).
|
| 12 |
+
|
| 13 |
+
In this paper, we propose a new Transformer-based neural language model DeBERTa (Decodingenhanced BERT with disentangled attention), which improves previous state-of-the-art PLMs using two novel techniques: a disentangled attention mechanism, and an enhanced mask decoder.
|
| 14 |
+
|
| 15 |
+
Disentangled attention. Unlike BERT where each word in the input layer is represented using a vector which is the sum of its word (content) embedding and position embedding, each word in DeBERTa is represented using two vectors that encode its content and position, respectively, and the attention weights among words are computed using disentangled matrices based on their contents and relative positions, respectively. This is motivated by the observation that the attention weight of a word pair depends on not only their contents but their relative positions. For example, the dependency between the words “deep” and “learning” is much stronger when they occur next to each other than when they occur in different sentences.
|
| 16 |
+
|
| 17 |
+
Enhanced mask decoder. Like BERT, DeBERTa is pre-trained using masked language modeling (MLM). MLM is a fill-in-the-blank task, where a model is taught to use the words surrounding a mask token to predict what the masked word should be. DeBERTa uses the content and position information of the context words for MLM. The disentangled attention mechanism already considers the contents and relative positions of the context words, but not the absolute positions of these words, which in many cases are crucial for the prediction. Consider the sentence “a new store opened beside the new mall” with the italicized words “store” and “mall” masked for prediction. Although the local contexts of the two words are similar, they play different syntactic roles in the sentence. (Here, the subject of the sentence is “store” not “mall,” for example.) These syntactical nuances depend, to a large degree, upon the words’ absolute positions in the sentence, and so it is important to account for a word’s absolute position in the language modeling process. DeBERTa incorporates absolute word position embeddings right before the softmax layer where the model decodes the masked words based on the aggregated contextual embeddings of word contents and positions.
|
| 18 |
+
|
| 19 |
+
In addition, we propose a new virtual adversarial training method for fine-tuning PLMs to downstream NLP tasks. The method is effective in improving models’ generalization.
|
| 20 |
+
|
| 21 |
+
We show through a comprehensive empirical study that these techniques substantially improve the efficiency of pre-training and the performance of downstream tasks. In the NLU tasks, compared to RoBERTa-Large, a DeBERTa model trained on half the training data performs consistently better on a wide range of NLP tasks, achieving improvements on MNLI by $+ 0 . 9 \%$ $9 0 . 2 \%$ vs. $9 1 . 1 \%$ ), on SQuAD v2.0 by $+ 2 . 3 \% ( 8 8 . 4 \%$ vs. $9 0 . 7 \%$ ), and RACE by $+ 3 . 6 \%$ ( $8 3 . 2 \%$ vs. $8 6 . 8 \%$ ). In the NLG tasks, DeBERTa reduces the perplexity from 21.6 to 19.5 on the Wikitext-103 dataset. We further scale up DeBERTa by pre-training a larger model that consists of 48 Transformer layers with 1.5 billion parameters. The single 1.5B-parameter DeBERTa model substantially outperforms T5 with 11 billion parameters on the SuperGLUE benchmark (Wang et al., 2019a) by $0 . 6 \% ( 8 9 . 3 \%$ vs. $8 9 . 9 \%$ ), and surpasses the human baseline (89.9 vs. 89.8) for the first time. The ensemble DeBERTa model sits atop the SuperGLUE leaderboard as of January 6, 2021, outperforming the human baseline by a decent margin (90.3 versus 89.8).
|
| 22 |
+
|
| 23 |
+
# 2 BACKGROUND
|
| 24 |
+
|
| 25 |
+
# 2.1 TRANSFORMER
|
| 26 |
+
|
| 27 |
+
A Transformer-based language model is composed of stacked Transformer blocks (Vaswani et al., 2017). Each block contains a multi-head self-attention layer followed by a fully connected positional feed-forward network. The standard self-attention mechanism lacks a natural way to encode word position information. Thus, existing approaches add a positional bias to each input word embedding so that each input word is represented by a vector whose value depends on its content and position. The positional bias can be implemented using absolute position embedding (Vaswani et al., 2017; Radford et al., 2019; Devlin et al., 2019) or relative position embedding (Huang et al., 2018; Yang et al., 2019). It has been shown that relative position representations are more effective for natural language understanding and generation tasks (Dai et al., 2019; Shaw et al., 2018). The proposed disentangled attention mechanism differs from all existing approaches in that we represent each input word using two separate vectors that encode a word’s content and position, respectively, and attention weights among words are computed using disentangled matrices on their contents and relative positions, respectively.
|
| 28 |
+
|
| 29 |
+
# 2.2 MASKED LANGUAGE MODEL
|
| 30 |
+
|
| 31 |
+
Large-scale Transformer-based PLMs are typically pre-trained on large amounts of text to learn contextual word representations using a self-supervision objective, known as Masked Language Model (MLM) (Devlin et al., 2019). Specifically, given a sequence $X \mathrm { ~ = ~ } \{ x _ { i } \}$ , we corrupt it into $\tilde { X }$ by masking $15 \%$ of its tokens at random and then train a language model parameterized by $\theta$ to reconstruct $\boldsymbol { X }$ by predicting the masked tokens $\tilde { x }$ conditioned on $\tilde { X }$ :
|
| 32 |
+
|
| 33 |
+
$$
|
| 34 |
+
\operatorname* { m a x } _ { \theta } \log p _ { \theta } ( X | \tilde { X } ) = \operatorname* { m a x } _ { \theta } \sum _ { i \in \mathcal { C } } \log p _ { \theta } \big ( \tilde { x } _ { i } = x _ { i } | \tilde { X } \big )
|
| 35 |
+
$$
|
| 36 |
+
|
| 37 |
+
where $\mathcal { C }$ is the index set of the masked tokens in the sequence. The authors of BERT propose to keep $10 \%$ of the masked tokens unchanged, another $10 \%$ replaced with randomly picked tokens and the rest replaced with the [MASK] token.
|
| 38 |
+
|
| 39 |
+
# 3 THE DEBERTA ARCHITECTURE
|
| 40 |
+
|
| 41 |
+
3.1 DISENTANGLED ATTENTION: A TWO-VECTOR APPROACH TO CONTENT AND POSITIONEMBEDDING
|
| 42 |
+
|
| 43 |
+
For a token at position $i$ in a sequence, we represent it using two vectors, $\left\{ H _ { i } \right\}$ and $\{ P _ { i \mid j } \}$ , which represent its content and relative position with the token at position $j$ , respectively. The calculation of the cross attention score between tokens $i$ and $j$ can be decomposed into four components as
|
| 44 |
+
|
| 45 |
+
$$
|
| 46 |
+
\begin{array} { r l } & { A _ { i , j } = \{ H _ { i } , P _ { i | j } \} \times \{ H _ { j } , P _ { j | i } \} ^ { \intercal } } \\ & { \qquad = H _ { i } H _ { j } ^ { \intercal } + H _ { i } P _ { j | i } ^ { \intercal } + P _ { i | j } H _ { j } ^ { \intercal } + P _ { i | j } P _ { j | i } ^ { \intercal } } \end{array}
|
| 47 |
+
$$
|
| 48 |
+
|
| 49 |
+
That is, the attention weight of a word pair can be computed as a sum of four attention scores using disentangled matrices on their contents and positions as content-to-content, content-to-position, position-to-content, and position-to-position 2.
|
| 50 |
+
|
| 51 |
+
Existing approaches to relative position encoding use a separate embedding matrix to compute the relative position bias in computing attention weights (Shaw et al., 2018; Huang et al., 2018). This is equivalent to computing the attention weights using only the content-to-content and content-toposition terms in equation 2. We argue that the position-to-content term is also important since the attention weight of a word pair depends not only on their contents but on their relative positions, which can only be fully modeled using both the content-to-position and position-to-content terms. Since we use relative position embedding, the position-to-position term does not provide much additional information and is removed from equation 2 in our implementation.
|
| 52 |
+
|
| 53 |
+
Taking single-head attention as an example, the standard self-attention operation (Vaswani et al., 2017) can be formulated as:
|
| 54 |
+
|
| 55 |
+
$$
|
| 56 |
+
\begin{array} { c } { { Q = H W _ { q } , K = H W _ { k } , V = H W _ { v } , A = \frac { Q K ^ { \intercal } } { \sqrt { d } } } } \\ { { H _ { o } = \mathrm { s o f t m a x } ( A ) V } } \end{array}
|
| 57 |
+
$$
|
| 58 |
+
|
| 59 |
+
where ${ \cal H } \in { \cal R } ^ { N \times d }$ represents the input hidden vectors, $H _ { o } \in R ^ { N \times d }$ the output of self-attention, $W _ { q } , W _ { k } , W _ { v } \in R ^ { d \times \hat { d } }$ the projection matrices, $\pmb { A } \in R ^ { N \times N }$ the attention matrix, $N$ the length of the input sequence, and $d$ the dimension of hidden states.
|
| 60 |
+
|
| 61 |
+
Denote $k$ as the maximum relative distance, $\delta ( i , j ) \in [ 0 , 2 k )$ as the relative distance from token $i$ to token $j$ , which is defined as:
|
| 62 |
+
|
| 63 |
+
$$
|
| 64 |
+
\delta ( i , j ) = \left\{ \begin{array} { r l l } { { 0 } } & { { \mathrm { f o r } } } & { { i - j \leqslant - k } } \\ { { 2 k - 1 } } & { { \mathrm { f o r } } } & { { i - j \geqslant k } } \\ { { i - j + k } } & { { \mathrm { o t h e r s . } } } & { { } } \end{array} \right.
|
| 65 |
+
$$
|
| 66 |
+
|
| 67 |
+
We can represent the disentangled self-attention with relative position bias as equation 4, where $Q _ { c } , K _ { c }$ and $V _ { c }$ are the projected content vectors generated using projection matrices $W _ { q , c } , W _ { k , c } , W _ { v , c } \in R ^ { d \times d }$ respectively, $P \in { \cal R } ^ { 2 k \times d }$ represents the relative position embedding vectors shared across all layers (i.e., staying fixed during forward propagation), and $Q _ { r }$ and $K _ { r }$ are projected relative position vectors generated using projection matrices $W _ { q , r } , W _ { k , r } \in R ^ { d \times d }$ , respectively.
|
| 68 |
+
|
| 69 |
+
$$
|
| 70 |
+
\begin{array} { l } { { Q _ { c } = H W _ { q , c } , K _ { c } = H W _ { k , c } , V _ { c } = H W _ { v , c } , Q _ { r } = P W _ { q , r } , K _ { r } = P W _ { k , r } } } \\ { { \tilde { A } _ { i , j } = \underbrace { Q _ { i } ^ { c } K _ { j } ^ { c \top } } _ { \mathrm { ( a ) c o n t e n t - t o - c o n t e n t } } + \underbrace { Q _ { i } ^ { c } K _ { \delta ( i , j ) } ^ { r } } _ { \mathrm { ( b ) c o n t e n t - t o - p o s i i t i o n } } + \underbrace { K _ { j } ^ { c } Q _ { \delta ( j , i ) } ^ { r } } _ { \mathrm { ( c ) p o s i i t i o n - t o r t e n t } } } } \\ { { \tilde { H } _ { o } = \mathrm { s o f t m a x } ( \frac { \tilde { A } } { \sqrt { 3 d } } ) V _ { c } } } \end{array}
|
| 71 |
+
$$
|
| 72 |
+
|
| 73 |
+
$\tilde { A } _ { i , j }$ is the element of attention matrix $\tilde { A }$ , representing the attention score from token $i$ to token $j$ . $Q _ { i } ^ { c }$ is the $i$ -th row of $Q _ { c } . \ K _ { j } ^ { c }$ is the $j$ -th row of $K _ { c }$ . $K _ { \delta ( i , j ) } ^ { r }$ is the $\delta ( i , j )$ -th row of $K _ { r }$ with regarding to relative distance $\delta ( i , j )$ . $Q _ { \delta ( j , i ) } ^ { r }$ is the $\delta ( j , i )$ -th row of $Q _ { r }$ with regarding to relative distance $\delta ( j , i )$ . Note that we use $\delta ( j , i )$ rather than $\delta ( i , j )$ here. This is because for a given position $i$ , position-to-content computes the attention weight of the key content at $j$ with respect to the query position at $i$ , thus the relative distance is $\delta ( j , i )$ . The position-to-content term is calculated as $K _ { j } ^ { c } Q _ { \delta ( j , i ) } ^ { r } { } ^ { \intercal }$ . The content-to-position term is calculated in a similar way.
|
| 74 |
+
|
| 75 |
+
Finally, we apply a scaling factor of $\frac { 1 } { \sqrt { 3 d } }$ on $\tilde { A }$ . The factor is important for stabilizing model training (Vaswani et al., 2017), especially for large-scale PLMs.
|
| 76 |
+
|
| 77 |
+
# Algorithm 1 Disentangled Attention
|
| 78 |
+
|
| 79 |
+
Input: Hidden state $\pmb { H }$ , relative distance embedding $_ { P }$ , relative distance matrix $\delta$ . Content projec
|
| 80 |
+
tion matrix $W _ { k , c }$ , $W _ { q , c }$ , $W _ { v , c }$ , position projection matrix $W _ { k , r }$ , $W _ { q , r }$ .
|
| 81 |
+
1: $K _ { c } = H W _ { k , c }$ , $Q _ { c } = H W _ { q , c }$ , $V _ { c } = H W _ { v , c }$ , $K _ { r } = P W _ { k , r }$ , $Q _ { r } \overset { = } { = } P W _ { q , r }$
|
| 82 |
+
2: $A _ { c c } = Q _ { c } K _ { c } ^ { \intercal }$
|
| 83 |
+
3: for $i = 0 , . . . , N - 1$ do
|
| 84 |
+
4: $\tilde { A } _ { c p } [ i , : ] = Q _ { c } [ i , : ] { \cal K } _ { r } ^ { \intercal }$
|
| 85 |
+
5: end for
|
| 86 |
+
6: for $i = 0 , . . . , N - 1$ do
|
| 87 |
+
7: for $j = 0 , . . . , N - 1$ do
|
| 88 |
+
8: $A _ { c p } [ i , j ] = \tilde { A } _ { c p } [ i , \delta [ i , j ] ]$
|
| 89 |
+
9: end for
|
| 90 |
+
10: end for
|
| 91 |
+
11: for $j = 0 , . . . , N - 1$ do
|
| 92 |
+
12: $\tilde { A } _ { p c } [ : , j ] = K _ { c } [ j , : ] Q _ { r } ^ { \intercal }$
|
| 93 |
+
13: end for
|
| 94 |
+
14: for $j = 0 , . . . , N - 1$ do
|
| 95 |
+
15: for $i = 0 , . . . , N - 1$ do
|
| 96 |
+
16: $A _ { p c } [ i , j ] = \tilde { A } _ { p c } [ \delta [ j , i ] , j ]$
|
| 97 |
+
17: end for
|
| 98 |
+
18: end for
|
| 99 |
+
19: $\tilde { A } = A _ { c c } + A _ { c p } + A _ { p c }$
|
| 100 |
+
20: $H _ { o } = \operatorname { s o f t m a x } ( \frac { \tilde { A } } { \sqrt { 3 d } } ) V _ { c }$
|
| 101 |
+
Output: Ho
|
| 102 |
+
|
| 103 |
+
# 3.1.1 EFFICIENT IMPLEMENTATION
|
| 104 |
+
|
| 105 |
+
For an input sequence of length $N$ , it requires a space complexity of $O ( N ^ { 2 } d )$ (Shaw et al., 2018; Huang et al., 2018; Dai et al., 2019) to store the relative position embedding for each token. However, taking content-to-position as an example, we note that since $\delta ( i , j ) \in [ 0 , 2 k )$ and the embeddings of all possible relative positions are always a subset of $K _ { r } \in R ^ { 2 k \times d }$ , then we can reuse $K _ { r }$ in the attention calculation for all the queries.
|
| 106 |
+
|
| 107 |
+
In our experiments, we set the maximum relative distance $k$ to 512 for pre-training. The disentangled attention weights can be computed efficiently using Algorithm 1. Let $\delta$ be the relative position matrix according to equation 3, i.e., $\delta [ i , j ] = \delta ( \overset { . } { i } , j )$ . Instead of allocating a different relative position embedding matrix for each query, we multiply each query vector $Q _ { c } [ i , : ]$ by ${ K } _ { r } ^ { \tau } \in { R } ^ { d \times 2 k }$ , as in line $3 - 5$ . Then, we extract the attention weight using the relative position matrix $\delta$ as the index, as in line $6 - 1 0$ . To compute the position-to-content attention score, we calculate $\tilde { A } _ { p c } [ : , j ]$ , i.e., the column vector of the attention matrix $\tilde { A } _ { p c }$ , by multiplying each key vector $K _ { c } [ j , : ]$ by $Q _ { r } ^ { \intercal }$ , as in line $1 1 - 1 3$ . Finally, we extract the corresponding attention score via the relative position matrix $\pmb { \delta }$ as the index, as in line $1 4 - 1 8$ . In this way, we do not need to allocate memory to store a relative position embedding for each query and thus reduce the space complexity to $O ( k d )$ (for storing $K _ { r }$ and $Q _ { r }$ ).
|
| 108 |
+
|
| 109 |
+
# 3.2 ENHANCED MASK DECODER ACCOUNTS FOR ABSOLUTE WORD POSITIONS
|
| 110 |
+
|
| 111 |
+
DeBERTa is pretrained using MLM, where a model is trained to use the words surrounding a mask token to predict what the masked word should be. DeBERTa uses the content and position information of the context words for MLM. The disentangled attention mechanism already considers the contents and relative positions of the context words, but not the absolute positions of these words, which in many cases are crucial for the prediction.
|
| 112 |
+
|
| 113 |
+
Given a sentence “a new store opened beside the new mall” with the words “store” and “mall” masked for prediction. Using only the local context (e.g., relative positions and surrounding words) is insufficient for the model to distinguish store and mall in this sentence, since both follow the word new with the same relative positions. To address this limitation, the model needs to take into account absolute positions, as complement information to the relative positions. For example, the subject of the sentence is “store” not “mall”. These syntactical nuances depend, to a large degree, upon the words’ absolute positions in the sentence.
|
| 114 |
+
|
| 115 |
+
There are two methods of incorporating absolute positions. The BERT model incorporates absolute positions in the input layer. In DeBERTa, we incorporate them right after all the Transformer layers but before the softmax layer for masked token prediction, as shown in Figure 2. In this way, DeBERTa captures the relative positions in all the Transformer layers and only uses absolute positions as complementary information when decoding the masked words. Thus, we call DeBERTa’s decoding component an Enhanced Mask Decoder (EMD). In the empirical study, we compare these two methods of incorporating absolute positions and observe that EMD works much better. We conjecture that the early incorporation of absolute positions used by BERT might undesirably hamper the model from learning sufficient information of relative positions. In addition, EMD also enables us to introduce other useful information, in addition to positions, for pre-training. We leave it to future work.
|
| 116 |
+
|
| 117 |
+
# 4 SCALE INVARIANT FINE-TUNING
|
| 118 |
+
|
| 119 |
+
This section presents a new virtual adversarial training algorithm, Scale-invariant-Fine-Tuning (SiFT), a variant to the algorithm described in Miyato et al. (2018); Jiang et al. (2020), for fine-tuning.
|
| 120 |
+
|
| 121 |
+
Virtual adversarial training is a regularization method for improving models’ generalization. It does so by improving a model’s robustness to adversarial examples, which are created by making small perturbations to the input. The model is regularized so that when given a task-specific example, the model produces the same output distribution as it produces on an adversarial perturbation of that example.
|
| 122 |
+
|
| 123 |
+
For NLP tasks, the perturbation is applied to the word embedding instead of the original word sequence. However, the value ranges (norms) of the embedding vectors vary among different words and models. The variance gets larger for bigger models with billions of parameters, leading to some instability of adversarial training.
|
| 124 |
+
|
| 125 |
+
Inspired by layer normalization (Ba et al., 2016), we propose the SiFT algorithm that improves the training stability by applying the perturbations to the normalized word embeddings. Specifically, when fine-tuning DeBERTa to a downstream NLP task in our experiments, SiFT first normalizes the word embedding vectors into stochastic vectors, and then applies the perturbation to the normalized embedding vectors. We find that the normalization substantially improves the performance of the fine-tuned models. The improvement is more prominent for larger DeBERTa models. Note that we only apply SiFT to $\mathrm { D e B E R T a } _ { 1 . 5 B }$ on SuperGLUE tasks in our experiments and we will provide a more comprehensive study of SiFT in our future work.
|
| 126 |
+
|
| 127 |
+
# 5 EXPERIMENT
|
| 128 |
+
|
| 129 |
+
This section reports DeBERTa results on various NLU tasks.
|
| 130 |
+
|
| 131 |
+
# 5.1 MAIN RESULTS ON NLU TASKS
|
| 132 |
+
|
| 133 |
+
Following previous studies of PLMs, we report results using large and base models.
|
| 134 |
+
|
| 135 |
+
5.1.1 PERFORMANCE ON LARGE MODELS
|
| 136 |
+
Table 1: Comparison results on the GLUE development set.
|
| 137 |
+
|
| 138 |
+
<table><tr><td rowspan=1 colspan=1>Model</td><td rowspan=1 colspan=1>CoLAMcc</td><td rowspan=1 colspan=1>|QQPAcc</td><td rowspan=1 colspan=1>MNLI-m/mmAcc</td><td rowspan=1 colspan=1>SST-2|Acc</td><td rowspan=1 colspan=1>STS-BCorr</td><td rowspan=1 colspan=1>QNLI|Acc</td><td rowspan=1 colspan=1>RTEAcc</td><td rowspan=1 colspan=1>MRPCAcc</td><td rowspan=1 colspan=1>Avg.</td></tr><tr><td rowspan=1 colspan=1>BERTlarge</td><td rowspan=1 colspan=1>60.6</td><td rowspan=1 colspan=1>91.3</td><td rowspan=1 colspan=1>86.6/-</td><td rowspan=1 colspan=1>93.2</td><td rowspan=1 colspan=1>90.0</td><td rowspan=1 colspan=1>92.3</td><td rowspan=1 colspan=1>70.4</td><td rowspan=1 colspan=1>88.0</td><td rowspan=1 colspan=1>84.05</td></tr><tr><td rowspan=1 colspan=1>RoBERTalarge</td><td rowspan=1 colspan=1>68.0</td><td rowspan=1 colspan=1>92.2</td><td rowspan=1 colspan=1>90.2/90.2</td><td rowspan=1 colspan=1>96.4</td><td rowspan=1 colspan=1>92.4</td><td rowspan=1 colspan=1>93.9</td><td rowspan=1 colspan=1>86.6</td><td rowspan=1 colspan=1>90.9</td><td rowspan=1 colspan=1>88.82</td></tr><tr><td rowspan=1 colspan=1>XLNetlarge</td><td rowspan=1 colspan=1>69.0</td><td rowspan=1 colspan=1>92.3</td><td rowspan=1 colspan=1>90.8/90.8</td><td rowspan=1 colspan=1>97.0</td><td rowspan=1 colspan=1>92.5</td><td rowspan=1 colspan=1>94.9</td><td rowspan=1 colspan=1>85.9</td><td rowspan=1 colspan=1>90.8</td><td rowspan=1 colspan=1>89.15</td></tr><tr><td rowspan=1 colspan=1>ELECTRAlarge</td><td rowspan=1 colspan=1>69.1</td><td rowspan=1 colspan=1>92.4</td><td rowspan=1 colspan=1>90.9/-</td><td rowspan=1 colspan=1>96.9</td><td rowspan=1 colspan=1>92.6</td><td rowspan=1 colspan=1>95.0</td><td rowspan=1 colspan=1>88.0</td><td rowspan=1 colspan=1>90.8</td><td rowspan=1 colspan=1>89.46</td></tr><tr><td rowspan=1 colspan=1>DeBERTalarge</td><td rowspan=1 colspan=1>70.5</td><td rowspan=1 colspan=1>92.3</td><td rowspan=1 colspan=1>91.1/91.1</td><td rowspan=1 colspan=1>96.8</td><td rowspan=1 colspan=1>92.8</td><td rowspan=1 colspan=1>95.3</td><td rowspan=1 colspan=1>88.3</td><td rowspan=1 colspan=1>91.9</td><td rowspan=1 colspan=1>90.00</td></tr></table>
|
| 139 |
+
|
| 140 |
+
We pre-train our large models following the setting of BERT (Devlin et al., 2019), except that we use the BPE vocabulary of Radford et al. (2019); Liu et al. (2019c). For training data, we use Wikipedia (English Wikipedia dump3; 12GB), BookCorpus (Zhu et al., 2015) (6GB), OPENWEBTEXT (public Reddit content (Gokaslan & Cohen, 2019); 38GB), and STORIES (a subset of CommonCrawl (Trinh & Le, 2018); 31GB). The total data size after data deduplication (Shoeybi et al., 2019) is about 78G. Refer to Appendix A.2 for a detailed description of the pre-training dataset.
|
| 141 |
+
|
| 142 |
+
We use 6 DGX-2 machines (96 V100 GPUs) to train the models. A single model trained with 2K batch size and 1M steps takes about 20 days. Refer to Appendix A for the detailed hyperparamters.
|
| 143 |
+
|
| 144 |
+
We summarize the results on eight NLU tasks of GLUE (Wang et al., 2019b) in Table 1, where DeBERTa is compared DeBERTa with previous Transform-based PLMs of similar structures (i.e. 24 layers with hidden size of 1024) including BERT, RoBERTa, XLNet, ALBERT and ELECTRA. Note that RoBERTa, XLNet and ELECTRA are pre-trained on 160G training data while DeBERTa is pretrained on 78G training data. RoBERTa and XLNet are pre-trained for 500K steps with 8K samples in a step, which amounts to four billion training samples. DeBERTa is pre-trained for one million steps with 2K samples in each step. This amounts to two billion training samples, approximately half of either RoBERTa or XLNet. Table 1 shows that compared to BERT and RoBERTa, DeBERTa performs consistently better across all the tasks. Meanwhile, DeBERTa outperforms XLNet in six out of eight tasks. Particularly, the improvements on MRPC ( $1 . 1 \%$ over XLNet and $1 . 0 \%$ over RoBERTa), RTE $2 . 4 \%$ over XLNet and $1 . 7 \%$ over RoBERTa) and CoLA ( $1 . 5 \%$ over XLNet and $2 . 5 \%$ over RoBERTa) are significant. DeBERTa also outperforms other SOTA PLMs, i.e., ELECTRAlarge and $\mathbf { X L N e t } _ { \mathrm { l a r g e } }$ , in terms of average GLUE score.
|
| 145 |
+
|
| 146 |
+
Among all GLUE tasks, MNLI is most often used as an indicative task to monitor the research progress of PLMs. DeBERTa significantly outperforms all existing PLMs of similar size on MNLI and creates a new state of the art.
|
| 147 |
+
|
| 148 |
+
Table 2: Results on MNLI in/out-domain, SQuAD v1.1, SQuAD v2.0, RACE, ReCoRD, SWAG, CoNLL 2003 NER development set. Note that missing results in literature are signified by “-”.
|
| 149 |
+
|
| 150 |
+
<table><tr><td rowspan=1 colspan=1>Model</td><td rowspan=1 colspan=2>MNLI-m/mm|SQuAD v1.1 SQuAD v2.0|RACE|Acc F1/EM F1/EM</td><td rowspan=1 colspan=1>Acc</td><td rowspan=1 colspan=1>ReCoRDF1/EM</td><td rowspan=1 colspan=2>|SWAGNERAcc F1</td></tr><tr><td rowspan=1 colspan=1>BERTlarge</td><td rowspan=1 colspan=1>86.6/-</td><td rowspan=1 colspan=1>90.9/84.1 81.8/79.0</td><td rowspan=1 colspan=1>72.0</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>86.6</td><td rowspan=1 colspan=1>92.8</td></tr><tr><td rowspan=1 colspan=1>ALBERTtarge</td><td rowspan=1 colspan=1>86.5/-</td><td rowspan=1 colspan=1>91.8/85.2 84.9/81.8</td><td rowspan=1 colspan=1>75.2</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>-</td></tr><tr><td rowspan=1 colspan=1>RoBERTalarge</td><td rowspan=1 colspan=1>90.2/90.2</td><td rowspan=1 colspan=1>94.6/88.9 89.4/86.5</td><td rowspan=1 colspan=1>83.2</td><td rowspan=1 colspan=1>90.6/90.0</td><td rowspan=1 colspan=1>89.9</td><td rowspan=1 colspan=1>93.4</td></tr><tr><td rowspan=1 colspan=1>XLNetlarge</td><td rowspan=1 colspan=1>90.8/90.8</td><td rowspan=1 colspan=1>95.1/89.7 90.6/87.9</td><td rowspan=1 colspan=1>85.4</td><td rowspan=1 colspan=1>-</td><td rowspan=1 colspan=1>-</td><td rowspan=1 colspan=1>-</td></tr><tr><td rowspan=1 colspan=1>Megatron336M</td><td rowspan=1 colspan=1>89.7/90.0</td><td rowspan=1 colspan=1>94.2/88.0 88.1/84.8</td><td rowspan=1 colspan=1>83.0</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>1</td></tr><tr><td rowspan=1 colspan=1>DeBERTalarge</td><td rowspan=1 colspan=1>91.1/91.1</td><td rowspan=1 colspan=1>95.5/90.1 90.7/88.0</td><td rowspan=1 colspan=1>86.8</td><td rowspan=1 colspan=1>91.4/91.0</td><td rowspan=1 colspan=1>90.8</td><td rowspan=1 colspan=1>93.8</td></tr><tr><td rowspan=1 colspan=1>ALBERTxxlarge</td><td rowspan=1 colspan=1>90.8/-</td><td rowspan=1 colspan=1>94.8/89.3 90.2/87.4</td><td rowspan=1 colspan=1>86.5</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>-</td><td rowspan=1 colspan=1>二</td></tr><tr><td rowspan=1 colspan=1>Megatron1.3B</td><td rowspan=1 colspan=1>90.9/91.0</td><td rowspan=1 colspan=1>94.9/89.1 90.2/87.1</td><td rowspan=1 colspan=1>87.3</td><td rowspan=1 colspan=1>-</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>-</td></tr><tr><td rowspan=1 colspan=1>Megatron3.9B</td><td rowspan=1 colspan=1>91.4/91.4</td><td rowspan=1 colspan=1>95.5/90.0 91.2/88.5</td><td rowspan=1 colspan=1>89.5</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>1</td></tr></table>
|
| 151 |
+
|
| 152 |
+
In addition to GLUE, DeBERTa is evaluated on three categories of NLU benchmarks: (1) Question Answering: SQuAD v1.1 (Rajpurkar et al., 2016), SQuAD v2.0 (Rajpurkar et al., 2018), RACE (Lai et al., 2017), ReCoRD (Zhang et al., 2018) and SWAG (Zellers et al., 2018); (2) Natural Language Inference: MNLI (Williams et al., 2018); and (3) NER: CoNLL-2003. For comparison, we include ALBERTxxlarge (Lan et al., 2019) 4 and Megatron (Shoeybi et al., 2019) with three different model sizes, denoted as Megatron336M, Megatron $\cdot 1 . 3 \mathrm { B }$ and Megatron3.9B, respectively, which are trained using the same dataset as RoBERTa. Note that Megatron336M has a similar model size as other models mentioned above5.
|
| 153 |
+
|
| 154 |
+
We summarize the results in Table 2. Compared to the previous SOTA PLMs with a similar model size (i.e., BERT, RoBERTa, XLNet, ALBERTlarge, and Megatron336M), DeBERTa shows superior performance in all seven tasks. Taking the RACE benchmark as an example, DeBERTa significantly outperforms XLNet by $+ 1 . 4 \%$ $8 6 . 8 \%$ vs. $8 5 . 4 \%$ ). Although Megatron $1 . 3 \mathrm { B }$ is three times larger than DeBERTa, DeBERTa outperforms it in three of the four benchmarks. We further report DeBERTa on text generation tasks in Appendix A.4.
|
| 155 |
+
|
| 156 |
+
# 5.1.2 PERFORMANCE ON BASE MODELS
|
| 157 |
+
|
| 158 |
+
Our setting for base model pre-training is similar to that for large models. The base model structure follows that of the BERT base model, i.e., $L = 1 2 , H = 7 6 8 , A = 1 2$ . We use 4 DGX-2 with 64 V100 GPUs to train the base model. It takes 10 days to finish a single pre-training of 1M training steps with batch size 2048. We train DeBERTa using the same 78G dataset, and compare it to RoBERTa and XLNet trained on 160G text data.
|
| 159 |
+
|
| 160 |
+
We summarize the base model results in Table 3. Across all three tasks, DeBERTa consistently outperforms RoBERTa and XLNet by a larger margin than that in large models. For example, on MNLI-m, $\mathrm { D e B E R T a _ { b a s e } }$ obtains $+ 1 . 2 \%$ $8 8 . 8 \%$ vs. $8 7 . 6 \%$ ) over $\mathrm { R o B E R T a _ { b a s e } }$ , and $+ 2 \%$ $8 8 . 8 \%$ vs. $8 6 . 8 \%$ ) over $\mathbf { X L N e t } _ { \mathrm { b a s e } }$ .
|
| 161 |
+
|
| 162 |
+
Table 3: Results on MNLI in/out-domain $\left( \mathrm { m } / \mathrm { m m } \right)$ ), SQuAD v1.1 and $\mathrm { v } 2 . 0$ development set.
|
| 163 |
+
|
| 164 |
+
<table><tr><td rowspan=1 colspan=1>Model</td><td rowspan=1 colspan=1>MNLI-m/mm (Acc)</td><td rowspan=1 colspan=1>SQuAD v1.1 (F1/EM)</td><td rowspan=1 colspan=1>SQuAD v2.0 (F1/EM)</td></tr><tr><td rowspan=1 colspan=1>RoBERTabase</td><td rowspan=1 colspan=1>87.6/-</td><td rowspan=1 colspan=1>91.5/84.6</td><td rowspan=1 colspan=1>83.7/80.5</td></tr><tr><td rowspan=1 colspan=1>XLNetbase</td><td rowspan=1 colspan=1>86.8/-</td><td rowspan=1 colspan=1>-</td><td rowspan=1 colspan=1>-/80.2</td></tr><tr><td rowspan=1 colspan=1>DeBERTabase</td><td rowspan=1 colspan=1>88.8/88.5</td><td rowspan=1 colspan=1>93.1/87.2</td><td rowspan=1 colspan=1>86.2/83.1</td></tr></table>
|
| 165 |
+
|
| 166 |
+
# 5.2 MODEL ANALYSIS
|
| 167 |
+
|
| 168 |
+
In this section, we first present an ablation study to quantify the relative contributions of different components introduced in DeBERTa. Then, we study the convergence property to characterize the model training efficiency. We run experiments for analysis using the base model setting: a model is pre-trained using the Wikipedia $^ +$ Bookcorpus dataset for 1M steps with batch size 256 in 7 days on a DGX-2 machine with 16 V-100 GPUs. Due to space limit, we visualize the different attention patterns of DeBERTa and RoBERTa in Appendix A.7.
|
| 169 |
+
|
| 170 |
+
# 5.2.1 ABLATION STUDY
|
| 171 |
+
|
| 172 |
+
To verify our experimental setting, we pre-train the RoBERTa base model from scratch. The re-pretrained RoBERTa model is denoted as RoBERTa-ReImpbase. To investigate the relative contributions of different components in DeBERTa, we develop three variations:
|
| 173 |
+
|
| 174 |
+
• -EMD is the DeBERTa base model without EMD. • -C2P is the DeBERTa base model without the content-to-position term ((c) in Eq. 4). • -P2C is the DeBERTa base model without the position-to-content term ((b) in Eq. 4). As XLNet also uses the relative position bias, this model is close to XLNet plus EMD.
|
| 175 |
+
|
| 176 |
+
Table 4: Ablation study of the DeBERTa base model.
|
| 177 |
+
|
| 178 |
+
<table><tr><td>Model</td><td>MNLI-m/mm Acc</td><td>SQuAD v1.1 F1/EM</td><td>SQuAD v2.0 F1/EM</td><td>RACE Acc</td></tr><tr><td>BERTbase Devlin et al. (2019) RoBERTabase Liu et al. (2019c)</td><td>84.3/84.7 84.7/-</td><td>88.5/81.0 90.6/-</td><td>76.3/73.7 79.7/-</td><td>65.0 65.6</td></tr><tr><td>XLNetbase Yang et al. (2019) RoBERTa-ReImpbase</td><td>85.8/85.4 84.9/85.1</td><td>-/- 91.1/84.8</td><td>81.3/78.5 79.5/76.0</td><td>66.7 66.8</td></tr><tr><td>DeBERTabase</td><td>86.3/86.2 86.1/86.1</td><td>92.1/86.1</td><td>82.5/79.3</td><td>71.7</td></tr><tr><td>-EMD -C2P</td><td>85.9/85.7</td><td>91.8/85.8 91.6/85.8</td><td>81.3/78.0 81.3/78.3</td><td>70.3 69.3</td></tr><tr><td>-P2C</td><td>86.0/85.8</td><td>91.7/85.7</td><td>80.8/77.6</td><td>69.6</td></tr><tr><td>-(EMD+C2P)</td><td>85.8/85.9</td><td>91.5/85.3</td><td>80.3/77.2</td><td>68.1</td></tr><tr><td>-(EMD+P2C)</td><td>85.8/85.8</td><td>91.3/85.1</td><td>80.2/77.1</td><td>68.5</td></tr></table>
|
| 179 |
+
|
| 180 |
+
Table 4 summarizes the results on four benchmark datasets. First, RoBERTa-ReImp performs similarly to RoBERTa across all benchmark datasets, verfiying that our setting is reasonable. Second, we see that removing any one component in DeBERTa results in a sheer performance drop. For instance, removing EMD (-EMD) results in a loss of $1 . 4 \%$ $7 1 . 7 \%$ vs. $7 0 . 3 \%$ ) on RACE, $0 . 3 \%$ $( 9 2 . 1 \%$ vs. $9 1 . 8 \%$ ) on SQuAD v1.1, $1 . 2 \%$ $8 2 . 5 \%$ vs. $8 1 . 3 \%$ ) on $\mathrm { S Q u A D ~ v } 2 . 0$ , $0 . 2 \%$ ( $8 6 . 3 \%$ vs. $8 6 . 1 \% )$ and $0 . 1 \%$ $8 6 . 2 \%$ vs. $8 6 . 1 \%$ ) on MNLI- $\cdot \mathrm { m } / \mathrm { m m }$ , respectively. Similarly, removing either content-to-position or position-to-content leads to inferior performance in all the benchmarks. As expected, removing two components results in even more substantial loss in performance.
|
| 181 |
+
|
| 182 |
+
# 5.3 SCALE UP TO 1.5 BILLION PARAMETERS
|
| 183 |
+
|
| 184 |
+
Larger pre-trained models have shown better generalization results (Raffel et al., 2020; Brown et al., 2020; Shoeybi et al., 2019). Thus, we have built a larger version of DeBERTa with 1.5 billion parameters, denoted as $\mathrm { D e B E R T a } _ { 1 . 5 B }$ . The model consists of 48 layers with a hidden size of 1,536 and 24 attention heads 6. DeBERTa $_ { 1 . 5 B }$ is trained on a pre-training dataset amounting to 160G, similar to that in Liu et al. (2019c), with a new vocabulary of size 128K constructed using the dataset.
|
| 185 |
+
|
| 186 |
+
To train $\mathrm { D e B E R T a } _ { 1 . 5 B }$ , we optimize the model architecture as follows. First, we share the projection matrices of relative position embedding $W _ { k , r } , W _ { q , r }$ with $W _ { k , c } , W _ { q , c }$ , respectively, in all attention layers to reduce the number of model parameters. Our ablation study in Table 13 on base models shows that the projection matrix sharing reduces the model size while retaining the model performance.
|
| 187 |
+
|
| 188 |
+
Second, a convolution layer is added aside the first Transformer layer to induce n-gram knowledge of sub-word encodings and their outputs are summed up before feeding to the next Transformer layer 7.
|
| 189 |
+
|
| 190 |
+
Table 5 reports the test results of SuperGLUE (Wang et al., 2019a) which is one of the most popular NLU benchmarks. SuperGLUE consists of a wide of NLU tasks, including Question Answering (Clark et al., 2019; Khashabi et al., 2018; Zhang et al., 2018), Natural Language Inference (Dagan et al., 2006; Bar-Haim et al., 2006; Giampiccolo et al., 2007; Bentivogli et al., 2009), Word Sense Disambiguation (Pilehvar & Camacho-Collados, 2019), and Reasoning (Levesque et al., 2011; Roemmele et al., 2011). Since its release in 2019, top research teams around the world have been developing large-scale PLMs that have driven striking performance improvement on SuperGLUE.
|
| 191 |
+
|
| 192 |
+
The significant performance boost due to scaling DeBERTa to a larger model makes the single DeBERTa1.5B surpass the human performance on SuperGLUE for the first time in terms of macroaverage score (89.9 versus 89.8) as of December 29, 2020, and the ensemble DeBERTa model $( \mathrm { D e B E R T a } _ { E n s e m b l e } )$ sits atop the SuperGLUE benchmark rankings as of January 6, 2021, outperforming the human baseline by a decent margin (90.3 versus 89.8). Compared to T5, which consists of 11 billion parameters, the 1.5-billion-parameter DeBERTa is much more energy efficient to train and maintain, and it is easier to compress and deploy to apps of various settings.
|
| 193 |
+
|
| 194 |
+
Table 5: SuperGLUE test set results scored using the SuperGLUE evaluation server. All the results are obtained from https://super.gluebenchmark.com on January 6, 2021.
|
| 195 |
+
|
| 196 |
+
<table><tr><td rowspan=1 colspan=1>Model</td><td rowspan=1 colspan=1>BoolQAcc</td><td rowspan=1 colspan=1>CBF1/Acc</td><td rowspan=1 colspan=1>|COPA|Acc</td><td rowspan=1 colspan=1>MultiRCF1a/EM</td><td rowspan=1 colspan=1>ReCoRDF1/EM</td><td rowspan=1 colspan=1>RTEAcc</td><td rowspan=1 colspan=1>WiCAcc</td><td rowspan=1 colspan=1>Acc</td><td rowspan=1 colspan=1>WSC|AverageScore</td></tr><tr><td rowspan=1 colspan=1>RoBERTalarge</td><td rowspan=1 colspan=1>87.1</td><td rowspan=1 colspan=1>[90.5/95.2</td><td rowspan=1 colspan=1>90.6</td><td rowspan=1 colspan=1>84.4/52.5</td><td rowspan=1 colspan=1>90.6/90.0</td><td rowspan=1 colspan=1>88.2</td><td rowspan=1 colspan=1>69.9</td><td rowspan=1 colspan=1>89.0</td><td rowspan=1 colspan=1>84.6</td></tr><tr><td rowspan=1 colspan=1>NEXHA-Plus</td><td rowspan=1 colspan=1>87.8</td><td rowspan=1 colspan=1>94.4/96.0</td><td rowspan=1 colspan=1>93.6</td><td rowspan=1 colspan=1>84.6/55.1</td><td rowspan=1 colspan=1>90.1/89.6</td><td rowspan=1 colspan=1>89.1</td><td rowspan=1 colspan=1>74.6</td><td rowspan=1 colspan=1>93.2</td><td rowspan=1 colspan=1>86.7</td></tr><tr><td rowspan=1 colspan=1>T511B</td><td rowspan=1 colspan=1>91.2</td><td rowspan=1 colspan=1>93.9/96.8</td><td rowspan=1 colspan=1>94.8</td><td rowspan=1 colspan=1>88.1/63.3</td><td rowspan=1 colspan=1>94.1/93.4</td><td rowspan=1 colspan=1>92.5</td><td rowspan=1 colspan=1>76.9</td><td rowspan=1 colspan=1>93.8</td><td rowspan=1 colspan=1>89.3</td></tr><tr><td rowspan=1 colspan=1>T511B+Meena</td><td rowspan=1 colspan=1>91.3</td><td rowspan=1 colspan=1>95.8/97.6</td><td rowspan=1 colspan=1>97.4</td><td rowspan=1 colspan=1>88.3/63.0</td><td rowspan=1 colspan=1>94.2/93.5</td><td rowspan=1 colspan=1>92.7</td><td rowspan=1 colspan=1>77.9</td><td rowspan=1 colspan=1>95.9</td><td rowspan=1 colspan=1>90.2</td></tr><tr><td rowspan=1 colspan=1>Human</td><td rowspan=1 colspan=1>89.0</td><td rowspan=1 colspan=1>95.8/98.9</td><td rowspan=1 colspan=1>100.0</td><td rowspan=1 colspan=1>81.8/51.9</td><td rowspan=1 colspan=1>91.7/91.3</td><td rowspan=1 colspan=1>93.6</td><td rowspan=1 colspan=1>80.0</td><td rowspan=1 colspan=1>100.0</td><td rowspan=1 colspan=1>89.8</td></tr><tr><td rowspan=2 colspan=1>DeBERTa1.5B+SiFTDeBERTaEnsemble</td><td rowspan=2 colspan=1>90.490.4</td><td rowspan=2 colspan=1>94.9/97.295.7/97.6</td><td rowspan=2 colspan=1>96.898.4</td><td rowspan=2 colspan=1>88.2/63.788.2/63.7</td><td rowspan=2 colspan=1>94.5/94.194.5/94.1</td><td rowspan=2 colspan=1>93.293.2</td><td rowspan=1 colspan=1>76.4</td><td rowspan=2 colspan=1>95.995.9</td><td rowspan=2 colspan=1>89.990.3</td></tr><tr><td rowspan=1 colspan=1>77.5</td></tr></table>
|
| 197 |
+
|
| 198 |
+
# 6 CONCLUSIONS
|
| 199 |
+
|
| 200 |
+
This paper presents a new model architecture DeBERTa (Decoding-enhanced BERT with disentangled attention) that improves the BERT and RoBERTa models using two novel techniques. The first is the disentangled attention mechanism, where each word is represented using two vectors that encode its content and position, respectively, and the attention weights among words are computed using disentangled matrices on their contents and relative positions, respectively. The second is an enhanced mask decoder which incorporates absolute positions in the decoding layer to predict the masked tokens in model pre-training. In addition, a new virtual adversarial training method is used for fine-tuning to improve model’s generalization on downstream tasks.
|
| 201 |
+
|
| 202 |
+
We show through a comprehensive empirical study that these techniques significantly improve the efficiency of model pre-training and the performance of downstream tasks. The DeBERTa model with 1.5 billion parameters surpasses the human performance on the SuperGLUE benchmark for the first time in terms of macro-average score.
|
| 203 |
+
|
| 204 |
+
DeBERTa surpassing human performance on SuperGLUE marks an important milestone toward general AI. Despite its promising results on SuperGLUE, the model is by no means reaching the human-level intelligence of NLU. Humans are extremely good at leveraging the knowledge learned from different tasks to solve a new task with no or little task-specific demonstration. This is referred to as compositional generalization, the ability to generalize to novel compositions (new tasks) of familiar constituents (subtasks or basic problem-solving skills). Moving forward, it is worth exploring how to make DeBERTa incorporate compositional structures in a more explicit manner, which could allow combining neural and symbolic computation of natural language similar to what humans do.
|
| 205 |
+
|
| 206 |
+
# 7 ACKNOWLEDGMENTS
|
| 207 |
+
|
| 208 |
+
We thank Jade Huang and Nikos Karampatziakis for proofreading the paper and providing insightful comments. We thank Yoyo Liang, Saksham Singhal, Xia Song, and Saurabh Tiwary for their help with large-scale model training. We also thank the anonymous reviewers for valuable discussions.
|
| 209 |
+
|
| 210 |
+
# REFERENCES
|
| 211 |
+
|
| 212 |
+
Jimmy Lei Ba, Jamie Ryan Kiros, and Geoffrey E Hinton. Layer normalization. arXiv preprint arXiv:1607.06450, 2016.
|
| 213 |
+
|
| 214 |
+
Roy Bar-Haim, Ido Dagan, Bill Dolan, Lisa Ferro, and Danilo Giampiccolo. The second PASCAL recognising textual entailment challenge. In Proceedings of the Second PASCAL Challenges Workshop on Recognising Textual Entailment, 01 2006.
|
| 215 |
+
|
| 216 |
+
Iz Beltagy, Matthew E Peters, and Arman Cohan. Longformer: The long-document transformer. arXiv preprint arXiv:2004.05150, 2020.
|
| 217 |
+
|
| 218 |
+
Luisa Bentivogli, Ido Dagan, Hoa Trang Dang, Danilo Giampiccolo, and Bernardo Magnini. The fifth pascal recognizing textual entailment challenge. In In Proc Text Analysis Conference (TAC’09, 2009.
|
| 219 |
+
|
| 220 |
+
Tom B Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, et al. Language models are few-shot learners. arXiv preprint arXiv:2005.14165, 2020.
|
| 221 |
+
|
| 222 |
+
Daniel Cer, Mona Diab, Eneko Agirre, Inigo Lopez-Gazpio, and Lucia Specia. Semeval-2017 task 1: Semantic textual similarity-multilingual and cross-lingual focused evaluation. arXiv preprint arXiv:1708.00055, 2017.
|
| 223 |
+
|
| 224 |
+
Kezhen Chen, Qiuyuan Huang, Hamid Palangi, Paul Smolensky, Kenneth D Forbus, and Jianfeng Gao. Natural-to formal-language generation using tensor product representations. arXiv preprint arXiv:1910.02339, 2019.
|
| 225 |
+
|
| 226 |
+
Rewon Child, Scott Gray, Alec Radford, and Ilya Sutskever. Generating long sequences with sparse transformers. arXiv preprint arXiv:1904.10509, 2019.
|
| 227 |
+
|
| 228 |
+
Christopher Clark, Kenton Lee, Ming-Wei Chang, Tom Kwiatkowski, Michael Collins, and Kristina Toutanova. BoolQ: Exploring the surprising difficulty of natural yes/no questions. In Proceedings of NAACL-HLT 2019, 2019.
|
| 229 |
+
|
| 230 |
+
Kevin Clark, Minh-Thang Luong, Quoc V. Le, and Christopher D. Manning. ELECTRA: Pre-training text encoders as discriminators rather than generators. In ICLR, 2020.
|
| 231 |
+
|
| 232 |
+
Ido Dagan, Oren Glickman, and Bernardo Magnini. The pascal recognising textual entailment challenge. In Proceedings of the First International Conference on Machine Learning Challenges: Evaluating Predictive Uncertainty Visual Object Classification, and Recognizing Textual Entailment, MLCW’05, Berlin, Heidelberg, 2006.
|
| 233 |
+
|
| 234 |
+
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, pp. 2978–2988, 2019.
|
| 235 |
+
|
| 236 |
+
Marie-Catherine De Marneffe, Mandy Simons, and Judith Tonhauser. The commitmentbank: Investigating projection in naturally occurring discourse. In proceedings of Sinn und Bedeutung, volume 23, pp. 107–124, 2019.
|
| 237 |
+
|
| 238 |
+
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, 2019.
|
| 239 |
+
|
| 240 |
+
William B Dolan and Chris Brockett. Automatically constructing a corpus of sentential paraphrases. In Proceedings of the Third International Workshop on Paraphrasing (IWP2005), 2005.
|
| 241 |
+
|
| 242 |
+
Li Dong, Nan Yang, Wenhui Wang, Furu Wei, Xiaodong Liu, Yu Wang, Jianfeng Gao, Ming Zhou, and Hsiao-Wuen Hon. Unified language model pre-training for natural language understanding and generation. In Advances in Neural Information Processing Systems, pp. 13042–13054, 2019.
|
| 243 |
+
|
| 244 |
+
Danilo Giampiccolo, Bernardo Magnini, Ido Dagan, and Bill Dolan. The third PASCAL recognizing textual entailment challenge. In Proceedings of the ACL-PASCAL Workshop on Textual Entailment and Paraphrasing, pp. 1–9, Prague, June 2007. Association for Computational Linguistics. URL https://www.aclweb.org/anthology/W07-1401.
|
| 245 |
+
|
| 246 |
+
Aaron Gokaslan and Vanya Cohen. Openwebtext corpus. http://Skylion007.github.io, 2019.
|
| 247 |
+
|
| 248 |
+
Pengcheng He, Xiaodong Liu, Weizhu Chen, and Jianfeng Gao. A hybrid neural network model for commonsense reasoning. arXiv preprint arXiv:1907.11983, 2019a.
|
| 249 |
+
|
| 250 |
+
Pengcheng He, Yi Mao, Kaushik Chakrabarti, and Weizhu Chen. X-sql: reinforce schema representation with context. arXiv preprint arXiv:1908.08113, 2019b.
|
| 251 |
+
|
| 252 |
+
Cheng-Zhi Anna Huang, Ashish Vaswani, Jakob Uszkoreit, Ian Simon, Curtis Hawthorne, Noam Shazeer, Andrew M Dai, Matthew D Hoffman, Monica Dinculescu, and Douglas Eck. Music transformer: Generating music with long-term structure. 2018.
|
| 253 |
+
|
| 254 |
+
Haoming Jiang, Pengcheng He, Weizhu Chen, Xiaodong Liu, Jianfeng Gao, and Tuo Zhao. SMART: Robust and efficient fine-tuning for pre-trained natural language models through principled regularized optimization. In ACL, July 2020. doi: 10.18653/v1/2020.acl-main.197.
|
| 255 |
+
|
| 256 |
+
Mandar Joshi, Danqi Chen, Yinhan Liu, Daniel S Weld, Luke Zettlemoyer, and Omer Levy. Spanbert: Improving pre-training by representing and predicting spans. Transactions of the Association for Computational Linguistics, 8:64–77, 2020.
|
| 257 |
+
|
| 258 |
+
Daniel Khashabi, Snigdha Chaturvedi, Michael Roth, Shyam Upadhyay, and Dan Roth. Looking beyond the surface: A challenge set for reading comprehension over multiple sentences. 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. 252–262, 2018.
|
| 259 |
+
|
| 260 |
+
Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
|
| 261 |
+
|
| 262 |
+
Nikita Kitaev, Lukasz Kaiser, and Anselm Levskaya. Reformer: The efficient transformer. In International Conference on Learning Representations, 2019.
|
| 263 |
+
|
| 264 |
+
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, pp. 785–794, 2017.
|
| 265 |
+
|
| 266 |
+
Zhenzhong Lan, Mingda Chen, Sebastian Goodman, Kevin Gimpel, Piyush Sharma, and Radu Soricut. Albert: A lite bert for self-supervised learning of language representations. In International Conference on Learning Representations, 2019.
|
| 267 |
+
|
| 268 |
+
Hector Levesque, Ernest Davis, and Leora Morgenstern. The winograd schema challenge. In Thirteenth International Conference on the Principles of Knowledge Representation and Reasoning, 2012.
|
| 269 |
+
|
| 270 |
+
Hector J Levesque, Ernest Davis, and Leora Morgenstern. The Winograd schema challenge. In AAAI Spring Symposium: Logical Formalizations of Commonsense Reasoning, volume 46, pp. 47, 2011.
|
| 271 |
+
|
| 272 |
+
Liyuan Liu, Haoming Jiang, Pengcheng He, Weizhu Chen, Xiaodong Liu, Jianfeng Gao, and Jiawei Han. On the variance of the adaptive learning rate and beyond. In International Conference on Learning Representations, 2019a.
|
| 273 |
+
|
| 274 |
+
Xiaodong Liu, Pengcheng He, Weizhu Chen, and Jianfeng Gao. Multi-task deep neural networks for natural language understanding. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pp. 4487–4496, Florence, Italy, July 2019b. Association for Computational Linguistics. URL https://www.aclweb.org/anthology/P19-1441.
|
| 275 |
+
|
| 276 |
+
Xiaodong Liu, Hao Cheng, Pengcheng He, Weizhu Chen, Yu Wang, Hoifung Poon, and Jianfeng Gao. Adversarial training for large neural language models. arXiv preprint arXiv:2004.08994, 2020.
|
| 277 |
+
|
| 278 |
+
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.
|
| 279 |
+
|
| 280 |
+
Ilya Loshchilov and Frank Hutter. Fixing weight decay regularization in adam. 2018.
|
| 281 |
+
|
| 282 |
+
Stephen Merity, Caiming Xiong, James Bradbury, and Richard Socher. Pointer sentinel mixture models. arXiv, pp. arXiv–1609, 2016.
|
| 283 |
+
|
| 284 |
+
Shervin Minaee, Nal Kalchbrenner, Erik Cambria, Narjes Nikzad, Meysam Chenaghlu, and Jianfeng Gao. Deep learning based text classification: A comprehensive review. arXiv preprint arXiv:2004.03705, 2020.
|
| 285 |
+
|
| 286 |
+
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.
|
| 287 |
+
|
| 288 |
+
Mohammad Taher Pilehvar and Jose Camacho-Collados. Wic: the word-in-context dataset for evaluating context-sensitive meaning representations. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pp. 1267–1273, 2019.
|
| 289 |
+
|
| 290 |
+
Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. Language models are unsupervised multitask learners. OpenAI Blog, 1(8), 2019.
|
| 291 |
+
|
| 292 |
+
Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J. Liu. Exploring the limits of transfer learning with a unified text-to-text transformer. Journal of Machine Learning Research, 21(140):1–67, 2020. URL http://jmlr.org/papers/v21/20-074.html.
|
| 293 |
+
|
| 294 |
+
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, November 2016.
|
| 295 |
+
|
| 296 |
+
Pranav Rajpurkar, Robin Jia, and Percy Liang. Know what you don’t know: Unanswerable questions for squad. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 2: Short Papers), pp. 784–789, 2018.
|
| 297 |
+
|
| 298 |
+
Melissa Roemmele, Cosmin Adrian Bejan, and Andrew S. Gordon. Choice of plausible alternatives: An evaluation of commonsense causal reasoning. In 2011 AAAI Spring Symposium Series, 2011.
|
| 299 |
+
|
| 300 |
+
Imanol Schlag, Paul Smolensky, Roland Fernandez, Nebojsa Jojic, Jürgen Schmidhuber, and Jianfeng Gao. Enhancing the transformer with explicit relational encoding for math problem solving. arXiv preprint arXiv:1910.06611, 2019.
|
| 301 |
+
|
| 302 |
+
Peter Shaw, Jakob Uszkoreit, and Ashish Vaswani. Self-attention with relative position representations. In Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 2 (Short Papers), pp. 464–468, 2018.
|
| 303 |
+
|
| 304 |
+
Tao Shen, Yi Mao, Pengcheng He, Guodong Long, Adam Trischler, and Weizhu Chen. Exploiting structured knowledge in text via graph-guided representation learning. arXiv preprint arXiv:2004.14224, 2020.
|
| 305 |
+
|
| 306 |
+
Mohammad Shoeybi, Mostofa Patwary, Raul Puri, Patrick LeGresley, Jared Casper, and Bryan Catanzaro. Megatron-lm: Training multi-billion parameter language models using gpu model parallelism. arXiv preprint arXiv:1909.08053, 2019.
|
| 307 |
+
|
| 308 |
+
Paul Smolensky. Tensor product variable binding and the representation of symbolic structures in connectionist systems. Artificial intelligence, 46(1-2):159–216, 1990.
|
| 309 |
+
|
| 310 |
+
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.
|
| 311 |
+
|
| 312 |
+
Yu Sun, Shuohuan Wang, Yukun Li, Shikun Feng, Xuyi Chen, Han Zhang, Xin Tian, Danxiang Zhu, Hao Tian, and Hua Wu. Ernie: Enhanced representation through knowledge integration. arXiv preprint arXiv:1904.09223, 2019.
|
| 313 |
+
|
| 314 |
+
Trieu H Trinh and Quoc V Le. A simple method for commonsense reasoning. arXiv preprint arXiv:1806.02847, 2018.
|
| 315 |
+
|
| 316 |
+
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.
|
| 317 |
+
|
| 318 |
+
Alex Wang, Yada Pruksachatkun, Nikita Nangia, Amanpreet Singh, Julian Michael, Felix Hill, Omer Levy, and Samuel Bowman. Superglue: A stickier benchmark for general-purpose language understanding systems. In Advances in neural information processing systems, pp. 3266–3280, 2019a.
|
| 319 |
+
|
| 320 |
+
Alex Wang, Amanpreet Singh, Julian Michael, Felix Hill, Omer Levy, and Samuel Bowman. Glue: A multi-task benchmark and analysis platform for natural language understanding. In 7th International Conference on Learning Representations, ICLR 2019, 2019b.
|
| 321 |
+
|
| 322 |
+
Wei Wang, Bin Bi, Ming Yan, Chen Wu, Zuyi Bao, Liwei Peng, and Luo Si. Structbert: Incorporating language structures into pre-training for deep language understanding. arXiv preprint arXiv:1908.04577, 2019c.
|
| 323 |
+
|
| 324 |
+
Alex Warstadt, Amanpreet Singh, and Samuel R Bowman. Neural network acceptability judgments. arXiv preprint arXiv:1805.12471, 2018.
|
| 325 |
+
|
| 326 |
+
Adina Williams, Nikita Nangia, and Samuel Bowman. A broad-coverage challenge corpus for sentence understanding through inference. 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. 1112–1122. Association for Computational Linguistics, 2018. URL http://aclweb.org/anthology/N18-1101.
|
| 327 |
+
|
| 328 |
+
Zhilin Yang, Zihang Dai, Yiming Yang, Jaime Carbonell, Russ R Salakhutdinov, and Quoc V Le. Xlnet: Generalized autoregressive pretraining for language understanding. In Advances in neural information processing systems, pp. 5754–5764, 2019.
|
| 329 |
+
|
| 330 |
+
Rowan Zellers, Yonatan Bisk, Roy Schwartz, and Yejin Choi. Swag: A large-scale adversarial dataset for grounded commonsense inference. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pp. 93–104, 2018.
|
| 331 |
+
|
| 332 |
+
Sheng Zhang, Xiaodong Liu, Jingjing Liu, Jianfeng Gao, Kevin Duh, and Benjamin Van Durme. ReCoRD: Bridging the gap between human and machine commonsense reading comprehension. arXiv preprint 1810.12885, 2018.
|
| 333 |
+
|
| 334 |
+
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, pp. 19–27, 2015.
|
| 335 |
+
|
| 336 |
+
# A APPENDIX
|
| 337 |
+
|
| 338 |
+
A.1 DATASET
|
| 339 |
+
Table 6: Summary information of the NLP application benchmarks.
|
| 340 |
+
|
| 341 |
+
<table><tr><td rowspan=1 colspan=1>Corpus</td><td rowspan=1 colspan=1>Task</td><td rowspan=1 colspan=2>#Train #Dev</td><td rowspan=1 colspan=3>#Test #Label Metrics</td></tr><tr><td rowspan=1 colspan=7>General Language Understanding Evaluation (GLUE)</td></tr><tr><td rowspan=1 colspan=1>CoLA</td><td rowspan=1 colspan=1>Acceptability</td><td rowspan=1 colspan=1>8.5k</td><td rowspan=1 colspan=1>1k</td><td rowspan=1 colspan=1>1k</td><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>Matthews corr</td></tr><tr><td rowspan=1 colspan=1>SST</td><td rowspan=1 colspan=1>Sentiment</td><td rowspan=1 colspan=1>67k</td><td rowspan=1 colspan=1>872</td><td rowspan=1 colspan=1>1.8k</td><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>Accuracy</td></tr><tr><td rowspan=1 colspan=1>MNLI</td><td rowspan=1 colspan=1>NLI</td><td rowspan=1 colspan=1>393k</td><td rowspan=1 colspan=1>20k</td><td rowspan=1 colspan=1>20k</td><td rowspan=1 colspan=1>3</td><td rowspan=1 colspan=1>Accuracy</td></tr><tr><td rowspan=1 colspan=1>RTE</td><td rowspan=1 colspan=1>NLI</td><td rowspan=1 colspan=1>2.5k</td><td rowspan=1 colspan=1>276</td><td rowspan=1 colspan=1>3k</td><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>Accuracy</td></tr><tr><td rowspan=1 colspan=1>WNLI</td><td rowspan=1 colspan=1>NLI</td><td rowspan=1 colspan=1>634</td><td rowspan=1 colspan=1>71</td><td rowspan=1 colspan=1>146</td><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>Accuracy</td></tr><tr><td rowspan=1 colspan=1>QQP</td><td rowspan=1 colspan=1>Paraphrase</td><td rowspan=1 colspan=1>364k</td><td rowspan=1 colspan=1>40k</td><td rowspan=1 colspan=1>391k</td><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>Accuracy/F1</td></tr><tr><td rowspan=1 colspan=1>MRPC</td><td rowspan=1 colspan=1>Paraphrase</td><td rowspan=1 colspan=1>3.7k</td><td rowspan=1 colspan=1>408</td><td rowspan=1 colspan=1>1.7k</td><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>Accuracy/F1</td></tr><tr><td rowspan=1 colspan=1>QNLI</td><td rowspan=1 colspan=1>QA/NLI</td><td rowspan=1 colspan=1>108k</td><td rowspan=1 colspan=1>5.7k</td><td rowspan=1 colspan=1>5.7k</td><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>Accuracy</td></tr><tr><td rowspan=1 colspan=1>STS-B</td><td rowspan=1 colspan=1>Similarity</td><td rowspan=1 colspan=1>7k</td><td rowspan=1 colspan=1>1.5k</td><td rowspan=1 colspan=1>1.4k</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>Pearson/Spearman corr</td></tr><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=3>SuperGLUE</td><td rowspan=1 colspan=3></td></tr><tr><td rowspan=1 colspan=1>WSC</td><td rowspan=1 colspan=1>Coreference</td><td rowspan=1 colspan=1>554k</td><td rowspan=1 colspan=1>104</td><td rowspan=1 colspan=1>146</td><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>Accuracy</td></tr><tr><td rowspan=1 colspan=1>BoolQ</td><td rowspan=1 colspan=1>QA</td><td rowspan=1 colspan=1>9,427</td><td rowspan=1 colspan=1>3,270</td><td rowspan=1 colspan=1>3,245</td><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>Accuracy</td></tr><tr><td rowspan=1 colspan=1>COPA</td><td rowspan=1 colspan=1>QA</td><td rowspan=1 colspan=1>400k</td><td rowspan=1 colspan=1>100</td><td rowspan=1 colspan=1>500</td><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>Accuracy</td></tr><tr><td rowspan=1 colspan=1>CB</td><td rowspan=1 colspan=1>NLI</td><td rowspan=1 colspan=1>250</td><td rowspan=1 colspan=1>57</td><td rowspan=1 colspan=1>250</td><td rowspan=1 colspan=1>3</td><td rowspan=1 colspan=1>Accuracy/F1</td></tr><tr><td rowspan=1 colspan=1>RTE</td><td rowspan=1 colspan=1>NLI</td><td rowspan=1 colspan=1>2.5k</td><td rowspan=1 colspan=1>276</td><td rowspan=1 colspan=1>3k</td><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>Accuracy</td></tr><tr><td rowspan=1 colspan=1>WiC</td><td rowspan=1 colspan=1>WSD</td><td rowspan=1 colspan=1>2.5k</td><td rowspan=1 colspan=1>276</td><td rowspan=1 colspan=1>3k</td><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>Accuracy</td></tr><tr><td rowspan=1 colspan=1>ReCoRD</td><td rowspan=1 colspan=1>MRC</td><td rowspan=1 colspan=1>101k</td><td rowspan=1 colspan=1>10k</td><td rowspan=1 colspan=1>10k</td><td rowspan=1 colspan=1>-</td><td rowspan=1 colspan=1>Exact Match (EM)/F1</td></tr><tr><td rowspan=1 colspan=1>MultiRC</td><td rowspan=1 colspan=1>Multiple choice</td><td rowspan=1 colspan=1>5,100</td><td rowspan=1 colspan=1>953</td><td rowspan=1 colspan=1>1,800</td><td rowspan=1 colspan=1>二</td><td rowspan=1 colspan=1>Exact Match (EM)/F1</td></tr><tr><td rowspan=1 colspan=7>Question Answering</td></tr><tr><td rowspan=1 colspan=1>SQuAD v1.1</td><td rowspan=1 colspan=1>MRC</td><td rowspan=1 colspan=1>87.6k</td><td rowspan=1 colspan=1>10.5k</td><td rowspan=1 colspan=1>9.5k</td><td rowspan=1 colspan=1>二</td><td rowspan=1 colspan=1>Exact Match (EM)/F1</td></tr><tr><td rowspan=1 colspan=1>SQuAD v2.0</td><td rowspan=1 colspan=1>MRC</td><td rowspan=1 colspan=1>130.3k</td><td rowspan=1 colspan=1>11.9k</td><td rowspan=1 colspan=1>8.9k</td><td rowspan=1 colspan=1>-</td><td rowspan=1 colspan=1>ExactMatch (EM)/F1</td></tr><tr><td rowspan=1 colspan=1>RACE</td><td rowspan=1 colspan=1>MRC</td><td rowspan=1 colspan=1>87,866</td><td rowspan=1 colspan=1>4,887</td><td rowspan=1 colspan=1>4,934</td><td rowspan=1 colspan=1>4</td><td rowspan=1 colspan=1>Accuracy</td></tr><tr><td rowspan=1 colspan=1>SWAG</td><td rowspan=1 colspan=1>Multiple choice</td><td rowspan=1 colspan=1>73.5k</td><td rowspan=1 colspan=1>20k</td><td rowspan=1 colspan=1>20k</td><td rowspan=1 colspan=1>4</td><td rowspan=1 colspan=1>Accuracy</td></tr><tr><td rowspan=1 colspan=7>Token Classification</td></tr><tr><td rowspan=1 colspan=1>CoNLL 2003</td><td rowspan=1 colspan=1>NER</td><td rowspan=1 colspan=1>14,987</td><td rowspan=1 colspan=1>3,466</td><td rowspan=1 colspan=1>3,684</td><td rowspan=1 colspan=1>8</td><td rowspan=1 colspan=1>F1</td></tr></table>
|
| 342 |
+
|
| 343 |
+
‚ GLUE. The General Language Understanding Evaluation (GLUE) benchmark is a collection of nine natural language understanding (NLU) tasks. As shown in Table 6, it includes question answering (Rajpurkar et al., 2016), linguistic acceptability (Warstadt et al., 2018), sentiment analysis (Socher et al., 2013), text similarity (Cer et al., 2017), paraphrase detection (Dolan & Brockett, 2005), and natural language inference (NLI) (Dagan et al., 2006; Bar-Haim et al., 2006; Giampiccolo et al., 2007; Bentivogli et al., 2009; Levesque et al., 2012; Williams et al., 2018). The diversity of the tasks makes GLUE very suitable for evaluating the generalization and robustness of NLU models.
|
| 344 |
+
|
| 345 |
+
‚ SuperGLUE. SuperGLUE is an extension of the GLUE benchmark, but more difficult, which is a collection of eight NLU tasks. It covers a various of tasks including question answering (Zhang et al., 2018; Clark et al., 2019; Khashabi et al., 2018), natural language inference (Dagan et al., 2006; Bar-Haim et al., 2006; Giampiccolo et al., 2007; Bentivogli et al., 2009; De Marneffe et al., 2019), coreference resolution (Levesque et al., 2012) and word sense disambiguation (Pilehvar & Camacho-Collados, 2019).
|
| 346 |
+
|
| 347 |
+
‚ RACE is a large-scale machine reading comprehension dataset, collected from English examinations in China, which are designed for middle school and high school students (Lai et al., 2017).
|
| 348 |
+
|
| 349 |
+
‚ SQuAD v1.1/v2.0 is the Stanford Question Answering Dataset (SQuAD) v1.1 and v2.0 (Rajpurkar et al., 2016; 2018) are popular machine reading comprehension benchmarks. Their passages come from approximately 500 Wikipedia articles and the questions and answers are obtained by crowdsourcing. The SQuAD $\mathrm { v } 2 . 0$ dataset includes unanswerable questions about the same paragraphs.
|
| 350 |
+
|
| 351 |
+
‚ SWAG is a large-scale adversarial dataset for the task of grounded commonsense inference, which unifies natural language inference and physically grounded reasoning (Zellers et al., 2018). SWAG consists of $1 1 3 \mathrm { k }$ multiple choice questions about grounded situations.
|
| 352 |
+
|
| 353 |
+
‚ CoNLL 2003 is an English dataset consisting of text from a wide variety of sources. It has 4 types of named entity.
|
| 354 |
+
|
| 355 |
+
# A.2 PRE-TRAINING DATASET
|
| 356 |
+
|
| 357 |
+
For DeBERTa pre-training, we use Wikipedia (English Wikipedia dump8; 12GB), BookCorpus (Zhu et al., 2015) 9 (6GB), OPENWEBTEXT (public Reddit content (Gokaslan & Cohen, 2019); 38GB) and STORIES10 (a subset of CommonCrawl (Trinh & Le, 2018); 31GB). The total data size after data deduplication(Shoeybi et al., 2019) is about 78GB. For pre-training, we also sample $5 \%$ training data as the validation set to monitor the training process. Table 7 compares datasets used in different pre-trained models.
|
| 358 |
+
|
| 359 |
+
Table 7: Comparison of the pre-training data.
|
| 360 |
+
|
| 361 |
+
<table><tr><td rowspan=1 colspan=1>Model</td><td rowspan=1 colspan=1>Wiki+Book16GB</td><td rowspan=1 colspan=1>OpenWebText38GB</td><td rowspan=1 colspan=1>Stories31GB</td><td rowspan=1 colspan=1>CC-News76GB</td><td rowspan=1 colspan=1>Giga516GB</td><td rowspan=1 colspan=1>ClueWeb19GB</td><td rowspan=1 colspan=1>Common Crawl110GB</td></tr><tr><td rowspan=1 colspan=1>BERT</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></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1>XLNet</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>√</td><td rowspan=1 colspan=1>√</td><td rowspan=1 colspan=1>(24号</td></tr><tr><td rowspan=1 colspan=1>RoBERTa</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></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1>DeBERTaDeBERTa1.5B</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></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td></tr></table>
|
| 362 |
+
|
| 363 |
+
# A.3 IMPLEMENTATION DETAILS
|
| 364 |
+
|
| 365 |
+
Following RoBERTa (Liu et al., 2019c), we adopt dynamic data batching. We also include span masking (Joshi et al., 2020) as an additional masking strategy with the span size up to three. We list the detailed hyperparameters of pre-training in Table 8. For pre-training, we use Adam (Kingma & Ba, 2014) as the optimizer with weight decay (Loshchilov & Hutter, 2018). For fine-tuning, even though we can get better and robust results with RAdam(Liu et al., 2019a) on some tasks, e.g. CoLA, RTE and RACE, we use Adam(Kingma & Ba, 2014) as the optimizer for a fair comparison. For fine-tuning, we train each task with a hyper-parameter search procedure, each run takes about 1-2 hours on a DGX-2 node. All the hyper-parameters are presented in Table 9. The model selection is based on the performance on the task-specific development sets.
|
| 366 |
+
|
| 367 |
+
Our code is implemented based on Huggingface Transformers11, FairSeq12 and Megatron (Shoeybi et al., 2019)13.
|
| 368 |
+
|
| 369 |
+
# A.3.1 PRE-TRAINING EFFICIENCY
|
| 370 |
+
|
| 371 |
+
To investigate the efficiency of model pre-training, we plot the performance of the fine-tuned model on downstream tasks as a function of the number of pre-training steps. As shown in Figure 1, for RoBERTa-ReImpbase and $\mathrm { D e B E R T a } _ { b a s e }$ , we dump a checkpoint every 150K pre-training steps, and then fine-tune the checkpoint on two representative downstream tasks, MNLI and SQuAD v2.0, and then report the accuracy and F1 score, respectively. As a reference, we also report the final model performance of both the original $\mathrm { R o B E R T a } _ { b a s e }$ (Liu et al., 2019c) and $\mathtt { X L N e t } _ { b a s e }$ (Yang et al., 2019). The results show that $\mathrm { D e B E R T a } _ { b a s e }$ consistently outperforms RoBERTa-ReImpbase during the course of pre-training.
|
| 372 |
+
|
| 373 |
+
Table 8: Hyper-parameters for pre-training DeBERTa.
|
| 374 |
+
|
| 375 |
+
<table><tr><td>Hyper-parameter</td><td>|DeBERTa1.5B</td><td>DeBERTalarge</td><td>DeBERTabase</td><td>DeBERTabase-ablation</td></tr><tr><td>Number of Layers</td><td>48</td><td>24</td><td>12</td><td>12</td></tr><tr><td>Hidden size</td><td>1536</td><td>1024</td><td>768</td><td>768</td></tr><tr><td>FNN inner hidden size</td><td>6144</td><td>4096</td><td>3072</td><td>3072</td></tr><tr><td>Attention Heads</td><td>24</td><td>16</td><td>12</td><td>12</td></tr><tr><td>Attention Head size</td><td>64</td><td>64</td><td>64</td><td>64</td></tr><tr><td>Dropout</td><td>0.1</td><td>0.1</td><td>0.1</td><td>0.1</td></tr><tr><td>Warmup Steps</td><td>10k</td><td>10k</td><td>10k</td><td>10k</td></tr><tr><td>Learning Rates</td><td>1.5e-4</td><td>2e-4</td><td>2e-4</td><td>1e-4</td></tr><tr><td>Batch Size</td><td>2k</td><td>2k</td><td>2k</td><td>256</td></tr><tr><td>Weight Decay</td><td>0.01</td><td>0.01</td><td>0.01</td><td>0.01</td></tr><tr><td>Max Steps</td><td>1M</td><td>1M</td><td>1M</td><td>1M</td></tr><tr><td>Learning Rate Decay</td><td>Linear</td><td>Linear</td><td>Linear</td><td>Linear</td></tr><tr><td>Adam ∈</td><td>1e-6</td><td>1e-6</td><td>1e-6</td><td>1e-6</td></tr><tr><td>Adam β1</td><td>0.9</td><td>0.9</td><td>0.9</td><td>0.9</td></tr><tr><td>Adam β2</td><td>0.999</td><td>0.999</td><td>0.999</td><td>0.999</td></tr><tr><td>Gradient Clipping</td><td>1.0</td><td>1.0</td><td>1.0</td><td></td></tr><tr><td>Number ofDGX-2 nodes</td><td>16</td><td>6</td><td></td><td>1.0</td></tr><tr><td>Training Time</td><td>30 days</td><td>20 days</td><td>4 10 days</td><td>1 7 days</td></tr></table>
|
| 376 |
+
|
| 377 |
+
Table 9: Hyper-parameters for fine-tuning DeBERTa on down-streaming tasks.
|
| 378 |
+
|
| 379 |
+
<table><tr><td>Hyper-parameter</td><td>DeBERTa1.5B</td><td>DeBERTalarge</td><td>DeBERTabase</td></tr><tr><td>Dropout of task layer Warmup Steps Learning Rates Batch Size Weight Decay Maximun Training Epochs Learning Rate Decay Adam ∈ Adam β1</td><td>{0,0.15,0.3} {50,100,500,1000] {1e-6,3e-6, 5e-6} {16,32,64} 0.01 10 Linear 1e-6 0.9</td><td>{0,0.1,0.15} {50,100,500,1000} {5e-6,8e-6, 9e-6, 1e-5} {16,32,48,64} 0.01 10 Linear 1e-6</td><td>{0,0.1,0.15} {50,100,500,1000] {1.5e-5,2e-5, 3e-5,4e-5} {16,32,48,64} 10 Linear</td></tr></table>
|
| 380 |
+
|
| 381 |
+

|
| 382 |
+
Figure 1: Pre-training performance curve between DeBERTa and its counterparts on the MNLI and SQuAD v2.0 development set.
|
| 383 |
+
|
| 384 |
+
# A.4 MAIN RESULTS ON GENERATION TASKS
|
| 385 |
+
|
| 386 |
+
In addition to NLU tasks, DeBERTa can also be extended to handle NLG tasks. To allow DeBERTa operating like an auto-regressive model for text generation, we use a triangular matrix for selfattention and set the upper triangular part of the self-attention mask to $- \infty$ , following Dong et al. (2019).
|
| 387 |
+
|
| 388 |
+
We evaluate DeBERTa on the task of auto-regressive language model (ARLM) using Wikitext103 (Merity et al., 2016). To do so, we train a new version of DeBERTa, denoted as DeBERTa-MT. It is jointly pre-trained using the MLM and ARLM tasks as in UniLM (Dong et al., 2019). The pre-training hyper-parameters follows that of $\mathrm { D e B E R T a } _ { b a s e }$ except that we use fewer training steps (200k). For comparison, we use RoBERTa as baseline, and include GPT-2 and Transformer-XL as additional references. DeBERTa-AP is a variant of DeBERTa where absolute position embeddings are incorporated in the input layer as RoBERTa. For a fair comparison, all these models are base models pre-trained in a similar setting.
|
| 389 |
+
|
| 390 |
+
Table 10: Language model results in perplexity (lower is better) on Wikitext-103 .
|
| 391 |
+
|
| 392 |
+
<table><tr><td rowspan=1 colspan=7>Model |RoBERTa|DeBERTa-AP|DeBERTa|DeBERTa-MT|GPT-2|Transformer-XL</td></tr><tr><td rowspan=1 colspan=1>Dev PPL</td><td rowspan=1 colspan=1>21.6</td><td rowspan=1 colspan=1>20.7</td><td rowspan=1 colspan=1>20.5</td><td rowspan=1 colspan=1>19.5</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>23.1</td></tr><tr><td rowspan=1 colspan=1>Test PPL</td><td rowspan=1 colspan=1>21.6</td><td rowspan=1 colspan=1>20.0</td><td rowspan=1 colspan=1>19.9</td><td rowspan=1 colspan=1>19.5</td><td rowspan=1 colspan=1>37.50</td><td rowspan=1 colspan=1>24</td></tr></table>
|
| 393 |
+
|
| 394 |
+
Table 10 summarizes the results on Wikitext-103. We see that $\mathrm { D e B E R T a _ { b a s e } }$ obtains lower perplexities on both dev and test data, and joint training using MLM and ARLM reduces perplexity further. That DeBERTa-AP is inferior to DeBERTa indicates that it is more effective to incorporate absolute position embeddings of words in the decoding layer as the EMD in DeBERTa than in the input layer as RoBERTa.
|
| 395 |
+
|
| 396 |
+
# A.5 HANDLING LONG SEQUENCE INPUT
|
| 397 |
+
|
| 398 |
+
With relative position bias, we choose to truncate the maximum relative distance to $k$ as in equation 3. Thus in each layer, each token can attend directly to at most $2 ( k - 1 )$ tokens and itself. By stacking Transformer layers, each token in the l´th layer can attend to at most $( 2 k - 1 ) l$ tokens implicitly. Taking $\mathrm { D e B E R T a } _ { l a r g e }$ as an example, where $k = 5 1 2 , L = 2 4$ , in theory, the maximum sequence length that can be handled is 24,528. This is a byproduct benefit of our design choice and we find it beneficial for the RACE task. A comparison of long sequence effect on the RACE task is shown in Table 11.
|
| 399 |
+
|
| 400 |
+
Table 11: The effect of handling long sequence input for RACE task with DeBERTa
|
| 401 |
+
|
| 402 |
+
<table><tr><td rowspan=1 colspan=1>Sequence length |Middle|High| A</td><td rowspan=1 colspan=1>Middle</td><td rowspan=1 colspan=1>High</td><td rowspan=1 colspan=1>|Accuracy</td></tr><tr><td rowspan=2 colspan=1>512768</td><td rowspan=1 colspan=1>88.8</td><td rowspan=1 colspan=1>85.0</td><td rowspan=1 colspan=1>86.3</td></tr><tr><td rowspan=1 colspan=1>88.7</td><td rowspan=1 colspan=1>86.3</td><td rowspan=1 colspan=1>86.8</td></tr></table>
|
| 403 |
+
|
| 404 |
+
Long sequence handling is an active research area. There have been a lot of studies where the Transformer architecture is extended for long sequence handling(Beltagy et al., 2020; Kitaev et al., 2019; Child et al., 2019; Dai et al., 2019). One of our future research directions is to extend DeBERTa to deal with extremely long sequences.
|
| 405 |
+
|
| 406 |
+
# A.6 PERFORMANCE IMPROVEMENTS OF DIFFERENT MODEL SCALES
|
| 407 |
+
|
| 408 |
+
In this subsection, we study the effect of different model sizes applied to large models on GLUE. Table 12 summarizes the results, showing that larger models can obtain a better result and SiFT also improves the model performance consistently.
|
| 409 |
+
|
| 410 |
+
Table 12: Comparison results of DeBERTa models with different sizes on the GLUE development set.
|
| 411 |
+
|
| 412 |
+
<table><tr><td>Model</td><td>CoLA| Mcc</td><td>|QQP Acc</td><td>MNLI-m/mml Acc</td><td>SST-2| Acc</td><td>STS-B Corr</td><td>QNLI Acc</td><td>RTE Acc</td><td>MRPC| Acc</td><td>Avg.</td></tr><tr><td>DeBERTalarge</td><td>70.5</td><td>92.3</td><td>91.1/91.1</td><td>96.8</td><td>92.8</td><td>95.3</td><td>88.3</td><td>91.9</td><td>90.00</td></tr><tr><td>DeBERTa900M</td><td>71.1</td><td>92.3</td><td>91.7/91.6</td><td>97.5</td><td>92.0</td><td>95.8</td><td>93.5</td><td>93.1</td><td>90.86</td></tr><tr><td>DeBERTa1.5B</td><td>72.0</td><td>92.7</td><td>91.7/91.9</td><td>97.2</td><td>92.9</td><td>96.0</td><td>93.9</td><td>92.0</td><td>91.17</td></tr><tr><td>DeBERTa1.5B+SiFT</td><td>73.5</td><td>93.0</td><td>92.0/92.1</td><td>97.5</td><td>93.2</td><td>96.5</td><td>96.5</td><td>93.2</td><td>91.93</td></tr></table>
|
| 413 |
+
|
| 414 |
+
<table><tr><td>Model</td><td>Parameters</td><td>MNLI-m/mm Acc</td><td>SQuAD v1.1 F1/EM</td><td>SQuAD v2.0 F1/EM</td></tr><tr><td>RoBERTa-ReImpbase</td><td>120M</td><td>84.9/85.1</td><td>91.1/84.8</td><td>79.5/76.0</td></tr><tr><td>DeBERTabase</td><td>134M</td><td>86.3/86.2</td><td>92.1/86.1</td><td>82.5/79.3</td></tr><tr><td>+ ShareProjection</td><td>120M</td><td>86.3/86.3</td><td>92.2/86.2</td><td>82.3/79.5</td></tr><tr><td>+ Conv</td><td>122M</td><td>86.3/86.5</td><td>92.5/86.4</td><td>82.5/79.7</td></tr><tr><td>+ 128k Vocab</td><td>190M</td><td>86.7/86.9</td><td>93.1/86.8</td><td>83.0/80.1</td></tr></table>
|
| 415 |
+
|
| 416 |
+
Table 13: Ablation study of the additional modifications in $\mathrm { D e B E R T a } _ { 1 . 5 B }$ and $\mathrm { D e B E R T a _ { 9 0 0 M } }$ models. Note that we progressively add each component on the top of DeBE $\mathrm { R T a } _ { \mathrm { b a s e } }$ .
|
| 417 |
+
|
| 418 |
+
# A.7 MODEL COMPLEXITY
|
| 419 |
+
|
| 420 |
+
With the disentangled attention mechanism, we introduce three additional sets of parameters $W _ { q , r } , W _ { k , r } \in R ^ { d \times d }$ and $P \in R ^ { 2 k \times d }$ . The total increase in model parameters is $2 L \times d ^ { \bar { 2 } } + 2 k \times d$ For the large model $( d = 1 0 2 4 , L = 2 4 , k = 5 1 2 )$ q, this amounts to about $4 9 M$ additional parameters, an increase of $1 3 \%$ . For the base model $( d = 7 6 8 , L = 1 2 , k = 5 1 2 )$ , this amounts to $1 4 M$ additional parameters, an increase of $1 2 \%$ . However, by sharing the projection matrix between content and position embedding, i.e. $W _ { q , r } = W _ { q , c } , W _ { k , r } = W _ { k , c }$ , the number of parameters of DeBERTa is the same as RoBERTa. Our experiment on base model shows that the results are almost the same, as in Table 13.
|
| 421 |
+
|
| 422 |
+
The additional computational complexity is $O ( N k d )$ due to the calculation of the additional positionto-content and content-to-position attention scores. Compared with BERT or RoBERTa, this increases the computational cost by $3 0 \%$ . Compared with XLNet which also uses relative position embedding, the increase of computational cost is about $1 5 \%$ . A further optimization by fusing the attention computation kernel can significantly reduce this additional cost. For $E M D$ , since the decoder in pre-training only reconstructs the masked tokens, it does not introduce additional computational cost for unmasked tokens. In the situation where $1 5 \%$ tokens are masked and we use only two decoder layers, the additional cost is $0 . 1 5 \times 2 / L$ which results in an additional computational cost of only $3 \%$ for base model( $L = 1 2$ ) and $2 \%$ for large model( $L = 2 4$ ) in EMD.
|
| 423 |
+
|
| 424 |
+
# A.8 ADDITIONAL DETAILS OF ENHANCED MASK DECODER
|
| 425 |
+
|
| 426 |
+
The structure of EMD is shown in Figure 2b. There are two inputs for EMD, (i.e., $I , H )$ . $H$ denotes the hidden states from the previous Transformer layer, and $I$ can be any necessary information for decoding, e.g., $H$ , absolute position embedding or output from previous EMD layer. $n$ denotes $n$ stacked layers of EMD where the output of each EMD layer will be the input $I$ for next EMD layer and the output of last EMD layer will be fed to the language model head directly. The $n$ layers can share the same weight. In our experiment we share the same weight for $n = 2$ layers to reduce the number of parameters and use absolute position embedding as $I$ of the first EMD layer. When $I = H$ and $n = 1$ , EMD is the same as the BERT decoder layer. However, EMD is more general and flexible as it can take various types of input information for decoding.
|
| 427 |
+
|
| 428 |
+
# A.9 ATTENTION PATTERNS
|
| 429 |
+
|
| 430 |
+
To visualize how DeBERTa operates differently from RoBERTa, we present in Figure 3 the attention patterns (taken in the last self-attention layers) of RoBERTa, DeBERTa and three DeBERTa variants.
|
| 431 |
+
|
| 432 |
+

|
| 433 |
+
Figure 2: Comparison of the decoding layer.
|
| 434 |
+
|
| 435 |
+

|
| 436 |
+
Figure 3: Comparison of attention patterns of the last layer among DeBERTa, RoBERTa and DeBERTa variants (i.e., DeBERTa without EMD, C2P and P2C respectively).
|
| 437 |
+
|
| 438 |
+
We observe two differences. First, RoBERTa has a clear diagonal line effect for a token attending to itself. But this effect is not very visible in DeBERTa. This can be attributed to the use of EMD, in which the absolute position embedding is added to the hidden state of content as the query vector, as verified by the attention pattern of DeBERTa-EMD where the diagonal line effect is more visible than that of the original DeBERTa. Second, we observe vertical strips in the attention patterns of RoBERTa, which are mainly caused by high-frequent functional words or tokens (e.g., “a”, “the”, and punctuation). For DeBERTa, the strip only appears in the first column, which represents the [CLS] token. We conjecture that a dominant emphasis on [CLS] is desirable since the feature vector of [CLS] is often used as a contextual representation of the entire input sequence in downstream tasks. We also observe that the vertical strip effect is quite obvious in the patterns of the three DeBERTa variants.
|
| 439 |
+
|
| 440 |
+
We present three additional examples to illustrate the different attention patterns of DeBERTa and RoBERTa in Figures 4 and 5.
|
| 441 |
+
|
| 442 |
+

|
| 443 |
+
Figure 4: Comparison on attention patterns of the last layer between DeBERTa and RoBERTa.
|
| 444 |
+
|
| 445 |
+

|
| 446 |
+
Figure 5: Comparison on attention patterns of last layer between DeBERTa and its variants (i.e. DeBERTa without EMD, C2P and P2C respectively).
|
| 447 |
+
|
| 448 |
+
# A.10 ACCOUNT FOR THE VARIANCE IN FINE-TUNING
|
| 449 |
+
|
| 450 |
+
Accounting for the variance of different runs of fine-tuning, in our experiments, we always follow Liu et al. (2019c) to report the results on downstream tasks by averaging over five runs with different random initialization seeds, and perform significance test when comparing results. As the examples shown in Table 14, $\mathrm { D e B E R T a } _ { b a s e }$ significantly outperforms $\mathrm { R o B E R T a } _ { b a s e }$ $\dot { p }$ -value $< 0 . 0 5$ ).
|
| 451 |
+
|
| 452 |
+
Table 14: Comparison of DeBERTa and RoBERTa on MNLI-matched and SQuAD v1.1.
|
| 453 |
+
|
| 454 |
+
<table><tr><td rowspan=1 colspan=1>Model</td><td rowspan=1 colspan=1> MNLI-matched (Min/Max/Avg)</td><td rowspan=1 colspan=1>SQuAD v1.1 (Min/Max/Avg)</td><td rowspan=1 colspan=1>p-value</td></tr><tr><td rowspan=1 colspan=1>RoBERTabase</td><td rowspan=1 colspan=1>84.7/85.0/84.9</td><td rowspan=1 colspan=1>90.8/91.3/91.1</td><td rowspan=1 colspan=1>0.02</td></tr><tr><td rowspan=1 colspan=1>DeBERTabase</td><td rowspan=1 colspan=1>86.1/86.5/86.3</td><td rowspan=1 colspan=1>91.8/92.2/92.1</td><td rowspan=1 colspan=1>0.01</td></tr></table>
|
md/train/ZS394D3djsg/ZS394D3djsg.md
ADDED
|
@@ -0,0 +1,457 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Fitting large mixture models using stochastic component selection
|
| 2 |
+
|
| 3 |
+
Anonymous Author(s)
|
| 4 |
+
Affiliation
|
| 5 |
+
Address
|
| 6 |
+
email
|
| 7 |
+
|
| 8 |
+
# Abstract
|
| 9 |
+
|
| 10 |
+
1 Traditional methods for unsupervised learning of finite mixture models require to
|
| 11 |
+
2 evaluate the likelihood of all components of the mixture. This becomes computa
|
| 12 |
+
3 tionally prohibitive when the number of components is large, as it is, for example,
|
| 13 |
+
4 in the sum-product (transform) networks. As a remedy, we propose an approach
|
| 14 |
+
5 combining the expectation maximization and the Metropolis-Hastings algorithm
|
| 15 |
+
6 to evaluate only a small number of, stochastically sampled, components, thus
|
| 16 |
+
7 substantially reducing the computational cost. We put emphasis on generality of
|
| 17 |
+
8 our method, equipping it with the ability to train both shallow and deep mixture
|
| 18 |
+
9 models which involve complex, and possibly nonlinear, transformations. The
|
| 19 |
+
10 performance of our method is illustrated in a variety of synthetic and real-data
|
| 20 |
+
11 contexts, considering deep models, such as mixtures of normalizing flows and
|
| 21 |
+
12 sum-product (transform) networks.
|
| 22 |
+
|
| 23 |
+
# 13 1 Introduction
|
| 24 |
+
|
| 25 |
+
14 Finite mixture models [40] constitute a fundamental class of density estimation models. They
|
| 26 |
+
15 have been successfully applied in diverse fields, including bioinformatics [49], econometrics [10],
|
| 27 |
+
16 engineering [33], etc. A mixture model relies on a weighted sum of probability distributions—here
|
| 28 |
+
17 referred to as components—to cluster $N$ unlabelled datapoints into $K$ categories. The traditional
|
| 29 |
+
18 maximum likelihood techniques train the model by optimizing either (i) the marginal likelihood via
|
| 30 |
+
19 gradient-descent [50] or (ii) the evidence lower bound via variational methods [4], including the
|
| 31 |
+
20 expectation-maximization (EM) [13]. The dependence structure among approximate, variational,
|
| 32 |
+
21 distributions then ranges from the fully independent (mean-field) [25] to fully dependent [30]. The
|
| 33 |
+
22 sampling-based techniques target the posterior distribution using sequential Monte Carlo [9] or
|
| 34 |
+
23 Markov chain Monte Carlo [52], e.g. via the Gibbs [34] or Metropolis-Hastings sampling [38]. The
|
| 35 |
+
24 computational cost of these methods typically scales with $\mathcal { O } ( T K N D )$ operations, where $N$ and $K$
|
| 36 |
+
25 are defined above, $T$ is the number of iterations and $D$ is the dimension of data.
|
| 37 |
+
26 Various methods to decrease the computational cost via any factor in $\mathcal { O } ( T K N D )$ have been proposed.
|
| 38 |
+
27 $T$ can be lowered by proper initialization, e.g. the optimal seeding [5]; an efficient step-size schedule,
|
| 39 |
+
28 e.g. the line-search [58]; or increased estimation precision, e.g. the variance reduction [8]. $N$ is often
|
| 40 |
+
29 reduced using the coreset methods, which approximate the original dataset by a weighted dataset
|
| 41 |
+
30 such that the exact and approximate marginal likelihoods are close. The weighted variants of the
|
| 42 |
+
31 variational [17, 59, 6] and sampling-based [39] methods then process the coresets. Reducing $D$ relies
|
| 43 |
+
32 on the compression of data into smaller representations via random projections [53, 2], which is
|
| 44 |
+
33 achieved in two ways: (i) each data item is projected into an individual representation [11]; (ii) all
|
| 45 |
+
34 data items are projected into an overall representation, commonly referred to as sketch [28, 22].
|
| 46 |
+
35 Nevertheless, all the aforementioned techniques—including those with reduced computational cost—
|
| 47 |
+
36 evaluate all $K$ components. This is very demanding for large models, and the problem is even more
|
| 48 |
+
37 severe for mixtures involving intricate models, such as neural networks [21, 42], Gaussian processes
|
| 49 |
+
38 [57], normalizing flows [48]; or deep mixtures, including sum-product (transform) networks [45, 47],
|
| 50 |
+
39 deep Gaussian mixture models [55], etc. In spite of this, a little attention has been paid to the design
|
| 51 |
+
40 of algorithms which does not evaluate all $K$ components. The notable exceptions are the sparse EM
|
| 52 |
+
41 algorithm [24] and the truncated variational EM algorithm [18], see Table 1 and Section 5 for details.
|
| 53 |
+
42 Moreover, the methods are mostly tailored for a specific class of mixture models, e.g. the Gaussian
|
| 54 |
+
43 mixture models.
|
| 55 |
+
|
| 56 |
+
Table 1: The computational features of various EM algorithms. We compare whether the methods (i) perform the computations with a reduced number of data (minibatching), (ii) update a lower number of statistics, (iii) make less evaluations of the conditional likelihood, and (iv) are suitable for training of deep models. Here, EM, SA, S, T, MC and MH stand for expectation-maximization, stochastic approximation, sparse, truncated, Monte Carlo and Metropolis-Hastings, respectively.
|
| 57 |
+
|
| 58 |
+
<table><tr><td>Feature/Algorithm</td><td>EM [13]</td><td>SAEM [44]</td><td>SSAEM [24]</td><td>TSAEM [18]</td><td>MCSAEM [1]</td><td>MHSAEM (ours)</td></tr><tr><td>B<Ndatapoints</td><td>×</td><td></td><td></td><td>√</td><td></td><td></td></tr><tr><td>M<K statistics</td><td>xx</td><td></td><td></td><td></td><td>厂</td><td></td></tr><tr><td>M<Klikelihoods</td><td></td><td>xx</td><td>×</td><td></td><td>X</td><td></td></tr><tr><td>deep models</td><td>×</td><td>×</td><td>×</td><td>X</td><td>×</td><td></td></tr></table>
|
| 59 |
+
|
| 60 |
+
44 In this paper, we make the following contributions:
|
| 61 |
+
|
| 62 |
+
45 • We propose an EM-based algorithm which relies on the MH sampler to stochastically evaluate less
|
| 63 |
+
46 components in mixture models, substantially reducing the computational cost.
|
| 64 |
+
7 • We design our method to enable optimization of fairly generic EM objective functions, making it
|
| 65 |
+
48 suitable for training of both shallow and deep mixture models.
|
| 66 |
+
49 • We apply our approach to Gaussian mixture mdoels (GMMs) and their generalizations: sum
|
| 67 |
+
50 product-transform networks (SPTNs) and mixtures of real-valued non-volume preserving (real
|
| 68 |
+
51 NVP) flows [15], reaching approximately $1 0 0 \times$ speed-up compared to state-of-the-art methods.
|
| 69 |
+
|
| 70 |
+
# 52 2 Problem formulation
|
| 71 |
+
|
| 72 |
+
A finite mixture model characterizes the relation between an observed (known) variable, 53 $\boldsymbol { x } \in \times \subseteq \mathbb { R } ^ { D }$ , 54 and a latent (unknown) variable, $z \in Z : = \{ 1 , \dots , K \}$ , via the marginal (incomplete-data) likelihood 55 in the following form:
|
| 73 |
+
|
| 74 |
+
$$
|
| 75 |
+
p _ { \theta } ( x ) = \sum _ { k = 1 } ^ { K } p _ { \eta _ { k } } ( x | z = k ) p _ { \pi _ { k } } ( z = k ) ,
|
| 76 |
+
$$
|
| 77 |
+
|
| 78 |
+
56 where $\theta : = ( \pi _ { 1 } , \eta _ { 1 } , \dots , \pi _ { K } , \eta _ { K } ) \in \Theta$ are unknown parameters. Here, $\eta _ { z }$ are the parameters of the 57 conditional likelihood, $p _ { \eta _ { z } } ( x | z )$ , and $\pi _ { z }$ is the weight which parameterizes the prior, $p _ { \pi _ { z } } ( z ) = \pi _ { z }$ , and satisfies 58 $0 \leq \pi _ { k } \leq 1$ for each $k \in { \mathord { \mathbb { Z } } }$ and $\textstyle \sum _ { k = 1 } ^ { K } \pi _ { k } = 1$ .
|
| 79 |
+
|
| 80 |
+
59 Given a set of independent and identically distributed data, $\mathbf { x } : = ( x _ { i } ) _ { i = 1 } ^ { N }$ , our goal is to learn the
|
| 81 |
+
60 unknown parameters of the marginal log-likelihood,
|
| 82 |
+
|
| 83 |
+
$$
|
| 84 |
+
\mathcal { L } ( \theta ) : = \log p _ { \theta } ( \mathbf { x } ) = \sum _ { i = 1 } ^ { N } \log \sum _ { k = 1 } ^ { K } p _ { \eta _ { k } } ( x _ { i } | z _ { i } = k ) p _ { \pi _ { k } } ( z _ { i } = k ) .
|
| 85 |
+
$$
|
| 86 |
+
|
| 87 |
+
61 The marginalization in (2) is tractable for almost all forms of $p _ { \eta _ { z } } ( x | z )$ . Indeed, we consider $p _ { \eta _ { z } } ( x | z )$
|
| 88 |
+
62 to belong to an arbitrary family of $\eta _ { z }$ -differentiable probability distributions. However, we assume that
|
| 89 |
+
63 $K$ is high, making the marginalization in (2) computationally costly, thus rendering the optimization
|
| 90 |
+
64 objective presumably intractable. Therefore, we want to design a computationally efficient algorithm,
|
| 91 |
+
65 requiring only $M < K$ evaluations of $p _ { \eta _ { z } } ( x | z )$ at each iteration.
|
| 92 |
+
67 The maximum likelihood estimation seeks the parameters maximizing the marginal log-likelihood,
|
| 93 |
+
68 $\theta ^ { M L } : = \arg \operatorname* { m a x } _ { \theta \in \Theta } \mathcal { L } ( \theta )$ . The traditional EM algorithm [13] addresses this task indirectly, i.e. by
|
| 94 |
+
69 optimizing the evidence lower bound (ELBO),
|
| 95 |
+
|
| 96 |
+
$$
|
| 97 |
+
\mathcal { L } ( \theta ) \geq \mathcal { Q } ( \theta ) + \mathcal { H } ( \hat { \theta } ) : = \mathrm { E L B O } ( \hat { \theta } ) ,
|
| 98 |
+
$$
|
| 99 |
+
|
| 100 |
+
where 70 $\mathcal { H } ( \hat { \theta } ) : = - \mathsf E _ { p _ { \hat { \theta } } ( \mathbf { z } | \mathbf { x } ) } [ \log p _ { \hat { \theta } } ( \mathbf { z } | \mathbf { x } ) ]$ is the differential entropy at an estimate, $\hat { \theta } \in \Theta$ , and
|
| 101 |
+
|
| 102 |
+
$$
|
| 103 |
+
\mathcal { Q } ( \theta ) : = \mathsf { E } _ { p _ { \hat { \theta } } ( \mathbf { z } | \mathbf { x } ) } [ \log p _ { \theta } ( \mathbf { z } , \mathbf { x } ) ] = \sum _ { i = 1 } ^ { N } \sum _ { k = 1 } ^ { K } p _ { \theta } ( z _ { i } = k | x _ { i } ) \log p _ { \theta } ( z _ { i } = k , x _ { i } )
|
| 104 |
+
$$
|
| 105 |
+
|
| 106 |
+
71 is the EM objective function. Here, $p _ { \theta } ( \mathbf { z } , \mathbf { x } )$ is the joint (complete-data) likelihood, and $p _ { \theta } ( \mathbf { z } | \mathbf { x } )$ is
|
| 107 |
+
72 the posterior distribution over the latent variables $\dot { \mathbf { z } } : = ( z _ { i } ) _ { i = 1 } ^ { N }$ . Given an initial value, $\theta _ { 0 }$ , the EM
|
| 108 |
+
73 algorithm produces a sequence of estimates, $( \theta _ { t } ) _ { t = 1 } ^ { T }$ , by alternating between the expectation (E) and
|
| 109 |
+
74 maximization (M) steps,
|
| 110 |
+
|
| 111 |
+
$$
|
| 112 |
+
\begin{array} { r l } & { \mathrm { E \mathrm { - } s t e p } ; ~ \mathcal { Q } _ { t - 1 } ( \theta ) , } \\ & { \mathrm { M \mathrm { - } s t e p } ; ~ \theta _ { t } : = \arg \operatorname* { m a x } _ { \theta \in \Theta } \mathcal { Q } _ { t - 1 } ( \theta ) . } \end{array}
|
| 113 |
+
$$
|
| 114 |
+
|
| 115 |
+
75 This sequence is guaranteed to monotonically tighten the ELBO, arriving at a local optimum of (2)
|
| 116 |
+
76 under mild regularity assumptions [56].
|
| 117 |
+
77 The EM algorithm is computationally expensive, since (4) evaluates $p _ { \theta } ( z _ { i } , x _ { i } )$ for each $z _ { i } \in \mathbb { Z }$ and
|
| 118 |
+
78 $i \in ( 1 , \ldots , N )$ . This has to be performed for all $t \in ( 1 , \ldots , T )$ in (5). Albeit the marginal factor,
|
| 119 |
+
79 $p _ { \pi _ { z } } ( z )$ , is just the cheap categorical distribution, the conditional factor, $p _ { \eta _ { z } } ( x | z )$ , typically involves
|
| 120 |
+
80 high-dimensional operations (e.g., the inversion of the full $D \times D$ -dimensional covariance matrices
|
| 121 |
+
81 in the GMMs). Moreover, the M-step (6) is also expensive for large $K$ . This holds despite that (6)
|
| 122 |
+
82 can be reduced to closed-form updates of expected sufficient statistics for $p _ { \eta _ { z } } ( x | z )$ belonging to the
|
| 123 |
+
83 exponential family [44] (again, due to high $D$ ). All in all, the computational complexity of the EM
|
| 124 |
+
84 algorithm scales with $\mathcal { O } ( T D N K )$ .
|
| 125 |
+
|
| 126 |
+
If (6) cannot be computed under a closed-form solution, one can resort to direct gradient-descent optimization of $\mathcal { Q } ( \boldsymbol { \theta } )$ , where arg max is replaced by one (or more) step(s) of a gradient descent technique. The EM algorithm is then referred to as the generalized EM algorithm [56].
|
| 127 |
+
|
| 128 |
+
# 88 4 The generalized MHSAEM algorithm
|
| 129 |
+
|
| 130 |
+
89 We design a version of the generalized EM algorithm suitable for scenarios where (4) can represent
|
| 131 |
+
90 deep, discrete, latent variable models, thus being parameterized by possibly complex nonlinear
|
| 132 |
+
91 transformations. We particularly focus on decreasing the the number of operations in the generalized
|
| 133 |
+
92 EM algorithm from $\mathcal { O } ( T D N K )$ to $\mathcal { O } ( T D B M )$ , where $B \ll N$ and $M \ll K$ .
|
| 134 |
+
|
| 135 |
+
# 4.1 E-step
|
| 136 |
+
|
| 137 |
+
94 We reduce the cost of evaluating the EM objective function (4) by combining the minibatching (as
|
| 138 |
+
95 used many times before) and the Monte Carlo sampling. Namely, the specific application of the latter
|
| 139 |
+
96 to generic mixture models is the key contribution of this paper.
|
| 140 |
+
97 Minibatching. At each iteration, $t$ , we compute the conditional expectation in (4) only for a subset—
|
| 141 |
+
98 here referred to as a minibatch—of the original full dataset, i.e. $( x _ { i } ) _ { i \in I }$ . Here, $I$ is a set of $B \ll N$
|
| 142 |
+
99 indices, $i$ , sampled uniformly without replacement from $( 1 , \ldots , \dot { N } )$ . This substantially decreases the
|
| 143 |
+
100 necessary computations compared to the full sweep over all $N$ datapoints [23].
|
| 144 |
+
101 Monte Carlo sampling. For each $i \in I$ , we want to draw $M \ll K$ random samples from $p _ { \theta } ( z _ { i } | x _ { i } )$ in
|
| 145 |
+
102 order to obtain a Monte Carlo estimate of (4). The straightforward way to do this would be to draw
|
| 146 |
+
103 the samples directly from $p _ { \theta } ( z _ { i } | x _ { i } )$ . However, direct sampling from $p _ { \theta } ( z _ { i } | x _ { i } )$ does not lead to any
|
| 147 |
+
104 substantial decrease in the number of operations. This is caused by the fact that even for a single
|
| 148 |
+
105 sample of $z _ { i }$ , we have to first compute the normalizing factor, $p _ { \theta } ( x _ { i } )$ , to obtaining the posterior,
|
| 149 |
+
106 $p _ { \theta } ( z _ { i } | x _ { i } )$ . This requires $K$ expensive evaluations of $p _ { \theta } ( z _ { i } , x _ { i } )$ , which is precisely what we want to
|
| 150 |
+
107 avoid. Our approach is to resort to the Markov chain Monte Carlo (MCMC), which allows us to
|
| 151 |
+
108 sample from $p _ { \theta } ( z _ { i } | x _ { i } )$ , with the computational complexity decreasing to only a single evaluation of
|
| 152 |
+
109 $p _ { \theta } ( z _ { i } , x _ { i } )$ per a single sample of $z _ { i }$ .
|
| 153 |
+
110 MCMC methods obviate the computation of the normalizing factor in $p _ { \theta } ( z _ { i } | x _ { i } )$ by simulating a
|
| 154 |
+
111 Markov chain, $( z _ { i , t } ) _ { t = 1 } ^ { T }$ , from a transition kernel, $z _ { i , t } \sim P ( z _ { i , t - 1 } , \cdot )$ , which leaves $p _ { \theta } ( z _ { i } | x _ { i } )$ as its
|
| 155 |
+
112 unique stationary (invariant) distribution, starting from an initial value $z _ { i , 0 }$ . The specific form of $P$
|
| 156 |
+
113 determines the structure of an MCMC method. We chose the Metropolis-Hastings (MH) sampler,
|
| 157 |
+
114 which represents $P ( z _ { i , t - 1 } , z _ { i , t } )$ as follows: given $\bar { z } _ { i } : = z _ { i , t - 1 }$ , draw a sample from the proposal
|
| 158 |
+
115 distribution $z _ { i } \sim q ( \cdot | \bar { z } _ { i } )$ , compute the acceptance ratio,
|
| 159 |
+
|
| 160 |
+
$$
|
| 161 |
+
\alpha ( \bar { z } _ { i } , z _ { i } ) : = \operatorname* { m i n } \biggr \{ 1 , \frac { p _ { \eta _ { z _ { i } , t - 1 } } ( x _ { i } | z _ { i } ) \pi _ { z _ { i } , t - 1 } q ( \bar { z } _ { i } | z _ { i } ) } { p _ { \eta _ { \bar { z } _ { i } , t - 1 } } ( x _ { i } | \bar { z } _ { i } ) \pi _ { \bar { z } _ { i } , t - 1 } q ( z _ { i } | \bar { z } _ { i } ) } \biggr \} ,
|
| 162 |
+
$$
|
| 163 |
+
|
| 164 |
+
116 and, if $u < \alpha \big ( \bar { z } _ { i } , z _ { i } \big )$ —where $u$ is drawn from a uniform distribution, Uniform $( 0 , 1 )$ —accept the
|
| 165 |
+
117 sample and set $z _ { i , t } = z _ { i }$ ; otherwise, set $z _ { i , t } = \bar { z } _ { i }$ . For each $i \in I$ and $t \in ( 1 , \ldots , T )$ , we repeat
|
| 166 |
+
118 this process $M$ times, construing a set $\mathbf { z } _ { i , t } = ( z _ { i , t } ^ { 1 } , \dots , z _ { i , t } ^ { M } )$ . Therefore, at every current iteration,
|
| 167 |
+
119 120 $t$ , we caking $\bar { z } _ { i } = z _ { i , t - 1 } ^ { M }$ extend the chain from the point where we left at the previous iteration, . Under mild regularity assumptions [52], the chain passes the transiti $t - 1$ , byriod
|
| 168 |
+
121 (the burn-in phase), and the samples can then be used to approximate the conditional expectation in
|
| 169 |
+
122 (4) as follows:
|
| 170 |
+
|
| 171 |
+
$$
|
| 172 |
+
\widehat { \mathcal { Q } } _ { t - 1 } ( \theta ) = \frac { 1 } { M } \sum _ { i \in I } \sum _ { z \in \mathbf { z } _ { i , t } } \log p _ { \eta _ { z } } ( x _ { i } | z ) \pi _ { z } .
|
| 173 |
+
$$
|
| 174 |
+
|
| 175 |
+
123 Note that, to ensure this approach is truly efficient, we have to draw only $M \ll K$ samples at each
|
| 176 |
+
124 iteration, $t$ ; otherwise, for $M \approx K$ , we may rather compute the exact marginalization in (4), since it
|
| 177 |
+
125 is tractable (but computationally costly).
|
| 178 |
+
|
| 179 |
+
# 4.2 M-step
|
| 180 |
+
|
| 181 |
+
127 Assume for a moment that (6) with $\mathcal { Q } _ { t - 1 } ( \theta )$ given by (8) has a closed-form solution, yielding an
|
| 182 |
+
128 estimate of $\theta$ . Such an estimate would have a high variance, converging only for $M \to \infty$ and
|
| 183 |
+
129 $T \to \infty$ [19]. The main reason is that the samples would not be reused over the iterations, $t$ ,
|
| 184 |
+
130 thus wasting computational resources. We consider that there is no closed-form solution of (6),
|
| 185 |
+
131 and—to ensure that the samples (and thus computations) are recycled over the iterations—we use
|
| 186 |
+
132 the stochastic approximation (SA) [51] to optimize (8). This is analogous to applying a stochastic
|
| 187 |
+
133 gradient-descent method, $\theta _ { t } = \theta _ { t - 1 } + \gamma _ { t } \nabla _ { \theta } \tilde { \mathcal { Q } } _ { t - 1 } ( \theta )$ , where $\gamma _ { t }$ is the step-size, satisfying the Robbins
|
| 188 |
+
134 Monro constraints, $\begin{array} { r } { \gamma _ { t } \in [ 0 , 1 ] , \sum _ { t \geq 1 } \gamma _ { t } = \infty , \sum _ { t \geq 1 } \gamma _ { t } ^ { 2 } < \infty , } \end{array}$ and $\nabla _ { \theta }$ is the gradient w.r.t. $\theta$ . In this
|
| 189 |
+
135 way, the computations made in $\nabla _ { \boldsymbol { \theta } } \widehat { \mathcal { Q } }$ are accumulated via $\theta _ { t }$ and reused over the iterations.
|
| 190 |
+
136 The parameters $\eta _ { z }$ have a different form based on a specific case of $p _ { \eta _ { z } } ( x | z )$ , whereas $\pi _ { z }$ is a
|
| 191 |
+
137 permanent structure in (1). Therefore, without loss of generality, we split (6) into a generic part and a
|
| 192 |
+
138 fixed part as follows:
|
| 193 |
+
|
| 194 |
+
$$
|
| 195 |
+
\begin{array} { r l } & { \eta _ { k , t } = \eta _ { k , t - 1 } + \gamma _ { t } \nabla _ { \eta _ { k } } \widehat { \mathcal { Q } } _ { t - 1 } ( \theta ) , } \\ & { \nu _ { k , t } = \nu _ { k , t - 1 } + \gamma _ { t } \nabla _ { \nu _ { k } } \widehat { \mathcal { Q } } _ { t - 1 } ( \theta ) , } \end{array}
|
| 196 |
+
$$
|
| 197 |
+
|
| 198 |
+
139 where—to ensure that the probabilities, $( \pi _ { k , t } ) _ { k = 1 } ^ { K }$ , satisfy the constraints (Section 2)—we transform
|
| 199 |
+
140 $\nabla _ { \pi _ { k } } \widehat { \mathcal { Q } }$ via $\nu _ { k } = \log \pi _ { k }$ and optimize w.r.t. $\nu _ { k }$ . Then, to obtain $( \pi _ { k , t } ) _ { k = 1 } ^ { K }$ from $\nu _ { t } : = ( \nu _ { k , t } ) _ { k = 1 } ^ { K }$ , we
|
| 200 |
+
141 k b use the softmax function, i.e. $\pi _ { k , t } : = \mathrm { s o f t m a x } ( \pmb { \nu } _ { t } ) _ { k } : = \exp ( \nu _ { k , t } ) / \sum _ { l = 1 } ^ { K } \exp ( \nu _ { l , t } )$ .
|
| 201 |
+
|
| 202 |
+
Computing the gradients for all pairs of $( \nu _ { k } , \eta _ { k } ) _ { k = 1 } ^ { K }$ would be inefficient, especially since ${ \bf z } _ { i , t }$ contains only a small number of unique values of Z for $M \ll K$ . Consequently, we compute $\dot { \nabla } _ { \eta _ { k } } \widehat { \mathcal { Q } }$ and $\nabla _ { \nu _ { k } } \widehat { \mathcal { Q } }$ only for $k \in { \mathrm { u n i q u e } } ( \mathbf { z } _ { i , t } )$ . We summarize the proposed approach in Algorithm 1.
|
| 203 |
+
|
| 204 |
+
# 4.3 Proposal distribution
|
| 205 |
+
|
| 206 |
+
146 The choice of the proposal distribution has a significant impact on the speed of convergence and the computational cost of the proposed algorithm. Here, we discuss various possible choices of 147 $q \big ( z _ { i } | \bar { z } _ { i } \big )$ .
|
| 207 |
+
|
| 208 |
+
Input: $\theta _ { 0 }$ , $( \mathbf { z } _ { i , 0 } ) _ { i = 1 } ^ { N }$ , $( \mathbf { x } _ { i } ) _ { i = 1 } ^ { N }$
|
| 209 |
+
Output: $( \theta _ { t } ) _ { t = 1 } ^ { T }$ for $t \in ( 1 , \ldots , T )$ or until convergence do form the set $\dot { I } = ( i _ { j } ) _ { j = 1 } ^ { B }$ by sampling (without replacement) $B$ indices $i \sim ( 1 , \dots , N )$ for $i \in I$ do set $\bar { z } _ { i }$ as the last element of $\mathbf { z } _ { i , t - 1 }$ for $j \in ( 1 , \ldots , M )$ do sample $z _ { i } \sim q ( z _ { i } | \bar { z } _ { i } )$ sample $u \sim \mathrm { U n i f o r m } ( 0 , 1 )$ compute $\alpha ( \bar { z } _ { i } , z _ { i } )$ in (7) if $u < \alpha \big ( \bar { z } _ { i } , z _ { i } \big )$ then set $z _ { i , t } ^ { j } = z _ { i }$ and $\bar { z } _ { i } = z _ { i }$ else set $z _ { i , t } ^ { j } = \bar { z } _ { i }$ end if end for set $\mathbf { z } _ { i , t } = ( z _ { i , t } ^ { 1 } , \dots , z _ { i , t } ^ { M } )$ end for compute (8) compute (9) for $k \in { \mathrm { u n i q u e } } ( \mathbf { z } _ { i , t } )$ compute $\pi _ { k , t } : = \mathrm { s o f t m a x } ( \pmb { \nu } _ { t } ) _ { k }$ for $k \in { \mathord { \mathbb { Z } } }$ end for
|
| 210 |
+
|
| 211 |
+
148 Optimal proposal $( O )$ . The optimal proposal distribution is $q ( z _ { i } | \bar { z } _ { i } ) : = q ( z _ { i } ) : = p _ { \theta } ( z _ { i } | x _ { i } )$ . This
|
| 212 |
+
149 ensures that the acceptance rate (7) is always $\alpha ( \bar { z } _ { i } , z _ { i } ) = 1$ . However, the need to perform $K$
|
| 213 |
+
150 expensive evaluations of $p _ { \theta } ( z _ { i } , x _ { i } )$ before sampling from $p _ { \theta } ( z _ { i } | x _ { i } )$ is the reason we resorted to
|
| 214 |
+
151 the MH sampler in the first place. We consider this case only to set the upper limit on admissible
|
| 215 |
+
152 computational cost and to study the impact of sub-optimal proposal distribtions.
|
| 216 |
+
153 Uniform proposal $( U )$ . The uniform distribution on the discrete interval from 1 to $K$ , i.e. $q ( z _ { i } | \bar { z } _ { i } ) : =$
|
| 217 |
+
154 $q ( z _ { i } ) : = \mathrm { U n i f o r m } ( 1 , K )$ , is the simplest and computationally cheapest variant of the proposal
|
| 218 |
+
155 distribution. However, due to poor mixing properties, the algorithm may converge slowly for high $K$ .
|
| 219 |
+
156 Tabular proposal with forgetting $( T F )$ . The key requirement to design a proposal distribution is to
|
| 220 |
+
157 restrict its computational complexity somewhere between that of the $\mathrm { U }$ and $\mathrm { o }$ proposals. One way to
|
| 221 |
+
158 satisfy this constraint is to use the Markov chain, $( z _ { i , t } ) _ { t = 1 } ^ { T }$ , to learn a transition kernel, $p ( z _ { i } | \bar { z } _ { i } )$ , see,
|
| 222 |
+
159 e.g. [3]. Unfortunately, this would require us to store a table with $K ^ { 2 }$ entries for each $i \in ( 1 , \ldots , N )$ ,
|
| 223 |
+
160 161 which is very demanding evethe Markov chain and define: $q ( z _ { i } | \bar { z } _ { i } ) : = q _ { \alpha _ { i } } ( z _ { i } ) : = \mathcal { C } ( \alpha _ { i } )$ $K$ $N$ herefore, where $\mathcal { C } ( \pmb { \alpha } _ { i } ) \propto \Pi _ { k = 1 } ^ { K } \alpha _ { k , i } ^ { \bar { 1 ( } z _ { i } = k ) }$ nce inis the
|
| 224 |
+
162 categorical distribution with the weights $\pmb { \alpha } _ { i } : = ( \alpha _ { 1 , i } , \dots , \alpha _ { K , i } )$ . For $\mathcal { L } ( \pmb { \alpha } _ { i } ) : = \Sigma _ { \tau = 1 } ^ { t } \log q _ { \pmb { \alpha } _ { i } } ( z _ { i , \tau } )$
|
| 225 |
+
163 we obtain an estimate of $\alpha _ { i }$ at iteration $t$ as follows: $\begin{array} { r } { \alpha _ { i , t } : = \mathrm { \ a r g m a x } _ { \alpha _ { i } } \mathcal L ( \alpha _ { i } ) \ = \ \frac { n _ { i , t } } { t } } \end{array}$ t , with
|
| 226 |
+
164 $n _ { i , t } = \Sigma _ { \tau = 1 } ^ { t } \mathbf { e } _ { z _ { i , t } }$ , where $\mathbf { e } _ { k }$ is the standard basis vector (a one-hot vector) with one at $k$ th position
|
| 227 |
+
165 and zeros otherwise. This can be further rewritten into a recursive form: $n _ { i , t } = n _ { i , t - 1 } + \mathbf { e } _ { z _ { i , t } }$ or,
|
| 228 |
+
166 using the Robbins-Monro step-size, $n _ { i , t } = ( { \bf 1 } - { \bf e } _ { z _ { i , t } } \gamma _ { t } ) \odot n _ { i , t - 1 } + \gamma _ { t } { \bf e } _ { z _ { i , t } }$ , where 1 is the vector of
|
| 229 |
+
167 ones, and $\odot$ is the Hadamard product. We refer to this case simply as “table with forgetting” (TF)
|
| 230 |
+
168 due to that it represents $N \times K$ table in the memory and $\gamma _ { t }$ is a forgetting factor.
|
| 231 |
+
|
| 232 |
+
# 169 5 Related work
|
| 233 |
+
|
| 234 |
+
Stochastic approximation expectation-maximization. The application of SA to prevent the evaluation
|
| 235 |
+
1 of all $K$ components in mixture models has been overlooked for a long time. The reason is that the
|
| 236 |
+
72 original motivation to combine the EM algorithm with SA is to address the analytical intractability
|
| 237 |
+
73 of the expected value under $p _ { \theta } ( z | x )$ in (4), which is, however, almost always tractable for mixture
|
| 238 |
+
74 models. The intractability issue is addressed by either the Monte Carlo SAEM (MCSAEM) [12]
|
| 239 |
+
75 or the Markov chain Monte Carlo SAEM (MCMCSAEM) [31]. Applying the former approach to
|
| 240 |
+
76 mixture models would be inefficient, since it evaluates $K$ joint distributions, $p _ { \theta } ( z , x )$ , before drawing
|
| 241 |
+
177 $M$ samples from $p _ { \theta } ( z | x )$ . Therefore, this method reduces only the computational cost of updating the
|
| 242 |
+
178 sufficient statistics. This is addressed by the latter approach, where $M < K$ samples from a proposal
|
| 243 |
+
179 distribution, $q ( z | x )$ , is used to calculate $p _ { \theta } ( z , x )$ and also the sufficient statistics. However, all these
|
| 244 |
+
180 methods process all data at every iteration, providing only a limited advantage over the conventional
|
| 245 |
+
181 EM algorithm. Minibatch versions of these techniques have recently been proposed [27, 32, 1].
|
| 246 |
+
182 All the above methods commonly assume $p _ { \theta } ( z , x )$ belonging to the exponential family. This provides
|
| 247 |
+
183 a convenient, but limiting, property which allows (6) to be computed under a closed-form solution.
|
| 248 |
+
184 The main contribution of our work is to release this restrictive assumption by admitting that $p _ { \theta } ( z , x )$
|
| 249 |
+
185 (and thus $\mathcal { Q }$ ) is given by possibly complex and intractable transformations.
|
| 250 |
+
186 Sparse and truncated variational techniques. There is only a small body of methods explicitly
|
| 251 |
+
187 reducing the number of evaluated components. Their common aspect is that they follow from the
|
| 252 |
+
188 variational framework, where the exact posterior, $p _ { \theta } ( z | x )$ , is approximated by a variational posterior,
|
| 253 |
+
189 $q ( z | x )$ . This sparse, approximate, posterior is defined over a lower number of components, $M \ll K$ ,
|
| 254 |
+
190 such that only the important components are selected, relying on relaxation of the hard EM algorithm
|
| 255 |
+
191 from taking a single $M = 1$ assignment [26] to taking multiple $M \ll K$ assignments. The sparse
|
| 256 |
+
192 SAEM (SSAEM) algorithm [24] selects the components by a quick partial sorting of the posterior
|
| 257 |
+
193 probabilities, $p _ { \theta } ( z | x )$ . Again, this requires $K$ evaluations of $p _ { \theta } ( z , x )$ before the sorting, thus only
|
| 258 |
+
194 reducing the amount of updated statistics. Similarly, the truncated SAEM (TSAEM) algorithm [18]
|
| 259 |
+
195 selects $M < K$ cluster-to-cluster and $\bar { M } < K$ cluster-to-datapoint minimal Euclidean distances,
|
| 260 |
+
196 preventing the problem in the SSAEM algorithm. However, all these distances are evaluated for all
|
| 261 |
+
197 components in a pairwise manner, leading to $K ^ { 2 }$ -computational complexity, which makes the saving
|
| 262 |
+
198 dubious. Similarly as before, these methods assume $p _ { \theta } ( z , x )$ to belong to the exponential family.
|
| 263 |
+
|
| 264 |
+

|
| 265 |
+
Figure 1: The training log-likelihood, $\mathcal { L } ( \boldsymbol { \theta } _ { t } )$ , versus the computational time (in seconds). Here, on the $\mathbf { X }$ -axis, the computational time at a current iteration, $t$ , is obtained by accumulating the time from the previous iterations. corresponds to $\mathcal { L } ( \boldsymbol { \theta } _ { t _ { 9 5 } } )$ , where $t _ { 9 5 }$ is the iteration of reaching $9 5 \%$ of max $\mathcal { L } ( \boldsymbol { \theta } _ { t } )$ . The projection of $^ { \circ }$ on the $\mathbf { X }$ -axis gives the time to reach $\mathcal { L } ( \boldsymbol { \theta } _ { t _ { 9 5 } } )$ . This experiment was performed with the following settings: $( D , \bar { K } , N , \omega , B , M , T ) = ( 1 0 , 1 0 0 , 1 0 k , 0 . 1 , \bar { 2 } 0 0 , 2 , 2 0 k )$ , see Section 6.1 for details. The results are averaged over five repetitions.
|
| 266 |
+
|
| 267 |
+
199 We summarize the distinguishing features of the above discussed methods in Table 1.
|
| 268 |
+
|
| 269 |
+
# 6 Experiments
|
| 270 |
+
|
| 271 |
+
To demonstrate the key features of our algorithm—its low computational complexity, competitive learning performance, and generality—we use it below to train: (i) GMMs on synthetic datasets, and (ii) SPTNs [47] and (iii) mixtures of real NVP flows [48] on real datasets. All experiments have been performed on a Slurm cluster equipped with Intel Xeon Scalable Gold 6146 with 384GB of RAM.
|
| 272 |
+
|
| 273 |
+
# 6.1 Gaussian mixture models
|
| 274 |
+
|
| 275 |
+
Consider the special case of a data-generating distribution given by (1), with the components taking the form of the multivariate Gaussian distribution, $p _ { \eta _ { z } } ( x | z ) = \mathcal { N } ( x ; \mu _ { z } , \Sigma _ { z } )$ , where $\mu _ { z }$ is the mean value and $\Sigma _ { z }$ is the covariance matrix. The difficulty of learning GMMs heavily depends on the degree of interaction among all mixture components, hence having the ability to generate synthetic datasets with arbitrary overlap characteristics between all pairs of components is crucial for systematic
|
| 276 |
+
|
| 277 |
+

|
| 278 |
+
Figure 2: The absolute error, $\mathrm { A E } = | \mathcal { L } ( \theta _ { t _ { 9 5 } } ) - \mathcal { L } ( \theta ) |$ , versus the computational time (in seconds). All experiments use the following settings: $( D , K , \dot { N } , \omega , B , M , T ) = \bar { ( } 1 0 , 1 0 0 , 1 0 k , 0 . 1 , 2 0 0 , 2 , 2 0 k )$ , where the number of components, $K$ , (left), the batchsize, $B$ , (middle) and the number of samples, $M$ , (right) change for different values denoted by $( + , \sqsupset , \circ , \pmb { \triangle } )$ . At each of these points (marks), we perform an experiment as illustrated in Figure 1, find $\mathcal { L } ( \boldsymbol { \theta } _ { t _ { 9 5 } } )$ to compute the AE, and record the time corresponding to $t _ { 9 5 }$ . The results are averaged over five repetitions.
|
| 279 |
+
|
| 280 |
+
211 evaluation of performance of learning algorithms [43]. Traditional techniques usually define overlap
|
| 281 |
+
212 (or separation) of components only in terms of their mean vectors and maximum eigenvalues of the
|
| 282 |
+
213 covariance matrices, not accounting for their rotation and mixing weights (see [36] for a detailed
|
| 283 |
+
214 treatment of the problem). We therefore use a more objective measure of the clustering complexity
|
| 284 |
+
215 defined by the total probability of misclassification [41], which allows to generate data with a
|
| 285 |
+
216 user-defined degree of maximum pairwise overlap, $\omega$ .
|
| 286 |
+
217 Experiment settings: We generate the parameters of (1), and the corresponding dataset, uniquely for a
|
| 287 |
+
218 given quadruple $( D , K , N , \omega )$ . Therefore, the parameters of the generative model are known and we
|
| 288 |
+
219 can measure and display the convergence of the training log-likelihood, $\mathcal { L } ( \boldsymbol { \theta } _ { t } )$ , compared to the exact
|
| 289 |
+
220 log-likelihood, $\mathcal { L } ( \boldsymbol { \theta } ) \dot { }$ , for $t = ( 1 , \ldots , T )$ . We are further interested in the absolute error between the
|
| 290 |
+
221 training log-likelihood at the iteration of reaching $9 5 \%$ of its maximum value, $t _ { 9 5 }$ , and the exact
|
| 291 |
+
222 log-likelihood, i.e. $\mathrm { A E } = | \mathcal { L } ( \theta _ { t _ { 9 5 } } ) - \mathcal { L } ( \theta ) |$ .
|
| 292 |
+
23 We also measure the computational time until reaching $t _ { 9 5 }$ . We have used $9 5 \%$ of the maximum
|
| 293 |
+
24 value instead of the maximum value to prevent cases, where the model oscillate around target value,
|
| 294 |
+
25 making the estimate of convergence time very noisy (for example MCSAEM in Figure 1).
|
| 295 |
+
226 Algorithms: The GMMs belong to the exponential family of probability distributions. This allows us
|
| 296 |
+
227 to find a closed-form, recursive, solution of (6), relying on a Robbins-Monro type of the step-size
|
| 297 |
+
228 sequence, $( \gamma _ { t } ) _ { t = 1 } ^ { T }$ , [7, 44]. In this setting, we compare our MHSAEM algorithm with a number of
|
| 298 |
+
229 related methods in Table 1. Note we use the acronyms U and TF to specify the proposal distribution of
|
| 299 |
+
230 the MHSAEM algorithm (Section 4.3). However, we do not use the O-proposal, since the MHSAEM
|
| 300 |
+
231 O algorithm is equivalent to the MCSAEM algorithm. All the SA-variants in Table 1 use a minibatch
|
| 301 |
+
232 of size $B$ . The key quantity to reduce the number of evaluated components and/or sufficient statistics
|
| 302 |
+
233 in the SSAEM, TSAEM, MCSAEM and MHSAEM algorithms is collectively denoted by $M$ (Section
|
| 303 |
+
234 5). Note that we always keep $M = \bar { M }$ in the TSAEM algorithm (see Figure 1 and 2 for concrete
|
| 304 |
+
235 numbers). We use the step-size given by $\gamma _ { t } = 1$ for $t = 1 , \ldots , 5 0$ and $\gamma _ { t } = 0 . 0 5$ otherwise. In
|
| 305 |
+
236 this section, to counteract the issue of attaining poor local optima, we equip all algorithms with the
|
| 306 |
+
237 anti-annealing schedule $( \beta _ { t } ) _ { t = 1 } ^ { T }$ , starting with $\beta _ { 1 } = 0 . 1$ , reaching $\beta _ { 2 / 3 T } = 1 . 2$ , and decreasing back
|
| 307 |
+
238 to $\beta _ { T } = 1 . 0$ , see [43] for details. The initial estimates of: (i) $\mu _ { k }$ are uniformly drawn from the unit
|
| 308 |
+
239 hyper-cube, (ii) $\Sigma _ { k }$ are fixed to unit diagonal matrix, and (iii) $\pi _ { k }$ are uniformly drawn from the unit
|
| 309 |
+
240 interval (followed by normalization).
|
| 310 |
+
241 Results: Figure 1 shows that the EM [13] and SAEM [44] algorithms take the longest time to
|
| 311 |
+
242 converge, attaining a poor local optima. On the other hand, the MCSAEM [1] and MHSAEM (U
|
| 312 |
+
243 and TF) algorithms achieve $\mathcal { L } ( \boldsymbol { \theta } _ { t _ { 9 5 } } )$ closest to the likelihood $\mathcal { L } ( \boldsymbol { \theta } )$ of the true model. Moreover, both
|
| 313 |
+
244 MHSAEM algorithms reach this value in the shortest time compared to all the other methods. The
|
| 314 |
+
245 SSAEM [24] and TSAEM [18] algorithms are comparable in terms of the computational time, but
|
| 315 |
+
246 they both provide the lowest $\mathcal { L } ( \boldsymbol { \theta } _ { t _ { 9 5 } } )$ . In Figure 2, we investigate sensitivity of fitting the model to
|
| 316 |
+
47 increasing values of $K$ , $B$ and $M$ by measuring the time and the likelihood again. In all the cases,
|
| 317 |
+
48 the proposed MHSAEM algorithms achieve the lowest AE in the shortest time.
|
| 318 |
+
|
| 319 |
+
SSAEM and TSAEM algorithms failed to converge for $M > 2$ and for $K > 5 0$ respectively. We believe this is caused by selecting only $M$ maximal probabilities in the SSAEM (or distances in the TSAEM) algorithm (Section 5), which prevents certain, but not a negligible number of, components from being updated, thus providing only a crude approximation of $\bar { p } _ { \theta } \bar { ( } z | x )$ . The results then suffer from substantial variational gap to the exact log-likelihood (Figure 1). On the contrary, MH sampler provides samples which consistently approximate $p _ { \theta } ( z | x )$ despite evaluating much lower number of components in each step.
|
| 320 |
+
|
| 321 |
+
# 6.2 Sum-product transform networks
|
| 322 |
+
|
| 323 |
+
The sum product networks (SPNs) are a deep learning extension of finite mixture models. They can be interpreted as a mixture of trees [60], where each tree corresponds to a component. Therefore, they can be cast into the form of (1), but the number of components grows exponentially with their depth. In this section, we use recently proposed SPTNs which introduce additional transformation nodes to provide better expressiveness than the SPNs (SPTNs effectively generalize SPNs and flow models into one large family of models).
|
| 324 |
+
|
| 325 |
+
Experimental settings: We use 19 real datasets from the UCI database [16, 37, 35, 54], preprocessed in the same way as in [46]. For each experiment, we randomly split the data into $64 \%$ , $16 \%$ and $20 \%$ for training, validation and testing, respectively. We calculate the average log-likelihood on the test set and measure again the time to reach $9 5 \%$ of the maximal training log-likelihood, $\mathcal { L } ( \boldsymbol { \theta } _ { t _ { 9 5 } } )$ .
|
| 326 |
+
|
| 327 |
+
To evaluate various (possibly shallow and/or deep) architectures of SPTNs, we fit each dataset with all the following combinations of hyper-parameters1: $s \in ( 8 , 3 2 , 1 2 8 )$ , $b \in ( 2 , 4 , 6 , 8 )$ , $l \in ( 2 , 3 , 4 )$ , where $s$ is the number of children of each sum node, $b$ is the number of partitions of each product node, and $l$ is the number of layers (one layer contains sum and product nodes). The number of components of the SPTN, after its conversion into (1), is given as follows: $K = s ^ { l }$ . Note that the maximum number of components for the investigated parameters of the SPTN is 268,435,456. To reduce the space of possible architectures, we restrict ourselves only to (i) the leaf nodes given by $\mathcal { N } ( 0 , \bf { I } )$ ; (ii) affine transformations fixed to the singular value decomposition, choosing the the Givens parameterization for the unitary matrices [47]; and (iii) no sharing of any type of nodes [47].
|
| 328 |
+
|
| 329 |
+
276 Algorithms: We evaluate only on the MHSAEM-U algorithm—due to its favourable computational
|
| 330 |
+
277 complexity and simplicity—and compare it with the stochastic gradient-descent (SGD) algorithm,
|
| 331 |
+
278 which is routinely used to train SP(T)Ns [45, 47]. In this case, SGD in each iteration performs
|
| 332 |
+
279 computations over all subtrees of the network, whereas the MHSAEM-U algorithm computes with
|
| 333 |
+
280 only $M = 1$ subtrees, thus we should observe speed-up of the computations. In our implementation,
|
| 334 |
+
281 both these methods perform optimization of their respective objective functions—the log-likelihood
|
| 335 |
+
282 (2) for SGD and the EM objective (8) for MHSAEM-U—via the use of the automatic differentiation
|
| 336 |
+
283 and the ADAM optimizer [29], using $B = 1 0 0$ and $T = 2 0 0 0 0$ .
|
| 337 |
+
|
| 338 |
+
Results: Since each dataset might benefit from a different architecture, Table 6.2 shows the test log-likelihood of the architectures selected according to the best likelihood measured on the validation set and the corresponding speed-up. The test log-likelihoods reveal that the MHSAEM-U algorithm outperforms the SGD algorithm on 10 out of 19 datasets, which was not originally the goal, but the added stochasticity helps to escape poor local minima. The speed-up demonstrates lower computational complexity of the MHSAEM-U algorithm on 17 out of 19 datasets, which was the main goal. The magic-telescope and wine datasets show approximately $1 0 2 \times$ and $7 5 \times$ speed-up, respectively, while on very small datasets (pima-indians and iris), the SGD is faster due to effective implementation. In the supplementary material, we present Table 3, exhibiting the same trends on a fixed architecture.
|
| 339 |
+
|
| 340 |
+
# 6.3 Mixtures of real NVP flows
|
| 341 |
+
|
| 342 |
+
We consider another class of mixture models (1), where each component $p _ { \eta _ { z } } ( x | z )$ is transformed by the flow model—real NVP [15]. These transformations are parameterized via deep neural networks, allowing for flexible adjustment of the learning capacity of each component.
|
| 343 |
+
|
| 344 |
+
Table 2: The speed-up and test log-likelihood, $\mathcal { L } ^ { \mathrm { t e s t } }$ , for the SGD and MHSAEM-U algorithms. The test log-likelihood (higher is better) is computed for the best model, with the corresponding $K$ , which is selected based on the validation log-likelihood. The speed-up is computed as the ratio of MHSAEM-U to SGD, i.e. their time to reach $9 5 \%$ of the training log-likelihood. The results are averaged over five repetitions. Then, the higher test log-likelihood is highlighted with bold blue, and and no speed-up is highlighted with red. The average rank is computed as the standard competition (“1224”) ranking [14] on each dataset (lower is better).
|
| 345 |
+
|
| 346 |
+
<table><tr><td rowspan="3"></td><td colspan="5">Sum-product transformnetworks</td><td colspan="5">Mixtures of real NVP flows SGD</td></tr><tr><td rowspan="2"></td><td colspan="2">SGD</td><td colspan="2">MHSAEM-U</td><td colspan="2"></td><td colspan="2"></td><td colspan="2">MHSAEM-U</td></tr><tr><td>speed-up</td><td>Ltest</td><td>K</td><td>Ltest</td><td>K</td><td>speed-up</td><td>Ltest</td><td>K 32</td><td>Ltest</td><td>K</td></tr><tr><td>breast-cancer-wisconsin</td><td>4.66</td><td>-4.66</td><td>64</td><td>1.43</td><td>1024</td><td>0.63</td><td>-99.85</td><td></td><td>-39.31</td><td></td><td>128</td></tr><tr><td>cardiotocography</td><td>10.55</td><td>59.52</td><td>512</td><td>31.04</td><td>1024</td><td></td><td>9.85</td><td>54.34</td><td>32</td><td>56.08</td><td>128</td></tr><tr><td>magic-telescope</td><td>102.53</td><td>-3.65</td><td>512</td><td>-5.03</td><td>1024</td><td></td><td>3.74</td><td>-3.97</td><td>8</td><td>-4.22</td><td>8</td></tr><tr><td>pendigits</td><td>4.89</td><td>0.88</td><td>1024</td><td>-4.86</td><td>16384</td><td></td><td>4.17</td><td>1.46</td><td>8</td><td>0.48</td><td>8</td></tr><tr><td>pima-indians</td><td>0.37</td><td>-8.54</td><td>64</td><td>-7.62</td><td></td><td>64</td><td>1.35</td><td>-20.09</td><td>128</td><td>-16.33</td><td>128</td></tr><tr><td>wall-following-robot</td><td>3.43</td><td>1.84</td><td>1024</td><td>-11.3</td><td>16384</td><td></td><td>22.21</td><td>-14.26</td><td>128</td><td>-17.56</td><td>128</td></tr><tr><td>waveform-1</td><td>4.35</td><td>-26.14</td><td>64</td><td>-23.91</td><td>1024</td><td></td><td>3.72</td><td>-34.12</td><td>8</td><td>-33.42</td><td>8</td></tr><tr><td>waveform-2</td><td>4.82</td><td>-26.21</td><td>64</td><td>-23.91</td><td></td><td>1024</td><td>4.12</td><td>-34.15</td><td>8</td><td>-33.64</td><td>8</td></tr><tr><td>yeast</td><td>20.57</td><td>10.26</td><td>512</td><td>5.18</td><td>1024</td><td></td><td>14.49</td><td>6.61</td><td>128</td><td>9.59</td><td>128</td></tr><tr><td>ecoli</td><td>1.86</td><td>-5.5</td><td>64</td><td>-0.22</td><td>1024</td><td></td><td>2.15</td><td>-11.37</td><td>128</td><td>-10.64</td><td>128</td></tr><tr><td>ionosphere</td><td>1.88</td><td>-20.27</td><td>64</td><td>-5.93</td><td></td><td>512</td><td>2.74</td><td>-87.01</td><td>128</td><td>-42.75</td><td>128</td></tr><tr><td>iris</td><td>0.23</td><td>-10.65</td><td>64</td><td>-1.49</td><td>16384</td><td></td><td>3.28</td><td>-16.34</td><td>128</td><td>-9.21</td><td>32</td></tr><tr><td>page-blocks</td><td>12.18</td><td>12.21</td><td>512</td><td>6.84</td><td>1024</td><td></td><td>44.95</td><td>17.13</td><td>128</td><td>17.94</td><td>32</td></tr><tr><td>parkinsons</td><td>1.46</td><td>-21.85</td><td>64</td><td>0.5</td><td></td><td>512</td><td>3.09</td><td>-566.58</td><td>128</td><td>-33.31</td><td>32</td></tr><tr><td>sonar</td><td>2.96</td><td>-95.39</td><td>512</td><td>-69.29</td><td></td><td>64</td><td>2.52</td><td>-622.2</td><td>128</td><td>-88.81</td><td>128</td></tr><tr><td>statlog-segment</td><td>1.44</td><td>47.35</td><td>512</td><td>26.53</td><td>16384</td><td></td><td>38.49</td><td>35.84</td><td>128</td><td>42.04</td><td>32</td></tr><tr><td>statlog-vehicle</td><td>2.97</td><td>-4.25</td><td>64</td><td>-5.45</td><td>1024</td><td></td><td>6.78</td><td>-31.34</td><td>32</td><td>-26.43</td><td>128</td></tr><tr><td>wine rank</td><td>75.42</td><td>-25.99</td><td>1024</td><td>-13.27</td><td></td><td>1024</td><td>2.05</td><td>-171.58</td><td>128</td><td>-25.57</td><td>128</td></tr><tr><td></td><td></td><td>1.56</td><td></td><td>1.44</td><td></td><td></td><td></td><td>1.83</td><td></td><td>1.17</td><td></td></tr></table>
|
| 347 |
+
|
| 348 |
+
298 Experimental settings: We use the same experimental settings and evaluation metrics as in Section
|
| 349 |
+
299 6.2. We apply the mixture model on all datasets, changing the number of components as follows:
|
| 350 |
+
300 $K \in ( 8 , 3 2 , 1 2 8 )$ . Each real NVP-based component in the mixture model has (i) the translation
|
| 351 |
+
301 function parameterized via multi-layer perceptron with a single hidden layer of dimension 10, using
|
| 352 |
+
302 the rectified linear activation function; and (ii) the scale function parameterized via the same network
|
| 353 |
+
303 except with the hyperbolic tangent activation function. We do not use the batch normalization [15] and
|
| 354 |
+
304 we stack two layers of the translation-scale transformation (we have used implementation from [20]).
|
| 355 |
+
|
| 356 |
+
Algorithms: The algorithms and their settings are the same as those in Section 6.2.
|
| 357 |
+
|
| 358 |
+
306 Results: The experimental results are presented in right part of Table 6.2. They are similar to those
|
| 359 |
+
307 obtained in the previous section. In terms of the test log-likelihood, the MHSAEM-U algorithm
|
| 360 |
+
308 outperforms the SGD algorithm on all but three datasets, and it provides a substantial speed-up on all
|
| 361 |
+
309 datasets except one. The test likelihood of models with the real NVP flows is most of the time worse
|
| 362 |
+
310 than that of SPTNs with the affine transformations. As explained in the supplementary, this is due to
|
| 363 |
+
311 the overfitting, which has been observed in [47].
|
| 364 |
+
|
| 365 |
+
# 312 7 Conclusion
|
| 366 |
+
|
| 367 |
+
313 This paper has presented a method to decrease computational complexity of fitting mixture models,
|
| 368 |
+
314 including their generalizations, such as sum-product-(transform) networks and mixtures of flow
|
| 369 |
+
315 models. The speed-up is achieved by evaluating and updating only a single component (per iteration),
|
| 370 |
+
316 where the Metropolis-Hasting algorithm ensures sampling of components from a proper posterior. An
|
| 371 |
+
317 experimental comparison on all three classes of models mentioned above confirmed the theoretical
|
| 372 |
+
318 expectations. The method significantly speeds-up the fitting time and, importantly, without sacrificing
|
| 373 |
+
319 the quality of the fit. In fact, the likelihood was better than that of the models fitted by the EM
|
| 374 |
+
320 algorithm or the SGD algorithm in more than $50 \%$ of cases. We attribute this to higher stochasticity,
|
| 375 |
+
321 which helps to escape from poor local minima.
|
| 376 |
+
322 In the experiments, the proposed method has used a uniform proposal distribution in the MH sampler.
|
| 377 |
+
323 Despite outperforming the alternative methods, we conjecture that this limits the speed of convergence.
|
| 378 |
+
324 Therefore, we believe that there is still a room for improvement in the implementation. We plan to
|
| 379 |
+
325 address these issues in future work.
|
| 380 |
+
|
| 381 |
+
The presented method decreases the computational complexity of fitting large (and deep) mixture models, which leads to five to hundred time speed-up depending on a size of the problem (although negative exceptions occurs). We believe this line of research, which we want to continue, to have important benefits. First, it is directly related to decrease in energy consumption and in production of CO2 (we expect similar rates as the speedup). Second, it has a positive effect on financial aspects of deploying (and experimenting with) mixture models. Third, it decreases the hardware requirements, as in all experiments presented above the model was fitted on a single-core.
|
| 382 |
+
|
| 383 |
+
# References
|
| 384 |
+
|
| 385 |
+
[1] S. Allassonnière and J. Chevallier. A new class of stochastic EM algorithms: Escaping local maxima and handling intractable sampling. Computational Statistics & Data Analysis, 159:107159, 2021.
|
| 386 |
+
[2] S. Ayesha, M. K. Hanif, and R. Talib. Overview and comparative study of dimensionality reduction techniques for high dimensional data. Information Fusion, 59:44–58, 2020.
|
| 387 |
+
[3] D. S. Bai. Efficient estimation of transition probabilities in a Markov chain. The Annals of Statistics, pages 1305–1317, 1975.
|
| 388 |
+
[4] D. M. Blei, A. Kucukelbir, and J. D. McAuliffe. Variational inference: A review for statisticians. Journal of the American statistical Association, 112(518):859–877, 2017.
|
| 389 |
+
[5] J. Blömer and K. Bujna. Adaptive seeding for Gaussian mixture models. In Pacific-asia conference on knowledge discovery and data mining, pages 296–308. Springer, 2016.
|
| 390 |
+
[6] T. Campbell and B. Beronov. Sparse variational inference: Bayesian coresets from scratch. arXiv preprint arXiv:1906.03329, 2019.
|
| 391 |
+
[7] O. Cappé and E. Moulines. On-line expectation–maximization algorithm for latent data models. Journal of the Royal Statistical Society: Series B (Statistical Methodology), 71(3):593–613, 2009.
|
| 392 |
+
[8] J. Chen, J. Zhu, Y. Teh, and T. Zhang. Stochastic expectation maximization with variance reduction. Advances in Neural Information Processing Systems, page 7967, 2018.
|
| 393 |
+
[9] N. Chopin. A sequential particle filter method for static models. Biometrika, 89(3):539–552, 2002.
|
| 394 |
+
[10] G. Compiani and Y. Kitamura. Using mixtures in econometric models: A brief review and some new results. The Econometrics Journal, 19(3):C95–C127, 2016.
|
| 395 |
+
[11] S. Dasgupta. Learning mixtures of Gaussians. In 40th Annual Symposium on Foundations of Computer Science (Cat. No. 99CB37039), pages 634–644. IEEE, 1999.
|
| 396 |
+
[12] B. Delyon, M. Lavielle, E. Moulines, et al. Convergence of a stochastic approximation version of the EM algorithm. The Annals of Statistics, 27(1):94–128, 1999.
|
| 397 |
+
[13] A. P. Dempster, N. M. Laird, and D. B. Rubin. Maximum likelihood from incomplete data via the EM algorithm. Journal of the Royal Statistical Society: Series B (Methodological), 39(1):1–22, 1977.
|
| 398 |
+
[14] J. Demšar. Statistical comparisons of classifiers over multiple data sets. The Journal of Machine Learning Research, 7:1–30, 2006.
|
| 399 |
+
[15] L. Dinh, J. Sohl-Dickstein, and S. Bengio. Density estimation using real NVP. In 5th International Conference on Learning Representations, ICLR 2017, 2017.
|
| 400 |
+
[16] D. Dua and C. Graff. UCI machine learning repository, 2017.
|
| 401 |
+
|
| 402 |
+
[17] D. Feldman, M. Faulkner, and A. Krause. Scalable training of mixture models via coresets. In Proceedings of the 24th International Conference on Neural Information Processing Systems, pages 2142–2150, 2011. 372 [18] D. Forster and J. Lücke. Can clustering scale sublinearly with its clusters? A variational EM acceleration of GMMs and k-means. In International Conference on Artificial Intelligence and Statistics, pages 124–132. PMLR, 2018. [19] G. Fort, E. Moulines, et al. Convergence of the Monte Carlo expectation maximization for curved exponential families. Annals of Statistics, 31(4):1220–1259, 2003. [20] J. Franc˚u. Continuousflows.jl. https://github.com/janfrancu/ContinuousFlows.jl, 2020. [21] K. Greff, S. van Steenkiste, and J. Schmidhuber. Neural expectation maximization. In Proceedings of the 31st International Conference on Neural Information Processing Systems, pages 6694–6704, 2017. [22] R. Gribonval, A. Chatalic, N. Keriven, V. Schellekens, L. Jacques, and P. Schniter. Sketching datasets for large-scale learning (long version). arXiv preprint arXiv:2008.01839, 2020. [23] M. D. Hoffman, D. M. Blei, C. Wang, and J. Paisley. Stochastic variational inference. Journal of Machine Learning Research, 14(5), 2013. [24] M. C. Hughes and E. B. Sudderth. Fast learning of clusters and topics via sparse posteriors. arXiv preprint arXiv:1609.07521, 2016. [25] K. Humphreys and D. Titterington. Approximate Bayesian inference for simple mixtures. In COMPSTAT, pages 331–336. Springer, 2000. [26] B.-H. Juang and L. R. Rabiner. The segmental K-means algorithm for estimating parameters of hidden Markov models. IEEE Transactions on acoustics, speech, and signal Processing, 38(9):1639–1641, 1990. [27] B. Karimi, M. Lavielle, and É. Moulines. On the convergence properties of the mini-batch EM and MCEM algorithms, 2019. [28] N. Keriven, A. Bourrier, R. Gribonval, and P. Pérez. Sketching for large-scale learning of mixture models. Information and Inference: A Journal of the IMA, 7(3):447–508, 2018. [29] D. P. Kingma and J. Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014. [30] A. Kucukelbir, D. Tran, R. Ranganath, A. Gelman, and D. M. Blei. Automatic differentiation variational inference. The Journal of Machine Learning Research, 18(1):430–474, 2017. [31] E. Kuhn and M. Lavielle. Coupling a stochastic approximation version of EM with an MCMC procedure. ESAIM: Probability and Statistics, 8:115–131, 2004. [32] E. Kuhn, C. Matias, and T. Rebafka. Properties of the stochastic approximation EM algorithm with mini-batch sampling. Statistics and Computing, 30(6):1725–1739, 2020. [33] A. Lagrange, M. Fauvel, and M. Grizonnet. Large-scale feature selection with Gaussian mixture models for the classification of high dimensional remote sensing images. IEEE Transactions on Computational Imaging, 3(2):230–242, 2017. [34] M. Lavine and M. West. A Bayesian method for classification and discrimination. Canadian Journal of Statistics, 20(4):451–461, 1992. [35] M. Little, P. McSharry, S. Roberts, D. Costello, and I. Moroz. Exploiting nonlinear recurrence and fractal scaling properties for voice disorder detection. Nature Precedings, pages 1–1, 2007. [36] R. Maitra and V. Melnykov. Simulating data to study performance of finite mixture modeling and clustering algorithms. Journal of Computational and Graphical Statistics, 19(2):354–376, 2010.
|
| 403 |
+
|
| 404 |
+
15 [37] O. L. Mangasarian and W. H. Wolberg. Cancer diagnosis via linear programming. Technical report, University of Wisconsin-Madison Department of Computer Sciences, 1990.
|
| 405 |
+
17 [38] J.-M. Marin, K. Mengersen, and C. P. Robert. Bayesian modelling and inference on mixtures of distributions. Handbook of statistics, 25:459–507, 2005.
|
| 406 |
+
19 [39] C. A. McGrory, D. C. Ahfock, J. A. Horsley, and C. L. Alston. Weighted Gibbs sampling for mixture modelling of massive datasets via coresets. Stat, 3(1):291–299, 2014. [40] G. J. McLachlan, S. X. Lee, and S. I. Rathnayake. Finite mixture models. Annual review of statistics and its application, 6:355–378, 2019.
|
| 407 |
+
423 [41] V. Melnykov, W.-C. Chen, and R. Maitra. MixSim: An R package for simulating data to study performance of clustering algorithms. Journal of Statistical Software, 51(12):1, 2012.
|
| 408 |
+
25 [42] T. Monnier, T. Groueix, and M. Aubry. Deep transformation-invariant clustering. In Conference on Neural Information Processing Systems (NeurIPS 2020), 2020. [43] I. Naim and D. Gildea. Convergence of the EM algorithm for Gaussian mixtures with unbalanced mixing coefficients. In Proceedings of the 29th International Coference on International Conference on Machine Learning, pages 1427–1431, 2012. [44] H. D. Nguyen, F. Forbes, and G. J. McLachlan. Mini-batch learning of exponential family finite mixture models. Statistics and Computing, pages 1–18, 2020. [45] R. Peharz, A. Vergari, K. Stelzner, A. Molina, X. Shao, M. Trapp, K. Kersting, and Z. Ghahramani. Random sum-product networks: A simple and effective approach to probabilistic deep learning. In Uncertainty in Artificial Intelligence, pages 334–344. PMLR, 2020. [46] T. Pevný. Loda: Lightweight on-line detector of anomalies. Machine Learning, 102(2):275–304, 2016. [47] T. Pevný, V. Šmídl, M. Trapp, O. Polácek, and T. Oberhuber. Sum-product-transform networks: ˇ Exploiting symmetries using invertible transformations. arXiv preprint arXiv:2005.01297, 2020. [48] G. G. Pires and M. A. Figueiredo. Variational mixture of normalizing flows. arXiv preprint arXiv:2009.00585, 2020.
|
| 409 |
+
42 [49] A. Rau, C. Maugis-Rabusseau, M.-L. Martin-Magniette, and G. Celeux. Co-expression analysis of high-throughput transcriptome sequencing data with Poisson mixture models. Bioinformatics, 31(9):1420–1427, 2015.
|
| 410 |
+
45 [50] R. A. Redner and H. F. Walker. Mixture densities, maximum likelihood and the EM algorithm. SIAM review, 26(2):195–239, 1984.
|
| 411 |
+
47 [51] H. Robbins and S. Monro. A stochastic approximation method. The annals of mathematical statistics, pages 400–407, 1951.
|
| 412 |
+
49 [52] C. Robert and G. Casella. Monte Carlo statistical methods. Springer Science & Business Media, 2013. [53] W. Siblini, P. Kuntz, and F. Meyer. A review on dimensionality reduction for multi-label classification. IEEE Transactions on Knowledge and Data Engineering, 2019.
|
| 413 |
+
53 [54] J. P. Siebert. Vehicle recognition using rule based methods. 1987. [55] C. Viroli and G. J. McLachlan. Deep gaussian mixture models. Statistics and Computing, 29(1):43–51, 2019.
|
| 414 |
+
56 [56] C. F. J. Wu. On the convergence properties of the EM algorithm. The Annals of statistics, pages 95–103, 1983.
|
| 415 |
+
58 [57] D. Wu and J. Ma. An effective EM algorithm for mixtures of Gaussian processes via the MCMC sampling and approximation. Neurocomputing, 331:366–374, 2019.
|
| 416 |
+
|
| 417 |
+
60 [58] W. Xiang, A. Karfoul, C. Yang, H. Shu, and R. L. B. Jeannès. An exact line search scheme to
|
| 418 |
+
61 accelerate the EM algorithm: Application to Gaussian mixture models identification. Journal of
|
| 419 |
+
62 computational science, 41:101073, 2020.
|
| 420 |
+
63 [59] M. Zhang, Y. Fu, K. M. Bennett, and T. Wu. Computational efficient variational Bayesian Gaus
|
| 421 |
+
64 sian mixture models via coreset. In 2016 International Conference on Computer, Information
|
| 422 |
+
65 and Telecommunication Systems (CITS), pages 1–5. IEEE, 2016.
|
| 423 |
+
66 [60] H. Zhao, P. Poupart, and G. Gordon. A unified approach for learning the parameters of sum
|
| 424 |
+
67 product networks. In Proceedings of the 30th International Conference on Neural Information
|
| 425 |
+
68 Processing Systems, pages 433–441, 2016.
|
| 426 |
+
|
| 427 |
+
1. For all authors...
|
| 428 |
+
|
| 429 |
+
(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
|
| 430 |
+
(b) Did you describe the limitations of your work? [Yes] Our main contribution is computational speedup. Cases where it was not achieved are highlighted in the experimental section.
|
| 431 |
+
(c) Did you discuss any potential negative societal impacts of your work? [No] We do not foresee any potential negative impact.
|
| 432 |
+
(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
|
| 433 |
+
|
| 434 |
+
2. If you are including theoretical results...
|
| 435 |
+
|
| 436 |
+
(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]
|
| 437 |
+
|
| 438 |
+
3. If you ran experiments...
|
| 439 |
+
|
| 440 |
+
(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] The code is available in a github repository. All dataset are public from the UCI database.
|
| 441 |
+
(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] See Section 6.
|
| 442 |
+
(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [No] We report only average of Monte Carlo repetitions, the error bars were too small to have any visual impact in the reported logarithmic scale.
|
| 443 |
+
(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]
|
| 444 |
+
|
| 445 |
+
4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
|
| 446 |
+
|
| 447 |
+
(a) If your work uses existing assets, did you cite the creators? [Yes] We use 20 datasets from UCI, we cite the required papers for each dataset, mostly the UCI database and few additional publications.
|
| 448 |
+
(b) Did you mention the license of the assets? [No] The data are publically available, we comply with the requirement on citing appropriate publications.
|
| 449 |
+
(c) Did you include any new assets either in the supplemental material or as a URL? [No]
|
| 450 |
+
(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A]
|
| 451 |
+
(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A]
|
| 452 |
+
|
| 453 |
+
5. If you used crowdsourcing or conducted research with human subjects...
|
| 454 |
+
|
| 455 |
+
(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
|
| 456 |
+
(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
|
| 457 |
+
(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
|
md/train/cKnKJcTPRcV/cKnKJcTPRcV.md
ADDED
|
@@ -0,0 +1,346 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# HYPERSAGE: GENERALIZING INDUCTIVE REPRESENTATION LEARNING ON HYPERGRAPHS
|
| 2 |
+
|
| 3 |
+
Anonymous authors Paper under double-blind review
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
Graphs are the most ubiquitous form of structured data representation used in machine learning. They model, however, only pairwise relations between nodes and are not designed for encoding the higher-order relations found in many real-world datasets. To model such complex relations, hypergraphs have proven to be a natural representation. Learning the node representations in a hypergraph is more complex than in a graph as it involves information propagation at two levels: within every hyperedge and across the hyperedges. Most current approaches first transform a hypergraph structure to a graph for use in existing geometric deep learning algorithms. This transformation leads to information loss, and sub-optimal exploitation of the hypergraph’s expressive power. We present HyperSAGE, a novel hypergraph learning framework that uses a two-level neural message passing strategy to accurately and efficiently propagate information through hypergraphs. The flexible design of HyperSAGE facilitates different ways of aggregating neighborhood information. Unlike the majority of related work which is transductive, our approach, inspired by the popular GraphSAGE method, is inductive. Thus, it can also be used on previously unseen nodes, facilitating deployment in problems such as evolving or partially observed hypergraphs. Through extensive experimentation, we show that HyperSAGE outperforms state-of-the-art hypergraph learning methods on representative benchmark datasets. We also demonstrate that the higher expressive power of HyperSAGE makes it more stable in learning node representations as compared to the alternatives.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
Graphs are considered the most prevalent structures for discovering useful information within a network, especially because of their capability to combine object-level information with the underlying inter-object relations (Wu et al., 2020). However, most structures encountered in practical applications form groups and relations that cannot be properly represented using pairwise connections alone, hence a graph may fail to capture the collective flow of information across objects. In addition, the underlying data structure might be evolving and only partially observed. Such dynamic higher-order relations occur in various domains, such as social networks (Tan et al., 2011), computational chemistry (Gu et al., 2020), neuroscience (Gu et al., 2017) and visual arts (Arya et al., 2019), among others. These relations can be readily represented with hypergraphs, where an edge can connect an arbitrary number of vertices as opposed to just two vertices in graphs. Hypergraphs thus provide a more flexible and natural framework to represent such multi-way relations (Wolf et al., 2016), however, this requires a representation learning technique that exploits the full expressive power of hypergraphs and can generalize on unseen nodes from a partially observed hypergraph.
|
| 12 |
+
|
| 13 |
+
Recent work in the field of geometric deep learning have presented formulations on graph structured data for the tasks of node classification (Kipf & Welling, 2016), link prediction (Zhang & Chen, 2018), or the classification of graphs (Zhang et al., 2018b). Subsequently, for data containing higher-order relations, a few recent papers have presented hypergraph-based learning approaches on similar tasks (Yadati et al., 2019; Feng et al., 2019). A common implicit premise in these papers is that a hypergraph can be viewed as a specific type of regular graph. Therefore, reduction of hypergraph learning problem to that of a graph should suffice. Strategies to reduce a hypergraph to a graph include transforming the hyperedges into multiple edges using clique expansion (Feng et al., 2019; Jiang et al., 2019; Zhang et al., 2018a), converting to a heterogeneous graph using star expansion (Agarwal et al., 2006), and replacing every hyperedge with an edge created using a certain predefined metric (Yadati et al., 2019). Yet these methods are based on the wrong premise, motivated chiefly by a larger availability of graph-based approaches. By reducing a hypergraph to regular graph, these approaches make existing graph learning algorithms applicable to hypergraphs. However, hypergraphs are not a special case of regular graphs. The opposite is true, regular graphs are simply a specific type of hypergraph (Berge & Minieka, 1976). Therefore, reducing the hypergraph problem to that of a graph cannot fully utilize the information available in hypergraph. Two schematic examples outlining this issue are shown in Fig.1. To address tasks based on complex structured data, a hypergraph-based formulation is needed that complies with the properties of a hypergraph.
|
| 14 |
+
|
| 15 |
+

|
| 16 |
+
Figure 1: (a) Example showing reduction of a hypergraph to a graph using clique and star expansion methods. The clique expansion loses the unique information associated with the hyperedge defined by the set of nodes $\{ v _ { 2 } , v _ { 3 } \}$ , and it cannot distinguish it from the hyperedge defined by the nodes $\{ \dot { v } _ { 1 } , v _ { 2 } , v _ { 3 } \}$ . Star expansion creates a heterogeneous graph that is difficult to handle using most well-studied graph methods (Hein et al., 2013). (b) Schematic representations of two Fano planes comprising 7 nodes and 7 hyperedges (6 straight lines and 1 circle.). The second Fano plane is a copy of the first with nodes $v _ { 2 }$ and $v _ { 3 }$ permuted. These two hypergraphs cannot be differentiated when transformed to a graph using clique expansion.
|
| 17 |
+
|
| 18 |
+
A major limitation of the existing hypergraph learning frameworks is their inherently transductive nature. This implies that these methods can only predict characteristics of nodes that were present in the hypergraph at training time, and fail to infer on previously unseen nodes. The transductive nature of existing hypegraph approaches makes them inapplicable in, for example, finding the most promising target audience for a marketing campaign or making movie recommendations with new movies appearing all the time. An inductive solution would pave the way to solve such problems using hypergraphs. The inductive learning framework must be able to identify both the node’s local role in the hypergraph, as well as its global position (Hamilton et al., 2017). This is important for generalizing the learned node embeddings that the algorithm has optimized on to a newly observed hypergraph comprising previously unseen nodes, thus, making inductive learning a far more complex problem compared to the transductive learning methods.
|
| 19 |
+
|
| 20 |
+
In this paper, we address the above mentioned limitations of the existing hypergraph learning methods. We propose a simple yet effective inductive learning framework for hypergraphs that is readily applicable to graphs as well. Our approach relies on neural message passing techniques due to which it can be used on hypergraphs of any degree of cardinality without the need for reduction to graphs. The points below highlight the contributions of this paper:
|
| 21 |
+
|
| 22 |
+
• We address the challenging problem of representation learning on hypergraphs by proposing HyperSAGE, comprising a message passing scheme which is capable of jointly capturing the intra-relations (within a hyperedge) as well as inter-relations (across hyperedges). • The proposed hypergraph learning framework is inductive, i.e. it can perform predictions on previously unseen nodes, and can thus be used to model evolving hypergraphs. • HyperSAGE facilitates neighborhood sampling and provides the flexibility in choosing different ways to aggregate information from the neighborhood. • HyperSAGE is more stable than state-of-the-art methods, thus provides more accurate results on node classification tasks on hypergraphs with reduced variance in the output.
|
| 23 |
+
|
| 24 |
+
# 2 RELATED WORK
|
| 25 |
+
|
| 26 |
+
Learning node representations using graph neural networks has been a popular research topic in the field of geometric deep learning (Bronstein et al., 2017). Graph neural networks can be broadly classified into spatial (message passing) and spectral networks. We focus on a family of spatial message passing graph neural networks that take a graph with some labeled nodes as input and learn embeddings for each node by aggregating information from its neighbors (Xu et al., 2019). Message passing operations in a graph simply propagate information along the edge connecting two nodes. Many variants of such message passing neural networks have been proposed, with some popular ones including Gori et al. (2005); Li et al. (2015); Kipf & Welling (2016); Gilmer et al. (2017); Hamilton et al. (2017).
|
| 27 |
+
|
| 28 |
+
Zhou et al. (2007) introduced learning on hypergraphs to model high-order relations for semisupervised classification and clustering of nodes. Emulating a graph-based message passing framework for hypergraphs is not straightforward since a hyperedge involves more than two nodes which makes the interactions inside each hyperedge more complex. Representing a hypergraph with a matrix makes it rigid in describing the structures of higher order relations (Li et al., 2013). On the other hand, formulating message passing on a higher dimensional representation of hypergraph using tensors makes it computationally expensive and restricts it to only small datasets (Zhang et al., 2019). Several tensor based methods do perform learning on hypergraphs (Shashua et al., 2006; Arya et al., 2019), however they are limited to uniform hypergraphs only.
|
| 29 |
+
|
| 30 |
+
To resolve the above issues, Feng et al. (2019) and Bai et al. (2020) reduce a hypergraph to graph using clique expansion and perform graph convolutions on them. These approaches cannot utilize complete structural information in the hypergraph and lead to unreliable learning performance for e.g. classification, clustering and active learning (Li & Milenkovic, 2017; Chien et al., 2019). Another approach by Yadati et al. (2019), named HyperGCN, replaces a hyperedge with pair-wise weighted edges between vertices (called mediators). With the use of mediators, HyperGCN can be interpreted as an improved approach of clique expansion, and to the best of our knowledge, is also the state-of-the-art method for hypergraph representation learning. However, for many cases such as Fano plane where each hyperedge contains at most three nodes, HyperGCN becomes equivalent to the clique expansion (Dong et al., 2020). In spectral theory of hypergraphs, methods have been proposed that fully exploit the hypergraph structure using non-linear Laplacian operators (Chan et al., 2018; Hein et al., 2013). In this work, we focus on message passing frameworks. Drawing inspiration from GraphSAGE (Hamilton et al., 2017), we propose to eliminate matrix (or tensor) based formulations in our neural message passing frameworks, which not only facilitates utilization of all the available information in a hypergraph, but also makes the entire framework inductive in nature.
|
| 31 |
+
|
| 32 |
+
# 3 PROPOSED MODEL: HYPERSAGE
|
| 33 |
+
|
| 34 |
+
The core concept behind our approach is to aggregate feature information from the neighborhood of a node spanning across multiple hyperedges, where the edges can have varying cardinality. Below, we first define some preliminary terms, and then describe our generic aggregation framework. This framework performs message passing at two-levels for a hypergraph. Further, for any graphstructured data, our framework emulates the one-level aggregation similar to GraphSAGE (Hamilton et al., 2017). Our approach inherently allows inductive learning, which makes it also applicable on hypergraphs with unseen nodes.
|
| 35 |
+
|
| 36 |
+
# 3.1 PRELIMINARIES
|
| 37 |
+
|
| 38 |
+
Definition 1 (Hypergraph). A general hypergraph $\mathcal { H }$ can be represented as $\mathcal { H } = ( \boldsymbol { \vartheta } , \boldsymbol { \mathcal { E } } , \mathbf { X } )$ , where $\nabla = \{ v _ { 1 } , v _ { 2 } , . . . , \bar { v } _ { N } \}$ denotes a set of $N$ nodes (vertices) and $\mathfrak { E } = \{ \mathbf { e } _ { 1 } , \mathbf { e } _ { 2 } , . . . , \mathbf { e } _ { K } \}$ denotes a set of hyperedges, with each hyperedge comprising a non-empty subset from $\mathcal { V }$ . $\mathbf { X } \in \mathbb { R } ^ { N \times d }$ denote the feature matrix, such that $\mathbf { x } _ { i } \in \mathbf { X }$ is the feature vector characterizing node $v _ { i } \in \mathcal V$ . The maximum cardinality of the hyperedges in $\mathcal { H }$ is denoted as $M = { \underset { \mathbf { e } \in \mathbb { E } } { \operatorname* { m a x } } } | \mathbf { e } |$ .
|
| 39 |
+
|
| 40 |
+
Unlike in a graph, the hyperedges of $\mathcal { H }$ can contain different number of nodes and $M$ denotes the largest number. From the definition above, we see that graphs are a special case of hypergraphs with
|
| 41 |
+
|
| 42 |
+
$M { = } 2$ . Thus, compared to graphs, hypergraphs are designed to model higher-order relations between nodes. Further, we define three types of neighborhoods in a hypergraph:
|
| 43 |
+
|
| 44 |
+
Definition 2 (Intra-edge neighborhood). The intra-edge neighborhood of a node $v _ { i } \in \mathcal V$ for any hyperedge $\mathbf { e } \in \mathcal { E }$ is defined as the set of nodes $v _ { j }$ belonging to e and is denoted by $\mathcal { N } ( v _ { i } , \mathbf { e } )$
|
| 45 |
+
|
| 46 |
+
Further, let $E ( v _ { i } ) = \{ \mathbf { e } \in \mathcal { E } \mid v _ { i } \in \mathbf { e } \}$ be the sets of hyperedges that contain node $v _ { i }$ .
|
| 47 |
+
|
| 48 |
+
Definition 3 (Inter-edge neighborhood). The inter-edge neighborhood of a node $\boldsymbol { v } _ { i } \in \mathcal { V }$ also referred as its global neighborhood, is defined as the neighborhood of $v _ { i }$ spanning across the set of hyperedges $E ( v _ { i } )$ and is represented by $\begin{array} { r } { \mathcal { N } ( v _ { i } ) = \bigcup _ { \mathbf { e } \in E ( v _ { i } ) } \mathcal { N } ( v _ { i } , \mathbf { e } ) } \end{array}$ .
|
| 49 |
+
|
| 50 |
+
Definition 4 (Condensed neighborhood). The condensed neighborhood of any node $\boldsymbol { v } _ { i } ~ \in ~ \mathcal { V }$ is $a$ sampled set of $\alpha \leq | \mathbf { e } |$ nodes from a hyperedge $\mathbf { e } \in E ( v _ { i } )$ denoted by $N ( v _ { i } , \mathbf { e } ; \alpha ) \subset \mathbb { N } ( v _ { i } , \mathbf { e } )$ .
|
| 51 |
+
|
| 52 |
+
# 3.2 GENERALIZED MESSAGE PASSING FRAMEWORK
|
| 53 |
+
|
| 54 |
+
We propose to interpret the propagation of information in a given hypergraph as a two-level aggregation problem, where the neighborhood of any node is divided into intra-edge neighbors and inter-edge neighbors. For message aggregation, we define aggregation function $\mathcal { F } ( \cdot )$ as a permutation invariant set function on a hypergraph $\mathcal { H } = ( \mathcal { V } , \mathcal { E } , \mathbf { X } )$ that takes as input a countable unordered message set and outputs a reduced or aggregated message. Further, for two-level aggregation, let $\mathcal { F } _ { 1 } ( \cdot )$ and $\mathcal { F } _ { 2 } ( \cdot )$ denote the intra-edge and inter-edge aggregation functions, respectively. Schematic representation of the two aggregation functions is provided in Fig.2. Similar to $\mathbf { X }$ we also define $\mathbf { Z }$ as the encoded feature matrix built using the outputs $\mathbf { z } _ { i }$ of aggregation functions. Message passing at node $v _ { i }$ for aggregation of information at the $l ^ { \mathrm { { \bar { t h } } } }$ layer can then be stated as
|
| 55 |
+
|
| 56 |
+
$$
|
| 57 |
+
\begin{array} { r l } & { \mathbf { x } _ { i , l } ^ { ( \mathbf { e } ) } \mathcal { F } _ { 1 } ( \{ \mathbf { x } _ { j , l - 1 } \mid v _ { j } \in \mathsf { N } ( v _ { i } , \mathbf { e } ; \alpha ) \} ) , } \\ & { \mathbf { x } _ { i , l } \mathbf { x } _ { i , l - 1 } + \mathcal { F } _ { 2 } ( \{ \mathbf { x } _ { i , l } ^ { ( \mathbf { e } ) } \mid v _ { i } \in E ( v _ { i } ) \} ) , } \end{array}
|
| 58 |
+
$$
|
| 59 |
+
|
| 60 |
+
where, $\mathbf { x } _ { i , l } ^ { ( \mathbf { e } ) }$ refers to the aggregated feature set at $v _ { i }$ obtained with intra-edge aggregation for edge e.
|
| 61 |
+
|
| 62 |
+
The combined two-level message passing is achieved using nested aggregation function $\mathcal { F } = \mathcal { F } _ { 2 }$ . To ensure that the expressive power of a hypergraph is preserved or at least the loss is minimized, the choice of aggregation function should comply with certain properties.
|
| 63 |
+
|
| 64 |
+
Firstly, the aggregation function should be able to capture the features of neighborhood vertices in a manner that is invariant to the permutation of the nodes and hyperedges. Many graph representation learning methods use permutation invariant aggregation functions, such as mean, sum and max functions $\mathrm { { X u } }$ et al., 2019). These aggregations have proven to be successful for node classification problems. For the existing hypergraph frameworks, reduction to simple graphs along with a matrix-based message passing framework limits the possibilities of using different types of feature aggregation functions, and hence curtails the potential to explore unique node representations.
|
| 65 |
+
|
| 66 |
+

|
| 67 |
+
Figure 2: Schematic representation of the twolevel message passing scheme of HyperSAGE, with aggregation functions $\mathcal { F } _ { 1 } ( \cdot )$ and $\mathsf { \bar { F } } _ { 2 } ( \cdot )$ . It shows information aggregation from two hyperedges $\mathbf { e } _ { A }$ and $\mathbf { e } _ { B }$ , where the intra-edge aggregation is from sampled sets of 5 nodes $( \alpha = 5$ ) for each hyperedge. For node $v _ { i }$ , $\mathbf { x } _ { i }$ and $\mathbf { z } _ { i }$ denote the input and encoded feature vector, respectively.
|
| 68 |
+
|
| 69 |
+
Secondly, the aggregation function should also preserve the global neighborhood invariance at the ‘dominant nodes’ of the graph. Here, dominant nodes refer to nodes that contain important features, thereby, impacting the learning process relatively more than their neighbors. The aggregation function should ideally be insensitive to the input, whether the provided hypergraph contains a few large hyperedges, or a larger number of smaller ones obtained from splitting them. Generally, a hyperedge would be split in a manner that the dominant nodes are shared across the resulting hyperedges. In such cases, global neighborhood invariance would imply that the aggregated output at these nodes before and after the splitting of any associated hyperedge stays the same. Otherwise, the learned representation of a node will change significantly with each hyperedge split.
|
| 70 |
+
|
| 71 |
+
Based on these considerations, we define the following properties for a generic message aggregation function that should hold for accurate propagation of information through the hypergraphs.
|
| 72 |
+
|
| 73 |
+
Property 1 (Hypergraph Isomorphic Equivariance). A message aggregation function $\mathcal { F } ( \cdot )$ is equivariant to hypergraph isomorphism, if for two isomorphic hypergraphs $\mathcal { H } = ( \boldsymbol { \nabla } , \boldsymbol { \mathcal { E } } , \mathbf { X } )$ and $\bar { \mathcal { H } } ^ { * } = ( \bar { \mathcal { V } } ^ { * } , \mathcal { E } ^ { * } , \bar { \bf X ^ { * } } )$ , given that $\mathcal { H } ^ { \ast } = \sigma \bullet \mathcal { H }$ , and $\mathbf { Z }$ and $\mathbf { Z } ^ { \ast }$ represent the encoded feature matrices obtained using $\mathcal { F } ( \cdot )$ on $\mathcal { H }$ and $\mathcal { H } ^ { * }$ , the condition $\mathbf { Z } ^ { * } = \sigma \bullet \mathbf { Z }$ holds. Here, $\sigma$ denotes a permutation operator on hypergraphs.
|
| 74 |
+
|
| 75 |
+
Property 2 (Global Neighborhood Invariance). A message aggregation scheme $\mathcal { F } ( \cdot )$ satisfies global neighborhood invariance at any node $\boldsymbol { v } _ { i } ~ \in ~ \mathcal { V }$ for a given hypergraph $\mathcal { H } = ( \boldsymbol { \nabla } , \boldsymbol { \mathcal { E } } , \mathbf { X } )$ if for any operation $\Gamma ( \cdot )$ , such that $\mathcal { H } ^ { * } = \Gamma ( \mathcal { H } )$ , and $\mathbf { z } _ { i }$ and $\mathbf { z } _ { i } ^ { * }$ denote the encoded feature vectors obtained using $\mathcal { F } ( \cdot )$ at node $v _ { i }$ on $\mathcal { H }$ and $\mathcal { H } ^ { * }$ , the condition $\mathbf { z } _ { i } ^ { * } ~ = ~ \mathbf { z } _ { i }$ holds. Here $\Gamma ( \mathcal { \mathrm { H } } )$ could refer to operations such as hyperedge contraction or expansion.
|
| 76 |
+
|
| 77 |
+
The flexibility of our message passing framework allows us to go beyond the simple aggregation functions on hypergraphs without violating Property 1. We introduce a series of power mean functions as aggregators, which have recently been shown to generalize well on graphs (Li et al., 2020). We perform message aggregation in hypergraphs using these generalized means, denoted by $M _ { p }$ and provide in section 4.2, a study on their performances. We also show that with appropriate combinations of the intra-edge and inter-edge aggregations Property 2 is also satisfied. This property ensures that the representation of a node after message passing is invariant to the cardinality of the hyperedge, i.e., the aggregation scheme should not be sensitive to hyperedge contraction or expansion, as long as the global neighborhood of a node remains the same in the hypergraph.
|
| 78 |
+
|
| 79 |
+
Aggregation Functions. One major advantage of our strategy is that the message passing module is decoupled from the choice of the aggregation itself. This allows our approach to be used with a broad set of aggregation functions. We discuss below a few such possible choices.
|
| 80 |
+
|
| 81 |
+
Generalized means. Also referred to as power means, this class of functions are very commonly used for getting an aggregated measure over a given set of samples. Mathematically, generalized means can be expressed as $\begin{array} { r } { M _ { p } = \left( \frac { 1 } { n } \sum _ { i = 1 } ^ { n } x _ { i } ^ { p } \right) ^ { \frac { 1 } { p } } } \end{array}$ , where $n$ refers to the number of samples in the aggregation, and denotes its power. The choice of allows providing different interpretations to the aggregation function. For example, $p = 1$ denotes arithmetic mean aggregation, $p = 2$ refers to mean squared estimate and a large value of $p$ corresponds to max pooling from the group. Similarly, $M _ { p }$ can be used for geometric and harmonic means with $p 0$ and $p = - 1$ , respectively.
|
| 82 |
+
|
| 83 |
+
Similar to the recent work of Li et al. (2020), we use generalized means for intra-edge as well as inter-edge aggregation. The two functions $\mathcal { F } _ { 1 } ( \cdot )$ and $\mathcal { F } _ { 2 } ( \cdot )$ for aggregation at node $v _ { i }$ is defined as
|
| 84 |
+
|
| 85 |
+
$$
|
| 86 |
+
\begin{array} { l } { \displaystyle \mathfrak { F } _ { 1 } ^ { ( i ) } ( \mathbf { s } ) = \left( \frac { 1 } { | \mathscr { N } ( v _ { i } , \mathbf { e } ) | | \mathscr { N } ( v _ { i } ) | } \sum _ { v _ { j } \in \mathscr { N } ( v _ { i } , \mathbf { e } ) } \left( \sum _ { m = 1 } ^ { | E ( v _ { i } ) | } \frac { 1 } { | \mathscr { N } ( v _ { i } , \mathbf { e } _ { m } ) | } \right) ^ { - 1 } \mathbf { x } _ { j } ^ { p } \right) ^ { \frac { 1 } { p } } } \\ { \displaystyle \mathfrak { F } _ { 2 } ^ { ( i ) } ( \mathbf { s } ) = \left( \frac { 1 } { | E ( v _ { i } ) | } \sum _ { \mathbf { e } \in E ( v _ { i } ) } ( \mathscr { F } _ { 1 } ( \mathbf { s } ) ) ^ { p } \right) ^ { \frac { 1 } { p } } } \end{array}
|
| 87 |
+
$$
|
| 88 |
+
|
| 89 |
+
where we use ‘s’ for concise representation of the unordered set of input as shown in Eq.1. Here and henceforth in this paper, we remove the superscript index $\mathbf { \rho } ( i ) ^ { \prime }$ for the sake of clarity and further occurrences of the two aggregation functions shall be interpreted in terms of node $v _ { i }$ . Note that in Eq. 3 and Eq. 4, we have chosen the power term $p$ to be same for ${ \mathcal { F } } _ { 1 }$ and $\mathcal { F } _ { 2 }$ so as to satisfy the global neighborhood invariance as stated in Property 2. Note, the scaling term added to ${ \mathcal { F } } _ { 1 }$ is added to balance the bias in the weighting introduced in intra-edge aggregation due to varying cardinality across the hyperedges. These restrictions ensure that the joint aggregation $\mathcal { F } _ { 2 } ( \cdot )$ satisfies the property of global neighborhood invariance at all times. Proof of the two aggregations satisfying Property 2 is stated in Appendix B.
|
| 90 |
+
|
| 91 |
+
Sampling-based Aggregation. Our neural message passing scheme provides the flexibility to adapt the message aggregation module to fit the desired computational budget through aggregating information from only a subset $N ( v _ { i } , \mathbf { e } ; \alpha )$ of the full neighborhood $N ( v _ { i } , \mathbf { e } )$ , if needed. We propose to apply sub-sampling only on the nodes from the training set, and use information from the full neighborhood for the test set. The advantages of this are twofold. First, reduced number of samples per aggregation at training time reduces the relative computational burden. Second, similar to dropout (Srivastava et al., 2014), it serves to add regularization to the optimization process. Using the full neighborhood on test data avoids randomness in the test predictions, and generates consistent output.
|
| 92 |
+
|
| 93 |
+
# 3.3 INDUCTIVE LEARNING ON HYPERGRAPHS
|
| 94 |
+
|
| 95 |
+
HyperSAGE is a general framework for learning node representations on hypergraphs, on even unseen nodes. Our approach uses a neural network comprising $L$ layers, and feature-aggregation is performed at each of these layers, as well as across the hyperedges.
|
| 96 |
+
|
| 97 |
+
Algorithm 1 describes the forward propagation mechanism which implements the aggregation function $\mathcal { F } ( \cdot ) ~ = ~ \mathcal { F } _ { 2 } ( \cdot )$ described above. At each iteration, nodes first aggregate information from their neighbors within a specific hyperedge. This is repeated over all the hyperedges across all the $L$ layers of the network. The trainable weight matrices $\mathbf { W } ^ { l }$ with $l \in L$ are used to aggregate information across the feature dimension and propagate it through the various layers of the hypergraph.
|
| 98 |
+
|
| 99 |
+
Generalizability of HyperSAGE. HyperSAGE can be interpreted as a generalized formulation that unifies various existing graphbased as well as hypergraph formulations. Our approach unifies them, identifying each of these as special variants/cases of our method. We discuss here briefly the two popular algorithms.
|
| 100 |
+
|
| 101 |
+
Graph Convolution Networks (GCN). The GCN approach proposed by Kipf & Welling (2016) is a graph-based method that can be derived as a special case of HyperSAGE with maximum
|
| 102 |
+
|
| 103 |
+
# Algorithm 1 HyperSAGE Message Passing
|
| 104 |
+
|
| 105 |
+
Input : $\mathcal { H } = ( \boldsymbol { \nabla } , \mathcal { E } , \mathbf { X } )$ ; depth $L$ ; weight matrices $\mathbf { W } ^ { l }$ for $l = 1 \ldots L$ ; non-linearity $\sigma$ ; intra-edge aggregation function $\mathcal { F } _ { 1 } ( \cdot )$ ; inter-edge aggregation function $\mathcal { F } _ { 2 } ( \cdot )$
|
| 106 |
+
Output: Node embeddings $\mathbf { z } _ { i } |$ $v _ { i } \in \mathcal V$
|
| 107 |
+
$\mathbf { h } _ { i } ^ { 0 } \bar { } \mathbf { x } _ { i } \in \mathbf { X } \mid v _ { i } \in \mathcal { V }$
|
| 108 |
+
for $l = 1 \ldots L$ do for e ∈ E do hl ← hl−1 for vi ∈ e do h l ← h l + F ( i ) ( s ) end end $\mathbf { h } _ { i } ^ { l } \sigma ( \mathbf { W } ^ { l } ( \mathbf { h } _ { i } ^ { l } / | | \mathbf { h } _ { i } ^ { l } | | _ { 2 } ) ) \mid v _ { i } \in \mathcal { V }$
|
| 109 |
+
end
|
| 110 |
+
$\mathbf { z } _ { i } \mathbf { h } _ { i } ^ { L } \mid v _ { i } \in \mathcal { V }$
|
| 111 |
+
|
| 112 |
+
cardinality $| M | = 2$ , and setting the agggregation function $\mathcal { F } _ { 2 } = M _ { p }$ with $p = 1$ . This being a graph-based method, ${ \mathcal { F } } _ { 1 }$ will not be used.
|
| 113 |
+
|
| 114 |
+
GraphSAGE. Our approach, when reduced for graphs using $| M | = 2$ , is similar to GraphSAGE. For exact match, the aggregation function $\mathcal { F } _ { 2 }$ should be one of mean, max or $L S T M$ . Further, the sampling term $\alpha$ can be adjusted to match the number of samples per aggregation as in GraphSAGE.
|
| 115 |
+
|
| 116 |
+
# 4 EXPERIMENTS
|
| 117 |
+
|
| 118 |
+
# 4.1 EXPERIMENTAL SETUP
|
| 119 |
+
|
| 120 |
+
For the experiments in this paper, we use co-citation and co-authorship network datasets: CiteSeer, PubMed, Cora (Sen et al., 2008) and DBLP (Rossi & Ahmed, 2015). The task for each dataset is to predict the topic to which a document belongs (multi-class classification). For these datasets, $\mathbf { x } _ { i }$ corresponds to a bag of words such that $x _ { i , j } \in \mathbf { x } _ { i }$ represents the normalized frequency of occurence of the $j ^ { t h }$ word. Additional details related to the hypergraph topology are presented in Appendix
|
| 121 |
+
|
| 122 |
+
Table 1: Performance of HyperSAGE and other hypergraph learning methods on co-authorship and co-citation datasets.
|
| 123 |
+
|
| 124 |
+
<table><tr><td rowspan="2">Method</td><td colspan="2">Co-authorship Data</td><td colspan="3">Co-citation Data</td></tr><tr><td>DBLP</td><td>Cora</td><td>Pubmed</td><td>Citeseer</td><td>Cora</td></tr><tr><td>MLP +HLR</td><td>63.6 ± 4.7</td><td>59.8 ± 4.7</td><td>64.7 ± 3.1</td><td>56.1 ± 2.6</td><td>61.0 ± 4.1</td></tr><tr><td>HGNN</td><td>69.2 ± 5.1</td><td>63.2 ± 3.1</td><td>66.8 ± 3.7</td><td>56.7 ± 3.8</td><td>70.0 ± 2.9</td></tr><tr><td>FastHyperGCN</td><td>68.1 ± 9.6</td><td>61.1 ± 8.2</td><td>65.7 ± 11.1</td><td>56.2 ± 8.1</td><td>61.3 ± 10.3</td></tr><tr><td>HyperGCN</td><td>70.9 ± 8.3</td><td>63.9 ± 7.3</td><td>68.3 ± 9.5</td><td>57.3 ± 7.3</td><td>62.5 ± 9.7</td></tr><tr><td>HyperSAGE (p = 2)</td><td>71.5 ± 4.4</td><td>69.8 ± 2.6</td><td>71.3 ± 2.4</td><td>59.8 ± 3.3</td><td>62.9 ± 2.1</td></tr><tr><td>HyperSAGE (p = 1)</td><td>77.2 ± 4.3</td><td>72.4 ± 1.6</td><td>72.6 ± 2.1</td><td>61.8 ± 2.3</td><td>69.3 ± 2.7</td></tr><tr><td>HyperSAGE (p = 0.01)</td><td>77.4 ± 3.8</td><td>72.1 ± 1.8</td><td>72.9 ± 1.3</td><td>61.3 ± 2.4</td><td>68.2 ± 2.4</td></tr><tr><td>HyperSAGE (p = -1)</td><td>70.9 ± 2.3</td><td>67.4 ± 2.1</td><td>68.3 ± 3.1</td><td>59.8 ± 2.0</td><td>62.3 ± 5.7</td></tr></table>
|
| 125 |
+
|
| 126 |
+
A.2. Further, for all experiments, we use a neural network with 2 layers. All models are implemented in Pytorch and trained using Adam optimizer. See Appendix A.2 for implementation details.
|
| 127 |
+
|
| 128 |
+
# 4.2 SEMI-SUPERVISED NODE CLASSIFICATION ON HYPERGRAPHS
|
| 129 |
+
|
| 130 |
+
Performance comparison with existing methods. We implemented HyperSAGE for the task of semi-supervised classification of nodes on a hypergraph, and the results are compared with stateof-the art methods. These include (a) Multi-layer perceptron with explicit hypergraph Laplacian regularisation $( \mathbf { M L P } + \mathbf { H L R } )$ , (b) Hypergraph Neural Networks (HGNN) (Feng et al., 2019) which uses a clique expansion, and (c) HyperGCN and its variants (Yadati et al., 2019) that collapse the hyperedges using mediators. For HyperSAGE method, we use 4 variants of generalized means $M _ { p }$ with $p = 1 , 2 , - 1$ and 0.01 with complete neighborhood i.e., $\alpha = | \mathbf { e } |$ . For all the cases, 10 data splits over 8 random weight initializations are used, totalling 80 experiments per method and for every dataset. The data splits are the same as in HyperGCN described in Appendix A.1.
|
| 131 |
+
|
| 132 |
+
Table 1 shows the results obtained for the node classification task. We see that the different variants of HyperSAGE consistently show better scores across our benchmark datasets, except Cora cocitation where no improvement is observed compared to HGNN. Cora co-citation data is relatively small in size with a cardinality of $3 . 0 \pm 1 . 1$ , and we speculate that there does not exist enough scope of improving with HyperSAGE beyond what HGNN can express with the clique expansion.
|
| 133 |
+
|
| 134 |
+
For the larger datasets such as DBLP and Pubmed, we see that the improvements obtained in performance with HyperSAGE over the best baselines are $6 . 3 \%$ and $4 . 3 \%$ respectively. Apart from its superior performance, HyperSAGE is also stable, and is less sensitive to the choice of data split and initialization of the weights. This is evident from the scores of standard deviation (SD) for the various experiments in Table 1. We see that the SD scores for our method are lower than other methods, and there is a significant gain in performance compared to HyperGCN. Another observation is that the HyperGCN method is very sensitive to the data splits as well as initializations with very large errors in the predictions. This is even higher for the FastHyperGCN variant. Also, we have found that all the 4 choices of $p$ work well with HyperSAGE for these datasets. We further perform a more comprehensive study analyzing the effect of $p$ on model performance later in this section.
|
| 135 |
+
|
| 136 |
+
Stability analysis. We further study the stability of our method in terms of the variance observed in performance for different ratios of train and test splits, and compare results with that of HyperGCN implemented under similar settings. Fig. 3 shows results for the two learning methods on 5 different train-test ratios. We see that the performance of both models improves when a higher fraction of data is used for training, and the performances are approximately the same at the train-test ratio of 1/3.
|
| 137 |
+
|
| 138 |
+

|
| 139 |
+
Figure 3: Accuracy scores for HyperSAGE and HyperGCN obtained for different train-test ratios for multi-class classification datasets.
|
| 140 |
+
|
| 141 |
+
Table 2: Performance of HyperSAGE for multiple values of $p$ in generalized means aggregator $( M _ { p } )$ on varying number of neighborhood samples $( \alpha )$ .
|
| 142 |
+
|
| 143 |
+
<table><tr><td rowspan="2"></td><td colspan="4">DBLP</td><td colspan="4">Pubmed</td></tr><tr><td>α=2</td><td>α=3</td><td>α=5</td><td>α=10</td><td>α=2</td><td>α=3</td><td>α=5</td><td>α=10</td></tr><tr><td>p=-1</td><td>59.6</td><td>61.2</td><td>69.9</td><td>70.9</td><td>60.1</td><td>60.2</td><td>67.9</td><td>66.4</td></tr><tr><td>p = 0.01</td><td>61.2</td><td>64.8</td><td>73.1</td><td>77.4</td><td>65.5</td><td>67.4</td><td>73.4</td><td>72.9</td></tr><tr><td>p=1</td><td>62.3</td><td>64.5</td><td>73.1</td><td>77.2</td><td>64.8</td><td>64.3</td><td>72.2</td><td>72.6</td></tr><tr><td>p=2</td><td>63.1</td><td>63.8</td><td>71.9</td><td>71.5</td><td>63.7</td><td>63.9</td><td>70.8</td><td>71.3</td></tr><tr><td>p=3</td><td>62.7</td><td>63.6</td><td>71.3</td><td>71.4</td><td>62.2</td><td>61.3</td><td>70.1</td><td>67.9</td></tr><tr><td>p=5</td><td>62.8</td><td>63.3</td><td>69.4</td><td>70.6</td><td>62.1</td><td>60.4</td><td>69.3</td><td>68.0</td></tr></table>
|
| 144 |
+
|
| 145 |
+
Table 3: Performance of HyperSAGE and its variants on nodes which were part of the training hypergraph (seen) and nodes which were not part of the training hypergraph (unseen).
|
| 146 |
+
|
| 147 |
+
<table><tr><td></td><td colspan="2">DBLP</td><td colspan="2">Pubmed</td><td colspan="2">Citeseer</td><td colspan="2">Cora (citation)</td></tr><tr><td>Method</td><td>Seen</td><td>Unseen</td><td>Seen</td><td>Unseen</td><td>Seen</td><td>Unseen</td><td>Seen</td><td>Unseen</td></tr><tr><td>MLP + HLR</td><td>64.5</td><td>58.7</td><td>66.8</td><td>62.4</td><td>60.1</td><td>58.2</td><td>65.7</td><td>64.2</td></tr><tr><td>HyperSAGE (p = 0.01)</td><td>78.1</td><td>73.1</td><td>81.0</td><td>80.4</td><td>69.2</td><td>67.1</td><td>68.2</td><td>65.7</td></tr><tr><td>HyperSAGE (p =1)</td><td>78.1</td><td>73.2</td><td>78.5</td><td>76.4</td><td>69.3</td><td>67.9</td><td>71.3</td><td>66.8</td></tr><tr><td>HyperSAGE (p = 2)</td><td>76.1</td><td>70.2</td><td>71.2</td><td>69.8</td><td>65.9</td><td>63.8</td><td>65.9</td><td>64.5</td></tr></table>
|
| 148 |
+
|
| 149 |
+
However, for smaller ratios, we see that HyperSAGE outperforms HyperGCN by a significant margin across all datasets. Further, the standard deviation for the predictions of HyperSAGE are significantly lower than that of HyperGCN. Clearly, this implies that HyperSAGE is able to better exploit the information contained in the hypergraph compared to HyperGCN, and can thus produce more accurate and stable predictions. Results on Cora and Citeseer can be found in Appendix C.
|
| 150 |
+
|
| 151 |
+
Effect of generalized mean aggregations and neighborhood sampling. We study here the effect of different choices of the aggregation functions $\mathcal { F } _ { 1 } ( \cdot )$ and $\mathcal { F } _ { 2 } ( \cdot )$ on the performance of the model. Further, we also analyze how the number of samples chosen for aggregation affect its performance. Aggregation functions from $M _ { p }$ are chosen with $p = 1 , 2 , 3 , 4 , 5 , 0 . 0 1$ and $- 1$ , and to comply with global neighborhood invariance, we use aggregation function as in Eq. 4. The number of neighbors $\alpha$ for intra-edge aggregation are chosen to be 2, 3, 5 and 10. Table 2 shows the accuracy scores obtained for different choices of $p$ and $\alpha$ on DBLP and Pubmed datasets. For most cases, higher value of $p$ reduces the performance of the model. For $\alpha = 2$ on DBLP, performance seems to be independent of the choice of $p$ . A possible explanation could be that the number of neighbors is very small, and change in $p$ does not affect the propagation of information significantly. An exception is $p = - 1$ , where the performance drops for all cases. For Pubmed, the choice of $p$ seems to be very important, and we find that $p = 0 . 0 1$ seems to fit best.
|
| 152 |
+
|
| 153 |
+
We also see that the number of samples per aggregation can significantly affect the performance of the model. For DBLP, model performance increases with increasing value of $\alpha$ . However, for Pubmed, we observe that performance improves up to $\alpha = 5$ , but then a slight drop is observed for larger sets of neighbors. Note that for Pubmed, the majority of the hyperedges have cardinality less than or equal to 10. This means that during aggregation, information will most often be aggregated from all the neighbors, thereby involving almost no stochastic sampling. Stochastic sampling of nodes could serve as a regularization mechanism and reduce the impact of noisy hyperedges. However, at $\alpha = 1 0$ , it is almost absent, due to which the noise in the data affects the performance of the model which is not the case in DBLP.
|
| 154 |
+
|
| 155 |
+
# 4.3 INDUCTIVE LEARNING ON EVOLVING GRAPHS
|
| 156 |
+
|
| 157 |
+
For inductive learning experiment, we consider the case of evolving hypergraphs. We create 4 inductive learning datasets from DBLP, Pubmed, Citeseer and Core (co-citation) by splitting each of the datasets into a train-test ratio of 1:4. Further, the test data is split into two halves: seen and unseen. The seen test set comprises nodes that are part of the hypergraph used for representation learning. Further, unseen nodes refer to those that are never a part of the hypergraph during training. To study how well HyperSAGE generalizes for inductive learning, we classify the unseen nodes and compare the performance with the scores obtained on the seen nodes. Further, we also compare our results on unseen nodes with those of $\mathrm { M L P { + } H L R }$ . The results are shown in Table 3. We see that results obtained with HyperSAGE on unseen nodes are significantly better than the baseline method. Further, these results seem to not differ drastically from those obtained on the seen nodes, thereby confirming that HyperSAGE can work with evolving graphs as well.
|
| 158 |
+
|
| 159 |
+
# 5 CONCLUSION
|
| 160 |
+
|
| 161 |
+
We have proposed HyperSAGE, a generic neural message passing framework for inductive learning on hypergraphs. The proposed approach fully utilizes the inherent higher-order relations in a hypergraph structure without reducing it to a regular graph. Through experiments on several representative datasets, we have shown that HyperSAGE outperforms the other methods for hypergraph learning. Several variants of graph-based learning algorithm such as GCN and GraphSAGE can be derived from the flexible aggregation and neighborhood sampling framework, thus making HyperSAGE a universal framework for learning node representations on hypergraphs as well as graphs.
|
| 162 |
+
|
| 163 |
+
# REFERENCES
|
| 164 |
+
|
| 165 |
+
Sameer Agarwal, Kristin Branson, and Serge Belongie. Higher order learning with graphs. In Proceedings of the 23rd international conference on Machine learning, pp. 17–24, 2006.
|
| 166 |
+
|
| 167 |
+
Devanshu Arya, Stevan Rudinac, and Marcel Worring. Hyperlearn: a distributed approach for representation learning in datasets with many modalities. In Proceedings of the 27th ACM International Conference on Multimedia, pp. 2245–2253, 2019.
|
| 168 |
+
|
| 169 |
+
Song Bai, Feihu Zhang, and Philip HS Torr. Hypergraph convolution and hypergraph attention. Pattern Recognition, pp. 107637, 2020.
|
| 170 |
+
|
| 171 |
+
C. Berge and E. Minieka. Graphs and Hypergraphs. North-Holland mathematical library. North-Holland Publishing Company, 1976. ISBN 9780720424539. URL https://books. google.nl/books?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ ARoVvgAACAAJ.
|
| 172 |
+
|
| 173 |
+
Michael M Bronstein, Joan Bruna, Yann LeCun, Arthur Szlam, and Pierre Vandergheynst. Geometric deep learning: going beyond euclidean data. IEEE Signal Processing Magazine, 34(4):18–42, 2017.
|
| 174 |
+
|
| 175 |
+
T-H Hubert Chan, Anand Louis, Zhihao Gavin Tang, and Chenzi Zhang. Spectral properties of hypergraph laplacian and approximation algorithms. Journal of the ACM (JACM), 65(3):1–48, 2018.
|
| 176 |
+
|
| 177 |
+
I Eli Chien, Huozhi Zhou, and Pan Li. hsˆ2: Active learning over hypergraphs with pointwise and pairwise queries. In The 22nd International Conference on Artificial Intelligence and Statistics, pp. 2466–2475, 2019.
|
| 178 |
+
|
| 179 |
+
Yihe Dong, Will Sawin, and Yoshua Bengio. HNHN: Hypergraph networks with hyperedge neurons. arXiv preprint arXiv:2006.12278, 2020.
|
| 180 |
+
|
| 181 |
+
Yifan Feng, Haoxuan You, Zizhao Zhang, Rongrong Ji, and Yue Gao. Hypergraph neural networks. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 33, pp. 3558–3565, 2019.
|
| 182 |
+
|
| 183 |
+
Justin Gilmer, Samuel S Schoenholz, Patrick F Riley, Oriol Vinyals, and George E Dahl. Neural message passing for quantum chemistry. Proceedings of the 34th International Conference on Machine Learning, 2017.
|
| 184 |
+
|
| 185 |
+
Marco Gori, Gabriele Monfardini, and Franco Scarselli. A new model for learning in graph domains. In Proceedings. 2005 IEEE International Joint Conference on Neural Networks, 2005., volume 2, pp. 729–734. IEEE, 2005.
|
| 186 |
+
|
| 187 |
+
Shi Gu, Muzhi Yang, John D Medaglia, Ruben C Gur, Raquel E Gur, Theodore D Satterthwaite, and Danielle S Bassett. Functional hypergraph uncovers novel covariant structures over neurodevelopment. Human brain mapping, 38(8):3823–3835, 2017.
|
| 188 |
+
|
| 189 |
+
Xuemei Gu, Lijun Chen, and Mario Krenn. Quantum experiments and hypergraphs: Multiphoton sources for quantum interference, quantum computation, and quantum entanglement. Physical Review A, 101(3):033816, 2020.
|
| 190 |
+
|
| 191 |
+
Will Hamilton, Zhitao Ying, and Jure Leskovec. Inductive representation learning on large graphs. In Advances in neural information processing systems, pp. 1024–1034, 2017.
|
| 192 |
+
|
| 193 |
+
Matthias Hein, Simon Setzer, Leonardo Jost, and Syama Sundar Rangapuram. The total variation on hypergraphs-learning on hypergraphs revisited. In Advances in Neural Information Processing Systems, pp. 2427–2435, 2013.
|
| 194 |
+
|
| 195 |
+
Jianwen Jiang, Yuxuan Wei, Yifan Feng, Jingxuan Cao, and Yue Gao. Dynamic hypergraph neural networks. In IJCAI, pp. 2635–2641, 2019.
|
| 196 |
+
|
| 197 |
+
Thomas N Kipf and Max Welling. Semi-supervised classification with graph convolutional networks. ICLR, 2016.
|
| 198 |
+
|
| 199 |
+
Guohao Li, Chenxin Xiong, Ali Thabet, and Bernard Ghanem. Deepergcn: All you need to train deeper gcns. arXiv preprint arXiv:2006.07739, 2020.
|
| 200 |
+
|
| 201 |
+
Guoyin Li, Liqun Qi, and Gaohang Yu. The z-eigenvalues of a symmetric tensor and its application to spectral hypergraph theory. Numerical Linear Algebra with Applications, 20(6):1001–1029, 2013.
|
| 202 |
+
|
| 203 |
+
Pan Li and Olgica Milenkovic. Inhomogeneous hypergraph clustering with applications. In Advances in Neural Information Processing Systems, pp. 2308–2318, 2017.
|
| 204 |
+
|
| 205 |
+
Yujia Li, Daniel Tarlow, Marc Brockschmidt, and Richard Zemel. Gated graph sequence neural networks. arXiv preprint arXiv:1511.05493, 2015.
|
| 206 |
+
|
| 207 |
+
Ryan A. Rossi and Nesreen K. Ahmed. The network data repository with interactive graph analytics and visualization. In AAAI, 2015. URL http://networkrepository.com.
|
| 208 |
+
|
| 209 |
+
Prithviraj Sen, Galileo Namata, Mustafa Bilgic, Lise Getoor, Brian Galligher, and Tina Eliassi-Rad. Collective classification in network data. AI magazine, 29(3):93–93, 2008.
|
| 210 |
+
|
| 211 |
+
Amnon Shashua, Ron Zass, and Tamir Hazan. Multi-way clustering using super-symmetric nonnegative tensor factorization. In European conference on computer vision, pp. 595–608. Springer, 2006.
|
| 212 |
+
|
| 213 |
+
Nitish Srivastava, Geoffrey Hinton, Alex Krizhevsky, Ilya Sutskever, and Ruslan Salakhutdinov. Dropout: a simple way to prevent neural networks from overfitting. The journal of machine learning research, 15(1):1929–1958, 2014.
|
| 214 |
+
|
| 215 |
+
Shulong Tan, Jiajun Bu, Chun Chen, Bin Xu, Can Wang, and Xiaofei He. Using rich social media information for music recommendation via hypergraph model. ACM Transactions on Multimedia Computing, Communications, and Applications (TOMM), 7(1):1–22, 2011.
|
| 216 |
+
|
| 217 |
+
Michael M Wolf, Alicia M Klinvex, and Daniel M Dunlavy. Advantages to modeling relational data using hypergraphs versus graphs. In 2016 IEEE High Performance Extreme Computing Conference (HPEC), pp. 1–7. IEEE, 2016.
|
| 218 |
+
|
| 219 |
+
Zonghan Wu, Shirui Pan, Fengwen Chen, Guodong Long, Chengqi Zhang, and S Yu Philip. A comprehensive survey on graph neural networks. IEEE Transactions on Neural Networks and Learning Systems, 2020.
|
| 220 |
+
|
| 221 |
+
Keyulu Xu, Weihua Hu, Jure Leskovec, and Stefanie Jegelka. How powerful are graph neural networks? International Conference on Learning Representations (ICLR), 2019.
|
| 222 |
+
|
| 223 |
+
Naganand Yadati, Madhav Nimishakavi, Prateek Yadav, Vikram Nitin, Anand Louis, and Partha Talukdar. Hypergcn: A new method for training graph convolutional networks on hypergraphs. In Advances in Neural Information Processing Systems, pp. 1511–1522, 2019.
|
| 224 |
+
|
| 225 |
+
Muhan Zhang and Yixin Chen. Link prediction based on graph neural networks. In Advances in Neural Information Processing Systems, pp. 5165–5175, 2018.
|
| 226 |
+
|
| 227 |
+
Muhan Zhang, Zhicheng Cui, Shali Jiang, and Yixin Chen. Beyond link prediction: Predicting hyperlinks in adjacency space. In AAAI, volume 1, pp. 6, 2018a.
|
| 228 |
+
|
| 229 |
+
Muhan Zhang, Zhicheng Cui, Marion Neumann, and Yixin Chen. An end-to-end deep learning architecture for graph classification. In Thirty-Second AAAI Conference on Artificial Intelligence, 2018b.
|
| 230 |
+
|
| 231 |
+
Songyang Zhang, Zhi Ding, and Shuguang Cui. Introducing hypergraph signal processing: theoretical foundation and practical applications. IEEE Internet of Things Journal, 7(1):639–660, 2019.
|
| 232 |
+
|
| 233 |
+
Dengyong Zhou, Jiayuan Huang, and Bernhard Scholkopf. Learning with hypergraphs: Clustering, ¨ classification, and embedding. In Advances in neural information processing systems, pp. 1601– 1608, 2007.
|
| 234 |
+
|
| 235 |
+
# APPENDICES
|
| 236 |
+
|
| 237 |
+
# A EXPERIMENTS: ADDITIONAL DETAILS
|
| 238 |
+
|
| 239 |
+
We perform multi-class classification on co-authorship and co-citation datasets, where the task is to predict the topic (class) for each document.
|
| 240 |
+
|
| 241 |
+
# A.1 DATASET DESCRIPTION
|
| 242 |
+
|
| 243 |
+
Hypergraphs are created on these datasets by assigning each document as a node and each hyperedge represents (a) all documents co-authored by an author in co-authorship dataset and (b) all documents cited together by a document in co-citation dataset. Each document (node) is represented by bagof-words features. The details about nodes, hyperedges and features is shown in Table 4. We use the same dataset and train-test splits as provided by Yadati et al. (2019) in their publically available implementation 1.
|
| 244 |
+
|
| 245 |
+
Table 4: Details of real-world hypergraph datasets used in our work
|
| 246 |
+
|
| 247 |
+
<table><tr><td rowspan="3"></td><td colspan="2">Co-authorship Data</td><td colspan="3">Co-citation Data</td></tr><tr><td>DBLP</td><td>Cora</td><td>Pubmed</td><td>Citeseer</td><td>Cora</td></tr><tr><td>Nodes (|VI)</td><td>43413</td><td>2708</td><td>19717</td><td>3312</td><td>2708</td></tr><tr><td>Hyperedges (|ε|)</td><td>22535</td><td>1072</td><td>7963</td><td>1079</td><td>1579</td></tr><tr><td>average hyperedge size</td><td>4.7±6.1</td><td>4.2±4.1</td><td>4.3 ± 5.7</td><td>3.2±2.0</td><td>3.0 ± 1.1</td></tr><tr><td>number of features, |xl</td><td>1425</td><td>1433</td><td>500</td><td>3703</td><td>1433</td></tr><tr><td>number of classes</td><td>6</td><td>7</td><td>3</td><td>6</td><td>7</td></tr></table>
|
| 248 |
+
|
| 249 |
+
# A.2 IMPLEMENTATION DETAILS
|
| 250 |
+
|
| 251 |
+
We use the following set of hyperparameters similar to the prior work by Kipf & Welling (2016) for all the models.
|
| 252 |
+
|
| 253 |
+
• hidden layer size: 32
|
| 254 |
+
• dropout rate: 0.5
|
| 255 |
+
• learning rate: 0.01
|
| 256 |
+
• weight decay: 0.0005
|
| 257 |
+
• number of training epochs: 150
|
| 258 |
+
• $\lambda$ for explicit Laplacian regularisation: 0.001
|
| 259 |
+
|
| 260 |
+
# B CHOICE OF INTER-EDGE AND INTRA-EDGE AGGREGATIONS
|
| 261 |
+
|
| 262 |
+
Proof. For any given hypergraph $\mathcal { H } _ { 1 } = ( \mathcal { V } , \mathcal { E } _ { 1 } , \mathbf { X } )$ , let $v _ { i }$ denote a node at which global neighborhood equivariance exists. The aggregation output $\mathcal { F } _ { 1 } ( \mathbf { s } )$ at $v _ { i }$ can then be written using generalized means $M _ { p }$ as
|
| 263 |
+
|
| 264 |
+
$$
|
| 265 |
+
\mathcal { F } _ { 1 } ( \mathbf { s } ) = \left( \frac { 1 } { | \mathscr { N } ( v _ { i } , \mathbf { e } ) | } \sum _ { v _ { j } \in \mathscr { N } ( v _ { i } , \mathbf { e } ) } \mathbf { x } _ { j } ^ { p _ { 1 } } \right) ^ { \frac { 1 } { p _ { 1 } } } .
|
| 266 |
+
$$
|
| 267 |
+
|
| 268 |
+
To reiterate here, s denotes the unordered set of input as shown in Eq. 5. Further, the inter-edge aggregation $\mathcal { F } _ { 2 } ( \cdot )$ can be stated as
|
| 269 |
+
|
| 270 |
+

|
| 271 |
+
Figure 4: (a) Example showing node $v _ { i }$ shared across 4 hyperedges. (b) Hyperedge $e _ { q }$ is split into $r$ hyperedges to reduce the cardinality of $e _ { q }$ . Note that the global neighborhood of $v _ { i }$ still remains the same, however its intra-edge neighborhood has changed due to such splitting.
|
| 272 |
+
|
| 273 |
+
$$
|
| 274 |
+
\mathcal { F } _ { 2 } ( \mathbf { s } ) = \left( \frac { 1 } { | E ( v _ { i } ) | } \sum _ { \mathbf { e } \in E ( v _ { i } ) } \left( \frac { 1 } { | \mathscr { N } ( v _ { i } , \mathbf { e } ) | } \sum _ { v _ { j } \in \mathscr { N } ( v _ { i } , \mathbf { e } ) } \mathbf { x } _ { j } ^ { p _ { 1 } } \right) ^ { \frac { p _ { 2 } } { p _ { 1 } } } \right) ^ { \frac { 1 } { p _ { 2 } } }
|
| 275 |
+
$$
|
| 276 |
+
|
| 277 |
+
This equation can be rewritten as
|
| 278 |
+
|
| 279 |
+
$$
|
| 280 |
+
\mathsf { F } _ { 2 } ( \mathbf { s } ) = \left( \frac { 1 } { | E ( v _ { i } ) | } \left( \left( \frac { 1 } { | \mathsf { N } ( v _ { i } , \mathbf { e } _ { q } ) | } \sum _ { v _ { j } \in \mathsf { N } ( v _ { i } , \mathbf { e } _ { q } ) } \mathbf { x } _ { j } ^ { p _ { 1 } } \right) ^ { \frac { p _ { 2 } } { p _ { 1 } } } + \sum _ { \mathbf { e } \in E ( v _ { i } ) , \mathbf { e } \neq \mathbf { e } _ { q } } \left( \frac { 1 } { | \mathsf { N } ( v _ { i } , \mathbf { e } ) | } \sum _ { v _ { j } \in \mathsf { N } ( v _ { i } , \mathbf { e } ) } \mathbf { x } _ { j } ^ { p _ { 1 } } \right) ^ { \frac { p _ { 2 } } { p _ { 1 } } } \right) \right) ^ { \frac { p _ { 1 } } { p _ { 2 } } }
|
| 281 |
+
$$
|
| 282 |
+
|
| 283 |
+
Further, let
|
| 284 |
+
|
| 285 |
+
$$
|
| 286 |
+
\Psi = \sum _ { \mathbf { e } \in E ( v _ { i } ) , \mathbf { e } \neq \mathbf { e } _ { q } } \left( \frac { 1 } { | \mathscr { N } ( v _ { i } , \mathbf { e } ) | } \sum _ { v _ { j } \in \mathscr { N } ( v _ { i } , \mathbf { e } ) } \mathbf { x } _ { j } ^ { p _ { 1 } } \right) ^ { \frac { p _ { 2 } } { p _ { 1 } } } ,
|
| 287 |
+
$$
|
| 288 |
+
|
| 289 |
+
then Eq. 7 can be rewritten as
|
| 290 |
+
|
| 291 |
+
$$
|
| 292 |
+
\mathcal { F } _ { 2 } ( \mathbf { s } ) = \left( \frac { 1 } { | E ( v _ { i } ) | } \left( \left( \frac { 1 } { | \Re ( v _ { i } , \mathbf { e } _ { q } ) | } \sum _ { v _ { j } \in \Re ( v _ { i } , \mathbf { e } _ { q } ) } \mathbf { x } _ { j } ^ { p _ { 1 } } \right) ^ { \frac { p _ { 2 } } { p _ { 1 } } } + \Psi \right) \right) ^ { \frac { 1 } { p _ { 2 } } }
|
| 293 |
+
$$
|
| 294 |
+
|
| 295 |
+
Let us assume now that hyperedge $\mathbf { e } _ { q }$ is split into $r$ hyperedges given by $\begin{array} { r l } { E ( v _ { i } , \mathbf { e } _ { q } ) } & { { } = } \end{array}$ $\{ \mathbf { e } _ { q _ { 1 } } , \mathbf { e } _ { q _ { 2 } } \ldots \mathbf { e } _ { q _ { r } } \}$ . Stating the aggregation on the new set of hyperedges as $\tilde { \mathcal { F } } _ { 2 } ( \mathbf { s } )$ , we assemble the contribution from this new set of hyperedges with added weight terms $w _ { j }$ as stated below.
|
| 296 |
+
|
| 297 |
+
$$
|
| 298 |
+
\tilde { \mathcal { F } } _ { 2 } ( \mathbf { s } ) = \left( \frac { 1 } { | E ( v _ { i } ) | } \left( \sum _ { \mathbf { e } \in E ( v _ { i } , \mathbf { e } _ { q } ) } \left( \frac { 1 } { | \Re ( v _ { i } , \mathbf { e } ) | } \sum _ { v _ { j } \in \Re ( v _ { i } , \mathbf { e } ) } w _ { j } \mathbf { x } _ { j } ^ { p _ { 1 } } \right) ^ { \frac { p _ { 2 } } { p _ { 1 } } } + \Psi \right) \right) ^ { \frac { 1 } { p _ { 2 } } }
|
| 299 |
+
$$
|
| 300 |
+
|
| 301 |
+
For the property of global neighborhood invariance to hold at $v _ { i }$ , the following condition should be satisfied: $\mathcal { F } _ { 2 } ( v _ { i } ) = \tilde { \mathcal { F } } _ { 2 } ( v _ { i } )$ . Based on this, we would like to solve for the weights $w _ { j }$ . For this, we equate the two terms and obtain
|
| 302 |
+
|
| 303 |
+
$$
|
| 304 |
+
\left( \frac { 1 } { | \mathscr { N } ( v _ { i } , \mathbf { e } _ { q } ) | } \sum _ { v _ { j } \in \mathscr { N } ( v _ { i } , \mathbf { e } _ { q } ) } \mathbf { x } _ { j } ^ { p _ { 1 } } \right) ^ { \frac { p _ { 2 } } { p _ { 1 } } } = \sum _ { \mathbf { e } \in E ( v _ { i } , \mathbf { e } _ { q } ) } \left( \frac { 1 } { | \mathscr { N } ( v _ { i } , \mathbf { e } ) | } \sum _ { v _ { j } \in \mathscr { N } ( v _ { i } , \mathbf { e } ) } w _ { j } \mathbf { x } _ { j } ^ { p _ { 1 } } \right) ^ { \frac { p _ { 2 } } { p _ { 1 } } }
|
| 305 |
+
$$
|
| 306 |
+
|
| 307 |
+
We further solve for the variables simplify Eq. 11 using the follow $p _ { 1 } , p _ { 2 }$ and bstitu $w _ { j }$ whns: 1, e sakand t, $\begin{array} { r } { \alpha = \frac { p _ { 2 } } { p _ { 1 } } } \end{array}$ $\begin{array} { r } { \beta = \frac { 1 } { | \mathcal { N } ( v _ { i } , \mathbf { e } _ { q } ) | } } \end{array}$ βmj = j|N(vi,em)| where the index $m$ here is used to refer to the $m ^ { \mathrm { t h } }$ hyperedge from among the $r$ hyperedges obtained on splitting $\mathbf { e } _ { q }$ . Further, let $z _ { j } = \mathbf { x } _ { j } ^ { p _ { 1 } }$ for $v _ { j } \in \mathcal { N } ( v _ { i } , \mathbf { e } _ { q } )$ and $z _ { m j } = \bar { \bf x } _ { j } ^ { p _ { 1 } }$ for $v _ { j } \in \mathcal { N } ( v _ { i } , \mathbf { e } _ { m } )$ and $\mathbf { e } _ { m } \in E ( v _ { i } , \mathbf { e } _ { q } )$ .
|
| 308 |
+
|
| 309 |
+
Based on these substitutions, Eq. 11 can be restated as
|
| 310 |
+
|
| 311 |
+
$$
|
| 312 |
+
\begin{array} { r l r } & { } & { \beta ^ { \alpha } ( z _ { 1 } + z _ { 2 } + . . . + z _ { N } ) ^ { \alpha } = ( \beta _ { 1 1 } z _ { 1 } + \beta _ { 1 2 } z _ { 2 } + . . . + \beta _ { 1 j } z _ { j } + . . . + \beta _ { 1 N } z _ { N } ) ^ { \alpha } } \\ & { } & { + ( \beta _ { 2 1 } z _ { 1 } + \beta _ { 2 2 } z _ { 2 } + . . . + \beta _ { 2 j } z _ { j } + . . . + \beta _ { 2 N } z _ { N } ) ^ { \alpha } + } \\ & { } & \\ & { } & { \vdots } & \\ & { } & { + ( \beta _ { r 1 } z _ { 1 } + \beta _ { r 2 } z _ { 2 } + . . . + \beta _ { r j } z _ { j } + . . . + \beta _ { r N } z _ { N } ) ^ { \alpha } . } \end{array}
|
| 313 |
+
$$
|
| 314 |
+
|
| 315 |
+
We seek general solutions for $w _ { j }$ and $\alpha$ which holds for all values of $z _ { j } \in [ 0 , 1 ]$ since every element in the normalized feature vectors $\mathbf { x } _ { j }$ lies in $[ 0 , 1 ]$ .
|
| 316 |
+
|
| 317 |
+
For a generalized solution, the coefficients of $z _ { j }$ on the right should be equal to the coefficient of $z _ { j }$ on the left. The term on the left can be reformulated as
|
| 318 |
+
|
| 319 |
+
$$
|
| 320 |
+
\beta ^ { \alpha } ( z _ { 1 } + z _ { 2 } + . . . + z _ { N } ) ^ { \alpha } = \beta ^ { \alpha } ( z _ { 1 } + ( z _ { 2 } + z _ { 3 } + . . . + z _ { N } ) ) ^ { \alpha }
|
| 321 |
+
$$
|
| 322 |
+
|
| 323 |
+
Consider the case when $| z _ { 1 } | \le | z _ { 2 } + z _ { 3 } + . . . |$ , we expand Eq. 13. using binomial expansion for real co-efficients,
|
| 324 |
+
|
| 325 |
+
$$
|
| 326 |
+
\begin{array} { r l } & { \beta ^ { \alpha } ( z _ { 1 } + ( z _ { 2 } + z _ { 3 } + \dots ) ) ^ { \alpha } = \beta ^ { \alpha } ( \binom { \alpha } { 0 } z _ { 1 } ^ { \alpha } + \binom { \alpha } { 1 } z _ { 1 } ^ { \alpha - 1 } ( z _ { 2 } + z _ { 3 } + \dots + z _ { N } ) + } \\ & { \vdots } \\ & { \qquad \quad + \ } \\ & { \qquad \quad + \ \binom { \alpha } { \alpha - 1 } z _ { 1 } ( z _ { 2 } + z _ { 3 } + \dots + z _ { N } ) ) } \\ & { \qquad = \beta ^ { \alpha } ( z _ { 1 } ^ { \alpha } + \alpha ( z _ { 1 } ^ { \alpha - 1 } z _ { 2 } + z _ { 1 } ^ { \alpha - 1 } z _ { 3 } + \dots + z _ { 1 } ^ { \alpha - 1 } z _ { N } ) + } \\ & { \vdots } \\ & { \qquad \quad + \ } \\ & { \quad + \alpha z _ { 1 } ( z _ { 2 } + z _ { 3 } + \dots + z _ { N } ) ^ { \alpha - 1 } ) } \end{array}
|
| 327 |
+
$$
|
| 328 |
+
|
| 329 |
+
Without any loss of generality, we consider splitting of hyperedge $e _ { q }$ into $r$ hyperedges such that nodes $v _ { \gamma _ { 1 } }$ and $v _ { \gamma _ { 2 } }$ are not contained in the same hyperedge anymore. This implies that RHS in Eq. 14 should not contain product terms of $z _ { 1 }$ and $z _ { 2 }$ . Hence, the term $z _ { 1 } ^ { \alpha - 1 } z _ { 2 }$ should be such that
|
| 330 |
+
|
| 331 |
+
$$
|
| 332 |
+
\alpha - 1 = 0 \Rightarrow \alpha = 1 \Rightarrow p 1 = p 2
|
| 333 |
+
$$
|
| 334 |
+
|
| 335 |
+
Putting $\alpha = 1$ and comparing the coefficients in Eq.12, we get
|
| 336 |
+
|
| 337 |
+
$$
|
| 338 |
+
\begin{array} { c } { \beta = \beta _ { 1 1 } + \beta _ { 1 2 } + . . . + \beta _ { 2 1 } + \beta _ { 2 2 } . . . + \beta _ { r 1 } + \beta _ { r 2 } + . . . } \\ { \displaystyle \frac { 1 } { | \mathbb { N } ( v _ { i } , \mathbf { e } _ { q } ) | } = \displaystyle \sum _ { m = 1 } ^ { r } \frac { w _ { j } } { | \mathbb { N } ( v _ { i } , \mathbf { e } _ { m } ) | } } \\ { w _ { j } = \displaystyle \frac { 1 } { | \mathbb { N } ( v _ { i } , \mathbf { e } _ { q } ) | } * \left( \displaystyle \sum _ { m = 1 } ^ { r } \frac { 1 } { | \mathbb { N } ( v _ { i } , \mathbf { e } _ { m } ) | } \right) ^ { - 1 } } \end{array}
|
| 339 |
+
$$
|
| 340 |
+
|
| 341 |
+
Thus, if an edge ${ \bf e } _ { q }$ is split into multiple edges $E ( v _ { i } , { \bf e } _ { q } )$ , then for the two aggregations to hold, the conditions are $p _ { 1 } = p _ { 2 }$ and $\begin{array} { r } { w _ { j } = \frac { 1 } { | \mathscr { N } ( v _ { i } , \mathbf { e } _ { q } ) | } * \left( \sum _ { m = 1 } ^ { r } \frac { 1 } { | \mathscr { N } ( v _ { i } , \mathbf { e } _ { m } ) | } \right) ^ { - 1 } \forall \mathbf { e } \in E ( v _ { i } , \mathbf { e } _ { q } ) . } \end{array}$
|
| 342 |
+
|
| 343 |
+
While we provide above a description related to splitting a certain hyperedge $\mathbf { e } _ { q }$ into $r$ hyperedges, the derived results can be used to compute global neighborhood itself on any given node $v _ { i }$ . Similar to $\mathbf { e } _ { q }$ above, node $v _ { i }$ together with its global neighborhood (counted as $\mathcal { N } ( v _ { i } ) )$ ) can be interpreted as a virtual hyperedge that has been split into a number of hyperedges that actually exist and contain $v _ { i }$ . These resultant hyperdges are equivalent to the $r$ hyperdges obtained after splitting, as stated above.
|
| 344 |
+
|
| 345 |
+

|
| 346 |
+
Figure 5: Results on cora and citeseer for multiple train test ratio
|
md/train/hb1sDDSLbV/hb1sDDSLbV.md
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
md/train/i80OPhOCVH2/i80OPhOCVH2.md
ADDED
|
@@ -0,0 +1,366 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# ON THE BOTTLENECK OF GRAPH NEURAL NETWORKS AND ITS PRACTICAL IMPLICATIONS
|
| 2 |
+
|
| 3 |
+
Uri Alon & Eran Yahav
|
| 4 |
+
Technion, Israel
|
| 5 |
+
{urialon,yahave}@cs.technion.ac.il
|
| 6 |
+
|
| 7 |
+
# ABSTRACT
|
| 8 |
+
|
| 9 |
+
Since the proposal of the graph neural network (GNN) by Gori et al. (2005) and Scarselli et al. (2008), one of the major problems in training GNNs was their struggle to propagate information between distant nodes in the graph. We propose a new explanation for this problem: GNNs are susceptible to a bottleneck when aggregating messages across a long path. This bottleneck causes the over-squashing of exponentially growing information into fixed-size vectors. As a result, GNNs fail to propagate messages originating from distant nodes and perform poorly when the prediction task depends on long-range interaction. In this paper, we highlight the inherent problem of over-squashing in GNNs: we demonstrate that the bottleneck hinders popular GNNs from fitting long-range signals in the training data; we further show that GNNs that absorb incoming edges equally, such as GCN and GIN, are more susceptible to over-squashing than GAT and GGNN; finally, we show that prior work, which extensively tuned GNN models of long-range problems, suffer from over-squashing, and that breaking the bottleneck improves their state-of-the-art results without any tuning or additional weights. Our code is available at https://github.com/tech-srl/bottleneck/ .
|
| 10 |
+
|
| 11 |
+
# 1 INTRODUCTION
|
| 12 |
+
|
| 13 |
+
Graph neural networks (GNNs) (Gori et al., 2005; Scarselli et al., 2008; Micheli, 2009) have seen sharply growing popularity over the last few years (Duvenaud et al., 2015; Hamilton et al., 2017; Xu et al., 2019). GNNs provide a general framework to model complex structural data containing elements (nodes) with relationships (edges) between them. A variety of real-world domains such as social networks, computer programs, chemical and biological systems can be naturally represented as graphs. Thus, many graph-structured domains are commonly modeled using GNNs.
|
| 14 |
+
|
| 15 |
+
A GNN layer can be viewed as a message-passing step (Gilmer et al., 2017), where each node updates its state by aggregating messages flowing from its direct neighbors. GNN variants (Li et al., 2016; Velickovi ˇ c et al., 2018; Kipf and Welling, 2017) mostly differ in how each node aggregates the ´ representations of its neighbors with its own representation. However, most problems also require the interaction between nodes that are not directly connected, and they achieve this by stacking multiple GNN layers. Different learning problems require different ranges of interaction between nodes in the graph to be solved. We call this required range of interaction between nodes – the problem radius.
|
| 16 |
+
|
| 17 |
+
In practice, GNNs were observed not to benefit from more than few layers. The accepted explanation for this phenomenon is over-smoothing: node representations become indistinguishable when the number of layers increases (Wu et al., 2020). Nonetheless, over-smoothing was mostly demonstrated in short-range tasks (Li et al., 2018; Klicpera et al., 2018; Chen et al., 2020a; Oono and Suzuki, 2020; Zhao and Akoglu, 2020; Rong et al., 2020; Chen et al., 2020b) – tasks that have small problem radii, where a node’s correct prediction mostly depends on its local neighborhood. Such tasks include paper subject classification (Sen et al., 2008) and product category classification (Shchur et al., 2018). Since the learning problems depend mostly on short-range information in these datasets, it makes sense why more layers than the problem radius might be extraneous. In contrast, in tasks that also depend on long-range information (and thus have larger problem radii), we hypothesize that the explanation for limited performance is over-squashing. We further discuss the differences between over-squashing and over-smoothing in Section 6.
|
| 18 |
+
|
| 19 |
+

|
| 20 |
+
Figure 1: The bottleneck that existed in RNN seq2seq models (before attention) is strictly more harmful in GNNs: information from a node’s exponentially-growing receptive field is compressed into a fixed-size vector. Black arrows are graph edges; red curved arrows illustrate information flow.
|
| 21 |
+
|
| 22 |
+
To allow a node to receive information from other nodes at a radius of $K$ , the GNN needs to have at least $K$ layers, or otherwise, it will suffer from under-reaching – these distant nodes will simply not be aware of each other. Clearly, to avoid under-reaching, problems that depend on long-range interaction require as many GNN layers as the range of the interaction. However, as the number of layers increases, the number of nodes in each node’s receptive field grows exponentially. This causes over-squashing: information from the exponentially-growing receptive field is compressed into fixed-length node vectors. Consequently, the graph fails to propagate messages flowing from distant nodes, and learns only short-range signals from the training data.
|
| 23 |
+
|
| 24 |
+
In fact, the GNN bottleneck is analogous to the bottleneck of sequential RNN models. Traditional seq2seq models (Sutskever et al., 2014; Cho et al., 2014a;b) suffered from a bottleneck at every decoder state – the model had to encapsulate the entire input sequence into a fixed-size vector. In RNNs, the receptive field of a node grows linearly with the number of recursive applications. However in GNNs, the bottleneck is asymptotically more harmful, because the receptive field of a node grows exponentially. This difference is illustrated in Figure 1.
|
| 25 |
+
|
| 26 |
+
This work does not aim to propose a new GNN variant. Rather, our main contribution is introducing the over-squashing phenomenon – a novel explanation for the major and well-known issue of training GNNs for long-range problems, and showing its harmful practical implications. We use a controlled problem to demonstrate how over-squashing prevents GNNs from fitting long-range patterns in the data, and to provide theoretical lower bounds for the required hidden size given the problem radius (Section 5). We show, analytically and empirically, that GCN (Kipf and Welling, 2017) and GIN (Xu et al., 2019) are susceptible to over-squashing more than other types of GNNs such as GAT (Velickovi ˇ c et al., 2018) and GGNN (Li et al., 2016). We further show that prior work that extensively ´ tuned GNNs to real-world datasets suffer from over-squashing: breaking the bottleneck using a simple fully adjacent layer reduces the error rate by $42 \%$ in the QM9 dataset, by $12 \%$ in ENZYMES, by $4 . 8 \%$ in NCI1, and improves accuracy in VARMISUSE, without any additional tuning.
|
| 27 |
+
|
| 28 |
+
# 2 PRELIMINARIES
|
| 29 |
+
|
| 30 |
+
A directed graph $\mathcal { G } = ( \nu , \mathcal { E } )$ contains nodes $\nu$ and edges $\mathcal { E }$ , where $( u , v ) \in \mathcal { E }$ denotes an edge from a node $u$ to a node $v$ . For brevity, in the following definitions we treat all edges as having the same type; in general, every edge can have a type and features (Schlichtkrull et al., 2018).
|
| 31 |
+
|
| 32 |
+
Graph neural networks Graph neural networks operate by propagating neural messages between neighboring nodes. At every propagation step (a graph layer): the network computes each node’s sent message; every node aggregates its received messages; and each node updates its representation by combining the aggregated incoming messages with its own previous representation.
|
| 33 |
+
|
| 34 |
+
Formally, each node is associated with an initial representation $\mathbf { h } _ { v } ^ { ( 0 ) } \in \mathcal { R } ^ { d _ { 0 } }$ . This representation is usually derived from the node’s label or its given features. Then, a GNN layer updates each node’s representation given its neighbors, yielding $\mathbf { h } _ { v } ^ { ( 1 ) } \in \mathcal { R } ^ { d }$ . In general, the $k$ -th layer of a GNN is a parametric function $f _ { k }$ that is applied to each node by considering its neighbors:
|
| 35 |
+
|
| 36 |
+

|
| 37 |
+
Figure 2: The NEIGHBORSMATCH: green nodes $\textcircled{4}$ , $\textcircled{8}$ , $\textcircled{ C} )$ have blue neighbors $\textcircled{)}$ and an alphabetical label. The goal is to predict the label (A, B, or C) of the green node that has the same number of blue neighbors as the target node $\textcircled{2}$ in the same graph. In this example, the correct label is $\mathbf { C }$ , because the target node has two blue neighbors, like the node marked with $\textrm { C }$ in the same graph.
|
| 38 |
+
|
| 39 |
+
$$
|
| 40 |
+
\mathbf h _ { v } ^ { ( k ) } = f _ { k } \left( \mathbf h _ { v } ^ { ( k - 1 ) } , \{ \mathbf h _ { u } ^ { ( k - 1 ) } \ | \ u \in \mathcal N _ { v } \} ; \theta _ { k } \right)
|
| 41 |
+
$$
|
| 42 |
+
|
| 43 |
+
where $\mathcal { N } _ { v }$ is the set of nodes that have edges to $v$ : $\mathcal { N } _ { v } = \{ u \in \mathcal { V } | ( u , v ) \in \mathcal { E } \}$ . The total number of layers $K$ is usually determined empirically as a hyperparameter.
|
| 44 |
+
|
| 45 |
+
The design of the function $f$ is what mostly distinguishes one type of GNN from the other. For example, graph convolutional networks (GCN) define $f$ as:
|
| 46 |
+
|
| 47 |
+
$$
|
| 48 |
+
\mathbf { h } _ { v } ^ { ( k ) } = \sigma \left( \sum _ { u \in \mathcal { N } _ { v } \cup \{ v \} } \frac { 1 } { c _ { u , v } } W ^ { ( k ) } \mathbf { h } _ { u } ^ { ( k - 1 ) } \right)
|
| 49 |
+
$$
|
| 50 |
+
|
| 51 |
+
where $\sigma$ is a nonlinearity such as $R e L U$ , and $c _ { u , v }$ is a normalization factor often set to $\sqrt { \left| \mathcal { N } _ { v } \right| \cdot \left| \mathcal { N } _ { u } \right| }$ or $| \mathcal { N } _ { v } |$ (Hamilton et al., 2017). As another example, graph isomorphism networks (GIN) (Xu et al., 2019) update a node’s representation using the following definition:
|
| 52 |
+
|
| 53 |
+
$$
|
| 54 |
+
\mathbf { h } _ { v } ^ { ( k ) } = M L P ^ { ( k ) } \left( \left( 1 + \epsilon ^ { ( k ) } \right) \mathbf { h } _ { v } ^ { ( k - 1 ) } + \sum _ { u \in \mathcal { N } _ { v } } \mathbf { h } _ { u } ^ { ( k - 1 ) } \right)
|
| 55 |
+
$$
|
| 56 |
+
|
| 57 |
+
Usually, the last ( $K$ -th) layer’s output is used for prediction: in node-prediction, $\mathbf { h } _ { v } ^ { ( K ) }$ is used to predict a label for $v$ ; in graph-prediction, a permutation-invariant “readout” function aggregates the nodes of the final layer using summation, averaging, or a weighted sum (Li et al., 2016).
|
| 58 |
+
|
| 59 |
+
# 3 THE GNN BOTTLENECK
|
| 60 |
+
|
| 61 |
+
Given a graph $\mathcal { G } = ( \nu , \mathcal { E } )$ and a given node $v$ , we denote the problem’s required range of interaction, the problem radius, by $r , \ r$ is generally unknown in advance, and usually approximated empirically by tuning the number of layers $K$ . We denote the set of nodes in the receptive field of $v$ by $\mathcal { N } _ { v } ^ { \breve { K } }$ , which is defined recursively as $\mathcal { N } _ { v } ^ { 1 } : = \mathcal { N } _ { v }$ and $\mathcal { N } _ { v } ^ { K } : = \mathcal { N } _ { v } ^ { K - 1 } \cup \{ w \mid ( w , u ) \in \mathcal { E } \wedge u \in \mathcal { N } _ { v } ^ { K ^ { - 1 } } \}$ .
|
| 62 |
+
|
| 63 |
+
When a prediction problem relies on long-range interaction between nodes, the GNN must have as many layers $K$ as the estimated range of these interactions, or otherwise, these distant nodes would not be able to interact. It is thus required that $K \geq r$ . However, the number of nodes in each node’s receptive field grows exponentially with the number of layers: $\left| \mathcal { N } _ { v } ^ { K } \right| = \mathcal { O } \left( \exp \left( K \right) \right)$ (Chen et al., 2018). As a result, an exponentially-growing amount of information is squashed into a fixed-length vector (the vector resulting from the $\bar { \sum }$ in Equations (2) and (3)), and crucial messages fail to reach their distant destinations. Instead, the model learns only short-ranged signals from the training data and consequently might generalize poorly at test time.
|
| 64 |
+
|
| 65 |
+
Example Consider the NEIGHBORSMATCH problem of Figure 2. Green nodes $( \textcircled { \textbf { A } } , \textcircled { \textbf { B } } , \textcircled { \textbf { C } } )$ have a varying number of blue neighbors $\textcircled{)}$ and an alphabetical label. Each example in the dataset is a different graph that has a different mapping from numbers of neighbors to labels. The rest of the graph (marked as ) represents a general, unknown, graph structure. The goal is to predict a label for the target node, which is marked with a question mark $\textcircled{2}$ , according to its number of blue neighbors. The correct answer is C in this case, because the target node has two blue neighbors, like the node marked with C in the same graph. Every example in the dataset has a different mapping from numbers of neighbors to labels, and thus message propagation and matching between the target node and all the green nodes must be performed for every graph in the dataset.
|
| 66 |
+
|
| 67 |
+
Since the model must propagate information from all green nodes before predicting the label, a bottleneck at the target node is inevitable. This bottleneck causes over-squashing, which can prevent the model from fitting the training data perfectly. We demonstrate the bottleneck empirically in this problem in Section 4; in Section 5, we provide theoretical lower bounds for the GNN’s hidden size. Obviously, adding direct edges between the target node and the green nodes, or making the existing edges bidirectional, could ease information flow for this specific problem. However, in real-life domains (e.g., molecules), we do not know the optimal message propagation structure a priori, and must use the given relations (such as bonds between atoms) as the graph’s edges.
|
| 68 |
+
|
| 69 |
+
Although this is a contrived problem, it resembles real-world problems that are often modeled as graphs. For example, a computer program in a language such as Python may declare multiple variables (i.e., the green nodes in Figure 2) along with their types and values (their numbers of blue neighbors in Figure 2); later in the program, predicting which variable should be used in a specific location (predict the alphabetical label in Figure 2) must use one of the variables that are available in scope based on the required type and the required value at that point. We experiment with this VARMISUSE problem in Section 4.4.
|
| 70 |
+
|
| 71 |
+
Short- vs. long-range problems Much of prior GNN work has focused on problems that were local in nature, with small problem radii, where the underlying inductive bias was that a node’s most relevant context is its local neighborhood, and long-range interaction was not necessarily needed. With the growing popularity of GNNs, their adoption expanded to domains that required longer-range information propagation as well, without addressing the inherent bottleneck. In this paper, we focus on problems that require long-range information. That is, a correct prediction requires considering the local environment of a node and interactions beyond the close neighborhood. For example, a chemical property of a molecule (Ramakrishnan et al., 2014; Gilmer et al., 2017) can depend on the combination of atoms that reside in the molecule’s opposite sides. Problems of this kind require long-range interaction, and thus, a large number of GNN layers. Since the receptive field of each node grows exponentially with the number of layers, the more layers – over-squashing is more harmful.
|
| 72 |
+
|
| 73 |
+
In problems that are local in nature (small $r$ ) – the bottleneck is less troublesome, because a GNN can perform well with only few layers (e.g., $K { = } 2$ layers in Kipf and Welling (2017)), and the receptive field of a node can be exponentially smaller. Domains such as citation networks (Sen et al., 2008), social networks (Leskovec and Mcauley, 2012), and product recommendations (Shchur et al., 2018) usually raise short-range problems and are thus not the focus of this paper. So, how long is long-range? We discuss and analyze this question in Section 5.
|
| 74 |
+
|
| 75 |
+
# 4 EVALUATION
|
| 76 |
+
|
| 77 |
+
First, we wish to empirically show that the GNN bottleneck exists, and find the smallest values of $r$ that raise over-squashing. We generated a synthetic benchmark that is theoretically solvable; however, in practice, all GNNs fail to reach $100 \%$ training accuracy because of the bottleneck (Section 4.1). Second, we examine whether the bottleneck exists in prior work, which addressed real-world problems (Sections 4.2 to 4.4).
|
| 78 |
+
|
| 79 |
+
# 4.1 SYNTHETIC BENCHMARK: NEIGHBORSMATCH
|
| 80 |
+
|
| 81 |
+
The NEIGHBORSMATCH problem (Figure 2) is a contrived problem that we designed to provide an intuition to the extent of the effect of over-squashing, while allowing us to control the problem radius $r$ , and thus control the intensity of over-squashing. We focus on the training accuracy of a model, to show that over-squashing prevents models from fitting long-range signals in the training set.
|
| 82 |
+
|
| 83 |
+
TREE-NEIGHBORSMATCH From the perspective of a single node $v$ , the rest of the graph may look like a tree of height $K$ , rooted at $v$ ( $\mathrm { { X u } }$ et al., 2018; Garg et al., 2020). To simulate this exponentially-growing receptive field, we created an instance of the general NEIGHBORSMATCH problem that we described in Section 3 and portrayed in Figure 2. We instantiated the subgraph in the middle of the graph (marked as $\textcircled{8}$ in Figure 2) as a binary tree of depth depth where the green nodes are its leaves, and the target node is the tree’s root. All edges are directed toward the root, such that information is propagated from all nodes toward the target node. The goal, as in Section 3, is to predict a label for the target node, where the correct answer is the label of the green node that has the same number of blue neighbors as the target node. An illustration is shown in Figure 5 in the appendix. This allows us to control the problem radius, i.e., $\begin{array} { r } { r = d e p t h { } } \end{array}$ . In this section we observe the bottleneck empirically; in Section 5 we provide a lower bound for the GNN’s hidden size given $r$
|
| 84 |
+
|
| 85 |
+
Model We implemented a network with $r { \mathrm { + } } 1$ graph layers to allow an additional nonlinearity after the information from the leaves reaches the target node. Our PyTorch Geometric (Fey and Lenssen, 2019) implementation is available at https://github.com/tech-srl/bottleneck/. Our training configuration and hyperparameter ranges are detailed in Appendix A.
|
| 86 |
+
|
| 87 |
+
Results Figure 3 shows the following surprising results: some GNNs fail to fit the dataset starting from $r { = } 4$ . For example, the training accuracy of GCN (Kipf and Welling, 2017) at $r { = } 4$ is $70 \%$ . At $r { = } 5$ , all GNNs fail to perfectly fit the data. Starting from $r { = } 4$ , the models suffered from oversquashing that resulted in underfitting: the bottleneck prevented the models from distinguishing between different training examples, even after they were observed tens of thousands of times. These results clearly show the existence of over-squashing, starting from $r { = } 4$ .
|
| 88 |
+
|
| 89 |
+

|
| 90 |
+
Figure 3: Accuracy across problem radius (tree depth) in the NEIGHBORSMATCH problem. Over-squashing starts to affect GCN and GIN even at $r = 4$ .
|
| 91 |
+
|
| 92 |
+
Why did some GNNs perform better than others? GCN and GIN managed to perfectly fit $r { = } 3$ at most, while GGNN and GAT also reached $100 \%$ accuracy at $r { = } 4$ . This difference can be explained by their neighbor aggregation computation: consider the target node that receives messages in the $r ^ { \mathrm { : } }$ ’th step. GCN and GIN aggregate all neighbors before combining them with the target node’s representation; they thus must compress the information flowing from all leaves into a single vector, and only afterward interact with the target node’s own representation (Equations (2) and (3)). In contrast, GAT uses attention to weight incoming messages given the target’s representation: at the last layer only, the target node can ignore the irrelevant incoming edge, and absorb only the relevant incoming edge, which contains information flowing from half of the leaves. That is, a single vector compresses only half of the information. Since the number of leaves grows exponentially with $r$ , it is expected that GNNs that need to compress only half of the information (GGNN and GAT) will succeed at an $r$ that is larger by 1. Following Levy et al. (2018), we hypothesize that the GRU cell in GGNNs filters incoming edges as GAT, but perform this filtering as element-wise attention.
|
| 93 |
+
|
| 94 |
+
If all GNNs have reached low training accuracy, how do GNN-based models usually do fit the training data in public datasets of long-range problems? We hypothesize that they overfit shortrange signals and artifacts from the training set, rather than learning the long-range information that was squashed in the bottleneck, and thus generalize poorly at test time.
|
| 95 |
+
|
| 96 |
+
# 4.2 QUANTUM CHEMISTRY: QM9
|
| 97 |
+
|
| 98 |
+
We wish to measure over-squashing in existing models. But, how can we measure over-squashing? Instead, we measure whether breaking the bottleneck improves the results of long-range problems.
|
| 99 |
+
|
| 100 |
+
Adding a fully-adjacent layer (FA) In Sections 4.2 to 4.4, we took extensively tuned models from previous work, and modified adjacency in the last layer: given a GNN with $K$ layers, we modified the $K$ -th layer to be a fully-adjacent layer (FA). A fully-adjacent layer is a GNN layer in which every pair of nodes is connected by an edge. In terms of Equations (1) to (3), converting an existing layer to be fully-adjacent means that $\mathcal { N } _ { v } : = \mathcal { V }$ for every node $v \in \mathcal V$ , in that layer only. This does not change the type of layer nor add weights, but only changes adjacency of a data sample in a single layer. Thus, the $K - 1$ graph layers exploit the graph structure using their original sparse topology, and only the
|
| 101 |
+
|
| 102 |
+
Table 1: Average error rates (5 runs $\pm$ stdev for each property) on the QM9 dataset. The best result for every property in every GNN type is highlighted in bold. Results marked with $\dagger$ were previously reported by Brockschmidt (2020) and reproduced by us.
|
| 103 |
+
|
| 104 |
+
<table><tr><td rowspan="2">Property</td><td colspan="2">R-GIN</td><td colspan="2">R-GAT</td><td colspan="2">GGNN</td></tr><tr><td>baset</td><td>+FA</td><td>baset</td><td>+FA</td><td>baset</td><td>+FA</td></tr><tr><td>mu</td><td>2.64±0.11</td><td>2.54±0.09</td><td>2.68±0.06</td><td>2.73±0.07</td><td>3.85±0.16</td><td>3.53±0.13</td></tr><tr><td>alpha</td><td>4.67±0.52</td><td>2.28±0.04</td><td>4.65±0.44</td><td>2.32±0.16</td><td>5.22±0.86</td><td>2.72±0.12</td></tr><tr><td>HOMO</td><td>1.42±0.01</td><td>1.26±0.02</td><td>1.48±0.03</td><td>1.43±0.02</td><td>1.67±0.07</td><td>1.45±0.04</td></tr><tr><td>LUMO</td><td>1.50±0.09</td><td>1.34±0.04</td><td>1.53±0.07</td><td>1.41±0.03</td><td>1.74±0.06</td><td>1.63±0.06</td></tr><tr><td>gap</td><td>2.27±0.09</td><td>1.96±0.04</td><td>2.31±0.06</td><td>2.08±0.05</td><td>2.60±0.06</td><td>2.30±0.05</td></tr><tr><td>R2</td><td>15.63±1.40</td><td>12.61±0.37</td><td>52.39 ±42.5</td><td>15.76±1.17</td><td>35.94±35.7</td><td>14.33±0.47</td></tr><tr><td>ZPVE</td><td>12.93±1.81</td><td>5.03±0.36</td><td>14.87±2.88</td><td>5.98±0.43</td><td>17.84±3.61</td><td>5.24±0.30</td></tr><tr><td>UO</td><td>5.88±1.01</td><td>2.21±0.12</td><td>7.61±0.46</td><td>2.19±0.25</td><td>8.65±2.46</td><td>3.35±1.68</td></tr><tr><td>U</td><td>18.71±23.36</td><td>2.32±0.18</td><td>6.86±0.53</td><td>2.11±0.10</td><td>9.24±2.26</td><td>2.49±0.34</td></tr><tr><td>H</td><td>5.62±0.81</td><td>2.26±0.19</td><td>7.64±0.92</td><td>2.27±0.29</td><td>9.35±0.96</td><td>2.31±0.15</td></tr><tr><td>G</td><td>5.38±0.75</td><td>2.04±0.24</td><td>6.54±0.36</td><td>2.07±0.07</td><td>7.14±1.15</td><td>2.17±0.29</td></tr><tr><td>Cv</td><td>3.53±0.37</td><td>1.86±0.03</td><td>4.11±0.27</td><td>2.03±0.14</td><td>8.86±9.07</td><td>2.25±0.20</td></tr><tr><td>Omega</td><td>1.05±0.11</td><td>0.80±0.04</td><td>1.48±0.87</td><td>0.73±0.04</td><td>1.57±0.53</td><td>0.87±0.09</td></tr><tr><td>Relative:</td><td></td><td>-39.54%</td><td></td><td>-44.58%</td><td></td><td>-47.42%</td></tr></table>
|
| 105 |
+
|
| 106 |
+
$K$ -th layer is an FA layer that allows the topology-aware node-representations to interact directly and consider nodes beyond their original neighbors. Hopefully, this would ease information flow, prevent over-squashing, and reduce the effect of the previously-existed bottleneck. We re-trained the models using the authors’ original code, without performing any additional tuning, to rule out hyperparameter tuning as the source of improvement. Statistics of all datasets can be found in Appendix D.
|
| 107 |
+
|
| 108 |
+
We note that an FA layer is a simple solution. Its purpose is merely to demonstrate that over-squashing in GNNs is so prevalent and untreated that even the simplest solution helps. Our main contribution is not the solution, but rather, highlighting and explaining the over-squashing problem. This simple solution opens the path for a variety of follow-up improvements and solutions for over-squashing.
|
| 109 |
+
|
| 110 |
+
Data The QM9 dataset (Ramakrishnan et al., 2014; Gilmer et al., 2017; Wu et al., 2018) contains \~130,000 graphs with ${ \sim } 1 8$ nodes. Each graph is a molecule where nodes are atoms, and undirected, typed edges are different types of bonds between the atoms. The goal is to regress each graph to 13 real-valued quantum chemical properties such as dipole moment and isotropic polarizability.
|
| 111 |
+
|
| 112 |
+
Models We modified the implementation of Brockschmidt (2020) who performed an extensive hyperparameter tuning for multiple GNNs, by searching over 500 configurations; we took the same splits and their best-found configurations. For most GNNs, Brockschmidt found that the best results are achieved using $K { = } 8$ layers. This hints that this problem depends on long-range information and relies on both graph structure and distant nodes. We re-trained each modified model for each target property using the same code, configuration, and training scheme as Brockschmidt (2020), training each model five times (using different random seeds) for each target property task. We compare the “base” models, reported by Brockschmidt, with our modified and re-trained $ { \mathrm { \^ 6 + F A } } ^ { { \gamma } }$ models.
|
| 113 |
+
|
| 114 |
+
Results Results for the top GNNs are shown in Table 1. The main results are that breaking the bottleneck by modifying a single layer to be an FA layer significantly reduces the error rate, by $42 \%$ on average, across six GNN types. These experiments clearly show evidence for a bottleneck in the original GNN models. Results for the other GNNs are shown in Appendix B due to space limitation.
|
| 115 |
+
|
| 116 |
+
Over-squashing or under-reaching? Barceló et al. (2020) discuss the inability of a GNN node to observe nodes that are farther away than the number of layers $K$ . We denote this limitation as underreaching: for every fixed number of layers $K$ , local information cannot travel farther than distance $K$ along edges. So, was the improvement of the FA layer in Table 1 achieved thanks to the reduction in over-squashing, or did the FA layer only extend the nodes’ reachability and prevent under-reaching? To answer this, we measured the graphs’ diameter in the QM9 dataset – the maximum shortest path between any two nodes in a graph. We found that the average diameter is $6 . 3 5 { \pm } 0 . 9 1 $ , the maximum diameter is 10, and the 90’th percentile is 8, while most models were trained with $K { = } 8$ layers. That is, at least $90 \%$ of the examples in the dataset certainly did not suffer from under-reaching, because the number of layers was greater or equal than their diameter. We trained another set of models with 10 layers, which did not show an improvement over the base models. We conclude that the source of improvement was clearly not the increased reachability, but instead, the reduction in over-squashing.
|
| 117 |
+
|
| 118 |
+
Table 2: Average accuracy (30 runs $\pm$ stdev) on the biological datasets. $\dagger -$ previously reported by Errica et al. (2020).
|
| 119 |
+
|
| 120 |
+
<table><tr><td colspan="2"></td><td>NCI1</td><td>ENZYMES</td></tr><tr><td>No Struct</td><td></td><td>69.8±2.2</td><td>65.2±6.4</td></tr><tr><td>DiffPool</td><td>baset +FA</td><td>76.9±1.9 77.6±1.3</td><td>59.5±5.6 65.7±4.8</td></tr><tr><td>GraphSAGE</td><td>baset +FA</td><td>76.0±1.8 77.7±1.8</td><td>58.2±6.0 60.8±4.5</td></tr><tr><td>DGCNN</td><td>base† +FA</td><td>76.4±1.7 76.8±1.5</td><td>38.9±5.7 42.8±5.3</td></tr><tr><td>GIN</td><td>baset +FA</td><td>80.0±1.4 81.5±1.2</td><td>59.6±4.5 67.7±5.3</td></tr></table>
|
| 121 |
+
|
| 122 |
+
Table 3: Average accuracy (5 runs±stdev) on VARMISUSE. † – previously reported by Brockschmidt (2020).
|
| 123 |
+
|
| 124 |
+
<table><tr><td colspan="3">SeenProj</td><td>UnseenProj</td></tr><tr><td rowspan="2">+ GGNN</td><td>baset</td><td>85.7±0.5</td><td>79.3±1.2</td></tr><tr><td>+FA</td><td>86.3±0.7</td><td>79.1±1.1</td></tr><tr><td rowspan="2">R-GCN</td><td>baset</td><td>88.3±0.4</td><td>82.9±0.8</td></tr><tr><td>+FA</td><td>88.4±0.7</td><td>83.8±1.0</td></tr><tr><td rowspan="2">R-GIN</td><td>baset</td><td>87.1±0.1</td><td>81.1±0.9</td></tr><tr><td>+FA</td><td>87.5±0.7</td><td>81.7±1.2</td></tr><tr><td rowspan="2">GNN-MLP</td><td>baset</td><td>86.9±0.3</td><td>81.4±0.7</td></tr><tr><td>+FA</td><td>87.3±0.2</td><td>81.2±0.5</td></tr><tr><td rowspan="2">R-GAT</td><td>baset</td><td>86.9±0.7</td><td>81.2±0.9</td></tr><tr><td>+FA</td><td>87.9±1.0</td><td>82.0±1.9</td></tr></table>
|
| 125 |
+
|
| 126 |
+
Can larger hidden sizes achieve a similar improvement? We trained another set of models with doubled dimensions. These models achieved only $5 . 5 \%$ improvement over the base model (Appendix B.2), while adding the FA layer achieved $42 \%$ improvement using the original dimensions and without adding weights. Consistently, in Section 5 we present an analysis that shows how dimensionality increase is ineffective in preventing over-squashing.
|
| 127 |
+
|
| 128 |
+
Is the entire FA layer needed? We experimented with using only a sampled fraction of edges in the FA layer. As Appendix B.3 shows, the fraction of added edges in the last layer correlates with the decrease in error. For example, using only half of the possible edges in the last layer (a “semi-adjacent” layer) still reduces the error rate by $3 1 . 5 \%$ on average compared to “base”.
|
| 129 |
+
|
| 130 |
+
If all GNNs benefitted from direct interaction between all nodes, maybe the graph structure is not even needed? We trained another set of models (Appendix B.2) where all $K$ layers are FA layers, thus ignoring the original graph topology; these models produced $1 5 0 0 \%$ higher (worse) error.
|
| 131 |
+
|
| 132 |
+
# 4.3 BIOLOGICAL BENCHMARKS
|
| 133 |
+
|
| 134 |
+
Data The NCI1 dataset (Wale et al., 2008) contains 4110 graphs with ${ \sim } 3 0 $ nodes on average, and its task is to predict whether a biochemical compound contains anti-lung-cancer activity. ENZYMES (Borgwardt et al., 2005) contains 600 graphs with ${ \sim } 3 6$ nodes on average, and its task is to classify an enzyme to one out of six classes. We used the same 10-folds and split as Errica et al. (2020).
|
| 135 |
+
|
| 136 |
+
Models We used the implementation of Errica et al. (2020) who performed a fair and thorough comparison between GNNs. The final reported result is the average of 30 test runs (10 folds $\times 3$ random seeds). Additional training details are provided in Appendix C.
|
| 137 |
+
|
| 138 |
+
In ENZYMES, Errica et al. found that a baseline that does not use the graph topology at all (“No Struct”) performs better than all GNNs. In NCI1, GIN performed best. We converted the last layer into an FA layer by modifying the implementation of Errica et al., and repeated the same training procedure. We compare the “base” models from Errica et al. with our re-trained $\cdot _ { \mathrm { + F A } } ,$ models.
|
| 139 |
+
|
| 140 |
+
Results Results are shown in Table 2. The main results are as follows: (a) in NCI1, $\mathrm { G I N + F A }$ improves by $1 . 5 \%$ over GIN-base, which was previously the best performing model; (b) in ENZYMES, where Errica et al. (2020) found that none of the GNNs exploit the topology of the graph, we find that $\mathrm { G I N + F A }$ does exploit the structure and improves by $8 . 1 \%$ over GIN-base and by $2 . 5 \%$ over No Struct.
|
| 141 |
+
|
| 142 |
+
On average, models with FA layers relatively reduce the error rate by $12 \%$ in ENZYMES and by $4 . 8 \%$ in NCI1. These experiments clearly show evidence for a bottleneck in the original GNN models.
|
| 143 |
+
|
| 144 |
+
# 4.4 PROGRAMS: VARMISUSE
|
| 145 |
+
|
| 146 |
+
Data VARMISUSE (Allamanis et al., 2018) is a node-prediction problem that depends on long-range information in computer programs. We used the same splits as Allamanis et al. (2018).
|
| 147 |
+
|
| 148 |
+
Models We use the implementation of Brockschmidt (2020) who performed an extensive hyperparameter tuning by searching over 30 configurations for each GNN type. The best results were found using 6-10 layers, which hints that this problem requires long-range information. We modified the last layer to be an FA layer, and used the resulting representations for node classification. We used the same best found configurations as Brockschmidt (2020) add re-trained each model five times.
|
| 149 |
+
|
| 150 |
+
Results Results are shown in Table 3. The main result is that adding an FA layer to all GNNs improves their SeenProjTest accuracy, obtaining a new state-of-the-art of $8 8 . 4 \%$ . In the UnseenProjTest set, adding an an FA layer improves the results of some of most of the GNNs, obtaining a new stateof-the-art of $8 3 . 8 \%$ . These improvements are significant, especially since they were achieved on extensively tuned models, without any further tuning by us.
|
| 151 |
+
|
| 152 |
+
# 5 HOW LONG IS LONG-RANGE?
|
| 153 |
+
|
| 154 |
+
In this section, we analyze oversquashing combinatorially in the TREE-NEIGHBORSMATCH problem. We provide a combinatorial lower bound for the minimal hidden size that a GNN requires to perfectly fit the data (learn to $100 \%$ training accuracy) given its problem radius $r$ . We denote the arity of such a tree by $m$ ${ \bf \omega } ( = 2$ in our experiments); the counting base as $b { = } 2$ ; the number of bits in a floating-point variable as $f { = } 3 2$ ; and the hidden dimension of the GNN, i.e., the size of a node vector $\mathbf { h } _ { v } ^ { ( k ) }$ , as $d$ .
|
| 155 |
+
|
| 156 |
+

|
| 157 |
+
Figure 4: Combinatorial and empirical lower bounds of the model dimension given the problem radius.
|
| 158 |
+
|
| 159 |
+
A full tree of arity $m$ and problem radius $r { = }$ depth has $m ^ { r }$ green label-nodes. All $( m ^ { r } ) !$ ! possible permutations of the labels $\{ \mathbf { A } , \mathbf { B } , \mathbf { C } , \mathbf { \Psi } . . . \}$ are valid, disregarding the
|
| 160 |
+
|
| 161 |
+
order of sibling nodes. Thus, the number of label assignments of green nodes is $( m ^ { r } ) ! / \left( m ! \right) ^ { m ^ { r } - 1 }$ (there are $m ^ { r } - 1$ parent nodes, where the order of each of their $m$ siblings can be permutated). Right before interacting with the target node and predicting the label, a single vector of size $d$ must encapsulate the information flowing from all green nodes (Equations (2) and (3)).1 Such a vector contains $d$ floating-point elements, each of them is stored as $f$ bits. Overall, the number of possible cases that this vector can distinguish between is $b ^ { f \cdot d }$ . The number of possible cases that the vector can distinguish between must be greater than the number of different examples that this vector may encounter in the training data. This requirement is expressed in Equation (4). Considering binary trees $( m { = } 2 )$ , and floating-point values of $f { = } 3 2$ binary $\scriptstyle ( b = 2 )$ bits, we get Equation (5):
|
| 162 |
+
|
| 163 |
+
$$
|
| 164 |
+
b ^ { f \cdot d } > \frac { ( m ^ { r } ) ! } { { ( m ! ) } ^ { m ^ { r } - 1 } }
|
| 165 |
+
$$
|
| 166 |
+
|
| 167 |
+
$$
|
| 168 |
+
2 ^ { 3 2 \cdot d } > \frac { ( 2 ^ { r } ) ! } { 2 ^ { 2 ^ { r } - 1 } }
|
| 169 |
+
$$
|
| 170 |
+
|
| 171 |
+
Since factorial grows faster than an exponent with a constant base, a small increase in $r$ requires a much larger increase in $d$ . Specifically, for $d { = } 3 2$ as in the experiments in Section 4.1, the maximal problem radius is as low as $r { = } 7$ . That is, a model with $d { = } 3 2$ cannot obtain $100 \%$ accuracy for $r { > } 7$
|
| 172 |
+
|
| 173 |
+
In practice, the problem is worse; i.e., the empirical minimal $d$ is higher than the combinatorial, because even if a solution to storing some information in a vector of a certain size exists, a gradient descent-based algorithm is not guaranteed to find it. Figure 4 shows the combinatorial lower bound of $d$ given $r$ . We also repeated the experiments from Section 4.1 and report the minimal empirical $d$ for each value of $r$ . As shown in Figure 4, the empirical and the theoretical minimal $d$ grow exponentially with $r$ ; for example, even $d { = } 5 1 2$ can empirically fit $r { = } 7$ at most.
|
| 174 |
+
|
| 175 |
+
# 6 RELATED WORK
|
| 176 |
+
|
| 177 |
+
Under-reaching Barceló et al. (2020) found that the expressiveness of GNNs captures only a small fragment of first-order logic. The main limitation arises from the inability of a node to be aware of nodes that are farther away than the number of layers $K$ , while the existence of such nodes can be easily described using logic. We denote this limitation as under-reaching. Nevertheless, even when information is reachable within $K$ edges, we show that this information might be over-squashed along the way. Thus, the over-squashing limitation described in this paper is tighter than under-reaching.
|
| 178 |
+
|
| 179 |
+
Over-smoothing As observed before, node representations become indistinguishable and prediction performance severely degrades as the number of layers increases. The accepted explanation to this phenomenon is over-smoothing (Li et al., 2018; Wu et al., 2020; Oono and Suzuki, 2020). This might explain the empirical optimality of few layers in short-range tasks (e.g., only $K { = } 2$ layers in Kipf and Welling (2017)). Nonetheless, some problems depend on longer-range information propagation and thus require more layers, to avoid under-reaching. We hypothesize that in long-range problems, the explanation for the degraded performance is over-squashing rather than over-smoothing. For further discussion of over-smoothing vs. over-squashing, see Appendix E.
|
| 180 |
+
|
| 181 |
+
Avoiding over-squashing Some previous work avoid over-squashing by various profitable means: Gilmer et al. (2017) add “virtual edges” to shorten long distances; Scarselli et al. (2008) add “supersource nodes”; and Allamanis et al. (2018) designed program analyses that serve as 16 “shortcut” edge types. However, none of these explicitly explained these solutions using over-squashing, and did not identify the bottleneck and its negative cross-domain implications.
|
| 182 |
+
|
| 183 |
+
# 7 CONCLUSION
|
| 184 |
+
|
| 185 |
+
We propose a novel explanation to a well known limitation in training graph neural networks: a bottleneck that causes over-squashing. Problems that depend on long-range interaction require as many GNN layers as the desired radius of each node’s receptive field. This causes an exponentiallygrowing amount of information to be squashed into a fixed-length vector. As a result, the GNN fails to propagate long-range information, learns only short-range signals from the training data instead, and performs poorly when the prediction task depends on long-range interaction.
|
| 186 |
+
|
| 187 |
+
We demonstrate the existence of the bottleneck in a controlled problem, provide theoretical lower bounds for the hidden size given the problem radius, and show that GCN and GIN are more susceptible to over-squashing than GAT and GGNN. We further show that prior models of chemical, biological and programmatical benchmarks suffer from over-squashing by showing that they can be dramatically improved using a simple FA layer. We conclude that over-squashing in GNNs is so prevalent and untreated in some benchmarks – that even the simplest solution helps. Our observations open the path for a variety of follow-up improvements and even better solutions for over-squashing.
|
| 188 |
+
|
| 189 |
+
# ACKNOWLEDGMENTS
|
| 190 |
+
|
| 191 |
+
We would like to thank Federico Errica and Marc Brockschmidt for their help in using their frameworks. We are also grateful to (alphabetically): Chen Zarfati, Elad Nachmias, Gail Weiss, Horace He, Jorge Perez, Lotem Fridman, Moritz Plenz, Pavol Bielik, Petar Velickovi ˇ c, Roy Sadaka, Shaked ´ Brody, Yoav Goldberg, and the anonymous reviewers for their useful comments and suggestions.
|
| 192 |
+
|
| 193 |
+
# REFERENCES
|
| 194 |
+
|
| 195 |
+
Miltiadis Allamanis, Marc Brockschmidt, and Mahmoud Khademi. Learning to represent programs with graphs. In International Conference on Learning Representations, 2018. URL https: //openreview.net/forum?id $\equiv$ BJOFETxR-.
|
| 196 |
+
|
| 197 |
+
Pablo Barceló, Egor V. Kostylev, Mikael Monet, Jorge Pérez, Juan Reutter, and Juan Pablo Silva. The logical expressiveness of graph neural networks. In International Conference on Learning Representations, 2020. URL https://openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ r1lZ7AEKvB.
|
| 198 |
+
|
| 199 |
+
Karsten M Borgwardt, Cheng Soon Ong, Stefan Schönauer, SVN Vishwanathan, Alex J Smola, and Hans-Peter Kriegel. Protein function prediction via graph kernels. Bioinformatics, 21(suppl_1): i47–i56, 2005.
|
| 200 |
+
|
| 201 |
+
Marc Brockschmidt. Gnn-film: Graph neural networks with feature-wise linear modulation. Proceedings of the 36th International Conference on Machine Learning, ICML, 2020.
|
| 202 |
+
|
| 203 |
+
Deli Chen, Yankai Lin, Wei Li, Peng Li, Jie Zhou, and Xu Sun. Measuring and relieving the oversmoothing problem for graph neural networks from the topological view. In Proceedings of the Thirty-Fourth Conference on Association for the Advancement of Artificial Intelligence (AAAI), 2020a.
|
| 204 |
+
|
| 205 |
+
Jianfei Chen, Jun Zhu, and Le Song. Stochastic training of graph convolutional networks with variance reduction. In International Conference on Machine Learning, pages 942–950, 2018.
|
| 206 |
+
|
| 207 |
+
Ming Chen, Zhewei Wei, Zengfeng Huang, Bolin Ding, and Yaliang Li. Simple and deep graph convolutional networks. In International Conference on Machine Learning, pages 1725–1735. PMLR, 2020b.
|
| 208 |
+
|
| 209 |
+
Kyunghyun Cho, Bart van Merriënboer, Dzmitry Bahdanau, and Yoshua Bengio. On the properties of neural machine translation: Encoder–decoder approaches. In Proceedings of SSST-8, Eighth Workshop on Syntax, Semantics and Structure in Statistical Translation, pages 103–111, 2014a.
|
| 210 |
+
|
| 211 |
+
Kyunghyun Cho, Bart Van Merriënboer, Caglar Gulcehre, Dzmitry Bahdanau, Fethi Bougares, Holger Schwenk, and Yoshua Bengio. Learning phrase representations using rnn encoder-decoder for statistical machine translation. arXiv preprint arXiv:1406.1078, 2014b.
|
| 212 |
+
|
| 213 |
+
David K Duvenaud, Dougal Maclaurin, Jorge Iparraguirre, Rafael Bombarell, Timothy Hirzel, Alán Aspuru-Guzik, and Ryan P Adams. Convolutional networks on graphs for learning molecular fingerprints. In Advances in neural information processing systems, pages 2224–2232, 2015.
|
| 214 |
+
|
| 215 |
+
Federico Errica, Marco Podda, Davide Bacciu, and Alessio Micheli. A fair comparison of graph neural networks for graph classification. In International Conference on Learning Representations, 2020. URL https://openreview.net/forum?id ${ . } = { }$ HygDF6NFPB.
|
| 216 |
+
|
| 217 |
+
Matthias Fey and Jan E. Lenssen. Fast graph representation learning with PyTorch Geometric. In ICLR Workshop on Representation Learning on Graphs and Manifolds, 2019.
|
| 218 |
+
|
| 219 |
+
Vikas K Garg, Stefanie Jegelka, and Tommi Jaakkola. Generalization and representational limits of graph neural networks. arXiv preprint arXiv:2002.06157, 2020.
|
| 220 |
+
|
| 221 |
+
Justin Gilmer, Samuel S Schoenholz, Patrick F Riley, Oriol Vinyals, and George E Dahl. Neural message passing for quantum chemistry. In Proceedings of the 34th International Conference on Machine Learning-Volume 70, pages 1263–1272. JMLR. org, 2017.
|
| 222 |
+
|
| 223 |
+
Marco Gori, Gabriele Monfardini, and Franco Scarselli. A new model for learning in graph domains. In Proceedings. 2005 IEEE International Joint Conference on Neural Networks, 2005., volume 2, pages 729–734. IEEE, 2005.
|
| 224 |
+
|
| 225 |
+
Will Hamilton, Zhitao Ying, and Jure Leskovec. Inductive representation learning on large graphs. In Advances in neural information processing systems, pages 1024–1034, 2017.
|
| 226 |
+
|
| 227 |
+
Thomas N Kipf and Max Welling. Semi-supervised classification with graph convolutional networks. In ICLR, 2017.
|
| 228 |
+
|
| 229 |
+
Johannes Klicpera, Aleksandar Bojchevski, and Stephan Günnemann. Predict then propagate: Graph neural networks meet personalized pagerank. In International Conference on Learning Representations, 2018.
|
| 230 |
+
|
| 231 |
+
Jure Leskovec and Julian J Mcauley. Learning to discover social circles in ego networks. In Advances in neural information processing systems, pages 539–547, 2012.
|
| 232 |
+
|
| 233 |
+
Omer Levy, Kenton Lee, Nicholas FitzGerald, and Luke Zettlemoyer. Long short-term memory as a dynamically computed element-wise weighted sum. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 2: Short Papers), pages 732–739, 2018.
|
| 234 |
+
|
| 235 |
+
Qimai Li, Zhichao Han, and Xiao-Ming Wu. Deeper insights into graph convolutional networks for semi-supervised learning. In Thirty-Second AAAI Conference on Artificial Intelligence, 2018.
|
| 236 |
+
|
| 237 |
+
Yujia Li, Daniel Tarlow, Marc Brockschmidt, and Richard Zemel. Gated graph sequence neural networks. In International Conference on Learning Representations, 2016.
|
| 238 |
+
|
| 239 |
+
Alessio Micheli. Neural network for graphs: A contextual constructive approach. IEEE Transactions on Neural Networks, 20(3):498–511, 2009.
|
| 240 |
+
|
| 241 |
+
Kenta Oono and Taiji Suzuki. Graph neural networks exponentially lose expressive power for node classification. In International Conference on Learning Representations, 2020. URL https://openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ S1ldO2EFPr.
|
| 242 |
+
|
| 243 |
+
Raghunathan Ramakrishnan, Pavlo O Dral, Matthias Rupp, and O Anatole Von Lilienfeld. Quantum chemistry structures and properties of 134 kilo molecules. Scientific data, 1:140022, 2014.
|
| 244 |
+
|
| 245 |
+
Yu Rong, Wenbing Huang, Tingyang Xu, and Junzhou Huang. Dropedge: Towards deep graph convolutional networks on node classification. In International Conference on Learning Representations, 2020. URL https://openreview.net/forum?id ${ . } = { }$ Hkx1qkrKPr.
|
| 246 |
+
|
| 247 |
+
Franco Scarselli, Marco Gori, Ah Chung Tsoi, Markus Hagenbuchner, and Gabriele Monfardini. The graph neural network model. IEEE Transactions on Neural Networks, 20(1):61–80, 2008.
|
| 248 |
+
|
| 249 |
+
Michael Schlichtkrull, Thomas N Kipf, Peter Bloem, Rianne Van Den Berg, Ivan Titov, and Max Welling. Modeling relational data with graph convolutional networks. In European Semantic Web Conference, pages 593–607. Springer, 2018.
|
| 250 |
+
|
| 251 |
+
Prithviraj Sen, Galileo Namata, Mustafa Bilgic, Lise Getoor, Brian Galligher, and Tina Eliassi-Rad. Collective classification in network data. AI magazine, 29(3):93–93, 2008.
|
| 252 |
+
|
| 253 |
+
Oleksandr Shchur, Maximilian Mumme, Aleksandar Bojchevski, and Stephan Günnemann. Pitfalls of graph neural network evaluation. Relational Representation Learning Workshop, NeurIPS 2018, 2018.
|
| 254 |
+
|
| 255 |
+
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.
|
| 256 |
+
|
| 257 |
+
Petar Velickovi ˇ c, Guillem Cucurull, Arantxa Casanova, Adriana Romero, Pietro Liò, and Yoshua ´ Bengio. Graph attention networks. In International Conference on Learning Representations, 2018.
|
| 258 |
+
|
| 259 |
+
Nikil Wale, Ian A Watson, and George Karypis. Comparison of descriptor spaces for chemical compound retrieval and classification. Knowledge and Information Systems, 14(3):347–375, 2008.
|
| 260 |
+
|
| 261 |
+
Zhenqin Wu, Bharath Ramsundar, Evan N Feinberg, Joseph Gomes, Caleb Geniesse, Aneesh S Pappu, Karl Leswing, and Vijay Pande. Moleculenet: a benchmark for molecular machine learning. Chemical science, 9(2):513–530, 2018.
|
| 262 |
+
|
| 263 |
+
Zonghan Wu, Shirui Pan, Fengwen Chen, Guodong Long, Chengqi Zhang, and S Yu Philip. A comprehensive survey on graph neural networks. IEEE Transactions on Neural Networks and Learning Systems, 2020.
|
| 264 |
+
|
| 265 |
+
Keyulu Xu, Chengtao Li, Yonglong Tian, Tomohiro Sonobe, Ken-ichi Kawarabayashi, and Stefanie Jegelka. Representation learning on graphs with jumping knowledge networks. In International Conference on Machine Learning, pages 5453–5462, 2018.
|
| 266 |
+
|
| 267 |
+
Keyulu Xu, Weihua Hu, Jure Leskovec, and Stefanie Jegelka. How powerful are graph neural networks? In International Conference on Learning Representations, 2019. URL https: //openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ ryGs6iA5Km.
|
| 268 |
+
|
| 269 |
+
Lingxiao Zhao and Leman Akoglu. Pairnorm: Tackling oversmoothing in gnns. In International Conference on Learning Representations, 2020. URL https://openreview.net/forum? id $=$ rkecl1rtwB.
|
| 270 |
+
|
| 271 |
+

|
| 272 |
+
Figure 5: An example of a TREE-NEIGHBORSMATCH, that is an instance of the general NEIGHBORSMATCH problem that we examine in Section 4. The target node $\textcircled{2}$ is the root of a tree of depth $\mathord { \left. \vert - 3 \right. }$ (from the target node to the green nodes). The green nodes ( $\textcircled{4}$ , $\textcircled{8}$ , $\textcircled{ C}$ , ...) have blue neighbors $\textcircled{)}$ and an alphabetical label. The node $\textcircled{8}$ has a single blue neighbor; the node $\textcircled{ C}$ has two blue neighbors; and the node $\textcircled{ D}$ has no blue neighbors; each other green node has another unique number of blue neighbors. The goal it to predict a label for the target node $\textcircled{2}$ according to its number of blue neighbors. The correct answer is C in this example, because the target node has two blue neighbors, like the green node that is marked with C in the same graph. To make a correct prediction, the network must propagate information from all leaves toward the target node, and make the decision given a single fixed-sized vector that compresses all this information.
|
| 273 |
+
|
| 274 |
+
# A TREE-NEIGHBORSMATCH – TRAINING DETAILS
|
| 275 |
+
|
| 276 |
+
Data We created a separate dataset for every tree depth (which is equal to $r$ , the problem radius) and sampled up to 32,000 examples per dataset. The label of each leaf (“A”, “B”, “C” in Figure 2) is represented as a one-hot vector. To tease the effect of the bottleneck from the ability of a GNN to count neighbors, we concatenated each leaf node’s initial representation with a 1-hot vector representing the number of blue neighbors, instead of creating the blue nodes. The target node is initialized with a learned vector as its (missing) label, concatenated with a 1-hot vector representing its number of blue neighbors. Intermediate nodes are initialized with another learned vector.
|
| 277 |
+
|
| 278 |
+
Model The network has an initial linear layer, followed by $r + 1$ GNN layers. Afterward, the final target node representation goes through a linear layer and a softmax to predict its label. We experimented with GCN (Kipf and Welling, 2017), GGNN (Li et al., 2016), GIN (Xu et al., 2019) and GAT (Velickovi ˇ c et al., 2018) as the graph layers. ´
|
| 279 |
+
|
| 280 |
+
In Section 4.1, we used model dimensions of $d { = } 3 2$ . Larger values led to the exact same trend. We added residual connections, summing every node with its own representation in the previous layer to increase expressivity, and layer normalization which eased convergence. We used the Adam optimizer with a learning rate of $1 0 ^ { - 3 }$ , decayed by 0.5 after every 1000 epochs without an increase in training accuracy, and stopped training after 2000 epochs of no training accuracy improvement. This usually led to tens of thousands of training epochs, sometimes reaching 100,000 epochs.
|
| 281 |
+
|
| 282 |
+
Table 4: Average error rates and standard deviations on the QM9 targets. Best result for every property in every GNN type is highlighted in bold. Results marked with $\dagger$ were previously reported by Brockschmidt (2020).
|
| 283 |
+
|
| 284 |
+
<table><tr><td></td><td colspan="2">MLP</td><td colspan="2">R-GCN</td><td colspan="2">GNN-FiLM</td></tr><tr><td>Property</td><td>baset</td><td>+FA</td><td>baset</td><td>+FA</td><td>baset</td><td>+FA</td></tr><tr><td>mu</td><td>2.36±0.04</td><td>2.19±0.04</td><td>3.21±0.06</td><td>2.92±0.07</td><td>2.38±0.13</td><td>2.26±0.06</td></tr><tr><td>alpha</td><td>4.27±0.36</td><td>1.92±0.06</td><td>4.22±0.45</td><td>2.14±0.08</td><td>3.75±0.11</td><td>1.93±0.08</td></tr><tr><td>HOMO</td><td>1.25±0.04</td><td>1.19±0.04</td><td>1.45±0.01</td><td>1.37±0.02</td><td>1.22±0.07</td><td>1.11±0.01</td></tr><tr><td>LUMO</td><td>1.35±0.04</td><td>1.20±0.05</td><td>1.62±0.04</td><td>1.41±0.01</td><td>1.30±0.05</td><td>1.21±0.05</td></tr><tr><td>gap</td><td>2.04±0.05</td><td>1.82±0.05</td><td>2.42±0.14</td><td>2.03±0.03</td><td>1.96±0.06</td><td>1.79±0.07</td></tr><tr><td>R2</td><td>14.86±1.62</td><td>12.40±0.84</td><td>16.38±0.49</td><td>13.55±0.50</td><td>15.59±1.38</td><td>11.89±0.73</td></tr><tr><td>ZPVE</td><td>12.00±1.66</td><td>4.68±0.29</td><td>17.40±3.56</td><td>5.81±0.61</td><td>11.00±0.74</td><td>4.68±0.49</td></tr><tr><td>U0</td><td>5.55±0.38</td><td>1.71±0.13</td><td>7.82±0.80</td><td>1.75±0.18</td><td>5.43±0.96</td><td>1.60±0.12</td></tr><tr><td>U</td><td>6.20±0.88</td><td>1.72±0.12</td><td>8.24±1.25</td><td>1.88±0.22</td><td>5.95±0.46</td><td>1.75±0.08</td></tr><tr><td>H</td><td>5.96±0.45</td><td>1.70±0.08</td><td>9.05±1.21</td><td>1.85±0.18</td><td>5.59±0.57</td><td>1.93±0.42</td></tr><tr><td>G</td><td>5.09±0.57</td><td>1.53±0.15</td><td>7.00±1.51</td><td>1.76±0.15</td><td>5.17±1.13</td><td>1.77±0.05</td></tr><tr><td>Cv</td><td>3.38±0.20</td><td>1.69±0.08</td><td>3.93±0.48</td><td>1.90±0.07</td><td>3.46±0.21</td><td>1.64±0.10</td></tr><tr><td>Omega</td><td>0.84±0.02</td><td>0.63±0.04</td><td>1.02±0.05</td><td>0.75±0.04</td><td>0.98±0.06</td><td>0.69±0.05</td></tr><tr><td>Relative:</td><td></td><td>-40.33%</td><td></td><td>-43.40%</td><td></td><td>-39.53%</td></tr></table>
|
| 285 |
+
|
| 286 |
+
To rule out hyperparameter tuning as the source of degraded performance, we experimented with changing activations (ReLu, tanh, MLP, none), using layer normalization and batch normalization, residual connections, various batch sizes, and whether or not the same GNN weights should be “unrolled” over time steps. The presented results were obtained using the configurations that achieved the best results.
|
| 287 |
+
|
| 288 |
+
Over-squashing or just long-range? To rule out the possibility that the long-range itself is preventing the GNNs from fitting the data, we repeated the experiment of Figure 3 for depths 4 to 8, where the distance between the leaves and the target node remained the same, but the amount of over-squashing was as in $r { = } 2$ . That is, the graph looks like a tree of depth $\Longrightarrow 2$ , where the root is connected to a “chain” of length of up to 6, and the target node is at the other side of the chain. This setting maintains the long-range as in the original problem, but reduces the amount of information that needs to be squashed. In other words, This setting disentangles of the effect of the long-range itself from the effect of the growing amount of information (i.e., from over-squashing). In this setting, all GNN types managed to easily fit the data to close to $100 \%$ across all distances, showing that the problem is the amount of over-squashing, rather than the long-range itself.
|
| 289 |
+
|
| 290 |
+
# B QM9 – ADDITIONAL RESULTS
|
| 291 |
+
|
| 292 |
+
# B.1 ADDITIONAL GNN TYPES
|
| 293 |
+
|
| 294 |
+
Because of space limitations, in Section 4.2 we presented results on the QM9 dataset only for R-GIN, R-GAT and GGNN. In this section, we show that additional GNN architectures benefit from breaking the bottleneck using a fully-adjacent layer: GNN-MLP , R-GCN (Schlichtkrull et al., 2018) and GNN-FiLM (Brockschmidt, 2020).
|
| 295 |
+
|
| 296 |
+
All experiments were performed using the extensively-tuned implementation of Brockschmidt (2020) who experimented with over 500 hyperparameter configurations.
|
| 297 |
+
|
| 298 |
+
Table 4 contains additional results for GGNN, R-GCN and R-GIN. As shown in Table 4, adding an FA layer significantly improves results across all GNN architectures, for all properties.
|
| 299 |
+
|
| 300 |
+
# B.2 ALTERNATIVE SOLUTIONS
|
| 301 |
+
|
| 302 |
+
Table 5 shows additional experiments, all performed using GCN. base† is the original model of Brockschmidt (2020) as in Table 4. $+ F A$ is the model that we re-trained with the last layer modified to an FA layer.
|
| 303 |
+
|
| 304 |
+
Table 5: Average error rates and standard deviations on the QM9 targets with GCN using alternative solutions.
|
| 305 |
+
|
| 306 |
+
<table><tr><td>Property</td><td>baset</td><td>+FA</td><td>2xd</td><td>All FA</td><td>2×FA</td><td>Penultimate FA</td></tr><tr><td>mu</td><td>3.21±0.06</td><td>2.92±0.07</td><td>2.99±0.08</td><td>11.52</td><td>2.89±0.08</td><td>2.80±0.08</td></tr><tr><td>alpha</td><td>4.22±0.45</td><td>2.14±0.08</td><td>3.57±0.40</td><td>9.19</td><td>2.23±0.04</td><td>2.14±0.10</td></tr><tr><td>HOMO</td><td>1.45±0.01</td><td>1.37±0.02</td><td>1.36±1.87</td><td>9.95</td><td>1.39±0.02</td><td>1.34±0.03</td></tr><tr><td>LUMO</td><td>1.62±0.04</td><td>1.41±0.01</td><td>1.43±0.04</td><td>19.13</td><td>1.42±0.04</td><td>1.37±0.02</td></tr><tr><td>gap</td><td>2.42±0.14</td><td>2.03±0.03</td><td>2.33±0.23</td><td>24.62</td><td>2.06±0.05</td><td>2.00±0.03</td></tr><tr><td>R2</td><td>16.38±0.49</td><td>13.55±0.50</td><td>18.4±0.76</td><td>168.09</td><td>13.97±0.56</td><td>12.92±0.11</td></tr><tr><td>ZPVE</td><td>17.40±3.56</td><td>5.81±0.61</td><td>15.8±2.59</td><td>591.33</td><td>5.79±0.50</td><td>4.53±0.62</td></tr><tr><td>UO</td><td>7.82±0.80</td><td>1.75±0.18</td><td>7.60±2.07</td><td>188.59</td><td>1.90±0.1</td><td>1.98±0.25</td></tr><tr><td>U</td><td>8.24±1.25</td><td>1.88±0.22</td><td>7.65±1.51</td><td>189.72</td><td>1.71±0.16</td><td>2.05±0.23</td></tr><tr><td>H</td><td>9.05±1.21</td><td>1.85±0.18</td><td>8.67±1.10</td><td>191.11</td><td>1.83±0.11</td><td>1.73±0.14</td></tr><tr><td>G</td><td>7.00±1.51</td><td>1.76±0.15</td><td>2.90±1.15</td><td>173.68</td><td>1.93±0.11</td><td>1.96±0.42</td></tr><tr><td>Cv</td><td>3.93±0.48</td><td>1.90±0.07</td><td>3.99±0.07</td><td>64.18</td><td>1.90±0.14</td><td>1.83±0.11</td></tr><tr><td>Omega</td><td>1.02±0.05</td><td>0.75±0.04</td><td>1.03±0.54</td><td>23.89</td><td>0.69±0.06</td><td>0.67±0.01</td></tr><tr><td>relative</td><td>0.0%</td><td>-43.40%</td><td>-5.50%</td><td>+1520%</td><td>-43.30%</td><td>-45.2%</td></tr></table>
|
| 307 |
+
|
| 308 |
+
$2 \times d$ is a model that was trained with a doubled hidden dimension size, $d = 2 5 6$ instead of $d = 1 2 8$ as in the base model. As shown, doubling the hidden dimension size leads to a small improvement of only $5 . 5 \%$ reduction in error. In comparison, the $+ \mathrm { F A }$ model used the original dimension sizes and achieves a much larger improvement of $4 3 . 4 0 \%$ .
|
| 309 |
+
|
| 310 |
+
All FA is a model that was trained with all GNN layers converted into FA layers, practically ignoring the graph topology. This led to much worse results of more than $1 5 0 0 \%$ higher error. This shows that the graph topology is important in this benchmark, and that a direct interaction between nodes (as in a single FA layer) must be performed in addition to considering the topology.
|
| 311 |
+
|
| 312 |
+
$2 \times F A$ is a model where the last layer was modified into an FA layer, and an additional FA layer was stacked on top of it. This led to results that are very similar to $+ \mathrm { F A }$ .
|
| 313 |
+
|
| 314 |
+
Penultimate $F A$ is a model where the FA layer is the penultimate layer (the $K - 1$ -th), followed by a standard GNN layer as the $K$ -th layer. This led to results that are even slightly better than $+ \mathrm { F A }$ .
|
| 315 |
+
|
| 316 |
+
Table 6: Average error rates and standard deviations on the QM9 targets with GCN, where we use only a fraction of the edges in the FA layer.
|
| 317 |
+
|
| 318 |
+
<table><tr><td></td><td>base†</td><td>0.25×FA</td><td>0.5× FA</td><td>0.75× FA</td><td>+FA (as in Table 4)</td></tr><tr><td>Avg. error compared to baset</td><td>-0%</td><td>-8.4%</td><td>-31.5%</td><td>-37.1%</td><td>-43.4%</td></tr></table>
|
| 319 |
+
|
| 320 |
+
# B.3 PARTIAL-FA LAYERS
|
| 321 |
+
|
| 322 |
+
We also examined whether instead of adding a “full fully-adjacent layer”, we can randomly sample only a fraction of these edges. We randomly sampled only $\{ 0 . 2 5 , 0 . 5 , 0 . 7 5 \}$ of the edges in the full FA layer in every example, and trained the model for each target property 5 times. Table 6 shows the results of these experiments using GCN. base† is the original model of Brockschmidt (2020) as in Table 4. $+ F A$ is the model that we re-trained with the last layer modified to an FA layer. $\{ 0 . 2 5 , 0 . 5 , 0 . 7 5 \} \times F A$ are the models were only a fraction of the edges in the FA layer were used.
|
| 323 |
+
|
| 324 |
+
As shown in Table 6, the full FA layer achieves the largest reduction in error $( - 4 3 . 4 \% )$ , but even adding a fraction of the edges improves the results over the base model. For example, using only half of the edges $( 0 . 5 \times F A )$ reduces the error by $3 1 . 5 \%$ . Overall, the percentage of used edges in the partial-FA layer is correlated with its reduction in error.
|
| 325 |
+
|
| 326 |
+
# C BIOLOGICAL BENCHMARKS – TRAINING DETAILS
|
| 327 |
+
|
| 328 |
+
We used the implementation of Errica et al. (2020) who performed a fair and thorough comparison between GNNs, by splitting each dataset to 10-folds; then, for each GNN type they select a configuration among a grid of 72 configurations according to the validation set; finally, the best configuration for each fold is trained three additional times, early stopped using the validation set, and evaluated on the test set. The final reported result is the average of all 30 test runs (10-folds $\times 3$ ). The final standard deviation is computed among the average results of each of the ten folds.
|
| 329 |
+
|
| 330 |
+
# D DATA STATISTICS
|
| 331 |
+
|
| 332 |
+
D.1 SYNTHETIC DATASET: TREE-NEIGHBORSMATCH
|
| 333 |
+
|
| 334 |
+
Statistics of the synthetic TREE-NEIGHBORSMATCH dataset are shown in Table 7.
|
| 335 |
+
|
| 336 |
+
Table 7: The number of examples, in our experiments and combinatorially, for every value of depth.
|
| 337 |
+
|
| 338 |
+
<table><tr><td>depth</td><td># Training examples sampled</td><td>Total combinatorial: (2depth!) . 2depth</td></tr><tr><td>2</td><td>96</td><td>96</td></tr><tr><td>3</td><td>8000</td><td>>3·105</td></tr><tr><td>4</td><td>16,000</td><td>>3·1014</td></tr><tr><td>5</td><td>32,000</td><td>>1036</td></tr><tr><td>6</td><td>32,000</td><td>>1090</td></tr><tr><td>7</td><td>32,000</td><td>>10217</td></tr><tr><td>8</td><td>32,000</td><td>>10509</td></tr></table>
|
| 339 |
+
|
| 340 |
+
# D.2 QUANTUM CHEMISTRY: QM9
|
| 341 |
+
|
| 342 |
+
Statistics of the quantum chemistry QM9 dataset, as used in Brockschmidt (2020) are shown in Table 8.
|
| 343 |
+
|
| 344 |
+
Table 8: Statistics of the QM9 chemical dataset (Ramakrishnan et al., 2014) as used by Brockschmidt (2020).
|
| 345 |
+
|
| 346 |
+
<table><tr><td></td><td>Training</td><td>Validation</td><td>Test</td></tr><tr><td># examples</td><td>110,462</td><td>10,000</td><td>10,000</td></tr><tr><td># nodes-average</td><td>18.03</td><td>18.06</td><td>18.09</td></tr><tr><td># nodes - standard deviation</td><td>2.9</td><td>2.9</td><td>2.9</td></tr><tr><td># edges - average</td><td>18.65</td><td>18.67</td><td>18.72</td></tr><tr><td># edges - standard deviation</td><td>3.1</td><td>3.1</td><td>3.1</td></tr></table>
|
| 347 |
+
|
| 348 |
+
# D.3 BIOLOGICAL BENCHMARKS
|
| 349 |
+
|
| 350 |
+
Statistics of the biological datasets, as used in Errica et al. (2020), are shown in Table 9.
|
| 351 |
+
|
| 352 |
+
# D.4 VARMISUSE
|
| 353 |
+
|
| 354 |
+
Statistics of the VARMISUSE dataset, as used in Allamanis et al. (2018) and Brockschmidt (2020), are shown in Table 10.
|
| 355 |
+
|
| 356 |
+
Table 9: Statistics of the biological datasets, as used by Errica et al. (2020).
|
| 357 |
+
|
| 358 |
+
<table><tr><td></td><td>NCI1 (Wale et al., 2008)</td><td>ENZYMES (Borgwardt et al., 2005)</td></tr><tr><td># examples</td><td>4110</td><td>600</td></tr><tr><td># classes</td><td>2</td><td>6</td></tr><tr><td># nodes -average</td><td>29.87</td><td>32.63</td></tr><tr><td># nodes - standard deviation</td><td>13.6</td><td>15.3</td></tr><tr><td># edges - average</td><td>32.30</td><td>64.14</td></tr><tr><td># edges - standard deviation</td><td>14.9</td><td>25.5</td></tr><tr><td># node labels</td><td>37</td><td>3</td></tr></table>
|
| 359 |
+
|
| 360 |
+
Table 10: Statistics of the VARMISUSE dataset (Allamanis et al., 2018) as used by Brockschmidt (2020).
|
| 361 |
+
|
| 362 |
+
<table><tr><td></td><td>Training</td><td>Validation</td><td>UnseenProject Test</td><td>SeenProject Test</td></tr><tr><td># graphs</td><td>254360</td><td>42654</td><td>117036</td><td>59974</td></tr><tr><td># nodes -average</td><td>2377</td><td>1742</td><td>1959</td><td>3986</td></tr><tr><td># edges - average</td><td>7298</td><td>7851</td><td>5882</td><td>12925</td></tr></table>
|
| 363 |
+
|
| 364 |
+
# E DISCUSSION: OVER-SMOOTHING VS. OVER-SQUASHING
|
| 365 |
+
|
| 366 |
+
Although over-smoothing and over-squashing are related, they are disparate phenomena that occur in different types of problems. For example, imagine a triangular graph containing only three nodes, where every node has a scalar value, an edge to each of the other nodes, and needs to compute a function of its own value and the other nodes’ values. The problem radius $r$ in this case is $r { = } 1$ . As we increase the number of layers, the representations of the nodes might become indistinguishable, and thus suffer from over-smoothing. However, there will be no over-squashing in this case, because there is no growing amount of information that is squashed into fixed-sized vectors while passing long-range messages. Contrarily, in the TREE-NEIGHBORSMATCH problem, there is no reason for over-smoothing to occur, because there are no two nodes that can converge to the same representation. A node in a “higher” level in the tree contains twice the information than a node in a “lower” level. Thus, this is a case where over-squashing can occur without over-smoothing.
|
md/train/kmG8vRXTFv/kmG8vRXTFv.md
ADDED
|
@@ -0,0 +1,574 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# AUGMENTING PHYSICAL MODELS WITH DEEP NET-WORKS FOR COMPLEX DYNAMICS FORECASTING
|
| 2 |
+
|
| 3 |
+
∗Yuan $\mathbf { Y i n } ^ { 1 }$ ∗Vincent Le Guen2,3 ∗Jérémie Dona1 ∗Emmanuel de Bézenac1
|
| 4 |
+
∗Ibrahim Ayed1,4 Nicolas Thome2 Patrick Gallinari1,5
|
| 5 |
+
1 Sorbonne Université, CNRS, LIP6, Paris, France
|
| 6 |
+
2 Conservatoire National des Arts et Métiers, CEDRIC, Paris, France
|
| 7 |
+
3 EDF R&D, Chatou, France
|
| 8 |
+
4 Theresis Lab, Thales
|
| 9 |
+
5 Criteo AI Lab, Paris, France
|
| 10 |
+
|
| 11 |
+
# ABSTRACT
|
| 12 |
+
|
| 13 |
+
Forecasting complex dynamical phenomena in settings where only partial knowledge of their dynamics is available is a prevalent problem across various scientific fields. While purely data-driven approaches are arguably insufficient in this context, standard physical modeling based approaches tend to be over-simplistic, inducing non-negligible errors. In this work, we introduce the APHYNITY framework, a principled approach for augmenting incomplete physical dynamics described by differential equations with deep data-driven models. It consists in decomposing the dynamics into two components: a physical component accounting for the dynamics for which we have some prior knowledge, and a data-driven component accounting for errors of the physical model. The learning problem is carefully formulated such that the physical model explains as much of the data as possible, while the data-driven component only describes information that cannot be captured by the physical model, no more, no less. This not only provides the existence and uniqueness for this decomposition, but also ensures interpretability and benefits generalization. Experiments made on three important use cases, each representative of a different family of phenomena, i.e. reaction-diffusion equations, wave equations and the non-linear damped pendulum, show that APHYNITY can efficiently leverage approximate physical models to accurately forecast the evolution of the system and correctly identify relevant physical parameters.
|
| 14 |
+
|
| 15 |
+
# 1 INTRODUCTION
|
| 16 |
+
|
| 17 |
+
Modeling and forecasting complex dynamical systems is a major challenge in domains such as environment and climate (Rolnick et al., 2019), health science (Choi et al., 2016), and in many industrial applications (Toubeau et al., 2018). Model Based (MB) approaches typically rely on partial or ordinary differential equations (PDE/ODE) and stem from a deep understanding of the underlying physical phenomena. Machine learning (ML) and deep learning methods are more prior agnostic yet have become state-of-the-art for several spatio-temporal prediction tasks (Shi et al., 2015; Wang et al., 2018; Oreshkin et al., 2020; Donà et al., 2020), and connections have been drawn between deep architectures and numerical ODE solvers, e.g. neural ODEs (Chen et al., 2018; Ayed et al., 2019b). However, modeling complex physical dynamics is still beyond the scope of pure ML methods, which often cannot properly extrapolate to new conditions as MB approaches do.
|
| 18 |
+
|
| 19 |
+
Combining the MB and ML paradigms is an emerging trend to develop the interplay between the two paradigms. For example, Brunton et al. (2016); Long et al. (2018b) learn the explicit form of PDEs directly from data, Raissi et al. (2019); Sirignano & Spiliopoulos (2018) use NNs as implicit methods for solving PDEs, Seo et al. (2020) learn spatial differences with a graph network, Ummenhofer et al. (2020) introduce continuous convolutions for fluid simulations, de Bézenac et al. (2018) learn the velocity field of an advection-diffusion system, Greydanus et al. (2019); Chen et al. (2020) enforce conservation laws in the network architecture or in the loss function.
|
| 20 |
+
|
| 21 |
+

|
| 22 |
+
Figure 1: Predicted dynamics for the damped pendulum vs. ground truth (GT) trajectories $\mathrm { d } ^ { 2 } \theta / \mathrm { d } t ^ { 2 } +$ $\omega _ { 0 } ^ { \mathrm { - } } \sin \theta + \alpha ^ { \mathrm { d } \theta } / { \mathrm { d } t } = \mathrm { ~ \dot { 0 } ~ }$ . We show that in (a) the data-driven approach (Chen et al., 2018) fails to properly learn the dynamics due to the lack of training data, while in (b) an ideal pendulum cannot take friction into account. The proposed APHYNITY shown in (c) augments the over-simplified physical model in (b) with a data-driven component. APHYNITY improves both forecasting (MSE) and parameter identification (Error $T _ { 0 }$ ) compared to (b).
|
| 23 |
+
|
| 24 |
+
The large majority of aforementioned MB/ML hybrid approaches assume that the physical model adequately describes the observed dynamics. This assumption is, however, commonly violated in practice. This may be due to various factors, e.g. idealized assumptions and difficulty to explain processes from first principles (Gentine et al., 2018), computational constraints prescribing a fine grain modeling of the system (Ayed et al., 2019a), unknown external factors, forces and sources which are present (Large & Yeager, 2004). In this paper, we aim at leveraging prior dynamical ODE/PDE knowledge in situations where this physical model is incomplete, i.e. unable to represent the whole complexity of observed data. To handle this case, we introduce a principled learning framework to Augment incomplete PHYsical models for ideNtIfying and forecasTing complex dYnamics (APHYNITY). The rationale of APHYNITY, illustrated in Figure 1 on the pendulum problem, is to augment the physical model when—and only when—it falls short.
|
| 25 |
+
|
| 26 |
+
Designing a general method for combining MB and ML approaches is still a widely open problem, and a clear problem formulation for the latter is lacking (Reichstein et al., 2019). Our contributions towards these goals are the following:
|
| 27 |
+
|
| 28 |
+
• We introduce a simple yet principled framework for combining both approaches. We decompose the data into a physical and a data-driven term such that the data-driven component only models information that cannot be captured by the physical model. We provide existence and uniqueness guarantees (Section 3.1) for the decomposition given mild conditions, and show that this formulation ensures interpretability and benefits generalization.
|
| 29 |
+
|
| 30 |
+
• We propose a trajectory-based training formulation (Section 3.2) along with an adaptive optimization scheme (Section 3.3) enabling end-to-end learning for both physical and deep learning components. This allows APHYNITY to automatically adjust the complexity of the neural network to different approximation levels of the physical model, paving the way to flexible learned hybrid models.
|
| 31 |
+
|
| 32 |
+
• We demonstrate the generality of the approach on three use cases (reaction-diffusion, wave equations and the pendulum) representative of different PDE families (parabolic, hyperbolic), having a wide spectrum of application domains, e.g. acoustics, electromagnetism, chemistry, biology, physics (Section 4). We show that APHYNITY is able to achieve performances close to complete physical models by augmenting incomplete ones, both in terms of forecasting accuracy and physical parameter identification. Moreover, APHYNITY can also be successfully extended to the partially observable setting (see discussion in Section 5).
|
| 33 |
+
|
| 34 |
+
# 2 RELATED WORK
|
| 35 |
+
|
| 36 |
+
Correction in data assimilation Prediction under approximate physical models has been tackled by traditional statistical calibration techniques, which often rely on Bayesian methods (Pernot & Cailliez, 2017). Data assimilation techniques, e.g. the Kalman filter (Kalman, 1960; Becker et al., 2019), 4D-var (Courtier et al., 1994), prediction errors are modeled probabilistically and a correction using observed data is applied after each prediction step. Similar residual correction procedures are commonly used in robotics and optimal control (Chen, 2004; Li et al., 2014). However, these sequential (two-stage) procedures prevent the cooperation between prediction and correction. Besides, in model-based reinforcement learning, model deficiencies are typically handled by considering only short-term rollouts (Janner et al., 2019) or by model predictive control (Nagabandi et al., 2018). The originality of APHYNITY is to leverage model-based prior knowledge by augmenting it with neurally parametrized dynamics. It does so while ensuring optimal cooperation between the prior model and the augmentation.
|
| 37 |
+
|
| 38 |
+
Augmented physical models Combining physical models with machine learning (gray-box or hybrid modeling) was first explored from the 1990’s: Psichogios & Ungar (1992); Thompson & Kramer (1994); Rico-Martinez et al. (1994) use neural networks to predict the unknown parameters of physical models. The challenge of proper MB/ML cooperation was already raised as a limitation of gray-box approaches but not addressed. Moreover these methods were evaluated on specific applications with a residual targeted to the form of the equation. In the last few years, there has been a renewed interest in deep hybrid models bridging data assimilation techniques and machine learning to identify complex PDE parameters using cautiously constrained forward model (Long et al., 2018b; de Bézenac et al., 2018), as discussed in introduction. Recently, some approaches have specifically targetted the MB/ML cooperation. HybridNet (Long et al., 2018a) and PhICNet (Saha et al., 2020) both use data-driven networks to learn additive perturbations or source terms to a given PDE. The former considers the favorable context where the perturbations can be accessed, and the latter the special case of additive noise on the input. Wang et al. (2019); Mehta et al. (2020) propose several empirical fusion strategies with deep neural networks but lack theoretical groundings. PhyDNet (Le Guen & Thome, 2020) tackles augmentation in partially-observed settings, but with specific recurrent architectures dedicated to video prediction. Crucially, all the aforementioned approaches do not address the issues of uniqueness of the decomposition or of proper cooperation for correct parameter identification. Besides, we found experimentally that this vanilla cooperation is inferior to the APHYNITY learning scheme in terms of forecasting and parameter identification performances (see experiments in Section 4.2).
|
| 39 |
+
|
| 40 |
+
# 3 THE APHYNITY MODEL
|
| 41 |
+
|
| 42 |
+
In the following, we study dynamics driven by an equation of the form:
|
| 43 |
+
|
| 44 |
+
$$
|
| 45 |
+
{ \frac { \mathrm { d } X _ { t } } { \mathrm { d } t } } = F ( X _ { t } )
|
| 46 |
+
$$
|
| 47 |
+
|
| 48 |
+
defined over a finite time interval $[ 0 , T ]$ , where the state $X$ is either vector-valued, i.e. we have $X _ { t } ~ \in ~ \mathbb { R } ^ { d }$ for every $t$ , (pendulum equations in Section 4), or $X _ { t }$ is a $d$ -dimensional vector field over a spatial domain $\bar { \Omega } \subset \mathbb { R } ^ { k }$ , with $k \in \{ 2 , 3 \}$ , i.e. $X _ { t } ( x ) \in \mathbb { R } ^ { d }$ for every $( t , x ) \in [ 0 , T ] \times \Omega$ (reaction-diffusion and wave equations in Section 4). We suppose that we have access to a set of observed trajectories $\mathcal { D } = \{ X . : [ 0 , T ] \to \mathcal { A } | \forall t \in [ 0 , T ] , \mathrm { d } X _ { t } / \mathrm { d } t = F ( X _ { t } ) \}$ , where $\mathcal { A }$ is the set of $X$ values (either $\mathbb { R } ^ { d }$ or vector field). In our case, the unknown $F$ has $\mathcal { A }$ as domain and we only assume that $F \in { \mathcal { F } }$ , with $( \mathcal { F } , \| \cdot \| )$ a normed vector space.
|
| 49 |
+
|
| 50 |
+
# 3.1 DECOMPOSING DYNAMICS INTO PHYSICAL AND AUGMENTED TERMS
|
| 51 |
+
|
| 52 |
+
As introduced in Section 1, we consider the common situation where incomplete information is available on the dynamics, under the form of a family of ODEs or PDEs characterized by their temporal evolution $F _ { p } \in { \mathcal { F } } _ { p } \subset { \mathcal { F } }$ . The APHYNITY framework leverages the knowledge of $\mathcal { F } _ { p }$ while mitigating the approximations induced by this simplified model through the combination of physical and data-driven components. $\mathcal { F }$ being a vector space, we can write:
|
| 53 |
+
|
| 54 |
+
$$
|
| 55 |
+
F = F _ { p } + F _ { a }
|
| 56 |
+
$$
|
| 57 |
+
|
| 58 |
+
where $F _ { p } \in \mathcal { F } _ { p }$ encodes the incomplete physical knowledge and $F _ { a } \in \mathcal { F }$ is the data-driven augmentation term complementing $F _ { p }$ . The incomplete physical prior is supposed to belong to a known family, but the physical parameters (e.g. propagation speed for the wave equation) are unknown and need to be estimated from data. Both $F _ { p }$ and $F _ { a }$ parameters are estimated by fitting the trajectories from $\mathcal { D }$ .
|
| 59 |
+
|
| 60 |
+
The decomposition $F = F _ { p } + F _ { a }$ is in general not unique. For example, all the dynamics could be captured by the $F _ { a }$ component. This decomposition is thus ill-defined, which hampers the interpretability and the extrapolation abilities of the model. In other words, one wants the estimated parameters of $F _ { p }$ to be as close as possible to the true parameter values of the physical model and $F _ { a }$ to play only a complementary role w.r.t $F _ { p }$ , so as to model only the information that cannot be captured by the physical prior. For example, when $F \in \mathcal { F } _ { p }$ , the data can be fully described by the physical model, and in this case it is sensible to desire $F _ { a }$ to be nullified; this is of central importance in a setting where one wishes to identify physical quantities, and for the model to generalize and extrapolate to new conditions. In a more general setting where the physical model is incomplete, the action of $F _ { a }$ on the dynamics, as measured through its norm, should be as small as possible.
|
| 61 |
+
|
| 62 |
+
This general idea is embedded in the following optimization problem:
|
| 63 |
+
|
| 64 |
+
$$
|
| 65 |
+
\operatorname* { m i n } _ { F _ { p } \in \mathcal { F } _ { p } , F _ { a } \in \mathcal { F } } \quad \| F _ { a } \| \quad \mathrm { s u b j e c t ~ t o } \quad \forall X \in \mathcal { D } , \forall t , \frac { \mathrm { d } X _ { t } } { \mathrm { d } t } = ( F _ { p } + F _ { a } ) ( X _ { t } )
|
| 66 |
+
$$
|
| 67 |
+
|
| 68 |
+
The originality of APHYNITY is to leverage model-based prior knowledge by augmenting it with neurally parametrized dynamics. It does so while ensuring optimal cooperation between the prior model and the augmentation.
|
| 69 |
+
|
| 70 |
+
A first key question is whether the minimum in Eq. (2) is indeed well-defined, in other words whether there exists indeed a decomposition with a minimal norm $F _ { a }$ . The answer actually depends on the geometry of ${ \mathcal { F } } _ { p }$ , and is formulated in the following proposition proven in Appendix B:
|
| 71 |
+
|
| 72 |
+
Proposition 1 (Existence of a minimizing pair). If ${ \mathcal { F } } _ { p }$ is a proximinal set1, there exists a decomposition minimizing Eq. (2).
|
| 73 |
+
|
| 74 |
+
Proximinality is a mild condition which, as shown through the proof of the proposition, cannot be weakened. It is a property verified by any boundedly compact set. In particular, it is true for closed subsets of finite dimensional spaces. However, if only existence is guaranteed, while forecasts would be expected to be accurate, non-uniqueness of the decomposition would hamper the interpretability of $F _ { p }$ and this would mean that the identified physical parameters are not uniquely determined.
|
| 75 |
+
|
| 76 |
+
It is then natural to ask under which conditions solving problem Eq. (2) leads to a unique decomposition into a physical and a data-driven component. The following result provides guarantees on the existence and uniqueness of the decomposition under mild conditions. The proof is given in Appendix B:
|
| 77 |
+
|
| 78 |
+
Proposition 2 (Uniqueness of the minimizing pair). If ${ \mathcal { F } } _ { p }$ is a Chebyshev set1, Eq. (2) admits $a$ unique minimizer. The $F _ { p }$ in this minimizer pair is the metric projection of the unknown $F$ onto $\mathcal { F } _ { p }$ .
|
| 79 |
+
|
| 80 |
+
The Chebyshev assumption condition is strictly stronger than proximinality but is still quite mild and necessary. Indeed, in practice, many sets of interest are Chebyshev, including all closed convex spaces in strict normed spaces and, if $\dot { \mathcal { F } } = L ^ { 2 }$ , ${ \mathcal { F } } _ { p }$ can be any closed convex set, including all finite dimensional subspaces. In particular, all examples considered in the experiments are Chebyshev sets.
|
| 81 |
+
|
| 82 |
+
Propositions 1 and 2 provide, under mild conditions, the theoretical guarantees for the APHYNITY formulation to infer the correct MB/ML decomposition, thus enabling both recovering the proper physical parameters and accurate forecasting.
|
| 83 |
+
|
| 84 |
+
# 3.2 SOLVING APHYNITY WITH DEEP NEURAL NETWORKS
|
| 85 |
+
|
| 86 |
+
In the following, both terms of the decomposition are parametrized and are denoted as $F _ { p } ^ { \theta _ { p } }$ and $F _ { p } ^ { \theta _ { a } }$ . Solving APHYNITY then consists in estimating the parameters $\theta _ { p }$ and $\theta _ { a }$ . $\theta _ { p }$ are the physical parameters and are typically low-dimensional, e.g. 2 or 3 in our experiments for the considered physical models. For $F _ { a }$ , we need sufficiently expressive models able to optimize over all $\mathcal { F }$ : we thus use deep neural networks, which have shown promising performances for the approximation of differential equations (Raissi et al., 2019; Ayed et al., 2019b).
|
| 87 |
+
|
| 88 |
+
When learning the parameters of $F _ { p } ^ { \theta _ { p } }$ and $F _ { a } ^ { \theta _ { a } }$ , we have access to a finite dataset of trajectories discretized with a given temporal resolution $\Delta t$ $\mathcal { D } _ { \mathrm { t r a i n } } = \{ ( X _ { k \Delta t } ^ { ( i ) } ) _ { 0 \leq k \leq \lfloor { ^ T / \Delta t } \rfloor } \} _ { 1 \leq i \leq N }$ . Solving $\mathrm { d } X _ { t } { \big / } \mathrm { d } t$
|
| 89 |
+
is to approximate this derivative using e.g. finite differences as in (Brunton et al., 2016; Greydanus et al., 2019; Cranmer et al., 2020). This numerical scheme requires high space and time resolutions in the observation space in order to get reliable gradient estimates. Furthermore it is often unstable, leading to explosive numerical errors as discussed in Appendix D. We propose instead to solve Eq. (2) using an integral trajectory-based approach: we compute $\widetilde { X } _ { k \Delta t , X _ { 0 } } ^ { i }$ from an initial state $X _ { 0 } ^ { ( i ) }$ using the current $F _ { p } ^ { \theta _ { p } } + F _ { a } ^ { \theta _ { a } }$ dynamics, then enforce the constraint $\widetilde { X } _ { k \Delta t , X _ { 0 } } ^ { i } = X _ { k \Delta t } ^ { i }$ . This leads to our final objective function on $( \theta _ { p } , \theta _ { a } )$ :
|
| 90 |
+
|
| 91 |
+
$$
|
| 92 |
+
\operatorname* { m i n } _ { \theta _ { p } , \theta _ { a } } \quad \left\| F _ { a } ^ { \theta _ { a } } \right\| \mathrm { ~ \ s u b j e c t ~ t o ~ } \forall i , \forall k , \widetilde { X } _ { k \Delta t } ^ { ( i ) } = X _ { k \Delta t } ^ { ( i ) }
|
| 93 |
+
$$
|
| 94 |
+
|
| 95 |
+
where $\widetilde { X } _ { k \Delta t } ^ { ( i ) }$ is the approximate solution of the integral $\begin{array} { r } { \int _ { X _ { 0 } ^ { ( i ) } } ^ { X _ { 0 } ^ { ( i ) } + k \Delta t } ( F _ { p } ^ { \theta _ { p } } + F _ { a } ^ { \theta _ { a } } ) ( X _ { s } ) \mathrm { d } X _ { s } } \end{array}$ obtained by a differentiable ODE solver.
|
| 96 |
+
|
| 97 |
+
In our setting, where we consider situations for which $F _ { p } ^ { \theta _ { p } }$ only partially describes the physical phenomenon, this coupled $\mathbf { M B } + \mathbf { M L }$ formulation leads to different parameter estimates than using the MB formulation alone, as analyzed more thoroughly in Appendix C. Interestingly, our experiments show that using this formulation also leads to a better identification of the physical parameters $\theta _ { p }$ than when fitting the simplified physical model $F _ { p } ^ { \theta _ { p } }$ alone (Section 4). With only an incomplete knowledge on the physics, $\theta _ { p }$ estimator will be biased by the additional dynamics which needs to be fitted in the data. Appendix F also confirms that the integral formulation gives better forecasting results and a more stable behavior than supervising over finite difference approximations of the derivatives.
|
| 98 |
+
|
| 99 |
+
# 3.3 ADAPTIVELY CONSTRAINED OPTIMIZATION
|
| 100 |
+
|
| 101 |
+
The formulation in Eq. (3) involves constraints which are difficult to enforce exactly in practice. We considered a variant of the method of multipliers (Bertsekas, 1996) which uses a sequence of Lagrangian relaxations $\mathcal { L } _ { \lambda _ { j } } ( \theta _ { p } , \theta _ { a } )$ :
|
| 102 |
+
|
| 103 |
+
$$
|
| 104 |
+
\mathcal { L } _ { \lambda _ { j } } ( \theta _ { p } , \theta _ { a } ) = \| F _ { a } ^ { \theta _ { a } } \| + \lambda _ { j } \cdot \mathcal { L } _ { t r a j } ( \theta _ { p } , \theta _ { a } )
|
| 105 |
+
$$
|
| 106 |
+
|
| 107 |
+
This method needs an increasing sequence $( \lambda _ { j } ) _ { j }$ such that the successive minima of $\mathcal { L } _ { \lambda _ { j } }$ converge to a solution (at least a local one) of the constrained problem Eq. (3). We select $( \lambda _ { j } ) _ { j }$ by using an iterative strategy: starting from a value $\lambda _ { 0 }$ , we iterate, minimizing $\mathcal { L } _ { \lambda _ { i } }$ by gradient descent2, then update $\lambda _ { j }$ with: $\lambda _ { j + 1 } = \bar { \lambda _ { j } } + \tau _ { 2 } \mathcal { L } _ { t r a j } ( \theta _ { j + 1 } )$ , where $\tau _ { 2 }$ is a chosen hyper-parameter and $\bar { \theta } \stackrel { - } { = } \left( \theta _ { p } , \theta _ { a } \right)$ . This procedure is summarized in Algorithm 1. This adaptive iterative procedure allows us to obtain stable and robust results, in a reproducible fashion, as shown in the experiments.
|
| 108 |
+
|
| 109 |
+
<table><tr><td>Algorithm1:APHYNITY</td></tr><tr><td>Initialization:入o ≥ O,T1 > O,T2 >O; for epoch = 1 : Nepochs do for iter in 1 : Niter do for batch in1 :B do 0j+1=0j- TiV[jLtraj(0j)+Fall] Xj+1=λj+ T2Ltraj(0j+1)</td></tr></table>
|
| 110 |
+
|
| 111 |
+
# 4 EXPERIMENTAL VALIDATION
|
| 112 |
+
|
| 113 |
+
We validate our approach on 3 classes of challenging physical dynamics: reaction-diffusion, wave propagation, and the damped pendulum, representative of various application domains such as chemistry, biology or ecology (for reaction-diffusion) and earth physic, acoustic, electromagnetism or even neuro-biology (for waves equations). The two first dynamics are described by PDEs and thus in practice should be learned from very high-dimensional vectors, discretized from the original compact domain. This makes the learning much more difficult than from the one-dimensional pendulum case. For each problem, we investigate the cooperation between physical models of increasing complexity encoding incomplete knowledge of the dynamics (denoted Incomplete physics in the following) and data-driven models. We show the relevance of APHYNITY (denoted APHYNITY models) both in terms of forecasting accuracy and physical parameter identification.
|
| 114 |
+
|
| 115 |
+
# 4.1 EXPERIMENTAL SETTING
|
| 116 |
+
|
| 117 |
+
We describe the three families of equations studied in the experiments. In all experiments, $\mathcal { F } = \mathcal { L } ^ { 2 } ( \mathcal { A } )$ where $\mathcal { A }$ is the set of all admissible states for each problem, and the $\textstyle { \mathcal { L } } ^ { 2 }$ norm is computed on $\mathcal { D } _ { t r a i n }$ by: $\begin{array} { r } { \| \boldsymbol { F } \| ^ { 2 } \approx \sum _ { i , k } \| \boldsymbol { F } ( \boldsymbol { X } _ { k \Delta t } ^ { ( i ) } ) \| ^ { 2 } } \end{array}$ . All considered sets of physical functionals ${ \mathcal { F } } _ { p }$ are closed and convex in $\mathcal { F }$ and thus are Chebyshev. In order to enable the evaluation on both prediction and parameter identification, all our experiments are conducted on simulated datasets with known model parameters. Each dataset has been simulated using an appropriate high-precision integration scheme for the corresponding equation. All solver-based models take the first state $X _ { 0 }$ as input and predict the remaining time-steps by integrating $F$ through the same differentiable generic and common ODE solver (4th order Runge-Kutta)3. Implementation details and architectures are given in Appendix E.
|
| 118 |
+
|
| 119 |
+
Reaction-diffusion equations We consider a 2D FitzHugh-Nagumo type model (Klaasen & Troy, 1984). The system is driven by the PDE $\begin{array} { r } { \frac { \partial u } { \partial t } = a \Delta u + \check { R _ { u } } ( u , \check { v ; } k ) } \end{array}$ , $\begin{array} { r } { \frac { \partial \bar { \boldsymbol { v } } } { \partial t } = b \Delta \boldsymbol { v } + R _ { v } ( \boldsymbol { u } , \boldsymbol { v } ) } \end{array}$ where $a$ and $b$ are respectively the diffusion coefficients of $u$ and $v , \Delta$ is the Laplace operator. The local reaction terms are $\bar { R _ { u } ( u , v ; k ) } = u - u ^ { 3 } - k - v , R _ { v } ( u , v ) = u - v$ . The state is $X = ( u , v )$ and is defined over a compact rectangular domain $\Omega$ with periodic boundary conditions. The considered physical models are: • Param PDE $( a , b )$ , with unknown $( a , b )$ diffusion terms and without reaction terms: $\mathcal { F } _ { p } = \{ F _ { p } ^ { a , b } : ( u , v ) \mapsto ( a \Delta u , b \Delta v ) | a \geq a _ { \operatorname* { m i n } } > 0 , b \geq b _ { \operatorname* { m i n } } > 0 \} \mathrm { { ; } }$ ; • Param PDE $( a , b , k )$ , the full PDE with unknown parameters: ${ \mathcal { F } } _ { p } ~ = ~ \{ F _ { p } ^ { a , b , k } ~ : ~ ( u , v ) ~ \mapsto ~$ $( a \Delta u + R _ { u } ( u , v ; k ) , b \Delta v + R _ { v } ( u , v ) \mid a \geq a _ { \operatorname* { m i n } } > 0 , b \geq b _ { \operatorname* { m i n } } > 0 , k \geq k _ { \operatorname* { m i n } } > 0 )$ .
|
| 120 |
+
|
| 121 |
+
$k$ amped wave equations We investigate tis the damping coefficient. The state is $\begin{array} { r } { X \ = \ ( w , \frac { \partial w } { \partial t } ) } \end{array}$ ve PDE: and we $\begin{array} { r } { \frac { \partial ^ { 2 } w } { \partial t ^ { 2 } } - c ^ { 2 } \Delta w + k \frac { \partial w } { \partial t } = 0 } \end{array}$ whereial domain $\Omega$ with Neumann homogeneous boundary conditions. Note that this damping differs from the pendulum, as its effect is global. Our physical models are: • Param PDE (c), without damping term: ${ \mathcal { F } } _ { p } = \{ F _ { p } ^ { c } : ( u , \bar { v _ { } } ) \mapsto ( v , c ^ { 2 } \bar { \Delta u } ) | c \in [ \epsilon , + \infty ) $ with $\epsilon > 0 \}$ ; $\bullet$ Param PDE $( c , k )$ : $\mathcal { F } _ { p } = \{ F _ { p } ^ { c , k } : ( u , v ) \mapsto ( v , c ^ { 2 } \Delta u - k v ) \mid c , k \in [ \epsilon , + \infty )$ with $\epsilon > 0 \}$ .
|
| 122 |
+
|
| 123 |
+
Damped pendulum The evolution follows the ODE $\mathrm { d } ^ { 2 } \theta \big / \mathrm { d } t ^ { 2 } + \omega _ { 0 } ^ { 2 } \sin \theta + \alpha ^ { \mathrm { d } \theta } \big / \mathrm { d } t = 0$ , where $\theta ( t )$ is the angle, $\omega _ { 0 }$ the proper pulsation ( $T _ { 0 }$ the period) and $\alpha$ the damping coefficient. With state $X ~ = ~ \left( \theta , \mathrm { d } \theta / \mathrm { d } t \right)$ , the ODE is $F _ { p } ^ { \omega _ { 0 } , \alpha } ~ : ~ \stackrel { \triangledown } { X } ~ \stackrel { \triangledown } { \mapsto } ~ ( \mathrm { d } \theta / \mathrm { d } t , - \omega _ { 0 } ^ { 2 } \sin \theta ~ - ~ \alpha \bar { \mathrm { d } } \theta / \mathrm { d } t )$ . Our physical models are: $\bullet$ Hamiltonian (Greydanus et al., 2019), a conservative approximation, with $\mathcal { F } _ { p } = \{ F _ { p } ^ { \mathcal { H } } : ( u , v ) \mapsto ( \partial _ { y } \mathcal { H } ( u , v ) , - \partial _ { x } \mathcal { H } ( u , v ) ) | \mathcal { H } \in H ^ { 1 } ( \mathbb { R } ^ { 2 } ) \}$ , $H ^ { 1 } ( \mathbb { R } ^ { 2 } )$ is the first order Sobolev space. • • Param $O D E \left( \omega _ { 0 } \right)$ , the frictionless pendulu full pendulum equation: $\mathcal { F } _ { p } = \{ F _ { p } ^ { \omega _ { 0 } , \alpha = 0 } | \ \omega _ { 0 } \in [ \epsilon , + \infty )$ wth $\epsilon > 0 \}$ $O D E \left( \omega _ { 0 } , \alpha \right)$ $\mathcal { F } _ { p } = \{ F _ { p } ^ { \omega _ { 0 } , \alpha } | \omega _ { 0 } , \alpha \in [ \epsilon , + \infty )$ $\epsilon > 0 \}$
|
| 124 |
+
|
| 125 |
+
Baselines As purely data-driven baselines, we use Neural ODE (Chen et al., 2018) for the three problems and PredR $\mathrm { N N } { + } { + }$ (Wang et al., 2018, for reaction-diffusion only) which are competitive models for datasets generated by differential equations and for spatio-temporal data. As MB/ML methods, in the ablations studies (see Appendix F), we compare for all problems, to the vanilla MB/ML cooperation scheme found in (Wang et al., 2019; Mehta et al., 2020). We also show results for True PDE/ODE, which corresponds to the equation for data simulation (which do not lead to zero error due to the difference between simulation and training integration schemes). For the pendulum, we compare to Hamiltonian neural networks (Greydanus et al., 2019; Toth et al., 2020) and to the the deep Galerkin method (DGM, Sirignano & Spiliopoulos, 2018). See additional details in Appendix E.
|
| 126 |
+
|
| 127 |
+
Table 1: Forecasting and identification results on the (a) reaction-diffusion, (b) wave equation, and (c) damped pendulum datasets. We set for (a) $a = 1 \times 1 0 ^ { - 3 } , b = 5 \times 1 0 ^ { - 3 } , k = 5 \times 1 0 ^ { - 3 }$ , for (b) $c = 3 3 0$ , $k = 5 0$ and for (c) $T _ { 0 } = 6$ , $\alpha = 0 . 2$ as true parameters. log MSEs are computed respectively over 25, 25, and 40 predicted time-steps. $\% \mathrm { E r r }$ param. averages the results when several physical parameters are present. For each level of incorporated physical knowledge, equivalent best results according to a Student t-test are shown in bold. $\mathrm { n / a }$ corresponds to non-applicable cases.
|
| 128 |
+
|
| 129 |
+
<table><tr><td>Dataset</td><td colspan="2">Method</td><td>log MSE</td><td>%Err param.</td><td>/Fall2</td></tr><tr><td rowspan="8">(a) Reaction- diffusion</td><td rowspan="3">Data- driven</td><td>Neural ODE</td><td>-3.76±0.02</td><td>n/a</td><td>n/a</td></tr><tr><td>PredRNN++</td><td>-4.60±0.01</td><td>n/a</td><td>n/a</td></tr><tr><td>Param PDE (a,b) Incomplete</td><td>-1.26±0.02</td><td>67.6</td><td>n/a</td></tr><tr><td rowspan="3">physics Complete</td><td>APHYNITY Param PDE (a, b)</td><td>-5.10±0.21</td><td>2.3</td><td>67</td></tr><tr><td>Param PDE (a,b,k)</td><td>-9.34±0.20</td><td>0.17</td><td>n/a</td></tr><tr><td>APHYNITYParamPDE(a, b, k)</td><td>-9.35±0.02</td><td>0.096</td><td>1.5e-6</td></tr><tr><td rowspan="3">physics Data-driven</td><td>TruePDE</td><td>-8.81±0.05</td><td>n/a</td><td>n/a</td></tr><tr><td>APHYNITYTrue PDE</td><td>-9.17±0.02</td><td>n/a</td><td>1.4e-7</td></tr><tr><td>Neural ODE</td><td>-2.51±0.29</td><td>n/a</td><td>n/a</td></tr><tr><td rowspan="8">(b) Wave equation</td><td>Incomplete physics</td><td>Param PDE (c)</td><td>0.51±0.07</td><td>10.4</td><td>n/a</td></tr><tr><td rowspan="2"></td><td>APHYNITY Param PDE (c)</td><td>-4.64±0.25</td><td>0.31</td><td>71.</td></tr><tr><td>Param PDE (c,k)</td><td>-4.68±0.55</td><td>1.38</td><td></td></tr><tr><td rowspan="3">Complete physics</td><td>APHYNITY Param PDE (c, k)</td><td>-6.09±0.28</td><td>0.70</td><td>n/a 4.54</td></tr><tr><td>True PDE</td><td>-4.66±0.30</td><td>n/a</td><td></td></tr><tr><td>APHYNITYTrue PDE</td><td>-5.24±0.45</td><td>n/a</td><td>n/a 0.14</td></tr><tr><td>Data-driven</td><td>Neural ODE</td><td>-2.84±0.70</td><td>n/a</td><td></td></tr><tr><td rowspan="6">(c) Damped pendulum</td><td></td><td>Hamiltonian</td><td>-0.35±0.10</td><td></td><td>n/a</td></tr><tr><td rowspan="4">Incomplete physics</td><td></td><td>-3.97±1.20</td><td>n/a</td><td>n/a</td></tr><tr><td>APHYNITY Hamiltonian</td><td></td><td>n/a</td><td>623</td></tr><tr><td>Param ODE (ωo)</td><td>-0.14±0.10</td><td>13.2</td><td>n/a</td></tr><tr><td>Deep Galerkin Method (ωo) APHYNITY Param ODE (ωo)</td><td>-3.10±0.40 -7.86±0.60</td><td>22.1</td><td>n/a</td></tr><tr><td rowspan="5">Complete physics</td><td>Param ODE (wo,α)</td><td></td><td>4.0</td><td>132</td></tr><tr><td>Deep Galerkin Method (ωo, α)</td><td>-8.28±0.40 -3.14±0.40</td><td>0.45 7.1</td><td>n/a</td></tr><tr><td>APHYNITYParam ODE (ωo, α)</td><td>-8.31±0.30</td><td>0.39</td><td>n/a 8.5</td></tr><tr><td>True ODE</td><td>-8.58±0.20</td><td>n/a</td><td>n/a</td></tr><tr><td>APHYNITY True ODE</td><td>-8.44±0.20</td><td>n/a</td><td>2.3</td></tr></table>
|
| 130 |
+
|
| 131 |
+
# 4.2 RESULTS
|
| 132 |
+
|
| 133 |
+
We analyze and discuss below the results obtained for the three kind of dynamics. We successively examine different evaluation or quality criteria. The conclusions are consistent for the three problems, which allows us to highlight clear trends for all of them.
|
| 134 |
+
|
| 135 |
+
Forecasting accuracy The data-driven models do not perform well compared to True PDE/ODE (all values are test errors expressed as log MSE): -4.6 for PredRNN++ vs. -9.17 for reaction-diffusion, -2.51 vs. -5.24 for wave equation, and -2.84 vs. -8.44 for the pendulum in Table 1. The Deep Galerkin method for the pendulum in complete physics DGM $( \omega _ { 0 } , \alpha )$ , being constrained by the equation, outperforms Neural ODE but is far inferior to APHYNITY models. In the incomplete physics case, $D G M \left( \omega _ { 0 } \right)$ fails to compensate for the missing information. The incomplete physical models, Param $P D E \left( a , b \right)$ for the reaction-diffusion, Param PDE (c) for the wave equation, and Param $O D E \left( \omega _ { 0 } \right)$ and Hamiltonian models for the damped pendulum, have even poorer performances than purely data-driven ones, as can be expected since they ignore important dynamical components, e.g. friction in the pendulum case. Using APHYNITY with these imperfect physical models greatly improves forecasting accuracy in all cases, significantly outperforming purely data-driven models, and reaching results often close to the accuracy of the true ODE, when APHYNITY and the true ODE models are integrated with the same numerical scheme (which is different from the one used for data generation, hence the non-null errors even for the true equations), e.g. -5.92 vs. -5.24 for wave equation in
|
| 136 |
+
|
| 137 |
+

|
| 138 |
+
|
| 139 |
+

|
| 140 |
+
Figure 2: Comparison of predictions of two components $u$ (top) and $v$ (bottom) of the reactiondiffusion system. Note that $t = 4$ is largely beyond the dataset horizon $t = 2 . 5$ ).
|
| 141 |
+
Figure 3: Comparison between the prediction of APHYNITY when $c$ is estimated and Neural ODE for the damped wave equation. Note that $t + 3 2$ , last column for (a, b, c) is already beyond the training time horizon $( t + 2 5 )$ , showing the consistency of APHYNITY method.
|
| 142 |
+
|
| 143 |
+
Table 1. This clearly highlights the capacity of our approach to augment incomplete physical models with a learned data-driven component.
|
| 144 |
+
|
| 145 |
+
Physical parameter estimation Confirming the phenomenon mentioned in the introduction and detailed in Appendix C, incomplete physical models can lead to bad estimates for the relevant physical parameters: an error respectively up to $6 7 . 6 \%$ and $1 0 . 4 \%$ for parameters in the reaction-diffusion and wave equations, and an error of more than $13 \%$ for parameters for the pendulum in Table 1. APHYNITY is able to significantly improve physical parameters identification: $2 . 3 \%$ error for the reaction-diffusion, $0 . 3 \%$ for the wave equation, and $4 \%$ for the pendulum. This validates the fact that augmenting a simple physical model to compensate its approximations is not only beneficial for prediction, but also helps to limit errors for parameter identification when dynamical models do not fit data well. This is crucial for interpretability and explainability of the estimates.
|
| 146 |
+
|
| 147 |
+
Ablation study We conduct ablation studies to validate the importance of the APHYNITY augmentation compared to a naive strategy consisting in learning $F = F _ { p } + F _ { a }$ without taking care on the quality of the decomposition, as done in (Wang et al., 2019; Mehta et al., 2020). Results shown in Table 1 of Appendix F show a consistent gain of APHYNITY for the three use cases and for all physical models: for instance for Param ODE $( a , b )$ in reaction-diffusion, both forecasting performances $( \log \mathbf { M S E } = - 5 . 1 0$ vs. -4.56) and identification parameter $( \mathrm { E r r o r } { = 2 . 3 3 \% }$ vs. $6 . 3 9 \%$ ) improve. Other ablation results are provided in Appendix F showing the relevance of the the trajectory-based approach described in Section 3.2 (vs supervising over finite difference approximations of the derivative $F$ ).
|
| 148 |
+
|
| 149 |
+
Flexibility When applied to complete physical models, APHYNITY does not degrade accuracy, contrary to a vanilla cooperation scheme (see ablations in Appendix F). This is due to the least action principle of our approach: when the physical knowledge is sufficient for properly predicting the observed dynamics, the model learns to ignore the data-driven augmentation. This is shown by the norm of the trained neural net component $F _ { a }$ , which is reported in Table 1 last column: as expected, $\| F _ { a } \| ^ { 2 }$ diminishes as the complexity of the corresponding physical model increases, and, relative to incomplete models, the norm becomes very small for complete physical models (for example in the pendulum experiments, we have $\| F _ { a } \| = \dot { 8 } . 5$ for the APHYNITY model to be compared with 132 and 623 for the incomplete models). Thus, we see that the norm of $F _ { a }$ is a good indication of how imperfect the physical models ${ \mathcal { F } } _ { p }$ are. It highlights the flexibility of APHYNITY to successfully adapt to very different levels of prior knowledge. Note also that APHYNITY sometimes slightly improves over the true ODE, as it compensates the error introduced by different numerical integration methods for data simulation and training (see Appendix E).
|
| 150 |
+
|
| 151 |
+
Qualitative visualizations Results in Figure 2 for reaction-diffusion show that the incomplete diffusion parametric PDE in Figure 2(a) is unable to properly match ground truth simulations: the behavior of the two components in Figure 2(a) is reduced to simple independent diffusions due to the lack of interaction terms between $u$ and $v$ . By using APHYNITY in Figure 2(b), the correlation between the two components appears together with the formation of Turing patterns, which is very similar to the ground truth. This confirms that $F _ { a }$ can learn the reaction terms and improve prediction quality. In Figure 3, we see for the wave equation that the data-driven Neural ODE model fails at approximating $\mathrm { d } w \big / \mathrm { d } t$ as the forecast horizon increases: it misses crucial details for the second component $\mathrm { d } w \big / \mathrm { d } t$ which makes the forecast diverge from the ground truth. APHYNITY incorporates a Laplacian term as well as the data-driven $F _ { a }$ thus capturing the damping phenomenon and succeeding in maintaining physically sound results for long term forecasts, unlike Neural ODE.
|
| 152 |
+
|
| 153 |
+
Extension to non-stationary dynamics We provide additional results in Appendix G to tackle datasets where physical parameters of the equations vary in each sequence. To this end, we design an encoder able to perform parameter estimation for each sequence. Results show that APHYNITY accommodates well to this setting, with similar trends as those reported in this section.
|
| 154 |
+
|
| 155 |
+
Additional illustrations We give further visual illustrations to demonstrate how the estimation of parameters in incomplete physical models is improved with APHYNITY. For the reaction-diffusion equation, we show that the incomplete parametric PDE underestimates both diffusion coefficients. The difference is visually recognizable between the poorly estimated diffusion (Figure 4(a)) and the true one (Figure 4(c)) while APHYNITY gives a fairly good estimation of those diffusion parameters as shown in Figure 4(b).
|
| 156 |
+
|
| 157 |
+

|
| 158 |
+
Figure 4: Diffusion predictions using coefficient learned with (a) incomplete physical model Param PDE $( a , b )$ and (b) APHYNITY-augmented Param $\mathrm { P D E } ( a , b )$ , compared with the (c) true diffusion
|
| 159 |
+
|
| 160 |
+
# 5 CONCLUSION
|
| 161 |
+
|
| 162 |
+
In this work, we introduce the APHYNITY framework that can efficiently augment approximate physical models with deep data-driven networks, performing similarly to models for which the underlying dynamics are entirely known. We exhibit the superiority of APHYNITY over data-driven, incomplete physics, and state-of-the-art approaches combining ML and MB methods, both in terms of forecasting and parameter identification on three various classes of physical systems. Besides, APHYNITY is flexible enough to adapt to different approximation levels of prior physical knowledge.
|
| 163 |
+
|
| 164 |
+
An appealing perspective is the applicability of APHYNITY on partially-observable settings, such as video prediction. Besides, we hope that the APHYNITY framework will open up the way to the design of a wide range of more flexible MB/ML models, e.g. in climate science, robotics or reinforcement learning. In particular, analyzing the theoretical decomposition properties in a partially-observed setting is an important direction for future work.
|
| 165 |
+
|
| 166 |
+
# ACKNOWLEDGEMENTS:
|
| 167 |
+
|
| 168 |
+
Funding (P. Gallinari), Chaires de recherche et d’enseignement en intelligence artificielle (Chaires IA), DL4Clim project.
|
| 169 |
+
|
| 170 |
+
# REFERENCES
|
| 171 |
+
|
| 172 |
+
Ibrahim Ayed, Nicolas Cedilnik, Patrick Gallinari, and Maxime Sermesant. Ep-net: Learning cardiac electrophysiology models for physiology-based constraints in data-driven predictions. In Yves Coudière, Valéry Ozenne, Edward J. Vigmond, and Nejib Zemzemi (eds.), Functional Imaging and Modeling of the Heart - 10th International Conference, FIMH 2019, Bordeaux, France, June 6-8, 2019, Proceedings, volume 11504 of Lecture Notes in Computer Science, pp. 55–63. Springer, 2019a.
|
| 173 |
+
|
| 174 |
+
Ibrahim Ayed, Emmanuel de Bézenac, Arthur Pajot, Julien Brajard, and Patrick Gallinari. Learning dynamical systems from partial observations. arXiv preprint arXiv:1902.11136, 2019b.
|
| 175 |
+
|
| 176 |
+
Philipp Becker, Harit Pandya, Gregor Gebhardt, Cheng Zhao, James Taylor, and Gerhard Neumann. Recurrent kalman networks: Factorized inference in high-dimensional deep feature spaces. International Conference on Machine Learning (ICML), 2019.
|
| 177 |
+
|
| 178 |
+
Dimitri P. Bertsekas. Constrained Optimization and Lagrange Multiplier Methods (Optimization and Neural Computation Series). Athena Scientific, 1 edition, 1996.
|
| 179 |
+
|
| 180 |
+
Steven L. Brunton, Joshua L. Proctor, and J. Nathan Kutz. Discovering governing equations from data by sparse identification of nonlinear dynamical systems. Proceedings of the National Academy of Sciences, 113(15):3932–3937, 2016.
|
| 181 |
+
|
| 182 |
+
Tian Qi Chen, Yulia Rubanova, Jesse Bettencourt, and David K. Duvenaud. Neural ordinary differential equations. In Advances in neural information processing systems (NeurIPS), pp. 6571–6583, 2018.
|
| 183 |
+
|
| 184 |
+
Wen-Hua Chen. Disturbance observer based control for nonlinear systems. IEEE/ASME transactions on mechatronics, 9(4):706–710, 2004.
|
| 185 |
+
|
| 186 |
+
Zhengdao Chen, Jianyu Zhang, Martin Arjovsky, and Léon Bottou. Symplectic recurrent neural networks. International Conference on Learning Representations (ICLR), 2020.
|
| 187 |
+
|
| 188 |
+
Edward Choi, Mohammad Taha Bahadori, Jimeng Sun, Joshua Kulas, Andy Schuetz, and Walter Stewart. RETAIN: An interpretable predictive model for healthcare using reverse time attention mechanism. In Advances in Neural Information Processing Systems (NeurIPS), pp. 3504–3512, 2016.
|
| 189 |
+
|
| 190 |
+
Philippe Courtier, J-N Thépaut, and Anthony Hollingsworth. A strategy for operational implementation of 4d-var, using an incremental approach. Quarterly Journal of the Royal Meteorological Society, 120(519):1367–1387, 1994.
|
| 191 |
+
|
| 192 |
+
Miles Cranmer, Sam Greydanus, Stephan Hoyer, Peter Battaglia, David Spergel, and Shirley Ho. Lagrangian neural networks. ICLR 2020 Deep Differential Equations Workshop, 2020.
|
| 193 |
+
|
| 194 |
+
Emmanuel de Bézenac, Arthur Pajot, and Patrick Gallinari. Deep learning for physical processes: Incorporating prior scientific knowledge. International Conference on Learning Representations (ICLR), 2018.
|
| 195 |
+
|
| 196 |
+
Jérémie Donà, Jean-Yves Franceschi, Sylvain Lamprier, and Patrick Gallinari. Pde-driven spatiotemporal disentanglement. International Conference on Learning Representations (ICLR), 2020.
|
| 197 |
+
|
| 198 |
+
John R Dormand and Peter J Prince. A family of embedded runge-kutta formulae. Journal of computational and applied mathematics, 6(1):19–26, 1980.
|
| 199 |
+
|
| 200 |
+
James Fletcher and Warren Moors. Chebyshev sets. Journal of the Australian Mathematical Society, 98:161–231, 04 2014. doi: 10.1017/S1446788714000561.
|
| 201 |
+
|
| 202 |
+
P. Gentine, M. Pritchard, S. Rasp, G. Reinaudi, and G. Yacalis. Could machine learning break the convection parameterization deadlock? Geophysical Research Letters, 45(11):5742–5751, 2018.
|
| 203 |
+
|
| 204 |
+
Samuel Greydanus, Misko Dzamba, and Jason Yosinski. Hamiltonian neural networks. In Advances in Neural Information Processing Systems (NeurIPS), pp. 15353–15363, 2019.
|
| 205 |
+
|
| 206 |
+
Michael Janner, Justin Fu, Marvin Zhang, and Sergey Levine. When to trust your model: Modelbased policy optimization. In Advances in Neural Information Processing Systems (NeurIPS), pp. 12519–12530, 2019.
|
| 207 |
+
|
| 208 |
+
Gordon G Johnson. A nonconvex set which has the unique nearest point property. Journal of Approximation Theory, 51(4):289 – 332, 1987.
|
| 209 |
+
|
| 210 |
+
Rudolph Emil Kalman. A new approach to linear filtering and prediction problems. 1960.
|
| 211 |
+
|
| 212 |
+
Gene A. Klaasen and William C. Troy. Stationary wave solutions of a system of reaction-diffusion equations derived from the fitzhugh–nagumo equations. SIAM Journal on Applied Mathematics, 44(1):96–110, 1984. doi: 10.1137/0144008.
|
| 213 |
+
|
| 214 |
+
William Large and Stephen Yeager. Diurnal to decadal global forcing for ocean and sea-ice models: The data sets and flux climatologies, 05 2004.
|
| 215 |
+
|
| 216 |
+
Vincent Le Guen and Nicolas Thome. Disentangling physical dynamics from unknown factors for unsupervised video prediction. In Computer Vision and Pattern Recognition (CVPR). 2020.
|
| 217 |
+
|
| 218 |
+
Shihua Li, Jun Yang, Wen-Hua Chen, and Xisong Chen. Disturbance observer-based control: methods and applications. CRC press, 2014.
|
| 219 |
+
|
| 220 |
+
Yun Long, Xueyuan She, and Saibal Mukhopadhyay. Hybridnet: integrating model-based and data-driven learning to predict evolution of dynamical systems. Conference on Robot Learning (CoRL), 2018a.
|
| 221 |
+
|
| 222 |
+
Zichao Long, Yiping Lu, Xianzhong Ma, and Bin Dong. PDE-Net: Learning PDEs from data. In International Conference on Machine Learning (ICML), 2018b.
|
| 223 |
+
|
| 224 |
+
Viraj Mehta, Ian Char, Willie Neiswanger, Youngseog Chung, and Jeff Schneider. Neural dynamical systems. ICLR 2020 Deep Differential Equations Workshop, 2020.
|
| 225 |
+
|
| 226 |
+
Anusha Nagabandi, Gregory Kahn, Ronald S Fearing, and Sergey Levine. Neural network dynamics for model-based deep reinforcement learning with model-free fine-tuning. In 2018 IEEE International Conference on Robotics and Automation (ICRA), pp. 7559–7566. IEEE, 2018.
|
| 227 |
+
|
| 228 |
+
Boris N. Oreshkin, Dmitri Carpov, Nicolas Chapados, and Yoshua Bengio. N-BEATS: Neural basis expansion analysis for interpretable time series forecasting. International Conference on Learning Representations (ICLR), 2020.
|
| 229 |
+
|
| 230 |
+
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’Alché Buc, E. Fox, and R. Garnett (eds.), Advances in Neural Information Processing Systems 32, pp. 8024–8035. 2019.
|
| 231 |
+
|
| 232 |
+
Pascal Pernot and Fabien Cailliez. A critical review of statistical calibration/prediction models handling data inconsistency and model inadequacy. AIChE Journal, 63(10):4642–4665, 2017.
|
| 233 |
+
|
| 234 |
+
Dimitris C Psichogios and Lyle H Ungar. A hybrid neural network-first principles approach to process modeling. AIChE Journal, 38(10):1499–1511, 1992.
|
| 235 |
+
|
| 236 |
+
Maziar Raissi, Paris Perdikaris, and George Em Karniadakis. Physics-informed neural networks: A deep learning framework for solving forward and inverse problems involving nonlinear partial differential equations. Journal of Computational Physics, 473:686–707, 2019.
|
| 237 |
+
|
| 238 |
+
Markus Reichstein, Gustau Camps-Valls, Bjorn Stevens, Martin Jung, Joachim Denzler, Nuno Carvalhais, and & Prabhat. Deep learning and process understanding for data-driven Earth system science. Nature, 566:195–204, 2019.
|
| 239 |
+
|
| 240 |
+
R Rico-Martinez, JS Anderson, and IG Kevrekidis. Continuous-time nonlinear signal processing: a neural network based approach for gray box identification. In Proceedings of IEEE Workshop on Neural Networks for Signal Processing, pp. 596–605. IEEE, 1994.
|
| 241 |
+
|
| 242 |
+
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. In NeurIPS 2019 workshop on Climate Change with Machine Learning, 2019.
|
| 243 |
+
|
| 244 |
+
Priyabrata Saha, Saurabh Dash, and Saibal Mukhopadhyay. PHICNet: Physics-incorporated convolutional recurrent neural networks for modeling dynamical systems. arXiv preprint arXiv:2004.06243, 2020.
|
| 245 |
+
|
| 246 |
+
Sungyong Seo, Chuizheng Meng, and Yan Liu. Physics-aware difference graph networks for sparselyobserved dynamics. International Conference on Learning Representations (ICLR), 2020.
|
| 247 |
+
|
| 248 |
+
Xingjian Shi, Zhourong Chen, Hao Wang, Dit-Yan Yeung, Wai-Kin Wong, and Wang-chun Woo. Convolutional LSTM network: A machine learning approach for precipitation nowcasting. In Advances in neural information processing systems (NeurIPS), pp. 802–810, 2015.
|
| 249 |
+
|
| 250 |
+
Justin Sirignano and Konstantinos Spiliopoulos. Dgm: A deep learning algorithm for solving partial differential equations. Journal of computational physics, 375:1339–1364, 2018.
|
| 251 |
+
|
| 252 |
+
Michael L Thompson and Mark A Kramer. Modeling chemical processes using prior knowledge and neural networks. AIChE Journal, 40(8):1328–1340, 1994.
|
| 253 |
+
|
| 254 |
+
Peter Toth, Danilo Jimenez Rezende, Andrew Jaegle, Sébastien Racanière, Aleksandar Botev, and Irina Higgins. Hamiltonian generative networks. International Conference on Learning Representations (ICLR), 2020.
|
| 255 |
+
|
| 256 |
+
Jean-François Toubeau, Jérémie Bottieau, François Vallée, and Zacharie De Grève. Deep learningbased multivariate probabilistic forecasting for short-term scheduling in power markets. IEEE Transactions on Power Systems, 34(2):1203–1215, 2018.
|
| 257 |
+
|
| 258 |
+
Benjamin Ummenhofer, Lukas Prantl, Nils Thuerey, and Vladlen Koltun. Lagrangian fluid simulation with continuous convolutions. International Conference on Learning Representations (ICLR), 2020.
|
| 259 |
+
|
| 260 |
+
Qi Wang, Feng Li, Yi Tang, and Yan Xu. Integrating model-driven and data-driven methods for power system frequency stability assessment and control. IEEE Transactions on Power Systems, 34(6):4557–4568, 2019.
|
| 261 |
+
|
| 262 |
+
Yunbo Wang, Zhifeng Gao, Mingsheng Long, Jianmin Wang, and Philip S. Yu. PredRNN $^ { + + }$ : Towards a resolution of the deep-in-time dilemma in spatiotemporal predictive learning. In International Conference on Machine Learning (ICML), 2018.
|
| 263 |
+
|
| 264 |
+
# A REMINDER ON PROXIMINAL AND CHEBYSHEV SETS
|
| 265 |
+
|
| 266 |
+
We begin by giving a definition of proximinal and Chebyshev sets, taken from (Fletcher & Moors, 2014):
|
| 267 |
+
|
| 268 |
+
Definition 1. A proximinal set of a normed space $( E , \| \cdot \| )$ is a subset $\mathcal { C } \subset E$ such that every $x \in E$ admits at least a nearest point in $\mathcal { C }$ .
|
| 269 |
+
|
| 270 |
+
Definition 2. A Chebyshev set of a normed space $( E , \| \cdot \| )$ is a subset $\mathcal { C } \subset E$ such that every $x \in E$ admits a unique nearest point in $\mathcal { C }$ .
|
| 271 |
+
|
| 272 |
+
Proximinality reduces to a compacity condition in finite dimensional spaces. In general, it is a weaker one: Boundedly compact sets verify this property for example.
|
| 273 |
+
|
| 274 |
+
In Euclidean spaces, Chebyshev sets are simply the closed convex subsets. The question of knowing whether it is the case that all Chebyshev sets are closed convex sets in infinite dimensional Hilbert spaces is still an open question. In general, there exists examples of non-convex Chebyshev sets, a famous one being presented in (Johnson, 1987) for a non-complete inner-product space.
|
| 275 |
+
|
| 276 |
+
Given the importance of this topic in approximation theory, finding necessary conditions for a set to be Chebyshev and studying the properties of those sets have been the subject of many efforts. Some of those properties are summarized below:
|
| 277 |
+
|
| 278 |
+
• The metric projection on a boundedly compact Chebyshev set is continuous.
|
| 279 |
+
• If the norm is strict, every closed convex space, in particular any finite dimensional subspace is Chebyshev.
|
| 280 |
+
• In a Hilbert space, every closed convex set is Chebyshev.
|
| 281 |
+
|
| 282 |
+
# B PROOF OF PROPOSITIONS 1 AND 2
|
| 283 |
+
|
| 284 |
+
We prove the following result which implies both propositions in the article:
|
| 285 |
+
|
| 286 |
+
Proposition 3. The optimization problem:
|
| 287 |
+
|
| 288 |
+
$$
|
| 289 |
+
\operatorname* { m i n } _ { F _ { p } \in \mathcal { F } _ { p } , F _ { a } \in \mathcal { F } } \quad \| F _ { a } \| \quad \mathrm { s u b j e c t ~ t o } \quad \forall X \in \mathcal { D } , \forall t , \frac { \mathrm { d } X _ { t } } { \mathrm { d } t } = ( F _ { p } + F _ { a } ) ( X _ { t } )
|
| 290 |
+
$$
|
| 291 |
+
|
| 292 |
+
is equivalent a metric projection onto $\mathcal { F } _ { p }$
|
| 293 |
+
|
| 294 |
+
If ${ \mathcal { F } } _ { p }$ is proximinal, Eq. (5) admits a minimizing pair.
|
| 295 |
+
|
| 296 |
+
If ${ \mathcal { F } } _ { p }$ is Chebyshev, Eq. (5) admits a unique minimizing pair which $F _ { p }$ is the metric projection.
|
| 297 |
+
|
| 298 |
+
Proof. The idea is to reconstruct the full functional from the trajectories of $\mathcal { D }$ . By definition, $\mathcal { A }$ is the set of points reached by trajectories in $\mathcal { D }$ so that:
|
| 299 |
+
|
| 300 |
+
$$
|
| 301 |
+
\mathcal { A } = \{ x \in \mathbb { R } ^ { d } \mid \exists X . \in \mathcal { D } , \exists t , X _ { t } = x \}
|
| 302 |
+
$$
|
| 303 |
+
|
| 304 |
+
Then let us define a function $F ^ { \mathcal { D } }$ in the following way: For $a \in { \mathcal { A } }$ , we can find $X , \in { \mathcal { D } }$ and $t _ { 0 }$ such that $X _ { t _ { 0 } } = a$ . Differentiating $X$ at $t _ { 0 }$ , which is possible by definition of $\mathcal { D }$ , we take:
|
| 305 |
+
|
| 306 |
+
$$
|
| 307 |
+
\boldsymbol { F } ^ { \mathcal { D } } ( \boldsymbol { a } ) = \left. \frac { \mathrm { d } X _ { t } } { \mathrm { d } t } \right| _ { t = t _ { 0 } }
|
| 308 |
+
$$
|
| 309 |
+
|
| 310 |
+
For any $( F _ { p } , F _ { a } )$ satisfying the constraint in Eq. (5), we then have that $( F _ { p } + F _ { a } ) ( a ) = \mathrm { d } X _ { t } / \mathrm { d } t _ { | t _ { 0 } } =$ $F ^ { \mathcal { D } } ( a )$ for all $a \in { \mathcal { A } }$ . Conversely, any pair such that $( F _ { p } , F _ { a } ) \in \mathcal { F } _ { p } \times \mathcal { F }$ and $F _ { p } + F _ { a } = F ^ { \mathcal { D } }$ , verifies the constraint.
|
| 311 |
+
|
| 312 |
+
Thus we have the equivalence between Eq. (5) and the metric projection formulated as:
|
| 313 |
+
|
| 314 |
+
$$
|
| 315 |
+
\operatorname* { m i n i m i z e } _ { F _ { p } \in \mathcal { F } _ { p } } \quad \left\| F ^ { D } - F _ { p } \right\|
|
| 316 |
+
$$
|
| 317 |
+
|
| 318 |
+
If $\mathcal { F } _ { p }$ is proximinal, the projection problem admits a solution which we denote $F _ { p } ^ { \star }$ . Taking $F _ { a } ^ { \star } =$ $F ^ { \mathcal { D } } - F _ { p } ^ { \star }$ , we have that $F _ { p } ^ { \star } + F _ { a } ^ { \star } = F ^ { \mathcal { D } }$ so that $( F _ { p } ^ { \star } , F _ { a } ^ { \star } )$ verifies the constraint of Eq. (2). Moreover, if there is $( F _ { p } , F _ { a } )$ satisfying the constraint of Eq. (2), we have that $F _ { p } + F _ { a } = F ^ { \mathcal { D } }$ by what was shown above and $\| F _ { a } \| = \| F ^ { \mathcal { D } } - F _ { p } \| \ge \| F ^ { \mathcal { D } } - F _ { p } ^ { \star } \|$ by definition of $F _ { p } ^ { \star }$ . This shows that $( F _ { p } ^ { \star } , F _ { a } ^ { \star } )$ is minimal.
|
| 319 |
+
|
| 320 |
+
Moreover, if ${ \mathcal { F } } _ { p }$ is a Chebyshev set, by uniqueness of the projection, if $F _ { p } \neq F _ { p } ^ { \star }$ then $\left\| F _ { a } \right\| > \left\| F _ { a } ^ { \star } \right\|$ Thus the minimal pair is unique.
|
| 321 |
+
|
| 322 |
+
# C PARAMETER ESTIMATION IN INCOMPLETE PHYSICAL MODELS
|
| 323 |
+
|
| 324 |
+
Classically, when a set $\mathcal { F } _ { p } \subset \mathcal { F }$ summarising the most important properties of a system is available, this gives a simplified model of the true dynamics and the adopted problem is then to fit the trajectories using this model as well as possible, solving:
|
| 325 |
+
|
| 326 |
+
$$
|
| 327 |
+
\begin{array} { r l } { \underset { { \boldsymbol { F } } _ { p } \in { \mathcal { F } } _ { p } } { \mathrm { m i n i m i z e } } } & { \mathbb { E } _ { \boldsymbol { X } \sim \mathcal { D } } L ( \widetilde { \boldsymbol { X } } ^ { X _ { 0 } } , \boldsymbol { X } ) } \\ { \mathrm { s u b j e c t ~ t o } } & { \forall g \in \mathbb { Z } , \widetilde { X } _ { 0 } ^ { g } = g \mathrm { ~ a n d ~ } \forall t , \frac { \mathrm { d } \widetilde { X } _ { t } ^ { g } } { \mathrm { d } t } = F _ { p } ( \widetilde { X } _ { t } ^ { g } ) } \end{array}
|
| 328 |
+
$$
|
| 329 |
+
|
| 330 |
+
where $L$ is a discrepancy measure between trajectories. Recall that $\widetilde { X } ^ { X _ { 0 } }$ is the result trajectory of an ODE solver taking $X _ { 0 }$ as initial condition. In other words, we try to find a function $F _ { p }$ which gives trajectories as close as possible to the ones from the dataset. While estimation of the function becomes easier, there is then a residual part which is left unexplained and this can be a non negligible issue in at least two ways:
|
| 331 |
+
|
| 332 |
+
• When $F \notin \mathcal { F } _ { p }$ , the loss is strictly positive at the minimum. This means that reducing the space of functions ${ \mathcal { F } } _ { p }$ makes us lose in terms of accuracy.4 • The obtained function $F _ { p }$ might not even be the most meaningful function from ${ \mathcal { F } } _ { p }$ as it would try to capture phenomena which are not explainable with functions in ${ \mathcal { F } } _ { p }$ , thus giving the wrong bias to the calculated function. For example, if one is considering a dampened periodic trajectory where only the period can be learned in $\mathcal { F } _ { p }$ but not the dampening, the estimated period will account for the dampening and will thus be biased.
|
| 333 |
+
|
| 334 |
+
This is confirmed in the paper in Section 4: the incomplete physical models augmented with APHYNITY get different and experimentally better physical identification results than the physical models alone.
|
| 335 |
+
|
| 336 |
+
Let us compare our approach with this one on the linearized damped pendulum to show how estimates of physical parameters can differ. The equation is the following:
|
| 337 |
+
|
| 338 |
+
$$
|
| 339 |
+
{ \frac { \mathrm { d } ^ { 2 } \theta } { \mathrm { d } t ^ { 2 } } } + \omega _ { 0 } ^ { 2 } \theta + \alpha { \frac { \mathrm { d } \theta } { \mathrm { d } t } } = 0
|
| 340 |
+
$$
|
| 341 |
+
|
| 342 |
+
We take the same notations as in the article and parametrize the simplified physical models as:
|
| 343 |
+
|
| 344 |
+
$$
|
| 345 |
+
F _ { p } ^ { a } : X \mapsto ( { \frac { \mathrm { d } \theta } { \mathrm { d } t } } , - a \theta )
|
| 346 |
+
$$
|
| 347 |
+
|
| 348 |
+
where $a > 0$ corresponds to $\omega _ { 0 } ^ { 2 }$ . The corresponding solution for an initial state $X _ { 0 }$ , which we denote $X ^ { a }$ , can then written explicitly as:
|
| 349 |
+
|
| 350 |
+
$$
|
| 351 |
+
\theta _ { t } ^ { a } = \theta _ { 0 } \cos \sqrt { a } t
|
| 352 |
+
$$
|
| 353 |
+
|
| 354 |
+
Let us consider damped pendulum solutions $X$ written as:
|
| 355 |
+
|
| 356 |
+
$$
|
| 357 |
+
\theta _ { t } = \theta _ { 0 } e ^ { - t } \cos t
|
| 358 |
+
$$
|
| 359 |
+
|
| 360 |
+
which corresponds to:
|
| 361 |
+
|
| 362 |
+
$$
|
| 363 |
+
F : X \mapsto ( { \frac { \mathrm { d } \theta } { \mathrm { d } t } } , - 2 ( \theta + { \frac { \mathrm { d } \theta } { \mathrm { d } t } } ) )
|
| 364 |
+
$$
|
| 365 |
+
|
| 366 |
+
4This is true in theory, although not necessarily in practice when $F$ overfits a small dataset.
|
| 367 |
+
|
| 368 |
+
It is then easy to see that the estimate of $a$ with the physical model alone can be obtained by minimizing:
|
| 369 |
+
|
| 370 |
+
$$
|
| 371 |
+
\int _ { 0 } ^ { T } | e ^ { - t } \cos t - \cos \sqrt { a } t | ^ { 2 }
|
| 372 |
+
$$
|
| 373 |
+
|
| 374 |
+
This expression depends on $T$ and thus, depending on the chosen time interval and the way the integral is discretized will almost always give biased estimates. In other words, the estimated value of $a$ will not give us the desired solution $t \mapsto \cos t$ .
|
| 375 |
+
|
| 376 |
+
On the other hand, for a given $a$ , in the APHYNITY framework, the residual must be equal to:
|
| 377 |
+
|
| 378 |
+
$$
|
| 379 |
+
F _ { r } ^ { a } : X \mapsto ( 0 , ( a - 2 ) \theta - 2 { \frac { \mathrm { d } \theta } { \mathrm { d } t } } )
|
| 380 |
+
$$
|
| 381 |
+
|
| 382 |
+
in order to satisfy the fitting constraint. Here $a$ corresponds to $1 + \omega _ { 0 } ^ { 2 }$ not to $\omega _ { 0 } ^ { 2 }$ as in the simplified case. Minimizing its norm, we obtain $a = 2$ which gives us the desired solution:
|
| 383 |
+
|
| 384 |
+
$$
|
| 385 |
+
\theta _ { t } = \theta _ { 0 } e ^ { - t } \cos t
|
| 386 |
+
$$
|
| 387 |
+
|
| 388 |
+
with the right period.
|
| 389 |
+
|
| 390 |
+
# D DISCUSSION ON SUPERVISION OVER DERIVATIVES
|
| 391 |
+
|
| 392 |
+
In order to find the appropriate decomposition $( F _ { p } , F _ { a } )$ , we use a trajectory-based error by solving:
|
| 393 |
+
|
| 394 |
+
$$
|
| 395 |
+
\begin{array} { r l r } { \underset { \boldsymbol { F _ { p } } \in \mathcal { F } _ { p } , \boldsymbol { F _ { a } } \in \mathcal { F } } { \mathrm { m i n i m i z e } } } & { \| \boldsymbol { F _ { a } } \| } & \\ { \mathrm { s u b j e c t ~ t o } } & { \forall g \in \mathcal { T } , \ \widetilde { X } _ { 0 } ^ { g } = g \mathrm { ~ a n d ~ } \forall t , \ \frac { \mathrm { d } \widetilde { X } _ { t } ^ { g } } { \mathrm { d } t } = ( \boldsymbol { F _ { p } } + \boldsymbol { F _ { a } } ) ( \widetilde { X } _ { t } ^ { g } ) , } & \\ & { \forall X \in \mathcal { D } , \ L ( X , \widetilde { X } ^ { X _ { 0 } } ) = 0 } \end{array}
|
| 396 |
+
$$
|
| 397 |
+
|
| 398 |
+
In the continuous setting where the data is available at all times $t$ , this problem is in fact equivalent to the following one:
|
| 399 |
+
|
| 400 |
+
$$
|
| 401 |
+
\underset { F _ { p } \in \mathcal { F } _ { p } } { \mathrm { m i n i m i z e } } \quad \mathbb { E } _ { X \sim \mathcal { D } } \int \left\| \frac { \mathrm { d } X _ { t } } { \mathrm { d } t } - F _ { p } ( X _ { t } ) \right\|
|
| 402 |
+
$$
|
| 403 |
+
|
| 404 |
+
where the supervision is done directly over derivatives, obtained through finite-difference schemes. This echoes the proof in Section B of the Appendix where $F$ can be reconstructed from the continuous data.
|
| 405 |
+
|
| 406 |
+
However, in practice, data is only available at discrete times with a certain time resolution. While Eq. (9) is indeed equivalent to Eq. (8) in the continuous setting, in the practical discrete one, the way error propagates is not anymore: For Eq. (8) it is controlled over integrated trajectories while for Eq. (9) the supervision is over the approximate derivatives of the trajectories from the dataset. We argue that the trajectory-based approach is more flexible and more robust for the following reasons:
|
| 407 |
+
|
| 408 |
+
• In Eq. (8), if $F _ { a }$ is appropriately parameterized, it is possible to perfectly fit the data trajectories at the sampled points.
|
| 409 |
+
• The use of finite differences schemes to estimate $F$ as is done in Eq. (9) necessarily induces a non-zero discretization error.
|
| 410 |
+
• This discretization error is explosive in terms of divergence from the true trajectories.
|
| 411 |
+
|
| 412 |
+
This last point is quite important, especially when time sampling is sparse (even though we do observe this adverse effect empirically in our experiments with relatively finely time-sampled trajectories). The following gives a heuristical reasoning as to why this is the case. Let $\widetilde { \boldsymbol { F } } = \boldsymbol { F } + \boldsymbol { \epsilon }$ be the function estimated from the sampled points with an error $\epsilon$ such that $\| \epsilon \| _ { \infty } \leq \alpha$ . Denoting $\widetilde { X }$ the corresponding trajectory generated by $\widetilde { F }$ , we then have, for all $X \in { \mathcal { D } }$ :
|
| 413 |
+
|
| 414 |
+
$$
|
| 415 |
+
\forall t , \ \frac { \mathrm { d } ( X - \widetilde { X } ) _ { t } } { \mathrm { d } t } = F ( X _ { t } ) - F ( \widetilde { X } _ { t } ) - \epsilon ( \widetilde { X } _ { t } )
|
| 416 |
+
$$
|
| 417 |
+
|
| 418 |
+
Integrating over $[ 0 , T ]$ and using the triangular inequality as well as the mean value inequality, supposing that $F$ has uniformly bounded spatial derivatives:
|
| 419 |
+
|
| 420 |
+
$$
|
| 421 |
+
\forall t \in [ 0 , T ] , \ \lVert ( X - \widetilde { X } ) _ { t } \rVert \leq \lVert \nabla F \rVert _ { \infty } \int _ { 0 } ^ { t } \lVert X _ { s } - \widetilde { X } _ { s } \rVert + \alpha t
|
| 422 |
+
$$
|
| 423 |
+
|
| 424 |
+
which, using a variant of the Grönwall lemma, gives us the inequality:
|
| 425 |
+
|
| 426 |
+
$$
|
| 427 |
+
\forall t \in [ 0 , T ] , \ \lVert X _ { t } - \widetilde { X } _ { t } \rVert \leq \frac { \alpha } { \lVert \nabla F \rVert _ { \infty } } ( \exp ( \Vert \nabla F \Vert _ { \infty } t ) - 1 )
|
| 428 |
+
$$
|
| 429 |
+
|
| 430 |
+
When $\alpha$ tends to 0, we recover the true trajectories $X$ . However, as $\alpha$ is bounded away from 0 by the available temporal resolution, this inequality gives a rough estimate of the way $\widetilde { X }$ diverges from them, and it can be an equality in many cases. This exponential behaviour explains our choice of a trajectory-based optimization.
|
| 431 |
+
|
| 432 |
+
# E IMPLEMENTATION DETAILS
|
| 433 |
+
|
| 434 |
+
We describe here the three use cases studied in the paper for validating APHYNITY. All experiments are implemented with PyTorch (Paszke et al., 2019) and the differentiable ODE solvers with the adjoint method implemented in torchdiffeq.5
|
| 435 |
+
|
| 436 |
+
# E.1 REACTION-DIFFUSION EQUATIONS
|
| 437 |
+
|
| 438 |
+
The system is driven by a FitzHugh-Nagumo type PDE (Klaasen & Troy, 1984)
|
| 439 |
+
|
| 440 |
+
$$
|
| 441 |
+
\frac { \partial u } { \partial t } = a \Delta u + R _ { u } ( u , v ; k ) , \frac { \partial v } { \partial t } = b \Delta v + R _ { v } ( u , v )
|
| 442 |
+
$$
|
| 443 |
+
|
| 444 |
+
where $a$ and $b$ are respectively the diffusion coefficients of $u$ and $v , \Delta$ is the Laplace operator. The local reaction terms are $R _ { u } ( \dot { u , } v ; k ) = u - u ^ { 3 } - k - v , R _ { v } ( u , v ) = u - v$ .
|
| 445 |
+
|
| 446 |
+
The state $X = ( u , v )$ is defined over a compact rectangular domain $\Omega = [ - 1 , 1 ] ^ { 2 }$ with periodic boundary conditions. $\Omega$ is spatially discretized with a $3 2 \times 3 2 ~ 2 \mathrm { { D } }$ uniform square mesh grid. The periodic boundary condition is implemented with circular padding around the borders. $\Delta$ is systematically estimated with a $3 \times 3$ discrete Laplace operator.
|
| 447 |
+
|
| 448 |
+
Dataset Starting from a randomly sampled initial state $X _ { \mathrm { i n i t } } \in [ 0 , 1 ] ^ { 2 \times 3 2 \times 3 2 }$ , we generate states by integrating the true PDE with fixed $a , b$ , and $k$ in a dataset $( a = 1 \times 1 0 ^ { - 3 } , b = 5 \times 1 0 ^ { - 3 } , k = 5 \times 1 0 ^ { - 3 } )$ . We firstly simulate high time-resolution $( \delta t _ { \mathrm { s i m } } = 0 . 0 0 1 $ ) sequences with explicit finite difference method. We then extract states every $\delta t _ { \mathrm { d a t a } } = 0 . 1$ to construct our low time-resolution datasets.
|
| 449 |
+
|
| 450 |
+
We set the time of random initial state to $t = - 0 . 5$ and the time horizon to $t = 2 . 5$ . 1920 sequences are generated, with 1600 for training/validation and 320 for test. We take the state at $t = 0$ as $X _ { 0 }$ and predict the sequence until the horizon (equivalent to 25 time steps) in all reaction-diffusion experiments. Note that the sub-sequence with $t < 0$ are reserved for the extensive experiments in Appendix G.1.
|
| 451 |
+
|
| 452 |
+
Neural network architectures Our $F _ { a }$ here is a 3-layer convolution network (ConvNet). The two input channels are $( u , v )$ and two output ones are $\textstyle { \bigl ( } { \frac { \partial u } { \partial t } } , { \frac { \tilde { \partial } v } { \partial t } } { \bigr ) }$ . The purely data-driven Neural ODE uses such ConvNet as its $F$ . The detailed architecture is provided in Table 2. The estimated physical parameters $\theta _ { p }$ in $F _ { p }$ are simply a trainable vector $( a , \dot { b } ) \in \mathbb { R } _ { + } ^ { 2 }$ or $( a , b , k ) \in \mathbb { R } _ { + } ^ { 3 }$ .
|
| 453 |
+
|
| 454 |
+
Table 2: ConvNet architecture in reaction-diffusion and wave equation experiments, used as datadriven derivative operator in APHYNITY and Neural ODE (Chen et al., 2018).
|
| 455 |
+
|
| 456 |
+
<table><tr><td>Module</td><td>Specification</td></tr><tr><td>2D Conv. 2D Batch Norm.</td><td>3 × 3 kernel, 2 input channels,16 output channels,1 pixel zero padding No average tracking</td></tr><tr><td>ReLUactivation 2D Conv.</td><td>3 × 3 kernel, 16 input channels,16 output channels,1 pixel zero padding</td></tr><tr><td>2D Batch Norm. ReLU activation</td><td>No average tracking</td></tr><tr><td>2D Conv.</td><td>3 × 3 kernel, 16 input channels,2 output channels,1 pixel zero padding</td></tr></table>
|
| 457 |
+
|
| 458 |
+
Optimization hyperparameters We choose to apply the same hyperparameters for all the reactiondiffusion experiments: $N i t e r = 1 , \lambda _ { 0 } = 1 , \tau _ { 1 } = \dot { 1 } \stackrel { . } { \times } \dot { 1 } 0 ^ { - 3 } , \tau _ { 2 } = \dot { 1 } \stackrel { . } { \times } \dot { 1 } 0 ^ { 3 }$ .
|
| 459 |
+
|
| 460 |
+
# E.2 WAVE EQUATIONS
|
| 461 |
+
|
| 462 |
+
The damped wave equation is defined by
|
| 463 |
+
|
| 464 |
+
$$
|
| 465 |
+
\frac { \partial ^ { 2 } w } { \partial t ^ { 2 } } - c ^ { 2 } \Delta w + k \frac { \partial w } { \partial t } = 0
|
| 466 |
+
$$
|
| 467 |
+
|
| 468 |
+
where $c$ is the wave speed and $k$ is the damping coefficient. The state is $\begin{array} { r } { X = ( w , \frac { \partial w } { \partial t } ) } \end{array}$
|
| 469 |
+
|
| 470 |
+
We consider a compact spatial domain $\Omega$ represented as a $6 4 \times 6 4$ grid and discretize the Laplacian operator similarly. $\Delta$ is implemented using a $5 \times 5$ discrete Laplace operator in simulation whereas in the experiment is a $3 \times 3$ Laplace operator. Null Neumann boundary condition are imposed for generation.
|
| 471 |
+
|
| 472 |
+
Dataset $\delta t$ was set to 0.001 to respect Courant number and provide stable integration. The simulation was integrated using a 4th order finite difference Runge-Kutta scheme for 300 steps from an initial Gaussian state, i.e for all sequence at $t = 0$ , we have:
|
| 473 |
+
|
| 474 |
+
$$
|
| 475 |
+
w ( x , y , t = 0 ) = C \times \exp ^ { \frac { ( x - x _ { 0 } ) ^ { 2 } + ( y - y _ { 0 } ) ^ { 2 } } { \sigma ^ { 2 } } }
|
| 476 |
+
$$
|
| 477 |
+
|
| 478 |
+
The amplitude $C$ is fixed to 1, and $( x _ { 0 } , y _ { 0 } ) = ( 3 2 , 3 2 )$ to make the Gaussian curve centered for all sequences. However, $\sigma$ is different for each sequence and uniformly sampled in [10, 100]. The same $\delta t$ was used for train and test. All initial conditions are Gaussian with varying amplitudes. 250 sequences are generated, 200 are used for training while 50 are reserved as a test set. In the main paper setting, $c = 3 3 0$ and $k = 5 0$ . As with the reaction diffusion case, the algorithm takes as input a state $\begin{array} { r } { X _ { t _ { 0 } } = ( w , \frac { \mathrm { d } w } { \mathrm { d } t } ) ( t _ { 0 } ) } \end{array}$ and predicts all states from $t _ { 0 } + \delta t$ up to $t _ { 0 } + 2 5 \delta t$ .
|
| 479 |
+
|
| 480 |
+
Neural network architectures The neural network for $F _ { a }$ is a 3-layer convolution neural network with the same architecture as in Table 2. For $F _ { p }$ , the parameter(s) to be estimated is either a scalar $c \in \mathbb { R } _ { + }$ or a vector $( c , k ) \in \mathbb { R } _ { + } ^ { 2 }$ . Similarly, Neural ODE networks are build as presented in Table 2.
|
| 481 |
+
|
| 482 |
+
Optimization hyperparameters We use the same hyperparameters for the experiments: $\bar { N i t e r } = 3 , \lambda _ { 0 } = \bar { 1 } , \bar { \tau _ { 1 } } = 1 \times 1 0 ^ { - 4 } , \tau _ { 2 } = 1 \times 1 0 ^ { 2 }$ .
|
| 483 |
+
|
| 484 |
+
# E.3 DAMPED PENDULUM
|
| 485 |
+
|
| 486 |
+
We consider the non-linear damped pendulum problem, governed by the ODE
|
| 487 |
+
|
| 488 |
+
$$
|
| 489 |
+
{ \frac { \mathrm { d } ^ { 2 } \theta } { \mathrm { d } t ^ { 2 } } } + \omega _ { 0 } ^ { 2 } \sin \theta + \alpha { \frac { \mathrm { d } \theta } { \mathrm { d } t } } = 0
|
| 490 |
+
$$
|
| 491 |
+
|
| 492 |
+
$\theta ( t )$ $\begin{array} { r } { \omega _ { 0 } = \frac { 2 \pi } { T _ { 0 } } } \end{array}$ proper pulsation , the ODE can b $T _ { 0 }$ being thritten as $\alpha$ is thwith $\begin{array} { r } { X = ( \theta , \frac { \mathrm { d } \theta } { \mathrm { d } t } ) } \end{array}$ $\begin{array} { r } { \frac { \mathrm { d } \boldsymbol { X } _ { t } } { \mathrm { d } t } = \boldsymbol { F } ( \boldsymbol { X } _ { t } ) } \end{array}$ $F : X \mapsto$ $\textstyle \bigl ( { \frac { \mathrm { d } \theta } { \mathrm { d } t } } , - \omega _ { 0 } ^ { 2 } \sin \theta - \alpha { \frac { \mathrm { d } \theta } { \mathrm { d } t } } \bigr )$
|
| 493 |
+
|
| 494 |
+
Dataset For each train / validation / test split, we simulate a dataset with 25 trajectories of 40 timesteps (time interval [0, 20], timestep $\delta t = 0 . 5$ ) with fixed ODE coefficients $( T _ { 0 } = 1 2 , \alpha = 0 . 2 )$ and varying initial conditions. The simulation integrator is Dormand-Prince Runge-Kutta method of order (4)5 (DOPRI5, Dormand & Prince, 1980). We also add a small amount of white gaussian noise $\sigma = 0 . 0 1$ ) to the state. Note that our pendulum dataset is much more challenging than the ideal frictionless pendulum considered in Greydanus et al. (2019).
|
| 495 |
+
|
| 496 |
+
Neural network architectures We detail in Table 3 the neural architectures used for the damped pendulum experiments. All data-driven augmentations for approximating the mapping $X _ { t } \mapsto F ( X _ { t } )$ are implemented by multi-layer perceptrons (MLP) with 3 layers of 200 neurons and ReLU activation functions (except at the last layer: linear activation). The Hamiltonian (Greydanus et al., 2019; Toth et al., 2020) is implemented by a MLP that takes the state $X _ { t }$ and outputs a scalar estimation of the Hamiltonian $\mathcal { H }$ of the system: the derivative is then computed by an in-graph gradient of $\mathcal { H }$ with respect to the input: $\begin{array} { r } { \dot { F ( X _ { t } ) } = \left( \frac { \partial \mathcal { H } } { \partial ( \mathrm { d } \theta / \mathrm { d } t ) } , - \frac { \partial \mathcal { H } } { \mathrm { d } \theta } \right) } \end{array}$
|
| 497 |
+
|
| 498 |
+
Table 3: Neural network architectures for the damped pendulum experiments. $\mathrm { n / a }$ corresponds to non-applicable cases.
|
| 499 |
+
|
| 500 |
+
<table><tr><td>Method</td><td>Physical model</td><td>Data-driven model</td></tr><tr><td colspan="2">Neural ODE n/a</td><td>MLP(in=2,units=200,layers=3,out=2)</td></tr><tr><td>Hamiltonian APHYNITY Hamiltonian</td><td>MLP(in=2,units=200,layers=3,out=1) MLP(in=2,units=200,layers=3,out=1)</td><td>n/a MLP(in=2,units=200,layers=3,out=2)</td></tr><tr><td>Param ODE (wo) APHYNITY Param ODE (ωo)</td><td>1 trainable parameter wo</td><td>n/a MLP(in=2,units=200,layers=3,out=2)</td></tr><tr><td></td><td>1 trainable parameter ωo</td><td></td></tr><tr><td>Param ODE (ωo, α) APHYNITY Param ODE (wo,α)</td><td>2 trainable parameters w,入 2 trainable parameters ωo,入</td><td>n/a MLP(in=2,units=200,layers=3,out=2)</td></tr></table>
|
| 501 |
+
|
| 502 |
+
Optimization hyperparameters The hyperparameters of the APHYNITY optimization algorithm $( N i t e r , \lambda _ { 0 } , \tau _ { 1 } , \tau _ { 2 } )$ were cross-validated on the validation set and are shown in Table 4. All models were trained with a maximum number of 5000 steps with early stopping.
|
| 503 |
+
|
| 504 |
+
Table 4: Hyperparameters of the damped pendulum experiments.
|
| 505 |
+
|
| 506 |
+
<table><tr><td>Method</td><td>Niter</td><td>入0</td><td>T1</td><td>T2</td></tr><tr><td>APHYNITY Hamiltonian</td><td>5</td><td>1</td><td>1</td><td>0.1</td></tr><tr><td>APHYNITY ParamODE (ωo)</td><td>5</td><td>1</td><td>1</td><td>10</td></tr><tr><td>APHYNITY ParamODE (ωo,入)</td><td>5</td><td>1000</td><td>1</td><td>100</td></tr></table>
|
| 507 |
+
|
| 508 |
+
# F ABLATION STUDY
|
| 509 |
+
|
| 510 |
+
We conduct ablation studies to show the effectiveness of APHYNITY’s adaptive optimization and trajectory-based learning scheme.
|
| 511 |
+
|
| 512 |
+
# F.1 ABLATION TO VANILLA MB/ML COOPERATION
|
| 513 |
+
|
| 514 |
+
In Table 5, we consider the ablation case with the vanilla augmentation scheme found in Le Guen & Thome (2020); Wang et al. (2019); Mehta et al. (2020), which does not present any proper decomposition guarantee. We observe that the APHYNITY cooperation scheme outperforms this vanilla scheme in all case, both in terms of forecasting performances (e.g. log $\mathrm { M S E } { = } { - 0 . 3 5 }$ vs. -3.97 for the Hamiltonian in the pendulum case) and parameter identification (e.g. Err Param ${ \it 1 } = 8 . 4 \%$ vs. 2.3 for Param PDE $[ a , b$ for reaction-diffusion). It confirms the crucial benefits of APHYNITY’s principled decomposition scheme.
|
| 515 |
+
|
| 516 |
+
Table 5: Ablation study comparing APHYNITY to the vanilla augmentation scheme (Wang et al., 2019; Mehta et al., 2020) for the reaction-diffusion equation, wave equation and damped pendulum.
|
| 517 |
+
|
| 518 |
+
<table><tr><td>Dataset</td><td>Method</td><td>log MSE</td><td>%Err Param.</td><td>|Fall²2</td></tr><tr><td rowspan="3">Reaction- diffusion</td><td>Param. PDE (a,b) with vanilla aug. APHYNITY Param. PDE (a,b)</td><td>-4.56±0.52 -5.10±0.21</td><td>8.4 2.3</td><td>(7.5±1.4)e1 (6.7±0.4)e1</td></tr><tr><td>Param. PDE (a,b, k) with vanilla aug. APHYNITY Param. PDE (a,b, k)</td><td>-8.04±0.03 -9.35±0.02</td><td>25.4 0.096</td><td>(1.5±0.2)e-2 (1.5±0.4)e-6</td></tr><tr><td>True PDE with vanilla aug. APHYNITY True PDE</td><td>-8.12±0.05 -9.17±0.02</td><td>n/a n/a</td><td>(6.1±2.3)e-4 (1.4±0.8)e-7</td></tr><tr><td rowspan="2">Wave equation</td><td>Param PDE (c) with vanilla aug. APHYNITY Param PDE (c)</td><td>-3.90 ± 0.27 -4.64±0.25</td><td>0.51 0.31</td><td>88.66 71.0</td></tr><tr><td>Param PDE (c, k) with vanilla aug. APHYNITY Param PDE (c, k)</td><td>-5.96 ± 0.10 -6.09±0.28</td><td>0.71 0.70</td><td>25.1 4.54</td></tr><tr><td rowspan="4">Damped pendulum</td><td>Hamiltonian with vanilla aug. APHYNITY Hamiltonian</td><td>-0.35±0.1 -3.97±1.2</td><td>n/a n/a</td><td>837±117 623±68</td></tr><tr><td>Param ODE (ωo) with vanilla aug. APHYNITY Param ODE (ωo)</td><td>-7.02±1.7 -7.86±0.6</td><td>4.5 4.0</td><td>148±49</td></tr><tr><td>Param ODE (wo,α) with vanilla aug. APHYNITY Param ODE (ωo, α)</td><td>-7.60±0.6</td><td>4.65</td><td>132±11 35.5±6.2</td></tr><tr><td>Augmented True ODE with vanilla aug. APHYNITY True ODE</td><td>-8.31±0.3 -8.40±0.2 -8.44±0.2</td><td>0.39 n/a n/a</td><td>8.5±2.0 3.4±0.8 2.3±0.4</td></tr></table>
|
| 519 |
+
|
| 520 |
+
# F.2 DETAILED ABLATION STUDY
|
| 521 |
+
|
| 522 |
+
We conduct also two other ablations in Table 6:
|
| 523 |
+
|
| 524 |
+
• derivative supervision: in which $F _ { p } + F _ { a }$ is trained with supervision over approximated derivatives on ground truth trajectory, as performed in Greydanus et al. (2019); Cranmer et al. (2020). More precisely, APHYNITY’s ${ \mathcal { L } } _ { \mathrm { t r a j } }$ is here replaced with $\begin{array} { r } { \mathcal { L } _ { \mathrm { d e r i v } } = \| \frac { \mathrm { d } X _ { t } } { \mathrm { d } t } - F ( X _ { t } ) \| } \end{array}$ as in Eq. (9), where $\frac { \mathrm { d } X _ { t } } { \mathrm { d } t }$ is approximated by finite differences on $X _ { t }$ . • non-adaptive optim.: in which we train APHYNITY by minimizing $\| F _ { a } \|$ without the adaptive optimization of $\lambda$ shown in Algorithm 1. This case is equivalent to $\lambda = 1 , \tau _ { 2 } = 0$ .
|
| 525 |
+
|
| 526 |
+
We highlight the importance to use a principled adaptive optimization algorithm (APHYNITY algorithm described in paper) compared to a non-adpative optimization: for example in the reactiondiffusion case, log $\mathrm { M S E } { = } { - 4 . 5 5 }$ vs. -5.10 for Param PDE $( a , b )$ . Finally, when the supervision occurs on the derivative, both forecasting and parameter identification results are systematically lower than with APHYNITY’s trajectory based approach: for example, $\log { \mathrm { M S E } } { = } { - } 1 . 1 6$ vs. -4.64 for Param PDE $( c )$ in the wave equation. It confirms the good properties of the APHYNITY training scheme.
|
| 527 |
+
|
| 528 |
+
Table 6: Detailed ablation study on supervision and optimization for the reaction-diffusion equation, wave equation and damped pendulum.
|
| 529 |
+
|
| 530 |
+
<table><tr><td>Dataset</td><td>Method</td><td>log MSE</td><td>%Err Param.</td><td>|Fall2</td></tr><tr><td rowspan="4">Reaction- diffusion</td><td>Augmented Param.PDE (a,b) derivative supervision Augmented Param. PDE(a,b) non-adaptive optim.</td><td>-4.42±0.25 -4.55±0.11</td><td>12.6 7.5</td><td>(6.8±0.6)e1 (7.6±1.0)e1</td></tr><tr><td>APHYNITY Param. PDE (a, b)</td><td>-5.10±0.21</td><td>2.3</td><td>(6.7±0.4)e1</td></tr><tr><td>Augmented Param.PDE (a,b, k) derivative supervision Augmented Param.PDE (a,b,k) non-adaptive optim.</td><td>-4.90±0.06 -9.10±0.02</td><td>11.7</td><td>(1.9±0.3)e-1</td></tr><tr><td>APHYNITY Param.PDE (a,b,k) Augmented True PDE derivative supervision Augmented True PDE non-adaptive optim.</td><td>-9.35±0.02 -6.03±0.01</td><td>0.21 0.096 n/a</td><td>(5.5±2.9)e-7 (1.5±0.4)e-6 (3.1±0.8)e-3</td></tr><tr><td rowspan="4">Wave equation</td><td>APHYNITY True PDE Augmented Param PDE (c) derivative supervision</td><td>-9.01±0.01 -9.17±0.02 -1.16±0.48</td><td>n/a n/a 12.1</td><td>(1.5±0.8)e-6 (1.4±0.8)e-7 0.00024</td></tr><tr><td>Augmented Param PDE (c) non-adaptive optim. APHYNITY Param PDE (c) Augmented Param PDE (c, k) derivative supervision</td><td>-2.57±0.21 -4.64±0.25 -4.19±0.36</td><td>3.1 0.31 7.2</td><td>43.6 71.0 0.00012</td></tr><tr><td>Augmented Param PDE (c, k) non-adaptive optim. APHYNITY Param PDE (c, k)</td><td>-4.93±0.51 -6.09±0.28</td><td>1.32 0.70</td><td>0.054 4.54</td></tr><tr><td>Augmented True PDE derivative supervision Augmented True PDE non-adaptive optim. APHYNITY True PDE</td><td>-4.42 ± 0.33 -4.97±0.49 -5.24±0.45</td><td>n/a n/a</td><td>6.02e-5 0.23</td></tr><tr><td rowspan="6">Damped pendulum</td><td>Augmented Hamiltonian derivative supervision Augmented Hamiltonian non-adaptive optim.</td><td>-0.83±0.3</td><td>n/a n/a</td><td>0.14 642±121</td></tr><tr><td>APHYNITYHamiltonian</td><td>-0.49±0.58 -3.97±1.2</td><td>n/a n/a</td><td>165±30 623±68</td></tr><tr><td>Augmented Param ODE (ωo) derivative supervision Augmented Param ODE (ωo) non-adaptive optim. APHYNITY Param ODE (ωo)</td><td>-1.02±0.04 -4.30±1.3</td><td>5.8 4.4</td><td>136±13 90.4±27</td></tr><tr><td>Augmented Param ODE (ωo,α) derivative supervision</td><td>-7.86±0.6 -2.61±0.2</td><td>4.0 5.0</td><td>132±11</td></tr><tr><td>Augmented Param ODE (ωo,α) non-adaptive optim. APHYNITY Param ODE (ωo, α)</td><td>-7.69±1.3</td><td>1.65</td><td>3.2±1.7 4.8±7.7</td></tr><tr><td>Augmented True ODE derivative supervision</td><td>-8.31±0.3 -2.14±0.3</td><td>0.39</td><td>8.5±2.0</td></tr><tr><td>Augmented True ODE non-adaptive optim. APHYNITY True ODE</td><td></td><td>-8.34±0.4 -8.44±0.2</td><td>n/a n/a n/a</td><td>4.1±0.6 1.4±0.3 2.3±0.4</td></tr></table>
|
| 531 |
+
|
| 532 |
+
# G ADDITIONAL EXPERIMENTS
|
| 533 |
+
|
| 534 |
+
# G.1 REACTION-DIFFUSION SYSTEMS WITH VARYING DIFFUSION PARAMETERS
|
| 535 |
+
|
| 536 |
+
We conduct an extensive evaluation on a setting with varying diffusion parameters for reactiondiffusion equations. The only varying parameters are diffusion coefficients, i.e. individual $a$ and $b$ for each sequence. We randomly sample $\mathbf { \bar { \alpha } } a \in [ 1 \times 1 0 ^ { - 3 } , 2 \times 1 0 ^ { - 3 } ]$ and $b \in [ 3 \times 1 0 ^ { - 3 } , 7 \times 1 0 ^ { - 3 } ]$ . $k$ is still fixed to $5 \times 1 0 ^ { - 3 }$ across the dataset.
|
| 537 |
+
|
| 538 |
+
In order to estimate $a$ and $b$ for each sequence, we use here a ConvNet encoder $E$ to estimate parameters from 5 reserved frames $( t < 0 )$ ). The architecture of the encoder $E$ is similar to the one in Table 2 except that $E$ takes 5 frames (10 channels) as input and $E$ outputs a vector of estimated $( \tilde { a } , \tilde { b } )$ after applying a sigmoid activation scaled by $1 \times 1 0 ^ { - 2 }$ (to avoid possible divergence). For the baseline Neural ODE, we concatenate $a$ and $b$ to each sequence as two channels.
|
| 539 |
+
|
| 540 |
+
In Table 7, we observe that combining data-driven and physical components outperforms the pure data-driven one. When applying APHYNITY to Param PDE $( a , b )$ , the prediction precision is significantly improved (log MSE: -1.32 vs. -4.32) with $a$ and $b$ respectively reduced from $5 5 . 6 \%$ and $5 4 . 1 \%$ to $1 1 . 8 \%$ and $1 8 . 7 \%$ . For complete physics cases, the parameter estimations are also improved for Param PDE $( a , b , k )$ by reducing over $60 \%$ of the error of $b$ (3.10 vs. 1.23) and $10 \%$ to $20 \%$ of the errors of $a$ and $k$ (resp. 1.55/0.59 vs. 1.29/0.39).
|
| 541 |
+
|
| 542 |
+
The extensive results reflect the same conclusion as shown in the main article: APHYNITY improves the prediction precision and parameter estimation. The same decreasing tendency of $\| F _ { a } \|$ is also confirmed.
|
| 543 |
+
|
| 544 |
+
Table 7: Results of the dataset of reaction-diffusion with varying $( a , b )$ . $k = 5 \times 1 0 ^ { - 3 }$ is shared across the dataset.
|
| 545 |
+
|
| 546 |
+
<table><tr><td></td><td>Method</td><td>log MSE</td><td>%Err a</td><td>%Err b</td><td>%Err k</td><td>|Fall2</td></tr><tr><td>Data- driven</td><td>Neural ODE (Chen et al., 2018)</td><td>-3.61±0.07</td><td>n/a</td><td>n/a</td><td>n/a</td><td>n/a</td></tr><tr><td rowspan="2">Incomplete physics</td><td>Param PDE (a,b)</td><td>-1.32±0.02</td><td>55.6</td><td>54.1</td><td>n/a</td><td>n/a</td></tr><tr><td>APHYNITY Param PDE (a, b)</td><td>-4.32±0.32</td><td>11.8</td><td>18.7</td><td>n/a</td><td>(4.3±0.6)e1</td></tr><tr><td rowspan="4">Complete physics</td><td>Param PDE (a,b, k)</td><td>-5.54±0.38</td><td>1.55</td><td>3.10</td><td>0.59</td><td>n/a</td></tr><tr><td>APHYNITY Param PDE (a, b, k)</td><td>-5.72±0.25</td><td>1.29</td><td>1.23</td><td>0.39</td><td>(5.9±4.3)e-1</td></tr><tr><td>True PDE</td><td>-8.86±0.02</td><td>n/a</td><td>n/a</td><td>n/a</td><td>n/a</td></tr><tr><td>APHYNITY True PDE</td><td>-8.82±0.15</td><td>n/a</td><td>n/a</td><td>n/a</td><td>(1.8±0.6)e-5</td></tr></table>
|
| 547 |
+
|
| 548 |
+
# G.2 ADDITIONAL RESULTS FOR THE WAVE EQUATION
|
| 549 |
+
|
| 550 |
+
We conduct an experiment where each sequence is generated with a different wave celerity. This dataset is challenging because both $c$ and the initial conditions vary across the sequences. For each simulated sequence, an initial condition is sampled as described previously, along with a wave celerity $c$ also sampled uniformly in [300, 400]. Finally our initial state is integrated with the same Runge-Kutta scheme. 200 of such sequences are generated for training while 50 are kept for testing.
|
| 551 |
+
|
| 552 |
+
For this experiment, we also use a ConvNet encoder to estimate the wave speed $c$ from 5 consecutive reserved states $\begin{array} { r } { ( w , \frac { \partial w } { \partial t } ) } \end{array}$ . The architecture of the encoder $E$ is the same as in Table 2 but with 10 input channels. Here also, $k$ is fixed for all sequences and $k = 5 0$ . The hyper-parameters used in these experiments are the same than described in the Section E.2.
|
| 553 |
+
|
| 554 |
+
The results when multiple wave speeds $c$ are in the dataset are consistent with the one present when only one is considered. Indeed, while prediction performances are slightly hindered, the parameter estimation remains consistent for both $c$ and $k$ . This extension provides elements attesting for the robustness and adaptability of our method to more complex settings. Finally the purely data-driven Neural-ODE fails to cope with the increasing difficulty.
|
| 555 |
+
|
| 556 |
+
Table 8: Results for the damped wave equation when considering multiple $c$ sampled uniformly in [300, 400] in the dataset, $k$ is shared across all sequences and $k = 5 0$ .
|
| 557 |
+
|
| 558 |
+
<table><tr><td></td><td>Method</td><td>log MSE</td><td>%Error c</td><td>%Error k</td><td>Fall²</td></tr><tr><td>Data- driven</td><td>Neural ODE</td><td>0.056±0.34</td><td>n/a</td><td>n/a</td><td>n/a</td></tr><tr><td rowspan="2">Incomplete physics</td><td>Param PDE (c)</td><td>-1.32±0.27</td><td>23.9</td><td>n/a</td><td>n/a</td></tr><tr><td>APHYNITY Param PDE (c)</td><td>-4.51±0.38</td><td>3.2</td><td>n/a</td><td>171</td></tr><tr><td rowspan="4">Complete physics</td><td>Param PDE (c, k)</td><td>-4.25±0.28</td><td>3.54</td><td>1.43</td><td>n/a</td></tr><tr><td>APHYNITY Param PDE (c, k)</td><td>-4.84±0.57</td><td>2.41</td><td>0.064</td><td>3.64</td></tr><tr><td>True PDE (c, k)</td><td>-4.51±0.29</td><td>n/a</td><td>n/a</td><td>n/a</td></tr><tr><td>APHYNITY True PDE (c, k)</td><td>-4.49±0.22</td><td>n/a</td><td>n/a</td><td>0.0005</td></tr></table>
|
| 559 |
+
|
| 560 |
+
# G.3 DAMPED PENDULUM WITH VARYING PARAMETERS
|
| 561 |
+
|
| 562 |
+
To extend the experiments conducted in the paper (section 4) with fixed parameters $( T _ { 0 } = 6 , \alpha = 0 . 2 )$ and varying initial conditions, we evaluate APHYNITY on a much more challenging dataset where we vary both the parameters $( T _ { 0 } , \alpha )$ and the initial conditions between trajectories.
|
| 563 |
+
|
| 564 |
+
We simulate 500/50/50 trajectories for the train/valid/test sets integrated with DOPRI5. For each trajectory, the period $T _ { 0 }$ (resp. the damping coefficient $\alpha$ ) are sampled uniformly in the range [3, 10] (resp. [0, 0.5]).
|
| 565 |
+
|
| 566 |
+
We train models that take the first 20 steps as input and predict the next 20 steps. To account for the varying ODE parameters between sequences, we use an encoder that estimates the parameters based on the first 20 timesteps. In practice, we use a recurrent encoder composed of 1 layer of 128 GRU units. The output of the encoder is fed as additional input to the data-driven augmentation models and to an MLP with final softplus activations to estimate the physical parameters when necessary $( \omega _ { 0 } \in \mathbb { R } _ { + }$ for Param ODE $\left( \omega _ { 0 } \right)$ , $( \omega _ { 0 } , \alpha ) \in \mathbb { R } _ { + } ^ { 2 }$ for Param ODE $( \omega _ { 0 } , \alpha ) _ { , } ^ { \prime }$ ).
|
| 567 |
+
|
| 568 |
+
In this varying ODE context, we also compare to the state-of-the-art univariate time series forecasting method N-Beats (Oreshkin et al., 2020).
|
| 569 |
+
|
| 570 |
+
Results shown in Table 9 are consistent with those presented in the paper. Pure data-driven models Neural ODE (Chen et al., 2018) and N-Beats (Oreshkin et al., 2020) fail to properly extrapolate the pendulum dynamics. Incomplete physical models (Hamiltonian and ParamODE $\left( \omega _ { 0 } \right)$ ) are even worse since they do not account for friction. Augmenting them with APHYNITY significantly and consistently improves forecasting results and parameter identification.
|
| 571 |
+
|
| 572 |
+
Table 9: Forecasting and identification results on the damped pendulum dataset with different parameters for each sequence. log MSEs are computed over 20 predicted time-steps. For each level of incorporated physical knowledge, equivalent best results according to a Student t-test are shown in bold. n/a corresponds to non-applicable cases.
|
| 573 |
+
|
| 574 |
+
<table><tr><td>Method</td><td></td><td>log MSE</td><td>%Error To</td><td>%Error α</td><td>|Fal2</td></tr><tr><td rowspan="2">data- driven</td><td>Neural ODE (Chen et al., 2018)</td><td>-4.35±0.9</td><td>n/a</td><td>n/a</td><td>n/a</td></tr><tr><td>N-Beats (Oreshkin et al., 2020)</td><td>-4.57±0.5</td><td>n/a</td><td>n/a</td><td>n/a</td></tr><tr><td rowspan="4">Incomplete physics</td><td>Hamiltonian (Greydanus et al., 2019)</td><td>-1.31±0.4</td><td>n/a</td><td>n/a</td><td>n/a</td></tr><tr><td>APHYNITY Hamiltonian</td><td>-4.72±0.4</td><td>n/a</td><td>n/a</td><td>5.6±0.6</td></tr><tr><td>Param ODE (ωo) APHYNITY Param ODE (ωo)</td><td>-2.66±0.9 -5.94±0.7</td><td>21.5±19 5.0±1.8</td><td>n/a</td><td>n/a</td></tr><tr><td>Param ODE (ωo,α)</td><td>-5.71±0.4</td><td>4.08±0.8</td><td>n/a</td><td>0.49±0.1</td></tr><tr><td rowspan="4">Complete physics</td><td>APHYNITY Param ODE (ωo, α)</td><td>-6.22±0.7</td><td>3.26±0.6</td><td>152±129 62±27</td><td>n/a (5.39±0.1)e-10</td></tr><tr><td>True ODE</td><td>-8.58±0.1</td><td>n/a</td><td>n/a</td><td></td></tr><tr><td>APHYNITY True ODE</td><td>-8.58±0.1</td><td></td><td></td><td>n/a</td></tr><tr><td></td><td></td><td>n/a</td><td>n/a</td><td>(2.15±1.6)e-4</td></tr></table>
|
md/train/r1te3Fqel/r1te3Fqel.md
ADDED
|
@@ -0,0 +1,238 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# END-TO-END ANSWER CHUNK EXTRACTION AND RANKING FOR READING COMPREHENSION
|
| 2 |
+
|
| 3 |
+
Yang Yu∗, Wei Zhang∗, Bowen Zhou, Kazi Hasan, Mo Yu, Bing Xiang {yu, zhangwei, zhou, kshasan, yum, bingxia} $@$ us.ibm.com IBM Watson, Yorktown Heights, NY, USA
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
This paper proposes dynamic chunk reader (DCR), an end-to-end neural reading comprehension (RC) model that is able to extract and rank a set of answer candidates from a given document to answer questions. DCR is able to predict answers of variable lengths, whereas previous neural RC models primarily focused on predicting single tokens or entities. DCR encodes a document and an input question with recurrent neural networks, and then applies a word-by-word attention mechanism to acquire question-aware representations for the document, followed by the generation of chunk representations and a ranking module to propose the topranked chunk as the answer. Experimental results show that DCR could achieve a $6 6 . 3 \%$ Exact match and $7 4 . 7 \%$ F1 score on the Stanford Question Answering Dataset (Rajpurkar et al., 2016).
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
Reading comprehension-based question answering (RCQA) is the task of answering a question with a chunk of text taken from related document(s). A variety of neural models have been proposed recently either for extracting a single entity or a single token as an answer from a given text (Hermann et al., 2015; Kadlec et al., 2016; Trischler et al., 2016b; Dhingra et al., 2016; Chen et al., 2016; Sordoni et al., 2016; Cui et al., 2016a); or for selecting the correct answer by ranking a small set of human-provided candidates (Yin et al., 2016; Trischler et al., 2016a). In both cases, an answer boundary is either easy to determine or already given.
|
| 12 |
+
|
| 13 |
+
Different from the above two assumptions for RCQA, in the real-world QA scenario, people may ask questions about both entities (factoid) and non-entities such as explanations and reasons (nonfactoid) (see Table 1 for examples).
|
| 14 |
+
|
| 15 |
+
In this regard, RCQA has the potential to complement other QA approaches that leverage structured data (e.g., knowledge bases) for both the above question types. This is because RCQA can exploit the textual evidences to ensure increased answer coverage, which is particularly helpful for nonfactoid answers. However, it is also challenging for RCQA to identify answer in arbitrary position in the passage with arbitrary length, especially for non-factoid answers which might be clauses or sentences.
|
| 16 |
+
|
| 17 |
+
As a result, apart from a few exceptions (Rajpurkar et al., 2016; Wang & Jiang, 2016), this research direction has not been fully explored yet.
|
| 18 |
+
|
| 19 |
+
Compared to the relatively easier RC task of predicting single tokens/entities1, predicting answers of arbitrary lengths and positions significantly increase the search space complexity:
|
| 20 |
+
|
| 21 |
+
the number of possible candidates to consider is in the order of $O ( n ^ { 2 } )$ , where $n$ is the number of passage words. In contrast, for previous works in which answers are single tokens/entities or from candidate lists, the complexity is in $O ( n )$ or the size of candidate lists $l$ (usually $l \leq 5 ,$ ), respectively. To address the above complexity, Rajpurkar et al. (Rajpurkar et al., 2016) used a two-step chunkand-rank approach that employs a rule-based algorithm to extract answer candidates from a passage, followed by a ranking approach with hand-crafted features to select the best answer. The rule-based chunking approach suffered from low coverage $\approx 7 0 \%$ recall of answer chunks) that cannot be improved during training; and candidate ranking performance depends greatly on the quality of the hand-crafted features. More recently, Wang and Jiang (Wang & Jiang, 2016) proposed two end-toend neural network models, one of which chunks a candidate answer by predicting the answer’s two boundary indices and the other classifies each passage word into answer/not-answer. Both models improved significantly over the method proposed by Rajpurkar et al. (Rajpurkar et al., 2016).
|
| 22 |
+
|
| 23 |
+
Table 1: Example of questions (with answers) which can be potentially answered with RC on a Wikipedia passage. The first question is factoid, asking for an entity. The second and third are non-factoid.
|
| 24 |
+
|
| 25 |
+
<table><tr><td>The United Kingdom (UK) intends to withdraw from the European Union (EU), a process commonly known as Brexit,as a result of a June 2O16 referendum in which 51.9% voted to leave the EU.The separation process is complex,causing political and economic changes for the UK and other countries.As of September 2016,neither the timetable nor the terms for withdrawal have been established: in the meantime,the UK remains a full member of the European Union.The term "Brexit”is a portmanteau of the words "British”and "exit".</td></tr><tr><td>Q1.Which country withdrew from EU in 2016? A1.UnitedKingdom</td></tr><tr><td>Q2.How did UK decide to leave the European Union? A2.as a result of a June 2O16 referendum in which 51.9% voted to leave the EU</td></tr><tr><td>Q3.What has not been finalized for Brexit as of September 2016? A3.neither the timetable nor the terms forwithdrawal</td></tr></table>
|
| 26 |
+
|
| 27 |
+
Our proposed model, called dynamic chunk reader $( D C R )$ , not only significantly differs from both the above systems in the way that answer candidates are generated and ranked, but also shares merits with both works. First, our model uses deep networks to learn better representations for candidate answer chunks, instead of using fixed feature representations as in (Rajpurkar et al., 2016). Second, it represents answer candidates as chunks, as in (Rajpurkar et al., 2016), instead of wordlevel representations (Wang & Jiang, 2016), to make the model aware of the subtle differences among candidates (importantly, overlapping candidates).
|
| 28 |
+
|
| 29 |
+
The contributions of this paper are three-fold. (1) We propose a novel neural network model for joint candidate answer chunking and ranking, where the candidate answer chunks are dynamically constructed and ranked in an end-to-end manner. (2) we propose a new question-attention mechanism to enhance passage word representation, which is subsequently used to construct chunk representations. (3) We also propose several simple but effective features to strengthen the attention mechanism, which fundamentally improves candidate ranking, with the by-product of higher exact boundary match accuracy.
|
| 30 |
+
|
| 31 |
+
The experiments on the Stanford Question Answering Dataset (SQuAD) (Rajpurkar et al., 2016), which contains a variety of human-generated factoid and non-factoid questions, have shown the effectiveness of above three contributions.
|
| 32 |
+
|
| 33 |
+
Our paper is organized as follows. We formally define the RCQA problem first. Next, we describe our baseline with a neural network component. We present the end-to-end dynamic chunk reader model next. Finally, we analyze our experimental results and discuss the related work. In appendix, we show formal equations and details of the model.
|
| 34 |
+
|
| 35 |
+
# 2 PROBLEM DEFINITION
|
| 36 |
+
|
| 37 |
+
Table 1 shows an example of our RC setting where the goal is to answer a question $Q _ { i }$ , factoid (Q1) or non-factoid (Q2 and Q3), based on a supporting passage $P _ { i }$ , by selecting a continuous sequence of text $A _ { i } \subseteq P _ { i }$ as answer. $Q _ { i } , P _ { i }$ , and $A _ { i }$ are all word sequences, where each word is drawn from a vocabulary, $V$ . The $i$ -th instance in the training set is a triple in the form of $( P _ { i } , Q _ { i } , A _ { i } )$ , where $P _ { i } = ( p _ { i 1 } , \dots , p _ { i | P _ { i } | } )$ , $Q _ { i } = ( q _ { i 1 } , \dots , q _ { i | Q _ { i } | } )$ , and $A _ { i } = \left( a _ { i 1 } , \ldots , a _ { i | A _ { i } | } \right) ( p _ { i \cdot } , q _ { i \cdot } , a _ { i \cdot } \in V )$ . Owing to the disagreement among annotators, there could be more than one correct answer for the samequestion; and the k-th answer to Qi is denoted by Aki = {aki1, . . . , aki|Aki |}. An answer candidate for the -th training example is defined as $c _ { i } ^ { m , n }$ , a sub-sequence in $P _ { i }$ , that spans from position $m$ to $n$ $( 1 \leq m \leq n \leq | P _ { i } | )$ . The ground truth answer $A _ { i }$ could be included in the set of all candidates
|
| 38 |
+
|
| 39 |
+
$C _ { i } = \{ c _ { i } ^ { m , n } ~ | \forall m , n \in N ^ { + } , s u b j ( m , n , P _ { i } )$ and $1 \leq m \leq n \leq | P _ { i } | \}$ , where $s u b j ( m , n , P _ { i } )$ is i the constraint put on the candidate chunk for $P _ { i }$ , such as, $^ { \cdot \mathfrak { e } _ { c _ { i } } m , n }$ can have at most 10 tokens”, or $c _ { i } ^ { m , n }$ must have a pre-defined POS pattern”. To evaluate a system’s performance, its top answer to a question is matched against the corresponding gold standard answer(s).
|
| 40 |
+
|
| 41 |
+
Remark: Categories of RC Tasks Other simpler variants of the aforementioned RC task were explored in the past. For example, quiz-style datasets (e.g., MCTest (Richardson et al., 2013), MovieQA (Tapaswi et al., 2015)) have multiple-choice questions with answer options. Cloze-style datesets(Hermann et al., 2015; Hill et al., 2015; Onishi et al., 2016), usually automatically generated, have factoid “question”s created by replacing the answer in a sentence from the text with blank. For the answer selection task this paper focuses on, several datasets exist, e.g. TREC-QA for factoid answer extraction from multiple given passages, bAbI (Weston et al., 2014) designed for inference purpose, and the SQuAD dataset (Rajpurkar et al., 2016) used in this paper. To the best of our knowledge, the SQuAD dataset is the only one for both factoid and non-factoid answer extraction with a question distribution more close to real-world applications.
|
| 42 |
+
|
| 43 |
+
# 3 BASELINE: CHUNK-AND-RANK PIPELINE WITH NEURAL RC
|
| 44 |
+
|
| 45 |
+
In this section we modified a state-of-the-art RC system for cloze-style tasks for our answer extraction purpose, to see how much gap we have for the two type of tasks, and to inspire our end-to-end system in the next section. In order to make the cloze-style RC system to make chunk-level decision, we use the RC model to generate features for chunks, which are further used in a feature-based ranker like in (Rajpurkar et al., 2016). As a result, this baseline can be viewed as a deep learning based counterpart of the system in (Rajpurkar et al., 2016). It has two main components: 1) a standalone answer chunker, which is trained to produce overlapping candidate chunks, and 2) a neural RC model, which is used to score each word in a given passage to be used thereafter for generating chunk scores.
|
| 46 |
+
|
| 47 |
+
Answer Chunking To reduce the errors generated by the rule-based chunker in (Rajpurkar et al., 2016), first, we capture the part-of-speech (POS) pattern of all answer sub-sequences in the training dataset to form a POS pattern trie tree, and then apply the answer POS patterns to passage $P _ { i }$ to acquire a collection of all subsequences (chunk candidates) $C _ { i }$ whose POS patterns can be matched to the POS pattern trie. This is equivalent to putting an constraint $s u b j ( m , n , P _ { i } )$ to candidate answer chunk generation process that only choose the chunk with a POS pattern seen for answers in the training data. Then the sub-sequences $C _ { i }$ are used as answer candidates for $P _ { i }$ . Note that overlapping chunks could be generated for a passage, and we rely on the ranker to choose the best candidate based on features from the cloze-style RC system. Experiments showed that for $> 9 0 \%$ of the questions on the development set, the ground truth answer is included in the candidate set constructed in such manner.
|
| 48 |
+
|
| 49 |
+
Feature Extraction and Ranking For chunk ranking, we (1) use neural RCQA model to annotate each $p _ { i j }$ in passage $P _ { i }$ to get score $s _ { i j }$ , then (2) for every chunk m,n $c _ { i } ^ { m , n }$ in passage $i$ , collect scores $( s _ { i m } , \ldots , s _ { i n } )$ for all the $( p _ { i m } , . . . , \bar { p _ { i n } ) }$ contained within $c _ { i } ^ { m , n }$ , and (3) extract features on the sequence of scores $( s _ { i m } , \ldots , s _ { i n } )$ to characterize its scale and distribution information, which serves as the feature representation of $c _ { i } ^ { m , n }$ . In step (1) to acquire $s _ { i j }$ we train and apply a word-level single-layer Gated Attention Reader 2 (Dhingra et al., 2016), which has state-of-the-art performance on CNN/DailyMail cloze-style RC task. In step (3) for chunk $c _ { i } ^ { m , n }$ , we designed 5 features, including 4 statistics on $( s _ { i m } , \ldots , s _ { i n } )$ : maximum, minimum, average and sum; as well as the count of matched POS pattern within the chunk, which serves as an answer prior. We use these 5 features in a state-of-the-art ranker (Ganjisaffar et al., 2011).
|
| 50 |
+
|
| 51 |
+
# 4 DYNAMIC CHUNK READER
|
| 52 |
+
|
| 53 |
+
The dynamic chunk reader (DCR) model is presented in Figure 1. Inspired by the baseline we built, DCR is deemed to be superior to the baseline for 3 reasons. First, each chunk has a representation constructed dynamically, instead of having a set of pre-defined feature values. Second, each passage word’s representation is enhanced by word-by-word attention that evaluates the relevance of the passage word to the question. Third, these components are all within a single, end-to-end model that can be trained in a joint manner.
|
| 54 |
+
|
| 55 |
+

|
| 56 |
+
Figure 1: The main components in dynamic chunk reader model (from bottom to top) are bi-GRU encoders for passage and question, a word-by-word attention bi-GRU for passage, dynamic chunk representations that are transformed from pooled dynamic chunks of hidden states, the question attention on every chunk representation and final answer chunk prediction.
|
| 57 |
+
|
| 58 |
+
DCR works in four steps. First, the encoder layer encodes passage and question separately, by using bidirectional recurrent neural networks (RNN).
|
| 59 |
+
|
| 60 |
+
Second, the attention layer calculates the relevance of each passage word to the question.
|
| 61 |
+
|
| 62 |
+
Third, the convolution layer generates unigram, bigram and trigram representation for each word. bigram and trigram of a word ends with the same word, and proper padding is applied on the first word to make sure the output is the same length as input to CNN layer.
|
| 63 |
+
|
| 64 |
+
Fourth, the chunk representation layer dynamically extracts the candidate chunks from the given passage, and create chunk representation that encodes the contextual information of each chunk.
|
| 65 |
+
|
| 66 |
+
Fifth, the ranker layer scores the relevance between the representations of a chunk and the given question, and ranks all candidate chunks using a softmax layer.
|
| 67 |
+
|
| 68 |
+
We describe each step below.
|
| 69 |
+
|
| 70 |
+
Encoder Layer We use bi-directional RNN encoder to encode $P _ { i }$ and $Q _ { i }$ of example $i$ , and get hidden state for each word position $p _ { i j }$ and $q _ { i k }$ .3 As RNN input, a word is represented by a row vector $x \in \mathbb { R } ^ { n }$ . $x$ can be the concatenation of word embedding and word features (see Fig. 1). The word vector for the $t$ -th word is $x _ { t }$ . A word sequence is processed using an RNN encoder with gated recurrent units (GRU) (Cho et al., 2014), which was proved to be effective in RC and neural machine translation tasks (Bahdanau et al., 2015; Kadlec et al., 2016; Dhingra et al., 2016). For each position $t$ , GRU computes $h _ { t }$ with input $x _ { t }$ and previous state $h _ { t - 1 }$ , as:
|
| 71 |
+
|
| 72 |
+
$$
|
| 73 |
+
\begin{array} { l c l } { { r _ { t } } } & { { = } } & { { \sigma ( W _ { r } { x _ { t } } + U _ { r } { h _ { t - 1 } } ) } } \\ { { u _ { t } } } & { { = } } & { { \sigma ( W _ { u } { x _ { t } } + U _ { u } { h _ { t - 1 } } ) } } \\ { { \bar { h _ { t } } } } & { { = } } & { { t a n h ( W { x _ { t } } + U ( r _ { t } \odot { h _ { t - 1 } } ) ) } } \\ { { h _ { t } } } & { { = } } & { { ( 1 - u _ { t } ) \cdot h _ { t - 1 } + u _ { t } \cdot \bar { h _ { t } } } } \end{array}
|
| 74 |
+
$$
|
| 75 |
+
|
| 76 |
+
where $h _ { t } , r _ { t }$ , and $u _ { t } \in \mathbb { R } ^ { d }$ are ${ \mathrm { d } }$ -dimensional hidden state, reset gate, and update gate, respectively; $W _ { \{ r , u \} }$ , $W \in \mathbb { R } ^ { n \times d }$ and $U _ { \{ r , u \} }$ , $U \in \mathbb { R } ^ { d \times d }$ are the parameters of the GRU; $\sigma$ is the sigmoid function, and $\odot$ denotes element-wise production. For a word at $t$ , we use the hidden state $\vec { h _ { t } }$ from the forward RNN as a representation of the preceding context, and the $\smash { \overleftarrow { h } _ { t } }$ from a backward RNN that encodes text reversely, to incorporate the context after $t$ . Next, $h _ { t } = [ \overrightarrow { h _ { t } } ; \overleftarrow { h _ { t } } ]$ , the bi-directional contextual encoding of $x _ { t }$ , is formed. $[ \cdot ; \cdot ]$ is the concatenation operator. To distinguish hidden states from different sources, we denote the $h _ { j }$ of $j$ -th word in $P$ and the $h _ { k }$ of $k$ -th word in $Q$ as $h _ { j } ^ { p }$ and $h _ { k } ^ { q }$ respectively.
|
| 77 |
+
|
| 78 |
+
Attention Layer Attention mechanism in previous RC tasks (Kadlec et al., 2016; Hermann et al., 2015; Sordoni et al., 2016; Dhingra et al., 2016; Cui et al., 2016a;b) enables question-aware passage representations. We propose a novel attention mechanism inspired by word-by-word style attention methods (Rocktaschel et al., 2015; Wang & Jiang, 2015; Santos et al., 2016). For each ¨ $p _ { j }$ , a questionattended representation $v _ { j }$ is computed as follows (example index $i$ is omitted for simplicity):
|
| 79 |
+
|
| 80 |
+
$$
|
| 81 |
+
\begin{array} { r c l } { { \alpha _ { j k } } } & { { = } } & { { { h _ { j } ^ { p } \cdot h _ { k } ^ { q } , } } } \\ { { } } & { { } } & { { } } \\ { { \beta _ { j } } } & { { = } } & { { \displaystyle \sum _ { k = 1 } ^ { | Q | } \alpha _ { j k } h _ { k } ^ { q } } } \\ { { } } & { { } } & { { } } \\ { { v _ { j } } } & { { = } } & { { \displaystyle [ h _ { j } ^ { p } ; \beta _ { j } ] } } \end{array}
|
| 82 |
+
$$
|
| 83 |
+
|
| 84 |
+
where $h _ { j } ^ { p }$ and $h _ { k } ^ { q }$ are hidden states from the bi-directional RNN encoders (see Figure 1). An inner product, $\alpha _ { j k }$ , is calculated between $h _ { j } ^ { p }$ and every question word $h _ { k } ^ { q }$ . It indicates how well the passage word $p _ { j }$ matches with every question word $q _ { k }$ . $\beta _ { j }$ is a weighted pooling of $| Q |$ question hidden states, which serves as a $p _ { j }$ -aware question representation. The concatenation of $h _ { j } ^ { p }$ and $\beta _ { j }$ leads to a passage-question joint representation, $v _ { j } \in \mathbb { R } ^ { 4 d }$ .4 Next, we apply a second bi-GRU layer taking the $v _ { j } \mathbf { s }$ as inputs, and obtain forward and backward representations $\overrightarrow { \gamma _ { j } ^ { \prime } }$ and $\{ \overline { { \gamma _ { j } } } \in \mathbb { R } ^ { d }$ , and in turn their concatenation, $\gamma _ { j } = [ \overrightarrow { \gamma _ { j } ^ { \ast } } ; \overleftarrow { \gamma _ { j } } ]$ .
|
| 85 |
+
|
| 86 |
+
Convolution Layer Every word is encoded with complete passage context through attention layer RNN. We would like to model more complex representation of the words, by introducing unigram, bigram and trigram representations. There are two benefits for this enhanced representation: 1) each word could be enhanced with local context information to help identify the boundary of the answer chunk. Using previous words has been a common feature used in POS tagging and Named entity recognition; and 2) The information brought in by the ngram into the word representation could enhance the semantic match between the answer chunk internal and the question. Imagine scenario of a three word candidate, where the last word representation includes the two previous words through the convolution layer. Matching to the last word could also lead to the match to the semantics of the internal of the chunk. Specifically, we create for every word position $j$ three representations, by using ngrams ending with the hidden state $j$ :
|
| 87 |
+
|
| 88 |
+
$$
|
| 89 |
+
\begin{array} { r c l } { \tilde { \gamma } _ { j 1 } } & { = } & { \gamma _ { j } \cdot W _ { c 1 } } \\ { \tilde { \gamma } _ { j 2 } } & { = } & { \left[ \gamma _ { j - 1 } ; \gamma _ { j } \right] \cdot W _ { c 2 } } \\ { \tilde { \gamma } _ { j 3 } } & { = } & { \left[ \gamma _ { j - 2 } ; \gamma _ { j - 1 } ; \gamma _ { j } \right] \cdot W _ { c 3 } } \end{array}
|
| 90 |
+
$$
|
| 91 |
+
|
| 92 |
+
The details shown in equations above. We used three different convolution kernels for different n-grams.
|
| 93 |
+
|
| 94 |
+
Chunk Representation Layer A candidate answer chunk representation is dynamically created given convolution layer output. We first decide the text boundary for the candidate chunk, and then form a chunk representation using all or part of those $\gamma _ { j }$ outputs inside the chunk. To decide a candidate chunk (boundary): we tried two ways: (1) adopt the $P O S$ trie-based approach used in our baseline, and (2) enumerate all possible chunks up to a maximum number of tokens. For (2), we create up to $N$ (max chunk length) chunks starting from any position $j$ in $P _ { j }$ . Approach (1) can generate candidates with arbitrary lengths, but fails to recall candidates whose POS pattern is unseen in training set; whereas approach (2) considers all possible candidates within a window and is more flexible, but over-generates invalid candidates.
|
| 95 |
+
|
| 96 |
+
For a candidate answer chunk $c ^ { m , n }$ spanning from position $m$ to $n$ inclusively, we construct chunk representation $\overline { { \gamma } } _ { m , n } ^ { l } ~ \in ~ \mathbb { R } ^ { 2 d }$ using every $\tilde { \gamma } _ { j l }$ within range $[ m , n ]$ , with a function $g ( \cdot )$ , and $l \in$ $\{ 1 , 2 , 3 \}$ . Formally,
|
| 97 |
+
|
| 98 |
+
$$
|
| 99 |
+
\overline { { \gamma } } _ { m , n } ^ { l } = g ( \widetilde { \gamma } _ { m l } , \ldots , \widetilde { \gamma } _ { n l } )
|
| 100 |
+
$$
|
| 101 |
+
|
| 102 |
+
Each $\tilde { \gamma } _ { j l }$ is a convolution output over concatenated forward and backward RNN hidden states from attention layer. So the first half in $\tilde { \gamma } _ { j l }$ encodes information in forward RNN hidden states and the second half encodes information in backward RNN hidden states. We experimented with several pooling functions (e.g., max, average) for $g ( \cdot )$ , and found out that, instead of pooling, the best $g ( \cdot )$ function is to concatenate the first half of convolution output of the chunk’s first word and the second half of convolution output of the chunk’s last word. Formally,
|
| 103 |
+
|
| 104 |
+
$$
|
| 105 |
+
\overline { { \gamma } } _ { m , n } ^ { l } = g ( \widetilde { \gamma } _ { m l } , \dots , \widetilde { \gamma } _ { n l } ) = [ \overrightarrow { \widetilde { \gamma } _ { m l } } ; \overleftarrow { \widetilde { \gamma } _ { n l } } ]
|
| 106 |
+
$$
|
| 107 |
+
|
| 108 |
+
where $\overrightarrow { \tilde { \gamma } _ { m l } }$ is half of the hidden state for $l$ -gram word representation corresponding to forward attention RNN output. We hypothesize that the hidden states at that two ends can better represent the chunk’s contexts, which is critical for this task, than the states within the chunk. This observation also agrees with (Kobayashi et al., 2016).
|
| 109 |
+
|
| 110 |
+
Ranker Layer A score $s _ { m , n } ^ { l }$ for each $l$ -gram chunk representation $\overline { { \gamma } } _ { m , n } ^ { l }$ denoting the probability of that chunk to be the true answer is calculated by dot product with question representation. The question representation is the concatenation of the last hidden state in forward RNN and the first hidden state in backward RNN. Formally for the chunk $c _ { i } ^ { m , n }$ we have
|
| 111 |
+
|
| 112 |
+
$$
|
| 113 |
+
s ^ { l } ( c _ { i } ^ { m , n } | P _ { i } , Q _ { i } ) = \overline { { { \gamma } } } _ { m , n } ^ { l } \cdot [ \overrightarrow { h _ { | Q _ { i } ^ { d } | } ^ { Q _ { i } } } ; \overleftrightarrow { h _ { 1 } ^ { Q _ { i } } } ]
|
| 114 |
+
$$
|
| 115 |
+
|
| 116 |
+
where $s ^ { l }$ denotes the score generated from $l$ -gram representatio n. −−→hQik or h Q ik is the $k$ -th hidden state output from question $Q _ { i }$ ’s forward and backward RNN encoder, respectively.
|
| 117 |
+
|
| 118 |
+
After that, the final score for cmi $c _ { i } ^ { m , n }$ is evaluated as the linear combination of three scores, followed by a softmax:
|
| 119 |
+
|
| 120 |
+
$$
|
| 121 |
+
s ( c _ { i } ^ { m , n } | P _ { i } , Q _ { i } ) = s o f t m a x ( W \cdot [ s ^ { 1 } ; s ^ { 2 } ; s ^ { 3 } ] )
|
| 122 |
+
$$
|
| 123 |
+
|
| 124 |
+
where $s ^ { l }$ is the shorthand notation for $s ^ { l } ( c _ { i } ^ { m , n } | P _ { i } , Q _ { i } )$ ; $W \in \mathbb { R } ^ { 3 }$ . In runtime, the chunk with the highest probability is taken as the answer. In training, the following negative log likelihood is minimized:
|
| 125 |
+
|
| 126 |
+
$$
|
| 127 |
+
\mathbb { L } = - \sum _ { i = 1 } ^ { N } \log \mathbb { P } ( A _ { i } | P _ { i } , Q _ { i } )
|
| 128 |
+
$$
|
| 129 |
+
|
| 130 |
+
Note that the $i$ -th training instance is only used when $A _ { i }$ is included in the corresponding candidate chunk set $C _ { i }$ , i.e. $\exists _ { m , n } \bar { A } _ { i } = c _ { i } ^ { m , n }$ . The softmax in the final layer serves as the list-wise ranking module similar in spirit to (Cao et al., 2007).
|
| 131 |
+
|
| 132 |
+
# 5 EXPERIMENTS
|
| 133 |
+
|
| 134 |
+
Dataset We used the Stanford Question Answering Dataset (SQuAD) (Rajpurkar et al., 2016) for the experiment. SQuAD came into our sight because it is a mix of factoid and non-factoid questions, a real-world data (crowd-sourced), and of large scale (over 100K question-answer pairs collected from 536 Wikipedia articles). Answers range from single words to long, variable-length phrase/clauses. It is a relaxation of assumptions by the cloze-style and quiz-style RC datasets in the Problem Definition section.
|
| 135 |
+
|
| 136 |
+
Table 2: Results on the SQuAD dataset.
|
| 137 |
+
|
| 138 |
+
<table><tr><td rowspan="2"></td><td colspan="2">Dev</td><td colspan="2">Test</td></tr><tr><td>EM</td><td>F1</td><td>EM</td><td>F1</td></tr><tr><td>Models Rajpurkar 2016</td><td>39.8%</td><td>51.0%</td><td>40.4%</td><td>51.0%</td></tr><tr><td>Wang 2016</td><td>59.1%</td><td>70.0%</td><td>59.5%</td><td>70.3%</td></tr><tr><td>DCR w/o Conv.</td><td>62.5%</td><td>71.2%</td><td>62.5%</td><td>71.0%</td></tr><tr><td>DCR</td><td>63.4%</td><td>72.3%</td><td></td><td>-</td></tr><tr><td>DCR Ensemble</td><td>66.3%</td><td>74.7%</td><td>-</td><td>1</td></tr></table>
|
| 139 |
+
|
| 140 |
+
Features The input vector representation of each word $w$ to encoder RNNs has six parts including a pre-trained 300-dimensional GloVe embedding (Pennington et al., 2014) and five features (see Figure 1): (1) a one-hot encoding (46 dimensions) for the part-of-speech (POS) tag of $w$ ; (2) a one-hot encoding (14 dimensions) for named entity (NE) tag of $w$ ; (3) a binary value indicating whether $w$ ’s surface form is the same to any word in the quesiton; (4) if the lemma form of $w$ is the same to any word in the question; and (5) if $w$ is caplitalized. Feature (3) and (4) are designed to help the model align the passage text with question. Note that some types of questions (e.g., “who”, “when” questions) have answers that have a specific POS/NE tag pattern. For instance, “who” questions mostly have proper nouns/persons as answers and “when” questions may frequently have numbers/dates (e.g., a year) as answers. Thus, we believe that the model could exploit the co-relation between question types and answer POS/NE patterns easier with POS and NE tag features. Implementation Details We pre-processed the SQuAD dataset using Stanford CoreNLP tool5 (Manning et al., 2014) with its default setting to tokenize the text and obtain the POS and NE annotations. To train our model, we used stochastic gradient descent with the ADAM optimizer (Kingma & Ba, 2014), with an initial learning rate of 0.001. All GRU weights were initialized from a uniform distribution between (-0.01, 0.01). The hidden state size, $d$ , was set to 300 for all GRUs. The question bi-GRU shared parameters with the passage bi-GRU, while the attention-based passage bi-GRU had its own parameters. We shuffled all training examples at the beginning of each epoch and adopted a curriculum learning approach (Bengio et al., 2009), by sorting training instances by length in every 10 batches, to enable the model start learning from relatively easier instances and to harder ones. We also applied dropout of rate 0.2 to the embedding layer of input bi-GRU encoder, and gradient clipping when the norm of gradients exceeded 10. We trained in mini-batch style (mini-batch size is 180) and applied zero-padding to the passage and question inputs in each batch. We also set the maximum passage length to be 300 tokens, and pruned all the tokens after the 300-th token in the training set to save memory and speed up the training process. This step reduced the training set size by about $1 . 6 \%$ . During test, we test on the full length of passage, so that we don’t prune out the potential candidates. We trained the model for at most 30 epochs, and in case the accuracy did not improve for 10 epochs, we stopped training.
|
| 141 |
+
|
| 142 |
+
For the feature ranking-based system, we used jforest ranker (Ganjisaffar et al., 2011) with LambdaMART-RegressionTree algorithm and the ranking metric was ${ \mathrm { N D C G } } \ @ 1 0$ . For the Gated Attention Reader in baseline system, we replicated the method and use the same configurations as in (Dhingra et al., 2016).
|
| 143 |
+
|
| 144 |
+
# Results
|
| 145 |
+
|
| 146 |
+
Table 2 shows our main results on the SQuAD dataset. Compared to the scores reported in (Wang & Jiang, 2016), our exact match (EM) and F1 on the development set and EM score on the test set are better, and F1 on the test set is comparable. We also studied how each component in our model contributes to the overall performance. Table 3 shows the details as well as the results of the baseline ranker. As the first row of Table 3 shows, our baseline system improves $10 \%$ (EM) over Rajpurkar et al. (Rajpurkar et al., 2016) (Table 2, row 1), the feature-based ranking system. However when compared to our DCR model (Table 3, row 2), the baseline (row 1) is more than $12 \%$ (EM) behind
|
| 147 |
+
|
| 148 |
+
Table 3: Detailed system experiments on the SQuAD development set.
|
| 149 |
+
|
| 150 |
+
<table><tr><td>Models</td><td>EM</td><td>F1</td></tr><tr><td>Chunk-and-RankPipelineBaseline</td><td>49.7%</td><td>64.9%</td></tr><tr><td>DCRw/o Convolution</td><td>62.5%</td><td>71.2%</td></tr><tr><td>DCR w/o Word-by-Word Attention</td><td>57.6%</td><td>68.7%</td></tr><tr><td>DCR w/o POS feature (1)</td><td>59.2%</td><td>68.8%</td></tr><tr><td>DCR w/o NE feature (2)</td><td>60.4%</td><td>70.2%</td></tr><tr><td>DCR w/o Question-word feature (3)</td><td>59.5%</td><td>69.0%</td></tr><tr><td>DCR w/o Question-lemma feature (4)</td><td>61.2%</td><td>69.9%</td></tr><tr><td>DCR w/o Capitalized feature (5)</td><td>61.5%</td><td>70.6%</td></tr><tr><td>DCRw/o Conv.wPOS-trie</td><td>62.1%</td><td>70.8%</td></tr></table>
|
| 151 |
+
|
| 152 |
+

|
| 153 |
+
Figure 2: (a) Variations of DCR performance on ground truth answer length (up to 10) in the development set. The curve with diamond knots also shows the percentage of answers for each length in the development set. (b) Performance comparisons for different question head word. even though it is based on the state-of-the-art model for cloze-style RC tasks. This can be attributed to the advanced model structure and end-to-end manner of DCR.
|
| 154 |
+
|
| 155 |
+
We also did ablation tests on our DCR model. First, replacing the word-by-word attention with Attentive Reader style attention (Hermann et al., 2015) decreases the EM score by about $4 . 5 \%$ , showing the strength of our proposed attention mechanism.
|
| 156 |
+
|
| 157 |
+
Second, we remove the features in input to see the contribution of each feature. The result shows that POS feature (1) and question-word feature (3) are the two most important features.
|
| 158 |
+
|
| 159 |
+
Finally, combining the DCR model with the proposed POS-trie constraints yields a score similar to the one obtained using the DCR model with all possible $n$ -gram chunks. The result shows that (1) our chunk representations are powerful enough to differentiate even a huge amount of chunks when no constraints are applied; and (2) the proposed POS-trie reduces the search space at the cost of a small drop in performance.
|
| 160 |
+
|
| 161 |
+
Analysis To better understand our system, we calculated the accuracy of the attention mechanism of the gated attention reader used in our deep learning-based baseline. We found that it is $72 \%$ accurate i.e., $72 \%$ of the times a word with the highest attention score is inside the correct answer span. This means that, if we could accurately detect the boundary around the word with the highest attention score to form the answer span, we could achieve an accuracy close to $72 \%$ . In addition, we checked the answer recall of our candidate chunking approach. When we use a window size of 10, $92 \%$ of the time, the ground truth answer will be included in the extracted Candidate chunk set. Thus the upper bound of the exact match score of our baseline system is around $66 \%$ $9 2 \%$ (the answer recall) $\times 7 2 \%$ ). From the results, we see our DCR system’s exact match score is at $62 \%$ . This shows that DCR is proficient at differentiating answer spans dynamically.
|
| 162 |
+
|
| 163 |
+
To further analyze the system’s performance while predicting answers of different lengths, we show the exact match (EM) and F1 scores for answers with lengths up to 10 tokens in Figure 2(a). From the graph, we can see that, with the increase of answer length, both EM and F1 drops, but in different speed. The gap between F1 and exact match also widens as answer length increases. However, the model still yields a decent accuracy when the answer is longer than a single word. Additionally, Figure 2(b) shows that the system is better at “when” and “who” questions, but performs poorly on “why” questions. The large gap between exact match and F1 on “why” questions means that perfectly identifying the span is harder than locating the core of the answer span.
|
| 164 |
+
|
| 165 |
+

|
| 166 |
+
Figure 3: Development set performance comparisons for different types of “what” questions (considering the types with more than 20 examples in the development set).
|
| 167 |
+
|
| 168 |
+
Since “what”, “which”, and “how” questions contain a broad range of question types, we split them further based on the bigram a question starts with, and Figure 3 shows the breakdown for “what” questions. We can see that “what” questions asking for explanations such as “what happens” and “what happened” have lower EM and F1 scores. In contrast, “what” questions asking for year and numbers have much higher scores and, for these questions, exact match scores are close to F1 scores, which means chunking for these questions are easier for DCR.
|
| 169 |
+
|
| 170 |
+
# 6 RELATED WORK
|
| 171 |
+
|
| 172 |
+
Attentive Reader was the first neural model for factoid RCQA (Hermann et al., 2015). It uses Bidirectional RNN (Cho et al., 2014; Chung et al.,2014) to encode document and query respectively, and use query representation to match with every token from the document. Attention Sum Reader (Kadlec et al., 2016) simplifies the model to just predicting positions of correct answer in the document and the training speed and test accuracy are both greatly improved on the CNN/Daily Mail dataset. (Chen et al., 2016) also simplified Attentive Reader and reported higher accuracy. Windowbased Memory Networks (MemN2N) is introduced along with the CBT dataset (Hill et al., 2015), which does not use RNN encoders, but embeds contexts as memory and matches questions with embedded contexts. Those models’ mechanism is to learn the match between answer context with question/query representation. In contrast, memory enhanced neural networks like Neural Turing Machines (Graves et al., 2014) and its variants (Zhang et al., 2015; Gulcehre et al., 2016; Zaremba & Sutskever, 2015; Chandar et al., 2016; Grefenstette et al., 2015) were also potential candidates for the task, and Gulcehre et al. (Gulcehre et al., 2016) reported results on the bAbI task, which is worse than memory networks. Similarly, sequence-to-sequence models were also used (Yu et al., 2015; Hermann et al., 2015), but they did not yield better results either.
|
| 173 |
+
|
| 174 |
+
Recently, several models have been proposed to enable more complex inference for RC task. For instance, gated attention model (Dhingra et al., 2016) employs a multi-layer architecture, where each layer encodes the same document, but the attention is updated from layer to layer. EpiReader (Trischler et al., 2016b) adopted a joint training model for answer extractor and reasoner, where the extractor proposes top candidates, and the reasoner weighs each candidate by examining entailment relationship between question-answer representation and the document. An iterative alternating attention mechanism and gating strategies were proposed in (Sordoni et al., 2016) to optimize the attention through several hops. In contrast, Cui et al. (Cui et al., 2016a;b) introduced fine-grained document attention from each question word and then aggregated those attentions from each question token by summation with or without weights. This system achieved the state-of-the-art score on the CNN dataset. Those different variations all result in roughly $3- 5 \%$ improvement over attention sum reader, but none of those could achieve higher than that. Other methods include using dynamic entity representation with max-pooling (Kobayashi et al., 2016) that aims to change entity representation with context, and Weissenborn’s (Weissenborn, 2016) system, which tries to separate entity from the context and then matches the question to context, scoring an accuracy around $70 \%$ on the CNN dataset.
|
| 175 |
+
|
| 176 |
+
However, all of those models assume that the answers are single tokens. This limits the type of questions the models can answer. Wang and Jiang (Wang & Jiang, 2016) proposed a match-lstm and achieved good results on SQuAD. However, this approach predicts a chunk boundary or whether a word is part of a chunk or not. In contrast, our approach explicitly constructs the chunk representations and similar chunks are compared directly to determine correct answer boundaries.
|
| 177 |
+
|
| 178 |
+
# 7 CONCLUSION
|
| 179 |
+
|
| 180 |
+
In this paper we proposed a novel neural reading comprehension model for question answering. Different from the previously proposed models for factoid RCQA, the proposed model, dynamic chunk reader, is not restricted to predicting a single named entity as an answer or selecting an answer from a small, pre-defined candidate list. Instead, it is capable of answering both factoid and nonfactoid questions as it learns to select answer chunks that are suitable for an input question. DCR achieves this goal with a joint deep learning model enhanced with a novel attention mechanism and five simple yet effective features. Error analysis shows that the DCR model achieves good performance, but still needs to improve on predicting longer answers, which are usually non-factoid in nature.
|
| 181 |
+
|
| 182 |
+
# REFERENCES
|
| 183 |
+
|
| 184 |
+
Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. Neural machine translation by jointly learning to align and translate. ICLR, 2015.
|
| 185 |
+
|
| 186 |
+
Yoshua Bengio, Jer´ ome Louradour, Ronan Collobert, and Jason Weston. Curriculum learning. In ˆ Proceedings of the 26th annual international conference on machine learning, pp. 41–48. ACM, 2009.
|
| 187 |
+
|
| 188 |
+
Zhe Cao, Tao Qin, Tie-Yan Liu, Ming-Feng Tsai, and Hang Li. Learning to rank: from pairwise approach to listwise approach. In Proceedings of the 24th international conference on Machine learning, pp. 129–136. ACM, 2007.
|
| 189 |
+
|
| 190 |
+
Sarath Chandar, Sungjin Ahn, Hugo Larochelle, Pascal Vincent, Gerald Tesauro, and Yoshua Bengio. Hierarchical memory networks. arXiv preprint arXiv:1605.07427, 2016.
|
| 191 |
+
|
| 192 |
+
Danqi Chen, Jason Bolton, and Christopher D Manning. A thorough examination of the cnn/daily mail reading comprehension task. ACL, 2016.
|
| 193 |
+
|
| 194 |
+
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.
|
| 195 |
+
|
| 196 |
+
Yiming Cui, Zhipeng Chen, Si Wei, Shijin Wang, Ting Liu, and Guoping Hu. Attention-overattention neural networks for reading comprehension. arXiv preprint arXiv:1607.04423, 2016a.
|
| 197 |
+
|
| 198 |
+
Yiming Cui, Ting Liu, Zhipeng Chen, Shijin Wang, and Guoping Hu. Consensus attention-based neural networks for chinese reading comprehension. arXiv preprint arXiv:1607.02250, 2016b.
|
| 199 |
+
|
| 200 |
+
Bhuwan Dhingra, Hanxiao Liu, William W Cohen, and Ruslan Salakhutdinov. Gated-attention readers for text comprehension. arXiv preprint arXiv:1606.01549, 2016.
|
| 201 |
+
|
| 202 |
+
Yasser Ganjisaffar, Rich Caruana, and Cristina Lopes. Bagging gradient-boosted trees for high precision, low variance ranking models. pp. 85–94, 2011. doi: http://doi.acm.org/10.1145/2009916. 2009932.
|
| 203 |
+
|
| 204 |
+
Alex Graves, Greg Wayne, and Ivo Danihelka. Neural turing machines. arXiv preprint arXiv:1410.5401, 2014.
|
| 205 |
+
|
| 206 |
+
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.
|
| 207 |
+
|
| 208 |
+
Caglar Gulcehre, Sarath Chandar, Kyunghyun Cho, and Yoshua Bengio. Dynamic neural turing machine with soft and hard addressing schemes. arXiv preprint arXiv:1607.00036, 2016.
|
| 209 |
+
Karl Moritz Hermann, Tomas Kocisky, Edward Grefenstette, Lasse Espeholt, Will Kay, Mustafa Suleyman, and Phil Blunsom. Teaching machines to read and comprehend. In Advances in Neural Information Processing Systems, pp. 1693–1701, 2015.
|
| 210 |
+
Felix Hill, Antoine Bordes, Sumit Chopra, and Jason Weston. The goldilocks principle: Reading children’s books with explicit memory representations. arXiv preprint arXiv:1511.02301, 2015.
|
| 211 |
+
Rudolf Kadlec, Martin Schmid, Ondrej Bajgar, and Jan Kleindienst. Text understanding with the attention sum reader network. ACL, 2016.
|
| 212 |
+
Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
|
| 213 |
+
Sosuke Kobayashi, Ran Tian, Naoaki Okazaki, and Kentaro Inui. Dynamic entity representations with max-pooling improves machine reading. NAACL-HLT, 2016.
|
| 214 |
+
Christopher D. Manning, Mihai Surdeanu, John Bauer, Jenny Finkel, Steven J. Bethard, and David McClosky. The Stanford CoreNLP natural language processing toolkit. In Association for Computational Linguistics (ACL) System Demonstrations, pp. 55–60, 2014. URL http://www.aclweb.org/anthology/P/P14/P14-5010.
|
| 215 |
+
T. Onishi, H. Wang, M. Bansal, K. Gimpel, and D. McAllester. Who did What: A large-scale person-centered cloze dataset. In Proc. of EMNLP, 2016.
|
| 216 |
+
Jeffrey Pennington, Richard Socher, and Christopher D Manning. Glove: Global vectors for word representation. In EMNLP, volume 14, pp. 1532–43, 2014.
|
| 217 |
+
Pranav Rajpurkar, Jian Zhang, Konstantin Lopyrev, and Percy Liang. Squad: $1 0 0 { , } 0 0 0 { + }$ questions for machine comprehension of text. arXiv preprint arXiv:1606.05250, 2016.
|
| 218 |
+
Matthew Richardson, Christopher JC Burges, and Erin Renshaw. Mctest: A challenge dataset for the open-domain machine comprehension of text. In EMNLP, volume 3, pp. 4, 2013.
|
| 219 |
+
Tim Rocktaschel, Edward Grefenstette, Karl Moritz Hermann, Tom ¨ a´s Ko ˇ cisk ˇ y, and Phil Blunsom. \` Reasoning about entailment with neural attention. arXiv preprint arXiv:1509.06664, 2015.
|
| 220 |
+
Cicero dos Santos, Ming Tan, Bing Xiang, and Bowen Zhou. Attentive pooling networks. arXiv preprint arXiv:1602.03609, 2016.
|
| 221 |
+
Alessandro Sordoni, Phillip Bachman, and Yoshua Bengio. Iterative alternating neural attention for machine reading. arXiv preprint arXiv:1606.02245, 2016.
|
| 222 |
+
Makarand Tapaswi, Yukun Zhu, Rainer Stiefelhagen, Antonio Torralba, Raquel Urtasun, and Sanja Fidler. Movieqa: Understanding stories in movies through question-answering. arXiv preprint arXiv:1512.02902, 2015.
|
| 223 |
+
Adam Trischler, Zheng Ye, Xingdi Yuan, Jing He, Phillip Bachman, and Kaheer Suleman. A parallel-hierarchical model for machine comprehension on sparse data. arXiv preprint arXiv:1603.08884, 2016a.
|
| 224 |
+
Adam Trischler, Zheng Ye, Xingdi Yuan, and Kaheer Suleman. Natural language comprehension with the epireader. arXiv preprint arXiv:1606.02270, 2016b.
|
| 225 |
+
Shuohang Wang and Jing Jiang. Learning natural language inference with lstm. arXiv preprint arXiv:1512.08849, 2015.
|
| 226 |
+
Shuohang Wang and Jing Jiang. Machine comprehension using match-lstm and answer pointer. arXiv preprint arXiv:1608.07905, 2016.
|
| 227 |
+
Dirk Weissenborn. Separating answers from queries for neural reading comprehension. arXiv
|
| 228 |
+
preprint arXiv:1607.03316, 2016.
|
| 229 |
+
|
| 230 |
+
Jason Weston, Sumit Chopra, and Antoine Bordes. Memory networks. CoRR, abs/1410.3916, 2014. URL http://arxiv.org/abs/1410.3916.
|
| 231 |
+
|
| 232 |
+
Wenpeng Yin, Sebastian Ebert, and Hinrich Schutze. Attention-based convolutional neural network ¨ for machine comprehension. arXiv preprint arXiv:1602.04341, 2016.
|
| 233 |
+
|
| 234 |
+
Yang Yu, Wei Zhang, Chung-Wei Hang, and Bowen Zhou. Empirical study on deep learning models for question answering. arXiv preprint arXiv:1510.07526, 2015.
|
| 235 |
+
|
| 236 |
+
Wojciech Zaremba and Ilya Sutskever. Reinforcement learning neural turing machines. arXiv preprint arXiv:1505.00521, 362, 2015.
|
| 237 |
+
|
| 238 |
+
Wei Zhang, Yang Yu, and Bowen Zhou. Structured memory for neural turing machines. arXiv preprint arXiv:1510.03931, 2015.
|
md/train/rJl8viCqKQ/rJl8viCqKQ.md
ADDED
|
@@ -0,0 +1,243 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# LOW LATENCY PRIVACY PRESERVING INFERENCE
|
| 2 |
+
|
| 3 |
+
Anonymous authors Paper under double-blind review
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
When applying machine learning to sensitive data one has to balance between accuracy, information leakage, and computational-complexity. Recent studies have shown that Homomorphic Encryption (HE) can be used for protecting against information leakage while applying neural networks. However, this comes with the cost of limiting the kind of neural networks that can be used (and hence the accuracy) and with latency of the order of several minutes even for relatively simple networks. In this study we improve on previous results both in the kind of networks that can be applied and in terms of the latency. Most of the improvement is achieved by novel ways to represent the data to make better use of the capabilities of the encryption scheme.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
Machine learning is used in domains such as education, health, and finance in which data may be private or confidential. Therefore, machine learning algorithms should preserve privacy while making accurate predictions. The privacy requirement pertains to all sub-tasks of the learning process, such as training and inference. In this work, we focus on private neural-networks inference. In this problem, popularized by the work on CryptoNets (Dowlin et al., 2016), the goal is to build an inference service that can make predictions on private data. To achieve this goal, the data is encrypted before it is sent to the prediction service which should be capable of operating on the encrypted data without having access to the raw content. To allow that, several cryptology technologies have been proposed, including Secure Multi-Party Computation (MPC) (Yao, 1982; Goldreich et al., 1987), hardware enclaves, such as Intel’s Software Guard Extensions (SGX) (McKeen et al., 2013), Homomorphic Encryption (Gentry, 2009), and combinations of these techniques.
|
| 12 |
+
|
| 13 |
+
The different approaches present different trade-offs in terms of computation, accuracy, and security. HE presents the most stringent security model. The security assumption relies on the hardness of solving a mathematical problem for which there are no known efficient algorithms, even in the presence of quantum computers (Gentry, 2009; Albrecht et al., 2018). Other techniques, such as MPC and SGX make additional assumptions and therefore provide a weaker sense of protection to the data (Yao, 1982; McKeen et al., 2013; Chen et al., 2018; Koruyeh et al., 2018).
|
| 14 |
+
|
| 15 |
+
While HE provides the highest level of security it is also limited in the kind of operations it allows and the complexity of these operations (see Section 1.1). CryptoNets (Dowlin et al., 2016) was the first demonstration that it may be feasible to use HE to build privacy preserving Encrypted Prediction as a Service (EPaaS) solutions (Sanyal et al., 2018). CryptoNets are capable of making predictions with accuracy of $9 9 \%$ on the MNIST task (LeCun et al., 2010) such that each prediction takes 250 seconds to complete. CryptoNets are also capable of packing 4096 prediction requests and operate on all of them in parallel which allows throughput of $\sim 5 9 0 0 0$ predictions per hour.
|
| 16 |
+
|
| 17 |
+
CryptoNets have several limitations that we address in this work, the first of them is latency. CryptoNets provide high throughput by operating on 4096 instances in parallel, however, all these instances have to come from a single source and use the same secret key. Therefore, this capability may be of little use in practice. Thus, we trade the high throughput in favor of low latency and show that the same neural network that was used by CryptoNets can be evaluated in as little as 2.2 seconds. We show that a part of this gain is an “engineering gain” which is a result of using a more recent implementation of HE. However, this “engineering gain” accounts for only $1 0 \times$ speedup. Most of the speedup comes from a new way to represent data when applying neural-networks using HE which we call LoLa. In a nut-shell, CryptoNets represent each node in the neural network as a separate message for encryption, while LoLa encrypts entire layers which results in a $1 1 . 2 \times$ speedup on top of the “engineering gain”. Together, these improvements results in a $1 1 4 \times$ improvement in latency while maintaining the same level of security and accuracy.1
|
| 18 |
+
|
| 19 |
+
LoLa provides another significant benefit over CryptoNets. Since CryptoNets encode every node in the network as a separate message, they create a memory bottleneck when applied to networks with many nodes. We demonstrate that in an experiment conducted on the CIFAR-10 dataset for which the CryptoNets approach fails to execute since it requires 100’s of Gigabytes of RAM. However, the low-latency approach, LoLa, which encodes layers instead of nodes, can make predictions in 12 minutes using only few Gigabytes of RAM.
|
| 20 |
+
|
| 21 |
+
The experiment on CIFAR demonstrates that the LoLa approach can handle larger networks than CryptoNets. However, there is still a big penalty for the size of the network: predictions on MNIST are achieved in 2.2 seconds, and this latency jumps to 12 minutes for the slightly more complex task in the CIFAR-10 dataset. Therefore, it is reasonable to ask whether any of these approaches can scale to handle tasks such as analyzing large and complex images. To that extent, we propose another solution which represents the input to the network using semantically meaningful features instead of pixels. These semantically meaningful features are extracted using the convolution layers of standard networks such as AlexNet (Krizhevsky et al., 2012). We consider these networks as “standard libraries” for machine learning tasks. Using such features allows reducing the size of the message to be sent and the complexity of the network that is needed for classification. Indeed, we use this approach to demonstrate private predictions in 0.18 seconds on the CalTech-101 dataset with class balanced accuracy of $7 5 . 7 \%$ .
|
| 22 |
+
|
| 23 |
+
# 1.1 HOMOMORPHIC ENCRYPTION
|
| 24 |
+
|
| 25 |
+
In this work we use Homomorphic Encryptions (HE) to provide privacy (we refer the reader to Dowlin et al. (2017) for a more comprehensive introduction). HEs are encryptions that allow operating on data while it is encrypted without requiring access to the secret key (Gentry, 2009). The data used for encryption is assumed to be elements in a ring $\mathcal { R }$ . On top of the encryption function $\mathbb { E }$ and the decryption function $\mathbb { D }$ , the HE scheme provides two additional operators $\oplus$ and $\otimes$ such that for any $x _ { 1 } , x _ { 2 } \in \mathcal { R }$
|
| 26 |
+
|
| 27 |
+
$$
|
| 28 |
+
\begin{array} { r l } & { \mathbb { D } \left( \mathbb { E } ( x _ { 1 } ) \oplus \mathbb { E } \left( x _ { 2 } \right) \right) = x _ { 1 } + x _ { 2 } \mathrm { ~ a n d ~ } } \\ & { \mathbb { D } \left( \mathbb { E } \left( x _ { 1 } \right) \otimes \mathbb { E } \left( x _ { 2 } \right) \right) = x _ { 1 } \times x _ { 2 } } \end{array}
|
| 29 |
+
$$
|
| 30 |
+
|
| 31 |
+
where $^ +$ and $\times$ are the standard addition and multiplication operations on the ring $\mathcal { R }$ . Therefore, the $\oplus$ and $\otimes$ operators allow computing addition and multiplication operators on the data in its encrypted form and thus computing any polynomial function.
|
| 32 |
+
|
| 33 |
+
Since Gentry’s seminal paper, in which he introduced the first HE scheme (Gentry, 2009), additional schemes have been proposed. In this work we use the Brakerski/Fan-Vercauteren scheme (BFV) (Fan & Vercauteren, 2012; Brakerski & Vaikuntanathan, 2014) as it is implemented in the SEAL library version 2.3.1.2 In this scheme, the ring on which the Homomorphic Encryption operates is $\begin{array} { r } { \mathcal { R } = \frac { \mathbb { Z } _ { p } [ x ] } { x ^ { n } + 1 } } \end{array}$ where $\begin{array} { r } { \mathbb { Z } _ { p } = \frac { \mathbb { Z } } { p \mathbb { Z } } } \end{array}$ . If the parameters $p$ and $n$ are chosen such that there is an order $2 n$ root of unity in $\mathbb { Z } _ { p }$ , then every element in can be viewed as a vector of dimension $n$ of elements in $\mathbb { Z } _ { p }$ where addition and multiplication operate component-wise (Brakerski et al., 2014). In this view, the BFV scheme allows a another operation on the encrypted data: rotation. The ideal rotation operation of size $k$ sends the value in the $\because$ ’th coordinate of a vector to the $( ( i + k )$ mod $n$ ) coordinate. The BFV scheme allows a slight modified version of the ideal rotation (see Appendix A) but for the sake of our discussion this detail is insignificant.
|
| 34 |
+
|
| 35 |
+
# 1.2 RELATED WORK
|
| 36 |
+
|
| 37 |
+
The task of private predictions gained significant attention in recent years. Dowlin et al. (2016) presented CryptoNets which demonstrated the feasibility of private neural networks predictions using
|
| 38 |
+
|
| 39 |
+
HE. CryptoNets are capable of making predictions with high throughput but are limited in both the depth of the network they can support and the latency per prediction. Bourse et al. (2017) used a different HE scheme that allows fast bootstrapping which results in only linear penalty for additional layers in the network. However, it is slower per operation and therefore, the results they presented on the MNIST data-set use small models with significantly lower accuracy (see Table 1). Sanyal et al. (2018) argued that many of these methods leak information about the structure of the neuralnetwork that the service provider uses through the parameters of the encryption. They presented a method that leaks less information about the neural-network but their solution is orders of magnitude slower. Nevertheless, their solution has the nice benefit that it allows the service provider to change the network without requiring changes in the client side.
|
| 40 |
+
|
| 41 |
+
Other researchers proposed using different encryption schemes. For example, the Chameleon system (Riazi et al., 2018) uses MPC to demonstrate private predictions on MNIST and Juvekar et al. (2018) use a hybrid MPC-HE approach for the same task. Hardware based solutions were also proposed, for example, Tramer & Boneh (2018). Some of these approaches provide faster predictions which are, in some cases, more accurate, however, this comes with the cost of a using a lower level of security.
|
| 42 |
+
|
| 43 |
+
# 2 DATA REPRESENTATION
|
| 44 |
+
|
| 45 |
+
Feed-forward neural networks are functions that can be computed by an alternating sequence of linear transformations and non-linear transformations. Linear transformations include dense, convolution layers and average pooling layers. Non-linear transformations include activation functions and max pooling layers. In most cases, we can consider this sequence to be alternating between linear transformations and non-linear ones since consecutive linear transformations can be combined into a single linear transformation and sequences of non-linear transformations can be merged as well.
|
| 46 |
+
|
| 47 |
+
For most of this work, we restrict the non-linear transformations to the square activation function. This follows CryptoNets (Dowlin et al., 2016) that showed that high accuracy can be achieved even with this restriction. We demonstrate this again on the CIFAR data-set in Section 4. Recall that HE supports point-wise multiplication of vectors and therefore it is straight-forward to implement the square activation function.
|
| 48 |
+
|
| 49 |
+
The main linear transformations we consider are dot-products and matrix-vector multiplications. Given two vectors, we can implement a dot product between two vectors whose size is a power of 2 by first applying point-wise multiplication between the two vectors and then a series of $\log n$ rotations of size $1 , 2 , 4 , \ldots , n / 2$ and addition between each rotation. The result of such a dot product operation is a vector that holds the results of the dot-product in all its coordinates.3
|
| 50 |
+
|
| 51 |
+
The dot-product operation can induce a change in representations. For example, given a weights matrix and an input vector represented as a single message, we can multiply the matrix by the vector using $r$ dot-product operations where $r$ is the number of rows in the matrix. The result of this operation is a vector of length $r$ that is spread across $r$ messages. Therefore, the result has a different representation than the representation of the input vector. Different representations can induce different computational costs and therefore choosing the right representations throughout the computation is important for computational efficiency. It is possible to change representations but this requires additional computational steps. Instead, we propose using various representations in the network inference. We start our discussion by presenting different possible vector representations.
|
| 52 |
+
|
| 53 |
+
# 2.1 VECTOR REPRESENTATIONS
|
| 54 |
+
|
| 55 |
+
Recall that a message in HE can be thought of as a vector of length $n$ of elements in $\mathbb { Z } _ { p }$ . For the sake of brevity, we assume that the dimension of the vector $\mathbf { v }$ to be encoded is of length $k$ such that $k \leq n$ , for otherwise multiple messages can be combined. For any vector $\mathbf { u }$ we denote by $u _ { i }$ its $i ^ { \mathrm { { t h } } }$ coordinate.
|
| 56 |
+
|
| 57 |
+
2.1.1 Dense representation: A vector $\mathbf { v }$ is represented as a single message m by setting $v _ { i } \mapsto m _ { i }$
|
| 58 |
+
|
| 59 |
+
2.1.2 Sparse representation: A vector $\mathbf { v }$ of length $k$ is represented in $k$ messages $\mathbf { m } ^ { 1 } , \ldots . \mathbf { m } ^ { k }$ such that $\mathbf { m } ^ { i }$ is a vector in which every coordinate is set to $v _ { i }$ .4
|
| 60 |
+
|
| 61 |
+
2.1.3 Stacked representation: For a short (low dimension) vector $\mathbf { v }$ , the stacked representation holds several copies of the vector $\mathbf { v }$ in a single message m. Typically this will be done by finding $d = \lceil \log \left( k \right) \rceil$ , the smallest $d$ such that the dimension of $\mathbf { v }$ is at most $2 ^ { d }$ and setting $m _ { i } , m _ { i + 2 ^ { d } } , m _ { i + 2 \cdot 2 ^ { d } } , . . . = v _ { i }$ .
|
| 62 |
+
|
| 63 |
+
2.1.4 Interleaved representation: The interleaved representation uses a permutation $\sigma$ of $[ 1 , \ldots , n ]$ to set $m _ { \sigma ( i ) } = v _ { i }$ . The dense representation can be viewed as a special case of the interleaved representation where $\sigma$ is the identity permutation.
|
| 64 |
+
|
| 65 |
+
2.1.5 Convolution representation: This is a special representation that makes convolution operations efficient. A convolution, when flattened to a single dimension, can be viewed as a restricted linear operation where there is a weight vector w of length $r$ (the window size) and a set of permutations $\sigma _ { i }$ such that the $\overrightarrow { \imath } ^ { \prime }$ ’th output of the linear transformation is $\textstyle \sum _ { j } w _ { j } v _ { \sigma _ { i } ( j ) }$ . The convolution representation takes a vector $v$ and represents it as $r$ messages $\mathbf { m } ^ { 1 } , \ldots , \mathbf { m } ^ { r }$ such that $m _ { i } ^ { j } = v _ { \sigma _ { i } ( j ) }$ . 5
|
| 66 |
+
|
| 67 |
+
2.1.6 SIMD representation: CryptoNets (Dowlin et al., 2016) represent each data element as a separate message but maps multiple data vectors into the same set of messages. More details about this representation are in Appendix B.
|
| 68 |
+
|
| 69 |
+
# 2.2 MATRIX-VECTOR MULTIPLICATIONS
|
| 70 |
+
|
| 71 |
+
Matrix-vector multiplication is a core operation in neural networks. The matrix may contain the learned weights of the network and the vector represents the values of the nodes at a certain layer. Here we present different ways to implement such matrix-vector operations. Each method operates on vectors in different representations and produces output in yet another representation. Furthermore, the weight matrix has to be represented appropriately as a set of vectors, either column-major or row-major to allow the operation. We assume that the matrix $W$ has $k$ columns $\mathbf { c } ^ { 1 } , \ldots , \mathbf { c } ^ { k }$ and $r$ rows $\mathbf { r } ^ { 1 } , \ldots , \mathbf { r } ^ { r }$ .
|
| 72 |
+
|
| 73 |
+
2.2.1 Dense Vector – Row Major: If the vector is given as a dense vector and each row $\mathbf { r } ^ { j }$ of the weight matrix is encoded as a dense vector then the matrix-vector multiplication can be applied using $r$ dot-product operations. As already described above, a dot-product requires a single multiplication and $\log \left( n \right)$ additions and rotations. The result is a sparse vector of length $r$ .
|
| 74 |
+
|
| 75 |
+
2.2.2 Sparse Vector – Column Major: Recall that $W \mathbf { v } = \sum v _ { i } \mathbf { c } ^ { i }$ . Therefore, when $\mathbf { v }$ is encoded in a sparse format, the message $\mathbf { m } ^ { i }$ has all its coordinate set to $v _ { i }$ and $v _ { i } \mathbf { c } ^ { i }$ can be computed using a single point-wise multiplication. Therefore, $W \mathbf { v }$ can be computed using $k$ multiplications and additions and the result is a dense vector.
|
| 76 |
+
|
| 77 |
+
2.2.3 Stacked Vector – Row Major: For the sake of clarity, assume that $k = 2 ^ { d }$ for some $d$ . In this case $n / k$ copies of $\mathbf { v }$ can be stacked in a single message $\mathbf { m }$ (this operation requires $\log { ( n / k ) } - 1$ rotations and additions). By concatenating $n / k$ rows of $W$ into a single message a special version of the dot-product operation can be used to compute $n / k$ elements of $W \mathbf { v }$ at once. First, a pointwise multiplication of the stacked vector and the concatenated rows is applied followed by $d - 1$ rotations and additions where the rotations are of size $1 , 2 , \ldots , 2 ^ { d - 1 }$ . The result is in the interleaved representation.6
|
| 78 |
+
|
| 79 |
+
The Stacked Vector - Row Major gets its efficiency from two places. First, the number of modified dot product operations is $\left. r k \right/ n$ and each dot product operation requires a single multiplication and second, only $d$ rotations and additions (compared to $\log n$ rotations and additions in the standard dot-product procedure).
|
| 80 |
+
|
| 81 |
+
2.2.4 Interleaved Vector – Row Major: This setting is very similar to the dense vector – row major matrix multiplication procedure with the only difference being that the columns of the matrix have to be shuffled to match the permutation of the interleaved representation of the vector. The result is in sparse format.
|
| 82 |
+
|
| 83 |
+
2.2.5 Convolution vector – Row Major: A convolution layer applies the same linear transformation to different locations on the data vector v. For the sake of brevity, assume the transformation is one-dimensional. In neural network language that would mean that the kernel has a single map. Obviously, if more maps exist, then the process described here can be repeated multiple times.
|
| 84 |
+
|
| 85 |
+
Recall that a convolution, when flattened to a single dimension, is a restricted linear operation where the weight vector w is of length $r$ , and there exists a set of permutations $\sigma _ { i }$ such that the $\ddot { \iota }$ ’th output of the linear transformation is $\sum w _ { j } v _ { \sigma _ { i } ( j ) }$ . In this case, the convolution representation is made of $r$ messages such that the $\ddot { \iota }$ ’th element in the message $\mathbf { m } ^ { j }$ is $v _ { \sigma _ { i } ( j ) }$ . By using a sparse representation of the vector w, we get that $\sum w _ { j } \mathbf { m } ^ { j }$ computes the set of required outputs using $r$ multiplications and additions. When the weights are not encrypted, the multiplications used here are relatively cheap since the weights are scalar and BFV supports fast implementation of multiplying a message by a scalar. The result of this operation is in a dense format.
|
| 86 |
+
|
| 87 |
+
# 3 SECURE NETWORKS FOR MNIST
|
| 88 |
+
|
| 89 |
+
The neural network used for the MNIST data-set (LeCun et al., 2010) is the same network used by CryptoNets (Dowlin et al., 2016). After suppressing adjacent linear layers it can be presented as a $5 \times 5$ convolution layer with a stride of $( 2 , 2 )$ and 5 output maps, which is followed by a square activation function that feeds a fully connected layer with 100 output maps, another square activation and another fully connected layer with 10 outputs (see Figure 2 in the appendix).
|
| 90 |
+
|
| 91 |
+
The baseline implementation uses the techniques presented in CryptoNets in Table 1. Recall that CryptoNets use the SIMD representation (Section 2.1.6) in which each pixel requires its own message. Therefore, since each image in the MNIST data-set is made of an array of $2 8 \times 2 8$ pixels, the input to the CryptoNets network is made of 784 messages. On the reference machine used for this work (Azure standard B8ms virtual machine with 8 vCPUs and 32GB of ram) the original CryptoNets implementation runs in 205 seconds. Re-implementing it to use better memory management and multi-threading in SEAL 2.3 reduces the running time to 24.8 seconds. Since this implementation allows batching of 8192 images to be processed simultaneously, it has a potential throughput of 1189161 predictions per hour which is, as far as we know, the highest throughput reported on this task by a large margin.
|
| 92 |
+
|
| 93 |
+
While CryptoNets provide high throughput, in many cases, it is hard to utilize this high throughput which requires batching together 8192 requests from sources that share the same secret key. If each user has only a single record to be predicted on, the throughput is governed by the latency and therefore, we move towards reducing latency. We do that by replacing the SIMD representation with other representations. As a result, throughput is sacrificed in favor of latency.
|
| 94 |
+
|
| 95 |
+
The Low-Latency CryptoNets (LoLa) uses the same network layout and has accuracy of $9 8 . 9 5 \%$ (see Table 2 for a summary of the data representations used by LoLa). However, it is implemented differently: the input to the network is a single dense message where the pixel values are mapped to coordinates in the encoded vector line after line . The first step in processing this message is breaking it into 25 messages corresponding to the 25 pixels in the convolution map to generate a convolution representation. Creating each message requires a single vector multiplication. This is performed by creating 25 masks. The first mask is a vector of zeros and ones that corresponds to a matrix of size $2 8 \times 2 8$ such that a one is in the $( i , j )$ coordinate if the $i , j$ pixel in the image appears as the upper left corner of the $5 \times 5$ window of the convolution layer. Multiplying point-wise the input vector by the mask creates the first message in the convolution representation as described in Section 2.1.5 hybrided with the interleaved representation as described in footnote 5. Similarly the other messages in the convolution representation are created. Note that all masks are shifts of each other which allows using the convolution representation-row major multiplication to implement the convolution layer (see Section 2.2.5). To do that, think of the 25 messages as a matrix and the weights of a map of the convolution layer as a sparse vector. Therefore, the outputs of the entire map can be computed using 25 multiplications (of each weight by the corresponding vector) and 24 additions. Note that there are 169 windows and all of them are computed simultaneously. However, the process repeats 5 times for the 5 maps of the convolution layer.
|
| 96 |
+
|
| 97 |
+
Table 1: MNIST performance comparison. Solutions are grouped by accuracy levels.
|
| 98 |
+
|
| 99 |
+
<table><tr><td>Method</td><td>Accuracy</td><td>Latency</td><td> Throughput</td><td></td></tr><tr><td>FHE-DiNN100</td><td>96.35%</td><td>1.65</td><td>2182</td><td>(Bourse et al., 2017)</td></tr><tr><td>LoLa-Small</td><td>96.92%</td><td>0.29</td><td>12500</td><td></td></tr><tr><td>CryptoNets</td><td>98.95%</td><td>250</td><td>58982</td><td>(Dowlin et al., 2016)</td></tr><tr><td>CryptoNets 2.3</td><td>98.95%</td><td>24.8</td><td>1189160</td><td></td></tr><tr><td>LoLa</td><td>98.95%</td><td>7.2</td><td>500</td><td></td></tr><tr><td>LoLa-Conv</td><td>98.95%</td><td>2.2</td><td>1636</td><td></td></tr></table>
|
| 100 |
+
|
| 101 |
+
The result of the convolution layer are 5 messages, each one of them contains 169 results. They are united into a single vector by rotating the messages such that they will not have active values in the same locations and summing the results. At this point, a single message holds all the 845 values (169 windows $\times 5$ maps). This vector is squared, using a single multiplication operation, to implement the activation function that follows the convolution layer. This demonstrates one of the main differences between CryptoNets and LoLa; In CryptoNets, the activation layer requires 845 multiplication operations, whereas in LoLa it is a single multiplication. Even if we add the manipulation of the vector to place all values in a single message, as described above, we add only 4 rotations and 4 additions which are still much fewer operations than in CryptoNets.
|
| 102 |
+
|
| 103 |
+
Next, we apply a dense layer with 100 maps. LoLa uses messages of size $n = 1 6 3 8 4$ where the 845 results of the previous layer, even though they are in interleaving representation, take fewer than 1024 dimensions. Therefore, 16 copies are stacked together which allows the use of the Stacked vector – Row Major multiplication method. This allows computing 16 out of the 100 maps in each operation and therefore, the entire dense layer is computed in 7 iterations resulting in 7 interleaved messages. By shifting the $i ^ { \mathrm { { t h } } }$ message by $i - 1$ positions, the active outputs in each of the messages are no longer in the same position and they are added together to form a single interleaved message that contains the 100 outputs. The following square activation requires a single point-wisemultiplication of this message. The final dense layer is applied using the Interleaved vector – Row Major method to generate 10 messages, each of which contains one of the 10 outputs.7
|
| 104 |
+
|
| 105 |
+
Overall, applying the entire network takes only 7.2 seconds on the same reference hardware which is $3 4 . 7 \times$ faster than CryptoNets and $3 . 4 \times$ faster than CryptoNets 2.3. This result can be further improved by changing the input to the network; Instead of taking as an input a dense representation of the image, the LoLa-Conv network takes as its input 25 messages which are the convolution representation of the image. This removes a processing step which saves time but also reduces the amount of noise accumulated during the computation and allows working with messages of size $n = 8 1 9 2$ , which further reduces the computation time.
|
| 106 |
+
|
| 107 |
+
The LoLa-Conv starts with a convolution vector – row major multiplication for each of the 5 maps of the convolution layer. The 5 dense output messages are joined together with a rotation and addition to form a single dense vector of 845 elements. This vector is squared using a single multiplication and 8 copies of the results are stacked before applying the dense layer as 13 rounds of Stacked vector – Row Major multiplication. The 13 vectors of interleaved results are rotated and added to form a single interleaved vector of results which is squared using a single multiplication. Finally, Interleaved vector – Row Major multiplication is used to obtain the final result. This version computes the entire network in only 2.2 seconds which is $3 . 3 \times$ faster than LoLa, $1 1 \times$ faster than CryptoNets 2.3 and $1 1 4 \times$ faster than CryptoNets. See Table 3 for a summary of the data representations used by LoLa-Conv.
|
| 108 |
+
|
| 109 |
+
Table 1 shows a summary of the performance of different methods and more details can be found in Appendix C. Bourse et al. (2017) showed faster results with similar security level, albeit with lower accuracy. To compare with that, LoLa-Small is similar to Lola-Conv but has only a convolution layer, square activation and a dense layer. This solution is more accurate than the networks used by Bourse et al. (2017) and at the same time it is $5 . 5 \times$ faster.
|
| 110 |
+
|
| 111 |
+
# 4 SECURE NETWORKS FOR CIFAR
|
| 112 |
+
|
| 113 |
+
The Cifar-10 data-set (Krizhevsky & Hinton, 2009) presents a more challenging task of recognizing one of 10 different types of objects in a small image. The neural network used has the following layout: the input is a $3 \times 3 2 \times 3 2$ image (i) $3 \times 3$ linear convolution with stride of $( 1 , 1 )$ and 128 output maps, (ii) $2 \times 2$ average pooling with $( 2 , 2 )$ stride (iii) $3 \times 3$ convolution with $( 1 , 1 )$ stride and 83 maps (iv) Square activation (v) $2 \times 2$ average pooling with $( 2 , 2 )$ stride (vi) $3 \times 3$ convolution with $( 1 , 1 )$ stride and 163 maps (vii) Square activation (vii) $2 \times 2$ average pooling with stride $( 2 , 2 )$ (viii) fully connected layer with 1024 outputs (ix) fully connected layer with 10 outputs $\mathbf { \tau } ( \mathbf { x } )$ softmax. ADAM was used for optimization (Kingma & Ba, 2014) together with dropouts after layers (vii) and (viii). We use zero-padding in layers (i) and (vii). See Figure 3 for an illustration of the network.
|
| 114 |
+
|
| 115 |
+
For inference, adjacent linear layers were collapsed to form the following structure: (i) $8 \times 8 \times 3$ convolutions with a stride of $( 2 , 2 , 0 )$ and 83 maps (ii) square activation (iii) $6 \times 6 \times 8 3$ convolution with stride $( 2 , 2 , 0 )$ and 163 maps (iv) square activation (v) dense layer with 10 output maps. This network is much larger than the network used for MNIST by CryptoNets. The input to the CIFAR network has 3072 nodes, the first hidden layer has 16268 nodes and the second hidden layer has 4075 nodes (compared to 784, 845, and 100 nodes respectively for MNIST).8 The accuracy of this network is $7 4 . 1 \%$ and it uses plain-text modulus $p = 2 1 4 8 7 2 8 8 3 3 \times 2 1 4 8 7 9 4 3 6 9 \times 2 1 4 9 8 1 0 1 7 7$ (the factors are combined using the Chinese Reminder Theorem) and $n = 1 6 3 8 4$ . See Figure 4 for an illustration of this network.
|
| 116 |
+
|
| 117 |
+
Due to the sizes of the hidden layers, implementing this network with SIMD representation requires more memory than available on the reference machine, since the SIMD representation requires a message for each node in each layer. Therefore, we used the LoLa-Conv approach to implement this network. The image is encoded using the convolution representation into $3 \times 8 \times 8 = 1 9 2$ messages. The convolution layer is implemented using the convolution vector – row major matrixvector multiplication technique. The results are combined into a single message using rotations and additions which allows the square activation to be performed with a single point-wise multiplication. The second convolution layer is performed using row major-dense vector multiplication. Although this layer is a convolution layer, each window of the convolution is so large that it is more efficient to implement it as a dense layer. The output is a sparse vector which is converted into a dense vector by point-wise multiplications and additions which allows the second square activation to be performed with a single point-wise multiplication. The last dense layer is implemented with a row major-dense vector technique again resulting in a sparse output.
|
| 118 |
+
|
| 119 |
+
Executing this network takes 730 seconds out of which the second layer consumes 711 seconds. Therefore, for this task the bottleneck in performance is the sizes of the weight matrices and data vectors as evident by the number of parameters which is $< \ 9 0 , 0 0 0$ in the MNIST network and $> 5 0 0 , 0 0 0$ in the CIFAR network. In the following section we present an approach to mitigate this problem.
|
| 120 |
+
|
| 121 |
+
# 5 APPLYING DEEP NETS USING DEEP REPRESENTATIONS
|
| 122 |
+
|
| 123 |
+
Homomorphic Encryption has two main limitations when used for evaluating deep networks: noise growth and message size growth. Noise growth is a result of the number of operations that has to take place. Each such operation increases the noise in the encrypted message and when this noise becomes too large, it is no longer possible to decrypt the message correctly. This problem can be mitigated using bootstrapping, while taking a performance hit. The message size grows with the size of the network as well. Since, in its core, the HE scheme operates in $\mathbb { Z } _ { p }$ , the parameter $p$ has to be selected such that the largest number obtained during computation would be smaller than $p$ . Since every multiplication might double the required size of $p$ , it has to grow exponentially with respect to the number of layers in the network. The recently introduced HEAAN scheme (Cheon et al., 2017) is more tolerant towards message growth but even HEAAN would not be able to operate efficiently on very deep networks.
|
| 124 |
+
|
| 125 |
+
We propose solving both the message growth and the noise growth problems using deep representations. Instead of encrypting the data in its raw format, it is first converted, by a standard network, to create a deep representation. For example, if the data is an image, then instead of encrypting the image as an array of pixels, a network, such as AlexNet (Krizhevsky et al., 2012), VGG (Simonyan & Zisserman, 2014), or ResNet (He et al., 2016), first extracts a deep representation of the image, using one of its last layers. The resulting representation is encrypted and sent for evaluation. This approach has several advantages. First, this representation is small even if the original image is large. Moreover, with deep representations it is possible to obtain high accuracies using shallow networks: in most cases a linear predictor is sufficient which translates to a fast evaluation with HE. It is also a very natural thing to do since in many cases of interest, such as in medical image, training a very deep network from scratch is almost impossible since data is scarce. Hence, it is a common practice to use deep representation and train only the top layer(s) (Yosinski et al., 2014).
|
| 126 |
+
|
| 127 |
+
To test the deep representation approach we used AlexNet (Krizhevsky et al., 2012) to generate features and trained a linear model to make predictions on the CalTech-101 data-set (Fei-Fei et al., 2006).9 See Table 4 for a summary of the data representations used for the CalTech-101 dataset. Since the CalTech-101 dataset is not class balanced, we used only the first 30 images from each class where the first 20 where used for training and the other 10 examples where used for testing. The obtained model has class-balanced accuracy of $7 5 . 7 \%$ . The inference time, on the encrypted data, takes only 0.178 seconds when using the dense vector – row major multiplication.
|
| 128 |
+
|
| 129 |
+
# 6 CONCLUSIONS
|
| 130 |
+
|
| 131 |
+
The problem of privacy in machine learning is gaining importance due to legal requirements and greater awareness to the benefits and risks of machine learning systems. The task of private inference, specifically with neural networks, serves as a benchmark and catalyst to promote further study in this domain. In this work, we showed how data representations can be used to accelerate private predictions using Homomorphic Encryption. We demonstrated both the ability to operate on more complex networks as well as lower latency on networks that were already studied in the past.
|
| 132 |
+
|
| 133 |
+
Some of the methods we propose require precomputation on the client side. In many cases, HE is presented as a method to offload computation from a power-limited client to the cloud. However, this is not the only reason to use privacy preserving prediction services: in some applications the data is sensitive while the service provider is not willing to share the model which may be a result of a costly development process. In these cases, the techniques we present here allow the provider to offer its services while respecting the privacy of data.
|
| 134 |
+
|
| 135 |
+
# REFERENCES
|
| 136 |
+
|
| 137 |
+
Martin Albrecht, Melissa Chase, Hao Chen, Jintai Ding, Shafi Goldwasser, Sergey Gorbunov, Jeffrey Hoffstein, Kristin Lauter, Satya Lokam, Daniele Micciancio, et al. Homomorphic encryption standard. 2018.
|
| 138 |
+
|
| 139 |
+
Florian Bourse, Michele Minelli, Matthias Minihold, and Pascal Paillier. Fast homomorphic evaluation of deep discretized neural networks. Technical report, Cryptology ePrint Archive, Report 2017/1114, 2017.
|
| 140 |
+
|
| 141 |
+
Zvika Brakerski and Vinod Vaikuntanathan. Efficient fully homomorphic encryption from (standard) lwe. SIAM Journal on Computing, 43(2):831–871, 2014.
|
| 142 |
+
|
| 143 |
+
Zvika Brakerski, Craig Gentry, and Vinod Vaikuntanathan. (leveled) fully homomorphic encryption without bootstrapping. ACM Transactions on Computation Theory (TOCT), 6(3):13, 2014.
|
| 144 |
+
|
| 145 |
+
Guoxing Chen, Sanchuan Chen, Yuan Xiao, Yinqian Zhang, Zhiqiang Lin, and Ten H Lai. Sgxpectre attacks: Leaking enclave secrets via speculative execution. arXiv preprint arXiv:1802.09085, 2018.
|
| 146 |
+
|
| 147 |
+
Jung Hee Cheon, Andrey Kim, Miran Kim, and Yongsoo Song. Homomorphic encryption for arithmetic of approximate numbers. In International Conference on the Theory and Application of Cryptology and Information Security, pp. 409–437. Springer, 2017.
|
| 148 |
+
|
| 149 |
+
Nathan Dowlin, Ran Gilad-Bachrach, Kim Laine, Kristin Lauter, Michael Naehrig, and John Wernsing. Cryptonets: Applying neural networks to encrypted data with high throughput and accuracy. In International Conference on Machine Learning, pp. 201–210, 2016.
|
| 150 |
+
|
| 151 |
+
Nathan Dowlin, Ran Gilad-Bachrach, Kim Laine, Kristin Lauter, Michael Naehrig, and John Wernsing. Manual for using homomorphic encryption for bioinformatics. Proceedings of the IEEE, 105 (3):552–567, 2017.
|
| 152 |
+
|
| 153 |
+
Junfeng Fan and Frederik Vercauteren. Somewhat practical fully homomorphic encryption. IACR Cryptology ePrint Archive, 2012:144, 2012.
|
| 154 |
+
|
| 155 |
+
Li Fei-Fei, Rob Fergus, and Pietro Perona. One-shot learning of object categories. IEEE transactions on pattern analysis and machine intelligence, 28(4):594–611, 2006.
|
| 156 |
+
|
| 157 |
+
Craig Gentry. Fully homomorphic encryption using ideal lattices. In STOC, volume 9, pp. 169–178, 2009.
|
| 158 |
+
|
| 159 |
+
Oded Goldreich, Silvio Micali, and Avi Wigderson. How to play any mental game. In Proceedings of the nineteenth annual ACM symposium on Theory of computing, pp. 218–229. ACM, 1987.
|
| 160 |
+
|
| 161 |
+
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.
|
| 162 |
+
|
| 163 |
+
Chiraag Juvekar, Vinod Vaikuntanathan, and Anantha Chandrakasan. Gazelle: A low latency framework for secure neural network inference. arXiv preprint arXiv:1801.05507, 2018.
|
| 164 |
+
|
| 165 |
+
Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
|
| 166 |
+
|
| 167 |
+
Esmaeil Mohammadian Koruyeh, Khaled Khasawneh, Chengyu Song, and Nael Abu-Ghazaleh. Spectre returns! speculation attacks using the return stack buffer. In 12th USENIX Workshop on Offensive Technologies (WOOT 18). USENIX Association, 2018.
|
| 168 |
+
|
| 169 |
+
Alex Krizhevsky and Geoffrey Hinton. Learning multiple layers of features from tiny images. Technical report, Citeseer, 2009.
|
| 170 |
+
|
| 171 |
+
Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton. Imagenet classification with deep convolutional neural networks. In Advances in neural information processing systems, pp. 1097–1105, 2012.
|
| 172 |
+
|
| 173 |
+
Yann LeCun, Corinna Cortes, and Christopher JC Burges. Mnist handwritten digit database. at&t labs, 2010.
|
| 174 |
+
|
| 175 |
+
Frank McKeen, Ilya Alexandrovich, Alex Berenzon, Carlos V Rozas, Hisham Shafi, Vedvyas Shanbhogue, and Uday R Savagaonkar. Innovative instructions and software model for isolated execution. HASP@ ISCA, 10, 2013.
|
| 176 |
+
|
| 177 |
+
M Sadegh Riazi, Christian Weinert, Oleksandr Tkachenko, Ebrahim M Songhori, Thomas Schneider, and Farinaz Koushanfar. Chameleon: A hybrid secure computation framework for machine learning applications. In Proceedings of the 2018 on Asia Conference on Computer and Communications Security, pp. 707–721. ACM, 2018.
|
| 178 |
+
|
| 179 |
+
Amartya Sanyal, Matt J Kusner, Adrià Gascón, and Varun Kanade. Tapas: Tricks to accelerate (encrypted) prediction as a service. arXiv preprint arXiv:1806.03461, 2018.
|
| 180 |
+
|
| 181 |
+
Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. arXiv preprint arXiv:1409.1556, 2014.
|
| 182 |
+
|
| 183 |
+
Florian Tramer and Dan Boneh. Slalom: Fast, verifiable and private execution of neural networks in trusted hardware. arXiv preprint arXiv:1806.03287, 2018.
|
| 184 |
+
|
| 185 |
+
Andrew C Yao. Protocols for secure computations. In Foundations of Computer Science, 1982. SFCS’08. 23rd Annual Symposium on, pp. 160–164. IEEE, 1982.
|
| 186 |
+
|
| 187 |
+
Jason Yosinski, Jeff Clune, Yoshua Bengio, and Hod Lipson. How transferable are features in deep neural networks? In Advances in neural information processing systems, pp. 3320–3328, 2014.
|
| 188 |
+
|
| 189 |
+
# A ROTATIONS
|
| 190 |
+
|
| 191 |
+
For the rotation operation in the BFV encryption scheme it is easier to think of the message as a $2 \times n / 2$ matrix:
|
| 192 |
+
|
| 193 |
+
$$
|
| 194 |
+
\left[ \begin{array} { c c c c c } { { m _ { 1 } } } & { { m _ { 2 } } } & { { \cdot } } & { { \cdot } } & { { m _ { n / 2 } } } \\ { { m _ { n / 2 + 1 } } } & { { m _ { n / 2 + 2 } } } & { { \cdot } } & { { \cdot } } & { { m _ { n } } } \end{array} \right]
|
| 195 |
+
$$
|
| 196 |
+
|
| 197 |
+
with this representation in mind, there are two rotations allowed, one switches the row, which will turn the above matrix to
|
| 198 |
+
|
| 199 |
+
$$
|
| 200 |
+
\left[ \begin{array} { c c c c c c } { { m _ { n / 2 + 1 } } } & { { m _ { n / 2 + 2 } } } & { { . } } & { { . } } & { { m _ { n } } } \\ { { m _ { 1 } } } & { { m _ { 2 } } } & { { . } } & { { . } } & { { m _ { n / 2 } } } \end{array} \right]
|
| 201 |
+
$$
|
| 202 |
+
|
| 203 |
+
and the other rotates the columns. For example, rotating the original matrix by one column to the right will result in
|
| 204 |
+
|
| 205 |
+
$$
|
| 206 |
+
\left[ \begin{array} { c c c c c c } { { m _ { n / 2 } } } & { { m _ { 1 } } } & { { \cdot } } & { { \cdot } } & { { m _ { n / 2 - 1 } } } \\ { { m _ { n } } } & { { m _ { n / 2 + 1 } } } & { { \cdot } } & { { \cdot } } & { { m _ { n - 1 } } } \end{array} \right] ~ .
|
| 207 |
+
$$
|
| 208 |
+
|
| 209 |
+
Since $n$ is a power of two, and the rotations we are interested in are powers of two as well, for the sake of this work, thinking about the rotations as simple rotations of the elements in the message yields similar results. In this view, the row-rotation is a rotation of size $n / 2$ and smaller rotations are achieved by column rotations.
|
| 210 |
+
|
| 211 |
+
# B THE SIMD REPRESENTATION
|
| 212 |
+
|
| 213 |
+
The vector structure of messages used by CryptoNets allow parallel execution over multiple data simultaneously. CryptoNets takes $n$ input vectors $\mathbf { v } ^ { 1 } , \ldots , \mathbf { v } ^ { n }$ and creates a dense representation in which these $n$ messages of length $k$ are encoded in $k$ messages $\mathbf { m } ^ { 1 } , \ldots , \mathbf { m } ^ { k }$ such that $\begin{array} { r } { m _ { i } ^ { j } = v _ { j } ^ { i } } \end{array}$ . All operations between vectors and matrices are implemented using additions and multiplications only. For example, a dot product between two vectors of length $k$ is implemented by $k$ multiplications and additions. Therefore, it acts as a sparse representation.
|
| 214 |
+
|
| 215 |
+
The advantage of this representation, which we call the SIMD Representation, is that the cost of applying an operation to a vector is the same cost of applying the same operation to $n$ vectors, hence it supports the Single Instruction Multiple Data (SIMD) framework. However, it is costly in two ways: the computational complexity of multiplying a matrix of size $r \times k$ with a vector of length $k$ is $O \left( r k \right)$ HE operations, and the memory consumption is large as well since a vector of length $k$ requires $k$ messages. In this sense it is similar to the sparse representation. However, the ability to perform SIMD operations provides it with high throughput, much like the dense representation.
|
| 216 |
+
|
| 217 |
+

|
| 218 |
+
Figure 1: The latency of the different network implementations for the MNIST task with respect to the number of available cores. The right figure shows the ratio between the latency of each solution and the latency of the LoLa-Conv
|
| 219 |
+
|
| 220 |
+
# C PARALLEL SCALING
|
| 221 |
+
|
| 222 |
+
The performance of the different solutions is affected by the amount of parallelism allowed. The hardware used for experimentation in this work has 8 cores. Therefore, we tested the performance of the different solutions with 1, 2, 4, and 8 cores to see how the performance varies. The results of these experiments are presented in Figure 1. These results show that at least up to 8 cores the performance of all methods scales linearly when tested on the MNIST data-set. This suggests that the latency can be further improved by using machines with higher core count.
|
| 223 |
+
|
| 224 |
+
# D LOLA REPRESENTATION CHANGES
|
| 225 |
+
|
| 226 |
+
The following tables show the different stages that the data goes through when using LoLa. This illustrates how the different representations are used during the computation. Table 2 shows the process that LoLa applies, Table 3 shows the process for LoLa-Conv, and Table 4 shows the process for the method proposed for processing the CalTech-101 dataset.
|
| 227 |
+
|
| 228 |
+

|
| 229 |
+
Figure 2: The structure of the network used for MNIST classification
|
| 230 |
+
|
| 231 |
+

|
| 232 |
+
Figure 3: The structure of the network used for CIFAR classification.
|
| 233 |
+
|
| 234 |
+

|
| 235 |
+
Figure 4: The structure of the network used for CIFAR classification after collapsing adjacent layers.
|
| 236 |
+
|
| 237 |
+
<table><tr><td rowspan=1 colspan=1>rrrrrireg</td><td rowspan=1 colspan=1>eserseopereseee</td><td rowspan=1 colspan=1>srsserts ereere or inter ree</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>oro nner sesessee s negigoe</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>serdoerr res</td><td rowspan=1 colspan=1>sesseauindino</td><td rowspan=1 colspan=1>oo oar sesesses engio</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1>rog indhno</td><td rowspan=1 colspan=1>dsues</td><td rowspan=1 colspan=1>Gorraiiirreinniiiiir</td><td rowspan=1 colspan=1>Trrereeiee</td><td rowspan=1 colspan=1>Trreaeeiee</td><td rowspan=1 colspan=1>Trreeeeee</td><td rowspan=1 colspan=1>Trrepiepereeee</td><td rowspan=1 colspan=1>Trreeeiee</td><td rowspan=1 colspan=1>Trreeeeee</td><td rowspan=1 colspan=1>Trrereeiee</td><td rowspan=1 colspan=1>Sssree</td></tr><tr><td rowspan=1 colspan=1>wtr sreer</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>oreri-ninior)uinnnirnos</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>(porarssrtrrt-etg</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>JIma-min</td></tr><tr><td rowspan=1 colspan=1>azs gndu</td><td rowspan=1 colspan=1>8</td><td rowspan=1 colspan=1>3</td><td rowspan=1 colspan=1>6912</td><td rowspan=1 colspan=1>691×</td><td rowspan=1 colspan=1>3</td><td rowspan=1 colspan=1>3</td><td rowspan=1 colspan=1>皖58×91</td><td rowspan=1 colspan=1>9×∠</td><td rowspan=1 colspan=1>100</td><td rowspan=1 colspan=1>100</td></tr><tr><td rowspan=1 colspan=1>Jaker</td><td rowspan=1 colspan=1>ropdkioug</td><td rowspan=1 colspan=3>Jrr grniniruirg x</td><td rowspan=1 colspan=1>Jrrrerenee</td><td rowspan=1 colspan=3>Jaer eseee</td><td rowspan=1 colspan=1>Jhrrreerrtt</td><td rowspan=1 colspan=1>Jareeseea</td></tr></table>
|
| 238 |
+
|
| 239 |
+
<table><tr><td rowspan=1 colspan=1>Brnreiieen</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>areserss oirpeidrrtesreree</td><td rowspan=1 colspan=1>sasessss oseep s ursr indin</td><td rowspan=1 colspan=1>ouo oinrseesseg oegqee</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>ssrdeeg reees</td><td rowspan=1 colspan=1>ssesssrr unindino</td><td rowspan=1 colspan=1>ono nner sesesseegr nerioioee</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1>Jror indino</td><td rowspan=1 colspan=1>conniinuio</td><td rowspan=1 colspan=1>Coonninuin</td><td rowspan=1 colspan=1>asuee</td><td rowspan=1 colspan=1>asues</td><td rowspan=1 colspan=1>esues</td><td rowspan=1 colspan=1>sseeee</td><td rowspan=1 colspan=1>Trreeiee</td><td rowspan=1 colspan=1>Trrereeene</td><td rowspan=1 colspan=1>Trrereeene</td><td rowspan=1 colspan=1>Ssrrre</td></tr><tr><td rowspan=1 colspan=1>Wrtrsraea</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>(ooorr-nuniir)uinnniruir</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>prrrrssrterets</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>JIii-mir</td></tr><tr><td rowspan=1 colspan=1>Jzis jndu</td><td rowspan=1 colspan=1>84</td><td rowspan=1 colspan=1>691397</td><td rowspan=1 colspan=1>69137</td><td rowspan=1 colspan=1>691×</td><td rowspan=1 colspan=1>5</td><td rowspan=1 colspan=1>5</td><td rowspan=1 colspan=1>8×8</td><td rowspan=1 colspan=1>8x1</td><td rowspan=1 colspan=1>10</td><td rowspan=1 colspan=1>10</td></tr><tr><td rowspan=1 colspan=1>Vaker</td><td rowspan=1 colspan=1>preeeeces</td><td rowspan=1 colspan=1>rrndrging</td><td rowspan=1 colspan=2>Jxrrr glnnninuirg x </td><td rowspan=1 colspan=1>Jreeaeeb</td><td rowspan=1 colspan=3>Jarer eseer</td><td rowspan=1 colspan=1>shrrrearett</td><td rowspan=1 colspan=1>Jaer saeaa</td></tr></table>
|
| 240 |
+
|
| 241 |
+
Table 4: LoLa-CalTech data representation changes. The table shows the different formats of the data during its evaluation with LoLa on the CalTech-101 dataset
|
| 242 |
+
|
| 243 |
+
<table><tr><td rowspan=1 colspan=1>Layer</td><td rowspan=1 colspan=1>Input size</td><td rowspan=1 colspan=1>Weights format</td><td rowspan=1 colspan=1>Output format</td><td rowspan=1 colspan=1>Description</td></tr><tr><td rowspan=1 colspan=1>Preprocess</td><td rowspan=1 colspan=1>200 ×300</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>dense</td><td rowspan=1 colspan=1> apply convolution layers from Alex-Net</td></tr><tr><td rowspan=1 colspan=1>Encryption</td><td rowspan=1 colspan=1>1000</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>dense</td><td rowspan=1 colspan=1> image is encrypted into 1 message</td></tr><tr><td rowspan=1 colspan=1>dense layer</td><td rowspan=1 colspan=1>1000</td><td rowspan=1 colspan=1>row-major</td><td rowspan=1 colspan=1>sparse</td><td></td></tr></table>
|
md/train/rbdKZJxDWWx/rbdKZJxDWWx.md
ADDED
|
@@ -0,0 +1,214 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Alpha-IoU: A Family of Power Intersection over Union Losses for Bounding Box Regression
|
| 2 |
+
|
| 3 |
+
Jiabo $\mathbf { H e } ^ { 1 , 3 , * }$ , Sarah Erfani1, Xingjun $\mathbf { M } \mathbf { a } ^ { 2 , \dagger }$ , James Bailey1, Ying $\mathbf { C } \mathbf { h } \mathbf { i } ^ { 3 , \dagger }$ , Xian-Sheng $\mathbf { H } \mathbf { u } \mathbf { a } ^ { 3 }$
|
| 4 |
+
|
| 5 |
+
1School of Computing and Information Systems, The University of Melbourne 2School of Computer Science, Fudan University 3DAMO Academy, Alibaba Group {jiaboh@student., sarah.erfani@, baileyj@}unimelb.edu.au
|
| 6 |
+
danxjma@gmail.com, {xinyi.cy, xiansheng.hxs}@alibaba-inc.com
|
| 7 |
+
|
| 8 |
+
# Abstract
|
| 9 |
+
|
| 10 |
+
Bounding box (bbox) regression is a fundamental task in computer vision. So far, the most commonly used loss functions for bbox regression are the Intersection over Union (IoU) loss and its variants. In this paper, we generalize existing IoUbased losses to a new family of power IoU losses that have a power IoU term and an additional power regularization term with a single power parameter $\alpha$ We call this new family of losses the $\alpha$ -IoU losses and analyze properties such as order preservingness and loss/gradient reweighting. Experiments on multiple object detection benchmarks and models demonstrate that $\alpha$ -IoU losses, 1) can surpass existing IoU-based losses by a noticeable performance margin; 2) offer detectors more flexibility in achieving different levels of bbox regression accuracy by modulating $\alpha$ ; and 3) are more robust to small datasets and noisy bboxes.
|
| 11 |
+
|
| 12 |
+
# 1 Introduction
|
| 13 |
+
|
| 14 |
+
Bounding box (bbox) regression localizes an object in an image/video by predicting a bbox for the object, which is fundamental to object detection, localization, and tracking. For example, the most advanced object detectors often consist of a bbox regression branch and a classification branch with the bbox regression branch generating bboxes to localize objects for classification. In this work, we explore more effective loss functions for bbox regression in the context of object detection.
|
| 15 |
+
|
| 16 |
+
Whilst early works in object detection use $\ell _ { n }$ -norm losses [11] for bbox regression, recent works directly adopt the localization performance metric, i.e., Intersection over Union (IoU), as the localization loss [28, 39]. Compared with $\ell _ { n }$ -norm losses, the IoU loss is invariant to bbox scales, thus helping train better detectors. However, the IoU loss suffers from the gradient vanishing problem when the predicted bboxes are not overlapping with the ground truth, which tends to slow down convergence and result in inaccurate detectors. This has motivated the design of several improved IoU-based losses including Generalized IoU (GIoU), Distance-IoU (DIoU) and Complete IoU (CIoU). GIoU introduces a penalty term into the IoU loss to alleviate the gradient vanishing problem [32], while DIoU and CIoU consider the central point distance and aspect ratio between predicted bboxes and their ground truth in penalty terms [43].
|
| 17 |
+
|
| 18 |
+
In this paper, we present a new family of IoU losses obtained by applying power transformations to existing IoU-based losses. We first apply the Box-Cox transformation [2] to the IoU loss $\mathcal { L } _ { \mathrm { I o U } } =$ $1 - I o U$ and generalize it to a power IoU loss: $\mathcal { L } _ { \alpha \mathrm { - I o U } } = ( 1 - I o U ^ { \alpha } ) / \alpha , ~ \alpha > 0$ , denoted as $\alpha$ -IoU. We further simplify $\alpha$ -IoU to $\mathcal { L } _ { \alpha - \mathrm { I o U } } = 1 - I o U ^ { \alpha }$ for $\alpha \nrightarrow 0$ and extend it to a more general form with an additional power regularization term (see equation (3)). This allows us to generalize existing IoU-based losses, including GIoU, DIoU, and CIoU, to a new family of power IoU losses (see equation (4)) for more accurate bbox regression as well as object detection.
|
| 19 |
+
|
| 20 |
+
We show that, relative to ${ \mathcal { L } } _ { \mathrm { I o U } }$ , ${ \mathcal { L } } _ { \alpha - { \mathrm { I o U } } }$ with $\alpha > 1$ up-weights both the loss and gradient of high IoU objects, leading to improved bbox regression accuracy. When $0 < \alpha < 1$ , it down-weights high IoU objects which we find hurts regression accuracy. The power parameter $\alpha$ can serve as a knob to adapt $\alpha$ -IoU losses to meeting different levels of bbox regression accuracy (precision measured under different IoU thresholds), with $\alpha > 1$ for high regression accuracy (i.e., high IoU thresholds) by focusing more on those high IoU objects. We also empirically show that $\alpha$ is not overly sensitive to different models or datasets, with $\alpha = 3$ performing consistently well in most cases. The family of $\alpha$ -IoU losses can be easily applied for improving state-of-the-art detectors under both clean and noisy bbox settings without introducing additional parameters to these models (making any modifications to training algorithms), nor increasing their training/inference time.
|
| 21 |
+
|
| 22 |
+
In summary, our main contributions are as follows:
|
| 23 |
+
|
| 24 |
+
• We propose a new family of power IoU losses called $\alpha$ -IoU for accurate bbox regression and object detection. $\alpha$ -IoU presents a unified power generalization of existing IoU-based losses.
|
| 25 |
+
• We analyze a set of properties of $\alpha$ -IoU, including order preservingness and loss/gradient reweighting, to show that a proper choice of $\alpha$ (i.e., $\alpha > 1$ ) can help improve bbox regression accuracy by adaptively up-weighting the loss and gradient of high IoU objects.
|
| 26 |
+
• We empirically show, on multiple benchmark object detection datasets and models, that $\alpha$ -IoU losses can consistently outperform existing IoU-based losses and provide more robustness for small datasets and noisy bboxes.
|
| 27 |
+
|
| 28 |
+
# 2 Related Work
|
| 29 |
+
|
| 30 |
+
Object Detection Models. There exist two mainstream types of detection models: anchor-based and anchor-free detectors. Anchor-based detectors can be further divided into two-stage and onestage models. Two-stage anchor-based detectors (e.g., R-CNN series [11, 31, 14, 3], HTC [5], and TSD [33]) are firstly proposed in object detection tasks, which are composed of region proposal networks (RPNs) and classifiers. RPNs generate a large number of foreground and background region proposals, followed by networks to classify objects in the proposals. Towards real-time object detection, one-stage anchor-based detectors (e.g., YOLO series [29, 30, 1], RetinaNet [21], and SSD [24]) are developed to predict bboxes and categories at the same time, thus no longer need RPNs. Anchor boxes with prior scales and aspect ratios should be defined before training anchor-based detectors. Techniques have been proposed to mitigate the sensitivity of these models to hand-picked anchor boxes, for example, attention-based fusion networks [31] and clustering algorithms [30]. These techniques learn prior anchors from the training set for every sliding window or grid cell.
|
| 31 |
+
|
| 32 |
+
Recently, anchor-free detectors such as CornerNet [16], CenterNet1 [8], ExtremeNet [45], and CentripetalNet [7], have also been proposed to get rid of anchor priors. These models first predict locations of keypoints (corners, centroids, or extreme points), then group them into the same bboxes if they are geometrically aligned. There also exist other models that generate pixel-wise results. For example, CenterNet2 estimates pixel-level categories of objects along with their sizes and offsets [44]. FCOS generates pixel-wise classification, centerness, and bbox (top, down, left, right) results using multi-head CNNs [34], followed by the Adaptive Training Sample Selection (ATSS) [40] as an improvement on automatically selecting positive and negative samples. In addition, transformers (e.g., DETR series [4, 46]) have also been developed for object detection without anchor generation or non-maximum suppression (NMS), achieving the performance on par with the above CNN-based detectors. In this work, we propose a new family of generalized IoU losses to improve the performance of these detectors without any architectural modifications, which is orthogonal to the above research.
|
| 33 |
+
|
| 34 |
+
Bounding Box Regression Losses. Anchor-based detectors regress offsets between ground-truth bboxes and their closest anchors, while anchor-free detectors predict keypoints of objects with some frameworks also generating the sizes of the bboxes. The predicted offsets or keypoints (w/ or w/o bbox sizes) are then mapped back to the pixel space for generating the bboxes. Localization losses usually compare the generated bboxes with their ground truth. Early works adopt $\ell _ { n }$ -norm losses [11] for bbox regression, which have been found sensitive to varying bbox scales. Recent works replace them with the IoU loss and its variants such as BIoU, GIoU, DIoU and CIoU for bbox regression, as IoU is the metric for localization and it is scale-invariant [28, 39]. The Bounded IoU (BIoU) loss maximizes the IoU overlap between the region of interest (RoI) and the ground truth based on a set of IoU upper bounds [35]. GIoU is proposed to address the problem of gradient vanishing on non-overlapping examples, which are examples having non-overlapping predicted bboxes with the ground truth (IoU is zero) [32]. DIoU and CIoU [43] losses further consider the overlapping area, central point distance, and aspect ratio in IoU and the regularization terms. These regularization terms can help improve the convergence speed as well as the final detection performance. There are also losses designed to focus more on high IoU objects, for example, the Rectified IoU (RIoU) loss [36], and the Focal and Efficient IoU (Focal-EIoU) loss [41]. These loss functions increase gradients of those examples that are in high bbox regression accuracy. However, RIoU and Focal-EIoU are neither concise nor generalized compared with other IoU-based losses. In this paper, we apply a power transformation to generalize the above vanilla IoU loss and regularized IoU-based losses for both their IoU and regularization terms. The new family of generalized losses improve bbox regression accuracy by adaptively reweighting the loss and gradient of high and low IoU objects.
|
| 35 |
+
|
| 36 |
+
There are also works on AutoML-based loss function search for computer vision tasks [23, 18, 17]. Despite their advantage in saving human efforts, these methods are very expensive in searching qualified loss functions (e.g., days of searching time on multiple GPUs), and probably with limited performance improvement based on existing losses [23]. We will empirically compare with one of these losses in our experiments.
|
| 37 |
+
|
| 38 |
+
# 3 $\alpha$ -IoU Losses for Bounding Box Regression
|
| 39 |
+
|
| 40 |
+
# 3.1 Preliminaries
|
| 41 |
+
|
| 42 |
+
We study the problem of bbox regression in object detection. Let $\pmb { X } \in \mathbb { R } ^ { d _ { x } }$ be the input space and $\pmb { Y } \in \mathbb { R } ^ { \tilde { d } _ { y } }$ be the annotation space, with $d _ { x }$ and $d _ { y }$ denoting the input and annotation dimensions, respectively. Given a dataset $D = \{ ( { \bf x } _ { i } , { \bf y } _ { i } ) \} _ { i = 1 } ^ { n }$ of $n$ training examples with each $( { \pmb x } _ { i } , { \pmb y } _ { i } ) \in$ $( X \times Y )$ , the task is to learn a function $f$ (represented by a detector network) that maps the input space to the annotation space $f : X \to Y$ . In object detection, each $\pmb { y } _ { i } = ( c _ { i , k } , B _ { i , k } ) _ { k = 1 } ^ { m _ { i } }$ , where $m _ { i }$ is the total number of objects in $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { i } }$ , $c _ { i , k }$ is the category of the $k ^ { t h }$ object in $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { i } }$ and $B _ { i , k }$ is its bbox.
|
| 43 |
+
|
| 44 |
+
The bbox regression performance is measured by the Intersection over Union (IoU) metric between the predicted bbox $B$ and the ground truth $B ^ { g t }$ $\ d ^ { 3 } \ d ^ { g t } \colon \bar { I o U } = | B \cap B ^ { g t } | / | B \cup B ^ { g t } |$ . Positive examples (both true and false positives) are determined from the set of predictions according to an IoU threshold, based on which the Average Precision (AP) over all categories of objects can be calculated. E.g., $\mathrm { { A P } _ { 5 0 } }$ measures the AP of objects localized by bboxes with an IoU that is above the threshold 0.5. The final performance of a detector is commonly evaluated by the mean Average Precision (mAP) across multiple IoU thresholds. For instance, the popular metric $\mathrm { m A P _ { 5 0 : 9 5 } }$ measures the mAP of examples across the set of IoU thresholds ranging from 0.5 to 0.95 with a stride of 0.05.
|
| 45 |
+
|
| 46 |
+
# 3.2 $\alpha$ -IoU Losses
|
| 47 |
+
|
| 48 |
+
The vanilla IoU loss is defined as $\mathcal { L } _ { \mathrm { I o U } } = 1 - I o U .$ . We first apply the Box-Cox transformation3 [2] and generalize the IoU loss to an $\alpha$ -IoU loss:
|
| 49 |
+
|
| 50 |
+
$$
|
| 51 |
+
\mathcal { L } _ { \alpha \cdot \mathrm { I o U } } = \frac { 1 - I o U ^ { \alpha } } { \alpha } , \alpha > 0 .
|
| 52 |
+
$$
|
| 53 |
+
|
| 54 |
+
By modulating the parameter $\alpha$ in $\alpha$ -IoU, one can derive most of the IoU terms in existing losses, e.g., $\log ( I o U )$ , $I o U$ and $I o U ^ { 2 }$ . When $\alpha 0$ , we obtain $\begin{array} { r } { \operatorname* { l i m } _ { \alpha \to 0 } \mathcal { L } _ { \alpha \mathrm { { \cdot } I o U } } = - \mathrm { l o g } ( I o U ) = \mathcal { L } _ { \mathrm { l o g } ( \mathrm { I o U } ) } } \end{array}$ [39] (see the proof in Appendix A). We recover the IoU loss with $\alpha = 1$ : $\mathcal { L } _ { \mathrm { 1 - I o U } } = 1 - I o U = \mathcal { L } _ { \mathrm { I o U } }$ And $\mathcal { L } _ { \mathrm { 2 - I o U } } = \textstyle { \frac { 1 } { 2 } } ( 1 - I o \dot { U } ^ { 2 } ) = \textstyle { \frac { 1 } { 2 } } \mathcal { L } _ { \mathrm { I o U } ^ { 2 } }$ , when $\alpha = 2$ . We can also extend the above $\alpha$ -IoU formula to loss functions with multiple IoU terms (e.g. RIoU [36]) by using multiple $\alpha$ values.
|
| 55 |
+
|
| 56 |
+

|
| 57 |
+
Figure 1: Correlation between IoU and $\mathcal { L } _ { \alpha \mathrm { { - I o U } } } ~ = ~ 1 - ~ I o U ^ { \alpha }$ (left) and its absolute gradient $| \nabla _ { \mathrm { I o U } } \mathcal { L } _ { \alpha - \mathrm { I o U } } |$ (right) with different $\alpha ~ \in ~ [ 0 . 5 , 3 ]$ . According to both plots, ${ \mathcal { L } } _ { \alpha - { \mathrm { I o U } } }$ reweights all objects adaptively and distinctively for $0 < \alpha < 1$ vs. $\alpha > 1$ $\langle \alpha = 1$ marks the IoU loss).
|
| 58 |
+
|
| 59 |
+
We simplify the above $\alpha$ -IoU formula for $\alpha > 0$ and $\alpha \nrightarrow 0$ , as in this case, the denominator $\alpha$ in equation (1) is just a positive constant in the objective. This gives us two cases of the $\alpha$ -IoU loss for $\alpha 0$ and $\alpha \not 0$ , respectively:
|
| 60 |
+
|
| 61 |
+
$$
|
| 62 |
+
\mathcal { L } _ { \alpha \mathrm { - I o U } } = \left\{ { { - \mathrm { l o g } ( I o U ) , ~ \alpha \to 0 } , } \atop { 1 - I o U ^ { \alpha } , ~ \alpha \to 0 . } \right.
|
| 63 |
+
$$
|
| 64 |
+
|
| 65 |
+
Here, we are more interested in the case $\alpha \nrightarrow 0$ as most state-of-the-art IoU-based losses have an $\alpha \geq 1$ . We then extend the above $\alpha$ -IoU loss for $\alpha \not 0$ to a more general form by introducing a power penalty/regularization term into the formula:
|
| 66 |
+
|
| 67 |
+
$$
|
| 68 |
+
{ \mathcal { L } } _ { \alpha - \mathrm { I o U } } = 1 - I o U ^ { \alpha _ { 1 } } + { \mathcal { P } } ^ { \alpha _ { 2 } } ( B , B ^ { g t } ) ,
|
| 69 |
+
$$
|
| 70 |
+
|
| 71 |
+
where $\alpha _ { 1 } > 0$ , $\alpha _ { 2 } > 0$ , and $\mathcal { P } ^ { \alpha _ { 2 } } ( B , B ^ { g t } )$ denotes any penalty term computed based on $B$ and $B ^ { g t }$ . This simple extension allows a straightforward generalization of existing IoU-based losses to their $\alpha$ -IoU versions. In Appendix B.2.1, we empirically show that ${ \mathcal { L } } _ { \alpha - { \mathrm { I o U } } }$ is not sensitive to $\alpha _ { 2 }$ . We thus maintain the power consistency between the IoU term and the penalty term and take $\alpha _ { 1 } = \alpha _ { 2 }$ as a simple choice when training the detectors.
|
| 72 |
+
|
| 73 |
+
With the above $\alpha$ -IoU formula, we can now generalize the commonly used IoU-based losses including $\mathcal { L } _ { \mathrm { I o U } } , \mathcal { L } _ { \mathrm { G I o U } } , \mathcal { L } _ { \mathrm { D I o U } }$ , and ${ \mathcal { L } } _ { \mathrm { C I o U } }$ using the same power parameter $\alpha$ for the IoU and penalty terms:
|
| 74 |
+
|
| 75 |
+
$$
|
| 76 |
+
\begin{array} { r l r } & { } & { \mathcal { L } _ { \mathrm { I o U } } = 1 - I o U \Longrightarrow \mathcal { L } _ { \alpha \mathrm { \cdot I o U } } = 1 - I o U ^ { \alpha } , } \\ & { } & { \mathcal { L } _ { \mathrm { G I o U } } = 1 - I o U + \frac { \left| C \setminus ( B \cup B ^ { g t } ) \right| } { \left| C \right| } \Longrightarrow \mathcal { L } _ { \alpha \mathrm { \cdot G I o U } } = 1 - I o U ^ { \alpha } + ( \frac { \left| C \setminus ( B \cup B ^ { g t } ) \right| } { \left| C \right| } ) ^ { \alpha } , } \\ & { } & { \mathcal { L } _ { \mathrm { D I o U } } = 1 - I o U + \frac { \rho ^ { 2 } ( b , b ^ { g t } ) } { c ^ { 2 } } \Longrightarrow \mathcal { L } _ { \alpha \mathrm { \cdot D I o U } } = 1 - I o U ^ { \alpha } + \frac { \rho ^ { 2 \alpha } ( b , b ^ { g t } ) } { c ^ { 2 \alpha } } , \ ~ } \\ & { } & { \mathcal { L } _ { \mathrm { C I o U } } = 1 - I o U + \frac { \rho ^ { 2 } ( b , b ^ { g t } ) } { c ^ { 2 } } + \beta v \Longrightarrow \mathcal { L } _ { \alpha \mathrm { \cdot C I o U } } = 1 - I o U ^ { \alpha } + \frac { \rho ^ { 2 \alpha } ( b , b ^ { g t } ) } { c ^ { 2 \alpha } } + ( \beta v ) ^ { \alpha } , } \end{array}
|
| 77 |
+
$$
|
| 78 |
+
|
| 79 |
+
where $C$ in ${ \mathcal { L } } _ { \mathrm { G I o U } }$ denotes the smallest convex shape enclosing $B$ and $B ^ { g t }$ ; $^ { b }$ and $\mathbf { \delta } _ { b } \mathbf { \mathcal { I } ^ { t } }$ in ${ \mathcal { L } } _ { \mathrm { D I o U } }$ denote central points of $B$ and $B ^ { g t }$ with $\rho ( \cdot )$ being the Euclidean distance and $c$ being the diagonal length of the smallest enclosing box; and in ${ \mathcal { L } } _ { \mathrm { C I o U } }$ , $\begin{array} { r } { v = \frac { 4 } { \pi ^ { 2 } } ( a r c t a n \frac { w ^ { g t } } { h ^ { g t } } - a r c t a n \frac { w } { h } ) ^ { 2 } } \end{array}$ , $\begin{array} { r } { \beta = \frac { v } { ( 1 - I o U ) + v } } \end{array}$ . They give us the family of power IoU losses for bbox regression with their original versions recovered at $\alpha = 1$ . Note that the above $\alpha$ -IoU generalization can be easily extended to more complex loss functions that have multiple IoU or penalty terms (e.g., $\mathcal { L } _ { \alpha - \mathrm { C I o U } } )$ ). Next, we will analyze the properties of $\alpha$ -IoU losses when $\alpha$ takes different values.
|
| 80 |
+
|
| 81 |
+
# 3.3 Properties of $\alpha$ -IoU Losses
|
| 82 |
+
|
| 83 |
+
Here, we focus on the vanilla $\alpha$ -IoU formula $\mathcal { L } _ { \alpha - \mathrm { I o U } } = 1 - I o U ^ { \alpha }$ to analyze its properties, as the penalty terms may affect these properties differently. Figure 1 illustrates the correlation between IoU and ${ \mathcal { L } } _ { \alpha - { \mathrm { I o U } } }$ (left) and the magnitude of its gradient w.r.t. IoU, i.e., $| \nabla _ { \mathrm { I o U } } \mathcal { L } _ { \alpha - \mathrm { I o U } } |$ (right). One key observation is that the IoU loss (i.e., $\alpha = 1$ ) has a linear correlation with IoU and the gradient is a constant, while ${ \mathcal { L } } _ { \alpha - { \mathrm { I o U } } }$ reweights objects adaptively (according to their IoU values) following different reweighting schemes with $0 < \alpha < 1$ versus $\alpha > 1$ .
|
| 84 |
+
|
| 85 |
+
The power transformation in ${ \mathcal { L } } _ { \alpha - { \mathrm { I o U } } }$ preserves key properties of ${ \mathcal { L } } _ { \mathrm { I o U } }$ as a performance metric, including non-negativity, identity of indiscernibles, symmetry, and triangle inequality [32]. Furthermore, we analyze the following important properties of ${ \mathcal { L } } _ { \alpha - { \mathrm { I o U } } }$ with detailed derivations deferred to Appendix A. We first let $B _ { i }$ and $B _ { j }$ be two predicted bboxes by two different models $M _ { i }$ and $M _ { j }$ respectively, and $B _ { i }$ and $B _ { j }$ correspond to the same ground truth $B ^ { g t }$ with $I o U ( B _ { i } , B ^ { g t } ) < I o U ( \bar { B _ { j } } , B ^ { g t } )$ . Then we have the first property of ${ \mathcal { L } } _ { \alpha }$ -IoU:
|
| 86 |
+
|
| 87 |
+
Property 1 (Order Preservingness). ${ \mathcal { L } } _ { \alpha }$ -IoU preserves the orders of both IoU and $\mathcal { L } _ { I o U }$ : I ${ } ^ { \circ } o \bar { U } ( B _ { i } , B ^ { g t } ) \ < I o U ( B _ { j } , B ^ { g t } ) ^ { - } \iff \ \mathcal { L } _ { I o U } ( B _ { i } , B ^ { g t } ) > \ \mathcal { L } _ { I o U } ( B _ { j } , B ^ { g t } ) \iff \ \mathcal { L } _ { \alpha \cdot I o U } ( B _ { i } , B ^ { g t } ) >$ $\mathcal { L } _ { \alpha - I o U } ( B _ { j } , B ^ { g t } )$ .
|
| 88 |
+
|
| 89 |
+
The above property indicates that both ${ \mathcal { L } } _ { \alpha - { \mathrm { I o U } } }$ and ${ \mathcal { L } } _ { \mathrm { I o U } }$ are monotonically decreasing functions w.r.t. $I o U$ . As ${ \mathcal { L } } _ { \alpha - { \mathrm { I o U } } }$ preserves the order of ${ \mathcal { L } } _ { \mathrm { I o U } }$ strictly, it is guaranteed that arg $\mathrm { m i n } _ { B } \mathcal { L } _ { \alpha \mathrm { - I o U } } ( B , B ^ { g t } )$ is identical to arg $\operatorname* { m a x } _ { B } I o U ( B , B ^ { g t } )$ and arg $\mathrm { m i n } _ { B } \bar { \mathcal { L } } _ { \mathrm { I o U } } ( \bar { B , B ^ { g t } } )$ . In other words, the optimal solution arg $\operatorname* { m a x } _ { B } I o U ( B , \bar { B ^ { g t } } )$ can be obtained by minimizing either ${ \mathcal { L } } _ { \alpha - { \mathrm { I o U } } }$ or ${ \mathcal { L } } _ { \mathrm { I o U } }$ . Following this, the adaptive relative loss reweighting scheme of ${ \mathcal { L } } _ { \alpha - { \mathrm { I o U } } }$ can be characterized by the second property:
|
| 90 |
+
|
| 91 |
+
Property 2 (Relative Loss Reweighting). Compared with $\mathcal { L } _ { I o U }$ , $\mathcal { L } _ { \alpha - I o U }$ adaptively reweights the relative loss of all objects by $w _ { \mathcal { L } _ { r } } = \mathcal { L } _ { \alpha \cdot I o U } / \mathcal { L } _ { I o U } = 1 + ( I o U - I o U ^ { \alpha } ) / ( 1 - I o U )$ , with $w _ { \mathscr { L } _ { r } } ( I o U =$ $0 ) = 1$ , and $\begin{array} { r } { \operatorname* { l i m } _ { I o U \to 1 } w _ { \mathcal { L } _ { r } } = \alpha } \end{array}$ .
|
| 92 |
+
|
| 93 |
+
The second property indicates that ${ \mathcal { L } } _ { \alpha - { \mathrm { I o U } } }$ will adaptively down-weight and up-weight the relative loss of all objects according to their IoUs when $0 < \alpha < 1$ and $\alpha > 1$ , respectively. We further note that, when $\alpha > 1$ , the reweighting factor $w _ { \mathcal { L } _ { r } }$ increases monotonically with the increase of IoU $( w _ { \boldsymbol { L } _ { r } }$ grows from 1 to $\alpha$ ) while decreasing monotonically with the increase of IoU when $0 < \alpha < 1 ( w _ { \mathcal { L } _ { r } }$ decays from 1 to $\alpha$ ). We will empirically show that the up-weighting scheme of ${ \mathcal { L } } _ { \alpha - { \mathrm { I o U } } }$ with $\alpha > 1$ can help the model focus more on high IoU objects to improve both the localization (i.e., predict more high IoU objects) and detection (i.e., more accurate at high APs) performance4. Similarly, we can obtain the third property of adaptive relative gradient reweighting owned by ${ \mathcal { L } } _ { \alpha - { \mathrm { I o U } } }$ as follows:
|
| 94 |
+
|
| 95 |
+
Property 3 (Relative Gradient Reweighting). Compared with $\mathcal { L } _ { I o U ; }$ , $\mathcal { L } _ { \alpha - I o U }$ adaptively reweights the relative gradient of all objects by $\begin{array} { r } { w _ { \bar { \nabla } _ { r } } = \bar { | } \nabla _ { I o U } \mathcal { L } _ { \alpha - I o U } | / | \nabla _ { I o U } \mathcal { L } _ { I o U } | = \alpha I o U ^ { \bar { \alpha } - 1 } } \end{array}$ , with the turning point at $I o U = \alpha ^ { \frac { 1 } { 1 - \alpha } } \in ( 0 , \frac { 1 } { e } )$ when $0 < \alpha < 1$ and $I o U = \alpha ^ { \frac { 1 } { 1 - \alpha } } \in ( \textstyle { \frac { 1 } { e } } , 1 )$ when $\alpha > 1$ .
|
| 96 |
+
|
| 97 |
+
When $\alpha > 1$ , the above reweighting factor $w _ { \nabla _ { r } }$ increases monotonically with the increase of IoU, while decreasing monotonically with the increase of IoU when $0 \textless \alpha \textless 1$ . This relative gradient reweighting scheme is also adaptive to IoU, with the turning point from up-weighting to down-weighting at $\overline { { I o U } } = \alpha ^ { \frac { 1 } { 1 - \alpha } } \in ( 0 , \frac { 1 } { e } )$ when $0 \textless \alpha \textless 1$ , and from down-weighting to upweighting at $I o U = \alpha ^ { \frac { 1 } { 1 - \alpha } } \in ( \frac { 1 } { e } , 1 )$ when $\alpha > 1$ . The gradient reweighting scheme is bounded by $w _ { \nabla _ { r } } ( I o U = 1 ) = \alpha$ , i.e., $0 \leq w _ { \nabla _ { r } } \leq \alpha$ when $\alpha > 1$ , and $w _ { \nabla _ { r } } \geq \alpha$ when $0 < \alpha < 1$ . This relative gradient reweighting scheme allows the model to learn objects with adaptive speeds (i.e., different gradients) according to their IoUs. Theoretically, when $\alpha = 2$ , $| \nabla _ { \mathrm { I o U } } \mathcal { L } _ { \alpha - \mathrm { I o U } } | > | \overline { { \nabla } } _ { \mathrm { I o U } } \mathcal { L } _ { \mathrm { I o U } } |$ for $I o U \in ( 0 . 5 , 1 ]$ , which accelerates the learning of all positive IoU objects at $\mathrm { { A P } _ { 5 0 } }$ . However, we empirically show that $\alpha$ -IoU losses with $\alpha = 3$ perform more competitively than those with $\alpha = 2$ in most cases. It is probable that $\alpha \cdot$ -IoU losses with $\alpha = 3$ further up-weight the relative loss of objects with $I o U \in ( 0 . 5 , 1 ]$ , although $\alpha$ -IoU losses with $\alpha = 2$ also beat existing baselines (see Figure 6). This property is both data-agnostic and model-agnostic, so we recommend $\alpha = 3$ or $\alpha \in [ 2 , 3 ]$ in practical use for other datasets and models.
|
| 98 |
+
|
| 99 |
+
The above loss and gradient reweighting schemes can also be inferred from Figure 1, with detailed proofs in Appendix A. To summarize, ${ \mathcal { L } } _ { \alpha - { \mathrm { I o U } } }$ trains better detectors than ${ \mathcal { L } } _ { \mathrm { I o U } }$ for the following reasons. First, the same optimal IoU can be achieved by ${ \mathcal { L } } _ { \alpha - { \mathrm { I o U } } }$ as that by ${ \mathcal { L } } _ { \mathrm { I o U } }$ (Property 1). Second, ${ \mathcal { L } } _ { \alpha - { \mathrm { I o U } } }$ with $\alpha > 1$ focuses more on high IoU objects by up-weighting their relative loss (Property
|
| 100 |
+
|
| 101 |
+
2). Third, ${ \mathcal { L } } _ { \alpha - { \mathrm { I o U } } }$ with $\alpha > 1$ helps detectors learn faster on high IoU objects (here $I o U \in ( \alpha ^ { \frac { 1 } { 1 - \alpha } } , 1 ] )$ through up-weighting their relative gradient (Property 3). In Appendix A, we also provide an analysis of the absolute loss and gradient reweighting properties (Property 4 and 5), showing the additions of $\alpha$ -IoU to IoU. Specifically, when $\alpha > 1$ , ${ \mathcal { L } } _ { \alpha - { \mathrm { I o U } } }$ adds an absolute loss weight to ${ \mathcal { L } } _ { \mathrm { I o U } }$ (i.e., $w _ { \mathscr { L } _ { a } } = \mathscr { L } _ { \alpha \mathrm { - I o U } } - \mathscr { L } _ { \mathrm { I o U } } = I o U - I o U ^ { \alpha } > 0$ for $I o U \in ( 0 , 1 ) )$ , which creates more space for optimization on all levels of objects (Property 4). Likewise, ${ \mathcal { L } } _ { \alpha - { \mathrm { I o U } } }$ puts an absolute gradient weight for high IoU objects (i.e., $\bar { w } _ { \nabla _ { a } } = | \bar { \nabla } _ { \mathrm { I o U } } \mathcal { L } _ { \alpha \mathrm { - I o U } } | - | \nabla _ { \mathrm { I o U } } \mathcal { L } _ { \mathrm { I o U } } | = \alpha I o U ^ { \alpha - 1 } - 1 \bar { > } 0$ for $I o U \in ( \alpha ^ { \frac { 1 } { 1 - \alpha } } , 1 ] )$ such that the learning of high IoU objects is accelerated (Property 5). Both of the absolute and relative properties of ${ \mathcal { L } } _ { \alpha - { \mathrm { I o U } } }$ are adaptive to the IoU values of the objects. Such reweighting schemes will provide more flexibility in achieving different levels of bbox regression accuracies (AP measured under different IoU thresholds).
|
| 102 |
+
|
| 103 |
+
Learning Dynamics of ${ \mathcal { L } } _ { \alpha \mathbf { - } \mathbf { I 0 } \mathbf { U } }$ . Training with ${ \mathcal { L } } _ { \alpha - { \mathrm { I o U } } }$ is a dynamic process and should be interpreted based on both the absolute and relative properties. With $\alpha > 1$ , easy examples will be learned first with increasing speed towards $I o U = 1$ , while hard examples will be learned gradually and accelerated later on as their IoU improves. We will empirically show in Figure 3 that up-weighting the loss and gradient of high IoU objects can boost the training at the later stage. As a comparison, we will also show that $\alpha$ -IoU losses with $0 < \alpha < 1$ tend to degrade the final performance in Section 4.4. Reducing the loss and gradient of high IoU objects ends up with more poorly localized objects.
|
| 104 |
+
|
| 105 |
+
# 4 Experiments
|
| 106 |
+
|
| 107 |
+
# 4.1 Datasets and Training Setup
|
| 108 |
+
|
| 109 |
+
We conduct all experiments on two popular benchmarks, i.e., PASCAL VOC [9] and MS COCO [22]. On the PASCAL VOC benchmark, we train all models on the trainval set $2 0 0 7 + 2 0 1 2$ (containing 16, 551 images from 20 categories) and evaluate them on the test set 2007 (containing 4, 952 images) [9]. On the MS COCO benchmark, we train all models on the training set 2017 (containing 118K images from 80 categories) and evaluate them on the val set 2017 (containing 5K images) [22]. We train all state-of-the-art models with the original implementation released by the authors. Specifically, we follow the original implementation’s training protocol with default parameters and the number of training epochs with different losses [31, 32, 43, 4]. Implementation details of all models are given in Appendix B.1. All experiments are run with NVIDIA V100 GPUs. Code is available at https://github.com/Jacobi93/Alpha-IoU.
|
| 110 |
+
|
| 111 |
+
# 4.2 Results and Analysis
|
| 112 |
+
|
| 113 |
+
We first validate the effectiveness of $\alpha$ -IoU losses in training both anchor-based and anchor-free models on the two datasets. We choose YOLOv5s (i.e., YOLOv5 small) and YOLOv5x (i.e., YOLOv5 extra large) as one-stage anchor-based models, and DETR (ResNet-50) as an anchor-free model. Both $\alpha$ -IoU losses (i.e., ${ \mathcal { L } } _ { \alpha - { \mathrm { I o U } } }$ and $\mathcal { L } _ { \alpha - \mathrm { D I o U } } )$ are generalized from existing baselines following equation (4). From Table 1, we can observe that $\alpha$ -IoU losses surpass existing losses consistently across multiple models and datasets in terms of both mAP and $\mathrm { m A P _ { 7 5 : 9 5 } }$ , especially at the high bbox regression accuracy $\mathrm { m A P _ { 7 5 : 9 5 } }$ . The superiority of $\alpha$ -IoU losses is more pronounced at high accuracy levels, which might reach more than $6 0 \%$ relative improvement at $\mathsf { A P } _ { 9 5 }$ . Interestingly, $\alpha$ -IoU losses tend to help more of light models (e.g., YOLOv5s with 7.3M parameters and 17 GFLOPs) than heavy models (e.g., YOLOv5x with $8 7 . 7 \mathbf { M }$ parameters and 218.8 GFLOPs). This indicates that $\alpha$ -IoU losses hold more advantage while training light models in computing-resource-limited scenarios, such as mobile devices, autonomous vehicles, and robots.
|
| 114 |
+
|
| 115 |
+
The consistent improvements on both PASCAL VOC and MS COCO demonstrate the stability of $\alpha$ -IoU losses across different datasets. In addition, we also verify its robustness to extremely small training sets in Appendix B.2.2, where $\alpha$ -IoU losses beat existing losses at various scales, i.e., from 4K $2 5 \%$ trainval set of PASCAL VOC $2 0 0 7 { + } 2 0 1 2 ,$ ) to 118K (the entire training set of MS COCO 2017) samples. It is possible that $\alpha$ -IoU losses may not perform well if measured by a single low AP metric. For example, there may be less than $0 . 5 \%$ performance drop at $\mathrm { { A P } _ { 5 0 } }$ when $\alpha = 3$ , however, this is compensated by the significant boost at high APs. With some examples from the test set of PASCAL VOC 2007 (Figure 4) and the val set of MS COCO 2017 (Figure 5), we show that $\alpha$ -IoU losses are able to localize objects more accurately than the baselines with more true positives and fewer false positives.
|
| 116 |
+
|
| 117 |
+
Table 1: The performance of YOLOv5s, YOLOv5x and DETR models trained using different localization losses on PASCAL VOC and MS COCO benchmarks. Results are obtained on the test set of PASCAL VOC 2007 and the val set of MS COCO 2017. mAP denotes $\mathrm { m A P _ { 5 0 : 9 5 } }$ ; $\mathrm { m A P _ { 7 5 : 9 5 } }$ denotes the mean AP over $\mathsf { A P } _ { 7 5 }$ , $\mathbf { A P } _ { 8 0 } , \cdot \cdot \cdot , \mathbf { A P } _ { 9 5 }$ . "rela. improv." stands for the relative improvement. $\alpha = 3$ is used for all $\alpha$ -IoU losses in all experiments.
|
| 118 |
+
|
| 119 |
+
<table><tr><td rowspan="2">Method</td><td rowspan="2">Loss</td><td rowspan="2"></td><td colspan="5">PASCAL VOC</td><td colspan="2"></td><td colspan="5">MS COCO</td></tr><tr><td>AP50</td><td>AP75</td><td>AP85 AP95</td><td></td><td>mAP</td><td>mAP75:95l</td><td>AP50</td><td>AP75</td><td>AP85</td><td>AP95</td><td>mAP</td><td>mAP75:95</td></tr><tr><td rowspan="5">YOLOv5s</td><td rowspan="5">LIoU Lα-loU rela. improv.</td><td>78.81 78.62</td><td>58.04 58.78</td><td>35.07 38.16</td><td>2.34 3.64</td><td>52.74 53.61</td><td>32.45 34.46</td><td>55.51</td><td>38.59</td><td>23.58</td><td></td><td>2.07</td><td>36.29</td><td>21.82</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>55.25</td><td>39.69</td><td>25.85</td><td>3.35</td><td>37.01</td><td>23.66</td></tr><tr><td></td><td>-0.24%</td><td>1.27%</td><td>8.81%</td><td>55.56%</td><td>1.65%</td><td>6.21%</td><td>-0.47%</td><td>2.85%</td><td>9.63%</td><td>61.84%</td><td>1.98%</td><td>8.43%</td></tr><tr><td>LDIoU</td><td>78.19</td><td>57.77</td><td>34.89</td><td>2.36</td><td>52.30</td><td>32.17</td><td>55.67</td><td>39.01</td><td>23.56</td><td>2.03</td><td>36.36</td><td>21.95</td></tr><tr><td>Lα-DIoU rela. improv.</td><td>78.33 0.18%</td><td>59.24 38.46</td><td>3.50</td><td></td><td>53.76</td><td>34.66</td><td>55.84</td><td>39.49</td><td>25.49</td><td>3.30</td><td>36.74</td><td>23.34</td></tr><tr><td rowspan="6">YOLOv5x</td><td colspan="10">LIoU</td><td rowspan="6">8.19%</td><td colspan="10">62.56%</td></tr><tr><td></td><td>85.24</td><td>2.54%</td><td>10.23%</td><td>48.31%</td><td>2.79% 63.95</td><td>7.72%</td><td></td><td>0.31%</td><td>1.23%</td><td></td><td></td><td>1.05%</td><td>6.32%</td></tr><tr><td>Lα-IoU</td><td>84.83</td><td>70.08 70.20</td><td>53.08 53.75</td><td>10.88 13.74</td><td>64.25</td><td>46.78 48.06</td><td></td><td>67.36 67.72</td><td>52.15 52.61</td><td>38.22 38.62</td><td>9.31 9.76</td><td>48.42 48.67</td><td>34.42 34.72</td></tr><tr><td>rela. improv.</td><td>-0.48%</td><td>0.17%</td><td>1.26%</td><td>26.29%</td><td>0.47%</td><td></td><td>2.73%</td><td>0.53%</td><td>0.88%</td><td>1.05%</td><td>4.83%</td><td>0.52%</td><td>0.87%</td></tr><tr><td>LDIoU</td><td>85.04</td><td>71.05</td><td>53.71</td><td>11.11</td><td>64.21</td><td>47.30</td><td></td><td>67.54</td><td>52.03</td><td>38.02</td><td>8.58</td><td>48.38</td><td>34.16</td></tr><tr><td>La-DloU rela.improv.</td><td>84.90</td><td>71.34</td><td>54.23</td><td>13.85</td><td>64.49</td><td>48.40</td><td></td><td></td><td>52.65</td><td>39.28</td><td>10.29</td><td>48.81</td><td>35.42</td></tr><tr><td rowspan="8">DETR</td><td rowspan="8">LIoU</td><td>-0.16%</td><td>0.41%</td><td>0.97%</td><td></td><td>24.66%</td><td>0.44%</td><td>2.32%</td><td>67.42 -0.18%</td><td>1.19%</td><td>3.31%</td><td></td><td>19.93%</td><td>0.89%</td><td>3.68%</td></tr><tr><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></td><td>76.50</td><td>53.85</td><td>29.54</td><td>1.62</td><td>49.78</td><td>28.82</td><td>59.38</td><td>41.67</td><td>26.13</td><td></td><td>3.52</td><td>39.23</td><td>24.37</td></tr><tr><td>La-loU rela.improv.</td><td>76.22 -0.37%</td><td>55.03 2.19%</td><td>32.30 9.34%</td><td>2.28 40.74%</td><td>51.12 2.69%</td><td>31.08 7.84%</td><td>59.61 0.39%</td><td>42.65 2.35%</td><td>28.57 9.34%</td><td></td><td>5.09 44.60%</td><td>40.18 2.42%</td><td>26.44 8.49%</td></tr><tr><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>LDIoU</td><td>76.26 76.44</td><td>54.09</td><td>29.23</td><td>1.56</td><td>49.91</td><td>28.68</td><td></td><td>59.28</td><td>41.62</td><td>26.09</td><td>3.54</td><td>39.25</td><td>24.48</td></tr><tr><td>La-DloU rela. improv.</td><td>0.24%</td><td>54.89 1.48%</td><td>31.48 7.70%</td><td>2.44</td><td>50.96 2.10%</td><td>30.60 6.69%</td><td>59.38</td><td>42.34 1.73%</td><td></td><td>28.23</td><td>5.36</td><td>39.94 1.76%</td><td>26.05</td></tr><tr><td></td><td></td><td></td><td></td><td>56.41%</td><td></td><td></td><td>0.17%</td><td></td><td></td><td>8.20%</td><td>51.41%</td><td></td><td>6.41%</td></tr></table>
|
| 120 |
+
|
| 121 |
+

|
| 122 |
+
Figure 2: IoU distributions between predicted bboxes and their ground truth after NMS.
|
| 123 |
+
|
| 124 |
+

|
| 125 |
+
Figure 3: Validation mAPs $( \mathrm { m A P _ { 5 0 : 9 5 } } )$ across 300 training epochs.
|
| 126 |
+
|
| 127 |
+
We further analyze the bbox regression accuracy by showing the IoU distributions between the predicted bboxes and their ground truth for YOLOv5s trained using different losses on PASCAL VOC. After NMS with the IoU threshold being 0.5, we visualize the number of positively predicted bboxes under different IoU thresholds from 0.5 to 0.9 in Figure 2, showing that $\alpha$ -IoU losses detect more positive objects than baseline losses across all IoU thresholds. Particularly, $\alpha$ -IoU losses detect approximately $1 \%$ more positive objects than the baselines when $I o U \ge 0 . 5$ , and $1 1 \%$ more high IoU objects when $I o U \ge 0 . 9$ . This demonstrates that $\alpha$ -IoU boosts both the precisions and recalls of detectors. $\alpha$ -IoU is extremely advantageous in pushing low IoU objects to high IoU objects by up-weighting their loss, thus outperforming baseline losses significantly at the high accuracy level and contributing to the improvement of the final detection performance (Table 1).
|
| 128 |
+
|
| 129 |
+
Moreover, Figure 3 shows that $\alpha$ -IoU losses are able to boost the late training stage (e.g., after 200 epochs) through up-weighting the gradient of high IoU objects, while almost having no negative impact on the early training stage (e.g., the first 100 epochs). When $\alpha > 1$ , the relative gradient weight is $0 \leq w _ { \nabla _ { r } } < 1$ for $0 \leq I o U < \alpha ^ { \frac { 1 } { 1 - \alpha } }$ , while $1 \leq w _ { \nabla _ { r } } \leq \alpha$ for $\alpha ^ { \frac { 1 } { 1 - \alpha } } \leq \hat { I o U } \leq 1$ , as analyzed in Property 3 and illustrated in Figure 1 (right). This property helps tune down the gradients of low IoU objects at the early training stage, which has a smoothing effect (reduces the high variance in parameter update caused by hard examples) that helps stabilize the model training when gradients are large at the early stage. On the other hand, the gradient up-weighting is well-bounded by $w _ { \nabla _ { r } } \leq \alpha$ , which makes up-weighting relatively safe for high IoU objects, as the original loss and gradient are small for these examples, so is the learning rate.
|
| 130 |
+
|
| 131 |
+

|
| 132 |
+
Figure 4: Example results on the test set of PASCAL VOC 2007 using YOLOv5s trained by ${ \mathcal { L } } _ { \mathrm { I o U } }$ (top row) and ${ \mathcal { L } } _ { \alpha - { \mathrm { I o U } } }$ with $\alpha = 3$ (bottom row). ${ \mathcal { L } } _ { \alpha - { \mathrm { I o U } } }$ performs better than ${ \mathcal { L } } _ { \mathrm { I o U } }$ because it can localize objects more accurately (image 1 and 2), thus can detect more true positive objects (image 3 to 5) and fewer false positive objects (image 6 and 7).
|
| 133 |
+
|
| 134 |
+

|
| 135 |
+
Figure 5: Example results on the val set of MS COCO 2017 using YOLOv5s trained by ${ \mathcal { L } } _ { \mathrm { I o U } }$ (top row) and ${ \mathcal { L } } _ { \alpha - { \mathrm { I o U } } }$ with $\alpha = 3$ (bottom row). ${ \mathcal { L } } _ { \alpha }$ -IoU performs better than ${ \mathcal { L } } _ { \mathrm { I o U } }$ because it can localize objects more accurately (image 1), thus can detect more true positive objects (image 2 to 5) and fewer false positive objects (image 4 to 7). Note that ${ \mathcal { L } } _ { \alpha - { \mathrm { I o U } } }$ detects both more true positive and fewer false positive objects in image 4 and 5 than ${ \mathcal { L } } _ { \mathrm { I o U } }$ .
|
| 136 |
+
|
| 137 |
+
We also conduct an experiment to compare our $\alpha$ -IoU with a set of existing IoU-based losses in training a popular two-stage anchor-based model, Faster R-CNN (ResNet-50-FPN). In Table 2, results at the top are reproduced using the MMDetection toolbox [6] while those in the middle are reported results in the original papers [43, 41, 23]. Results at the bottom are obtained by replacing existing losses with their $\alpha$ -IoU versions (i.e., improve based on top results using MMDetection). The results on MS COCO demonstrate that $\alpha$ -IoU losses are quite competitive compared with existing baselines in terms of both mAP and $\mathrm { m A P _ { 7 5 : 9 5 } }$ . Note that the Autoloss searches both the classification loss and the localization loss, thus taking a huge amount of searching time [23]. In contrast, $\alpha$ -IoU losses only need an easy modification of the localization loss and win the Autoloss without causing any additional computational overhead.
|
| 138 |
+
|
| 139 |
+
# 4.3 Robustness to Noisy Bounding Boxes
|
| 140 |
+
|
| 141 |
+
It happens quite often that people annotate inaccurate bboxes in images/videos as the ground truth, even with computer-assisted annotation tools. However, there is little work on the robustness of localization losses to noisy bboxes, even though a number of methods have been proposed for robust learning with noisy labels, anchors, and bboxes [27, 26, 12, 10, 15, 37, 38, 25, 19, 20]. Here, we fill this gap by conducting a set of experiments to evaluate the robustness of different localization losses to noisy bboxes. We show that $\alpha$ -IoU is more robust to noisy bboxes as they focus less on the low IoU objects, creating a suppression effect on the learning of the noisy bbox examples. Considering that open datasets like PASCAL VOC and MS COCO are carefully annotated, we synthesize a set of common noisy bboxes by perturbing normalized bboxes in the entire training set. The perturbations follow a uniform noise distribution in $[ - \eta w , \eta w ]$ at horizontal coordinates $\scriptstyle { \dot { x } }$ and $w$ ) and $[ - \eta h , \eta h ]$ at vertical coordinates $y$ and $h$ ), where $\eta$ is the noise rate [20]. We then constrain all the noisy bboxes by the following boundary conditions:
|
| 142 |
+
|
| 143 |
+
$$
|
| 144 |
+
0 < w < 1 , ~ 0 < h < 1 , ~ \frac { 1 } { 2 } w \leq x \leq 1 - \frac { 1 } { 2 } w , ~ \frac { 1 } { 2 } h \leq y \leq 1 - \frac { 1 } { 2 } h .
|
| 145 |
+
$$
|
| 146 |
+
|
| 147 |
+
Table 2: The performance of Faster R-CNN (ResNet-50-FPN) with $1 \times$ schedule and single scale training on MS COCO using different localization losses. Results are obtained on the val set of MS COCO 2017. mAP denotes $\mathrm { m A P _ { 5 0 : 9 5 } }$ ; $\mathrm { m A P _ { 7 5 : 9 5 } }$ denotes the mean AP over $\mathsf { A P } _ { 7 5 }$ , $\mathbf { A P } _ { 8 0 } , \cdot \cdot \cdot , \mathbf { A P } _ { 9 5 }$ . $\mathsf { A P } _ { s }$ , $\mathsf { A P } _ { m }$ , and $\mathsf { A P } _ { l }$ denote the AP for small, medium, and large objects, respectively. † marks the reproduced results from the MMDetection toolbox [6], while ∗ marks the results in the original papers. "–" represents the missing results in papers. $\alpha = 3$ is used for all $\alpha$ -IoU losses in all experiments. The top two best results in every column are boldfaced.
|
| 148 |
+
|
| 149 |
+
<table><tr><td>Loss</td><td>AP50</td><td>AP75</td><td>AP80</td><td>AP85</td><td>AP90</td><td>AP95</td><td>mAP</td><td>mAP75:95|</td><td>APs</td><td>APm</td><td>APt</td></tr><tr><td>+e1</td><td>58.13</td><td>40.45</td><td>33.56</td><td>23.39</td><td>11.09</td><td>1.24</td><td>37.37</td><td>21.95</td><td>21.20</td><td>40.96</td><td>48.13</td></tr><tr><td>LIoU</td><td>58.12</td><td>41.23</td><td>34.03</td><td>24.43</td><td>12.42</td><td>1.61</td><td>37.88</td><td>22.74</td><td>21.61</td><td>41.63</td><td>49.11</td></tr><tr><td>LGIoU</td><td>58.18</td><td>41.00</td><td>33.52</td><td>24.13</td><td>11.97</td><td>1.51</td><td>37.62</td><td>22.43</td><td>21.49</td><td>41.07</td><td>48.90</td></tr><tr><td>+LBIoU</td><td>58.05</td><td>40.57</td><td>33.54</td><td>23.85</td><td>11.10</td><td>1.19</td><td>37.43</td><td>22.05</td><td>21.57</td><td>41.00</td><td>48.17</td></tr><tr><td>*LIoU</td><td>/</td><td>40.79</td><td>/</td><td></td><td>1</td><td>1</td><td>37.93</td><td></td><td>21.58</td><td>40.82</td><td>50.14</td></tr><tr><td>*LGIoU</td><td>1</td><td>41.11</td><td></td><td></td><td>1</td><td></td><td>38.02</td><td></td><td>21.45</td><td>41.06</td><td>50.21</td></tr><tr><td>*LDIoU</td><td>1</td><td>41.11</td><td></td><td></td><td>1</td><td>1</td><td>38.09</td><td>1</td><td>21.66</td><td>41.18</td><td>50.32</td></tr><tr><td>*LCIoU</td><td>1</td><td>41.96</td><td></td><td></td><td></td><td></td><td>38.65</td><td></td><td>21.32</td><td>41.83</td><td>51.51</td></tr><tr><td>*LFocal-EIoU</td><td>59.10</td><td>42.40</td><td></td><td></td><td></td><td></td><td>38.90</td><td></td><td>21.20</td><td>41.10</td><td>50.20</td></tr><tr><td>*Autoloss</td><td>58.60</td><td>41.80</td><td>1</td><td>一</td><td>1</td><td>1</td><td>38.50</td><td>1</td><td>22.00</td><td>42.20</td><td>50.20</td></tr><tr><td>Lα-IoU</td><td>58.81</td><td>41.94</td><td>34.81</td><td>25.36</td><td>13.27</td><td>1.81</td><td>38.96</td><td>23.44</td><td>22.14</td><td>42.11</td><td>50.36</td></tr><tr><td>La-GloU</td><td>59.01</td><td>42.00</td><td>35.13</td><td>25.14</td><td>13.09</td><td>2.03</td><td>39.18</td><td>23.46</td><td>22.05</td><td>42.19</td><td>50.08</td></tr><tr><td>Lα-DIoU</td><td>59.27</td><td>42.18</td><td>35.25</td><td>25.47</td><td>13.32</td><td>1.95</td><td>39.43</td><td>23.65</td><td>22.10</td><td>42.10</td><td>50.43</td></tr><tr><td>La-CloU</td><td>59.09</td><td>41.92</td><td>35.01</td><td>25.08</td><td>13.04</td><td>1.98</td><td>39.25</td><td>23.41</td><td>21.94</td><td>41.88</td><td>50.01</td></tr></table>
|
| 150 |
+
|
| 151 |
+
Table 3: The performance of YOLOv5s trained using different localization losses on simulated noisy trainval sets of PASCAL VOC $2 0 0 7 { + } 2 0 1 2$ under noise rates $\eta = 0 . 1 , 0 . 2$ , and 0.3. Results are obtained on the clean test set of PASCAL VOC 2007. mAP denotes $\mathrm { m A P _ { 5 0 : 9 5 } }$ ; $\mathrm { m A P _ { 7 5 : 9 5 } }$ denotes the mean AP over $\mathsf { A P } _ { 7 5 }$ , $\mathbf { A P } _ { 8 0 } , \cdot \cdot \cdot , \mathbf { A P } _ { 9 5 }$ . "rela. improv." stands for the relative improvement. $\alpha = 3$ is used for all $\alpha$ -IoU losses in all experiments.
|
| 152 |
+
|
| 153 |
+
<table><tr><td>Noise</td><td>Loss</td><td>AP50</td><td>AP55</td><td>AP60</td><td>AP65</td><td>AP70</td><td>AP75</td><td>AP80</td><td>AP85</td><td>AP90</td><td>AP95</td><td>mAP</td><td>mAP75:95</td></tr><tr><td rowspan="6">0.1</td><td>LIoU La-IoU</td><td>74.48 74.67</td><td>71.57 71.94</td><td>68.08 68.73</td><td>63.29 64.27</td><td>56.55 57.75</td><td>47.12 48.50</td><td>33.06 36.88</td><td>17.53 21.25</td><td>4.16 6.30</td><td>0.26 0.28</td><td>43.61 45.06</td><td>20.43</td></tr><tr><td>rela. improv.</td><td>0.26%</td><td>0.52%</td><td>0.95%</td><td>1.55%</td><td>2.12%</td><td>2.93%</td><td>11.55%</td><td>21.22%</td><td>51.44%</td><td>7.69%</td><td>3.32%</td><td>22.64 10.85%</td></tr><tr><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>LDIoU</td><td>74.09</td><td>71.46</td><td>67.88</td><td>63.09</td><td>56.18</td><td>46.71</td><td>32.67</td><td>17.50</td><td>4.43</td><td>0.23</td><td>43.42</td><td>20.31</td></tr><tr><td>La-DloU</td><td>74.38</td><td>71.95</td><td>68.10</td><td>63.52</td><td>57.18</td><td>48.47</td><td>35.90</td><td>20.89</td><td>6.37</td><td>0.33</td><td>44.71</td><td>22.39</td></tr><tr><td>rela. improv.</td><td>0.39%</td><td>0.69%</td><td>0.32%</td><td>0.68%</td><td>1.78%</td><td>3.77%</td><td>9.89%</td><td>19.37%</td><td>43.79%</td><td>43.48%</td><td>2.97%</td><td>10.26%</td></tr><tr><td rowspan="6">0.2</td><td>LIoU La-loU</td><td>67.82</td><td>63.93</td><td>58.22</td><td>50.11</td><td>39.31</td><td>26.33</td><td>13.51</td><td>4.55</td><td>0.66</td><td>0.05</td><td>32.45</td><td>9.02</td></tr><tr><td></td><td>68.20</td><td>64.21</td><td>58.77</td><td>51.59</td><td>40.66</td><td>29.20</td><td>16.11</td><td>6.06</td><td>1.31</td><td>0.10</td><td>33.62</td><td>10.56</td></tr><tr><td>rela. improv.</td><td>0.56%</td><td>0.44%</td><td>0.94%</td><td>2.95%</td><td>3.43%</td><td>10.90%</td><td>19.25%</td><td>33.19%</td><td>98.48%</td><td>100%</td><td>3.61%</td><td>17.03%</td></tr><tr><td>LDIoU</td><td>67.39</td><td>62.94</td><td>57.29</td><td>49.25</td><td>39.40</td><td>27.13</td><td>13.78</td><td>4.52</td><td>0.68</td><td>0.02</td><td>32.24</td><td>9.23</td></tr><tr><td>La-DloU</td><td>68.26</td><td>64.49</td><td>59.59</td><td>51.99</td><td>41.19</td><td>29.12</td><td>15.77</td><td>5.84</td><td>1.25</td><td>0.21</td><td>33.77</td><td>10.44</td></tr><tr><td>rela.improv.</td><td>1.29%</td><td>2.46%</td><td>4.01%</td><td>5.56%</td><td>4.54%</td><td>7.34%</td><td>14.44%</td><td>29.20%</td><td>83.82%</td><td>950%</td><td>4.75%</td><td>13.14%</td></tr><tr><td rowspan="6">0.3</td><td>LIoU La-IoU</td><td>56.54</td><td>49.69</td><td>40.67</td><td>30.80</td><td>19.99</td><td>11.13</td><td>4.81</td><td>1.43</td><td>0.31</td><td>0.04</td><td>21.54</td><td>3.54</td></tr><tr><td></td><td>58.59</td><td>51.58</td><td>43.23</td><td>32.93</td><td>22.27</td><td>12.52</td><td>5.91</td><td>2.16</td><td>0.73</td><td>0.12</td><td>23.00</td><td>4.29</td></tr><tr><td>rela. improv.</td><td>3.63%</td><td>3.80%</td><td>6.29%</td><td>6.92%</td><td>11.41%</td><td>12.49%</td><td>22.87%</td><td>51.05%</td><td>135%</td><td>200%</td><td>6.78%</td><td>20.99%</td></tr><tr><td>LDIoU</td><td>56.84</td><td>49.82</td><td>41.50</td><td></td><td>20.80</td><td>11.22</td><td>4.84</td><td>1.51</td><td>0.46</td><td></td><td></td><td></td></tr><tr><td></td><td>58.45</td><td>51.94</td><td>43.9</td><td>32.06 33.78</td><td>22.57</td><td>12.89</td><td>6.34</td><td>2.42</td><td>0.65</td><td>0.07</td><td>21.91 23.31</td><td>3.62 4.49</td></tr><tr><td>La-DIoU rela. improv.</td><td>2.83%</td><td>4.26%</td><td>5.78%</td><td>5.36%</td><td>8.51%</td><td>14.88%</td><td>30.99%</td><td>60.26%</td><td>41.30%</td><td>0.16 129%</td><td>6.39%</td><td>24.09%</td></tr></table>
|
| 154 |
+
|
| 155 |
+
We test $\eta = 0 . 1 , 0 . 2 , 0 . 3$ in our experiments, with the average IoU between the noisy bboxes and their clean versions dropping to 0.833, 0.710, and 0.613, respectively. Examples of the synthesized noisy bboxes can be found in Appendix B.4. As shown in Table 3, $\alpha$ -IoU improves the baseline losses (i.e., ${ \mathcal { L } } _ { \mathrm { I o U } }$ and ${ \mathcal { L } } _ { \mathrm { { D I o U } } } ,$ ) considerably in these noisy scenarios. We gain increasing relative improvements from $\mathrm { { A P } _ { 5 0 } }$ to $\mathsf { A P } _ { 9 5 }$ , which accumulate to a more significant improvement in $\mathrm { m A P _ { 7 5 : 9 5 } }$ . Note that $\alpha$ -IoU losses also outperform the baselines at $\mathrm { { A P } _ { 5 0 } }$ across all noisy scenarios, which is not always the case when bboxes are clean (Table 1). Furthermore, $\alpha$ -IoU losses are noticeably more robust against more severe noises. For instance, the relative improvement of $\mathcal { L } _ { \alpha \mathrm { - D I o U } }$ over ${ \mathcal { L } } _ { \mathrm { D I o U } }$ increases from $2 . 9 7 \% / 1 0 . 2 6 \%$ to $6 . 3 9 \% / 2 4 . 0 9 \%$ according to $\mathrm { m A P / m A P _ { 7 5 : 9 5 } }$ when the noise rate $\eta$ rises from 0.1 to 0.3. These results confirm the advantage of $\alpha$ -IoU losses in noisy bbox scenarios.
|
| 156 |
+
|
| 157 |
+

|
| 158 |
+
Figure 6: The performance of YOLOv5 models trained using $\alpha$ -IoU with different $\alpha$ values and evaluated on the clean test set of PASCAL VOC 2007. Black dashed lines denote baselines (i.e., the family of $\alpha$ -IoU with $\alpha = 1$ ) while red dashed lines denote the family of $\alpha$ -IoU with $\alpha = 3$ .
|
| 159 |
+
|
| 160 |
+
# 4.4 Sensitivity to power parameter $\alpha$
|
| 161 |
+
|
| 162 |
+
Here, we evaluate the performance of $\alpha$ -IoU with varying $\alpha$ values $( \alpha \in [ 0 . 5 , 5 ] )$ ) via a set of experiments with ${ \mathcal { L } } _ { \alpha - { \mathrm { I o U } } }$ and $\mathcal { L } _ { \alpha - \mathrm { D I o U } }$ . The results are shown in Figure 6 for YOLOv5s on PASCAL VOC in both clean and various noisy bbox scenarios. It is evident that $\alpha$ -IoU losses with $\alpha \in [ 2 , 4 ]$ perform competitively well across all scenarios, with $\alpha = 3$ performing the best in most cases. When $\alpha > 3$ , $\alpha$ -IoU losses tend to perform worse on low APs than the baselines (i.e., $\alpha$ -IoU with $\alpha = 1 \AA$ ), although the performance at high APs gains more improvement. We also test an extreme case with $\alpha = 1 0$ , in which the performance drops by $5 . 6 1 \% / 1 \dot { 0 } . 9 2 \% / 2 3 . 8 8 \% / 3 1 . 8 2 \%$ on average compared with $\alpha = 3$ under noise rates $\eta = 0 / 0 . 1 / 0 . 2 / 0 . 3$ , respectively. More specifically, it becomes worse than the baselines according to either mAP or $\mathrm { m A P _ { 7 5 : 9 5 } }$ . This indicates that a proper choice of $\alpha$ is crucial for $\alpha$ -IoU losses. Our recommendation is to tune $\alpha \in [ 2 , 3 ]$ for most applications or directly use $\alpha = 3$ when tuning is too expensive. Note that $\alpha \in [ 3 , 4 ]$ may be a better choice when high levels of bbox regression accuracy is desired, e.g., $\mathrm { m A P _ { 7 5 : 9 5 } }$ is the preferred performance metric. It is possible that $\alpha < 1$ is a better choice for certain applications, although $\alpha$ -IoU losses with $\alpha < 1$ perform consistently worse than the baselines in our experiments.
|
| 163 |
+
|
| 164 |
+
# 5 Conclusions
|
| 165 |
+
|
| 166 |
+
In this paper, we proposed a unified formula $\alpha$ -IoU to generalize existing IoU-based losses to a new family of power IoU losses. By modulating the power parameter $\alpha$ , $\alpha$ -IoU offers the flexibility to achieve different levels of bbox regression accuracy when training an object detector. We analyzed the order preservingness and the loss/gradient reweighting properties of $\alpha$ -IoU, and showed that $\alpha$ -IoU can improve bbox regression accuracy through up-weighting the loss and gradient of high IoU objects. Experiments with multiple detection models and benchmark datasets demonstrated that $\alpha$ -IoU losses can consistently outperform existing IoU-based losses, especially at the high Average Precisions (APs). $\alpha$ -IoU has the potential to be widely applied in real-world object detection applications as 1) it improves existing IoU-based losses, 2) it benefits light models, 3) it is extremely advantageous on small datasets, and 4) it is more robust to noisy bboxes. For future work, we will explore new generalization formulas for other metric-derived loss functions [13], such as Dice, Hausdorff distance, and Chamfer distance losses.
|
| 167 |
+
|
| 168 |
+
# Societal Impacts
|
| 169 |
+
|
| 170 |
+
The proposed loss functions can help train high-performance object detectors for impactful applications such as self-driving, face recognition and video surveillance. While not our initial intention, these models could potentially be manipulated by adversaries or unauthorized users for malicious purposes. This could compromise the safety or privacy of certain individuals. We believe strict regulations should be established to prevent such illegitimate exploitations.
|
| 171 |
+
|
| 172 |
+
# References
|
| 173 |
+
|
| 174 |
+
[1] A. Bochkovskiy, C.-Y. Wang, and H.-Y. M. Liao. Yolov4: Optimal speed and accuracy of object detection. arXiv preprint arXiv:2004.10934, 2020.
|
| 175 |
+
[2] G. E. Box and D. R. Cox. An analysis of transformations. Journal of the Royal Statistical Society: Series B (Methodological), 26(2):211–243, 1964. [3] Z. Cai and N. Vasconcelos. Cascade r-cnn: Delving into high quality object detection. In CVPR, pages 6154–6162, 2018. [4] N. Carion, F. Massa, G. Synnaeve, N. Usunier, A. Kirillov, and S. Zagoruyko. End-to-end object detection with transformers. In ECCV, pages 213–229. Springer, 2020. [5] K. Chen, J. Pang, J. Wang, Y. Xiong, X. Li, S. Sun, W. Feng, Z. Liu, J. Shi, W. Ouyang, et al. Hybrid task cascade for instance segmentation. In CVPR, pages 4974–4983, 2019.
|
| 176 |
+
[6] K. Chen, J. Wang, J. Pang, Y. Cao, Y. Xiong, X. Li, S. Sun, W. Feng, Z. Liu, J. Xu, et al. Mmdetection: Open mmlab detection toolbox and benchmark. arXiv preprint arXiv:1906.07155, 2019.
|
| 177 |
+
[7] Z. Dong, G. Li, Y. Liao, F. Wang, P. Ren, and C. Qian. Centripetalnet: Pursuing high-quality keypoint pairs for object detection. In CVPR, pages 10519–10528, 2020. [8] K. Duan, S. Bai, L. Xie, H. Qi, Q. Huang, and Q. Tian. Centernet: Keypoint triplets for object detection. In ICCV, pages 6569–6578, 2019. [9] M. Everingham, L. Van Gool, C. K. Williams, J. Winn, and A. Zisserman. The pascal visual object classes (voc) challenge. IJCV, 88(2):303–338, 2010.
|
| 178 |
+
[10] J. Gao, J. Wang, S. Dai, L.-J. Li, and R. Nevatia. Note-rcnn: Noise tolerant ensemble rcnn for semi-supervised object detection. In ICCV, pages 9508–9517, 2019.
|
| 179 |
+
[11] R. Girshick. Fast r-cnn. In ICCV, pages 1440–1448, 2015.
|
| 180 |
+
[12] B. Han, Q. Yao, X. Yu, G. Niu, M. Xu, W. Hu, I. W. Tsang, and M. Sugiyama. Co-teaching: Robust training of deep neural networks with extremely noisy labels. In NeurIPS, 2018.
|
| 181 |
+
[13] J. He, S. Erfani, S. Wijewickrema, S. O’Leary, and K. Ramamohanarao. Learning non-unique segmentation with reward-penalty dice loss. In IJCNN, pages 1–8. IEEE, 2020.
|
| 182 |
+
[14] K. He, G. Gkioxari, P. Dollár, and R. Girshick. Mask r-cnn. In ICCV, pages 2961–2969, 2017.
|
| 183 |
+
[15] M. Khodabandeh, A. Vahdat, M. Ranjbar, and W. G. Macready. A robust learning approach to domain adaptive object detection. In ICCV, pages 480–490, 2019.
|
| 184 |
+
[16] H. Law and J. Deng. Cornernet: Detecting objects as paired keypoints. In ECCV, pages 734–750, 2018.
|
| 185 |
+
[17] H. Li, T. Fu, J. Dai, H. Li, G. Huang, and X. Zhu. Autoloss-zero: Searching loss functions from scratch for generic tasks. arXiv preprint arXiv:2103.14026, 2021.
|
| 186 |
+
[18] H. Li, C. Tao, X. Zhu, X. Wang, G. Huang, and J. Dai. Auto seg-loss: Searching metric surrogates for semantic segmentation. arXiv preprint arXiv:2010.07930, 2020.
|
| 187 |
+
[19] H. Li, Z. Wu, C. Zhu, C. Xiong, R. Socher, and L. S. Davis. Learning from noisy anchors for one-stage object detection. In CVPR, pages 10588–10597, 2020.
|
| 188 |
+
[20] J. Li, C. Xiong, R. Socher, and S. Hoi. Towards noise-resistant object detection with noisy annotations. arXiv preprint arXiv:2003.01285, 2020.
|
| 189 |
+
[21] T.-Y. Lin, P. Goyal, R. Girshick, K. He, and P. Dollár. Focal loss for dense object detection. In ICCV, pages 2980–2988, 2017.
|
| 190 |
+
[22] T.-Y. Lin, M. Maire, S. Belongie, J. Hays, P. Perona, D. Ramanan, P. Dollár, and C. L. Zitnick. Microsoft coco: Common objects in context. In ECCV, pages 740–755. Springer, 2014.
|
| 191 |
+
[23] P. Liu, G. Zhang, B. Wang, H. Xu, X. Liang, Y. Jiang, and Z. Li. Loss function discovery for object detection via convergence-simulation driven search. arXiv preprint arXiv:2102.04700, 2021.
|
| 192 |
+
[24] W. Liu, D. Anguelov, D. Erhan, C. Szegedy, S. Reed, C.-Y. Fu, and A. C. Berg. Ssd: Single shot multibox detector. In ECCV, pages 21–37. Springer, 2016.
|
| 193 |
+
[25] X. Ma, H. Huang, Y. Wang, S. Romano, S. Erfani, and J. Bailey. Normalized loss functions for deep learning with noisy labels. In ICML, pages 6543–6553. PMLR, 2020.
|
| 194 |
+
[26] X. Ma, Y. Wang, M. E. Houle, S. Zhou, S. Erfani, S. Xia, S. Wijewickrema, and J. Bailey. Dimensionality-driven learning with noisy labels. In ICML, pages 3355–3364. PMLR, 2018.
|
| 195 |
+
[27] N. Natarajan, I. S. Dhillon, P. K. Ravikumar, and A. Tewari. Learning with noisy labels. NeurIPS, 26:1196–1204, 2013.
|
| 196 |
+
[28] M. A. Rahman and Y. Wang. Optimizing intersection-over-union in deep neural networks for image segmentation. In ISVC, pages 234–244. Springer, 2016.
|
| 197 |
+
[29] J. Redmon and A. Farhadi. Yolo9000: better, faster, stronger. In CVPR, pages 7263–7271, 2017.
|
| 198 |
+
[30] J. Redmon and A. Farhadi. Yolov3: An incremental improvement. arXiv preprint arXiv:1804.02767, 2018.
|
| 199 |
+
[31] S. Ren, K. He, R. Girshick, and J. Sun. Faster r-cnn: Towards real-time object detection with region proposal networks. arXiv preprint arXiv:1506.01497, 2015.
|
| 200 |
+
[32] H. Rezatofighi, N. Tsoi, J. Gwak, A. Sadeghian, I. Reid, and S. Savarese. Generalized intersection over union: A metric and a loss for bounding box regression. In CVPR, pages 658–666, 2019.
|
| 201 |
+
[33] G. Song, Y. Liu, and X. Wang. Revisiting the sibling head in object detector. In CVPR, pages 11563–11572, 2020.
|
| 202 |
+
[34] Z. Tian, C. Shen, H. Chen, and T. He. Fcos: Fully convolutional one-stage object detection. In ICCV, pages 9627–9636, 2019.
|
| 203 |
+
[35] L. Tychsen-Smith and L. Petersson. Improving object localization with fitness nms and bounded iou loss. In CVPR, pages 6877–6885, 2018.
|
| 204 |
+
[36] K. Wang and L. Zhang. Single-shot two-pronged detector with rectified iou loss. In Proceedings of the 28th ACM International Conference on Multimedia, pages 1311–1319, 2020.
|
| 205 |
+
[37] Y. Wang, X. Ma, Z. Chen, Y. Luo, J. Yi, and J. Bailey. Symmetric cross entropy for robust learning with noisy labels. In ICCV, pages 322–330, 2019.
|
| 206 |
+
[38] Z. Wang, L. Liu, and D. Tao. Deep streaming label learning. In ICML, pages 9963–9972. PMLR, 2020.
|
| 207 |
+
[39] J. Yu, Y. Jiang, Z. Wang, Z. Cao, and T. Huang. Unitbox: An advanced object detection network. In Proceedings of the 24th ACM international conference on Multimedia, pages 516–520, 2016.
|
| 208 |
+
[40] S. Zhang, C. Chi, Y. Yao, Z. Lei, and S. Z. Li. Bridging the gap between anchor-based and anchor-free detection via adaptive training sample selection. In CVPR, pages 9759–9768, 2020.
|
| 209 |
+
[41] Y.-F. Zhang, W. Ren, Z. Zhang, Z. Jia, L. Wang, and T. Tan. Focal and efficient iou loss for accurate bounding box regression. arXiv preprint arXiv:2101.08158, 2021.
|
| 210 |
+
[42] Z. Zhang and M. R. Sabuncu. Generalized cross entropy loss for training deep neural networks with noisy labels. In NeurIPS, 2018.
|
| 211 |
+
[43] Z. Zheng, P. Wang, W. Liu, J. Li, R. Ye, and D. Ren. Distance-iou loss: Faster and better learning for bounding box regression. In AAAI, pages 12993–13000, 2020.
|
| 212 |
+
[44] X. Zhou, D. Wang, and P. Krähenbühl. Objects as points. arXiv preprint, arXiv:1904.07850, 2019.
|
| 213 |
+
[45] X. Zhou, J. Zhuo, and P. Krahenbuhl. Bottom-up object detection by grouping extreme and center points. In CVPR, pages 850–859, 2019.
|
| 214 |
+
[46] X. Zhu, W. Su, L. Lu, B. Li, X. Wang, and J. Dai. Deformable detr: Deformable transformers for end-to-end object detection. arXiv preprint arXiv:2010.04159, 2020.
|
md/train/ry-TW-WAb/ry-TW-WAb.md
ADDED
|
@@ -0,0 +1,413 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# VARIATIONAL NETWORK QUANTIZATION
|
| 2 |
+
|
| 3 |
+
Jan Achterhold1,2, Jan M. Kohler ¨ 1, Anke Schmeink2 & Tim Genewein1,\*
|
| 4 |
+
|
| 5 |
+
1Bosch Center for Artificial Intelligence
|
| 6 |
+
Robert Bosch GmbH
|
| 7 |
+
Renningen, Germany
|
| 8 |
+
2RWTH Aachen University
|
| 9 |
+
Institute for Theoretical Information Technology
|
| 10 |
+
Aachen, Germany
|
| 11 |
+
\*Corresponding author: tim.genewein@de.bosch.com
|
| 12 |
+
|
| 13 |
+
# ABSTRACT
|
| 14 |
+
|
| 15 |
+
In this paper, the preparation of a neural network for pruning and few-bit quantization is formulated as a variational inference problem. To this end, a quantizing prior that leads to a multi-modal, sparse posterior distribution over weights, is introduced and a differentiable Kullback-Leibler divergence approximation for this prior is derived. After training with Variational Network Quantization, weights can be replaced by deterministic quantization values with small to negligible loss of task accuracy (including pruning by setting weights to 0). The method does not require fine-tuning after quantization. Results are shown for ternary quantization on LeNet-5 (MNIST) and DenseNet (CIFAR-10).
|
| 16 |
+
|
| 17 |
+
# 1 INTRODUCTION
|
| 18 |
+
|
| 19 |
+
Parameters of a trained neural network commonly exhibit high degrees of redundancy (Denil et al., 2013) which implies an over-parametrization of the network. Network compression methods implicitly or explicitly aim at the systematic reduction of redundancy in neural network models while at the same time retaining a high level of task accuracy. Besides architectural approaches, such as SqueezeNet (Iandola et al., 2016) or MobileNets (Howard et al., 2017), many compression methods perform some form of pruning or quantization. Pruning is the removal of irrelevant units (weights, neurons or convolutional filters) (LeCun et al., 1990). Relevance of weights is often determined by the absolute value (“magnitude based pruning” (Han et al., 2016; 2017; Guo et al., 2016)), but more sophisticated methods have been known for decades, e.g., based on second-order derivatives (Optimal Brain Damage (LeCun et al., 1990) and Optimal Brain Surgeon (Hassibi & Stork, 1993)) or ARD (automatic relevance determination, a Bayesian framework for determining the relevance of weights, (MacKay, 1995; Neal, 1995; Karaletsos & Ratsch, 2015)). Quantization is the reduc- ¨ tion of the bit-precision of weights, activations or even gradients, which is particularly desirable from a hardware perspective (Sze et al., 2017). Methods range from fixed bit-width computation (e.g., 12-bit fixed point) to aggressive quantization such as binarization of weights and activations (Courbariaux et al., 2016; Rastegari et al., 2016; Zhou et al., 2016; Hubara et al., 2016). Few-bit quantization (2 to 6 bits) is often performed by k-means clustering of trained weights with subsequent fine-tuning of the cluster centers (Han et al., 2016). Pruning and quantization methods have been shown to work well in conjunction (Han et al., 2016). In so-called “ternary” networks, weights can have one out of three possible values (negative, zero or positive) which also allows for simultaneous pruning and few-bit quantization (Li et al., 2016; Zhu et al., 2016).
|
| 20 |
+
|
| 21 |
+
This work is closely related to some recent Bayesian methods for network compression (Ullrich et al., 2017; Molchanov et al., 2017; Louizos et al., 2017; Neklyudov et al., 2017) that learn a posterior distribution over network weights under a sparsity-inducing prior. The posterior distribution over network parameters allows identifying redundancies through three means: weights with (1) an expected value very close to zero and (2) weights with a large variance can be pruned as they do not contribute much to the overall computation. (3) the posterior variance over non-pruned parameters can be used to determine the required bit-precision (quantization noise can be made as large as implied by the posterior uncertainty). Additionally, Bayesian inference over modelparameters is known to automatically reduce parameter redundancy by penalizing overly complex models (MacKay, 2003).
|
| 22 |
+
|
| 23 |
+
In this paper we present Variational Network Quantization (VNQ), a Bayesian network compression method for simultaneous pruning and few-bit quantization of weights. We extend previous Bayesian pruning methods by introducing a multi-modal quantizing prior that penalizes weights of low variance unless they lie close to one of the target values for quantization. As a result, weights are either drawn to one of the quantization target values or they are assigned large variance values—see Fig. 1. After training, our method yields a Bayesian neural network with a multi-modal posterior over weights (typically with one mode fixed at 0), which is the basis for subsequent pruning and quantization. Additionally, posterior uncertainties can also be interesting for network introspection and analysis, as well as for obtaining uncertainty estimates over network predictions (Gal & Ghahramani, 2015; Gal, 2016; Depeweg et al., 2016; 2017). After pruning and hard quantization, and without the need for additional fine-tuning, our method yields a deterministic feed-forward neural network with heavily quantized weights. Our method is applicable to pre-trained networks but can also be used for training from scratch. Target values for quantization can either be manually fixed or they can be learned during training. We demonstrate our method for the case of ternary quantization on LeNet-5 (MNIST) and DenseNet (CIFAR-10).
|
| 24 |
+
|
| 25 |
+

|
| 26 |
+
|
| 27 |
+

|
| 28 |
+
(b) Soft-quantized network after VNQ training. Weights tightly cluster around the quantization target values.
|
| 29 |
+
|
| 30 |
+
(a) Pre-trained network. No obvious clusters are visible in the network trained without VNQ. No regularization was used during pre-training.
|
| 31 |
+
|
| 32 |
+
Figure 1: Distribution of weights (means $\theta$ and log-variance $\log \sigma ^ { 2 } ,$ ) before and after VNQ training of LeNet-5 on MNIST (validation accuracy before: $9 9 . 2 \%$ vs. after 195 epochs: $9 9 . 3 \%$ ). Top row: scatter plot of weights (blue dots) per layer. Means were initialized from pre-trained deterministic network, variances with $\log \sigma ^ { 2 } = - 8$ . Bottom row: corresponding density1. Red shaded areas show the funnel-shaped “basins of attraction” induced by the quantizing prior. Positive and negative target values for ternary quantization have been learned per layer. After training, weights with small expected absolute value or large variance $( \log \alpha _ { i j } \ge \log T _ { \alpha } = 2$ corresponding to the funnel marked by the red dotted line) are pruned and remaining weights are quantized without loss in accuracy.
|
| 33 |
+
|
| 34 |
+
# 2 PRELIMINARIES
|
| 35 |
+
|
| 36 |
+
Our method extends recent work that uses a (variational) Bayesian objective for neural network pruning (Molchanov et al., 2017). In this section, we first motivate such an approach by discussing that the objectives of compression (in the minimum-description-length sense) and Bayesian inference are well-aligned. We then briefly review the core ingredients that are combined in Sparse Variational Dropout (Molchanov et al., 2017). The final idea (and also the starting point of our method) is to learn dropout noise levels per weight and prune weights with large dropout noise. Learning dropout noise per weight can be done by interpreting dropout training as variational inference of an approximate weight-posterior under a sparsity inducing prior - this is known as Variational Dropout which is described in more detail below, after a brief introduction to modern approximate posterior inference in Bayesian neural networks by optimizing the evidence lower bound via stochastic gradient ascent and reparameterization tricks.
|
| 37 |
+
|
| 38 |
+
# 2.1 WHY BAYES FOR COMPRESSION?
|
| 39 |
+
|
| 40 |
+
Bayesian inference over model parameters automatically penalizes overly complex parametric models, leading to an automatic regularization effect (Grunwald, 2007; Graves, 2011) (see Molchanov ¨ et al. (2017), where the authors show that Sparse Variational Dropout (Sparse VD) successfully prevents a network from fitting unstructured data, that is a random labeling). The automatic regularization is based on the objective of maximizing model evidence, also know as marginal likelihood. A very complex model might have a particular parameter setting that achieves extremely good likelihood given the data, however, since the model evidence is obtained via marginalizing parameters, overly complex models are penalized for having many parameter settings with poor likelihood. This effect is also known as “Bayesian Occams Razor” in Bayesian model selection (MacKay, 2003; Genewein & Braun, 2014). The argument can be extended to variational Bayesian inference (with some caveats) via the equivalence of the variational Bayesian objective and the Minimum description length (MDL) principle (Rissanen, 1978; Grunwald, 2007; Graves, 2011; Louizos et al., 2017).¨ The evidence lower bound (ELBO), which is maximized in variational inference, is composed of two terms: $\mathcal { L } ^ { E }$ , the average message length required to transmit outputs (labels) to a receiver that knows the inputs and the posterior over model parameters and $\mathcal { L } ^ { C }$ , the average message length to transmit the posterior parameters to a receiver that knows the prior over parameters:
|
| 41 |
+
|
| 42 |
+
$$
|
| 43 |
+
\begin{array} { r l } { \mathcal { L } ^ { \mathrm { E L B O } } = \underbrace { \mathrm { n e g . r e c o n s t r . \ e r r o r } } _ { - \mathcal { L } ^ { E } } } & { + \underbrace { \mathrm { n e g . \ K L \ d i v e r g e n c e } } _ { - \mathcal { L } ^ { C } = \mathrm { e n t r o p y - c r o s s \ e n t r o p y } } } \end{array}
|
| 44 |
+
$$
|
| 45 |
+
|
| 46 |
+
Maximizing the ELBO minimizes the total message length: max $\mathcal { L } ^ { \mathrm { E L B O } } = \operatorname* { m i n } \mathcal { L } ^ { E } + \mathcal { L } ^ { C }$ , leading to an optimal trade-off between short description length of the data and the model (thus, minimizing the sum of error cost $\mathcal { L } ^ { E }$ and model complexity cost $\mathcal { L } ^ { C }$ ). Interestingly, MDL dictates the use of stochastic models since they are in general “more compressible” compared to deterministic models: high posterior uncertainty over parameters is rewarded by the entropy term in $\mathcal { L } ^ { C }$ —higher uncertainty allows the quantization noise to be higher, thus, requiring lower bit-precision for a parameter. Variational Bayesian inference can also be formally related to the information-theoretic framework for lossy compression, rate-distortion theory, (Cover & Thomas, 2006; Tishby et al., 2000; Genewein et al., 2015). The only difference is that rate-distortion requires the use of the optimal prior, which is the marginal over posteriors (Hoffman & Johnson, 2016; Tomczak & Welling, 2017; Hoffman et al., 2017) - providing an interesting connection to empirical Bayes where the prior is learned from the data.
|
| 47 |
+
|
| 48 |
+
# 2.2 VARIATIONAL BAYES AND REPARAMETERIZATION
|
| 49 |
+
|
| 50 |
+
Let $\mathcal { D }$ be a dataset of $N$ pairs $( x _ { n } , y _ { n } ) _ { n = 1 } ^ { N }$ and $p ( \boldsymbol { y } | \boldsymbol { x } , \boldsymbol { w } )$ be a parameterized model that predicts outputs $y$ given inputs $x$ and parameters $w$ . A Bayesian neural network models a (posterior) distribution over parameters $w$ instead of just a point-estimate. The posterior is given by Bayes’ rule: $p ( w | \mathcal { D } ) = p ( \bar { \mathcal { D } } | w ) p ( w ) / p ( \mathcal { D } )$ , where $p ( w )$ is the prior over parameters. Computation of the true posterior is in general intractable. Common approaches to approximate inference in neural networks are for instance: MCMC methods pioneered in (Neal, 1995) and later refined, e.g., via stochastic gradient Langevin dynamics (Welling & Teh, 2011), or variational approximations to the true posterior (Graves, 2011), Bayes by Backprop (Blundell et al., 2015), Expectation Backpropagation (Soudry et al., 2014), Probabilistic Backpropagation (Hernandez-Lobato & Adams, 2015). In the ´ latter methods the true posterior is approximated by a parameterized distribution $q _ { \phi } ( w )$ . Variational parameters $\phi$ are optimized by minimizing the Kullback-Leibler (KL) divergence from the true to the approximate posterior $D _ { \mathrm { K L } } ( q _ { \phi } ( w ) | | p ( w | \mathcal { D } ) )$ . Since computation of the true posterior is intractable, minimizing this KL divergence is approximately performed by maximizing the so-called “evidence lower bound” (ELBO) or “negative variational free energy” (Kingma & Welling, 2014):
|
| 51 |
+
|
| 52 |
+
$$
|
| 53 |
+
\mathcal { L } ^ { \mathrm { E L B O } } ( \phi ) = \underbrace { \sum _ { n = 1 } ^ { N } \mathbb { E } _ { q _ { \phi } ( w ) } [ \log p ( y _ { n } | x _ { n } , w ) ] } _ { \mathrm { ~ } } - D _ { \mathrm { K L } } ( q _ { \phi } ( w ) | | p ( w ) ) ,
|
| 54 |
+
$$
|
| 55 |
+
|
| 56 |
+
$$
|
| 57 |
+
\simeq \mathcal { L } ^ { \mathrm { S G V B } } ( \phi ) = \frac { N } { M } \sum _ { m = 1 } ^ { M } \log p ( \tilde { y } _ { m } | \tilde { x } _ { m } , f ( \phi , \epsilon _ { m } ) ) - D _ { \mathrm { K L } } ( q _ { \phi } ( w ) | | p ( w ) ) ,
|
| 58 |
+
$$
|
| 59 |
+
|
| 60 |
+
where we have used the Reparameterization $T r i c k ^ { 2 }$ (Kingma & Welling, 2014) in Eq. (2) to get an unbiased, differentiable, minibatch-based Monte Carlo estimator of the expected log likelihood $L _ { \mathcal { D } } ( \phi )$ . A mini-batch of data is denoted by $( \tilde { x } _ { m } , \tilde { y } _ { m } ) _ { m = 1 } ^ { M }$ . Additionally, and in line with similar work (Molchanov et al., 2017; Louizos et al., 2017; Neklyudov et al., 2017), we use the Local Reparameterization Trick (Kingma et al., 2015) to further reduce variance of the stochastic ELBO gradient estimator, which locally marginalizes weights at each layer and instead samples directly from the distribution over pre-activations (which can be computed analytically). See Appendix A.2 for more details on the Local reparameterization. Commonly, the prior $p ( w )$ and the parametric form of the posterior $q _ { \phi } ( w )$ are chosen such that the KL divergence term can be computed analytically (e.g. a fully factorized Gaussian prior and posterior, known as the mean-field approximation). Due to the particular choice of prior in our work, a closed-form expression for the KL divergence cannot be obtained but instead we use a differentiable approximation (see Sec. 3.3).
|
| 61 |
+
|
| 62 |
+
# 2.3 VARIATIONAL INFERENCE VIA DROPOUT TRAINING
|
| 63 |
+
|
| 64 |
+
Dropout (Srivastava et al., 2014) is a method originally introduced for regularization of neural networks, where activations are stochastically dropped (i.e., set to zero) with a certain probability $p$ during training. It was shown that dropout, i.e., multiplicative noise on inputs, is equivalent to having noisy weights and vice versa (Wang $\&$ Manning, 2013; Kingma et al., 2015). Multiplicative Gaussian noise $\begin{array} { r } { \xi _ { i j } \sim \mathcal { N } ( 1 , \alpha = \frac { p } { 1 - p } ) } \end{array}$ on a weight $w _ { i j }$ induces a Gaussian distribution
|
| 65 |
+
|
| 66 |
+
$$
|
| 67 |
+
w _ { i j } = \theta _ { i j } \xi _ { i j } = \theta _ { i j } ( 1 + \sqrt { \alpha } \epsilon _ { i j } ) \sim \mathcal { N } ( \theta _ { i j } , \alpha \theta _ { i j } ^ { 2 } )
|
| 68 |
+
$$
|
| 69 |
+
|
| 70 |
+
with $\epsilon _ { i j } \sim \mathcal { N } ( 0 , 1 )$ . In standard (Gaussian) dropout training, the dropout rates $\alpha$ (or $p$ to be precise) are fixed and the expected log likelihood $L _ { \mathcal { D } } ( \phi )$ (first term in Eq. (1)) is maximized with respect to the means $\theta$ . Kingma et al. (2015) show that Gaussian dropout training is mathematically equivalent to maximizing the ELBO (both terms in Eq. (1)), under a prior $p ( w )$ and fixed $\alpha$ where the KL term does not depend on $\theta$ :
|
| 71 |
+
|
| 72 |
+
$$
|
| 73 |
+
\mathcal { L } ( \alpha , \theta ) = \mathbb { E } _ { q _ { \alpha } } [ L _ { \mathcal { D } } ( \theta ) ] - D _ { \mathrm { K L } } ( q _ { \alpha } ( w ) | | p ( w ) ) ,
|
| 74 |
+
$$
|
| 75 |
+
|
| 76 |
+
where the dependencies on $\alpha$ and $\theta$ of the terms in Eq. (1) have been made explicit. The only prior that meets this requirement is the scale invariant log-uniform prior:
|
| 77 |
+
|
| 78 |
+
$$
|
| 79 |
+
p ( \log | w _ { i j } | ) = \mathrm { { \ c o n s t . } } \Leftrightarrow p ( | w _ { i j } | ) \propto \frac { 1 } { | w _ { i j } | } .
|
| 80 |
+
$$
|
| 81 |
+
|
| 82 |
+
Using this interpretation, it becomes straightforward to learn individual dropout-rates $\alpha _ { i j }$ per weight, by including $\alpha _ { i j }$ into the set of variational parameters $\phi = ( \theta , \alpha )$ . This procedure was introduced in (Kingma et al., 2015) under the name “Variational Dropout”. With the choice of a log-uniform prior (Eq. (5)) and a factorized Gaussian approximate posterior $q _ { \phi } ( w _ { i j } ) = N ( \theta _ { i j } , \alpha _ { i j } \theta _ { i j } ^ { 2 } )$ (Eq. (3)) the KL term in Eq. (1) is not analytically tractable, but the authors of Kingma et al. (2015) present an approximation
|
| 83 |
+
|
| 84 |
+
$$
|
| 85 |
+
- D _ { \mathrm { K L } } ( q _ { \phi } ( w _ { i j } ) | | p ( w _ { i j } ) ) \approx \mathrm { c o n s t . } + 0 . 5 \log \alpha _ { i j } + c _ { 1 } \alpha _ { i j } + c _ { 2 } \alpha _ { i j } ^ { 2 } + c _ { 3 } \alpha _ { i j } ^ { 3 } ,
|
| 86 |
+
$$
|
| 87 |
+
|
| 88 |
+
see the original publication for numerical values of $c _ { 1 } , c _ { 2 } , c _ { 3 }$ . Note that due to the mean-field approximation, where the posterior over all weights factorizes into a product over individual weights $\bar { q } _ { \phi } ( w ) ~ = ~ \prod q _ { \phi } ( w _ { i j } )$ , the KL divergence factorizes into a sum of individual KL divergences $\begin{array} { r } { \tilde { D } _ { \mathrm { K L } } ( q _ { \phi } ( w ) | \bar { | } p ( w ) ) = \sum D _ { \mathrm { K L } } ( q _ { \phi } ( w _ { i j } ) | | p ( w _ { i j } ) ) } \end{array}$ .
|
| 89 |
+
|
| 90 |
+
# 2.4 PRUNING UNITS WITH LARGE DROPOUT RATES
|
| 91 |
+
|
| 92 |
+
Learning dropout rates is interesting for network compression since neurons or weights with very high dropout rates $p 1$ can very likely be pruned without loss in accuracy. However, as the authors of Sparse Variational Dropout (sparse VD) (Molchanov et al., 2017) report, the approximation in Eq. (6) is only accurate for $\alpha \leq 1$ (corresponding to $p \leq 0 . 5$ ). For this reason, the original variational dropout paper restricted $\alpha$ to values smaller or equal to 1, which are unsuitable for pruning. Molchanov et al. (2017) propose an improved approximation, which is very accurate on the full range of $\log \alpha$ :
|
| 93 |
+
|
| 94 |
+
$- D _ { \mathrm { K L } } ( q _ { \phi } ( w _ { i j } ) | | p ( w _ { i j } ) ) \approx \mathrm { c o n s t . } + k _ { 1 } S ( k _ { 2 } + k _ { 3 } \log \alpha _ { i j } ) - 0 . 5 \log ( 1 + \alpha _ { i j } ^ { - 1 } ) = F _ { \mathrm { K L , L U } } ( \theta _ { i j } , \sigma _ { i j } ) ,$ (7)
|
| 95 |
+
|
| 96 |
+
with $k _ { 1 } = 0 . 6 3 5 7 6$ , $k _ { 2 } = 1 . 8 7 3 2 0$ and $k _ { 3 } = 1 . 4 8 6 9 5$ and $S$ denoting the sigmoid function. Additionally, the authors propose to use an additive, instead of a multiplicative noise reparameterization, which significantly reduces variance in the gradient $\frac { \partial \mathcal { L } ^ { \mathrm { S G V B } } } { \partial \theta _ { i j } }$ for large $\alpha _ { i j }$ . To achieve this, the multiplicative noise term is replaced by an exactly equivalent additive noise term $\sigma _ { i j } \epsilon _ { i j }$ with $\sigma _ { i j } ^ { 2 } = \alpha _ { i j } \theta _ { i j } ^ { 2 }$ and the set of variational parameters becomes $\phi = ( \theta , \sigma )$ :
|
| 97 |
+
|
| 98 |
+
$$
|
| 99 |
+
w _ { i j } = \theta _ { i j } \underbrace { ( 1 + \sqrt { \alpha } \epsilon _ { i j } ) } _ { \mathrm { m u l t . n o i s e } } = \theta _ { i j } \underbrace { + \sigma _ { i j } \epsilon _ { i j } } _ { \mathrm { a d d . n o i s e } } \sim \mathcal { N } ( \theta _ { i j } , \sigma _ { i j } ^ { 2 } ) , \epsilon _ { i j } \sim \mathcal { N } ( 0 , 1 ) .
|
| 100 |
+
$$
|
| 101 |
+
|
| 102 |
+
After Sparse VD training, pruning is performed by thresholding $\begin{array} { r } { \alpha _ { i j } = \frac { \sigma _ { i j } ^ { 2 } } { \theta _ { i j } ^ { 2 } } } \end{array}$ . In Molchanov et al. (2017) a threshold of $\log \alpha = 3$ is used, which roughly corresponds to $p > 0 . 9 5$ . Pruning weights that lie above a threshold of $T _ { \alpha }$ leads to
|
| 103 |
+
|
| 104 |
+
$$
|
| 105 |
+
\frac { \sigma _ { i j } ^ { 2 } } { \theta _ { i j } ^ { 2 } } \geq T _ { \alpha } \Leftrightarrow \sigma _ { i j } ^ { 2 } \geq T _ { \alpha } \theta _ { i j } ^ { 2 } ,
|
| 106 |
+
$$
|
| 107 |
+
|
| 108 |
+
which means effectively that weights with large variance but also weights of lower variance and a mean $\theta _ { i j }$ close to zero are pruned. A visualization of the pruning threshold can be seen in Fig. 1 (the “central funnel”, i.e., the area marked by the red dotted lines for a threshold for $T _ { \alpha } = 2$ ). Sparse VD training can be performed from random initialization or with pre-trained networks by initializing the means $\theta _ { i j }$ accordingly. In Bayesian Compression (Louizos et al., 2017) and Structured Bayesian Pruning (Neklyudov et al., 2017), Sparse VD has been extended to include group-sparsity constraints, which allows for pruning of whole neurons or convolutional filters (via learning their corresponding dropout rates).
|
| 109 |
+
|
| 110 |
+
# 2.5 SPARSITY INDUCING PRIORS
|
| 111 |
+
|
| 112 |
+
For pruning weights based on their (learned) dropout rate, it is desirable to have high dropout rates for most weights. Perhaps surprisingly, Variational Dropout already implicitly introduces such a “high dropout rate constraint” via the implicit prior distribution over weights. The prior $p ( w )$ can be used to induce sparsity into the posterior by having high density at zero and heavy tails. There is a well known family of such distributions: scale-mixtures of normals (Andrews & Mallows, 1974; Louizos et al., 2017; Ingraham & Marks, 2017):
|
| 113 |
+
|
| 114 |
+
$$
|
| 115 |
+
w \sim { \mathcal { N } } ( 0 , z ^ { 2 } ) ; \quad z \sim p ( z ) ,
|
| 116 |
+
$$
|
| 117 |
+
|
| 118 |
+
where the scales of $w$ are random variables. A well-known example is the spike-and-slab prior (Mitchell & Beauchamp, 1988), which has a delta-spike at zero and a slab over the real line. Gal & Ghahramani (2015); Kingma et al. (2015) show how Dropout training implies a spike-and-slab prior over weights. The log uniform prior used in Sparse VD (Eq. (5)) can also be derived as a marginalized scale-mixture of normals
|
| 119 |
+
|
| 120 |
+
$$
|
| 121 |
+
p ( w _ { i j } ) \propto \int \frac { 1 } { | z _ { i j } | } { \cal N } ( w _ { i j } | 0 , z _ { i j } ^ { 2 } ) \mathrm { d } z _ { i j } = \frac { 1 } { | w _ { i j } | } ; \quad p ( z _ { i j } ) \propto \frac { 1 } { | z _ { i j } | } ,
|
| 122 |
+
$$
|
| 123 |
+
|
| 124 |
+
also known as the normal-Jeffreys prior (Figueiredo, 2002). Louizos et al. (2017) discuss how the log-uniform prior can be seen as a continuous relaxation of the spike-and-slab prior and how the alternative formulation through the normal-Jeffreys distribution can be used to couple the scales of weights that belong together and thus, learn dropout rates for whole neurons or convolutional filters, which is the basis for Bayesian Compression (Louizos et al., 2017) and Structured Bayesian Pruning (Neklyudov et al., 2017).
|
| 125 |
+
|
| 126 |
+
# 3 VARIATIONAL NETWORK QUANTIZATION
|
| 127 |
+
|
| 128 |
+
We formulate the preparation of a neural network for a post-training quantization step as a variational inference problem. To this end, we introduce a multi-modal, quantizing prior and train by maximizing the ELBO (Eq. (2)) under a mean-field approximation of the posterior (i.e., a fully factorized Gaussian). The goal of our algorithm is to achieve soft quantization, that is learning a posterior distribution such that the accuracy-loss introduced by post-training quantization is small. Our variational posterior approximation and training procedure is similar to Kingma et al. (2015) and Molchanov et al. (2017) with the crucial difference of using a quantizing prior that drives weights towards the target values for quantization.
|
| 129 |
+
|
| 130 |
+
# 3.1 A QUANTIZING PRIOR
|
| 131 |
+
|
| 132 |
+
The log uniform prior (Eq. (5)) can be viewed as a continuous relaxation of the spike-and-slab prior with a spike at location 0 (Louizos et al., 2017). We use this insight to formulate a quantizing prior, a continuous relaxation of a “multi-spike-and-slab” prior which has multiple spikes at locations $c _ { k }$ , $k \in \{ 1 , \ldots , K \}$ . Each spike location corresponds to one target value for subsequent quantization. The quantizing prior allows weights of low variance only at the locations of the quantization target values $c _ { k }$ . The effect of using such a quantizing prior during Variational Network Quantization is shown in Fig. 1. After training, most weights of low variance are distributed very closely around the quantization target values $c _ { k }$ and can thus be replaced by the corresponding value without significant loss in accuracy. We typically fix one of the quantization targets to zero, e.g., $c _ { 2 } = 0$ , which allows pruning weights. Additionally, weights with a large variance can also be pruned. Both kinds of pruning can be achieved with an $\alpha _ { i j }$ threshold (see Eq. (9)) as in sparse Variational Dropout (Molchanov et al., 2017). Following the interpretation of the log uniform prior $p ( w _ { i j } )$ as a marginal over the scale-hyperparameter $z _ { i j }$ , we extend Eq. (10) with a hyper-prior over locations
|
| 133 |
+
|
| 134 |
+
$$
|
| 135 |
+
p ( w _ { i j } ) = \int \mathcal { N } ( w _ { i j } | m _ { i j } , z _ { i j } ) p _ { z } ( z _ { i j } ) p _ { m } ( m _ { i j } ) \mathrm { d } z _ { i j } \mathrm { d } m _ { i j } \qquad p _ { m } ( m _ { i j } ) = \sum _ { k } a _ { k } \delta ( m _ { i j } - c _ { k } ) ,
|
| 136 |
+
$$
|
| 137 |
+
|
| 138 |
+
with $p ( z _ { i j } ) \propto | z _ { i j } | ^ { - 1 }$ . The location prior $p _ { m } ( m _ { i j } )$ is a mixture of weighted delta distributions located at the quantization values $c _ { k }$ . Marginalizing over $m$ yields the quantizing prior
|
| 139 |
+
|
| 140 |
+
$$
|
| 141 |
+
p ( w _ { i j } ) \propto \sum _ { k } a _ { k } \int \frac { 1 } { | z _ { i j } | } { \mathcal { N } } ( w _ { i j } | c _ { k } , z _ { i j } ) \mathrm { d } z _ { i j } = \sum _ { k } a _ { k } \frac { 1 } { | w _ { i j } - c _ { k } | } .
|
| 142 |
+
$$
|
| 143 |
+
|
| 144 |
+
In our experiments, we use $K = 3$ , $a _ { k } = 1 / K ~ \forall k$ and $c _ { 2 } = 0$ unless indicated otherwise.
|
| 145 |
+
|
| 146 |
+
# 3.2 POST-TRAINING QUANTIZATION
|
| 147 |
+
|
| 148 |
+
Eq. (9) implies that using a threshold on $\alpha _ { i j }$ as a pruning criterion is equivalent to pruning weights whose value does not differ significantly from zero:
|
| 149 |
+
|
| 150 |
+
$$
|
| 151 |
+
\theta _ { i j } ^ { 2 } \leq \frac { \sigma _ { i j } ^ { 2 } } { T _ { \alpha } } \quad \Longleftrightarrow \quad \theta _ { i j } \in ( - \frac { \sigma _ { i j } } { \sqrt { T _ { \alpha } } } , \frac { \sigma _ { i j } } { \sqrt { T _ { \alpha } } } ) .
|
| 152 |
+
$$
|
| 153 |
+
|
| 154 |
+
To be precise, $T _ { \alpha }$ specifies the width of a scaled standard-deviation band $\pm \sigma _ { i j } / \sqrt { T _ { \alpha } }$ around the mean $\theta _ { i j }$ . If the value zero lies within this band, the weight is assigned the value 0. For instance, a pruning threshold which implies $p \geq 0 . 9 5$ corresponds to a variance band of approximately $\sigma _ { i j } / 4$ . An equivalent interpretation is that a weight is pruned if the likelihood for the value 0 under the approximate posterior exceeds the threshold given by the standard-deviation band (Eq. (13)):
|
| 155 |
+
|
| 156 |
+
$$
|
| 157 |
+
\mathcal { N } ( 0 | \theta _ { i j } , \sigma _ { i j } ^ { 2 } ) \geq \mathcal { N } ( \theta _ { i j } \pm \frac { \sigma _ { i j } } { \sqrt { T _ { \alpha } } } | \theta _ { i j } , \sigma _ { i j } ^ { 2 } ) = \frac { 1 } { \sqrt { 2 \pi } \sigma _ { i j } } e ^ { - \frac { 1 } { 2 T _ { \alpha } } } .
|
| 158 |
+
$$
|
| 159 |
+
|
| 160 |
+
Extending this argument for pruning weights to a quantization setting, we design a post-training quantization scheme that assigns each weight the quantized value $c _ { k }$ with the highest likelihood under the approximate posterior. Since variational posteriors over weights are Gaussian, this translates into minimizing the squared distance between the mean $\theta _ { i j }$ and the quantized values $c _ { k }$ :
|
| 161 |
+
|
| 162 |
+
$$
|
| 163 |
+
\arg \operatorname* { m a x } _ { k } \mathcal { N } ( c _ { k } | \theta _ { i j } , \sigma _ { i j } ^ { 2 } ) = \arg \operatorname* { m a x } _ { k } e ^ { - \frac { ( c _ { k } - \theta _ { i j } ) ^ { 2 } } { 2 \sigma _ { i j } ^ { 2 } } } = \arg \operatorname* { m i n } _ { k } ( c _ { k } - \theta _ { i j } ) ^ { 2 } .
|
| 164 |
+
$$
|
| 165 |
+
|
| 166 |
+
Additionally, the pruning rate can be increased by first assigning a hard 0 to all weights that exceed the pruning threshold $T _ { \alpha }$ (see Eq. (9)) before performing the assignment to quantization levels as described above.
|
| 167 |
+
|
| 168 |
+
# 3.3 KL DIVERGENCE APPROXIMATION
|
| 169 |
+
|
| 170 |
+
Under the quantizing prior (Eq. (12)) the KL divergence from the prior $D _ { \mathrm { K L } } ( q _ { \phi } ( w ) | | p ( w ) )$ to the mean-field posterior is analytically intractable. Similar to Kingma et al. (2015); Molchanov et al. (2017), we use a differentiable approximation $F _ { \mathrm { K L } } ( \theta , \sigma , c ) ^ { 3 }$ , composed of a small number of differentiable functions to keep the computational effort low during training. We now present the approximation for a reference codebook $c = [ - r , 0 , r ] , r = 0 . 2$ , however later we show how the approximation can be used for arbitrary ternary, symmetric codebooks as well. The basis of our approximation is the approximation $F _ { \mathrm { K L , L U } }$ introduced by Molchanov et al. (2017) for the KL divergence from a log uniform prior to a Gaussian posterior (see Eq. (7)) which is centered around zero. We observe that a weighted mixture of shifted versions of $F _ { \mathrm { K L , L U } }$ can be used to approximate the KL divergence for our multi-modal quantizing prior (Eq. (12)) (which is composed of shifted versions of the log uniform prior). In a nutshell, we shift one version of $F _ { \mathrm { K L } }$ to each codebook entry $c _ { k }$ and then use $\theta$ -dependent Gaussian windowing functions $\Omega ( \theta )$ to mix the shifted approximations (see more details in the Appendix A.3). The approximation for the KL divergence from our multi-modal quantizing prior to a Gaussian posterior is given as
|
| 171 |
+
|
| 172 |
+
$$
|
| 173 |
+
{ \cal F } _ { \mathrm { K L } } ( \theta , \sigma , c ) = \sum _ { { k : c _ { k } \neq 0 } \atop \mathrm { ~ e l o s } \scriptscriptstyle \mathrm { ~ \left[ \sqrt { ~ \theta ~ - ~ } c _ { k } \right] ~ } } \Omega ( \theta - c _ { k } ) \mathrm { { F } } _ { \mathrm { K L , L U } } ( \theta - c _ { k } , \sigma ) + \underbrace { \Omega _ { 0 } ( \theta ) \mathrm { { F } } _ { \mathrm { K L , L U } } ( \theta , \sigma ) } _ { \mathrm { ~ e l o h ~ s l e n ~ i n ~ \left[ \sqrt { ~ \theta ~ - ~ } c _ { k } \right] ~ } }
|
| 174 |
+
$$
|
| 175 |
+
|
| 176 |
+
with
|
| 177 |
+
|
| 178 |
+
$$
|
| 179 |
+
\Omega ( \theta ) = \exp ( - \frac { 1 } { 2 } \frac { \theta ^ { 2 } } { \tau ^ { 2 } } ) \qquad \Omega _ { 0 } ( \theta ) = 1 - \sum _ { k : c _ { k } \neq 0 } \Omega ( \theta - c _ { k } ) .
|
| 180 |
+
$$
|
| 181 |
+
|
| 182 |
+
We use $\tau = 0 . 0 7 5$ in our experiments. Illustrations of the approximation, including a comparison against the ground-truth computed via Monte Carlo sampling are shown in Fig. 2. Over the range of $\theta \cdot$ and $\sigma$ -values relevant to our method, the maximum absolute deviation from the ground-truth is 1.07 nats. See Fig. 4 in the Appendix for a more detailed quantitative evaluation of our approximation.
|
| 183 |
+
|
| 184 |
+
This $\mathrm { K L }$ approximation in Eq. (16), developed for the reference codebook $c _ { r } = [ - r , 0 , r ]$ , can be reused for any symmetric ternary codebook $c _ { a } = [ - a , 0 , a ]$ , $a \in \mathbb { R } ^ { + }$ , since $c _ { a }$ can be represented with the reference codebook and a positive scaling factor $s$ , $c _ { a } ~ = ~ s c _ { r }$ , $s ~ = ~ a / r$ . As derived in the Appendix (A.4), this re-scaling translates into a multiplicative re-scaling of the variational parameters $\theta$ and $\sigma$ . The KL divergence from a prior based on the codebook $c _ { a }$ to the posterior $q _ { \phi } ( w )$ is thus given by $D _ { K L } ( q _ { \phi } ( w ) \bar { | } | p _ { c _ { a } } ( w ) ) \approx \bar { F _ { \mathrm { K L } } } ( \theta / s , \sigma / s , c _ { r } )$ . This result allows learning the quantization level $a$ during training as well.
|
| 185 |
+
|
| 186 |
+
# 4 EXPERIMENTS
|
| 187 |
+
|
| 188 |
+
In our experiments, we train with VNQ and then first prune via thresholding $\log \alpha _ { i j } \geq \log T _ { \alpha } = 2$ . Remaining weights are then quantized by minimizing the squared distance to the quantization values $c _ { k }$ (see Sec. 3.2). We use warm-up (Sønderby et al., 2016), that is, we multiply the KL divergence term (Eq. (2)) with a factor $\beta$ , where $\beta = 0$ during the first few epochs and then linearly ramp up to $\beta = 1$ . To improve stability of VNQ training, we ensure through clipping that $\log \sigma _ { i j } ^ { 2 ^ { - } } \in ( \bar { - } 1 \bar { 0 } , 1 )$ and $\theta _ { i j } \in ( - a - 0 . 3 6 7 9 \sigma , a + 0 . 3 6 7 9 \sigma )$ (which corresponds to a shifted $\log \alpha$ threshold of 2, that is, we clip $\theta _ { i j }$ if it lies left of the $- a$ funnel or right of the $+ a$ funnel, compare Fig. 1). This leads to a clipping-boundary that depends on trainable parameters. To avoid weights getting stuck at these boundaries, we use gradient-stopping, that is, we apply the gradient to a so-called “shadow weight” and use the clipped weight-value only for the forward pass. Without this procedure our method still works, but accuracies are a bit worse, particularly on CIFAR-10. When learning codebook values $a$ during training, we use a lower learning rate for adjusting the codebook, otherwise we observe a tendency for codebook values to collapse in early stages of training (a similar observation was made by Ullrich et al. (2017)). Additionally, we ensure $a \ge 0 . 0 5$ by clipping.
|
| 189 |
+
|
| 190 |
+

|
| 191 |
+
Figure 2: Approximation to the analytically intractable KL divergence $D _ { \mathrm { K L } } ( q _ { \phi } | | p )$ , constructed by shifting and mixing known approximations to the KL divergence from a log uniform prior to the posterior. Top row: Shifted versions of the known approximation (Eq. (7)) in color and the ground truth KL approximation (computed via Monte Carlo sampling) $\mathrm { D } _ { \mathrm { K L } } ^ { \mathrm { M C } } ( q _ { \phi } | | p )$ in black. Middle row: weighting functions $\Omega ( \theta )$ that mix the shifted known approximation to form the final approximation $F _ { \mathrm { K L } }$ shown in the bottom row (gold), compared against the ground-truth (MC sampled). Each column corresponds to a different value of $\sigma$ . A comparison between ground-truth and our approximation over a large range of $\sigma$ and $\theta$ values is shown in the Appendix in Fig. 4. Note that since the priors are improper, KL approximation and ground-truth can only be compared up to an additive constant $C$ - the constant is irrelevant for network training but has been chosen in the plot such that ground-truth and approximation align for large values of $\theta$ .
|
| 192 |
+
|
| 193 |
+
# 4.1 LENET-5 ON MNIST
|
| 194 |
+
|
| 195 |
+
We demonstrate our method with LeNet- ${ \cdot } 5 ^ { 4 }$ (LeCun et al., 1998) on the MNIST handwritten digits dataset. Images are pre-processed by subtracting the mean and dividing by the standard-deviation over the training set. For the pre-trained network we run 5 epochs on a randomly initialized network (Glorot initialization, Adam optimizer), which leads to a validation accuracy of $9 9 . 2 \%$ . We initialize means $\theta$ with the pre-trained weights and variances with $\log \sigma ^ { 2 } = - 8$ . The warm-up factor $\beta$ is linearly increased from 0 to 1 during the first 15 epochs. VNQ training runs for a total of 195 epochs with a batch-size of 128, the learning rate is linearly decreased from 0.001 to 0 and the learning rate for adjusting the codebook parameter $a$ uses a learning rate that is 100 times lower. We initialize with $a = 0 . 2$ . Results are shown in Table 1, a visualization of the distribution over weights after VNQ training is shown in Fig. 1.
|
| 196 |
+
|
| 197 |
+
We find that VNQ training sufficiently prepares a network for pruning and quantization with negligible loss in accuracy and without requiring subsequent fine-tuning. Training from scratch yields a similar performance compared to initializing with a pre-trained network, with a slightly higher pruning rate. Compared to pruning methods that do not consider few-bit quantization in their objective, we achieve significantly lower pruning rates. This is an interesting observation since our method is based on a similar objective (e.g., compared to Sparse VD) but with the addition of forcing nonpruned weights to tightly cluster around the quantization levels. Few-bit quantization severely limits network capacity. Perhaps this capacity limitation must be countered by pruning fewer weights. Our pruning rates are roughly in line with other papers on ternary quantization, e.g., Zhu et al. (2016), who report sparsity levels between $3 0 \%$ and $5 0 \%$ with their ternary quantization method. Note that
|
| 198 |
+
|
| 199 |
+
Table 1: Results on LeNet-5 (MNIST), showing validation error, percentage of non-pruned weights and bit-precision per parameter. Original is our pre-trained LeNet-5. We show results after VNQ training (without pruning and quantization, denoted by “no P&Q”) where weights were deterministically replaced by the full-precision means $\theta$ and for VNQ training with subsequent pruning and quantization (denoted by “P&Q”). “random init.” denotes training with random weight initialization (Glorot). We also show results of non-ternary or pruning-only methods (P): Deep Compression (Han et al., 2016), Soft weight-sharing (Ullrich et al., 2017), Sparse VD (Molchanov et al., 2017), Bayesian Compression (Louizos et al., 2017) and Stuctured Bayesian Pruning (Neklyudov et al., 2017).
|
| 200 |
+
|
| 201 |
+
<table><tr><td>Method</td><td>val. error [%]</td><td>[u≠0 [%] w</td><td>bits</td></tr><tr><td>Original</td><td>0.8</td><td>100</td><td>32</td></tr><tr><td>VNQ (no P&Q)</td><td>0.67</td><td>100</td><td>32</td></tr><tr><td>VNQ +P&Q</td><td>0.73</td><td>28.3</td><td>2</td></tr><tr><td>VNQ + P&Q (random init.)</td><td>0.73</td><td>17.7</td><td>2</td></tr><tr><td>Deep Compression (P&Q)</td><td>0.74</td><td>8</td><td>5-8</td></tr><tr><td>Soft weight-sharing (P&Q)</td><td>0.97</td><td>0.5</td><td>3</td></tr><tr><td>Sparse VD (P)</td><td>0.75</td><td>0.7</td><td>=</td></tr><tr><td>Bayesian Comp. (P&Q)</td><td>1.0</td><td>0.6</td><td>7-18</td></tr><tr><td>Structured BP (P)</td><td>0.86</td><td>1</td><td>1</td></tr></table>
|
| 202 |
+
|
| 203 |
+
a direct comparison between pruning, quantizing and ternarizing methods is difficult and depends on many factors such that a fair computation of the compression rate that does not implicitly favor certain methods is hardly possible within the scope of this paper. For instance, compression rates for pruning methods are typically reported under the assumption of a CSC storage format which would not fully account for the compression potential of a sparse ternary matrix. We thus choose not to report any measures for compression rates, however for the methods listed in Table 1, they can easily be found in the literature.
|
| 204 |
+
|
| 205 |
+
# 4.2 DENSENET ON CIFAR-10
|
| 206 |
+
|
| 207 |
+
Our second experiment uses a modern DenseNet (Huang et al., 2017) $k = 1 2$ , depth $L = 7 6$ , with bottlenecks) on CIFAR-10 (Krizhevsky & Hinton, 2009). We follow the CIFAR-10 settings of Huang et al. $( 2 0 1 7 ) ^ { 5 }$ . The training procedure is identical to the procedure on MNIST with the following exceptions: we use a batch-size of 64 samples, the warm-up weight $\beta$ of the KL term is 0 for the first 5 epochs and is then linearly ramped up from 0 to 1 over the next 15 epochs, the learning rate of 0.005 is kept constant for the first 50 epochs and then linearly decreased to a value of 0.003 when training stops after 150 epochs. We pre-train a deterministic DenseNet (reaching validation accuracy of $9 3 . 1 9 \%$ ) to initialize VNQ training. The codebook parameter for non-zero values $a$ is initialized with the maximum absolute value over pre-trained weights per layer. Results are shown in Table 2. A visualization of the distribution over weights after VNQ training is shown in the Appendix Fig. 3.
|
| 208 |
+
|
| 209 |
+
We generally observe lower levels of sparsity for DenseNet, compared to LeNet. This might be due to the fact that DenseNet already has an optimized architecture which removed a lot of redundant parameters from the start. In line with previous publications, we generally observed that the first and last layer of the network are most sensitive to pruning and quantization. However, in contrast to many other methods that do not quantize these layers (e.g., Zhu et al. (2016)), we find that after sufficient training, the complete network can be pruned and quantized with very little additional loss in accuracy (see Table 2). Inspecting the weight scatter-plot for the first and last layer (Appendix Fig. 3, top-left and bottom-right panel) it can be seen that some weights did not settle on one of the prior modes (the “funnels”) after VNQ training, particularly the first layer has a few such weights with very low variance. It is likely that quantizing these weights causes the additional loss in accuracy that we observe when quantizing the whole network. Without gradient stopping (i.e., applying gradients to a shadow weight at the trainable clipping boundary) we have observed that pruning and quantizing the first layer leads to a more pronounced drop in accuracy (about $3 \%$ compared to a network where the first layer is kept with full precision, not shown in results).
|
| 210 |
+
|
| 211 |
+
Table 2: Results on DenseNet (CIFAR-10), showing the error on the validation set, the percentage of non-pruned weights and the bit-precision per weight. Original denotes the pre-trained network. We show results after VNQ training without pruning and quantization (weights were deterministically replaced by the full-precision means $\theta$ ) denoted by “no P&Q”, and VNQ with subsequent pruning and quantization denoted by “P&Q” (in the condition “(w/o 1)” we use full-precision means for the weights in the first layer and do not prune and quantize this layer).
|
| 212 |
+
|
| 213 |
+
<table><tr><td>Method</td><td>val error [%]</td><td>[w≠0 [%] w</td><td>bits</td></tr><tr><td>Original</td><td>6.81</td><td>100</td><td>32</td></tr><tr><td>VNQ (no P&Q)</td><td>8.32</td><td>100</td><td>32</td></tr><tr><td>VNQ + P&Q (w/o 1)</td><td>8.78</td><td>46</td><td>2 (32)</td></tr><tr><td>VNQ + P&Q</td><td>8.83</td><td>46</td><td>2</td></tr></table>
|
| 214 |
+
|
| 215 |
+
# 5 RELATED WORK
|
| 216 |
+
|
| 217 |
+
Our method is an extension of Sparse VD (Molchanov et al., 2017), originally used for network pruning. In contrast, we use a quantizing prior, leading to a multi-modal posterior suitable for fewbit quantization and pruning. Bayesian Compression and Structured Bayesian Pruning (Louizos et al., 2017; Neklyudov et al., 2017) extend Sparse VD to prune whole neurons or filters via groupsparsity constraints. Additionally, in Bayesian Compression the required bit-precision per layer is determined via the posterior variance. In contrast to our method, Bayesian Compression does not explicitly enforce clustering of weights during training and thus requires bit-widths in the range between 5 and 18 bits. Extending our method to include group-constraints for pruning is an interesting direction for future work. Another Bayesian method for simultaneous network quantization and pruning is soft weight-sharing (SWS) (Ullrich et al., 2017), which uses a Gaussian mixture model prior (and a KL term without trainable parameters such that the KL term reduces to the prior entropy). SWS acts like a probabilistic version of $\mathbf { k }$ -means clustering with the advantage of automatic collapse of unnecessary mixture components. Similar to learning the codebooks in our method, soft weight-sharing learns the prior from the data, a technique known as empirical Bayes. We cannot directly compare against soft weight-sharing since the authors do not report results on ternary networks. Gal et al. (2017) learn dropout rates by using a continuous relaxation of dropout’s discrete masks (via the concrete distribution). The authors learn layer-wise dropout rates, which does not allow for dropout-rate-based pruning. We experimented with using the concrete distribution for learning codebooks for quantization with promising early results but so far we have observed lower pruning rates or lower accuracy compared to VNQ. A non-probabilistic state-of-the-art method for network ternarization is Trained Ternary Quantization (Zhu et al., 2016) which uses fullprecision shadow weights during training, but quantized forward passes. Additionally it learns a (non-symmetric) scaling per layer for the non-zero quantization values, similar to our learned quantization level $a$ . While the method achieves impressive accuracy, the sparsity and thus pruning rates are rather low (between $3 0 \%$ and $5 0 \%$ sparsity) and the first and last layer need to be kept with full precision.
|
| 218 |
+
|
| 219 |
+
# 6 DISCUSSION
|
| 220 |
+
|
| 221 |
+
A potential shortcoming of our method is the KL divergence approximation (Sec. 3.3). While the approximation is reasonably good on the relevant range of $\theta$ - and $\sigma$ -values, there is still room for improvement which could have the benefit that weights are drawn even more tightly onto the quantization levels, resulting in lower accuracy loss after quantization and pruning. Since our functional approximation to the KL divergence only needs to be computed once and an arbitrary amount of ground-truth data can be produced, it should be possible to improve upon the approximation presented here at least by some brute-force function approximation, e.g., a neural network, polynomial or kernel regression. The main difficulty is that the resulting approximation must be differentiable and must not introduce significant computational overhead since the approximation is evaluated once for each network parameter in each gradient step. We have also experimented with a naive Monte-Carlo approximation of the KL divergence term. This has the disadvantage that local reparameterization (where pre-activations are sampled directly) can no longer be used, since weight samples are required for the MC approximation. To keep computational complexity comparable, we used a single sample for the MC approximation. In our LeNet-5 on MNIST experiment the MC approximation achieves comparable accuracy with higher pruning rates compared to our functional KL approximation. However, with DenseNet on CIFAR-10 and the MC approximation validation accuracy plunges catastrophically after pruning and quantization. See Sec. A.3 in the Appendix for more details. Compared to similar methods that only consider network pruning, our pruning rates are significantly lower. This does not seem to be a particular problem of our method since other papers on network ternarization report similar or even lower sparsity levels (Zhu et al. (2016) roughly achieve between $3 0 \%$ and $5 0 \%$ sparsity). The reason for this might be that heavily quantized networks have a much lower capacity compared to full-precision networks. This limited capacity might require that the network compensates by effectively using more weights such that the pruning rates become significantly lower. Similar trends have also been observed with binary networks, where drops in accuracy could be prevented by increasing the number of neurons (with binary weights) per layer. Principled experiments to test the trade-off between low bit-precision and sparsity rates would be an interesting direction for future work. One starting point could be to test our method with more quantization levels (e.g., 5, 7 or 9) and investigate how this affects the pruning rate.
|
| 222 |
+
|
| 223 |
+
# REFERENCES
|
| 224 |
+
|
| 225 |
+
David F Andrews and Colin L Mallows. Scale mixtures of normal distributions. Journal of the Royal Statistical Society. Series B (Methodological), pp. 99–102, 1974.
|
| 226 |
+
Charles Blundell, Julien Cornebise, Koray Kavukcuoglu, and Daan Wierstra. Weight uncertainty in neural networks. arXiv preprint arXiv:1505.05424, 2015.
|
| 227 |
+
Matthieu Courbariaux, Itay Hubara, Daniel Soudry, Ran El-Yaniv, and Yoshua Bengio. Binarized neural networks: Training deep neural networks with weights and activations constrained $\mathrm { t o } + 1$ or-1. arXiv preprint arXiv:1602.02830, 2016.
|
| 228 |
+
Thomas M Cover and Joy A Thomas. Elements of information theory. John Wiley & Sons, 2006.
|
| 229 |
+
Misha Denil, Babak Shakibi, Laurent Dinh, Nando de Freitas, et al. Predicting parameters in deep learning. In Advances in Neural Information Processing Systems, pp. 2148–2156, 2013.
|
| 230 |
+
Stefan Depeweg, Jose Miguel Hern ´ andez-Lobato, Finale Doshi-Velez, and Steffen Udluft. Learning ´ and policy search in stochastic dynamical systems with bayesian neural networks. arXiv preprint arXiv:1605.07127, 2016.
|
| 231 |
+
Stefan Depeweg, Jose Miguel Hern ´ andez-Lobato, Finale Doshi-Velez, and Steffen Udluft. Un- ´ certainty decomposition in bayesian neural networks with latent variables. arXiv preprint arXiv:1706.08495, 2017.
|
| 232 |
+
Mario Figueiredo. Adaptive sparseness using jeffreys prior. In ´ Advances in neural information processing systems, pp. 697–704, 2002.
|
| 233 |
+
Yarin Gal. Uncertainty in deep learning. PhD thesis, PhD thesis, University of Cambridge, 2016.
|
| 234 |
+
Yarin Gal and Zoubin Ghahramani. Dropout as a Bayesian approximation: Representing model uncertainty in deep learning. arXiv:1506.02142, 2015.
|
| 235 |
+
Yarin Gal, Jiri Hron, and Alex Kendall. Concrete dropout. arXiv preprint arXiv:1705.07832, 2017.
|
| 236 |
+
Tim Genewein and Daniel A Braun. Occam’s razor in sensorimotor learning. Proceedings of the Royal Society of London B: Biological Sciences, 281(1783):20132952, 2014.
|
| 237 |
+
|
| 238 |
+
Tim Genewein, Felix Leibfried, Jordi Grau-Moya, and Daniel Alexander Braun. Bounded rationality, abstraction, and hierarchical decision-making: An information-theoretic optimality principle. Frontiers in Robotics and AI, 2:27, 2015.
|
| 239 |
+
|
| 240 |
+
Alex Graves. Practical variational inference for neural networks. In NIPS, pp. 2348–2356, 2011.
|
| 241 |
+
|
| 242 |
+
Peter D Grunwald. ¨ The minimum description length principle. MIT press, 2007.
|
| 243 |
+
|
| 244 |
+
Yiwen Guo, Anbang Yao, and Yurong Chen. Dynamic network surgery for efficient dnns. In Advances In Neural Information Processing Systems, pp. 1379–1387, 2016.
|
| 245 |
+
|
| 246 |
+
Song Han, Huizi Mao, and William J Dally. Deep compression: Compressing deep neural networks with pruning, trained quantization and huffman coding. ICLR 2016, 2016.
|
| 247 |
+
|
| 248 |
+
Song Han, Jeff Pool, Sharan Narang, Huizi Mao, Shijian Tang, Erich Elsen, Bryan Catanzaro, John Tran, and William J Dally. Dsd: Regularizing deep neural networks with dense-sparse-dense training flow. ICLR 2017, 2017.
|
| 249 |
+
|
| 250 |
+
Babak Hassibi and David G Stork. Second order derivatives for network pruning: Optimal brain surgeon. In Advances in Neural Information Processing Systems, pp. 164–171, 1993.
|
| 251 |
+
|
| 252 |
+
Jose Miguel Hern ´ andez-Lobato and Ryan Adams. Probabilistic backpropagation for scalable learn- ´ ing of bayesian neural networks. In International Conference on Machine Learning, pp. 1861– 1869, 2015.
|
| 253 |
+
|
| 254 |
+
Matthew D Hoffman and Matthew J Johnson. Elbo surgery: yet another way to carve up the variational evidence lower bound. In Workshop in Advances in Approximate Bayesian Inference, NIPS 2016, 2016.
|
| 255 |
+
|
| 256 |
+
Matthew D Hoffman, Carlos Riquelme, and Matthew J Johnson. The beta-vaes implicit prior. In Workshop on Bayesian deep learning, NIPS 2017, 2017.
|
| 257 |
+
|
| 258 |
+
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.
|
| 259 |
+
|
| 260 |
+
Gao Huang, Zhuang Liu, Laurens van der Maaten, and Kilian Q Weinberger. Densely connected convolutional networks. 2017.
|
| 261 |
+
|
| 262 |
+
Itay Hubara, Matthieu Courbariaux, Daniel Soudry, Ran El-Yaniv, and Yoshua Bengio. Quantized neural networks: Training neural networks with low precision weights and activations. arXiv preprint arXiv:1609.07061, 2016.
|
| 263 |
+
|
| 264 |
+
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¡ $0 . 5 \mathrm { m b }$ model size. arXiv preprint arXiv:1602.07360, 2016.
|
| 265 |
+
|
| 266 |
+
John Ingraham and Debora Marks. Variational inference for sparse and undirected models. In International Conference on Machine Learning, pp. 1607–1616, 2017.
|
| 267 |
+
|
| 268 |
+
Theofanis Karaletsos and Gunnar Ratsch. Automatic relevance determination for deep generative ¨ models. arXiv preprint arXiv:1505.07765, 2015.
|
| 269 |
+
|
| 270 |
+
Diederik P Kingma and Max Welling. Auto-encoding variational bayes. ICLR, 2014.
|
| 271 |
+
|
| 272 |
+
Diederik P Kingma, Tim Salimans, and Max Welling. Variational dropout and the local reparameterization trick. In Advances in Neural Information Processing Systems, pp. 2575–2583, 2015.
|
| 273 |
+
|
| 274 |
+
Alex Krizhevsky and Geoffrey Hinton. Learning multiple layers of features from tiny images. 2009.
|
| 275 |
+
|
| 276 |
+
Yann LeCun, John S. Denker, and Sara A. Solla. Optimal brain damage. In D. S. Touretzky (ed.), Advances in Neural Information Processing Systems, pp. 598–605. 1990.
|
| 277 |
+
|
| 278 |
+
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.
|
| 279 |
+
|
| 280 |
+
Fengfu Li, Bo Zhang, and Bin Liu. Ternary weight networks. arXiv preprint arXiv:1605.04711, 2016.
|
| 281 |
+
|
| 282 |
+
Christos Louizos, Karen Ullrich, and Max Welling. Bayesian compression for deep learning. Advances in Neural Information Processing Systems, 2017.
|
| 283 |
+
|
| 284 |
+
David JC MacKay. Probable networks and plausible predictions - a review of practical bayesian methods for supervised neural networks. Network: Computation in Neural Systems, 6(3):469– 505, 1995.
|
| 285 |
+
|
| 286 |
+
David JC MacKay. Information theory, inference and learning algorithms. Cambridge university press, 2003.
|
| 287 |
+
|
| 288 |
+
Toby J Mitchell and John J Beauchamp. Bayesian variable selection in linear regression. Journal of the American Statistical Association, 83(404):1023–1032, 1988.
|
| 289 |
+
|
| 290 |
+
Dmitry Molchanov, Arsenii Ashukha, and Dmitry Vetrov. Variational dropout sparsifies deep neural networks. ICML 2017, 2017.
|
| 291 |
+
|
| 292 |
+
Radford M Neal. Bayesian Learning for Neural Networks. PhD thesis, University of Toronto, 1995.
|
| 293 |
+
|
| 294 |
+
Kirill Neklyudov, Dmitry Molchanov, Arsenii Ashukha, and Dmitry Vetrov. Structured bayesian pruning via log-normal multiplicative noise. arXiv preprint arXiv:1705.07283, 2017.
|
| 295 |
+
|
| 296 |
+
Mohammad Rastegari, Vicente Ordonez, Joseph Redmon, and Ali Farhadi. Xnor-net: Imagenet classification using binary convolutional neural networks. In European Conference on Computer Vision, pp. 525–542. Springer, 2016.
|
| 297 |
+
|
| 298 |
+
Jorma Rissanen. Modeling by shortest data description. Automatica, 14(5):465–471, 1978.
|
| 299 |
+
|
| 300 |
+
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.
|
| 301 |
+
|
| 302 |
+
Daniel Soudry, Itay Hubara, and Ron Meir. Expectation backpropagation: Parameter-free training of multilayer neural networks with continuous or discrete weights. In Advances in Neural Information Processing Systems, pp. 963–971, 2014.
|
| 303 |
+
|
| 304 |
+
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.
|
| 305 |
+
|
| 306 |
+
Vivienne Sze, Yu-Hsin Chen, Tien-Ju Yang, and Joel Emer. Efficient processing of deep neural networks: A tutorial and survey. arXiv preprint arXiv:1703.09039, 2017.
|
| 307 |
+
|
| 308 |
+
Naftali Tishby, Fernando C Pereira, and William Bialek. The information bottleneck method. arXiv preprint physics/0004057, 2000.
|
| 309 |
+
|
| 310 |
+
Jakub M Tomczak and Max Welling. Vae with a vampprior. arXiv preprint arXiv:1705.07120, 2017.
|
| 311 |
+
|
| 312 |
+
Karen Ullrich, Edward Meeds, and Max Welling. Soft weight-sharing for neural network compression. ICLR 2017, 2017.
|
| 313 |
+
|
| 314 |
+
Sida Wang and Christopher Manning. Fast dropout training. In Proceedings of the 30th International Conference on Machine Learning (ICML-13), pp. 118–126, 2013.
|
| 315 |
+
|
| 316 |
+
Max Welling and Yee W Teh. Bayesian learning via stochastic gradient langevin dynamics. In Proceedings of the 28th International Conference on Machine Learning (ICML-11), pp. 681–688, 2011.
|
| 317 |
+
|
| 318 |
+
Shuchang Zhou, Yuxin Wu, Zekun Ni, Xinyu Zhou, He Wen, and Yuheng Zou. Dorefa-net: Training low bitwidth convolutional neural networks with low bitwidth gradients. arXiv preprint arXiv:1606.06160, 2016.
|
| 319 |
+
|
| 320 |
+
Chenzhuo Zhu, Song Han, Huizi Mao, and William J Dally. Trained ternary quantization. arXiv preprint arXiv:1612.01064, 2016.
|
| 321 |
+
|
| 322 |
+
A APPENDIX
|
| 323 |
+
|
| 324 |
+
A.1 VISUALIZATION OF DENSENET WEIGHTS AFTER VNQ TRAINING
|
| 325 |
+
|
| 326 |
+
See Fig. 3.
|
| 327 |
+
|
| 328 |
+

|
| 329 |
+
Figure 3: Visualization of distribution over DenseNet weights after training on CIFAR-10 with VNQ. Each panel shows one (convolutional or dense) layer, starting in the top-left corner with the input- and ending with the final layer in the bottom-right panel (going row-wise, that is first moving to the right as layers increase). The validation accuracy of the network shown is $9 1 . 6 8 \%$ before pruning and quantization and $9 1 . 1 7 \%$ after pruning and quantization.
|
| 330 |
+
|
| 331 |
+
# A.2 LOCAL REPARAMETERIZATION
|
| 332 |
+
|
| 333 |
+
We follow Sparse VD (Molchanov et al., 2017) and use the Local Reparameterization Trick (Kingma et al., 2015) and Additive Noise Reparmetrization to optimize the stochastic gradient variational lower bound $\mathcal { L } ^ { \mathrm { S G V B } }$ (Eq. (2)). We optimize posterior means and log-variances $( \theta , \log \sigma ^ { 2 } )$ and the codebook level $a$ . We apply Variational Network Quantization to fully connected and convolutional layers. Denoting inputs to a layer with $A ^ { M \times I }$ , outputs of a layer with $B ^ { M \times O }$ and using local reparameterization we get:
|
| 334 |
+
|
| 335 |
+
$$
|
| 336 |
+
b _ { m j } \sim { \mathcal { N } } ( \gamma _ { m j } , \delta _ { m j } ) ; \gamma _ { m j } = \sum _ { i = 1 } ^ { I } a _ { m i } \theta _ { i j } , \delta _ { m j } = \sum _ { i = 1 } ^ { I } a _ { m i } ^ { 2 } \sigma _ { i j } ^ { 2 }
|
| 337 |
+
$$
|
| 338 |
+
|
| 339 |
+
for a fully connected layer. Similarly activations for a convolutional layer are computed as follows
|
| 340 |
+
|
| 341 |
+
$$
|
| 342 |
+
\mathrm { v e c } ( b _ { m k } ) \sim \mathcal { N } ( \gamma _ { m k } , \delta _ { m k } ) ; \gamma _ { m k } = \mathrm { v e c } ( A _ { m } * \theta _ { k } ) , \delta _ { m k } = \mathrm { d i a g } ( \mathrm { v e c } ( A _ { m } ^ { 2 } * \sigma _ { k } ^ { 2 } ) ) ,
|
| 343 |
+
$$
|
| 344 |
+
|
| 345 |
+
where $( \cdot ) ^ { 2 }$ denotes an element-wise operation, $^ *$ is the convolution operation and $\mathrm { v e c } ( \cdot )$ denotes reshaping of a matrix/tensor into a vector.
|
| 346 |
+
|
| 347 |
+
# A.3 KL APPROXIMATION FOR QUANTIZING PRIOR
|
| 348 |
+
|
| 349 |
+
Under the quantizing prior (Eq. (12)) the KL divergence from the log uniform prior to the meanfield posterior $D _ { \mathrm { K L } } ( q _ { \phi } ( w _ { i j } ) | | p ( w _ { i j } ) )$ is analytically intractable. Molchanov et al. (2017) presented an approximation for the KL divergence under a (zero-centered) log uniform prior (Eq. (5)). Since our quantizing prior is essentially a composition of shifted log uniform priors, we construct a composition of the approximation given by Molchanov et al. (2017), shown in Eq. (7). The original approximation can be utilized to calculate a KL divergence approximation (up to an additive constant $\tilde { C }$ ) from a shifted log-uniform prior $\begin{array} { r } { p ( w _ { i j } ) \ \propto \ \frac { 1 } { | w _ { i j } - r | } } \end{array}$ to a Gaussian posterior $q _ { \phi } ( w _ { i j } )$ by transferring the shift to the posterior parameter $\theta$
|
| 350 |
+
|
| 351 |
+
$$
|
| 352 |
+
D _ { \mathrm { K L } } \left( q _ { \{ \theta _ { i j } , \sigma _ { i j } \} } | | p ( w _ { i j } ) \propto \frac { 1 } { | w _ { i j } - r | } \right) = D _ { \mathrm { K L } } \left( q _ { \{ \theta _ { i j } - r , \sigma _ { i j } \} } ( w _ { i j } ) | | p ( w _ { i j } ) \propto \frac { 1 } { | w _ { i j } | } \right) + \tilde { C } ,
|
| 353 |
+
$$
|
| 354 |
+
|
| 355 |
+
For small posterior variances $\sigma _ { i j } ^ { 2 }$ $( \sigma _ { i j } \ll r )$ and means near the quantization levels (i.e., $| \theta _ { i j } | \approx r )$ , the KL divergence is dominated by the mixture prior component located at the respective quantization level $r$ . For these values of $\theta$ and $\sigma$ , the KL divergence can be approximated by shifting the approximation $F _ { \mathrm { L U , K L } } ( \theta , \sigma )$ to the quantization level $r$ , i.e., $F _ { \mathrm { L U , K L } } ( \theta \pm r , \sigma )$ . For small $\sigma$ and values of $\theta$ near zero or far away from any quantization level, as well as for large values of $\sigma$ and arbitrary $\theta$ , the KL divergence can be approximated by the original non-shifted approximation $F _ { \mathrm { L U , K L } } ( \theta , \sigma )$ . Based on these observations we construct our KL approximation by properly mixing shifted versions of $F _ { \mathrm { L U , K L } } ( \theta \pm r , \sigma )$ . We use Gaussian window functions $\Omega ( \theta \pm r )$ to perform this weighting (to ensure differentiability). The remaining $\theta$ domain is covered by an approximation located at zero and weighted such that this approximation is dominant near zero and far away from the quantization levels, which is achieved by introducing the constraint that all window functions sum up to one on the full $\theta$ domain. See Fig. 2 for a visual representation of shifted approximations and their respective window functions.
|
| 356 |
+
|
| 357 |
+
# A.3.1 APPROXIMATION QUALITY
|
| 358 |
+
|
| 359 |
+
We evaluate the quality of our KL approximation (Eq. (16)) by comparing against a ground-truth Monte Carlo approximation on a dense grid over the full range of relevant $\theta$ and $\sigma$ values. Results of this comparison are shown in Fig. 4. Alternatively to the functional KL approximation, one could also use a naive Monte Carlo approximation directly. This has the disadvantage that local reparameterization can no longer be used, since actual samples of the weights must be drawn. To assess the quality of our functional KL approximation, we also compare against experiments where we use a naive MC approximation of the KL divergence term, where we only use a single sample for approximating the expectation to keep computational complexity comparable to our original method. Note that the “ground-truth” MC approximation used before to evaluate KL approximation quality uses many more samples which would be prohibitively expensive during training. To test for the effect of local reparameterization in isolation we also show results for our functional KL approximation without using local reparameterization. The results in Table 3 show that the naive MC approximation of the KL term leads to slightly lower validation error on MNIST (LeNet-5) (with higher pruning rates) but on CIFAR-10 (DenseNet) the validation error of the network trained with the naive MC approximation catastrophically increases after pruning and quantizing the network. Except for removing local reparameterization or plugging in the naive MC approximation, experiments were ran as described in Sec. 4.
|
| 360 |
+
|
| 361 |
+

|
| 362 |
+
Figure 4: Quantitative analysis of the KL approxmiation quality. The top panel shows the “groundtruth” (computed via computationally expensive Monte Carlo approximation), the middle panel shows our approxiomation (Eq. (16)) and the bottom panel shows the difference between both. The maximum absolute error between our approximation and the ground-truth is 1.07 nats.
|
| 363 |
+
|
| 364 |
+
Table 3: Comparing the effects of local reparameterization and naive MC approximation of the KL divergence. “func. KL approx” denotes our functional approximation of the KL divergence given by Eq. (16). “naive MC approx” denotes a naive Monte Carlo approximation that uses a single sample only. The first column of results shows the validation error after training, but without pruning and quantization (no P&Q), the next column shows results after pruning and quantization (results in brackets correspond to the validation error without pruning and quantizing the first layer).
|
| 365 |
+
|
| 366 |
+
<table><tr><td> Setting</td><td>val. error no P&Q [%]</td><td>val. error P&Q [%]</td><td>[u0 [%] w</td></tr><tr><td>LeNet-5 on MNIST</td><td></td><td></td><td>28.3</td></tr><tr><td>local reparam, func. KL approx no local reparam, func. KL approx</td><td>0.67 0.69</td><td>0.73 0.91</td><td>12.4</td></tr><tr><td>no local reparam, naive MC approx</td><td>0.6</td><td>0.69</td><td>8.8</td></tr><tr><td>DenseNet on CIFAR-10</td><td></td><td></td><td></td></tr><tr><td>local reparam, func. KL approx no local reparam, naive MC approx</td><td>8.32 20.75</td><td>8.83 (8.78) 77.71 (75.74)</td><td>46 60.7</td></tr></table>
|
| 367 |
+
|
| 368 |
+
Inspecting the distribution over weights after training with the naive MC approximation for the KL divergence, shown in Fig. 5 for LeNet-5 and in Fig. 6 for DenseNet, reveals that weight-means tend to be more dispersed and weight-variances tend to be generally lower than when training with our functional KL approximation (compare Fig. 1 for LeNet-5 and Fig. 3 for DenseNet). We speculate that the combined effects of missing local reparameterization and single-sample MC approximation lead to more noisy gradients.
|
| 369 |
+
|
| 370 |
+

|
| 371 |
+
|
| 372 |
+
(a) No local reprametrization, functional KL approximation given by Eq. (16).
|
| 373 |
+
|
| 374 |
+

|
| 375 |
+
(b) No local reparameterization, naive MC approximation for KL divergence.
|
| 376 |
+
Figure 5: Distribution of weights after training without local reparameterization but with functional KL approximation (a) and after training with naive MC approximation (b). Top rows: scatter plot of weights (blue dots) per layer. Bottom row: corresponding density.
|
| 377 |
+
|
| 378 |
+

|
| 379 |
+
Figure 6: Visualization of distribution over DenseNet weights after training on CIFAR-10 with naive MC approximation for the KL divergence (and without local reparameterization). Each panel shows one layer, starting in the top-left corner with the input- and ending with the final layer in the bottomright panel (going row-wise, that is first moving to the right as layers increase). Validation accuracy before pruning and quantization is $7 9 . 2 5 \%$ but plunges to $2 2 . 2 9 \%$ after pruning and quantization.
|
| 380 |
+
|
| 381 |
+
# A.4 REUSING THE KL APPROXIMATION FOR ARBITRARY CODEBOOKS
|
| 382 |
+
|
| 383 |
+
We show that the KL approximation (Eq. (16)), developed for a fixed reference codebook, can be reused for arbitrary codebooks as long as codebook learning is restricted to learning a multiplicative scaling factor. Without loss of generality we consider the case of ternary, symmetric codebooks6
|
| 384 |
+
|
| 385 |
+
$$
|
| 386 |
+
c _ { r } = [ - r , 0 , r ] ; \quad p _ { c _ { r } } ( w ) = \sum _ { k = 1 } ^ { 3 } \frac { a _ { k } } { | w - c _ { r , k } | }
|
| 387 |
+
$$
|
| 388 |
+
|
| 389 |
+
where $r \in \mathbb { R } ^ { + }$ is the quantization level value and $p _ { c _ { r } }$ denotes a sparsity-inducing, quantizing prior over weights (sparsity is induced because one of the codebook entries is fixed to 0). We denote $c _ { r }$ as the reference codebook for which we design the KL approximation $D _ { \mathrm { K L } } ( q _ { \phi } ( w ) | | p _ { c _ { r } } ) ~ =$ $F _ { \mathrm { K L } } ( \theta , \sigma , c _ { r } )$ (Eq. (16)). This approximation can be reused for any symmetric ternary codebook $c _ { a } = [ - a , 0 , a ]$ with quantization level $a \in \mathbb { R } ^ { + }$ . The latter can be seen by representing $c _ { a }$ with the reference codebook and a positive scaling factor $s > 0$ as $c _ { a } = s c _ { r }$ , $s = a / r$ . This re-scaling translates into a multiplicative re-scaling of the variational parameters $\theta$ and $\sigma$ . To see this, consider the prior $p _ { c _ { a } }$ , based on codebook $c _ { a }$ :
|
| 390 |
+
|
| 391 |
+
$$
|
| 392 |
+
{ p _ { c } } _ { a } ( w ) = \frac { 1 } { Z } \sum _ { k = 1 } ^ { 3 } \frac { a _ { k } } { | w - c _ { a , k } | } = \frac { 1 } { Z } \sum _ { k = 1 } ^ { 3 } \frac { a _ { k } } { | w - s c _ { r , k } | } .
|
| 393 |
+
$$
|
| 394 |
+
|
| 395 |
+
The KL divergence from a prior based on the codebook $c _ { a }$ to the posterior $q _ { \phi } ( w )$ is given by
|
| 396 |
+
|
| 397 |
+
$$
|
| 398 |
+
\begin{array} { r l } { D _ { \mathrm { K L } } ( q _ { \phi } ( w ) | | p _ { c _ { \alpha } } ( w ) ) = \displaystyle \int q _ { \phi } ( w ) \log \frac { q _ { \phi } ( w ) } { \sum _ { k = 1 } ^ { 3 } \frac { a _ { k } } { | w - c _ { \alpha , k } | } } \mathrm { d } w + C } \\ { \displaystyle } & { = \int q _ { \phi } ( w ) \log \frac { q _ { \phi } ( w ) } { \frac { 1 } { s } \sum _ { k = 1 } ^ { 3 } \frac { a _ { k } } { | \frac { w } { s } - c _ { \tau , k } | } } \mathrm { d } w + C \qquad | \mathrm { s u b s t . } z = \frac { w } { s } , \mathrm { d } w = s \mathrm { d } z } \\ { \displaystyle } & { = \int q _ { \phi } ( s z ) \log \frac { q _ { \phi } ( s z ) } { \frac { 1 } { s } \sum _ { k = 1 } ^ { 3 } \frac { a _ { k } } { | z - c _ { \tau , k } | } } s \mathrm { d } z + C . } \end{array}
|
| 399 |
+
$$
|
| 400 |
+
|
| 401 |
+
Since $q _ { \theta } ( s z )$ is Gaussian, the scaling $s$ can be transfered into the variational parameters $\phi = \left( \theta , \sigma \right)$ :
|
| 402 |
+
|
| 403 |
+
$$
|
| 404 |
+
q _ { \phi } ( s z ) = \mathcal { N } ( s ; \theta , \sigma ^ { 2 } ) = \frac { 1 } { s } \mathcal { N } ( z ; \frac { \theta } { s } , \frac { \sigma ^ { 2 } } { s ^ { 2 } } ) = \frac { 1 } { s } q _ { \hat { \phi } } ( z ) ,
|
| 405 |
+
$$
|
| 406 |
+
|
| 407 |
+
with $\begin{array} { r } { \hat { \phi } = \bigl ( \frac { \theta } { s } , \frac { \sigma } { s } \bigr ) } \end{array}$ . Inserting into Eq. (21) yields:
|
| 408 |
+
|
| 409 |
+
$$
|
| 410 |
+
\begin{array} { l } { \displaystyle D _ { \mathrm { K L } } ( q _ { \phi } ( w ) | | p _ { c _ { a } } ( w ) ) = \int \frac { 1 } { s } q _ { \hat { \phi } } ( z ) \log \frac { \frac { 1 } { s } q _ { \hat { \phi } } ( z ) } { \frac { 1 } { s } \sum _ { k = 1 } ^ { 3 } \frac { a _ { k } } { | z - c _ { r , k } | } } s \mathrm { d } z + C . } \\ { = \displaystyle \int q _ { \hat { \phi } } ( z ) \log \frac { q _ { \hat { \phi } } ( z ) } { \sum _ { k = 1 } ^ { 3 } \frac { a _ { k } } { | z - c _ { r , k } | } } \mathrm { d } z + C . } \\ { = D _ { \mathrm { K L } } ( q _ { \hat { \phi } } ( w ) | | p _ { c _ { r } } ( w ) ) + C . } \end{array}
|
| 411 |
+
$$
|
| 412 |
+
|
| 413 |
+
Thus, $D _ { \mathrm { K L } } ( q _ { \phi } ( w ) | | p _ { c _ { a } } ( w ) ) = D _ { \mathrm { K L } } ( q _ { \hat { \phi } } ( w ) | | p _ { c _ { r } } ( w ) ) + C \approx F _ { \mathrm { K L } } ( \theta / s , \sigma / s , c _ { r } )$ , where $F _ { \mathrm { K L } }$ is given by Eq. (16). This means that the $\mathrm { K L }$ approximation can be used for arbitrary ternary, symmetric codebooks of the form $c _ { a } = [ - a , 0 , a ] = { \dot { s } } c _ { r }$ because the scaling factor $s$ translates into a re-scaling of the variational parameters $\begin{array} { r } { \hat { \phi } = \left( \frac { \theta } { s } , \frac { \sigma } { s } \right) } \end{array}$ .
|
md/train/ry_WPG-A-/ry_WPG-A-.md
ADDED
|
@@ -0,0 +1,384 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# ON THE INFORMATION BOTTLENECK THEORY OF DEEP LEARNING
|
| 2 |
+
|
| 3 |
+
Andrew M. Saxe, Yamini Bansal, Joel Dapello, Madhu Advani
|
| 4 |
+
Harvard University
|
| 5 |
+
{asaxe,madvani}@fas.harvard.edu,{ybansal,dapello}@g.harvard.edu
|
| 6 |
+
|
| 7 |
+
Artemy Kolchinsky, Brendan D. Tracey
|
| 8 |
+
|
| 9 |
+
Santa Fe Institute {artemyk,tracey.brendan}@gmail.com
|
| 10 |
+
|
| 11 |
+
David D. Cox
|
| 12 |
+
Harvard University
|
| 13 |
+
MIT-IBM Watson AI Lab
|
| 14 |
+
davidcox@fas.harvard.edu
|
| 15 |
+
david.d.cox@ibm.com
|
| 16 |
+
|
| 17 |
+
# ABSTRACT
|
| 18 |
+
|
| 19 |
+
The practical successes of deep neural networks have not been matched by theoretical progress that satisfyingly explains their behavior. In this work, we study the information bottleneck (IB) theory of deep learning, which makes three specific claims: first, that deep networks undergo two distinct phases consisting of an initial fitting phase and a subsequent compression phase; second, that the compression phase is causally related to the excellent generalization performance of deep networks; and third, that the compression phase occurs due to the diffusion-like behavior of stochastic gradient descent. Here we show that none of these claims hold true in the general case. Through a combination of analytical results and simulation, we demonstrate that the information plane trajectory is predominantly a function of the neural nonlinearity employed: double-sided saturating nonlinearities like tanh yield a compression phase as neural activations enter the saturation regime, but linear activation functions and single-sided saturating nonlinearities like the widely used ReLU in fact do not. Moreover, we find that there is no evident causal connection between compression and generalization: networks that do not compress are still capable of generalization, and vice versa. Next, we show that the compression phase, when it exists, does not arise from stochasticity in training by demonstrating that we can replicate the IB findings using full batch gradient descent rather than stochastic gradient descent. Finally, we show that when an input domain consists of a subset of task-relevant and task-irrelevant information, hidden representations do compress the task-irrelevant information, although the overall information about the input may monotonically increase with training time, and that this compression happens concurrently with the fitting process rather than during a subsequent compression period.
|
| 20 |
+
|
| 21 |
+
# 1 INTRODUCTION
|
| 22 |
+
|
| 23 |
+
Deep neural networks (Schmidhuber, 2015; LeCun et al., 2015) are the tool of choice for real-world tasks ranging from visual object recognition (Krizhevsky et al., 2012), to unsupervised learning (Goodfellow et al., 2014; Lotter et al., 2016) and reinforcement learning (Silver et al., 2016). These practical successes have spawned many attempts to explain the performance of deep learning systems (Kadmon & Sompolinsky, 2016), mostly in terms of the properties and dynamics of the optimization problem in the space of weights (Saxe et al., 2014; Choromanska et al., 2015; Advani & Saxe, 2017), or the classes of functions that can be efficiently represented by deep networks (Montufar et al., 2014; Poggio et al., 2017). This paper analyzes a recent inventive proposal to study the dynamics of learning through the lens of information theory (Tishby & Zaslavsky, 2015; Shwartz-Ziv & Tishby, 2017). In this view, deep learning is a question of representation learning: each layer of a deep neural network can be seen as a set of summary statistics which contain some but not all of the information present in the input, while retaining as much information about the target output as possible. The amount of information in a hidden layer regarding the input and output can then be measured over the course of learning, yielding a picture of the optimization process in the information plane. Crucially, this method holds the promise to serve as a general analysis that can be used to compare different architectures, using the common currency of mutual information. Moreover, the elegant information bottleneck (IB) theory provides a fundamental bound on the amount of input compression and target output information that any representation can achieve (Tishby et al., 1999). The IB bound thus serves as a method-agnostic ideal to which different architectures and algorithms may be compared.
|
| 24 |
+
|
| 25 |
+
A preliminary empirical exploration of these ideas in deep neural networks has yielded striking findings (Shwartz-Ziv & Tishby, 2017). Most saliently, trajectories in the information plane appear to consist of two distinct phases: an initial “fitting” phase where mutual information between the hidden layers and both the input and output increases, and a subsequent “compression” phase where mutual information between the hidden layers and the input decreases. It has been hypothesized that this compression phase is responsible for the excellent generalization performance of deep networks, and further, that this compression phase occurs due to the random diffusion-like behavior of stochastic gradient descent.
|
| 26 |
+
|
| 27 |
+
Here we study these phenomena using a combination of analytical methods and simulation. In Section 2, we show that the compression observed by Shwartz-Ziv & Tishby (2017) arises primarily due to the double-saturating tanh activation function used. Using simple models, we elucidate the effect of neural nonlinearity on the compression phase. Importantly, we demonstrate that the ReLU activation function, often the nonlinearity of choice in practice, does not exhibit a compression phase. We discuss how this compression via nonlinearity is related to the assumption of binning or noise in the hidden layer representation. To better understand the dynamics of learning in the information plane, in Section 3 we study deep linear networks in a tractable setting where the mutual information can be calculated exactly. We find that deep linear networks do not compress over the course of training for the setting we examine. Further, we show a dissociation between generalization and compression. In Section 4, we investigate whether stochasticity in the training process causes compression in the information plane. We train networks with full batch gradient descent, and compare the results to those obtained with stochastic gradient descent. We find comparable compression in both cases, indicating that the stochasticity of SGD is not a primary factor in the observed compression phase. Moreover, we show that the two phases of SGD occur even in networks that do not compress, demonstrating that the phases are not causally related to compression. These results may seem difficult to reconcile with the intuition that compression can be necessary to attain good performance: if some input channels primarily convey noise, good generalization requires excluding them. Therefore, in Section 5 we study a situation with explicitly task-relevant and task-irrelevant input dimensions. We show that the hidden-layer mutual information with the task-irrelevant subspace does indeed drop during training, though the overall information with the input increases. However, instead of a secondary compression phase, this task-irrelevant information is compressed at the same time that the taskrelevant information is boosted. Our results highlight the importance of noise assumptions in applying information theoretic analyses to deep learning systems, and put in doubt the generality of the IB theory of deep learning as an explanation of generalization performance in deep architectures.
|
| 28 |
+
|
| 29 |
+
# 2 COMPRESSION AND NEURAL NONLINEARITIES
|
| 30 |
+
|
| 31 |
+
The starting point for our analysis is the observation that changing the activation function can markedly change the trajectory of a network in the information plane. In Figure 1A, we show our replication of the result reported by Shwartz-Ziv & Tishby (2017) for networks with the tanh nonlinearity.1 This replication was performed with the code supplied by the authors of Shwartz-Ziv & Tishby (2017), and closely follows the experimental setup described therein. Briefly, a neural network with 7 fully connected hidden layers of width 12-10-7-5-4-3-2 is trained with stochastic gradient descent to produce a binary classification from a 12-dimensional input. In our replication we used 256 randomly selected samples per batch. The mutual information of the network layers with respect to the input and output variables is calculated by binning the neuron’s tanh output activations into 30 equal intervals between -1 and 1. Discretized values for each neuron in each layer are then used to directly calculate the joint distributions, over the 4096 equally likely input patterns and true output labels. In line with prior work (Shwartz-Ziv & Tishby, 2017), the dynamics in Fig. 1 show a transition between an initial fitting phase, during which information about the input increases, and a subsequent compression phase, during which information about the input decreases.
|
| 32 |
+
|
| 33 |
+

|
| 34 |
+
Figure 1: Information plane dynamics and neural nonlinearities. (A) Replication of Shwartz-Ziv & Tishby (2017) for a network with tanh nonlinearities (except for the final classification layer which contains two sigmoidal neurons). The $\mathbf { X }$ -axis plots information between each layer and the input, while the y-axis plots information between each layer and the output. The color scale indicates training time in epochs. Each of the six layers produces a curve in the information plane with the input layer at far right, output layer at the far left. Different layers at the same epoch are connected by fine lines. (B) Information plane dynamics with ReLU nonlinearities (except for the final layer of 2 sigmoidal neurons). Here no compression phase is visible in the ReLU layers. For learning curves of both networks, see Appendix A. (C) Information plane dynamics for a tanh network of size $7 8 4 - 1 0 2 4 - 2 0 - 2 0 - 2 0 - 1 0$ trained on MNIST, estimated using the non-parametric kernel density mutual information estimator of Kolchinsky & Tracey (2017); Kolchinsky et al. (2017), no compression is observed except in the final classification layer with sigmoidal neurons. See Appendix B for the KDE MI method applied to the original Tishby dataset; additional results using a second popular nonparametric $\mathbf { k }$ -NN-based method (Kraskov et al., 2004); and results for other neural nonlinearities.
|
| 35 |
+
|
| 36 |
+
We then modified the code to train deep networks using rectified linear activation functions $( f ( x ) =$ $\operatorname* { m a x } ( 0 , x ) )$ . While the activities of tanh networks are bounded in the range $[ - 1 , 1 ]$ , ReLU networks have potentially unbounded positive activities. To calculate mutual information, we first trained the ReLU networks, next identified their largest activity value over the course of training, and finally chose 100 evenly spaced bins between the minimum and maximum activity values to discretize the hidden layer activity. The resulting information plane dynamics are shown in Fig. 1B. The mutual information with the input monotonically increases in all ReLU layers, with no apparent compression phase. To see whether our results were an artifact of the small network size, toy dataset, or simple binning-based mutual information estimator we employed, we also trained larger networks on the MNIST dataset and computed mutual information using a state-of-the-art nonparametric kernel density estimator which assumes hidden activity is distributed as a mixture of Gaussians (see Appendix B for details). Fig. C-D show that, again, tanh networks compressed but ReLU networks did not. Appendix B shows that similar results also obtain with the popular nonparametric $\mathbf { k }$ -nearest-neighbor estimator of Kraskov et al. (2004), and for other neural nonlinearities. Thus, the choice of nonlinearity substantively affects the dynamics in the information plane.
|
| 37 |
+
|
| 38 |
+
To understand the impact of neural nonlinearity on the mutual information dynamics, we develop a minimal model that exhibits this phenomenon. In particular, consider the simple three neuron network shown in Fig. 2A. We assume a scalar Gaussian input distribution $X \sim \mathcal { N } ( 0 , 1 )$ , which is fed through the scalar first layer weight $w _ { 1 }$ , and passed through a neural nonlinearity $f ( \cdot )$ , yielding the hidden unit activity $h = f ( w _ { 1 } X )$ . To calculate the mutual information with the input, this hidden unit activity is then binned yielding the new discrete variable $T = \dot { \mathbf { b i n } } ( h )$ (for instance, into 30 evenly spaced bins from $^ { - 1 }$ to 1 for the tanh nonlinearity). This binning process is depicted in Fig. 2B. In this simple setting, the mutual information $I ( T ; X )$ between the binned hidden layer activity $T$ and the input $X$ can be calculated exactly. In particular,
|
| 39 |
+
|
| 40 |
+
$$
|
| 41 |
+
\begin{array} { l c l } { { { \cal I } ( T ; X ) } } & { { = } } & { { { \cal H } ( T ) - { \cal H } ( T | X ) } } \\ { { } } & { { = } } & { { { \cal H } ( T ) } } \\ { { } } & { { = } } & { { - \displaystyle \sum _ { i = 1 } ^ { N } p _ { i } \log p _ { i } } } \end{array}
|
| 42 |
+
$$
|
| 43 |
+
|
| 44 |
+
where $H ( \cdot )$ denotes entropy, and we have used the fact that $H ( T | X ) = 0$ since $T$ is a deterministic function of $X$ . Here the probabilities $p _ { i } = P ( h \ge b _ { i }$ and $h < b _ { i + 1 }$ ) are simply the probability that an input $X$ produces a hidden unit activity that lands in bin $i$ , defined by lower and upper bin limits $b _ { i }$ and $b _ { i + 1 }$ respectively. This probability can be calculated exactly for monotonic nonlinearities $f ( \cdot )$ using the cumulative density of $X$ ,
|
| 45 |
+
|
| 46 |
+
$$
|
| 47 |
+
p _ { i } = P ( X \geq f ^ { - 1 } ( b _ { i } ) / w _ { 1 } \mathrm { a n d } X < f ^ { - 1 } ( b _ { i + 1 } ) / w _ { 1 } ) ,
|
| 48 |
+
$$
|
| 49 |
+
|
| 50 |
+
where $f ^ { - 1 } ( \cdot )$ is the inverse function of $f ( \cdot )$ .
|
| 51 |
+
|
| 52 |
+
As shown in Fig. 2C-D, as a function of the weight $w _ { 1 }$ , mutual information with the input first increases and then decreases for the tanh nonlinearity, but always increases for the ReLU nonlinearity. Intuitively, for small weights $w _ { 1 } \approx 0$ , neural activities lie near zero on the approximately linear part of the tanh function. Therefore $f ( w _ { 1 } X ) \approx w _ { 1 } X$ , yielding a rescaled Gaussian with information that grows with the size of the weights. However for very large weights $w _ { 1 } \to \infty$ , the tanh hidden unit nearly always saturates, yielding a discrete variable that concentrates in just two bins. This is more or less a coin flip, containing mutual information with the input of approximately 1 bit. Hence the distribution of $T$ collapses to a much lower entropy distribution, yielding compression for large weight values. With the ReLU nonlinearity, half of the inputs are negative and land in the bin containing a hidden activity of zero. The other half are Gaussian distributed, and thus have entropy that increases with the size of the weight.
|
| 53 |
+
|
| 54 |
+
Hence double-saturating nonlinearities can lead to compression of information about the input, as hidden units enter their saturation regime, due to the binning procedure used to calculate mutual information. The crux of the issue is that the actual $I ( h ; X )$ is infinite, unless the network itself adds noise to the hidden layers. In particular, without added noise, the transformation from $X$ to the continuous hidden activity $h$ is deterministic and the mutual information $I ( h ; X )$ would generally be infinite (see Appendix C for extended discussion). Networks that include noise in their processing (e.g., Kolchinsky et al. (2017)) can have finite $I ( T ; X )$ . Otherwise, to obtain a finite MI, one must compute mutual information as though there were binning or added noise in the activations. But this binning/noise is not actually a part of the operation of the network, and is therefore somewhat arbitrary (different binning schemes can result in different mutual information with the input, as shown in Fig. 14 of Appendix C).
|
| 55 |
+
|
| 56 |
+

|
| 57 |
+
Figure 2: Nonlinear compression in a minimal model. (A) A three neuron nonlinear network which receives Gaussian inputs $x$ , multiplies by weight $w _ { 1 }$ , and maps through neural nonlinearity $f ( \cdot )$ to produce hidden unit activity $h$ . (B) The continuous activity $h$ is binned into a discrete variable $T$ for the purpose of calculating mutual information. Blue: continuous tanh nonlinear activation function. Grey: Bin borders for 30 bins evenly spaced between $^ { - 1 }$ and 1. Because of the saturation in the sigmoid, a wide range of large magnitude net input values map to the same bin. (C) Mutual information with the input as a function of weight size $w _ { 1 }$ for a tanh nonlinearity. Information increases for small $w _ { 1 }$ and then decreases for large $w _ { 1 }$ as all inputs land in one of the two bins corresponding to the saturation regions. (D) Mutual information with the input for the ReLU nonlinearity increases without bound. Half of all inputs land in the bin corresponding to zero activity, while the other half have information that scales with the size of the weights.
|
| 58 |
+
|
| 59 |
+
We note that the binning procedure can be viewed as implicitly adding noise to the hidden layer activity: a range of $X$ values map to a single bin, such that the mapping between $X$ and $T$ is no longer perfectly invertible (Laughlin, 1981). The binning procedure is therefore crucial to obtaining a finite MI value, and corresponds approximately to a model where noise enters the system after the calculation of $h$ , that is, $T = h + \epsilon$ , where $\epsilon$ is noise of fixed variance independent from $h$ and $X$ . This approach is common in information theoretic analyses of deterministic systems, and can serve as a measure of the complexity of a system’s representation (see Sec 2.4 of Shwartz-Ziv & Tishby (2017)). However, neither binning nor noise is present in the networks that Shwartz-Ziv & Tishby (2017) considered, nor the ones in Fig. 2, either during training or testing. It therefore remains unclear whether robustness of a representation to this sort of noise in fact influences generalization performance in deep learning systems.
|
| 60 |
+
|
| 61 |
+
Furthermore, the addition of noise means that different architectures may no longer be compared in a common currency of mutual information: the binning/noise structure is arbitrary, and architectures that implement an identical input-output map can nevertheless have different robustness to noise added in their internal representation. For instance, Appendix C describes a family of linear networks that compute exactly the same input-output map and therefore generalize identically, but yield different mutual information with respect to the input. Finally, we note that approaches which view the weights obtained from the training process as the random variables of interest may sidestep this issue (Achille & Soatto, 2017).
|
| 62 |
+
|
| 63 |
+

|
| 64 |
+
Figure 3: Generalization and information plane dynamics in deep linear networks. (A) A linear teacher network generates a dataset by passing Gaussian inputs $X$ through its weights and adding noise. (B) A deep linear student network is trained on the dataset (here the network has 1 hidden layer to allow comparison with Fig. 4A, see Supplementary Figure 18 for a deeper network). (C) Training and testing error over time. (D) Information plane dynamics. No compression is observed.
|
| 65 |
+
|
| 66 |
+
Hence when a tanh network is initialized with small weights and over the course of training comes to saturate its nonlinear units (as it must to compute most functions of practical interest, see discussion in Appendix D), it will enter a compression period where mutual information decreases. Figures 16-17 of Appendix E show histograms of neural activity over the course of training, demonstrating that activities in the tanh network enter the saturation regime during training. This nonlinearity-based compression furnishes another explanation for the observation that training slows down as tanh networks enter their compression phase (Shwartz-Ziv & Tishby, 2017): some fraction of inputs have saturated the nonlinearities, reducing backpropagated error gradients.
|
| 67 |
+
|
| 68 |
+
# 3 INFORMATION PLANE DYNAMICS IN DEEP LINEAR NETWORKS
|
| 69 |
+
|
| 70 |
+
The preceding section investigates the role of nonlinearity in the observed compression behavior, tracing the source to double-saturating nonlinearities and the binning methodology used to calculate mutual information. However, other mechanisms could lead to compression as well. Even without nonlinearity, neurons could converge to highly correlated activations, or project out irrelevant directions of the input. These phenomena are not possible to observe in our simple three neuron minimal model, as they require multiple inputs and hidden layer activities. To search for these mechanisms, we turn to a tractable model system: deep linear neural networks (Baldi & Hornik (1989); Fukumizu (1998); Saxe et al. (2014)). In particular, we exploit recent results on the generalization dynamics in simple linear networks trained in a student-teacher setup (Seung et al., 1992; Advani & Saxe, 2017). In a student-teacher setting, one “student” neural network learns to approximate the output of another “teacher” neural network. This setting is a way of generating a dataset with interesting structure that nevertheless allows exact calculation of the generalization performance of the network, exact calculation of the mutual information of the representation (without any binning procedure), and, though we do not do so here, direct comparison to the IB bound which is already known for linear Gaussian problems (Chechik et al., 2005).
|
| 71 |
+
|
| 72 |
+
We consider a scenario where a linear teacher neural network generates input and output examples which are then fed to a deep linear student network to learn (Fig. 3A). Following the formulation of (Advani & Saxe, 2017), we assume multivariate Gaussian inputs $\begin{array} { r } { X \sim \mathcal { N } ( 0 , \frac { 1 } { N _ { i } } \overline { { I } } _ { N _ { i } } ) } \end{array}$ and a scalar output $Y$ . The output is generated by the teacher network according to $Y = \dot { W } _ { 0 } X + \epsilon _ { o }$ , where $\epsilon _ { o } \stackrel { - } { \sim } \mathcal { N } ( 0 , \sigma _ { o } ^ { 2 } )$ represents aspects of the target function which cannot be represented by a neural network (that is, the approximation error or bias in statistical learning theory), and the teacher weights $W _ { o }$ are drawn independently from ${ \mathcal N } ( 0 , \sigma _ { w } ^ { 2 } )$ . Here, the weights of the teacher define the rule to be learned. The signal to noise ratio $\mathrm { S N R } = \sigma _ { w } ^ { 2 } / \sigma _ { o } ^ { 2 }$ determines the strength of the rule linking inputs to outputs relative to the inevitable approximation error. We emphasize that the “noise” added to the teacher’s output is fundamentally different from the noise added for the purpose of calculating mutual information: $\epsilon _ { o }$ models the approximation error for the task–even the best possible neural network may still make errors because the target function is not representable exactly as a neural network–and is part of the construction of the dataset, not part of the analysis of the student network.
|
| 73 |
+
|
| 74 |
+
To train the student network, a dataset of $P$ examples is generated using the teacher. The student network is then trained to minimize the mean squared error between its output and the target output using standard (batch or stochastic) gradient descent on this dataset. Here the student is a deep linear neural network consisting of potentially many layers, but where the the activation function of each neuron is simply $f ( u ) = u$ . That is, a depth $D$ deep linear network computes the output $\hat { Y } = W _ { D + 1 } W _ { D } \cdot \cdot \cdot W _ { 2 } W _ { 1 } X$ . While linear activation functions stop the network from computing complex nonlinear functions of the input, deep linear networks nevertheless show complicated nonlinear learning trajectories (Saxe et al., 2014), the optimization problem remains nonconvex (Baldi & Hornik, 1989), and the generalization dynamics can exhibit substantial overtraining (Fukumizu, 1998; Advani & Saxe, 2017).
|
| 75 |
+
|
| 76 |
+
Importantly, because of the simplified setting considered here, the true generalization error is easily shown to be
|
| 77 |
+
|
| 78 |
+
$$
|
| 79 |
+
E _ { g } ( t ) = | | W _ { o } - W _ { t o t } ( t ) | | _ { F } ^ { 2 } + \sigma _ { o } ^ { 2 }
|
| 80 |
+
$$
|
| 81 |
+
|
| 82 |
+
where $W _ { t o t } ( t )$ is the overall linear map implemented by the network at training epoch $t$ (that is, $W _ { t o t } = W _ { D + 1 } W _ { D } \cdot \cdot \cdot W _ { 2 } W _ { 1 } )$ .
|
| 83 |
+
|
| 84 |
+
Furthermore, the mutual information with the input and output may be calculated exactly, because the distribution of the activity of any hidden layer is Gaussian. Let $T$ be the activity of a specific hidden layer, and let $\bar { W }$ be the linear map from the input to this activity (that is, for layer $l$ , $\bar { W } =$ $W _ { l } \cdots W _ { 2 } W _ { 1 } )$ . Since $T = { \bar { W } } X$ , the mutual information of $X$ and $T$ calculated using differential entropy is infinite. For the purpose of calculating the mutual information, therefore, we assume that Gaussian noise is added to the hidden layer activity, $T = \bar { W } X + \epsilon _ { M I }$ , with mean 0 and variance $\sigma _ { M I } ^ { 2 } = 1 . 0$ . This allows the analysis to apply to networks of any size, including overcomplete layers, but as before we emphasize that we do not add this noise either during training or testing. With these assumptions, $T$ and $X$ are jointly Gaussian and we have
|
| 85 |
+
|
| 86 |
+
$$
|
| 87 |
+
I ( T ; X ) = \log \lvert \bar { W } \bar { W } ^ { T } + \sigma _ { M I } ^ { 2 } I _ { N _ { h } } \rvert - \log \lvert \sigma _ { M I } ^ { 2 } I _ { N _ { h } } \rvert
|
| 88 |
+
$$
|
| 89 |
+
|
| 90 |
+
where $\left| \cdot \right|$ denotes the determinant of a matrix. Finally the mutual information with the output $Y$ , also jointly Gaussian, can be calculated similarly (see Eqns. (22)-(25) of Appendix G).
|
| 91 |
+
|
| 92 |
+
Fig. 3 shows example training and test dynamics over the course of learning in panel C, and the information plane dynamics in panel D. Here the network has an input layer of 100 units, 1 hidden layer of 100 units each and one output unit. The network was trained with batch gradient descent on a dataset of 100 examples drawn from the teacher with signal to noise ratio of 1.0. The linear network behaves qualitatively like the ReLU network, and does not exhibit compression. Nevertheless, it learns a map that generalizes well on this task and shows minimal overtraining. Hence, in the setting we study here, generalization performance can be acceptable without any compression phase.
|
| 93 |
+
|
| 94 |
+
The results in (Advani & Saxe (2017)) show that, for the case of linear networks, overtraining is worst when the number of inputs matches the number of training samples, and is reduced by making the number of samples smaller or larger. Fig. 4 shows learning dynamics with the number of samples matched to the size of the network. Here overfitting is substantial, and again no compression is seen in the information plane. Comparing to the result in Fig. 3D, both networks exhibit similar information dynamics with respect to the input (no compression), but yield different generalization performance.
|
| 95 |
+
|
| 96 |
+
Hence, in this linear analysis of a generic setting, there do not appear to be additional mechanisms that cause compression over the course of learning; and generalization behavior can be widely different for networks with the same dynamics of information compression regarding the input. We note that, in the setting considered here, all input dimensions have the same variance, and the weights of the teacher are drawn independently. Because of this, there are no special directions in the input, and each subspace of the input contains as much information as any other. It is possible that, in real world tasks, higher variance inputs are also the most likely to be relevant to the task (here, have large weights in the teacher). We have not investigated this possibility here.
|
| 97 |
+
|
| 98 |
+

|
| 99 |
+
Figure 4: Overtraining and information plane dynamics. (A) Average training and test mean square error for a deep linear network trained with SGD. Overtraining is substantial. Other parameters: $N _ { i } =$ 100, $\mathrm { P } = 1 0 0$ , Number of hidden units $= 1 0 0$ , Batch size $= 5$ (B) Information plane dynamics. No compression is observed, and information about the labels is lost during overtraining. (C) Average train and test accuracy $\%$ correct) for nonlinear tanh networks exhibiting modest overfitting $N = 8$ ). (D) Information plane dynamics. Overfitting occurs despite continued compression.
|
| 100 |
+
|
| 101 |
+

|
| 102 |
+
Figure 5: Stochastic training and the information plane. (A) tanh network trained with SGD. (B) tanh network trained with BGD. (C) ReLU network trained with SGD. (D) ReLU network trained with BGD. Both random and non-random training procedures show similar information plane dynamics.
|
| 103 |
+
|
| 104 |
+
To see whether similar behavior arises in nonlinear networks, we trained tanh networks in the same setting as Section 2, but with $30 \%$ of the data, which we found to lead to modest overtraining. Fig. 4C-D shows the resulting train, test, and information plane dynamics. Here the tanh networks show substantial compression, despite exhibiting overtraining. This establishes a dissociation between behavior in the information plane and generalization dynamics: networks that compress may (Fig. 1A) or may not (Fig. 4C-D) generalize well, and networks that do not compress may (Figs.1B, 3A-B) or may not (Fig. 4A-B) generalize well.
|
| 105 |
+
|
| 106 |
+
# 4 COMPRESSION IN BATCH GRADIENT DESCENT AND SGD
|
| 107 |
+
|
| 108 |
+
Next, we test a core theoretical claim of the information bottleneck theory of deep learning, namely that randomness in stochastic gradient descent is responsible for the compression phase. In particular, because the choice of input samples in SGD is random, the weights evolve in a stochastic way during training.
|
| 109 |
+
|
| 110 |
+
Shwartz-Ziv & Tishby (2017) distinguish two phases of SGD optimization: in the first “drift” phase, the mean of the gradients over training samples is large relative to the standard deviation of the gradients; in the second “diffusion” phase, the mean becomes smaller than the standard deviation of the gradients. The authors propose that compression should commence following the transition from a high to a low gradient signal-to-noise ratio (SNR), i.e., the onset of the diffusion phase. The proposed mechanism behind this diffusion-driven compression is as follows. The authors state that during the diffusion phase, the stochastic evolution of the weights can be described as a Fokker-Planck equation under the constraint of small training error. Then, the stationary distribution over weights for this process will have maximum entropy, again subject to the training error constraint. Finally, the authors claim that weights drawn from this stationary distribution will maximize the entropy of inputs given hidden layer activity, $H ( X | T )$ , subject to a training error constraint, and that this training error constraint is equivalent to a constraint on the mutual information $I ( T ; Y )$ for small training error. Since the entropy of the input, $H ( X )$ , is fixed, the result of the diffusion dynamics will be to minimize $I ( X ; T ) \mathrel { \mathop : } = H ( X ) - \bar { H } ( X | \dot { T } )$ for a given value of $I ( T ; Y )$ reached at the end of the drift phase.
|
| 111 |
+
|
| 112 |
+
However, this explanation does not hold up to either theoretical or empirical investigation. Let us assume that the diffusion phase does drive the distribution of weights to a maximum entropy distribution subject to a training error constraint. Note that this distribution reflects stochasticity of weights across different training runs. There is no general reason that a given set of weights sampled from this distribution (i.e., the weight parameters found in one particular training run) will maximize $H ( X | T )$ , the entropy of inputs given hidden layer activity. In particular, $H ( X | T )$ reflects (conditional) uncertainty about inputs drawn from the data-generating distribution, rather than uncertainty about any kind of distribution across different training runs.
|
| 113 |
+
|
| 114 |
+
We also show empirically that the stochasticity of the SGD is not necessary for compression. To do so, we consider two distinct training procedures: offline stochastic gradient descent (SGD), which learns from a fixed-size dataset, and updates weights by repeatedly sampling a single example from the dataset and calculating the gradient of the error with respect to that single sample (the typical procedure used in practice); and batch gradient descent (BGD), which learns from a fixed-size dataset, and updates weights using the gradient of the total error across all examples. Batch gradient descent uses the full training dataset and, crucially, therefore has no randomness or diffusion-like behavior in its updates.
|
| 115 |
+
|
| 116 |
+
We trained tanh and ReLU networks with SGD and BGD and compare their information plane dynamics in Fig. 5 (see Appendix H for a linear network). We find largely consistent information dynamics in both instances, with robust compression in tanh networks for both methods. Thus randomness in the training process does not appear to contribute substantially to compression of information about the input. This finding is consistent with the view presented in Section 2 that compression arises predominantly from the double saturating nonlinearity.
|
| 117 |
+
|
| 118 |
+
Finally, we look at the gradient signal-to-noise ratio (SNR) to analyze the relationship between compression and the transition from high to low gradient SNR. Fig. 20 of Appendix I shows the gradient SNR over training, which in all cases shows a phase transition during learning. Hence the gradient SNR transition is a general phenomenon, but is not causally related to compression. Appendix I offers an extended discussion and shows gradient SNR transitions without compression on the MNIST dataset and for linear networks.
|
| 119 |
+
|
| 120 |
+
# 5 SIMULTANEOUS FITTING AND COMPRESSION
|
| 121 |
+
|
| 122 |
+
Our finding that generalization can occur without compression may seem difficult to reconcile with the intuition that certain tasks involve suppressing irrelevant directions of the input. In the extreme, if certain inputs contribute nothing but noise, then good generalization requires ignoring them. To study this, we consider a variant on the linear student-teacher setup of Section 3: we partition the input $X$ into a set of task-relevant inputs $X _ { r e l }$ and a set of task-irrelevant inputs $X _ { i r r e l }$ , and alter the teacher network so that the teacher’s weights to the task-irrelevant inputs are all zero. Hence the inputs $X _ { i r r e l }$ contribute only noise, while the $X _ { r e l }$ contain signal. We then calculate the information plane dynamics for the whole layer, and for the task-relevant and task-irrelevant inputs separately. Fig. 6 shows information plane dynamics for a deep linear neural network trained using SGD (5 samples/batch) on a task with 30 task-relevant inputs and 70 task-irrelevant inputs. While the overall dynamics show no compression phase, the information specifically about the task-irrelevant subspace does compress over the course of training. This compression process occurs at the same time as the fitting to the task-relevant information. Thus, when a task requires ignoring some inputs, the information with these inputs specifically will indeed be reduced; but overall mutual information with the input in general may still increase.
|
| 123 |
+
|
| 124 |
+

|
| 125 |
+
Figure 6: Simultaneous fitting and compression. (A) For a task with a large task-irrelevant subspace in the input, a linear network shows no overall compression of information about the input. (B) The information with the task-relevant subspace increases robustly over training. (C) However, the information specifically about the task-irrelevant subspace does compress after initially growing as the network is trained.
|
| 126 |
+
|
| 127 |
+
# 6 DISCUSSION
|
| 128 |
+
|
| 129 |
+
Our results suggest that compression dynamics in the information plane are not a general feature of deep networks, but are critically influenced by the nonlinearities employed by the network. Doublesaturating nonlinearities lead to compression, if mutual information is estimated by binning activations or by adding homoscedastic noise, while single-sided saturating nonlinearities like ReLUs do not compress in general. Consistent with this view, we find that stochasticity in the training process does not contribute to compression in the cases we investigate. Furthermore, we have found instances where generalization performance does not clearly track information plane behavior, questioning the causal link between compression and generalization. Hence information compression may parallel the situation with sharp minima: although empirical evidence has shown a correlation with generalization error in certain settings and architectures, further theoretical analysis has shown that sharp minima can in fact generalize well (Dinh et al., 2017). We emphasize that compression still may occur within a subset of the input dimensions if the task demands it. This compression, however, is interleaved rather than in a secondary phase and may not be visible by information metrics that track the overall information between a hidden layer and the input. Finally, we note that our results address the specific claims of one scheme to link the information bottleneck principle with current practice in deep networks. The information bottleneck principle itself is more general and may yet offer important insights into deep networks (Achille & Soatto, 2017). Moreover, the information bottleneck principle could yield fundamentally new training algorithms for networks that are inherently stochastic and where compression is explicitly encouraged with appropriate regularization terms (Chalk et al., 2016; Alemi et al., 2017; Kolchinsky et al., 2017).
|
| 130 |
+
|
| 131 |
+
# ACKNOWLEDGMENTS
|
| 132 |
+
|
| 133 |
+
We thank Ariel Herbert-Voss for useful discussions. This work was supported by grant numbers IIS 1409097 and CHE 1648973 from the US National Science Foundation, and by IARPA contract #D16PC00002. Andrew Saxe and Madhu Advani thank the Swartz Program in Theoretical Theoretical Neuroscience at Harvard University. Artemy Kolchinsky and Brendan Tracey would like to thank the Santa Fe Institute for helping to support this research. Artemy Kolchinsky was supported by Grant No. FQXi-RFP-1622 from the FQXi foundation and Grant No. CHE-1648973 from the US National Science Foundation. Brendan Tracey was supported by AFOSR MURI on Multi-Information Sources of Multi-Physics Systems under Award Number FA9550-15-1-0038.
|
| 134 |
+
|
| 135 |
+
# REFERENCES
|
| 136 |
+
|
| 137 |
+
A. Achille and S. Soatto. On the Emergence of Invariance and Disentangling in Deep Representations. arXiv preprint arXiv:1706.01350, 2017.
|
| 138 |
+
|
| 139 |
+
M.S. Advani and A.M. Saxe. High-dimensional dynamics of generalization error in neural networks. arXiv preprint arXiv:1710.03667, 2017.
|
| 140 |
+
A.A. Alemi, I. Fischer, J.V. Dillon, and K. Murphy. Deep variational information bottleneck. In International Conference on Learning Representations, 2017.
|
| 141 |
+
P. Baldi and K. Hornik. Neural networks and principal component analysis: Learning from examples without local minima. Neural Networks, 2:53–58, 1989.
|
| 142 |
+
P.L. Bartlett and S. Mendelson. Rademacher and Gaussian Complexities: Risk Bounds and Structural Results. Journal of Machine Learning Research, 3:463–482, 2002.
|
| 143 |
+
M. Chalk, O. Marre, and G. Tkacik. Relevant sparse codes with variational information bottleneck. In Advances in Neural Information Processing Systems, pp. 1957–1965, 2016.
|
| 144 |
+
G. Chechik, A. Globerson, N. Tishby, and Y. Weiss. Information bottleneck for gaussian variables. Journal of Machine Learning Research, pp. 165–188, 2005.
|
| 145 |
+
J. Chee and P. Toulis. Convergence diagnostics for stochastic gradient descent with constant step size. arXiv preprint arXiv:1710.06382, 2017.
|
| 146 |
+
A. Choromanska, M. Henaff, M. Mathieu, G. Arous, B., and Y. LeCun. The Loss Surfaces of Multilayer Networks. In Proceedings of the 18th International Conference on Artificial Intelligence, volume 38, 2015.
|
| 147 |
+
L. Dinh, R. Pascanu, S. Bengio, and Y. Bengio. Sharp Minima Can Generalize For Deep Nets. In International Conference on Machine Learning, 2017.
|
| 148 |
+
K. Fukumizu. Effect of Batch Learning In Multilayer Neural Networks. In Proceedings of the 5th International Conference on Neural Information Processing, pp. 67–70, 1998.
|
| 149 |
+
I. Goodfellow, J. Pouget-Abadie, M. Mirza, B. Xu, D. Warde-Farley, S. Ozair, A. Courville, and Y. Bengio. Generative Adversarial Nets. Advances in Neural Information Processing Systems, pp. 2672–2680, 2014.
|
| 150 |
+
J. Kadmon and H. Sompolinsky. Optimal Architectures in a Solvable Model of Deep Networks. In Advances in Neural Information Processing Systems, 2016.
|
| 151 |
+
A. Kolchinsky and B.D. Tracey. Estimating mixture entropy with pairwise distances. Entropy, 19, 2017.
|
| 152 |
+
A. Kolchinsky, B.D. Tracey, and D.H. Wolpert. Nonlinear information bottleneck. arXiv preprint arXiv:1705.02436, 2017.
|
| 153 |
+
A. Kraskov, H. Stögbauer, and P. Grassberger. Estimating mutual information. Physical Review E, 69:066138, 2004.
|
| 154 |
+
A. Krizhevsky, I. Sutskever, and G.E. Hinton. ImageNet classification with deep convolutional neural networks. In Advances in Neural Information Processing Systems, pp. 1097–1105. 2012.
|
| 155 |
+
S. Laughlin. A simple coding procedure enhances a neuron’s information capacity. Zeitschrift für Naturforschung c, 36:910–912, 1981.
|
| 156 |
+
Y. LeCun, Y. Bengio, and G.E. Hinton. Deep learning. Nature, 521:436–444, 2015.
|
| 157 |
+
W. Lotter, G. Kreiman, and D.D. Cox. Deep predictive coding networks for video prediction and unsupervised learning. arXiv preprint arXiv:1605.08104, 2016.
|
| 158 |
+
G. Montufar, R. Pascanu, K. Cho, and Y. Bengio. On the Number of Linear Regions of Deep Neural Networks. In Advances in Neural Information Processing Systems, 2014.
|
| 159 |
+
N. Murata. A statistical study of on-line learning. In On-line Learning in Neural Networks, pp. 63–92. Cambridge University Press, 1998.
|
| 160 |
+
B. Neyshabur, R. Tomioka, and N. Srebro. Norm-Based Capacity Control in Neural Networks. In Proceedings of The 28th Conference on Learning Theory, volume 40, pp. 1–26, 2015.
|
| 161 |
+
H. Poggio, T.and Mhaskar, L. Rosasco, B. Miranda, and Q. Liao. Why and when can deep-but not shallow-networks avoid the curse of dimensionality: A review. International Journal of Automation and Computing, pp. 1–17, 2017.
|
| 162 |
+
A.M. Saxe, J.L. McClelland, and S. Ganguli. Exact solutions to the nonlinear dynamics of learning in deep linear neural networks. In the International Conference on Learning Representations, 2014.
|
| 163 |
+
J. Schmidhuber. Deep Learning in Neural Networks: An Overview. Neural Networks, 61:85–117, 2015.
|
| 164 |
+
H.S. Seung, H. Sompolinsky, and N. Tishby. Statistical mechanics of learning from examples. Physical Review A, 45:6056–6091, 1992.
|
| 165 |
+
R. Shwartz-Ziv and N. Tishby. Opening the black box of deep neural networks via information. arXiv preprint arXiv:1703.00810, 2017.
|
| 166 |
+
D. Silver, A. Huang, C.J. Maddison, A. Guez, L. Sifre, G. van den Driessche, J. Schrittwieser, I. Antonoglou, V. Panneershelvam, M. Lanctot, S. Dieleman, D. Grewe, J. Nham, N. Kalchbrenner, I. Sutskever, T. Lillicrap, M. Leach, K. Kavukcuoglu, T. Graepel, and D. Hassabis. Mastering the game of Go with deep neural networks and tree search. Nature, 529:484–489, 2016.
|
| 167 |
+
N. Tishby and N. Zaslavsky. Deep learning and the information bottleneck principle. In IEEE Information Theory Workshop, 2015.
|
| 168 |
+
N. Tishby, F.C. Pereira, and W. Bialek. The information bottleneck method. Proceedings of the 37-th Annual Allerton Conference on Communication, Control and Computing, pp. 368–377, 1999.
|
| 169 |
+
|
| 170 |
+
# A LEARNING CURVES FOR tanh AND RELU NETWORKS
|
| 171 |
+
|
| 172 |
+
Supplementary Figure 7 shows the learning curves for tanh and ReLU networks depicted in Fig. 1.
|
| 173 |
+
|
| 174 |
+

|
| 175 |
+
Figure 7: Learning curves for (A) tanh neural network in 1 A and (B) ReLU neural network in $1 \textbf { B }$ . Both networks show good generalization with regards to the test data.
|
| 176 |
+
|
| 177 |
+
# B ROBUSTNESS OF FINDINGS TO MI ESTIMATION METHOD AND NEURAL ACTIVATION FUNCTIONS
|
| 178 |
+
|
| 179 |
+
This Appendix investigates the generality of the finding that compression is not observed in neural network layers with certain activation functions. Figure 1 of the main text shows example results using a binning-based MI estimator and a nonparametric KDE estimator, for both the tanh and ReLU activation functions. Here we describe the KDE MI estimator in detail, and present extended results on other datasets. We also show results for other activation functions. Finally, we provide entropy estimates based on another nonparametric estimator, the popular $\mathbf { k }$ -nearest neighbor approach of Kraskov et al. (2004). Our findings consistently show that double-saturating nonlinearities can yield compression, while single-sided nonlinearities do not.
|
| 180 |
+
|
| 181 |
+
# B.1 KERNEL DENSITY ESTIMATION OF MI
|
| 182 |
+
|
| 183 |
+
The KDE approach of Kolchinsky & Tracey (2017); Kolchinsky et al. (2017) estimates the mutual information between the input and the hidden layer activity by assuming that the hidden activity is distributed as a mixture of Gaussians. This assumption is well-suited to the present setting under the following interpretation: we take the input activity to be distributed as delta functions at each example in the dataset, corresponding to a uniform distribution over these specific samples. In other words, we assume that the empirical distribution of input samples is the true distribution. Next, the hidden layer activity $h$ is a deterministic function of the input. As mentioned in the main text and discussed in more detail in Appendix C, without the assumption of noise, this would have infinite mutual information with the input. We therefore assume for the purposes of analysis that Gaussian noise of variance $\sigma ^ { 2 }$ is added, that is, $T = h + \epsilon$ where $\epsilon \sim \mathcal { N } ( \bar { 0 } , \bar { \sigma ^ { 2 } } I )$ . Under these assumptions, the distribution of $T$ is genuinely a mixture of Gaussians, with a Gaussian centered on the hidden activity corresponding to each input sample. We emphasize again that the noise $\epsilon$ is added solely for the purposes of analysis, and is not present during training or testing the network. In this setting, an upper bound for the mutual information with the input is (Kolchinsky & Tracey, 2017; Kolchinsky et al., 2017)
|
| 184 |
+
|
| 185 |
+
$$
|
| 186 |
+
I ( T ; X ) \leq - { \frac { 1 } { P } } \sum _ { i } \log { \frac { 1 } { P } } \sum _ { j } \exp \left( - { \frac { 1 } { 2 } } { \frac { \vert \vert h _ { i } - h _ { j } \vert \vert _ { 2 } ^ { 2 } } { \sigma ^ { 2 } } } \right)
|
| 187 |
+
$$
|
| 188 |
+
|
| 189 |
+
where $P$ is the number of training samples and $h _ { i }$ denotes the hidden activity vector in response to input sample $i$ . Similarly, the mutual information with respect to the output can be calculated as
|
| 190 |
+
|
| 191 |
+
$$
|
| 192 |
+
\begin{array} { r c l } { I ( T ; Y ) } & { = } & { { \displaystyle H ( T ) - H ( T | Y ) } } \\ & { \leq } & { \displaystyle - \frac { 1 } { P } \sum _ { i } \log \frac { 1 } { P } \sum _ { j } \exp \left( - \frac { 1 } { 2 } \frac { \| h _ { i } - h _ { j } \| _ { 2 } ^ { 2 } } { \sigma ^ { 2 } } \right) } \\ & & { \displaystyle - \sum _ { l } ^ { L } p _ { l } \left[ - \frac { 1 } { P _ { l } } \sum _ { i , Y _ { i } = l } \log \frac { 1 } { P _ { l } } \sum _ { j , Y _ { j } = l } \exp \left( - \frac { 1 } { 2 } \frac { \| h _ { i } - h _ { j } \| _ { 2 } ^ { 2 } } { \sigma ^ { 2 } } \right) \right] } \end{array}
|
| 193 |
+
$$
|
| 194 |
+
|
| 195 |
+
where $L$ is the number of output labels, $P _ { l }$ denotes the number of data samples with output label $l$ , $p _ { l } = P _ { l } / P$ denotes the probability of output label $l$ , and the sums over $i , Y _ { i } = l$ indicate a sum over all examples with output label $l$ .
|
| 196 |
+
|
| 197 |
+

|
| 198 |
+
Figure 8: Information plane dynamics for the network architecture and training dataset of ShwartzZiv & Tishby (2017), estimated with the nonparametric KDE method of Kolchinsky & Tracey (2017); Kolchinsky et al. (2017) and averaged over 50 repetitions. (A) tanh neural network layers show compression. (B) ReLU neural network layers show no compression. (C) The soft-sign activation function, a double-saturating nonlinearity that saturates more gently than tanh, shows modest compression. (D) The soft-plus activation function, a smoothed version of the ReLU, exhibits no compression. Hence double-saturating nonlinearities exhibit the compression effect while singlesaturating nonlinearities do not.
|
| 199 |
+
|
| 200 |
+
Figure 8A-B shows the result of applying this MI estimation method on the dataset and network architecture of Shwartz-Ziv & Tishby (2017), with MI estimated on the full dataset and averaged over 50 repetitions. Mutual information was estimated using data samples from the test set, and we took the noise variance $\sigma ^ { 2 } = 0 . 1$ . These results look similar to the estimate derived from binning, with compression in tanh networks but no compression in ReLU networks. Relative to the binning estimate, it appears that compression is less pronounced in the KDE method.
|
| 201 |
+
|
| 202 |
+
Figure 1C-D of the main text shows the results of this estimation technique applied to a neural network of size $7 8 4 - 1 0 2 4 - 2 0 - 2 0 - 2 0 - 1 0$ on the MNIST handwritten digit classification dataset. The network was trained using SGD with minibatches of size 128. As before, mutual information was estimated using data samples from the test set, and we took the noise variance $\sigma ^ { 2 } = 0 . 1$ . The smaller layer sizes in the top three hidden layers were selected to ensure the quality of the kernel density estimator given the amount of data in the test set, since the estimates are more accurate for smaller-dimensional data. Because of computational expense, the MNIST results are from a single training run.
|
| 203 |
+
|
| 204 |
+
More detailed results for the MNIST dataset are provided in Figure 9 for the tanh activation function, and in Figure 10 for the ReLU activation function. In these figures, the first row shows the evolution of the cross entropy loss (on both training and testing data sets) during training. The second row shows the mutual information between input and the activity of different hidden layers, using the nonparametric KDE estimator described above. The blue region in the second row shows the range of possible MI values, ranging from the upper bound described above (Eq. 10) to the following lower
|
| 205 |
+
|
| 206 |
+
bound (Kolchinsky & Tracey, 2017),
|
| 207 |
+
|
| 208 |
+
$$
|
| 209 |
+
\begin{array} { r c l } { { I ( T ; Y ) } } & { { \geq } } & { { \displaystyle - \frac { 1 } { P } \sum _ { i } \log \frac { 1 } { P } \sum _ { j } \exp \left( - \frac { 1 } { 2 } \frac { \left\| h _ { i } - h _ { j } \right\| _ { 2 } ^ { 2 } } { 4 \sigma ^ { 2 } } \right) } } \\ { { } } & { { } } & { { \displaystyle - \sum _ { l } ^ { L } p _ { l } \left[ - \frac { 1 } { P _ { l } } \sum _ { i , Y _ { i } = l } \log \frac { 1 } { P _ { l } } \sum _ { j , Y _ { j } = l } \exp \left( - \frac { 1 } { 2 } \frac { \left\| h _ { i } - h _ { j } \right\| _ { 2 } ^ { 2 } } { 4 \sigma ^ { 2 } } \right) \right] . } } \end{array}
|
| 210 |
+
$$
|
| 211 |
+
|
| 212 |
+
The third row shows the mutual information between input and activity of different hidden layers, estimated using the binning method (here, the activity of each neuron was discretized into bins of size 0.5). For both the second and third rows, we also plot the entropy of the inputs, $H ( X )$ , as a dashed line. $H ( X )$ is an upper bound on the mutual information $I ( X ; T )$ , and is computed using the assumption of a uniform distribution over the 10,000 testing points in the MNIST dataset, giving $H ( X ) = \log _ { 2 } { 1 0 0 0 0 }$ .
|
| 213 |
+
|
| 214 |
+
Finally, the fourth row visualizes the dynamics of the SGD updates during training. For each layer and epoch, the green line shows the $\ell _ { 2 }$ norm of the weights. We also compute the vector of mean updates across SGD minibatches (this vector has one dimension for each weight parameter), as well as the vector of the standard deviation of the updates across SGD minibatches. The $\ell _ { 2 }$ norm of the mean update vector is shown in blue, and the $\ell _ { 2 }$ norm of the standard deviation vector is shown in orange. The gradient SNR, computed as the ratio of the norm of the mean vector to the norm of the standard deviation vector, is shown in red. For both the tanh and ReLU networks, the gradient SNR shows a phase transition during training, and the norm of the weights in each layer increases. Importantly, this phase transition occurs despite a lack of compression in the ReLU network, indicating that noise in SGD updates does not yield compression in this setting.
|
| 215 |
+
|
| 216 |
+

|
| 217 |
+
Figure 9: Detailed tanh activation function results on MNIST. Row 1: Loss over training. Row 2: Upper and lower bounds for the mutual information $I ( X ; T )$ between the input $( X )$ and each layer’s activity $( T )$ , using the nonparametric KDE estimator (Kolchinsky & Tracey, 2017; Kolchinsky et al., 2017). Dotted line indicates $H ( X ) = \log _ { 2 } { 1 0 0 0 0 }$ , the entropy of a uniform distribution over 10,000 testing samples. Row 3: Binning-based estimate of the mutual information $I ( X ; T )$ , with each neuron’s activity discretized using a bin size of 0.5. Row 4: Gradient SNR and weight norm dynamics. The gradient SNR shows a phase transition during training, and the norm of the weights in each layer increases.
|
| 218 |
+
|
| 219 |
+

|
| 220 |
+
Figure 10: Detailed ReLU activation function results on MNIST. Row 1: Loss over training. Row 2: Upper and lower bounds for the mutual information $I ( X ; T )$ between the input $( X )$ and each layer’s activity $( T )$ , using the nonparametric KDE estimator (Kolchinsky & Tracey, 2017; Kolchinsky et al., 2017). Dotted line indicates $H ( X ) = \log _ { 2 } { 1 0 0 0 0 }$ , the entropy of a uniform distribution over 10,000 testing samples. Row 3: Binning-based estimate of the mutual information $I ( X ; T )$ , with each neuron’s activity discretized using a bin size of 0.5. Row 4: Gradient SNR and weight norm dynamics. The gradient SNR shows a phase transition during training, and the norm of the weights in each layer increases. Importantly, this phase transition occurs despite a lack of compression in the ReLU network, indicating that noise in SGD updates does not yield compression in this setting.
|
| 221 |
+
|
| 222 |
+

|
| 223 |
+
Figure 11: Alternative activation functions.
|
| 224 |
+
|
| 225 |
+
# B.2 OTHER ACTIVATION FUNCTIONS
|
| 226 |
+
|
| 227 |
+
Next, in Fig. 8C-D, we show results from the kernel MI estimator from two additional nonlinear activation functions, the softsign function
|
| 228 |
+
|
| 229 |
+
$$
|
| 230 |
+
f ( x ) = { \frac { x } { 1 + | x | } } ,
|
| 231 |
+
$$
|
| 232 |
+
|
| 233 |
+
and the softplus function
|
| 234 |
+
|
| 235 |
+
$$
|
| 236 |
+
f ( x ) = \ln ( 1 + e ^ { x } ) .
|
| 237 |
+
$$
|
| 238 |
+
|
| 239 |
+
These functions are plotted next to tanh and ReLU in Fig. 11. The softsign function is similar to tanh but saturates more slowly, and yields less compression than tanh. The softplus function is a smoothed version of the ReLU, and yields similar dynamics with no compression. Because softplus never saturates fully to zero, it retains more information with respect to the input than ReLUs in general.
|
| 240 |
+
|
| 241 |
+
# B.3 KRASKOV ESTIMATOR
|
| 242 |
+
|
| 243 |
+
We additionally investigated the widely-used nonparametric MI estimator of Kraskov et al. (2004). This estimator uses nearest neighbor distances between samples to compute an estimate of the entropy of a continuous random variable. Here we focused for simplicity only on the compression phenomenon in the mutual information between the input and hidden layer activity, leaving aside the information with respect to the output (as this is not relevant to the compression phenomenon). Again, without additional noise assumptions, the MI between the hidden representation and the input would be infinite because the mapping is deterministic. Rather than make specific noise assumptions, we instead use the Kraskov method to estimate the entropy of the hidden representations $T$ . Note that the entropy of $T$ is the mutual information up to an unknown constant so long as the noise assumption is homoscedastic, that is, $T = h + Z$ where the random variable $Z$ is independent of $X$ . To see this, note that
|
| 244 |
+
|
| 245 |
+
$$
|
| 246 |
+
\begin{array} { l l l } { { I ( T ; X ) } } & { { = } } & { { H ( T ) - H ( T | X ) } } \\ { { } } & { { = } } & { { H ( T ) - H ( Z ) } } \\ { { } } & { { = } } & { { H ( T ) - c } } \end{array}
|
| 247 |
+
$$
|
| 248 |
+
|
| 249 |
+
where the constant $c = H ( Z )$ . Hence observing compression in the layer entropy $H ( T )$ is enough to establish that compression occurs in the mutual information.
|
| 250 |
+
|
| 251 |
+
The Kraskov estimate is given by
|
| 252 |
+
|
| 253 |
+
$$
|
| 254 |
+
\frac { d } { P } \sum _ { i = 1 } ^ { P } \log ( r _ { i } + \epsilon ) + \frac { d } { 2 } \log ( \pi ) - \log \Gamma ( d / 2 + 1 ) + \psi ( P ) - \psi ( k )
|
| 255 |
+
$$
|
| 256 |
+
|
| 257 |
+
where $d$ is the dimension of the hidden representation, $P$ is the number of samples, $r _ { i }$ is the distance to the $k$ -th nearest neighbor of sample $i$ , $\epsilon$ is a small constant for numerical stability, $\Gamma ( \cdot )$ is the
|
| 258 |
+
|
| 259 |
+
Gamma function, and $\psi ( \cdot )$ is the digamma function. Here the parameter $\epsilon$ prevents infinite terms when the nearest neighbor distance ri = 0 for some sample. We took = 10−16.
|
| 260 |
+
|
| 261 |
+
Figure 12 shows the entropy over training for tanh and ReLU networks trained on the dataset of and with the network architecture in Shwartz-Ziv & Tishby (2017), averaged over 50 repeats. In these experiments, we used $k = 2$ . Compression would correspond to decreasing entropy over the course of training, while a lack of compression would correspond to increasing entropy. Several tanh layers exhibit compression, while the ReLU layers do not. Hence qualitatively, the Kraskov estimator returns similar results to the binning and KDE strategies.
|
| 262 |
+
|
| 263 |
+

|
| 264 |
+
Figure 12: Entropy dynamics over training for the network architecture and training dataset of Shwartz-Ziv & Tishby (2017), estimated with the nonparametric $\mathbf { k }$ -nearest-neighbor-based method of Kraskov et al. (2004). Here the $\mathbf { X } ^ { } -$ -axis is epochs of training time, and the y-axis plots the entropy of the hidden representation, as calculated using nearest-neighbor distances. Note that in this setting, if $T$ is considered to be the hidden activity plus independent noise, the entropy is equal to the mutual information up to a constant (see derivation in text). Layers 0-4 correspond to the hidden layers of size 10-7-5-4-3. (A) tanh neural network layers can show compression over the course of training. (B) ReLU neural network layers show no compression.
|
| 265 |
+
|
| 266 |
+
# C NOISE ASSUMPTIONS AND DISCRETE VS CONTINUOUS ENTROPY
|
| 267 |
+
|
| 268 |
+
A recurring theme in the results reported in this paper is the necessity of noise assumptions to yield a nontrivial information theoretic analysis. Here we give an extended discussion of this phenomenon, and of issues relating to discrete entropy as opposed to continuous (differential) entropy.
|
| 269 |
+
|
| 270 |
+
The activity of a neural network is often a continuous deterministic function of its input. That is, in response to an input $X$ , a specific hidden layer might produce activity $h = f ( X )$ for some function $f$ . The mutual information between $h$ and $X$ is given by
|
| 271 |
+
|
| 272 |
+
$$
|
| 273 |
+
\begin{array} { l l l } { { I ( h ; X ) } } & { { = } } & { { H ( h ) - H ( h | X ) . } } \end{array}
|
| 274 |
+
$$
|
| 275 |
+
|
| 276 |
+
If $h$ were a discrete variable, then the entropy would be given by
|
| 277 |
+
|
| 278 |
+
$$
|
| 279 |
+
H ( h ) = - \sum _ { i = 1 } ^ { N } p _ { i } \log p _ { i }
|
| 280 |
+
$$
|
| 281 |
+
|
| 282 |
+
where $p _ { i }$ is the probability of the discrete symbol $i$ , as mentioned in the main text. Then $H ( h | X ) = 0$ because the mapping is deterministic and we have $I ( h ; X ) = H ( h )$ .
|
| 283 |
+
|
| 284 |
+
However $h$ is typically continuous. The continuous entropy, defined for a continuous random variable $Z$ with density $p _ { Z }$ by analogy to Eqn. (18) as
|
| 285 |
+
|
| 286 |
+
$$
|
| 287 |
+
H ( Z ) = - \int p _ { Z } ( z ) \log p _ { Z } ( z ) d z ,
|
| 288 |
+
$$
|
| 289 |
+
|
| 290 |
+
can be negative and possibly infinite. In particular, note that if $p _ { Z }$ is a delta function, then $H ( Z ) =$ $- \infty$ . The mutual information between hidden layer activity $h$ and the input $X$ for continuous $h , X$ is
|
| 291 |
+
|
| 292 |
+
$$
|
| 293 |
+
I ( h ; X ) = H ( h ) - H ( h | X ) .
|
| 294 |
+
$$
|
| 295 |
+
|
| 296 |
+
Now $H ( h | X ) = - \infty$ since given the input $X$ , the hidden activity $h$ is distributed as a delta function at $f ( X )$ . The mutual information is thus generally infinite, so long as the hidden layer activity has finite entropy $H ( h )$ is finite).
|
| 297 |
+
|
| 298 |
+

|
| 299 |
+
Figure 13: Effect of binning strategy on minimal three neuron model. Mutual information for the simple three neuron model shown in Fig. 2 with bin edges $b _ { i } \in \mathrm { t a n h } ( \operatorname* { l i n s p a c e } ( - 5 0 , 5 0 , N ) )$ . In contrast to linear binning, the mutual information continues to increase as weights grow.
|
| 300 |
+
|
| 301 |
+
To yield a finite mutual information, some noise in the mapping is required such that $H ( h | X )$ remains finite. A common choice (and one adopted here for the linear network, the nonparametric kernel density estimator, and the $\mathbf { k }$ -nearest neighbor estimator) is to analyze a new variable with additive noise, $T = h + Z$ , where $Z$ is a random variable independent of $X$ . Then $H ( T | X ) = H ( Z )$ which allows the overall information $I ( T ; X ) = H ( T ) - H ( Z )$ to remain finite. This noise assumption is not present in the actual neural networks either during training or testing, and is made solely for the purpose of calculating the mutual information.
|
| 302 |
+
|
| 303 |
+
Another strategy is to partition the continuous variable $h$ into a discrete variable $T$ , for instance by binning the values (the approach taken in Shwartz-Ziv & Tishby (2017)). This allows use of the discrete entropy, which remains finite. Again, however, in practice the network does not operate on the binned variables $T$ but on the continuous variables $h$ , and the binning is solely for the purpose of calculating the mutual information. Moreover, there are many possible binning strategies, which yield different discrete random variables, and different mutual information with respect to the input. The choice of binning strategy is an assumption analogous to choosing a type of noise to add to the representation in the continuous case: because there is in fact no binning in the operation of the network, there is no clear choice for binning methodology. The strategy we use in binning-based experiments reported here is the following: for bounded activations like the tanh activation, we use evenly spaced bins between the minimum and maximum limits of the function. For unbounded activations like ReLU, we first train the network completely; next identify the minimum and maximum hidden activation over all units and all training epochs; and finally bin into equally spaced bins between these minimum and maximum values. We note that this procedure places no restriction on the magnitude that the unbounded activation function can take during training, and yields the same MI estimate as using infinite equally spaced bins (because bins for activities larger than the maximum are never seen during training).
|
| 304 |
+
|
| 305 |
+
As an example of another binning strategy that can yield markedly different results, we consider evenly spaced bins in a neuron’s net input, rather than its activity. That is, instead of evenly spaced bins in the neural activity, we determine the bin edges by mapping a set of evenly spaced values through the neural nonlinearity. For tanh, for instance, this spaces bins more tightly in the saturation region as compared to the linear region. Figure 13 shows the results of applying this binning strategy to the minimal three neuron model with tanh activations. This binning scheme captures more information as the weights of the network grow larger. Figure 14 shows information plane dynamics for this binning structure. The tanh network no longer exhibits compression. (We note that the broken DPI in this example is an artifact of performing binning only for analysis, as discussed below).
|
| 306 |
+
|
| 307 |
+

|
| 308 |
+
Figure 14: Effect of binning strategy on information plane dynamics. Results for the same tanh network and training regime as 1A, but with bin edges $b _ { i } \in$ tanh(linspace $( - 5 0 , 5 0 , N )$ ). Measured with this binning structure, there is no compression in most layers.
|
| 309 |
+
|
| 310 |
+
Any implementation of a neural network on digital hardware is ultimately of finite precision, and hence is a binned, discrete representation. However, it is a very high resolution binning compared to that used here or by Shwartz-Ziv & Tishby (2017): single precision would correspond to using roughly $2 ^ { 3 2 }$ bins to discretize each hidden unit’s activity, as compared to the 30-100 used here. If the binning is fine-grained enough that each input $X$ yields a different binned activity pattern $h$ , then $H ( h ) \stackrel { - } { = } \log ( P )$ where $P$ is the number of examples in the dataset, and there will be little to no change in information during training. As an example, we show in Fig. 15 the result of binning at full machine precision.
|
| 311 |
+
|
| 312 |
+
Finally, we note two consequences of the assumption of noise/binning for the purposes of analysis. First, this means that the data processing inequality (DPI) does not apply to the noisy/binned mutual information estimates. The DPI states that information can only be destroyed through successive transformations, that is, if $X h _ { 1 } h _ { 2 }$ form a Markov chain, then $I ( X ; \bar { h _ { 1 } } ) \geq I ( \bar { X ; } h _ { 2 } )$ (see, eg, Tishby & Zaslavsky (2015)). Because noise is added only for the purpose of analysis, however, this does not apply here. In particular, for the DPI to apply, the noise added at lower layers would have to propagate through the network to higher layers. That is, if the transformation from hidden layer 1 to hidden layer 2 is $h _ { 2 } = f ( h _ { 1 } )$ and $T _ { 1 } = h _ { 1 } + Z _ { 1 }$ is the hidden layer activity after adding noise, then the DPI would hold for the variable $\tilde { T } _ { 2 } = f ( T _ { 1 } ) + Z _ { 2 } = f ( h _ { 1 } + Z _ { 1 } ) + Z _ { 2 }$ , not the quantity
|
| 313 |
+
|
| 314 |
+

|
| 315 |
+
Figure 15: Effect of binning at full machine precision. (A) ReLU network. (B) tanh network. Information in most layers stays pinned to $\log _ { 2 } ( P ) = 1 2$ . Compression is only observed in the highest and smallest layers near the very end of training, when the saturation of tanh is strong enough to saturate machine precision.
|
| 316 |
+
|
| 317 |
+
$T _ { 2 } = h _ { 2 } + Z _ { 2 } = f ( h _ { 1 } ) + Z _ { 2 }$ used in the analysis. Said another way, the Markov chain for $T _ { 2 }$ is $X h _ { 1 } h _ { 2 } T _ { 2 }$ , not $X h _ { 1 } T _ { 1 } T _ { 2 }$ , so the DPI states only that $I ( X ; h _ { 1 } ) \ge I ( X ; T _ { 2 } )$ .
|
| 318 |
+
|
| 319 |
+
A second consequence of the noise assumption is the fact that the mutual information is no longer invariant to invertible transformations of the hidden activity $h$ . A potentially attractive feature of a theory based on mutual information is that it can allow for comparisons between different architectures: mutual information is invariant to any invertible transformation of the variables, so two hidden representations could be very different in detail but yield identical mutual information with respect to the input. However, once noise is added to a hidden representation, this is no longer the case: the variable $T = h + Z$ is not invariant to reparametrizations of $h$ . As a simple example, consider a minimal linear network with scalar weights $w _ { 1 }$ and $w _ { 2 }$ that computes the output ${ \hat { y } } = w _ { 2 } w _ { 1 } X$ . The hidden activity is $h = w _ { 1 } X$ . Now consider the family of networks in which we scale down $w _ { 1 }$ and scale up $w _ { 2 }$ by a factor $c \neq 0$ , that is, these networks have weights $\tilde { w } _ { 1 } = w _ { 1 } / c$ and $\tilde { w } _ { 2 } = c w _ { 2 }$ , yielding the exact same input-output map $\hat { y } = \tilde { w } _ { 2 } \tilde { w } _ { 1 } X = c w _ { 2 } ( w _ { 1 } / c ) X = w _ { 2 } w _ { 1 } X$ . Because they compute the same function, they necessarily generalize identically. However after introducing the noise assumption the mutual information is
|
| 320 |
+
|
| 321 |
+
$$
|
| 322 |
+
\begin{array} { l l l } { { I ( T ; X ) } } & { { = } } & { { \log \left( w _ { 1 } ^ { 2 } / c ^ { 2 } + \sigma _ { M I } ^ { 2 } \right) - \log \left( \sigma _ { M I } ^ { 2 } \right) } } \end{array}
|
| 323 |
+
$$
|
| 324 |
+
|
| 325 |
+
where we have taken the setting in Section 3 in which $X$ is normal Gaussian, and independent Gaussian noise of variance $\sigma _ { M I } ^ { 2 }$ is added for the purpose of MI computation. Clearly, the mutual information is now dependent on the scaling $c$ of the internal layer, even though this is an invertible linear transformation of the representation. Moreover, this shows that networks which generalize identically can nevertheless have very different mutual information with respect to the input when it is measured in this way.
|
| 326 |
+
|
| 327 |
+
# D WEIGHT NORMS OVER TRAINING
|
| 328 |
+
|
| 329 |
+
Our argument relating neural saturation to compression in mutual information relies on the notion that in typical training regimes, weights begin small and increase in size over the course of training. We note that this is a virtual necessity for a nonlinearity like tanh, which is linear around the origin: when initialized with small weights, the activity of a tanh network will be in this linear regime and the network can only compute a linear function of its input. Hence a real world nonlinear task can only be learned by increasing the norm of the weights so as to engage the tanh nonlinearity on some examples. This point can also be appreciated from norm-based capacity bounds on neural networks, which show that, for instance, the Rademacher complexity of a neural network with small weights must be low (Bartlett & Mendelson, 2002; Neyshabur et al., 2015). Finally, as an empirical matter, the networks trained in this paper do in fact increase the norm of their weights over the course of training, as shown by the green lines in Figure 20 for tanh and ReLU networks in the training setting of Shwartz-Ziv & Tishby (2017); Figures 9 and 10 for the MNIST networks; and Figure 21 for a linear network.
|
| 330 |
+
|
| 331 |
+
# E HISTOGRAMS OF NEURAL ACTIVATIONS
|
| 332 |
+
|
| 333 |
+
Supplementary Figures 16 and 17 show histograms of neural activities over the course of training in tanh and ReLU networks respectively.
|
| 334 |
+
|
| 335 |
+

|
| 336 |
+
Figure 16: Histogram of neural activities in a tanh network during training. The final three layers eventually saturate in the top and bottom bins corresponding to the saturation limits of the tanh activation function, explaining the compression observed in tanh. x-axis: training time in epochs. y-axis: Hidden activity bin values from lowest to highest. Colormap: density of hidden layer activities across all input examples.
|
| 337 |
+
|
| 338 |
+

|
| 339 |
+
Figure 17: Histogram of neural activities in a ReLU network during training. ReLU layers 1-5 have a roughly constant fraction of activities at zero, corresponding to instances where the ReLU is off; the nonzero activities disperse over the course of training without bound, yielding higher entropy distributions. The sigmoid output layer 6 converges to its saturation limits, and is the only layer that compresses during training (c.f. Fig. 1B). $\mathbf { X }$ -axis: training time in epochs. y-axis: Hidden activity value. Colormap: density of hidden layer activities across all input examples.
|
| 340 |
+
|
| 341 |
+
# F INFORMATION PLANE DYNAMICS IN DEEPER LINEAR NETWORKS
|
| 342 |
+
|
| 343 |
+
Supplementary Figure 18 shows information plane dynamics for a deep neural network with five hidden layers each containing 50 hidden units.
|
| 344 |
+
|
| 345 |
+

|
| 346 |
+
Figure 18: Information plane dynamics in a deep linear neural network. (A) Train and test error during learning. (B) Information plane dynamics. No compression is visible.
|
| 347 |
+
|
| 348 |
+
# G LINEAR MUTUAL INFORMATION CALCULATION
|
| 349 |
+
|
| 350 |
+
For the linear setting considered here, the mutual information between a hidden representation $T$ and the output $Y$ may be calculated using the relations
|
| 351 |
+
|
| 352 |
+
$$
|
| 353 |
+
\begin{array} { c } { { { \cal H } ( Y ) = \displaystyle \frac { N _ { o } } { 2 } \log ( 2 \pi e ) + \displaystyle \frac { 1 } { 2 } \log | W _ { o } W _ { o } ^ { T } + \sigma _ { o } ^ { 2 } I _ { N _ { o } } | , } } \\ { { { \cal H } ( T ) = \displaystyle \frac { N _ { h } } { 2 } \log ( 2 \pi e ) + \displaystyle \frac { 1 } { 2 } \log | \bar { W } \bar { W } ^ { T } + \sigma _ { M I } ^ { 2 } I _ { N _ { h } } | , } } \\ { { { \cal H } ( Y ; T ) = \displaystyle \frac { N _ { o } + N _ { h } } { 2 } \log ( 2 \pi e ) + \displaystyle \frac { 1 } { 2 } \log | \bar { W } \bar { W } ^ { T } + \sigma _ { M I } ^ { 2 } I _ { N _ { h } } \quad \quad \bar { W } W _ { o } ^ { T } , } } \\ { { { \cal I } ( Y ; T ) = { \cal H } ( Y ) + { \cal H } ( T ) - { \cal H } ( Y ; T ) . } } \end{array}
|
| 354 |
+
$$
|
| 355 |
+
|
| 356 |
+
# H STOCHASTIC VS BATCH TRAINING
|
| 357 |
+
|
| 358 |
+

|
| 359 |
+
Figure 19 shows information plane dynamics for stochastic and batch gradient descent learning in a linear network. Randomness in the training process does not dramatically alter the information plane dynamics.
|
| 360 |
+
Figure 19: Effect of stochastic training in linear networks. (A) Information plane dynamics for stochastic gradient descent in a linear network (same setting as Fig. 4). (B) Information plane dynamics for batch gradient descent.
|
| 361 |
+
|
| 362 |
+
# I GRADIENT SNR PHASE TRANSITION
|
| 363 |
+
|
| 364 |
+
The proposed mechanism of compression in Shwartz-Ziv & Tishby (2017) is noise arising from stochastic gradient descent training. The results in Section 4 of the main text show that compression still occurs under batch gradient descent learning, suggesting that in fact noise in the gradient updates is not the cause of compression. Here we investigate a related claim, namely that during training, networks switch between two phases. These phases are defined by the ratio of the mean of the gradient to the standard deviation of the gradient across training examples, called the gradient signal-to-noise ratio. In the first “drift” phase, the SNR is high, while in the second “diffusion” phase the SNR is low. Shwartz-Ziv & Tishby (2017) hypothesize that the drift phase corresponds to movement toward the minimum with no compression, while the diffusion phase corresponds to a constrained diffusion in weight configurations that attain the optimal loss, during which representations compress. However, two phases of gradient descent have been described more generally, sometimes known as the transient and stochastic phases or search and convergence phases (Murata, 1998; Chee & Toulis, 2017), suggesting that these phases might not be related specifically to compression behavior.
|
| 365 |
+
|
| 366 |
+
In Fig. 20 we plot the gradient SNR over the course of training for the tanh and ReLU networks in the standard setting of Shwartz-Ziv & Tishby (2017). In particular, for each layer $l$ we calculate the mean and standard deviation as
|
| 367 |
+
|
| 368 |
+
$$
|
| 369 |
+
\begin{array} { r c l } { { m _ { l } } } & { { = } } & { { \displaystyle \left\| \left. \frac { \partial E } { \partial W _ { l } } \right. \right\| _ { F } } } \\ { { s _ { l } } } & { { = } } & { { \displaystyle \left\| \mathrm { S T D } \left( \frac { \partial E } { \partial W _ { l } } \right) \right\| _ { F } } } \end{array}
|
| 370 |
+
$$
|
| 371 |
+
|
| 372 |
+
where $\langle \cdot \rangle$ denotes the mean and $S T D ( \cdot )$ denotes the element-wise standard deviation across all training samples, and $\left\| \cdot \right\| _ { F }$ denotes the Frobenius norm. The gradient SNR is then the ratio $m _ { l } / s _ { l }$ We additionally plot the norm of the weights $\| W _ { l } \| _ { F }$ over the course of training.
|
| 373 |
+
|
| 374 |
+
Both tanh and ReLU networks yield a similar qualitative pattern, with SNR undergoing a step-like transition to a lower value during training. Figures 9 and 10, fourth row, show similar plots for MNIST-trained networks. Again, SNR undergoes a transition from high to low over training. Hence the two phase nature of gradient descent appears to hold across the settings that we examine here. Crucially, this finding shows that the SNR transition is not related to the compression phenomenon because ReLU networks, which show the gradient SNR phase transition, do not compress.
|
| 375 |
+
|
| 376 |
+
Finally, to show the generality of the two-phase gradient SNR behavior and its independence from compression, we develop a minimal model of this phenomenon in a three neuron linear network. We consider the student-teacher setting of Fig. 3 but with $N _ { i } = N _ { h } = 1$ , such that the input and hidden layers have just a single neuron (as in the setting of Fig. 2). Here, with just a single hidden neuron, clearly there can be no compression so long as the first layer weight increases over the course of training. Figure 21AC shows that even in this simple setting, the SNR shows the phase transition but the weight norm increases over training. Hence again, the two phases of the gradient are present even though there is no compression. To intuitively understand the source of this behavior, note that the weights are initialized to be small and hence early in learning all must be increased in magnitude, yielding a consistent mean gradient. Once the network reaches the vicinity of the minimum, the mean weight change across all samples by definition goes to zero. The standard deviation remains finite, however, because on some specific examples error could be improved by increasing or decreasing the weights–even though across the whole dataset the mean error has been minimized.
|
| 377 |
+
|
| 378 |
+
Hence overall, our results show that a two-phase structure in the gradient SNR occurs in all settings we consider, even though compression occurs only in a subset. The gradient SNR behavior is therefore not causally related to compression dynamics, consistent with the view that saturating nonlinearities are the primary source of compression.
|
| 379 |
+
|
| 380 |
+

|
| 381 |
+
Figure 20: Gradient SNR phase transition. (A) tanh networks trained in the standard setting of Shwartz-Ziv & Tishby (2017) show a phase transition in every layer. (B) ReLU networks also show a phase transition in every layer, despite exhibiting no compression.
|
| 382 |
+
|
| 383 |
+

|
| 384 |
+
Figure 21: Minimal model exhibiting gradient SNR phase transition. Here a three neuron linear network (architecture $1 - 1 - 1 )$ learns to approximate a teacher. Other parameters are teacher $S N R = 1$ , number of training samples $P = 1 0 0$ , learning rate .001. Left column: (A) The loss over training with SGD (minibatch size 1). (C) The resulting gradient SNR dynamics. Right column: (B) The loss over training with BGD. (D) The resulting gradient SNR dynamics averaging over all training samples (not minibatches, see text).
|
md/train/ryxjnREFwH/ryxjnREFwH.md
ADDED
|
@@ -0,0 +1,413 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# NEURAL SYMBOLIC READER: SCALABLE INTEGRATION OF DISTRIBUTED AND SYMBOLIC REPRESENTATIONS FOR READING COMPREHENSION
|
| 2 |
+
|
| 3 |
+
Xinyun Chen ∗
|
| 4 |
+
UC Berkeley
|
| 5 |
+
xinyun.chen@berkeley.edu
|
| 6 |
+
|
| 7 |
+
Chen Liang, Adams Wei Yu, Denny Zhou Google Brain {crazydonkey,adamsyuwei,dennyzhou}@google.com
|
| 8 |
+
|
| 9 |
+
Dawn Song
|
| 10 |
+
UC Berkeley
|
| 11 |
+
dawnsong@cs.berkeley.edu
|
| 12 |
+
|
| 13 |
+
Quoc V. Le Google Brain qvl@google.com
|
| 14 |
+
|
| 15 |
+
# ABSTRACT
|
| 16 |
+
|
| 17 |
+
Integrating distributed representations with symbolic operations is essential for reading comprehension requiring complex reasoning, such as counting, sorting and arithmetics, but most existing approaches rely on specialized neural modules and are hard to adapt to multiple domains or multi-step reasoning. In this work, we propose the Neural Symbolic Reader (NeRd), which includes a reader, e.g., BERT, to encode the passage and question, and a programmer, e.g., LSTM, to generate a program for multi-step reasoning. By using operators like span selection, the program can be executed over text to generate the answer. Compared to previous works, NeRd is more scalable in two aspects: (1) domain-agnostic, i.e., the same neural architecture works for different domains; (2) compositional, i.e., complex programs can be generated by compositionally applying the symbolic operators. Furthermore, to overcome the challenge of training NeRd with weak supervision, we apply data augmentation techniques and hard ExpectationMaximization (EM) with thresholding. On DROP, a challenging reading comprehension dataset requiring discrete reasoning, NeRd achieves $1 . 3 7 \% / 1 . 1 8 \%$ absolute gain over the state-of-the-art on Exact-Match/F1 metrics. With the same architecture, NeRd significantly outperforms the baselines on MathQA, a math problem benchmark that requires multiple steps of reasoning, by $2 5 . 5 \%$ absolute gain on accuracy when trained on all the annotated programs, and more importantly, still beats the baselines even with only $20 \%$ of the program annotations.
|
| 18 |
+
|
| 19 |
+
# 1 INTRODUCTION
|
| 20 |
+
|
| 21 |
+
Deep neural networks have achieved remarkable successes in natural language processing recently. In particular, pretrained language models, e.g., BERT (Devlin et al., 2019), have significantly advanced the state-of-the-art in reading comprehension. While neural models have demonstrated performance superior to humans on some benchmarks, e.g., SQuAD (Rajpurkar et al., 2016), so far such progress is mostly limited to extractive question answering, in which the answer is a single span from the text. In other words, this type of benchmarks usually test the capability of text pattern matching, but not of reasoning. Some recent datasets, e.g., DROP (Dua et al., 2019) and MathQA (Amini et al., 2019), are collected to examine the capability of both language understanding and discrete reasoning, where the direct application of the state-of-the-art pre-trained language models, such as BERT or QANet (Yu et al., 2018), achieves very low accuracy. This is especially challenging for pure neural network approaches, because discrete operators learned by neural networks, such as addition and sorting, can hardly generalize to inputs of arbitrary size without specialized design (Reed & de Freitas, 2016; Cai et al., 2017; Kaiser & Sutskever, 2015). Therefore, integrating neural networks with symbolic reasoning is crucial for solving those new tasks.
|
| 22 |
+
|
| 23 |
+
The recent progress on neural semantic parsing (Jia & Liang, 2016; Liang et al., 2017) is sparked to address this problem. However, such success is mainly restricted to question answering with structured data sources, e.g., knowledge graphs (Berant et al., 2013) or tabular databases (Pasupat & Liang, 2015). Extending it to reading comprehension by parsing the text into structured representations suffers severely from the cascade errors, i.e., the issues of the structured parsing for data preprocessing account for the poor performance of the learned neural model (Dua et al., 2019).
|
| 24 |
+
|
| 25 |
+

|
| 26 |
+
Figure 1: Comparison of NeRd with previous approaches for reading comprehension requiring complex reasoning. The components in grey boxes are the neural architectures. Previous works mainly take two approaches: (1) augmenting pre-trained language model such as BERT with specialized modules for each type of questions, which is hard to scale to multiple domains or multi-step complex reasoning; (2) applying neural semantic parser to the structured parses of the passage, which suffers severely from the cascade error. In contrast, the neural architecture of NeRd is domain-agnostic, which includes a reader, e.g., BERT, and a programmer, e.g., LSTM, to generate compositional programs that are directly executed over the passages.
|
| 27 |
+
|
| 28 |
+
A recent line of work (Dua et al., 2019; Hu et al., 2019; Andor et al., 2019) extends BERT/QANet to perform reasoning on the DROP dataset. However, they cannot easily scale to multiple domains or multi-step complex reasoning because: (1) they usually rely on handcrafted and specialized modules for each type of questions; (2) they don’t support compositional applications of the operators, so it is hard to perform reasoning of more than one step.
|
| 29 |
+
|
| 30 |
+
In this work, we propose the Neural Symbolic Reader (NeRd) for reading comprehension, which consists of (1) a reader that encodes passages and questions into vector representations; and (2) a programmer that generates programs, which are executed to produce answers. The key insights behind NeRd are as follows: (1) by introducing a set of span selection operators, the compositional programs, usually executed against structured data such as databases in semantic parsing, can now be executed over text; (2) the same architecture can be applied to different domains by simply extending the set of symbolic operators.
|
| 31 |
+
|
| 32 |
+
A main challenge of training NeRd is that it is often expensive to collect program annotations, so the model needs to learn from weak supervision, i.e., with access only to the final answers. This raises two problems for learning: (1) cold start problem. There are no programs available at the beginning of training, so the training cannot proceed. We address this problem through data augmentation that generates noisy training data to bootstrap the training; (2) spurious program problem, where some programs produce the right answer for wrong rationales. We propose an iterative process using hard EM with thresholding, which filters out the spurious programs during training.
|
| 33 |
+
|
| 34 |
+
In our evaluation, NeRd demonstrates three major advantages over previous methods: (1) better accuracy. It outperforms the previous state-of-the-art on DROP by $1 . 3 7 \% / 1 . 1 8 \%$ on EM/F1, and the baselines on MathQA by a large margin of $2 5 . 5 \%$ on accuracy if trained with all annotated programs. Notably, it still outperforms the MathQA baselines using only $20 \%$ of the program annotations; (2) more scalable (domain-agnostic and compositional). Unlike previous approaches, which rely on specialized modules that do not support compositional application of the operators, NeRd can be applied to tasks of different domains, e.g., DROP and MathQA, without changing the architecture, and more complex programs can be simply generated by extending the set of operators and compositionally applying them; (3) better interpretability. It is easier to interpret and verify an answer by inspecting the program that produces it, especially for the questions involving complex reasoning such as counting and sorting.
|
| 35 |
+
|
| 36 |
+
# 2 NEURAL SYMBOLIC READER
|
| 37 |
+
|
| 38 |
+
In this section, we present the design of NeRd. It consists of a reader that encodes the passages and questions into vector representations, and a programmer that generates programs in a domain specific language. The overall comparison between NeRd and previous works is visualized in Figure 1.
|
| 39 |
+
|
| 40 |
+
# 2.1 NEURAL ARCHITECTURE
|
| 41 |
+
|
| 42 |
+
We provide an overview of the two components in NeRd, and defer more details to Appendix C.
|
| 43 |
+
|
| 44 |
+
Reader. Given the natural language text including a question and a passage, the reader component encodes each token $t _ { i }$ in the text into an embedding $e _ { i }$ . Note that our framework is agnostic to the architecture choice of the encoder, so any neural module that turns words into vectors is applicable, e.g., BERT (Devlin et al., 2019).
|
| 45 |
+
|
| 46 |
+
Programmer. The programmer takes the output of the reader as input, and then decodes a program as a sequence of tokens. Again, our model is agnostic to the design of decoder. For simplicity, we use an LSTM (Hochreiter & Schmidhuber, 1997) decoder with attention (Bahdanau et al., 2014) over the encoded text, and self-attention (Vaswani et al., 2017) over the previously generated tokens.
|
| 47 |
+
|
| 48 |
+
A major advantage of our architecture is that it is domain-agnostic, i.e., the same architecture can be used for different domains. Compared to previous approaches that craft separate specialized modules for each answer type, we use a unified programmer component to generate programs for multi-step reasoning, and we can simply extend the operator set in the domain specific language (see the next section) to adapt to a different domain. See Section 4.3 for a more detailed discussion.
|
| 49 |
+
|
| 50 |
+
# 2.2 DOMAIN SPECIFIC LANGUAGE
|
| 51 |
+
|
| 52 |
+
In this section, we introduce our domain specific language (DSL), which is used to interpret the tokens generated by the programmer component as an executable program.
|
| 53 |
+
|
| 54 |
+
We list the operators in our DSL in Table 1. To handle discrete reasoning, the DSL includes operators that perform arithmetics (DIFF, SUM), counting (COUNT) and sorting (ARGMAX, ARGMIN, MAX, MIN). These operators have been used in previous work in semantic parsing over structured data sources such as a knowledge graph or a tabular database.
|
| 55 |
+
|
| 56 |
+
However, the main challenge of applying such operations for reading comprehension is that the model needs to manipulate unstructured data, i.e., natural language text, and parsing the text into structured representations may introduce a lot of cascade errors. For example, Dua et al. (2019) found that their best performing semantic parsing pipeline using SRL (Carreras & Marquez, 2004) \` can only find the logical forms for $3 5 \%$ of the questions, resulting in poor performance.
|
| 57 |
+
|
| 58 |
+
To address this issue, a key insight in our DSL design is to introduce the span selection operators, so that all the arithmetics, counting and sorting operators can be applied to text. Specifically, we introduce PASSAGE_SPAN, QUESTION_SPAN, VALUE, KEY-VALUE for selecting spans or numbers from the passage and question. For example, COUNT can use PASSAGE_SPAN to pick out the spans that mention the relevant entities or events, e.g., touchdowns made by a certain person, and then returns the total number; ARGMAX relies on applying KEY-VALUE to pick out the spans (keys) for relevant mentions and their associated numbers (values), e.g., touchdowns and their lengths, and then returns the key with the highest value, e.g., the player kicking the longest touchdown. More examples can be found in Table 2. In summary, the introduction of span selection operators in the DSL enables the application of the discrete reasoning operators to text, and the resulting programs act as executable and interpretable representations of the reasoning process.
|
| 59 |
+
|
| 60 |
+
As mentioned above, our architecture is domain-agnostic and the only change needed, to apply to a different domain, is to extend the DSL with new operators. For example, MathQA benchmark requires adding more advanced mathematical operations beyond addition and subtraction, which are defined in Amini et al. (2019). We defer the details to Section 4.1.
|
| 61 |
+
|
| 62 |
+
A major advantage of our DSL is its compositionality, i.e., complex programs can be generated by compositionally applying the operators. Previous works (Andor et al., 2019) only allow applying the operators for one step, which requires them to introduce operators to mimic two-step compositions, e.g., Merge (selecting two spans) and Sum3 (summing up three numbers). However, this would not scale to more steps of reasoning, as the number of required operators will grow exponentially w.r.t the number of steps. In contrast, NeRd can compose different operators to synthesize complex programs for multi-step reasoning. For example, on MathQA, the average number of operations per question is 5, and some programs apply more than 30 operations to compute the final answer.
|
| 63 |
+
|
| 64 |
+
<table><tr><td>Operator</td><td>Arguments</td><td>Outputs</td><td>Description</td></tr><tr><td>PASSAGE_SPAN QUESTION_SPAN</td><td>vO: the start index. v1: the end index.</td><td>a span.</td><td>Select a span from the passage or question.</td></tr><tr><td>VALUE</td><td>vO: an index.</td><td>a number.</td><td>Select a number from the passage.</td></tr><tr><td>KEY-VALUE (KV)</td><td>vo: a span. v1: a number.</td><td>a key-value pair.</td><td>Select a key (span) value (number) pair from the passage.</td></tr><tr><td>DIFF SUM</td><td>vO:a number or index. vl: a number or index.</td><td>a number.</td><td>Compute the difference or sum of two numbers.</td></tr><tr><td>COUNT</td><td>v: a set of spans.</td><td>a number.</td><td>Count the number of given spans.</td></tr><tr><td>MAX MIN</td><td>v:a set of numbers.</td><td>a number.</td><td>Select the maximum /minimum among the given numbers.</td></tr><tr><td>ARGMAX ARGMIN</td><td>v:a set of key-value pairs.</td><td>a span.</td><td>Select the key (span) with the highest /lowest value.</td></tr></table>
|
| 65 |
+
|
| 66 |
+
Table 1: Overview of our domain-specific language. See Table 2 for the sample usage.
|
| 67 |
+
|
| 68 |
+
# 3 TRAINING WITH WEAK SUPERVISION
|
| 69 |
+
|
| 70 |
+
Although it is relatively easy to collect question-answer pairs, it is often hard and expensive to obtain program annotations that represent the reasoning behind the answers. Thus, how to train NeRd with only weak supervision becomes a main challenge. In this section, we revisit the cold start and spurious program problems described in Section 1, and present our solutions.
|
| 71 |
+
|
| 72 |
+
# 3.1 DATA AUGMENTATION FOR COLD START
|
| 73 |
+
|
| 74 |
+
The cold start problem means that the training cannot get started when there isn’t any program available. For example, a question “How many touchdowns did Brady throw” annotated with only an answer $\mathbf { \ddot { \delta } } ^ { 6 } 3 ^ { \mathit { * } }$ cannot be directly used to train our model due to the lack of the target program to optimize on. To obtain program annotations from question-answer pairs, we first follow previous work to find programs for questions answerable by span selection or arithmetic operations via an exhaustive search, and we defer the details to Section 4.2. However, for questions involving counting or sorting operations, the space becomes too large for an exhaustive search, since these operations rely on the span selection as their sub-routines. For example, the number of possible spans in a text with 200 words is in the order of $1 0 ^ { 4 }$ , and what’s more, counting and sorting operators usually include more than one span as their arguments.
|
| 75 |
+
|
| 76 |
+
We apply data augmentation to address the search space explosion problem for counting and sorting operations. For counting, we augment the span selection questions by replacing the interrogatives, e.g., “what” and “who”, with “how many” when applicable, and adding a call to COUNT over the selected spans in the answer. For example, a question “What areas have a Muslim population of more than 50000 people?” is changed into “How many areas...”. For sorting, we extract the key-value pairs by first applying CoreNLP (Manning et al., 2014) for entity recognition, and then heuristically find an associated number for each entity. If including them as the arguments of any sorting operator yields the correct answer, then such programs are added to the training set. More details can be found in Appendix D.1. Although the programs found for counting and sorting through this data augmentation process is noisy, they help bootstrap the training. Throughout the training, we also use the model to decode programs, and add those leading to correct answers into our training set.
|
| 77 |
+
|
| 78 |
+
# 3.2 HARD EM WITH THRESHOLDING AGAINST SPURIOUS PROGRAMS
|
| 79 |
+
|
| 80 |
+
After collecting a set of programs for each question-answer pair, another obstacle is the spurious program problem, the phenomenon that a wrong program accidentally predicts a right answer. For example, per arithmetic question in DROP, there are on average 9.8 programs that return correct answers, but usually only one of them is semantically correct.
|
| 81 |
+
|
| 82 |
+
# Algorithm 1 Hard EM with Thresholding
|
| 83 |
+
|
| 84 |
+
Input: question-answer pairs $\{ ( x _ { i } , y _ { i } ) \} _ { i = 1 } ^ { N }$ ,
|
| 85 |
+
a model $p _ { \theta }$ , initial threshold $\alpha _ { 0 }$ , decay factor $\gamma$
|
| 86 |
+
for each $( x _ { i } , y _ { i } )$ do $Z _ { i } \gets$ DataAugmentation $( x _ { i } , y _ { i } )$
|
| 87 |
+
$T \gets 0$
|
| 88 |
+
repeat $\mathbf { \Delta } _ { \mathcal { D } } ^ { \alpha \alpha _ { 0 } * \gamma ^ { T } }$ for each $( x _ { i } , y _ { i } )$ do $z _ { i } ^ { * } = \mathrm { a r g } \operatorname* { m a x } _ { k } p _ { \theta } ( z _ { i } ^ { k } | x _ { i } ) , z _ { i } ^ { k } \in Z _ { i }$ if $p _ { \theta } \big ( z _ { i } ^ { * } \big ) > \alpha$ or $T = 0$ and $| Z _ { i } | = 1$ then $\mathcal { D } \mathcal { D } \cup ( x _ { i } , z _ { i } ^ { * } ) _ { - }$ Update $\theta$ by maximizing $\begin{array} { r } { \sum _ { \mathcal { D } } \log p _ { \theta } ( z ^ { * } | x ) } \end{array}$ $T \gets T + 1$
|
| 89 |
+
until converge or early stop
|
| 90 |
+
|
| 91 |
+
To filter out spurious programs, we adopt hard EM (Liang et al., 2018; Min et al., 2019) due to its simplicity and efficiency. Specifically, this approach uses the current model to select the program with the highest model probability among the ones that return the correct answer, and then maximizes the likelihood of the selected program. In other words, it relies on the neural model itself to filter out spurious programs. This algorithm is usually faster than the marginalized approach (Berant et al., 2013) because at most one program per question-answer pair is used to compute the gradient, and the selection process is fast since it only has a forward pass.
|
| 92 |
+
|
| 93 |
+
Hard EM assumes that for any question
|
| 94 |
+
|
| 95 |
+
answer pair, at least one of the generated programs is correct. However, there exist questions without any semantically correct program found, e.g., when the annotated answer itself is wrong. In this case, when directly applying the hard EM algorithm, even if the model probabilities for all the programs are very small, it will still select a program for training. RL-based approaches such as MAPO (Liang et al., 2018) avoid this issue by optimizing the expected return, which weighs the gradient by the model probability. Thus, when all the programs of a question-answer pair have very small probabilities, they will be largely ignored during training. We incorporate this intuition into hard EM by introducing a decaying threshold $\alpha$ , so that a program’s probability has to be at least $\alpha$ in order to be included for training. Our experiments show that both hard EM and thresholding are crucial for successful training. The pseudo-code of our training procedure is presented in Algorithm 1, and we defer more details to Appendix D.2.
|
| 96 |
+
|
| 97 |
+
# 4 EVALUATION
|
| 98 |
+
|
| 99 |
+
In this section, we demonstrate the effectiveness of our approach on DROP (Dua et al., 2019) and MathQA (Amini et al., 2019), two recent benchmarks that require discrete reasoning over passages.
|
| 100 |
+
|
| 101 |
+
# 4.1 DATASETS
|
| 102 |
+
|
| 103 |
+
DROP. DROP (Discrete Reasoning Over Paragraphs) (Dua et al., 2019) is designed to combine the challenges from both reading comprehension and semantic parsing communities. Specifically, the passages are collected from Wikipedia, each having at least twenty numbers. The question-answer pairs are crowdsourced in an adversarial way that they are accepted only when the questions cannot be correctly answered by the BiDAF model (Seo et al., 2017). The dataset has 96.6K questionanswer pairs from 6.7K passages. Unlike most existing datasets that are solely based on the single span selection, the questions in DROP require complex reasoning, such as selecting multiple spans, arithmetic operations over numbers in the passage, counting and sorting, etc., which poses extra challenge for existing models. For example, vanilla BERT only gets around $30 \%$ F1 score. Table 2 provides some sample questions in DROP, and their corresponding programs in our DSL (Table 1).
|
| 104 |
+
|
| 105 |
+
For evaluation, we use the same metrics in Dua et al. (2019): (1) Exact Match (EM), where the score is 1 if the prediction exactly matches the ground truth, and 0 otherwise; (2) F1 score, which gives partial credits to a prediction that is not exactly the same as the ground truth, but overlaps with it.
|
| 106 |
+
|
| 107 |
+
MathQA. MathQA (Amini et al., 2019) is a dataset with 37K question-answer pairs selected from AQuA (Ling et al., 2017), but it is further annotated with gold programs in their domain-specific language. The passage length in MathQA is 38 on average, much shorter than DROP with 224. However, the questions in MathQA require more complex and advanced mathematical reasoning than DROP. To this aim, they design 58 math operations, which cover various advanced math topics including geometry, physics, probability, etc. Accordingly, we augment our DSL with those operators to support more advanced numerical reasoning. In these annotated programs, the average number of operations per question is 5, and some programs involve more than 30 steps of computation. Table 3 shows an example from MathQA.
|
| 108 |
+
|
| 109 |
+
Table 2: Examples of correct predictions on DROP development set.
|
| 110 |
+
|
| 111 |
+
<table><tr><td>Passage</td><td>Question&Answer</td></tr><tr><td colspan="2">Multiple spans</td></tr><tr><td>...the population was spread out with 26.20% under the age of18,9.30% from 18 to 24, 26.50% from 25 to 44,23.50% from 45 to 64, and 14.6o% who were 65 years of age or older..</td><td>Question:Which groups in percent are larger than 16%? Program: PASSAGE_SPAN(26,30), PASSAGE_SPAN(46,48), PASSAGE_SPAN(55,57)</td></tr><tr><td>Date When major general Nathanael Greene took</td><td>Result: ‘under the age of 18’,‘25 to 44',‘45 to 64' Question: When did Marion rescue the American force?</td></tr><tr><td>command in the south,Marion and lieutenant colonel Henry Lee were ordered in January 1781... On August 31, Marion rescued a small American force trapped by 5Oo British sol- diers...</td><td>Program: PASSAGE_SPAN(71,71), PASSAGE_SPAN(72,72), PASSAGE_SPAN(32.32)</td></tr><tr><td>Numerical operations</td><td>Result: 'August','3i','1781'</td></tr><tr><td>...Lassen county had a population of 34,895. The racial makeup of Lassen county was 25.532 (73.2%) white (U.S. census),2,834 (8.1%)</td><td>Question: How many people were not either solely white or solely African American? Program: DIFF(9,SUM(10,12))</td></tr><tr><td>African American (U.S.census)... ...the Bolshevik party came to powerin Novem-</td><td>Result: 34895 - (25532 + 2834)= 6529 Counting</td></tr><tr><td>ber 1917 through the simultaneous election in the soviets and an organized uprising sup- ported by military mutiny..</td><td>Question: How many factors were involved in bringing the Bolsheviks to power? Program: COUNT(PASSAGE_SPAN(62,66),PASSAGE_SPAN(69,74)) Result: COUNT( 'simultaneous election in the soviets',</td></tr><tr><td>Sorting</td><td>'organized uprising supported by military mutiny')= 2</td></tr><tr><td>...Jaguarskicker Josh Scobee managed to get a 48-yard field goal..with kicker Nate Kaeding getting a 23-yard field goal...</td><td>Question:Who kicked the longest field goal? Program: ARGMAX( KV(PASSAGE_SPAN(50,53),VALUE(9)), KV(PASSAGE_SPAN(92,94),VALUE(11))) Result: ARGMAX(KV(Josh Scobee',48),KV(Nate Kaeding',23))</td></tr><tr><td>...Leftwich flippeda1-yard touchdown pass to Wrighster..Leftwich threw a 16- yard touch- down pass to Williams for a 38-O lead.</td><td>=‘Josh Scobee' Question:How many yardswas the shortest touchdown pass? Program: MIN(VALUE(17), VALUE(19)) Result: MIN(1,16)= 1</td></tr></table>
|
| 112 |
+
|
| 113 |
+
<table><tr><td>Question</td><td>Answer</td></tr><tr><td>Someone on a skateboard is traveling 8 miles per hour.How many feet does she travel in 5 seconds? (1 mile = 5280 feet)</td><td>Program: multiply(5,divide(multiply(8,5280),const_3600)) Result: 5 *((8* 5280)/3600)=58.67 ft</td></tr></table>
|
| 114 |
+
|
| 115 |
+
Table 3: An example in MathQA dataset.
|
| 116 |
+
|
| 117 |
+
Note that each question in MathQA is accompanied with 4 options, where 1 of them is the correct answer. However, since we do not have the full knowledge of the operation semantics, we choose a conservative metric to evaluate the accuracy: a predicted program is considered to be correct only if it is exactly the same as the annotated program. Thus, this metric is an under-estimation of the accuracy based on the execution results. Despite that we use a much stricter measurement in our evaluation, we show that NeRd still outperforms the baselines by a large margin.
|
| 118 |
+
|
| 119 |
+
# 4.2 IMPLEMENTATION DETAILS
|
| 120 |
+
|
| 121 |
+
DROP. Similar to previous work (Dua et al., 2019), for span prediction, we perform an exhaustive search to find all mentions of the ground truth spans in the passage, then include all of them as candidate programs. For numerical questions, we perform another exhaustive search over all expressions applying addition and subtraction over up to 3 numbers. In this way, we are able to find at least one program for over $9 5 \%$ of the training samples with a number as the answer. Our data augmentation approach for counting and sorting questions can be seen in Section 3.1.
|
| 122 |
+
|
| 123 |
+
MathQA. Besides the setting where all the ground truth programs are provided during training, we also evaluate the weak supervision setting on MathQA. Due to the lack of program executor, we are unable to perform the search similar to what we have done on DROP. To enable the first training iteration of the model, we assume that we have access to the ground truth programs for a small fraction of training samples at the beginning, and only know the final answer for the rest of training samples. In the first training iteration, the model only trains on the samples annotated with programs. In each of the following iterations, we first run a beam search with a beam size 64 to generate programs for each training sample that has not been annotated in previous iterations, and add the generated program only if it is exactly the same as the ground truth annotation.
|
| 124 |
+
|
| 125 |
+
For a fair comparison, our reader uses the same pre-trained model as (Hu et al., 2019; Andor et al., 2019), i.e., BERTLARGE. For both benchmarks, we perform greedy decoding during the evaluation.
|
| 126 |
+
|
| 127 |
+
# 4.3 BASELINES
|
| 128 |
+
|
| 129 |
+
DROP. We evaluate NeRd against three types of baselines: (1) previous models on DROP; (2) NeRd with and without counting and sorting operations; (3) NeRd with different training algorithms, and we discuss the details below.
|
| 130 |
+
|
| 131 |
+
Previous approaches. We compare with NAQANet (Dua et al., 2019), NABERT (Hu et al., 2019), MTMSN (Hu et al., 2019), and BERT-Calc (Andor et al., 2019). We have discussed the key differences between NeRd and BERT-Calc, the baseline with the best performance, in Section 2.2. On the other hand, NAQANet, NABERT, MTMSN share the same overall framework, where they augment an existing model to include individual modules for span selection, numerical expression generation, counting, negation, etc. While NAQANet is based on QANet, other baselines as well as NeRd are based on BERT. Note that the span selection modules themselves are not able to handle questions that return multiple spans as the answer, which causes the exact match accuracy to be zero on multiple-span selection questions for both NAQANet and NABERT. To tackle this issue, MTMSN adapts the non-maximum suppression algorithm (Rosenfeld & Thurston, 1971) to select multiple spans from the candidates with the top prediction probabilities.
|
| 132 |
+
|
| 133 |
+
Operator variants of NeRd. To show that NeRd learns to apply counting and sorting operations appropriately, we also evaluate the following two variants: (1) NeRd without counting: we remove the COUNT operation in Table 1, and introduce 10 operations COUNT_0, COUNT_1, ..., COUNT_9, where the execution engine returns the number $x$ for operation COUNT_X. This counting process is the same as (Andor et al., 2019). (2) NeRd without sorting: we remove ARGMAX, ARGMIN, MAX and MIN operations, so that the model needs to use span selection operations for sorting questions.
|
| 134 |
+
|
| 135 |
+
Training variants of NeRd. To show the effectiveness of our training algorithm, we compare with the following baselines: (1) Hard EM described in Section 3.2; and (2) Maximum Likelihood, which maximizes the likelihood of each program that returns the correct answer for a training sample.
|
| 136 |
+
|
| 137 |
+
MathQA. We compare with Seq2prog and Seq2prog+cat models in Amini et al. (2019), which are LSTM-based encoder-decoder architectures implemented in OpenNMT (Klein et al., 2018). In particular, Seq2prog+cat extracts the category label of each question, then trains separate LSTMs to handle different categories, which improves the accuracy by $\mathrm { \bar { 2 . 3 \% } }$ .
|
| 138 |
+
|
| 139 |
+
# 4.4 RESULTS
|
| 140 |
+
|
| 141 |
+
DROP. Table 4 summarizes our main evaluation results on DROP dataset, with 9.5K samples in the development set and 9.6K hidden samples in the test set. Note that NABERTLARGE was not evaluated on the test set (Hu et al., 2019). Specifically, we train $1 0 \ \mathrm { N e R d }$ models with the best configuration from different random initialization, present the mean and standard error of the results on the development set, and submit a single model to obtain the result on the hidden test set. We can observe that on test set, NeRd outperforms previous models by $1 . 3 7 \%$ on exact match, and $1 . 1 8 \%$ on F1 score. Notice that in (Andor et al., 2019), they train their BERT-Calc model on CoQA (Reddy et al., 2019) in addition to DROP, and they also evaluate an ensemble with 6 models, resulting in the exact match of 78.14, and F1 score of 81.78 on test set. However, we can see that without additional training data and ensembling, NeRd still beats their single model, and the performance is on par with their ensemble model.
|
| 142 |
+
|
| 143 |
+
<table><tr><td></td><td colspan="2">Overall Dev</td><td colspan="2">Overall Test</td><td colspan="2">Number (62%)</td><td colspan="2">Span (32%)</td><td colspan="2">Spans (4.4%)</td><td colspan="2">Date (1.6%)</td></tr><tr><td>NAQANet</td><td>EM</td><td>F1</td><td>EM</td><td>F1</td><td>EM</td><td>F1</td><td>EM</td><td>F1</td><td>EM</td><td>F1</td><td>EM</td><td>F1</td></tr><tr><td>NABERTLARGE</td><td>46.75</td><td>50.39</td><td>44.24</td><td>47.77</td><td>44.9</td><td>45.0</td><td>58.2</td><td>64.8</td><td>0.0</td><td>27.3</td><td>32.0</td><td>39.6</td></tr><tr><td></td><td>64.61</td><td>67.35</td><td>1</td><td>一</td><td>63.8</td><td>64.0</td><td>75.9</td><td>80.6</td><td>0.0</td><td>22.7</td><td>55.7</td><td>60.8</td></tr><tr><td>MTMSNLARGE</td><td>76.68</td><td>80.54</td><td>75.85</td><td>79.85</td><td>80.9</td><td>81.1</td><td>77.5</td><td>82.8</td><td>25.1</td><td>62.8</td><td>55.7</td><td>69.0</td></tr><tr><td>BERT-Calc</td><td>78.09</td><td>81.65</td><td>76.96</td><td>80.53</td><td>82.0</td><td>82.1</td><td>78.8</td><td>83.4</td><td>5.1</td><td>45.0</td><td>58.1</td><td>61.8</td></tr><tr><td>NeRd</td><td>78.55 ±0.27</td><td>81.85 ±0.20</td><td>78.33</td><td>81.71</td><td>82.4 ±0.3</td><td>82.6 ±0.2</td><td>76.2 ±0.4</td><td>81.8 ±0.2</td><td>51.3 ±0.8</td><td>77.6 ±1.2</td><td>58.3 ±1.8</td><td>67.2 ±1.7</td></tr></table>
|
| 144 |
+
|
| 145 |
+
Table 4: Results on DROP dataset. On the development set, we present the mean and standard error of $1 0 \ \mathrm { N e R d }$ models, and the test result of a single model. For all models, the performance breakdown of different question types is on the development set. Note that the training data of BERT-Calc model (Andor et al., 2019) for test set evaluation is augmented with $\mathrm { C o Q A }$ (Reddy et al., 2019).
|
| 146 |
+
|
| 147 |
+
<table><tr><td></td><td>with Sort Ops</td><td>w/o Sort Ops</td></tr><tr><td>EM</td><td>83.9</td><td>82.1</td></tr><tr><td>F1</td><td>86.8</td><td>85.5</td></tr></table>
|
| 148 |
+
|
| 149 |
+
Table 5: Results of counting and sorting questions on DROP development set, where we compare variants of NeRd with and without the corresponding operations. (a): counting; (b): sorting. For each setting, we present the best results on development set.
|
| 150 |
+
|
| 151 |
+
<table><tr><td></td><td>with Count Op</td><td>w/o Count op</td></tr><tr><td>EM</td><td>73.1</td><td>71.2</td></tr><tr><td>F1</td><td>73.1</td><td>71.2</td></tr></table>
|
| 152 |
+
|
| 153 |
+
To understand the strengths of NeRd, we first show examples of correct predictions in Table 2. We can observe that NeRd is able to compose multiple operations so as to obtain the correct answer, which helps boost the performance. In particular, for questions that require the selection of multiple spans, the exact match accuracy of NeRd is more than double of the best previous approach that specially designed for multi-span prediction, and the F1 score also improves around $1 5 \%$ . Meanwhile, NeRd is able to generate more complicated arithmetic expressions than Andor et al. (2019), thanks to the compositionality of our approach.
|
| 154 |
+
|
| 155 |
+
We further present our ablation studies of counting and sorting operations in Tables 5 and 6. Specifically, we evaluate on two subsets of DROP development set that include counting and sorting questions only, using the variants of NeRd with and without the corresponding operations. We can observe that adding these advanced operations can not only boost the performance, but also enable the model to provide the rationale behind its predictions. For counting problems, NeRd is able to select the spans related to the question. For sorting problems, NeRd first associates the entities with their corresponding values to compose the key-value pairs, then picks the most relevant ones for prediction. None of the previous models is able to demonstrate such reasoning processes, which suggests better interpretability of NeRd.
|
| 156 |
+
|
| 157 |
+
Finally, we present the results of different training algorithms in Table 7. First, we observe that by filtering spurious programs, the hard EM significantly boosts the performance of the maximum likelihood training for $1 \bar { 0 } \%$ , which may be due to the fact that the exhaustive search finds plenty of spurious programs that yield the correct answer. Adding the threshold for program selection provides further improvement of about $7 \%$ , indicating that our training algorithm can better handle the issue of spurious programs and be more tolerant to the noise of answer annotations. In Appendix E, we show some examples discarded by NeRd using the threshold, which mostly have the wrong answer annotations, e.g., incorrect numerical operations or missing part of the information in the question.
|
| 158 |
+
|
| 159 |
+
MathQA. We present the results on MathQA test set with around 3K samples in Table 8. NeRd dramatically boosts the accuracy of the baselines by $2 5 . 5 \%$ . In addition, we also evaluate a variant of NeRd with the same model architecture, but the BERT encoder is not pre-trained and is randomly initialized. We observe that this variant still yields a performance gain of $1 7 . 4 \%$ . Note that NeRd is measured by the program accuracy, which is a much stricter criterion and thus is an underestimation of the execution accuracy computed in (Amini et al., 2019). Moreover, even with only $2 0 \%$ training data labeled with ground truth programs, NeRd still outperforms the baseline.
|
| 160 |
+
|
| 161 |
+
# 5 RELATED WORK
|
| 162 |
+
|
| 163 |
+
Reading comprehension and question answering have recently attracted a lot of attention from the NLP community. A plethora of datasets have been available to evaluate different capabilities of
|
| 164 |
+
|
| 165 |
+
<table><tr><td rowspan=1 colspan=3>Passage</td><td rowspan=1 colspan=1>Question&Prediction</td></tr><tr><td rowspan=3 colspan=3>...with field goals of 38and 36 yards by kickerDan Carpenter.. fol-lowed bya 43-yard fieldgoal by Carpenter... 52-yard field goal...</td><td rowspan=1 colspan=1>Question:Howmany total field goalswere kicked in the game?</td></tr><tr><td rowspan=1 colspan=1>PredictedProgram:COUNT(PASSAGE_SPAN(75,75),PASSAGE_SPAN(77,78),PASSAGE_SPAN(133,135),PASSAGE_SPAN(315,317))Result:COUNT(‘38',36 yards',‘43-yard',‘52-yard')= 4</td></tr><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>Predicted Program (-counting): COUNT5 Result: 5</td></tr><tr><td rowspan=3 colspan=3>with the five mostcommon surgeries beingbreast augmentation,li-posuction, breast reduc-tion,eyelid surgery andabdominoplasty..</td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1>Predicted Program:COUNT(PASSAGE_SPAN(132,135),PASSAGE_SPAN(140,142),PASSAGE_SPAN(144,149))Result: COUNT(‘liposuction',‘eyelid surgery',‘abdominoplasty') = 3</td></tr><tr><td rowspan=1 colspan=1>Predicted Program (-counting): COUNT4 Result: 4</td></tr></table>
|
| 166 |
+
|
| 167 |
+
(a)
|
| 168 |
+
(b)
|
| 169 |
+
|
| 170 |
+
<table><tr><td rowspan=1 colspan=1>Passage</td><td rowspan=1 colspan=1>Question&Prediction</td></tr><tr><td rowspan=2 colspan=1>...Inthe third quarter,Arizona'sdeficit continued to climb as Cas-sel completed a 76-yard touchdownpass to wide receiver Randy Moss... quarterback Matt Leinart com-pleted a 78-yard touchdown pass to</td><td rowspan=1 colspan=1>Question:Who threw the longest touchdown pass?</td></tr><tr><td rowspan=1 colspan=1>Predicted Program:ARGMAX(KV(PASSAGE_SPAN(205,208),VALUE(18)),KV(PASSAGE_SPAN(142,143), VALUE(14)))Result:ARGMAX(KV(Matt Leinart',78),KV(‘Cassel',76))=‘MattLeinart'</td></tr><tr><td rowspan=1 colspan=1>wide receiver Larry Fitzgerald ..</td><td rowspan=1 colspan=1>Predicted Program (-sorting):PASSAGE_SPAN(82,84) Result:Matt Cassel</td></tr><tr><td rowspan=3 colspan=1>Carney got a 38-yard field goal... with Carney connecting on a 39-yard field goal..</td><td rowspan=1 colspan=1>Question: How many yards was the longest field goal?</td></tr><tr><td rowspan=1 colspan=1>Predicted Program: MAX(VALUE(14),VALUE(11))Result: MAX(39,38)= 39</td></tr><tr><td rowspan=1 colspan=1>Predicted Program (-sorting): VALUE(11) Result: 38</td></tr></table>
|
| 171 |
+
|
| 172 |
+
Table 6: Examples of counting and sorting questions on DROP development set, where NeRd with the corresponding operations gives the correct predictions, while the variants without them do not. (a): counting; (b): sorting.
|
| 173 |
+
|
| 174 |
+
Table 7: Results of different training algorithms on DROP development set. For each setting, we present the best results on the development set.
|
| 175 |
+
|
| 176 |
+
<table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>EM</td><td rowspan=1 colspan=1>F1</td></tr><tr><td rowspan=1 colspan=1>HardEMwith thresholding</td><td rowspan=1 colspan=1>80.58</td><td rowspan=1 colspan=1>83.42</td></tr><tr><td rowspan=1 colspan=1>Hard EM</td><td rowspan=1 colspan=1>73.72</td><td rowspan=1 colspan=1>77.46</td></tr><tr><td rowspan=1 colspan=1>MaximumLikelihood</td><td rowspan=1 colspan=1>63.96</td><td rowspan=1 colspan=1>67.98</td></tr></table>
|
| 177 |
+
|
| 178 |
+
<table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>Accuracy</td></tr><tr><td rowspan=1 colspan=1>Seq2prog</td><td rowspan=1 colspan=1>51.9</td></tr><tr><td rowspan=1 colspan=1>Seq2prog+cat</td><td rowspan=1 colspan=1>54.2</td></tr><tr><td rowspan=1 colspan=1>NeRd</td><td rowspan=1 colspan=1>79.7</td></tr><tr><td rowspan=1 colspan=1>NeRd (-pretraining)</td><td rowspan=1 colspan=1>71.6</td></tr><tr><td rowspan=1 colspan=1>NeRd (20%)</td><td rowspan=1 colspan=1>56.5</td></tr></table>
|
| 179 |
+
|
| 180 |
+
Table 8: Results on MathQA test set, with NeRd and two variants: (1) no pre-training; (2) using $20 \%$ of the program annotations in training.
|
| 181 |
+
|
| 182 |
+
the models, such as SQuAD (Rajpurkar et al., 2016), CoQA (Reddy et al., 2019), GLUE (Wang et al., 2019), etc. A bunch of representative models are proposed for these benchmarks, including BiDAF (Seo et al., 2017), r-net (Wang et al., 2017), DrQA (Chen et al., 2017), DCN (Xiong et al., 2016) and QANet (Yu et al., 2018). More recently, massive text pre-training techniques, e.g., ELMo (Peters et al., 2018), BERT (Devlin et al., 2019), XLNet (Yang et al., 2019) and Roberta (Liu et al., 2019), have achieved superior performance on these tasks. However, for more complicated tasks that require logical reasoning, pre-trained models alone are insufficient.
|
| 183 |
+
|
| 184 |
+
On the other hand, semantic parsing has recently seen a lot of progress from the neural symbolic approaches. Jia & Liang (2016); Dong & Lapata (2016); Zhong et al. (2017) applied neural sequenceto-sequence and sequence-to-tree models to semantic parsing with full supervision. Liang et al. (2017); Neelakantan et al. (2016); Krishnamurthy et al. (2017); Guu et al. (2017); Liang et al. (2018) have advanced the state-of-the-art in weakly supervised semantic parsing on knowledge graphs and tabular databases. However, most of the successes of semantic parsing are limited to structured data sources. In contrast, our work naturally extends the complex reasoning in semantic parsing to reading comprehension by introducing the span selection operators. Several methods for training with weak supervision have been proposed in the context of weakly supervised semantic parsing including Maximum Marginal Likelihood (Berant et al., 2013; Krishnamurthy et al., 2017; Dasigi et al., 2019; Guu et al., 2017), RL (Liang et al., 2017; 2018) and Hard EM (Liang et al., 2017; Min et al., 2019). Our approach is based on Hard EM due to its simplicity and efficiency, and extends it by adding a decaying threshold, which improves its robustness against spurious programs.
|
| 185 |
+
|
| 186 |
+
In the broader context, neural symbolic approaches have been applied to Visual Question Answering (Andreas et al., 2016; Mao et al., 2019; Johnson et al., 2017), where the neural architecture is composed with sub-modules based on the structured parses of the questions. Another line of work studied neural symbolic approaches to learn the execution of symbolic operations such as addition and sorting (Graves et al., 2014; Reed & de Freitas, 2016; Cai et al., 2017; Dong et al., 2019). In this work, we study neural symbolic approaches for reading comprehension tasks that require discrete reasoning over the text (Dua et al., 2019; Hu et al., 2019; Andor et al., 2019; Amini et al., 2019).
|
| 187 |
+
|
| 188 |
+
# 6 CONCLUSION
|
| 189 |
+
|
| 190 |
+
We presented the Neural Symbolic Reader (NeRd) as a scalable integration of distributed representations and symbolic operations for reading comprehension. NeRd architecture consists of a reader that encodes text into vector representation, and a programmer that generates programs, which will be executed to produce the answer. By introducing the span selection operators, our domain-agnostic architecture can generate compositional programs to perform complex reasoning over text for different domains by only extending the set of operators. We also overcome the challenge of weak supervision by applying data augmentation techniques and hard EM with thresholding. In our evaluation, using the same model architecture without any change, NeRd significantly surpasses previous state-of-the-arts on two challenging reading comprehension tasks, DROP and MathQA. We hope to motivate future works to introduce complex reasoning to other domains or other tasks in NLP, e.g., machine translation and language modeling, by extending the set of operators.
|
| 191 |
+
|
| 192 |
+
# REFERENCES
|
| 193 |
+
|
| 194 |
+
Aida Amini, Saadia Gabriel, Peter Lin, Rik Koncel-Kedziorski, Yejin Choi, and Hannaneh Hajishirzi. Mathqa: Towards interpretable math word problem solving with operation-based formalisms. arXiv preprint arXiv:1905.13319, 2019.
|
| 195 |
+
Daniel Andor, Luheng He, Kenton Lee, and Emily Pitler. Giving bert a calculator: Finding operations and arguments with reading comprehension. arXiv preprint arXiv:1909.00109, 2019.
|
| 196 |
+
Jacob Andreas, Marcus Rohrbach, Trevor Darrell, and Dan Klein. Learning to compose neural networks for question answering. arXiv:1601.01705, 2016.
|
| 197 |
+
Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. Neural machine translation by jointly learning to align and translate. arXiv:1409.0473, 2014.
|
| 198 |
+
Jonathan Berant, Andrew Chou, Roy Frostig, and Percy Liang. Semantic parsing on freebase from question-answer pairs. EMNLP, 2(5):6, 2013.
|
| 199 |
+
Rudy Bunel, Matthew Hausknecht, Jacob Devlin, Rishabh Singh, and Pushmeet Kohli. Leveraging grammar and reinforcement learning for neural program synthesis. In International Conference on Learning Representations, 2018.
|
| 200 |
+
Jonathon Cai, Richard Shin, and Dawn Song. Making neural programming architectures generalize via recursion. ICLR, 2017.
|
| 201 |
+
Xavier Carreras and Llu´ıs Marquez. Introduction to the conll-2004 shared task: Semantic role \` labeling. In Proceedings of the Eighth Conference on Computational Natural Language Learning (CoNLL-2004) at HLT-NAACL 2004, pp. 89–97, 2004.
|
| 202 |
+
Danqi Chen, Adam Fisch, Jason Weston, and Antoine Bordes. Reading wikipedia to answer opendomain questions. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics, ACL 2017, Vancouver, Canada, July 30 - August 4, Volume 1: Long Papers, pp. 1870–1879, 2017.
|
| 203 |
+
Pradeep Dasigi, Matt Gardner, Shikhar Murty, Luke Zettlemoyer, and Eduard Hovy. Iterative search for weakly supervised semantic 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. 2669–2680, 2019.
|
| 204 |
+
|
| 205 |
+
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, 2019.
|
| 206 |
+
|
| 207 |
+
Honghua Dong, Jiayuan Mao, Tian Lin, Chong Wang, Lihong Li, and Denny Zhou. Neural logic machines. In 7th International Conference on Learning Representations, ICLR 2019, New Orleans, LA, USA, May 6-9, 2019, 2019.
|
| 208 |
+
|
| 209 |
+
Li Dong and Mirella Lapata. Language to logical form with neural attention. ACL, 2016.
|
| 210 |
+
|
| 211 |
+
Dheeru Dua, Yizhong Wang, Pradeep Dasigi, Gabriel Stanovsky, Sameer Singh, and Matt Gardner. DROP: A reading comprehension benchmark requiring discrete reasoning over paragraphs. In Proc. of NAACL, 2019.
|
| 212 |
+
|
| 213 |
+
Alex Graves, Greg Wayne, and Ivo Danihelka. Neural turing machines. CoRR, abs/1410.5401, 2014. URL http://arxiv.org/abs/1410.5401.
|
| 214 |
+
|
| 215 |
+
Kelvin Guu, Panupong Pasupat, Evan Liu, and Percy Liang. From language to programs: Bridging reinforcement learning and maximum marginal likelihood. ACL, 2017.
|
| 216 |
+
|
| 217 |
+
Sepp Hochreiter and Jurgen Schmidhuber. Long short-term memory. ¨ Neural Comput., 1997.
|
| 218 |
+
|
| 219 |
+
Minghao Hu, Yuxing Peng, Zhen Huang, and Dongsheng Li. A multi-type multi-span network for reading comprehension that requires discrete reasoning. arXiv preprint arXiv:1908.05514, 2019.
|
| 220 |
+
|
| 221 |
+
Robin Jia and Percy Liang. Data recombination for neural semantic parsing. ACL, 2016.
|
| 222 |
+
|
| 223 |
+
Justin Johnson, Bharath Hariharan, Laurens van der Maaten, Judy Hoffman, Li Fei-Fei, C Lawrence Zitnick, and Ross Girshick. Inferring and executing programs for visual reasoning. In Proceedings of the IEEE International Conference on Computer Vision, pp. 2989–2998, 2017.
|
| 224 |
+
|
| 225 |
+
Łukasz Kaiser and Ilya Sutskever. Neural gpus learn algorithms. arXiv:1511.08228, 2015.
|
| 226 |
+
|
| 227 |
+
Guillaume Klein, Yoon Kim, Yuntian Deng, Vincent Nguyen, Jean Senellart, and Alexander M Rush. Opennmt: Neural machine translation toolkit. arXiv preprint arXiv:1805.11462, 2018.
|
| 228 |
+
|
| 229 |
+
Jayant Krishnamurthy, Pradeep Dasigi, and Matt Gardner. Neural semantic parsing with type constraints for semi-structured tables. EMNLP, 2017.
|
| 230 |
+
|
| 231 |
+
Chen Liang, Jonathan Berant, Quoc Le, Kenneth D. Forbus, and Ni Lao. Neural symbolic machines: Learning semantic parsers on freebase with weak supervision. ACL, 2017.
|
| 232 |
+
|
| 233 |
+
Chen Liang, Mohammad Norouzi, Jonathan Berant, Quoc V. Le, and Ni Lao. Memory augmented policy optimization for program synthesis and semantic parsing. In NeurIPS, pp. 10015–10027, 2018.
|
| 234 |
+
|
| 235 |
+
Wang Ling, Dani Yogatama, Chris Dyer, and Phil Blunsom. Program induction by rationale generation: Learning to solve and explain algebraic word problems. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 158–167, 2017.
|
| 236 |
+
|
| 237 |
+
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. CoRR, abs/1907.11692, 2019.
|
| 238 |
+
|
| 239 |
+
Christopher Manning, Mihai Surdeanu, John Bauer, Jenny Finkel, Steven Bethard, and David McClosky. The stanford corenlp natural language processing toolkit. In Proceedings of 52nd annual meeting of the association for computational linguistics: system demonstrations, pp. 55–60, 2014.
|
| 240 |
+
|
| 241 |
+
Jiayuan Mao, Chuang Gan, Pushmeet Kohli, Joshua B. Tenenbaum, and Jiajun Wu. The neurosymbolic concept learner: Interpreting scenes, words, and sentences from natural supervision. In 7th International Conference on Learning Representations, ICLR 2019, New Orleans, LA, USA, May 6-9, 2019, 2019.
|
| 242 |
+
|
| 243 |
+
Sewon Min, Danqi Chen, Hannaneh Hajishirzi, and Luke Zettlemoyer. A discrete hard em approach for weakly supervised question answering. arXiv preprint arXiv:1909.04849, 2019.
|
| 244 |
+
|
| 245 |
+
Arvind Neelakantan, Quoc V Le, Martin Abadi, Andrew McCallum, and Dario Amodei. Learning a natural language interface with neural programmer. arXiv preprint arXiv:1611.08945, 2016.
|
| 246 |
+
|
| 247 |
+
Panupong Pasupat and Percy Liang. Compositional semantic parsing on semi-structured tables. ACL, 2015.
|
| 248 |
+
|
| 249 |
+
Matthew E. 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, NAACL-HLT 2018, New Orleans, Louisiana, USA, June 1-6, 2018, Volume 1 (Long Papers), pp. 2227–2237, 2018.
|
| 250 |
+
|
| 251 |
+
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, EMNLP 2016, Austin, Texas, USA, November 1-4, 2016, pp. 2383–2392, 2016.
|
| 252 |
+
|
| 253 |
+
Siva Reddy, Danqi Chen, and Christopher D. Manning. Coqa: A conversational question answering challenge. TACL, 7:249–266, 2019.
|
| 254 |
+
|
| 255 |
+
Scott Reed and Nando de Freitas. Neural programmer-interpreters. ICLR, 2016.
|
| 256 |
+
|
| 257 |
+
Azriel Rosenfeld and Mark Thurston. Edge and curve detection for visual scene analysis. IEEE Transactions on computers, (5):562–569, 1971.
|
| 258 |
+
|
| 259 |
+
Min Joon Seo, Aniruddha Kembhavi, Ali Farhadi, and Hannaneh Hajishirzi. Bidirectional attention flow for machine comprehension. In ICLR, 2017.
|
| 260 |
+
|
| 261 |
+
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.
|
| 262 |
+
|
| 263 |
+
Oriol Vinyals, Meire Fortunato, and Navdeep Jaitly. Pointer networks. NIPS, 2015.
|
| 264 |
+
|
| 265 |
+
Alex Wang, Amanpreet Singh, Julian Michael, Felix Hill, Omer Levy, and Samuel R. Bowman. GLUE: A multi-task benchmark and analysis platform for natural language understanding. In 7th International Conference on Learning Representations, ICLR 2019, New Orleans, LA, USA, May 6-9, 2019, 2019.
|
| 266 |
+
|
| 267 |
+
Wenhui Wang, Nan Yang, Furu Wei, Baobao Chang, and Ming Zhou. Gated self-matching networks for reading comprehension and question answering. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics, ACL 2017, Vancouver, Canada, July 30 - August 4, Volume 1: Long Papers, pp. 189–198, 2017.
|
| 268 |
+
|
| 269 |
+
Caiming Xiong, Victor Zhong, and Richard Socher. Dynamic coattention networks for question answering. CoRR, abs/1611.01604, 2016. URL http://arxiv.org/abs/1611.01604.
|
| 270 |
+
|
| 271 |
+
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.
|
| 272 |
+
|
| 273 |
+
Adams Wei Yu, David Dohan, Minh-Thang Luong, Rui Zhao, Kai Chen, Mohammad Norouzi, and Quoc V. Le. Qanet: Combining local convolution with global self-attention for reading comprehension. In 6th International Conference on Learning Representations, ICLR 2018, Vancouver, BC, Canada, April 30 - May 3, 2018, Conference Track Proceedings, 2018.
|
| 274 |
+
|
| 275 |
+
Victor Zhong, Caiming Xiong, and Richard Socher. Seq2sql: Generating structured queries from natural language using reinforcement learning. arXiv:1709.00103, 2017.
|
| 276 |
+
|
| 277 |
+
# A MORE DETAILS ABOUT THE INPUT PREPROCESSING
|
| 278 |
+
|
| 279 |
+
We preprocess the input passages and questions in a similar way as the input preprocessing of DROP dataset described in (Andor et al., 2019). Specifically, to facilitate the usage of BERT, we split up the documents longer than $L = 5 1 2$ tokens. Meanwhile, we extract the locations and values of the numbers, so that they can be retrieved via indices when applying numerical operators. We apply the same input preprocessing on MathQA as well.
|
| 280 |
+
|
| 281 |
+
# B MORE DISCUSSION ABOUT THE DOMAIN SPECIFIC LANGUAGE
|
| 282 |
+
|
| 283 |
+
To better support numerical reasoning, sometimes we need to leverage pre-defined constants for our computation. On MathQA, we have shown that applying the constant 3600, which is provided in their pre-defined question-agnostic constant list, is necessary for the calculation in Table 3. Meanwhile, we find that defining such a constant list is also helpful on DROP benchmark. For example, a variant of the sample numerical operation question in Table 2 is “How many people, in terms of percentage, were not either solely white or solely African American?”, and such questions are included in DROP dataset as well. In this case, unless we are able to use the number 100 in our calculation, there is no way to obtain the correct answer. Again, previous works design specialized modules to deal with such questions, which is the main role of the negation module illustrated in Figure 1. On the contrary, we introduce a constant list that is callable for every question, so that the model can learn to apply any constant covered in the list, without the need of manually designing separate modules for questions requiring different constants.
|
| 284 |
+
|
| 285 |
+
In our evaluation, for DROP, we used $[ 1 0 0 , 1 2 , 2 8 , 2 9 , 3 0 , 3 1 , 1 , 0 ]$ as the constant list, which is helpful for percentage and date time calculation. For MathQA, we used the constant list provided in their public dataset, which includes 23 constants that cover common conversion between different units, domain-specific constants for geometry, physics and probability, etc.
|
| 286 |
+
|
| 287 |
+
# C MORE DETAILS ABOUT THE MODEL ARCHITECTURE
|
| 288 |
+
|
| 289 |
+
# C.1 READER
|
| 290 |
+
|
| 291 |
+
The reader implementation is largely the same as (Andor et al., 2019). Specifically, for the embedding representation of the reader component, we feed the question and passage jointly into BERT, which provides the output vector of each input token $t _ { i }$ as $e _ { i }$ . Unless otherwise specified, the encoder is initialized with the uncased whole-word-masking version of BERTLARGE. We denote the size of $e _ { i }$ as $H _ { 0 }$ .
|
| 292 |
+
|
| 293 |
+
# C.2 PROGRAMMER
|
| 294 |
+
|
| 295 |
+
The core architecture of the programmer is a 1-layer LSTM with the hidden size of $H = 5 1 2$ . To formally describe the input space and output space of the programmer, we denote $R$ as the size of the reserved tokens, which include both operators and constants in a domain-specific language, and the special start and end tokens [GO] and [EOF]; and $L = 5 1 2$ as the total number of the question and passage tokens in a single sample. Samples with fewer than $L = 5 1 2$ tokens will be padded with [EOF] tokens to achieve this length. In the following, we discuss the details of each component.
|
| 296 |
+
|
| 297 |
+
Input embedding. At each timestep, the programmer could generate a program token from: (1) the reserved tokens of the domain-specific language; and (2) the input question and passage tokens. The embedding of the $i$ -th reserved token is
|
| 298 |
+
|
| 299 |
+
$$
|
| 300 |
+
h r _ { i } = E _ { r } ^ { T } r _ { i }
|
| 301 |
+
$$
|
| 302 |
+
|
| 303 |
+
Where $E _ { r }$ is a trainable embedding matrix of size $R \times H$ , and $r _ { i }$ is the one-hot encoding of the token.
|
| 304 |
+
|
| 305 |
+
For the $i$ -th token in the input question and passage token list, their embedding is
|
| 306 |
+
|
| 307 |
+
$$
|
| 308 |
+
h t _ { i } = P _ { t } e _ { i }
|
| 309 |
+
$$
|
| 310 |
+
|
| 311 |
+
Where $P _ { t }$ is a trainable projection matrix of size $H \times H _ { 0 }$ .
|
| 312 |
+
|
| 313 |
+
Attention module over the input. At each timetstep $T$ , let $\left[ p _ { 1 } , p _ { 2 } , . . . , p _ { T - 1 } \right]$ denote the list of program tokens that are already generated in previous timesteps, and we define $[ h p _ { 0 } , h p _ { 1 } , h \bar { p } _ { 2 } , . . . , h p _ { T - 1 } ]$ as the decoder history, where $h p _ { 0 }$ is the embedding vector of the [GO] token calculated as above; $[ h p _ { 1 } , h p _ { 2 } , . . . , h p _ { T - 1 } ]$ are $H$ -dimensional vectors corresponding to the generated program token list, and we will discuss how they are computed later.
|
| 314 |
+
|
| 315 |
+
Denote $\mathbf { \Phi } ( h _ { T } , c _ { T } ) \ = \ \mathrm { L S T M } \big ( h p _ { T - 1 } , \big ( h _ { T - 1 } , c _ { T - 1 } \big ) \big )$ as the hidden state of the LSTM decoder at timestep T, where $\left( { { h _ { 0 } } , { c _ { 0 } } } \right)$ is the trainable initial state, and $h p _ { T - 1 }$ is the LSTM input.
|
| 316 |
+
|
| 317 |
+
For each of $h p _ { i }$ in the decoder history, we compute
|
| 318 |
+
|
| 319 |
+
$$
|
| 320 |
+
v h i = W _ { h } h p _ { i }
|
| 321 |
+
$$
|
| 322 |
+
|
| 323 |
+
Where $W _ { h }$ is a trainable matrix of size $H \times H$
|
| 324 |
+
|
| 325 |
+
The attention weight of each $h p _ { i }$ in the decoder history is computed as
|
| 326 |
+
|
| 327 |
+
$$
|
| 328 |
+
w h _ { i } = \frac { \exp ( h _ { T } ^ { T } v h _ { i } ) } { \sum _ { j = 0 } ^ { T - 1 } \exp ( h _ { T } ^ { T } v h _ { j } ) }
|
| 329 |
+
$$
|
| 330 |
+
|
| 331 |
+
The attention vector of the decoder history is thus
|
| 332 |
+
|
| 333 |
+
$$
|
| 334 |
+
a t t _ { h } = \sum _ { i = 0 } ^ { T - 1 } w h _ { i } \cdot h p _ { i }
|
| 335 |
+
$$
|
| 336 |
+
|
| 337 |
+
This formulation is similar to the attention mechanism introduced in prior work (Bahdanau et al., 2014). Correspondingly, we compute the attention vector of the passage tokens $a t t _ { p }$ , and the attention vector of the question tokens $a t t _ { q }$ .
|
| 338 |
+
|
| 339 |
+
Afterwards, we compute
|
| 340 |
+
|
| 341 |
+
$$
|
| 342 |
+
v _ { T } = W _ { v } [ a t t _ { h } ; a t t _ { q } ; a t t _ { p } ; h _ { T } ]
|
| 343 |
+
$$
|
| 344 |
+
|
| 345 |
+
Where $W _ { v }$ is a trainable matrix of size $H \times 4 H$ , and $[ a ; b ]$ denotes the concatenation of $a$ and $b$ .
|
| 346 |
+
|
| 347 |
+
Program token prediction. We compute another attention vector of the question tokens $a t t _ { q } ^ { \prime }$ in a similar way as above, but with a different set of trainable parameters. Then for each input token, we have
|
| 348 |
+
|
| 349 |
+
$$
|
| 350 |
+
\begin{array} { r l } & { h t _ { i } ^ { \prime } = P ^ { \prime } [ h t _ { i } ; h t _ { i } \circ a t t _ { q } ^ { \prime } ] } \\ & { } \\ & { h r _ { i } ^ { \prime } = P ^ { \prime } [ h r _ { i } ; h r _ { i } \circ a t t _ { q } ^ { \prime } ] } \end{array}
|
| 351 |
+
$$
|
| 352 |
+
|
| 353 |
+
Where $P ^ { \prime }$ is a trainable matrix of size $H \times 2 H$ , and $\circ$ is the Hadamard product.
|
| 354 |
+
|
| 355 |
+
Let $H _ { T } ^ { \prime }$ be a $( R + L ) \times H$ -dimensional matrix, where the first $R$ rows are $h r _ { i } ^ { \prime }$ for $0 \leq i < R$ , and the next $L$ rows are $h t _ { i } ^ { \prime }$ for $0 \leq i < L$ . Then we compute
|
| 356 |
+
|
| 357 |
+
$$
|
| 358 |
+
w _ { T } ^ { \prime } = H _ { T } ^ { \prime } \cdot v _ { T }
|
| 359 |
+
$$
|
| 360 |
+
|
| 361 |
+
Where $w _ { T i } ^ { \prime }$ denotes the weight of selecting the $i$ -th token as the next program token. This design is similar to the pointer network (Vinyals et al., 2015).
|
| 362 |
+
|
| 363 |
+
Note that a valid program should satisfy the grammar constraints, for instance, those listed in Table 1 on DROP dataset. Therefore, we compute a mask $m _ { T }$ as an $( R + L )$ -dimensional vector, where $m _ { T i } = 1$ when the $i$ -th token is a valid next program token, and $m _ { T i } = 0$ if it is invalid. In the following, we take the DROP dataset as the example, and list some sample rules for mask generation:
|
| 364 |
+
|
| 365 |
+
(1) At the beginning of the program generation, $m _ { T i } = 1$ iff the $i$ -th token denotes an operator;
|
| 366 |
+
|
| 367 |
+
(2) When the previous generated program token $p _ { T - 1 }$ is PASSAGE_SPAN, then $m _ { T i } = 1$ iff the $i$ -th token is from the passage. Similarly, if $p _ { T - 1 }$ is QUESTION_SPAN, then $m _ { T i } = 1$ iff the $i$ -th token is from the question.
|
| 368 |
+
|
| 369 |
+
(3) As discussed in Appendix A, we preprocess the data to extract the locations and values of numbers in the input question and passage, thus we can leverage it to generate masks for numerical calculation operators. Specifically, when $p _ { T - 1 } \in \{ \mathsf { D I F F }$ , SUM, VALUE}, $m _ { T i } = 1$ iff the $i$ -th token is from the constant list, or a number from either the input question or the passage.
|
| 370 |
+
|
| 371 |
+
With the generated program mask, we compute
|
| 372 |
+
|
| 373 |
+
$$
|
| 374 |
+
w _ { T } = w _ { T } ^ { \prime } - C ( 1 - m _ { T } )
|
| 375 |
+
$$
|
| 376 |
+
|
| 377 |
+
Where $C$ is a large positive constant to ensure that the weight of an invalid program token is much smaller than the valid program tokens. In practice, we use $C ~ = ~ 1 e 6$ . Such a grammar-based decoding process is a common practice in order to ensure the syntactic correctness of the generated programs (Krishnamurthy et al., 2017; Liang et al., 2017; Bunel et al., 2018).
|
| 378 |
+
|
| 379 |
+
Afterwards, the model predicts $p _ { T } = \arg \operatorname* { m a x } _ { i } ( w _ { T } )$ as the next program token. We can also apply the beam search for decoding, but we find that the greedy decoding is already sufficient to provide good results, while the inference process is also much faster than the beam search.
|
| 380 |
+
|
| 381 |
+
Finally, decoder $h p _ { T } = H _ { T p _ { T } } ^ { \prime }$ is the vector representation corresponding to nerating the next program token. $p _ { T }$ , which is appended to the
|
| 382 |
+
|
| 383 |
+
# D MORE DETAILS ABOUT TRAINING
|
| 384 |
+
|
| 385 |
+
# D.1 DATA AUGMENTATION
|
| 386 |
+
|
| 387 |
+
In this section, we discuss the details of our data augmentation process for counting and sorting questions on DROP. To obtain training samples for counting questions with ground truth annotations, starting from the span selection questions in the training set, we filter out those questions that either can be answered by using the QUESTION_SPAN operation, or do not start with any interrogative in [“What”, “Which”, “Who”, “Where”]. Afterwards, we replace the interrogative with “How many”, and modify the ground truth program correspondingly. In this way, we can augment 15K additional questions for counting in DROP training set.
|
| 388 |
+
|
| 389 |
+
To annotate the key-value pairs, for each entity recognized by the CoreNLP tool, we search for the numbers that are in the same clause as the entity, i.e., not separated by any punctuation mark, and discard those entities that do not have any nearby number satisfying this constraint. Afterwards, we filter out those questions that do not include any superlative in [“longest”, “shortest”, “largest”, “smallest”, “most” and “least”]. For the remaining questions, we call each of the sorting operations, i.e., ARGMAX, ARGMIN, MAX, MIN, with all extracted key-value pairs as the arguments. For ARGMAX and MAX operators, the key-value pairs are sorted in the descending order of their values; for ARGMIN and MIN operators, they are sorted in the increasing order of their values. If any of the resulted sorting program yields the correct answer, the program is included into the training set. In this way, we can annotate 0.9K questions using ARGMAX or ARGMIN operations, and 1.8K questions using MAX or MIN operations in DROP training set.
|
| 390 |
+
|
| 391 |
+
# D.2 TRAINING CONFIGURATION
|
| 392 |
+
|
| 393 |
+
For the training algorithm described in Algorithm 1, the initial threshold $\alpha _ { 0 } = 0 . 5$ , and the decay factor $\gamma = 0 . 5$ . We perform early stopping when both exact match and F1 score on the development
|
| 394 |
+
|
| 395 |
+
Table 9: Some samples in DROP training set with the wrong annotations, which are discarded by NeRd because none of the annotated programs passes the threshold of our training algorithm.
|
| 396 |
+
|
| 397 |
+
<table><tr><td>Passage</td><td>Question</td><td>Ground truth</td></tr><tr><td>buthad to settle fora 23-yard field … goal by kicker Matt Bryant ...</td><td>How many field goals shorter than 30 yards did Matt Bryant kick?</td><td>3</td></tr><tr><td>... from a sample of 4O Sherman tanks, 33 tanks burned (82 percent) and 7 tanks remained unburned .</td><td>How many more Sherman tanks burned out than survived in the Nor- mandy Campaign?</td><td>22</td></tr></table>
|
| 398 |
+
|
| 399 |
+
Table 10: Examples of wrong predictions on DROP dev set.
|
| 400 |
+
|
| 401 |
+
<table><tr><td rowspan=1 colspan=1>Question type</td><td rowspan=1 colspan=1>Passage</td><td rowspan=1 colspan=1>Question</td><td rowspan=1 colspan=1>Prediction</td></tr><tr><td rowspan=1 colspan=1>Question span</td><td rowspan=1 colspan=1>The campaigns of 1702 and 1703showedhislimitationsasafield of-ficer...In early 1704,he spoke withthe envoy of Savoy about possibleopportunities in their army ...</td><td rowspan=1 colspan=1>What happened first,the Hague campaignsas field officer or hespoke with envoy ofSavoy for opportuni-ties in the army?</td><td rowspan=1 colspan=1>Prediction:QUESTION_SPAN(7,10)Result:“campaigns as field offi-cer”Ground truth: “campaigns of1702 and 1703"</td></tr><tr><td rowspan=1 colspan=1>Counting</td><td rowspan=1 colspan=1>.. The five regions with the lowestfertility rates were Beijing (0.71),Shanghai (0.74), Liaoning (0.74),Heilongjiang (0.75.)..</td><td rowspan=1 colspan=1>Howmanyareas hada fertility rate of .74?</td><td rowspan=1 colspan=1>Prediction: COUNT(PASSAGE_SPAN(216,216),PASSAGE_SPAN(223,223),PASSAGE_SPAN(230,231))Result: COUNT("Beijing",“Shanghai”,“Liaoning")= 3Ground truth: 2</td></tr><tr><td rowspan=1 colspan=1>Sorting</td><td rowspan=1 colspan=1>.to set up Nugent's career-long54-yard field goal to give the Jetsa 9-3 lead ... The half ended whenBrown came up five yards short ona 59-yard field goal attempt ...</td><td rowspan=1 colspan=1>How many yardswas the longest fieldgoal?</td><td rowspan=1 colspan=1>Program:MAX(VALUE(16), VALUE(20))Result: MAX(54,59) = 59Ground truth: 54</td></tr></table>
|
| 402 |
+
|
| 403 |
+
set do not improve for two consecutive training iterations. For both DROP and MathQA datasets, the training typically takes around $5 0 K \sim 6 0 K$ training steps.
|
| 404 |
+
|
| 405 |
+
For both tasks in our evaluation, we train the model with Adam optimizer, with an initial learning rate of 5e-5, and batch size of 32. Gradients with $L _ { 2 }$ norm larger than 1.0 are clipped.
|
| 406 |
+
|
| 407 |
+
# E EXAMPLES OF WRONG ANNOTATIONS ON DROP
|
| 408 |
+
|
| 409 |
+
Table 9 lists some examples of wrong annotations in DROP training set. Specifically, the first annotation is wrong because the crowd worker simply counts the number of field goals included in the entire passage, without considering the constraints of lengths and the kicker’s name; on the other hand, the second mistake comes from the wrong numerical calculations. For both samples, the highest likelihood among all programs with the annotated answer is smaller than 1e-4, thus are not included during training, which is why the thresholding helps significantly.
|
| 410 |
+
|
| 411 |
+
# F EXAMPLES OF WRONG PREDICTIONS ON DROP
|
| 412 |
+
|
| 413 |
+
Table 10 presents some error cases of NeRd on DROP development set.
|
md/train/ryxyCeHtPB/ryxyCeHtPB.md
ADDED
|
@@ -0,0 +1,308 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Pay Attention to Features, Transfer Learn Faster CNNs
|
| 2 |
+
|
| 3 |
+
Kafeng Wang∗†1, Xitong Gao $^ 2$ ∗, Yiren Zhao3, Xingjian Li4, Dejing Dou5, Cheng-Zhong Xu6
|
| 4 |
+
|
| 5 |
+
$^ { 1 , 2 }$ Shenzhen Institutes of Advanced Technology, Chinese Academy of Sciences.
|
| 6 |
+
1 University of Chinese Academy of Sciences. $^ 3$ University of Cambridge.
|
| 7 |
+
$^ { 4 , 5 }$ Big Data Lab, Baidu Research. 6 University of Macau.
|
| 8 |
+
1 kf.wang@siat.ac.cn, 2 xt.gao@siat.ac.cn.
|
| 9 |
+
|
| 10 |
+
# Abstract
|
| 11 |
+
|
| 12 |
+
Deep convolutional neural networks are now widely deployed in vision applications, but a limited size of training data can restrict their task performance. Transfer learning offers the chance for CNNs to learn with limited data samples by transferring knowledge from models pretrained on large datasets. Blindly transferring all learned features from the source dataset, however, brings unnecessary computation to CNNs on the target task. In this paper, we propose attentive feature distillation and selection (AFDS), which not only adjusts the strength of transfer learning regularization but also dynamically determines the important features to transfer. By deploying AFDS on ResNet-101, we achieved a state-of-the-art computation reduction at the same accuracy budget, outperforming all existing transfer learning methods. With a $1 0 \times$ MACs reduction budget, a ResNet-101 equipped with AFDS transfer learned from ImageNet to Stanford Dogs 120, can achieve an accuracy $1 1 . 0 7 \%$ higher than its best competitor.
|
| 13 |
+
|
| 14 |
+
# 1 Introduction
|
| 15 |
+
|
| 16 |
+
Despite recent successes of CNNs achieving state-of-the-art performance in vision applications (Tan & Le, 2019; Cai & Vasconcelos, 2018; Zhao et al., 2018; Ren et al., 2015), there are two major shortcomings limiting their deployments in real life. First, training CNNs from random initializations to achieve high task accuracy generally requires a large amount of data that is expensive to collect. Second, CNNs are typically compute-intensive and memory-demanding, hindering their adoption to power-limited scenarios.
|
| 17 |
+
|
| 18 |
+
To address the former challenge, transfer learning (Pan $\&$ Yang, 2009) is thus designed to transfer knowledge learned from the source task to a target dataset that has limited data samples. In practice, we often choose a source dataset such that the input domain of the source comprises the domain of the target. A common paradigm for transfer learning is to train a model on a large source dataset, and then fine-tune the pre-trained weights with regularization methods on the target dataset (Zagoruyko & Komodakis, 2017; Yim et al., 2017; Li et al., 2018; Li & Hoiem, 2018; Li et al., 2019). For example, one regularization method, $L ^ { 2 }$ - $S P$ (Li et al., 2018), penalizes the $L ^ { 2 }$ -distances of pretrained weights on the source dataset and the weights being trained on the target dataset. The pretrained source weights serves as a starting point when training on the target data. During fine-tuning on the target dataset, the regularization constrains the search space around this starting point, which in turn prevents overfitting the target dataset.
|
| 19 |
+
|
| 20 |
+
Intuitively, the responsibility of transfer learning is to preserve the source knowledge acquired by important neurons. The neurons thereby retain their abilities to extract features from the source domain, and contribute to the network’s performance on the target dataset.
|
| 21 |
+
|
| 22 |
+
Moreover, by determining the importance of neurons, unimportant ones can further be removed from computation during inference with network pruning methods (Luo et al., 2017; He et al., 2017; Zhuang et al., 2018; Ye et al., 2018; Gao et al., 2019). The removal of unnecessary compute not only makes CNNs smaller in size but also reduces computational costs while minimizing possible accuracy degradations. As the source domain encompasses the target, many neurons responsible for extracting features from the source domain may become irrelevant to the target domain and can be removed. In Figure 1, a simple empirical study of the channel neurons’ activation magnitudes corroborates our intuition: as deeper layers extract higher-level features, more neurons become either specialized or irrelevant to dogs. The discussion above hence prompts two questions regarding the neurons: which neurons should we transfer source knowledge to, and which are actually important to the target model?
|
| 23 |
+
|
| 24 |
+

|
| 25 |
+
Figure 1: (a) shows sample images from two datasets, ImageNet contains images with greater diversity. (b) shows the average maximum activations of 20 channel neurons in 3 layers of ResNet-101 that are most excited by images from Dogs.
|
| 26 |
+
|
| 27 |
+
Yet traditional transfer learning methods fail to provide answers to both, as generally they transfer knowledge either equally for each neuron with the same regularized weights, or determine the strength of regularization using only the source dataset (Li et al., 2018). The source domain could be vastly larger than the target, giving importance to weights that are irrelevant to the target task.
|
| 28 |
+
|
| 29 |
+
Recent years have seen a surge of interest in network pruning techniques, many of which induce sparsity by pushing neuron weights or outputs to zeros, allowing them to be pruned without a detrimental impact on the task accuracies. Even though pruning methods present a solution to neuron/weight importance, unfortunately they do not provide an answer to the latter question, i.e. whether these neurons/weights are important to the target dataset. The reason for this is that pruning optimization objectives are often in conflict with traditional transfer learning, as both drive weight values in different directions: zero for pruning and the initial starting point for transfer learning. As we will see later, a na¨ıve composition of the two methods could have a disastrous impact on the accuracy of a pruned CNN transferlearned on the target dataset.
|
| 30 |
+
|
| 31 |
+
In this paper, to tackle the challenge of jointly transferring source knowledge and pruning target CNNs, we propose a new method based on attention mechanism (Vaswani et al., 2017), attentive feature distillation and selection (AFDS). For the images in the target dataset, AFDS dynamically learns not only the features to transfer, but also the unimportant neurons to skip.
|
| 32 |
+
|
| 33 |
+
During transfer learning, instead of fine-tuning with $L ^ { 2 }$ -SP regularization which explores the proximity of the pre-trained weights, we argue that a better alternative is to mimic the feature maps, i.e. the output response of each convolutional layer in the source model when images from the target dataset are shown, with $L ^ { 2 }$ -distances. This way the fine-tuned model can still learn the behavior of the source model. Additionally, without the restriction of searching only the proximity of the initial position, the weights in the target model can be optimized freely and thus increasing their generalization capacity. Therefore, we present attentive feature distillation (AFD) to learn which relevant features to transfer.
|
| 34 |
+
|
| 35 |
+
To accelerate the transfer-learned model, we further propose attentive feature selection (AFS) to prune networks dynamically. AFS is designed to learn to predictively select important output channels in the convolution to evaluate and skip unimportant ones, depending on the input to the convolution. Rarely activated channel neurons can further be removed from the network, reducing the model’s memory footprint.
|
| 36 |
+
|
| 37 |
+
From an informal perspective, both AFD and AFS learn to adjust the “valves” that control the flow of information for each channel neuron. The former adjusts the strength of regularization, thereby tuning the flow of knowledge being transferred from the source model. The latter allows salient information to pass on to the subsequent layer and stops the flow of unimportant information. A significant attribute that differentiates AFD and AFS from their existing counterparts is that we employ attention mechanisms to adaptively learn to “turn the valves” dynamically with small trainable auxiliary networks.
|
| 38 |
+
|
| 39 |
+
Our main contributions are as follows:
|
| 40 |
+
|
| 41 |
+
• We present attentive feature distillation and selection (AFDS) to effectively transfer learn CNNs, and demonstrate state-of-the-art performance on many publicly available datasets with ResNet-101 (He et al., 2016) models transfer learned from ImageNet (Deng et al., 2009). We paired a large range of existing transfer learning and network pruning methods, and examined their abilities to trade-off FLOPs with task accuracy. • By changing the fraction of channel neurons to skip for each convolution, AFDS can further accelerate the transfer learned models while minimizing the impact on task accuracy. We found that AFDS generally provides the best FLOPs and accuracy trade-off when compared to a broad range of paired methods.
|
| 42 |
+
|
| 43 |
+
# 2 Related Work
|
| 44 |
+
|
| 45 |
+
# 2.1 Transfer Learning
|
| 46 |
+
|
| 47 |
+
Training a deep CNN to achieve high accuracy generally require a large amount of training data, which may be expensive to collect. Transfer learning (Pan & Yang, 2009) addresses this challenge by transferring knowledge learned on a large dataset that has a similar domain to the training dataset. A typical approach for CNNs is to first train the model on a large source dataset, and make use of their feature extraction abilities (Donahue et al., 2014; Razavian et al., 2014). Moreover, it has been demonstrated that the task accuracy can be further improved by fine-tuning the resulting pre-trained model on a smaller target dataset with a similar domain but a different task (Yosinski et al., 2014; Azizpour et al., 2015). Li et al. (2018) proposed $L ^ { 2 }$ -SP regularization to minimize the $L ^ { 2 }$ -distance between each fine-tuned parameter and its initial pre-trained value, thus preserving knowledge learned in the pre-trained model. In addition, they presented $L ^ { 2 }$ -SP-Fisher, which further weighs each $L ^ { 2 }$ -distance using Fisher information matrix estimated from the source dataset. Instead of constraining the parameter search space, Li et al. (2019) showed that it is often more effective to regularize feature maps during fine-tuning, and further learns which features to pay attention to. Learning without Forgetting (Li & Hoiem, 2018) learns to adapt the model to new tasks, while trying to match the output response on the original task of the original model using knowledge distillation (KD) (Hinton et al., 2014). Methods proposed by Zagoruyko & Komodakis (2017) and Yim et al. (2017) transfer knowledge from a teacher model to a student by regularizing features. The former computes and regularizes spatial statistics across all feature maps channels, whereas the latter estimates the flow of information across layers for each pair of channels, and transfers this knowledge to the student. Instead of manually deciding the regularization penalties and what to regularize as in the previous approaches, Jang et al. (2019) used meta-learning to automatically learn what knowledge to transfer from the teacher and to where in the student model.
|
| 48 |
+
|
| 49 |
+
Inspired by Li et al. (2019) and Jang et al. (2019), this paper introduces attentive feature distillation (AFD), which similarly transfers knowledge by learning from the teacher’s feature maps. It however differs from Jang et al. (2019) as the teacher and student models share the same network topology, and it instead learns which channel to transfer from the teacher to the student in the same convolutional output.
|
| 50 |
+
|
| 51 |
+
# 2.2 Structured Sparsity
|
| 52 |
+
|
| 53 |
+
Sparsity in neural networks has been a long-studied subject (Reed, 1993; LeCun et al., 1990; Chauvin, 1989; Mozer & Smolensky, 1989; Hassibi et al., 1994). Related techniques have been applied to modern deep CNNs with great success (Guo et al., 2016; Dong et al., 2017a), significantly lowering their storage requirements. In general, as these methods zero out individual weights, producing irregular sparse connections, which cannot be efficiently exploited by GPUs to speed up computation.
|
| 54 |
+
|
| 55 |
+
For this, many recent work turned their attention to structured sparsity (Alvarez & Salzmann, 2016; Wen et al., 2016; Liu et al., 2017; He et al., 2017; 2018). This approach aims to find coarse-grained sparsity and preserves dense structures, thus allowing conventional GPUs to compute them efficiently. Alvarez & Salzmann (2016) and Wen et al. (2016) both added group Lasso to penalize non-zero weights, and removed channels entirely that have been reduced to zero. Liu et al. (2017) proposed network slimming (NS), which adds $L ^ { 1 }$ regularization to the trainable channel-wise scaling parameters $\gamma$ used in batch normalization, and gradually prunes channels with small $\gamma$ values by threshold. He et al. (2018) introduced soft filter pruning (SFP), which iteratively fine-tunes and sets channels with small $L ^ { 2 }$ -norms to zero.
|
| 56 |
+
|
| 57 |
+
Pruning algorithms remove weights or neurons from the network. The network may therefore lose its ability to process some difficult inputs correctly, as the neurons responsible for them are permanently discarded. Gao et al. (2019) have found empirically that task accuracies degrades considerably when most of the computation are removed from the network, and introduced feature boosting and suppression (FBS). Instead of removing neurons permanently from the network, FBS learns to dynamically prune unimportant channels, depending on the current input image. In this paper, attentive feature selection (AFS) builds on top of the advantages of both static and dynamic pruning algorithms. AFS not only preserves neurons that are important to some input images, but also removes unimportant ones for most inputs from the network, reducing both the memory and compute requirements for inference.
|
| 58 |
+
|
| 59 |
+
There are methods that dynamically select which paths to evaluate in a network dependent on the input (Figurnov et al., 2017; Dong et al., 2017b; Bolukbasi et al., 2017; Lin et al., 2017; Shazeer et al., 2017; Wu et al., 2018; Ren et al., 2018). They however introduce architectural and/or training method changes, and thus cannot be applied directly on existing popular models pre-trained on ImageNet (Deng et al., 2009).
|
| 60 |
+
|
| 61 |
+
# 3 Attentive Feature Distillation and Selection
|
| 62 |
+
|
| 63 |
+
# 3.1 High-Level Overview
|
| 64 |
+
|
| 65 |
+

|
| 66 |
+
Figure 2: High-level overview of AFDS.
|
| 67 |
+
|
| 68 |
+
We begin by providing a high-level overview of attentive feature distillation and selection (AFDS). AFDS introduces two new components to augment each conventional batchnormalized convolutional (ConvBN) layer (Ioffe & Szegedy, 2015), as illustrated in Figure 2. The AFS preemptively learns the importance of each channel, in the output of the ConvBN layer, and can suppress unimportant channels, thus allowing the expensive convolution operation to skip evaluating these channels. The AFD learns the importance of each channel in the output activation, and use the importance as weights to regularize feature maps in the target model with $L ^ { 2 }$ -distance. Each component is a small neural network containing a small number of parameters that can be trained with conventional stochastic gradient descent (SGD).
|
| 69 |
+
|
| 70 |
+
# 3.2 Preliminaries
|
| 71 |
+
|
| 72 |
+
Consider a set of training data $\mathcal { D }$ where each sample $( { \pmb x } , y )$ consists of an input image $\pmb { x } \in \mathbb { R } ^ { C \times H \times W }$ , and a ground-truth label $y \in \mathbb N$ . Here $C$ , $H$ and $W$ respectively denote the number of channels, and the height and width of the input image. Training a deep CNN classifier thus minimizes the following loss function with an optimization method based on SGD:
|
| 73 |
+
|
| 74 |
+
$$
|
| 75 |
+
\mathcal { L } ( \pmb { \theta } ) = \mathbb { E } _ { ( \pmb { x } , \pmb { y } ) \sim \mathcal { D } } [ \mathcal { L } ^ { \mathrm { C E } } ( f ( \pmb { x } , \pmb { \theta } ) , \pmb { y } ) + \mathcal { R } ( \pmb { \theta } , \pmb { x } ) + \lambda \| \pmb { \theta } \| _ { 2 } ^ { 2 } ] ,
|
| 76 |
+
$$
|
| 77 |
+
|
| 78 |
+
where $\pmb { \theta }$ comprises all parameters of the model, the loss $\mathcal { L } ^ { \mathrm { C E } } ( f ( \pmb { x } , \pmb { \theta } ) , y )$ denotes the crossentropy loss between the CNN output $f ( { \pmb x } , { \pmb \theta } )$ and the label $y$ . The regularizer $\mathcal { R } ( \pmb \theta , \pmb x )$ is often used to reduce the risk of overfitting. In conventional training, $\mathcal { R } ( \pmb \theta , \pmb x ) = 0$ . Finally, we impose a $L ^ { 2 }$ penalty on $\pmb { \theta }$ , where $\left. \ z \right. _ { 2 }$ represents the $L ^ { 2 }$ -norm of $_ z$ across all its elements.
|
| 79 |
+
|
| 80 |
+
We assume that $f ( { \pmb x } , { \pmb \theta } )$ is a feed-forward CNN composed of $N$ ConvBN layers for feature extraction, $f _ { l } ( \pmb { x } _ { l - 1 } , \pmb { \theta } _ { l } )$ with $l \in L = \{ 1 , 2 , \ldots , N \}$ , and a final fully-connected layer for classification, $g ( \pmb { x } _ { N } , \pmb { \theta } _ { g } )$ . Here, for the $l ^ { \mathrm { t h } }$ layer, ${ \bf { \Delta } } x _ { l - 1 }$ is the input to the layer, with ${ \boldsymbol { \mathbf { \mathit { x } } } } _ { 0 }$ indicating $_ { x }$ , and $\theta _ { l }$ is the layer’s parameters. Therefore, the $l ^ { \mathrm { t h } }$ layer is defined as:
|
| 81 |
+
|
| 82 |
+
$$
|
| 83 |
+
\pmb { x } _ { l } = f _ { l } ( \pmb { x } _ { l - 1 } , \pmb { \theta } _ { l } ) = \mathrm { r e l u } ( \gamma _ { l } \cdot \mathrm { n o r m } ( \mathrm { c o n v } ( \pmb { x } _ { l - 1 } , \pmb { \theta } _ { l } ) ) + \beta _ { l } ) ,
|
| 84 |
+
$$
|
| 85 |
+
|
| 86 |
+
where $\pmb { x } _ { l } \in \mathbb { R } ^ { C _ { l } \times H _ { l } \times W _ { l } }$ contains $C _ { l }$ feature maps of the layer, each with a $H _ { l }$ height and $W _ { l }$ width. The function $\mathrm { c o n v } ( \pmb { x } _ { l - 1 } , \pmb { \theta } _ { l } )$ is a convolution that takes ${ \bf { \Delta } } x _ { l - 1 }$ as input and uses trainable parameters $\theta _ { l }$ , and $\operatorname { n o r m } ( z )$ performs batch normalization. Finally, $\gamma _ { l } , \beta _ { l } \in \mathbb { R } ^ { C _ { l } }$ are trainable vectors, the multiplications (·) and additions $( + )$ are channel-wise, and $\mathrm { r e l u } ( z ) = \mathrm { m a x } ( z , 0 )$ stands for the ReLU activation. Although we use the feed-forward classifier above for simplicity, it can be easily modified to contain additional structures such as residual connections (He et al., 2016) and computations for object detection (Ren et al., 2015).
|
| 87 |
+
|
| 88 |
+
During transfer learning, as we fine-tune the network with a different task, the final layer $g ( \pmb { x } _ { N } , \pmb { \theta } _ { g } )$ is generally replaced with a new randomly-initialized one $h ( \pmb { x } _ { N } , \pmb { \theta } _ { h } )$ . To prevent overfitting, additional terms are used during transfer learning, for instance, $L ^ { z }$ - $S P$ (Li et al., 2018) further constrains the parameters $\pmb { \theta } _ { l }$ to explore around their initial values $\pmb { \theta } _ { l } ^ { \star }$ :
|
| 89 |
+
|
| 90 |
+
$$
|
| 91 |
+
\mathcal { R } ( \pmb { \theta } , \pmb { x } ) = \lambda _ { \mathrm { S P } } \sum _ { l \in L } \lVert \pmb { \theta } _ { l } - \pmb { \theta } _ { l } ^ { \star } \rVert _ { 2 } ^ { 2 } + \lambda _ { \mathrm { L 2 } } \lVert \pmb { \theta } \rVert _ { 2 } ^ { 2 } .
|
| 92 |
+
$$
|
| 93 |
+
|
| 94 |
+
Instead of regularizing parameters, methods based on knowledge distillation (Hinton et al., 2014) encourages the model to mimic the behavior of the original while learning the target task. Learning without Forgetting (LwF) (Li $\&$ Hoiem, 2018) uses the following regularizer to mimic the response from the original classifiers:
|
| 95 |
+
|
| 96 |
+
$$
|
| 97 |
+
\mathcal { R } ( \pmb { \theta } , \pmb { x } ) = \lambda _ { \mathrm { L w F } } \mathcal { L } ^ { \mathrm { C E } } ( g ^ { \star } ( f _ { L } ( \pmb { x } , \pmb { \theta } _ { L } ) , \pmb { \theta } _ { g } ^ { \star } ) ) ,
|
| 98 |
+
$$
|
| 99 |
+
|
| 100 |
+
where $f _ { L } ( \pmb { x } , \pmb { \theta } _ { L } )$ indicates the first $N$ layers, and $g ^ { \star }$ and $\theta _ { g } ^ { \star }$ respectively denote the original fully-connected (FC) layer and its associated parameters, and generally $\lambda _ { \mathrm { L w F } } ~ = ~ 1$ . Zagoruyko $\&$ Komodakis (2017), Yim et al. (2017) and Li et al. (2019) chose to regularize feature maps in some intermediate layers $L ^ { \prime } \subseteq L$ . We assume that $\mathbf { \boldsymbol { x } } _ { l } ^ { \star }$ is the $l ^ { \mathrm { t h } }$ layer output of the original model with weights $\theta ^ { \star }$ when the input $_ { x }$ is shown to the model, and $r$ is a method-dependent function that constrains the relationship between $\mathbf { \boldsymbol { x } } _ { l } ^ { \star }$ and $\mathbf { \Delta } x _ { l }$ . The regularizer can then be defined as follows:
|
| 101 |
+
|
| 102 |
+
$$
|
| 103 |
+
\mathcal { R } ( \pmb { \theta } , \pmb { x } ) = \lambda _ { \mathrm { K D } } \sum _ { l \in L ^ { \prime } } r ( \pmb { x } _ { l } ^ { \star } , \pmb { x } _ { l } ) .
|
| 104 |
+
$$
|
| 105 |
+
|
| 106 |
+
# 3.3 Attentive Feature Distillation
|
| 107 |
+
|
| 108 |
+
A simple way to extend Equation (5) is to constrain the $L ^ { 2 }$ -norm-distance between $\mathbf { \boldsymbol { x } } _ { l } ^ { \star }$ and $\mathbf { \Delta } x _ { l }$ , and thus pushing the target model to learn the feature map responses of the source:
|
| 109 |
+
|
| 110 |
+
$$
|
| 111 |
+
\mathcal { R } ( \pmb { \theta } , \pmb { x } ) = \lambda _ { \mathrm { F D } } \sum _ { l \in L ^ { \prime } } \| \pmb { x } _ { l } ^ { \star } - \pmb { x } _ { l } \| _ { 2 } ^ { 2 } .
|
| 112 |
+
$$
|
| 113 |
+
|
| 114 |
+
The above formulation, however, places equal weight to each channel neurons of the feature maps. As we discussed earlier, the importance of channel neurons varies drastically when different input images are shown. it is thus desirable to enforce a different penalty for each channel depending on the input $_ { x }$ . For this purpose, we design the regularizer:
|
| 115 |
+
|
| 116 |
+
$$
|
| 117 |
+
\mathcal { R } ( \pmb { \theta } , \pmb { x } ) = \lambda _ { \mathrm { A F D } } \sum _ { l \in L ^ { \prime } } \sum _ { c \in C _ { l } } \pmb { \rho } _ { l } ^ { [ c ] } ( \pmb { x } _ { l } ^ { \star } ) \| ( \pmb { x } _ { l } ^ { \star } - \pmb { x } _ { l } ) ^ { [ c ] } \| _ { 2 } ^ { 2 } .
|
| 118 |
+
$$
|
| 119 |
+
|
| 120 |
+
Note that in Equation (7), for any tensor $_ z$ , the term $z ^ { [ c ] }$ denotes the $c ^ { \mathrm { t h } }$ slice of the tensor. The transfer importance predictor ${ \pmb \rho } _ { l } : \mathbb { R } ^ { C _ { l } \times H _ { l } \times W _ { l } } \mathbb { R } ^ { C _ { l } }$ computes for each channel the importance of the source activation maps, which governs the strength of the $L ^ { 2 }$ regularization for each channel. The predictor function is trainable and is defined as a small network with two FC layers:
|
| 121 |
+
|
| 122 |
+
$$
|
| 123 |
+
\rho _ { l } ^ { [ c ] } ( { \pmb x } _ { l } ^ { \star } ) = \mathrm { s o f t m a x } ( \mathrm { r e l u } ( { \sf b } ( { \pmb x } _ { l } ^ { \star } ) { \pmb \varphi } _ { l } + { \pmb \nu } _ { l } ) { \pmb \varphi } _ { l } ^ { \prime } + { \pmb \nu } _ { l } ^ { \prime } ) .
|
| 124 |
+
$$
|
| 125 |
+
|
| 126 |
+
The function $\flat : \mathbb { R } ^ { C \times H \times W } \mathbb { R } ^ { C \times H W }$ flattens the spatial dimensions in a channel-wise fashion; The parameters $\varphi _ { l } \in \mathbb { R } ^ { H W \times H }$ , $\pmb { \nu } _ { l } \in \mathbb { R } ^ { 1 \times H }$ , $\varphi _ { l } ^ { \prime } \in \mathbb { R } ^ { H }$ and $\pmb { \nu } _ { l } ^ { \prime } \in \mathbb { R } ^ { C }$ can thus be trained to adjust the importance of each channel dynamically; finally, the softmax activation is borrowed from attention mechanism (Vaswani et al., 2017) to normalize the importance values. In our experiments, $\varphi _ { l }$ and $\varphi _ { l } ^ { \prime }$ use He et al. (2015)’s initialization, $\pmb { \nu } _ { l }$ and $\nu _ { l } ^ { \prime }$ are both initialized to $\mathbf { 0 }$ .
|
| 127 |
+
|
| 128 |
+
# 3.4 Attentive Feature Selection
|
| 129 |
+
|
| 130 |
+
In a fashion similar to feature boosting and suppression (FBS) (Gao et al., 2019), AFS modifies the ConvBN layers from Equation (2):
|
| 131 |
+
|
| 132 |
+
$$
|
| 133 |
+
\hat { f } _ { l } ( \pmb { x } _ { l - 1 } , \pmb { \theta } _ { l } ) = \mathrm { r e l u } ( \pi _ { l } ( \pmb { x } _ { l - 1 } ) \cdot \mathrm { n o r m } ( \mathrm { c o n v } ( \pmb { x } _ { l - 1 } , \pmb { \theta } _ { l } ) ) + \beta _ { l } ) ,
|
| 134 |
+
$$
|
| 135 |
+
|
| 136 |
+
where the predictor function takes as input the activation maps of the previous layer, i.e. : $\mathbb { R } ^ { C _ { l - 1 } \times H _ { l - 1 } \times W _ { l - 1 } } \to \mathbb { R } ^ { C }$ , is used to replace the vector $\gamma _ { l }$ . This function dynamically predicts the importance of each channel, and suppresses certain unimportant channels by setting them to zero. The expensive conv function can hence be accelerated by skipping the disabled output channels. The predictor function is defined as below:
|
| 137 |
+
|
| 138 |
+
$$
|
| 139 |
+
\begin{array} { r } { \pi _ { l } ( \pmb { x } _ { l - 1 } ) = \pmb { \mathrm { m } } _ { l } \cdot \ b { q } _ { l } ( \pmb { x } _ { l - 1 } ) , \mathrm { ~ w h e r e ~ } \pmb { q } _ { l } ( \pmb { x } _ { l - 1 } ) = \mathrm { w t a } _ { \lceil d C _ { l } \rceil } ( \mathbf { s } _ { l } \cdot h _ { l } ( \pmb { x } _ { l - 1 } ) + ( 1 - \mathbf { s } _ { l } ) \cdot \gamma _ { l } ) , } \end{array}
|
| 140 |
+
$$
|
| 141 |
+
|
| 142 |
+
where $\mathbf { m } _ { l } , \mathbf { s } _ { l } \in \{ 0 , 1 \} ^ { C _ { l } }$ are both constant masks that take binary values: $\mathbf { I I I }$ prunes output channels by permanently setting them to zeros, and $\mathbf { s } _ { l }$ decides for each channel whether the output of $h _ { l } ( \pmb { x } _ { l - 1 } )$ or $\gamma _ { l }$ should be used. It is clear that when ${ \bf m } _ { l } = { \bf 1 }$ , no channel neurons are removed from the network. In Section 3.5, we explain how $\mathbf { I I I }$ and $\gamma _ { l }$ can be determined during the fine-tuning process. The winner-take-all function w $\tan _ { [ d C _ { l } ] } ( z )$ preserves the $\lceil d C _ { l } \rceil$ most salient values in $_ { z }$ , and suppresses the remaining ones by setting them to zeros. The density value $0 < d \leq 1$ is a constant that controls the number of channels to preserve during inference, with 1 preserving all $C _ { l }$ channels. The smaller $d$ gets, the more channels can be skipped, which in turn accelerates the model. Finally, the function $h _ { l } : \mathbb { R } ^ { C _ { l - 1 } \times H \times W } \mathbb { R } ^ { C _ { l } }$ is a small network that is used to predict the importance of each channel. It is composed of a global average pool followed by a FC layer, where pool : $: \mathbb { R } ^ { C _ { l - 1 } \times H \times W } \mathbb { R } ^ { C _ { l - 1 } }$ computes the average across the spatial dimensions for each channel:
|
| 143 |
+
|
| 144 |
+
$$
|
| 145 |
+
h ( \pmb { x } _ { l - 1 } ) = \mathrm { r e l u } ( \mathrm { p o o l } ( \pmb { x } _ { l - 1 } ) \pmb { \varphi } _ { l } ^ { \prime \prime } + \pmb { \nu } _ { l } ^ { \prime \prime } ) .
|
| 146 |
+
$$
|
| 147 |
+
|
| 148 |
+
For the initialization of the FC parameters, we apply He et al. (2015)’s method on the trainable weights $\varphi _ { l } ^ { \prime \prime } \in \mathbb { R } ^ { C _ { l - 1 } \times C _ { l } }$ and $\pmb { \nu } _ { l } ^ { \prime \prime } \in \mathbb { R } ^ { C _ { l } }$ is initialized to zeros.
|
| 149 |
+
|
| 150 |
+
# 3.5 Training Procedure
|
| 151 |
+
|
| 152 |
+
In this section, we describe the pipeline of AFDS for transferring knowledge from a source model to a new model by fine-tuning on target dataset. The detailed algorithm can be found in Appendix A.
|
| 153 |
+
|
| 154 |
+
Initially, we have a pre-trained model $f$ with parameters $\theta ^ { \star }$ for the source dataset (e.g. ImageNet). To ensure better accuracies on compressed target models, All ConvBN layers $f _ { l }$ in $f$ are extended with AFS as discussed in Section 3.4, with $d$ initially set to 1, which means that all output channels in a convolutional layer are evaluated during inference, i.e. no acceleration. The pre-trained model is then fine-tuned on the target training dataset $\mathcal { D }$ with the AFD regularization proposed in Section 3.3.
|
| 155 |
+
|
| 156 |
+
Empirically we found that in residual networks with greater depths, AFS could become notably challenging to train to high accuracies. To mitigate this, for each output channel of a layer $\it l$ we update $\mathbf { s } _ { l }$ according to the variance of $h _ { l } ( \pmb { x } _ { l - 1 } )$ observed on the target dataset. For each channel if the variance is smaller than a threshold $\delta _ { s }$ , then we set the entry in $\mathbf { s } _ { l }$ to zero for that particular channel. This action replaces the output of $h _ { l } ( \pmb { x } _ { l - 1 } )$ with $\gamma _ { l }$ , which is a trainable parameter initialized to the mean of $h _ { l } ( \pmb { x } _ { l - 1 } )$ . We compute the mean and variance statistics using Welford (1962)’s online algorithm which can efficiently compute the statistics in a single-pass with $O ( 1 )$ storage. In our experiments, $\delta _ { \mathrm { s } }$ is set to a value such that $5 0 \%$ of the channel neurons use the predictor function $h _ { l }$ .
|
| 157 |
+
|
| 158 |
+
Moreover, we discovered that many of the channel neurons are rarely activated in a AFSbased network. We further propose to remove the channel neurons that are activated with a low frequency. In each layer $\it l$ , the mask $\mathbf { m } _ { l }$ is used to disable certain channels from the network by setting their output to a constant $\mathbf { 0 }$ , if the probability of a channel neuron being active is lower than $\delta _ { \mathrm { m } }$ . Zeroed-out channels can thus be permanently removed when the model is used in inference.
|
| 159 |
+
|
| 160 |
+
# 4 Experiments
|
| 161 |
+
|
| 162 |
+
In this section we provide an extensive empirical study of the joint methods of transfer learning and channel pruning. We evaluate the methods with 6 different benchmark datasets: Caltech-256 (Griffin et al., 2007) of 256 general object categories; Stanford Dogs 120 (Khosla et al., 2011) specializes to images containing dogs; MIT Indoors 67 (Quattoni & Torralba, 2009) for indoor scene classification; Caltech-UCSD Birds-200-2011 (CUB-200-2011) (Wah et al., 2011) for classifying birds; and Food-101 (Bossard et al., 2014) for food categories. We refer to Li et al. (2018) and Li et al. (2019), for a detailed description of the benchmark datasets. For Caltech-256, we randomly sample either 30 or 60 images from the training set for each category to produce Caltech-256-30 and - $6 0$ training datasets.
|
| 163 |
+
|
| 164 |
+
We use the ResNet-101 from torchvision1 pre-trained on ImageNet as the network for experiments. For ResNet-101 equipped with AFS, we start by extending the pre-trained model and replacing each batch normalization with a randomly initialized AFS, and fine-tune the resulting model on ImageNet for 90 epochs with a learning rate of 0.01 decaying by a factor of 10 every 30 epochs. The resulting model matches its original baseline accuracy.
|
| 165 |
+
|
| 166 |
+
For each benchmark dataset, the final FC layer of the network is replaced with a new FC randomly initialized with He et al. (2015)’s method to match the number of output categories accordingly. We then perform transfer learning with 4 different methods: $L ^ { 2 }$ (fine-tuning without additional regularization), $L ^ { 2 }$ -SP (Li et al., 2018), learning without forgetting (LwF) (Li & Hoiem, 2018), and finally AFD for models using AFS.
|
| 167 |
+
|
| 168 |
+
To accelerate the resulting fine-tuned models, we continue fine-tuning the model while gradually pruning away channels used during inference. For this, we separately examine 3 pruning strategies: network slimming (NS) (Liu et al., 2017), soft filter pruning (SFP) (He et al., 2018) and finally AFS for models transfer learned with AFD. Note that NS prunes channels by sorting them globally, while SFP does so in a layer-wise manner with identical prune ratios. During this procedure, we start with an unpruned model and incrementally remove $1 0 \%$ of the channels used in inference, i.e. preserving $9 0 \%$ , $8 0 \%$ , and etc., down to $1 0 \%$ of all channels for the accelerated models. At each step, we fine-tune each model using 4500 steps of SGD with a batch size of 48, at a learning rate of 0.01, before fine-tuning for a further 4500 steps at a learning rate of 0.001. AFS additionally updates the $\mathbf { m }$ and s masks between the two fine-tuning runs.
|
| 169 |
+
|
| 170 |
+
Table 1: Top-1 accuracy ( $\%$ ) comparisons of NS, SFP and AFDS on 6 datasets fine-tuned with their respective best transfer learning methods under various speed-up constraints.
|
| 171 |
+
|
| 172 |
+
<table><tr><td colspan="2">MACs reduction</td><td>NS</td><td>SFP</td><td>AFDS</td></tr><tr><td rowspan="3">MIT Indoors 67</td><td>2×</td><td>81.83 ± 0.35</td><td>79.43± 0.50</td><td>82.05 ± 0.43</td></tr><tr><td>5×</td><td>69.38 ± 0.27</td><td>60.43 ± 0.31</td><td>69.93 ± 0.52</td></tr><tr><td>10×</td><td>1.50 ± 0.30</td><td>58.49 ± 0.34</td><td>66.72 ± 0.53</td></tr><tr><td rowspan="3">Stanford Dogs 120</td><td>2×</td><td>87.21 ± 0.58</td><td>81.74 ± 0.26</td><td>87.41 ± 0.56</td></tr><tr><td>5×</td><td>73.44 ± 0.27</td><td>61.20 ± 0.31</td><td>75.14 ± 0.52</td></tr><tr><td>10×</td><td>1.33 ± 0.50</td><td>59.63 ± 0.23</td><td>70.70 ± 0.33</td></tr><tr><td rowspan="3">Caltech-256-30</td><td>2×</td><td>85.87 ± 0.38</td><td>77.26 ± 0.28</td><td>85.15 ± 0.75</td></tr><tr><td>5×</td><td>66.57 ± 0.23</td><td>64.27 ± 0.31</td><td>66.64 ± 0.32</td></tr><tr><td>10×</td><td>0.39 ±0.04</td><td>57.11 ± 0.54</td><td>61.45 ± 0.43</td></tr><tr><td rowspan="3">Caltech-256-60</td><td>2×</td><td>88.02 ± 0.45</td><td>84.59 ± 0.28</td><td>87.15 ± 0.75</td></tr><tr><td>5×</td><td>73.95 ± 0.27</td><td>68.38 ± 0.59</td><td>74.46 ± 0.52</td></tr><tr><td>10×</td><td>5.05 ± 0.11</td><td>61.27 ± 0.49</td><td>70.16 ± 0.53</td></tr><tr><td rowspan="3">CUB-200-2011</td><td>2×</td><td>78.88± 0.65</td><td>75.65± 0.26</td><td>78.03 ± 0.45</td></tr><tr><td>5×</td><td>73.44 ± 0.27</td><td>61.50 ± 0.31</td><td>73.35 ± 0.52</td></tr><tr><td>10×</td><td>0.52 ± 0.50</td><td>57.88 ± 0.23</td><td>69.07 ± 0.43</td></tr><tr><td rowspan="3">Food-101</td><td>2×</td><td>83.78 ± 0.61</td><td>75.65 ± 0.26</td><td>84.21 ± 0.65</td></tr><tr><td>5×</td><td>73.36 ± 0.45</td><td>17.10 ± 0.17</td><td>79.12 ± 0.52</td></tr><tr><td>10×</td><td>0.99 ± 0.04</td><td>3.85 ± 0.09</td><td>76.95 ± 0.49</td></tr></table>
|
| 173 |
+
|
| 174 |
+
Table 2: Top-1 accuracy ( $\%$ ) comparisons of $L ^ { 2 }$ , $L ^ { 2 }$ -SP, LwF, AFDS on 6 datasets fine-tuned with their respective best pruning methods under various speed-up constraints.
|
| 175 |
+
|
| 176 |
+
<table><tr><td colspan="2">MACs reduction</td><td>L²</td><td>L²-SP</td><td>LwF</td><td>AFDS</td></tr><tr><td rowspan="3">MIT Indoors 67</td><td>2×</td><td>79.13 ± 0.16</td><td>78.09 ± 0.56</td><td>81.83 ± 0.35</td><td>82.05 ± 0.43</td></tr><tr><td>5×</td><td>64.02 ± 0.21</td><td>62.00 ± 0.31</td><td>69.38 ± 0.27</td><td>69.93 ± 0.52</td></tr><tr><td>10×</td><td>58.04 ± 0.38</td><td>58.49 ± 0.34</td><td>48.09 ± 0.52</td><td>66.72 ± 0.53</td></tr><tr><td rowspan="3">Stanford Dogs 120</td><td>2×</td><td>85.38 ± 0.67</td><td>87.21 ± 0.58</td><td>87.07 ± 0.35</td><td>87.41 ± 0.56</td></tr><tr><td>5×</td><td>70.20 ± 0.37</td><td>67.10 ± 0.31</td><td>73.44 ± 0.27</td><td>75.14 ± 0.52</td></tr><tr><td>10×</td><td>59.63 ± 0.23</td><td>42.89 ± 0.48</td><td>17.79 ± 0.50</td><td>70.70 ± 0.33</td></tr><tr><td rowspan="3">Caltech-256-30</td><td>2×</td><td>83.83 ± 0.62</td><td>83.67 ± 0.53</td><td>85.87 ± 0.38</td><td>85.15 ± 0.75</td></tr><tr><td>5×</td><td>61.45 ± 0.17</td><td>60.03 ± 0.21</td><td>66.57 ± 0.23</td><td>66.64 ± 0.32</td></tr><tr><td>10×</td><td>57.11 ± 0.54</td><td>56.12 ± 0.31</td><td>40.32 ± 0.34</td><td>61.45 ± 0.43</td></tr><tr><td rowspan="3">Caltech-256-60</td><td>2×</td><td>86.27 ± 0.47</td><td>85.84 ± 0.51</td><td>88.02 ± 0.45</td><td>87.15 ± 0.75</td></tr><tr><td>5×</td><td>71.02 ± 0.37</td><td>69.9 ± 0.31</td><td>73.95 ± 0.27</td><td>74.46 ± 0.52</td></tr><tr><td>10×</td><td>61.27 ± 0.49</td><td>39.41 ± 0.71</td><td>26.75 ± 0.50</td><td>70.16 ± 0.53</td></tr><tr><td rowspan="3">CUB-200-2011</td><td>2×</td><td>76.27 ± 0.37</td><td>75.58 ± 0.46</td><td>78.88 ± 0.65</td><td>78.03 ± 0.45</td></tr><tr><td>5×</td><td>66.48 ± 0.37</td><td>64.49 ± 0.31</td><td>73.44 ± 0.27</td><td>73.35 ± 0.52</td></tr><tr><td>10×</td><td>57.88 ± 0.23</td><td>57.13 ± 0.38</td><td>29.57 ± 0.31</td><td>69.07 ± 0.43</td></tr><tr><td rowspan="3">Food-101</td><td>2×</td><td>83.78 ± 0.61</td><td>82.27 ± 0.23</td><td>82.38 ± 0.85</td><td>84.21 ± 0.65</td></tr><tr><td>5×</td><td>73.36 ± 0.33</td><td>70.12 ± 0.71</td><td>73.05 ± 0.64</td><td>79.12 ± 0.52</td></tr><tr><td>10×</td><td>1.6 ± 0.04</td><td>3.56 ± 0.08</td><td>3.85 ± 0.09</td><td>76.95 ± 0.49</td></tr></table>
|
| 177 |
+
|
| 178 |
+
For each pruned model, we can compute the number of multiply-accumulate operations (MACs) required to perform inference on an image. For each accelerated convolution, the required number of MACs is $k ^ { 2 } H W C _ { \mathrm { i n } } C _ { \mathrm { o u t } }$ , where $C _ { \mathrm { i n } }$ and $C _ { \mathrm { o u t } }$ are the number of input and output channels that are not pruned, respectively. We compute the total number of MACs by summing up the MACs in all convolutions, residual connections, and the final pooling and FC layers. For AFS as we dynamically select which channels to evaluate during inference, we additionally add the overhead of the importance predictor layers to the number of total MACs.
|
| 179 |
+
|
| 180 |
+
Table 3: Comparison to related transfer learning methods.
|
| 181 |
+
|
| 182 |
+
<table><tr><td>Dataset</td><td>Method</td><td>Model</td><td>Accuracy</td><td>MACs</td></tr><tr><td rowspan="4">CUB-200-2011</td><td rowspan="2">Zagoruyko & Komodakis (2017)</td><td>ResNet-34</td><td>73.5</td><td>3.6G</td></tr><tr><td>ResNet-18</td><td>73.0</td><td>1.8G</td></tr><tr><td rowspan="2">Jang et al. (2019)</td><td>ResNet-18</td><td>65.05</td><td>1.8G</td></tr><tr><td>ResNet-101</td><td>76.34</td><td>2.4G</td></tr><tr><td rowspan="4">MIT Indoors 67</td><td rowspan="2">AFDS</td><td>ResNet-101</td><td>73.35</td><td>1.9G</td></tr><tr><td>ResNet-34</td><td>74.0</td><td>3.6G</td></tr><tr><td rowspan="2">Zagoruyko & Komodakis (2017) Jang et al. (2019)</td><td>ResNet-18</td><td>72.9</td><td>1.8G</td></tr><tr><td>ResNet-18</td><td>64.85</td><td>1.8G</td></tr><tr><td rowspan="2"></td><td rowspan="2">AFDS</td><td>ResNet-101</td><td>78.09</td><td>2.4G</td></tr><tr><td>ResNet-101</td><td>74.57</td><td>1.9G</td></tr></table>
|
| 183 |
+
|
| 184 |
+

|
| 185 |
+
Figure 3: MACs and accuracy $\%$ ) trade-off comparisons among different joint methods.
|
| 186 |
+
|
| 187 |
+
In Figure 3, we present the trade-off relationship between the number of vs. the target dataset accuracies for Stanford Dogs and Caltech-256-60. It is clear that AFDS (ours) exceeds various combinations of pruning methods (NS, SFP) and transfer learning methods ( $L ^ { 2 }$ , $L ^ { 2 }$ -SP, LwF). The results for the remaining datasets can be found in Appendix B. The trade-off curves show that AFDS minimizes accuracy degradation even if 47% of the total MACs are removed from the original model, AFDS resulted in only $1 . 8 3 \%$ drop in accuracy for the model trained on Stanford Dogs. In extreme cases where we permit only $\textstyle { \frac { 1 } { 1 0 } }$ of the original computations, our method can still manage abstantially better when compared to other pruning algorithm $7 0 . 7 0 \%$ accuracrops to ch is and $1 . 3 3 \%$ SFP only has $5 9 . 6 3 \%$ .
|
| 188 |
+
|
| 189 |
+
Table 1 provide numerical comparisons of different pruning methods against AFS under various speed-up constraints. Table 2 similarly compares transfer learning strategies against AFD. Under most acceleration requirements, the combined method, AFDS, achieves the best accuracies on the target datasets. Finally, Table 3 compares AFDS against other literatures that performs transfer learning. AFDS can achieve state-of-the-art accuracies when compared to methods that produce models with similar number of MACs.
|
| 190 |
+
|
| 191 |
+
# 5 Conclusion
|
| 192 |
+
|
| 193 |
+
In this paper, we introduced attentive feature distillation and selection (AFDS), a dualattention method that aims to reap the advantages of transfer learning and channel pruning methods. By applying AFDS during fine-tuning, we can not only learn a new model with a higher target task accuracy, but also further accelerates it by computing a subset of channel neurons in each convolutional layers. Under a wide range of datasets, we demonstrated the smallest drop in validation accuracies under the same speed-up constraints when compared to traditional compression methods such as network slimming (Liu et al., 2017) and soft filter pruning (He et al., 2018).
|
| 194 |
+
|
| 195 |
+
# Acknowledgements
|
| 196 |
+
|
| 197 |
+
This work is supported in part by National Key R&D Program of China (No. 2019YFB2102100), Science and Technology Development Fund of Macao S.A.R (FDCT) under number 0015/2019/AKP, Shenzhen Discipline Construction Project for Urban Computing and Data Intelligence, the National Natural Science Foundation of China (Nos. 61806192, 61802387), Shenzhen Science and Technology Innovation Commission (No. JCYJ2017081853518789, JCYJ20190812160003719), the Guangdong Science and Technology Plan Guangdong-Hong Kong Cooperation Innovation Platform (No. 2018B050502009), and China’s Post-doctoral Science Fund (No. 2019M663183).
|
| 198 |
+
|
| 199 |
+
# References
|
| 200 |
+
|
| 201 |
+
Jose M Alvarez and Mathieu Salzmann. Learning the number of neurons in deep networks. In D. D. Lee, M. Sugiyama, U. V. Luxburg, I. Guyon, and R. Garnett (eds.), Advances in Neural Information Processing Systems (NIPS), pp. 2270–2278. 2016.
|
| 202 |
+
|
| 203 |
+
Hossein Azizpour, Ali Sharif Razavian, Josephine Sullivan, Atsuto Maki, and Stefan Carlsson. From generic to specific deep representations for visual recognition. In Proceedings of the 2015 IEEE Conference on Computer Vision and Pattern Recognition Workshops, CVPRW ’15, pp. 36–45, 2015.
|
| 204 |
+
|
| 205 |
+
Tolga Bolukbasi, Joseph Wang, Ofer Dekel, and Venkatesh Saligrama. Adaptive neural networks for efficient inference. In Proceedings of the 34th International Conference on Machine Learning (ICML), pp. 527–536, 2017.
|
| 206 |
+
|
| 207 |
+
Lukas Bossard, Matthieu Guillaumin, and Luc Van Gool. Food-101 – mining discriminative components with random forests. In European Conference on Computer Vision, 2014.
|
| 208 |
+
|
| 209 |
+
Zhaowei Cai and Nuno Vasconcelos. Cascade R-CNN: Delving into high quality object detection. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 6154–6162, 2018.
|
| 210 |
+
|
| 211 |
+
Yves Chauvin. A back-propagation algorithm with optimal use of hidden units. In D. S. Touretzky (ed.), Advances in Neural Information Processing Systems 1, pp. 519–526. Morgan-Kaufmann, 1989.
|
| 212 |
+
|
| 213 |
+
Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. ImageNet: A largescale hierarchical image database. In 2009 IEEE Conference on Computer Vision and Pattern Recognition, pp. 248–255, June 2009.
|
| 214 |
+
|
| 215 |
+
Jeff Donahue, Yangqing Jia, Oriol Vinyals, Judy Hoffman, Ning Zhang, Eric Tzeng, and Trevor Darrell. DeCAF: A deep convolutional activation feature for generic visual recognition. In Eric P. Xing and Tony Jebara (eds.), Proceedings of the 31st International Conference on Machine Learning, volume 32 of Proceedings of Machine Learning Research, pp. 647–655, Bejing, China, 22–24 Jun 2014. PMLR.
|
| 216 |
+
|
| 217 |
+
Xin Dong, Shangyu Chen, and Sinno Pan. Learning to prune deep neural networks via layer-wise optimal brain surgeon. In I. Guyon, U. V. Luxburg, S. Bengio, H. Wallach, R. Fergus, S. Vishwanathan, and R. Garnett (eds.), Advances in Neural Information Processing Systems 30, pp. 4857–4867. Curran Associates, Inc., 2017a.
|
| 218 |
+
|
| 219 |
+
Xuanyi Dong, Junshi Huang, Yi Yang, and Shuicheng Yan. More is less: A more complicated network with less inference complexity. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), July 2017b.
|
| 220 |
+
|
| 221 |
+
Michael Figurnov, Maxwell D. Collins, Yukun Zhu, Li Zhang, Jonathan Huang, Dmitry Vetrov, and Ruslan Salakhutdinov. Spatially adaptive computation time for residual networks. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), July 2017.
|
| 222 |
+
|
| 223 |
+
Xitong Gao, Yiren Zhao, Lukasz Dudziak, Robert Mullins, and Cheng-zhong Xu. Dynamic channel pruning: Feature boosting and suppression. In International Conference on Learning Representations (ICLR), 2019.
|
| 224 |
+
|
| 225 |
+
Gregory Griffin, Alex Holub, and Pietro Perona. Caltech-256 object category dataset. Technical report, 2007.
|
| 226 |
+
|
| 227 |
+
Yiwen Guo, Anbang Yao, and Yurong Chen. Dynamic network surgery for efficient DNNs. In Advances in Neural Information Processing Systems (NIPS), 2016.
|
| 228 |
+
|
| 229 |
+
Babak Hassibi, David G. Stork, and Gregory Wolff. Optimal brain surgeon: Extensions and performance comparisons. In J. D. Cowan, G. Tesauro, and J. Alspector (eds.), Advances in Neural Information Processing Systems (NIPS), pp. 263–270. 1994.
|
| 230 |
+
|
| 231 |
+
Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Delving deep into rectifiers: Surpassing human-level 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.
|
| 232 |
+
|
| 233 |
+
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.
|
| 234 |
+
|
| 235 |
+
Yang He, Guoliang Kang, Xuanyi Dong, Yanwei Fu, and Yi Yang. Soft filter pruning for accelerating deep convolutional neural networks. In International Joint Conference on Artificial Intelligence (IJCAI), pp. 2234–2240, 2018.
|
| 236 |
+
|
| 237 |
+
Yihui He, Xiangyu Zhang, and Jian Sun. Channel pruning for accelerating very deep neural networks. In The IEEE International Conference on Computer Vision (ICCV), Oct 2017.
|
| 238 |
+
|
| 239 |
+
Geoffrey Hinton, Oriol Vinyals, and Jeff Dean. Distilling the knowledge in a neural network. Advances in neural information processing systems 2014, Deep Learning Workshop, 2014.
|
| 240 |
+
|
| 241 |
+
Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. In Proceedings of the 32Nd International Conference on International Conference on Machine Learning - Volume 37, ICML’15, pp. 448–456. JMLR.org, 2015. URL http://dl.acm.org/citation.cfm?id=3045118.3045167.
|
| 242 |
+
|
| 243 |
+
Yunhun Jang, Hankook Lee, Sung Ju Hwang, and Jinwoo Shin. Learning what and where to transfer. In Kamalika Chaudhuri and Ruslan Salakhutdinov (eds.), Proceedings of the 36th International Conference on Machine Learning, volume 97 of Proceedings of Machine Learning Research, pp. 3030–3039, Long Beach, California, USA, 09–15 Jun 2019. PMLR.
|
| 244 |
+
|
| 245 |
+
Aditya Khosla, Nityananda Jayadevaprakash, Bangpeng Yao, and Li Fei-Fei. Novel dataset for fine-grained image categorization. In First Workshop on Fine-Grained Visual Categorization, IEEE Conference on Computer Vision and Pattern Recognition, Colorado Springs, CO, June 2011.
|
| 246 |
+
|
| 247 |
+
Yann LeCun, John S. Denker, and Sara A. Solla. Optimal brain damage. In Advances in Neural Information Processing Systems (NIPS), pp. 598–605. 1990.
|
| 248 |
+
|
| 249 |
+
Xingjian Li, Haoyi Xiong, Hanchao Wang, Yuxuan Rao, Liping Liu, and Jun Huan. DELTA: Deep learning transfer using feature map with attention for convolutional networks. In International Conference on Learning Representations (ICLR), 2019.
|
| 250 |
+
|
| 251 |
+
Xuhong Li, Yves Grandvalet, and Franck Davoine. Explicit inductive bias for transfer learning with convolutional networks. Thirty-fifth International Conference on Machine Learning, 2018.
|
| 252 |
+
|
| 253 |
+
Zhizhong Li and Derek Hoiem. Learning without forgetting. IEEE Transactions on Pattern Analysis and Machine Intelligence, 40(12):2935–2947, Dec 2018. ISSN 0162-8828. doi: 10.1109/TPAMI.2017.2773081.
|
| 254 |
+
|
| 255 |
+
Ji Lin, Yongming Rao, Jiwen Lu, and Jie Zhou. Runtime neural pruning. In Advances in Neural Information Processing Systems (NIPS), pp. 2181–2191. 2017.
|
| 256 |
+
|
| 257 |
+
Zhuang Liu, Jianguo Li, Zhiqiang Shen, Gao Huang, Shoumeng Yan, and Changshui Zhang. Learning efficient convolutional networks through network slimming. In International Conference on Computer Vision (ICCV), 2017.
|
| 258 |
+
|
| 259 |
+
Jian-Hao Luo, Jianxin Wu, and Weiyao Lin. ThiNet: A filter level pruning method for deep neural network compression. In Proceedings of the IEEE international conference on computer vision, pp. 5058–5066, 2017.
|
| 260 |
+
|
| 261 |
+
Michael C Mozer and Paul Smolensky. Skeletonization: A technique for trimming the fat from a network via relevance assessment. In D. S. Touretzky (ed.), Advances in Neural Information Processing Systems 1, pp. 107–115. Morgan-Kaufmann, 1989.
|
| 262 |
+
|
| 263 |
+
Sinno Jialin Pan and Qiang Yang. A survey on transfer learning. IEEE Transactions on knowledge and data engineering, 22(10):1345–1359, 2009.
|
| 264 |
+
|
| 265 |
+
Ariadna Quattoni and Antonio Torralba. Recognizing indoor scenes. In 2009 IEEE Conference on Computer Vision and Pattern Recognition, pp. 413–420, June 2009. doi: 10.1109/CVPR.2009.5206537.
|
| 266 |
+
|
| 267 |
+
Ali Sharif Razavian, Hossein Azizpour, Josephine Sullivan, and Stefan Carlsson. CNN features off-the-shelf: An astounding baseline for recognition. In Proceedings of the 2014 IEEE Conference on Computer Vision and Pattern Recognition Workshops, CVPRW ’14, pp. 512–519, Washington, DC, USA, 2014. IEEE Computer Society. ISBN 978-1-4799- 4308-1. doi: 10.1109/CVPRW.2014.131.
|
| 268 |
+
|
| 269 |
+
R. Reed. Pruning algorithms–a survey. IEEE Transactions on Neural Networks, 4(5):740– 747, Sep. 1993. doi: 10.1109/72.248452.
|
| 270 |
+
|
| 271 |
+
Mengye Ren, Andrei Pokrovsky, Bin Yang, and Raquel Urtasun. SBNet: Sparse blocks network for fast inference. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), June 2018.
|
| 272 |
+
|
| 273 |
+
Shaoqing Ren, Kaiming He, Ross Girshick, and Jian Sun. Faster R-CNN: Towards realtime object detection with region proposal networks. In Advances in neural information processing systems, pp. 91–99, 2015.
|
| 274 |
+
|
| 275 |
+
Noam Shazeer, Azalia Mirhoseini, Krzysztof Maziarz, Andy Davis, Quoc Le, Geoffrey Hinton, and Jeff Dean. Outrageously large neural networks: The sparsely-gated mixture-ofexperts layer. 2017.
|
| 276 |
+
|
| 277 |
+
Mingxing Tan and Quoc Le. EfficientNet: Rethinking model scaling for convolutional neural networks. In International Conference on Machine Learning, pp. 6105–6114, 2019.
|
| 278 |
+
|
| 279 |
+
Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention is all you need. In Advances in neural information processing systems, pp. 5998–6008, 2017.
|
| 280 |
+
|
| 281 |
+
C. Wah, S. Branson, P. Welinder, P. Perona, and S. Belongie. The Caltech-UCSD Birds200-2011 Dataset. Technical Report CNS-TR-2011-001, California Institute of Technology, 2011.
|
| 282 |
+
|
| 283 |
+
B. P. Welford. Note on a method for calculating corrected sums of squares and products. Technometrics, 4(3):419–420, 1962. ISSN 00401706. URL http://www.jstor.org/ stable/1266577.
|
| 284 |
+
|
| 285 |
+
Wei Wen, Chunpeng Wu, Yandan Wang, Yiran Chen, and Hai Li. Learning structured sparsity in deep neural networks. In Advances in Neural Information Processing Systems (NIPS), pp. 2074–2082. 2016.
|
| 286 |
+
|
| 287 |
+
Zuxuan Wu, Tushar Nagarajan, Abhishek Kumar, Steven Rennie, Larry S. Davis, Kristen Grauman, and Rogerio Feris. BlockDrop: Dynamic inference paths in residual networks. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), June 2018.
|
| 288 |
+
|
| 289 |
+
Jianbo Ye, Xin Lu, Zhe Lin, and James Z Wang. Rethinking the smaller-norm-lessinformative assumption in channel pruning of convolution layers. 2018.
|
| 290 |
+
|
| 291 |
+
Junho Yim, Donggyu Joo, Jihoon Bae, and Junmo Kim. A gift from knowledge distillation: Fast optimization, network minimization and transfer learning. In 2017 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 7130–7138, July 2017. doi: 10.1109/CVPR.2017.754.
|
| 292 |
+
|
| 293 |
+
Jason Yosinski, Jeff Clune, Yoshua Bengio, and Hod Lipson. How transferable are features in deep neural networks? In Z. Ghahramani, M. Welling, C. Cortes, N. D. Lawrence, and K. Q. Weinberger (eds.), Advances in Neural Information Processing Systems 27, pp. 3320–3328. Curran Associates, Inc., 2014.
|
| 294 |
+
|
| 295 |
+
Sergey Zagoruyko and Nikos Komodakis. Paying more attention to attention: Improving the performance of convolutional neural networks via attention transfer. In International Conference on Learning Representations (ICLR), 2017.
|
| 296 |
+
|
| 297 |
+
Hengshuang Zhao, Xiaojuan Qi, Xiaoyong Shen, Jianping Shi, and Jiaya Jia. ICNet for realtime semantic segmentation on high-resolution images. In Proceedings of the European Conference on Computer Vision (ECCV), pp. 405–420, 2018.
|
| 298 |
+
|
| 299 |
+
Zhuangwei Zhuang, Mingkui Tan, Bohan Zhuang, Jing Liu, Yong Guo, Qingyao Wu, Junzhou Huang, and Jinhui Zhu. Discrimination-aware channel pruning for deep neural networks. In Advances in Neural Information Processing Systems, pp. 875–886, 2018.
|
| 300 |
+
|
| 301 |
+
# A The Overall Training Algorithm
|
| 302 |
+
|
| 303 |
+
In Algorithm 1 we illustrate the complete training procedure described above. Here, the function takes as input the target training dataset $\mathcal { D }$ , the source model $f$ and its parameters $\theta ^ { \star }$ , the total number of steps to fine-tune $S$ , the initial learning rate $\alpha$ , and the threshold hyperparameters $\delta _ { \mathrm { s } }$ and $\delta _ { \mathrm { m } }$ respectively for $\mathbf { s } _ { l }$ and $\mathbf { I I I }$ . The function returns the optimized parameters $\pmb { \theta }$ for the target dataset, and both constant masks for all layers $\mathbf { s } = ( \mathbf { s } _ { 1 } , \mathbf { s } _ { 2 } , \ldots , \mathbf { s } _ { L } )$ and $\mathbf { m } = \left( \mathbf { m } _ { 1 } , \mathbf { m } _ { 2 } , \ldots , \mathbf { m } _ { L } \right)$ . The function SGD then fine-tunes the model parameters. For each layer $\it { \Delta } l$ , we compute the mean $\pmb { \mu } _ { l }$ and variance $\sigma _ { \mathit { l } }$ statistics of $q _ { l } ( \pmb { x } _ { l - 1 } )$ , and use it to compute $\mathbf { s } _ { l }$ .
|
| 304 |
+
|
| 305 |
+
<table><tr><td>Algorithm 1 Training Procedure</td></tr><tr><td>1: function AFDS(D,f,0*,S,α,δs,δm)</td></tr><tr><td>2: forl∈L:st←1</td></tr><tr><td>3: forl∈L:m ←1</td></tr><tr><td>4: 0 ← SGD(D,f,0*,s,m,「],a,R) 5: forl∈Ldo</td></tr><tr><td>6: μ ←E(x,y)~D[q(xl-1)]</td></tr><tr><td>7: σ²←E(,y)~D[(q(xl-1)-μt)²]</td></tr><tr><td>8: Pl ←E(χ,y)~D[πt(xl-1) >0]</td></tr><tr><td>9: st←σ²>δs</td></tr><tr><td>10:</td></tr><tr><td>Y←μ 11: m ←p>δm</td></tr><tr><td>end for</td></tr><tr><td>12:</td></tr><tr><td>13: 0 ← SGD(D,f,0,s,m,「2],1,R)</td></tr><tr><td>14: return 0,s,m</td></tr><tr><td>15: :end function</td></tr></table>
|
| 306 |
+
|
| 307 |
+

|
| 308 |
+
Figure 4: MACs and accuracy $\%$ ) trade-off comparisons among different joint methods.
|
md/train/ryzECoAcY7/ryzECoAcY7.md
ADDED
|
@@ -0,0 +1,250 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# LEARNING MULTI-LEVEL HIERARCHIES WITHHINDSIGHT
|
| 2 |
+
|
| 3 |
+
Andrew Levy
|
| 4 |
+
Department of Computer Science
|
| 5 |
+
Brown University
|
| 6 |
+
Providence, RI, USA
|
| 7 |
+
andrew levy2@brown.edu
|
| 8 |
+
George Konidaris
|
| 9 |
+
Department of Computer Science
|
| 10 |
+
Brown University
|
| 11 |
+
Providence, RI, USA
|
| 12 |
+
gdk@cs.brown.edu
|
| 13 |
+
Robert Platt
|
| 14 |
+
College of Computer and Information Science
|
| 15 |
+
Northeastern University
|
| 16 |
+
Boston, MA, USA
|
| 17 |
+
rplatt@ccs.neu.edu
|
| 18 |
+
Kate Saenko
|
| 19 |
+
Department of Computer Science
|
| 20 |
+
Boston University
|
| 21 |
+
Boston, MA, USA
|
| 22 |
+
saenko@bu.edu
|
| 23 |
+
|
| 24 |
+
# ABSTRACT
|
| 25 |
+
|
| 26 |
+
Hierarchical agents have the potential to solve sequential decision making tasks with greater sample efficiency than their non-hierarchical counterparts because hierarchical agents can break down tasks into sets of subtasks that only require short sequences of decisions. In order to realize this potential of faster learning, hierarchical agents need to be able to learn their multiple levels of policies in parallel so these simpler subproblems can be solved simultaneously. Yet, learning multiple levels of policies in parallel is hard because it is inherently unstable: changes in a policy at one level of the hierarchy may cause changes in the transition and reward functions at higher levels in the hierarchy, making it difficult to jointly learn multiple levels of policies. In this paper, we introduce a new Hierarchical Reinforcement Learning (HRL) framework, Hierarchical Actor-Critic (HAC), that can overcome the instability issues that arise when agents try to jointly learn multiple levels of policies. The main idea behind HAC is to train each level of the hierarchy independently of the lower levels by training each level as if the lower level policies are already optimal. We demonstrate experimentally in both grid world and simulated robotics domains that our approach can significantly accelerate learning relative to other non-hierarchical and hierarchical methods. Indeed, our framework is the first to successfully learn 3-level hierarchies in parallel in tasks with continuous state and action spaces. We also present a video of our results and software to implement our framework.
|
| 27 |
+
|
| 28 |
+
# 1 INTRODUCTION
|
| 29 |
+
|
| 30 |
+
Hierarchy has the potential to accelerate learning in sequential decision making tasks because hierarchical agents can decompose problems into smaller subproblems. In order to take advantage of these shorter horizon subproblems and realize the potential of HRL, an HRL algorithm must be able to learn the multiple levels within the hierarchy in parallel. That is, at the same time one level in the hierarchy is learning the sequence of subtasks needed to solve a task, the level below should be learning the sequence of shorter time scale actions needed to solve each subtask. Yet the existing HRL algorithms that are capable of automatically learning hierarchies in continuous domains (Schmidhuber, 1991; Konidaris & Barto, 2009; Bacon et al., 2017; Vezhnevets et al., 2017; Nachum et al., 2018) do not efficiently learn the multiple levels within the hierarchy in parallel. Instead, these algorithms often resort to learning the hierarchy one level at a time in a bottom-up fashion.
|
| 31 |
+
|
| 32 |
+
Learning multiple levels of policies in parallel is challenging due to non-stationary state transition functions. In nested, multi-level hierarchies, the transition function for any level above the ground level depends on the current policies below that level. For instance, in a 2-level hierarchy, the high-level policy may output a subgoal state for the low level to achieve, and the state to which this subgoal state leads will depend on the current low-level policy. When all policies within the hierarchy are trained simultaneously, the transition function at each level above ground level will continue to change as long as the policies below that level continue to be updated. In this setting of non-stationary transition functions, RL will likely struggle to learn the above ground level policies in the hierarchy because in order for RL methods to effectively value actions, the distribution of states to which those actions lead should be stable. However, learning multiple policies in parallel is still possible because the transition function for each level above ground level will stabilize once all lower level policies have converged to optimal or near optimal policies. Thus, RL can be used to learn all policies in parallel if each level above ground level had a way to simulate a transition function that uses the optimal versions of lower level policies. Our framework is able to simulate a transition function that uses an optimal lower level policy hierarchy and thus can learn multiple levels of policies in parallel.
|
| 33 |
+
|
| 34 |
+

|
| 35 |
+
|
| 36 |
+

|
| 37 |
+
Figure 1: An ant agent uses a 3-level hierarchy to traverse though rooms to reach its goal, represented by the yellow cube. $\Pi _ { 2 }$ uses as input the current state (joint positions $\theta$ and velocities $\dot { \theta }$ ) and goal state (yellow box) and outputs a subgoal state (green box) for $\Pi _ { 1 }$ to achieve. $\Pi _ { 1 }$ takes in the current state and its goal state (green box) and outputs a subgoal state (purple box) for $\Pi _ { 0 }$ to achieve. $\Pi _ { 0 }$ takes in the current state and goal state (purple box) and outputs a vector of joint torques.
|
| 38 |
+
|
| 39 |
+
We introduce a new HRL framework, Hierarchical Actor-Critic (HAC), that can significantly accelerate learning by enabling hierarchical agents to jointly learn a hierarchy of policies. Our framework is primarily comprised of two components: (i) a particular hierarchical architecture and (ii) a method for learning the multiple levels of policies in parallel given sparse rewards.
|
| 40 |
+
|
| 41 |
+
The hierarchies produced by HAC have a specific architecture consisting of a set of nested, goalconditioned policies that use the state space as the mechanism for breaking down a task into subtasks. The hierarchy of nested policies works as follows. The highest level policy takes as input the current state and goal state provided by the task and outputs a subgoal state. This state is used as the goal state for the policy at the next level down. The policy at that level takes as input the current state and the goal state provided by the level above and outputs its own subgoal state for the next level below to achieve. This process continues until the lowest level is reached. The lowest level then takes as input the current state and the goal state provided by the level above and outputs a primitive action. Further, each level has a certain number of attempts to achieve its goal state. When the level either runs out of attempts or achieves its goal state, execution at that level ceases and the level above outputs another subgoal.
|
| 42 |
+
|
| 43 |
+
Figure 1 shows how an ant agent trained with HAC uses its 3-level policy hierarchy $( \pi _ { 2 } , \pi _ { 1 } , \pi _ { 0 } )$ to move through rooms to reach its goal. At the beginning of the episode, the ant’s highest level policy, $\pi _ { 2 }$ , takes as input the current state, which in this case is a vector containing the ant’s joint positions and velocities $( [ \theta , { \dot { \theta } } ] )$ , and its goal state, represented by the yellow box. $\pi _ { 2 }$ then outputs a subgoal state, represented by the green box, for $\pi _ { 1 }$ to achieve. $\pi _ { 1 }$ takes as input the current state and its goal state represented by the green box and outputs the subgoal state represented by the purple box. Finally, $\pi _ { 0 }$ takes as input the current state and the goal state represented by purple box and outputs a primitive action, which in this case is a vector of joint torques. $\pi _ { 0 }$ has a fixed number of attempts to move to the purple box before $\pi _ { 1 }$ outputs another subgoal state. Similarly, $\pi _ { 1 }$ has a fixed number of subgoal states that it can output to try to move the agent to the green box before $\pi _ { 2 }$ outputs another subgoal.
|
| 44 |
+
|
| 45 |
+
In addition, HAC enables agents to learn multiple policies in parallel using only sparse reward functions as a result of two types of hindsight transitions. Hindsight action transitions help agents learn multiple levels of policies simultaneously by training each subgoal policy with respect to a transition function that simulates the optimal lower level policy hierarchy. Hindsight action transitions are implemented by using the subgoal state achieved in hindsight instead of the original subgoal state as the action component in the transition. For instance, when a subgoal level proposes subgoal state $A$ , but the next level policy is unsuccessful and the agent ends in state $B$ after a certain number of attempts, the subgoal level receives a transition in which the state $B$ is the action component, not state $A$ . The key outcome is that now the action and next state components in the transition are the same, as if the optimal lower level policy hierarchy had been used to achieve subgoal state $B$ . Training with respect to a transition function that uses the optimal lower level policy hierarchy is critical to learning multiple policies in parallel, because the subgoal policies can be learned independently of the changing lower level policies. With hindsight action transitions, a subgoal level can focus on learning the sequences of subgoal states that can reach a goal state, while the lower level policies focus on learning the sequences of actions to achieve those subgoal states. The second type of hindsight transition, hindsight goal transitions, helps each level learn a goal-conditioned policy in sparse reward tasks by extending the idea of Hindsight Experience Replay (Andrychowicz et al. (2017)) to the hierarchical setting. In these transitions, one of the states achieved in hindsight is used as the goal state in the transition instead of the original goal state.
|
| 46 |
+
|
| 47 |
+
We evaluated our approach on both grid world tasks and more complex simulated robotics environments. For each task, we evaluated agents with 1, 2, and 3 levels of hierarchy. In all tasks, agents using multiple levels of hierarchy substantially outperformed agents that learned a single policy. Further, in all tasks, agents using 3 levels of hierarchy outperformed agents using 2 levels of hierarchy. Indeed, our framework is the first to show empirically that it can jointly learn 3-level hierarchical policies in tasks with continuous state and action spaces. In addition, our approach outperformed another leading HRL algorithm, HIRO (Nachum et al., 2018), on three simulated robotics tasks.
|
| 48 |
+
|
| 49 |
+
# 2 RELATED WORK
|
| 50 |
+
|
| 51 |
+
Building agents that can learn hierarchical policies is a longstanding problem in Reinforcement Learning (Sutton et al., 1999; Dietterich, 2000; McGovern & Barto, 2001; Kulkarni et al., 2016; Menache et al., 2002; S¸ ims¸ek et al., 2005; Bakker & Schmidhuber, 2004; Wiering & Schmidhuber, 1997). However, most HRL approaches either only work in discrete domains, require pre-trained low-level controllers, or need a model of the environment.
|
| 52 |
+
|
| 53 |
+
There are several other automated HRL techniques that can work in continuous domains. Schmidhuber (1991) proposed a HRL approach that can support multiple levels, as in our method. However, the approach requires that the levels are trained one at a time, beginning with the bottom level, which can slow learning. Konidaris & Barto (2009) proposed Skill Chaining, a 2-level HRL method that incrementally chains options backwards from the end goal state to the start state. Our key advantage relative to Skill Chaining is that our approach can learn the options needed to bring the agent from the start state to the goal state in parallel rather than incrementally. Nachum et al. (2018) proposed HIRO, a 2-level HRL approach that can learn off-policy like our approach and outperforms two other popular HRL techniques used in continuous domains: Option-Critic (Bacon et al. (2017)) and FeUdal Networks (FUN) (Vezhnevets et al. (2017)). HIRO, which was developed simultaneously and independently to our approach, uses the same hierarchical architecture, but does not use either form of hindsight and is therefore not as efficient at learning multiple levels of policies in sparse reward tasks.
|
| 54 |
+
|
| 55 |
+
# 3 BACKGROUND
|
| 56 |
+
|
| 57 |
+
We are interested in solving a Markov Decision Process (MDP) augmented with a set of goals $\mathcal { G }$ (each a state or set of states) that we would like an agent to learn. We define an MDP augmented with a set of goals as a Universal MDP (UMDP). A UMDP is a tuple ${ \mathcal { U } } = ( S , \mathcal { G } , \mathcal { A } , T , R , \gamma )$ , in which $s$ is the set of states; $\mathcal { G }$ is the set of goals; $\mathcal { A }$ is the set of actions; $T$ is the transition probability function in which $T ( s , a , s ^ { \prime } )$ is the probability of transitioning to state $s ^ { \prime }$ when action $a$ is taken in state $s ; R$ is the reward function; $\gamma$ is the discount rate $\in [ 0 , 1 )$ . At the beginning of each episode in a UMDP, a goal $g \in { \mathcal { G } }$ is selected for the entirety of the episode. The solution to a UMDP is a control policy $\pi : { \mathcal { S } } , { \mathcal { G } } \to { \mathcal { A } }$ that maximizes the value function $\begin{array} { r } { v _ { \pi } ( s , g ) = \mathbb { E } _ { \pi } [ \sum _ { n = 0 } ^ { \infty } \gamma ^ { n } R _ { t + n + 1 } | s _ { t } = s , \tilde { g _ { t } } = \bar { g } ] } \end{array}$ for an initial state $s$ and goal $g$ .
|
| 58 |
+
|
| 59 |
+
In order to implement hierarchical agents in tasks with continuous state and actions spaces, we will use two techniques from the RL literature: (i) the Universal Value Function Approximator (UVFA) (Schaul et al., 2015) and (ii) Hindsight Experience Replay (Andrychowicz et al., 2017). The UVFA will be used to estimate the action-value function of a goal-conditioned policy $\pi$ , $q _ { \pi } ( s , g , a ) \ =$ $\begin{array} { r } { \mathbb { E } _ { \boldsymbol \pi } [ \sum _ { n = 0 } ^ { \infty } \gamma ^ { n } R _ { t + n + 1 } | s _ { t } = s , g _ { t } = g , a _ { t } = a ] } \end{array}$ . In our experiments, the UVFAs used will be in the form of feedforward neural networks. UVFAs are important for learning goal-conditioned policies because they can potentially generalize $\mathrm { Q }$ -values from certain regions of the (state, goal, action) tuple space to other regions of the tuple space, which can accelerate learning. However, UVFAs are less helpful in difficult tasks that use sparse reward functions. In these tasks when the sparse reward is rarely achieved, the UVFA will not have large regions of the (state, goal, action) tuple space with relatively high Q-values that it can generalize to other regions. For this reason, we also use Hindsight Experience Replay (Andrychowicz et al., 2017). HER is a data augmentation technique that can accelerate learning in sparse reward tasks. HER first creates copies of the [state, action, reward, next state, goal] transitions that are created in traditional off-policy RL. In the copied transitions, the original goal element is replaced with a state that was actually achieved during the episode, which guarantees that at least one of the HER transitions will contain the sparse reward. These HER transitions in turn help the UVFA learn about regions of the (state, goal, action) tuple space that should have relatively high Q-values, which the UVFA can then potentially extrapolate to the other areas of the tuple space that may be more relevant for achieving the current set of goals.
|
| 60 |
+
|
| 61 |
+
# 4 HIERARCHICAL ACTOR-CRITIC (HAC)
|
| 62 |
+
|
| 63 |
+
We introduce a HRL framework, Hierarchical Actor-Critic, that can efficiently learn the levels in a multi-level hierarchy in parallel. HAC contains two components: (i) a particular hierarchical architecture and (ii) a method for learning the levels of the hierarchy simultaneously and independently. In this section, we will more formally present our proposed system as a UMDP transformation operation.
|
| 64 |
+
|
| 65 |
+
The purpose of our framework is to efficiently learn a $k$ -level hierarchy $\Pi _ { k - 1 }$ consisting of $k$ individual policies $\pi _ { 0 } , \ldots , \pi _ { k - 1 }$ , in which $k$ is a hyperparameter chosen by the user. In order to learn $\pi _ { 0 } , \ldots , \pi _ { k - 1 }$ in parallel our framework transforms the original UMDP, $\mathcal { U } _ { o r i g i n a l } =$ $( S , \mathcal { G } , \mathcal { A } , T , R , \gamma )$ , into a set of $k$ UMDPs $\mathcal { U } _ { 0 } , \dotsc , \mathcal { U } _ { k - 1 }$ , in which $\mathcal { U } _ { i } = ( S _ { i } , \mathcal { G } _ { i } , \mathcal { A } _ { i } , T _ { i } , R _ { i } , \gamma _ { i } )$ . In the remainder of the section, we will describe these tuples at a high-level. See section 7.3 in the Appendix for the full definition of each UMDP tuple.
|
| 66 |
+
|
| 67 |
+
# 4.1 STATE, GOAL, AND ACTION SPACES
|
| 68 |
+
|
| 69 |
+
In our approach, each level of the UMDP hierarchy learns its own deterministic policy: $\pi _ { i } : S _ { i } , { \mathcal { G } } _ { i } \to$ $\mathcal { A } _ { i } , 0 \leq i \leq k - 1$ . The state space for every level $i$ is identical to the state space in the original problem: ${ { S } _ { i } } = { { S } }$ . Since each level will learn to solve a shortest path problem with respect to a goal state, we set the goal space at each level $i$ to be identical to the state space: $\mathcal { G } _ { i } = \mathcal { S }$ . Finally, the action space at all levels except the bottom-most level is identical to the goal space of the next level down (i.e. the state space): $\mathcal { A } _ { i } = \mathcal { S } , i > 0$ . These levels output subgoal states for the next lower level to achieve. The action space of the bottom-most level is identical to the set of primitive actions that are available to the agent: $A _ { 0 } = A$ .
|
| 70 |
+
|
| 71 |
+

|
| 72 |
+
Figure 2: An example episode trajectory for a simple toy example. The tic marks along the trajectory show the next states for the robot after each primitive action is executed. The pink circles show the original subgoal actions. The gray circles show the subgoal states reached in hindsight after at most $H$ actions by the low-level policy.
|
| 73 |
+
|
| 74 |
+
# 4.2 NESTED POLICIES
|
| 75 |
+
|
| 76 |
+
HAC learns hierarchies of nested policies. Nesting is critical to decomposing problems because it enables agents to learn tasks requiring long sequences of primitive actions with policies that only need to learn short sequences of actions. HAC nests policies by embedding the policy at level $i - 1 , \pi _ { i - 1 }$ , into the transition function at level $i$ , $T _ { i }$ . The transition function at each subgoal level, $T _ { i } , i > 0$ , will work as follows. The subgoal action selected $a _ { i }$ by level $i$ is assigned to be the goal of level $i - 1$ : $g _ { i - 1 } = a _ { i }$ . $\pi _ { i - 1 }$ then has at most $H$ attempts to achieve $g _ { i - 1 }$ , in which $H$ , or the maximum horizon of a subgoal action, is another parameter provided by the user. When either $\pi _ { i - 1 }$ runs out of $H$ attempts or a goal $g _ { n } , n \geq i - 1$ , is achieved, the transition function terminates and the agent’s current state is returned. Level $i$ ’s state transition function $T _ { i }$ thus depends on the full policy hierarchy below level $i$ , $\Pi _ { i - 1 }$ , due to the hierarchy’s nested architecture. Each action from $\pi _ { i - 1 }$ depends on $T _ { i - 1 }$ , which depends on $\pi _ { i - 2 }$ and so on. Consequently, we use the notation $T _ { i \left. \Pi _ { i - 1 } \right. }$ for level $i$ ’s state transition function going forward as it depends on the full lower level policy hierarchy. The full state transition function for level $i > 0$ is provided in Algorithm 3 in the Appendix. The base transition function $T _ { 0 }$ is assumed to be provided by the task: $T _ { 0 } = T$ .
|
| 77 |
+
|
| 78 |
+
# 4.3 HINDSIGHT ACTION TRANSITIONS
|
| 79 |
+
|
| 80 |
+
There are two causes of non-stationary transition functions in our framework that will need to be overcome in order to learn multiple policies in parallel. One cause of non-stationary transition functions is updates to lower level policies. That is, whenever $\pi _ { i }$ changes, the transition function at levels above $i$ , $T _ { j | \Pi _ { j - 1 } } , j > i$ , can change. The second cause is exploring lower level policies. Because all levels have a deterministic policy in our algorithm, all levels will need to explore with some behavior policy $\pi _ { i _ { b } }$ that is different than the policy it is learning $\pi _ { i }$ . For instance, in continuous domains, the agent may add Gaussian noise to its greedy policy: $\overline { { \pi } } _ { i _ { b } } = \pi _ { i } + \mathcal { N } ( 0 , \sigma ^ { 2 } )$ for some variance $\sigma ^ { 2 }$ . Yet whenever a lower level policy hierarchy uses some behavior policy $\Pi _ { i - 1 _ { b } }$ to achieve a subgoal, the transition function at level $i$ , $T _ { i | \Pi _ { i - 1 _ { b } } }$ , will also vary over time. RL methods will likely not be effective at learning subgoal policies in parallel if each subgoal policy at level $i$ is trained with respect to a transition function that uses the current lower level policy hierarchy $\Pi _ { i - 1 }$ or the behavior lower level policy hierarchy $\Pi _ { i - 1 _ { b } }$ . RL methods need the distribution of states to which actions lead to be stable in order to effectively value actions and both $\Pi _ { i - 1 }$ and $\Pi _ { i - 1 _ { b } }$ are continually changing.
|
| 81 |
+
|
| 82 |
+
In order to overcome these non-stationary issues that hinder the joint learning of policies, HAC instead trains each subgoal policy assuming a transition function that uses the optimal lower level policy hierarchy, $\Pi _ { i - 1 } ^ { * }$ . $T _ { i | \Pi _ { i - 1 } ^ { * } }$ is stationary because it is independent of the changing and exploring lower level policies, allowing an agent to learn a policy at level $i$ at the same time the agent learns policies below level $i$ .
|
| 83 |
+
|
| 84 |
+
Hindsight action transitions use a simple technique to simulate the transition function that uses the optimal policy hierarchy below level $i$ , $T _ { i | \Pi _ { i - 1 } ^ { * } }$ . In order to explain how hindsight actions transitions are implemented, we will use the example in Figure 2, in which a $k = 2$ -level robot is looking to move from its start state to the yellow flag. The robot begins in state $s _ { 0 }$ when the high level policy $\pi _ { 1 }$ outputs the subgoal state $g _ { 0 }$ for the low level to achieve. The low level policy $\pi _ { 0 }$ then executes $H = 5$ primitive actions using some behavior policy $\pi _ { 0 _ { b } }$ but is unable to achieve $g _ { 0 }$ , instead landing in $s _ { 1 }$ . After executing $H = 5$ primitive actions, the first action by $\pi _ { 1 }$ is complete and a hindsight action transition can be created.
|
| 85 |
+
|
| 86 |
+
Hindsight action transitions have two key components. The first is that the subgoal state achieved in hindsight is used as the action component in the transition, not the originally proposed subgoal state. Thus, the hindsight action transition so far will look like: [initial state $\mathbf { \xi } = \mathbf { \xi } _ { S 0 }$ , $a c t i o n = s _ { 1 }$ , reward $=$ TBD, next state $\mathbf { \delta } = \mathbf { \delta } s _ { 1 }$ , $g o a l =$ yellow flag, discount rate $=$ gamma]. The second key component of the hindsight action transition is the reward function used at all subgoal levels. The first requirement for this reward function is that it should incentivize short paths to the goal because shorter paths can be learned more quickly. The second requirement for the reward function is that it should be independent of the path taken at lower levels. The purpose of hindsight action transitions is to simulate a transition function that uses the optimal lower level policy hierarchy $\Pi _ { i - 1 } ^ { * }$ . Yet without a model of the environment, the exact path $\Pi _ { i - 1 } ^ { * }$ would have taken is unknown. Thus, the reward should only be a function of the state reached in hindsight and the goal state. For each subgoal level, we use the reward function in which a reward of $^ { - 1 }$ is granted if the goal has not been achieved and a reward of 0 otherwise. Thus, in the example above, the high level of the robot would receive the hindsight action transition [initial state $\mathbf { \delta } = \mathbf { \nabla } _ { S 0 }$ , action $\mathbf { \delta } = \mathbf { \delta } s _ { 1 }$ , reward $= - l$ , next state $\mathbf { \delta } = \mathbf { \delta } s _ { 1 }$ , $g o a l =$ yellow flag, discount $\cdot a t e = g a m m a J$ , which is the same transition that would have been created had the high level originally proposed state $s _ { 1 }$ as a subgoal and the transition function used the optimal lower level policy hierarchy to achieve it. Using the same process, the hindsight action transition created for the second action by $\pi _ { 1 }$ would be [initial state $\mathbf { \mu } = s _ { 1 }$ , $a c t i o n = s _ { 2 }$ , reward $= - l$ , next state $\mathbf { \delta } = s _ { 2 }$ , goal $=$ yellow flag, discount rate $= \gamma J$ .
|
| 87 |
+
|
| 88 |
+
Although none of the hindsight actions produced in the episode contained the sparse reward of 0, they are still helpful for the high level of the agent. Through these transitions, the high level discovers on its own possible subgoals that fit the time scale of $H$ primitive actions per high level action, which is the time scale that it should be learning. More importantly, these transitions are robust to a changing and exploring lower level policy $\pi _ { 0 }$ because they assume a transition function that uses $\pi _ { 0 } ^ { * }$ and not the current low level policy $\pi _ { 0 }$ or low level behavior policy $\pi _ { 0 _ { b } }$ .
|
| 89 |
+
|
| 90 |
+
# 4.4 HINDSIGHT GOAL TRANSITIONS
|
| 91 |
+
|
| 92 |
+
We supplement all levels of the hierarchy with an additional set of transitions, which we refer to as hindsight goal transitions, that enable each level to learn more effectively in sparse reward tasks by extending the idea of Hindsight Experience Replay (Andrychowicz et al., 2017) to the hierarchical setting. As the toy robot example illustrates, it can be difficult for any level in our framework to receive the sparse reward. A level needs to randomly reach its goal state in order to obtain the sparse reward. Hindsight goal transitions use another simple use of hindsight to guarantee that after every sequence of actions by each level in the hierarchy, that level receives a transition containing the sparse reward.
|
| 93 |
+
|
| 94 |
+
Hindsight goal transitions would be created for each level in the toy robot example as follows. Beginning with the low level, after each of the at most $H = 5$ primitive actions executed by the low level policy $\pi _ { 0 }$ per high level action, the low level will create two transitions. The first transition is the typical transition non-hierarchical agents create evaluating the primitive action that was taken given the goal state. For instance, assuming the same shortest path reward function described earlier, after the first primitive action in the episode, the low level will receive the transition [initial state $=$ $s _ { 0 }$ , action $=$ joint torques, reward $= - l$ , next state $=$ first tick mark, $g o a l = g _ { 0 }$ , discount rate $= \gamma J$ . The second transition is a copy of the first transition, but the goal state and reward components are temporarily erased: [initial state $\mathbf { \xi } = \mathbf { \xi } _ { S 0 }$ , action $=$ joint torques, reward $= T B D$ , next state $= \mathit { f i r s t } \mathit { t i c k }$ mark, $g o a l = T B D$ , discount rate $= \gamma J$ . After the sequence of at most $H = 5$ primitive actions, the hindsight goal transitions will be created by filling in the TBD components in the extra transitions that were created. First, one of the “next state” elements in one of the transitions will be selected as the new goal state replacing the TBD component in each transition. Second, the reward will be updated in each transition to reflect the new goal state. For instance, after the first set of $H = 5$ primitive actions, the state $s _ { 1 }$ may be chosen as the hindsight goal. The hindsight goal transition created by the fifth primitive action that achieved the hindsight goal would then be [initial state $=$
|
| 95 |
+
|
| 96 |
+
4th tick mark, action $=$ joint torques, reward $= { \cal O }$ , next state $\mathbf { \delta } = \mathbf { \delta } s _ { 1 }$ , $g o a l = s _ { 1 }$ , discount rate $= O J$ . Moreover, hindsight goal transitions would be created in the same way for the high level of the toy robot, except that the hindsight goal transitions would be made from copies of the hindsight action transitions. Assuming the last state reached $s _ { 5 }$ is used as the hindsight goal, the first hindsight goal transition for the high level would be [initial state $\mathbf { \xi } = \mathbf { \xi } _ { S 0 }$ , $a c t i o n = s _ { 1 }$ , reward $= - l$ , next state $\mathbf { \delta } = \mathbf { \nabla } _ { S 1 }$ , $g o a l = s _ { 5 }$ , discount rate $= \gamma J$ . The last hindsight goal transition for the high level would be [initial $s t a t e = s _ { 4 }$ , $a c t i o n = s _ { 5 }$ , reward $= { \cal O } _ { ; }$ , next state $= s _ { 5 }$ , $g o a l = s _ { 5 }$ , discount rate $= O J$ .
|
| 97 |
+
|
| 98 |
+
Hindsight goal transitions should significantly help each level learn an effective goal-conditioned policy because it guarantees that after every sequence of actions, at least one transition will be created that contains the sparse reward (in our case a reward and discount rate of 0). These transitions containing the sparse reward will in turn incentivize the UVFA critic function to assign relatively high Q-values to the (state, action, goal) tuples described by these transitions. The UVFA can then potentially generalize these high $\mathrm { Q }$ -values to the other actions that could help the level solve its tasks.
|
| 99 |
+
|
| 100 |
+
# 4.5 SUBGOAL TESTING TRANSITIONS
|
| 101 |
+
|
| 102 |
+
Hindsight action and hindsight goal transitions give agents the potential to learn multiple policies in parallel with only sparse rewards, but some key issues remain. The most serious flaw is that the strategy only enables a level to learn about a restricted set of subgoal states. A level $i$ will only execute in hindsight subgoal actions that can be achieved with at most $H$ actions from level $i - 1$ . For instance, when the toy robot is in state $s _ { 2 }$ , it will not be able to achieve a subgoal state on the yellow flag in $H = 5$ primitive actions. As a result, level $i$ in a hierarchical agent will only learn Q-values for subgoal actions that are relatively close to its current state and will ignore the Q-values for all subgoal actions that require more than $H$ actions. This is problematic because the action space for all subgoal levels should be the full state space in order for the framework to be end-toend. If the action space is the full state space and the Q-function is ignoring large regions of the action space, significant problems will occur if the learned Q-function assigns higher Q-values to distant subgoals that the agent is ignoring than to feasible subgoals that can be achieved with at most $H$ actions from the level below. $\pi _ { i }$ may adjust its policy to output these distant subgoals that have relatively high Q-values. Yet the lower level policy hierarchy $\Pi _ { i - 1 }$ has not been trained to achieve distant subgoals, which may cause the agent to act erratically.
|
| 103 |
+
|
| 104 |
+
A second, less significant shortcoming is that hindsight action and goal transitions do not incentivize a subgoal level to propose paths to the goal state that the lower levels can actually execute with its current policy hierarchy. Hindsight action and goal transitions purposefully incentivize a subgoal level to ignore the current capabilities of lower level policies and propose the shortest path of subgoals that has been found. But this strategy can be suboptimal because it may cause a subgoal level to prefer a path of subgoals that cannot yet be achieved by the lower level policy hierarchy over subgoal paths that both lead to the goal state and can be achieved by the lower level policy hierarchy.
|
| 105 |
+
|
| 106 |
+
Our framework addresses the above issues by supplying agents with a third set of transitions, which we will refer to as subgoal testing transitions. Subgoal testing transitions essentially play the opposite role of hindsight action transitions. While hindsight actions transitions help a subgoal level learn the value of a subgoal state when lower level policies are optimal, subgoal testing transitions enable a level to understand whether a subgoal state can be achieved by the current set of lower level policies.
|
| 107 |
+
|
| 108 |
+
Subgoal testing transitions are implemented as follows. After level $i$ proposes a subgoal $a _ { i }$ , a certain fraction of the time $\lambda$ , the lower level behavior policy hierarchy, $\Pi _ { i - 1 _ { b } }$ , used to achieve subgoal $a _ { i }$ must be the current lower level policy hierarchy $\Pi _ { i - 1 }$ . That is, instead of a level being able to explore with a noisy policy when trying to achieve its goal, the current lower level policy hierarchy must be followed exactly. Then, if subgoal $a _ { i }$ is not achieved in at most $H$ actions by level $i - 1$ , level $i$ will be penalized with a low reward, penalty. In our experiments, we set $p e n a l t y = - H$ , or the negative of the maximum horizon of a subgoal. In addition, we use a discount rate of 0 in these transitions to avoid non-stationary transition function issues.
|
| 109 |
+
|
| 110 |
+
Using the robot example in Figure 2, after the robot proposes the ambitious subgoal $g _ { 2 }$ when in state $s _ { 2 }$ , the robot may randomly decide to test that subgoal. The low level policy then has at most $H = 5$ primitive actions to achieve $g _ { 2 }$ . These primitive actions must follow $\pi _ { 0 }$ exactly. Because the robot misses its subgoal, it would be penalized with following transition [initial state $= s _ { 2 }$ , $a c t i o n = g _ { 2 }$ reward $= - 5$ , next state $= s _ { 3 }$ , goal $=$ Yellow Flag, discount rate $= O J$ .
|
| 111 |
+
|
| 112 |
+
Subgoal testing transitions have three different effects on Q-values depending on the (state, goal, subgoal action) tuple that is under consideration. For this analysis, we use the notation $| s - a |$ to refer to the number of actions required by an optimal version of the policy at the level below, $\pi _ { i - 1 } ^ { * }$ , to move the agent from state $s$ to subgoal state $a$ .
|
| 113 |
+
|
| 114 |
+
1. $| s - a | > H$ : For those (state, goal, subgoal action) tuples in which the subgoal action could never be completed with $H$ actions by the optimal policy at the level below, the critic function will be incentivized to learn Q-values of $- H$ because the only transitions a subgoal level will receive for these tuples is the penalty transition. Thus, subgoal testing transitions can overcome the major flaw of training only with hindsight action and goal transitions because now the more distant subgoal actions are no longer ignored.
|
| 115 |
+
|
| 116 |
+
2. $| s - a | \le H$ and Achievable by $\Pi _ { i - 1 }$ : For those (state, goal, subgoal action) tuples in which the subgoal action can be achieved by the current lower level policy hierarchy $\Pi _ { i - 1 }$ , subgoal testing should have little to no effect. Critic functions will be incentivized to learn Q-values close to the Q-value targets prescribed by the hindsight action and hindsight goal transitions.
|
| 117 |
+
|
| 118 |
+
3. $| s - a | \le H$ and Not Achievable by $\Pi _ { i - 1 }$ : The effects of subgoal testing are a bit more subtle for those (state, goal, subgoal action) tuples in which the subgoal action can be achieved with at most $H$ actions by an optimal version of the policy below, $\pi _ { i - 1 } ^ { * }$ , but cannot yet be achieved with the current policy $\pi _ { i - 1 }$ . For these tuples, critic functions are incentivized to assign a Q-value that is a weighted average of the target Q-values prescribed by the hindsight action/goal transitions and the penalty value of $- H$ prescribed by the subgoal testing transitions. However, it is important to note that for any given tuple there are likely significantly fewer subgoal testing transitions than the total number of hindsight action and goal transitions. Hindsight action transitions are created after every subgoal action, even during subgoal testing, whereas subgoal testing transitions are not created after each subgoal action. Thus, the critic function is likely to assign Q-values closer to the target value prescribed by the hindsight action and hindsight goal transitions than the penalty value of $- H$ prescribed by the subgoal testing transition.
|
| 119 |
+
|
| 120 |
+
To summarize, subgoal testing transitions can overcome the issues caused by only training with hindsight goal and hindsight action transitions while still enabling all policies of the hierarchy to be learned in parallel. With subgoal testing transitions, critic functions no longer ignore the Q-values of infeasible subgoals. In addition, each subgoal level can still learn simultaneously with lower levels because Q-values are predominately decided by hindsight action and goal transitions, but each level will have a preference for paths of subgoals that can be achieved by the current lower level policy hierarchy.
|
| 121 |
+
|
| 122 |
+
# 4.6 ALGORITHMS
|
| 123 |
+
|
| 124 |
+
Algorithm 1 in the Appendix shows the full procedure for Hierarchical Actor-Critic (HAC). Section 7.6 in the Appendix provides additional HAC implementation details. We also provide the discrete version of our algorithm, Hierarchical $Q$ -Learning (HierQ), in Algorithm 2 in the Appendix.
|
| 125 |
+
|
| 126 |
+
# 5 EXPERIMENTS
|
| 127 |
+
|
| 128 |
+
We evaluated our framework in several discrete state and action and continuous state and action tasks. The discrete tasks consisted of grid world environments. The continuous tasks consisted of the following simulated robotics environments developed in MuJoCo (Todorov et al., 2012): (i) inverted pendulum, (ii) UR5 reacher, (iii) ant reacher, and (iv) ant four rooms. A video showing our experiments is available at https://www.youtube.com/watch?v $=$ DYcVTveeNK0. Figure 3 shows some episode sequences from the grid world and inverted pendulum environments for a 2-level agent.
|
| 129 |
+
|
| 130 |
+

|
| 131 |
+
Figure 3: Episode sequences from the four rooms (top) and inverted pendulum tasks (bottom). In the four rooms task, the $k { = } 2$ level agent is the blue square; the goal is the yellow square; the learned subgoal is the purple square. In the inverted pendulum task, the goal is the yellow sphere and the subgoal is the purple sphere.
|
| 132 |
+
|
| 133 |
+

|
| 134 |
+
Figure 4: Average success rates for 3-level (red), 2-level agent (blue), and flat (green) agents in each task. The error bars show 1 standard deviation.
|
| 135 |
+
|
| 136 |
+
# 5.1 RESULTS
|
| 137 |
+
|
| 138 |
+
We compared the performance of agents using policy hierarchies with 1 (i.e., flat), 2, and 3 levels on each task. The flat agents used Q-learning (Watkins & Dayan, 1992) with HER in the discrete tasks and DDPG (Lillicrap et al., 2015) with HER in the continuous tasks.
|
| 139 |
+
|
| 140 |
+
Our approach significantly outperformed the flat agent in all tasks. Figure 4 shows the average episode success rate for each type of agent in each task. The discrete tasks average data from 50 trials. The continuous tasks average data from at least 7 trials.
|
| 141 |
+
|
| 142 |
+
In addition, our empirical results show that our framework can benefit from additional levels of hierarchy likely because our framework can learn multiple levels of policies in parallel. In all tasks, the 3-level agent outperformed the 2-level agent, and the 2-level agent outperformed the flat agent.
|
| 143 |
+
|
| 144 |
+

|
| 145 |
+
Figure 5: Figure compares the performance of HAC (2 Levels) and HIRO. The charts show the average success rate and 1 standard deviation.
|
| 146 |
+
|
| 147 |
+
# 5.1.1 BASELINE COMPARISON
|
| 148 |
+
|
| 149 |
+
We also directly compared our approach HAC to another HRL technique, HIRO (Nachum et al., 2018), which outperforms the other leading HRL techniques that can work in continuous state and action spaces: FeUdal Networks (Vezhnevets et al., 2017) and Option-Critic (Bacon et al., 2017). HIRO enables agents to learn a 2-level hierarchical policy that like our approach can be trained off-policy and uses the state space to decompose a task. Two of the key differences between the algorithms are that (i) HIRO does not use Hindsight Experience Replay at either of the 2 levels and (ii) HIRO uses a different approach for handling the non-stationary transition functions. Instead of replacing the original proposed action with the hindsight action as in our approach, HIRO uses a subgoal action from a set of candidates that when provided to the current level 0 policy would most likely cause the sequence of (state, action) tuples that originally occurred at level 0 when the level 0 policy was trying to achieve its original subgoal. In other words, HIRO values subgoal actions with respect to a transition function that essentially uses the current lower level policy hierarchy, not the optimal lower level policy hierarchy as in our approach. Consequently, HIRO may need to wait until the lower level policy converges before the higher level can learn a meaningful policy.
|
| 150 |
+
|
| 151 |
+
We compared the 2-level version of HAC to HIRO on the inverted pendulum, UR5 reacher, and ant reacher tasks. In all experiments, the 2-level version of HAC significantly outperformed HIRO. The results are shown in Figure 5.
|
| 152 |
+
|
| 153 |
+
# 5.1.2 SUBGOAL TESTING ABLATION STUDIES
|
| 154 |
+
|
| 155 |
+
We also implemented some ablation studies examining our subgoal testing procedure. We compared our method to (i) no subgoal testing and (ii) always penalizing missed subgoals even when the lower levels use noisy policies when attempting to achieve a subgoal. Our implementation significantly outperformed both baselines. The results and analysis of the ablation studies are given in section 6 of the Appendix.
|
| 156 |
+
|
| 157 |
+
# 6 CONCLUSION
|
| 158 |
+
|
| 159 |
+
Hierarchy has the potential to accelerate learning but in order to realize this potential, hierarchical agents need to be able to learn their multiple levels of policies in parallel. We present a new HRL framework that can efficiently learn multiple levels of policies simultaneously. HAC can overcome the instability issues that arise when agents try to learn to make decisions at multiple time scales because the framework trains each level of the hierarchy as if the lower levels are already optimal. Our results in several discrete and continuous domains, which include the first 3-level agents in tasks with continuous state and action spaces, confirm that HAC can significantly improve sample efficiency.
|
| 160 |
+
|
| 161 |
+
# ACKNOWLEDGEMENTS
|
| 162 |
+
|
| 163 |
+
This work has been supported in part by the National Science Foundation through IIS-1724237, IIS-1427081, IIS-1724191, and IIS-1724257, NASA through NNX16AC48A and NNX13AQ85G,
|
| 164 |
+
|
| 165 |
+
ONR through N000141410047, Amazon through an ARA to Platt, Google through a FRA to Platt, and DARPA.
|
| 166 |
+
|
| 167 |
+
REFERENCES
|
| 168 |
+
M. Andrychowicz, F. Wolski, A. Ray, J. Schneider, R. Fong, P. Welinder, B. McGrew, J. Tobin, P. Abbeel, and W. Zaremba. Hindsight experience replay. In Advances in Neural Information Processing Systems 30, pp. 5048–5058. 2017.
|
| 169 |
+
P-L Bacon, J. Harb, and D. Precup. The option-critic architecture. In Proceedings of the Thirty-First AAAI Conference on Artificial Intelligence, pp. 1726–1734, 2017.
|
| 170 |
+
Bram Bakker and Jurgen Schmidhuber. Hierarchical reinforcement learning with subpolicies spe- ¨ cializing for learned subgoals. In Neural Networks and Computational Intelligence, pp. 125–130, 2004.
|
| 171 |
+
T.G. Dietterich. Hierarchical reinforcement learning with the MAXQ value function decomposition. Journal of Artificial Intelligence Research, 13:227–303, 2000.
|
| 172 |
+
G.D. Konidaris and A.G. Barto. Skill discovery in continuous reinforcement learning domains using skill chaining. In Advances in Neural Information Processing Systems 22, pp. 1015–1023, 2009.
|
| 173 |
+
T.D. Kulkarni, K. Narasimhan, A. Saeedi, and J. Tenenbaum. Hierarchical deep reinforcement learning: Integrating temporal abstraction and intrinsic motivation. In Advances in Neural Information Processing Systems 29, pp. 3675–3683. 2016.
|
| 174 |
+
T.P. Lillicrap, J.J. Hunt, A. Pritzel, N. Heess, T. Erez, Y. Tassa, D. Silver, and D. Wierstra. Continuous control with deep reinforcement learning. CoRR, abs/1509.02971, 2015. URL http://arxiv.org/abs/1509.02971.
|
| 175 |
+
A. McGovern and A.G. Barto. Automatic discovery of subgoals in reinforcement learning using diverse density. In Proceedings of the Eighteenth International Conference on Machine Learning, pp. 361–368, 2001.
|
| 176 |
+
I. Menache, S. Mannor, and N. Shimkin. Q-cut—dynamic discovery of sub-goals in reinforcement learning. In Proceedings of the Thirteenth European Conference on Machine Learning, pp. 295– 306, 2002.
|
| 177 |
+
O. Nachum, S. Gu, H. Lee, and S. Levine. Data-efficient hierarchical reinforcement learning. In Advances in Neural Information Processing Systems 31, pp. 3303–3313. 2018.
|
| 178 |
+
T. Schaul, D. Horgan, K. Gregor, and D. Silver. Universal value function approximators. In Proceedings of the 32nd International Conference on Machine Learning, volume 37, pp. 1312–1320, 2015.
|
| 179 |
+
Jurgen Schmidhuber. Learning to generate sub-goals for action sequences. ¨ Artificial Neural Networks, pp. 967–972, 1991.
|
| 180 |
+
O. S¸ ims¸ek, A.P. Wolfe, and A.G. Barto. Identifying useful subgoals in reinforcement learning by ¨ local graph partitioning. In Proceedings of the Twenty-Second International Conference on Machine Learning, pp. 816– 823, 2005.
|
| 181 |
+
R. S. Sutton, D. Precup, and S. Singh. Between MDPs and semi-MDPs: a framework for temporal abstraction in reinforcement learning. Artificial Intelligence Journal, 112:181–211, 1999.
|
| 182 |
+
E. Todorov, T. Erez, and Y. Tassa. MuJoCo: A physics engine for model-based control. Proceedings of the 2012 IEEE/RSJ International Conference on Intelligent Robots and Systems, pp. 5026– 5033, 2012.
|
| 183 |
+
A. Vezhnevets, S. Osindero, T. Schaul, N. Heess, M. Jaderberg, D. Silver, and K. Kavukcuoglu. FeUdal networks for hierarchical reinforcement learning. In Proceedings of the 34th International Conference on Machine Learning, pp. 3540–3549, 2017.
|
| 184 |
+
|
| 185 |
+
Christopher J. C. H. Watkins and Peter Dayan. Q-learning. In Machine Learning, pp. 279–292, 1992.
|
| 186 |
+
|
| 187 |
+
Marco Wiering and Jurgen Schmidhuber. HQ-learning. ¨ Adaptive Behaviour, 6(2):219–246, 1997.
|
| 188 |
+
|
| 189 |
+
# 7 APPENDIX
|
| 190 |
+
|
| 191 |
+
7.1 HIERARCHICAL ACTOR-CRITIC (HAC) ALGORITHM
|
| 192 |
+
|
| 193 |
+
# Algorithm 1 Hierarchical Actor-Critic (HAC)
|
| 194 |
+
|
| 195 |
+
#
|
| 196 |
+
|
| 197 |
+
• Key agent parameters: number of levels in hierarchy $k$ , maximum subgoal horizon $H$ , and subgoal testing frequency $\lambda$ .
|
| 198 |
+
|
| 199 |
+
#
|
| 200 |
+
|
| 201 |
+
• $k$ trained actor and critic functions $\pi _ { 0 } , . . . , \pi _ { k - 1 } , Q _ { 0 } , . . . , Q _ { k - 1 }$
|
| 202 |
+
|
| 203 |
+
for $M$ episodes do $\triangleright$ Train for M episodes $s \gets S _ { i n i t }$ , $g G _ { k - 1 }$ $\triangleright$ Sample initial state and task goal $t r a i n - l e v e l ( k - 1 , s , g )$ $\triangleright$ Begin training Update all actor and critic networks
|
| 204 |
+
end for
|
| 205 |
+
function TRAIN-LEVEL $( i : : l e v e l , s : : s t a t e , g : : g o a l )$ $s _ { i } \gets s$ , $g _ { i } g$ . Set current state and goal for level $i$ for $H$ attempts or until $g _ { n }$ , $i \leq n < k$ achieved do $a _ { i } \gets \pi _ { i } \bar { ( } s _ { i } , g _ { i } \big ) + n \bar { o } i s e$ (if not subgoal testing) $\triangleright$ Sample (noisy) action from policy if $i > 0$ then Determine whether to test subgoal $a _ { i }$ $s _ { i } ^ { ' } t r a i n - l e v e l ( i - 1 , s _ { i } , \bar { a } _ { i } )$ . Train level $i - 1$ using subgoal $a _ { i }$ else Execute primitive action $a _ { 0 }$ and observe next state $s _ { 0 }$ end if . Create replay transitions if $i > 0$ and $a _ { i }$ missed then if $a _ { i }$ was tested then $\triangleright$ Penalize subgoal $a _ { i }$ $R e p l a y . B u f f e r _ { i } \gets [ s = s _ { i } , a = a _ { i } , r = P e n a l t y , s ^ { ' } = s _ { i } ^ { ' } , g = g _ { i } , \gamma = 0 ]$ end if $a _ { i } s _ { i }$ $\triangleright$ Replace original action with action executed in hindsight end if $\triangleright$ Evaluate executed action on current goal and hindsight goals $\begin{array} { r } { R e p l a y \_ B u f f e r _ { i } \gets [ s = s _ { i } , a = a _ { i } , r \in \{ - 1 , 0 \} , s ^ { ' } = s _ { i } ^ { ' } , g = g _ { i } , \gamma \in \{ \gamma , 0 \} ] } \\ { H E R \_ S t o r a g e _ { i } \gets [ s = s _ { i } , a = a _ { i } , r = T B D , s ^ { ' } = s _ { i } ^ { ' } , g = T B D , \gamma = T B D ] } \end{array}$ $s _ { i } \gets s _ { i } ^ { ' }$ end for Replay Bufferi Perform HER using HER Storagei transitions return s i . Output current state
|
| 206 |
+
end function
|
| 207 |
+
|
| 208 |
+
# 7.2 HIERARCHICAL Q-LEARNING (HIERQ) ALGORITHM
|
| 209 |
+
|
| 210 |
+
HierQ is the version of our algorithm designed for domains with discrete state and action spaces. Note that HierQ does not use subgoal testing. Instead, the algorithm uses pessimistic Q-value initializations to prevent agents from learning to propose subgoal states that are too distant.
|
| 211 |
+
|
| 212 |
+
# Algorithm 2 Hierarchical Q-Learning (HierQ)
|
| 213 |
+
|
| 214 |
+
#
|
| 215 |
+
|
| 216 |
+
• Key agent parameters: number of levels in hierarchy $k > 1$ , maximum subgoal horizon $H$ , learning rate $\alpha$ Output: • $k$ trained Q-tables $Q _ { 0 } ( s , g , a ) , . . . , Q _ { k - 1 } ( s , g , a )$ Use pessimistic $\mathrm { Q }$ -value initialization: $Q _ { i } ( s , g , a ) \leq - H ^ { i + 1 }$ for $M$ episodes do $\triangleright$ Train for M episodes sk−1 ← Sinit, $g _ { k - 1 } G _ { k - 1 }$ $\triangleright$ Sample initial state and task goal . Initialize previous state arrays for levels $i , 0 < i < k$ $P r e v _ { - } S t a t e s _ { i } \gets A r r a y [ H ^ { i } ]$ $\triangleright$ Length of level $i$ array is $H ^ { i }$ while $g _ { k - 1 }$ not achieved do $\triangleright$ Begin Training $a _ { k - 1 } \pi _ { k - 1 _ { b } } ( s _ { k - 1 } , g _ { k - 1 } )$ $\triangleright$ Sample action using $\epsilon$ -greedy policy $\pi _ { k - 1 _ { b } }$ $\begin{array} { r l } & { \mathbf { \Phi } ^ { \mathrm { u } _ { K - 1 } } \cdot \mathbf { \Phi } ^ { \mathrm { \prime } _ { \{ ^ { * } K - 1 _ { b } \{ ^ { \circ } K - 1 \} , \forall \kappa - 1 / } } } \\ & { s _ { k - 1 } \gets t r a i n - l e v e l ( k - 2 , s _ { k - 1 } , a _ { k - 1 } ) } \end{array}$ $\triangleright$ Train next level end while end for function TRAIN-LEVEL $( i : : l e v e l , s : : s t a t e , g : : g o a l )$ $s _ { i } \gets s$ , $g _ { i } g$ . Set current state and goal for level $i$ for $H$ attempts or until $g _ { n }$ $, i \leq n < k$ achieved do $a _ { i } \pi _ { i _ { b } } ( s _ { i } , g _ { i } )$ $\triangleright$ Sample action using $\epsilon$ -greedy policy $\pi _ { i _ { b } }$ if $i > 0$ then $s _ { i } ^ { ' } t r a i n - l e v e l ( i - 1 , s _ { i } , a _ { i } )$ . Train level $i - 1$ using subgoal $a _ { i }$ else Execute primitive action $a _ { 0 }$ and observe next state $^ { \prime }$ $s _ { 0 }$ $\triangleright$ Update $Q _ { 0 } ( s , g , a )$ table for all possible subgoal states for each state $s _ { g o a l } \in S$ do $Q _ { 0 } ( s _ { 0 } , s _ { g o a l } , a _ { 0 } ) \xleftarrow { } { } ( 1 - \alpha ) \cdot Q _ { 0 } ( s _ { 0 } , s _ { g o a l } , a _ { 0 } ) + \alpha \cdot [ R _ { 0 } + \gamma m a x _ { a } Q _ { 0 } ( s _ { 0 } ^ { \prime } , s _ { g o a l } , a _ { 0 } ) ]$ end for $\triangleright$ Add state $s _ { 0 }$ to all previous state arrays $P r e v _ { - } S t a t e s _ { i } s _ { 0 } , 0 < i < k$ . Update $Q _ { i } ( s , g , a ) , 0 < i < k$ , tables for each level $i , 0 < i < k$ do for each state $s \in P r e v \_ S t a t e s _ { i }$ do for each goal $s _ { g o a l } \in S$ do $Q _ { i } ( s , s _ { g o a l } , s _ { 0 } ^ { \prime } ) ~ ~ ( 1 ~ - ~ \alpha ) ~ \cdot ~ Q _ { i } ( s , s _ { g o a l } , s _ { 0 } ^ { \prime } ) ~ + ~ \alpha ~ \cdot ~ [ R _ { i } ~ + ~ \alpha ] ~$ γmaxaQi(s00, sgoal, a) end for end for end for end if $s _ { i } \gets s _ { i } ^ { ' }$ end for return s i . Output current state end function
|
| 217 |
+
|
| 218 |
+
# 7.3 UMDP TUPLE DEFINITIONS
|
| 219 |
+
|
| 220 |
+
We now formally define the UMDPs tuples for all levels.
|
| 221 |
+
|
| 222 |
+
$\mathcal { U } _ { 0 }$ : This is the lowest level of the hierarchy. It has the same state set, action set, and state transition function as $\mathcal { U } _ { o r i g i n a l }$ : ${ \cal S } _ { 0 } = { \cal S } , { \cal A } _ { 0 } = { \cal A }$ , and $T _ { 0 } ~ = ~ T$ . The goal states for which $\mathcal { U } _ { 0 }$ will be responsible for learning will be dictated by the UMDP one level higher, $\mathcal { U } _ { 1 }$ . However, given that every state is potentially a goal, the goal space is defined to be the state space: $\mathcal { G } _ { 0 } ~ = ~ \mathcal { S }$ . The framework is flexible as to the reward function used at level 0, but we will use the shortest path reward function, in which a reward of 0 is granted if the next state, $s ^ { \prime }$ , maps to the goal and $^ { - 1 }$ otherwise: $R _ { 0 } ( s ^ { \prime } , g ) = 0 , \forall s ^ { \prime } : s ^ { \prime } \in g$ and $R _ { 0 } ( s ^ { \prime } , g ) = - 1 , \forall s ^ { \prime } : s ^ { \prime } \notin g$ . In addition, the discount rate is set to 0 if the goal has been achieved, but remains $\gamma$ otherwise: $\bar { \gamma } _ { 0 } ( s ^ { \prime } , g ) = 0 , \forall s ^ { \prime } : s ^ { \prime } \in g$ , $\gamma _ { 0 } ( s ^ { \prime } , g ) \ = \ \gamma , \forall s ^ { \prime } \ : \ s ^ { \prime } \ \notin \ g$ . $\mathcal { U } _ { \mathrm { 0 } }$ $\pi _ { 0 } : { \mathcal { S } } _ { 0 } , { \mathcal { G } } _ { 0 } \to { \mathcal { A } } _ { 0 }$ thatnitial $\begin{array} { r } { { v } _ { \pi _ { 0 } } ( s , g ) \underline { { = } } \mathbb { E } _ { \pi _ { 0 } } [ \sum _ { n = 0 } ^ { \infty } \gamma _ { 0 } ^ { n } R _ { 0 _ { t + n + 1 } } | \bar { s } _ { 0 _ { t } } = s , g _ { 0 _ { t } } = g ] } \end{array}$ state and goal combinations that the policy $\pi _ { 1 }$ from $\mathcal { U } _ { 1 }$ requires.
|
| 223 |
+
|
| 224 |
+
$\mathcal { U } _ { i } , 1 \leq i < k$ : These UMDPs represent the remainder of the hierarchy. The state space is the same as the state space in $U _ { o r i g i n a l }$ : ${ { S } _ { i } } = { { S } }$ . For all levels except for the top level, the set of goals is dictated by the level above. These goals can potentially be any state: $G _ { i } = \bar { \mathcal { S } } , 1 \leq i < k { - } 1$ . For the top level, the goal set is provided by the task: $\mathcal { G } _ { k - 1 } = \mathcal { G }$ . The action space is the state space as these policies will output subgoal states for the next level to achieve: $A _ { i } = S$ . The state transition function consists of two transition functions: $T _ { i | \hat { \Pi } _ { i - 1 } } ( s , a ) = \{ \mathrm { ( i ) } \ T _ { i | \Pi _ { i - 1 } ^ { * } } ( s , \bar { a } ) , \bar { a } = T _ { i | \Pi _ { i - 1 } _ { b } } ( s , \pi _ { i _ { b } } ( s , g _ { i } ) )$ , (ii) $T _ { i \left| \Pi _ { i - 1 } \right. } ( s , a ) \}$ . The first transition function will be used to generate hindsight transitions. Note that the action $\bar { a }$ passed to the first transition function must be generated by some hierarchical behavior policy $\Pi _ { i _ { b } }$ . The second transition function will be used for subgoal testing and will follow the current lower level policy hierarchy exactly. The reward function is $\bar { R } _ { i } ( a , s ^ { \prime } , g ) = p e n a l t y , \forall s ^ { \prime } : s ^ { \prime } \notin a ,$ $R _ { i } ( a , s ^ { \prime } , g ) \bar { = } - 1 , \forall s ^ { \prime } : ( \bar { s ^ { \prime } } \in a ) \land ( s ^ { \prime } \notin g )$ , and $R _ { i } ( a , s ^ { \prime } , g ) = 0 , \forall s ^ { \prime } : ( s ^ { \prime } \in a ) \land ( s ^ { \prime } \in g ) .$ . The penalty reward is only issued during subgoal testing. $\gamma _ { i }$ is set to 0 if a subgoal is tested and missed or if an action achieves the goal, but is otherwise $\gamma$ from $\mathcal { U } _ { o r i g i n a l } : \gamma _ { i } ( a , s ^ { \prime } , g ) = 0 , \forall s ^ { \prime } : ( s ^ { \prime } \notin$ $a ) \vee ( s ^ { \prime } \in g )$ . The objective in each $U _ { i }$ is to learn a policy $\pi _ { i } : S _ { i } , { \mathcal { G } } _ { i } \to { \mathcal { A } } _ { i }$ that maximizes the value function $\begin{array} { r } { v _ { \pi _ { i } | \hat { \Pi } _ { i - 1 } } ( s , g ) = \mathbb { E } _ { \pi _ { i } | \hat { \Pi } _ { i - 1 } } \bigl [ \sum _ { n = 0 } ^ { \infty } \gamma ^ { n } R _ { i _ { t + n + 1 } } | s _ { i _ { t } } = s , g _ { i _ { t } } = g \bigr ] } \end{array}$ .
|
| 225 |
+
|
| 226 |
+
# 7.4 UMDP STATE TRANSITION FUNCTION
|
| 227 |
+
|
| 228 |
+
<table><tr><td>Algorithm 3 UMDP Ui Transition Function: Ti|IIi_1 (state, action)</td><td></td></tr><tr><td>Input: state s,action a,</td><td></td></tr><tr><td>Output: next state</td><td></td></tr><tr><td>return Execute - H - Actions(s,a,i -1,H)</td><td>Execute ≤ H actions using policy πi-1</td></tr><tr><td colspan="2">function ExECUTE-H-AcTiONs(s : state,a :: action,i :: level,itr :: iteration) s' =Ti|IIi-1(s,πi(s,a)) Execute 1 action using policy πi Decrement iteration counter</td></tr><tr><td colspan="2">itr -= 1</td></tr><tr><td colspan="2">if itr == 0 or s' ∈g,∀g∈{gi,.,gk-1} then</td></tr><tr><td colspan="2">return s' >Return next state if out of iterations or goal achieved else Execute another action from Ti</td></tr><tr><td colspan="2">return Execute- H - Actions(s',a,i,itr) end if</td></tr></table>
|
| 229 |
+
|
| 230 |
+
# 7.5 SUBGOAL TESTING ABLATION STUDIES
|
| 231 |
+
|
| 232 |
+
Both the qualitative and quantitative results of the subgoal testing ablation studies support our implementation. When no subgoal testing was used, the results were as expected. The subgoal policies would always learn to set unrealistic subgoals that could not be achieved within $H$ actions by the level below. This led to certain levels of the hierarchy needing to learn very long sequences of actions that the level was not trained to do. When the Q-values of these unrealistic subgoal states were examined, they were high, likely because there were no transitions indicating that these should have low Q-values.
|
| 233 |
+
|
| 234 |
+
The implementation of always penalizing subgoals even when a noisy lower level policy hierarchy was used also performed significantly worse than our implementation. One likely reason for this outcome is that always penalizing strategy incentivizes subgoal levels to output overly conservative subgoals, which means a subgoal level needs to learn longer sequences of subgoals that in turn take longer to learn. Subgoal levels are incentivized to set nearby subgoals because more distant ones are less likely to be achieved when noise is added to actions.
|
| 235 |
+
|
| 236 |
+

|
| 237 |
+
Figure 6: Results from the ablation studies examining our subgoal testing procedure. We compare our implementation to two other options: (i) no subgoal testing and (ii) an implementation in which all missed subgoals are penalized even when lower levels use noisy policies to try to achieve the subgoal state that is being tested. 3-level agents were used in all options.
|
| 238 |
+
|
| 239 |
+
# 7.6 HIERARCHICAL ACTOR-CRITIC IMPLEMENTATION DETAILS
|
| 240 |
+
|
| 241 |
+
Below we provide some of the important details of our implementation of HAC. For further detail, see the GitHub repository available at https://github.com/andrew-j-levy/ Hierarchical-Actor-Critc-HAC-.
|
| 242 |
+
|
| 243 |
+
• DDPG Parameters:
|
| 244 |
+
|
| 245 |
+
– Bounded Q-Values: We bound the output of each critic function to the range $[ - H , 0 ]$ using a negative sigmoid function. An upper bound of 0 was chosen because all rewards in HAC are nonpositive so positive Q-values are illegal. We believe the lower bound of $- H$ is helpful for learning Q-values as the critic function does not need to learn precise Q-values for the large space of irrelevant actions in which the current stat is far from the goal state. The bound of $- H$ also ensures that subgoal states that were reached in hindsight should have higher Q-values than any subgoal state that is too distant and penalized during subgoal testing. DDPG Target Networks: For the 2- and 3-level agents, we removed the target networks used in DDPG because we saw in some of our early MuJoCo experiments that these hierarchical agents performed at least as well without target networks. We evaluated the flat agents with and without target networks. The flat agent generally performed better with target networks, but our results show the better result of the two. Exploration: Each level uses the following exploration strategy when a level is not involved in subgoal testing. ∗ $20 \%$ of actions are sampled uniformly at random from the level’s action space $^ *$ $80 \%$ of actions are the sum of actions sampled from the level’s policy and Gaussian noise
|
| 246 |
+
– Neural Network Architectures: All actor and critic neural networks had 3 hidden layers, with 64 nodes in each hidden layer. ReLU activation functions were used.
|
| 247 |
+
|
| 248 |
+
• HAC Parameters: – Maximum horizon of a subgoal, $H$ : 1. For $k { = } 3$ -level agents in MuJoCo tasks, $H = 1 0$
|
| 249 |
+
|
| 250 |
+
2. For $k { = } 2$ -level agents in MuJoCo tasks, $H$ was generally in the range [20,30] – Subgoal testing rate $\lambda = 0 . 3$ – Goal and subgoal achievement thresholds were hand-crafted.
|
md/train/wCrH0JBCFNm/wCrH0JBCFNm.md
ADDED
|
@@ -0,0 +1,252 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Post-Training Quantization for Vision Transformer
|
| 2 |
+
|
| 3 |
+
Zhenhua Liu1,2, Yunhe Wang2∗, Kai Han2, Wei Zhang2, Siwei $\mathbf { M } \mathbf { a } ^ { 1 , 3 }$ , Wen Gao1,3
|
| 4 |
+
|
| 5 |
+
1School of Electronic Engineering and Computer Science, Peking University 2 Huawei Noah’s Ark Lab 3Peng Cheng Laboratory liu-zh@pku.edu.cn, {yunhe.wang, kai.han, wz.zhang}@huawei.com, {swma, wgao}@pku.edu.cn
|
| 6 |
+
|
| 7 |
+
# Abstract
|
| 8 |
+
|
| 9 |
+
Recently, transformer has achieved remarkable performance on a variety of computer vision applications. Compared with mainstream convolutional neural networks, vision transformers are often of sophisticated architectures for extracting powerful feature representations, which are more difficult to be developed on mobile devices. In this paper, we present an effective post-training quantization algorithm for reducing the memory storage and computational costs of vision transformers. Basically, the quantization task can be regarded as finding the optimal low-bit quantization intervals for weights and inputs, respectively. To preserve the functionality of the attention mechanism, we introduce a ranking loss into the conventional quantization objective that aims to keep the relative order of the self-attention results after quantization. Moreover, we thoroughly analyze the relationship between quantization loss of different layers and the feature diversity, and explore a mixedprecision quantization scheme by exploiting the nuclear norm of each attention map and output feature. The effectiveness of the proposed method is verified on several benchmark models and datasets, which outperforms the state-of-the-art posttraining quantization algorithms. For instance, we can obtain an $8 1 . 2 9 \%$ top-1 accuracy using DeiT-B model on ImageNet dataset with about 8-bit quantization. Code will be available at https://gitee.com/mindspore/models/tree/master/research/cv/VTPTQ.
|
| 10 |
+
|
| 11 |
+
# 1 Introduction
|
| 12 |
+
|
| 13 |
+
Following the applications in Natural Language Processing (NLP) tasks, transformer-based models have shown great power in various Computer Vision (CV) tasks, such as image classification [11, 26], object detection [4, 39] and image super-resolution [5]. Pre-trained with large-scale data, these models usually have hundreds of millions of parameters. For instance, there are 307M parameters and 64G FLOPs in the ViT-L model, which is both memory and computation expensive during inference. This brings great challenges for these models to run on resource-constrained devices like mobile phones and intelligent cars. Besides, the real-time computer vision applications that integrate transformer-based models have to meet low latency requirements to achieve a high quality customer experience. Therefore, the model compression technology of transformer-based models is urgently needed for deployment in industrial environments.
|
| 14 |
+
|
| 15 |
+
Among various compression methods like pruning [16, 29, 19] and weight decomposition [37], quantization method [9, 38, 7, 27, 14, 32] compresses a neural network by using lower bit-width for weight values without changing the model architecture, which is particularly useful for carefullydesigned network architectures like transformers. Quantizing both weights and inputs can speed up inference by tuning floating-point operations into integer or bit operations. There have been some training-aware quantization approaches for transformer-based models in NLP (e.g., BERT [17]) [34, 23, 35, 22]. However, these methods are not designed for computer vision tasks and usually need additional training or fine-tuning. Furthermore, in some scenarios, the entire training data is not available to optimize the quantization model and the training costs for edge devices are intolerable.
|
| 16 |
+
|
| 17 |
+
Post-training quantization [24] is a kind of efficient model compression technique, which can directly quantize neural network models without fine-tuning. Most of the existing post-training quantization methods are designed for convolutional neural networks [3, 21, 30] or recurrent neural networks [36]. These methods do not take the character of vision transformer into consideration (e.g., the attention mechanism do not exist in CNNs), which are not perfectly suitable for quantizing vision transformer. However, vision transformers are showing stronger performance in a large variety of computer vision tasks. Thus, we are motivated to explore the post-training quantization for them to reduce the costs on memory and computation.
|
| 18 |
+
|
| 19 |
+
In this paper, we study the post-training quantization method for vision transformer models with mixed-precision for higher compression and speed-up ratios. The quantized process in the transformer is formulated as an optimization problem for finding the optimal quantization intervals. Specially, our goal is to maximize the similarity between the full-precision and quantized outputs in vision transformers. To better preserve the functionality of the attention mechanism, we thoroughly analyze the difference between attention layers and conventional layers such as MLP. Then, a ranking loss is introduced to keep the relative order of attention values. Furthermore, we propose to determine the bit-widths of each layer according to the feature diversity, $i , e ,$ , the nuclear norm calculated by the attention map and output features. We alternatively search the quantization intervals of weights and inputs in all layers to obtain the best quantization results. In addition, bias correction is introduced to diminish the cumulative quantization error. Experimental results on several benchmarks demonstrate the effectiveness of our algorithm for achieving better performance over the state-of-art post-training quantization approaches.
|
| 20 |
+
|
| 21 |
+
# 2 Related Works
|
| 22 |
+
|
| 23 |
+
Here, we reviews the transformer-based models designed for computer vision tasks. And the training-aware quantization schemes proposed for BERT and post-training quantization algorithms are summarized and analyzed.
|
| 24 |
+
|
| 25 |
+
# 2.1 Vision Transformer
|
| 26 |
+
|
| 27 |
+
Inspired by the major success of transformer architectures in the field of NLP, researchers have recently applied transformer to computer vision (CV) tasks [13]. Chen et al. [6] trained a sequence transformer to auto-regressively predict pixels, achieving results comparable to CNNs on image classification tasks. Another vision transformer model is ViT, which applies a pure transformer directly to treat image patches as the sequences. Recently proposed by Dosovitskiy et al. [11], it has achieved great performance on multiple image recognition benchmarks. Touvron et al. [26] produce competitive convolution-free transformers by training on ImageNet only while introducing a teacher-student strategy specific to transformers. In addition to basic image classification, transformer has been utilized to address a variety of other computer vision problems, including object detection [4, 39], semantic segmentation [5], image processing [5], and video understanding [5]. Han et al. [15] proposed a Transformer-iN-Transformer (TNT) model for modeling both patch-level and pixel-level representation. Tang et al. [25] proposed an augmented shortcut scheme to improve the performance of vision transformers. Thanks to its exceptional performance, more and more researchers are proposing transformer-based models for a wide range of computer vision tasks.
|
| 28 |
+
|
| 29 |
+
# 2.2 Compression of Transformer in NLP
|
| 30 |
+
|
| 31 |
+
Owing to the remarkable performance of BERT in many NLP tasks, many researchers have tried to compress the model to reduce the memory and computation complexity of BERT. Wu et al. [31] proposed Short Range Attention (LSRA) to conduct transformer on edge devices, where one group of heads specializes in the local context modeling (by convolution) while another group specializes in the long-distance relationship modeling. In [22, 34], 8-bit quantization is successfully applied to Transformer-based models with comparable performance as the full-precision baseline. However, quantizing these models to ultra low bits (e.g., 1 or 2 bits) can be much more challenging due to significant reduction in model capacity. To avoid severe accuracy drop, more complex quantization methods, like mixed-precision quantization [23, 33] and product quantization (PQ) [12] are used. In addition, Zhang et al. [35] propose TernaryBERT, which use both approximation-based and lossaware ternarization methods and empirically investigate the ternarization granularity of different parts of BERT. Moreover, to reduce the accuracy degradation, they also leverage the knowledge distillation technique. Bai et al. [1] further push BERT quantization to the limit with weight binarization. They propose ternary weight splitting, which initializes the binary model by equivalent splitting from a half-sized ternary network. However, these methods are not designed for computer vision tasks and need additional training or fine-tuning.
|
| 32 |
+
|
| 33 |
+
# 2.3 Post-Training Quantization
|
| 34 |
+
|
| 35 |
+
There are many works focusing on developing post-training quantization methods, without any training or fine-tuning. In particular, Yoni et al. [8] propose the OMSE method to optimize the $L _ { 2 }$ distance between the quantized tensor and the original tensor. Moreover, Ron et al. [2] present the so-called ACIQ method to analytically compute the clipping range, as well as the per-channel bit allocation for NNs. Zhao et al. [36] propose an outlier channel splitting (OCS) method to solve the outlier channel problem. Wang et al. [28] propose a Bit-Split and Stitching framework for lower-bit post-training quantization and an Error Compensated Activation Quantization method, which could lower the quantization error for activations. Nagel et al. [20] propose AdaRound, a weight-rounding mechanism for post-training quantization that adapts to the data and the task loss. By approximating the task loss with a Taylor series expansion, the rounding task is posed as a quadratic unconstrained binary optimization problem. The recent work of [21] propose Data-Free Quantization, which further pushes post-training quantization to zero-shot scenarios, where neither training nor testing data are accessible during quantization. Cai et al. [3] introduce ZeroQ, which distills an input data distribution to match the statistics in the batch normalization layers of the model and utilize a Pareto Frontier method to select automatically the bit-precision configuration of mixed-precision settings. These methods are designed for CNNs and do not consider the unique structure of vision transformers such as self-attention layers.
|
| 36 |
+
|
| 37 |
+
# 3 Methodology
|
| 38 |
+
|
| 39 |
+
In this section, we elaborate on the proposed mixed-precision post-training quantization scheme for the vision transformer. The similarity-aware quantization for linear layers and ranking-aware quantization for self-attention layers are presented. In addition, the bias correction method for optimization and the mixed-precision quantization based on nuclear norm of the attention map and output feature are introduced.
|
| 40 |
+
|
| 41 |
+
# 3.1 Preliminaries
|
| 42 |
+
|
| 43 |
+
A standard transformer receives an input as a 1-D sequence of token embeddings, so the vision transformers usually reshape the image $\mathbf { I } \in \mathbb { R } ^ { H \times W \times C }$ into a sequence of flatted 2D patches $I ^ { p } \in$ $\mathbb { R } ^ { n \times ( P ^ { 2 } \cdot C ) }$ . Here, $H$ and $W$ are the height and width of the original image and $( P , P )$ is the resolution of each image patch, $\begin{array} { r } { n = \frac { H W } { P ^ { 2 } } } \end{array}$ is then the effective sequence length for the transformer. Usually, the vision transformers use constant widths through all of its layers, so a trainable linear projection maps each vectorized patch to the model dimension $d$ . Thus, the input to the first transformer layer is:
|
| 44 |
+
|
| 45 |
+
$$
|
| 46 |
+
\begin{array} { r l } & { \mathbf { X } _ { 1 } = [ x _ { c l a s s } ; I _ { 1 } ^ { p } \mathbf { W } _ { 1 } ^ { E } ; \cdot \cdot \cdot ; I _ { n } ^ { p } \mathbf { W } _ { n } ^ { E } ] + \mathbf { E } ^ { p o s } . } \\ & { \mathrm { w h e r e ~ } \mathbf { W } ^ { E } \in \mathbb { R } ^ { ( P ^ { 2 } \cdot C ) \times d } , \mathbf { E } ^ { p o s } \in \mathbb { R } ^ { ( n + 1 ) \times d } } \end{array}
|
| 47 |
+
$$
|
| 48 |
+
|
| 49 |
+
A standard transformer layer includes two main modules: Multi-Head Self Attention (MSA) and Multi-Layer Perceptron (MLP) module. For the $l$ -th transformer layer, suppose the input to it is $\mathbf { X } _ { l } \in \mathbb { R } ^ { n \times d }$ , the attention scores computed by the dot product of queries and keys can be formulated as:
|
| 50 |
+
|
| 51 |
+
$$
|
| 52 |
+
\mathbf { A } _ { l } = \mathbf { Q } _ { l } \mathbf { K } _ { l } ^ { \mathrm { T } } = \mathbf { X } _ { l } \mathbf { W } _ { l } ^ { Q } \mathbf { W } _ { l } ^ { K ^ { \mathrm { T } } } \mathbf { X } _ { l } ^ { \mathrm { T } } .
|
| 53 |
+
$$
|
| 54 |
+
|
| 55 |
+

|
| 56 |
+
Figure 1: Diagram of the proposed mixed-precision post-training quantization method for vision transformer. The similarity-aware and ranking-aware quantization are designed for finding the optimal quantization interval of the linear operations and self-attention layers. The bit-widths of transformer layers are determined based on the nuclear norm of the attention map and the output feature.
|
| 57 |
+
|
| 58 |
+
Then the softmax function is applied on the normalized scores to get the output and the output of the multi-head self attention module is:
|
| 59 |
+
|
| 60 |
+
$$
|
| 61 |
+
\mathbf { M S A } ( \mathbf { X } _ { l } ) = \operatorname { S o f t m a x } ( \frac { 1 } { \sqrt { d } } \mathbf { A } _ { l } ) \mathbf { X } _ { l } \mathbf { W } _ { l } ^ { V } \cdot \mathbf { W } _ { l } ^ { O } .
|
| 62 |
+
$$
|
| 63 |
+
|
| 64 |
+
The MLP module contains two linear layers parameterized by $\mathbf { W } ^ { 1 } \in \mathbb { R } ^ { d \times d _ { f } } , b ^ { 1 } \in \mathbb { R } ^ { d _ { f } }$ and $\mathbf { W } ^ { 2 } \in \mathbf { \Sigma }$ $\mathbb { R } ^ { d _ { f } \times d } , b ^ { 2 } \in \mathbb { R } ^ { d }$ respectively, where $d _ { f }$ is the number of neurons in the intermediate layer of MLP. Denote the input to MLP as $\mathbf { Z } _ { l } \in \mathbb { R } ^ { n \times d }$ , the output is then computed as:
|
| 65 |
+
|
| 66 |
+
$$
|
| 67 |
+
\begin{array} { r } { \mathbf { M } \mathbf { L } \mathbf { P } ( \mathbf { Z } _ { l } ) = \mathbf { G } \mathbf { e } \mathbf { L } \mathbf { U } ( \mathbf { Z } _ { l } \mathbf { W } ^ { 1 } + b ^ { 1 } ) \mathbf { W } ^ { 2 } + b ^ { 2 } . } \end{array}
|
| 68 |
+
$$
|
| 69 |
+
|
| 70 |
+
Combining Eq. (4) and (5), the forward propagation for the $l$ -th transformer layer can be formulated as:
|
| 71 |
+
|
| 72 |
+
$$
|
| 73 |
+
\begin{array} { r } { \mathbf { Z } _ { l } = \mathbf { X } _ { l } + \mathbf { M S A } ( \mathbf { L N } ( \mathbf { X } _ { l } ) ) , } \\ { \mathbf { X } _ { l + 1 } = \mathbf { Z } _ { l } + \mathbf { M L P } ( \mathbf { L N } ( \mathbf { Z } _ { l } ) ) , } \end{array}
|
| 74 |
+
$$
|
| 75 |
+
|
| 76 |
+
where LN represents the layer normalization.
|
| 77 |
+
|
| 78 |
+
The most computational costs of vision transformer lie on the large matrix multiplication in MSA and MLP module. Following the mainstream quantization methods for CNNs [7, 21], we quantize all the weights and inputs involved in matrix multiplication. For weight quantization, we quantize the weights $\mathbf { W } ^ { Q } , \mathbf { W } ^ { \hat { K } } , \mathbf { W } ^ { V } , \mathbf { W } ^ { O } , \mathbf { W } ^ { 1 } , \mathbf { W } ^ { 2 }$ in Eq. (4) and (5) for all transformer layers, as well as the linear embedding $\mathbf { W } ^ { E }$ in Eq. (1). Besides these weights, we also quantize the inputs of all linear layers and matrix multiplication operations. Following the methods in [22, 35], we do not quantize the softmax operation and layer normalization, because the parameters contained in these operations are negligible and quantizing them may bring significant accuracy degradation.
|
| 79 |
+
|
| 80 |
+
# 3.2 Ranking-Aware Post-Training Quantization
|
| 81 |
+
|
| 82 |
+
For post-training quantization, we need to restrict the floating-numbers to a finite set of values. The choice of quantization intervals is critical for quantization and one popular option is to use a uniform quantization function, where the data range is equally split:
|
| 83 |
+
|
| 84 |
+
$$
|
| 85 |
+
\Psi _ { \Delta } ( \mathbf { Y } ) = \mathrm { C l a m p } ( \mathrm { R o u n d } ( \frac { \mathbf { Y } } { \Delta } ) , - 2 ^ { b - 1 } , 2 ^ { b - 1 } - 1 ) ,
|
| 86 |
+
$$
|
| 87 |
+
|
| 88 |
+
where $\Delta$ is the quantization interval, $b$ is the quantization bit-width and $\mathbf { Y }$ is a tensor representing weights or inputs. Clamp denotes that elements in the tensor that exceed the ranges of the quantized domain are clipped.
|
| 89 |
+
|
| 90 |
+
For the layers in vision transformer, the original output can be computed as $\mathbf { O } _ { l } = \mathbf { X } _ { l } \mathbf { W } _ { l }$ . The uniform quantization for the weights and inputs and the corresponding dequant operation can be described as:
|
| 91 |
+
|
| 92 |
+
$$
|
| 93 |
+
\begin{array} { r } { \widehat { \mathbf { O } } _ { l } = \Psi _ { \Delta _ { l } ^ { X } } ( \mathbf { X } _ { l } ) \Psi _ { \Delta _ { l } ^ { W } } ( \mathbf { W } _ { l } ) \cdot \Delta _ { l } ^ { W } \cdot \Delta _ { l } ^ { X } , } \end{array}
|
| 94 |
+
$$
|
| 95 |
+
|
| 96 |
+
where $\widehat { \mathbf { O } } _ { l }$ denotes the outputs of the quantized layer. From Eq. (8) and Eq. (9), it can be seen that the quantization intervals actually control the clamping thresholds in quantization process, which affects the quantization results to a great extent. Therefore, we are motivated to focus on optimizing the quantization intervals for both weights $\Delta _ { l } ^ { W }$ and inputs $\Delta _ { l } ^ { X }$ , where inputs $X _ { l }$ are generated from a given calibration dataset $\mathbf { D }$ with $N$ samples. Specifically, the calibration dataset is much less than the common training dataset.
|
| 97 |
+
|
| 98 |
+
The self-attention layer is the critical component of the transformer since it can calculate the global relevance of the features, which makes the transformer unique from the convolutional neural networks. For the calculation of self-attention (Eq. 3), we empirically find that the relative order of the attention map has been changed after quantization as shown in $\mathrm { F i g ~ 1 }$ , which could cause a significant performance degradation. Thus, a ranking loss is introduced to solve this problem during the quantization process:
|
| 99 |
+
|
| 100 |
+
$$
|
| 101 |
+
\mathcal { L } _ { r a n k i n g } = \sum _ { k = 1 } ^ { h } \sum _ { p = 1 } ^ { w - 1 } \sum _ { q = p + 1 } ^ { w } \varPhi \bigl ( \bigl ( \widehat { \mathbf { A } } _ { k p } - \widehat { \mathbf { A } } _ { k q } \bigr ) \cdot s i g n \bigl ( \mathbf { A } _ { k p } - \mathbf { A } _ { k q } \bigr ) \bigr ) ,
|
| 102 |
+
$$
|
| 103 |
+
|
| 104 |
+
in which $\varPhi ( m ) = ( \theta - m ) _ { + }$ is hinge function with parameter $\theta$ , $( h , w )$ are the size of matrix A. Given a pair of examples, the loss is 0 only when the examples are in the correct order and differed by a margin.
|
| 105 |
+
|
| 106 |
+
Then we combine the ranking loss with the similarity-aware quantization, and the overall optimization goal can be described as:
|
| 107 |
+
|
| 108 |
+
$$
|
| 109 |
+
\operatorname* { m i n } _ { \Delta _ { l } ^ { W } , \Delta _ { l } ^ { X } } \gamma \cdot \mathcal { L } _ { r a n k i n g } - \frac { 1 } { N } \sum _ { i = 1 } ^ { N } \Gamma ( \mathbf { O } _ { l } ^ { i } , \widehat { \mathbf { O } } _ { l } ^ { i } ) , \quad s . t . \Delta _ { l } ^ { W } , \Delta _ { l } ^ { X } \in \mathbb { R } ^ { + }
|
| 110 |
+
$$
|
| 111 |
+
|
| 112 |
+
where $\mathcal { L } _ { r a n k }$ denote the pairwise ranking based loss function, and $\gamma$ is the trade-off hyper-parameter. $\Gamma ( \mathbf { O } _ { l } ^ { i } , \widehat { \mathbf { O } } _ { l } ^ { i } )$ denotes the similarity metric between the original and quantized output feature maps, which can be formulated as:
|
| 113 |
+
|
| 114 |
+
$$
|
| 115 |
+
\Gamma ( \widehat { \bf O } , { \bf O } ) = \frac { \sum _ { j = 1 } ( { \bf O } _ { j } - \overline { { \bf O } } ) ( \widehat { \bf O } _ { j } - \overline { { \bf O } } ) } { \sqrt { \sum _ { j = 1 } ( { \bf O } _ { j } - \overline { { \bf O } } ) ^ { 2 } } \sqrt { \sum _ { j = 1 } ( \widehat { \bf O } _ { j } - \overline { { \bf O } } ) ^ { 2 } } } ,
|
| 116 |
+
$$
|
| 117 |
+
|
| 118 |
+
where the Pearson correlation coefficient is adopted as the measurement for the similarity since it subtracts the mean value of the data and can be more representative for the similarity between the distribution of quantized and original feature maps.
|
| 119 |
+
|
| 120 |
+
To solve the above optimization problem, we present a simple but efficient alternative searching method for the uniform quantization of transformer layers. Firstly, the quantization interval of inputs $\Delta _ { l } ^ { X }$ is fixed, and the quantization interval of weights $\Delta _ { l } ^ { W }$ is optimized for adjustment. Secondly, $\Delta _ { l } ^ { W }$ is fixed, and $\Delta _ { l } ^ { X }$ is optimized to fine-tune the quantization interval of the inputs. $\Delta _ { l } ^ { W }$ and $\Delta _ { l } ^ { X }$ are alternately optimized until the target function converges or the maximum iteration is exceeded. Moreover, for fast convergence, $\Delta _ { l } ^ { W }$ and $\Delta _ { l } ^ { X }$ are initialized in terms of the maximum of weights or inputs respectively. For the search space of $\Delta _ { l } ^ { W }$ and $\Delta _ { l } ^ { X }$ , we linearly divide interval of $[ \alpha \Delta _ { l } , \beta \Delta _ { l } ]$ into $C$ candidate options and conduct a simple search strategy on them.
|
| 121 |
+
|
| 122 |
+
Bias Correction To further reduce the biased error for the outputs raised by quantization, a bias correction method is then introduced after each search iteration. Suppose the quantization error of weights and inputs are defined as:
|
| 123 |
+
|
| 124 |
+
$$
|
| 125 |
+
\begin{array} { r l } & { \epsilon ^ { X } = \Psi _ { \Delta ^ { X } } ( \mathbf { X } ) \cdot \Delta ^ { X } - \mathbf { X } , } \\ & { \epsilon ^ { W } = \Psi _ { \Delta ^ { W } } ( \mathbf { W } ) \cdot \Delta ^ { W } - \mathbf { W } . } \end{array}
|
| 126 |
+
$$
|
| 127 |
+
|
| 128 |
+
If the expectation of the error for output is not zero, then the mean of the output will change. This shift in distribution may lead to detrimental behavior in the following layers. We can correct this change by seeing that:
|
| 129 |
+
|
| 130 |
+
$$
|
| 131 |
+
\begin{array} { r } { \mathbb { E } [ \widehat { \mathbf { O } } ] = \mathbb { E } [ \mathbf { O } ] + \mathbb { E } [ \epsilon ^ { W } \mathbf { X } ] + \mathbb { E } [ \epsilon ^ { X } \mathbf { W } ] + \mathbb { E } [ \epsilon ^ { X } \epsilon ^ { W } ] . } \end{array}
|
| 132 |
+
$$
|
| 133 |
+
|
| 134 |
+
Thus, subtracting the expected error on the output from the biased output ensures that the mean for each output unit is preserved. For implementation, the expected error can be computed using the calibration data and subtracted from the layer’s bias parameter, since the expected error vector has the same shape as the layer’s output.
|
| 135 |
+
|
| 136 |
+
# 3.3 Nuclear Norm Based Mixed-Precision Quantization
|
| 137 |
+
|
| 138 |
+
Different transformer layers are attending to different structures, and it is expected that they exhibit different sensitivity. Thus, assigning the same number of bit-widths to all the layers is sub-optimal. As a result, we explore mixed-precision quantization, where more bits are assigned to more sensitive layers in order to retain performance. Considering the unique structure of transformer layer, we assign all the operations in the MSA or MLP modules with the same bit-width. This will also be friendly to the hardware implementation since the weights and inputs are assigned with the same bit-width.
|
| 139 |
+
|
| 140 |
+
Singular value decomposition (SVD) is an important matrix decomposition approach in linear algebra. It takes a rectangular matrix of gene expression data, whose formulation can be written as :
|
| 141 |
+
|
| 142 |
+
$$
|
| 143 |
+
\mathbf { M } = \mathbf { U } \boldsymbol { \Sigma } \mathbf { V } , \quad \mathrm { t r ( } \mathbf { M } ) = \sum _ { i = 1 } ^ { m } \boldsymbol { \Sigma } _ { i i } ,
|
| 144 |
+
$$
|
| 145 |
+
|
| 146 |
+
where the diagonal entries $\Sigma _ { i i }$ of $\pmb { \Sigma }$ are known as the singular values of $\mathbf { M }$ . And the nuclear norm tr is the sum of singular values, which represents the data relevance of the matrix. In this paper, we propose to estimate the sensitivity of the transformer layer with the nuclear norm of the attention map in the MSA module and the output feature in the MLP module. The nuclear norm can be used to reduce the search space of the mixed-precision settings, while using higher bit-widths for layers that are more sensitive and vice versa. Inspired by the method in [10], we utilize a Pareto frontier approach to determine the bit-width. The main idea is to sort each candidate bit-width configuration based on the total second-order perturbation that they cause, according to the following metric:
|
| 147 |
+
|
| 148 |
+
$$
|
| 149 |
+
\Omega = \sum _ { i = 1 } ^ { L } \Omega _ { i } = \sum _ { i = 1 } ^ { L _ { M H A } } \mathrm { t r } ( \mathbf A _ { i } ) \cdot \lVert \widehat { \mathbf A _ { i } } - \mathbf A _ { i } \rVert _ { 2 } ^ { 2 } + \sum _ { j = 1 } ^ { L _ { M S A } } \mathrm { t r } ( \mathbf O _ { j } ) \cdot \lVert \widehat { \mathbf O _ { j } } - \mathbf O _ { j } \rVert _ { 2 } ^ { 2 } .
|
| 150 |
+
$$
|
| 151 |
+
|
| 152 |
+
Given a target model size, the candidate bit-width configurations are sorted based on their $\Omega$ value and choose the bit-width configuration with minimal $\Omega$ . The nuclear norm of the attention map and output feature in each transformer layer are shown in Figure 1. As we can see, they are various for different transformer layers.
|
| 153 |
+
|
| 154 |
+
# 4 Exprimental results
|
| 155 |
+
|
| 156 |
+
In this section, we evaluate the performance of the proposed post-training quantization scheme on vision transformer model for image classification (ViT [11] and DeiT [26]) and object detection (DETR [4]). To the best of our knowledge, there is no published work done on post-training quantization of vision transformer at this point, so we implement recent post-training quantization methods for CNNs as described in the papers by ourselves. It is shown that the proposed method outperforms the conventional post-training quantization methods. Moreover, extensive experiments of ablation study have shown that the proposed similarity-aware, ranking-aware quantization and bias correction method are beneficial for the post-training quantization of vision transformer.
|
| 157 |
+
|
| 158 |
+
# 4.1 Implementation details
|
| 159 |
+
|
| 160 |
+
Datasets For image classification, the CIFAR-10, CIFAR-100 and ILSVRC-2012 ImageNet (we refer to it as ImageNet in what follows) datasets are utilized to evaluate the quantization performance.
|
| 161 |
+
|
| 162 |
+
The CIFAR-10 dataset consists of $5 0 K$ training images and $1 0 K$ test images, which are labeled for 10 classes. And CIFAR-100 dataset also contains $5 0 K$ training images and $1 0 K$ test images, expect that they are labeled for 100 classes. ImageNet dataset contains 1.2 million training images and $5 0 K$ validation images labeled for 1,000 categories. For object detection task, the COCO2017 dataset is utilized to evaluate the quantization performance, which contains $1 1 8 K$ training images and $5 K$ validation images.
|
| 163 |
+
|
| 164 |
+
Experimental settings We randomly select 100 images for CIFAR-10 and CIFAR-100 dataset and 1000 images for ImageNet and COCO2017 dataset from the training dataset as the calibration dataset. For the hyper-parameter, $\alpha$ and $\beta$ are set to 0.5 and 1.2 for all the experiments. The maximum iteration is set to 20 if not mentioned specifically. For mixed-precision, we utilize {4,5,6,7,8} and {6,7,8,9,10} bits while the target bit-width are 6 bit and 8 bit, respectively.
|
| 165 |
+
|
| 166 |
+
Baseline For image classification, we evaluate our quantization method on two popular vision transformer implementation: ViT [11] and DeiT [26]. The ViT-B, ViT-L, DeiT-S, DeiT-B are adopted as the baseline model, whose top-1 accuracy on ImageNet dataset are $7 1 . 5 8 \%$ , $7 1 . 4 8 \%$ , $7 9 . 8 \%$ , $8 1 . 8 \%$ respectively. For a fair comparison, we utilize the official implementation of DeiT and do not use other techniques like knowledge distillation. For object detection, the DETR model using ResNet-50 backbone is adopted, which achieves a $4 2 . 0 \mathrm { m A P }$ on COCO dataset.
|
| 167 |
+
|
| 168 |
+
# 4.2 Results and Analysis
|
| 169 |
+
|
| 170 |
+
Image classification The experimental results are shown in Table 1. We firstly evaluate the proposed method on ViT-B and ViT-L model. ViT-B model is a 12-layer transformer with 12 heads and 768 embedding dimension. For the similar quantized model size, the proposed method outperforms percentile-based method [18] by $3 . 3 5 \%$ and $2 . 0 7 \%$ on CIFAR-10 dataset, respectively. And it is worth noting that the performance of the proposed 8-bit model is comparable to the fullprecision model. The proposed method obtains the similar performance on CIFAR-100 dataset and ImageNet dataset, while the average gains are $2 . 9 5 \%$ and $3 . 2 8 \%$ respectively. Moreover, the performance of the proposed 6-bit model is even better than the 8-bit percentile-based model, which means that the proposed method can save about $2 5 \%$ memory and $44 \%$ computational costs than conventional post-training quantization method.
|
| 171 |
+
|
| 172 |
+
ViT-L model is much larger network which consists of 24 transformer layer with 16 heads and 1024 embedding dimension. It contains 307M parameters, however its performance is worse than ViT-B. We also test the quantization methods on CIFAR-10, CIFAR-100 and ImageNet dataset. As shown in Table 1, the performance of the proposed method outperforms the percentile-based method by a large margin. It is worth mentioning that the 8-bit proposed model is even better than full-precision model on CIFAR-10 dataset and comparable to the full-precision model on CIFAR-100 dataset and ImageNet model. It is supposed that there is more redundancy in the ViT-L model and the performance degradation of quantization is less than that of ViT-B model.
|
| 173 |
+
|
| 174 |
+
The architecture of DeiT network is the same as ViT, expect that DeiT utilizes the data augmentation and regularization strategies. As a result, the performance of DeiT is much better than ViT. Among the models, ViT-S consists of 12 transformer layers with 6 heads and 384 embedding dimension. As we can see, the percentile-based method largely hurts the performance while the accuracy losses of 6-bit and 8-bit models are $9 . 3 1 \%$ and $5 . 8 2 \%$ . EasyQuant [30] is a popular simple post-training quantization method which improves the performance loss to $6 . 5 4 \%$ and $3 . 2 1 \%$ , respectively. Bit-Split proposes a bit splitting and stitching framework [28], while the Top-1 accuracy degradation are $5 . 7 6 \%$ and $2 . 7 4 \%$ . In comparison, the Top-1 accuracy losses of the proposed post-training quantization scheme are $5 . 2 2 \%$ and $2 . 3 3 \%$ respectively. In addition, when the mixed-precision is conducted, the 8-bit quantized model can achieve $7 8 . 0 9 \%$ Top-1 accuracy.
|
| 175 |
+
|
| 176 |
+
DeiT-B is a much larger network than DeiT-S, which consists of 12 transformer layers with 12 heads and 768 embedding dimension. As shown in Table 1, the Top-1 accuracy of percentile-based are $7 3 . 9 9 \%$ and $7 5 . 2 1 \%$ when quantized to 6-bit and 8-bit respectively. And the proposed scheme improves the performance of the quantized model to $7 7 . 4 7 \%$ and $8 1 . 2 9 \%$ . Another point is that the accuracy losses of DeiT-B are smaller than DeiT-S and we think that this is because DeiT-B consists of more parameters and is more representive when quantized to the same bit-width.
|
| 177 |
+
|
| 178 |
+
Table 1: Comparison on the performance of proposed mixed-precision post-training quantization method with conventional quantization method for image classification. ’MP’ represents for mixedprecision.
|
| 179 |
+
|
| 180 |
+
<table><tr><td>Model</td><td>Dataset</td><td>Method</td><td>W-bit</td><td>A-bit</td><td>Model size (MB)</td><td>Top-1 Accuracy</td></tr><tr><td rowspan="12">ViT-B</td><td rowspan="5">CIFAR-10</td><td>Baseline Percentile</td><td>32 6</td><td>32 6</td><td>344 64.5</td><td>98.13 93.48</td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Ours</td><td>6MP</td><td>6MP</td><td>64.6</td><td>96.83</td></tr><tr><td>Percentile</td><td>8</td><td>8</td><td>86.2</td><td>95.72</td></tr><tr><td>Ours</td><td>8 MP</td><td>8 MP</td><td>86.0</td><td>97.79</td></tr><tr><td rowspan="5">CIFAR-100</td><td>Baseline</td><td>32 6</td><td>32 6</td><td>344</td><td>87.13 80.56</td></tr><tr><td>Percentile</td><td></td><td></td><td>64.5 64.4</td><td>83.99</td></tr><tr><td>Ours</td><td>6MP 8</td><td>6MP 8</td><td>86.2</td><td></td></tr><tr><td>Percentile</td><td></td><td>8MP</td><td>86.5</td><td>83.28</td></tr><tr><td>Ours Baseline</td><td>8 MP 32</td><td></td><td></td><td>85.76</td></tr><tr><td rowspan="5">ImageNet</td><td>Percentile</td><td>6</td><td>32 6</td><td>344 64.5</td><td>77.91 71.58</td></tr><tr><td>Ours</td><td>6MP</td><td>6MP</td><td>64.8</td><td>75.26</td></tr><tr><td>Percentile</td><td>8</td><td>8</td><td>86.2</td><td>74.10</td></tr><tr><td>Ours</td><td>8 MP</td><td>8 MP</td><td>86.5</td><td>76.98</td></tr><tr><td></td><td></td><td>32</td><td>1228</td><td></td></tr><tr><td rowspan="9">ViT-L</td><td rowspan="6">CIFAR-10</td><td>Baseline</td><td>32</td><td></td><td></td><td>97.86</td></tr><tr><td>Percentile Ours</td><td>6 6MP</td><td>6 6MP</td><td>230.2 232</td><td>93.27 96.09</td></tr><tr><td>Percentile</td><td>8</td><td>8</td><td>307</td><td>94.19</td></tr><tr><td>Ours</td><td>8 MP</td><td>8 MP</td><td>305.8</td><td>97.90</td></tr><tr><td>Baseline</td><td>32</td><td>32</td><td>1228</td><td>86.35</td></tr><tr><td>Percentile</td><td>6</td><td>6</td><td>230.2</td><td></td></tr><tr><td>Ours</td><td>6 MP</td><td>6MP</td><td>231</td><td>80.54</td></tr><tr><td rowspan="5">CIFAR-100</td><td></td><td>8</td><td></td><td></td><td>83.69</td></tr><tr><td>Percentile Ours</td><td>8 MP</td><td>8</td><td>307</td><td>83.01</td></tr><tr><td></td><td></td><td>8 MP</td><td>307.8</td><td>85.83</td></tr><tr><td>Baseline</td><td>32</td><td>32</td><td>1228</td><td>76.53</td></tr><tr><td>Percentile Ours</td><td>6</td><td>6</td><td>230.2</td><td>71.48</td></tr><tr><td rowspan="5">ImageNet</td><td></td><td>6 MP</td><td>6 MP</td><td>231.6</td><td>75.46</td></tr><tr><td>Percentile</td><td>8</td><td>8</td><td>307</td><td>75.17</td></tr><tr><td>Ours</td><td>8 MP</td><td>8 MP</td><td>306.4</td><td>76.41</td></tr><tr><td>Baseline</td><td>32</td><td>32</td><td>88</td><td>79.8</td></tr><tr><td>Percentile [18] EasyQuant [30]</td><td>6</td><td>6</td><td>16.5</td><td>70.49</td></tr><tr><td rowspan="9">DeiT-S</td><td></td><td>6</td><td>6</td><td>16.5</td><td>73.26</td><td></td></tr><tr><td>Bit-Split [28]</td><td>6</td><td>6</td><td>16.5</td><td></td><td>74.04</td></tr><tr><td>Ours</td><td>6</td><td>6</td><td>16.5</td><td></td><td>74.58</td></tr><tr><td>ImageNet Ours</td><td>6MP</td><td>6MP</td><td>16.6</td><td></td><td>75.10</td></tr><tr><td>Percentile [18]</td><td></td><td>8</td><td>8</td><td>22.0</td><td>73.98</td></tr><tr><td>EasyQuant [30]</td><td>8</td><td>8</td><td>22.0</td><td></td><td>76.59</td></tr><tr><td>Bit-Split [28]</td><td></td><td>8</td><td>22.0</td><td></td><td>77.06</td></tr><tr><td>Ours</td><td>8 8</td><td>8</td><td>22.0</td><td></td><td>77.47</td></tr><tr><td>Ours</td><td>8 MP</td><td>8 MP</td><td>22.2</td><td></td><td>78.09</td></tr><tr><td rowspan="11">DeiT-B</td><td></td><td></td><td></td><td></td><td>344</td><td>81.8</td></tr><tr><td>Percentile [18]</td><td>Baseline</td><td>32 6</td><td>32 6</td><td>64.5</td><td>73.99</td></tr><tr><td></td><td>EasyQuant [30]</td><td>6</td><td>6</td><td>64.5</td><td>75.86</td></tr><tr><td>Bit-Split [28]</td><td>6</td><td>6</td><td>64.5</td><td></td><td>76.39</td></tr><tr><td>Ours</td><td>4 MP</td><td>4 MP</td><td>43.6</td><td></td><td>75.94</td></tr><tr><td>Ours</td><td>6</td><td>6</td><td>64.5</td><td></td><td>77.02</td></tr><tr><td rowspan="8">ImageNet</td><td>Ours</td><td>6 MP</td><td>6MP</td><td>64.3</td><td>77.47</td></tr><tr><td>Percentile [18]</td><td>8</td><td>8</td><td>86.0</td><td>75.21</td></tr><tr><td>EasyQuant [30]</td><td>8</td><td>8</td><td>86.0</td><td>79.36</td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Bit-Split [28]</td><td>8</td><td>8</td><td>86.0</td><td>79.42</td></tr><tr><td>Ours</td><td>8</td><td>8</td><td>86.0</td><td>80.48</td></tr><tr><td>Ours</td><td>8 MP</td><td>8MP</td><td>86.8</td><td>81.29</td></tr></table>
|
| 181 |
+
|
| 182 |
+
Table 2: Comparison on the performance of proposed mixed-precision post-training quantization method with conventional quantization method for DETR. ’MP’ represents for mixed-precision.
|
| 183 |
+
|
| 184 |
+
<table><tr><td>Model</td><td>Dataset</td><td>Method</td><td>W-bit</td><td>A-bit</td><td>Model size (MB)</td><td>mAP</td></tr><tr><td rowspan="9">DETR</td><td rowspan="6">COCO2017</td><td>Baseline</td><td>32</td><td>32</td><td>164</td><td>42.0</td></tr><tr><td>Percentile [18]</td><td>6</td><td>6</td><td>30.75</td><td>37.5</td></tr><tr><td>EasyQuant [30]</td><td>6</td><td>6</td><td>30.75</td><td>39.0</td></tr><tr><td>Bit-Split [28]</td><td>6</td><td>6</td><td>30.75</td><td>38.9</td></tr><tr><td>Ours</td><td>6</td><td>6</td><td>30.75</td><td>40.1</td></tr><tr><td>Ours</td><td>6 MP</td><td>6 MP</td><td>30.98</td><td>40.5</td></tr><tr><td>Percentile [18] EasyQuant [30]</td><td>8</td><td>8</td><td>41.00</td><td>38.6</td></tr><tr><td></td><td>8</td><td>8</td><td>41.00</td><td>40.4</td></tr><tr><td></td><td>Bit-Split [28]</td><td>8 8 8</td><td>41.00</td><td>40.6</td></tr><tr><td></td><td>Ours</td><td>8</td><td>41.00</td><td>41.2</td></tr><tr><td>Ours</td><td>8 MP</td><td>8 MP</td><td>41.64</td><td>41.7</td></tr></table>
|
| 185 |
+
|
| 186 |
+
Object Detection In order to show the generalization capability of proposed method, we also evaluate our method for object detection task using DETR [4]. The experimental results are shown in Table 2. As we can see, the proposed method outperforms percentile-based method, EasyQuant, BitSplit by 2.6, 1.1 and $1 . 2 \mathrm { m A P }$ for 6-bit quantization, respectively. The mixed-precision quantization can further boost the performance of the method. For 8-bit quantization, the mAP of the proposed mixed-precision quantization method is comparable to the full-precision model.
|
| 187 |
+
|
| 188 |
+
# 4.3 Ablation study
|
| 189 |
+
|
| 190 |
+
In this section, we evaluate the effect of the proposed similarity-aware quantization module, rankingaware quantization module, bias correction method and the mixed-precision method. The experimental results are shown in Table 3, while experiments are conducted on ImageNet dataset with ViT-B model. As we can see, the Top-1 accuracy of only using similarity-aware quantization is $7 5 . 4 2 \%$ which is inferior to the full-precision model and using ranking-aware quantization loss and bias correction method can improve the performance by $0 . 5 2 \%$ and $0 . 3 9 \%$ . It is worth noting that the nuclear norm based mixed-precision can further promote the performance of the quantized model, since it considers the variant sensitivity of different layers.
|
| 191 |
+
|
| 192 |
+
It is also shown that the Top-1 accuracy of using the similarity-aware mixed-precision quantization is $7 6 . 2 6 \%$ . And the ranking-aware quantization and bias correction can still boost the performance in this case. Besides, the performance of the 8-bit quantized model using all the proposed methods is $7 6 . 9 8 \%$ , which is comparable to the full-precision model.
|
| 193 |
+
|
| 194 |
+
Table 3: Ablation study of the proposed similarity-aware quantization module, ranking-aware quantization module, bias correction and mixed-precision method.
|
| 195 |
+
|
| 196 |
+
<table><tr><td rowspan=1 colspan=1>Model</td><td rowspan=1 colspan=1>Similarity</td><td rowspan=1 colspan=1>Ranking</td><td rowspan=1 colspan=1>Bias Correction</td><td rowspan=1 colspan=1>Mixed-Precision</td><td rowspan=1 colspan=1>Modelsize(MB)</td><td rowspan=1 colspan=1>Top-1 Accuracy</td></tr><tr><td rowspan=3 colspan=1></td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>344</td><td rowspan=1 colspan=1>77.91</td></tr><tr><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>86.2</td><td rowspan=2 colspan=1>75.4275.94</td></tr><tr><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>86.2</td></tr><tr><td rowspan=6 colspan=1>ViT-B</td><td rowspan=3 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>86.2</td><td rowspan=1 colspan=1>75.81</td></tr><tr><td rowspan=1 colspan=1>√</td><td rowspan=1 colspan=1>√</td><td rowspan=1 colspan=1>×</td><td rowspan=1 colspan=1>86.2</td><td rowspan=1 colspan=1>76.49</td></tr><tr><td rowspan=1 colspan=1>×</td><td rowspan=1 colspan=1>×</td><td rowspan=1 colspan=1>√</td><td rowspan=1 colspan=1>86.5</td><td rowspan=1 colspan=1>76.26</td></tr><tr><td rowspan=3 colspan=1>√T√</td><td rowspan=1 colspan=1>×</td><td rowspan=1 colspan=1>√</td><td rowspan=1 colspan=1>√</td><td rowspan=1 colspan=1>86.5</td><td rowspan=1 colspan=1>76.61</td></tr><tr><td rowspan=1 colspan=1>√</td><td rowspan=1 colspan=1>×</td><td rowspan=1 colspan=1>√</td><td rowspan=1 colspan=1>86.5</td><td rowspan=1 colspan=1>76.53</td></tr><tr><td rowspan=1 colspan=1>√</td><td rowspan=1 colspan=1>√</td><td rowspan=1 colspan=1>√</td><td rowspan=1 colspan=1>86.5</td><td rowspan=1 colspan=1>76.98</td></tr></table>
|
| 197 |
+
|
| 198 |
+
We also compared the performance of the proposed method with the hessian-based mixed-precision method, where the experiments are conducted with ViT-B on ImageNet dataset. As we can see in Table 4, the proposed method achieves a similar result while the consuming computation time is much less than hessian-based approach.
|
| 199 |
+
|
| 200 |
+
Table 4: Performance comparison with hessian-based mixed=precision method.
|
| 201 |
+
|
| 202 |
+
<table><tr><td>Method</td><td>W-bit</td><td>A-bit</td><td>Model size (MB)</td><td>Computation time (s)</td><td>Top-1 Accuracy</td></tr><tr><td>Hessian-based</td><td>8MP</td><td>8MP</td><td>86.7</td><td>754.6</td><td>77.01</td></tr><tr><td>Ours</td><td>8 MP</td><td>8 MP</td><td>86.5</td><td>53.1</td><td>76.98</td></tr></table>
|
| 203 |
+
|
| 204 |
+
# 5 Conclusion
|
| 205 |
+
|
| 206 |
+
In this paper, we have developed a novel post-training quantization scheme for vision transformer, in which the bit-widths of each layer are variant based on the nuclear norm of the attention map and output feature in the transformer layer. To solve the optimization problem of the quantization, we propose to search the optimal quantization interval for remaining the similarity between the quantized and original feature maps. In addition, we thoroughly analyze the different between attention layers and conventional layers and introduce a ranking loss to keep the relative order of the attention values. Specifically, the bias correction is employed to reduce the accumulated quantization error. Last but not the least, the optimal quantization interval for each transformer layer is carefully optimized using an alternative searching strategy. Experimental results show that the proposed method outperforms the conventional post-training quantization method by a large margin in terms of both network accuracy and memory costs.
|
| 207 |
+
|
| 208 |
+
# Acknowledge
|
| 209 |
+
|
| 210 |
+
This work was partly supported by the National Natural Science Foundation of China (61961130392) and PKU-Baidu Fund(2019BD003). Besides, High-Performance Computing Platform of Peking University is acknowledged.
|
| 211 |
+
|
| 212 |
+
# References
|
| 213 |
+
|
| 214 |
+
[1] Haoli Bai, Wei Zhang, Lu Hou, Lifeng Shang, Jing Jin, Xin Jiang, Qun Liu, Michael Lyu, and Irwin King. Binarybert: Pushing the limit of bert quantization. arXiv preprint arXiv:2012.15701, 2020.
|
| 215 |
+
[2] Ron Banner, Yury Nahshan, Elad Hoffer, and Daniel Soudry. Post-training 4-bit quantization of convolution networks for rapid-deployment. arXiv preprint arXiv:1810.05723, 2018.
|
| 216 |
+
[3] Yaohui Cai, Zhewei Yao, Zhen Dong, Amir Gholami, Michael W Mahoney, and Kurt Keutzer. Zeroq: A novel zero shot quantization framework. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 13169–13178, 2020.
|
| 217 |
+
[4] Nicolas Carion, Francisco Massa, Gabriel Synnaeve, Nicolas Usunier, Alexander Kirillov, and Sergey Zagoruyko. End-to-end object detection with transformers. arXiv preprint arXiv:2005.12872, 2020.
|
| 218 |
+
[5] 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 preprint arXiv:2012.00364, 2020.
|
| 219 |
+
[6] Mark Chen, Alec Radford, Rewon Child, Jeffrey Wu, Heewoo Jun, David Luan, and Ilya Sutskever. Generative pretraining from pixels. In International Conference on Machine Learning, pages 1691–1703. PMLR, 2020.
|
| 220 |
+
[7] Jungwook Choi, Zhuo Wang, Swagath Venkataramani, Pierce I-Jen Chuang, Vijayalakshmi Srinivasan, and Kailash Gopalakrishnan. Pact: Parameterized clipping activation for quantized neural networks. arXiv preprint arXiv:1805.06085, 2018.
|
| 221 |
+
[8] Yoni Choukroun, Eli Kravchik, Fan Yang, and Pavel Kisilev. Low-bit quantization of neural networks for efficient inference. In ICCV Workshops, pages 3009–3018, 2019.
|
| 222 |
+
[9] M. Courbariaux, I. Hubara, D. Soudry, R. El-Yaniv, and Y. Bengio. Binarized neural networks: Training deep neural networks with weights and activations constrained $^ \mathrm { t o + 1 }$ or-1. arXiv preprint arXiv:1602.02830, 2016.
|
| 223 |
+
[10] Zhen Dong, Zhewei Yao, Yaohui Cai, Daiyaan Arfeen, Amir Gholami, Michael W. Mahoney, and Kurt Keutzer. Hawq-v2: Hessian aware trace-weighted quantization of neural networks. arXiv preprint arXiv:1911.03852, 2019.
|
| 224 |
+
[11] Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, et al. arXiv:2010.11929, 2020.
|
| 225 |
+
[12] Angela Fan, Pierre Stock, Benjamin Graham, Edouard Grave, Rémi Gribonval, Hervé Jégou, and Armand Joulin. Training with quantization noise for extreme model compression. arXiv e-prints, pages arXiv–2004, 2020.
|
| 226 |
+
[13] Kai Han, Yunhe Wang, Hanting Chen, Xinghao Chen, Jianyuan Guo, Zhenhua Liu, Yehui Tang, An Xiao, Chunjing Xu, Yixing Xu, et al. A survey on visual transformer. arXiv preprint arXiv:2012.12556, 2020.
|
| 227 |
+
[14] Kai Han, Yunhe Wang, Yixing Xu, Chunjing Xu, Enhua Wu, and Chang Xu. Training binary neural networks through learning with noisy supervision. In International Conference on Machine Learning, pages 4017–4026. PMLR, 2020.
|
| 228 |
+
[15] Kai Han, An Xiao, Enhua Wu, Jianyuan Guo, Chunjing Xu, and Yunhe Wang. Transformer in transformer. arXiv preprint arXiv:2103.00112, 2021.
|
| 229 |
+
[16] 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.
|
| 230 |
+
[17] Jacob Devlin Ming-Wei Chang Kenton and Lee Kristina Toutanova. Bert: Pre-training of deep bidirectional transformers for language understanding. In Proceedings of NAACL-HLT, pages 4171–4186, 2019.
|
| 231 |
+
[18] Rundong Li, Yan Wang, Feng Liang, Hongwei Qin, Junjie Yan, and Rui Fan. Fully quantized network for object detection. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 2810–2819, 2019.
|
| 232 |
+
[19] Zhuang Liu, Jianguo Li, Zhiqiang Shen, Gao Huang, Shoumeng Yan, and Changshui Zhang. Learning efficient convolutional networks through network slimming. In Proceedings of the IEEE International Conference on Computer Vision, pages 2736–2744, 2017.
|
| 233 |
+
[20] Markus Nagel, Rana Ali Amjad, Mart Van Baalen, Christos Louizos, and Tijmen Blankevoort. Up or down? adaptive rounding for post-training quantization. In International Conference on Machine Learning, pages 7197–7206. PMLR, 2020.
|
| 234 |
+
[21] Markus Nagel, Mart van Baalen, Tijmen Blankevoort, and Max Welling. Data-free quantization through weight equalization and bias correction. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 1325–1334, 2019.
|
| 235 |
+
[22] Gabriele Prato, Ella Charlaix, and Mehdi Rezagholizadeh. Fully quantized transformer for improved translation. 2019.
|
| 236 |
+
[23] 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.
|
| 237 |
+
[24] Wonyong Sung, Sungho Shin, and Kyuyeon Hwang. Resiliency of deep neural networks under quantization. arXiv preprint arXiv:1511.06488, 2015.
|
| 238 |
+
[25] Yehui Tang, Kai Han, Chang Xu, An Xiao, Yiping Deng, Chao Xu, and Yunhe Wang. Augmented shortcuts for vision transformers. arXiv preprint arXiv:2106.15941, 2021.
|
| 239 |
+
[26] Hugo Touvron, Matthieu Cord, Matthijs Douze, Francisco Massa, Alexandre Sablayrolles, and Hervé Jégou. Training data-efficient image transformers & distillation through attention. arXiv preprint arXiv:2012.12877, 2020.
|
| 240 |
+
[27] Kuan Wang, Zhijian Liu, Yujun Lin, Ji Lin, and Song Han. Haq: Hardware-aware automated quantization with mixed precision. In 2019 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pages 8612–8620, 2019.
|
| 241 |
+
[28] Peisong Wang, Qiang Chen, Xiangyu He, and Jian Cheng. Towards accurate post-training network quantization via bit-split and stitching. In International Conference on Machine Learning, pages 9847–9856. PMLR, 2020.
|
| 242 |
+
[29] Yunhe Wang, Chang Xu, Shan You, Dacheng Tao, and Chao Xu. Cnnpack: Packing convolutional neural networks in the frequency domain. In NIPS, volume 1, page 3, 2016.
|
| 243 |
+
[30] Di Wu, Qi Tang, Yongle Zhao, Ming Zhang, Ying Fu, and Debing Zhang. Easyquant: Posttraining quantization via scale optimization. arXiv preprint arXiv:2006.16669, 2020.
|
| 244 |
+
[31] Zhanghao Wu, Zhijian Liu, Ji Lin, Yujun Lin, and Song Han. Lite transformer with long-short range attention. arXiv preprint arXiv:2004.11886, 2020.
|
| 245 |
+
[32] Yixing Xu, Kai Han, Chang Xu, Yehui Tang, Chunjing Xu, and Yunhe Wang. Learning frequency domain approximation for binary neural networks. arXiv preprint arXiv:2103.00841, 2021.
|
| 246 |
+
[33] Ali Hadi Zadeh, Isak Edo, Omar Mohamed Awad, and Andreas Moshovos. Gobo: Quantizing attention-based nlp models for low latency and energy efficient inference. In 2020 53rd Annual IEEE/ACM International Symposium on Microarchitecture (MICRO), pages 811–824. IEEE, 2020.
|
| 247 |
+
[34] Ofir Zafrir, Guy Boudoukh, Peter Izsak, and Moshe Wasserblat. Q8bert: Quantized 8bit bert. arXiv preprint arXiv:1910.06188, 2019.
|
| 248 |
+
[35] Wei Zhang, Lu Hou, Yichun Yin, Lifeng Shang, Xiao Chen, Xin Jiang, and Qun Liu. Ternarybert: Distillation-aware ultra-low bit bert. arXiv preprint arXiv:2009.12812, 2020.
|
| 249 |
+
[36] Ritchie Zhao, Yuwei Hu, Jordan Dotzel, Chris De Sa, and Zhiru Zhang. Improving neural network quantization without retraining using outlier channel splitting. In International conference on machine learning, pages 7543–7552. PMLR, 2019.
|
| 250 |
+
[37] Zhisheng Zhong, Fangyin Wei, Zhouchen Lin, and Chao Zhang. Ada-tucker: Compressing deep neural networks via adaptive dimension adjustment tucker decomposition. Neural Networks, 110:104–115, 2019.
|
| 251 |
+
[38] Chenzhuo Zhu, Song Han, Huizi Mao, and William J Dally. Trained ternary quantization. arXiv preprint arXiv:1612.01064, 2016.
|
| 252 |
+
[39] Xizhou Zhu, Weijie Su, Lewei Lu, Bin Li, Xiaogang Wang, and Jifeng Dai. Deformable detr: Deformable transformers for end-to-end object detection. arXiv preprint arXiv:2010.04159, 2020.
|