Datasets:
Add files using upload-large-folder tool
Browse files- parse/train/S1gOpsCctm/S1gOpsCctm.md +239 -0
- parse/train/S1gOpsCctm/S1gOpsCctm_content_list.json +1342 -0
- parse/train/S1gOpsCctm/S1gOpsCctm_middle.json +0 -0
- parse/train/S1gOpsCctm/S1gOpsCctm_model.json +0 -0
- parse/train/S1q_Cz-Cb/S1q_Cz-Cb.md +508 -0
- parse/train/S1q_Cz-Cb/S1q_Cz-Cb_content_list.json +0 -0
- parse/train/S1q_Cz-Cb/S1q_Cz-Cb_middle.json +0 -0
- parse/train/S1q_Cz-Cb/S1q_Cz-Cb_model.json +0 -0
- parse/train/Sks9_ajex/Sks9_ajex.md +271 -0
- parse/train/Sks9_ajex/Sks9_ajex_content_list.json +1461 -0
- parse/train/Sks9_ajex/Sks9_ajex_middle.json +0 -0
- parse/train/Sks9_ajex/Sks9_ajex_model.json +0 -0
- parse/train/rJevYoA9Fm/rJevYoA9Fm.md +356 -0
- parse/train/rJevYoA9Fm/rJevYoA9Fm_content_list.json +1863 -0
- parse/train/rJevYoA9Fm/rJevYoA9Fm_middle.json +0 -0
- parse/train/rJevYoA9Fm/rJevYoA9Fm_model.json +0 -0
- parse/train/rkgNKkHtvB/rkgNKkHtvB.md +274 -0
- parse/train/rkgNKkHtvB/rkgNKkHtvB_content_list.json +1316 -0
- parse/train/rkgNKkHtvB/rkgNKkHtvB_middle.json +0 -0
- parse/train/rkgNKkHtvB/rkgNKkHtvB_model.json +0 -0
parse/train/S1gOpsCctm/S1gOpsCctm.md
ADDED
|
@@ -0,0 +1,239 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# LEARNING FINITE STATE REPRESENTATIONS OF RECURRENT POLICY NETWORKS
|
| 2 |
+
|
| 3 |
+
Anurag Koul & Alan Fern
|
| 4 |
+
School of EECS
|
| 5 |
+
Oregon State University
|
| 6 |
+
Corvallis, Oregon, USA
|
| 7 |
+
{koula,alan.fern}@oregonstate.edu
|
| 8 |
+
Sam Greydanus ∗
|
| 9 |
+
Google Brain
|
| 10 |
+
Mountain View, California, USA
|
| 11 |
+
sgrey@google.com
|
| 12 |
+
|
| 13 |
+
# ABSTRACT
|
| 14 |
+
|
| 15 |
+
Recurrent neural networks (RNNs) are an effective representation of control policies for a wide range of reinforcement and imitation learning problems. RNN policies, however, are particularly difficult to explain, understand, and analyze due to their use of continuous-valued memory vectors and observation features. In this paper, we introduce a new technique, Quantized Bottleneck Insertion, to learn finite representations of these vectors and features. The result is a quantized representation of the RNN that can be analyzed to improve our understanding of memory use and general behavior. We present results of this approach on synthetic environments and six Atari games. The resulting finite representations are surprisingly small in some cases, using as few as 3 discrete memory states and 10 observations for a perfect Pong policy. We also show that these finite policy representations lead to improved interpretability.
|
| 16 |
+
|
| 17 |
+
# 1 INTRODUCTION
|
| 18 |
+
|
| 19 |
+
Deep reinforcement learning (RL) and imitation learning (IL) have demonstrated impressive performance across a wide range of applications. Unfortunately, the learned policies are difficult to understand and explain, which limits the degree that they can be trusted and used in high-stakes applications. Such explanations are particularly problematic for policies represented as recurrent neural networks (RNNs) (Mnih et al., 2016; Mikolov et al., 2010), which are increasingly used to achieve state-of-the-art performance (Mnih et al., 2015; Silver et al., 2017). This is because RNN policies use internal memory to encode features of the observation history, which are critical to their decision making, but extremely difficult to interpret. In this paper, we take a step towards comprehending and explaining RNN policies by learning more compact memory representations.
|
| 20 |
+
|
| 21 |
+
Explaining RNN memory is challenging due to the typical use of high-dimensional continuous memory vectors that are updated through complex gating networks (e.g. LSTMs, GRUs (Hochreiter & Schmidhuber, 1997; Chung et al., 2014; Cho et al., 2014)). We hypothesize that, in many cases, the continuous memory is capturing and updating one or more discrete concepts. If exposed, such concepts could significantly aid explainability. This motivates attempting to quantize the memory and observation representation used by an RNN to more directly capture those concepts. In this case, understanding the memory use can be approached by manipulating and analyzing the quantized system. Of course, not all RNN policies will have compact quantized representations, but many powerful forms of memory usage can be captured in this way.
|
| 22 |
+
|
| 23 |
+
Our main contribution is to introduce an approach for transforming an RNN policy with continuous memory and continuous observations to a finite-state representation known as a Moore Machine. To accomplish this we introduce the idea of Quantized Bottleneck Network (QBN) insertion. QBNs are simply auto-encoders, where the latent representation is quantized. Given a trained RNN, we train QBNs to encode the memory states and observation vectors that are encountered during the RNN operation. We then insert the QBNs into the trained RNN policy in place of the “wires” that propagated the memory and observation vectors. The combination of the RNN and QBN results in a policy represented as a Moore Machine Network (MMN) with quantized memory and observations that is nearly equivalent to the original RNN. The MMN can be used directly or fine-tuned to improve on inaccuracies introduced by QBN insertion.
|
| 24 |
+
|
| 25 |
+
While training quantized networks is often considered to be quite challenging, we show that a simple approach works well in the case of QBNs. In particular, we demonstrate that “straight through” gradient estimators as in (Bengio et al., 2013; Courbariaux et al., 2016) are quite effective.
|
| 26 |
+
|
| 27 |
+
We present experiments in synthetic domains designed to exercise different types of memory use as well as benchmark grammar learning problems. Our approach is able to accurately extract the ground-truth MMNs, providing insight into the RNN memory use. We also did experiments on 6 Atari games using RNNs that achieve state-of-the-art performance. We show that in most cases it is possible to extract near-equivalent MMNs and that the MMNs can be surprisingly small. Further, the extracted MMNs give insights into the memory usage that are not obvious based on just observing the RNN policy in action. For example, we identify games where the RNNs do not use memory in a meaningful way, indicating the RNN is implementing purely reactive control. In contrast, in other games, the RNN does not use observations in a meaningful way, which indicates that the RNN is implementing an open-loop controller.
|
| 28 |
+
|
| 29 |
+
# 2 RELATED WORK
|
| 30 |
+
|
| 31 |
+
There have been efforts made in the past to understand the internals of Recurrent Networks (Karpathy et al., 2015; Arras et al., 2017; Strobelt et al., 2016; Murdoch & Szlam, 2017; Jacobsson, 2005; Omlin & Giles, 1996). However, to the best of our knowledge there is no prior work on learning finite-memory representations of continuous RNN policies. Our work, however, is related to a large body of work on learning finite-state representations of recurrent neural networks. Below we summarize the branches of that work and the relationship to our own.
|
| 32 |
+
|
| 33 |
+
There has been a significant history of work on extracting Finite State Machines (FSMs) from recurrent networks trained to recognize languages (Zeng et al., 1993; Tino et al., 1998; Cechin et al., ˇ 2003). Typical approaches include discretizing the continuous memory space via gridding or clustering followed by minimization. A more recent approach is to use classic query-based learning algorithms to extract FSMs by asking membership and equivalence queries (Weiss et al., 2017). However, none of these approaches directly apply to learning policies, which require extending to Moore Machines. In addition, all of these approaches produce an FSM approximation that is separated from the RNN and thus serve as only a proxy of the RNN behavior. Rather, our approach directly inserts discrete elements into the RNN that preserves its behavior, but allows for a finite state characterization. This insertion approach has the advantage of allowing fine-tuning and visualization using standard learning frameworks.
|
| 34 |
+
|
| 35 |
+
The work most similar to ours also focused on learning FSMs (Zeng et al., 1993). However, the approach is based on directly learning recurrent networks with finite memory, which are qualitatively similar to the memory representation of our MMNs. That work, however, focused on learning from scratch rather than aiming to describe the behavior of a continuous RNN. Our work extends that approach to learn MMNs and more importantly introduces the method of QBN insertion as a way of learning via guidance from a continuous RNN.This transforms any pre-trained recurrent policy into a finite representation.
|
| 36 |
+
|
| 37 |
+
We note that there has been prior work on learning fully binary networks, where the activation functions and/or weights are binary (e.g. (Bengio et al., 2013; Courbariaux et al., 2016; Hinton, 2012)). The goal of that line of work is typically to learn more time and space efficient networks. Rather, we focus on learning only discrete representations of memory and observations, while allowing the rest of the network to use arbitrary activations and weights. This is due to our alternative goal of supporting interpretability rather than efficiency.
|
| 38 |
+
|
| 39 |
+
# 3 RECURRENT POLICY NETWORKS: CONTINUOUS AND QUANTIZED
|
| 40 |
+
|
| 41 |
+
Recurrent neural networks (RNNs) are commonly used in reinforcement learning to represent policies that require or can benefit from internal memory. At each time step, an RNN is given an observation $o _ { t }$ (e.g. image) and must output an action $a _ { t }$ to be taken in the environment. During execution an RNN maintains a continuous-valued hidden state $h _ { t }$ , which is updated on each transition and influences the action choice. In particular, given the current observation $o _ { t }$ and current state $h _ { t }$ , an RNN performs the following operations: 1) Extract a set of observation features $f _ { t }$ from $o _ { t }$ , for example, using a CNN when observations are images, 2) Outputting an action $a _ { t } = \pi ( h _ { t } )$ according to policy $\pi$ , which is often a linear softmax function of $h _ { t }$ , 3) transition to a new state $h _ { t + 1 } = \bar { \delta } ( f _ { t } , \mathsf { \bar { h } } _ { t } )$ where $\delta$ is the transition function, which is often implemented via different types of gating networks such as LSTMs or GRUs.
|
| 42 |
+
|
| 43 |
+
The continuous and high dimensional nature of $h _ { t }$ and $f _ { t }$ can make interpreting the role of memory difficult. This motivates our goal of extracting compact quantized representations of $h _ { t }$ and $f _ { t }$ . Such representations have the potential to allow investigating a finite system that captures the key features of the memory and observations. For this purpose we introduce Moore Machines and their deep network counterparts.
|
| 44 |
+
|
| 45 |
+
Moore Machines. A classical Moore Machine (MM) is a standard finite state machine where all states are labeled by output values, which in our case will correspond to actions. In particular, a Moore Machine is described by a finite set of (hidden) states $\hat { H }$ , an initial hidden state $\hat { h } _ { 0 }$ , a finite set of observations $\hat { O }$ , a finite set of actions $A$ , a transition function $\hat { \delta }$ , and a policy $\hat { \pi }$ that maps hidden states to actions. The transition function $\hat { \delta } : \hat { H } \times \hat { O } \hat { H }$ returns the next hidden state $\hat { h } _ { t + 1 } = \hat { \delta } ( \hat { h } _ { t } , \hat { o } _ { t } )$ given the current state $\hat { h } _ { t }$ and observation $\hat { o } _ { t }$ . By convention we will use $h _ { t }$ and $\hat { h } _ { t }$ to denote continuous and discrete states respectively and similarly for other quantities and functions.
|
| 46 |
+
|
| 47 |
+
Moore Machine Networks. A Moore Machine Network (MMN) is a Moore Machine where the transition function $\hat { \delta }$ and policy $\hat { \pi }$ are represented via deep networks. In addition, since the raw observations given to an MMN are often continuous, or from an effectively unbounded set (e.g. images), an MMN will also provide a mapping $\hat { g }$ from the continuous observations to a finite discrete observation space $\hat { O }$ . Here $\hat { g }$ will also be represented via a deep network. In this work, we consider quantized state and observation representations where each $\hat { h } \in \hat { H }$ is a discrete vector and each discrete observation in $\hat { O }$ is a discrete vector that describes the raw observation. We will denote the quantization level as $k$ and the dimensions of $\hat { h }$ and $\hat { f }$ by $B _ { h }$ and $B _ { f }$ respectively.
|
| 48 |
+
|
| 49 |
+
Based on the above discussion, an MMN can be viewed as a traditional RNN, where: 1) The memory is restricted to be composed of $k$ -level activation units, and 2) The environmental observations are intermediately transformed to a $k$ -level representation $\hat { f }$ before being fed to the recurrent module. Given an approach for incorporating quantized units into the backpropagation process, it is straightforward, in concept, to learn MMNs from scratch via standard RNN learning algorithms. However, we have found that learning MMNs from scratch can be quite difficult for non-trivial problems, even when an RNN can be learned with relative ease. For example, we have not been able to train highperforming MMNs from scratch for Atari games. Below we introduce a new approach for learning MMNs that is able to leverage the ability to learn RNNs.
|
| 50 |
+
|
| 51 |
+
# 4 LEARNING MOORE MACHINE NETWORKS FROM RNNS
|
| 52 |
+
|
| 53 |
+
Given a trained RNN, our key idea is to first learn quantized bottleneck networks (QBNs) for embedding the continuous observation features and hidden state into a $k$ -level quantized representation. We will then insert the QBNs into the original recurrent net in such a way that its behavior is minimally changed with the option of fine-tuning after insertion. The resulting network can be viewed as consuming quantized features and maintaining quantized state, which is effectively an MMN. Below we describe the steps in further detail, which are illustrated in Figure 1.
|
| 54 |
+
|
| 55 |
+
# 4.1 QUANTIZED BOTTLENECK NETWORKS
|
| 56 |
+
|
| 57 |
+
A QBN is simply an autoencoder where the latent representation between the encoder and decoder (i.e. the bottleneck) is constrained to be composed of $k$ -level activation units. While, traditional autoencoders are generally used for the purpose of dimensionality reduction in continuous space (Hinton & Salakhutdinov, 2006), QBNs are motivated by the goal of discretizing a continuous space. Conceptually, this can be done by quantizing the activations of units in the encoding layer.
|
| 58 |
+
|
| 59 |
+

|
| 60 |
+
Figure 1: Learning Moore Machine Networks. (1.) Learn an RNN policy. (2.) Learn QBN’s to quantize memory and observations. (3.) Insertion and Fine Tuning. The modules labelled O, R are observation feature-extraction and recurrent modules, respectively
|
| 61 |
+
|
| 62 |
+
We represent a QBN via a continuous multilayer encoder $E$ , which maps inputs $x$ to a latent encoding $E ( x )$ , and a corresponding multilayer decoder $D$ . To quantize the encoding, the QBN output is given by
|
| 63 |
+
|
| 64 |
+
$$
|
| 65 |
+
b ( x ) = D ( { \mathrm { q u a n t i z e } } ( E ( x ) ) )
|
| 66 |
+
$$
|
| 67 |
+
|
| 68 |
+
In our case, we use 3-level quantization in the form of $+ 1 , 0$ and $- 1$ using the quantize function, which assumes the outputs of $E ( x )$ are in the range $[ - 1 , 1 ]$ .1 One choice for the output nodes of $E ( x )$ would be the tanh activation. However, since the gradient of tanh is close to 1 near 0, it can be difficult to produce quantization level 0 during learning. Thus, as suggested in Pitis (2017), to support 3-valued quantization we use the following activation function, which is flatter in the region around zero input.
|
| 69 |
+
|
| 70 |
+
$$
|
| 71 |
+
\phi ( x ) = 1 . 5 \operatorname { t a n h } ( x ) + 0 . 5 \operatorname { t a n h } ( - 3 x )
|
| 72 |
+
$$
|
| 73 |
+
|
| 74 |
+
Of course introducing the quantize function in the QBN results in $b ( x )$ being non-differentiable, making it apparently incompatible with backpropagation, since the gradients between the decoder and encoder will almost always be zero. While there are a variety of ways to deal with this issue, we have found that the straight-through estimator, as suggested and used in prior work (Hinton, 2012; Bengio et al., 2013; Courbariaux et al., 2016) is quite effective. In particular, the standard straightthrough estimator of the gradient simply treats the quantize function as the identity function during back-propagation. Overall, the inclusion of the quantize function in the QBN effectively allows us to view the last layer of $E$ as producing a $k$ -level encoding. We train a QBN as an autoencoder using the standard $L _ { 2 }$ reconstruction error $\| x - b ( x ) \| ^ { 2 }$ for a given input $x$ .
|
| 75 |
+
|
| 76 |
+
# 4.2 BOTTLENECK INSERTION
|
| 77 |
+
|
| 78 |
+
Given a recurrent policy we can run the policy in the target environment in order to produce an arbitrarily large set of training sequences of triples $\left( o _ { t } , f _ { t } , h _ { t } \right)$ , giving the observation, corresponding observation feature, and hidden state at time $t$ . Let $F$ and $H$ be the sets of all observed features and states respectively. The first step of our approach is to train two QBNs, $b _ { f }$ and $b _ { h }$ , on $F$ and $H$ respectively. If the QBNs are able to achieve low reconstruction error then we can view latent “bottlenecks” of the QBNs as a high-quality $k$ -level encodings of the original hidden states and features.
|
| 79 |
+
|
| 80 |
+
We now view $b _ { f }$ and $b _ { h }$ as “wires” that propagate the input to the output, with some noise due to imperfect reconstruction. We insert these wires into the original RNN in the natural way (stage-3 in Figure 1). The $b _ { f }$ QBN is inserted between the RNN units that compute the features $f$ and the nodes those units are connected to. The $b _ { h }$ QBN is inserted between the output of the recurrent network block and the input to the recurrent block. If $b _ { f }$ and $b _ { h }$ always produced perfect reconstructions, then the result of inserting them as described would not change the behavior of the RNN. Yet, the RNN can now be viewed as an MMN since the bottlenecks of $b _ { f }$ and $b _ { h }$ provide a quantized representation of the features $f _ { t }$ and states $h _ { t }$ .
|
| 81 |
+
|
| 82 |
+
Fine Tuning. In practice, the QBNs will not achieve perfect reconstruction and thus, the resulting MMN may not behave identically to the original RNN. Empirically, we have found that the performance of the resulting MMN is often very close to the RNN directly after insertion. However, when there is non-trivial performance degradation, we can fine-tune the MMN by training on the original rollout data of the RNN. Importantly, since our primary goal is to learn a representation of the original RNN, during fine-tuning our objective is to have the MMN match the softmax distribution over actions produced by the RNN. We found that training in this way was significantly more stable than training the MMN to simply output the same action as the RNN.
|
| 83 |
+
|
| 84 |
+
# 4.3 MOORE MACHINE EXTRACTION AND MINIMIZATION
|
| 85 |
+
|
| 86 |
+
After obtaining the MMN, one could use visualization and other analysis tools to investigate the memory and it’s feature bits in order to gain a semantic understanding of their roles. Solving the full interpretation problem in a primitive way is beyond the scope of this work.
|
| 87 |
+
|
| 88 |
+
Extraction. Another way to gain insight is to use the MMN to produce an equivalent Moore Machine over atomic state and observation spaces, where each state and observation is a discrete symbol. This machine can be analyzed to understand the role of different machine states and how they are related. In order to create the Moore Machine we run the learned MMN to produce a dataset of $< \hat { h } _ { t - 1 } , \hat { f } _ { t } , \hat { h } _ { t } , a _ { t } > ,$ , giving the consecutive pairs of quantized states, the quantized features that led to the transition, and the action selected after the transition. The state-space of the Moore Machine will correspond to the $p$ distinct quantized states in the data and the observation-space of the machine will be the $q$ unique quantized feature vectors in the data. The transition function of the machine $\hat { \delta }$ is constructed from the data by producing a $p \times q$ transaction table that captures the transitions seen in the data.
|
| 89 |
+
|
| 90 |
+
Minimization. In general, the number of states $p$ in the resulting Moore Machine will be larger than necessary in the sense that there is a much smaller, but equivalent, minimal machine. Thus, we apply standard Moore Machine minimization techniques to arrive at the minimal2 equivalent Moore Machine (Paull & Unger, 1959). This often dramatically reduces the number of distinct states and observations.
|
| 91 |
+
|
| 92 |
+
# 5 SYNTHETIC EXPERIMENTS
|
| 93 |
+
|
| 94 |
+
Our experiments address the following questions: 1) Is it possible to extract MMNs from RNNs without significant loss in Performance? 2) What is the general magnitude of the number of states and observations in the minimal machines, especially for complex domains such as Atari? 3) Do the learned MMNs help with interpretability of the recurrent policies? In this section, we begin addressing these questions by considering two domains where ground truth Moore Machines are known. The first is a parameterized synthetic environment, Mode Counter, which can capture multiple types of memory use. Second, we consider benchmark grammar learning problems.
|
| 95 |
+
|
| 96 |
+
# 5.1 MODE COUNTER
|
| 97 |
+
|
| 98 |
+
The class of Mode Counter Environments (MCEs) allows us to vary the amount of memory required by a policy (including no memory) and the required type of memory usage. In particular, MCEs can require varying amounts of memory for remembering past events and implementing internal counters.
|
| 99 |
+
|
| 100 |
+
An MCE is a restricted type of Partially Observable Markov Decision Process, which transitions between one of $M$ modes over time according to a transition distribution, which can depend on the current mode and amount of time spent in the current mode. There are $M$ actions, one for each mode, and the agent receives a reward of $+ 1$ at the end of the episode if it takes the correct action associated with the active mode at each time step. The agent does not observe the mode directly, but rather must infer the mode via a combination of observations and memory use. Different parameterizations place different requirements on how (and if) memory needs to be used to infer the mode and achieve optimal performance. Below we give an intuitive description of the $\mathbf { M C E s } ^ { 3 }$ in our experiments.
|
| 101 |
+
|
| 102 |
+
We conduct experiments in three MCE instances, which use memory and observations in fundamentally different ways. This tests our ability to use our approach for determining the type of memory use. 1) Amnesia. This MCE is designed so that the optimal policy does not need memory to track past information and can select optimal actions based on just the current observation. 2) Blind. Here we consider the opposite extreme, where the MCE observations provide no information about optimal actions. Rather, memory must be used to implement counters that keep track of a deterministic mode sequence for determining the optimal actions. 3) Tracker. This MCE is designed so that the optimal policy must both use observations and memory in order to select optimal actions. Intuitively the memory must implement counters that keep track of key time steps where the observations provide information about the mode. In all above instances, we used $M = 4$ modes.
|
| 103 |
+
|
| 104 |
+
RNN Training. For each MCE instance we use the following recurrent architecture: the input feeds into 1 feed-forward layer with 4 Relu6 nodes (Krizhevsky & Hinton, 2010) $( f _ { t } )$ , followed by a 1-layer GRU with 8 hidden units $\left( { { h _ { t } } } \right)$ , followed by a fully connected softmax layer giving a distribution over the $M$ actions (one per mode). Since we know the optimal policy in the MCEs we use imitation learning for training. For all of the MCEs in our experiments, the trained RNNs achieve $100 \%$ accuracy on the imitation dataset and appeared to produce optimal policies.
|
| 105 |
+
|
| 106 |
+
MMN Training. The observation QBN $b _ { f }$ and hidden-state QBN $b _ { h }$ have the same architecture, except that the number of quantized bottleneck units $B _ { f }$ and $B _ { h }$ are varied in our experiments. The encoders consist of 1 feed-forward layer of tanh nodes, where the number of nodes is 4 times the size of the bottleneck. This layer feeds into 1 feedforward layer of quantized bottleneck nodes (see Section 4). The decoder for both $b _ { f }$ and $b _ { h }$ has a symmetric architecture to the encoder. Training of $b _ { f }$ and $b _ { h }$ in the MCE environments was extremely fast compared to the RNN training, since QBNs do not need to learn temporal dependencies. We trained QBNs with bottleneck sizes of $B _ { f } \in \{ 4 , 8 \}$ and $B _ { h } \in \{ 4 , 8 \}$ . For each combination of $B _ { f }$ and $B _ { h }$ we embedded the QBNs into the RNN to give a discrete MMN and then measured performance of the MMN before and after fine tuning. Table 1 gives the average test score over 50 test episodes. Score of 1 indicates the agent performed optimally for all episodes. In most of the cases no fine tuning was required (marked as ’-’) since the agent achieved perfect performance immediately after bottleneck insertion due to low reconstruction error. In all other cases, except for Tracker $B _ { h } = 4$ , $B _ { f } = 4 _ { . }$ ) fine-tuning resulted in perfect MMN performance. The exception yielded $98 \%$ accuracy. Interestingly in that case, we see that if we only insert one of the bottlenecks at a time, we yield perfect performance, which indicates that the combined error accumulation of the two bottlenecks is responsible for the reduced performance.
|
| 107 |
+
|
| 108 |
+
Moore Machine Extraction. Table 1 also gives the number of states and observations of the MMs extracted from the MMNs both before and after minimization. Recall that the number of states and obsevations before minimization is the number of distinct combinations of values observed for the bottleneck nodes during long executions of the MMN. We see that there are typically significantly more states and observations before minimization than after. This indicates that the MMN learning does not necessarily learn minimal discrete state and observation representations, though the representations accurately describe the RNN. After minimization (Section 4.3), however, in all but one case we get exact minimal machines for each MCE domain. The ground truth minimal machines that are found are shown in the Appendix (Figure 3). This shows that the MMNs learned via QBN insertions were equivalent to the true minimal machines and hence indeed optimal in most cases. The exception matches the case where the MMN did not achieve perfect accuracy.
|
| 109 |
+
|
| 110 |
+
Examining these machines allows one to understand the memory use. For example, the machine for Blind has just a single observation symbol and hence its transitions cannot depend on the input observations. In contrast, the machine for Amnesia shows that each distinct observation symbol leads to the same state (and hence action choice) regardless of the source state. Thus, the policies action is completely determined by the current observation.
|
| 111 |
+
|
| 112 |
+
Table 1: Moore Machine extraction for MCE
|
| 113 |
+
|
| 114 |
+
<table><tr><td rowspan=2 colspan=1>Game</td><td rowspan=2 colspan=1>Bh,Bf</td><td rowspan=1 colspan=2>Fine-TuningScore</td><td rowspan=1 colspan=3>BeforeMinimization</td><td rowspan=1 colspan=3>AfterMinimization</td></tr><tr><td rowspan=1 colspan=1>Before(%)</td><td rowspan=1 colspan=1>After(%)</td><td rowspan=1 colspan=1>H</td><td rowspan=1 colspan=1>0</td><td rowspan=1 colspan=1>Acc.(%)</td><td rowspan=1 colspan=1>H</td><td rowspan=1 colspan=1>|0|</td><td rowspan=1 colspan=1>Acc.(%)</td></tr><tr><td rowspan=3 colspan=1>Amnesia</td><td rowspan=2 colspan=1>4,44,8</td><td rowspan=2 colspan=1>0.980.99</td><td rowspan=2 colspan=1>11</td><td rowspan=2 colspan=1>77</td><td rowspan=2 colspan=1>57</td><td rowspan=1 colspan=1>1</td><td rowspan=2 colspan=1>44</td><td rowspan=2 colspan=1>44</td><td rowspan=2 colspan=1>11</td></tr><tr><td rowspan=1 colspan=1>1</td></tr><tr><td rowspan=1 colspan=1>8,48,8</td><td rowspan=1 colspan=1>10.99</td><td rowspan=1 colspan=1>-1</td><td rowspan=1 colspan=1>67</td><td rowspan=1 colspan=1>57</td><td rowspan=1 colspan=1>11</td><td rowspan=1 colspan=1>44</td><td rowspan=1 colspan=1>44</td><td rowspan=1 colspan=1>11</td></tr><tr><td rowspan=2 colspan=1>Blind</td><td rowspan=1 colspan=1>4,44,8</td><td rowspan=1 colspan=1>11</td><td rowspan=1 colspan=1>-1</td><td rowspan=1 colspan=1>1212</td><td rowspan=1 colspan=1>68</td><td rowspan=1 colspan=1>11</td><td rowspan=1 colspan=1>1010</td><td rowspan=1 colspan=1>11</td><td rowspan=1 colspan=1>11</td></tr><tr><td rowspan=1 colspan=1>8,48,8</td><td rowspan=1 colspan=1>10.78</td><td rowspan=1 colspan=1>-1</td><td rowspan=1 colspan=1>513</td><td rowspan=1 colspan=1>68</td><td rowspan=1 colspan=1>11</td><td rowspan=1 colspan=1>1010</td><td rowspan=1 colspan=1>11</td><td rowspan=1 colspan=1>11</td></tr><tr><td rowspan=4 colspan=1>Tracker</td><td rowspan=2 colspan=1>4,44,8</td><td rowspan=2 colspan=1>0.980.99</td><td rowspan=2 colspan=1>0.981</td><td rowspan=2 colspan=1>5823</td><td rowspan=2 colspan=1>55</td><td rowspan=2 colspan=1>0.981</td><td rowspan=2 colspan=1>5010</td><td rowspan=1 colspan=1>4</td><td rowspan=1 colspan=1>0.98</td></tr><tr><td rowspan=1 colspan=1>4</td><td rowspan=1 colspan=1>1</td></tr><tr><td rowspan=2 colspan=1>8,48,8</td><td rowspan=2 colspan=1>0.980.99</td><td rowspan=2 colspan=1>11</td><td rowspan=2 colspan=1>9185</td><td rowspan=2 colspan=1>55</td><td rowspan=2 colspan=1>11</td><td rowspan=2 colspan=1>1010</td><td rowspan=1 colspan=1>4</td><td rowspan=2 colspan=1>11</td></tr><tr><td rowspan=1 colspan=1>4</td></tr></table>
|
| 115 |
+
|
| 116 |
+
# 5.2 TOMITA GRAMMARS
|
| 117 |
+
|
| 118 |
+
The Tomita Grammars are popular benchmarks for learning finite state machines (FSMs), including work on extracting FSMs from RNNs (e.g. (Watrous & Kuhn, 1992; Weiss et al., 2017)). Here we evaluate our approach over the 7 Tomita Grammars4, where each grammar defines the set of binary strings that should be accepted or rejected. Since, our focus is on policy learning problems, we treat the grammars as environments with two actions ‘accept’ and ‘reject’. Each episode corresponds to a random string that is either part of the particular grammar or not. The agent receives a reward of 1 if the correct action accept/reject is chosen on the last symbol of a string.
|
| 119 |
+
|
| 120 |
+
RNN Training. The RNN for each grammar is comprised of a one-layer GRU with 10 hidden units, followed by a fully connected softmax layer with 2 nodes (accept/reject). Since we know the optimal policy, we again use imitation learning to train each RNN using the Adam optimizer and learning rate of 0.001. The training dataset is comprised of an equal number of accept/reject strings with lengths uniformly sampled in the range [1,50]. Table 2 presents the test results for the trained RNNs giving the accuracy over a test set of 100 strings drawn from the same distribution as used for training. Other than grammar $\# 6 ^ { 5 }$ , the RNNs were $100 \%$ accurate.
|
| 121 |
+
|
| 122 |
+
MMN Training. Since the raw observations for this problem are from a finite alphabet, we don’t need to employ a bottleneck encoder to discretize the observation features. Thus the only bottleneck learned here is $b _ { h }$ for the hidden memory state. We use the same architecture for $b _ { h }$ as used for the MCE experiments and conduct experiments with $B _ { h } \in \{ 8 , 1 6 \}$ . These bottlenecks were then inserted in the RNNs to give MMNs. The performance of the MMNs before and after fine-tuning are shared in Table 2. In almost all cases, the MMN is able to maintain the performance of the RNN without fine-tuning. Fine tuning provides only minor improvements in other cases, which already are achieving high accuracy.
|
| 123 |
+
|
| 124 |
+
Moore Machine Extraction. Our results for MM extraction and minimization are in Table 2. In each case, we see a considerable reduction in the MM’s state-space after minimization while accurately maintaining the MMN’s performance. Again, this shows that the MMN learning does not directly result in minimal machines, yet are equivalent to the minimal machines and hence are exact solutions. In all cases, except for grammar 6 the minimized machines are identical to the minimal machines that are known for these grammars (Tomita, 1982).
|
| 125 |
+
|
| 126 |
+
Table 2: Moore Machine extraction for Tomita grammar
|
| 127 |
+
|
| 128 |
+
<table><tr><td rowspan=2 colspan=1>#Grammar</td><td rowspan=2 colspan=1>RNNAcc. (%)</td><td rowspan=2 colspan=1>Bh</td><td rowspan=1 colspan=2>Fine-TuningAcc.(%)</td><td rowspan=1 colspan=2>BeforeMinimization</td><td rowspan=1 colspan=2>AfterMinimization</td></tr><tr><td rowspan=1 colspan=1>Before</td><td rowspan=1 colspan=1>After</td><td rowspan=1 colspan=1>H</td><td rowspan=1 colspan=1>Acc.(%)</td><td rowspan=1 colspan=1>A</td><td rowspan=1 colspan=1>Acc.(%)</td></tr><tr><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>100</td><td rowspan=1 colspan=1>816</td><td rowspan=1 colspan=1>100100</td><td rowspan=1 colspan=1>--</td><td rowspan=1 colspan=1>1328</td><td rowspan=1 colspan=1>100100</td><td rowspan=1 colspan=1>22</td><td rowspan=1 colspan=1>100100</td></tr><tr><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>100</td><td rowspan=1 colspan=1>816</td><td rowspan=1 colspan=1>100100</td><td rowspan=1 colspan=1>--</td><td rowspan=1 colspan=1>1314</td><td rowspan=1 colspan=1>100100</td><td rowspan=1 colspan=1>33</td><td rowspan=1 colspan=1>100100</td></tr><tr><td rowspan=1 colspan=1>3</td><td rowspan=1 colspan=1>100</td><td rowspan=1 colspan=1>816</td><td rowspan=1 colspan=1>100100</td><td rowspan=1 colspan=1>--</td><td rowspan=1 colspan=1>3439</td><td rowspan=1 colspan=1>100100</td><td rowspan=1 colspan=1>55</td><td rowspan=1 colspan=1>100100</td></tr><tr><td rowspan=1 colspan=1>4</td><td rowspan=1 colspan=1>100</td><td rowspan=1 colspan=1>816</td><td rowspan=1 colspan=1>100100</td><td rowspan=1 colspan=1>-1</td><td rowspan=1 colspan=1>1718</td><td rowspan=1 colspan=1>100100</td><td rowspan=1 colspan=1>44</td><td rowspan=1 colspan=1>100100</td></tr><tr><td rowspan=1 colspan=1>5</td><td rowspan=1 colspan=1>100</td><td rowspan=1 colspan=1>816</td><td rowspan=1 colspan=1>95100</td><td rowspan=1 colspan=1>961</td><td rowspan=1 colspan=1>192316</td><td rowspan=1 colspan=1>96100</td><td rowspan=1 colspan=1>1154</td><td rowspan=1 colspan=1>96100</td></tr><tr><td rowspan=1 colspan=1>6</td><td rowspan=1 colspan=1>99</td><td rowspan=1 colspan=1>816</td><td rowspan=1 colspan=1>9899</td><td rowspan=1 colspan=1>9899</td><td rowspan=1 colspan=1>100518</td><td rowspan=1 colspan=1>9899</td><td rowspan=1 colspan=1>1211</td><td rowspan=1 colspan=1>9899</td></tr><tr><td rowspan=1 colspan=1>7</td><td rowspan=1 colspan=1>100</td><td rowspan=1 colspan=1>816</td><td rowspan=1 colspan=1>100100</td><td rowspan=1 colspan=1>-1</td><td rowspan=1 colspan=1>25107</td><td rowspan=1 colspan=1>100100</td><td rowspan=1 colspan=1>55</td><td rowspan=1 colspan=1>100100</td></tr></table>
|
| 129 |
+
|
| 130 |
+
# 6 ATARI EXPERIMENTS
|
| 131 |
+
|
| 132 |
+
In this section, we consider applying our technique to RNNs learned for six Atari6 games using the OpenAI gym (Brockman et al., 2016). Unlike the above experiments, where we knew the ground truth MMs, for Atari we did not have any preconception of what the MMs might look and how large they might be. The fact that the input observations for Atari (i.e. images) are much more complex than the previous experiments inputs makes it completely unclear if we can expect similar types of results. There have been other recent efforts towards understanding Atari agents (Zahavy et al., 2016; Greydanus et al., 2017). However, we are not aware of any other work which aims to extract finite state representations for Atari policies.
|
| 133 |
+
|
| 134 |
+
RNN Training. All the Atari agents have the same recurrent architecture. The input observation is an image frame, preprocessed by gray-scaling, $2 \mathbf { x }$ down-sampling, cropping to an $8 0 \times 8 0$ square and normalizing the values to [0, 1]. The network has 4 convolutional layers (kernel size 3, strides 2, padding 1, and 32,32,16,4 filters respectively). We used Relu as the intermediate activation and Relu6 over the last convolutional layer. This is followed by a GRU layer with 32 hidden units and a fully connected layer with $n { + 1 }$ units, where $n$ is the dimension of the Atari action space. We applied a softmax to first $n$ neurons to obtain the policy and used the last neuron to predict the value function. We used the A3C RL algorithm (Mnih et al., 2016) (learning rate $1 0 ^ { - 4 }$ , discount factor 0.99) and computed loss on the policy using Generalized Advantage Estimation $\lambda = 1 . 0$ ) (Schulman et al., 2015). We report the trained RNN performance on our six games in the second column of Table 3.
|
| 135 |
+
|
| 136 |
+
MMN Training. We used the same general architecture for the QBN $b _ { f }$ as used for the MCE experiments, but adjusted the encoder input and decoder output sizes to match the dimension of the continuous observation features $f _ { t }$ . For $b _ { h }$ , the encoder has 3 feed-forward layers with $( 8 \times$ $B _ { h . }$ ), $( 4 \times B _ { h } )$ and $B _ { h }$ nodes. The decoder is symmetric to the encoder. For the Atari domains, the training data for $b _ { f }$ and $b _ { h }$ was generated using noisy rollouts. In particular, each training episode was generated by executing the learned RNN for a random number of steps and then executing an $\epsilon$ -greedy (with $\epsilon = 0 . 3$ ) version of the RNN policy. This is intended to increase the diversity of the training data and we found that it helps to more robustly learn the QBNs. We trained bottlenecks for
|
| 137 |
+
|
| 138 |
+
$B _ { h } \in \{ 6 4 , 1 2 8 \}$ and $B _ { f } \in \{ 1 0 0 , 4 0 0 \}$ noting that these values are significantly larger than for our earlier experiments due to the complexity of Atari. Note that while there are an enormous number of potential discrete states for these values of $B _ { h }$ the actual number of states observed and hence the number of MMN states can be substantially smaller. Each bottleneck was trained to the point of saturation of training loss and then inserted into the RNN to give an MMN for each Atari game.
|
| 139 |
+
|
| 140 |
+
MMN Performance. Table 3 gives the performance of the trained MMNs before and after finetuning for different combinations of $B _ { h }$ and $B _ { f }$ . We see that for 4 games, Pong, Freeway, Bowling, and Boxing, the MMNs after fine tuning either achieve identical scores to the RNN or very close (in the case of boxing). This demonstrates the ability to learn a discrete representation of the input and memory for these complex games with no impact on performance. We see that for Boxing and Pong fine tuning was required to match the RNN performance. In the case of Freeway and Bowling, fine-tuning was not required.
|
| 141 |
+
|
| 142 |
+
In the remaining two games, Breakout and Space Invaders, we see that the MMNs learned after fine tuning achieve lower scores than the original RNNs, though the scores are still relatively good. On further investigation, we found that this drop in performance was due to poor reconstruction on some rare parts of the game. For example, in Breakout, after the first board is cleared, the policy needs to press the fire-button to continue, but the learned MMN does not do this and instead times out, which results in less score. This motivates the investigation into more intelligent approaches for training QBNs to capture critical information in such rare, but critically important, states.
|
| 143 |
+
|
| 144 |
+
MM Minimization. We see from Table 3 that before minimization, the MMs often have relatively large numbers of discrete states and observations. This is unsurprising given that we are using relatively large values of $B _ { h }$ and $B _ { f }$ . However, we see that after minimizing the MMNs the number of states and observations reduces by orders of magnitude, sometimes to just a single state and/or single observation. The number of states and observations in many cases are small enough to write out and analyze by hand, making them amenable to careful analysis. However, this analysis is likely to be non-trivial for moderately complex policies due to the need to understand the “meaning” of the observations and in turn of the states.
|
| 145 |
+
|
| 146 |
+
Understanding Memory Use. We were surprised to observe in Atari the same three types of memory use considered for the MCE domains above. First, we see that the MM for Pong has just three states (one per action) and 10 discrete observation symbols (see Figure 2a). Most importantly we see that each observation transitions to the same state (and hence action) regardless of the current state. So we can view this MM as defining a set of rule that maps individual observations to actions with no memory necessary. In this sense, the Pong policy is analogous to the Amnesia MCE [5.1].
|
| 147 |
+
|
| 148 |
+
In contrast, we see that in both Bowling and Freeway there is only one observation symbol in the minimal MM. This means that the MM actually ignores the input image when selecting actions. Rather the policies are open-loop controllers whose action just depends on the time-step rather than the observations. Thus, these policies are analogous to the Blind MCE [5.1]. Freeway has a particularly trivial policy that always takes the Up action at each time step. While this policy behavior could have been determined by looking at the action sequence of the rollouts, it is encouraging that our MM extraction approach also discovered this. As shown in Figure 2b, Bowling has a more interesting open-loop policy structure where it has an initial sequence of actions and then a loop is entered where the action sequence is repeated. It is not immediately obvious that this policy has such an open-loop structure by just watching the policy. Thus, we can see that the MM extraction approach we use here can provide significant additional insight.
|
| 149 |
+
|
| 150 |
+
Breakout, Space Invaders and Boxing use both memory and observations based on our analysis of the MM transition structures. We have not yet attempted a full semantic analysis of the discrete observations and states for any of the Atari policies. This will require additional visualization and interaction tools and is an important direction of future work that is enabled by our approach.
|
| 151 |
+
|
| 152 |
+
# 7 SUMMARY AND FUTURE WORK
|
| 153 |
+
|
| 154 |
+
Motivated by the goal of better understanding memory use in RNN polices, we introduced an approach for extracting finite state Moore Machines from those policies. The key idea, bottleneck insertion, is to train Quantized Bottleneck Networks to produce binary encodings of continuous RNN memory and input features, and then insert those bottlenecks into the RNN. This yields a near equivalent Moore Machine Network (MMN) which has quantized memory and observation features. From the MMN we then extract a discrete Moore machine that can then be transformed into an equivalent minimal machine for analysis and usage. Our results on two environments where the ground truth machines are known show that our approach is able to accurately extract the ground truth. We also show experiments in six Atari games, where we have no prior insight into the ground truth machines. We show that, in most cases, the learned MMNs maintain similar performance to the original RNN policies. Further, the extracted machines provide insight into the memory usage of the policies. First, we see that the number of required memory states and observations is surprisingly small. Second, we can identify cases where the policy did not use memory in a significant way (e.g. Pong) and policies that relied only on memory and ignored the observations (e.g. Bowling and Freeway). To our knowledge, this is the first work where this type of insight was reported for policies in such complex domains. A key direction for future work is to develop tools and visualizations for attaching meaning to the discrete observations and in turn states, which will allow for an additional level of insight into the policies. It is also worth considering the use of tools for analyzing finite-state machine structure to gain further insight and analyze formal properties of the policies.
|
| 155 |
+
|
| 156 |
+
Table 3: Moore Machine extraction for trained Atari RNN policies. DQN (Mnih et al., 2015), A3C (Mnih et al., 2016) scores have been reported for performance comparison with trained policies.
|
| 157 |
+
|
| 158 |
+
<table><tr><td rowspan="3">Game (# of actions)</td><td rowspan="3">DQN (Score)</td><td rowspan="3">A3C LSTM (Score)</td><td rowspan="3">RNN (Score)</td><td rowspan="3">(Bh,Bf)</td><td colspan="2">Fine-Tuning Score</td><td colspan="3">Before Minimization</td><td colspan="3">After Minimization</td></tr><tr><td>Before</td><td>After</td><td>H</td><td>10</td><td>Score</td><td>间</td><td>10</td><td>Score</td></tr><tr><td>20</td><td>21</td><td>380</td><td>374</td><td>21</td><td></td><td></td><td></td></tr><tr><td rowspan="4">Pong (3)</td><td rowspan="4">18.9</td><td rowspan="4">10.7</td><td rowspan="4">21</td><td>64,100 64,400</td><td>20</td><td>21</td><td>373</td><td>372</td><td>21</td><td>4 3</td><td>12 10</td><td>21 21</td></tr><tr><td>128,100</td><td>20</td><td>21</td><td>383</td><td>373</td><td>21</td><td>3</td><td>12</td><td>21</td></tr><tr><td>128,400</td><td>20</td><td>21</td><td>379</td><td>371</td><td>21</td><td>3</td><td>11</td><td>21</td></tr><tr><td>64,100</td><td>21</td><td>:</td><td>11</td><td>11</td><td>21</td><td>11</td><td>1</td><td>21</td></tr><tr><td rowspan="3">Freeway (3)</td><td rowspan="3">30.3</td><td rowspan="3">0.1</td><td rowspan="3">21</td><td>64,400</td><td>21</td><td></td><td></td><td></td><td>21</td><td></td><td></td><td>21</td></tr><tr><td>128,100 128,400</td><td>21 21</td><td>:</td><td>1 1</td><td>1 1</td><td>21 21</td><td>11</td><td>1 1</td><td>21</td></tr><tr><td>64,100</td><td>32</td><td>423</td><td>1898</td><td>1874</td><td>423</td><td>8</td><td>3</td><td>21 423</td></tr><tr><td rowspan="4">Breakout (4)</td><td rowspan="4">401.2</td><td rowspan="4">766.8</td><td rowspan="4">773</td><td>64,400</td><td>25</td><td>415</td><td>1888</td><td>1871</td><td>415</td><td>8</td><td></td><td>415</td></tr><tr><td>128,100</td><td>41</td><td>377</td><td>1583</td><td>1514</td><td>377</td><td>11</td><td>30</td><td>377</td></tr><tr><td>128,400</td><td>85</td><td>379</td><td>1729</td><td>1769</td><td>379</td><td>8</td><td></td><td>379</td></tr><tr><td>64,100</td><td>520</td><td>1335</td><td>1495</td><td>1502</td><td>1335</td><td>8</td><td></td><td>1335</td></tr><tr><td rowspan="3">Space Invaders (4)</td><td rowspan="3">1976</td><td rowspan="3">23846</td><td rowspan="3">1820</td><td>64,400</td><td>365</td><td>1235</td><td>1625</td><td>1620</td><td>1235</td><td>12</td><td>29</td><td>1235</td></tr><tr><td>128,100</td><td>390</td><td>1040</td><td>1563</td><td>1457</td><td>1040</td><td>12</td><td>35</td><td>1040</td></tr><tr><td>128,400</td><td>520</td><td>1430</td><td>1931</td><td>1921</td><td>1430</td><td>6</td><td>27</td><td>1430</td></tr><tr><td rowspan="4">Bowling (6)</td><td rowspan="4">42.4</td><td rowspan="4">41.8</td><td rowspan="4">60</td><td>64,100 64,400</td><td>60</td><td>-</td><td>49</td><td>1</td><td>60</td><td>33</td><td>1</td><td>60</td></tr><tr><td></td><td>60</td><td>-</td><td>49</td><td>1</td><td>60</td><td>33</td><td>1</td><td>60</td></tr><tr><td>128,100</td><td>60</td><td>-</td><td>26</td><td>11</td><td>60</td><td>24</td><td>T</td><td>60</td></tr><tr><td>128,400</td><td>60</td><td>-</td><td>26</td><td></td><td>60</td><td>24</td><td></td><td>60</td></tr><tr><td rowspan="4">Boxing (18)</td><td rowspan="4">71.8</td><td rowspan="4">37.3</td><td rowspan="4">100</td><td>64,100</td><td>94</td><td>100</td><td>1173</td><td>1167</td><td>100</td><td>13</td><td>79</td><td>100</td></tr><tr><td>64,400</td><td>98</td><td>100</td><td>2621</td><td>2605</td><td>100</td><td>14</td><td>119</td><td>100</td></tr><tr><td>128,100</td><td>94</td><td>97</td><td>2499</td><td>2482</td><td>97</td><td>14</td><td>106</td><td>97</td></tr><tr><td>128,400</td><td>97</td><td>100</td><td>1173</td><td>1169</td><td>100</td><td>14</td><td>88</td><td>100</td></tr></table>
|
| 159 |
+
|
| 160 |
+

|
| 161 |
+
Figure 2: Moore Machine representation for Atari policies
|
| 162 |
+
|
| 163 |
+
# REFERENCES
|
| 164 |
+
|
| 165 |
+
Leila Arras, Gregoire Montavon, Klaus-Robert M ´ uller, and Wojciech Samek. Explaining recurrent ¨ neural network predictions in sentiment analysis. arXiv preprint arXiv:1706.07206, 2017.
|
| 166 |
+
|
| 167 |
+
Yoshua Bengio, Nicholas Leonard, and Aaron Courville. Estimating or propagating gradients ´ through stochastic neurons for conditional computation. arXiv preprint arXiv:1308.3432, 2013.
|
| 168 |
+
|
| 169 |
+
Greg Brockman, Vicki Cheung, Ludwig Pettersson, Jonas Schneider, John Schulman, Jie Tang, and Wojciech Zaremba. Openai gym. arXiv preprint arXiv:1606.01540, 2016.
|
| 170 |
+
|
| 171 |
+
Adelmo Luis Cechin, D Regina, P Simon, and K Stertz. State automata extraction from recurrent neural nets using k-means and fuzzy clustering. In Chilean Computer Science Society, 2003. SCCC 2003. Proceedings. 23rd International Conference of the, pp. 73–78. IEEE, 2003.
|
| 172 |
+
|
| 173 |
+
Kyunghyun Cho, Bart Van Merrienboer, Dzmitry Bahdanau, and Yoshua Bengio. On the properties ¨ of neural machine translation: Encoder-decoder approaches. arXiv preprint arXiv:1409.1259, 2014.
|
| 174 |
+
|
| 175 |
+
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.
|
| 176 |
+
|
| 177 |
+
Matthieu Courbariaux, Itay Hubara, Daniel Soudry, Ran El-Yaniv, and Yoshua Bengio. Binarized neural networks: Training deep neural networks with weights and activations constrained to $+ 1$ or-1. arXiv preprint arXiv:1602.02830, 2016.
|
| 178 |
+
|
| 179 |
+
Sam Greydanus, Anurag Koul, Jonathan Dodge, and Alan Fern. Visualizing and understanding atari agents. arXiv preprint arXiv:1711.00138, 2017.
|
| 180 |
+
|
| 181 |
+
Geoffrey Hinton. Neural networks for machine learning. video lectures, 2012.
|
| 182 |
+
|
| 183 |
+
Geoffrey E Hinton and Ruslan R Salakhutdinov. Reducing the dimensionality of data with neural networks. science, 313(5786):504–507, 2006.
|
| 184 |
+
|
| 185 |
+
Sepp Hochreiter and Jurgen Schmidhuber. Long short-term memory. ¨ Neural computation, 9(8): 1735–1780, 1997.
|
| 186 |
+
|
| 187 |
+
Henrik Jacobsson. Rule extraction from recurrent neural networks: Ataxonomy and review. Neural Computation, 17(6):1223–1263, 2005.
|
| 188 |
+
|
| 189 |
+
Andrej Karpathy, Justin Johnson, and Li Fei-Fei. Visualizing and understanding recurrent networks. arXiv preprint arXiv:1506.02078, 2015.
|
| 190 |
+
|
| 191 |
+
Alex Krizhevsky and Geoff Hinton. Convolutional deep belief networks on cifar-10. Unpublished manuscript, 40(7), 2010.
|
| 192 |
+
|
| 193 |
+
Tom Mikolov, Martin Karafiat, Luk Burget, and Sanjeev Khudanpur.´ Recurrent neural network based language model. INTERSPEECH 2010, 11th Annual Conference of the International Speech Communication Association, pp. 1045–1048, 2010. URL http://www.fit.vutbr.cz/research/groups/speech/publi/2010/ mikolov_interspeech2010_IS100722.pdf.
|
| 194 |
+
|
| 195 |
+
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, 2015. doi: 10.1038/nature14236. URL https://storage.googleapis. com/deepmind-media/dqn/DQNNaturePaper.pdf.
|
| 196 |
+
|
| 197 |
+
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.
|
| 198 |
+
|
| 199 |
+
W James Murdoch and Arthur Szlam. Automatic rule extraction from long short term memory networks. arXiv preprint arXiv:1702.02540, 2017.
|
| 200 |
+
|
| 201 |
+
Christian W Omlin and C Lee Giles. Extraction of rules from discrete-time recurrent neural networks. Neural networks, 9(1):41–52, 1996.
|
| 202 |
+
|
| 203 |
+
Marvin C Paull and Stephen H Unger. Minimizing the number of states in incompletely specified sequential switching functions. IRE Transactions on Electronic Computers, (3):356–367, 1959.
|
| 204 |
+
|
| 205 |
+
Silviu Pitis. Beyond binary: Ternary and one-hot neurons. https://r2rt.com/ beyond-binary-ternary-and-one-hot-neurons.html, 2017.
|
| 206 |
+
|
| 207 |
+
John Schulman, Philipp Moritz, Sergey Levine, Michael Jordan, and Pieter Abbeel. Highdimensional continuous control using generalized advantage estimation. arXiv preprint arXiv:1506.02438, 2015.
|
| 208 |
+
|
| 209 |
+
David Silver, Julian Schrittwieser, Karen Simonyan, Ioannis Antonoglou, Aja Huang, Arthur Guez, Thomas Hubert, Lucas Baker, Matthew Lai, Adrian Bolton, Yutian Chen, Timothy Lillicrap, Fan Hui, Laurent Sifre, George van den Driessche, Thore Graepel, and Demis Hassabis. Mastering the game of Go without human knowledge. Nature Publishing Group, 550, 2017. doi: 10.1038/nature24270. URL https://www.nature.com/nature/journal/ v550/n7676/pdf/nature24270.pdf.
|
| 210 |
+
|
| 211 |
+
Hendrik Strobelt, Sebastian Gehrmann, Bernd Huber, Hanspeter Pfister, and Alexander M Rush. Visual analysis of hidden state dynamics in recurrent neural networks. arXiv preprint arXiv:1606.07461, 2016.
|
| 212 |
+
|
| 213 |
+
Peter Tino, Bill G Horne, C Lee Giles, and Pete C Collingwood. Finite state machines and recurrent ˇ neural networksautomata and dynamical systems approaches. In Neural networks and pattern recognition, pp. 171–219. Elsevier, 1998.
|
| 214 |
+
|
| 215 |
+
Masaru Tomita. Dynamic construction of finite-state automata from examples using hill-climbing. In Proceedings of the Fourth Annual Conference of the Cognitive Science Society, pp. 105–108, 1982.
|
| 216 |
+
|
| 217 |
+
Raymond L Watrous and Gary M Kuhn. Induction of finite-state automata using second-order recurrent networks. In Advances in neural information processing systems, pp. 309–317, 1992.
|
| 218 |
+
|
| 219 |
+
Gail Weiss, Yoav Goldberg, and Eran Yahav. Extracting automata from recurrent neural networks using queries and counterexamples. arXiv preprint arXiv:1711.09576, 2017.
|
| 220 |
+
|
| 221 |
+
Tom Zahavy, Nir Ben-Zrihem, and Shie Mannor. Graying the black box: Understanding dqns. In International Conference on Machine Learning, pp. 1899–1908, 2016.
|
| 222 |
+
|
| 223 |
+
Zheng Zeng, Rodney M Goodman, and Padhraic Smyth. Learning finite state machines with selfclustering recurrent networks. Neural Computation, 5(6):976–990, 1993.
|
| 224 |
+
|
| 225 |
+
# APPENDIX
|
| 226 |
+
|
| 227 |
+
# 7.1 FORMAL DEFINITION OF MODE COUNTER ENVIRONMENT
|
| 228 |
+
|
| 229 |
+
An MCE is parameterized by the mode number $M$ , a mode transition function $P$ , a mode life span mapping $\Delta ( m )$ that assigns a positive integer to each mode, and a count set $C$ containing zero or more natural numbers. At time $t$ the MCE hidden state is a tuple $( m _ { t } , c _ { t } )$ , where $\overline { { m _ { t } } } ~ \in ~ \{ 1 , 2 , \dots , M \}$ is the current mode and $c _ { t }$ is the count of time-steps that the system has been consecutively in mode $m _ { t }$ . The mode only changes when the lifespan is reached, i.e. $c _ { t } = \Delta ( m _ { t } ) - 1$ , upon which the next mode $m _ { t + 1 }$ is generated according to the transition distribution $P ( m _ { t + 1 } \mid m _ { t } )$ . The transition distribution also specifies the distribution over initial modes. The agent does not directly observe the state, but rather, the agent only receives a continuous-valued observations $o _ { t } \in [ 0 , 1 ]$ at each step, based on the current state $( m _ { t } , c _ { t } )$ . If $c _ { t } \in C$ then $o _ { t }$ is drawn uniformly at random from $[ m _ { t } / M , ( m _ { t } + 1 ) / M ) ]$ and otherwise $o _ { t }$ is drawn uniformly at random from [0, 1]. Thus, observations determine the mode when the mode count is in $C$ and otherwise the observations are uninformative. Note that the agent does not observe the counter. This means that to keep track of the mode for optimal performance the agent must remember the current mode and use memory to keep track of how long the mode has been active, in order to determine when it needs to “pay attention” to the current observation.
|
| 230 |
+
|
| 231 |
+
We conduct experiments with the following three MCE instances 7: 1) Amnesia. This MCE uses $\Delta ( m ) = 1$ for all modes, $C = \{ 0 \}$ , and uniformly samples random initial mode and transition distributions. Thus, an optimal policy will not use memory to track information from the past, since the current observation alone determines the current mode. This tests our ability to use MMN extraction to determine that a policy is purely reactive, i.e. not using memory. 2) Blind. Here we use deterministic initial mode and transition distributions, mode life spans that can be larger than 1, and $C = \{ \}$ . Thus, the observations provide no information about the mode and optimal performance can only be achieved by using memory to keep track of the deterministic mode sequence. This allows us to test whether the extraction of an MMN could infer that the recurrent policy is ignoring observations and only using memory. 3) Tracker. This MCE is identical to Amnesia, except that the $\Delta ( m )$ values can be larger than 1. This requires an optimal policy to pay attention to observations when $c _ { t } = 0$ and use memory to keep track of the current mode and mode count. This is the most general instance of the environment and can result in difficult problems when the number of modes and their life-spans grow. In all above instances, we used $M = 4$ .
|
| 232 |
+
|
| 233 |
+
# 7.2 GROUND TRUTH MCE MOORE MACHINES
|
| 234 |
+
|
| 235 |
+

|
| 236 |
+
Figure 3: Moore machine representation of Mode Counter Environments (MCE). We use $\cdot _ { m }$ ’ to indicate the activate mode/action required in that state. Given $M = 4$ , we have 4 observations classes, $o _ { 1 } = ( 0 , 0 . 2 5 ]$ , $o _ { 2 } = ( 0 . 2 5 , 0 . 5 ]$ , $o _ { 3 } = ( 0 . 5 , 0 . 7 5 ]$ and $o _ { 4 } = ( 0 . 7 5 , 1 ]$ . Also, $^ { O _ { * } }$ implies that the transaction is valid for all observations. The minimal moore machines extracted by our approach from trained RNN policies exactly matches these ground truth machines.
|
| 237 |
+
|
| 238 |
+

|
| 239 |
+
Figure 4: Extracted Moore machine representation for Tomita Grammar policies where $B _ { h } = 1 6$ . We use ‘A’ and $\cdot _ { \mathrm { R } } \cdot$ to denote accept and reject states, respectively. Other than Grammar 6, all machines are $100 \%$ accurate.
|
parse/train/S1gOpsCctm/S1gOpsCctm_content_list.json
ADDED
|
@@ -0,0 +1,1342 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[
|
| 2 |
+
{
|
| 3 |
+
"type": "text",
|
| 4 |
+
"text": "LEARNING FINITE STATE REPRESENTATIONS OF RECURRENT POLICY NETWORKS ",
|
| 5 |
+
"text_level": 1,
|
| 6 |
+
"bbox": [
|
| 7 |
+
174,
|
| 8 |
+
98,
|
| 9 |
+
750,
|
| 10 |
+
146
|
| 11 |
+
],
|
| 12 |
+
"page_idx": 0
|
| 13 |
+
},
|
| 14 |
+
{
|
| 15 |
+
"type": "text",
|
| 16 |
+
"text": "Anurag Koul & Alan Fern \nSchool of EECS \nOregon State University \nCorvallis, Oregon, USA \n{koula,alan.fern}@oregonstate.edu \nSam Greydanus ∗ \nGoogle Brain \nMountain View, California, USA \nsgrey@google.com ",
|
| 17 |
+
"bbox": [
|
| 18 |
+
184,
|
| 19 |
+
170,
|
| 20 |
+
504,
|
| 21 |
+
241
|
| 22 |
+
],
|
| 23 |
+
"page_idx": 0
|
| 24 |
+
},
|
| 25 |
+
{
|
| 26 |
+
"type": "text",
|
| 27 |
+
"text": "",
|
| 28 |
+
"bbox": [
|
| 29 |
+
560,
|
| 30 |
+
171,
|
| 31 |
+
776,
|
| 32 |
+
227
|
| 33 |
+
],
|
| 34 |
+
"page_idx": 0
|
| 35 |
+
},
|
| 36 |
+
{
|
| 37 |
+
"type": "text",
|
| 38 |
+
"text": "ABSTRACT ",
|
| 39 |
+
"text_level": 1,
|
| 40 |
+
"bbox": [
|
| 41 |
+
454,
|
| 42 |
+
276,
|
| 43 |
+
544,
|
| 44 |
+
291
|
| 45 |
+
],
|
| 46 |
+
"page_idx": 0
|
| 47 |
+
},
|
| 48 |
+
{
|
| 49 |
+
"type": "text",
|
| 50 |
+
"text": "Recurrent neural networks (RNNs) are an effective representation of control policies for a wide range of reinforcement and imitation learning problems. RNN policies, however, are particularly difficult to explain, understand, and analyze due to their use of continuous-valued memory vectors and observation features. In this paper, we introduce a new technique, Quantized Bottleneck Insertion, to learn finite representations of these vectors and features. The result is a quantized representation of the RNN that can be analyzed to improve our understanding of memory use and general behavior. We present results of this approach on synthetic environments and six Atari games. The resulting finite representations are surprisingly small in some cases, using as few as 3 discrete memory states and 10 observations for a perfect Pong policy. We also show that these finite policy representations lead to improved interpretability. ",
|
| 51 |
+
"bbox": [
|
| 52 |
+
233,
|
| 53 |
+
309,
|
| 54 |
+
764,
|
| 55 |
+
476
|
| 56 |
+
],
|
| 57 |
+
"page_idx": 0
|
| 58 |
+
},
|
| 59 |
+
{
|
| 60 |
+
"type": "text",
|
| 61 |
+
"text": "1 INTRODUCTION ",
|
| 62 |
+
"text_level": 1,
|
| 63 |
+
"bbox": [
|
| 64 |
+
176,
|
| 65 |
+
505,
|
| 66 |
+
336,
|
| 67 |
+
520
|
| 68 |
+
],
|
| 69 |
+
"page_idx": 0
|
| 70 |
+
},
|
| 71 |
+
{
|
| 72 |
+
"type": "text",
|
| 73 |
+
"text": "Deep reinforcement learning (RL) and imitation learning (IL) have demonstrated impressive performance across a wide range of applications. Unfortunately, the learned policies are difficult to understand and explain, which limits the degree that they can be trusted and used in high-stakes applications. Such explanations are particularly problematic for policies represented as recurrent neural networks (RNNs) (Mnih et al., 2016; Mikolov et al., 2010), which are increasingly used to achieve state-of-the-art performance (Mnih et al., 2015; Silver et al., 2017). This is because RNN policies use internal memory to encode features of the observation history, which are critical to their decision making, but extremely difficult to interpret. In this paper, we take a step towards comprehending and explaining RNN policies by learning more compact memory representations. ",
|
| 74 |
+
"bbox": [
|
| 75 |
+
174,
|
| 76 |
+
536,
|
| 77 |
+
825,
|
| 78 |
+
662
|
| 79 |
+
],
|
| 80 |
+
"page_idx": 0
|
| 81 |
+
},
|
| 82 |
+
{
|
| 83 |
+
"type": "text",
|
| 84 |
+
"text": "Explaining RNN memory is challenging due to the typical use of high-dimensional continuous memory vectors that are updated through complex gating networks (e.g. LSTMs, GRUs (Hochreiter & Schmidhuber, 1997; Chung et al., 2014; Cho et al., 2014)). We hypothesize that, in many cases, the continuous memory is capturing and updating one or more discrete concepts. If exposed, such concepts could significantly aid explainability. This motivates attempting to quantize the memory and observation representation used by an RNN to more directly capture those concepts. In this case, understanding the memory use can be approached by manipulating and analyzing the quantized system. Of course, not all RNN policies will have compact quantized representations, but many powerful forms of memory usage can be captured in this way. ",
|
| 85 |
+
"bbox": [
|
| 86 |
+
174,
|
| 87 |
+
669,
|
| 88 |
+
825,
|
| 89 |
+
795
|
| 90 |
+
],
|
| 91 |
+
"page_idx": 0
|
| 92 |
+
},
|
| 93 |
+
{
|
| 94 |
+
"type": "text",
|
| 95 |
+
"text": "Our main contribution is to introduce an approach for transforming an RNN policy with continuous memory and continuous observations to a finite-state representation known as a Moore Machine. To accomplish this we introduce the idea of Quantized Bottleneck Network (QBN) insertion. QBNs are simply auto-encoders, where the latent representation is quantized. Given a trained RNN, we train QBNs to encode the memory states and observation vectors that are encountered during the RNN operation. We then insert the QBNs into the trained RNN policy in place of the “wires” that propagated the memory and observation vectors. The combination of the RNN and QBN results in a policy represented as a Moore Machine Network (MMN) with quantized memory and observations that is nearly equivalent to the original RNN. The MMN can be used directly or fine-tuned to improve on inaccuracies introduced by QBN insertion. ",
|
| 96 |
+
"bbox": [
|
| 97 |
+
174,
|
| 98 |
+
801,
|
| 99 |
+
825,
|
| 100 |
+
898
|
| 101 |
+
],
|
| 102 |
+
"page_idx": 0
|
| 103 |
+
},
|
| 104 |
+
{
|
| 105 |
+
"type": "text",
|
| 106 |
+
"text": "",
|
| 107 |
+
"bbox": [
|
| 108 |
+
176,
|
| 109 |
+
103,
|
| 110 |
+
823,
|
| 111 |
+
145
|
| 112 |
+
],
|
| 113 |
+
"page_idx": 1
|
| 114 |
+
},
|
| 115 |
+
{
|
| 116 |
+
"type": "text",
|
| 117 |
+
"text": "While training quantized networks is often considered to be quite challenging, we show that a simple approach works well in the case of QBNs. In particular, we demonstrate that “straight through” gradient estimators as in (Bengio et al., 2013; Courbariaux et al., 2016) are quite effective. ",
|
| 118 |
+
"bbox": [
|
| 119 |
+
176,
|
| 120 |
+
152,
|
| 121 |
+
821,
|
| 122 |
+
195
|
| 123 |
+
],
|
| 124 |
+
"page_idx": 1
|
| 125 |
+
},
|
| 126 |
+
{
|
| 127 |
+
"type": "text",
|
| 128 |
+
"text": "We present experiments in synthetic domains designed to exercise different types of memory use as well as benchmark grammar learning problems. Our approach is able to accurately extract the ground-truth MMNs, providing insight into the RNN memory use. We also did experiments on 6 Atari games using RNNs that achieve state-of-the-art performance. We show that in most cases it is possible to extract near-equivalent MMNs and that the MMNs can be surprisingly small. Further, the extracted MMNs give insights into the memory usage that are not obvious based on just observing the RNN policy in action. For example, we identify games where the RNNs do not use memory in a meaningful way, indicating the RNN is implementing purely reactive control. In contrast, in other games, the RNN does not use observations in a meaningful way, which indicates that the RNN is implementing an open-loop controller. ",
|
| 129 |
+
"bbox": [
|
| 130 |
+
174,
|
| 131 |
+
202,
|
| 132 |
+
825,
|
| 133 |
+
340
|
| 134 |
+
],
|
| 135 |
+
"page_idx": 1
|
| 136 |
+
},
|
| 137 |
+
{
|
| 138 |
+
"type": "text",
|
| 139 |
+
"text": "2 RELATED WORK ",
|
| 140 |
+
"text_level": 1,
|
| 141 |
+
"bbox": [
|
| 142 |
+
176,
|
| 143 |
+
359,
|
| 144 |
+
344,
|
| 145 |
+
376
|
| 146 |
+
],
|
| 147 |
+
"page_idx": 1
|
| 148 |
+
},
|
| 149 |
+
{
|
| 150 |
+
"type": "text",
|
| 151 |
+
"text": "There have been efforts made in the past to understand the internals of Recurrent Networks (Karpathy et al., 2015; Arras et al., 2017; Strobelt et al., 2016; Murdoch & Szlam, 2017; Jacobsson, 2005; Omlin & Giles, 1996). However, to the best of our knowledge there is no prior work on learning finite-memory representations of continuous RNN policies. Our work, however, is related to a large body of work on learning finite-state representations of recurrent neural networks. Below we summarize the branches of that work and the relationship to our own. ",
|
| 152 |
+
"bbox": [
|
| 153 |
+
174,
|
| 154 |
+
391,
|
| 155 |
+
825,
|
| 156 |
+
476
|
| 157 |
+
],
|
| 158 |
+
"page_idx": 1
|
| 159 |
+
},
|
| 160 |
+
{
|
| 161 |
+
"type": "text",
|
| 162 |
+
"text": "There has been a significant history of work on extracting Finite State Machines (FSMs) from recurrent networks trained to recognize languages (Zeng et al., 1993; Tino et al., 1998; Cechin et al., ˇ 2003). Typical approaches include discretizing the continuous memory space via gridding or clustering followed by minimization. A more recent approach is to use classic query-based learning algorithms to extract FSMs by asking membership and equivalence queries (Weiss et al., 2017). However, none of these approaches directly apply to learning policies, which require extending to Moore Machines. In addition, all of these approaches produce an FSM approximation that is separated from the RNN and thus serve as only a proxy of the RNN behavior. Rather, our approach directly inserts discrete elements into the RNN that preserves its behavior, but allows for a finite state characterization. This insertion approach has the advantage of allowing fine-tuning and visualization using standard learning frameworks. ",
|
| 163 |
+
"bbox": [
|
| 164 |
+
174,
|
| 165 |
+
483,
|
| 166 |
+
825,
|
| 167 |
+
635
|
| 168 |
+
],
|
| 169 |
+
"page_idx": 1
|
| 170 |
+
},
|
| 171 |
+
{
|
| 172 |
+
"type": "text",
|
| 173 |
+
"text": "The work most similar to ours also focused on learning FSMs (Zeng et al., 1993). However, the approach is based on directly learning recurrent networks with finite memory, which are qualitatively similar to the memory representation of our MMNs. That work, however, focused on learning from scratch rather than aiming to describe the behavior of a continuous RNN. Our work extends that approach to learn MMNs and more importantly introduces the method of QBN insertion as a way of learning via guidance from a continuous RNN.This transforms any pre-trained recurrent policy into a finite representation. ",
|
| 174 |
+
"bbox": [
|
| 175 |
+
174,
|
| 176 |
+
642,
|
| 177 |
+
825,
|
| 178 |
+
739
|
| 179 |
+
],
|
| 180 |
+
"page_idx": 1
|
| 181 |
+
},
|
| 182 |
+
{
|
| 183 |
+
"type": "text",
|
| 184 |
+
"text": "We note that there has been prior work on learning fully binary networks, where the activation functions and/or weights are binary (e.g. (Bengio et al., 2013; Courbariaux et al., 2016; Hinton, 2012)). The goal of that line of work is typically to learn more time and space efficient networks. Rather, we focus on learning only discrete representations of memory and observations, while allowing the rest of the network to use arbitrary activations and weights. This is due to our alternative goal of supporting interpretability rather than efficiency. ",
|
| 185 |
+
"bbox": [
|
| 186 |
+
174,
|
| 187 |
+
747,
|
| 188 |
+
825,
|
| 189 |
+
830
|
| 190 |
+
],
|
| 191 |
+
"page_idx": 1
|
| 192 |
+
},
|
| 193 |
+
{
|
| 194 |
+
"type": "text",
|
| 195 |
+
"text": "3 RECURRENT POLICY NETWORKS: CONTINUOUS AND QUANTIZED",
|
| 196 |
+
"text_level": 1,
|
| 197 |
+
"bbox": [
|
| 198 |
+
173,
|
| 199 |
+
851,
|
| 200 |
+
754,
|
| 201 |
+
867
|
| 202 |
+
],
|
| 203 |
+
"page_idx": 1
|
| 204 |
+
},
|
| 205 |
+
{
|
| 206 |
+
"type": "text",
|
| 207 |
+
"text": "Recurrent neural networks (RNNs) are commonly used in reinforcement learning to represent policies that require or can benefit from internal memory. At each time step, an RNN is given an observation $o _ { t }$ (e.g. image) and must output an action $a _ { t }$ to be taken in the environment. During execution an RNN maintains a continuous-valued hidden state $h _ { t }$ , which is updated on each transition and influences the action choice. In particular, given the current observation $o _ { t }$ and current state $h _ { t }$ , an RNN performs the following operations: 1) Extract a set of observation features $f _ { t }$ from $o _ { t }$ , for example, using a CNN when observations are images, 2) Outputting an action $a _ { t } = \\pi ( h _ { t } )$ according to policy $\\pi$ , which is often a linear softmax function of $h _ { t }$ , 3) transition to a new state $h _ { t + 1 } = \\bar { \\delta } ( f _ { t } , \\mathsf { \\bar { h } } _ { t } )$ where $\\delta$ is the transition function, which is often implemented via different types of gating networks such as LSTMs or GRUs. ",
|
| 208 |
+
"bbox": [
|
| 209 |
+
176,
|
| 210 |
+
882,
|
| 211 |
+
823,
|
| 212 |
+
924
|
| 213 |
+
],
|
| 214 |
+
"page_idx": 1
|
| 215 |
+
},
|
| 216 |
+
{
|
| 217 |
+
"type": "text",
|
| 218 |
+
"text": "",
|
| 219 |
+
"bbox": [
|
| 220 |
+
174,
|
| 221 |
+
103,
|
| 222 |
+
823,
|
| 223 |
+
200
|
| 224 |
+
],
|
| 225 |
+
"page_idx": 2
|
| 226 |
+
},
|
| 227 |
+
{
|
| 228 |
+
"type": "text",
|
| 229 |
+
"text": "The continuous and high dimensional nature of $h _ { t }$ and $f _ { t }$ can make interpreting the role of memory difficult. This motivates our goal of extracting compact quantized representations of $h _ { t }$ and $f _ { t }$ . Such representations have the potential to allow investigating a finite system that captures the key features of the memory and observations. For this purpose we introduce Moore Machines and their deep network counterparts. ",
|
| 230 |
+
"bbox": [
|
| 231 |
+
174,
|
| 232 |
+
208,
|
| 233 |
+
823,
|
| 234 |
+
277
|
| 235 |
+
],
|
| 236 |
+
"page_idx": 2
|
| 237 |
+
},
|
| 238 |
+
{
|
| 239 |
+
"type": "text",
|
| 240 |
+
"text": "Moore Machines. A classical Moore Machine (MM) is a standard finite state machine where all states are labeled by output values, which in our case will correspond to actions. In particular, a Moore Machine is described by a finite set of (hidden) states $\\hat { H }$ , an initial hidden state $\\hat { h } _ { 0 }$ , a finite set of observations $\\hat { O }$ , a finite set of actions $A$ , a transition function $\\hat { \\delta }$ , and a policy $\\hat { \\pi }$ that maps hidden states to actions. The transition function $\\hat { \\delta } : \\hat { H } \\times \\hat { O } \\hat { H }$ returns the next hidden state $\\hat { h } _ { t + 1 } = \\hat { \\delta } ( \\hat { h } _ { t } , \\hat { o } _ { t } )$ given the current state $\\hat { h } _ { t }$ and observation $\\hat { o } _ { t }$ . By convention we will use $h _ { t }$ and $\\hat { h } _ { t }$ to denote continuous and discrete states respectively and similarly for other quantities and functions. ",
|
| 241 |
+
"bbox": [
|
| 242 |
+
174,
|
| 243 |
+
285,
|
| 244 |
+
825,
|
| 245 |
+
388
|
| 246 |
+
],
|
| 247 |
+
"page_idx": 2
|
| 248 |
+
},
|
| 249 |
+
{
|
| 250 |
+
"type": "text",
|
| 251 |
+
"text": "Moore Machine Networks. A Moore Machine Network (MMN) is a Moore Machine where the transition function $\\hat { \\delta }$ and policy $\\hat { \\pi }$ are represented via deep networks. In addition, since the raw observations given to an MMN are often continuous, or from an effectively unbounded set (e.g. images), an MMN will also provide a mapping $\\hat { g }$ from the continuous observations to a finite discrete observation space $\\hat { O }$ . Here $\\hat { g }$ will also be represented via a deep network. In this work, we consider quantized state and observation representations where each $\\hat { h } \\in \\hat { H }$ is a discrete vector and each discrete observation in $\\hat { O }$ is a discrete vector that describes the raw observation. We will denote the quantization level as $k$ and the dimensions of $\\hat { h }$ and $\\hat { f }$ by $B _ { h }$ and $B _ { f }$ respectively. ",
|
| 252 |
+
"bbox": [
|
| 253 |
+
174,
|
| 254 |
+
395,
|
| 255 |
+
825,
|
| 256 |
+
515
|
| 257 |
+
],
|
| 258 |
+
"page_idx": 2
|
| 259 |
+
},
|
| 260 |
+
{
|
| 261 |
+
"type": "text",
|
| 262 |
+
"text": "Based on the above discussion, an MMN can be viewed as a traditional RNN, where: 1) The memory is restricted to be composed of $k$ -level activation units, and 2) The environmental observations are intermediately transformed to a $k$ -level representation $\\hat { f }$ before being fed to the recurrent module. Given an approach for incorporating quantized units into the backpropagation process, it is straightforward, in concept, to learn MMNs from scratch via standard RNN learning algorithms. However, we have found that learning MMNs from scratch can be quite difficult for non-trivial problems, even when an RNN can be learned with relative ease. For example, we have not been able to train highperforming MMNs from scratch for Atari games. Below we introduce a new approach for learning MMNs that is able to leverage the ability to learn RNNs. ",
|
| 263 |
+
"bbox": [
|
| 264 |
+
174,
|
| 265 |
+
522,
|
| 266 |
+
825,
|
| 267 |
+
648
|
| 268 |
+
],
|
| 269 |
+
"page_idx": 2
|
| 270 |
+
},
|
| 271 |
+
{
|
| 272 |
+
"type": "text",
|
| 273 |
+
"text": "4 LEARNING MOORE MACHINE NETWORKS FROM RNNS ",
|
| 274 |
+
"text_level": 1,
|
| 275 |
+
"bbox": [
|
| 276 |
+
174,
|
| 277 |
+
678,
|
| 278 |
+
665,
|
| 279 |
+
694
|
| 280 |
+
],
|
| 281 |
+
"page_idx": 2
|
| 282 |
+
},
|
| 283 |
+
{
|
| 284 |
+
"type": "text",
|
| 285 |
+
"text": "Given a trained RNN, our key idea is to first learn quantized bottleneck networks (QBNs) for embedding the continuous observation features and hidden state into a $k$ -level quantized representation. We will then insert the QBNs into the original recurrent net in such a way that its behavior is minimally changed with the option of fine-tuning after insertion. The resulting network can be viewed as consuming quantized features and maintaining quantized state, which is effectively an MMN. Below we describe the steps in further detail, which are illustrated in Figure 1. ",
|
| 286 |
+
"bbox": [
|
| 287 |
+
174,
|
| 288 |
+
715,
|
| 289 |
+
825,
|
| 290 |
+
799
|
| 291 |
+
],
|
| 292 |
+
"page_idx": 2
|
| 293 |
+
},
|
| 294 |
+
{
|
| 295 |
+
"type": "text",
|
| 296 |
+
"text": "4.1 QUANTIZED BOTTLENECK NETWORKS ",
|
| 297 |
+
"text_level": 1,
|
| 298 |
+
"bbox": [
|
| 299 |
+
176,
|
| 300 |
+
824,
|
| 301 |
+
483,
|
| 302 |
+
838
|
| 303 |
+
],
|
| 304 |
+
"page_idx": 2
|
| 305 |
+
},
|
| 306 |
+
{
|
| 307 |
+
"type": "text",
|
| 308 |
+
"text": "A QBN is simply an autoencoder where the latent representation between the encoder and decoder (i.e. the bottleneck) is constrained to be composed of $k$ -level activation units. While, traditional autoencoders are generally used for the purpose of dimensionality reduction in continuous space (Hinton & Salakhutdinov, 2006), QBNs are motivated by the goal of discretizing a continuous space. Conceptually, this can be done by quantizing the activations of units in the encoding layer. ",
|
| 309 |
+
"bbox": [
|
| 310 |
+
174,
|
| 311 |
+
854,
|
| 312 |
+
823,
|
| 313 |
+
924
|
| 314 |
+
],
|
| 315 |
+
"page_idx": 2
|
| 316 |
+
},
|
| 317 |
+
{
|
| 318 |
+
"type": "image",
|
| 319 |
+
"img_path": "images/8e6ffec04cb5d48cb94463e00191c657158e780f30ce437df980135cd9a97c85.jpg",
|
| 320 |
+
"image_caption": [
|
| 321 |
+
"Figure 1: Learning Moore Machine Networks. (1.) Learn an RNN policy. (2.) Learn QBN’s to quantize memory and observations. (3.) Insertion and Fine Tuning. The modules labelled O, R are observation feature-extraction and recurrent modules, respectively "
|
| 322 |
+
],
|
| 323 |
+
"image_footnote": [],
|
| 324 |
+
"bbox": [
|
| 325 |
+
269,
|
| 326 |
+
101,
|
| 327 |
+
723,
|
| 328 |
+
294
|
| 329 |
+
],
|
| 330 |
+
"page_idx": 3
|
| 331 |
+
},
|
| 332 |
+
{
|
| 333 |
+
"type": "text",
|
| 334 |
+
"text": "We represent a QBN via a continuous multilayer encoder $E$ , which maps inputs $x$ to a latent encoding $E ( x )$ , and a corresponding multilayer decoder $D$ . To quantize the encoding, the QBN output is given by ",
|
| 335 |
+
"bbox": [
|
| 336 |
+
173,
|
| 337 |
+
376,
|
| 338 |
+
825,
|
| 339 |
+
417
|
| 340 |
+
],
|
| 341 |
+
"page_idx": 3
|
| 342 |
+
},
|
| 343 |
+
{
|
| 344 |
+
"type": "equation",
|
| 345 |
+
"img_path": "images/104211c8f20500801b1bdf91981a7d5767477194aa54767bb54a3f008c2e42dd.jpg",
|
| 346 |
+
"text": "$$\nb ( x ) = D ( { \\mathrm { q u a n t i z e } } ( E ( x ) ) )\n$$",
|
| 347 |
+
"text_format": "latex",
|
| 348 |
+
"bbox": [
|
| 349 |
+
406,
|
| 350 |
+
416,
|
| 351 |
+
591,
|
| 352 |
+
434
|
| 353 |
+
],
|
| 354 |
+
"page_idx": 3
|
| 355 |
+
},
|
| 356 |
+
{
|
| 357 |
+
"type": "text",
|
| 358 |
+
"text": "In our case, we use 3-level quantization in the form of $+ 1 , 0$ and $- 1$ using the quantize function, which assumes the outputs of $E ( x )$ are in the range $[ - 1 , 1 ]$ .1 One choice for the output nodes of $E ( x )$ would be the tanh activation. However, since the gradient of tanh is close to 1 near 0, it can be difficult to produce quantization level 0 during learning. Thus, as suggested in Pitis (2017), to support 3-valued quantization we use the following activation function, which is flatter in the region around zero input. ",
|
| 359 |
+
"bbox": [
|
| 360 |
+
173,
|
| 361 |
+
438,
|
| 362 |
+
825,
|
| 363 |
+
521
|
| 364 |
+
],
|
| 365 |
+
"page_idx": 3
|
| 366 |
+
},
|
| 367 |
+
{
|
| 368 |
+
"type": "equation",
|
| 369 |
+
"img_path": "images/d81f75caed697986167f0dc3489888dd41167be67c71aeac959eed7e2574eb6f.jpg",
|
| 370 |
+
"text": "$$\n\\phi ( x ) = 1 . 5 \\operatorname { t a n h } ( x ) + 0 . 5 \\operatorname { t a n h } ( - 3 x )\n$$",
|
| 371 |
+
"text_format": "latex",
|
| 372 |
+
"bbox": [
|
| 373 |
+
370,
|
| 374 |
+
520,
|
| 375 |
+
625,
|
| 376 |
+
537
|
| 377 |
+
],
|
| 378 |
+
"page_idx": 3
|
| 379 |
+
},
|
| 380 |
+
{
|
| 381 |
+
"type": "text",
|
| 382 |
+
"text": "Of course introducing the quantize function in the QBN results in $b ( x )$ being non-differentiable, making it apparently incompatible with backpropagation, since the gradients between the decoder and encoder will almost always be zero. While there are a variety of ways to deal with this issue, we have found that the straight-through estimator, as suggested and used in prior work (Hinton, 2012; Bengio et al., 2013; Courbariaux et al., 2016) is quite effective. In particular, the standard straightthrough estimator of the gradient simply treats the quantize function as the identity function during back-propagation. Overall, the inclusion of the quantize function in the QBN effectively allows us to view the last layer of $E$ as producing a $k$ -level encoding. We train a QBN as an autoencoder using the standard $L _ { 2 }$ reconstruction error $\\| x - b ( x ) \\| ^ { 2 }$ for a given input $x$ . ",
|
| 383 |
+
"bbox": [
|
| 384 |
+
173,
|
| 385 |
+
540,
|
| 386 |
+
825,
|
| 387 |
+
669
|
| 388 |
+
],
|
| 389 |
+
"page_idx": 3
|
| 390 |
+
},
|
| 391 |
+
{
|
| 392 |
+
"type": "text",
|
| 393 |
+
"text": "4.2 BOTTLENECK INSERTION ",
|
| 394 |
+
"text_level": 1,
|
| 395 |
+
"bbox": [
|
| 396 |
+
174,
|
| 397 |
+
685,
|
| 398 |
+
390,
|
| 399 |
+
699
|
| 400 |
+
],
|
| 401 |
+
"page_idx": 3
|
| 402 |
+
},
|
| 403 |
+
{
|
| 404 |
+
"type": "text",
|
| 405 |
+
"text": "Given a recurrent policy we can run the policy in the target environment in order to produce an arbitrarily large set of training sequences of triples $\\left( o _ { t } , f _ { t } , h _ { t } \\right)$ , giving the observation, corresponding observation feature, and hidden state at time $t$ . Let $F$ and $H$ be the sets of all observed features and states respectively. The first step of our approach is to train two QBNs, $b _ { f }$ and $b _ { h }$ , on $F$ and $H$ respectively. If the QBNs are able to achieve low reconstruction error then we can view latent “bottlenecks” of the QBNs as a high-quality $k$ -level encodings of the original hidden states and features. ",
|
| 406 |
+
"bbox": [
|
| 407 |
+
173,
|
| 408 |
+
712,
|
| 409 |
+
825,
|
| 410 |
+
809
|
| 411 |
+
],
|
| 412 |
+
"page_idx": 3
|
| 413 |
+
},
|
| 414 |
+
{
|
| 415 |
+
"type": "text",
|
| 416 |
+
"text": "We now view $b _ { f }$ and $b _ { h }$ as “wires” that propagate the input to the output, with some noise due to imperfect reconstruction. We insert these wires into the original RNN in the natural way (stage-3 in Figure 1). The $b _ { f }$ QBN is inserted between the RNN units that compute the features $f$ and the nodes those units are connected to. The $b _ { h }$ QBN is inserted between the output of the recurrent network block and the input to the recurrent block. If $b _ { f }$ and $b _ { h }$ always produced perfect reconstructions, then the result of inserting them as described would not change the behavior of the RNN. Yet, the RNN can now be viewed as an MMN since the bottlenecks of $b _ { f }$ and $b _ { h }$ provide a quantized representation of the features $f _ { t }$ and states $h _ { t }$ . ",
|
| 417 |
+
"bbox": [
|
| 418 |
+
174,
|
| 419 |
+
815,
|
| 420 |
+
825,
|
| 421 |
+
886
|
| 422 |
+
],
|
| 423 |
+
"page_idx": 3
|
| 424 |
+
},
|
| 425 |
+
{
|
| 426 |
+
"type": "text",
|
| 427 |
+
"text": "",
|
| 428 |
+
"bbox": [
|
| 429 |
+
174,
|
| 430 |
+
103,
|
| 431 |
+
823,
|
| 432 |
+
145
|
| 433 |
+
],
|
| 434 |
+
"page_idx": 4
|
| 435 |
+
},
|
| 436 |
+
{
|
| 437 |
+
"type": "text",
|
| 438 |
+
"text": "Fine Tuning. In practice, the QBNs will not achieve perfect reconstruction and thus, the resulting MMN may not behave identically to the original RNN. Empirically, we have found that the performance of the resulting MMN is often very close to the RNN directly after insertion. However, when there is non-trivial performance degradation, we can fine-tune the MMN by training on the original rollout data of the RNN. Importantly, since our primary goal is to learn a representation of the original RNN, during fine-tuning our objective is to have the MMN match the softmax distribution over actions produced by the RNN. We found that training in this way was significantly more stable than training the MMN to simply output the same action as the RNN. ",
|
| 439 |
+
"bbox": [
|
| 440 |
+
173,
|
| 441 |
+
152,
|
| 442 |
+
825,
|
| 443 |
+
263
|
| 444 |
+
],
|
| 445 |
+
"page_idx": 4
|
| 446 |
+
},
|
| 447 |
+
{
|
| 448 |
+
"type": "text",
|
| 449 |
+
"text": "4.3 MOORE MACHINE EXTRACTION AND MINIMIZATION",
|
| 450 |
+
"text_level": 1,
|
| 451 |
+
"bbox": [
|
| 452 |
+
174,
|
| 453 |
+
281,
|
| 454 |
+
581,
|
| 455 |
+
295
|
| 456 |
+
],
|
| 457 |
+
"page_idx": 4
|
| 458 |
+
},
|
| 459 |
+
{
|
| 460 |
+
"type": "text",
|
| 461 |
+
"text": "After obtaining the MMN, one could use visualization and other analysis tools to investigate the memory and it’s feature bits in order to gain a semantic understanding of their roles. Solving the full interpretation problem in a primitive way is beyond the scope of this work. ",
|
| 462 |
+
"bbox": [
|
| 463 |
+
176,
|
| 464 |
+
308,
|
| 465 |
+
825,
|
| 466 |
+
349
|
| 467 |
+
],
|
| 468 |
+
"page_idx": 4
|
| 469 |
+
},
|
| 470 |
+
{
|
| 471 |
+
"type": "text",
|
| 472 |
+
"text": "Extraction. Another way to gain insight is to use the MMN to produce an equivalent Moore Machine over atomic state and observation spaces, where each state and observation is a discrete symbol. This machine can be analyzed to understand the role of different machine states and how they are related. In order to create the Moore Machine we run the learned MMN to produce a dataset of $< \\hat { h } _ { t - 1 } , \\hat { f } _ { t } , \\hat { h } _ { t } , a _ { t } > ,$ , giving the consecutive pairs of quantized states, the quantized features that led to the transition, and the action selected after the transition. The state-space of the Moore Machine will correspond to the $p$ distinct quantized states in the data and the observation-space of the machine will be the $q$ unique quantized feature vectors in the data. The transition function of the machine $\\hat { \\delta }$ is constructed from the data by producing a $p \\times q$ transaction table that captures the transitions seen in the data. ",
|
| 473 |
+
"bbox": [
|
| 474 |
+
174,
|
| 475 |
+
357,
|
| 476 |
+
825,
|
| 477 |
+
500
|
| 478 |
+
],
|
| 479 |
+
"page_idx": 4
|
| 480 |
+
},
|
| 481 |
+
{
|
| 482 |
+
"type": "text",
|
| 483 |
+
"text": "Minimization. In general, the number of states $p$ in the resulting Moore Machine will be larger than necessary in the sense that there is a much smaller, but equivalent, minimal machine. Thus, we apply standard Moore Machine minimization techniques to arrive at the minimal2 equivalent Moore Machine (Paull & Unger, 1959). This often dramatically reduces the number of distinct states and observations. ",
|
| 484 |
+
"bbox": [
|
| 485 |
+
174,
|
| 486 |
+
507,
|
| 487 |
+
825,
|
| 488 |
+
577
|
| 489 |
+
],
|
| 490 |
+
"page_idx": 4
|
| 491 |
+
},
|
| 492 |
+
{
|
| 493 |
+
"type": "text",
|
| 494 |
+
"text": "5 SYNTHETIC EXPERIMENTS ",
|
| 495 |
+
"text_level": 1,
|
| 496 |
+
"bbox": [
|
| 497 |
+
178,
|
| 498 |
+
597,
|
| 499 |
+
428,
|
| 500 |
+
613
|
| 501 |
+
],
|
| 502 |
+
"page_idx": 4
|
| 503 |
+
},
|
| 504 |
+
{
|
| 505 |
+
"type": "text",
|
| 506 |
+
"text": "Our experiments address the following questions: 1) Is it possible to extract MMNs from RNNs without significant loss in Performance? 2) What is the general magnitude of the number of states and observations in the minimal machines, especially for complex domains such as Atari? 3) Do the learned MMNs help with interpretability of the recurrent policies? In this section, we begin addressing these questions by considering two domains where ground truth Moore Machines are known. The first is a parameterized synthetic environment, Mode Counter, which can capture multiple types of memory use. Second, we consider benchmark grammar learning problems. ",
|
| 507 |
+
"bbox": [
|
| 508 |
+
174,
|
| 509 |
+
628,
|
| 510 |
+
825,
|
| 511 |
+
727
|
| 512 |
+
],
|
| 513 |
+
"page_idx": 4
|
| 514 |
+
},
|
| 515 |
+
{
|
| 516 |
+
"type": "text",
|
| 517 |
+
"text": "5.1 MODE COUNTER ",
|
| 518 |
+
"text_level": 1,
|
| 519 |
+
"bbox": [
|
| 520 |
+
176,
|
| 521 |
+
744,
|
| 522 |
+
331,
|
| 523 |
+
757
|
| 524 |
+
],
|
| 525 |
+
"page_idx": 4
|
| 526 |
+
},
|
| 527 |
+
{
|
| 528 |
+
"type": "text",
|
| 529 |
+
"text": "The class of Mode Counter Environments (MCEs) allows us to vary the amount of memory required by a policy (including no memory) and the required type of memory usage. In particular, MCEs can require varying amounts of memory for remembering past events and implementing internal counters. ",
|
| 530 |
+
"bbox": [
|
| 531 |
+
174,
|
| 532 |
+
770,
|
| 533 |
+
825,
|
| 534 |
+
825
|
| 535 |
+
],
|
| 536 |
+
"page_idx": 4
|
| 537 |
+
},
|
| 538 |
+
{
|
| 539 |
+
"type": "text",
|
| 540 |
+
"text": "An MCE is a restricted type of Partially Observable Markov Decision Process, which transitions between one of $M$ modes over time according to a transition distribution, which can depend on the current mode and amount of time spent in the current mode. There are $M$ actions, one for each mode, and the agent receives a reward of $+ 1$ at the end of the episode if it takes the correct action associated with the active mode at each time step. The agent does not observe the mode directly, but rather must infer the mode via a combination of observations and memory use. Different parameterizations place different requirements on how (and if) memory needs to be used to infer the mode and achieve optimal performance. Below we give an intuitive description of the $\\mathbf { M C E s } ^ { 3 }$ in our experiments. ",
|
| 541 |
+
"bbox": [
|
| 542 |
+
176,
|
| 543 |
+
833,
|
| 544 |
+
820,
|
| 545 |
+
861
|
| 546 |
+
],
|
| 547 |
+
"page_idx": 4
|
| 548 |
+
},
|
| 549 |
+
{
|
| 550 |
+
"type": "text",
|
| 551 |
+
"text": "",
|
| 552 |
+
"bbox": [
|
| 553 |
+
174,
|
| 554 |
+
103,
|
| 555 |
+
825,
|
| 556 |
+
200
|
| 557 |
+
],
|
| 558 |
+
"page_idx": 5
|
| 559 |
+
},
|
| 560 |
+
{
|
| 561 |
+
"type": "text",
|
| 562 |
+
"text": "We conduct experiments in three MCE instances, which use memory and observations in fundamentally different ways. This tests our ability to use our approach for determining the type of memory use. 1) Amnesia. This MCE is designed so that the optimal policy does not need memory to track past information and can select optimal actions based on just the current observation. 2) Blind. Here we consider the opposite extreme, where the MCE observations provide no information about optimal actions. Rather, memory must be used to implement counters that keep track of a deterministic mode sequence for determining the optimal actions. 3) Tracker. This MCE is designed so that the optimal policy must both use observations and memory in order to select optimal actions. Intuitively the memory must implement counters that keep track of key time steps where the observations provide information about the mode. In all above instances, we used $M = 4$ modes. ",
|
| 563 |
+
"bbox": [
|
| 564 |
+
174,
|
| 565 |
+
208,
|
| 566 |
+
825,
|
| 567 |
+
347
|
| 568 |
+
],
|
| 569 |
+
"page_idx": 5
|
| 570 |
+
},
|
| 571 |
+
{
|
| 572 |
+
"type": "text",
|
| 573 |
+
"text": "RNN Training. For each MCE instance we use the following recurrent architecture: the input feeds into 1 feed-forward layer with 4 Relu6 nodes (Krizhevsky & Hinton, 2010) $( f _ { t } )$ , followed by a 1-layer GRU with 8 hidden units $\\left( { { h _ { t } } } \\right)$ , followed by a fully connected softmax layer giving a distribution over the $M$ actions (one per mode). Since we know the optimal policy in the MCEs we use imitation learning for training. For all of the MCEs in our experiments, the trained RNNs achieve $100 \\%$ accuracy on the imitation dataset and appeared to produce optimal policies. ",
|
| 574 |
+
"bbox": [
|
| 575 |
+
174,
|
| 576 |
+
354,
|
| 577 |
+
825,
|
| 578 |
+
438
|
| 579 |
+
],
|
| 580 |
+
"page_idx": 5
|
| 581 |
+
},
|
| 582 |
+
{
|
| 583 |
+
"type": "text",
|
| 584 |
+
"text": "MMN Training. The observation QBN $b _ { f }$ and hidden-state QBN $b _ { h }$ have the same architecture, except that the number of quantized bottleneck units $B _ { f }$ and $B _ { h }$ are varied in our experiments. The encoders consist of 1 feed-forward layer of tanh nodes, where the number of nodes is 4 times the size of the bottleneck. This layer feeds into 1 feedforward layer of quantized bottleneck nodes (see Section 4). The decoder for both $b _ { f }$ and $b _ { h }$ has a symmetric architecture to the encoder. Training of $b _ { f }$ and $b _ { h }$ in the MCE environments was extremely fast compared to the RNN training, since QBNs do not need to learn temporal dependencies. We trained QBNs with bottleneck sizes of $B _ { f } \\in \\{ 4 , 8 \\}$ and $B _ { h } \\in \\{ 4 , 8 \\}$ . For each combination of $B _ { f }$ and $B _ { h }$ we embedded the QBNs into the RNN to give a discrete MMN and then measured performance of the MMN before and after fine tuning. Table 1 gives the average test score over 50 test episodes. Score of 1 indicates the agent performed optimally for all episodes. In most of the cases no fine tuning was required (marked as ’-’) since the agent achieved perfect performance immediately after bottleneck insertion due to low reconstruction error. In all other cases, except for Tracker $B _ { h } = 4$ , $B _ { f } = 4 _ { . }$ ) fine-tuning resulted in perfect MMN performance. The exception yielded $98 \\%$ accuracy. Interestingly in that case, we see that if we only insert one of the bottlenecks at a time, we yield perfect performance, which indicates that the combined error accumulation of the two bottlenecks is responsible for the reduced performance. ",
|
| 585 |
+
"bbox": [
|
| 586 |
+
174,
|
| 587 |
+
444,
|
| 588 |
+
825,
|
| 589 |
+
666
|
| 590 |
+
],
|
| 591 |
+
"page_idx": 5
|
| 592 |
+
},
|
| 593 |
+
{
|
| 594 |
+
"type": "text",
|
| 595 |
+
"text": "Moore Machine Extraction. Table 1 also gives the number of states and observations of the MMs extracted from the MMNs both before and after minimization. Recall that the number of states and obsevations before minimization is the number of distinct combinations of values observed for the bottleneck nodes during long executions of the MMN. We see that there are typically significantly more states and observations before minimization than after. This indicates that the MMN learning does not necessarily learn minimal discrete state and observation representations, though the representations accurately describe the RNN. After minimization (Section 4.3), however, in all but one case we get exact minimal machines for each MCE domain. The ground truth minimal machines that are found are shown in the Appendix (Figure 3). This shows that the MMNs learned via QBN insertions were equivalent to the true minimal machines and hence indeed optimal in most cases. The exception matches the case where the MMN did not achieve perfect accuracy. ",
|
| 596 |
+
"bbox": [
|
| 597 |
+
174,
|
| 598 |
+
674,
|
| 599 |
+
825,
|
| 600 |
+
825
|
| 601 |
+
],
|
| 602 |
+
"page_idx": 5
|
| 603 |
+
},
|
| 604 |
+
{
|
| 605 |
+
"type": "text",
|
| 606 |
+
"text": "Examining these machines allows one to understand the memory use. For example, the machine for Blind has just a single observation symbol and hence its transitions cannot depend on the input observations. In contrast, the machine for Amnesia shows that each distinct observation symbol leads to the same state (and hence action choice) regardless of the source state. Thus, the policies action is completely determined by the current observation. ",
|
| 607 |
+
"bbox": [
|
| 608 |
+
174,
|
| 609 |
+
833,
|
| 610 |
+
823,
|
| 611 |
+
876
|
| 612 |
+
],
|
| 613 |
+
"page_idx": 5
|
| 614 |
+
},
|
| 615 |
+
{
|
| 616 |
+
"type": "text",
|
| 617 |
+
"text": "",
|
| 618 |
+
"bbox": [
|
| 619 |
+
171,
|
| 620 |
+
103,
|
| 621 |
+
821,
|
| 622 |
+
132
|
| 623 |
+
],
|
| 624 |
+
"page_idx": 6
|
| 625 |
+
},
|
| 626 |
+
{
|
| 627 |
+
"type": "table",
|
| 628 |
+
"img_path": "images/7b2b5f5f58062cbcc4358ec32db84938637b24bfb58429e5f1ffd40ea955f9b8.jpg",
|
| 629 |
+
"table_caption": [
|
| 630 |
+
"Table 1: Moore Machine extraction for MCE "
|
| 631 |
+
],
|
| 632 |
+
"table_footnote": [],
|
| 633 |
+
"table_body": "<table><tr><td rowspan=2 colspan=1>Game</td><td rowspan=2 colspan=1>Bh,Bf</td><td rowspan=1 colspan=2>Fine-TuningScore</td><td rowspan=1 colspan=3>BeforeMinimization</td><td rowspan=1 colspan=3>AfterMinimization</td></tr><tr><td rowspan=1 colspan=1>Before(%)</td><td rowspan=1 colspan=1>After(%)</td><td rowspan=1 colspan=1>H</td><td rowspan=1 colspan=1>0</td><td rowspan=1 colspan=1>Acc.(%)</td><td rowspan=1 colspan=1>H</td><td rowspan=1 colspan=1>|0|</td><td rowspan=1 colspan=1>Acc.(%)</td></tr><tr><td rowspan=3 colspan=1>Amnesia</td><td rowspan=2 colspan=1>4,44,8</td><td rowspan=2 colspan=1>0.980.99</td><td rowspan=2 colspan=1>11</td><td rowspan=2 colspan=1>77</td><td rowspan=2 colspan=1>57</td><td rowspan=1 colspan=1>1</td><td rowspan=2 colspan=1>44</td><td rowspan=2 colspan=1>44</td><td rowspan=2 colspan=1>11</td></tr><tr><td rowspan=1 colspan=1>1</td></tr><tr><td rowspan=1 colspan=1>8,48,8</td><td rowspan=1 colspan=1>10.99</td><td rowspan=1 colspan=1>-1</td><td rowspan=1 colspan=1>67</td><td rowspan=1 colspan=1>57</td><td rowspan=1 colspan=1>11</td><td rowspan=1 colspan=1>44</td><td rowspan=1 colspan=1>44</td><td rowspan=1 colspan=1>11</td></tr><tr><td rowspan=2 colspan=1>Blind</td><td rowspan=1 colspan=1>4,44,8</td><td rowspan=1 colspan=1>11</td><td rowspan=1 colspan=1>-1</td><td rowspan=1 colspan=1>1212</td><td rowspan=1 colspan=1>68</td><td rowspan=1 colspan=1>11</td><td rowspan=1 colspan=1>1010</td><td rowspan=1 colspan=1>11</td><td rowspan=1 colspan=1>11</td></tr><tr><td rowspan=1 colspan=1>8,48,8</td><td rowspan=1 colspan=1>10.78</td><td rowspan=1 colspan=1>-1</td><td rowspan=1 colspan=1>513</td><td rowspan=1 colspan=1>68</td><td rowspan=1 colspan=1>11</td><td rowspan=1 colspan=1>1010</td><td rowspan=1 colspan=1>11</td><td rowspan=1 colspan=1>11</td></tr><tr><td rowspan=4 colspan=1>Tracker</td><td rowspan=2 colspan=1>4,44,8</td><td rowspan=2 colspan=1>0.980.99</td><td rowspan=2 colspan=1>0.981</td><td rowspan=2 colspan=1>5823</td><td rowspan=2 colspan=1>55</td><td rowspan=2 colspan=1>0.981</td><td rowspan=2 colspan=1>5010</td><td rowspan=1 colspan=1>4</td><td rowspan=1 colspan=1>0.98</td></tr><tr><td rowspan=1 colspan=1>4</td><td rowspan=1 colspan=1>1</td></tr><tr><td rowspan=2 colspan=1>8,48,8</td><td rowspan=2 colspan=1>0.980.99</td><td rowspan=2 colspan=1>11</td><td rowspan=2 colspan=1>9185</td><td rowspan=2 colspan=1>55</td><td rowspan=2 colspan=1>11</td><td rowspan=2 colspan=1>1010</td><td rowspan=1 colspan=1>4</td><td rowspan=2 colspan=1>11</td></tr><tr><td rowspan=1 colspan=1>4</td></tr></table>",
|
| 634 |
+
"bbox": [
|
| 635 |
+
230,
|
| 636 |
+
172,
|
| 637 |
+
767,
|
| 638 |
+
412
|
| 639 |
+
],
|
| 640 |
+
"page_idx": 6
|
| 641 |
+
},
|
| 642 |
+
{
|
| 643 |
+
"type": "text",
|
| 644 |
+
"text": "5.2 TOMITA GRAMMARS ",
|
| 645 |
+
"text_level": 1,
|
| 646 |
+
"bbox": [
|
| 647 |
+
174,
|
| 648 |
+
438,
|
| 649 |
+
359,
|
| 650 |
+
453
|
| 651 |
+
],
|
| 652 |
+
"page_idx": 6
|
| 653 |
+
},
|
| 654 |
+
{
|
| 655 |
+
"type": "text",
|
| 656 |
+
"text": "The Tomita Grammars are popular benchmarks for learning finite state machines (FSMs), including work on extracting FSMs from RNNs (e.g. (Watrous & Kuhn, 1992; Weiss et al., 2017)). Here we evaluate our approach over the 7 Tomita Grammars4, where each grammar defines the set of binary strings that should be accepted or rejected. Since, our focus is on policy learning problems, we treat the grammars as environments with two actions ‘accept’ and ‘reject’. Each episode corresponds to a random string that is either part of the particular grammar or not. The agent receives a reward of 1 if the correct action accept/reject is chosen on the last symbol of a string. ",
|
| 657 |
+
"bbox": [
|
| 658 |
+
174,
|
| 659 |
+
464,
|
| 660 |
+
825,
|
| 661 |
+
563
|
| 662 |
+
],
|
| 663 |
+
"page_idx": 6
|
| 664 |
+
},
|
| 665 |
+
{
|
| 666 |
+
"type": "text",
|
| 667 |
+
"text": "RNN Training. The RNN for each grammar is comprised of a one-layer GRU with 10 hidden units, followed by a fully connected softmax layer with 2 nodes (accept/reject). Since we know the optimal policy, we again use imitation learning to train each RNN using the Adam optimizer and learning rate of 0.001. The training dataset is comprised of an equal number of accept/reject strings with lengths uniformly sampled in the range [1,50]. Table 2 presents the test results for the trained RNNs giving the accuracy over a test set of 100 strings drawn from the same distribution as used for training. Other than grammar $\\# 6 ^ { 5 }$ , the RNNs were $100 \\%$ accurate. ",
|
| 668 |
+
"bbox": [
|
| 669 |
+
173,
|
| 670 |
+
569,
|
| 671 |
+
825,
|
| 672 |
+
666
|
| 673 |
+
],
|
| 674 |
+
"page_idx": 6
|
| 675 |
+
},
|
| 676 |
+
{
|
| 677 |
+
"type": "text",
|
| 678 |
+
"text": "MMN Training. Since the raw observations for this problem are from a finite alphabet, we don’t need to employ a bottleneck encoder to discretize the observation features. Thus the only bottleneck learned here is $b _ { h }$ for the hidden memory state. We use the same architecture for $b _ { h }$ as used for the MCE experiments and conduct experiments with $B _ { h } \\in \\{ 8 , 1 6 \\}$ . These bottlenecks were then inserted in the RNNs to give MMNs. The performance of the MMNs before and after fine-tuning are shared in Table 2. In almost all cases, the MMN is able to maintain the performance of the RNN without fine-tuning. Fine tuning provides only minor improvements in other cases, which already are achieving high accuracy. ",
|
| 679 |
+
"bbox": [
|
| 680 |
+
173,
|
| 681 |
+
672,
|
| 682 |
+
825,
|
| 683 |
+
785
|
| 684 |
+
],
|
| 685 |
+
"page_idx": 6
|
| 686 |
+
},
|
| 687 |
+
{
|
| 688 |
+
"type": "text",
|
| 689 |
+
"text": "Moore Machine Extraction. Our results for MM extraction and minimization are in Table 2. In each case, we see a considerable reduction in the MM’s state-space after minimization while accurately maintaining the MMN’s performance. Again, this shows that the MMN learning does not directly result in minimal machines, yet are equivalent to the minimal machines and hence are exact solutions. In all cases, except for grammar 6 the minimized machines are identical to the minimal machines that are known for these grammars (Tomita, 1982). ",
|
| 690 |
+
"bbox": [
|
| 691 |
+
173,
|
| 692 |
+
791,
|
| 693 |
+
825,
|
| 694 |
+
848
|
| 695 |
+
],
|
| 696 |
+
"page_idx": 6
|
| 697 |
+
},
|
| 698 |
+
{
|
| 699 |
+
"type": "table",
|
| 700 |
+
"img_path": "images/74c749936cba5d10a3fa3adba28f6efb2a53201b7242b0fd6f2102b5239dff36.jpg",
|
| 701 |
+
"table_caption": [
|
| 702 |
+
"Table 2: Moore Machine extraction for Tomita grammar "
|
| 703 |
+
],
|
| 704 |
+
"table_footnote": [],
|
| 705 |
+
"table_body": "<table><tr><td rowspan=2 colspan=1>#Grammar</td><td rowspan=2 colspan=1>RNNAcc. (%)</td><td rowspan=2 colspan=1>Bh</td><td rowspan=1 colspan=2>Fine-TuningAcc.(%)</td><td rowspan=1 colspan=2>BeforeMinimization</td><td rowspan=1 colspan=2>AfterMinimization</td></tr><tr><td rowspan=1 colspan=1>Before</td><td rowspan=1 colspan=1>After</td><td rowspan=1 colspan=1>H</td><td rowspan=1 colspan=1>Acc.(%)</td><td rowspan=1 colspan=1>A</td><td rowspan=1 colspan=1>Acc.(%)</td></tr><tr><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>100</td><td rowspan=1 colspan=1>816</td><td rowspan=1 colspan=1>100100</td><td rowspan=1 colspan=1>--</td><td rowspan=1 colspan=1>1328</td><td rowspan=1 colspan=1>100100</td><td rowspan=1 colspan=1>22</td><td rowspan=1 colspan=1>100100</td></tr><tr><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>100</td><td rowspan=1 colspan=1>816</td><td rowspan=1 colspan=1>100100</td><td rowspan=1 colspan=1>--</td><td rowspan=1 colspan=1>1314</td><td rowspan=1 colspan=1>100100</td><td rowspan=1 colspan=1>33</td><td rowspan=1 colspan=1>100100</td></tr><tr><td rowspan=1 colspan=1>3</td><td rowspan=1 colspan=1>100</td><td rowspan=1 colspan=1>816</td><td rowspan=1 colspan=1>100100</td><td rowspan=1 colspan=1>--</td><td rowspan=1 colspan=1>3439</td><td rowspan=1 colspan=1>100100</td><td rowspan=1 colspan=1>55</td><td rowspan=1 colspan=1>100100</td></tr><tr><td rowspan=1 colspan=1>4</td><td rowspan=1 colspan=1>100</td><td rowspan=1 colspan=1>816</td><td rowspan=1 colspan=1>100100</td><td rowspan=1 colspan=1>-1</td><td rowspan=1 colspan=1>1718</td><td rowspan=1 colspan=1>100100</td><td rowspan=1 colspan=1>44</td><td rowspan=1 colspan=1>100100</td></tr><tr><td rowspan=1 colspan=1>5</td><td rowspan=1 colspan=1>100</td><td rowspan=1 colspan=1>816</td><td rowspan=1 colspan=1>95100</td><td rowspan=1 colspan=1>961</td><td rowspan=1 colspan=1>192316</td><td rowspan=1 colspan=1>96100</td><td rowspan=1 colspan=1>1154</td><td rowspan=1 colspan=1>96100</td></tr><tr><td rowspan=1 colspan=1>6</td><td rowspan=1 colspan=1>99</td><td rowspan=1 colspan=1>816</td><td rowspan=1 colspan=1>9899</td><td rowspan=1 colspan=1>9899</td><td rowspan=1 colspan=1>100518</td><td rowspan=1 colspan=1>9899</td><td rowspan=1 colspan=1>1211</td><td rowspan=1 colspan=1>9899</td></tr><tr><td rowspan=1 colspan=1>7</td><td rowspan=1 colspan=1>100</td><td rowspan=1 colspan=1>816</td><td rowspan=1 colspan=1>100100</td><td rowspan=1 colspan=1>-1</td><td rowspan=1 colspan=1>25107</td><td rowspan=1 colspan=1>100100</td><td rowspan=1 colspan=1>55</td><td rowspan=1 colspan=1>100100</td></tr></table>",
|
| 706 |
+
"bbox": [
|
| 707 |
+
236,
|
| 708 |
+
128,
|
| 709 |
+
761,
|
| 710 |
+
398
|
| 711 |
+
],
|
| 712 |
+
"page_idx": 7
|
| 713 |
+
},
|
| 714 |
+
{
|
| 715 |
+
"type": "text",
|
| 716 |
+
"text": "",
|
| 717 |
+
"bbox": [
|
| 718 |
+
176,
|
| 719 |
+
426,
|
| 720 |
+
823,
|
| 721 |
+
454
|
| 722 |
+
],
|
| 723 |
+
"page_idx": 7
|
| 724 |
+
},
|
| 725 |
+
{
|
| 726 |
+
"type": "text",
|
| 727 |
+
"text": "6 ATARI EXPERIMENTS ",
|
| 728 |
+
"text_level": 1,
|
| 729 |
+
"bbox": [
|
| 730 |
+
174,
|
| 731 |
+
477,
|
| 732 |
+
383,
|
| 733 |
+
492
|
| 734 |
+
],
|
| 735 |
+
"page_idx": 7
|
| 736 |
+
},
|
| 737 |
+
{
|
| 738 |
+
"type": "text",
|
| 739 |
+
"text": "In this section, we consider applying our technique to RNNs learned for six Atari6 games using the OpenAI gym (Brockman et al., 2016). Unlike the above experiments, where we knew the ground truth MMs, for Atari we did not have any preconception of what the MMs might look and how large they might be. The fact that the input observations for Atari (i.e. images) are much more complex than the previous experiments inputs makes it completely unclear if we can expect similar types of results. There have been other recent efforts towards understanding Atari agents (Zahavy et al., 2016; Greydanus et al., 2017). However, we are not aware of any other work which aims to extract finite state representations for Atari policies. ",
|
| 740 |
+
"bbox": [
|
| 741 |
+
174,
|
| 742 |
+
508,
|
| 743 |
+
825,
|
| 744 |
+
621
|
| 745 |
+
],
|
| 746 |
+
"page_idx": 7
|
| 747 |
+
},
|
| 748 |
+
{
|
| 749 |
+
"type": "text",
|
| 750 |
+
"text": "RNN Training. All the Atari agents have the same recurrent architecture. The input observation is an image frame, preprocessed by gray-scaling, $2 \\mathbf { x }$ down-sampling, cropping to an $8 0 \\times 8 0$ square and normalizing the values to [0, 1]. The network has 4 convolutional layers (kernel size 3, strides 2, padding 1, and 32,32,16,4 filters respectively). We used Relu as the intermediate activation and Relu6 over the last convolutional layer. This is followed by a GRU layer with 32 hidden units and a fully connected layer with $n { + 1 }$ units, where $n$ is the dimension of the Atari action space. We applied a softmax to first $n$ neurons to obtain the policy and used the last neuron to predict the value function. We used the A3C RL algorithm (Mnih et al., 2016) (learning rate $1 0 ^ { - 4 }$ , discount factor 0.99) and computed loss on the policy using Generalized Advantage Estimation $\\lambda = 1 . 0$ ) (Schulman et al., 2015). We report the trained RNN performance on our six games in the second column of Table 3. ",
|
| 751 |
+
"bbox": [
|
| 752 |
+
173,
|
| 753 |
+
627,
|
| 754 |
+
825,
|
| 755 |
+
766
|
| 756 |
+
],
|
| 757 |
+
"page_idx": 7
|
| 758 |
+
},
|
| 759 |
+
{
|
| 760 |
+
"type": "text",
|
| 761 |
+
"text": "MMN Training. We used the same general architecture for the QBN $b _ { f }$ as used for the MCE experiments, but adjusted the encoder input and decoder output sizes to match the dimension of the continuous observation features $f _ { t }$ . For $b _ { h }$ , the encoder has 3 feed-forward layers with $( 8 \\times$ $B _ { h . }$ ), $( 4 \\times B _ { h } )$ and $B _ { h }$ nodes. The decoder is symmetric to the encoder. For the Atari domains, the training data for $b _ { f }$ and $b _ { h }$ was generated using noisy rollouts. In particular, each training episode was generated by executing the learned RNN for a random number of steps and then executing an $\\epsilon$ -greedy (with $\\epsilon = 0 . 3$ ) version of the RNN policy. This is intended to increase the diversity of the training data and we found that it helps to more robustly learn the QBNs. We trained bottlenecks for ",
|
| 762 |
+
"bbox": [
|
| 763 |
+
173,
|
| 764 |
+
772,
|
| 765 |
+
825,
|
| 766 |
+
885
|
| 767 |
+
],
|
| 768 |
+
"page_idx": 7
|
| 769 |
+
},
|
| 770 |
+
{
|
| 771 |
+
"type": "text",
|
| 772 |
+
"text": "$B _ { h } \\in \\{ 6 4 , 1 2 8 \\}$ and $B _ { f } \\in \\{ 1 0 0 , 4 0 0 \\}$ noting that these values are significantly larger than for our earlier experiments due to the complexity of Atari. Note that while there are an enormous number of potential discrete states for these values of $B _ { h }$ the actual number of states observed and hence the number of MMN states can be substantially smaller. Each bottleneck was trained to the point of saturation of training loss and then inserted into the RNN to give an MMN for each Atari game. ",
|
| 773 |
+
"bbox": [
|
| 774 |
+
174,
|
| 775 |
+
103,
|
| 776 |
+
823,
|
| 777 |
+
172
|
| 778 |
+
],
|
| 779 |
+
"page_idx": 8
|
| 780 |
+
},
|
| 781 |
+
{
|
| 782 |
+
"type": "text",
|
| 783 |
+
"text": "MMN Performance. Table 3 gives the performance of the trained MMNs before and after finetuning for different combinations of $B _ { h }$ and $B _ { f }$ . We see that for 4 games, Pong, Freeway, Bowling, and Boxing, the MMNs after fine tuning either achieve identical scores to the RNN or very close (in the case of boxing). This demonstrates the ability to learn a discrete representation of the input and memory for these complex games with no impact on performance. We see that for Boxing and Pong fine tuning was required to match the RNN performance. In the case of Freeway and Bowling, fine-tuning was not required. ",
|
| 784 |
+
"bbox": [
|
| 785 |
+
173,
|
| 786 |
+
180,
|
| 787 |
+
825,
|
| 788 |
+
279
|
| 789 |
+
],
|
| 790 |
+
"page_idx": 8
|
| 791 |
+
},
|
| 792 |
+
{
|
| 793 |
+
"type": "text",
|
| 794 |
+
"text": "In the remaining two games, Breakout and Space Invaders, we see that the MMNs learned after fine tuning achieve lower scores than the original RNNs, though the scores are still relatively good. On further investigation, we found that this drop in performance was due to poor reconstruction on some rare parts of the game. For example, in Breakout, after the first board is cleared, the policy needs to press the fire-button to continue, but the learned MMN does not do this and instead times out, which results in less score. This motivates the investigation into more intelligent approaches for training QBNs to capture critical information in such rare, but critically important, states. ",
|
| 795 |
+
"bbox": [
|
| 796 |
+
174,
|
| 797 |
+
285,
|
| 798 |
+
825,
|
| 799 |
+
382
|
| 800 |
+
],
|
| 801 |
+
"page_idx": 8
|
| 802 |
+
},
|
| 803 |
+
{
|
| 804 |
+
"type": "text",
|
| 805 |
+
"text": "MM Minimization. We see from Table 3 that before minimization, the MMs often have relatively large numbers of discrete states and observations. This is unsurprising given that we are using relatively large values of $B _ { h }$ and $B _ { f }$ . However, we see that after minimizing the MMNs the number of states and observations reduces by orders of magnitude, sometimes to just a single state and/or single observation. The number of states and observations in many cases are small enough to write out and analyze by hand, making them amenable to careful analysis. However, this analysis is likely to be non-trivial for moderately complex policies due to the need to understand the “meaning” of the observations and in turn of the states. ",
|
| 806 |
+
"bbox": [
|
| 807 |
+
174,
|
| 808 |
+
388,
|
| 809 |
+
825,
|
| 810 |
+
500
|
| 811 |
+
],
|
| 812 |
+
"page_idx": 8
|
| 813 |
+
},
|
| 814 |
+
{
|
| 815 |
+
"type": "text",
|
| 816 |
+
"text": "Understanding Memory Use. We were surprised to observe in Atari the same three types of memory use considered for the MCE domains above. First, we see that the MM for Pong has just three states (one per action) and 10 discrete observation symbols (see Figure 2a). Most importantly we see that each observation transitions to the same state (and hence action) regardless of the current state. So we can view this MM as defining a set of rule that maps individual observations to actions with no memory necessary. In this sense, the Pong policy is analogous to the Amnesia MCE [5.1]. ",
|
| 817 |
+
"bbox": [
|
| 818 |
+
174,
|
| 819 |
+
507,
|
| 820 |
+
823,
|
| 821 |
+
592
|
| 822 |
+
],
|
| 823 |
+
"page_idx": 8
|
| 824 |
+
},
|
| 825 |
+
{
|
| 826 |
+
"type": "text",
|
| 827 |
+
"text": "In contrast, we see that in both Bowling and Freeway there is only one observation symbol in the minimal MM. This means that the MM actually ignores the input image when selecting actions. Rather the policies are open-loop controllers whose action just depends on the time-step rather than the observations. Thus, these policies are analogous to the Blind MCE [5.1]. Freeway has a particularly trivial policy that always takes the Up action at each time step. While this policy behavior could have been determined by looking at the action sequence of the rollouts, it is encouraging that our MM extraction approach also discovered this. As shown in Figure 2b, Bowling has a more interesting open-loop policy structure where it has an initial sequence of actions and then a loop is entered where the action sequence is repeated. It is not immediately obvious that this policy has such an open-loop structure by just watching the policy. Thus, we can see that the MM extraction approach we use here can provide significant additional insight. ",
|
| 828 |
+
"bbox": [
|
| 829 |
+
174,
|
| 830 |
+
598,
|
| 831 |
+
825,
|
| 832 |
+
751
|
| 833 |
+
],
|
| 834 |
+
"page_idx": 8
|
| 835 |
+
},
|
| 836 |
+
{
|
| 837 |
+
"type": "text",
|
| 838 |
+
"text": "Breakout, Space Invaders and Boxing use both memory and observations based on our analysis of the MM transition structures. We have not yet attempted a full semantic analysis of the discrete observations and states for any of the Atari policies. This will require additional visualization and interaction tools and is an important direction of future work that is enabled by our approach. ",
|
| 839 |
+
"bbox": [
|
| 840 |
+
174,
|
| 841 |
+
758,
|
| 842 |
+
825,
|
| 843 |
+
813
|
| 844 |
+
],
|
| 845 |
+
"page_idx": 8
|
| 846 |
+
},
|
| 847 |
+
{
|
| 848 |
+
"type": "text",
|
| 849 |
+
"text": "7 SUMMARY AND FUTURE WORK ",
|
| 850 |
+
"text_level": 1,
|
| 851 |
+
"bbox": [
|
| 852 |
+
176,
|
| 853 |
+
835,
|
| 854 |
+
468,
|
| 855 |
+
852
|
| 856 |
+
],
|
| 857 |
+
"page_idx": 8
|
| 858 |
+
},
|
| 859 |
+
{
|
| 860 |
+
"type": "text",
|
| 861 |
+
"text": "Motivated by the goal of better understanding memory use in RNN polices, we introduced an approach for extracting finite state Moore Machines from those policies. The key idea, bottleneck insertion, is to train Quantized Bottleneck Networks to produce binary encodings of continuous RNN memory and input features, and then insert those bottlenecks into the RNN. This yields a near equivalent Moore Machine Network (MMN) which has quantized memory and observation features. From the MMN we then extract a discrete Moore machine that can then be transformed into an equivalent minimal machine for analysis and usage. Our results on two environments where the ground truth machines are known show that our approach is able to accurately extract the ground truth. We also show experiments in six Atari games, where we have no prior insight into the ground truth machines. We show that, in most cases, the learned MMNs maintain similar performance to the original RNN policies. Further, the extracted machines provide insight into the memory usage of the policies. First, we see that the number of required memory states and observations is surprisingly small. Second, we can identify cases where the policy did not use memory in a significant way (e.g. Pong) and policies that relied only on memory and ignored the observations (e.g. Bowling and Freeway). To our knowledge, this is the first work where this type of insight was reported for policies in such complex domains. A key direction for future work is to develop tools and visualizations for attaching meaning to the discrete observations and in turn states, which will allow for an additional level of insight into the policies. It is also worth considering the use of tools for analyzing finite-state machine structure to gain further insight and analyze formal properties of the policies. ",
|
| 862 |
+
"bbox": [
|
| 863 |
+
174,
|
| 864 |
+
867,
|
| 865 |
+
823,
|
| 866 |
+
922
|
| 867 |
+
],
|
| 868 |
+
"page_idx": 8
|
| 869 |
+
},
|
| 870 |
+
{
|
| 871 |
+
"type": "table",
|
| 872 |
+
"img_path": "images/c7744cb88de1ce65fe21c0249b937cc3218b922de3bb9b1125197afa4309833c.jpg",
|
| 873 |
+
"table_caption": [
|
| 874 |
+
"Table 3: Moore Machine extraction for trained Atari RNN policies. DQN (Mnih et al., 2015), A3C (Mnih et al., 2016) scores have been reported for performance comparison with trained policies. "
|
| 875 |
+
],
|
| 876 |
+
"table_footnote": [],
|
| 877 |
+
"table_body": "<table><tr><td rowspan=\"3\">Game (# of actions)</td><td rowspan=\"3\">DQN (Score)</td><td rowspan=\"3\">A3C LSTM (Score)</td><td rowspan=\"3\">RNN (Score)</td><td rowspan=\"3\">(Bh,Bf)</td><td colspan=\"2\">Fine-Tuning Score</td><td colspan=\"3\">Before Minimization</td><td colspan=\"3\">After Minimization</td></tr><tr><td>Before</td><td>After</td><td>H</td><td>10</td><td>Score</td><td>间</td><td>10</td><td>Score</td></tr><tr><td>20</td><td>21</td><td>380</td><td>374</td><td>21</td><td></td><td></td><td></td></tr><tr><td rowspan=\"4\">Pong (3)</td><td rowspan=\"4\">18.9</td><td rowspan=\"4\">10.7</td><td rowspan=\"4\">21</td><td>64,100 64,400</td><td>20</td><td>21</td><td>373</td><td>372</td><td>21</td><td>4 3</td><td>12 10</td><td>21 21</td></tr><tr><td>128,100</td><td>20</td><td>21</td><td>383</td><td>373</td><td>21</td><td>3</td><td>12</td><td>21</td></tr><tr><td>128,400</td><td>20</td><td>21</td><td>379</td><td>371</td><td>21</td><td>3</td><td>11</td><td>21</td></tr><tr><td>64,100</td><td>21</td><td>:</td><td>11</td><td>11</td><td>21</td><td>11</td><td>1</td><td>21</td></tr><tr><td rowspan=\"3\">Freeway (3)</td><td rowspan=\"3\">30.3</td><td rowspan=\"3\">0.1</td><td rowspan=\"3\">21</td><td>64,400</td><td>21</td><td></td><td></td><td></td><td>21</td><td></td><td></td><td>21</td></tr><tr><td>128,100 128,400</td><td>21 21</td><td>:</td><td>1 1</td><td>1 1</td><td>21 21</td><td>11</td><td>1 1</td><td>21</td></tr><tr><td>64,100</td><td>32</td><td>423</td><td>1898</td><td>1874</td><td>423</td><td>8</td><td>3</td><td>21 423</td></tr><tr><td rowspan=\"4\">Breakout (4)</td><td rowspan=\"4\">401.2</td><td rowspan=\"4\">766.8</td><td rowspan=\"4\">773</td><td>64,400</td><td>25</td><td>415</td><td>1888</td><td>1871</td><td>415</td><td>8</td><td></td><td>415</td></tr><tr><td>128,100</td><td>41</td><td>377</td><td>1583</td><td>1514</td><td>377</td><td>11</td><td>30</td><td>377</td></tr><tr><td>128,400</td><td>85</td><td>379</td><td>1729</td><td>1769</td><td>379</td><td>8</td><td></td><td>379</td></tr><tr><td>64,100</td><td>520</td><td>1335</td><td>1495</td><td>1502</td><td>1335</td><td>8</td><td></td><td>1335</td></tr><tr><td rowspan=\"3\">Space Invaders (4)</td><td rowspan=\"3\">1976</td><td rowspan=\"3\">23846</td><td rowspan=\"3\">1820</td><td>64,400</td><td>365</td><td>1235</td><td>1625</td><td>1620</td><td>1235</td><td>12</td><td>29</td><td>1235</td></tr><tr><td>128,100</td><td>390</td><td>1040</td><td>1563</td><td>1457</td><td>1040</td><td>12</td><td>35</td><td>1040</td></tr><tr><td>128,400</td><td>520</td><td>1430</td><td>1931</td><td>1921</td><td>1430</td><td>6</td><td>27</td><td>1430</td></tr><tr><td rowspan=\"4\">Bowling (6)</td><td rowspan=\"4\">42.4</td><td rowspan=\"4\">41.8</td><td rowspan=\"4\">60</td><td>64,100 64,400</td><td>60</td><td>-</td><td>49</td><td>1</td><td>60</td><td>33</td><td>1</td><td>60</td></tr><tr><td></td><td>60</td><td>-</td><td>49</td><td>1</td><td>60</td><td>33</td><td>1</td><td>60</td></tr><tr><td>128,100</td><td>60</td><td>-</td><td>26</td><td>11</td><td>60</td><td>24</td><td>T</td><td>60</td></tr><tr><td>128,400</td><td>60</td><td>-</td><td>26</td><td></td><td>60</td><td>24</td><td></td><td>60</td></tr><tr><td rowspan=\"4\">Boxing (18)</td><td rowspan=\"4\">71.8</td><td rowspan=\"4\">37.3</td><td rowspan=\"4\">100</td><td>64,100</td><td>94</td><td>100</td><td>1173</td><td>1167</td><td>100</td><td>13</td><td>79</td><td>100</td></tr><tr><td>64,400</td><td>98</td><td>100</td><td>2621</td><td>2605</td><td>100</td><td>14</td><td>119</td><td>100</td></tr><tr><td>128,100</td><td>94</td><td>97</td><td>2499</td><td>2482</td><td>97</td><td>14</td><td>106</td><td>97</td></tr><tr><td>128,400</td><td>97</td><td>100</td><td>1173</td><td>1169</td><td>100</td><td>14</td><td>88</td><td>100</td></tr></table>",
|
| 878 |
+
"bbox": [
|
| 879 |
+
169,
|
| 880 |
+
142,
|
| 881 |
+
834,
|
| 882 |
+
486
|
| 883 |
+
],
|
| 884 |
+
"page_idx": 9
|
| 885 |
+
},
|
| 886 |
+
{
|
| 887 |
+
"type": "image",
|
| 888 |
+
"img_path": "images/d3fb4e58681fc6a910ba757405979178b3787603f3c9e9e2303e94b5bbb72621.jpg",
|
| 889 |
+
"image_caption": [
|
| 890 |
+
"Figure 2: Moore Machine representation for Atari policies "
|
| 891 |
+
],
|
| 892 |
+
"image_footnote": [],
|
| 893 |
+
"bbox": [
|
| 894 |
+
214,
|
| 895 |
+
508,
|
| 896 |
+
800,
|
| 897 |
+
671
|
| 898 |
+
],
|
| 899 |
+
"page_idx": 9
|
| 900 |
+
},
|
| 901 |
+
{
|
| 902 |
+
"type": "text",
|
| 903 |
+
"text": "",
|
| 904 |
+
"bbox": [
|
| 905 |
+
173,
|
| 906 |
+
715,
|
| 907 |
+
825,
|
| 908 |
+
924
|
| 909 |
+
],
|
| 910 |
+
"page_idx": 9
|
| 911 |
+
},
|
| 912 |
+
{
|
| 913 |
+
"type": "text",
|
| 914 |
+
"text": "REFERENCES ",
|
| 915 |
+
"text_level": 1,
|
| 916 |
+
"bbox": [
|
| 917 |
+
174,
|
| 918 |
+
102,
|
| 919 |
+
287,
|
| 920 |
+
118
|
| 921 |
+
],
|
| 922 |
+
"page_idx": 10
|
| 923 |
+
},
|
| 924 |
+
{
|
| 925 |
+
"type": "text",
|
| 926 |
+
"text": "Leila Arras, Gregoire Montavon, Klaus-Robert M ´ uller, and Wojciech Samek. Explaining recurrent ¨ neural network predictions in sentiment analysis. arXiv preprint arXiv:1706.07206, 2017. ",
|
| 927 |
+
"bbox": [
|
| 928 |
+
174,
|
| 929 |
+
126,
|
| 930 |
+
821,
|
| 931 |
+
155
|
| 932 |
+
],
|
| 933 |
+
"page_idx": 10
|
| 934 |
+
},
|
| 935 |
+
{
|
| 936 |
+
"type": "text",
|
| 937 |
+
"text": "Yoshua Bengio, Nicholas Leonard, and Aaron Courville. Estimating or propagating gradients ´ through stochastic neurons for conditional computation. arXiv preprint arXiv:1308.3432, 2013. ",
|
| 938 |
+
"bbox": [
|
| 939 |
+
176,
|
| 940 |
+
161,
|
| 941 |
+
821,
|
| 942 |
+
191
|
| 943 |
+
],
|
| 944 |
+
"page_idx": 10
|
| 945 |
+
},
|
| 946 |
+
{
|
| 947 |
+
"type": "text",
|
| 948 |
+
"text": "Greg Brockman, Vicki Cheung, Ludwig Pettersson, Jonas Schneider, John Schulman, Jie Tang, and Wojciech Zaremba. Openai gym. arXiv preprint arXiv:1606.01540, 2016. ",
|
| 949 |
+
"bbox": [
|
| 950 |
+
173,
|
| 951 |
+
199,
|
| 952 |
+
823,
|
| 953 |
+
228
|
| 954 |
+
],
|
| 955 |
+
"page_idx": 10
|
| 956 |
+
},
|
| 957 |
+
{
|
| 958 |
+
"type": "text",
|
| 959 |
+
"text": "Adelmo Luis Cechin, D Regina, P Simon, and K Stertz. State automata extraction from recurrent neural nets using k-means and fuzzy clustering. In Chilean Computer Science Society, 2003. SCCC 2003. Proceedings. 23rd International Conference of the, pp. 73–78. IEEE, 2003. ",
|
| 960 |
+
"bbox": [
|
| 961 |
+
174,
|
| 962 |
+
236,
|
| 963 |
+
825,
|
| 964 |
+
280
|
| 965 |
+
],
|
| 966 |
+
"page_idx": 10
|
| 967 |
+
},
|
| 968 |
+
{
|
| 969 |
+
"type": "text",
|
| 970 |
+
"text": "Kyunghyun Cho, Bart Van Merrienboer, Dzmitry Bahdanau, and Yoshua Bengio. On the properties ¨ of neural machine translation: Encoder-decoder approaches. arXiv preprint arXiv:1409.1259, 2014. ",
|
| 971 |
+
"bbox": [
|
| 972 |
+
174,
|
| 973 |
+
287,
|
| 974 |
+
825,
|
| 975 |
+
330
|
| 976 |
+
],
|
| 977 |
+
"page_idx": 10
|
| 978 |
+
},
|
| 979 |
+
{
|
| 980 |
+
"type": "text",
|
| 981 |
+
"text": "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. ",
|
| 982 |
+
"bbox": [
|
| 983 |
+
171,
|
| 984 |
+
338,
|
| 985 |
+
825,
|
| 986 |
+
368
|
| 987 |
+
],
|
| 988 |
+
"page_idx": 10
|
| 989 |
+
},
|
| 990 |
+
{
|
| 991 |
+
"type": "text",
|
| 992 |
+
"text": "Matthieu Courbariaux, Itay Hubara, Daniel Soudry, Ran El-Yaniv, and Yoshua Bengio. Binarized neural networks: Training deep neural networks with weights and activations constrained to $+ 1$ or-1. arXiv preprint arXiv:1602.02830, 2016. ",
|
| 993 |
+
"bbox": [
|
| 994 |
+
174,
|
| 995 |
+
376,
|
| 996 |
+
823,
|
| 997 |
+
419
|
| 998 |
+
],
|
| 999 |
+
"page_idx": 10
|
| 1000 |
+
},
|
| 1001 |
+
{
|
| 1002 |
+
"type": "text",
|
| 1003 |
+
"text": "Sam Greydanus, Anurag Koul, Jonathan Dodge, and Alan Fern. Visualizing and understanding atari agents. arXiv preprint arXiv:1711.00138, 2017. ",
|
| 1004 |
+
"bbox": [
|
| 1005 |
+
171,
|
| 1006 |
+
426,
|
| 1007 |
+
825,
|
| 1008 |
+
455
|
| 1009 |
+
],
|
| 1010 |
+
"page_idx": 10
|
| 1011 |
+
},
|
| 1012 |
+
{
|
| 1013 |
+
"type": "text",
|
| 1014 |
+
"text": "Geoffrey Hinton. Neural networks for machine learning. video lectures, 2012. ",
|
| 1015 |
+
"bbox": [
|
| 1016 |
+
173,
|
| 1017 |
+
463,
|
| 1018 |
+
687,
|
| 1019 |
+
479
|
| 1020 |
+
],
|
| 1021 |
+
"page_idx": 10
|
| 1022 |
+
},
|
| 1023 |
+
{
|
| 1024 |
+
"type": "text",
|
| 1025 |
+
"text": "Geoffrey E Hinton and Ruslan R Salakhutdinov. Reducing the dimensionality of data with neural networks. science, 313(5786):504–507, 2006. ",
|
| 1026 |
+
"bbox": [
|
| 1027 |
+
174,
|
| 1028 |
+
487,
|
| 1029 |
+
826,
|
| 1030 |
+
516
|
| 1031 |
+
],
|
| 1032 |
+
"page_idx": 10
|
| 1033 |
+
},
|
| 1034 |
+
{
|
| 1035 |
+
"type": "text",
|
| 1036 |
+
"text": "Sepp Hochreiter and Jurgen Schmidhuber. Long short-term memory. ¨ Neural computation, 9(8): 1735–1780, 1997. ",
|
| 1037 |
+
"bbox": [
|
| 1038 |
+
173,
|
| 1039 |
+
525,
|
| 1040 |
+
823,
|
| 1041 |
+
553
|
| 1042 |
+
],
|
| 1043 |
+
"page_idx": 10
|
| 1044 |
+
},
|
| 1045 |
+
{
|
| 1046 |
+
"type": "text",
|
| 1047 |
+
"text": "Henrik Jacobsson. Rule extraction from recurrent neural networks: Ataxonomy and review. Neural Computation, 17(6):1223–1263, 2005. ",
|
| 1048 |
+
"bbox": [
|
| 1049 |
+
174,
|
| 1050 |
+
561,
|
| 1051 |
+
823,
|
| 1052 |
+
590
|
| 1053 |
+
],
|
| 1054 |
+
"page_idx": 10
|
| 1055 |
+
},
|
| 1056 |
+
{
|
| 1057 |
+
"type": "text",
|
| 1058 |
+
"text": "Andrej Karpathy, Justin Johnson, and Li Fei-Fei. Visualizing and understanding recurrent networks. arXiv preprint arXiv:1506.02078, 2015. ",
|
| 1059 |
+
"bbox": [
|
| 1060 |
+
173,
|
| 1061 |
+
598,
|
| 1062 |
+
823,
|
| 1063 |
+
627
|
| 1064 |
+
],
|
| 1065 |
+
"page_idx": 10
|
| 1066 |
+
},
|
| 1067 |
+
{
|
| 1068 |
+
"type": "text",
|
| 1069 |
+
"text": "Alex Krizhevsky and Geoff Hinton. Convolutional deep belief networks on cifar-10. Unpublished manuscript, 40(7), 2010. ",
|
| 1070 |
+
"bbox": [
|
| 1071 |
+
173,
|
| 1072 |
+
636,
|
| 1073 |
+
823,
|
| 1074 |
+
665
|
| 1075 |
+
],
|
| 1076 |
+
"page_idx": 10
|
| 1077 |
+
},
|
| 1078 |
+
{
|
| 1079 |
+
"type": "text",
|
| 1080 |
+
"text": "Tom Mikolov, Martin Karafiat, Luk Burget, and Sanjeev Khudanpur.´ Recurrent neural network based language model. INTERSPEECH 2010, 11th Annual Conference of the International Speech Communication Association, pp. 1045–1048, 2010. URL http://www.fit.vutbr.cz/research/groups/speech/publi/2010/ mikolov_interspeech2010_IS100722.pdf. ",
|
| 1081 |
+
"bbox": [
|
| 1082 |
+
173,
|
| 1083 |
+
672,
|
| 1084 |
+
825,
|
| 1085 |
+
743
|
| 1086 |
+
],
|
| 1087 |
+
"page_idx": 10
|
| 1088 |
+
},
|
| 1089 |
+
{
|
| 1090 |
+
"type": "text",
|
| 1091 |
+
"text": "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, 2015. doi: 10.1038/nature14236. URL https://storage.googleapis. com/deepmind-media/dqn/DQNNaturePaper.pdf. ",
|
| 1092 |
+
"bbox": [
|
| 1093 |
+
174,
|
| 1094 |
+
751,
|
| 1095 |
+
825,
|
| 1096 |
+
837
|
| 1097 |
+
],
|
| 1098 |
+
"page_idx": 10
|
| 1099 |
+
},
|
| 1100 |
+
{
|
| 1101 |
+
"type": "text",
|
| 1102 |
+
"text": "Volodymyr Mnih, Adria Puigdomenech Badia, Mehdi Mirza, Alex Graves, Timothy Lillicrap, Tim Harley, David Silver, and Koray Kavukcuoglu. Asynchronous methods for deep reinforcement learning. In International conference on machine learning, pp. 1928–1937, 2016. ",
|
| 1103 |
+
"bbox": [
|
| 1104 |
+
176,
|
| 1105 |
+
844,
|
| 1106 |
+
821,
|
| 1107 |
+
887
|
| 1108 |
+
],
|
| 1109 |
+
"page_idx": 10
|
| 1110 |
+
},
|
| 1111 |
+
{
|
| 1112 |
+
"type": "text",
|
| 1113 |
+
"text": "W James Murdoch and Arthur Szlam. Automatic rule extraction from long short term memory networks. arXiv preprint arXiv:1702.02540, 2017. ",
|
| 1114 |
+
"bbox": [
|
| 1115 |
+
174,
|
| 1116 |
+
895,
|
| 1117 |
+
820,
|
| 1118 |
+
924
|
| 1119 |
+
],
|
| 1120 |
+
"page_idx": 10
|
| 1121 |
+
},
|
| 1122 |
+
{
|
| 1123 |
+
"type": "text",
|
| 1124 |
+
"text": "Christian W Omlin and C Lee Giles. Extraction of rules from discrete-time recurrent neural networks. Neural networks, 9(1):41–52, 1996. ",
|
| 1125 |
+
"bbox": [
|
| 1126 |
+
171,
|
| 1127 |
+
103,
|
| 1128 |
+
823,
|
| 1129 |
+
132
|
| 1130 |
+
],
|
| 1131 |
+
"page_idx": 11
|
| 1132 |
+
},
|
| 1133 |
+
{
|
| 1134 |
+
"type": "text",
|
| 1135 |
+
"text": "Marvin C Paull and Stephen H Unger. Minimizing the number of states in incompletely specified sequential switching functions. IRE Transactions on Electronic Computers, (3):356–367, 1959. ",
|
| 1136 |
+
"bbox": [
|
| 1137 |
+
171,
|
| 1138 |
+
141,
|
| 1139 |
+
823,
|
| 1140 |
+
170
|
| 1141 |
+
],
|
| 1142 |
+
"page_idx": 11
|
| 1143 |
+
},
|
| 1144 |
+
{
|
| 1145 |
+
"type": "text",
|
| 1146 |
+
"text": "Silviu Pitis. Beyond binary: Ternary and one-hot neurons. https://r2rt.com/ beyond-binary-ternary-and-one-hot-neurons.html, 2017. ",
|
| 1147 |
+
"bbox": [
|
| 1148 |
+
171,
|
| 1149 |
+
179,
|
| 1150 |
+
821,
|
| 1151 |
+
208
|
| 1152 |
+
],
|
| 1153 |
+
"page_idx": 11
|
| 1154 |
+
},
|
| 1155 |
+
{
|
| 1156 |
+
"type": "text",
|
| 1157 |
+
"text": "John Schulman, Philipp Moritz, Sergey Levine, Michael Jordan, and Pieter Abbeel. Highdimensional continuous control using generalized advantage estimation. arXiv preprint arXiv:1506.02438, 2015. ",
|
| 1158 |
+
"bbox": [
|
| 1159 |
+
173,
|
| 1160 |
+
217,
|
| 1161 |
+
823,
|
| 1162 |
+
260
|
| 1163 |
+
],
|
| 1164 |
+
"page_idx": 11
|
| 1165 |
+
},
|
| 1166 |
+
{
|
| 1167 |
+
"type": "text",
|
| 1168 |
+
"text": "David Silver, Julian Schrittwieser, Karen Simonyan, Ioannis Antonoglou, Aja Huang, Arthur Guez, Thomas Hubert, Lucas Baker, Matthew Lai, Adrian Bolton, Yutian Chen, Timothy Lillicrap, Fan Hui, Laurent Sifre, George van den Driessche, Thore Graepel, and Demis Hassabis. Mastering the game of Go without human knowledge. Nature Publishing Group, 550, 2017. doi: 10.1038/nature24270. URL https://www.nature.com/nature/journal/ v550/n7676/pdf/nature24270.pdf. ",
|
| 1169 |
+
"bbox": [
|
| 1170 |
+
173,
|
| 1171 |
+
268,
|
| 1172 |
+
825,
|
| 1173 |
+
353
|
| 1174 |
+
],
|
| 1175 |
+
"page_idx": 11
|
| 1176 |
+
},
|
| 1177 |
+
{
|
| 1178 |
+
"type": "text",
|
| 1179 |
+
"text": "Hendrik Strobelt, Sebastian Gehrmann, Bernd Huber, Hanspeter Pfister, and Alexander M Rush. Visual analysis of hidden state dynamics in recurrent neural networks. arXiv preprint arXiv:1606.07461, 2016. ",
|
| 1180 |
+
"bbox": [
|
| 1181 |
+
173,
|
| 1182 |
+
361,
|
| 1183 |
+
826,
|
| 1184 |
+
404
|
| 1185 |
+
],
|
| 1186 |
+
"page_idx": 11
|
| 1187 |
+
},
|
| 1188 |
+
{
|
| 1189 |
+
"type": "text",
|
| 1190 |
+
"text": "Peter Tino, Bill G Horne, C Lee Giles, and Pete C Collingwood. Finite state machines and recurrent ˇ neural networksautomata and dynamical systems approaches. In Neural networks and pattern recognition, pp. 171–219. Elsevier, 1998. ",
|
| 1191 |
+
"bbox": [
|
| 1192 |
+
173,
|
| 1193 |
+
412,
|
| 1194 |
+
825,
|
| 1195 |
+
455
|
| 1196 |
+
],
|
| 1197 |
+
"page_idx": 11
|
| 1198 |
+
},
|
| 1199 |
+
{
|
| 1200 |
+
"type": "text",
|
| 1201 |
+
"text": "Masaru Tomita. Dynamic construction of finite-state automata from examples using hill-climbing. In Proceedings of the Fourth Annual Conference of the Cognitive Science Society, pp. 105–108, 1982. ",
|
| 1202 |
+
"bbox": [
|
| 1203 |
+
174,
|
| 1204 |
+
464,
|
| 1205 |
+
825,
|
| 1206 |
+
507
|
| 1207 |
+
],
|
| 1208 |
+
"page_idx": 11
|
| 1209 |
+
},
|
| 1210 |
+
{
|
| 1211 |
+
"type": "text",
|
| 1212 |
+
"text": "Raymond L Watrous and Gary M Kuhn. Induction of finite-state automata using second-order recurrent networks. In Advances in neural information processing systems, pp. 309–317, 1992. ",
|
| 1213 |
+
"bbox": [
|
| 1214 |
+
171,
|
| 1215 |
+
516,
|
| 1216 |
+
823,
|
| 1217 |
+
545
|
| 1218 |
+
],
|
| 1219 |
+
"page_idx": 11
|
| 1220 |
+
},
|
| 1221 |
+
{
|
| 1222 |
+
"type": "text",
|
| 1223 |
+
"text": "Gail Weiss, Yoav Goldberg, and Eran Yahav. Extracting automata from recurrent neural networks using queries and counterexamples. arXiv preprint arXiv:1711.09576, 2017. ",
|
| 1224 |
+
"bbox": [
|
| 1225 |
+
171,
|
| 1226 |
+
554,
|
| 1227 |
+
823,
|
| 1228 |
+
583
|
| 1229 |
+
],
|
| 1230 |
+
"page_idx": 11
|
| 1231 |
+
},
|
| 1232 |
+
{
|
| 1233 |
+
"type": "text",
|
| 1234 |
+
"text": "Tom Zahavy, Nir Ben-Zrihem, and Shie Mannor. Graying the black box: Understanding dqns. In International Conference on Machine Learning, pp. 1899–1908, 2016. ",
|
| 1235 |
+
"bbox": [
|
| 1236 |
+
171,
|
| 1237 |
+
592,
|
| 1238 |
+
823,
|
| 1239 |
+
621
|
| 1240 |
+
],
|
| 1241 |
+
"page_idx": 11
|
| 1242 |
+
},
|
| 1243 |
+
{
|
| 1244 |
+
"type": "text",
|
| 1245 |
+
"text": "Zheng Zeng, Rodney M Goodman, and Padhraic Smyth. Learning finite state machines with selfclustering recurrent networks. Neural Computation, 5(6):976–990, 1993. ",
|
| 1246 |
+
"bbox": [
|
| 1247 |
+
171,
|
| 1248 |
+
628,
|
| 1249 |
+
823,
|
| 1250 |
+
659
|
| 1251 |
+
],
|
| 1252 |
+
"page_idx": 11
|
| 1253 |
+
},
|
| 1254 |
+
{
|
| 1255 |
+
"type": "text",
|
| 1256 |
+
"text": "APPENDIX ",
|
| 1257 |
+
"text_level": 1,
|
| 1258 |
+
"bbox": [
|
| 1259 |
+
176,
|
| 1260 |
+
103,
|
| 1261 |
+
263,
|
| 1262 |
+
117
|
| 1263 |
+
],
|
| 1264 |
+
"page_idx": 12
|
| 1265 |
+
},
|
| 1266 |
+
{
|
| 1267 |
+
"type": "text",
|
| 1268 |
+
"text": "7.1 FORMAL DEFINITION OF MODE COUNTER ENVIRONMENT ",
|
| 1269 |
+
"text_level": 1,
|
| 1270 |
+
"bbox": [
|
| 1271 |
+
176,
|
| 1272 |
+
133,
|
| 1273 |
+
616,
|
| 1274 |
+
147
|
| 1275 |
+
],
|
| 1276 |
+
"page_idx": 12
|
| 1277 |
+
},
|
| 1278 |
+
{
|
| 1279 |
+
"type": "text",
|
| 1280 |
+
"text": "An MCE is parameterized by the mode number $M$ , a mode transition function $P$ , a mode life span mapping $\\Delta ( m )$ that assigns a positive integer to each mode, and a count set $C$ containing zero or more natural numbers. At time $t$ the MCE hidden state is a tuple $( m _ { t } , c _ { t } )$ , where $\\overline { { m _ { t } } } ~ \\in ~ \\{ 1 , 2 , \\dots , M \\}$ is the current mode and $c _ { t }$ is the count of time-steps that the system has been consecutively in mode $m _ { t }$ . The mode only changes when the lifespan is reached, i.e. $c _ { t } = \\Delta ( m _ { t } ) - 1$ , upon which the next mode $m _ { t + 1 }$ is generated according to the transition distribution $P ( m _ { t + 1 } \\mid m _ { t } )$ . The transition distribution also specifies the distribution over initial modes. The agent does not directly observe the state, but rather, the agent only receives a continuous-valued observations $o _ { t } \\in [ 0 , 1 ]$ at each step, based on the current state $( m _ { t } , c _ { t } )$ . If $c _ { t } \\in C$ then $o _ { t }$ is drawn uniformly at random from $[ m _ { t } / M , ( m _ { t } + 1 ) / M ) ]$ and otherwise $o _ { t }$ is drawn uniformly at random from [0, 1]. Thus, observations determine the mode when the mode count is in $C$ and otherwise the observations are uninformative. Note that the agent does not observe the counter. This means that to keep track of the mode for optimal performance the agent must remember the current mode and use memory to keep track of how long the mode has been active, in order to determine when it needs to “pay attention” to the current observation. ",
|
| 1281 |
+
"bbox": [
|
| 1282 |
+
173,
|
| 1283 |
+
160,
|
| 1284 |
+
825,
|
| 1285 |
+
367
|
| 1286 |
+
],
|
| 1287 |
+
"page_idx": 12
|
| 1288 |
+
},
|
| 1289 |
+
{
|
| 1290 |
+
"type": "text",
|
| 1291 |
+
"text": "We conduct experiments with the following three MCE instances 7: 1) Amnesia. This MCE uses $\\Delta ( m ) = 1$ for all modes, $C = \\{ 0 \\}$ , and uniformly samples random initial mode and transition distributions. Thus, an optimal policy will not use memory to track information from the past, since the current observation alone determines the current mode. This tests our ability to use MMN extraction to determine that a policy is purely reactive, i.e. not using memory. 2) Blind. Here we use deterministic initial mode and transition distributions, mode life spans that can be larger than 1, and $C = \\{ \\}$ . Thus, the observations provide no information about the mode and optimal performance can only be achieved by using memory to keep track of the deterministic mode sequence. This allows us to test whether the extraction of an MMN could infer that the recurrent policy is ignoring observations and only using memory. 3) Tracker. This MCE is identical to Amnesia, except that the $\\Delta ( m )$ values can be larger than 1. This requires an optimal policy to pay attention to observations when $c _ { t } = 0$ and use memory to keep track of the current mode and mode count. This is the most general instance of the environment and can result in difficult problems when the number of modes and their life-spans grow. In all above instances, we used $M = 4$ . ",
|
| 1292 |
+
"bbox": [
|
| 1293 |
+
173,
|
| 1294 |
+
375,
|
| 1295 |
+
825,
|
| 1296 |
+
569
|
| 1297 |
+
],
|
| 1298 |
+
"page_idx": 12
|
| 1299 |
+
},
|
| 1300 |
+
{
|
| 1301 |
+
"type": "text",
|
| 1302 |
+
"text": "7.2 GROUND TRUTH MCE MOORE MACHINES ",
|
| 1303 |
+
"text_level": 1,
|
| 1304 |
+
"bbox": [
|
| 1305 |
+
176,
|
| 1306 |
+
103,
|
| 1307 |
+
511,
|
| 1308 |
+
118
|
| 1309 |
+
],
|
| 1310 |
+
"page_idx": 13
|
| 1311 |
+
},
|
| 1312 |
+
{
|
| 1313 |
+
"type": "image",
|
| 1314 |
+
"img_path": "images/e7cd336a61b1fc10f2f80cbc3c40f5d29f9a8092c3204b02c29226434987d837.jpg",
|
| 1315 |
+
"image_caption": [
|
| 1316 |
+
"Figure 3: Moore machine representation of Mode Counter Environments (MCE). We use $\\cdot _ { m }$ ’ to indicate the activate mode/action required in that state. Given $M = 4$ , we have 4 observations classes, $o _ { 1 } = ( 0 , 0 . 2 5 ]$ , $o _ { 2 } = ( 0 . 2 5 , 0 . 5 ]$ , $o _ { 3 } = ( 0 . 5 , 0 . 7 5 ]$ and $o _ { 4 } = ( 0 . 7 5 , 1 ]$ . Also, $^ { O _ { * } }$ implies that the transaction is valid for all observations. The minimal moore machines extracted by our approach from trained RNN policies exactly matches these ground truth machines. "
|
| 1317 |
+
],
|
| 1318 |
+
"image_footnote": [],
|
| 1319 |
+
"bbox": [
|
| 1320 |
+
246,
|
| 1321 |
+
125,
|
| 1322 |
+
745,
|
| 1323 |
+
801
|
| 1324 |
+
],
|
| 1325 |
+
"page_idx": 13
|
| 1326 |
+
},
|
| 1327 |
+
{
|
| 1328 |
+
"type": "image",
|
| 1329 |
+
"img_path": "images/a4e9003bcecc0374482ab76fa7dba9d19edd23d300fd319d7e789d2735b16e1e.jpg",
|
| 1330 |
+
"image_caption": [
|
| 1331 |
+
"Figure 4: Extracted Moore machine representation for Tomita Grammar policies where $B _ { h } = 1 6$ . We use ‘A’ and $\\cdot _ { \\mathrm { R } } \\cdot$ to denote accept and reject states, respectively. Other than Grammar 6, all machines are $100 \\%$ accurate. "
|
| 1332 |
+
],
|
| 1333 |
+
"image_footnote": [],
|
| 1334 |
+
"bbox": [
|
| 1335 |
+
187,
|
| 1336 |
+
107,
|
| 1337 |
+
879,
|
| 1338 |
+
827
|
| 1339 |
+
],
|
| 1340 |
+
"page_idx": 14
|
| 1341 |
+
}
|
| 1342 |
+
]
|
parse/train/S1gOpsCctm/S1gOpsCctm_middle.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
parse/train/S1gOpsCctm/S1gOpsCctm_model.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
parse/train/S1q_Cz-Cb/S1q_Cz-Cb.md
ADDED
|
@@ -0,0 +1,508 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# TRAINING NEURAL MACHINES WITH PARTIAL TRACES
|
| 2 |
+
|
| 3 |
+
Anonymous authors Paper under double-blind review
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
We present a novel approach for training neural machines which incorporates additional supervision on the machine’s interpretable components (e.g., neural memory). To cleanly capture the kind of neural machines to which our method applies, we introduce the concept of a differential neural computational machine $\left( \partial \mathbf { N } \mathbf { C M } \right)$ and show that several existing architectures (e.g., NTMs, NRAMs) can be instantiated as a $\partial { \bf N C M }$ and can thus benefit from any amount of additional supervision over their interpretable components. Based on our method, we performed a detailed experimental evaluation with NTM and NRAM machines, showing the approach leads to significantly better convergence and generalization capabilities of the learning phase than standard training using only input-output examples.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
Recently, there has been substantial interest in neural abstract machines that can induce programs from examples Feser et al. (2015; 2016); Frankle et al. (2016); Gaunt et al. (2017); Graves et al. (2014; 2016); Kaiser & Sutskever (2016); Kurach et al. (2016); Reed & de Freitas (2016); Vinyals et al. (2015); Zaremba & Sutskever (2015); Zhang et al. (2015). While significant progress has been made towards learning interesting algorithms Graves et al. (2016), ensuring the training of these machines converges to the desired solution can be very challenging. Interestingly however, even though these machines differ architecturally, they tend to rely on components (e.g., neural memory) that are more interpretable than a typical neural network (e.g., an LSTM). A key question then is:
|
| 12 |
+
|
| 13 |
+
Can we somehow provide additional amounts of supervision for these interpretable components during training so to bias the learning towards the desired solution?
|
| 14 |
+
|
| 15 |
+
In this work we investigate this question in depth. We refer to the type of supervision mentioned above as partial trace supervision, capturing the intuition that more detailed information, beyond inputoutput examples, is provided during learning. To study the question systematically, we introduce the notion of a differential neural computational machine (∂NCM), a formalism which allows for clean characterization of the neural abstract machines that fall inside our class and that can benefit from any amount of partial trace information. We show that common architectures such as Neural Turing Machines (NTMs) and Neural Random Access Machines (NRAMs) can be phrased as ∂NCMs, useful also because these architectures form the basis for many recent extensions, e.g., Graves et al. (2016); Grefenstette et al. (2015); Kaiser & Sutskever (2016). We also explain why other machines such as the Neural Program Interpreter (NPI) Reed & de Freitas (2016) or its recent extensions (e.g., the Neural Program Lattice Li et al. (2017)) cannot be instantiated as an $\partial { \bf N C M }$ and are thus restricted to require large (and potentially prohibitive) amounts of supervision. We believe the $\partial { \bf N } { \bf C M }$ abstraction is a useful step in better understanding how different neural abstract machines compare when it comes to additional supervision. We then present $\partial { \bf N } { \bf C M }$ loss functions which abstractly capture the concept of partial trace information and show how to instantiate these for both the NTM and the NRAM. We also performed an extensive evaluation for how partial trace information affects training in both architectures. Overall, our experimental results indicate that the additional supervision can substantially improve convergence while leading to better generalization and interpretability.
|
| 16 |
+
|
| 17 |
+
To provide an intuition for the problem we study in this work, consider the simple task of training an NTM to flip the third bit in a bit stream (called Flip3rd) – such bitstream tasks have been extensively studied in the area of program synthesis (e.g., Jha et al. (2010); Raychev et al. (2016)). An example input-output pair for this task could be $[ 0 , 1 , 0 , 0 ] [ 0 , 1 , 1 , 0 ]$ . Given a set of such examples, our goal is to train an NTM that solves this task. An example NTM that generalizes well and is understandable is shown in Figure 1c. Here, the y-axis is time (descending), the $\mathbf { X }$ -axis is the accessed memory location, the white squares represent the write head of the NTM, and the orange squares represent the read head. As we can see, the model writes the input sequence to the tape and then reads from the tape in the same order. However, in the absence of richer supervision, the NTM (and other neural architectures) can easily overfit to the training set – an example of an overfitting NTM is shown in Figure 1a. Here, the traces are chaotic and difficult to interpret. Further, even if the NTM generalizes, it can do so with erratic reads and writes, an example of which is shown in Figure 1b. Here, the NTM learns to read from the third bit (circled) with a smaller weight than from other locations, and also reads and writes erratically near the end of the sequence. This model is less interpretable than the one in Figure 1c because it is unclear how the model knows which the third bit actually is, or why a different read weight would help flip that bit.
|
| 18 |
+
|
| 19 |
+

|
| 20 |
+
Figure 1: Traces of locations accessed by read/write heads for the Flip3rd task in three different training setups. The y-axis represents time (descending); $\mathbf { X }$ -axis represents head locations. First two NTMs are trained without partial trace information. White represents the distribution of the write head; orange the distribution of the read head; (b) and (c) generalize and are more interpretable than (a); (c) was trained using partial trace information and is more interpretable than (b).
|
| 21 |
+
|
| 22 |
+
In this work we will develop principled ways for guiding the training of a neural abstract machine towards the behavior shown in Figure 1c. For instance, for Flip3rd, providing partial trace information on the NTM’s read heads for $10 \%$ of the input-output examples is sufficient to bias the learning towards the NTM shown in Figure 1c $100 \%$ of the time.
|
| 23 |
+
|
| 24 |
+
# 2 NEURAL COMPUTATIONAL MACHINES
|
| 25 |
+
|
| 26 |
+
To capture the essence of our method and illustrate its applicability, we now define the abstract notion of a neural computational machine (NCM). NCMs mimic classic computational machines with a controller and a memory, and generalize multiple existing architectures. Our approach for supervision with partial trace information applies to all neural architectures expressible as NCMs. A useful feature of the NCM abstraction is that it clearly delineates end-to-end differentiable architectures (Graves et al. (2014)’s NTM, Kurach et al. (2016)’s NRAM), which can train with little to no trace supervision, from architectures that are not end-to-end differentiable (Reed & de Freitas (2016)’s NPI) and hence require a certain minimum amount of trace information. In the follow-up section, we show how to phrase two existing neural architectures (NTMs and NRAMs) as an NCM.
|
| 27 |
+
|
| 28 |
+
An NCM is a triple of functions: a processor, a controller, and a loss:
|
| 29 |
+
|
| 30 |
+
Processor The processor $\pi : W \times C \times M \to B \times M$ performs a pre-defined set of commands $C$ , which might involve manipulating memories in $M$ . The commands may produce additional feedback in $B$ . Also, the processor’s operation may depend on parameters in $W$ .
|
| 31 |
+
|
| 32 |
+
Controller The controller $\kappa : W \times B \times Q \times I C \times Q \times O$ decides which operations the machine performs at each step. It receives external inputs from $I$ and returns external outputs in $O$ . It can also receive feedback from the processor and command it to do certain operations (e.g., memory read). The decisions the controller takes may depend on its internal state (from $Q$ ). The controller can also depend on parameters in $W$ . For instance, if the controller is a neural network, then the network’s weights will range over $W$ .
|
| 33 |
+
|
| 34 |
+

|
| 35 |
+
Figure 2: (a) is depiction of the generic NCM structure (b) is a high-level overview of an NTM and (c) is a high level overview of the NRAM architecture. The controller outputs a circuit, which in this case contains the modules READ, ADD, SUB, LT, and WRITE. The controller encodes the two inputs to the modules as probability vectors, $a , b$ and $c$ , over the possible choices. The most likely choice is shown in green. The only input to the controller are the registers $r _ { 1 }$ and $r _ { 2 }$ .
|
| 36 |
+
|
| 37 |
+
Loss Function The loss function $L _ { e } : T r a c e \times E \mathbb { R }$ indicates how close a trace $\tau \in T r a c e$ of an execution of the machine (defined below) is to a behavior from a set $E$ . The loss function provides a criterion for training a machine to follow a prescribed set of behaviors, and hence we impose certain differentiability conditions. We require that the loss surface is continuous and piecewise differentiable with respect to the weights $w \in W$ for all examples $e$ and inputs $x$ with traces $\tau ( w , x )$ :
|
| 38 |
+
|
| 39 |
+
$$
|
| 40 |
+
l ( w ; x , e ) = L _ { e } ( \tau ( w , x ) , e )
|
| 41 |
+
$$
|
| 42 |
+
|
| 43 |
+
Execution The execution of the machine begins with an input sequence $x = \{ x _ { t } \} _ { 1 } ^ { n }$ and initial values of the controller state $q _ { 0 }$ , memory $m _ { 0 }$ , and processor feedback $b _ { 0 }$ . At each time step $t = 1 \ldots n$ controller and processor take turns executing according to the following equations:
|
| 44 |
+
|
| 45 |
+
$$
|
| 46 |
+
\begin{array} { c } { { ( c _ { t } , q _ { t } , y _ { t } ) = \kappa ( w , b _ { t - 1 } , q _ { t - 1 } , x _ { t } ) } } \\ { { ( b _ { t } , m _ { t } ) = \pi ( w , c _ { t } , m _ { t - 1 } ) } } \end{array}
|
| 47 |
+
$$
|
| 48 |
+
|
| 49 |
+
A trace $\tau ( w , x , b _ { 0 } , m _ { 0 } , q _ { 0 } ) = \{ ( c _ { t } , b _ { t } , q _ { t } , y _ { t } , m _ { t } ) \} _ { 1 } ^ { n }$ records these quantities’ values at each time step.
|
| 50 |
+
We will occasionally write $\tau _ { C } , \tau _ { B } , \ldots$ for the trace projected onto one of its components $c , b , \ldots$ .
|
| 51 |
+
|
| 52 |
+
∂NCMs Note that the differentiability conditions that we impose on the loss do not imply that any of the NCM functions $\pi$ , $\kappa$ and $L _ { e }$ are continuous or differentiable. They indeed can be highly discontinuous as in NCMs like Weston et al. (2014)’s memory networks with a hard attention mechanism, or as in Reed $\&$ de Freitas (2016)’s neural programmer-interpreters. In order to fix these discontinuities and recover a differentiable loss surface, these architectures train with strong supervision only: the training examples $e \in E$ must provide a value for every traced quantity that comes from a discontinuous parameter.
|
| 53 |
+
|
| 54 |
+
In contrast, what we call differentiable neural computational machines (∂NCM), have $\kappa , \pi$ and $L _ { e }$ continuous and piecewise differentiable. In this case, the loss surface is differentiable with respect to every parameter. Thus, there is no need to specify corresponding values in the examples, and so we can train with as much trace information as available.
|
| 55 |
+
|
| 56 |
+
# 3 NTMS AND NRAMS AS NCMS
|
| 57 |
+
|
| 58 |
+
We now show how NTMs and NRAMs can be instantiated as ∂NCMs.
|
| 59 |
+
|
| 60 |
+
NTM as ∂NCM An Neural Turing Machine (NTM) Graves et al. (2014) (Figure 2b) has access to a memory $\mathcal { M } \in \mathbb { R } ^ { c \times n }$ of $c$ cells of $n$ real numbers each. We suppose the machine has one read head and one write head, whose addresses are, respectively, the probability vectors $r , w \in [ 0 , 1 ] ^ { \{ 1 \ldots c \} }$ At every time step, the read head computes the expected value $m \in \mathbb { R } ^ { n }$ of a random cell at index $i \sim r$ . This value together with the current input are fed into a controller neural network, which then decides on several commands. It decides what fraction $e \in \mathbb { R } ^ { n }$ to erase and how much $a \in \mathbb { R } ^ { n }$ to add to the cells underneath the write head. The write head stores the tape expected after a random modification at index $i \sim w$ . Then the controller indicates the head movement with two probability vectors $\Delta r , \Delta w \in [ 0 , 1 ] ^ { \{ - 1 , 0 , + 1 \} }$ which are convolved with the respective head addresses (the actual addressing mechanism is more involved, but we omit it for brevity) Finally, the controller produces the current output value. In terms of NCMs, the NTM’s variables fall into the following classes:
|
| 61 |
+
|
| 62 |
+
$$
|
| 63 |
+
\frac { \mathrm { I } / \mathrm { O } } { x \in I } \qquad \begin{array} { r l r } { \mathrm { S t a t e } } & { } & { \mathrm { C o m m u n i c a t i o n } } \\ { q \in Q } & { ( e , a , \Delta r , \Delta w ) \in C } \\ { y \in O } & { ( r , w , \mathcal { M } ) \in M } & { m \in B } \end{array}
|
| 64 |
+
$$
|
| 65 |
+
|
| 66 |
+
Each of these variables change over time according to certain equations (see Appendix A for details). The processor $\pi$ and the controller $\kappa$ functions for each time step satisfy:
|
| 67 |
+
|
| 68 |
+
$$
|
| 69 |
+
\begin{array} { r l } & { ( ( e _ { t } , a _ { t } , \Delta r _ { t } , \Delta w _ { t } ) , \ q _ { t } , \ y _ { t } ) = \kappa ( w , m _ { t } , q _ { t - 1 } , x _ { t } ) } \\ & { \qquad ( m _ { t + 1 } , \ ( r _ { t } , w _ { t } , M _ { t } ) ) = \pi ( ( e _ { t } , a _ { t } , \Delta r _ { t } , \Delta w _ { t } ) , \ ( r _ { t - 1 } , w _ { t - 1 } , \mathcal { M } _ { t - 1 } ) ) . } \end{array}
|
| 70 |
+
$$
|
| 71 |
+
|
| 72 |
+
The standard loss function $L _ { e }$ for the NTM simply includes a term, such as cross-entropy or $L _ { 2 }$ distance, for the machine output at every time step. Each of these compare the machine output to the respective values contained in the examples $e \in E$ .
|
| 73 |
+
|
| 74 |
+
NRAM as ∂NCM A Neural Random Access Machine (NRAM) Kurach et al. (2016) is a neural machine designed for ease of pointer (de-)referencing. An NRAM has a variable sized memory $\mathcal { M } \in \mathbb { R } ^ { c \times c }$ whose size varies between runs. It also has access to a register file $r \in \mathbb { R } ^ { n \times c }$ with a constant number $n$ of registers. Both the memory and the registers store probability vectors over $\{ 1 \ldots c \}$ . The controller receives no external inputs, but at each time step reads the probability that a register assigns to 0. It also produces no external output, except a probability $f \in [ 0 , 1 ]$ for termination at the current time step. The output of the run is considered to be the final memory state.
|
| 75 |
+
|
| 76 |
+
Unlike the NTM, computation in the NRAM is performed by a fixed sequence of modules. Each module implements a simple integer operation/memory manipulation lifted to probability vectors. For example, addition lifts to convolution, while memory access is like that of the NTM. At every time step the controller organizes the sequence of modules into a circuit, which is then executed. The circuit is encoded by a pair of probability distributions per module, as shown in Figure $_ { 2 \mathrm { c } }$ . These distributions specify respectively which previous modules or registers will provide a given module first/second arguments. The distributions are stacked in the matrices $a$ and $b$ . A similar matrix $c$ is responsible for specifying what values should be written to the registers at the end of the time step. The NCM instantiation of an NRAM is the following:
|
| 77 |
+
|
| 78 |
+
<table><tr><td>I/0</td><td>State Communication</td></tr><tr><td>{1}=I qt∈Q</td><td>(at,bt,ct) ∈C</td></tr><tr><td>ft∈O (rt,Mt) ∈ M</td><td>Tt,-,0 ∈B</td></tr></table>
|
| 79 |
+
|
| 80 |
+
The equations that determine these quantities can be found in Appendix B. The processor function $\pi$ and the controller function $\kappa$ expressed in terms of these quantities are:
|
| 81 |
+
|
| 82 |
+
$$
|
| 83 |
+
\begin{array} { r l } & { ( ( a _ { t } , b _ { t } , c _ { t } ) , h _ { t } , f _ { t } ) = \kappa ( w , r _ { ( t - 1 ) , - , 0 } , h _ { t - 1 } , 1 ) } \\ & { ( r _ { t , - , 0 } , ( r _ { t } , \mathcal { M } _ { t } ) ) = \pi ( ( a _ { t } , b _ { t } , c _ { t } ) , \ ( r _ { t - 1 } , \mathcal { M } _ { t - 1 } ) ) . } \end{array}
|
| 84 |
+
$$
|
| 85 |
+
|
| 86 |
+
The loss of the NRAM is more complex than the NTM loss: it is an expectation with respect to the probability distribution $p$ of termination time, as determined by the termination probabilities $f _ { t }$ (see Appendix B). For every $t = 1 \ldots k$ , the loss considers the negative log likelihood that the $i$ -th memory cell at that time step equals the value $e _ { i }$ provided in the example, independently for each $i$ :
|
| 87 |
+
|
| 88 |
+
$$
|
| 89 |
+
L _ { e } ( \tau , e ) = - \sum _ { t < k } p _ { t } \sum _ { i < c } \log ( \mathcal { M } _ { t , i , e _ { i } } ) .
|
| 90 |
+
$$
|
| 91 |
+
|
| 92 |
+
# 4 SUBTRACE SUPERVISION OF NCMS
|
| 93 |
+
|
| 94 |
+
Incorporating supervision during NCM training can be helpful with: (i) convergence: additional bias may steer the minimization of the NCM’s loss function $L _ { e }$ , as much as possible, away from local minima that do not correspond to good solutions, (ii) interpretability: the bias can also be useful in guiding the NCM towards learning a model that is more intuitive/explainable to a user (especially if the user already has an intuition on what it is that parts of the model should do), and (iii) generalization: the bias can steer the NCM towards solutions which minimize not just the loss on example of difficulties it has seen, but on significantly more difficult examples.
|
| 95 |
+
|
| 96 |
+
The way we provide additional supervision to NCMs is, by encoding, for example, specific commands issued to the processor, into extra loss terms. Let us illustrate how we can bias the learning with an NTM. Consider the task of copying the first half of an input sequence $\{ x _ { t } \} _ { 1 } ^ { 2 l }$ into the second half of the machine’s output $\{ y _ { t } \} _ { 1 } ^ { 2 l }$ , where the last input $x _ { l }$ from the first half is a special value indicating that the first half ended. Starting with both heads at position 1, the most direct solution is to consecutively store the input to the tape during the first half of the execution, and then recall the stored values during the second half. In such a solution, we expect the head positions to be:
|
| 97 |
+
|
| 98 |
+
$$
|
| 99 |
+
w _ { t } = p ( t ) = { \left\{ \begin{array} { l l } { { \mathrm { o n e - h o t } } ( t ) } & { { \mathrm { i f ~ } } t = 1 \dots l } \\ { { \mathrm { o n e - h o t } } ( l ) } & { { \mathrm { i f ~ } } t \geq l + 1 } \end{array} \right. } \quad r _ { t } = q ( t ) = { \left\{ \begin{array} { l l } { { \mathrm { o n e - h o t } } ( 1 ) } & { { \mathrm { i f ~ } } t = 1 \dots l } \\ { { \mathrm { o n e - h o t } } ( t - l ) } & { { \mathrm { i f ~ } } t \geq l + 1 } \end{array} \right. }
|
| 100 |
+
$$
|
| 101 |
+
|
| 102 |
+
To incorporate this information into the training, we add loss terms that measure the cross-entropy $( H )$ between $p ( t )$ and $w _ { t }$ as well as between $q ( t )$ and $r _ { t }$ . Importantly, we need not add terms for every time-step, but instead we can consider only the corner cases where heads change direction:
|
| 103 |
+
|
| 104 |
+
$$
|
| 105 |
+
\sum _ { t = 1 , l + 1 , 2 l } H ( p ( t ) , w _ { t } ) + H ( q ( t ) , r _ { t } ) .
|
| 106 |
+
$$
|
| 107 |
+
|
| 108 |
+
# 4.1 GENERIC SUBTRACE LOSS FOR NCMS
|
| 109 |
+
|
| 110 |
+
We now describe the general shape of the extra loss terms for arbitrary NCMs. Since, typically, we can interpret only the memory and the processor in terms of well-understood operations, we will consider loss terms only for the memory state and the communication flow between the controller and the processor. We leave the controller’s hidden state unconstrained – this also permits us to use the same training procedure with different controllers.
|
| 111 |
+
|
| 112 |
+
The generic loss is expressed with four loss functions for the different components of an NCM trace:
|
| 113 |
+
|
| 114 |
+
$$
|
| 115 |
+
\begin{array} { r l r l } & { L _ { C } : C \times E _ { C } \to \mathbb { R } \quad } & & { L _ { B } : B \times E _ { B } \to \mathbb { R } } \\ & { L _ { O } : O \times E _ { O } \to \mathbb { R } \quad } & & { L _ { M } : M \times E _ { M } \to \mathbb { R } } \end{array}
|
| 116 |
+
$$
|
| 117 |
+
|
| 118 |
+
For each part $\alpha \in \{ C , B , O , M \}$ , we provide hints $( t , v , \mu ) \in \sigma _ { \alpha }$ that indicate a time step $t$ at which the hint applies, an example $v \in E _ { \alpha }$ for the relevant component, and a weight $w \in \mathbb { R }$ of the hint. The weight is included to account for hints having a different importance at different time-steps, but also to express our confidence in the hint, e.g., hints coming from noisy sources would get less weight.
|
| 119 |
+
|
| 120 |
+
A subtrace $\sigma$ is a collection of hints used for a particular input-output example $e$ . We call it a subtrace because, typically, it contains hints for a proper subset of the states traced by the NCM during execution. The net loss for a given input-output example and subtrace equals the original loss $L _ { e }$ added to the weighted losses for all the hints, scaled by a constant factor $\lambda$ :
|
| 121 |
+
|
| 122 |
+
$$
|
| 123 |
+
L ( \tau , ( \sigma , e ) ) = L _ { e } ( \tau , e ) + \lambda \frac { \sum _ { \alpha \in \{ C , B , O , M \} } \sum _ { ( t , v , \mu ) \in \sigma _ { \alpha } } \mu L _ { \alpha } ( \tau _ { \alpha , t } , v ) } { \sum _ { \alpha \in \{ C , B , O , M \} } \sum _ { ( t , v , \mu ) \in \sigma _ { \alpha } } \mu }
|
| 124 |
+
$$
|
| 125 |
+
|
| 126 |
+

|
| 127 |
+
Figure 3: An example circuit for the task of adding one to all memory cells. The arrows for register updates are shown in red. Technically, modules take two arguments, but some ignore an argument, such as INC or READ. For them, we show only the relevant arrows.
|
| 128 |
+
|
| 129 |
+
# 4.2 SUBTRACES FOR NTM
|
| 130 |
+
|
| 131 |
+
For NTMs, we allow hints on the output $y$ , the addresses $r$ and $w$ , and the tape $\mathcal { M }$ . We include extra loss terms for the memory state only (all other loss terms are zero):
|
| 132 |
+
|
| 133 |
+
$$
|
| 134 |
+
\begin{array} { r } { \begin{array} { r l } & { L _ { M } ( ( r _ { t } , w _ { t } , \mathcal { M } _ { t } ) , ( \mathrm { w r } , v ) ) = H ( v , w _ { t } ) } \\ & { L _ { M } ( ( r _ { t } , w _ { t } , \mathcal { M } _ { t } ) , ( \mathrm { r d } , v ) ) = H ( v , r _ { t } ) } \end{array} } \end{array}
|
| 135 |
+
$$
|
| 136 |
+
|
| 137 |
+
Unlike the output and addresses, values on the tape are interpreted according to an encoding internal to the controller (which emerges only during training). Forcing the controller to use a specific encoding for the tape, as we do with NTM output, can have a negative effect on training (in our experiments, training diverged consistently). To remedy this, we do not apply loss to the tape directly but to a decoded version of a cell on the tape. While a decoder might find multiple representations and overfit, we found that it forced just enough consistency to improve the convergence rate. The decoder itself is an auxiliary network $\phi$ trained together with the NTM, which takes a single cell from memory as input. The output of the decoder is compared against the expected value which should be in that cell:
|
| 138 |
+
|
| 139 |
+
$$
|
| 140 |
+
L _ { M } ( ( - , - , \mathcal { M } _ { t } ) , ( \mathsf { t a p e } , i , v ) ) = H ( \phi ( \mathcal { M } _ { t , i } ) , v ) .
|
| 141 |
+
$$
|
| 142 |
+
|
| 143 |
+
For all subtraces we provide in our experiments with NTMs, the hints have the same unit weight.
|
| 144 |
+
|
| 145 |
+
# 4.3 SUBTRACES FOR NRAM
|
| 146 |
+
|
| 147 |
+
For NRAMs, we hint which connections should be present in the circuit the controller constructs at each step, including the ones for register updates. An example circuit is shown in Figure 3. In terms of an NCM, this amounts to providing loss for commands and no loss for anything else. We set the loss to the negative log likelihood of the controller choosing specific connections revealed in the hint:
|
| 148 |
+
|
| 149 |
+
$$
|
| 150 |
+
\begin{array} { r l } & { L _ { C } ( ( a _ { t } , b _ { t } , c _ { t } ) , ( \mathrm { m o d u l e } , m , i , j ) ) = - \log ( a _ { t , m , i } ) - \log ( b _ { t , m , j } ) } \\ & { L _ { C } ( ( a _ { t } , b _ { t } , c _ { t } ) , ( \mathrm { r e g i s t e r } , r , i ) ) = - \log ( c _ { t , r , i } ) } \end{array}
|
| 151 |
+
$$
|
| 152 |
+
|
| 153 |
+
In our experiments, we observed that assigning higher weight to hints at earlier timesteps is crucial for convergence of the training process. For a hint at time-step $t$ , we use the weight $\mu \bar { = } ( t + 1 ) ^ { - 2 }$ . A possible reason for why this helps is that the machine’s behavior at later time-steps is highly dependent on its behavior at the early time-steps. Thus, the machine cannot reach a later behavior that is right before it fixes its early behavior. Unless the behavior is correct early on, the loss feedback from later time-steps will be mostly noise, masking the feedback from early time-steps.
|
| 154 |
+
|
| 155 |
+
Other Architectures The NCM can be instantiated to architectures as diverse as a common LSTM network or End-To-End Differentiable Memory Networks. Any programming inducing neural network with at least partially interpretable intermediate states for which the dataset contains additional hints could be considered a good candidate for application of this abstraction.
|
| 156 |
+
|
| 157 |
+
# 5 EXPERIMENTAL EVALUATION
|
| 158 |
+
|
| 159 |
+
We evaluated our NCM supervision method on the NTM and NRAM architectures. For each of the two architectures we implemented a variety of tasks and experimented with different setups of trace supervision. The main questions that we address are: (i) does trace supervision help convergence, interpretability, and generalization? (ii) how much supervision is needed to train such models? Below, we summarize our findings – further details are provided in the appendix.
|
| 160 |
+
|
| 161 |
+

|
| 162 |
+
Figure 4: Relative percentage of training instances which generalized out of ten runs per task for the NTM. We provide a subtrace $100 \%$ of the time and use $\lambda = 1$ . $\mathbf { X }$ -axis shows the type of supervision.
|
| 163 |
+
|
| 164 |
+

|
| 165 |
+
Figure 5: The number of initial runs which generalized for Flip3rd. The first dimension listed in the rows controls the execution details revealed in a subtrace, while the second dimension (the density column) controls the proportion of examples that receive extra subtrace supervision.
|
| 166 |
+
|
| 167 |
+
Subtraces For NTMs We measured how often we successfully trained an NTM that achieves strong generalization. We consider a model to generalize if relative to the training size limit $n$ , it achieves perfect accuracy on all of tests of $\mathrm { s i z e } \le 1 . 5 n$ , and perfect accuracy on $90 \%$ of the tests of size $\leq 2 n$ . Figure 4 reports the average improvement compared to a baseline using only $\mathrm { I / O }$ examples. We ran experiments with four different tasks and various types of hints (cf. Appendices C, E). Some of the hint types are: read and write specify respective head addresses for all time steps; address combines the previous two; corner reveals the head addresses, but only when the heads change direction; value gives value for a single cell. Except for three cases, trace supervision helped improve generalization. Here, RepeatFlip3d is most challenging, with baseline generalizing only $5 \%$ of the time (cf. Appendix I). Here we have the largest improvement with extra supervision: corner type of hints achieve eight-fold increase in success rate, reaching $40 \%$ . Another task with an even larger ratio is RepeatCopyTwice (cf. Appendix), where success increases from $1 5 . 5 \%$ to $100 \%$ .
|
| 168 |
+
|
| 169 |
+
In addition to this experiment, we performed an extensive evaluation of different setups, varying the global $\lambda$ parameter of the loss Eq. 8, and providing hints for just a fraction of the examples. The full results are in Appendix I; here we provide those for RepeatFlip3d in Table 5. The table reveals that the efficacy of our method heavily depends on these two parameters. The best results in this case are for the read/corner type of hints $\mathbf { \dot { \frac { 1 } { 2 } } } / \mathbf { \frac { 1 } { 1 0 } } ^ { - }$ of the time, with $\bar { \lambda } \in \{ 0 . 1 , 1 \}$ . The best results for other tasks are achieved with different setups. Generally, our conclusion is that training with traces $50 \%$ of the time usually improves performance (or does not lower it much) when compared to the best method. This observation raises the interesting question of what the best type and amount of hints are for a given task.
|
| 170 |
+
|
| 171 |
+
Finally, we observed that in all cases where training with trace supervision converged, it successfully learned the head movements/tape values we had intended. This show that trace supervision can bias the architecture towards more interpretable behaviors. In those cases, the NTM learned consistently sharper head positions/tape values than the baseline, as Figure 6 shows for Flip3rd.
|
| 172 |
+
|
| 173 |
+
Effect of Subtraces For NRAMs Ease of generalization for the NRAM is a known issue, with Neelakantan et al. (2015) reporting that ListK for example generalizes poorly, even when trained with noise in the gradient, curriculum learning, and an entropy bonus. We observed that when run on an indefinite number of examples with the correct number of timesteps and a correct module sequence, Swap and Increment would in fact occasionally generalize perfectly, but did not have the resources to run such indefinite tests with Permute, ListK, and Merge.
|
| 174 |
+
|
| 175 |
+

|
| 176 |
+
Figure 6: Execution traces of two NTMs trained on $\mathtt { F 1 1 p 3 r d }$ until generalization. First is baseline (no trace supervision); second is trained with corner hints. Time flows top to bottom. The first pane from every pair shows the value written to tape; second shows head locations. Figures show that a little extra supervision helps the NTM write sharper 0–1 values and have more focused heads.
|
| 177 |
+
|
| 178 |
+

|
| 179 |
+
Figure 7: (a) average number of errors after training had completed for NRAM. Observe that full training results in a significantly higher percent of generalization after training stopped. (b) shows the distribution of errors to problem length for Permute (one character of noise in $10 \%$ of samples).
|
| 180 |
+
|
| 181 |
+
Figure 7a demonstrates that when training had finished, either because it had ended early or had reached 5000 training examples (our upper bound), generalization would in fact be on average significantly better than the baseline the more hints that were used for all tasks. Here, number of hints used seemed to be a sufficient predictor for the quality of the trained model.
|
| 182 |
+
|
| 183 |
+
Robustness to Noise The effect of increasing supervision on the quality of the trained model was so strong that not even noise in the input was able to significantly hinder generalization. In Figure 7b, we corrupted a single character in the output examples for the Permute problem in $10 \%$ of the examples. We found that without any extra hints, no convergence was seen after training was complete, whereas with just corner subtraces, the generalization was nearly optimal.
|
| 184 |
+
|
| 185 |
+
Furthermore, we found that noise in the trace does not seriously harm performance. We corrupted a single hint for $20 \%$ of the traces of the Increment task using otherwise full supervision, as can be seen in the NoisyFull line of Figure 14.
|
| 186 |
+
|
| 187 |
+
# 6 CONCLUSION
|
| 188 |
+
|
| 189 |
+
We presented a method for incorporating (any amount of) additional supervision into the training of neural abstract machines. The basic idea was to provide this supervision (called partial trace information) over the interpretable components of the machine and to thus more effectively guide the learning towards the desired solution. We introduced the $\partial { \bf N } { \bf C M }$ architecture in order to precisely capture the neural abstract machines to which our method applies. We showed how to formulate partial trace information as abstract loss functions, how to instantiate common neural architectures such as NTMs and NRAMs as ∂NCMs and concretize the $\partial { \bf N C M }$ loss functions. Our experimental results indicate that partial trace information is effective in biasing the learning of both NTM’s and NRAM’s towards better converge, generalization and interpretability of the resulting models.
|
| 190 |
+
|
| 191 |
+
# REFERENCES
|
| 192 |
+
|
| 193 |
+
Matko Bošnjak, Tim Rocktäschel, Jason Naradowsky, and Sebastian Riedel. Programming with a differentiable forth interpreter. In under review for ICLR (2017). URL http://arxiv.org/ abs/1605.06640.
|
| 194 |
+
|
| 195 |
+
Corinna Cortes, Neil D. Lawrence, Daniel D. Lee, Masashi Sugiyama, and Roman Garnett (eds.). Advances in Neural Information Processing Systems 28, 2015. URL http://papers.nips.cc/ book/advances-in-neural-information-processing-systems-28-2015.
|
| 196 |
+
|
| 197 |
+
John K Feser, Swarat Chaudhuri, and Isil Dillig. Synthesizing data structure transformations from input-output examples. In ACM SIGPLAN Notices, volume 50, pp. 229–239. ACM, 2015.
|
| 198 |
+
|
| 199 |
+
John K Feser, Marc Brockschmidt, Alexander L Gaunt, and Daniel Tarlow. Differentiable functional program interpreters. arXiv preprint arXiv:1611.01988, 2016.
|
| 200 |
+
|
| 201 |
+
Jonathan Frankle, Peter-Michael Osera, David Walker, and Steve Zdancewic. Example-directed synthesis: a type-theoretic interpretation. ACM SIGPLAN Notices, 51(1):802–815, 2016.
|
| 202 |
+
|
| 203 |
+
Karlis Freivalds and Renars Liepins. Improving the neural gpu architecture for algorithm learning. arXiv preprint arXiv:1702.08727, 2017.
|
| 204 |
+
|
| 205 |
+
Alexander L. Gaunt, Marc Brockschmidt, Nate Kushman, and Daniel Tarlow. Lifelong perceptual programming by example. In under review for ICLR (2017). URL https://arxiv.org/ abs/1611.02109.
|
| 206 |
+
|
| 207 |
+
Alex Graves, Greg Wayne, and Ivo Danihelka. Neural turing machines. CoRR, abs/1410.5401, 2014. URL http://arxiv.org/abs/1410.5401.
|
| 208 |
+
|
| 209 |
+
Alex Graves, Greg Wayne, Malcolm Reynolds, Tim Harley, Ivo Danihelka, Agnieszka GrabskaBarwinska, Sergio Gómez Colmenarejo, Edward Grefenstette, Tiago Ramalho, John Agapiou, ´ Adrià Puigdomènech Badia, Karl Moritz Hermann, Yori Zwols, Georg Ostrovski, Adam Cain, Helen King, Christopher Summerfield, Phil Blunsom, Koray Kavukcuoglu, and Demis Hassabis. Hybrid computing using a neural network with dynamic external memory. Nature, 538(7626):471– 476, Oct 2016. ISSN 0028-0836. URL http://dx.doi.org/10.1038/nature20101.
|
| 210 |
+
|
| 211 |
+
Edward Grefenstette, Karl Moritz Hermann, Mustafa Suleyman, and Phil Blunsom. Learning to transduce with unbounded memory. In Cortes et al. (2015), pp. 1828–1836. URL http://papers. nips.cc/paper/5648-learning-to-transduce-with-unbounded-memory.
|
| 212 |
+
|
| 213 |
+
Susmit Jha, Sumit Gulwani, Sanjit A Seshia, and Ashish Tiwari. Oracle-guided component-based program synthesis. In Proceedings of the 32nd ACM/IEEE International Conference on Software Engineering-Volume 1, pp. 215–224. ACM, 2010.
|
| 214 |
+
|
| 215 |
+
Lukasz Kaiser and Ilya Sutskever. Neural GPUs learn algorithms. In Kingsbury & Bengio (2016). URL http://arxiv.org/abs/1511.08228.
|
| 216 |
+
|
| 217 |
+
Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
|
| 218 |
+
|
| 219 |
+
Brian Kingsbury and Samy Bengio (eds.). 4th International Conference on Learning Representations, May 2-4, 2016, San Juan, Puerto Rico, 2016. URL http://www.iclr.cc/doku.php?id= iclr2016:main.
|
| 220 |
+
|
| 221 |
+
Karol Kurach, Marcin Andrychowicz, and Ilya Sutskever. Neural random-access machines. ERCIM News, 2016(107), 2016. URL http://ercim-news.ercim.eu/en107/special/ neural-random-access-machines.
|
| 222 |
+
|
| 223 |
+
Chengtao Li, Daniel Tarlow, Alexander L. Gaunt, Marc Brockschmidt, and Nate Kushman. Neural program lattices. In under review for ICLR (2017). URL https://openreview.net/pdf? id=HJjiFK5gx.
|
| 224 |
+
|
| 225 |
+
Arvind Neelakantan, Luke Vilnis, Quoc V Le, Ilya Sutskever, Lukasz Kaiser, Karol Kurach, and James Martens. Adding gradient noise improves learning for very deep networks. arXiv preprint arXiv:1511.06807, 2015.
|
| 226 |
+
|
| 227 |
+
Veselin Raychev, Pavol Bielik, Martin T. Vechev, and Andreas Krause. Learning programs from noisy data. In Proceedings of the 43rd Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 2016, St. Petersburg, FL, USA, January 20 - 22, 2016, pp. 761–774, 2016. doi: 10.1145/2837614.2837671. URL http://doi.acm.org/10.1145/ 2837614.2837671.
|
| 228 |
+
|
| 229 |
+
Scott Reed and Nando de Freitas. Neural programmer-interpreters. In Kingsbury & Bengio (2016). URL https://arxiv.org/abs/1511.06279.
|
| 230 |
+
|
| 231 |
+
under review for ICLR (ed.). 5th International Conference on Learning Representations, April 24- 26, 2017, Toloun, France, 2017. URL http://www.iclr.cc/doku.php?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ ICLR2017: main.
|
| 232 |
+
|
| 233 |
+
Oriol Vinyals, Meire Fortunato, and Navdeep Jaitly. Pointer networks. In Cortes et al. (2015), pp. 2692–2700. URL http://papers.nips.cc/paper/5866-pointer-networks.
|
| 234 |
+
|
| 235 |
+
Jason Weston, Sumit Chopra, and Antoine Bordes. Memory networks. arXiv preprint arXiv:1410.3916, 2014.
|
| 236 |
+
|
| 237 |
+
Wojciech Zaremba and Ilya Sutskever. Learning to execute. CoRR, abs/1410.4615, 2014. URL http://arxiv.org/abs/1410.4615.
|
| 238 |
+
|
| 239 |
+
Wojciech Zaremba and Ilya Sutskever. Reinforcement learning neural turing machines. CoRR, abs/1505.00521, 2015. URL http://arxiv.org/abs/1505.00521.
|
| 240 |
+
|
| 241 |
+
Wei Zhang, Yang Yu, and Bowen Zhou. Structured memory for neural turing machines. CoRR, abs/1510.03931, 2015. URL http://arxiv.org/abs/1510.03931.
|
| 242 |
+
|
| 243 |
+
# A NTM EQUATIONS
|
| 244 |
+
|
| 245 |
+
The controller for the NTM consists of the networks $\varphi$ $\varphi , \psi _ { y } , \psi _ { e } , \psi _ { a } , \chi _ { r } , \chi _ { w }$ , which operate on the variables:
|
| 246 |
+
|
| 247 |
+
$$
|
| 248 |
+
\begin{array} { r l r l r l } { x - \operatorname* { i n } \quad } & { q \mathrm { - c o n t r o l l e r ~ s t a t e } } & { r \mathrm { - r e a d ~ a d d r e s s } } & { \Delta r \mathrm { - c h a n g e ~ i n } r } & { e \mathrm { - e r a s e } } & { \mathcal { M } \mathrm { - t a p e } } \\ { y \mathrm { - o u t } \quad m \mathrm { - r e a d ~ v a l u e } } & { w \mathrm { - w r i t e ~ a d d r e s s } } & { \Delta w \mathrm { - c h a n g e ~ i n } w } & { a \mathrm { - a d d } } & { ( 1 \mathrm { - } r \mathrm { - } \mathrm { ~ a d d } ) } \end{array}
|
| 249 |
+
$$
|
| 250 |
+
|
| 251 |
+
The equations that describe NTM executions are:
|
| 252 |
+
|
| 253 |
+
$$
|
| 254 |
+
\begin{array} { r } { \Delta r _ { t } = \chi _ { r } ( q _ { t } ) } \\ { \Delta w _ { t } = \chi _ { w } ( q _ { t } ) } \\ { y _ { t } = \psi _ { y } ( q _ { t } ) } \\ { e _ { t } = \psi _ { e } ( q _ { t } ) } \\ { a _ { t } = \psi _ { a } ( q _ { t } ) } \end{array}
|
| 255 |
+
$$
|
| 256 |
+
|
| 257 |
+
$$
|
| 258 |
+
\begin{array} { r l } & { { \boldsymbol { r } } _ { t } = a d d r e s s ( \Delta { \boldsymbol { r } } _ { t } , { \boldsymbol { r } } _ { t - 1 } , \mathcal { M } _ { t - 1 } ) } \\ & { { \boldsymbol { w } } _ { t } = a d d r e s s ( \Delta { \boldsymbol { w } } _ { t } , { \boldsymbol { w } } _ { t - 1 } , \mathcal { M } _ { t - 1 } ) } \\ & { { \boldsymbol { m } } _ { t } = { \boldsymbol { r } } _ { t } { \boldsymbol { M } } _ { t - 1 } } \\ & { { \boldsymbol { \mathcal { M } } } _ { t } = \mathcal { M } _ { t - 1 } - ( { \boldsymbol { w } } _ { t } \otimes { \boldsymbol { e } } _ { t } ) \odot \mathcal { M } _ { t - 1 } + { \boldsymbol { w } } _ { t } \otimes { \boldsymbol { a } } _ { t } } \\ & { { \boldsymbol { q } } _ { t } = \varphi ( { \boldsymbol { x } } _ { t } , { \boldsymbol { q } } _ { t - 1 } , { \boldsymbol { m } } _ { t } ) . } \end{array}
|
| 259 |
+
$$
|
| 260 |
+
|
| 261 |
+
# B NRAM EQUATIONS
|
| 262 |
+
|
| 263 |
+
The controller of the NRAM consists of the networks $\varphi , \psi _ { a } , \psi _ { b } , \psi _ { c } , \psi _ { f }$ , which operate on the variables:
|
| 264 |
+
|
| 265 |
+
$$
|
| 266 |
+
\begin{array} { r l r l r l } & { a - \mathrm { l h s ~ c i r c u i t } } & & { b - \mathrm { r h s ~ c i r c u i t } } & & { c - \mathrm { r e g i s t e r ~ i n p u t s } } & & { o - \mathrm { m o d u l e ~ o u t p u t s } } \\ & { r - \mathrm { r e g i s t e r ~ s t a t e } } & & { \mathcal { M } - \mathrm { m e m o r y ~ t a p e } } & & { h - \mathrm { c o n t r o l l e r ~ s t a t e } } & & { f - \mathrm { s t o p ~ p r o b a b i l i t y } . } \end{array}
|
| 267 |
+
$$
|
| 268 |
+
|
| 269 |
+
The equations that describe the NRAM execution are:
|
| 270 |
+
|
| 271 |
+
$$
|
| 272 |
+
\begin{array} { r l r } { a _ { t } = \mathrm { s o f m a x } ( \psi _ { a } ( q _ { t } ) ) } & { A _ { t , i } = ( r _ { 1 } , \dots , r _ { R } , o _ { 0 } , \dots , o _ { i - 1 } ) ^ { T } a _ { t , i } } & { \forall i < M } \\ { b _ { t } = \mathrm { s o f m a x } ( \psi _ { b } ( q _ { t } ) ) } & { B _ { t , i } = ( r _ { 1 } , \dots , r _ { R } , o _ { 0 } , \dots , o _ { i - 1 } ) ^ { T } b _ { t , i } } & { \forall i < M } \\ { c _ { t } = \mathrm { s o f m a x } ( \psi _ { c } ( q _ { t } ) ) } & { r _ { t , i } = ( r _ { 1 } , \dots , r _ { R } , o _ { 1 } , \dots , o _ { Q } ) ^ { T } c _ { t , i } } & { \forall i < R } \\ { f _ { t } = \psi _ { f } ( q _ { t } ) } & { o _ { t , i , k } = \displaystyle \sum _ { 0 \leq a , b < M } A _ { t , i , a } B _ { t , i , b } [ m _ { i } ( a , b ) = k ] } & { \forall i \notin \{ \rho , \omega \} , k < M } \\ { q _ { t } = \varphi ( q _ { t - 1 } , r _ { t , - , 0 } ) } & { o _ { t , \rho } = \mathcal { M } _ { t } A _ { t , \rho } } & { \mathrm { ( ) } } \\ & { \mathcal { M } _ { t } = ( J - A _ { t , \omega } ) J ^ { T } \cdot \mathcal { M } _ { t - 1 } + A _ { t , \omega } B _ { t , \omega } ^ { T } } & { \mathrm { ( ) } } \\ { p _ { t } = f _ { t } \prod ( 1 - f _ { i } ) } & { p _ { T } = 1 - \displaystyle \sum _ { i \ < T } p _ { i } } & { \mathrm { ( ) } } \end{array}
|
| 273 |
+
$$
|
| 274 |
+
|
| 275 |
+
# C SETUP FOR NTM
|
| 276 |
+
|
| 277 |
+
For all of our NTM experiments we use a densely connected feed-forward controller. There are two architectural differences from the original NTM Graves et al. (2014) that helped our baseline performance: (1) the feed-forward controller, the erase and the add gates use tanh activation; (2) the output layer uses softmax. In the original architecture these are all logistic sigmoids. For the newly introduced tape decoder (active only during training) we used two alternative implementations: a tanh-softmax network, and a single affine transformation. We tested the NTM’s learning ability on five different tasks for sequence manipulation, two of which have not been previously investigated in this domain. These tasks can be found in Appendix E.
|
| 278 |
+
|
| 279 |
+
We performed experiments using several combination of losses as summarized in Appendix F. The observed training performance per task is shown in Appendix I, with rows corresponding to the different loss setups. The corner setup differs from the address setup in that the example subtraces were defined only for a few important corner cases. For example in RepeatCopyTwice, the write head was provided once at the beginning of the input sequence, and once at the end. Similarly, the read head was revealed at the beginning and at the end of every output repetition. In all other setups we provide full subtraces (defined for all time steps).
|
| 280 |
+
|
| 281 |
+
The supervision amount can be tuned by adjusting the $\lambda$ weight from Equation 8. Further, we can also control the fraction of examples which get extra subtrace supervision (the density row in Figure I). The performance metric we use is the percentage of runs that do generalize after $1 0 0 \mathrm { k }$ iterations for the given task and supervision type. By generalize we mean that the NTM has perfect accuracy on all testing examples up to $1 . 5 \times$ the size of the max training length, and also perfect accuracy on $90 \%$ of the testing examples up to $2 \times$ the maximum training length.
|
| 282 |
+
|
| 283 |
+
We used a feed-forwad controller with $2 \times 5 0$ units, except for RepeatCopyTwice, which uses $2 \times 1 0 0$ units. For training we used the Adam optimizer Kingma & Ba (2014), a learning rate of $1 0 ^ { - 3 }$ for all tasks except RepeatFlip3d and $\mathtt { F 1 1 p 3 r d }$ which use $5 \cdot 1 0 ^ { - 4 } $ . The lengths of the training sequences for the first four tasks are from 1 to 5, whereas the generalization of the model was tested with sequences of lengths up to 20. For Flip3rd and RepeatFlip3d, the training sequence length was up to 16, whereas the testing sequences have maximum length of 32.
|
| 284 |
+
|
| 285 |
+
# D SETUP FOR NRAM
|
| 286 |
+
|
| 287 |
+
Like in the NTM, we use a densely connected two layer feed forward controller for our experiments, and use ReLU as the activation function. We make no modifications to the original architecture, and use noise with the parameter $\eta = 0 . 3$ as suggested by Neelakantan et al. (2015), and curriculum learning as described by Zaremba & Sutskever (2014). We stop training once we get to a difficulty specified by the task, and increase the difficulty once 0 errors were found on a new testing batch of 10 samples. Each training iteration trains with 50 examples of the currently randomly sampled difficulty. Regardless of whether the model had converged, training is stopped after 5000 samples were used. Such a low number is used to replicate the potential conditions under which such a model might be used. As with the NTM, the Adam optimizer was used. The specific tasks we use are described in Appendix G, and the specific kinds of supervision we give are described in Appendix H. The $\lambda$ we used here was 40. The system was implemented using PyTorch.
|
| 288 |
+
|
| 289 |
+
# E NTM TASKS
|
| 290 |
+
|
| 291 |
+
Every input sequence ends with a special delimiter $x _ { E }$ not occurring elsewhere in the sequence
|
| 292 |
+
|
| 293 |
+
Copy – The input consists of generic elements, $x _ { 1 } \ldots x _ { n } x _ { E }$ . The desired output is $x _ { 1 } \ldots x _ { n } x _ { E }$
|
| 294 |
+
|
| 295 |
+
RepeatCopyTwice – The input is again a sequence of generic elements, $x _ { 1 } \ldots x _ { n } x _ { E }$ . The desired output is the input copied twice $x _ { 1 } \ldots x _ { n } x _ { 1 } \ldots x _ { n } x _ { E }$ . Placing the delimiter only at the end of the output ensures that the machine learns to keep track of the number of copies. Otherwise, it could simply learn to cycle through the tape reproducing the given input indefinitely. We kept the number of repetitions fixed in order to increase baseline task performance for the benefit of comparison.
|
| 296 |
+
|
| 297 |
+
DyckWords – The input is a sequence of open and closed parentheses, $x _ { 1 } \ldots x _ { n } x _ { E }$ . The desired output is a sequence of bits $y _ { 1 } \ldots y _ { n } x _ { E }$ such that $y _ { i } = 1$ iff the prefix $x _ { 1 } \ldots x _ { i }$ is a balanced string of parentheses (a Dyck word). Both positive and negative examples were given.
|
| 298 |
+
|
| 299 |
+
Flip3rd – The input is a sequence of bits, $x _ { 1 } x _ { 2 } x _ { 3 } \ldots x _ { n } x _ { E }$ . The desired output is the same sequence of bits but with the 3rd bit flipped: $x _ { 1 } x _ { 2 } \bar { x } _ { 3 } \ldots x _ { n } x _ { E }$ . Such a task with a specific index to be updated (e.g., 3rd) still requires handling data dependence on the contents of the index (unlike say the Copy task).
|
| 300 |
+
|
| 301 |
+
RepeatFlip3d – The input is a sequence of bits, $x _ { 1 } x _ { 2 } x _ { 3 } x _ { 4 } x _ { 5 } x _ { 5 } \ldots x _ { E }$ . The desired output is the same sequence of bits but with every 3rd bit flipped: $x _ { 1 } x _ { 2 } \bar { x } _ { 3 } x _ { 4 } x _ { 5 } \bar { x } _ { 6 } \ldots x _ { E }$ .
|
| 302 |
+
|
| 303 |
+
# F NTM SUBTRACES
|
| 304 |
+
|
| 305 |
+

|
| 306 |
+
Figure 8: A heirarchy of supervision types (but not quantities) for NTMs.
|
| 307 |
+
|
| 308 |
+
value traces provide hints for the memory at every timestep as explained in Equation 10.
|
| 309 |
+
|
| 310 |
+
read – provides a hint for the address of the read head at every timestep.
|
| 311 |
+
|
| 312 |
+
write – provides a hint for the address of the write head at every timestep.
|
| 313 |
+
|
| 314 |
+
address – provides hints for the address of both the read and the write head at every timestep.
|
| 315 |
+
|
| 316 |
+
addr+val – provides value, read and write hints for every timestep.
|
| 317 |
+
|
| 318 |
+
corner – provides hints for the address of both the read and the write head at every “important” timestep - we decided what important means here depends on which task we are referring to. In general, we consider the first and last timesteps important, and also any timestep where a head should change direction. For example, in RepeatCopyTwice for an example of size $n$ with $e$ repeats, we’d provide the heads at timesteps $0 , n , 2 n , 3 n \ldots , e n$ .
|
| 319 |
+
|
| 320 |
+
# G NRAM TASKS
|
| 321 |
+
|
| 322 |
+
Below we describe all the tasks we experimented with. We predominantly picked tasks that the NRAM is known to have trouble generalizing on. We did not introduce any new tasks, and more detailed descriptions of these tasks can be found in Kurach et al. (2016).
|
| 323 |
+
|
| 324 |
+
Swap – Provided two numbers, $a$ and $b$ and an array $p$ , swap $p [ a ]$ and $p [ b ]$ . All elements but that in the last memory cell are not zero.
|
| 325 |
+
|
| 326 |
+
Increment – Given an array $p$ , return the array with one added to each element. All elements but that in the last cell for the input are not zero. Elements can be zero in the output.
|
| 327 |
+
|
| 328 |
+
Permute – Given two arrays $p$ and $q$ return a new array $s$ such that $s [ i ] ~ = ~ q [ p [ i ] ]$ . The arrays $p$ and $q$ are preceded by a pointer, $a$ , to array $q$ . The output is expected to be $a , s [ 0 ] \ldots , s [ n ] , q [ 0 ] , q [ n ]$ .
|
| 329 |
+
|
| 330 |
+
ListK – Given a linked list in array form, and an index $k$ return the value at node $k$ .
|
| 331 |
+
|
| 332 |
+
Merge – given arrays $p$ and $q$ , and three pointers $a , b , c$ to array $p , q$ , and the output sequence (given as zeros initially), place the sorted combination of $p$ and $q$ into the output location.
|
| 333 |
+
|
| 334 |
+
The following table describes the specific NRAM instantiation used for each task. The default sequence (def) is the one described by Kurach et al. (2016). The number of timesteps is usually dependent on the length of the problem instance, $M$ (equivalently the word size or difficulty), and in the case of ListKwas given with respect to the argument $k$ . The difficulty (D) was simply the length of the sequence used.
|
| 335 |
+
|
| 336 |
+
<table><tr><td>Task</td><td>No. Regs</td><td>Module Sequence</td><td>Timesteps</td><td>Learn Rate</td><td>Start D</td><td>End D</td></tr><tr><td>Swap</td><td>5</td><td>def</td><td>7</td><td>0.01</td><td>6</td><td>10</td></tr><tr><td>Increment</td><td>2</td><td>def+R</td><td>M+2</td><td>0.01</td><td>4</td><td>10</td></tr><tr><td>Permute</td><td>4</td><td>R+def+R+W</td><td>M+3</td><td>0.05</td><td>7</td><td>12</td></tr><tr><td>ListK</td><td>6</td><td>def</td><td>k+5</td><td>0.05</td><td>9</td><td>16</td></tr><tr><td>Merge</td><td>8</td><td>def + def + def</td><td>M+3</td><td>0.05</td><td>13</td><td>16</td></tr></table>
|
| 337 |
+
|
| 338 |
+
# H NRAM SUBTRACES
|
| 339 |
+
|
| 340 |
+
For each of the tasks listed Appendix G, we hand coded a complete circuit for every module and every timestep we would provide. The following subtraces types describe how we provide hints based on this circuit.
|
| 341 |
+
|
| 342 |
+
None – provides no hints.
|
| 343 |
+
|
| 344 |
+
Full – provides the entire circuit.
|
| 345 |
+
|
| 346 |
+
SingleHint – provides a random hint at a random timestep.
|
| 347 |
+
|
| 348 |
+
SingleTimestep – provides the entire circuit at a random timestep.
|
| 349 |
+
|
| 350 |
+
Corners – provides the entire circuit at the first and last timesteps.
|
| 351 |
+
|
| 352 |
+
Registers – provides hints for the registers at every timestep.
|
| 353 |
+
|
| 354 |
+
Modules – provides hints for the modules at every timestep.
|
| 355 |
+
|
| 356 |
+
# I NTM RESULTS
|
| 357 |
+
|
| 358 |
+
(a) Copy
|
| 359 |
+
|
| 360 |
+
<table><tr><td rowspan=1 colspan=1>density</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>100</td><td rowspan=1 colspan=1>100</td><td rowspan=1 colspan=1>100</td><td rowspan=1 colspan=1>100</td><td rowspan=1 colspan=1>50</td><td rowspan=1 colspan=1>50</td><td rowspan=1 colspan=1>50</td><td rowspan=1 colspan=1>50</td><td rowspan=1 colspan=1>10</td><td rowspan=1 colspan=1>10</td><td rowspan=1 colspan=1>10</td><td rowspan=1 colspan=1>10</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></tr><tr><td rowspan=1 colspan=1>A</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>0.3</td><td rowspan=1 colspan=1>0.1</td><td rowspan=1 colspan=1>0.01</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>0.3</td><td rowspan=1 colspan=1>0.1</td><td rowspan=1 colspan=1>0.01</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>0.3</td><td rowspan=1 colspan=1>0.1</td><td rowspan=1 colspan=1>0.01</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>0.3</td><td rowspan=1 colspan=1>0.1</td><td rowspan=1 colspan=1>0.01</td></tr><tr><td rowspan=1 colspan=1>baseline</td><td rowspan=1 colspan=1>52.5</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><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><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1>addr+val</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>100</td><td rowspan=1 colspan=1>100</td><td rowspan=1 colspan=1>100</td><td rowspan=1 colspan=1>70</td><td rowspan=1 colspan=1>100</td><td rowspan=1 colspan=1>100</td><td rowspan=1 colspan=1>100</td><td rowspan=1 colspan=1>40</td><td rowspan=1 colspan=1>60</td><td rowspan=1 colspan=1>80</td><td rowspan=1 colspan=1>40</td><td rowspan=1 colspan=1>30</td><td rowspan=1 colspan=1>30</td><td rowspan=1 colspan=1>50</td><td rowspan=1 colspan=1>60</td><td rowspan=1 colspan=1>10</td></tr><tr><td rowspan=1 colspan=1>address</td><td></td><td rowspan=1 colspan=1>100</td><td rowspan=1 colspan=1>100</td><td rowspan=1 colspan=1>100</td><td rowspan=1 colspan=1>50</td><td rowspan=1 colspan=1>90</td><td rowspan=1 colspan=1>100</td><td rowspan=1 colspan=1>90</td><td rowspan=1 colspan=1>30</td><td rowspan=1 colspan=1>80</td><td rowspan=1 colspan=1>90</td><td rowspan=1 colspan=1>70</td><td rowspan=1 colspan=1>30</td><td rowspan=1 colspan=1>50</td><td rowspan=1 colspan=1>30</td><td rowspan=1 colspan=1>40</td><td rowspan=1 colspan=1>50</td></tr><tr><td rowspan=1 colspan=1>value</td><td></td><td rowspan=1 colspan=1>100</td><td rowspan=1 colspan=1>100</td><td rowspan=1 colspan=1>70</td><td rowspan=1 colspan=1>40</td><td rowspan=1 colspan=1>80</td><td rowspan=1 colspan=1>20</td><td rowspan=1 colspan=1>40</td><td rowspan=1 colspan=1>10</td><td rowspan=1 colspan=1>10</td><td rowspan=1 colspan=1>20</td><td rowspan=1 colspan=1>40</td><td rowspan=1 colspan=1>30</td><td rowspan=1 colspan=1>60</td><td rowspan=1 colspan=1>40</td><td rowspan=1 colspan=1>20</td><td rowspan=1 colspan=1>10</td></tr><tr><td rowspan=1 colspan=1>read</td><td></td><td rowspan=1 colspan=1>90</td><td rowspan=1 colspan=1>80</td><td rowspan=1 colspan=1>70</td><td rowspan=1 colspan=1>50</td><td rowspan=1 colspan=1>60</td><td rowspan=1 colspan=1>20</td><td rowspan=1 colspan=1>50</td><td rowspan=1 colspan=1>20</td><td rowspan=1 colspan=1>40</td><td rowspan=1 colspan=1>40</td><td rowspan=1 colspan=1>60</td><td rowspan=1 colspan=1>20</td><td rowspan=1 colspan=1>70</td><td rowspan=1 colspan=1>30</td><td rowspan=1 colspan=1>40</td><td rowspan=1 colspan=1>10</td></tr><tr><td rowspan=1 colspan=1>write</td><td></td><td rowspan=1 colspan=1>60</td><td rowspan=1 colspan=1>70</td><td rowspan=1 colspan=1>80</td><td rowspan=1 colspan=1>60</td><td rowspan=1 colspan=1>80</td><td rowspan=1 colspan=1>80</td><td rowspan=1 colspan=1>40</td><td rowspan=1 colspan=1>40</td><td rowspan=1 colspan=1>50</td><td rowspan=1 colspan=1>70</td><td rowspan=1 colspan=1>50</td><td rowspan=1 colspan=1>40</td><td rowspan=1 colspan=1>50</td><td rowspan=1 colspan=1>60</td><td rowspan=1 colspan=1>50</td><td rowspan=1 colspan=1>40</td></tr><tr><td rowspan=1 colspan=1>corner</td><td></td><td rowspan=1 colspan=1>100</td><td rowspan=1 colspan=1>100</td><td rowspan=1 colspan=1>100</td><td rowspan=1 colspan=1>50</td><td rowspan=1 colspan=1>100</td><td rowspan=1 colspan=1>90</td><td rowspan=1 colspan=1>60</td><td rowspan=1 colspan=1>70</td><td rowspan=1 colspan=1>70</td><td rowspan=1 colspan=1>20</td><td rowspan=1 colspan=1>50</td><td rowspan=1 colspan=1>30</td><td rowspan=1 colspan=1>50</td><td rowspan=1 colspan=1>60</td><td rowspan=1 colspan=1>20</td><td rowspan=1 colspan=1>30</td></tr></table>
|
| 361 |
+
|
| 362 |
+
(b) RepeatCopyTwice
|
| 363 |
+
|
| 364 |
+
<table><tr><td rowspan=1 colspan=1>density</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>100</td><td rowspan=1 colspan=1>100</td><td rowspan=1 colspan=1>100</td><td rowspan=1 colspan=1>50</td><td rowspan=1 colspan=1>50</td><td rowspan=1 colspan=1>50</td><td rowspan=1 colspan=1>10</td><td rowspan=1 colspan=1>10</td><td rowspan=1 colspan=1>10</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>A</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>0.3</td><td rowspan=1 colspan=1>0.03</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>0.3</td><td rowspan=1 colspan=1>0.03</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>0.3</td><td rowspan=1 colspan=1>0.03</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>0.3</td><td rowspan=1 colspan=1>0.03</td></tr><tr><td rowspan=1 colspan=1>baseline</td><td rowspan=1 colspan=1>15.5</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><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>addr+val</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>90</td><td rowspan=1 colspan=1>100</td><td rowspan=1 colspan=1>60</td><td rowspan=1 colspan=1>90</td><td rowspan=1 colspan=1>80</td><td rowspan=1 colspan=1>40</td><td rowspan=1 colspan=1>80</td><td rowspan=1 colspan=1>20</td><td rowspan=1 colspan=1>10</td><td rowspan=1 colspan=1>10</td><td rowspan=1 colspan=1>0</td><td rowspan=1 colspan=1>。</td></tr><tr><td rowspan=1 colspan=1>address</td><td></td><td rowspan=1 colspan=1>90</td><td rowspan=1 colspan=1>90</td><td rowspan=1 colspan=1>90</td><td rowspan=1 colspan=1>100</td><td rowspan=1 colspan=1>100</td><td rowspan=1 colspan=1>40</td><td rowspan=1 colspan=1>100</td><td rowspan=1 colspan=1>60</td><td rowspan=1 colspan=1>。</td><td rowspan=1 colspan=1>。</td><td rowspan=1 colspan=1>20</td><td rowspan=1 colspan=1>30</td></tr><tr><td rowspan=1 colspan=1>value</td><td></td><td rowspan=1 colspan=1>80</td><td rowspan=1 colspan=1>70</td><td rowspan=1 colspan=1>。</td><td rowspan=1 colspan=1>50</td><td rowspan=1 colspan=1>50</td><td rowspan=1 colspan=1>10</td><td rowspan=1 colspan=1>30</td><td rowspan=1 colspan=1>30</td><td rowspan=1 colspan=1>20</td><td rowspan=1 colspan=1>10</td><td rowspan=1 colspan=1>30</td><td rowspan=1 colspan=1>0</td></tr><tr><td rowspan=1 colspan=1>read</td><td></td><td rowspan=1 colspan=1>50</td><td rowspan=1 colspan=1>30</td><td rowspan=1 colspan=1>30</td><td rowspan=1 colspan=1>20</td><td rowspan=1 colspan=1>60</td><td rowspan=1 colspan=1>30</td><td rowspan=1 colspan=1>20</td><td rowspan=1 colspan=1>60</td><td rowspan=1 colspan=1>10</td><td rowspan=1 colspan=1>10</td><td rowspan=1 colspan=1>10</td><td rowspan=1 colspan=1>。</td></tr><tr><td rowspan=1 colspan=1>write</td><td></td><td rowspan=1 colspan=1>30</td><td rowspan=1 colspan=1>30</td><td rowspan=1 colspan=1>20</td><td rowspan=1 colspan=1>10</td><td rowspan=1 colspan=1>30</td><td rowspan=1 colspan=1>40</td><td rowspan=1 colspan=1>20</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>10</td><td rowspan=1 colspan=1>10</td><td rowspan=1 colspan=1>20</td><td rowspan=1 colspan=1>20</td></tr><tr><td rowspan=1 colspan=1>comer</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>60</td><td rowspan=1 colspan=1>50</td><td rowspan=1 colspan=1>40</td><td rowspan=1 colspan=1>50</td><td rowspan=1 colspan=1>60</td><td rowspan=1 colspan=1>10</td><td rowspan=1 colspan=1>20</td><td rowspan=1 colspan=1>40</td><td rowspan=1 colspan=1>20</td><td rowspan=1 colspan=1>10</td><td rowspan=1 colspan=1>20</td><td rowspan=1 colspan=1>0</td></tr></table>
|
| 365 |
+
|
| 366 |
+
(c) DyckWords
|
| 367 |
+
|
| 368 |
+
<table><tr><td rowspan=1 colspan=1>density</td><td rowspan=1 colspan=2></td><td rowspan=1 colspan=1>100</td><td rowspan=1 colspan=1>100</td><td rowspan=1 colspan=1>100</td><td rowspan=1 colspan=1>100</td><td rowspan=1 colspan=1>50</td><td rowspan=1 colspan=1>50</td><td rowspan=1 colspan=1>50</td><td rowspan=1 colspan=1>50</td><td rowspan=1 colspan=1>10</td><td rowspan=1 colspan=1>10</td><td rowspan=1 colspan=1>10</td><td rowspan=1 colspan=1>10</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></tr><tr><td rowspan=1 colspan=1>A</td><td rowspan=1 colspan=2></td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>0.3</td><td rowspan=1 colspan=1>0.1</td><td rowspan=1 colspan=1>0.01</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>0.3</td><td rowspan=1 colspan=1>0.1</td><td rowspan=1 colspan=1>0.01</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>0.3</td><td rowspan=1 colspan=1>0.1</td><td rowspan=1 colspan=1>0.01</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>0.3</td><td rowspan=1 colspan=1>0.1</td><td rowspan=1 colspan=1>0.01</td></tr><tr><td rowspan=1 colspan=1>baseline</td><td rowspan=1 colspan=2>45</td><td rowspan=1 colspan=2></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><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>address</td><td rowspan=1 colspan=2></td><td rowspan=1 colspan=1>70</td><td rowspan=1 colspan=1>90</td><td rowspan=1 colspan=1>60</td><td rowspan=1 colspan=1>80</td><td rowspan=1 colspan=1>90</td><td rowspan=1 colspan=1>90</td><td rowspan=1 colspan=1>90</td><td rowspan=1 colspan=1>50</td><td rowspan=1 colspan=1>80</td><td rowspan=1 colspan=1>50</td><td rowspan=1 colspan=1>90</td><td rowspan=1 colspan=1>80</td><td rowspan=1 colspan=1>100</td><td rowspan=1 colspan=1>80</td><td rowspan=1 colspan=1>70</td><td rowspan=1 colspan=1>70</td></tr><tr><td rowspan=1 colspan=1>read</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>80</td><td rowspan=1 colspan=1>90</td><td rowspan=1 colspan=1>70</td><td rowspan=1 colspan=1>70</td><td rowspan=1 colspan=1>100</td><td rowspan=1 colspan=1>100</td><td rowspan=1 colspan=1>70</td><td rowspan=1 colspan=1>50</td><td rowspan=1 colspan=1>50</td><td rowspan=1 colspan=1>60</td><td rowspan=1 colspan=1>70</td><td rowspan=1 colspan=1>70</td><td rowspan=1 colspan=1>80</td><td rowspan=1 colspan=1>70</td><td rowspan=1 colspan=1>50</td><td rowspan=1 colspan=1>50</td></tr><tr><td rowspan=1 colspan=1>corner</td><td rowspan=1 colspan=2></td><td rowspan=1 colspan=1>60</td><td rowspan=1 colspan=1>100</td><td rowspan=1 colspan=1>80</td><td rowspan=1 colspan=1>80</td><td rowspan=1 colspan=1>80</td><td rowspan=1 colspan=1>90</td><td rowspan=1 colspan=1>90</td><td rowspan=1 colspan=1>90</td><td rowspan=1 colspan=1>60</td><td rowspan=1 colspan=1>60</td><td rowspan=1 colspan=1>100</td><td rowspan=1 colspan=1>50</td><td rowspan=1 colspan=1>90</td><td rowspan=1 colspan=1>80</td><td rowspan=1 colspan=1>80</td><td rowspan=1 colspan=1>50</td></tr></table>
|
| 369 |
+
|
| 370 |
+
(d) Flip3rd
|
| 371 |
+
|
| 372 |
+
<table><tr><td rowspan=1 colspan=1>density</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>100</td><td rowspan=1 colspan=1>100</td><td rowspan=1 colspan=1>100</td><td rowspan=1 colspan=1>100</td><td rowspan=1 colspan=1>50</td><td rowspan=1 colspan=1>50</td><td rowspan=1 colspan=1>50</td><td rowspan=1 colspan=1>50</td><td rowspan=1 colspan=1>10</td><td rowspan=1 colspan=1>10</td><td rowspan=1 colspan=1>10</td><td rowspan=1 colspan=1>10</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></tr><tr><td rowspan=1 colspan=1>A</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>0.3</td><td rowspan=1 colspan=1>0.1</td><td rowspan=1 colspan=1>0.03</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>0.3</td><td rowspan=1 colspan=1>0.1</td><td rowspan=1 colspan=1>0.03</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>0.3</td><td rowspan=1 colspan=1>0.1</td><td rowspan=1 colspan=1>0.03</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>0.3</td><td rowspan=1 colspan=1>0.1</td><td rowspan=1 colspan=1>0.03</td></tr><tr><td rowspan=1 colspan=1>baseline</td><td rowspan=1 colspan=1>45</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=2></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=2></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><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1>addr+val</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>30</td><td rowspan=1 colspan=1>50</td><td rowspan=1 colspan=1>50</td><td rowspan=1 colspan=1>50</td><td rowspan=1 colspan=1>50</td><td rowspan=1 colspan=1>50</td><td rowspan=1 colspan=1>70</td><td rowspan=1 colspan=1>80</td><td rowspan=1 colspan=1>60</td><td rowspan=1 colspan=1>80</td><td rowspan=1 colspan=1>40</td><td rowspan=1 colspan=1>40</td><td rowspan=1 colspan=1>40</td><td rowspan=1 colspan=1>60</td><td rowspan=1 colspan=1>40</td><td rowspan=1 colspan=1>10</td></tr><tr><td rowspan=1 colspan=1>address</td><td></td><td rowspan=1 colspan=1>。</td><td rowspan=1 colspan=1>60</td><td rowspan=1 colspan=1>40</td><td rowspan=1 colspan=1>40</td><td rowspan=1 colspan=1>20</td><td rowspan=1 colspan=1>70</td><td rowspan=1 colspan=1>80</td><td rowspan=1 colspan=1>90</td><td rowspan=1 colspan=1>90</td><td rowspan=1 colspan=1>70</td><td rowspan=1 colspan=1>60</td><td rowspan=1 colspan=1>50</td><td rowspan=1 colspan=1>50</td><td rowspan=1 colspan=1>50</td><td rowspan=1 colspan=1>60</td><td rowspan=1 colspan=1>60</td></tr><tr><td rowspan=1 colspan=1>value</td><td></td><td rowspan=1 colspan=1>60</td><td rowspan=1 colspan=1>50</td><td rowspan=1 colspan=1>40</td><td rowspan=1 colspan=1>60</td><td rowspan=1 colspan=1>80</td><td rowspan=1 colspan=1>70</td><td rowspan=1 colspan=1>40</td><td rowspan=1 colspan=1>10</td><td rowspan=1 colspan=1>50</td><td rowspan=1 colspan=1>10</td><td rowspan=1 colspan=1>40</td><td rowspan=1 colspan=1>70</td><td rowspan=1 colspan=1>50</td><td rowspan=1 colspan=1>30</td><td rowspan=1 colspan=1>40</td><td rowspan=1 colspan=1>60</td></tr><tr><td rowspan=1 colspan=1>read</td><td></td><td rowspan=1 colspan=1>40</td><td rowspan=1 colspan=1>60</td><td rowspan=1 colspan=1>70</td><td rowspan=1 colspan=1>40</td><td rowspan=1 colspan=1>30</td><td rowspan=1 colspan=1>80</td><td rowspan=1 colspan=1>90</td><td rowspan=1 colspan=1>90</td><td rowspan=1 colspan=1>100</td><td rowspan=1 colspan=1>70</td><td rowspan=1 colspan=1>80</td><td rowspan=1 colspan=1>50</td><td rowspan=1 colspan=1>30</td><td rowspan=1 colspan=1>50</td><td rowspan=1 colspan=1>60</td><td rowspan=1 colspan=1>30</td></tr><tr><td rowspan=1 colspan=1>write</td><td></td><td rowspan=1 colspan=1>。</td><td rowspan=1 colspan=1>30</td><td rowspan=1 colspan=1>50</td><td rowspan=1 colspan=1>20</td><td rowspan=1 colspan=1>30</td><td rowspan=1 colspan=1>40</td><td rowspan=1 colspan=1>60</td><td rowspan=1 colspan=1>20</td><td rowspan=1 colspan=1>40</td><td rowspan=1 colspan=1>40</td><td rowspan=1 colspan=1>40</td><td rowspan=1 colspan=1>40</td><td rowspan=1 colspan=1>20</td><td rowspan=1 colspan=1>50</td><td rowspan=1 colspan=1>70</td><td rowspan=1 colspan=1>50</td></tr><tr><td rowspan=1 colspan=1>corner</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>50</td><td rowspan=1 colspan=1>70</td><td rowspan=1 colspan=1>80</td><td rowspan=1 colspan=1>80</td><td rowspan=1 colspan=1>40</td><td rowspan=1 colspan=1>40</td><td rowspan=1 colspan=1>90</td><td rowspan=1 colspan=1>70</td><td rowspan=1 colspan=1>80</td><td rowspan=1 colspan=1>70</td><td rowspan=1 colspan=1>60</td><td rowspan=1 colspan=1>40</td><td rowspan=1 colspan=1>50</td><td rowspan=1 colspan=1>60</td><td rowspan=1 colspan=1>60</td><td rowspan=1 colspan=1>40</td></tr></table>
|
| 373 |
+
|
| 374 |
+
(e) RepeatFlip3d
|
| 375 |
+
|
| 376 |
+
<table><tr><td rowspan=1 colspan=1>density</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>100</td><td rowspan=1 colspan=1>100</td><td rowspan=1 colspan=1>100</td><td rowspan=1 colspan=1>100</td><td rowspan=1 colspan=1>50</td><td rowspan=1 colspan=1>50</td><td rowspan=1 colspan=1>50</td><td rowspan=1 colspan=1>50</td><td rowspan=1 colspan=1>10</td><td rowspan=1 colspan=1>10</td><td rowspan=1 colspan=1>10</td><td rowspan=1 colspan=1>10</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></tr><tr><td rowspan=1 colspan=1>A</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>0.5</td><td rowspan=1 colspan=1>0.1</td><td rowspan=1 colspan=1>0.03</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>0.5</td><td rowspan=1 colspan=1>0.1</td><td rowspan=1 colspan=1>0.03</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>0.5</td><td rowspan=1 colspan=1>0.1</td><td rowspan=1 colspan=1>0.03</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>0.5</td><td rowspan=1 colspan=1>0.1</td><td rowspan=1 colspan=1>0.03</td></tr><tr><td rowspan=1 colspan=1>baseline</td><td rowspan=1 colspan=1>5</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><td rowspan=1 colspan=1></td><td rowspan=1 colspan=2></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>addr+val</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>30</td><td rowspan=1 colspan=1>20</td><td rowspan=1 colspan=1>20</td><td rowspan=1 colspan=1>40</td><td rowspan=1 colspan=1>30</td><td rowspan=1 colspan=1>30</td><td rowspan=1 colspan=1>10</td><td rowspan=1 colspan=1>10</td><td rowspan=1 colspan=1>40</td><td rowspan=1 colspan=1>10</td><td rowspan=1 colspan=1>0</td><td rowspan=1 colspan=1>20</td><td rowspan=1 colspan=1>10</td><td rowspan=1 colspan=1>10</td><td rowspan=1 colspan=1>0</td><td rowspan=1 colspan=1>10</td></tr><tr><td rowspan=1 colspan=1>address</td><td></td><td rowspan=1 colspan=1>20</td><td rowspan=1 colspan=1>50</td><td rowspan=1 colspan=1>30</td><td rowspan=1 colspan=1>30</td><td rowspan=1 colspan=1>30</td><td rowspan=1 colspan=1>40</td><td rowspan=1 colspan=1>20</td><td rowspan=1 colspan=1>40</td><td rowspan=1 colspan=1>20</td><td rowspan=1 colspan=1>40</td><td rowspan=1 colspan=1>20</td><td rowspan=1 colspan=1>。</td><td rowspan=1 colspan=1>。</td><td rowspan=1 colspan=1>0</td><td rowspan=1 colspan=1>20</td><td rowspan=1 colspan=1>。</td></tr><tr><td rowspan=1 colspan=1>value</td><td></td><td rowspan=1 colspan=1>。</td><td rowspan=1 colspan=1>。</td><td rowspan=1 colspan=1>20</td><td rowspan=1 colspan=1>20</td><td rowspan=1 colspan=1>。</td><td rowspan=1 colspan=1>0</td><td rowspan=1 colspan=1>0</td><td rowspan=1 colspan=1>0</td><td rowspan=1 colspan=1>10</td><td rowspan=1 colspan=1>10</td><td rowspan=1 colspan=1>10</td><td rowspan=1 colspan=1>。</td><td rowspan=1 colspan=1>0</td><td rowspan=1 colspan=1>0</td><td rowspan=1 colspan=1>0</td><td rowspan=1 colspan=1>0</td></tr><tr><td rowspan=1 colspan=1>read</td><td></td><td rowspan=1 colspan=1>30</td><td rowspan=1 colspan=1>10</td><td rowspan=1 colspan=1>40</td><td rowspan=1 colspan=1>20</td><td rowspan=1 colspan=1>10</td><td rowspan=1 colspan=1>30</td><td rowspan=1 colspan=1>20</td><td rowspan=1 colspan=1>40</td><td rowspan=1 colspan=1>30</td><td rowspan=1 colspan=1>10</td><td rowspan=1 colspan=1>。</td><td rowspan=1 colspan=1>10</td><td rowspan=1 colspan=1>20</td><td rowspan=1 colspan=1>。</td><td rowspan=1 colspan=1>10</td><td rowspan=1 colspan=1>20</td></tr><tr><td rowspan=1 colspan=1>write</td><td></td><td rowspan=1 colspan=1>。</td><td rowspan=1 colspan=1>。</td><td rowspan=1 colspan=1>。</td><td rowspan=1 colspan=1>10</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>10</td><td rowspan=1 colspan=1>10</td><td rowspan=1 colspan=1>0</td><td rowspan=1 colspan=1>。</td><td rowspan=1 colspan=1>20</td><td rowspan=1 colspan=1>20</td><td rowspan=1 colspan=1>30</td><td rowspan=1 colspan=1>。</td></tr><tr><td rowspan=1 colspan=1>corner</td><td></td><td rowspan=1 colspan=1>40</td><td rowspan=1 colspan=1>40</td><td rowspan=1 colspan=1>60</td><td rowspan=1 colspan=1>20</td><td rowspan=1 colspan=1>50</td><td rowspan=1 colspan=1>30</td><td rowspan=1 colspan=1>10</td><td rowspan=1 colspan=1>30</td><td rowspan=1 colspan=1>10</td><td rowspan=1 colspan=1>10</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>。</td><td rowspan=1 colspan=1>。</td><td rowspan=1 colspan=1>10</td><td rowspan=1 colspan=1>。</td><td rowspan=1 colspan=1>10</td></tr></table>
|
| 377 |
+
|
| 378 |
+
Figure 9: Baselines have generalization on over 40 different initial weights. Other tests use 10.
|
| 379 |
+
|
| 380 |
+
Which Details to Reveal for NTM? The first dimension listed in the rows of the tables of Figure I controls the execution details revealed in a Subtrace. We use subtraces showing either the addresses without the tape values, only the read heads or the write heads, or even weaker supervision in a few corner cases. In tasks Copy Figure 9a), RepeatCopyTwice (Figure 9b) and DyckWords (Figure 9c), it is frequently the case that when the NTM generalizes without supervision, it converges to an algorithm which we are able to interpret. For them, we designed the addr+val traces to match this algorithm, and saw increases in generalization frequency of at least $45 \%$ . It can be concluded that when additionally provided supervision reflects the interpretable “natural” behavior of the NTM, the learning becomes significantly more robust to changes in initial weights. Additionally, for tasks Flip3rd (Figure 9d) and RepeatFlip3d (Figure 9e), both the baseline and other supervision types are outperformed by training with read supervision. It is also notable that corner supervision in RepeatFlip3d achieves highest improvement over the baseline, $60 \%$ over $5 \%$ . In essence, this means that providing only a small part of the trace can diminish the occurrence of local minima in the loss function.
|
| 381 |
+
|
| 382 |
+
How Often to Reveal for NTM? The second dimension controls the proportion of examples that receive extra subtrace supervision (the density columns in Figure I). For Flip3rd, RepeatCopyTwice and DyckWords we observed that having only a small number of examples with extra supervision leads to models which are more robust to initial weight changes than the baseline, although not necessarily always as robust as providing supervision all the time.
|
| 383 |
+
|
| 384 |
+
A couple of interesting cases stand out. For Flip3rd with $10 \%$ corner subtraces and $\lambda = 1$ , we find a surprisingly high rate of generalization. Providing address traces $10 \%$ of the time when training RepeatCopyTwice leads to better performance all the time. For RepeatFlip3d, write traces at $1 \%$ frequency and $\lambda = 0 . 1$ generalize $30 \%$ of the time vs. $5 \%$ for baseline.
|
| 385 |
+
|
| 386 |
+
While the type of trace which works best varies per task, for each task there exists a trace which can be provided only $1 \%$ of the time and still greatly improve the performance over the baseline. This suggests that a small amount of extra supervision can improve performance significantly, but the kind of supervision may differ. It is an interesting research question to find out how the task at hand relates to the optimal kind of supervision.
|
| 387 |
+
|
| 388 |
+
# J NRAM RESULTS
|
| 389 |
+
|
| 390 |
+
<table><tr><td rowspan=1 colspan=1>Subtrace Type \Task</td><td rowspan=1 colspan=1>Permute</td><td rowspan=1 colspan=1>Swap</td><td rowspan=1 colspan=1>Increment</td><td rowspan=1 colspan=1>ListK</td><td rowspan=1 colspan=1>Merge</td><td rowspan=1 colspan=1>PermuteNoise</td></tr><tr><td rowspan=8 colspan=1>NoneSingleHintCornersSingleTimestepRegistersModulesFullNoisyFull</td><td rowspan=1 colspan=1>36</td><td rowspan=1 colspan=1>44</td><td rowspan=1 colspan=1>58</td><td rowspan=1 colspan=1>41</td><td rowspan=1 colspan=1>13</td><td rowspan=3 colspan=1>121417</td></tr><tr><td rowspan=1 colspan=1>24</td><td rowspan=1 colspan=1>38</td><td rowspan=1 colspan=1>28</td><td rowspan=1 colspan=1>22</td><td rowspan=1 colspan=1>12</td></tr><tr><td rowspan=1 colspan=1>29</td><td rowspan=1 colspan=1>23</td><td rowspan=1 colspan=1>36</td><td rowspan=1 colspan=1>22</td><td rowspan=1 colspan=1>9</td></tr><tr><td rowspan=1 colspan=1>21</td><td rowspan=1 colspan=1>52</td><td rowspan=1 colspan=1>29</td><td rowspan=1 colspan=1>28</td><td rowspan=1 colspan=1>12</td><td rowspan=5 colspan=1>13-1141</td></tr><tr><td rowspan=1 colspan=1>48</td><td rowspan=1 colspan=1>58</td><td rowspan=1 colspan=1>73</td><td rowspan=1 colspan=1>54</td><td rowspan=1 colspan=1>-</td></tr><tr><td rowspan=1 colspan=1>48</td><td rowspan=1 colspan=1>58</td><td rowspan=1 colspan=1>107</td><td rowspan=1 colspan=1>54</td><td rowspan=1 colspan=1>-</td></tr><tr><td rowspan=1 colspan=1>26</td><td rowspan=1 colspan=1>33</td><td rowspan=1 colspan=1>32</td><td rowspan=1 colspan=1>44</td><td rowspan=1 colspan=1>21</td></tr><tr><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>36</td><td rowspan=1 colspan=1>1</td></tr></table>
|
| 391 |
+
|
| 392 |
+
Figure 11: The average time (in seconds) to finish training for each task and subtrace type. For most tasks it is clear that Full traces while introducing extra computations to individual timesteps, reduce the amount of time to finish training over not using supervision.
|
| 393 |
+
|
| 394 |
+
<table><tr><td rowspan=1 colspan=1>Subtrace Type \Task</td><td rowspan=1 colspan=1>Permute</td><td rowspan=1 colspan=1>Swap</td><td rowspan=1 colspan=1>Increment</td><td rowspan=1 colspan=1>ListK</td></tr><tr><td rowspan=1 colspan=1>None</td><td rowspan=1 colspan=1>6290.29</td><td rowspan=1 colspan=1>5505.22</td><td rowspan=1 colspan=1>3500.13</td><td rowspan=1 colspan=1>5880.11</td></tr><tr><td rowspan=6 colspan=1>SingleHintCornersSingleTimestepRegistersModulesFull</td><td rowspan=1 colspan=1>5565.22</td><td rowspan=1 colspan=1>3700.64</td><td rowspan=1 colspan=1>4318.20</td><td rowspan=1 colspan=1>6574.59</td></tr><tr><td rowspan=2 colspan=1>4468.856259.05</td><td rowspan=1 colspan=1>6195.75</td><td rowspan=1 colspan=1>3199.86</td><td rowspan=1 colspan=1>6601.16</td></tr><tr><td rowspan=1 colspan=1>2662.35</td><td rowspan=1 colspan=1>4042.18</td><td rowspan=1 colspan=1>5076.17</td></tr><tr><td rowspan=1 colspan=1>6618.12</td><td rowspan=1 colspan=1>5774.61</td><td rowspan=1 colspan=1>3839.18</td><td rowspan=1 colspan=1>6185.54</td></tr><tr><td rowspan=1 colspan=1>6523.16</td><td rowspan=1 colspan=1>5781.99</td><td rowspan=1 colspan=1>2335.99</td><td rowspan=1 colspan=1>6183.74</td></tr><tr><td rowspan=1 colspan=1>4919.33</td><td rowspan=1 colspan=1>4110.14</td><td rowspan=1 colspan=1>3758.99</td><td rowspan=1 colspan=1>3216.01</td></tr></table>
|
| 395 |
+
|
| 396 |
+

|
| 397 |
+
Figure 10: The number of runs which completed for each task and subtrace type. The Data in the graphs below is taken by averaging the results of these runs.
|
| 398 |
+
|
| 399 |
+
Figure 12: The average number of errors on the test set for each task and subtrace type once trained.
|
| 400 |
+
|
| 401 |
+
<table><tr><td rowspan=1 colspan=1>Subtrace Type \Task</td><td rowspan=1 colspan=1>ListK</td><td rowspan=1 colspan=1>Swap</td><td rowspan=1 colspan=1>Permute</td><td rowspan=1 colspan=1>Increment</td><td rowspan=1 colspan=1>Merge</td><td rowspan=1 colspan=1>PermuteNoise</td></tr><tr><td rowspan=7 colspan=1>NoneSingleHintCornersSingleTimestepFullRegistersModules</td><td rowspan=1 colspan=1>95.08</td><td rowspan=1 colspan=1>91.52</td><td rowspan=1 colspan=1>99.97</td><td rowspan=1 colspan=1>99.91</td><td rowspan=1 colspan=1>99.96</td><td rowspan=7 colspan=1>99.9956.9020.7933.6023.57-=</td></tr><tr><td rowspan=1 colspan=1>93.61</td><td rowspan=1 colspan=1>2.41</td><td rowspan=1 colspan=1>57.55</td><td rowspan=1 colspan=1>14.86</td><td rowspan=1 colspan=1>100.0</td></tr><tr><td rowspan=1 colspan=1>94.47</td><td rowspan=1 colspan=1>99.09</td><td rowspan=1 colspan=1>16.40</td><td rowspan=1 colspan=1>2.14</td><td rowspan=1 colspan=1>100.0</td></tr><tr><td rowspan=1 colspan=1>36.91</td><td rowspan=1 colspan=1>1.75</td><td rowspan=1 colspan=1>47.79</td><td rowspan=1 colspan=1>13.77</td><td rowspan=1 colspan=1>100.0</td></tr><tr><td rowspan=1 colspan=1>12.77</td><td rowspan=1 colspan=1>11.01</td><td rowspan=1 colspan=1>7.83</td><td rowspan=1 colspan=1>9.89</td><td rowspan=1 colspan=1>78.44</td></tr><tr><td rowspan=1 colspan=1>93.22</td><td rowspan=1 colspan=1>93.44</td><td rowspan=1 colspan=1>99.97</td><td rowspan=1 colspan=1>90.36</td><td rowspan=1 colspan=1>=</td></tr><tr><td rowspan=1 colspan=1>93.70</td><td rowspan=1 colspan=1>95.57</td><td rowspan=1 colspan=1>86.48</td><td rowspan=1 colspan=1>40.87</td><td rowspan=1 colspan=1>=</td></tr></table>
|
| 402 |
+
|
| 403 |
+

|
| 404 |
+
Figure 13: Comparing average generalization to sequence length for Swap
|
| 405 |
+
Figure 14: Comparing average generalization to sequence length for Increment
|
| 406 |
+
|
| 407 |
+

|
| 408 |
+
Figure 15: Comparing average generalization to sequence length for Permute
|
| 409 |
+
|
| 410 |
+

|
| 411 |
+
Figure 16: Comparing average generalization to sequence length for ListK
|
| 412 |
+
|
| 413 |
+

|
| 414 |
+
Figure 17: Comparing average generalization to sequence length for Merge
|
| 415 |
+
|
| 416 |
+

|
| 417 |
+
Figure 18: Comparing average generalization of the DNGPU Freivalds & Liepins (2017) with that of the NRAM using the full tracer for Merge. For this experiment, a maximum of 10000 samples were used for the DNGPU and 5000 for the NRAM. The DNGPU was run out of the box from the code supplied by the authors. 20 runs were averaged for the DNGPU and 38 runs for the NRAM. One can deduce that while neither is able to generalize this task perfectly, the simpler and easier to understand architecture, NRAM, does generalize better with fewer examples when those examples come with richer supervision.
|
| 418 |
+
|
| 419 |
+
# K PROGRAMMING NRAMS
|
| 420 |
+
|
| 421 |
+
The NRAM is parametrized by one or more straight-line partial programs, i.e., programs with no branching and no loops, chosen by register states. The machine runs in a loop, repeatedly selecting the program for that register state then executing it. The programs are expressend in a simple single-assignment imperative language. Each program statement $i$ invokes one of the modules of the architecture and assigns the result of the invocation to a local variable $x _ { i }$ . That variable cannot be changed later. The final program statement is a parallel-asignment that modifies the machine registers $r _ { 1 } \ldots r _ { k }$ . The values that appear in assignments/invocations can be: variables in scope, machine registers, or holes ?. These values are not used directly during execution: the actual values needs to be supplied by the NRAM controller. The values are only used as hints for the controller during training, with the whole ? denoting no hint. We can describe the language in an EBNF-style grammar:
|
| 422 |
+
|
| 423 |
+
$$
|
| 424 |
+
{ \begin{array} { r l r l } & { F _ { n } : : = { \mathrm { m o d u l e s ~ o f ~ a r i t y ~ } } n } & & { S _ { i } : : = x _ { i } F _ { n } ( \underbrace { V _ { i } , \dotsc , V _ { i } } _ { n } ) } \\ & { V _ { i } : = r _ { 1 } \mid \dots \mid r _ { k } \mid ? \mid x _ { 1 } \mid \dots \mid x _ { i - 1 } } & & { R _ { i } : = r _ { j 1 } , \dotsc , r _ { j _ { n } } \underbrace { V _ { i } , \dotsc , V _ { i } } _ { n } } \\ & { P _ { 1 } : = S _ { 1 } } & { P _ { i } : = P _ { i - 1 } ; S _ { i } } & & { P : : = P _ { 1 } ; R _ { 1 } \mid P _ { 2 } ; R _ { 2 } \mid \dots } \end{array} }
|
| 425 |
+
$$
|
| 426 |
+
|
| 427 |
+
An example program for the Increment task would be the following:
|
| 428 |
+
|
| 429 |
+
$x _ { 1 } \gets 1$ ;
|
| 430 |
+
$x _ { 2 } \gets \mathsf { R E A D } ( r _ { 1 } )$ ;
|
| 431 |
+
$x _ { 3 } \gets \mathsf { A D D } ( x _ { 2 } , x _ { 1 } )$ ; $x _ { 4 } \gets \mathsf { W R I T E } ( r _ { 1 } , x _ { 3 } ) ;$ $x _ { 5 } \gets \mathsf { A D D } ( r _ { 1 } , x _ { 1 } ) ;$ r1 ← x5
|
| 432 |
+
|
| 433 |
+
Here, the controller is encouraged to read the memory at the location stored in the first register $r _ { 1 }$ add one to it, then store it back, and then increment the the first register.
|
| 434 |
+
|
| 435 |
+
An alternative to the trace-based approach is to make the controller produce values only for the holes, and use directly the specified variable/register arguments. This way, only the unspecified parts of the program are learned. This is, for example, the approach taken by ∂Forth Bošnjak et al. (2017). There, programs are expressed in a suitably adapted variant of the Forth programming language, which is as expressive as the language discussed above, but less syntactically constrained.
|
| 436 |
+
|
| 437 |
+
The drawback of this alternative is that whenever an argument other than a whole is specified, one must also specify the time steps to which it applies in all possible executions and not just the training ones. That is why, typically, these values are specified either for all or for none of the time steps.
|
| 438 |
+
|
| 439 |
+
In the following examples, we will describe the register states using $\mathbf { \vec { \nabla } } _ { 0 } , \mathbf { \vec { \mathbf { \phi } } } _ { 0 } ,$ , “ $! 0 ^ { \dag }$ and “-” meaning respectively that a register has 0, that it contains anything but zero, or that it can contain anything.
|
| 440 |
+
|
| 441 |
+
# L NRAM PERMUTATION PROGRAM
|
| 442 |
+
|
| 443 |
+
For any register pattern.
|
| 444 |
+
|
| 445 |
+
# M NRAM LISTK PROGRAM
|
| 446 |
+
|
| 447 |
+
When the registers are $[ 0 , ! 0 , ! 0 , - , - ]$ :
|
| 448 |
+
|
| 449 |
+
$x _ { 1 } \gets R E A D ( r _ { 0 } )$ ; $x _ { 2 } A D D ( x _ { 1 } , 2 )$ ; $\begin{array} { r l } & { x _ { 3 } \gets W R I T E ( 0 , x _ { 1 } ) ; } \\ & { r _ { 0 } \gets 1 ; } \\ & { r _ { 1 } \gets 1 ; } \\ & { r _ { 2 } \gets 1 ; } \\ & { r _ { 3 } \gets x _ { 2 } ; } \end{array}$
|
| 450 |
+
|
| 451 |
+
When the registers are [!0, !0, !0, -, -]:
|
| 452 |
+
|
| 453 |
+
$$
|
| 454 |
+
\begin{array} { l } { { x _ { 1 } \gets R E A D ( r _ { 1 } ) ; } } \\ { { x _ { 2 } \gets A D D ( x _ { 1 } , 2 ) ; } } \\ { { x _ { 3 } \gets W R I T E ( r _ { 1 } , x _ { 1 } ) ; } } \\ { { r _ { 0 } \gets 1 ; } } \\ { { r _ { 1 } \gets 0 ; } } \\ { { r _ { 2 } \gets 1 ; } } \\ { { r _ { 3 } \gets r _ { 3 } ; } } \\ { { x _ { 4 } \gets x _ { 2 } ; } } \end{array}
|
| 455 |
+
$$
|
| 456 |
+
|
| 457 |
+
When the registers are $[ ! 0 , 0 , ! 0 , - , - ]$ :
|
| 458 |
+
|
| 459 |
+
When the registers are $[ ! 0 , 0 , 0 , \cdot , - ]$ :
|
| 460 |
+
|
| 461 |
+
$$
|
| 462 |
+
\begin{array} { l } { x _ { 1 } \gets R E A D ( r _ { 4 } ) ; } \\ { x _ { 2 } \gets W R I T E ( r _ { 4 } , r _ { 3 } ) ; } \\ { r _ { 0 } \gets 1 ; } \\ { r _ { 1 } \gets 1 ; } \\ { r _ { 2 } \gets 0 ; } \\ { r _ { 3 } \gets x _ { 1 } ; } \end{array}
|
| 463 |
+
$$
|
| 464 |
+
|
| 465 |
+
When the registers are $[ 0 , ! 0 , 0 , \cdot , - ]$ :
|
| 466 |
+
|
| 467 |
+
$$
|
| 468 |
+
\begin{array} { r l } & { x _ { 1 } \gets R E A D ( r _ { 2 } ) ; } \\ & { x _ { 2 } \gets A D D ( x _ { 1 } , 2 ) ; } \\ & { x _ { 3 } \gets W R I T E ( x _ { 2 } ) ; } \\ & { r _ { 0 } \gets 0 ; } \\ & { r _ { 1 } \gets 1 ; } \\ & { r _ { 2 } \gets 0 ; } \end{array}
|
| 469 |
+
$$
|
| 470 |
+
|
| 471 |
+
# N NRAM LISTK PROGRAM
|
| 472 |
+
|
| 473 |
+
# Timestep 0:
|
| 474 |
+
|
| 475 |
+
$$
|
| 476 |
+
\begin{array} { l } { { x _ { 1 } R E A D ( r _ { 0 } ) ; } } \\ { { x _ { 2 } I N C ( x _ { 1 } ) ; } } \\ { { x _ { 3 } 0 ; } } \\ { { x _ { 4 } W R I T E ( x _ { 3 } , x _ { 1 } ) ; } } \\ { { r _ { 0 } r _ { 1 } ; } } \\ { { r _ { 1 } r _ { 1 } ; } } \\ { { r _ { 2 } r _ { 2 } ; } } \\ { { r _ { 3 } x _ { 2 } ; } } \\ { { x _ { 4 } r _ { 4 } ; } } \end{array}
|
| 477 |
+
$$
|
| 478 |
+
|
| 479 |
+
$$
|
| 480 |
+
r _ { 5 } \gets r _ { 5 } ;
|
| 481 |
+
$$
|
| 482 |
+
|
| 483 |
+
$$
|
| 484 |
+
\begin{array} { l } { { x _ { 1 } R E A D ( r _ { 1 } ) ; } } \\ { { x _ { 2 } W R I T E ( r _ { 1 } , x _ { 1 } ) ; } } \\ { { x _ { 3 } 0 ; } } \\ { { r _ { 0 } r _ { 0 } ; } } \\ { { r _ { 1 } x _ { 1 } ; } } \\ { { r _ { 2 } r _ { 2 } ; } } \\ { { r _ { 3 } r _ { 3 } ; } } \\ { { r _ { 4 } x _ { 3 } ; } } \\ { { r _ { 5 } r _ { 5 } ; } } \end{array}
|
| 485 |
+
$$
|
| 486 |
+
|
| 487 |
+
# Timestep 2:
|
| 488 |
+
|
| 489 |
+
$x _ { 1 } \gets R E A D ( r _ { 2 } )$ ;
|
| 490 |
+
$x _ { 2 } \gets W R I T E ( r _ { 2 } , x _ { 1 } ) ;$ ;
|
| 491 |
+
x3 ← 0;
|
| 492 |
+
r0 ← r0;
|
| 493 |
+
$r _ { 1 } r _ { 1 }$ ;
|
| 494 |
+
$r _ { 2 } \gets x _ { 1 }$ ;
|
| 495 |
+
$r _ { 3 } \gets r _ { 3 }$ ;
|
| 496 |
+
$r _ { 4 } \gets x _ { 3 } { \mathrm { : } }$ r5 ← x3;
|
| 497 |
+
|
| 498 |
+
$$
|
| 499 |
+
\begin{array} { l } { { x _ { 1 } R E A D ( r _ { 0 } ) ; } } \\ { { x _ { 2 } I N C ( x _ { 1 } ) ; } } \\ { { x _ { 3 } 0 ; } } \\ { { x _ { 4 } D E C ( x _ { 1 } ) ; } } \\ { { x _ { 5 } W H T E ( r _ { 0 } , x _ { 1 } ) ; } } \\ { { r _ { 0 } x _ { 1 } ; } } \\ { { r _ { 1 } x _ { 4 } ; } } \\ { { r _ { 2 } r _ { 2 } ; } } \\ { { r _ { 3 } x _ { 2 } ; } } \\ { { r _ { 4 } x _ { 3 } ; } } \\ { { r _ { 5 } x _ { 3 } ; } } \end{array}
|
| 500 |
+
$$
|
| 501 |
+
|
| 502 |
+
Timestep $3 + \mathrm { k }$ : $x _ { 1 } \gets R E A D ( r _ { 3 } )$ ; $x _ { 2 } \gets W R I T E ( r _ { 2 } , x _ { 1 } ) ;$ ; x3 ← 0; x4 ← 1; $r _ { 0 } \gets r _ { 0 }$ ; $r _ { 1 } r _ { 1 }$ ; $r _ { 2 } \gets r _ { 2 } ;$ $r _ { 3 } \gets x _ { 1 }$ ; $r _ { 4 } \gets x _ { 4 }$ ; $r _ { 5 } s _ { 3 }$ ;
|
| 503 |
+
|
| 504 |
+
# Rest:
|
| 505 |
+
|
| 506 |
+
$$
|
| 507 |
+
\begin{array} { l } { { x _ { 1 } W R I T E ( r _ { 2 } , r _ { 3 } ) ; } } \\ { { x _ { 2 } 1 ; } } \\ { { x _ { 3 } 0 ; } } \\ { { r _ { 0 } r _ { 0 } ; } } \\ { { r _ { 1 } r _ { 1 } ; } } \\ { { r _ { 2 } r _ { 2 } ; } } \\ { { r _ { 3 } r _ { 3 } ; } } \\ { { r _ { 4 } x _ { 2 } ; } } \\ { { r _ { 5 } x _ { 3 } ; } } \end{array}
|
| 508 |
+
$$
|
parse/train/S1q_Cz-Cb/S1q_Cz-Cb_content_list.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
parse/train/S1q_Cz-Cb/S1q_Cz-Cb_middle.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
parse/train/S1q_Cz-Cb/S1q_Cz-Cb_model.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
parse/train/Sks9_ajex/Sks9_ajex.md
ADDED
|
@@ -0,0 +1,271 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# PAYING MORE ATTENTION TO ATTENTION: IMPROVING THE PERFORMANCE OF CONVOLUTIONAL NEURAL NETWORKS VIA ATTENTION TRANSFER
|
| 2 |
+
|
| 3 |
+
Sergey Zagoruyko, Nikos Komodakis
|
| 4 |
+
Universite Paris-Est, ´ Ecole des Ponts ParisTech ´
|
| 5 |
+
Paris, France
|
| 6 |
+
{sergey.zagoruyko,nikos.komodakis}@enpc.fr
|
| 7 |
+
|
| 8 |
+
# ABSTRACT
|
| 9 |
+
|
| 10 |
+
Attention plays a critical role in human visual experience. Furthermore, it has recently been demonstrated that attention can also play an important role in the context of applying artificial neural networks to a variety of tasks from fields such as computer vision and NLP. In this work we show that, by properly defining attention for convolutional neural networks, we can actually use this type of information in order to significantly improve the performance of a student CNN network by forcing it to mimic the attention maps of a powerful teacher network. To that end, we propose several novel methods of transferring attention, showing consistent improvement across a variety of datasets and convolutional neural network architectures. Code and models for our experiments are available at https://github.com/szagoruyko/attention-transfer.
|
| 11 |
+
|
| 12 |
+
# 1 INTRODUCTION
|
| 13 |
+
|
| 14 |
+
As humans, we need to pay attention in order to be able to adequately perceive our surroundings. Attention is therefore a key aspect of our visual experience, and closely relates to perception - we need to keep attention to build a visual representation, possessing detail and coherence.
|
| 15 |
+
|
| 16 |
+
As artificial neural networks became more popular in fields such as computer vision and natural language processing in the recent years, artificial attention mechanisms started to be developed as well. Artificial attention lets a system “attend” to an object to examine it with greater detail. It has also become a research tool for understanding mechanisms behind neural networks, similar to attention used in psychology.
|
| 17 |
+
|
| 18 |
+
One of the popular hypothesis there is that there are non-attentional and attentional perception processes. Non-attentional processes help to observe a scene in general and gather high-level information, which, when associated with other thinking processes, helps us to control the attention processes and navigate to a certain part of the scene. This implies that different observers with different knowledge, different goals, and therefore different attentional strategies can literally see the same scene differently. This brings us to the main topic of this paper: how attention differs within artificial vision systems, and can we use attention information in order to improve the performance of convolutional neural networks ? More specifically, can a teacher network improve the performance of another student network by providing to it information about where it looks, i.e., about where it concentrates its attention into ?
|
| 19 |
+
|
| 20 |
+
To study these questions, one first needs to properly specify how attention is defined w.r.t. a given convolutional neural network. To that end, here we consider attention as a set of spatial maps that essentially try to encode on which spatial areas of the input the network focuses most for taking its output decision (e.g., for classifying an image), where, furthermore, these maps can be defined w.r.t. various layers of the network so that they are able to capture both low-, mid-, and high-level representation information. More specifically, in this work we define two types of spatial attention maps: activation-based and gradient-based. We explore how both of these attention maps change over various datasets and architectures, and show that these actually contain valuable information that can be used for significantly improving the performance of convolutional neural network architectures (of various types and trained for various different tasks). To that end, we propose several novel ways of transferring attention from a powerful teacher network to a smaller student network with the goal of improving the performance of the latter (Fig. 1).
|
| 21 |
+
|
| 22 |
+

|
| 23 |
+
Figure 1: (a) An input image and a corresponding spatial attention map of a convolutional network that shows where the network focuses in order to classify the given image. Surely, this type of map must contain valuable information about the network. The question that we pose in this paper is the following: can we use knowledge of this type to improve the training of CNN models ? (b) Schematic representation of attention transfer: a student CNN is trained so as, not only to make good predictions, but to also have similar spatial attention maps to those of an already trained teacher CNN.
|
| 24 |
+
|
| 25 |
+
To summarize, the contributions of this work are as follows:
|
| 26 |
+
|
| 27 |
+
• We propose attention as a mechanism of transferring knowledge from one network to another
|
| 28 |
+
• We propose the use of both activation-based and gradient-based spatial attention maps
|
| 29 |
+
• We show experimentally that our approach provides significant improvements across a variety of datasets and deep network architectures, including both residual and non-residual networks
|
| 30 |
+
• We show that activation-based attention transfer gives better improvements than fullactivation transfer, and can be combined with knowledge distillation
|
| 31 |
+
|
| 32 |
+
The rest of the paper is structured as follows: we first describe related work in section 2, we explain our approach for activation-based and gradient-based attention transfer in section 3, and then present experimental results for both methods in section 4. We conclude the paper in section 5.
|
| 33 |
+
|
| 34 |
+
# 2 RELATED WORK
|
| 35 |
+
|
| 36 |
+
Early work on attention based tracking Larochelle & Hinton (2010), Denil et al. (2012) was motivated by human attention mechanism theories Rensink (2000) and was done via Restricted Bolzmann Machines. It was recently adapted for neural machine translation with recurrent neural networks, e.g. Bahdanau et al. (2014) as well as in several other NLP-related tasks. It was also exploited in computer-vision-related tasks such as image captioning Xu et al. (2015), visual question answering Yang et al. (2015), as well as in weakly-supervised object localization Oquab et al. (2015) and classification Mnih et al. (2014), to mention a few characteristic examples. In all these tasks attention proved to be useful.
|
| 37 |
+
|
| 38 |
+
Visualizing attention maps in deep convolutional neural networks is an open problem. The simplest gradient-based way of doing that is by computing a Jacobian of network output w.r.t. input (this leads to attention visualization that are not necessarily class-discriminative), as for example in Simonyan et al. (2014). Another approach was proposed by Zeiler & Fergus (2014) that consists of attaching a network called “deconvnet” that shares weights with the original network and is used to project certain features onto the image plane. A number of methods was proposed to improve gradientbased attention as well, for example guided backpropagation Springenberg et al. (2015), adding a change in ReLU layers during calculation of gradient w.r.t. previous layer output. Attention maps obtained with guided backpropagation are non-class-discriminative too. Among existing methods for visualizing attention, we should also mention class activation maps Zhou et al. (2016), which are based on removing top average-pooling layer and converting the linear classification layer into a convolutional layer, producing attention maps per each class. A method combining both guided backpropagation and CAM is Grad-CAM by Selvaraju et al. (2016), adding image-level details to class-discriminative attention maps.
|
| 39 |
+
|
| 40 |
+
Knowledge distillation with neural networks was pioneered by Hinton et al. (2015); Bucila et al. (2006), which is a transfer learning method that aims to improve the training of a student network by relying on knowledge borrowed from a powerful teacher network. Although in certain special cases shallow networks had been shown to be able to approximate deeper ones without loss in accuracy Lei & Caruana (2014), later work related to knowledge distillation was mostly based on the assumption that deeper networks always learn better representations. For example, FitNets Romero et al. (2014) tried to learn a thin deep network using a shallow one with more parameters. The introduction of highway Srivastava et al. (2015) and later residual networks He et al. (2015) allowed training very deep architectures with higher accuracy, and generality of these networks was experimentally showed over a large variety of datasets. Although the main motivation for residual networks was increasing depth, it was later shown by Zagoruyko & Komodakis (2016) that, after a certain depth, the improvements came mostly from increased capacity of the networks, i.e. number of parameters (for instance, a wider deep residual network with only 16 layers was shown that it could learn as good or better representations as very thin 1000 layer one, provided that they were using comparable number of parameters).
|
| 41 |
+
|
| 42 |
+
Due to the above fact and due to that thin deep networks are less parallelizable than wider ones, we think that knowledge transfer needs to be revisited, and take an opposite to FitNets approach - we try to learn less deep student networks. Our attention maps used for transfer are similar to both gradient-based and activation-based maps mentioned above, which play a role similar to “hints” in FitNets, although we don’t introduce new weights.
|
| 43 |
+
|
| 44 |
+
# 3 ATTENTION TRANSFER
|
| 45 |
+
|
| 46 |
+
In this section we explain the two methods that we use for defining the spatial attention maps of a convolutional neural network as well as how we transfer attention information from a teacher to a student network in each case.
|
| 47 |
+
|
| 48 |
+
# 3.1 ACTIVATION-BASED ATTENTION TRANSFER
|
| 49 |
+
|
| 50 |
+
Let us consider a CNN layer and its corresponding activation tensor $A \in R ^ { C \times H \times W }$ , which consists of $C$ feature planes with spatial dimensions $H \times W$ . An activation-based mapping function $\mathcal { F }$ (w.r.t. that layer) takes as input the above 3D tensor $A$ and outputs a spatial attention map, i.e., a flattened 2D tensor defined over the spatial dimensions, or
|
| 51 |
+
|
| 52 |
+
$$
|
| 53 |
+
\mathcal { F } : R ^ { C \times H \times W } R ^ { H \times W } .
|
| 54 |
+
$$
|
| 55 |
+
|
| 56 |
+
To define such a spatial attention mapping function, the implicit assumption that we make in this section is that the absolute value of a hidden neuron activation (that results when the network is evaluated on given input) can be used as an indication about the importance of that neuron w.r.t. the specific input. By considering, therefore, the absolute values of the elements of tensor $A$ , we can construct a spatial attention map by computing statistics of these values across the channel dimension (see Fig. 3). More specifically, in this work we will consider the following activation-based spatial attention maps:
|
| 57 |
+
|
| 58 |
+
• sum of absolute values: $\begin{array} { r } { F _ { \mathrm { s u m } } ( A ) = \sum _ { i = 1 } ^ { C } | A _ { i } | } \end{array}$ • sum of absolute values raised to the power of $p$ (where $p > 1 _ { \cdot }$ ): $\begin{array} { r } { F _ { \mathrm { s u m } } ^ { p } ( A ) = \sum _ { i = 1 } ^ { C } | A _ { i } | ^ { p } } \end{array}$ • max of absolute values raised to the power of $p$ (where $p > 1$ ): $F _ { \operatorname* { m a x } } ^ { p } ( A ) = \operatorname* { m a x } _ { i = 1 , C } | A _ { i } | ^ { p }$ where $A _ { i } = A ( i , : , : )$ (using Matlab notation), and max, power and absolute value operations are elementwise (e.g. $| A _ { i } | ^ { p }$ is equivalent to abs $( \mathbb { A } _ { i } ) \cdot { } ^ { \wedge } \mathtt { p }$ in Matlab notation).
|
| 59 |
+
|
| 60 |
+

|
| 61 |
+
Figure 2: Sum of absolute values attention maps $F _ { \mathrm { s u m } }$ over different levels of a network trained for face recognition. Mid-level attention maps have higher activation level around eyes, nose and lips, high-level activations correspond to the whole face.
|
| 62 |
+
|
| 63 |
+
We visualized activations of various networks on several datasets, including ImageNet classification and localization, COCO object detection, face recognition, and fine-grained recognition. We were mostly focused on modern architectures without top dense linear layers, such as Network-InNetwork, ResNet and Inception, which have streamlined convolutional structure. We also examined networks of the same architecture, width and depth, but trained with different frameworks with significant difference in performance. We found that the above statistics of hidden activations not only have spatial correlation with predicted objects on image level, but these correlations also tend to be higher in networks with higher accuracy, and stronger networks have peaks in attention where weak networks don’t (e.g., see Fig. 4). Furthermore, attention maps focus on different parts for different layers in the network. In the first layers neurons activation level is high for low-level gradient points, in the middle it is higher for the most discriminative regions such as eyes or wheels, and in the top layers it reflects full objects. For example, mid-level attention maps of a network trained for face recognition Parkhi et al. (2015) will have higher activations around eyes, nose and lips, and top level activation will correspond to full face (Fig. 2).
|
| 64 |
+
|
| 65 |
+
Concerning the different attention mapping functions defined above, these can have slightly different properties. E.g.:
|
| 66 |
+
|
| 67 |
+
• Compared to $F _ { \mathrm { s u m } } ( A )$ , the spatial map $F _ { \mathrm { s u m } } ^ { p } ( A )$ (where $p > 1$ ) puts more weight to spatial locations that correspond to the neurons with the highest activations, i.e., puts more weight to the most discriminative parts (the larger the $p$ the more focus is placed on those parts with highest activations).
|
| 68 |
+
Furthermore, among all neuron activations corresponding to the same spatial location, $F _ { \mathrm { m a x } } ^ { p } ( A )$ will consider only one of them to assign a weight to that spatial location (as opposed to $F _ { \mathrm { s u m } } ^ { p } ( A )$ that will favor spatial locations that carry multiple neurons with high activations).
|
| 69 |
+
|
| 70 |
+
To further illustrate the differences of these functions we visualized attention maps of 3 networks with sufficient difference in classification performance: Network-In-Network $62 \%$ top-1 val accuracy), ResNet34 ( $73 \%$ top-1 val accuracy) and ResNet-101 ( $7 7 . 3 \%$ top-1 val accuracy). In each network we took last pre-downsampling activation maps, on the left for mid-level and on the right for top pre-average pooling activations in fig. 4. Top-level maps are blurry because their original spatial resolution is $7 \times 7$ . It is clear that most discriminative regions have higher activation levels, e.g. face of the wolf, and that shape details disappear as the parameter $p$ (used as exponent) increases.
|
| 71 |
+
|
| 72 |
+
In attention transfer, given the spatial attention maps of a teacher network (computed using any of the above attention mapping functions), the goal is to train a student network that will not only make correct predictions but will also have attentions maps that are similar to those of the teacher. In general, one can place transfer losses w.r.t. attention maps computed across several layers. For instance, in the case of ResNet architectures, one can consider the following two cases, depending on the depth of teacher and student:
|
| 73 |
+
|
| 74 |
+

|
| 75 |
+
Figure 3: Attention mapping over feature dimension.
|
| 76 |
+
|
| 77 |
+
• Same depth: possible to have attention transfer layer after every residual block • Different depth: have attention transfer on output activations of each group of residual blocks
|
| 78 |
+
|
| 79 |
+

|
| 80 |
+
Figure 4: Activation attention maps for various ImageNet networks: Network-In-Network $6 2 \%$ top-1 val accuracy), ResNet-34 $73 \%$ top-1 val accuracy), ResNet-101 $7 7 . 3 \%$ top-1 val accuracy). Left part: mid-level activations, right part: top-level pre-softmax acivations
|
| 81 |
+
|
| 82 |
+

|
| 83 |
+
Figure 5: Schematics of teacher-student attention transfer for the case when both networks are residual, and the teacher is deeper.
|
| 84 |
+
|
| 85 |
+
Similar cases apply also to other architectures (such as NIN, in which case a group refers to a block of a $3 \times 3 , 1 \times 1 , 1 \times 1$ convolutions). In fig. 5 we provide a schematic illustration of the different depth case for residual network architectures.
|
| 86 |
+
|
| 87 |
+
Without loss of generality, we assume that transfer losses are placed between student and teacher attention maps of same spatial resolution, but, if needed, attention maps can be interpolated to match their shapes. Let $S$ , $T$ and $\mathbf { W } _ { S }$ , $\mathbf { W } _ { T }$ denote student, teacher and their weights correspondingly, and let $\mathcal { L } ( \mathbf { W } , x )$ denote a standard cross entropy loss. Let also $\mathcal { T }$ denote the indices of all teacher-student activation layer pairs for which we want to transfer attention maps. Then we can define the following total loss:
|
| 88 |
+
|
| 89 |
+
$$
|
| 90 |
+
\mathcal { L } _ { A T } = \mathcal { L } ( \mathbf { W } _ { S } , x ) + \frac { \beta } { 2 } \sum _ { j \in \mathcal { T } } \Vert \frac { Q _ { S } ^ { j } } { \Vert Q _ { S } ^ { j } \Vert _ { 2 } } - \frac { Q _ { T } ^ { j } } { \Vert Q _ { T } ^ { j } \Vert _ { 2 } } \Vert _ { p } \enspace ,
|
| 91 |
+
$$
|
| 92 |
+
|
| 93 |
+
where $Q _ { S } ^ { j } = v e c ( F ( A _ { S } ^ { j } ) )$ and $Q _ { T } ^ { j } = v e c ( F ( A _ { T } ^ { j } ) )$ are respectively the $j$ -th pair of student and teacher attention maps in vectorized form, and $p$ refers to norm type (in the experiments we use $p = 2$ ). As can be seen, during attention transfer we make use of $l _ { 2 }$ -normalized attention maps, i.e., we replace each vectorized attention map $Q$ with QkQk2 (l1 normalization could be used as well). It is worth emphasizing that normalization of attention maps is important for the success of the student training.
|
| 94 |
+
|
| 95 |
+
Attention transfer can also be combined with knowledge distillation Hinton et al. (2015), in which case an additional term (corresponding to the cross entropy between softened distributions over labels of teacher and student) simply needs to be included to the above loss. When combined, attention transfer adds very little computational cost, as attention maps for teacher can be easily computed during forward propagation, needed for distillation.
|
| 96 |
+
|
| 97 |
+
# 3.2 GRADIENT-BASED ATTENTION TRANSFER
|
| 98 |
+
|
| 99 |
+
In this case we define attention as gradient w.r.t. input, which can be viewed as an input sensitivity map Simonyan et al. (2014), i.e., attention at an input spatial location encodes how sensitive the output prediction is w.r.t. changes at that input location (e.g., if small changes at a pixel can have a large effect on the network output then it is logical to assume that the network is “paying attention” to that pixel). Let’s define the gradient of the loss w.r.t input for teacher and student as:
|
| 100 |
+
|
| 101 |
+
$$
|
| 102 |
+
J _ { S } = \frac { \partial } { \partial x } \mathcal { L } ( \mathbf { W _ { S } } , x ) , J _ { T } = \frac { \partial } { \partial x } \mathcal { L } ( \mathbf { W _ { T } } , x )
|
| 103 |
+
$$
|
| 104 |
+
|
| 105 |
+
Then if we want student gradient attention to be similar to teacher attention, we can minimize a distance between them (here we use $l _ { 2 }$ distance but other distances can be employed as well):
|
| 106 |
+
|
| 107 |
+
$$
|
| 108 |
+
\mathcal { L } _ { A T } ( \mathbf { W _ { S } } , \mathbf { W _ { T } } , x ) = \mathcal { L } ( \mathbf { W _ { S } } , x ) + \frac { \beta } { 2 } | | J _ { S } - J _ { T } | | _ { 2 }
|
| 109 |
+
$$
|
| 110 |
+
|
| 111 |
+
As $\mathbf { W } _ { T }$ and $x$ are given, to get the needed derivative w.r.t. $\mathbf { W } _ { S }$ :
|
| 112 |
+
|
| 113 |
+
$$
|
| 114 |
+
\frac { \partial } { \partial \mathbf { W _ { S } } } \mathcal { L } _ { A T } = \frac { \partial } { \partial \mathbf { W _ { S } } } \mathcal { L } ( \mathbf { W _ { S } } , x ) + \beta ( J _ { S } - J _ { T } ) \frac { \partial ^ { 2 } } { \partial \mathbf { W _ { S } } \partial x } \mathcal { L } ( \mathbf { W _ { S } } , x )
|
| 115 |
+
$$
|
| 116 |
+
|
| 117 |
+
So to do an update we first need to do forward and back propagation to get $J _ { S }$ and $J _ { T }$ , compute the second error $ { \mathbf { \bar { \rho } } } _ { 2 } ^ { \beta } | | J _ { S } - J _ { T } | | _ { 2 }$ and propagate it second time. The second propagation is similar to forward propagation in this case, and involves second order mixed partial derivative calculation ∂2∂WS∂x . The above computation is similar to the double backpropagation technique developed by Drucker & LeCun (1992) (where the $l _ { 2 }$ norm of the gradient w.r.t. input is used as regularizer). Furthermore, it can be implemented efficiently in a framework with automatic differentiation support, even for modern architectures with sophisticated graphs. The second backpropagation has approximately the same cost with first backpropagation, excluding forward propagation.
|
| 118 |
+
|
| 119 |
+
We also propose to enforce horizontal flip invariance on gradient attention maps. To do that we propagate horizontally flipped images as well as originals, backpropagate and flip gradient attention maps back. We then add $l _ { 2 }$ losses on the obtained attentions and outputs, and do second backpropagation:
|
| 120 |
+
|
| 121 |
+
$$
|
| 122 |
+
\mathcal { L } _ { s y m } ( \mathbf { W } , x ) = \mathcal { L } ( \mathbf { W } , x ) + \frac { \beta } { 2 } | | \frac { \partial } { \partial x } \mathcal { L } ( \mathbf { W } , x ) - \mathrm { H i p } ( \frac { \partial } { \partial x } \mathcal { L } ( \mathbf { W } , \mathrm { H i p } ( x ) ) ) | | _ { 2 } \ ,
|
| 123 |
+
$$
|
| 124 |
+
|
| 125 |
+
where $\operatorname { f i i p } ( x )$ denotes the flip operator. This is similar to Group Equivariant CNN approach by Cohen & Welling (2016), however it is not a hard constraint. We experimentally find that this has a regularization effect on training.
|
| 126 |
+
|
| 127 |
+
We should note that in this work we consider only gradients w.r.t. the input layer, but in general one might have the proposed attention transfer and symmetry constraints w.r.t. higher layers of the network.
|
| 128 |
+
|
| 129 |
+
# 4 EXPERIMENTAL SECTION
|
| 130 |
+
|
| 131 |
+
In the following section we explore attention transfer on various image classification datasets. We split the section in two parts, in the first we include activation-based attention transfer and gradientbased attention transfer experiments on CIFAR, and in the second activation-based attention transfer experiments on larger datasets. For activation-based attention transfer we used Network-InNetwork Lin et al. (2013) and ResNet-based architectures (including the recently introduced Wide Residual Networks (WRN) Zagoruyko & Komodakis (2016)), as they are most performant and set strong baselines in terms of number of parameters compared to AlexNet or VGG, and have been explored in various papers across small and large datasets. On Scenes, CUB and ImageNet we experimented with ResNet-18 and ResNet-34. As for gradient-based attention, we constrained ourselves to Network-In-Network without batch normalization and CIFAR dataset, due to the need of complex automatic differentiation.
|
| 132 |
+
|
| 133 |
+
# 4.1 CIFAR EXPERIMENTS
|
| 134 |
+
|
| 135 |
+
We start with CIFAR dataset which has small $3 2 \times 3 2$ images, and after downsampling top activations have even smaller resolution, so there is not much space for attention transfer. Interestingly, even under this adversarial setting, we find that attention transfer seems to give reasonable benefits, offering in all cases consistent improvements. We use horizontal flips and random crops data augmentations, and all networks have batch normalization. We find that ZCA whitening has negative effect on validation accuracy, and omit it in favor of simpler meanstd normalization. We raise Knowledge Distillation (KD) temperature for ResNet transfers to 4, and use $\alpha = 0 . 9$ (see Hinton et al. (2015) for an explanation of these parameters).
|
| 136 |
+
|
| 137 |
+
# 4.1.1 ACTIVATION-BASED ATTENTION TRANSFER
|
| 138 |
+
|
| 139 |
+
Results of attention transfer (using $F _ { \mathrm { s u m } } ^ { 2 }$ attention maps) for various networks on CIFAR-10 can be found in table 1. We experimented with teacher/student having the same depth (WRN-16-2/WRN16-1), as well as different depth (WRN-40-1/WRN-16-1, WRN-40-2/WRN-16-2). In all combinations, attention transfer (AT) shows significant improvements, which are also higher when it is combined with knowledge distillation $( \mathrm { A T + K D } )$ ).
|
| 140 |
+
|
| 141 |
+
<table><tr><td>student</td><td>teacher</td><td>student</td><td>AT</td><td>F-ActT</td><td>KD</td><td>AT+KD</td><td>teacher</td></tr><tr><td>NIN-thin,0.2M</td><td>NIN-wide,1M</td><td>9.38</td><td>8.93</td><td>9.05</td><td>8.55</td><td>8.33</td><td>7.28</td></tr><tr><td>WRN-16-1, 0.2M</td><td>WRN-16-2, 0.7M</td><td>8.77</td><td>7.93</td><td>8.51</td><td>7.41</td><td>7.51</td><td>6.31</td></tr><tr><td>WRN-16-1, 0.2M</td><td>WRN-40-1, 0.6M</td><td>8.77</td><td>8.25</td><td>8.62</td><td>8.39</td><td>8.01</td><td>6.58</td></tr><tr><td>WRN-16-2,0.7M</td><td>WRN-40-2,2.2M</td><td>6.31</td><td>5.85</td><td>6.24</td><td>6.08</td><td>5.71</td><td>5.23</td></tr></table>
|
| 142 |
+
|
| 143 |
+
Table 1: Activation-based attention transfer (AT) with various architectures on CIFAR-10. Error is computed as median of 5 runs with different seed. F-ActT means full-activation transfer (see $\ S 4 . 1 . 2 )$ .
|
| 144 |
+
|
| 145 |
+
To verify if having at least one activation-based attention transfer loss per group in WRN transfer is important, we trained three networks with only one transfer loss per network in group1, group2 and group3 separately, and compared to a network trained with all three losses. The corresponding results were 8.11, 7.96, 7.97 (for the separate losses) and 7.93 for the combined loss (using WRN16-2/WRN-16-1 as teacher/student pair). Each loss provides some additional degree of attention transfer.
|
| 146 |
+
|
| 147 |
+
We also explore which attention mapping functions tend to work best using WRN-16-1 and WRN16-2 as student and teacher networks respectively (table 2). Interestingly, sum-based functions work very similar, and better than max-based ones. From now on, we will use sum of squared attention mapping function $F _ { \mathrm { s u m } } ^ { 2 }$ for simplicity. As for parameter $\beta$ in eq. 2, it usually varies about 0.1, as we set it to $\mathrm { \bar { 1 0 ^ { 3 } } }$ divided by number of elements in attention map and batch size for each layer. In case of combinining AT with KD we decay it during traning in order to simplify learning harder examples.
|
| 148 |
+
|
| 149 |
+
# 4.1.2 ACTIVATION-BASED AT VS. TRANSFERRING FULL ACTIVATION
|
| 150 |
+
|
| 151 |
+
To check if transferring information from full activation tensors is more beneficial than from attention maps, we experimented with FitNets-style hints using $l _ { 2 }$ losses on full activations directly, with $1 \times 1$ convolutional layers to match tensor shapes, and found that improvements over baseline student were minimal (see column F-ActT in table 1). For networks of the same width different depth we tried to regress directly to activations, without $1 \times 1$ convolutions. We also use $l _ { 2 }$ normalization before transfer losses, and decay $\beta$ in eq. 2 during training as these give better performance. We find that AT, as well as full-activation transfer, greatly speeds up convergence, but AT gives much better final accuracy improvement than full-activation transfer (see fig. 7(b), Appendix). It seems quite interesting that attention maps carry information that is more important for transfer than full activations.
|
| 152 |
+
|
| 153 |
+
<table><tr><td>norm type</td><td>error</td></tr><tr><td>baseline (no attention transfer) min-l2 Drucker & LeCun (1992) grad-based AT KD symmetry norm activation-based AT</td><td>13.5 12.5 12.1 12.1 11.8 11.2</td></tr></table>
|
| 154 |
+
|
| 155 |
+
Table 2: Test error of WRN16-2/WRN-16-1 teacher/student pair for various attention mapping functions. Median of 5 runs test errors are reported.
|
| 156 |
+
Table 3: Performance of various gradient-based attention methods on CIFAR-10. Baseline is a thin NIN network with ${ \bf 0 . 2 M }$ parameters (trained only on horizontally flipped augmented data and without batch normalization), min- $\mathbf { \cdot } l _ { 2 }$ refers to using $l _ { 2 }$ norm of gradient w.r.t. input as regularizer, symmetry norm - to using flip invariance on gradient attention maps (see eq. 6), AT - to attention transfer, and KD - to Knowledge Distillation (both AT and KD use a wide NIN of 1M parameters as teacher).
|
| 157 |
+
|
| 158 |
+
<table><tr><td>attention mapping function</td><td>error</td></tr><tr><td>no attention transfer Fsum</td><td>8.77 7.99 7.93</td></tr></table>
|
| 159 |
+
|
| 160 |
+
# 4.1.3 GRADIENT-BASED ATTENTION TRANSFER
|
| 161 |
+
|
| 162 |
+
For simplicity we use thin Network-In-Network model in these experiments, and don’t apply random crop data augmentation with batch normalization, just horizontal flips augmentation. We also only use deterministic algorithms and sampling with fixed seed, so reported numbers are for single run experiments. We find that in this setting network struggles to fit into training data already, and turn off weight decay even for baseline experiments. In future we plan to explore gradient-based attention for teacher-student pairs that make use of batch normalization, because it is so far unclear how batch normalization should behave in the second backpropagation step required during gradientbased attention transfer (e.g., should it contribute to batch normalization parameters, or is a separate forward propagation with fixed parameters needed).
|
| 163 |
+
|
| 164 |
+
We explored the following methods:
|
| 165 |
+
|
| 166 |
+
• Minimizing $l _ { 2 }$ norm of gradient w.r.t. input, i.e. the double backpropagation method Drucker & LeCun (1992);
|
| 167 |
+
• Symmetry norm on gradient attention maps (see eq. 6);
|
| 168 |
+
• Student-teacher gradient-based attention transfer;
|
| 169 |
+
• Student-teacher activation-based attention transfer.
|
| 170 |
+
|
| 171 |
+
Results for various methods are shown in table 3. Interestingly, just minimizing $l _ { 2 }$ norm of gradient already works pretty well. Also, symmetry norm is one the best performing attention norms, which we plan to investigate in future on other datasets as well. We also observe that, similar to activationbased attention transfer, using gradient-based attention transfer leads to improved performance. We also trained a network with activation-based AT in the same training conditions, which resulted in the best performance among all methods. We should note that the architecture of student NIN without batch normalization is slightly different from teacher network, it doesn’t have ReLU activations before pooling layers, which leads to better performance without batch normalization, and worse with. So to achieve the best performance with activation-based AT we had to train a new teacher, with batch normalization and without ReLU activations before pooling layers, and have AT losses on outputs of convolutional layers.
|
| 172 |
+
|
| 173 |
+
# 4.2 LARGE INPUT IMAGE NETWORKS
|
| 174 |
+
|
| 175 |
+
In this section we experiment with hidden activation attention transfer on ImageNet networks which have $2 2 4 \times 2 2 4$ input image size. Presumably, attention matters more in this kind of networks as spatial resolution of attention maps is higher.
|
| 176 |
+
|
| 177 |
+
Table 4: Finetuning with attention transfer error on Scenes and CUB datasets
|
| 178 |
+
|
| 179 |
+
<table><tr><td>type</td><td>model</td><td>ImageNet-→CUB</td><td>ImageNet-→Scenes</td></tr><tr><td>student</td><td>ResNet-18</td><td>28.5</td><td>28.2</td></tr><tr><td>KD</td><td>ResNet-18</td><td>27 (-1.5)</td><td>28.1 (-0.1)</td></tr><tr><td>AT</td><td>ResNet-18</td><td>27 (-1.5)</td><td>27.1 (-1.1)</td></tr><tr><td>teacher</td><td>ResNet-34</td><td>26.5</td><td>26</td></tr></table>
|
| 180 |
+
|
| 181 |
+
# 4.2.1 TRANSFER LEARNING
|
| 182 |
+
|
| 183 |
+
To see how attention transfer works in finetuning we choose two datasets: Caltech-UCSD Birds-200- 2011 fine-grained classification (CUB) by Wah et al. (2011), and MIT indoor scene classification (Scenes) by Quattoni & Torralba (2009), both containing around 5K images training images. We took ResNet-18 and ResNet-34 pretrained on ImageNet and finetuned on both datasets. On CUB we crop bounding boxes, rescale to 256 in one dimension and then take a random crop. Batch normalization layers are fixed for finetuning, and first group of residual blocks is frozen. We then took finetuned ResNet-34 networks and used them as teachers for ResNet-18 pretrained on ImageNet, with $F _ { \mathrm { s u m } } ^ { 2 }$ attention losses on 2 last groups. In both cases attention transfer provides significant improvements, closing the gap between ResNet-18 and ResNet-34 in accuracy. On Scenes AT works as well as KD, and on CUB AT works much better, which we speculate is due to importance of intermediate attention for fine-grained recognition. Moreover, after finetuning, student’s attention maps indeed look more similar to teacher’s (Fig. 6, Appendix).
|
| 184 |
+
|
| 185 |
+
# 4.2.2 IMAGENET
|
| 186 |
+
|
| 187 |
+
To showcase activation-based attention transfer on ImageNet we took ResNet-18 as a student, and ResNet-34 as a teacher, and tried to improve ResNet-18 accuracy. We added only two losses in the 2 last groups of residual blocks and used squared sum attention $F _ { \mathrm { s u m } } ^ { 2 }$ . We also did not have time to tune any hyperparameters and kept them from finetuning experiments. Nevertheless, ResNet-18 with attention transfer achieved $1 . 1 \%$ top-1 and $0 . 8 \%$ top-5 better validation accuracy (Table. 5 and Fig. 7(a), Appendix), we plan to update the paper with losses on all 4 groups of residual blocks.
|
| 188 |
+
|
| 189 |
+
We were not able to achieve positive results with KD on ImageNet. With ResNet-18-ResNet-34 student-teacher pair it actually hurts convergence with the same hyperparameters as on CIFAR. As it was reported that KD struggles to work if teacher and student have different architecture/depth (we observe the same on CIFAR), so we tried using the same architecture and depth for attention transfer. On CIFAR both AT and KD work well in this case and improve convergence and final accuracy, on ImageNet though KD converges significantly slower (we did not train until the end due to lack of computational resources). We also could not find applications of FitNets, KD or similar methods on ImageNet in the literature. Given that, we can assume that proposed activation-based AT is the first knowledge transfer method to be successfully applied on ImageNet.
|
| 190 |
+
|
| 191 |
+
# 5 CONCLUSIONS
|
| 192 |
+
|
| 193 |
+
We presented several ways of transferring attention from one network to another, with experimental results over several image recognition datasets. It would be interesting to see how attention transfer works in cases where spatial information is more important, e.g. object detection or weaklysupervised localization, which is something that we plan to explore in the future.
|
| 194 |
+
|
| 195 |
+
Overall, we think that our interesting findings will help further advance knowledge distillation, and understanding convolutional neural networks in general.
|
| 196 |
+
|
| 197 |
+
# REFERENCES
|
| 198 |
+
|
| 199 |
+
Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. Neural machine translation by jointly learning to align and translate. CoRR, abs/1409.0473, 2014. URL http://arxiv.org/ abs/1409.0473.
|
| 200 |
+
|
| 201 |
+
Cristian Bucila, Rich Caruana, and Alexandru Niculescu-Mizil. Model compression. In KDD, pp. 535–541, 2006.
|
| 202 |
+
|
| 203 |
+
Taco S. Cohen and Max Welling. Group equivariant convolutional networks. CoRR, abs/1602.07576, 2016. URL http://arxiv.org/abs/1602.07576.
|
| 204 |
+
|
| 205 |
+
Misha Denil, Loris Bazzani, Hugo Larochelle, and Nando de Freitas. Learning where to attend with deep architectures for image tracking. Neural Computation, 2012.
|
| 206 |
+
|
| 207 |
+
H. Drucker and Y LeCun. Improving generalization performance using double backpropagation. IEEE Transaction on Neural Networks, 3(6):991–997, 1992.
|
| 208 |
+
|
| 209 |
+
Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. CoRR, abs/1512.03385, 2015.
|
| 210 |
+
|
| 211 |
+
Geoffrey E. Hinton, Oriol Vinyals, and Jeff Dean. Distilling the knowledge in a neural networks. 2015.
|
| 212 |
+
|
| 213 |
+
Hugo Larochelle and Geoffrey E. Hinton. Learning to combine foveal glimpses with a third-order boltzmann machine. In J. D. Lafferty, C. K. I. Williams, J. Shawe-Taylor, R. S. Zemel, and A. Culotta (eds.), Advances in Neural Information Processing Systems 23, pp. 1243–1251. Curran Associates, Inc., 2010.
|
| 214 |
+
|
| 215 |
+
Jimmy Ba Lei and Rich Caruana. Do deep nets really need to be deep? In NIPS, 2014.
|
| 216 |
+
|
| 217 |
+
Min Lin, Qiang Chen, and Shuicheng Yan. Network in network. CoRR, abs/1312.4400, 2013.
|
| 218 |
+
|
| 219 |
+
Volodymyr Mnih, Nicolas Heess, Alex Graves, and koray kavukcuoglu. Recurrent models of visual attention. In Z. Ghahramani, M. Welling, C. Cortes, N. D. Lawrence, and K. Q. Weinberger (eds.), Advances in Neural Information Processing Systems 27, pp. 2204–2212. Curran Associates, Inc., 2014. URL http://papers.nips.cc/paper/ 5542-recurrent-models-of-visual-attention.pdf.
|
| 220 |
+
|
| 221 |
+
M. Oquab, L. Bottou, I. Laptev, and J. Sivic. Is object localization for free? weakly-supervised learning with convolutional neural networks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, 2015.
|
| 222 |
+
|
| 223 |
+
O. M. Parkhi, A. Vedaldi, and A. Zisserman. Deep face recognition. In British Machine Vision Conference, 2015.
|
| 224 |
+
|
| 225 |
+
A. Quattoni and A. Torralba. Recognizing indoor scenes. In CVPR, 2009.
|
| 226 |
+
|
| 227 |
+
Ronald A. Rensink. The dynamic representation of scenes. In Visual Cognition, pp. 17–42, 2000.
|
| 228 |
+
|
| 229 |
+
Adriana Romero, Nicolas Ballas, Samira Ebrahimi Kahou, Antoine Chassang, Carlo Gatta, and Yoshua Bengio. FitNets: Hints for thin deep nets. Technical Report Arxiv report 1412.6550, arXiv, 2014.
|
| 230 |
+
|
| 231 |
+
Ramprasaath R. Selvaraju, Abhishek Das, Ramakrishna Vedantam, Devi Parikh, and Dhruv Batra. Grad-cam: Why did you say that? visual explanations from deep networks via gradient-based localization. 2016.
|
| 232 |
+
|
| 233 |
+
Karen Simonyan, Andrea Vedaldi, and Andrew Zisserman. Deep inside convolutional networks: Visualising image classification models and saliency maps. In ICLR Workshop, 2014.
|
| 234 |
+
|
| 235 |
+
J. T. Springenberg, A. Dosovitskiy, T. Brox, and M. Riedmiller. Striving for simplicity: The all convolutional net. In arXiv:1412.6806, also appeared at ICLR 2015 Workshop Track, 2015. URL http://arxiv.org/abs/1412.6806.
|
| 236 |
+
|
| 237 |
+
Rupesh Kumar Srivastava, Klaus Greff, and Jurgen Schmidhuber. Highway networks. ¨ CoRR, abs/1505.00387, 2015.
|
| 238 |
+
|
| 239 |
+
C. Wah, S. Branson, P. Welinder, P. Perona, and S. Belongie. The Caltech-UCSD Birds-200-2011 Dataset. Technical Report CNS-TR-2011-001, California Institute of Technology, 2011.
|
| 240 |
+
|
| 241 |
+
Kelvin Xu, Jimmy Ba, Ryan Kiros, Kyunghyun Cho, Aaron C. Courville, Ruslan Salakhutdinov, Richard S. Zemel, and Yoshua Bengio. Show, attend and tell: Neural image caption generation with visual attention. CoRR, abs/1502.03044, 2015. URL http://arxiv.org/abs/1502. 03044.
|
| 242 |
+
|
| 243 |
+
Zichao Yang, Xiaodong He, Jianfeng Gao, Li Deng, and Alexander J. Smola. Stacked attention networks for image question answering. CoRR, abs/1511.02274, 2015. URL http://arxiv. org/abs/1511.02274.
|
| 244 |
+
|
| 245 |
+
Sergey Zagoruyko and Nikos Komodakis. Wide residual networks. In BMVC, 2016.
|
| 246 |
+
|
| 247 |
+
Matthew Zeiler and Rob Fergus. Visualizing and understanding convolutional networks. In ECCV, 2014.
|
| 248 |
+
|
| 249 |
+
Bolei Zhou, Aditya Khosla, Agata Lapedriza, Aude Oliva, and Antonio Torralba. Learning deep features for discriminative localization. In Computer Vision and Pattern Recognition, 2016.
|
| 250 |
+
|
| 251 |
+
# A APPENDIX
|
| 252 |
+
|
| 253 |
+
# A.1 FIGURES AND TABLES
|
| 254 |
+
|
| 255 |
+

|
| 256 |
+
Figure 6: Top activation attention maps for different Scenes networks: original pretrained ResNet-18 (ResNet-18-ImageNet), ResNet-18 trained on Scenes (ResNet-18-scenes), ResNet-18 trained with attention transfer (ResNet-18-scenes-AT) with ResNet-34 as a teacher, ResNet-34 trained on Scenes (ResNet-34-scenes). Predicted classes for each task are shown on top. Attention maps look more similar after transfer (images taken from test set).
|
| 257 |
+
|
| 258 |
+

|
| 259 |
+
(a) Attention transfer on ImageNet between ResNet18 and ResNet-34. Solid lines represent top-5 validation error, dashed - top-5 training error. Two attention transfer losses were used on the outputs of two last groups of residual blocks respectively, no KD losses used.
|
| 260 |
+
|
| 261 |
+

|
| 262 |
+
|
| 263 |
+
(b) Activation attention transfer on CIFAR-10 from WRN-16-2 to WRN-16-1. Test error is in bold, train error is in dashed lines. Attention transfer greatly speeds up convergence and improves final accuracy.
|
| 264 |
+
|
| 265 |
+
Table 5: Attention transfer validation error (single crop) on ImageNet. Transfer losses are added on epoch 60/100.
|
| 266 |
+
|
| 267 |
+
<table><tr><td>Model</td><td>top1, top5</td></tr><tr><td>ResNet-18</td><td>30.4,10.8</td></tr><tr><td>AT</td><td>29.3,10.0</td></tr><tr><td>ResNet-34</td><td>26.1,8.3</td></tr></table>
|
| 268 |
+
|
| 269 |
+
# A.2 IMPLEMENTATION DETAILS
|
| 270 |
+
|
| 271 |
+
The experiments were conducted in Torch machine learning framework. Double propagation can be implemented in a modern framework with automatic differentiation support, e.g. Torch, Theano, Tensorflow. For ImageNet experiments we used fb.resnet.torch code, and used 2 Titan X cards with data parallelizm in both teacher and student to speed up training. Code and models for our experiments are available at https://github.com/szagoruyko/attention-transfer.
|
parse/train/Sks9_ajex/Sks9_ajex_content_list.json
ADDED
|
@@ -0,0 +1,1461 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[
|
| 2 |
+
{
|
| 3 |
+
"type": "text",
|
| 4 |
+
"text": "PAYING MORE ATTENTION TO ATTENTION: IMPROVING THE PERFORMANCE OF CONVOLUTIONAL NEURAL NETWORKS VIA ATTENTION TRANSFER ",
|
| 5 |
+
"text_level": 1,
|
| 6 |
+
"bbox": [
|
| 7 |
+
174,
|
| 8 |
+
99,
|
| 9 |
+
821,
|
| 10 |
+
172
|
| 11 |
+
],
|
| 12 |
+
"page_idx": 0
|
| 13 |
+
},
|
| 14 |
+
{
|
| 15 |
+
"type": "text",
|
| 16 |
+
"text": "Sergey Zagoruyko, Nikos Komodakis \nUniversite Paris-Est, ´ Ecole des Ponts ParisTech ´ \nParis, France \n{sergey.zagoruyko,nikos.komodakis}@enpc.fr ",
|
| 17 |
+
"bbox": [
|
| 18 |
+
184,
|
| 19 |
+
195,
|
| 20 |
+
593,
|
| 21 |
+
253
|
| 22 |
+
],
|
| 23 |
+
"page_idx": 0
|
| 24 |
+
},
|
| 25 |
+
{
|
| 26 |
+
"type": "text",
|
| 27 |
+
"text": "ABSTRACT ",
|
| 28 |
+
"text_level": 1,
|
| 29 |
+
"bbox": [
|
| 30 |
+
454,
|
| 31 |
+
290,
|
| 32 |
+
544,
|
| 33 |
+
304
|
| 34 |
+
],
|
| 35 |
+
"page_idx": 0
|
| 36 |
+
},
|
| 37 |
+
{
|
| 38 |
+
"type": "text",
|
| 39 |
+
"text": "Attention plays a critical role in human visual experience. Furthermore, it has recently been demonstrated that attention can also play an important role in the context of applying artificial neural networks to a variety of tasks from fields such as computer vision and NLP. In this work we show that, by properly defining attention for convolutional neural networks, we can actually use this type of information in order to significantly improve the performance of a student CNN network by forcing it to mimic the attention maps of a powerful teacher network. To that end, we propose several novel methods of transferring attention, showing consistent improvement across a variety of datasets and convolutional neural network architectures. Code and models for our experiments are available at https://github.com/szagoruyko/attention-transfer. ",
|
| 40 |
+
"bbox": [
|
| 41 |
+
233,
|
| 42 |
+
323,
|
| 43 |
+
764,
|
| 44 |
+
476
|
| 45 |
+
],
|
| 46 |
+
"page_idx": 0
|
| 47 |
+
},
|
| 48 |
+
{
|
| 49 |
+
"type": "text",
|
| 50 |
+
"text": "1 INTRODUCTION ",
|
| 51 |
+
"text_level": 1,
|
| 52 |
+
"bbox": [
|
| 53 |
+
176,
|
| 54 |
+
507,
|
| 55 |
+
336,
|
| 56 |
+
523
|
| 57 |
+
],
|
| 58 |
+
"page_idx": 0
|
| 59 |
+
},
|
| 60 |
+
{
|
| 61 |
+
"type": "text",
|
| 62 |
+
"text": "As humans, we need to pay attention in order to be able to adequately perceive our surroundings. Attention is therefore a key aspect of our visual experience, and closely relates to perception - we need to keep attention to build a visual representation, possessing detail and coherence. ",
|
| 63 |
+
"bbox": [
|
| 64 |
+
176,
|
| 65 |
+
540,
|
| 66 |
+
823,
|
| 67 |
+
583
|
| 68 |
+
],
|
| 69 |
+
"page_idx": 0
|
| 70 |
+
},
|
| 71 |
+
{
|
| 72 |
+
"type": "text",
|
| 73 |
+
"text": "As artificial neural networks became more popular in fields such as computer vision and natural language processing in the recent years, artificial attention mechanisms started to be developed as well. Artificial attention lets a system “attend” to an object to examine it with greater detail. It has also become a research tool for understanding mechanisms behind neural networks, similar to attention used in psychology. ",
|
| 74 |
+
"bbox": [
|
| 75 |
+
174,
|
| 76 |
+
589,
|
| 77 |
+
823,
|
| 78 |
+
660
|
| 79 |
+
],
|
| 80 |
+
"page_idx": 0
|
| 81 |
+
},
|
| 82 |
+
{
|
| 83 |
+
"type": "text",
|
| 84 |
+
"text": "One of the popular hypothesis there is that there are non-attentional and attentional perception processes. Non-attentional processes help to observe a scene in general and gather high-level information, which, when associated with other thinking processes, helps us to control the attention processes and navigate to a certain part of the scene. This implies that different observers with different knowledge, different goals, and therefore different attentional strategies can literally see the same scene differently. This brings us to the main topic of this paper: how attention differs within artificial vision systems, and can we use attention information in order to improve the performance of convolutional neural networks ? More specifically, can a teacher network improve the performance of another student network by providing to it information about where it looks, i.e., about where it concentrates its attention into ? ",
|
| 85 |
+
"bbox": [
|
| 86 |
+
174,
|
| 87 |
+
666,
|
| 88 |
+
825,
|
| 89 |
+
805
|
| 90 |
+
],
|
| 91 |
+
"page_idx": 0
|
| 92 |
+
},
|
| 93 |
+
{
|
| 94 |
+
"type": "text",
|
| 95 |
+
"text": "To study these questions, one first needs to properly specify how attention is defined w.r.t. a given convolutional neural network. To that end, here we consider attention as a set of spatial maps that essentially try to encode on which spatial areas of the input the network focuses most for taking its output decision (e.g., for classifying an image), where, furthermore, these maps can be defined w.r.t. various layers of the network so that they are able to capture both low-, mid-, and high-level representation information. More specifically, in this work we define two types of spatial attention maps: activation-based and gradient-based. We explore how both of these attention maps change over various datasets and architectures, and show that these actually contain valuable information that can be used for significantly improving the performance of convolutional neural network architectures (of various types and trained for various different tasks). To that end, we propose several novel ways of transferring attention from a powerful teacher network to a smaller student network with the goal of improving the performance of the latter (Fig. 1). ",
|
| 96 |
+
"bbox": [
|
| 97 |
+
174,
|
| 98 |
+
813,
|
| 99 |
+
823,
|
| 100 |
+
924
|
| 101 |
+
],
|
| 102 |
+
"page_idx": 0
|
| 103 |
+
},
|
| 104 |
+
{
|
| 105 |
+
"type": "image",
|
| 106 |
+
"img_path": "images/eab8212626fdafd2cd7dfa6c01a9064ec3518bbe8b21086a6a8d038e6c3e0aee.jpg",
|
| 107 |
+
"image_caption": [
|
| 108 |
+
"Figure 1: (a) An input image and a corresponding spatial attention map of a convolutional network that shows where the network focuses in order to classify the given image. Surely, this type of map must contain valuable information about the network. The question that we pose in this paper is the following: can we use knowledge of this type to improve the training of CNN models ? (b) Schematic representation of attention transfer: a student CNN is trained so as, not only to make good predictions, but to also have similar spatial attention maps to those of an already trained teacher CNN. "
|
| 109 |
+
],
|
| 110 |
+
"image_footnote": [],
|
| 111 |
+
"bbox": [
|
| 112 |
+
251,
|
| 113 |
+
63,
|
| 114 |
+
767,
|
| 115 |
+
220
|
| 116 |
+
],
|
| 117 |
+
"page_idx": 1
|
| 118 |
+
},
|
| 119 |
+
{
|
| 120 |
+
"type": "text",
|
| 121 |
+
"text": "",
|
| 122 |
+
"bbox": [
|
| 123 |
+
174,
|
| 124 |
+
353,
|
| 125 |
+
825,
|
| 126 |
+
410
|
| 127 |
+
],
|
| 128 |
+
"page_idx": 1
|
| 129 |
+
},
|
| 130 |
+
{
|
| 131 |
+
"type": "text",
|
| 132 |
+
"text": "To summarize, the contributions of this work are as follows: ",
|
| 133 |
+
"bbox": [
|
| 134 |
+
174,
|
| 135 |
+
415,
|
| 136 |
+
566,
|
| 137 |
+
430
|
| 138 |
+
],
|
| 139 |
+
"page_idx": 1
|
| 140 |
+
},
|
| 141 |
+
{
|
| 142 |
+
"type": "text",
|
| 143 |
+
"text": "• We propose attention as a mechanism of transferring knowledge from one network to another \n• We propose the use of both activation-based and gradient-based spatial attention maps \n• We show experimentally that our approach provides significant improvements across a variety of datasets and deep network architectures, including both residual and non-residual networks \n• We show that activation-based attention transfer gives better improvements than fullactivation transfer, and can be combined with knowledge distillation ",
|
| 144 |
+
"bbox": [
|
| 145 |
+
215,
|
| 146 |
+
443,
|
| 147 |
+
825,
|
| 148 |
+
573
|
| 149 |
+
],
|
| 150 |
+
"page_idx": 1
|
| 151 |
+
},
|
| 152 |
+
{
|
| 153 |
+
"type": "text",
|
| 154 |
+
"text": "The rest of the paper is structured as follows: we first describe related work in section 2, we explain our approach for activation-based and gradient-based attention transfer in section 3, and then present experimental results for both methods in section 4. We conclude the paper in section 5. ",
|
| 155 |
+
"bbox": [
|
| 156 |
+
176,
|
| 157 |
+
584,
|
| 158 |
+
825,
|
| 159 |
+
627
|
| 160 |
+
],
|
| 161 |
+
"page_idx": 1
|
| 162 |
+
},
|
| 163 |
+
{
|
| 164 |
+
"type": "text",
|
| 165 |
+
"text": "2 RELATED WORK ",
|
| 166 |
+
"text_level": 1,
|
| 167 |
+
"bbox": [
|
| 168 |
+
176,
|
| 169 |
+
648,
|
| 170 |
+
341,
|
| 171 |
+
664
|
| 172 |
+
],
|
| 173 |
+
"page_idx": 1
|
| 174 |
+
},
|
| 175 |
+
{
|
| 176 |
+
"type": "text",
|
| 177 |
+
"text": "Early work on attention based tracking Larochelle & Hinton (2010), Denil et al. (2012) was motivated by human attention mechanism theories Rensink (2000) and was done via Restricted Bolzmann Machines. It was recently adapted for neural machine translation with recurrent neural networks, e.g. Bahdanau et al. (2014) as well as in several other NLP-related tasks. It was also exploited in computer-vision-related tasks such as image captioning Xu et al. (2015), visual question answering Yang et al. (2015), as well as in weakly-supervised object localization Oquab et al. (2015) and classification Mnih et al. (2014), to mention a few characteristic examples. In all these tasks attention proved to be useful. ",
|
| 178 |
+
"bbox": [
|
| 179 |
+
174,
|
| 180 |
+
680,
|
| 181 |
+
825,
|
| 182 |
+
791
|
| 183 |
+
],
|
| 184 |
+
"page_idx": 1
|
| 185 |
+
},
|
| 186 |
+
{
|
| 187 |
+
"type": "text",
|
| 188 |
+
"text": "Visualizing attention maps in deep convolutional neural networks is an open problem. The simplest gradient-based way of doing that is by computing a Jacobian of network output w.r.t. input (this leads to attention visualization that are not necessarily class-discriminative), as for example in Simonyan et al. (2014). Another approach was proposed by Zeiler & Fergus (2014) that consists of attaching a network called “deconvnet” that shares weights with the original network and is used to project certain features onto the image plane. A number of methods was proposed to improve gradientbased attention as well, for example guided backpropagation Springenberg et al. (2015), adding a change in ReLU layers during calculation of gradient w.r.t. previous layer output. Attention maps obtained with guided backpropagation are non-class-discriminative too. Among existing methods for visualizing attention, we should also mention class activation maps Zhou et al. (2016), which are based on removing top average-pooling layer and converting the linear classification layer into a convolutional layer, producing attention maps per each class. A method combining both guided backpropagation and CAM is Grad-CAM by Selvaraju et al. (2016), adding image-level details to class-discriminative attention maps. ",
|
| 189 |
+
"bbox": [
|
| 190 |
+
173,
|
| 191 |
+
797,
|
| 192 |
+
825,
|
| 193 |
+
924
|
| 194 |
+
],
|
| 195 |
+
"page_idx": 1
|
| 196 |
+
},
|
| 197 |
+
{
|
| 198 |
+
"type": "text",
|
| 199 |
+
"text": "",
|
| 200 |
+
"bbox": [
|
| 201 |
+
174,
|
| 202 |
+
103,
|
| 203 |
+
825,
|
| 204 |
+
174
|
| 205 |
+
],
|
| 206 |
+
"page_idx": 2
|
| 207 |
+
},
|
| 208 |
+
{
|
| 209 |
+
"type": "text",
|
| 210 |
+
"text": "Knowledge distillation with neural networks was pioneered by Hinton et al. (2015); Bucila et al. (2006), which is a transfer learning method that aims to improve the training of a student network by relying on knowledge borrowed from a powerful teacher network. Although in certain special cases shallow networks had been shown to be able to approximate deeper ones without loss in accuracy Lei & Caruana (2014), later work related to knowledge distillation was mostly based on the assumption that deeper networks always learn better representations. For example, FitNets Romero et al. (2014) tried to learn a thin deep network using a shallow one with more parameters. The introduction of highway Srivastava et al. (2015) and later residual networks He et al. (2015) allowed training very deep architectures with higher accuracy, and generality of these networks was experimentally showed over a large variety of datasets. Although the main motivation for residual networks was increasing depth, it was later shown by Zagoruyko & Komodakis (2016) that, after a certain depth, the improvements came mostly from increased capacity of the networks, i.e. number of parameters (for instance, a wider deep residual network with only 16 layers was shown that it could learn as good or better representations as very thin 1000 layer one, provided that they were using comparable number of parameters). ",
|
| 211 |
+
"bbox": [
|
| 212 |
+
174,
|
| 213 |
+
181,
|
| 214 |
+
825,
|
| 215 |
+
388
|
| 216 |
+
],
|
| 217 |
+
"page_idx": 2
|
| 218 |
+
},
|
| 219 |
+
{
|
| 220 |
+
"type": "text",
|
| 221 |
+
"text": "Due to the above fact and due to that thin deep networks are less parallelizable than wider ones, we think that knowledge transfer needs to be revisited, and take an opposite to FitNets approach - we try to learn less deep student networks. Our attention maps used for transfer are similar to both gradient-based and activation-based maps mentioned above, which play a role similar to “hints” in FitNets, although we don’t introduce new weights. ",
|
| 222 |
+
"bbox": [
|
| 223 |
+
174,
|
| 224 |
+
395,
|
| 225 |
+
825,
|
| 226 |
+
465
|
| 227 |
+
],
|
| 228 |
+
"page_idx": 2
|
| 229 |
+
},
|
| 230 |
+
{
|
| 231 |
+
"type": "text",
|
| 232 |
+
"text": "3 ATTENTION TRANSFER ",
|
| 233 |
+
"text_level": 1,
|
| 234 |
+
"bbox": [
|
| 235 |
+
176,
|
| 236 |
+
486,
|
| 237 |
+
397,
|
| 238 |
+
502
|
| 239 |
+
],
|
| 240 |
+
"page_idx": 2
|
| 241 |
+
},
|
| 242 |
+
{
|
| 243 |
+
"type": "text",
|
| 244 |
+
"text": "In this section we explain the two methods that we use for defining the spatial attention maps of a convolutional neural network as well as how we transfer attention information from a teacher to a student network in each case. ",
|
| 245 |
+
"bbox": [
|
| 246 |
+
174,
|
| 247 |
+
518,
|
| 248 |
+
825,
|
| 249 |
+
560
|
| 250 |
+
],
|
| 251 |
+
"page_idx": 2
|
| 252 |
+
},
|
| 253 |
+
{
|
| 254 |
+
"type": "text",
|
| 255 |
+
"text": "3.1 ACTIVATION-BASED ATTENTION TRANSFER ",
|
| 256 |
+
"text_level": 1,
|
| 257 |
+
"bbox": [
|
| 258 |
+
178,
|
| 259 |
+
579,
|
| 260 |
+
513,
|
| 261 |
+
593
|
| 262 |
+
],
|
| 263 |
+
"page_idx": 2
|
| 264 |
+
},
|
| 265 |
+
{
|
| 266 |
+
"type": "text",
|
| 267 |
+
"text": "Let us consider a CNN layer and its corresponding activation tensor $A \\in R ^ { C \\times H \\times W }$ , which consists of $C$ feature planes with spatial dimensions $H \\times W$ . An activation-based mapping function $\\mathcal { F }$ (w.r.t. that layer) takes as input the above 3D tensor $A$ and outputs a spatial attention map, i.e., a flattened 2D tensor defined over the spatial dimensions, or ",
|
| 268 |
+
"bbox": [
|
| 269 |
+
174,
|
| 270 |
+
604,
|
| 271 |
+
825,
|
| 272 |
+
661
|
| 273 |
+
],
|
| 274 |
+
"page_idx": 2
|
| 275 |
+
},
|
| 276 |
+
{
|
| 277 |
+
"type": "equation",
|
| 278 |
+
"img_path": "images/e1a2f4609c7793c8f981468f34ea72277781915aa2c7e5bdde465f032fc42345.jpg",
|
| 279 |
+
"text": "$$\n\\mathcal { F } : R ^ { C \\times H \\times W } R ^ { H \\times W } .\n$$",
|
| 280 |
+
"text_format": "latex",
|
| 281 |
+
"bbox": [
|
| 282 |
+
405,
|
| 283 |
+
679,
|
| 284 |
+
593,
|
| 285 |
+
696
|
| 286 |
+
],
|
| 287 |
+
"page_idx": 2
|
| 288 |
+
},
|
| 289 |
+
{
|
| 290 |
+
"type": "text",
|
| 291 |
+
"text": "To define such a spatial attention mapping function, the implicit assumption that we make in this section is that the absolute value of a hidden neuron activation (that results when the network is evaluated on given input) can be used as an indication about the importance of that neuron w.r.t. the specific input. By considering, therefore, the absolute values of the elements of tensor $A$ , we can construct a spatial attention map by computing statistics of these values across the channel dimension (see Fig. 3). More specifically, in this work we will consider the following activation-based spatial attention maps: ",
|
| 292 |
+
"bbox": [
|
| 293 |
+
173,
|
| 294 |
+
709,
|
| 295 |
+
825,
|
| 296 |
+
809
|
| 297 |
+
],
|
| 298 |
+
"page_idx": 2
|
| 299 |
+
},
|
| 300 |
+
{
|
| 301 |
+
"type": "text",
|
| 302 |
+
"text": "• sum of absolute values: $\\begin{array} { r } { F _ { \\mathrm { s u m } } ( A ) = \\sum _ { i = 1 } ^ { C } | A _ { i } | } \\end{array}$ • sum of absolute values raised to the power of $p$ (where $p > 1 _ { \\cdot }$ ): $\\begin{array} { r } { F _ { \\mathrm { s u m } } ^ { p } ( A ) = \\sum _ { i = 1 } ^ { C } | A _ { i } | ^ { p } } \\end{array}$ • max of absolute values raised to the power of $p$ (where $p > 1$ ): $F _ { \\operatorname* { m a x } } ^ { p } ( A ) = \\operatorname* { m a x } _ { i = 1 , C } | A _ { i } | ^ { p }$ where $A _ { i } = A ( i , : , : )$ (using Matlab notation), and max, power and absolute value operations are elementwise (e.g. $| A _ { i } | ^ { p }$ is equivalent to abs $( \\mathbb { A } _ { i } ) \\cdot { } ^ { \\wedge } \\mathtt { p }$ in Matlab notation). ",
|
| 303 |
+
"bbox": [
|
| 304 |
+
215,
|
| 305 |
+
820,
|
| 306 |
+
825,
|
| 307 |
+
883
|
| 308 |
+
],
|
| 309 |
+
"page_idx": 2
|
| 310 |
+
},
|
| 311 |
+
{
|
| 312 |
+
"type": "text",
|
| 313 |
+
"text": "",
|
| 314 |
+
"bbox": [
|
| 315 |
+
173,
|
| 316 |
+
895,
|
| 317 |
+
823,
|
| 318 |
+
924
|
| 319 |
+
],
|
| 320 |
+
"page_idx": 2
|
| 321 |
+
},
|
| 322 |
+
{
|
| 323 |
+
"type": "image",
|
| 324 |
+
"img_path": "images/a810f404f345874269d478e85bafdf6df6ed6eb8ded9d40e011795d05be4c787.jpg",
|
| 325 |
+
"image_caption": [
|
| 326 |
+
"Figure 2: Sum of absolute values attention maps $F _ { \\mathrm { s u m } }$ over different levels of a network trained for face recognition. Mid-level attention maps have higher activation level around eyes, nose and lips, high-level activations correspond to the whole face. "
|
| 327 |
+
],
|
| 328 |
+
"image_footnote": [],
|
| 329 |
+
"bbox": [
|
| 330 |
+
276,
|
| 331 |
+
80,
|
| 332 |
+
745,
|
| 333 |
+
184
|
| 334 |
+
],
|
| 335 |
+
"page_idx": 3
|
| 336 |
+
},
|
| 337 |
+
{
|
| 338 |
+
"type": "text",
|
| 339 |
+
"text": "We visualized activations of various networks on several datasets, including ImageNet classification and localization, COCO object detection, face recognition, and fine-grained recognition. We were mostly focused on modern architectures without top dense linear layers, such as Network-InNetwork, ResNet and Inception, which have streamlined convolutional structure. We also examined networks of the same architecture, width and depth, but trained with different frameworks with significant difference in performance. We found that the above statistics of hidden activations not only have spatial correlation with predicted objects on image level, but these correlations also tend to be higher in networks with higher accuracy, and stronger networks have peaks in attention where weak networks don’t (e.g., see Fig. 4). Furthermore, attention maps focus on different parts for different layers in the network. In the first layers neurons activation level is high for low-level gradient points, in the middle it is higher for the most discriminative regions such as eyes or wheels, and in the top layers it reflects full objects. For example, mid-level attention maps of a network trained for face recognition Parkhi et al. (2015) will have higher activations around eyes, nose and lips, and top level activation will correspond to full face (Fig. 2). ",
|
| 340 |
+
"bbox": [
|
| 341 |
+
174,
|
| 342 |
+
265,
|
| 343 |
+
825,
|
| 344 |
+
460
|
| 345 |
+
],
|
| 346 |
+
"page_idx": 3
|
| 347 |
+
},
|
| 348 |
+
{
|
| 349 |
+
"type": "text",
|
| 350 |
+
"text": "Concerning the different attention mapping functions defined above, these can have slightly different properties. E.g.: ",
|
| 351 |
+
"bbox": [
|
| 352 |
+
174,
|
| 353 |
+
467,
|
| 354 |
+
823,
|
| 355 |
+
494
|
| 356 |
+
],
|
| 357 |
+
"page_idx": 3
|
| 358 |
+
},
|
| 359 |
+
{
|
| 360 |
+
"type": "text",
|
| 361 |
+
"text": "• Compared to $F _ { \\mathrm { s u m } } ( A )$ , the spatial map $F _ { \\mathrm { s u m } } ^ { p } ( A )$ (where $p > 1$ ) puts more weight to spatial locations that correspond to the neurons with the highest activations, i.e., puts more weight to the most discriminative parts (the larger the $p$ the more focus is placed on those parts with highest activations). \nFurthermore, among all neuron activations corresponding to the same spatial location, $F _ { \\mathrm { m a x } } ^ { p } ( A )$ will consider only one of them to assign a weight to that spatial location (as opposed to $F _ { \\mathrm { s u m } } ^ { p } ( A )$ that will favor spatial locations that carry multiple neurons with high activations). ",
|
| 362 |
+
"bbox": [
|
| 363 |
+
215,
|
| 364 |
+
507,
|
| 365 |
+
825,
|
| 366 |
+
625
|
| 367 |
+
],
|
| 368 |
+
"page_idx": 3
|
| 369 |
+
},
|
| 370 |
+
{
|
| 371 |
+
"type": "text",
|
| 372 |
+
"text": "To further illustrate the differences of these functions we visualized attention maps of 3 networks with sufficient difference in classification performance: Network-In-Network $62 \\%$ top-1 val accuracy), ResNet34 ( $73 \\%$ top-1 val accuracy) and ResNet-101 ( $7 7 . 3 \\%$ top-1 val accuracy). In each network we took last pre-downsampling activation maps, on the left for mid-level and on the right for top pre-average pooling activations in fig. 4. Top-level maps are blurry because their original spatial resolution is $7 \\times 7$ . It is clear that most discriminative regions have higher activation levels, e.g. face of the wolf, and that shape details disappear as the parameter $p$ (used as exponent) increases. ",
|
| 373 |
+
"bbox": [
|
| 374 |
+
174,
|
| 375 |
+
637,
|
| 376 |
+
645,
|
| 377 |
+
776
|
| 378 |
+
],
|
| 379 |
+
"page_idx": 3
|
| 380 |
+
},
|
| 381 |
+
{
|
| 382 |
+
"type": "text",
|
| 383 |
+
"text": "In attention transfer, given the spatial attention maps of a teacher network (computed using any of the above attention mapping functions), the goal is to train a student network that will not only make correct predictions but will also have attentions maps that are similar to those of the teacher. In general, one can place transfer losses w.r.t. attention maps computed across several layers. For instance, in the case of ResNet architectures, one can consider the following two cases, depending on the depth of teacher and student: ",
|
| 384 |
+
"bbox": [
|
| 385 |
+
174,
|
| 386 |
+
784,
|
| 387 |
+
647,
|
| 388 |
+
895
|
| 389 |
+
],
|
| 390 |
+
"page_idx": 3
|
| 391 |
+
},
|
| 392 |
+
{
|
| 393 |
+
"type": "image",
|
| 394 |
+
"img_path": "images/ecea16573bf41e3859b1bb7a08e2e1f06b2b2c4af1a8193e2bb2d962a4b0e095.jpg",
|
| 395 |
+
"image_caption": [
|
| 396 |
+
"Figure 3: Attention mapping over feature dimension. "
|
| 397 |
+
],
|
| 398 |
+
"image_footnote": [],
|
| 399 |
+
"bbox": [
|
| 400 |
+
658,
|
| 401 |
+
654,
|
| 402 |
+
828,
|
| 403 |
+
801
|
| 404 |
+
],
|
| 405 |
+
"page_idx": 3
|
| 406 |
+
},
|
| 407 |
+
{
|
| 408 |
+
"type": "text",
|
| 409 |
+
"text": "• Same depth: possible to have attention transfer layer after every residual block • Different depth: have attention transfer on output activations of each group of residual blocks ",
|
| 410 |
+
"bbox": [
|
| 411 |
+
215,
|
| 412 |
+
909,
|
| 413 |
+
745,
|
| 414 |
+
924
|
| 415 |
+
],
|
| 416 |
+
"page_idx": 3
|
| 417 |
+
},
|
| 418 |
+
{
|
| 419 |
+
"type": "image",
|
| 420 |
+
"img_path": "images/781eb750349972c73251c3706985fc4fdd949468996c34b70fb12c9dc71cba30.jpg",
|
| 421 |
+
"image_caption": [
|
| 422 |
+
"Figure 4: Activation attention maps for various ImageNet networks: Network-In-Network $6 2 \\%$ top-1 val accuracy), ResNet-34 $73 \\%$ top-1 val accuracy), ResNet-101 $7 7 . 3 \\%$ top-1 val accuracy). Left part: mid-level activations, right part: top-level pre-softmax acivations "
|
| 423 |
+
],
|
| 424 |
+
"image_footnote": [],
|
| 425 |
+
"bbox": [
|
| 426 |
+
173,
|
| 427 |
+
98,
|
| 428 |
+
818,
|
| 429 |
+
362
|
| 430 |
+
],
|
| 431 |
+
"page_idx": 4
|
| 432 |
+
},
|
| 433 |
+
{
|
| 434 |
+
"type": "image",
|
| 435 |
+
"img_path": "images/77bb0edefec14bad0b13034ac4f6bc3cc6cf506fed258747cfc540c385faf28d.jpg",
|
| 436 |
+
"image_caption": [
|
| 437 |
+
"Figure 5: Schematics of teacher-student attention transfer for the case when both networks are residual, and the teacher is deeper. "
|
| 438 |
+
],
|
| 439 |
+
"image_footnote": [],
|
| 440 |
+
"bbox": [
|
| 441 |
+
181,
|
| 442 |
+
428,
|
| 443 |
+
816,
|
| 444 |
+
553
|
| 445 |
+
],
|
| 446 |
+
"page_idx": 4
|
| 447 |
+
},
|
| 448 |
+
{
|
| 449 |
+
"type": "text",
|
| 450 |
+
"text": "",
|
| 451 |
+
"bbox": [
|
| 452 |
+
215,
|
| 453 |
+
619,
|
| 454 |
+
823,
|
| 455 |
+
647
|
| 456 |
+
],
|
| 457 |
+
"page_idx": 4
|
| 458 |
+
},
|
| 459 |
+
{
|
| 460 |
+
"type": "text",
|
| 461 |
+
"text": "Similar cases apply also to other architectures (such as NIN, in which case a group refers to a block of a $3 \\times 3 , 1 \\times 1 , 1 \\times 1$ convolutions). In fig. 5 we provide a schematic illustration of the different depth case for residual network architectures. ",
|
| 462 |
+
"bbox": [
|
| 463 |
+
174,
|
| 464 |
+
664,
|
| 465 |
+
825,
|
| 466 |
+
705
|
| 467 |
+
],
|
| 468 |
+
"page_idx": 4
|
| 469 |
+
},
|
| 470 |
+
{
|
| 471 |
+
"type": "text",
|
| 472 |
+
"text": "Without loss of generality, we assume that transfer losses are placed between student and teacher attention maps of same spatial resolution, but, if needed, attention maps can be interpolated to match their shapes. Let $S$ , $T$ and $\\mathbf { W } _ { S }$ , $\\mathbf { W } _ { T }$ denote student, teacher and their weights correspondingly, and let $\\mathcal { L } ( \\mathbf { W } , x )$ denote a standard cross entropy loss. Let also $\\mathcal { T }$ denote the indices of all teacher-student activation layer pairs for which we want to transfer attention maps. Then we can define the following total loss: ",
|
| 473 |
+
"bbox": [
|
| 474 |
+
173,
|
| 475 |
+
713,
|
| 476 |
+
826,
|
| 477 |
+
796
|
| 478 |
+
],
|
| 479 |
+
"page_idx": 4
|
| 480 |
+
},
|
| 481 |
+
{
|
| 482 |
+
"type": "equation",
|
| 483 |
+
"img_path": "images/d92a2a6814bded05a23688e8f03280327d1eedb66ca494b0565a4fb579087c76.jpg",
|
| 484 |
+
"text": "$$\n\\mathcal { L } _ { A T } = \\mathcal { L } ( \\mathbf { W } _ { S } , x ) + \\frac { \\beta } { 2 } \\sum _ { j \\in \\mathcal { T } } \\Vert \\frac { Q _ { S } ^ { j } } { \\Vert Q _ { S } ^ { j } \\Vert _ { 2 } } - \\frac { Q _ { T } ^ { j } } { \\Vert Q _ { T } ^ { j } \\Vert _ { 2 } } \\Vert _ { p } \\enspace ,\n$$",
|
| 485 |
+
"text_format": "latex",
|
| 486 |
+
"bbox": [
|
| 487 |
+
325,
|
| 488 |
+
804,
|
| 489 |
+
671,
|
| 490 |
+
847
|
| 491 |
+
],
|
| 492 |
+
"page_idx": 4
|
| 493 |
+
},
|
| 494 |
+
{
|
| 495 |
+
"type": "text",
|
| 496 |
+
"text": "where $Q _ { S } ^ { j } = v e c ( F ( A _ { S } ^ { j } ) )$ and $Q _ { T } ^ { j } = v e c ( F ( A _ { T } ^ { j } ) )$ are respectively the $j$ -th pair of student and teacher attention maps in vectorized form, and $p$ refers to norm type (in the experiments we use $p = 2$ ). As can be seen, during attention transfer we make use of $l _ { 2 }$ -normalized attention maps, i.e., we replace each vectorized attention map $Q$ with QkQk2 (l1 normalization could be used as well). It is worth emphasizing that normalization of attention maps is important for the success of the student training. ",
|
| 497 |
+
"bbox": [
|
| 498 |
+
173,
|
| 499 |
+
863,
|
| 500 |
+
825,
|
| 501 |
+
928
|
| 502 |
+
],
|
| 503 |
+
"page_idx": 4
|
| 504 |
+
},
|
| 505 |
+
{
|
| 506 |
+
"type": "text",
|
| 507 |
+
"text": "",
|
| 508 |
+
"bbox": [
|
| 509 |
+
173,
|
| 510 |
+
103,
|
| 511 |
+
823,
|
| 512 |
+
132
|
| 513 |
+
],
|
| 514 |
+
"page_idx": 5
|
| 515 |
+
},
|
| 516 |
+
{
|
| 517 |
+
"type": "text",
|
| 518 |
+
"text": "Attention transfer can also be combined with knowledge distillation Hinton et al. (2015), in which case an additional term (corresponding to the cross entropy between softened distributions over labels of teacher and student) simply needs to be included to the above loss. When combined, attention transfer adds very little computational cost, as attention maps for teacher can be easily computed during forward propagation, needed for distillation. ",
|
| 519 |
+
"bbox": [
|
| 520 |
+
174,
|
| 521 |
+
138,
|
| 522 |
+
825,
|
| 523 |
+
209
|
| 524 |
+
],
|
| 525 |
+
"page_idx": 5
|
| 526 |
+
},
|
| 527 |
+
{
|
| 528 |
+
"type": "text",
|
| 529 |
+
"text": "3.2 GRADIENT-BASED ATTENTION TRANSFER ",
|
| 530 |
+
"text_level": 1,
|
| 531 |
+
"bbox": [
|
| 532 |
+
174,
|
| 533 |
+
226,
|
| 534 |
+
503,
|
| 535 |
+
239
|
| 536 |
+
],
|
| 537 |
+
"page_idx": 5
|
| 538 |
+
},
|
| 539 |
+
{
|
| 540 |
+
"type": "text",
|
| 541 |
+
"text": "In this case we define attention as gradient w.r.t. input, which can be viewed as an input sensitivity map Simonyan et al. (2014), i.e., attention at an input spatial location encodes how sensitive the output prediction is w.r.t. changes at that input location (e.g., if small changes at a pixel can have a large effect on the network output then it is logical to assume that the network is “paying attention” to that pixel). Let’s define the gradient of the loss w.r.t input for teacher and student as: ",
|
| 542 |
+
"bbox": [
|
| 543 |
+
173,
|
| 544 |
+
251,
|
| 545 |
+
825,
|
| 546 |
+
321
|
| 547 |
+
],
|
| 548 |
+
"page_idx": 5
|
| 549 |
+
},
|
| 550 |
+
{
|
| 551 |
+
"type": "equation",
|
| 552 |
+
"img_path": "images/2ad17650acada2c3e36d1907d9ab0ccbcf175315f0fb02cbca36cf2bf053a2fa.jpg",
|
| 553 |
+
"text": "$$\nJ _ { S } = \\frac { \\partial } { \\partial x } \\mathcal { L } ( \\mathbf { W _ { S } } , x ) , J _ { T } = \\frac { \\partial } { \\partial x } \\mathcal { L } ( \\mathbf { W _ { T } } , x )\n$$",
|
| 554 |
+
"text_format": "latex",
|
| 555 |
+
"bbox": [
|
| 556 |
+
359,
|
| 557 |
+
330,
|
| 558 |
+
638,
|
| 559 |
+
361
|
| 560 |
+
],
|
| 561 |
+
"page_idx": 5
|
| 562 |
+
},
|
| 563 |
+
{
|
| 564 |
+
"type": "text",
|
| 565 |
+
"text": "Then if we want student gradient attention to be similar to teacher attention, we can minimize a distance between them (here we use $l _ { 2 }$ distance but other distances can be employed as well): ",
|
| 566 |
+
"bbox": [
|
| 567 |
+
174,
|
| 568 |
+
369,
|
| 569 |
+
826,
|
| 570 |
+
398
|
| 571 |
+
],
|
| 572 |
+
"page_idx": 5
|
| 573 |
+
},
|
| 574 |
+
{
|
| 575 |
+
"type": "equation",
|
| 576 |
+
"img_path": "images/15213dd42eecf05fccd4996b0afc684cee08a291da893f6650bb403a700ffc2a.jpg",
|
| 577 |
+
"text": "$$\n\\mathcal { L } _ { A T } ( \\mathbf { W _ { S } } , \\mathbf { W _ { T } } , x ) = \\mathcal { L } ( \\mathbf { W _ { S } } , x ) + \\frac { \\beta } { 2 } | | J _ { S } - J _ { T } | | _ { 2 }\n$$",
|
| 578 |
+
"text_format": "latex",
|
| 579 |
+
"bbox": [
|
| 580 |
+
330,
|
| 581 |
+
407,
|
| 582 |
+
668,
|
| 583 |
+
439
|
| 584 |
+
],
|
| 585 |
+
"page_idx": 5
|
| 586 |
+
},
|
| 587 |
+
{
|
| 588 |
+
"type": "text",
|
| 589 |
+
"text": "As $\\mathbf { W } _ { T }$ and $x$ are given, to get the needed derivative w.r.t. $\\mathbf { W } _ { S }$ : ",
|
| 590 |
+
"bbox": [
|
| 591 |
+
173,
|
| 592 |
+
446,
|
| 593 |
+
593,
|
| 594 |
+
462
|
| 595 |
+
],
|
| 596 |
+
"page_idx": 5
|
| 597 |
+
},
|
| 598 |
+
{
|
| 599 |
+
"type": "equation",
|
| 600 |
+
"img_path": "images/c0f828380e1cf94b387c133639904db6b1a6666bf03d7c23c9b9e1d571bd9858.jpg",
|
| 601 |
+
"text": "$$\n\\frac { \\partial } { \\partial \\mathbf { W _ { S } } } \\mathcal { L } _ { A T } = \\frac { \\partial } { \\partial \\mathbf { W _ { S } } } \\mathcal { L } ( \\mathbf { W _ { S } } , x ) + \\beta ( J _ { S } - J _ { T } ) \\frac { \\partial ^ { 2 } } { \\partial \\mathbf { W _ { S } } \\partial x } \\mathcal { L } ( \\mathbf { W _ { S } } , x )\n$$",
|
| 602 |
+
"text_format": "latex",
|
| 603 |
+
"bbox": [
|
| 604 |
+
279,
|
| 605 |
+
472,
|
| 606 |
+
718,
|
| 607 |
+
506
|
| 608 |
+
],
|
| 609 |
+
"page_idx": 5
|
| 610 |
+
},
|
| 611 |
+
{
|
| 612 |
+
"type": "text",
|
| 613 |
+
"text": "So to do an update we first need to do forward and back propagation to get $J _ { S }$ and $J _ { T }$ , compute the second error $ { \\mathbf { \\bar { \\rho } } } _ { 2 } ^ { \\beta } | | J _ { S } - J _ { T } | | _ { 2 }$ and propagate it second time. The second propagation is similar to forward propagation in this case, and involves second order mixed partial derivative calculation ∂2∂WS∂x . The above computation is similar to the double backpropagation technique developed by Drucker & LeCun (1992) (where the $l _ { 2 }$ norm of the gradient w.r.t. input is used as regularizer). Furthermore, it can be implemented efficiently in a framework with automatic differentiation support, even for modern architectures with sophisticated graphs. The second backpropagation has approximately the same cost with first backpropagation, excluding forward propagation. ",
|
| 614 |
+
"bbox": [
|
| 615 |
+
173,
|
| 616 |
+
513,
|
| 617 |
+
825,
|
| 618 |
+
635
|
| 619 |
+
],
|
| 620 |
+
"page_idx": 5
|
| 621 |
+
},
|
| 622 |
+
{
|
| 623 |
+
"type": "text",
|
| 624 |
+
"text": "We also propose to enforce horizontal flip invariance on gradient attention maps. To do that we propagate horizontally flipped images as well as originals, backpropagate and flip gradient attention maps back. We then add $l _ { 2 }$ losses on the obtained attentions and outputs, and do second backpropagation: ",
|
| 625 |
+
"bbox": [
|
| 626 |
+
173,
|
| 627 |
+
640,
|
| 628 |
+
825,
|
| 629 |
+
696
|
| 630 |
+
],
|
| 631 |
+
"page_idx": 5
|
| 632 |
+
},
|
| 633 |
+
{
|
| 634 |
+
"type": "equation",
|
| 635 |
+
"img_path": "images/17423230f75804ce7bab0c6dff0abf0df6b5ff552911035cce3ecf9221bbaeb5.jpg",
|
| 636 |
+
"text": "$$\n\\mathcal { L } _ { s y m } ( \\mathbf { W } , x ) = \\mathcal { L } ( \\mathbf { W } , x ) + \\frac { \\beta } { 2 } | | \\frac { \\partial } { \\partial x } \\mathcal { L } ( \\mathbf { W } , x ) - \\mathrm { H i p } ( \\frac { \\partial } { \\partial x } \\mathcal { L } ( \\mathbf { W } , \\mathrm { H i p } ( x ) ) ) | | _ { 2 } \\ ,\n$$",
|
| 637 |
+
"text_format": "latex",
|
| 638 |
+
"bbox": [
|
| 639 |
+
248,
|
| 640 |
+
698,
|
| 641 |
+
746,
|
| 642 |
+
729
|
| 643 |
+
],
|
| 644 |
+
"page_idx": 5
|
| 645 |
+
},
|
| 646 |
+
{
|
| 647 |
+
"type": "text",
|
| 648 |
+
"text": "where $\\operatorname { f i i p } ( x )$ denotes the flip operator. This is similar to Group Equivariant CNN approach by Cohen & Welling (2016), however it is not a hard constraint. We experimentally find that this has a regularization effect on training. ",
|
| 649 |
+
"bbox": [
|
| 650 |
+
174,
|
| 651 |
+
738,
|
| 652 |
+
825,
|
| 653 |
+
781
|
| 654 |
+
],
|
| 655 |
+
"page_idx": 5
|
| 656 |
+
},
|
| 657 |
+
{
|
| 658 |
+
"type": "text",
|
| 659 |
+
"text": "We should note that in this work we consider only gradients w.r.t. the input layer, but in general one might have the proposed attention transfer and symmetry constraints w.r.t. higher layers of the network. ",
|
| 660 |
+
"bbox": [
|
| 661 |
+
174,
|
| 662 |
+
787,
|
| 663 |
+
825,
|
| 664 |
+
830
|
| 665 |
+
],
|
| 666 |
+
"page_idx": 5
|
| 667 |
+
},
|
| 668 |
+
{
|
| 669 |
+
"type": "text",
|
| 670 |
+
"text": "4 EXPERIMENTAL SECTION ",
|
| 671 |
+
"text_level": 1,
|
| 672 |
+
"bbox": [
|
| 673 |
+
176,
|
| 674 |
+
851,
|
| 675 |
+
415,
|
| 676 |
+
866
|
| 677 |
+
],
|
| 678 |
+
"page_idx": 5
|
| 679 |
+
},
|
| 680 |
+
{
|
| 681 |
+
"type": "text",
|
| 682 |
+
"text": "In the following section we explore attention transfer on various image classification datasets. We split the section in two parts, in the first we include activation-based attention transfer and gradientbased attention transfer experiments on CIFAR, and in the second activation-based attention transfer experiments on larger datasets. For activation-based attention transfer we used Network-InNetwork Lin et al. (2013) and ResNet-based architectures (including the recently introduced Wide Residual Networks (WRN) Zagoruyko & Komodakis (2016)), as they are most performant and set strong baselines in terms of number of parameters compared to AlexNet or VGG, and have been explored in various papers across small and large datasets. On Scenes, CUB and ImageNet we experimented with ResNet-18 and ResNet-34. As for gradient-based attention, we constrained ourselves to Network-In-Network without batch normalization and CIFAR dataset, due to the need of complex automatic differentiation. ",
|
| 683 |
+
"bbox": [
|
| 684 |
+
174,
|
| 685 |
+
882,
|
| 686 |
+
823,
|
| 687 |
+
924
|
| 688 |
+
],
|
| 689 |
+
"page_idx": 5
|
| 690 |
+
},
|
| 691 |
+
{
|
| 692 |
+
"type": "text",
|
| 693 |
+
"text": "",
|
| 694 |
+
"bbox": [
|
| 695 |
+
174,
|
| 696 |
+
103,
|
| 697 |
+
825,
|
| 698 |
+
214
|
| 699 |
+
],
|
| 700 |
+
"page_idx": 6
|
| 701 |
+
},
|
| 702 |
+
{
|
| 703 |
+
"type": "text",
|
| 704 |
+
"text": "4.1 CIFAR EXPERIMENTS ",
|
| 705 |
+
"text_level": 1,
|
| 706 |
+
"bbox": [
|
| 707 |
+
176,
|
| 708 |
+
232,
|
| 709 |
+
367,
|
| 710 |
+
246
|
| 711 |
+
],
|
| 712 |
+
"page_idx": 6
|
| 713 |
+
},
|
| 714 |
+
{
|
| 715 |
+
"type": "text",
|
| 716 |
+
"text": "We start with CIFAR dataset which has small $3 2 \\times 3 2$ images, and after downsampling top activations have even smaller resolution, so there is not much space for attention transfer. Interestingly, even under this adversarial setting, we find that attention transfer seems to give reasonable benefits, offering in all cases consistent improvements. We use horizontal flips and random crops data augmentations, and all networks have batch normalization. We find that ZCA whitening has negative effect on validation accuracy, and omit it in favor of simpler meanstd normalization. We raise Knowledge Distillation (KD) temperature for ResNet transfers to 4, and use $\\alpha = 0 . 9$ (see Hinton et al. (2015) for an explanation of these parameters). ",
|
| 717 |
+
"bbox": [
|
| 718 |
+
174,
|
| 719 |
+
257,
|
| 720 |
+
823,
|
| 721 |
+
369
|
| 722 |
+
],
|
| 723 |
+
"page_idx": 6
|
| 724 |
+
},
|
| 725 |
+
{
|
| 726 |
+
"type": "text",
|
| 727 |
+
"text": "4.1.1 ACTIVATION-BASED ATTENTION TRANSFER ",
|
| 728 |
+
"text_level": 1,
|
| 729 |
+
"bbox": [
|
| 730 |
+
174,
|
| 731 |
+
386,
|
| 732 |
+
529,
|
| 733 |
+
398
|
| 734 |
+
],
|
| 735 |
+
"page_idx": 6
|
| 736 |
+
},
|
| 737 |
+
{
|
| 738 |
+
"type": "text",
|
| 739 |
+
"text": "Results of attention transfer (using $F _ { \\mathrm { s u m } } ^ { 2 }$ attention maps) for various networks on CIFAR-10 can be found in table 1. We experimented with teacher/student having the same depth (WRN-16-2/WRN16-1), as well as different depth (WRN-40-1/WRN-16-1, WRN-40-2/WRN-16-2). In all combinations, attention transfer (AT) shows significant improvements, which are also higher when it is combined with knowledge distillation $( \\mathrm { A T + K D } )$ ). ",
|
| 740 |
+
"bbox": [
|
| 741 |
+
176,
|
| 742 |
+
407,
|
| 743 |
+
823,
|
| 744 |
+
478
|
| 745 |
+
],
|
| 746 |
+
"page_idx": 6
|
| 747 |
+
},
|
| 748 |
+
{
|
| 749 |
+
"type": "table",
|
| 750 |
+
"img_path": "images/457e87329667a3637946d4edcafbba6930d454b5a51d77eef2470e323d963977.jpg",
|
| 751 |
+
"table_caption": [],
|
| 752 |
+
"table_footnote": [],
|
| 753 |
+
"table_body": "<table><tr><td>student</td><td>teacher</td><td>student</td><td>AT</td><td>F-ActT</td><td>KD</td><td>AT+KD</td><td>teacher</td></tr><tr><td>NIN-thin,0.2M</td><td>NIN-wide,1M</td><td>9.38</td><td>8.93</td><td>9.05</td><td>8.55</td><td>8.33</td><td>7.28</td></tr><tr><td>WRN-16-1, 0.2M</td><td>WRN-16-2, 0.7M</td><td>8.77</td><td>7.93</td><td>8.51</td><td>7.41</td><td>7.51</td><td>6.31</td></tr><tr><td>WRN-16-1, 0.2M</td><td>WRN-40-1, 0.6M</td><td>8.77</td><td>8.25</td><td>8.62</td><td>8.39</td><td>8.01</td><td>6.58</td></tr><tr><td>WRN-16-2,0.7M</td><td>WRN-40-2,2.2M</td><td>6.31</td><td>5.85</td><td>6.24</td><td>6.08</td><td>5.71</td><td>5.23</td></tr></table>",
|
| 754 |
+
"bbox": [
|
| 755 |
+
200,
|
| 756 |
+
491,
|
| 757 |
+
797,
|
| 758 |
+
558
|
| 759 |
+
],
|
| 760 |
+
"page_idx": 6
|
| 761 |
+
},
|
| 762 |
+
{
|
| 763 |
+
"type": "text",
|
| 764 |
+
"text": "Table 1: Activation-based attention transfer (AT) with various architectures on CIFAR-10. Error is computed as median of 5 runs with different seed. F-ActT means full-activation transfer (see $\\ S 4 . 1 . 2 )$ . ",
|
| 765 |
+
"bbox": [
|
| 766 |
+
176,
|
| 767 |
+
569,
|
| 768 |
+
823,
|
| 769 |
+
597
|
| 770 |
+
],
|
| 771 |
+
"page_idx": 6
|
| 772 |
+
},
|
| 773 |
+
{
|
| 774 |
+
"type": "text",
|
| 775 |
+
"text": "To verify if having at least one activation-based attention transfer loss per group in WRN transfer is important, we trained three networks with only one transfer loss per network in group1, group2 and group3 separately, and compared to a network trained with all three losses. The corresponding results were 8.11, 7.96, 7.97 (for the separate losses) and 7.93 for the combined loss (using WRN16-2/WRN-16-1 as teacher/student pair). Each loss provides some additional degree of attention transfer. ",
|
| 776 |
+
"bbox": [
|
| 777 |
+
174,
|
| 778 |
+
612,
|
| 779 |
+
825,
|
| 780 |
+
695
|
| 781 |
+
],
|
| 782 |
+
"page_idx": 6
|
| 783 |
+
},
|
| 784 |
+
{
|
| 785 |
+
"type": "text",
|
| 786 |
+
"text": "We also explore which attention mapping functions tend to work best using WRN-16-1 and WRN16-2 as student and teacher networks respectively (table 2). Interestingly, sum-based functions work very similar, and better than max-based ones. From now on, we will use sum of squared attention mapping function $F _ { \\mathrm { s u m } } ^ { 2 }$ for simplicity. As for parameter $\\beta$ in eq. 2, it usually varies about 0.1, as we set it to $\\mathrm { \\bar { 1 0 ^ { 3 } } }$ divided by number of elements in attention map and batch size for each layer. In case of combinining AT with KD we decay it during traning in order to simplify learning harder examples. ",
|
| 787 |
+
"bbox": [
|
| 788 |
+
174,
|
| 789 |
+
703,
|
| 790 |
+
825,
|
| 791 |
+
786
|
| 792 |
+
],
|
| 793 |
+
"page_idx": 6
|
| 794 |
+
},
|
| 795 |
+
{
|
| 796 |
+
"type": "text",
|
| 797 |
+
"text": "4.1.2 ACTIVATION-BASED AT VS. TRANSFERRING FULL ACTIVATION ",
|
| 798 |
+
"text_level": 1,
|
| 799 |
+
"bbox": [
|
| 800 |
+
176,
|
| 801 |
+
801,
|
| 802 |
+
663,
|
| 803 |
+
815
|
| 804 |
+
],
|
| 805 |
+
"page_idx": 6
|
| 806 |
+
},
|
| 807 |
+
{
|
| 808 |
+
"type": "text",
|
| 809 |
+
"text": "To check if transferring information from full activation tensors is more beneficial than from attention maps, we experimented with FitNets-style hints using $l _ { 2 }$ losses on full activations directly, with $1 \\times 1$ convolutional layers to match tensor shapes, and found that improvements over baseline student were minimal (see column F-ActT in table 1). For networks of the same width different depth we tried to regress directly to activations, without $1 \\times 1$ convolutions. We also use $l _ { 2 }$ normalization before transfer losses, and decay $\\beta$ in eq. 2 during training as these give better performance. We find that AT, as well as full-activation transfer, greatly speeds up convergence, but AT gives much better final accuracy improvement than full-activation transfer (see fig. 7(b), Appendix). It seems quite interesting that attention maps carry information that is more important for transfer than full activations. ",
|
| 810 |
+
"bbox": [
|
| 811 |
+
174,
|
| 812 |
+
825,
|
| 813 |
+
823,
|
| 814 |
+
924
|
| 815 |
+
],
|
| 816 |
+
"page_idx": 6
|
| 817 |
+
},
|
| 818 |
+
{
|
| 819 |
+
"type": "text",
|
| 820 |
+
"text": "",
|
| 821 |
+
"bbox": [
|
| 822 |
+
173,
|
| 823 |
+
103,
|
| 824 |
+
825,
|
| 825 |
+
146
|
| 826 |
+
],
|
| 827 |
+
"page_idx": 7
|
| 828 |
+
},
|
| 829 |
+
{
|
| 830 |
+
"type": "table",
|
| 831 |
+
"img_path": "images/fa42ab76995dcaf083f9b8b726cd4c931eadab7bd69140b85762df9ed202d66d.jpg",
|
| 832 |
+
"table_caption": [],
|
| 833 |
+
"table_footnote": [],
|
| 834 |
+
"table_body": "<table><tr><td>norm type</td><td>error</td></tr><tr><td>baseline (no attention transfer) min-l2 Drucker & LeCun (1992) grad-based AT KD symmetry norm activation-based AT</td><td>13.5 12.5 12.1 12.1 11.8 11.2</td></tr></table>",
|
| 835 |
+
"bbox": [
|
| 836 |
+
500,
|
| 837 |
+
150,
|
| 838 |
+
763,
|
| 839 |
+
242
|
| 840 |
+
],
|
| 841 |
+
"page_idx": 7
|
| 842 |
+
},
|
| 843 |
+
{
|
| 844 |
+
"type": "table",
|
| 845 |
+
"img_path": "images/e993fc2fc74b0f9ba78d5d39b5f03f1cc654e5872b107df249412fe3d3f03195.jpg",
|
| 846 |
+
"table_caption": [
|
| 847 |
+
"Table 2: Test error of WRN16-2/WRN-16-1 teacher/student pair for various attention mapping functions. Median of 5 runs test errors are reported. ",
|
| 848 |
+
"Table 3: Performance of various gradient-based attention methods on CIFAR-10. Baseline is a thin NIN network with ${ \\bf 0 . 2 M }$ parameters (trained only on horizontally flipped augmented data and without batch normalization), min- $\\mathbf { \\cdot } l _ { 2 }$ refers to using $l _ { 2 }$ norm of gradient w.r.t. input as regularizer, symmetry norm - to using flip invariance on gradient attention maps (see eq. 6), AT - to attention transfer, and KD - to Knowledge Distillation (both AT and KD use a wide NIN of 1M parameters as teacher). "
|
| 849 |
+
],
|
| 850 |
+
"table_footnote": [],
|
| 851 |
+
"table_body": "<table><tr><td>attention mapping function</td><td>error</td></tr><tr><td>no attention transfer Fsum</td><td>8.77 7.99 7.93</td></tr></table>",
|
| 852 |
+
"bbox": [
|
| 853 |
+
173,
|
| 854 |
+
176,
|
| 855 |
+
403,
|
| 856 |
+
257
|
| 857 |
+
],
|
| 858 |
+
"page_idx": 7
|
| 859 |
+
},
|
| 860 |
+
{
|
| 861 |
+
"type": "text",
|
| 862 |
+
"text": "4.1.3 GRADIENT-BASED ATTENTION TRANSFER ",
|
| 863 |
+
"text_level": 1,
|
| 864 |
+
"bbox": [
|
| 865 |
+
174,
|
| 866 |
+
383,
|
| 867 |
+
516,
|
| 868 |
+
397
|
| 869 |
+
],
|
| 870 |
+
"page_idx": 7
|
| 871 |
+
},
|
| 872 |
+
{
|
| 873 |
+
"type": "text",
|
| 874 |
+
"text": "For simplicity we use thin Network-In-Network model in these experiments, and don’t apply random crop data augmentation with batch normalization, just horizontal flips augmentation. We also only use deterministic algorithms and sampling with fixed seed, so reported numbers are for single run experiments. We find that in this setting network struggles to fit into training data already, and turn off weight decay even for baseline experiments. In future we plan to explore gradient-based attention for teacher-student pairs that make use of batch normalization, because it is so far unclear how batch normalization should behave in the second backpropagation step required during gradientbased attention transfer (e.g., should it contribute to batch normalization parameters, or is a separate forward propagation with fixed parameters needed). ",
|
| 875 |
+
"bbox": [
|
| 876 |
+
174,
|
| 877 |
+
407,
|
| 878 |
+
825,
|
| 879 |
+
534
|
| 880 |
+
],
|
| 881 |
+
"page_idx": 7
|
| 882 |
+
},
|
| 883 |
+
{
|
| 884 |
+
"type": "text",
|
| 885 |
+
"text": "We explored the following methods: ",
|
| 886 |
+
"bbox": [
|
| 887 |
+
176,
|
| 888 |
+
540,
|
| 889 |
+
413,
|
| 890 |
+
555
|
| 891 |
+
],
|
| 892 |
+
"page_idx": 7
|
| 893 |
+
},
|
| 894 |
+
{
|
| 895 |
+
"type": "text",
|
| 896 |
+
"text": "• Minimizing $l _ { 2 }$ norm of gradient w.r.t. input, i.e. the double backpropagation method Drucker & LeCun (1992); \n• Symmetry norm on gradient attention maps (see eq. 6); \n• Student-teacher gradient-based attention transfer; \n• Student-teacher activation-based attention transfer. ",
|
| 897 |
+
"bbox": [
|
| 898 |
+
215,
|
| 899 |
+
570,
|
| 900 |
+
823,
|
| 901 |
+
665
|
| 902 |
+
],
|
| 903 |
+
"page_idx": 7
|
| 904 |
+
},
|
| 905 |
+
{
|
| 906 |
+
"type": "text",
|
| 907 |
+
"text": "Results for various methods are shown in table 3. Interestingly, just minimizing $l _ { 2 }$ norm of gradient already works pretty well. Also, symmetry norm is one the best performing attention norms, which we plan to investigate in future on other datasets as well. We also observe that, similar to activationbased attention transfer, using gradient-based attention transfer leads to improved performance. We also trained a network with activation-based AT in the same training conditions, which resulted in the best performance among all methods. We should note that the architecture of student NIN without batch normalization is slightly different from teacher network, it doesn’t have ReLU activations before pooling layers, which leads to better performance without batch normalization, and worse with. So to achieve the best performance with activation-based AT we had to train a new teacher, with batch normalization and without ReLU activations before pooling layers, and have AT losses on outputs of convolutional layers. ",
|
| 908 |
+
"bbox": [
|
| 909 |
+
173,
|
| 910 |
+
680,
|
| 911 |
+
825,
|
| 912 |
+
833
|
| 913 |
+
],
|
| 914 |
+
"page_idx": 7
|
| 915 |
+
},
|
| 916 |
+
{
|
| 917 |
+
"type": "text",
|
| 918 |
+
"text": "4.2 LARGE INPUT IMAGE NETWORKS ",
|
| 919 |
+
"text_level": 1,
|
| 920 |
+
"bbox": [
|
| 921 |
+
176,
|
| 922 |
+
854,
|
| 923 |
+
442,
|
| 924 |
+
867
|
| 925 |
+
],
|
| 926 |
+
"page_idx": 7
|
| 927 |
+
},
|
| 928 |
+
{
|
| 929 |
+
"type": "text",
|
| 930 |
+
"text": "In this section we experiment with hidden activation attention transfer on ImageNet networks which have $2 2 4 \\times 2 2 4$ input image size. Presumably, attention matters more in this kind of networks as spatial resolution of attention maps is higher. ",
|
| 931 |
+
"bbox": [
|
| 932 |
+
176,
|
| 933 |
+
882,
|
| 934 |
+
823,
|
| 935 |
+
924
|
| 936 |
+
],
|
| 937 |
+
"page_idx": 7
|
| 938 |
+
},
|
| 939 |
+
{
|
| 940 |
+
"type": "table",
|
| 941 |
+
"img_path": "images/aa326066a7003553cbde413286cb73a50f53244db58c482a4b29f28497c4f47a.jpg",
|
| 942 |
+
"table_caption": [
|
| 943 |
+
"Table 4: Finetuning with attention transfer error on Scenes and CUB datasets "
|
| 944 |
+
],
|
| 945 |
+
"table_footnote": [],
|
| 946 |
+
"table_body": "<table><tr><td>type</td><td>model</td><td>ImageNet-→CUB</td><td>ImageNet-→Scenes</td></tr><tr><td>student</td><td>ResNet-18</td><td>28.5</td><td>28.2</td></tr><tr><td>KD</td><td>ResNet-18</td><td>27 (-1.5)</td><td>28.1 (-0.1)</td></tr><tr><td>AT</td><td>ResNet-18</td><td>27 (-1.5)</td><td>27.1 (-1.1)</td></tr><tr><td>teacher</td><td>ResNet-34</td><td>26.5</td><td>26</td></tr></table>",
|
| 947 |
+
"bbox": [
|
| 948 |
+
297,
|
| 949 |
+
97,
|
| 950 |
+
700,
|
| 951 |
+
164
|
| 952 |
+
],
|
| 953 |
+
"page_idx": 8
|
| 954 |
+
},
|
| 955 |
+
{
|
| 956 |
+
"type": "text",
|
| 957 |
+
"text": "4.2.1 TRANSFER LEARNING ",
|
| 958 |
+
"text_level": 1,
|
| 959 |
+
"bbox": [
|
| 960 |
+
174,
|
| 961 |
+
213,
|
| 962 |
+
382,
|
| 963 |
+
228
|
| 964 |
+
],
|
| 965 |
+
"page_idx": 8
|
| 966 |
+
},
|
| 967 |
+
{
|
| 968 |
+
"type": "text",
|
| 969 |
+
"text": "To see how attention transfer works in finetuning we choose two datasets: Caltech-UCSD Birds-200- 2011 fine-grained classification (CUB) by Wah et al. (2011), and MIT indoor scene classification (Scenes) by Quattoni & Torralba (2009), both containing around 5K images training images. We took ResNet-18 and ResNet-34 pretrained on ImageNet and finetuned on both datasets. On CUB we crop bounding boxes, rescale to 256 in one dimension and then take a random crop. Batch normalization layers are fixed for finetuning, and first group of residual blocks is frozen. We then took finetuned ResNet-34 networks and used them as teachers for ResNet-18 pretrained on ImageNet, with $F _ { \\mathrm { s u m } } ^ { 2 }$ attention losses on 2 last groups. In both cases attention transfer provides significant improvements, closing the gap between ResNet-18 and ResNet-34 in accuracy. On Scenes AT works as well as KD, and on CUB AT works much better, which we speculate is due to importance of intermediate attention for fine-grained recognition. Moreover, after finetuning, student’s attention maps indeed look more similar to teacher’s (Fig. 6, Appendix). ",
|
| 970 |
+
"bbox": [
|
| 971 |
+
174,
|
| 972 |
+
238,
|
| 973 |
+
825,
|
| 974 |
+
405
|
| 975 |
+
],
|
| 976 |
+
"page_idx": 8
|
| 977 |
+
},
|
| 978 |
+
{
|
| 979 |
+
"type": "text",
|
| 980 |
+
"text": "4.2.2 IMAGENET ",
|
| 981 |
+
"text_level": 1,
|
| 982 |
+
"bbox": [
|
| 983 |
+
176,
|
| 984 |
+
419,
|
| 985 |
+
305,
|
| 986 |
+
434
|
| 987 |
+
],
|
| 988 |
+
"page_idx": 8
|
| 989 |
+
},
|
| 990 |
+
{
|
| 991 |
+
"type": "text",
|
| 992 |
+
"text": "To showcase activation-based attention transfer on ImageNet we took ResNet-18 as a student, and ResNet-34 as a teacher, and tried to improve ResNet-18 accuracy. We added only two losses in the 2 last groups of residual blocks and used squared sum attention $F _ { \\mathrm { s u m } } ^ { 2 }$ . We also did not have time to tune any hyperparameters and kept them from finetuning experiments. Nevertheless, ResNet-18 with attention transfer achieved $1 . 1 \\%$ top-1 and $0 . 8 \\%$ top-5 better validation accuracy (Table. 5 and Fig. 7(a), Appendix), we plan to update the paper with losses on all 4 groups of residual blocks. ",
|
| 993 |
+
"bbox": [
|
| 994 |
+
174,
|
| 995 |
+
444,
|
| 996 |
+
825,
|
| 997 |
+
527
|
| 998 |
+
],
|
| 999 |
+
"page_idx": 8
|
| 1000 |
+
},
|
| 1001 |
+
{
|
| 1002 |
+
"type": "text",
|
| 1003 |
+
"text": "We were not able to achieve positive results with KD on ImageNet. With ResNet-18-ResNet-34 student-teacher pair it actually hurts convergence with the same hyperparameters as on CIFAR. As it was reported that KD struggles to work if teacher and student have different architecture/depth (we observe the same on CIFAR), so we tried using the same architecture and depth for attention transfer. On CIFAR both AT and KD work well in this case and improve convergence and final accuracy, on ImageNet though KD converges significantly slower (we did not train until the end due to lack of computational resources). We also could not find applications of FitNets, KD or similar methods on ImageNet in the literature. Given that, we can assume that proposed activation-based AT is the first knowledge transfer method to be successfully applied on ImageNet. ",
|
| 1004 |
+
"bbox": [
|
| 1005 |
+
174,
|
| 1006 |
+
534,
|
| 1007 |
+
825,
|
| 1008 |
+
660
|
| 1009 |
+
],
|
| 1010 |
+
"page_idx": 8
|
| 1011 |
+
},
|
| 1012 |
+
{
|
| 1013 |
+
"type": "text",
|
| 1014 |
+
"text": "5 CONCLUSIONS ",
|
| 1015 |
+
"text_level": 1,
|
| 1016 |
+
"bbox": [
|
| 1017 |
+
176,
|
| 1018 |
+
679,
|
| 1019 |
+
328,
|
| 1020 |
+
695
|
| 1021 |
+
],
|
| 1022 |
+
"page_idx": 8
|
| 1023 |
+
},
|
| 1024 |
+
{
|
| 1025 |
+
"type": "text",
|
| 1026 |
+
"text": "We presented several ways of transferring attention from one network to another, with experimental results over several image recognition datasets. It would be interesting to see how attention transfer works in cases where spatial information is more important, e.g. object detection or weaklysupervised localization, which is something that we plan to explore in the future. ",
|
| 1027 |
+
"bbox": [
|
| 1028 |
+
176,
|
| 1029 |
+
710,
|
| 1030 |
+
823,
|
| 1031 |
+
766
|
| 1032 |
+
],
|
| 1033 |
+
"page_idx": 8
|
| 1034 |
+
},
|
| 1035 |
+
{
|
| 1036 |
+
"type": "text",
|
| 1037 |
+
"text": "Overall, we think that our interesting findings will help further advance knowledge distillation, and understanding convolutional neural networks in general. ",
|
| 1038 |
+
"bbox": [
|
| 1039 |
+
174,
|
| 1040 |
+
772,
|
| 1041 |
+
823,
|
| 1042 |
+
801
|
| 1043 |
+
],
|
| 1044 |
+
"page_idx": 8
|
| 1045 |
+
},
|
| 1046 |
+
{
|
| 1047 |
+
"type": "text",
|
| 1048 |
+
"text": "REFERENCES ",
|
| 1049 |
+
"text_level": 1,
|
| 1050 |
+
"bbox": [
|
| 1051 |
+
176,
|
| 1052 |
+
821,
|
| 1053 |
+
287,
|
| 1054 |
+
837
|
| 1055 |
+
],
|
| 1056 |
+
"page_idx": 8
|
| 1057 |
+
},
|
| 1058 |
+
{
|
| 1059 |
+
"type": "text",
|
| 1060 |
+
"text": "Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. Neural machine translation by jointly learning to align and translate. CoRR, abs/1409.0473, 2014. URL http://arxiv.org/ abs/1409.0473. ",
|
| 1061 |
+
"bbox": [
|
| 1062 |
+
174,
|
| 1063 |
+
844,
|
| 1064 |
+
823,
|
| 1065 |
+
887
|
| 1066 |
+
],
|
| 1067 |
+
"page_idx": 8
|
| 1068 |
+
},
|
| 1069 |
+
{
|
| 1070 |
+
"type": "text",
|
| 1071 |
+
"text": "Cristian Bucila, Rich Caruana, and Alexandru Niculescu-Mizil. Model compression. In KDD, pp. 535–541, 2006. ",
|
| 1072 |
+
"bbox": [
|
| 1073 |
+
174,
|
| 1074 |
+
895,
|
| 1075 |
+
820,
|
| 1076 |
+
922
|
| 1077 |
+
],
|
| 1078 |
+
"page_idx": 8
|
| 1079 |
+
},
|
| 1080 |
+
{
|
| 1081 |
+
"type": "text",
|
| 1082 |
+
"text": "Taco S. Cohen and Max Welling. Group equivariant convolutional networks. CoRR, abs/1602.07576, 2016. URL http://arxiv.org/abs/1602.07576. ",
|
| 1083 |
+
"bbox": [
|
| 1084 |
+
171,
|
| 1085 |
+
103,
|
| 1086 |
+
825,
|
| 1087 |
+
133
|
| 1088 |
+
],
|
| 1089 |
+
"page_idx": 9
|
| 1090 |
+
},
|
| 1091 |
+
{
|
| 1092 |
+
"type": "text",
|
| 1093 |
+
"text": "Misha Denil, Loris Bazzani, Hugo Larochelle, and Nando de Freitas. Learning where to attend with deep architectures for image tracking. Neural Computation, 2012. ",
|
| 1094 |
+
"bbox": [
|
| 1095 |
+
171,
|
| 1096 |
+
140,
|
| 1097 |
+
823,
|
| 1098 |
+
169
|
| 1099 |
+
],
|
| 1100 |
+
"page_idx": 9
|
| 1101 |
+
},
|
| 1102 |
+
{
|
| 1103 |
+
"type": "text",
|
| 1104 |
+
"text": "H. Drucker and Y LeCun. Improving generalization performance using double backpropagation. IEEE Transaction on Neural Networks, 3(6):991–997, 1992. ",
|
| 1105 |
+
"bbox": [
|
| 1106 |
+
173,
|
| 1107 |
+
176,
|
| 1108 |
+
821,
|
| 1109 |
+
205
|
| 1110 |
+
],
|
| 1111 |
+
"page_idx": 9
|
| 1112 |
+
},
|
| 1113 |
+
{
|
| 1114 |
+
"type": "text",
|
| 1115 |
+
"text": "Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. CoRR, abs/1512.03385, 2015. ",
|
| 1116 |
+
"bbox": [
|
| 1117 |
+
176,
|
| 1118 |
+
213,
|
| 1119 |
+
821,
|
| 1120 |
+
242
|
| 1121 |
+
],
|
| 1122 |
+
"page_idx": 9
|
| 1123 |
+
},
|
| 1124 |
+
{
|
| 1125 |
+
"type": "text",
|
| 1126 |
+
"text": "Geoffrey E. Hinton, Oriol Vinyals, and Jeff Dean. Distilling the knowledge in a neural networks. 2015. ",
|
| 1127 |
+
"bbox": [
|
| 1128 |
+
173,
|
| 1129 |
+
250,
|
| 1130 |
+
823,
|
| 1131 |
+
279
|
| 1132 |
+
],
|
| 1133 |
+
"page_idx": 9
|
| 1134 |
+
},
|
| 1135 |
+
{
|
| 1136 |
+
"type": "text",
|
| 1137 |
+
"text": "Hugo Larochelle and Geoffrey E. Hinton. Learning to combine foveal glimpses with a third-order boltzmann machine. In J. D. Lafferty, C. K. I. Williams, J. Shawe-Taylor, R. S. Zemel, and A. Culotta (eds.), Advances in Neural Information Processing Systems 23, pp. 1243–1251. Curran Associates, Inc., 2010. ",
|
| 1138 |
+
"bbox": [
|
| 1139 |
+
173,
|
| 1140 |
+
285,
|
| 1141 |
+
826,
|
| 1142 |
+
343
|
| 1143 |
+
],
|
| 1144 |
+
"page_idx": 9
|
| 1145 |
+
},
|
| 1146 |
+
{
|
| 1147 |
+
"type": "text",
|
| 1148 |
+
"text": "Jimmy Ba Lei and Rich Caruana. Do deep nets really need to be deep? In NIPS, 2014. ",
|
| 1149 |
+
"bbox": [
|
| 1150 |
+
173,
|
| 1151 |
+
349,
|
| 1152 |
+
741,
|
| 1153 |
+
366
|
| 1154 |
+
],
|
| 1155 |
+
"page_idx": 9
|
| 1156 |
+
},
|
| 1157 |
+
{
|
| 1158 |
+
"type": "text",
|
| 1159 |
+
"text": "Min Lin, Qiang Chen, and Shuicheng Yan. Network in network. CoRR, abs/1312.4400, 2013. ",
|
| 1160 |
+
"bbox": [
|
| 1161 |
+
171,
|
| 1162 |
+
373,
|
| 1163 |
+
787,
|
| 1164 |
+
388
|
| 1165 |
+
],
|
| 1166 |
+
"page_idx": 9
|
| 1167 |
+
},
|
| 1168 |
+
{
|
| 1169 |
+
"type": "text",
|
| 1170 |
+
"text": "Volodymyr Mnih, Nicolas Heess, Alex Graves, and koray kavukcuoglu. Recurrent models of visual attention. In Z. Ghahramani, M. Welling, C. Cortes, N. D. Lawrence, and K. Q. Weinberger (eds.), Advances in Neural Information Processing Systems 27, pp. 2204–2212. Curran Associates, Inc., 2014. URL http://papers.nips.cc/paper/ 5542-recurrent-models-of-visual-attention.pdf. ",
|
| 1171 |
+
"bbox": [
|
| 1172 |
+
173,
|
| 1173 |
+
396,
|
| 1174 |
+
825,
|
| 1175 |
+
467
|
| 1176 |
+
],
|
| 1177 |
+
"page_idx": 9
|
| 1178 |
+
},
|
| 1179 |
+
{
|
| 1180 |
+
"type": "text",
|
| 1181 |
+
"text": "M. Oquab, L. Bottou, I. Laptev, and J. Sivic. Is object localization for free? weakly-supervised learning with convolutional neural networks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, 2015. ",
|
| 1182 |
+
"bbox": [
|
| 1183 |
+
173,
|
| 1184 |
+
474,
|
| 1185 |
+
823,
|
| 1186 |
+
517
|
| 1187 |
+
],
|
| 1188 |
+
"page_idx": 9
|
| 1189 |
+
},
|
| 1190 |
+
{
|
| 1191 |
+
"type": "text",
|
| 1192 |
+
"text": "O. M. Parkhi, A. Vedaldi, and A. Zisserman. Deep face recognition. In British Machine Vision Conference, 2015. ",
|
| 1193 |
+
"bbox": [
|
| 1194 |
+
173,
|
| 1195 |
+
523,
|
| 1196 |
+
821,
|
| 1197 |
+
554
|
| 1198 |
+
],
|
| 1199 |
+
"page_idx": 9
|
| 1200 |
+
},
|
| 1201 |
+
{
|
| 1202 |
+
"type": "text",
|
| 1203 |
+
"text": "A. Quattoni and A. Torralba. Recognizing indoor scenes. In CVPR, 2009. ",
|
| 1204 |
+
"bbox": [
|
| 1205 |
+
174,
|
| 1206 |
+
560,
|
| 1207 |
+
661,
|
| 1208 |
+
577
|
| 1209 |
+
],
|
| 1210 |
+
"page_idx": 9
|
| 1211 |
+
},
|
| 1212 |
+
{
|
| 1213 |
+
"type": "text",
|
| 1214 |
+
"text": "Ronald A. Rensink. The dynamic representation of scenes. In Visual Cognition, pp. 17–42, 2000. ",
|
| 1215 |
+
"bbox": [
|
| 1216 |
+
173,
|
| 1217 |
+
583,
|
| 1218 |
+
808,
|
| 1219 |
+
599
|
| 1220 |
+
],
|
| 1221 |
+
"page_idx": 9
|
| 1222 |
+
},
|
| 1223 |
+
{
|
| 1224 |
+
"type": "text",
|
| 1225 |
+
"text": "Adriana Romero, Nicolas Ballas, Samira Ebrahimi Kahou, Antoine Chassang, Carlo Gatta, and Yoshua Bengio. FitNets: Hints for thin deep nets. Technical Report Arxiv report 1412.6550, arXiv, 2014. ",
|
| 1226 |
+
"bbox": [
|
| 1227 |
+
174,
|
| 1228 |
+
606,
|
| 1229 |
+
823,
|
| 1230 |
+
648
|
| 1231 |
+
],
|
| 1232 |
+
"page_idx": 9
|
| 1233 |
+
},
|
| 1234 |
+
{
|
| 1235 |
+
"type": "text",
|
| 1236 |
+
"text": "Ramprasaath R. Selvaraju, Abhishek Das, Ramakrishna Vedantam, Devi Parikh, and Dhruv Batra. Grad-cam: Why did you say that? visual explanations from deep networks via gradient-based localization. 2016. ",
|
| 1237 |
+
"bbox": [
|
| 1238 |
+
173,
|
| 1239 |
+
656,
|
| 1240 |
+
821,
|
| 1241 |
+
700
|
| 1242 |
+
],
|
| 1243 |
+
"page_idx": 9
|
| 1244 |
+
},
|
| 1245 |
+
{
|
| 1246 |
+
"type": "text",
|
| 1247 |
+
"text": "Karen Simonyan, Andrea Vedaldi, and Andrew Zisserman. Deep inside convolutional networks: Visualising image classification models and saliency maps. In ICLR Workshop, 2014. ",
|
| 1248 |
+
"bbox": [
|
| 1249 |
+
173,
|
| 1250 |
+
707,
|
| 1251 |
+
821,
|
| 1252 |
+
737
|
| 1253 |
+
],
|
| 1254 |
+
"page_idx": 9
|
| 1255 |
+
},
|
| 1256 |
+
{
|
| 1257 |
+
"type": "text",
|
| 1258 |
+
"text": "J. T. Springenberg, A. Dosovitskiy, T. Brox, and M. Riedmiller. Striving for simplicity: The all convolutional net. In arXiv:1412.6806, also appeared at ICLR 2015 Workshop Track, 2015. URL http://arxiv.org/abs/1412.6806. ",
|
| 1259 |
+
"bbox": [
|
| 1260 |
+
174,
|
| 1261 |
+
743,
|
| 1262 |
+
821,
|
| 1263 |
+
786
|
| 1264 |
+
],
|
| 1265 |
+
"page_idx": 9
|
| 1266 |
+
},
|
| 1267 |
+
{
|
| 1268 |
+
"type": "text",
|
| 1269 |
+
"text": "Rupesh Kumar Srivastava, Klaus Greff, and Jurgen Schmidhuber. Highway networks. ¨ CoRR, abs/1505.00387, 2015. ",
|
| 1270 |
+
"bbox": [
|
| 1271 |
+
171,
|
| 1272 |
+
794,
|
| 1273 |
+
821,
|
| 1274 |
+
824
|
| 1275 |
+
],
|
| 1276 |
+
"page_idx": 9
|
| 1277 |
+
},
|
| 1278 |
+
{
|
| 1279 |
+
"type": "text",
|
| 1280 |
+
"text": "C. Wah, S. Branson, P. Welinder, P. Perona, and S. Belongie. The Caltech-UCSD Birds-200-2011 Dataset. Technical Report CNS-TR-2011-001, California Institute of Technology, 2011. ",
|
| 1281 |
+
"bbox": [
|
| 1282 |
+
171,
|
| 1283 |
+
830,
|
| 1284 |
+
823,
|
| 1285 |
+
859
|
| 1286 |
+
],
|
| 1287 |
+
"page_idx": 9
|
| 1288 |
+
},
|
| 1289 |
+
{
|
| 1290 |
+
"type": "text",
|
| 1291 |
+
"text": "Kelvin Xu, Jimmy Ba, Ryan Kiros, Kyunghyun Cho, Aaron C. Courville, Ruslan Salakhutdinov, Richard S. Zemel, and Yoshua Bengio. Show, attend and tell: Neural image caption generation with visual attention. CoRR, abs/1502.03044, 2015. URL http://arxiv.org/abs/1502. 03044. ",
|
| 1292 |
+
"bbox": [
|
| 1293 |
+
174,
|
| 1294 |
+
867,
|
| 1295 |
+
825,
|
| 1296 |
+
922
|
| 1297 |
+
],
|
| 1298 |
+
"page_idx": 9
|
| 1299 |
+
},
|
| 1300 |
+
{
|
| 1301 |
+
"type": "text",
|
| 1302 |
+
"text": "Zichao Yang, Xiaodong He, Jianfeng Gao, Li Deng, and Alexander J. Smola. Stacked attention networks for image question answering. CoRR, abs/1511.02274, 2015. URL http://arxiv. org/abs/1511.02274. ",
|
| 1303 |
+
"bbox": [
|
| 1304 |
+
174,
|
| 1305 |
+
103,
|
| 1306 |
+
823,
|
| 1307 |
+
145
|
| 1308 |
+
],
|
| 1309 |
+
"page_idx": 10
|
| 1310 |
+
},
|
| 1311 |
+
{
|
| 1312 |
+
"type": "text",
|
| 1313 |
+
"text": "Sergey Zagoruyko and Nikos Komodakis. Wide residual networks. In BMVC, 2016. ",
|
| 1314 |
+
"bbox": [
|
| 1315 |
+
174,
|
| 1316 |
+
155,
|
| 1317 |
+
727,
|
| 1318 |
+
170
|
| 1319 |
+
],
|
| 1320 |
+
"page_idx": 10
|
| 1321 |
+
},
|
| 1322 |
+
{
|
| 1323 |
+
"type": "text",
|
| 1324 |
+
"text": "Matthew Zeiler and Rob Fergus. Visualizing and understanding convolutional networks. In ECCV, 2014. ",
|
| 1325 |
+
"bbox": [
|
| 1326 |
+
171,
|
| 1327 |
+
179,
|
| 1328 |
+
823,
|
| 1329 |
+
208
|
| 1330 |
+
],
|
| 1331 |
+
"page_idx": 10
|
| 1332 |
+
},
|
| 1333 |
+
{
|
| 1334 |
+
"type": "text",
|
| 1335 |
+
"text": "Bolei Zhou, Aditya Khosla, Agata Lapedriza, Aude Oliva, and Antonio Torralba. Learning deep features for discriminative localization. In Computer Vision and Pattern Recognition, 2016. ",
|
| 1336 |
+
"bbox": [
|
| 1337 |
+
173,
|
| 1338 |
+
217,
|
| 1339 |
+
825,
|
| 1340 |
+
246
|
| 1341 |
+
],
|
| 1342 |
+
"page_idx": 10
|
| 1343 |
+
},
|
| 1344 |
+
{
|
| 1345 |
+
"type": "text",
|
| 1346 |
+
"text": "A APPENDIX ",
|
| 1347 |
+
"text_level": 1,
|
| 1348 |
+
"bbox": [
|
| 1349 |
+
176,
|
| 1350 |
+
103,
|
| 1351 |
+
299,
|
| 1352 |
+
117
|
| 1353 |
+
],
|
| 1354 |
+
"page_idx": 11
|
| 1355 |
+
},
|
| 1356 |
+
{
|
| 1357 |
+
"type": "text",
|
| 1358 |
+
"text": "A.1 FIGURES AND TABLES ",
|
| 1359 |
+
"text_level": 1,
|
| 1360 |
+
"bbox": [
|
| 1361 |
+
176,
|
| 1362 |
+
135,
|
| 1363 |
+
372,
|
| 1364 |
+
147
|
| 1365 |
+
],
|
| 1366 |
+
"page_idx": 11
|
| 1367 |
+
},
|
| 1368 |
+
{
|
| 1369 |
+
"type": "image",
|
| 1370 |
+
"img_path": "images/a6852adc648143a8da669a4269ab0c67e38607b3d22191a3838c564f0afd6901.jpg",
|
| 1371 |
+
"image_caption": [
|
| 1372 |
+
"Figure 6: Top activation attention maps for different Scenes networks: original pretrained ResNet-18 (ResNet-18-ImageNet), ResNet-18 trained on Scenes (ResNet-18-scenes), ResNet-18 trained with attention transfer (ResNet-18-scenes-AT) with ResNet-34 as a teacher, ResNet-34 trained on Scenes (ResNet-34-scenes). Predicted classes for each task are shown on top. Attention maps look more similar after transfer (images taken from test set). "
|
| 1373 |
+
],
|
| 1374 |
+
"image_footnote": [],
|
| 1375 |
+
"bbox": [
|
| 1376 |
+
243,
|
| 1377 |
+
160,
|
| 1378 |
+
772,
|
| 1379 |
+
433
|
| 1380 |
+
],
|
| 1381 |
+
"page_idx": 11
|
| 1382 |
+
},
|
| 1383 |
+
{
|
| 1384 |
+
"type": "image",
|
| 1385 |
+
"img_path": "images/c20211c1047b61992778f2016adb04f866db4ac50dc4d94cb2703c8c36f78489.jpg",
|
| 1386 |
+
"image_caption": [
|
| 1387 |
+
"(a) Attention transfer on ImageNet between ResNet18 and ResNet-34. Solid lines represent top-5 validation error, dashed - top-5 training error. Two attention transfer losses were used on the outputs of two last groups of residual blocks respectively, no KD losses used. "
|
| 1388 |
+
],
|
| 1389 |
+
"image_footnote": [],
|
| 1390 |
+
"bbox": [
|
| 1391 |
+
184,
|
| 1392 |
+
546,
|
| 1393 |
+
482,
|
| 1394 |
+
698
|
| 1395 |
+
],
|
| 1396 |
+
"page_idx": 11
|
| 1397 |
+
},
|
| 1398 |
+
{
|
| 1399 |
+
"type": "image",
|
| 1400 |
+
"img_path": "images/559c91e539374d17e840fd28649202f9f0b10146b4b0ea025da1995c2f8e48b2.jpg",
|
| 1401 |
+
"image_caption": [],
|
| 1402 |
+
"image_footnote": [],
|
| 1403 |
+
"bbox": [
|
| 1404 |
+
511,
|
| 1405 |
+
546,
|
| 1406 |
+
810,
|
| 1407 |
+
698
|
| 1408 |
+
],
|
| 1409 |
+
"page_idx": 11
|
| 1410 |
+
},
|
| 1411 |
+
{
|
| 1412 |
+
"type": "text",
|
| 1413 |
+
"text": "(b) Activation attention transfer on CIFAR-10 from WRN-16-2 to WRN-16-1. Test error is in bold, train error is in dashed lines. Attention transfer greatly speeds up convergence and improves final accuracy. ",
|
| 1414 |
+
"bbox": [
|
| 1415 |
+
503,
|
| 1416 |
+
704,
|
| 1417 |
+
818,
|
| 1418 |
+
756
|
| 1419 |
+
],
|
| 1420 |
+
"page_idx": 11
|
| 1421 |
+
},
|
| 1422 |
+
{
|
| 1423 |
+
"type": "table",
|
| 1424 |
+
"img_path": "images/7fc36abdab659263129fe9d4dbb7a091ac40fee72761bb64536b2c892ddb22ad.jpg",
|
| 1425 |
+
"table_caption": [
|
| 1426 |
+
"Table 5: Attention transfer validation error (single crop) on ImageNet. Transfer losses are added on epoch 60/100. "
|
| 1427 |
+
],
|
| 1428 |
+
"table_footnote": [],
|
| 1429 |
+
"table_body": "<table><tr><td>Model</td><td>top1, top5</td></tr><tr><td>ResNet-18</td><td>30.4,10.8</td></tr><tr><td>AT</td><td>29.3,10.0</td></tr><tr><td>ResNet-34</td><td>26.1,8.3</td></tr></table>",
|
| 1430 |
+
"bbox": [
|
| 1431 |
+
415,
|
| 1432 |
+
101,
|
| 1433 |
+
581,
|
| 1434 |
+
155
|
| 1435 |
+
],
|
| 1436 |
+
"page_idx": 12
|
| 1437 |
+
},
|
| 1438 |
+
{
|
| 1439 |
+
"type": "text",
|
| 1440 |
+
"text": "A.2 IMPLEMENTATION DETAILS ",
|
| 1441 |
+
"text_level": 1,
|
| 1442 |
+
"bbox": [
|
| 1443 |
+
176,
|
| 1444 |
+
220,
|
| 1445 |
+
406,
|
| 1446 |
+
236
|
| 1447 |
+
],
|
| 1448 |
+
"page_idx": 12
|
| 1449 |
+
},
|
| 1450 |
+
{
|
| 1451 |
+
"type": "text",
|
| 1452 |
+
"text": "The experiments were conducted in Torch machine learning framework. Double propagation can be implemented in a modern framework with automatic differentiation support, e.g. Torch, Theano, Tensorflow. For ImageNet experiments we used fb.resnet.torch code, and used 2 Titan X cards with data parallelizm in both teacher and student to speed up training. Code and models for our experiments are available at https://github.com/szagoruyko/attention-transfer. ",
|
| 1453 |
+
"bbox": [
|
| 1454 |
+
174,
|
| 1455 |
+
246,
|
| 1456 |
+
825,
|
| 1457 |
+
318
|
| 1458 |
+
],
|
| 1459 |
+
"page_idx": 12
|
| 1460 |
+
}
|
| 1461 |
+
]
|
parse/train/Sks9_ajex/Sks9_ajex_middle.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
parse/train/Sks9_ajex/Sks9_ajex_model.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
parse/train/rJevYoA9Fm/rJevYoA9Fm.md
ADDED
|
@@ -0,0 +1,356 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# The Singular Values of Convolutional Layers
|
| 2 |
+
|
| 3 |
+
Hanie Sedghi, Vineet Gupta and Philip M. Long
|
| 4 |
+
|
| 5 |
+
Google Brain
|
| 6 |
+
Mountain View, CA 94043
|
| 7 |
+
{hsedghi,vineet,plong}@google.com
|
| 8 |
+
|
| 9 |
+
# Abstract
|
| 10 |
+
|
| 11 |
+
We characterize the singular values of the linear transformation associated with a standard 2D multi-channel convolutional layer, enabling their efficient computation. This characterization also leads to an algorithm for projecting a convolutional layer onto an operator-norm ball. We show that this is an effective regularizer; for example, it improves the test error of a deep residual network using batch normalization on CIFAR-10 from $6 . 2 \%$ to $5 . 3 \%$ .
|
| 12 |
+
|
| 13 |
+
# 1 Introduction
|
| 14 |
+
|
| 15 |
+
Exploding and vanishing gradients (Hochreiter, 1991; Hochreiter et al., 2001; Goodfellow et al., 2016) are fundamental obstacles to effective training of deep neural networks. Many deep networks used in practice are layered. We can think of such networks as the composition of a number of feature transformations, followed by a linear classifier on the final layer of features. The singular values of the Jacobian of a layer bound the factor by which it increases or decreases the norm of the backpropagated signal. If these singular values are all close to 1, then gradients neither explode nor vanish. These singular values also bound these factors in the forward direction, which affects the stability of computations, including whether the network produces the dreaded “Nan”. Moreover, it has been proven (Bartlett et al., 2017) that the generalization error for a network is bounded by the Lipschitz constant of the network, which in turn can be bounded by the product of the operator norms of the Jacobians of the layers. Cisse et al. (2017) discussed robustness to adversarial examples as a result of bounding the operator norm.
|
| 16 |
+
|
| 17 |
+
These considerations have led authors to regularize networks by driving down the operator norms of network layers (Drucker and Le Cun, 1992; Hein and Andriushchenko, 2017; Yoshida and Miyato, 2017; Miyato et al., 2018). Orthogonal initialization (Saxe et al., 2013; Pennington et al., 2017) and Parseval networks (Cisse et al., 2017) are motivated by similar considerations.
|
| 18 |
+
|
| 19 |
+
Convolutional layers (LeCun et al., 1998) are key components of modern deep networks. They compute linear transformations of their inputs. The Jacobian of a linear transformation is always equal to the linear transformation itself. Because of the central importance of convolutional layers to the practice of deep learning, and the fact that the singular values of the linear transformation computed by a convolutional layer are the key to its contribution to exploding and vanishing gradients, we study these singular values. Up until now, authors seeking to control the operator norm of convolutional layers have resorted to approximations (Yoshida and Miyato, 2017; Miyato et al., 2018; Gouk et al., 2018a). In this paper, we provide an efficient way to compute the singular values exactly — this opens the door to various regularizers.
|
| 20 |
+
|
| 21 |
+
We consider the convolutional layers commonly applied to image analysis tasks. The input to a typical layer is a feature map, with multiple channels for each position in an $n \times n$ field. If there are $m$ channels, then the input as a whole is a $m \times n \times n$ tensor. The output is also an $n \times n$ field with multiple channels per position1. Each channel of the output is obtained by taking a linear combination of the values of the features in all channels in a local neighborhood centered at the corresponding position in the input feature map. Crucially, the same linear combination is used for all positions in the feature map. The coefficients are compiled in the kernel of the convolution. If the neighborhood is a $k \times k$ region, a kernel $K$ is a $k \times k \times m \times m$ tensor. The projection $K _ { : , : , c , }$ : gives the coefficients that determine the cth channel of the output, in terms of the values found in all of the channels of all positions in it neighborhood; $K _ { : , : , c , d }$ gives the coefficients to apply to the dth input channel, and $K _ { p , q , c , d }$ is the coefficient to apply to this input at in the position in the field offset horizontally by $p$ and vertically by $q$ . For ease of exposition, we assume that feature maps and local neighborhoods are square and that the number of channels in the output is equal to the number of channels in the input - the extension to the general case is completely straightforward.
|
| 22 |
+
|
| 23 |
+
To handle edge cases in which the offsets call for inputs that are off the feature maps, practical convolutional layers either do not compute outputs (reducing the size of the feature map), or pad the input with zeros. The behavior of these layers can be approximated by a layer that treats the input as if it were a torus; when the offset calls for a pixel that is off the right end of the image, the layer “wraps around” to take it from the left edge, and similarly for the other edges. The quality of this approximation has been heavily analyzed in the case of one-dimensional signals (Gray, 2006). Consequently, theoretical analysis of convolutions that wrap around has been become standard. This is the case analyzed in this paper.
|
| 24 |
+
|
| 25 |
+
Summary of Results: Our main result is a characterization of the singular values of a convolutional layer in terms of the kernel tensor $K$ . Our characterization enables these singular values to be computed exactly in a simple and practically fast way, using $O ( n ^ { 2 } m ^ { 2 } ( m + \log n ) )$ time. For comparison, the brute force solution that performs SVD on the matrix that encodes the convolutional layer’s linear transformation would take $O ( ( n ^ { 2 } m ) ^ { 3 } ) = O ( n ^ { 6 } m ^ { 3 } )$ time, and is impractical for commonly used network sizes. As another point of comparison, simply to compute the convolution takes $O ( n ^ { 2 } m ^ { 2 } k ^ { 2 } )$ time. We prove that the following two lines of NumPy correctly compute the singular values.
|
| 26 |
+
|
| 27 |
+
def SingularValues(kernel, input_shape): transforms $=$ np.fft.fft2(kernel, input_shape, axes $=$ [0, 1]) return np.linalg.svd(transforms, compute_uv=False)
|
| 28 |
+
|
| 29 |
+
Here kernel is any $k \times k \times m \times m$ tensor2 and input_shape is the shape of the feature map to be convolved. A TensorFlow implementation is similarly simple.
|
| 30 |
+
|
| 31 |
+
Timing tests, reported in Section 4.1, confirm that this characterization speeds up the computation of singular values by multiple orders of magnitude – making it usable in practice. The algorithm first performs $m ^ { 2 }$ FFTs, and then it performs ${ { \bar { n } } ^ { 2 } }$ SVDs. The FFTs, and then the SVDs, may be executed in parallel. Our TensorFlow implementation runs a lot faster than the NumPy implementation (see Figure 1); we think that this parallelism is the cause. We used our code to compute the singular values of the convolutional layers of the official ResNet-v2 model released with TensorFlow (He et al., 2016). The results are described in Appendix C.
|
| 32 |
+
|
| 33 |
+
Exposing the singular values of a convolutional layer opens the door to a variety of regularizers for these layers, including operator-norm regularizers. In Section 4.2, we evaluate an algorithm that periodically projects each convolutional layer onto a operator-norm ball. Using the projections improves the test error from $6 . 2 \%$ to $5 . 3 \%$ on CIFAR-10. We evaluate bounding the operator norm with and without batchnorm and we see that regularizing the operator norm helps, even in the presence of batch normalization. Moreover, operator-norm regularization and batch normalization are not redundant, and neither dominates the other. They complement each other.
|
| 34 |
+
|
| 35 |
+
Related work: Prior to our work, authors have responded to the difficulty of computing the singular values of convolutional layers in various ways. Cisse et al. (2017) constrained the matrix to have orthogonal rows and scale the output of each layer by a factor of $( 2 k + 1 ) ^ { - \frac { 1 } { 2 } }$ , for $k \times k$ kernels. Gouk et al. (2018a;b) proposed regularizing using a per-mini-batch approximation to the operator norm. They find the largest ratio between the input and output of a layer in the minibatch, and then scale down the transformation (thereby scaling down all of the singular values, not just the largest ones) so that the new value of this ratio obeys a constraint.
|
| 36 |
+
|
| 37 |
+
Yoshida and Miyato (2017) used an approximation of the operator norm of a reshaping of $K$ in place of the operator norm for the linear transformation associated with $K$ in their experiments. They reshape the given $k \times k \times m \times m$ into a $m k ^ { 2 } \times m$ matrix, and compute its largest singular value using a power iteration method, and use this as a substitute for the operator norm. While this provides a useful heuristic for regularization, the largest singular value of the reshaped matrix is often quite different from the operator norm of the linear transform associated with $K$ . Furthermore if we want to regularize using projection onto an operator-norm ball, we need the whole spectrum of the linear transformation (see Section 3). The reshaped $K$ has only $m$ singular values, whereas the linear transformation has $m n ^ { 2 }$ singular values of which $m n ^ { 2 } / 2$ are distinct except in rare degenerate cases. It is possible to project the reshaped $K$ onto an operator-norm ball by taking its SVD and clipping its singular values — we conducted experiments with this projection and report the results in Section 4.4.
|
| 38 |
+
|
| 39 |
+
A close relative of our main result was independently discovered by Bibi et al. (2019, Lemma 2).
|
| 40 |
+
|
| 41 |
+
Overview of the Analysis: If the signal is 1D and there is a single input and output channel, then the linear transformation associated with a convolution is encoded by a circulant matrix, i.e., a matrix whose rows are circular shifts of a single row (Gray, 2006). For example, for a row $a = ( a _ { 1 } , a _ { 2 } , a _ { 3 } )$ , the circulant matrix $\mathrm { c i r c } ( a )$ generated by $a$ is $\left( \begin{array} { l l l } { a _ { 0 } } & { a _ { 1 } } & { a _ { 2 } } \\ { a _ { 2 } } & { a _ { 0 } } & { a _ { 1 } } \\ { a _ { 1 } } & { a _ { 2 } } & { a _ { 0 } } \end{array} \right)$ . In the special case of a 2D signal with a single input channel and single output channel, the linear transformation is doubly block circulant (see (Goodfellow et al., 2016)). Such a matrix is made up of a circulant matrix of blocks, each of which in turn is itself circulant. Finally, when there are $m$ input channels and $m$ output channels, there are three levels to the hierarchy: there is a $m \times m$ matrix of blocks, each of which is doubly block circulant. Our analysis extends tools from the literature built for circulant (Horn and Johnson, 2012) and doubly circulant (Chao, 1974) matrices to analyze the matrices with a third level in the hierarchy arising from the convolutional layers used in deep learning. One key point is that the eigenvectors of a circulant matrix are Fourier basis vectors: in the 2D, one-channel case, the matrix whose columns are the eigenvectors is $F \otimes F$ , for the matrix $F$ whose columns form the Fourier basis. Multiplying by this matrix is a 2D Fourier transform. In the multi-channel case, we show that the singular values can be computed by (a) finding the eigenvalues of each of the $m ^ { 2 }$ doubly circulant matrices (of dimensions $n ^ { 2 } \times n ^ { 2 }$ ) using a 2D Fourier transform, (b) by forming multiple $m \times m$ matrices, one for each eigenvalue, by picking out the $i$ -th eigenvalue of each of the $n ^ { 2 } \times n ^ { 2 }$ blocks, for $i \in [ 1 . . n ^ { 2 } ]$ . The union of all of the singular values of all of those $m \times m$ matrices is the multiset of singular values of the layer.
|
| 42 |
+
|
| 43 |
+
Notation: We use upper case letters for matrices, lower case for vectors. For matrix $M , M _ { i }$ ,: represents the $i$ -th row and $M _ { : , j }$ represents the $j$ -th column; we will also use the analogous notation for higher-order tensors. The operator norm of $M$ is denoted by $| | { \cal M } | | _ { 2 }$ . For $n \in \mathbb { N }$ , we use $[ n ]$ to denote the set $\{ 0 , 1 , \ldots , n - 1 \}$ (instead of usual $\{ 1 , \ldots , n \} )$ . We will index the rows and columns of matrices using elements of $[ n ]$ , i.e. numbering from 0. Addition of row and column indices will be done mod $n$ unless otherwise indicated. (Tensors will be treated analogously.) Let $\sigma ( \cdot )$ be the mapping from a matrix to (the multiset of) its singular values. 3
|
| 44 |
+
|
| 45 |
+
Let $\omega = \exp ( 2 \pi i / n )$ , where $i = \sqrt { - 1 }$ . (Because we need a lot of indices in this paper, our use of √ $i$ to define $\omega$ is the only place in the paper where we will use $i$ to denote $\sqrt { - 1 }$ .)
|
| 46 |
+
|
| 47 |
+
Let $F$ be the $n \times n$ matrix that represents the discrete Fourier transform: $F _ { i j } = \omega ^ { i j }$ . We use $I _ { n }$ to denote the identity matrix of size $n \times n$ . For $i \in [ n ]$ , we use $e _ { i }$ to represent the ith basis vector in $\mathbb { R } ^ { n }$ We use $\otimes$ to represent the Kronecker product between two matrices (which also refers to the outer product of two vectors).
|
| 48 |
+
|
| 49 |
+
# 2 Analysis
|
| 50 |
+
|
| 51 |
+
# 2.1 One filter
|
| 52 |
+
|
| 53 |
+
As a warmup, we focus on the case that the number $m$ of input channels and output channels is 1. In this case, the filter coefficients are simply a $k \times k$ matrix. It will simplify notation, however, if we embed this $k \times k$ matrix in an $n \times n$ matrix, by padding with zeroes (which corresponds to the fact that the offsets with those indices are not used). Let us refer to this $n \times n$ matrix also as $K$ .
|
| 54 |
+
|
| 55 |
+
An $n ^ { 2 } \times n ^ { 2 }$ matrix $A$ is doubly block circulant if $A$ is a circulant matrix of $n \times n$ blocks that are in turn circulant.
|
| 56 |
+
|
| 57 |
+
For a matrix $X$ , let $\operatorname { v e c } ( X )$ be the vector obtained by stacking the columns of $X$ .
|
| 58 |
+
|
| 59 |
+
Lemma 1 (see Jain (1989) Section 5.5, Goodfellow et al. (2016) page 329) For any filter coefficients $K$ , the linear transform for the convolution by $K$ is represented by the following doubly block circulant matrix:
|
| 60 |
+
|
| 61 |
+
$$
|
| 62 |
+
\begin{array} { r } { A = \left[ \begin{array} { c c c c } { \mathrm { c i r c } ( K _ { 0 , : } ) } & { \mathrm { c i r c } ( K _ { 1 , : } ) } & { \ldots } & { \mathrm { c i r c } ( K _ { n - 1 , : } ) } \\ { \mathrm { c i r c } ( K _ { n - 1 , : } ) } & { \mathrm { c i r c } ( K _ { 0 , : } ) } & { \ldots } & { \mathrm { c i r c } ( K _ { n - 2 , : } ) } \\ { \vdots } & { \vdots } & { \vdots } & { \vdots } \\ { \mathrm { c i r c } ( K _ { 1 , : } ) } & { \mathrm { c i r c } ( K _ { 2 , : } ) } & { \ldots } & { \mathrm { c i r c } ( K _ { 0 , : } ) } \end{array} \right] . } \end{array}
|
| 63 |
+
$$
|
| 64 |
+
|
| 65 |
+
That is, $i f X$ is an $n \times n$ matrix, and $Y$ is the result of a 2-d convolution of $X$ with $K$ , i.e.
|
| 66 |
+
|
| 67 |
+
$$
|
| 68 |
+
\forall i j , Y _ { i j } = \sum _ { p \in [ n ] } \sum _ { q \in [ n ] } X _ { i + p , j + q } K _ { p , q }
|
| 69 |
+
$$
|
| 70 |
+
|
| 71 |
+
then $\operatorname { v e c } ( Y ) = A \operatorname { v e c } ( X ) .$
|
| 72 |
+
|
| 73 |
+
So now we want to determine the singular values of a doubly block circulant matrix.
|
| 74 |
+
|
| 75 |
+
We will make use of the characterization of the eigenvalues and eigenvectors of doubly block circulant matrices, which uses the following definition: $Q \stackrel { \mathrm { d e f } } { = } \frac { 1 } { n } \left( F \otimes F \right)$ .
|
| 76 |
+
|
| 77 |
+
Theorem 2 (Jain (1989) Section 5.5) For any $n ^ { 2 } \times n ^ { 2 }$ doubly block circulant matrix $A$ , the eigenvectors of $A$ are the columns of $Q$ .
|
| 78 |
+
|
| 79 |
+
To get singular values in addition to eigenvalues, we need the following two lemmas.
|
| 80 |
+
|
| 81 |
+
Lemma 3 (Jain (1989) Section 5.5) $Q$ is unitary.
|
| 82 |
+
|
| 83 |
+
Using Theorem 2 and Lemma 3, we can get the eigenvalues as the diagonal elements of $Q ^ { * } A Q$ .
|
| 84 |
+
|
| 85 |
+
Lemma 4 The matrix $A$ defined in equation $^ { l }$ is normal, i.e., $A ^ { T } A = A A ^ { T }$ .
|
| 86 |
+
|
| 87 |
+
# Proof:
|
| 88 |
+
|
| 89 |
+
$$
|
| 90 |
+
A A ^ { T } = A A ^ { * } = Q ^ { * } D Q Q ^ { * } D ^ { * } Q = Q ^ { * } D D ^ { * } Q = Q ^ { * } D ^ { * } D Q = Q ^ { * } D ^ { * } Q Q ^ { * } D Q = A ^ { * } A = A ^ { T } A .
|
| 91 |
+
$$
|
| 92 |
+
|
| 93 |
+
The following theorem characterizes the singular values of $A$ as a simple function of $K$ . As we will see, a characterization of the eigenvalues plays a major role. Chao (1974) provided a more technical characterization of the eigenvalues which may be regarded as making partial progress toward Theorem 5. However, we provide a proof from first principles, since it is the cleanest way we know to prove the theorem.
|
| 94 |
+
|
| 95 |
+
Theorem 5 For the matrix $A$ defined in equation $I$ , the eigenvalues of $A$ are the entries of $F ^ { T } K F$ and its singular values are their magnitudes. That is, the singular values of $A$ are
|
| 96 |
+
|
| 97 |
+
$$
|
| 98 |
+
\left\{ \left| ( F ^ { T } K F ) _ { u , v } \right| \ : \ u , v \in [ n ] \right\} .
|
| 99 |
+
$$
|
| 100 |
+
|
| 101 |
+
Proof: By Theorems 2 and Lemma 3, the eigenvalues of $A$ are the diagonal elements of $Q ^ { * } A Q =$ $\mathring { \neg } ( F ^ { * } \otimes \bar { F } ^ { * } ) A ( F \otimes F )$ . If we view $( F ^ { * } \otimes F ^ { * } ) A ( F \otimes F )$ as a compound $n \times n$ matrix of $n \times n$ blocks, for $u , v \in [ n ]$ , the $( u n + v )$ th diagonal element is the $v$ th element of the $u$ th diagonal block. Let us first evaluate the uth diagonal block. Using $i , j$ to index blocks, we have
|
| 102 |
+
|
| 103 |
+
$$
|
| 104 |
+
\begin{array} { l } { { ( Q ^ { * } A Q ) _ { u u } = \displaystyle \frac { 1 } { n ^ { 2 } } \sum _ { i , j \in [ n ] } ( F ^ { * } \otimes F ^ { * } ) _ { u i } A _ { i j } ( F \otimes F ) _ { j u } = \displaystyle \frac { 1 } { n ^ { 2 } } \sum _ { i , j \in [ n ] } \omega ^ { - u i } F ^ { * } \mathrm { c i r c } ( K _ { j - i , \cdot } ) \omega ^ { j u } F } } \\ { { = \displaystyle \frac { 1 } { n ^ { 2 } } \sum _ { i , j \in [ n ] } \omega ^ { u ( j - i ) } F ^ { * } \mathrm { c i r c } ( K _ { j - i , \cdot } ) F . } } \end{array}
|
| 105 |
+
$$
|
| 106 |
+
|
| 107 |
+
To get the $v$ th element of the diagonal of (4), we may sum the vth elements of the diagonals of each of its terms. Toward this end, we have
|
| 108 |
+
|
| 109 |
+
$$
|
| 110 |
+
( F ^ { * } \mathrm { c i r c } ( K _ { j - i , : } ) F ) _ { v v } = \sum _ { r , s \in [ n ] } \omega ^ { - v r } \mathrm { c i r c } ( K _ { j - i , : } ) _ { r s } \omega ^ { s v } = \sum _ { r , s \in [ n ] } \omega ^ { v ( s - r ) } K _ { j - i , s - r } .
|
| 111 |
+
$$
|
| 112 |
+
|
| 113 |
+
Substituting into (4), we get $\begin{array} { r } { \frac { 1 } { n ^ { 2 } } \sum _ { i , j , r , s \in [ n ] } \omega ^ { u ( j - i ) } \omega ^ { v ( s - r ) } K _ { j - i , s - r } . } \end{array}$ . Collecting terms where $j - i =$ $p$ and $s - r = q$ , this is $\begin{array} { r } { \sum _ { p , q \in [ n ] } \omega ^ { u p } \omega ^ { v q } K _ { p , q } = ( F ^ { T } K F ) _ { u v } } \end{array}$ .
|
| 114 |
+
|
| 115 |
+
Since the singular values of any normal matrix are the magnitudes of its eigenvalues (Horn and Johnson (2012) page 158), applying Lemma 4 completes the proof. □
|
| 116 |
+
|
| 117 |
+
Note that $F ^ { T } K F$ is the 2D Fourier transform of $K$ , and recall that $| | A | | _ { 2 }$ is the largest singular value of $A$ .
|
| 118 |
+
|
| 119 |
+
# 2.2 Multi-channel convolution
|
| 120 |
+
|
| 121 |
+
Now, we consider case where the number $m$ of channels may be more than one. Assume we have a 4D kernel tensor $K$ with element $K _ { p , q , c , d }$ giving the connection strength between a unit in channel $d$ of the input and a unit in channel $c$ of the output, with an offset of $p$ rows and $q$ columns between the input unit and the output unit. The input $X \in \mathbb { R } ^ { m \times n \times n }$ ; element $X _ { d , i , j }$ is the value of the input unit within channel $d$ at row $i$ and column $j$ . The output $Y \in \mathbb { R } ^ { m \times n \times n }$ has the same format as $X$ , and is produced by
|
| 122 |
+
|
| 123 |
+
$$
|
| 124 |
+
Y _ { c r s } = \sum _ { d \in [ m ] } \sum _ { p \in [ n ] } \sum _ { q \in [ n ] } X _ { d , r + p , s + q } K _ { p , q , c , d } .
|
| 125 |
+
$$
|
| 126 |
+
|
| 127 |
+
By inspection, $\operatorname { v e c } ( Y ) = M \operatorname { v e c } ( X )$ , where $M$ is as follows
|
| 128 |
+
|
| 129 |
+
$$
|
| 130 |
+
{ \cal M } = \left[ \begin{array} { c c c c } { { B _ { 0 0 } } } & { { B _ { 0 1 } } } & { { \dots } } & { { B _ { 0 ( m - 1 ) } } } \\ { { B _ { 1 0 } } } & { { B _ { 1 1 } } } & { { \dots } } & { { B _ { 1 ( m - 1 ) } } } \\ { { \vdots } } & { { \vdots } } & { { \ddots } } & { { \vdots } } \\ { { B _ { ( m - 1 ) 0 } } } & { { B _ { ( m - 1 ) 1 } } } & { { \dots } } & { { B _ { ( m - 1 ) ( m - 1 ) } } } \end{array} \right]
|
| 131 |
+
$$
|
| 132 |
+
|
| 133 |
+
and each $B _ { c d }$ is a doubly block circulant matrix from Lemma 1 corresponding to the portion $K _ { : , : , c , d }$ of $K$ that concerns the effect of the $d$ -th input channel on the $c$ -th output channel. (We can think of each output in the multichannel case as being a sum of single channel filters parameterized by one of the $K _ { : , : , c , d }$ ’s.)
|
| 134 |
+
|
| 135 |
+
The following is our main result.
|
| 136 |
+
|
| 137 |
+
Theorem 6 For any $K \in \mathbb { R } ^ { n \times n \times m \times m }$ , let $M$ is the matrix encoding the linear transformation computed by a convolutional layer parameterized by $K$ , defined as in (6). For each $u , v \in [ n ] \times [ n ]$ , let $P ^ { ( u , v ) }$ be the $m \times m$ matrix given by $P _ { c d } ^ { ( u , v ) } = ( F ^ { T } K _ { : , : , c , d } F ) _ { u v }$ . Then
|
| 138 |
+
|
| 139 |
+
$$
|
| 140 |
+
\sigma ( M ) = \bigcup _ { u \in [ n ] , v \in [ n ] } \sigma \left( P ^ { ( u , v ) } \right) .
|
| 141 |
+
$$
|
| 142 |
+
|
| 143 |
+
The rest of this section is devoted to proving Theorem 6 through a series of lemmas.
|
| 144 |
+
|
| 145 |
+
The analysis of Section 2.1 implies that for all $c , d \in [ m ]$ , $D _ { c d } \stackrel { \mathrm { d e f } } { = } Q ^ { * } B _ { c d } Q$ is diagonal. Define
|
| 146 |
+
|
| 147 |
+
$$
|
| 148 |
+
\begin{array} { r } { L \stackrel { \mathrm { d e f } } { = } \left[ \begin{array} { c c c c } { D _ { 0 0 } } & { D _ { 0 1 } } & { . . . } & { D _ { 0 ( m - 1 ) } } \\ { D _ { 1 0 } } & { D _ { 1 1 } } & { . . . } & { D _ { 1 ( m - 1 ) } } \\ { \vdots } & { \vdots } & { . . . } & { \vdots } \\ { D _ { ( m - 1 ) 0 } } & { D _ { ( m - 1 ) 1 } } & { . . . } & { D _ { ( m - 1 ) ( m - 1 ) } } \end{array} \right] . } \end{array}
|
| 149 |
+
$$
|
| 150 |
+
|
| 151 |
+
Lemma 7 $M$ and $L$ have the same singular values.
|
| 152 |
+
|
| 153 |
+
Proof: We have
|
| 154 |
+
|
| 155 |
+
$$
|
| 156 |
+
\begin{array} { r l } & { M = \left[ \begin{array} { c c c } { B _ { 0 0 } } & { \ldots } & { B _ { 0 ( m - 1 ) } } \\ { \vdots } & { \vdots } & { \vdots } \\ { B _ { ( m - 1 ) 0 } } & { \ldots } & { B _ { ( m - 1 ) ( m - 1 ) } } \end{array} \right] = \left[ \begin{array} { c c c } { Q D _ { 0 0 } Q ^ { * } } & { \ldots } & { Q D _ { 0 ( m - 1 ) } Q ^ { * } } \\ { \vdots } & { \vdots } & { \vdots } \\ { Q D _ { ( m - 1 ) 0 } Q ^ { * } } & { \ldots } & { Q D _ { ( m - 1 ) ( m - 1 ) } Q ^ { * } } \end{array} \right] } \\ & { \quad \quad = R \left[ \begin{array} { c c c } { D _ { 0 0 } } & { \ldots } & { D _ { 0 ( m - 1 ) } } \\ { \vdots } & { \vdots } & { \vdots } \\ { D _ { ( m - 1 ) 0 } } & { \ldots } & { D _ { ( m - 1 ) ( m - 1 ) } } \end{array} \right] R ^ { * } = R L R ^ { * } , } \end{array}
|
| 157 |
+
$$
|
| 158 |
+
|
| 159 |
+
where $R \stackrel { \mathrm { d e f } } { = } I _ { m } \otimes Q$ . Note that $R$ is unitary because
|
| 160 |
+
|
| 161 |
+
$$
|
| 162 |
+
R R ^ { * } = ( I _ { m } \otimes Q ) ( I _ { m } \otimes Q ^ { * } ) = ( I _ { m } I _ { m } ) \otimes ( Q Q ^ { * } ) = I _ { m n ^ { 2 } } ;
|
| 163 |
+
$$
|
| 164 |
+
|
| 165 |
+
this implies that $M$ and $L$ have the same singular values.
|
| 166 |
+
|
| 167 |
+
So now we have as a subproblem characterizing the singular values of a block matrix whose blocks are diagonal. To express the the characterization, it helps to reshape the nonzero elements of $L$ into a $m \times \overline { { m \times n ^ { 2 } } }$ tensor $G$ as follows: $G _ { c d w } = ( D _ { c d } ) _ { w w }$ .
|
| 168 |
+
|
| 169 |
+
Theorem 8 $\sigma ( L ) = \bigcup _ { w \in [ n ^ { 2 } ] } \sigma \left( G _ { : , : , w } \right) .$ .
|
| 170 |
+
|
| 171 |
+
Proof: Choose an arbitrary $w \in [ n ^ { 2 } ]$ , and a (scalar) singular value $\sigma$ of $G _ { : , : , w }$ whose left singular vector is $x$ and whose right singular vector is $y$ , so that $G _ { : , : , w } y = \sigma x$ . Recall that $e _ { w } \in \mathbb { R } ^ { n ^ { 2 } }$ is a standard basis vector.
|
| 172 |
+
|
| 173 |
+
We claim that $L ( y \otimes e _ { w } ) = \sigma ( x \otimes e _ { w } )$ . Since $D _ { c d }$ is diagonal, $D _ { c d } e _ { w } = ( D _ { c d } ) _ { w w } e _ { w } = G _ { c d w } e _ { w }$ Thus we have $\begin{array} { r } { ( L ( y \otimes e _ { w } ) ) _ { c } = \sum _ { d \in [ m ] } D _ { c d } y _ { d } e _ { w } = ( \sum _ { d \in [ m ] } G _ { c d w } y _ { d } ) e _ { w } = ( G _ { : , : , w } y ) _ { c } e _ { w } = \sigma x _ { c } e _ { w } , } \end{array}$ which shows that
|
| 174 |
+
|
| 175 |
+
$$
|
| 176 |
+
{ \boldsymbol { \zeta } } ( y \otimes e _ { w } ) = \left[ { \begin{array} { c c c c } { D _ { 0 0 } } & { \ldots } & { D _ { 0 ( m - 1 ) } } \\ { D _ { 1 0 } } & { \ldots } & { D _ { 1 ( m - 1 ) } } \\ { \vdots } & { \ldots } & { \vdots } \\ { D _ { ( m - 1 ) 0 } } & { \ldots } & { D _ { ( m - 1 ) ( m - 1 ) } } \end{array} } \right] \left[ { \begin{array} { c } { y _ { 0 } e _ { w } } \\ { \vdots } \\ { y _ { m - 1 } e _ { w } } \end{array} } \right] = \left[ { \begin{array} { c } { \sigma x _ { 0 } e _ { w } } \\ { \vdots } \\ { \sigma x _ { m - 1 } e _ { w } } \end{array} } \right] = \sigma ( x \otimes e _ { w } ) .
|
| 177 |
+
$$
|
| 178 |
+
|
| 179 |
+
If $\tilde { \sigma }$ is another singular value of $G _ { : , : , w }$ with a left singular vector $\tilde { x }$ and a right singular vector $\tilde { y }$ , then $\langle ( x \otimes e _ { w } ) , ( \tilde { x } \otimes e _ { w } ) \rangle = \langle x , \tilde { x } \rangle = 0$ and, similarly $\langle ( y \otimes e _ { w } ) , ( \tilde { y } \otimes e _ { w } ) \rangle = 0$ . Also, $\langle ( x \otimes e _ { w } ) , ( x \otimes e _ { w } ) \rangle = 1$ and $\langle ( y \otimes e _ { w } ) , ( y \otimes e _ { w } ) \rangle = 1$ .
|
| 180 |
+
|
| 181 |
+
For any $x$ and $\tilde { x }$ , whether they are equal or not, if $w \ne \tilde { w }$ , then $\langle ( x \otimes e _ { w } ) , ( \tilde { x } \otimes e _ { \tilde { w } } ) \rangle = 0$ , simply because their non-zero components do not overlap.
|
| 182 |
+
|
| 183 |
+
Thus, by taking the Kronecker product of each singular vector of $G _ { : , : , w }$ with $e _ { w }$ and assembling the results for various $w$ , we may form a singular value decomposition of $L$ whose singular values are $\cup _ { w \in [ n ^ { 2 } ] } \sigma ( G _ { : , : , w } ) .$ . This completes the proof. □
|
| 184 |
+
|
| 185 |
+
Using Lemmas 7 and Theorem 8, we are now ready to prove Theorem 6.
|
| 186 |
+
|
| 187 |
+
Proof (of Theorem 6). Recall that, for each input channel $c$ and output channel $d$ , the diagonal elements of $D _ { c , d }$ are the eigenvalues of $B _ { c , d }$ . By Theorem 5, this means that the diagonal elements of $D _ { c , d }$ are
|
| 188 |
+
|
| 189 |
+
$$
|
| 190 |
+
\{ ( F ^ { T } K _ { : , : , c , d } F ) _ { u , v } : u , v \in [ n ] \} .
|
| 191 |
+
$$
|
| 192 |
+
|
| 193 |
+
The elements of (9) map to the diagonal elements of $D _ { c , d }$ as follows:
|
| 194 |
+
|
| 195 |
+
$$
|
| 196 |
+
G _ { c d w } = ( D _ { c , d } ) _ { w w } = ( F ^ { T } K _ { : , : , c , d } F ) _ { \lfloor w / m \rfloor , w \mod m }
|
| 197 |
+
$$
|
| 198 |
+
|
| 199 |
+
and thus
|
| 200 |
+
|
| 201 |
+
$$
|
| 202 |
+
G _ { : , : , w } = \left( ( F ^ { T } K _ { : , : , c , d } F ) _ { \lfloor w / m \rfloor , w \mod m } \right) _ { c d }
|
| 203 |
+
$$
|
| 204 |
+
|
| 205 |
+
which in turn implies
|
| 206 |
+
|
| 207 |
+
$$
|
| 208 |
+
\bigcup _ { w \in [ n ^ { 2 } ] } \sigma ( G _ { : , : , w } ) = \cup _ { u \in [ n ] , v \in [ n ] } \sigma \left( \left( ( F ^ { T } K _ { : , : , c , d } F ) _ { u , v } \right) _ { c d } \right) .
|
| 209 |
+
$$
|
| 210 |
+
|
| 211 |
+
Applying Lemmas 7 and 8 completes the proof.
|
| 212 |
+
|
| 213 |
+
# 3 Regularization
|
| 214 |
+
|
| 215 |
+
We now show how to use the spectrum computed above to project a convolution onto the set of convolutions with bounded operator norm. We exploit the following key fact.
|
| 216 |
+
|
| 217 |
+
Proposition 9 (Lefkimmiatis et al. (2013), Proposition 1) Let $A \in \mathbb { R } ^ { n \times n }$ , and let $A = U D V ^ { \top }$ be its singular value decomposition. Let $\tilde { A } = U \tilde { D } \bar { V } ^ { \top }$ , where, for all $i \in [ n ] , \tilde { D } _ { i i } = \operatorname* { m i n } ( D _ { i i } , c )$ and $B = \{ X \mid | X | | _ { 2 } \leq c \}$ . Then $\tilde { A }$ is the projection of $A$ onto $\boldsymbol { B }$ ; i.e. ${ \tilde { A } } = \underset { X \in \mathcal { B } } { \arg \operatorname* { m i n } } \ | | A - X | | _ { F } .$ .
|
| 218 |
+
|
| 219 |
+
This implies that the desired projection can be obtained by clipping the singular values of linear transformation associated with a convolutional layer to the interval $[ 0 , c ]$ . Note that the eigenvectors remained the same in the proposition, hence the projected matrix is still generated by a convolution. However, after the projection, the resulting convolution neighborhood may become as large as $n \times n$ . On the other hand, we can project this convolution onto the set of convolutions with $k \times k$ neighborhoods, by zeroing out all other coefficients. NumPy code for this is in Appendix A.
|
| 220 |
+
|
| 221 |
+
Repeatedly alternating the two projections would give a point in the intersection of the two sets, i.e., a $k \times k$ convolution with bounded operator norm (Cheney and Goldstein (1959) Theorem 4, Boyd and Dattorro (2003) Section 2), and the projection onto that intersection could be found using the more complicated Dykstra’s projection algorithm (Boyle and Dykstra, 1986).
|
| 222 |
+
|
| 223 |
+
When we wish to control the operator norm during an iterative optimization process, however, repeating the alternating projections does not seem to be worth it – we found that the first two projections already often produced a convolutional layer with an operator norm close to the desired value. Furthermore, because SGD does not change the parameters very fast, we can think of a given pair of projections as providing a warm start for the next pair.
|
| 224 |
+
|
| 225 |
+
In practice, we run the two projections once every few steps, thus letting the projection alternate with the training.
|
| 226 |
+
|
| 227 |
+
# 4 Experiments
|
| 228 |
+
|
| 229 |
+
First, we validated Theorem 6 with unit tests in which the output of the code given in the introduction is compared with evaluating the singular values by constructing the full matrix encoding the linear transformation corresponding to the convolutional layer and computing its SVD.
|
| 230 |
+
|
| 231 |
+
# 4.1 Timing
|
| 232 |
+
|
| 233 |
+
We generated 4D tensors of various shapes with random standard normal values, and computed their singular values using the full matrix method, the NumPy code given above and the equivalent TensorFlow code. For small tensors, the NumPy code was faster than TensorFlow, but for larger tensors, the TensorFlow code was able to exploit the parallelism in the algorithm and run much faster on a GPU. The timing results are shown in Figure 1.
|
| 234 |
+
|
| 235 |
+
# 4.2 Regularization
|
| 236 |
+
|
| 237 |
+
We next explored the effect of regularizing the convolutional layers by clipping their operator norms as described in Section 3. We ran the CIFAR-10 benchmark with a standard 32 layer residual network with 2.4M training parameters; (He et al., 2016). This network reached a test error rate of $6 . 2 \%$ after 250 epochs, using a learning rate schedule determined by a grid search (shown by the gray plot in Figure 2). We then evaluated an algorithm that, every 100 steps, clipped the norms of the convolutional layers to various different values between 0.1 and 3.0. As expected, clipping to 2.5 and 3.0 had little impact on the performance, since the norms of the convolutional layers were between 2.5 and 2.8. Clipping to 0.1 yielded a surprising $6 . 7 \%$ test error, whereas clipping to 0.5 and 1.0 yielded test errors of $5 . 3 \%$ and $5 . 5 \%$ respectively (shown in Figure 2). A plot of test error against training time is provided in Figure 4 in Appendix B, showing that the projections did not slow down the training very much.
|
| 238 |
+
|
| 239 |
+

|
| 240 |
+
Figure 1: Time used to compute singular values. The left graph is for a $3 \times 3$ convolution on a $1 6 \times 1 6$ image with the number of input/output channels on the $x$ -axis. The right graph is for a $1 1 \times 1 1$ convolution on a $6 4 \times 6 4$ image (no curve for full matrix method is shown as this method could not complete in a reasonable time for these inputs).
|
| 241 |
+
|
| 242 |
+

|
| 243 |
+
Figure 2: Training loss and test error for ResNet model (He et al., 2016) for CIFAR-10.
|
| 244 |
+
|
| 245 |
+
# 4.3 Robustness to changes in hyperparameters
|
| 246 |
+
|
| 247 |
+
The baseline algorithm studied in the previous subsection used batch normalization. Batch normalization tends to make the network less sensitive to linear transformations with large operator norms. However, batch normalization includes trainable scaling parameters (called $\gamma$ in the original paper) that are applied after the normalization step. The existence of these parameters lead to a complicated interaction between batch normalization and methods like ours that act to control the norm of the linear transformation applied before batch normalization.
|
| 248 |
+
|
| 249 |
+
Because the effect of regularizing the operator norm is more easily understood in the absence of batch normalization, we also performed experiments with a baseline that did not use batch normalization.
|
| 250 |
+
|
| 251 |
+
Another possibility that we wanted to study was that using a regularizer may make the process overall more stable, enabling a larger learning rate. We were generally interested in whether operator-norm regularization made the training process more robust to the choice of hyperparameters.
|
| 252 |
+
|
| 253 |
+
In one experiment, we started with the same baseline as the previous subsection, but disabled batch normalization. This baseline started with a learning rate of 0.1, which was multiplied by a factor 0.95 after every epoch. We tried all combinations of the following hyperparameters: (a) the norm of the ball projected onto (no projection, 0.5, 1.0, 1.5, 2.0); (b) the initial learning rate (0.001, 0.003, 0.01, 0.03, 0.1); (c) the minibatch size (32, 64); (d) the number of epochs per decay of the learning rate (1,2,3). We tried each of the 150 combinations of the hyperparameters, trained for 100 epochs, and measured the test error. The results are plotted in Figure 3a. The operator norm regularization improved the best result, and also made the process more robust to the choice of hyperparameters.
|
| 254 |
+
|
| 255 |
+

|
| 256 |
+
Figure 3: A scatterplot of the test errors obtained with different hyperparameter combinations, and different operator-norm regularizers.
|
| 257 |
+
|
| 258 |
+
We conducted a similar experiment in the presence of batch normalization, except using learning rates 0.01, 0.03, 0.1, 0.2, and 0.3. Those results are shown in Figure 3b. Regularizing the operator norm helps, even in the presence of batch normalization.
|
| 259 |
+
|
| 260 |
+
It appears that operator-norm regularization and batch normalization are not redundant, and neither dominates the other. We were surprised by this.
|
| 261 |
+
|
| 262 |
+
# 4.4 Comparison with reshaping $K$
|
| 263 |
+
|
| 264 |
+
In Section 1 we mentioned that Yoshida and Miyato (2017) approximated the linear transformation induced by $K$ by reshaping $K$ . This leads to an alternate regularization method — we compute the spectrum of the reshaped $K$ , and project it onto a ball using clipping, as above. We implemented this an experimented with it using the same network and hyperparameters as in Section 4.2 and found the following.
|
| 265 |
+
|
| 266 |
+
• We clipped the singular values of the reshaped $K$ every 100 steps. We tried various constants for the clipped value (0.05, 0.1, 0.2, 0.5, 1.0), and found that the best accuracy we achieved, using 0.2, was the same as the accuracy we achieved in Section 4.2. • We clipped the singular values of the reshaped $K$ to these same values every step, and found that the best accuracy achieved was slightly worse than the accuracy achieved in the previous step. We observed similar behavior when we clipped norms using our method. • Most surprisingly, we found that clipping norms by our method on a GPU was about $2 5 \%$ faster than clipping the singular values of the reshaped $K$ — when we clipped after every step, on the same machine, 10000 batches of CIFAR10 took 14490 seconds when we clipped the reshaped $K$ , whereas they took 11004 seconds with our exact method! One possible explanation is parallelization — clipping reshaped $K$ takes $O ( m ^ { 3 } k ^ { 2 } )$ flops, whereas our method does $m ^ { 2 }$ FFTs, followed by $\bar { n ^ { 2 } } m \times m$ SVDs, which takes $O ( m ^ { 3 } n ^ { 2 } )$ flops, but these can be parallelized and completed in as little as $O ( n ^ { 2 } \log n + m ^ { 3 } )$ time.
|
| 267 |
+
|
| 268 |
+
Clearly this is only one dataset, and the results may not generalize to other sets. However it does suggest that finding the full spectrum of the convolutional layer may be no worse than computing heuristic approximations, both in classification accuracy and speed.
|
| 269 |
+
|
| 270 |
+
# 5 Acknowledgements
|
| 271 |
+
|
| 272 |
+
We thank Tomer Koren, Nishal Shah, Yoram Singer and Chiyuan Zhang for valuable conversations.
|
| 273 |
+
|
| 274 |
+
# References
|
| 275 |
+
|
| 276 |
+
P. L. Bartlett, D. J. Foster, and M. J. Telgarsky. Spectrally-normalized margin bounds for neural networks. In NIPS, pages 6240–6249, 2017.
|
| 277 |
+
|
| 278 |
+
Adel Bibi, Bernard Ghanem, Vladlen Koltun, and Rene Ranftl. Deep layers as stochastic solvers. ICLR, 2019.
|
| 279 |
+
|
| 280 |
+
S. Boyd and J. Dattorro. Alternating projections, 2003. https://web.stanford.edu/class/ee392o/alt_proj.pdf.
|
| 281 |
+
|
| 282 |
+
J. P. Boyle and R. L. Dykstra. A method for finding projections onto the intersection of convex sets in hilbert spaces. In Advances in order restricted statistical inference, pages 28–47. Springer, 1986.
|
| 283 |
+
|
| 284 |
+
C. Chao. A note on block circulant matrices. Kyungpook Mathematical Journal, 14:97–100, 1974.
|
| 285 |
+
|
| 286 |
+
W. Cheney and A. A. Goldstein. Proximity maps for convex sets. Proceedings of the American Mathematical Society, 10(3):448–450, 1959. ISSN 00029939, 10886826. URL http://www.jstor.org/stable/ 2032864.
|
| 287 |
+
|
| 288 |
+
M. Cisse, P. Bojanowski, E. Grave, Y. Dauphin, and N. Usunier. Parseval networks: Improving robustness to adversarial examples. ICML, 2017.
|
| 289 |
+
|
| 290 |
+
H. Drucker and Y. Le Cun. Improving generalization performance using double backpropagation. IEEE Transactions on Neural Networks, 3(6):991–997, 1992.
|
| 291 |
+
|
| 292 |
+
I. Goodfellow, Y. Bengio, and A. Courville. Deep Learning. MIT Press, 2016. http://www. deeplearningbook.org.
|
| 293 |
+
|
| 294 |
+
H. Gouk, E. Frank, B. Pfahringer, and M. Cree. Regularisation of neural networks by enforcing lipschitz continuity. arXiv preprint arXiv:1804.04368, 2018a.
|
| 295 |
+
|
| 296 |
+
H. Gouk, B. Pfahringer, E. Frank, and M. Cree. MaxGain: Regularisation of neural networks by constraining activation magnitudes. arXiv preprint arXiv:1804.05965, 2018b.
|
| 297 |
+
|
| 298 |
+
R. M. Gray. Toeplitz and circulant matrices: A review. Foundations and Trends® in Communications and Information Theory, 2(3):155–239, 2006.
|
| 299 |
+
|
| 300 |
+
K. He, X. Zhang, S. Ren, and J. Sun. Identity mappings in deep residual networks. In European Conference on Computer Vision, pages 630–645. Springer, 2016. http://download.tensorflow.org/models/official/resnet_v2_imagenet_checkpoint.tar.gz; downloaded on on 5/1/18.
|
| 301 |
+
|
| 302 |
+
M. Hein and M. Andriushchenko. Formal guarantees on the robustness of a classifier against adversarial manipulation. In NIPS, pages 2266–2276, 2017.
|
| 303 |
+
|
| 304 |
+
S. Hochreiter. Untersuchungen zu dynamischen neuronalen netzen. Diploma, Technische Universität München, 91:1, 1991.
|
| 305 |
+
|
| 306 |
+
S. Hochreiter, Y. Bengio, P. Frasconi, J. Schmidhuber, et al. Gradient flow in recurrent nets: the difficulty of learning long-term dependencies, 2001.
|
| 307 |
+
|
| 308 |
+
R. A. Horn and C. R. Johnson. Matrix Analysis. Cambridge University Press, New York, NY, USA, 2nd edition, 2012. ISBN 0521548233, 9780521548236.
|
| 309 |
+
|
| 310 |
+
A. K. Jain. Fundamentals of digital image processing. Englewood Cliffs, NJ: Prentice Hall„ 1989.
|
| 311 |
+
|
| 312 |
+
Y. LeCun, L. Bottou, Y. Bengio, and P. Haffner. Gradient-based learning applied to document recognition. Proceedings of the IEEE, 86(11):2278–2324, 1998.
|
| 313 |
+
|
| 314 |
+
S. Lefkimmiatis, J. P. Ward, and M. Unser. Hessian Schatten-norm regularization for linear inverse problems. IEEE transactions on image processing, 22(5):1873–1888, 2013.
|
| 315 |
+
|
| 316 |
+
T. Miyato, T. Kataoka, M. Koyama, and Y. Yoshida. Spectral normalization for generative adversarial networks. ICLR, 2018.
|
| 317 |
+
|
| 318 |
+
J. Pennington, S. Schoenholz, and S. Ganguli. Resurrecting the sigmoid in deep learning through dynamical isometry: theory and practice. In Advances in neural information processing systems, pages 4788–4798, 2017.
|
| 319 |
+
|
| 320 |
+
A. M. Saxe, J. L. McClelland, and S. Ganguli. Exact solutions to the nonlinear dynamics of learning in deep linear neural networks. arXiv preprint arXiv:1312.6120, 2013.
|
| 321 |
+
|
| 322 |
+
Y. Yoshida and T. Miyato. Spectral norm regularization for improving the generalizability of deep learning. arXiv preprint arXiv:1705.10941, 2017.
|
| 323 |
+
|
| 324 |
+
# A NumPy code for operator norm projection
|
| 325 |
+
|
| 326 |
+
def Clip_OperatorNorm(kernel, input_shape, clip_to): transform_coefficients $=$ np.fft.fft2(kernel, input_shape, axes $\displaystyle { \varepsilon }$ [0, 1]) U, D, $\texttt { V } =$ np.linalg.svd(transform_coefficients, compute_uv $\mathbf { \bar { \Pi } } = \mathbf { \bar { \Pi } }$ True, full_matrices $\underline { { \underline { { \mathbf { \Pi } } } } }$ False) D_clipped $=$ np.minimum(D, clip_to)
|
| 327 |
+
|
| 328 |
+
if kernel.shape[2] $>$ kernel.shape[3]:
|
| 329 |
+
|
| 330 |
+
clipped_transform_coefficients $=$ np.matmul(U, D_clipped[..., None] \* V) else:
|
| 331 |
+
|
| 332 |
+
clipped_transform_coefficients $=$ np.matmul(U \* D_clipped[..., None, :], V) clipped_kernel $=$ np.fft.ifft2(clipped_transform_coefficients, axes $=$ [0, 1]).real return clipped_kernel[np.ix_(\*[range(d) for d in kernel.shape])]
|
| 333 |
+
|
| 334 |
+
# B Test error vs. training time
|
| 335 |
+
|
| 336 |
+
Figure 4 shows the plots of test error vs. training time in our CIFAR-10 experiment.
|
| 337 |
+
|
| 338 |
+

|
| 339 |
+
Figure 4: Test error vs. training time for ResNet model (He et al., 2016) for CIFAR-10.
|
| 340 |
+
|
| 341 |
+
C The official pre-trained ResNet model
|
| 342 |
+
|
| 343 |
+

|
| 344 |
+
Figure 5: Plot of the singular values of the linear operators associated with the convolutional layers of the pretrained "ResNet V2" from the TensorFlow website.
|
| 345 |
+
|
| 346 |
+
The singular values of the convolutional layers from the official “Resnet $\mathbf { V } 2 ^ { \mathbf { \mathfrak { s } } }$ pre-trained model (He et al., 2016) are plotted in Figure 5. The singular values are ordered by value. Only layers with kernels larger than $1 \times 1$ are plotted. The curves are plotted with a mixture of red and green; layers closer to the input are plotted with colors with a greater share of red. The transformations with the largest operator norms are closest to the inputs. As the data has undergone more rounds of processing, as we proceed through the layers, the number of non-negligible singular values increases for a while, but at the end, it tapers off.
|
| 347 |
+
|
| 348 |
+

|
| 349 |
+
Figure 6: Plot of the ratio of singular values to maximum singular value of the linear operators associated with the convolutional layers of the pretrained "ResNet V2" from the TensorFlow website.
|
| 350 |
+
|
| 351 |
+

|
| 352 |
+
Figure 7: Plot of the ratio of singular values to maximum singular value of the linear operators associated with the convolutional layers of the pretrained "ResNet V2" normalized by size of the convolution.
|
| 353 |
+
|
| 354 |
+
In Figure 5, we plotted the singular values ordered by value. It can be observed that while singular values in the first layer are much larger than the rest, many layers have a lot of singular values that are pretty big. For example, most of the layers have at least 10000 singular values that are at least 1. To give a complementary view, Figure 6 presents a plot of the ratios of the singular values in each layer with the largest singular value in that layer. We see that the effective rank of the convolutional layers is larger closer to the inputs.
|
| 355 |
+
|
| 356 |
+
Figure 6 shows that different convolutional layers have significantly different numbers of non-negligible singular values. A question that may arise is to what extent this was due to the fact that different layers simply are of different sizes, so that the total number of their singular values, tiny or not, was different. To look into this, instead of plotting the singular value ratios as a function of the rank of the singular values, as in the Figure 6, we normalized the values on the horizontal axis by dividing by the total number of singular values. The result is shown in Figure 7.
|
parse/train/rJevYoA9Fm/rJevYoA9Fm_content_list.json
ADDED
|
@@ -0,0 +1,1863 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[
|
| 2 |
+
{
|
| 3 |
+
"type": "text",
|
| 4 |
+
"text": "The Singular Values of Convolutional Layers ",
|
| 5 |
+
"text_level": 1,
|
| 6 |
+
"bbox": [
|
| 7 |
+
173,
|
| 8 |
+
98,
|
| 9 |
+
710,
|
| 10 |
+
122
|
| 11 |
+
],
|
| 12 |
+
"page_idx": 0
|
| 13 |
+
},
|
| 14 |
+
{
|
| 15 |
+
"type": "text",
|
| 16 |
+
"text": "Hanie Sedghi, Vineet Gupta and Philip M. Long ",
|
| 17 |
+
"bbox": [
|
| 18 |
+
187,
|
| 19 |
+
148,
|
| 20 |
+
519,
|
| 21 |
+
164
|
| 22 |
+
],
|
| 23 |
+
"page_idx": 0
|
| 24 |
+
},
|
| 25 |
+
{
|
| 26 |
+
"type": "text",
|
| 27 |
+
"text": "Google Brain \nMountain View, CA 94043 \n{hsedghi,vineet,plong}@google.com ",
|
| 28 |
+
"bbox": [
|
| 29 |
+
184,
|
| 30 |
+
165,
|
| 31 |
+
468,
|
| 32 |
+
205
|
| 33 |
+
],
|
| 34 |
+
"page_idx": 0
|
| 35 |
+
},
|
| 36 |
+
{
|
| 37 |
+
"type": "text",
|
| 38 |
+
"text": "Abstract ",
|
| 39 |
+
"text_level": 1,
|
| 40 |
+
"bbox": [
|
| 41 |
+
459,
|
| 42 |
+
242,
|
| 43 |
+
539,
|
| 44 |
+
257
|
| 45 |
+
],
|
| 46 |
+
"page_idx": 0
|
| 47 |
+
},
|
| 48 |
+
{
|
| 49 |
+
"type": "text",
|
| 50 |
+
"text": "We characterize the singular values of the linear transformation associated with a standard 2D multi-channel convolutional layer, enabling their efficient computation. This characterization also leads to an algorithm for projecting a convolutional layer onto an operator-norm ball. We show that this is an effective regularizer; for example, it improves the test error of a deep residual network using batch normalization on CIFAR-10 from $6 . 2 \\%$ to $5 . 3 \\%$ . ",
|
| 51 |
+
"bbox": [
|
| 52 |
+
233,
|
| 53 |
+
273,
|
| 54 |
+
766,
|
| 55 |
+
358
|
| 56 |
+
],
|
| 57 |
+
"page_idx": 0
|
| 58 |
+
},
|
| 59 |
+
{
|
| 60 |
+
"type": "text",
|
| 61 |
+
"text": "1 Introduction ",
|
| 62 |
+
"text_level": 1,
|
| 63 |
+
"bbox": [
|
| 64 |
+
176,
|
| 65 |
+
386,
|
| 66 |
+
318,
|
| 67 |
+
402
|
| 68 |
+
],
|
| 69 |
+
"page_idx": 0
|
| 70 |
+
},
|
| 71 |
+
{
|
| 72 |
+
"type": "text",
|
| 73 |
+
"text": "Exploding and vanishing gradients (Hochreiter, 1991; Hochreiter et al., 2001; Goodfellow et al., 2016) are fundamental obstacles to effective training of deep neural networks. Many deep networks used in practice are layered. We can think of such networks as the composition of a number of feature transformations, followed by a linear classifier on the final layer of features. The singular values of the Jacobian of a layer bound the factor by which it increases or decreases the norm of the backpropagated signal. If these singular values are all close to 1, then gradients neither explode nor vanish. These singular values also bound these factors in the forward direction, which affects the stability of computations, including whether the network produces the dreaded “Nan”. Moreover, it has been proven (Bartlett et al., 2017) that the generalization error for a network is bounded by the Lipschitz constant of the network, which in turn can be bounded by the product of the operator norms of the Jacobians of the layers. Cisse et al. (2017) discussed robustness to adversarial examples as a result of bounding the operator norm. ",
|
| 74 |
+
"bbox": [
|
| 75 |
+
174,
|
| 76 |
+
419,
|
| 77 |
+
825,
|
| 78 |
+
585
|
| 79 |
+
],
|
| 80 |
+
"page_idx": 0
|
| 81 |
+
},
|
| 82 |
+
{
|
| 83 |
+
"type": "text",
|
| 84 |
+
"text": "These considerations have led authors to regularize networks by driving down the operator norms of network layers (Drucker and Le Cun, 1992; Hein and Andriushchenko, 2017; Yoshida and Miyato, 2017; Miyato et al., 2018). Orthogonal initialization (Saxe et al., 2013; Pennington et al., 2017) and Parseval networks (Cisse et al., 2017) are motivated by similar considerations. ",
|
| 85 |
+
"bbox": [
|
| 86 |
+
174,
|
| 87 |
+
593,
|
| 88 |
+
825,
|
| 89 |
+
647
|
| 90 |
+
],
|
| 91 |
+
"page_idx": 0
|
| 92 |
+
},
|
| 93 |
+
{
|
| 94 |
+
"type": "text",
|
| 95 |
+
"text": "Convolutional layers (LeCun et al., 1998) are key components of modern deep networks. They compute linear transformations of their inputs. The Jacobian of a linear transformation is always equal to the linear transformation itself. Because of the central importance of convolutional layers to the practice of deep learning, and the fact that the singular values of the linear transformation computed by a convolutional layer are the key to its contribution to exploding and vanishing gradients, we study these singular values. Up until now, authors seeking to control the operator norm of convolutional layers have resorted to approximations (Yoshida and Miyato, 2017; Miyato et al., 2018; Gouk et al., 2018a). In this paper, we provide an efficient way to compute the singular values exactly — this opens the door to various regularizers. ",
|
| 96 |
+
"bbox": [
|
| 97 |
+
174,
|
| 98 |
+
655,
|
| 99 |
+
825,
|
| 100 |
+
780
|
| 101 |
+
],
|
| 102 |
+
"page_idx": 0
|
| 103 |
+
},
|
| 104 |
+
{
|
| 105 |
+
"type": "text",
|
| 106 |
+
"text": "We consider the convolutional layers commonly applied to image analysis tasks. The input to a typical layer is a feature map, with multiple channels for each position in an $n \\times n$ field. If there are $m$ channels, then the input as a whole is a $m \\times n \\times n$ tensor. The output is also an $n \\times n$ field with multiple channels per position1. Each channel of the output is obtained by taking a linear combination of the values of the features in all channels in a local neighborhood centered at the corresponding position in the input feature map. Crucially, the same linear combination is used for all positions in the feature map. The coefficients are compiled in the kernel of the convolution. If the neighborhood is a $k \\times k$ region, a kernel $K$ is a $k \\times k \\times m \\times m$ tensor. The projection $K _ { : , : , c , }$ : gives the coefficients that determine the cth channel of the output, in terms of the values found in all of the channels of all positions in it neighborhood; $K _ { : , : , c , d }$ gives the coefficients to apply to the dth input channel, and $K _ { p , q , c , d }$ is the coefficient to apply to this input at in the position in the field offset horizontally by $p$ and vertically by $q$ . For ease of exposition, we assume that feature maps and local neighborhoods are square and that the number of channels in the output is equal to the number of channels in the input - the extension to the general case is completely straightforward. ",
|
| 107 |
+
"bbox": [
|
| 108 |
+
174,
|
| 109 |
+
787,
|
| 110 |
+
825,
|
| 111 |
+
898
|
| 112 |
+
],
|
| 113 |
+
"page_idx": 0
|
| 114 |
+
},
|
| 115 |
+
{
|
| 116 |
+
"type": "text",
|
| 117 |
+
"text": "",
|
| 118 |
+
"bbox": [
|
| 119 |
+
174,
|
| 120 |
+
103,
|
| 121 |
+
825,
|
| 122 |
+
188
|
| 123 |
+
],
|
| 124 |
+
"page_idx": 1
|
| 125 |
+
},
|
| 126 |
+
{
|
| 127 |
+
"type": "text",
|
| 128 |
+
"text": "To handle edge cases in which the offsets call for inputs that are off the feature maps, practical convolutional layers either do not compute outputs (reducing the size of the feature map), or pad the input with zeros. The behavior of these layers can be approximated by a layer that treats the input as if it were a torus; when the offset calls for a pixel that is off the right end of the image, the layer “wraps around” to take it from the left edge, and similarly for the other edges. The quality of this approximation has been heavily analyzed in the case of one-dimensional signals (Gray, 2006). Consequently, theoretical analysis of convolutions that wrap around has been become standard. This is the case analyzed in this paper. ",
|
| 129 |
+
"bbox": [
|
| 130 |
+
174,
|
| 131 |
+
194,
|
| 132 |
+
825,
|
| 133 |
+
305
|
| 134 |
+
],
|
| 135 |
+
"page_idx": 1
|
| 136 |
+
},
|
| 137 |
+
{
|
| 138 |
+
"type": "text",
|
| 139 |
+
"text": "Summary of Results: Our main result is a characterization of the singular values of a convolutional layer in terms of the kernel tensor $K$ . Our characterization enables these singular values to be computed exactly in a simple and practically fast way, using $O ( n ^ { 2 } m ^ { 2 } ( m + \\log n ) )$ time. For comparison, the brute force solution that performs SVD on the matrix that encodes the convolutional layer’s linear transformation would take $O ( ( n ^ { 2 } m ) ^ { 3 } ) = O ( n ^ { 6 } m ^ { 3 } )$ time, and is impractical for commonly used network sizes. As another point of comparison, simply to compute the convolution takes $O ( n ^ { 2 } m ^ { 2 } k ^ { 2 } )$ time. We prove that the following two lines of NumPy correctly compute the singular values. ",
|
| 140 |
+
"bbox": [
|
| 141 |
+
174,
|
| 142 |
+
319,
|
| 143 |
+
825,
|
| 144 |
+
415
|
| 145 |
+
],
|
| 146 |
+
"page_idx": 1
|
| 147 |
+
},
|
| 148 |
+
{
|
| 149 |
+
"type": "text",
|
| 150 |
+
"text": "def SingularValues(kernel, input_shape): transforms $=$ np.fft.fft2(kernel, input_shape, axes $=$ [0, 1]) return np.linalg.svd(transforms, compute_uv=False) ",
|
| 151 |
+
"bbox": [
|
| 152 |
+
189,
|
| 153 |
+
425,
|
| 154 |
+
651,
|
| 155 |
+
463
|
| 156 |
+
],
|
| 157 |
+
"page_idx": 1
|
| 158 |
+
},
|
| 159 |
+
{
|
| 160 |
+
"type": "text",
|
| 161 |
+
"text": "Here kernel is any $k \\times k \\times m \\times m$ tensor2 and input_shape is the shape of the feature map to be convolved. A TensorFlow implementation is similarly simple. ",
|
| 162 |
+
"bbox": [
|
| 163 |
+
174,
|
| 164 |
+
474,
|
| 165 |
+
823,
|
| 166 |
+
502
|
| 167 |
+
],
|
| 168 |
+
"page_idx": 1
|
| 169 |
+
},
|
| 170 |
+
{
|
| 171 |
+
"type": "text",
|
| 172 |
+
"text": "Timing tests, reported in Section 4.1, confirm that this characterization speeds up the computation of singular values by multiple orders of magnitude – making it usable in practice. The algorithm first performs $m ^ { 2 }$ FFTs, and then it performs ${ { \\bar { n } } ^ { 2 } }$ SVDs. The FFTs, and then the SVDs, may be executed in parallel. Our TensorFlow implementation runs a lot faster than the NumPy implementation (see Figure 1); we think that this parallelism is the cause. We used our code to compute the singular values of the convolutional layers of the official ResNet-v2 model released with TensorFlow (He et al., 2016). The results are described in Appendix C. ",
|
| 173 |
+
"bbox": [
|
| 174 |
+
174,
|
| 175 |
+
511,
|
| 176 |
+
825,
|
| 177 |
+
608
|
| 178 |
+
],
|
| 179 |
+
"page_idx": 1
|
| 180 |
+
},
|
| 181 |
+
{
|
| 182 |
+
"type": "text",
|
| 183 |
+
"text": "Exposing the singular values of a convolutional layer opens the door to a variety of regularizers for these layers, including operator-norm regularizers. In Section 4.2, we evaluate an algorithm that periodically projects each convolutional layer onto a operator-norm ball. Using the projections improves the test error from $6 . 2 \\%$ to $5 . 3 \\%$ on CIFAR-10. We evaluate bounding the operator norm with and without batchnorm and we see that regularizing the operator norm helps, even in the presence of batch normalization. Moreover, operator-norm regularization and batch normalization are not redundant, and neither dominates the other. They complement each other. ",
|
| 184 |
+
"bbox": [
|
| 185 |
+
174,
|
| 186 |
+
614,
|
| 187 |
+
825,
|
| 188 |
+
712
|
| 189 |
+
],
|
| 190 |
+
"page_idx": 1
|
| 191 |
+
},
|
| 192 |
+
{
|
| 193 |
+
"type": "text",
|
| 194 |
+
"text": "Related work: Prior to our work, authors have responded to the difficulty of computing the singular values of convolutional layers in various ways. Cisse et al. (2017) constrained the matrix to have orthogonal rows and scale the output of each layer by a factor of $( 2 k + 1 ) ^ { - \\frac { 1 } { 2 } }$ , for $k \\times k$ kernels. Gouk et al. (2018a;b) proposed regularizing using a per-mini-batch approximation to the operator norm. They find the largest ratio between the input and output of a layer in the minibatch, and then scale down the transformation (thereby scaling down all of the singular values, not just the largest ones) so that the new value of this ratio obeys a constraint. ",
|
| 195 |
+
"bbox": [
|
| 196 |
+
173,
|
| 197 |
+
727,
|
| 198 |
+
825,
|
| 199 |
+
827
|
| 200 |
+
],
|
| 201 |
+
"page_idx": 1
|
| 202 |
+
},
|
| 203 |
+
{
|
| 204 |
+
"type": "text",
|
| 205 |
+
"text": "Yoshida and Miyato (2017) used an approximation of the operator norm of a reshaping of $K$ in place of the operator norm for the linear transformation associated with $K$ in their experiments. They reshape the given $k \\times k \\times m \\times m$ into a $m k ^ { 2 } \\times m$ matrix, and compute its largest singular value using a power iteration method, and use this as a substitute for the operator norm. While this provides a useful heuristic for regularization, the largest singular value of the reshaped matrix is often quite different from the operator norm of the linear transform associated with $K$ . Furthermore if we want to regularize using projection onto an operator-norm ball, we need the whole spectrum of the linear transformation (see Section 3). The reshaped $K$ has only $m$ singular values, whereas the linear transformation has $m n ^ { 2 }$ singular values of which $m n ^ { 2 } / 2$ are distinct except in rare degenerate cases. It is possible to project the reshaped $K$ onto an operator-norm ball by taking its SVD and clipping its singular values — we conducted experiments with this projection and report the results in Section 4.4. ",
|
| 206 |
+
"bbox": [
|
| 207 |
+
174,
|
| 208 |
+
833,
|
| 209 |
+
825,
|
| 210 |
+
890
|
| 211 |
+
],
|
| 212 |
+
"page_idx": 1
|
| 213 |
+
},
|
| 214 |
+
{
|
| 215 |
+
"type": "text",
|
| 216 |
+
"text": "",
|
| 217 |
+
"bbox": [
|
| 218 |
+
174,
|
| 219 |
+
103,
|
| 220 |
+
825,
|
| 221 |
+
202
|
| 222 |
+
],
|
| 223 |
+
"page_idx": 2
|
| 224 |
+
},
|
| 225 |
+
{
|
| 226 |
+
"type": "text",
|
| 227 |
+
"text": "A close relative of our main result was independently discovered by Bibi et al. (2019, Lemma 2). ",
|
| 228 |
+
"bbox": [
|
| 229 |
+
173,
|
| 230 |
+
208,
|
| 231 |
+
805,
|
| 232 |
+
223
|
| 233 |
+
],
|
| 234 |
+
"page_idx": 2
|
| 235 |
+
},
|
| 236 |
+
{
|
| 237 |
+
"type": "text",
|
| 238 |
+
"text": "Overview of the Analysis: If the signal is 1D and there is a single input and output channel, then the linear transformation associated with a convolution is encoded by a circulant matrix, i.e., a matrix whose rows are circular shifts of a single row (Gray, 2006). For example, for a row $a = ( a _ { 1 } , a _ { 2 } , a _ { 3 } )$ , the circulant matrix $\\mathrm { c i r c } ( a )$ generated by $a$ is $\\left( \\begin{array} { l l l } { a _ { 0 } } & { a _ { 1 } } & { a _ { 2 } } \\\\ { a _ { 2 } } & { a _ { 0 } } & { a _ { 1 } } \\\\ { a _ { 1 } } & { a _ { 2 } } & { a _ { 0 } } \\end{array} \\right)$ . In the special case of a 2D signal with a single input channel and single output channel, the linear transformation is doubly block circulant (see (Goodfellow et al., 2016)). Such a matrix is made up of a circulant matrix of blocks, each of which in turn is itself circulant. Finally, when there are $m$ input channels and $m$ output channels, there are three levels to the hierarchy: there is a $m \\times m$ matrix of blocks, each of which is doubly block circulant. Our analysis extends tools from the literature built for circulant (Horn and Johnson, 2012) and doubly circulant (Chao, 1974) matrices to analyze the matrices with a third level in the hierarchy arising from the convolutional layers used in deep learning. One key point is that the eigenvectors of a circulant matrix are Fourier basis vectors: in the 2D, one-channel case, the matrix whose columns are the eigenvectors is $F \\otimes F$ , for the matrix $F$ whose columns form the Fourier basis. Multiplying by this matrix is a 2D Fourier transform. In the multi-channel case, we show that the singular values can be computed by (a) finding the eigenvalues of each of the $m ^ { 2 }$ doubly circulant matrices (of dimensions $n ^ { 2 } \\times n ^ { 2 }$ ) using a 2D Fourier transform, (b) by forming multiple $m \\times m$ matrices, one for each eigenvalue, by picking out the $i$ -th eigenvalue of each of the $n ^ { 2 } \\times n ^ { 2 }$ blocks, for $i \\in [ 1 . . n ^ { 2 } ]$ . The union of all of the singular values of all of those $m \\times m$ matrices is the multiset of singular values of the layer. ",
|
| 239 |
+
"bbox": [
|
| 240 |
+
173,
|
| 241 |
+
241,
|
| 242 |
+
826,
|
| 243 |
+
534
|
| 244 |
+
],
|
| 245 |
+
"page_idx": 2
|
| 246 |
+
},
|
| 247 |
+
{
|
| 248 |
+
"type": "text",
|
| 249 |
+
"text": "Notation: We use upper case letters for matrices, lower case for vectors. For matrix $M , M _ { i }$ ,: represents the $i$ -th row and $M _ { : , j }$ represents the $j$ -th column; we will also use the analogous notation for higher-order tensors. The operator norm of $M$ is denoted by $| | { \\cal M } | | _ { 2 }$ . For $n \\in \\mathbb { N }$ , we use $[ n ]$ to denote the set $\\{ 0 , 1 , \\ldots , n - 1 \\}$ (instead of usual $\\{ 1 , \\ldots , n \\} )$ . We will index the rows and columns of matrices using elements of $[ n ]$ , i.e. numbering from 0. Addition of row and column indices will be done mod $n$ unless otherwise indicated. (Tensors will be treated analogously.) Let $\\sigma ( \\cdot )$ be the mapping from a matrix to (the multiset of) its singular values. 3 ",
|
| 250 |
+
"bbox": [
|
| 251 |
+
173,
|
| 252 |
+
541,
|
| 253 |
+
825,
|
| 254 |
+
638
|
| 255 |
+
],
|
| 256 |
+
"page_idx": 2
|
| 257 |
+
},
|
| 258 |
+
{
|
| 259 |
+
"type": "text",
|
| 260 |
+
"text": "Let $\\omega = \\exp ( 2 \\pi i / n )$ , where $i = \\sqrt { - 1 }$ . (Because we need a lot of indices in this paper, our use of √ $i$ to define $\\omega$ is the only place in the paper where we will use $i$ to denote $\\sqrt { - 1 }$ .) ",
|
| 261 |
+
"bbox": [
|
| 262 |
+
174,
|
| 263 |
+
643,
|
| 264 |
+
821,
|
| 265 |
+
675
|
| 266 |
+
],
|
| 267 |
+
"page_idx": 2
|
| 268 |
+
},
|
| 269 |
+
{
|
| 270 |
+
"type": "text",
|
| 271 |
+
"text": "Let $F$ be the $n \\times n$ matrix that represents the discrete Fourier transform: $F _ { i j } = \\omega ^ { i j }$ . We use $I _ { n }$ to denote the identity matrix of size $n \\times n$ . For $i \\in [ n ]$ , we use $e _ { i }$ to represent the ith basis vector in $\\mathbb { R } ^ { n }$ We use $\\otimes$ to represent the Kronecker product between two matrices (which also refers to the outer product of two vectors). ",
|
| 272 |
+
"bbox": [
|
| 273 |
+
174,
|
| 274 |
+
681,
|
| 275 |
+
825,
|
| 276 |
+
738
|
| 277 |
+
],
|
| 278 |
+
"page_idx": 2
|
| 279 |
+
},
|
| 280 |
+
{
|
| 281 |
+
"type": "text",
|
| 282 |
+
"text": "2 Analysis ",
|
| 283 |
+
"text_level": 1,
|
| 284 |
+
"bbox": [
|
| 285 |
+
174,
|
| 286 |
+
762,
|
| 287 |
+
282,
|
| 288 |
+
779
|
| 289 |
+
],
|
| 290 |
+
"page_idx": 2
|
| 291 |
+
},
|
| 292 |
+
{
|
| 293 |
+
"type": "text",
|
| 294 |
+
"text": "2.1 One filter ",
|
| 295 |
+
"text_level": 1,
|
| 296 |
+
"bbox": [
|
| 297 |
+
174,
|
| 298 |
+
796,
|
| 299 |
+
287,
|
| 300 |
+
810
|
| 301 |
+
],
|
| 302 |
+
"page_idx": 2
|
| 303 |
+
},
|
| 304 |
+
{
|
| 305 |
+
"type": "text",
|
| 306 |
+
"text": "As a warmup, we focus on the case that the number $m$ of input channels and output channels is 1. In this case, the filter coefficients are simply a $k \\times k$ matrix. It will simplify notation, however, if we embed this $k \\times k$ matrix in an $n \\times n$ matrix, by padding with zeroes (which corresponds to the fact that the offsets with those indices are not used). Let us refer to this $n \\times n$ matrix also as $K$ . ",
|
| 307 |
+
"bbox": [
|
| 308 |
+
174,
|
| 309 |
+
825,
|
| 310 |
+
825,
|
| 311 |
+
881
|
| 312 |
+
],
|
| 313 |
+
"page_idx": 2
|
| 314 |
+
},
|
| 315 |
+
{
|
| 316 |
+
"type": "text",
|
| 317 |
+
"text": "An $n ^ { 2 } \\times n ^ { 2 }$ matrix $A$ is doubly block circulant if $A$ is a circulant matrix of $n \\times n$ blocks that are in turn circulant. ",
|
| 318 |
+
"bbox": [
|
| 319 |
+
171,
|
| 320 |
+
103,
|
| 321 |
+
825,
|
| 322 |
+
132
|
| 323 |
+
],
|
| 324 |
+
"page_idx": 3
|
| 325 |
+
},
|
| 326 |
+
{
|
| 327 |
+
"type": "text",
|
| 328 |
+
"text": "For a matrix $X$ , let $\\operatorname { v e c } ( X )$ be the vector obtained by stacking the columns of $X$ . ",
|
| 329 |
+
"bbox": [
|
| 330 |
+
173,
|
| 331 |
+
138,
|
| 332 |
+
705,
|
| 333 |
+
155
|
| 334 |
+
],
|
| 335 |
+
"page_idx": 3
|
| 336 |
+
},
|
| 337 |
+
{
|
| 338 |
+
"type": "text",
|
| 339 |
+
"text": "Lemma 1 (see Jain (1989) Section 5.5, Goodfellow et al. (2016) page 329) For any filter coefficients $K$ , the linear transform for the convolution by $K$ is represented by the following doubly block circulant matrix: ",
|
| 340 |
+
"bbox": [
|
| 341 |
+
173,
|
| 342 |
+
164,
|
| 343 |
+
825,
|
| 344 |
+
207
|
| 345 |
+
],
|
| 346 |
+
"page_idx": 3
|
| 347 |
+
},
|
| 348 |
+
{
|
| 349 |
+
"type": "equation",
|
| 350 |
+
"img_path": "images/bf18dcaeb7ed4f6ee830b35407e9e346fbec023aebd221af99f64b4a5bf36ac1.jpg",
|
| 351 |
+
"text": "$$\n\\begin{array} { r } { A = \\left[ \\begin{array} { c c c c } { \\mathrm { c i r c } ( K _ { 0 , : } ) } & { \\mathrm { c i r c } ( K _ { 1 , : } ) } & { \\ldots } & { \\mathrm { c i r c } ( K _ { n - 1 , : } ) } \\\\ { \\mathrm { c i r c } ( K _ { n - 1 , : } ) } & { \\mathrm { c i r c } ( K _ { 0 , : } ) } & { \\ldots } & { \\mathrm { c i r c } ( K _ { n - 2 , : } ) } \\\\ { \\vdots } & { \\vdots } & { \\vdots } & { \\vdots } \\\\ { \\mathrm { c i r c } ( K _ { 1 , : } ) } & { \\mathrm { c i r c } ( K _ { 2 , : } ) } & { \\ldots } & { \\mathrm { c i r c } ( K _ { 0 , : } ) } \\end{array} \\right] . } \\end{array}\n$$",
|
| 352 |
+
"text_format": "latex",
|
| 353 |
+
"bbox": [
|
| 354 |
+
302,
|
| 355 |
+
208,
|
| 356 |
+
694,
|
| 357 |
+
279
|
| 358 |
+
],
|
| 359 |
+
"page_idx": 3
|
| 360 |
+
},
|
| 361 |
+
{
|
| 362 |
+
"type": "text",
|
| 363 |
+
"text": "That is, $i f X$ is an $n \\times n$ matrix, and $Y$ is the result of a 2-d convolution of $X$ with $K$ , i.e. ",
|
| 364 |
+
"bbox": [
|
| 365 |
+
173,
|
| 366 |
+
281,
|
| 367 |
+
758,
|
| 368 |
+
296
|
| 369 |
+
],
|
| 370 |
+
"page_idx": 3
|
| 371 |
+
},
|
| 372 |
+
{
|
| 373 |
+
"type": "equation",
|
| 374 |
+
"img_path": "images/2967315b55fc342e5bc9c604818ab2ceaab7d5c2c69c1e282cbeb4326e6319be.jpg",
|
| 375 |
+
"text": "$$\n\\forall i j , Y _ { i j } = \\sum _ { p \\in [ n ] } \\sum _ { q \\in [ n ] } X _ { i + p , j + q } K _ { p , q }\n$$",
|
| 376 |
+
"text_format": "latex",
|
| 377 |
+
"bbox": [
|
| 378 |
+
375,
|
| 379 |
+
299,
|
| 380 |
+
619,
|
| 381 |
+
337
|
| 382 |
+
],
|
| 383 |
+
"page_idx": 3
|
| 384 |
+
},
|
| 385 |
+
{
|
| 386 |
+
"type": "text",
|
| 387 |
+
"text": "then $\\operatorname { v e c } ( Y ) = A \\operatorname { v e c } ( X ) .$ ",
|
| 388 |
+
"bbox": [
|
| 389 |
+
174,
|
| 390 |
+
340,
|
| 391 |
+
348,
|
| 392 |
+
356
|
| 393 |
+
],
|
| 394 |
+
"page_idx": 3
|
| 395 |
+
},
|
| 396 |
+
{
|
| 397 |
+
"type": "text",
|
| 398 |
+
"text": "So now we want to determine the singular values of a doubly block circulant matrix. ",
|
| 399 |
+
"bbox": [
|
| 400 |
+
176,
|
| 401 |
+
367,
|
| 402 |
+
723,
|
| 403 |
+
382
|
| 404 |
+
],
|
| 405 |
+
"page_idx": 3
|
| 406 |
+
},
|
| 407 |
+
{
|
| 408 |
+
"type": "text",
|
| 409 |
+
"text": "We will make use of the characterization of the eigenvalues and eigenvectors of doubly block circulant matrices, which uses the following definition: $Q \\stackrel { \\mathrm { d e f } } { = } \\frac { 1 } { n } \\left( F \\otimes F \\right)$ . ",
|
| 410 |
+
"bbox": [
|
| 411 |
+
176,
|
| 412 |
+
388,
|
| 413 |
+
821,
|
| 414 |
+
422
|
| 415 |
+
],
|
| 416 |
+
"page_idx": 3
|
| 417 |
+
},
|
| 418 |
+
{
|
| 419 |
+
"type": "text",
|
| 420 |
+
"text": "Theorem 2 (Jain (1989) Section 5.5) For any $n ^ { 2 } \\times n ^ { 2 }$ doubly block circulant matrix $A$ , the eigenvectors of $A$ are the columns of $Q$ . ",
|
| 421 |
+
"bbox": [
|
| 422 |
+
176,
|
| 423 |
+
433,
|
| 424 |
+
823,
|
| 425 |
+
464
|
| 426 |
+
],
|
| 427 |
+
"page_idx": 3
|
| 428 |
+
},
|
| 429 |
+
{
|
| 430 |
+
"type": "text",
|
| 431 |
+
"text": "To get singular values in addition to eigenvalues, we need the following two lemmas. ",
|
| 432 |
+
"bbox": [
|
| 433 |
+
173,
|
| 434 |
+
473,
|
| 435 |
+
727,
|
| 436 |
+
489
|
| 437 |
+
],
|
| 438 |
+
"page_idx": 3
|
| 439 |
+
},
|
| 440 |
+
{
|
| 441 |
+
"type": "text",
|
| 442 |
+
"text": "Lemma 3 (Jain (1989) Section 5.5) $Q$ is unitary. ",
|
| 443 |
+
"bbox": [
|
| 444 |
+
173,
|
| 445 |
+
497,
|
| 446 |
+
504,
|
| 447 |
+
513
|
| 448 |
+
],
|
| 449 |
+
"page_idx": 3
|
| 450 |
+
},
|
| 451 |
+
{
|
| 452 |
+
"type": "text",
|
| 453 |
+
"text": "Using Theorem 2 and Lemma 3, we can get the eigenvalues as the diagonal elements of $Q ^ { * } A Q$ . ",
|
| 454 |
+
"bbox": [
|
| 455 |
+
171,
|
| 456 |
+
523,
|
| 457 |
+
799,
|
| 458 |
+
540
|
| 459 |
+
],
|
| 460 |
+
"page_idx": 3
|
| 461 |
+
},
|
| 462 |
+
{
|
| 463 |
+
"type": "text",
|
| 464 |
+
"text": "Lemma 4 The matrix $A$ defined in equation $^ { l }$ is normal, i.e., $A ^ { T } A = A A ^ { T }$ . ",
|
| 465 |
+
"bbox": [
|
| 466 |
+
173,
|
| 467 |
+
549,
|
| 468 |
+
678,
|
| 469 |
+
565
|
| 470 |
+
],
|
| 471 |
+
"page_idx": 3
|
| 472 |
+
},
|
| 473 |
+
{
|
| 474 |
+
"type": "text",
|
| 475 |
+
"text": "Proof: ",
|
| 476 |
+
"text_level": 1,
|
| 477 |
+
"bbox": [
|
| 478 |
+
173,
|
| 479 |
+
577,
|
| 480 |
+
220,
|
| 481 |
+
590
|
| 482 |
+
],
|
| 483 |
+
"page_idx": 3
|
| 484 |
+
},
|
| 485 |
+
{
|
| 486 |
+
"type": "equation",
|
| 487 |
+
"img_path": "images/e0a170445ca8fc22ab0fc9c16bfc5bfdd84f9e1c9915cecdcec18d384badcef1.jpg",
|
| 488 |
+
"text": "$$\nA A ^ { T } = A A ^ { * } = Q ^ { * } D Q Q ^ { * } D ^ { * } Q = Q ^ { * } D D ^ { * } Q = Q ^ { * } D ^ { * } D Q = Q ^ { * } D ^ { * } Q Q ^ { * } D Q = A ^ { * } A = A ^ { T } A .\n$$",
|
| 489 |
+
"text_format": "latex",
|
| 490 |
+
"bbox": [
|
| 491 |
+
181,
|
| 492 |
+
594,
|
| 493 |
+
816,
|
| 494 |
+
613
|
| 495 |
+
],
|
| 496 |
+
"page_idx": 3
|
| 497 |
+
},
|
| 498 |
+
{
|
| 499 |
+
"type": "text",
|
| 500 |
+
"text": "The following theorem characterizes the singular values of $A$ as a simple function of $K$ . As we will see, a characterization of the eigenvalues plays a major role. Chao (1974) provided a more technical characterization of the eigenvalues which may be regarded as making partial progress toward Theorem 5. However, we provide a proof from first principles, since it is the cleanest way we know to prove the theorem. ",
|
| 501 |
+
"bbox": [
|
| 502 |
+
173,
|
| 503 |
+
637,
|
| 504 |
+
825,
|
| 505 |
+
708
|
| 506 |
+
],
|
| 507 |
+
"page_idx": 3
|
| 508 |
+
},
|
| 509 |
+
{
|
| 510 |
+
"type": "text",
|
| 511 |
+
"text": "Theorem 5 For the matrix $A$ defined in equation $I$ , the eigenvalues of $A$ are the entries of $F ^ { T } K F$ and its singular values are their magnitudes. That is, the singular values of $A$ are ",
|
| 512 |
+
"bbox": [
|
| 513 |
+
171,
|
| 514 |
+
718,
|
| 515 |
+
825,
|
| 516 |
+
748
|
| 517 |
+
],
|
| 518 |
+
"page_idx": 3
|
| 519 |
+
},
|
| 520 |
+
{
|
| 521 |
+
"type": "equation",
|
| 522 |
+
"img_path": "images/1b4489f66523ab07dc89a4fad1abc9688d1b38e90bf9b0cf0902794ae693203c.jpg",
|
| 523 |
+
"text": "$$\n\\left\\{ \\left| ( F ^ { T } K F ) _ { u , v } \\right| \\ : \\ u , v \\in [ n ] \\right\\} .\n$$",
|
| 524 |
+
"text_format": "latex",
|
| 525 |
+
"bbox": [
|
| 526 |
+
395,
|
| 527 |
+
751,
|
| 528 |
+
606,
|
| 529 |
+
771
|
| 530 |
+
],
|
| 531 |
+
"page_idx": 3
|
| 532 |
+
},
|
| 533 |
+
{
|
| 534 |
+
"type": "text",
|
| 535 |
+
"text": "Proof: By Theorems 2 and Lemma 3, the eigenvalues of $A$ are the diagonal elements of $Q ^ { * } A Q =$ $\\mathring { \\neg } ( F ^ { * } \\otimes \\bar { F } ^ { * } ) A ( F \\otimes F )$ . If we view $( F ^ { * } \\otimes F ^ { * } ) A ( F \\otimes F )$ as a compound $n \\times n$ matrix of $n \\times n$ blocks, for $u , v \\in [ n ]$ , the $( u n + v )$ th diagonal element is the $v$ th element of the $u$ th diagonal block. Let us first evaluate the uth diagonal block. Using $i , j$ to index blocks, we have ",
|
| 536 |
+
"bbox": [
|
| 537 |
+
174,
|
| 538 |
+
780,
|
| 539 |
+
825,
|
| 540 |
+
838
|
| 541 |
+
],
|
| 542 |
+
"page_idx": 3
|
| 543 |
+
},
|
| 544 |
+
{
|
| 545 |
+
"type": "equation",
|
| 546 |
+
"img_path": "images/d2e9ab1c263360c17e4bb4073a14e684eb58fc40eace4c38eb96c6d3137d9219.jpg",
|
| 547 |
+
"text": "$$\n\\begin{array} { l } { { ( Q ^ { * } A Q ) _ { u u } = \\displaystyle \\frac { 1 } { n ^ { 2 } } \\sum _ { i , j \\in [ n ] } ( F ^ { * } \\otimes F ^ { * } ) _ { u i } A _ { i j } ( F \\otimes F ) _ { j u } = \\displaystyle \\frac { 1 } { n ^ { 2 } } \\sum _ { i , j \\in [ n ] } \\omega ^ { - u i } F ^ { * } \\mathrm { c i r c } ( K _ { j - i , \\cdot } ) \\omega ^ { j u } F } } \\\\ { { = \\displaystyle \\frac { 1 } { n ^ { 2 } } \\sum _ { i , j \\in [ n ] } \\omega ^ { u ( j - i ) } F ^ { * } \\mathrm { c i r c } ( K _ { j - i , \\cdot } ) F . } } \\end{array}\n$$",
|
| 548 |
+
"text_format": "latex",
|
| 549 |
+
"bbox": [
|
| 550 |
+
194,
|
| 551 |
+
840,
|
| 552 |
+
803,
|
| 553 |
+
922
|
| 554 |
+
],
|
| 555 |
+
"page_idx": 3
|
| 556 |
+
},
|
| 557 |
+
{
|
| 558 |
+
"type": "text",
|
| 559 |
+
"text": "To get the $v$ th element of the diagonal of (4), we may sum the vth elements of the diagonals of each of its terms. Toward this end, we have ",
|
| 560 |
+
"bbox": [
|
| 561 |
+
171,
|
| 562 |
+
103,
|
| 563 |
+
825,
|
| 564 |
+
132
|
| 565 |
+
],
|
| 566 |
+
"page_idx": 4
|
| 567 |
+
},
|
| 568 |
+
{
|
| 569 |
+
"type": "equation",
|
| 570 |
+
"img_path": "images/80a0689efbdd7472da0a56701fe521988ac42d92e59bd41cf6849e9a2d524dc8.jpg",
|
| 571 |
+
"text": "$$\n( F ^ { * } \\mathrm { c i r c } ( K _ { j - i , : } ) F ) _ { v v } = \\sum _ { r , s \\in [ n ] } \\omega ^ { - v r } \\mathrm { c i r c } ( K _ { j - i , : } ) _ { r s } \\omega ^ { s v } = \\sum _ { r , s \\in [ n ] } \\omega ^ { v ( s - r ) } K _ { j - i , s - r } .\n$$",
|
| 572 |
+
"text_format": "latex",
|
| 573 |
+
"bbox": [
|
| 574 |
+
223,
|
| 575 |
+
136,
|
| 576 |
+
772,
|
| 577 |
+
174
|
| 578 |
+
],
|
| 579 |
+
"page_idx": 4
|
| 580 |
+
},
|
| 581 |
+
{
|
| 582 |
+
"type": "text",
|
| 583 |
+
"text": "Substituting into (4), we get $\\begin{array} { r } { \\frac { 1 } { n ^ { 2 } } \\sum _ { i , j , r , s \\in [ n ] } \\omega ^ { u ( j - i ) } \\omega ^ { v ( s - r ) } K _ { j - i , s - r } . } \\end{array}$ . Collecting terms where $j - i =$ $p$ and $s - r = q$ , this is $\\begin{array} { r } { \\sum _ { p , q \\in [ n ] } \\omega ^ { u p } \\omega ^ { v q } K _ { p , q } = ( F ^ { T } K F ) _ { u v } } \\end{array}$ . ",
|
| 584 |
+
"bbox": [
|
| 585 |
+
173,
|
| 586 |
+
199,
|
| 587 |
+
825,
|
| 588 |
+
237
|
| 589 |
+
],
|
| 590 |
+
"page_idx": 4
|
| 591 |
+
},
|
| 592 |
+
{
|
| 593 |
+
"type": "text",
|
| 594 |
+
"text": "Since the singular values of any normal matrix are the magnitudes of its eigenvalues (Horn and Johnson (2012) page 158), applying Lemma 4 completes the proof. □ ",
|
| 595 |
+
"bbox": [
|
| 596 |
+
174,
|
| 597 |
+
242,
|
| 598 |
+
825,
|
| 599 |
+
272
|
| 600 |
+
],
|
| 601 |
+
"page_idx": 4
|
| 602 |
+
},
|
| 603 |
+
{
|
| 604 |
+
"type": "text",
|
| 605 |
+
"text": "Note that $F ^ { T } K F$ is the 2D Fourier transform of $K$ , and recall that $| | A | | _ { 2 }$ is the largest singular value of $A$ . ",
|
| 606 |
+
"bbox": [
|
| 607 |
+
173,
|
| 608 |
+
276,
|
| 609 |
+
825,
|
| 610 |
+
306
|
| 611 |
+
],
|
| 612 |
+
"page_idx": 4
|
| 613 |
+
},
|
| 614 |
+
{
|
| 615 |
+
"type": "text",
|
| 616 |
+
"text": "2.2 Multi-channel convolution ",
|
| 617 |
+
"text_level": 1,
|
| 618 |
+
"bbox": [
|
| 619 |
+
176,
|
| 620 |
+
323,
|
| 621 |
+
415,
|
| 622 |
+
338
|
| 623 |
+
],
|
| 624 |
+
"page_idx": 4
|
| 625 |
+
},
|
| 626 |
+
{
|
| 627 |
+
"type": "text",
|
| 628 |
+
"text": "Now, we consider case where the number $m$ of channels may be more than one. Assume we have a 4D kernel tensor $K$ with element $K _ { p , q , c , d }$ giving the connection strength between a unit in channel $d$ of the input and a unit in channel $c$ of the output, with an offset of $p$ rows and $q$ columns between the input unit and the output unit. The input $X \\in \\mathbb { R } ^ { m \\times n \\times n }$ ; element $X _ { d , i , j }$ is the value of the input unit within channel $d$ at row $i$ and column $j$ . The output $Y \\in \\mathbb { R } ^ { m \\times n \\times n }$ has the same format as $X$ , and is produced by ",
|
| 629 |
+
"bbox": [
|
| 630 |
+
173,
|
| 631 |
+
348,
|
| 632 |
+
826,
|
| 633 |
+
433
|
| 634 |
+
],
|
| 635 |
+
"page_idx": 4
|
| 636 |
+
},
|
| 637 |
+
{
|
| 638 |
+
"type": "equation",
|
| 639 |
+
"img_path": "images/15ce5e4b0763da1fc3e28dee2e70e520f6f63e30ad16c3c59868c993d599aa35.jpg",
|
| 640 |
+
"text": "$$\nY _ { c r s } = \\sum _ { d \\in [ m ] } \\sum _ { p \\in [ n ] } \\sum _ { q \\in [ n ] } X _ { d , r + p , s + q } K _ { p , q , c , d } .\n$$",
|
| 641 |
+
"text_format": "latex",
|
| 642 |
+
"bbox": [
|
| 643 |
+
352,
|
| 644 |
+
439,
|
| 645 |
+
643,
|
| 646 |
+
476
|
| 647 |
+
],
|
| 648 |
+
"page_idx": 4
|
| 649 |
+
},
|
| 650 |
+
{
|
| 651 |
+
"type": "text",
|
| 652 |
+
"text": "By inspection, $\\operatorname { v e c } ( Y ) = M \\operatorname { v e c } ( X )$ , where $M$ is as follows ",
|
| 653 |
+
"bbox": [
|
| 654 |
+
173,
|
| 655 |
+
489,
|
| 656 |
+
566,
|
| 657 |
+
506
|
| 658 |
+
],
|
| 659 |
+
"page_idx": 4
|
| 660 |
+
},
|
| 661 |
+
{
|
| 662 |
+
"type": "equation",
|
| 663 |
+
"img_path": "images/57a2ed388c1b005e298cd2a7fc808a56a6ede79262b9f2614102fa1228c4f9a7.jpg",
|
| 664 |
+
"text": "$$\n{ \\cal M } = \\left[ \\begin{array} { c c c c } { { B _ { 0 0 } } } & { { B _ { 0 1 } } } & { { \\dots } } & { { B _ { 0 ( m - 1 ) } } } \\\\ { { B _ { 1 0 } } } & { { B _ { 1 1 } } } & { { \\dots } } & { { B _ { 1 ( m - 1 ) } } } \\\\ { { \\vdots } } & { { \\vdots } } & { { \\ddots } } & { { \\vdots } } \\\\ { { B _ { ( m - 1 ) 0 } } } & { { B _ { ( m - 1 ) 1 } } } & { { \\dots } } & { { B _ { ( m - 1 ) ( m - 1 ) } } } \\end{array} \\right]\n$$",
|
| 665 |
+
"text_format": "latex",
|
| 666 |
+
"bbox": [
|
| 667 |
+
318,
|
| 668 |
+
511,
|
| 669 |
+
676,
|
| 670 |
+
583
|
| 671 |
+
],
|
| 672 |
+
"page_idx": 4
|
| 673 |
+
},
|
| 674 |
+
{
|
| 675 |
+
"type": "text",
|
| 676 |
+
"text": "and each $B _ { c d }$ is a doubly block circulant matrix from Lemma 1 corresponding to the portion $K _ { : , : , c , d }$ of $K$ that concerns the effect of the $d$ -th input channel on the $c$ -th output channel. (We can think of each output in the multichannel case as being a sum of single channel filters parameterized by one of the $K _ { : , : , c , d }$ ’s.) ",
|
| 677 |
+
"bbox": [
|
| 678 |
+
176,
|
| 679 |
+
587,
|
| 680 |
+
821,
|
| 681 |
+
643
|
| 682 |
+
],
|
| 683 |
+
"page_idx": 4
|
| 684 |
+
},
|
| 685 |
+
{
|
| 686 |
+
"type": "text",
|
| 687 |
+
"text": "The following is our main result. ",
|
| 688 |
+
"bbox": [
|
| 689 |
+
174,
|
| 690 |
+
650,
|
| 691 |
+
388,
|
| 692 |
+
665
|
| 693 |
+
],
|
| 694 |
+
"page_idx": 4
|
| 695 |
+
},
|
| 696 |
+
{
|
| 697 |
+
"type": "text",
|
| 698 |
+
"text": "Theorem 6 For any $K \\in \\mathbb { R } ^ { n \\times n \\times m \\times m }$ , let $M$ is the matrix encoding the linear transformation computed by a convolutional layer parameterized by $K$ , defined as in (6). For each $u , v \\in [ n ] \\times [ n ]$ , let $P ^ { ( u , v ) }$ be the $m \\times m$ matrix given by $P _ { c d } ^ { ( u , v ) } = ( F ^ { T } K _ { : , : , c , d } F ) _ { u v }$ . Then ",
|
| 699 |
+
"bbox": [
|
| 700 |
+
173,
|
| 701 |
+
675,
|
| 702 |
+
826,
|
| 703 |
+
724
|
| 704 |
+
],
|
| 705 |
+
"page_idx": 4
|
| 706 |
+
},
|
| 707 |
+
{
|
| 708 |
+
"type": "equation",
|
| 709 |
+
"img_path": "images/92bb344dd01a8020b9b0e72299336f4d1c04d9ad06e856b2b9b8a8bd2270211f.jpg",
|
| 710 |
+
"text": "$$\n\\sigma ( M ) = \\bigcup _ { u \\in [ n ] , v \\in [ n ] } \\sigma \\left( P ^ { ( u , v ) } \\right) .\n$$",
|
| 711 |
+
"text_format": "latex",
|
| 712 |
+
"bbox": [
|
| 713 |
+
390,
|
| 714 |
+
729,
|
| 715 |
+
607,
|
| 716 |
+
767
|
| 717 |
+
],
|
| 718 |
+
"page_idx": 4
|
| 719 |
+
},
|
| 720 |
+
{
|
| 721 |
+
"type": "text",
|
| 722 |
+
"text": "The rest of this section is devoted to proving Theorem 6 through a series of lemmas. ",
|
| 723 |
+
"bbox": [
|
| 724 |
+
173,
|
| 725 |
+
780,
|
| 726 |
+
723,
|
| 727 |
+
796
|
| 728 |
+
],
|
| 729 |
+
"page_idx": 4
|
| 730 |
+
},
|
| 731 |
+
{
|
| 732 |
+
"type": "text",
|
| 733 |
+
"text": "The analysis of Section 2.1 implies that for all $c , d \\in [ m ]$ , $D _ { c d } \\stackrel { \\mathrm { d e f } } { = } Q ^ { * } B _ { c d } Q$ is diagonal. Define ",
|
| 734 |
+
"bbox": [
|
| 735 |
+
171,
|
| 736 |
+
804,
|
| 737 |
+
792,
|
| 738 |
+
823
|
| 739 |
+
],
|
| 740 |
+
"page_idx": 4
|
| 741 |
+
},
|
| 742 |
+
{
|
| 743 |
+
"type": "equation",
|
| 744 |
+
"img_path": "images/65790b5844631b07b810021de78a672668fde36ad1720ec8da8dae3eb663907b.jpg",
|
| 745 |
+
"text": "$$\n\\begin{array} { r } { L \\stackrel { \\mathrm { d e f } } { = } \\left[ \\begin{array} { c c c c } { D _ { 0 0 } } & { D _ { 0 1 } } & { . . . } & { D _ { 0 ( m - 1 ) } } \\\\ { D _ { 1 0 } } & { D _ { 1 1 } } & { . . . } & { D _ { 1 ( m - 1 ) } } \\\\ { \\vdots } & { \\vdots } & { . . . } & { \\vdots } \\\\ { D _ { ( m - 1 ) 0 } } & { D _ { ( m - 1 ) 1 } } & { . . . } & { D _ { ( m - 1 ) ( m - 1 ) } } \\end{array} \\right] . } \\end{array}\n$$",
|
| 746 |
+
"text_format": "latex",
|
| 747 |
+
"bbox": [
|
| 748 |
+
315,
|
| 749 |
+
828,
|
| 750 |
+
681,
|
| 751 |
+
900
|
| 752 |
+
],
|
| 753 |
+
"page_idx": 4
|
| 754 |
+
},
|
| 755 |
+
{
|
| 756 |
+
"type": "text",
|
| 757 |
+
"text": "Lemma 7 $M$ and $L$ have the same singular values. ",
|
| 758 |
+
"bbox": [
|
| 759 |
+
173,
|
| 760 |
+
909,
|
| 761 |
+
514,
|
| 762 |
+
924
|
| 763 |
+
],
|
| 764 |
+
"page_idx": 4
|
| 765 |
+
},
|
| 766 |
+
{
|
| 767 |
+
"type": "text",
|
| 768 |
+
"text": "Proof: We have ",
|
| 769 |
+
"bbox": [
|
| 770 |
+
173,
|
| 771 |
+
103,
|
| 772 |
+
282,
|
| 773 |
+
117
|
| 774 |
+
],
|
| 775 |
+
"page_idx": 5
|
| 776 |
+
},
|
| 777 |
+
{
|
| 778 |
+
"type": "equation",
|
| 779 |
+
"img_path": "images/5f52efe46a6ad162972562edc581b86502cd29065dc00dbf98751a1804dcf681.jpg",
|
| 780 |
+
"text": "$$\n\\begin{array} { r l } & { M = \\left[ \\begin{array} { c c c } { B _ { 0 0 } } & { \\ldots } & { B _ { 0 ( m - 1 ) } } \\\\ { \\vdots } & { \\vdots } & { \\vdots } \\\\ { B _ { ( m - 1 ) 0 } } & { \\ldots } & { B _ { ( m - 1 ) ( m - 1 ) } } \\end{array} \\right] = \\left[ \\begin{array} { c c c } { Q D _ { 0 0 } Q ^ { * } } & { \\ldots } & { Q D _ { 0 ( m - 1 ) } Q ^ { * } } \\\\ { \\vdots } & { \\vdots } & { \\vdots } \\\\ { Q D _ { ( m - 1 ) 0 } Q ^ { * } } & { \\ldots } & { Q D _ { ( m - 1 ) ( m - 1 ) } Q ^ { * } } \\end{array} \\right] } \\\\ & { \\quad \\quad = R \\left[ \\begin{array} { c c c } { D _ { 0 0 } } & { \\ldots } & { D _ { 0 ( m - 1 ) } } \\\\ { \\vdots } & { \\vdots } & { \\vdots } \\\\ { D _ { ( m - 1 ) 0 } } & { \\ldots } & { D _ { ( m - 1 ) ( m - 1 ) } } \\end{array} \\right] R ^ { * } = R L R ^ { * } , } \\end{array}\n$$",
|
| 781 |
+
"text_format": "latex",
|
| 782 |
+
"bbox": [
|
| 783 |
+
191,
|
| 784 |
+
117,
|
| 785 |
+
808,
|
| 786 |
+
236
|
| 787 |
+
],
|
| 788 |
+
"page_idx": 5
|
| 789 |
+
},
|
| 790 |
+
{
|
| 791 |
+
"type": "text",
|
| 792 |
+
"text": "where $R \\stackrel { \\mathrm { d e f } } { = } I _ { m } \\otimes Q$ . Note that $R$ is unitary because ",
|
| 793 |
+
"bbox": [
|
| 794 |
+
173,
|
| 795 |
+
239,
|
| 796 |
+
516,
|
| 797 |
+
257
|
| 798 |
+
],
|
| 799 |
+
"page_idx": 5
|
| 800 |
+
},
|
| 801 |
+
{
|
| 802 |
+
"type": "equation",
|
| 803 |
+
"img_path": "images/61c941174a79ab0bf6640d73ba1b7a8606b2f94303eba99c688ed4e6ca6823d4.jpg",
|
| 804 |
+
"text": "$$\nR R ^ { * } = ( I _ { m } \\otimes Q ) ( I _ { m } \\otimes Q ^ { * } ) = ( I _ { m } I _ { m } ) \\otimes ( Q Q ^ { * } ) = I _ { m n ^ { 2 } } ;\n$$",
|
| 805 |
+
"text_format": "latex",
|
| 806 |
+
"bbox": [
|
| 807 |
+
300,
|
| 808 |
+
261,
|
| 809 |
+
694,
|
| 810 |
+
279
|
| 811 |
+
],
|
| 812 |
+
"page_idx": 5
|
| 813 |
+
},
|
| 814 |
+
{
|
| 815 |
+
"type": "text",
|
| 816 |
+
"text": "this implies that $M$ and $L$ have the same singular values. ",
|
| 817 |
+
"bbox": [
|
| 818 |
+
173,
|
| 819 |
+
281,
|
| 820 |
+
547,
|
| 821 |
+
296
|
| 822 |
+
],
|
| 823 |
+
"page_idx": 5
|
| 824 |
+
},
|
| 825 |
+
{
|
| 826 |
+
"type": "text",
|
| 827 |
+
"text": "So now we have as a subproblem characterizing the singular values of a block matrix whose blocks are diagonal. To express the the characterization, it helps to reshape the nonzero elements of $L$ into a $m \\times \\overline { { m \\times n ^ { 2 } } }$ tensor $G$ as follows: $G _ { c d w } = ( D _ { c d } ) _ { w w }$ . ",
|
| 828 |
+
"bbox": [
|
| 829 |
+
173,
|
| 830 |
+
303,
|
| 831 |
+
826,
|
| 832 |
+
345
|
| 833 |
+
],
|
| 834 |
+
"page_idx": 5
|
| 835 |
+
},
|
| 836 |
+
{
|
| 837 |
+
"type": "text",
|
| 838 |
+
"text": "Theorem 8 $\\sigma ( L ) = \\bigcup _ { w \\in [ n ^ { 2 } ] } \\sigma \\left( G _ { : , : , w } \\right) .$ . ",
|
| 839 |
+
"bbox": [
|
| 840 |
+
173,
|
| 841 |
+
354,
|
| 842 |
+
429,
|
| 843 |
+
383
|
| 844 |
+
],
|
| 845 |
+
"page_idx": 5
|
| 846 |
+
},
|
| 847 |
+
{
|
| 848 |
+
"type": "text",
|
| 849 |
+
"text": "Proof: Choose an arbitrary $w \\in [ n ^ { 2 } ]$ , and a (scalar) singular value $\\sigma$ of $G _ { : , : , w }$ whose left singular vector is $x$ and whose right singular vector is $y$ , so that $G _ { : , : , w } y = \\sigma x$ . Recall that $e _ { w } \\in \\mathbb { R } ^ { n ^ { 2 } }$ is a standard basis vector. ",
|
| 850 |
+
"bbox": [
|
| 851 |
+
173,
|
| 852 |
+
395,
|
| 853 |
+
826,
|
| 854 |
+
440
|
| 855 |
+
],
|
| 856 |
+
"page_idx": 5
|
| 857 |
+
},
|
| 858 |
+
{
|
| 859 |
+
"type": "text",
|
| 860 |
+
"text": "We claim that $L ( y \\otimes e _ { w } ) = \\sigma ( x \\otimes e _ { w } )$ . Since $D _ { c d }$ is diagonal, $D _ { c d } e _ { w } = ( D _ { c d } ) _ { w w } e _ { w } = G _ { c d w } e _ { w }$ Thus we have $\\begin{array} { r } { ( L ( y \\otimes e _ { w } ) ) _ { c } = \\sum _ { d \\in [ m ] } D _ { c d } y _ { d } e _ { w } = ( \\sum _ { d \\in [ m ] } G _ { c d w } y _ { d } ) e _ { w } = ( G _ { : , : , w } y ) _ { c } e _ { w } = \\sigma x _ { c } e _ { w } , } \\end{array}$ which shows that ",
|
| 861 |
+
"bbox": [
|
| 862 |
+
173,
|
| 863 |
+
446,
|
| 864 |
+
826,
|
| 865 |
+
492
|
| 866 |
+
],
|
| 867 |
+
"page_idx": 5
|
| 868 |
+
},
|
| 869 |
+
{
|
| 870 |
+
"type": "equation",
|
| 871 |
+
"img_path": "images/5c684470f1adc3a7d28b32c0a35b20298ae91e534f499c93328da3c8cf90d593.jpg",
|
| 872 |
+
"text": "$$\n{ \\boldsymbol { \\zeta } } ( y \\otimes e _ { w } ) = \\left[ { \\begin{array} { c c c c } { D _ { 0 0 } } & { \\ldots } & { D _ { 0 ( m - 1 ) } } \\\\ { D _ { 1 0 } } & { \\ldots } & { D _ { 1 ( m - 1 ) } } \\\\ { \\vdots } & { \\ldots } & { \\vdots } \\\\ { D _ { ( m - 1 ) 0 } } & { \\ldots } & { D _ { ( m - 1 ) ( m - 1 ) } } \\end{array} } \\right] \\left[ { \\begin{array} { c } { y _ { 0 } e _ { w } } \\\\ { \\vdots } \\\\ { y _ { m - 1 } e _ { w } } \\end{array} } \\right] = \\left[ { \\begin{array} { c } { \\sigma x _ { 0 } e _ { w } } \\\\ { \\vdots } \\\\ { \\sigma x _ { m - 1 } e _ { w } } \\end{array} } \\right] = \\sigma ( x \\otimes e _ { w } ) .\n$$",
|
| 873 |
+
"text_format": "latex",
|
| 874 |
+
"bbox": [
|
| 875 |
+
181,
|
| 876 |
+
492,
|
| 877 |
+
830,
|
| 878 |
+
563
|
| 879 |
+
],
|
| 880 |
+
"page_idx": 5
|
| 881 |
+
},
|
| 882 |
+
{
|
| 883 |
+
"type": "text",
|
| 884 |
+
"text": "If $\\tilde { \\sigma }$ is another singular value of $G _ { : , : , w }$ with a left singular vector $\\tilde { x }$ and a right singular vector $\\tilde { y }$ , then $\\langle ( x \\otimes e _ { w } ) , ( \\tilde { x } \\otimes e _ { w } ) \\rangle = \\langle x , \\tilde { x } \\rangle = 0$ and, similarly $\\langle ( y \\otimes e _ { w } ) , ( \\tilde { y } \\otimes e _ { w } ) \\rangle = 0$ . Also, $\\langle ( x \\otimes e _ { w } ) , ( x \\otimes e _ { w } ) \\rangle = 1$ and $\\langle ( y \\otimes e _ { w } ) , ( y \\otimes e _ { w } ) \\rangle = 1$ . ",
|
| 885 |
+
"bbox": [
|
| 886 |
+
174,
|
| 887 |
+
565,
|
| 888 |
+
825,
|
| 889 |
+
609
|
| 890 |
+
],
|
| 891 |
+
"page_idx": 5
|
| 892 |
+
},
|
| 893 |
+
{
|
| 894 |
+
"type": "text",
|
| 895 |
+
"text": "For any $x$ and $\\tilde { x }$ , whether they are equal or not, if $w \\ne \\tilde { w }$ , then $\\langle ( x \\otimes e _ { w } ) , ( \\tilde { x } \\otimes e _ { \\tilde { w } } ) \\rangle = 0$ , simply because their non-zero components do not overlap. ",
|
| 896 |
+
"bbox": [
|
| 897 |
+
171,
|
| 898 |
+
613,
|
| 899 |
+
823,
|
| 900 |
+
643
|
| 901 |
+
],
|
| 902 |
+
"page_idx": 5
|
| 903 |
+
},
|
| 904 |
+
{
|
| 905 |
+
"type": "text",
|
| 906 |
+
"text": "Thus, by taking the Kronecker product of each singular vector of $G _ { : , : , w }$ with $e _ { w }$ and assembling the results for various $w$ , we may form a singular value decomposition of $L$ whose singular values are $\\cup _ { w \\in [ n ^ { 2 } ] } \\sigma ( G _ { : , : , w } ) .$ . This completes the proof. □ ",
|
| 907 |
+
"bbox": [
|
| 908 |
+
173,
|
| 909 |
+
648,
|
| 910 |
+
826,
|
| 911 |
+
693
|
| 912 |
+
],
|
| 913 |
+
"page_idx": 5
|
| 914 |
+
},
|
| 915 |
+
{
|
| 916 |
+
"type": "text",
|
| 917 |
+
"text": "Using Lemmas 7 and Theorem 8, we are now ready to prove Theorem 6. ",
|
| 918 |
+
"bbox": [
|
| 919 |
+
174,
|
| 920 |
+
698,
|
| 921 |
+
650,
|
| 922 |
+
713
|
| 923 |
+
],
|
| 924 |
+
"page_idx": 5
|
| 925 |
+
},
|
| 926 |
+
{
|
| 927 |
+
"type": "text",
|
| 928 |
+
"text": "Proof (of Theorem 6). Recall that, for each input channel $c$ and output channel $d$ , the diagonal elements of $D _ { c , d }$ are the eigenvalues of $B _ { c , d }$ . By Theorem 5, this means that the diagonal elements of $D _ { c , d }$ are ",
|
| 929 |
+
"bbox": [
|
| 930 |
+
173,
|
| 931 |
+
719,
|
| 932 |
+
825,
|
| 933 |
+
762
|
| 934 |
+
],
|
| 935 |
+
"page_idx": 5
|
| 936 |
+
},
|
| 937 |
+
{
|
| 938 |
+
"type": "equation",
|
| 939 |
+
"img_path": "images/927892efd2938938398dd616b62d4f51343f81de6401ba11bddab1f3c4ae0bd7.jpg",
|
| 940 |
+
"text": "$$\n\\{ ( F ^ { T } K _ { : , : , c , d } F ) _ { u , v } : u , v \\in [ n ] \\} .\n$$",
|
| 941 |
+
"text_format": "latex",
|
| 942 |
+
"bbox": [
|
| 943 |
+
390,
|
| 944 |
+
761,
|
| 945 |
+
606,
|
| 946 |
+
780
|
| 947 |
+
],
|
| 948 |
+
"page_idx": 5
|
| 949 |
+
},
|
| 950 |
+
{
|
| 951 |
+
"type": "text",
|
| 952 |
+
"text": "The elements of (9) map to the diagonal elements of $D _ { c , d }$ as follows: ",
|
| 953 |
+
"bbox": [
|
| 954 |
+
174,
|
| 955 |
+
780,
|
| 956 |
+
622,
|
| 957 |
+
796
|
| 958 |
+
],
|
| 959 |
+
"page_idx": 5
|
| 960 |
+
},
|
| 961 |
+
{
|
| 962 |
+
"type": "equation",
|
| 963 |
+
"img_path": "images/8d734bd88d925709d70e2529f5b104b85cdce91e333790b04126aecc05d79c81.jpg",
|
| 964 |
+
"text": "$$\nG _ { c d w } = ( D _ { c , d } ) _ { w w } = ( F ^ { T } K _ { : , : , c , d } F ) _ { \\lfloor w / m \\rfloor , w \\mod m }\n$$",
|
| 965 |
+
"text_format": "latex",
|
| 966 |
+
"bbox": [
|
| 967 |
+
323,
|
| 968 |
+
799,
|
| 969 |
+
673,
|
| 970 |
+
819
|
| 971 |
+
],
|
| 972 |
+
"page_idx": 5
|
| 973 |
+
},
|
| 974 |
+
{
|
| 975 |
+
"type": "text",
|
| 976 |
+
"text": "and thus ",
|
| 977 |
+
"bbox": [
|
| 978 |
+
173,
|
| 979 |
+
821,
|
| 980 |
+
232,
|
| 981 |
+
835
|
| 982 |
+
],
|
| 983 |
+
"page_idx": 5
|
| 984 |
+
},
|
| 985 |
+
{
|
| 986 |
+
"type": "equation",
|
| 987 |
+
"img_path": "images/ad493def1cb3947e724c83755400ef3cf2636413c69f50f9080b19deaa6feac6.jpg",
|
| 988 |
+
"text": "$$\nG _ { : , : , w } = \\left( ( F ^ { T } K _ { : , : , c , d } F ) _ { \\lfloor w / m \\rfloor , w \\mod m } \\right) _ { c d }\n$$",
|
| 989 |
+
"text_format": "latex",
|
| 990 |
+
"bbox": [
|
| 991 |
+
349,
|
| 992 |
+
832,
|
| 993 |
+
647,
|
| 994 |
+
853
|
| 995 |
+
],
|
| 996 |
+
"page_idx": 5
|
| 997 |
+
},
|
| 998 |
+
{
|
| 999 |
+
"type": "text",
|
| 1000 |
+
"text": "which in turn implies ",
|
| 1001 |
+
"bbox": [
|
| 1002 |
+
173,
|
| 1003 |
+
853,
|
| 1004 |
+
316,
|
| 1005 |
+
867
|
| 1006 |
+
],
|
| 1007 |
+
"page_idx": 5
|
| 1008 |
+
},
|
| 1009 |
+
{
|
| 1010 |
+
"type": "equation",
|
| 1011 |
+
"img_path": "images/f6a6e06ab68764df63f7221d18344133bd37a91f93d563b9a3cd832d77e51e91.jpg",
|
| 1012 |
+
"text": "$$\n\\bigcup _ { w \\in [ n ^ { 2 } ] } \\sigma ( G _ { : , : , w } ) = \\cup _ { u \\in [ n ] , v \\in [ n ] } \\sigma \\left( \\left( ( F ^ { T } K _ { : , : , c , d } F ) _ { u , v } \\right) _ { c d } \\right) .\n$$",
|
| 1013 |
+
"text_format": "latex",
|
| 1014 |
+
"bbox": [
|
| 1015 |
+
303,
|
| 1016 |
+
871,
|
| 1017 |
+
691,
|
| 1018 |
+
906
|
| 1019 |
+
],
|
| 1020 |
+
"page_idx": 5
|
| 1021 |
+
},
|
| 1022 |
+
{
|
| 1023 |
+
"type": "text",
|
| 1024 |
+
"text": "Applying Lemmas 7 and 8 completes the proof. ",
|
| 1025 |
+
"bbox": [
|
| 1026 |
+
173,
|
| 1027 |
+
909,
|
| 1028 |
+
486,
|
| 1029 |
+
924
|
| 1030 |
+
],
|
| 1031 |
+
"page_idx": 5
|
| 1032 |
+
},
|
| 1033 |
+
{
|
| 1034 |
+
"type": "text",
|
| 1035 |
+
"text": "3 Regularization ",
|
| 1036 |
+
"text_level": 1,
|
| 1037 |
+
"bbox": [
|
| 1038 |
+
174,
|
| 1039 |
+
102,
|
| 1040 |
+
339,
|
| 1041 |
+
117
|
| 1042 |
+
],
|
| 1043 |
+
"page_idx": 6
|
| 1044 |
+
},
|
| 1045 |
+
{
|
| 1046 |
+
"type": "text",
|
| 1047 |
+
"text": "We now show how to use the spectrum computed above to project a convolution onto the set of convolutions with bounded operator norm. We exploit the following key fact. ",
|
| 1048 |
+
"bbox": [
|
| 1049 |
+
174,
|
| 1050 |
+
136,
|
| 1051 |
+
825,
|
| 1052 |
+
164
|
| 1053 |
+
],
|
| 1054 |
+
"page_idx": 6
|
| 1055 |
+
},
|
| 1056 |
+
{
|
| 1057 |
+
"type": "text",
|
| 1058 |
+
"text": "Proposition 9 (Lefkimmiatis et al. (2013), Proposition 1) Let $A \\in \\mathbb { R } ^ { n \\times n }$ , and let $A = U D V ^ { \\top }$ be its singular value decomposition. Let $\\tilde { A } = U \\tilde { D } \\bar { V } ^ { \\top }$ , where, for all $i \\in [ n ] , \\tilde { D } _ { i i } = \\operatorname* { m i n } ( D _ { i i } , c )$ and $B = \\{ X \\mid | X | | _ { 2 } \\leq c \\}$ . Then $\\tilde { A }$ is the projection of $A$ onto $\\boldsymbol { B }$ ; i.e. ${ \\tilde { A } } = \\underset { X \\in \\mathcal { B } } { \\arg \\operatorname* { m i n } } \\ | | A - X | | _ { F } .$ . ",
|
| 1059 |
+
"bbox": [
|
| 1060 |
+
174,
|
| 1061 |
+
176,
|
| 1062 |
+
825,
|
| 1063 |
+
233
|
| 1064 |
+
],
|
| 1065 |
+
"page_idx": 6
|
| 1066 |
+
},
|
| 1067 |
+
{
|
| 1068 |
+
"type": "text",
|
| 1069 |
+
"text": "This implies that the desired projection can be obtained by clipping the singular values of linear transformation associated with a convolutional layer to the interval $[ 0 , c ]$ . Note that the eigenvectors remained the same in the proposition, hence the projected matrix is still generated by a convolution. However, after the projection, the resulting convolution neighborhood may become as large as $n \\times n$ . On the other hand, we can project this convolution onto the set of convolutions with $k \\times k$ neighborhoods, by zeroing out all other coefficients. NumPy code for this is in Appendix A. ",
|
| 1070 |
+
"bbox": [
|
| 1071 |
+
174,
|
| 1072 |
+
246,
|
| 1073 |
+
825,
|
| 1074 |
+
329
|
| 1075 |
+
],
|
| 1076 |
+
"page_idx": 6
|
| 1077 |
+
},
|
| 1078 |
+
{
|
| 1079 |
+
"type": "text",
|
| 1080 |
+
"text": "Repeatedly alternating the two projections would give a point in the intersection of the two sets, i.e., a $k \\times k$ convolution with bounded operator norm (Cheney and Goldstein (1959) Theorem 4, Boyd and Dattorro (2003) Section 2), and the projection onto that intersection could be found using the more complicated Dykstra’s projection algorithm (Boyle and Dykstra, 1986). ",
|
| 1081 |
+
"bbox": [
|
| 1082 |
+
174,
|
| 1083 |
+
337,
|
| 1084 |
+
825,
|
| 1085 |
+
392
|
| 1086 |
+
],
|
| 1087 |
+
"page_idx": 6
|
| 1088 |
+
},
|
| 1089 |
+
{
|
| 1090 |
+
"type": "text",
|
| 1091 |
+
"text": "When we wish to control the operator norm during an iterative optimization process, however, repeating the alternating projections does not seem to be worth it – we found that the first two projections already often produced a convolutional layer with an operator norm close to the desired value. Furthermore, because SGD does not change the parameters very fast, we can think of a given pair of projections as providing a warm start for the next pair. ",
|
| 1092 |
+
"bbox": [
|
| 1093 |
+
174,
|
| 1094 |
+
398,
|
| 1095 |
+
825,
|
| 1096 |
+
469
|
| 1097 |
+
],
|
| 1098 |
+
"page_idx": 6
|
| 1099 |
+
},
|
| 1100 |
+
{
|
| 1101 |
+
"type": "text",
|
| 1102 |
+
"text": "In practice, we run the two projections once every few steps, thus letting the projection alternate with the training. ",
|
| 1103 |
+
"bbox": [
|
| 1104 |
+
171,
|
| 1105 |
+
476,
|
| 1106 |
+
825,
|
| 1107 |
+
505
|
| 1108 |
+
],
|
| 1109 |
+
"page_idx": 6
|
| 1110 |
+
},
|
| 1111 |
+
{
|
| 1112 |
+
"type": "text",
|
| 1113 |
+
"text": "4 Experiments ",
|
| 1114 |
+
"text_level": 1,
|
| 1115 |
+
"bbox": [
|
| 1116 |
+
174,
|
| 1117 |
+
527,
|
| 1118 |
+
312,
|
| 1119 |
+
545
|
| 1120 |
+
],
|
| 1121 |
+
"page_idx": 6
|
| 1122 |
+
},
|
| 1123 |
+
{
|
| 1124 |
+
"type": "text",
|
| 1125 |
+
"text": "First, we validated Theorem 6 with unit tests in which the output of the code given in the introduction is compared with evaluating the singular values by constructing the full matrix encoding the linear transformation corresponding to the convolutional layer and computing its SVD. ",
|
| 1126 |
+
"bbox": [
|
| 1127 |
+
174,
|
| 1128 |
+
563,
|
| 1129 |
+
825,
|
| 1130 |
+
604
|
| 1131 |
+
],
|
| 1132 |
+
"page_idx": 6
|
| 1133 |
+
},
|
| 1134 |
+
{
|
| 1135 |
+
"type": "text",
|
| 1136 |
+
"text": "4.1 Timing ",
|
| 1137 |
+
"text_level": 1,
|
| 1138 |
+
"bbox": [
|
| 1139 |
+
174,
|
| 1140 |
+
626,
|
| 1141 |
+
261,
|
| 1142 |
+
638
|
| 1143 |
+
],
|
| 1144 |
+
"page_idx": 6
|
| 1145 |
+
},
|
| 1146 |
+
{
|
| 1147 |
+
"type": "text",
|
| 1148 |
+
"text": "We generated 4D tensors of various shapes with random standard normal values, and computed their singular values using the full matrix method, the NumPy code given above and the equivalent TensorFlow code. For small tensors, the NumPy code was faster than TensorFlow, but for larger tensors, the TensorFlow code was able to exploit the parallelism in the algorithm and run much faster on a GPU. The timing results are shown in Figure 1. ",
|
| 1149 |
+
"bbox": [
|
| 1150 |
+
174,
|
| 1151 |
+
652,
|
| 1152 |
+
825,
|
| 1153 |
+
723
|
| 1154 |
+
],
|
| 1155 |
+
"page_idx": 6
|
| 1156 |
+
},
|
| 1157 |
+
{
|
| 1158 |
+
"type": "text",
|
| 1159 |
+
"text": "4.2 Regularization ",
|
| 1160 |
+
"text_level": 1,
|
| 1161 |
+
"bbox": [
|
| 1162 |
+
174,
|
| 1163 |
+
743,
|
| 1164 |
+
325,
|
| 1165 |
+
757
|
| 1166 |
+
],
|
| 1167 |
+
"page_idx": 6
|
| 1168 |
+
},
|
| 1169 |
+
{
|
| 1170 |
+
"type": "text",
|
| 1171 |
+
"text": "We next explored the effect of regularizing the convolutional layers by clipping their operator norms as described in Section 3. We ran the CIFAR-10 benchmark with a standard 32 layer residual network with 2.4M training parameters; (He et al., 2016). This network reached a test error rate of $6 . 2 \\%$ after 250 epochs, using a learning rate schedule determined by a grid search (shown by the gray plot in Figure 2). We then evaluated an algorithm that, every 100 steps, clipped the norms of the convolutional layers to various different values between 0.1 and 3.0. As expected, clipping to 2.5 and 3.0 had little impact on the performance, since the norms of the convolutional layers were between 2.5 and 2.8. Clipping to 0.1 yielded a surprising $6 . 7 \\%$ test error, whereas clipping to 0.5 and 1.0 yielded test errors of $5 . 3 \\%$ and $5 . 5 \\%$ respectively (shown in Figure 2). A plot of test error against training time is provided in Figure 4 in Appendix B, showing that the projections did not slow down the training very much. ",
|
| 1172 |
+
"bbox": [
|
| 1173 |
+
174,
|
| 1174 |
+
770,
|
| 1175 |
+
825,
|
| 1176 |
+
924
|
| 1177 |
+
],
|
| 1178 |
+
"page_idx": 6
|
| 1179 |
+
},
|
| 1180 |
+
{
|
| 1181 |
+
"type": "image",
|
| 1182 |
+
"img_path": "images/5ca872dd9b2f7dda8d75174026703ad85648d97a4e1cc3686f4dfd1cc25ddd1f.jpg",
|
| 1183 |
+
"image_caption": [
|
| 1184 |
+
"Figure 1: Time used to compute singular values. The left graph is for a $3 \\times 3$ convolution on a $1 6 \\times 1 6$ image with the number of input/output channels on the $x$ -axis. The right graph is for a $1 1 \\times 1 1$ convolution on a $6 4 \\times 6 4$ image (no curve for full matrix method is shown as this method could not complete in a reasonable time for these inputs). "
|
| 1185 |
+
],
|
| 1186 |
+
"image_footnote": [],
|
| 1187 |
+
"bbox": [
|
| 1188 |
+
179,
|
| 1189 |
+
101,
|
| 1190 |
+
816,
|
| 1191 |
+
297
|
| 1192 |
+
],
|
| 1193 |
+
"page_idx": 7
|
| 1194 |
+
},
|
| 1195 |
+
{
|
| 1196 |
+
"type": "image",
|
| 1197 |
+
"img_path": "images/aef8fcd02dda25632a62ea916f9c61667a60909bec96589f9dd4a13662ccd92a.jpg",
|
| 1198 |
+
"image_caption": [
|
| 1199 |
+
"Figure 2: Training loss and test error for ResNet model (He et al., 2016) for CIFAR-10. "
|
| 1200 |
+
],
|
| 1201 |
+
"image_footnote": [],
|
| 1202 |
+
"bbox": [
|
| 1203 |
+
179,
|
| 1204 |
+
395,
|
| 1205 |
+
821,
|
| 1206 |
+
594
|
| 1207 |
+
],
|
| 1208 |
+
"page_idx": 7
|
| 1209 |
+
},
|
| 1210 |
+
{
|
| 1211 |
+
"type": "text",
|
| 1212 |
+
"text": "4.3 Robustness to changes in hyperparameters ",
|
| 1213 |
+
"text_level": 1,
|
| 1214 |
+
"bbox": [
|
| 1215 |
+
173,
|
| 1216 |
+
652,
|
| 1217 |
+
524,
|
| 1218 |
+
665
|
| 1219 |
+
],
|
| 1220 |
+
"page_idx": 7
|
| 1221 |
+
},
|
| 1222 |
+
{
|
| 1223 |
+
"type": "text",
|
| 1224 |
+
"text": "The baseline algorithm studied in the previous subsection used batch normalization. Batch normalization tends to make the network less sensitive to linear transformations with large operator norms. However, batch normalization includes trainable scaling parameters (called $\\gamma$ in the original paper) that are applied after the normalization step. The existence of these parameters lead to a complicated interaction between batch normalization and methods like ours that act to control the norm of the linear transformation applied before batch normalization. ",
|
| 1225 |
+
"bbox": [
|
| 1226 |
+
174,
|
| 1227 |
+
679,
|
| 1228 |
+
825,
|
| 1229 |
+
762
|
| 1230 |
+
],
|
| 1231 |
+
"page_idx": 7
|
| 1232 |
+
},
|
| 1233 |
+
{
|
| 1234 |
+
"type": "text",
|
| 1235 |
+
"text": "Because the effect of regularizing the operator norm is more easily understood in the absence of batch normalization, we also performed experiments with a baseline that did not use batch normalization. ",
|
| 1236 |
+
"bbox": [
|
| 1237 |
+
174,
|
| 1238 |
+
770,
|
| 1239 |
+
823,
|
| 1240 |
+
797
|
| 1241 |
+
],
|
| 1242 |
+
"page_idx": 7
|
| 1243 |
+
},
|
| 1244 |
+
{
|
| 1245 |
+
"type": "text",
|
| 1246 |
+
"text": "Another possibility that we wanted to study was that using a regularizer may make the process overall more stable, enabling a larger learning rate. We were generally interested in whether operator-norm regularization made the training process more robust to the choice of hyperparameters. ",
|
| 1247 |
+
"bbox": [
|
| 1248 |
+
176,
|
| 1249 |
+
805,
|
| 1250 |
+
825,
|
| 1251 |
+
847
|
| 1252 |
+
],
|
| 1253 |
+
"page_idx": 7
|
| 1254 |
+
},
|
| 1255 |
+
{
|
| 1256 |
+
"type": "text",
|
| 1257 |
+
"text": "In one experiment, we started with the same baseline as the previous subsection, but disabled batch normalization. This baseline started with a learning rate of 0.1, which was multiplied by a factor 0.95 after every epoch. We tried all combinations of the following hyperparameters: (a) the norm of the ball projected onto (no projection, 0.5, 1.0, 1.5, 2.0); (b) the initial learning rate (0.001, 0.003, 0.01, 0.03, 0.1); (c) the minibatch size (32, 64); (d) the number of epochs per decay of the learning rate (1,2,3). We tried each of the 150 combinations of the hyperparameters, trained for 100 epochs, and measured the test error. The results are plotted in Figure 3a. The operator norm regularization improved the best result, and also made the process more robust to the choice of hyperparameters. ",
|
| 1258 |
+
"bbox": [
|
| 1259 |
+
174,
|
| 1260 |
+
854,
|
| 1261 |
+
825,
|
| 1262 |
+
924
|
| 1263 |
+
],
|
| 1264 |
+
"page_idx": 7
|
| 1265 |
+
},
|
| 1266 |
+
{
|
| 1267 |
+
"type": "text",
|
| 1268 |
+
"text": "",
|
| 1269 |
+
"bbox": [
|
| 1270 |
+
171,
|
| 1271 |
+
103,
|
| 1272 |
+
825,
|
| 1273 |
+
132
|
| 1274 |
+
],
|
| 1275 |
+
"page_idx": 8
|
| 1276 |
+
},
|
| 1277 |
+
{
|
| 1278 |
+
"type": "image",
|
| 1279 |
+
"img_path": "images/0a6350eb054416feb2a9f086e2abc8aab36e4eed2bd1744a93c2d6e1d99dc11c.jpg",
|
| 1280 |
+
"image_caption": [
|
| 1281 |
+
"Figure 3: A scatterplot of the test errors obtained with different hyperparameter combinations, and different operator-norm regularizers. "
|
| 1282 |
+
],
|
| 1283 |
+
"image_footnote": [],
|
| 1284 |
+
"bbox": [
|
| 1285 |
+
197,
|
| 1286 |
+
148,
|
| 1287 |
+
790,
|
| 1288 |
+
337
|
| 1289 |
+
],
|
| 1290 |
+
"page_idx": 8
|
| 1291 |
+
},
|
| 1292 |
+
{
|
| 1293 |
+
"type": "text",
|
| 1294 |
+
"text": "",
|
| 1295 |
+
"bbox": [
|
| 1296 |
+
171,
|
| 1297 |
+
391,
|
| 1298 |
+
813,
|
| 1299 |
+
406
|
| 1300 |
+
],
|
| 1301 |
+
"page_idx": 8
|
| 1302 |
+
},
|
| 1303 |
+
{
|
| 1304 |
+
"type": "text",
|
| 1305 |
+
"text": "We conducted a similar experiment in the presence of batch normalization, except using learning rates 0.01, 0.03, 0.1, 0.2, and 0.3. Those results are shown in Figure 3b. Regularizing the operator norm helps, even in the presence of batch normalization. ",
|
| 1306 |
+
"bbox": [
|
| 1307 |
+
176,
|
| 1308 |
+
412,
|
| 1309 |
+
820,
|
| 1310 |
+
454
|
| 1311 |
+
],
|
| 1312 |
+
"page_idx": 8
|
| 1313 |
+
},
|
| 1314 |
+
{
|
| 1315 |
+
"type": "text",
|
| 1316 |
+
"text": "It appears that operator-norm regularization and batch normalization are not redundant, and neither dominates the other. We were surprised by this. ",
|
| 1317 |
+
"bbox": [
|
| 1318 |
+
173,
|
| 1319 |
+
462,
|
| 1320 |
+
823,
|
| 1321 |
+
489
|
| 1322 |
+
],
|
| 1323 |
+
"page_idx": 8
|
| 1324 |
+
},
|
| 1325 |
+
{
|
| 1326 |
+
"type": "text",
|
| 1327 |
+
"text": "4.4 Comparison with reshaping $K$ ",
|
| 1328 |
+
"text_level": 1,
|
| 1329 |
+
"bbox": [
|
| 1330 |
+
176,
|
| 1331 |
+
507,
|
| 1332 |
+
426,
|
| 1333 |
+
520
|
| 1334 |
+
],
|
| 1335 |
+
"page_idx": 8
|
| 1336 |
+
},
|
| 1337 |
+
{
|
| 1338 |
+
"type": "text",
|
| 1339 |
+
"text": "In Section 1 we mentioned that Yoshida and Miyato (2017) approximated the linear transformation induced by $K$ by reshaping $K$ . This leads to an alternate regularization method — we compute the spectrum of the reshaped $K$ , and project it onto a ball using clipping, as above. We implemented this an experimented with it using the same network and hyperparameters as in Section 4.2 and found the following. ",
|
| 1340 |
+
"bbox": [
|
| 1341 |
+
176,
|
| 1342 |
+
532,
|
| 1343 |
+
825,
|
| 1344 |
+
603
|
| 1345 |
+
],
|
| 1346 |
+
"page_idx": 8
|
| 1347 |
+
},
|
| 1348 |
+
{
|
| 1349 |
+
"type": "text",
|
| 1350 |
+
"text": "• We clipped the singular values of the reshaped $K$ every 100 steps. We tried various constants for the clipped value (0.05, 0.1, 0.2, 0.5, 1.0), and found that the best accuracy we achieved, using 0.2, was the same as the accuracy we achieved in Section 4.2. • We clipped the singular values of the reshaped $K$ to these same values every step, and found that the best accuracy achieved was slightly worse than the accuracy achieved in the previous step. We observed similar behavior when we clipped norms using our method. • Most surprisingly, we found that clipping norms by our method on a GPU was about $2 5 \\%$ faster than clipping the singular values of the reshaped $K$ — when we clipped after every step, on the same machine, 10000 batches of CIFAR10 took 14490 seconds when we clipped the reshaped $K$ , whereas they took 11004 seconds with our exact method! One possible explanation is parallelization — clipping reshaped $K$ takes $O ( m ^ { 3 } k ^ { 2 } )$ flops, whereas our method does $m ^ { 2 }$ FFTs, followed by $\\bar { n ^ { 2 } } m \\times m$ SVDs, which takes $O ( m ^ { 3 } n ^ { 2 } )$ flops, but these can be parallelized and completed in as little as $O ( n ^ { 2 } \\log n + m ^ { 3 } )$ time. ",
|
| 1351 |
+
"bbox": [
|
| 1352 |
+
217,
|
| 1353 |
+
614,
|
| 1354 |
+
825,
|
| 1355 |
+
804
|
| 1356 |
+
],
|
| 1357 |
+
"page_idx": 8
|
| 1358 |
+
},
|
| 1359 |
+
{
|
| 1360 |
+
"type": "text",
|
| 1361 |
+
"text": "Clearly this is only one dataset, and the results may not generalize to other sets. However it does suggest that finding the full spectrum of the convolutional layer may be no worse than computing heuristic approximations, both in classification accuracy and speed. ",
|
| 1362 |
+
"bbox": [
|
| 1363 |
+
176,
|
| 1364 |
+
815,
|
| 1365 |
+
823,
|
| 1366 |
+
858
|
| 1367 |
+
],
|
| 1368 |
+
"page_idx": 8
|
| 1369 |
+
},
|
| 1370 |
+
{
|
| 1371 |
+
"type": "text",
|
| 1372 |
+
"text": "5 Acknowledgements ",
|
| 1373 |
+
"text_level": 1,
|
| 1374 |
+
"bbox": [
|
| 1375 |
+
176,
|
| 1376 |
+
877,
|
| 1377 |
+
374,
|
| 1378 |
+
893
|
| 1379 |
+
],
|
| 1380 |
+
"page_idx": 8
|
| 1381 |
+
},
|
| 1382 |
+
{
|
| 1383 |
+
"type": "text",
|
| 1384 |
+
"text": "We thank Tomer Koren, Nishal Shah, Yoram Singer and Chiyuan Zhang for valuable conversations. ",
|
| 1385 |
+
"bbox": [
|
| 1386 |
+
171,
|
| 1387 |
+
909,
|
| 1388 |
+
821,
|
| 1389 |
+
924
|
| 1390 |
+
],
|
| 1391 |
+
"page_idx": 8
|
| 1392 |
+
},
|
| 1393 |
+
{
|
| 1394 |
+
"type": "text",
|
| 1395 |
+
"text": "References ",
|
| 1396 |
+
"text_level": 1,
|
| 1397 |
+
"bbox": [
|
| 1398 |
+
174,
|
| 1399 |
+
103,
|
| 1400 |
+
274,
|
| 1401 |
+
117
|
| 1402 |
+
],
|
| 1403 |
+
"page_idx": 9
|
| 1404 |
+
},
|
| 1405 |
+
{
|
| 1406 |
+
"type": "text",
|
| 1407 |
+
"text": "P. L. Bartlett, D. J. Foster, and M. J. Telgarsky. Spectrally-normalized margin bounds for neural networks. In NIPS, pages 6240–6249, 2017. ",
|
| 1408 |
+
"bbox": [
|
| 1409 |
+
174,
|
| 1410 |
+
123,
|
| 1411 |
+
825,
|
| 1412 |
+
150
|
| 1413 |
+
],
|
| 1414 |
+
"page_idx": 9
|
| 1415 |
+
},
|
| 1416 |
+
{
|
| 1417 |
+
"type": "text",
|
| 1418 |
+
"text": "Adel Bibi, Bernard Ghanem, Vladlen Koltun, and Rene Ranftl. Deep layers as stochastic solvers. ICLR, 2019. ",
|
| 1419 |
+
"bbox": [
|
| 1420 |
+
171,
|
| 1421 |
+
157,
|
| 1422 |
+
826,
|
| 1423 |
+
172
|
| 1424 |
+
],
|
| 1425 |
+
"page_idx": 9
|
| 1426 |
+
},
|
| 1427 |
+
{
|
| 1428 |
+
"type": "text",
|
| 1429 |
+
"text": "S. Boyd and J. Dattorro. Alternating projections, 2003. https://web.stanford.edu/class/ee392o/alt_proj.pdf. ",
|
| 1430 |
+
"bbox": [
|
| 1431 |
+
169,
|
| 1432 |
+
179,
|
| 1433 |
+
872,
|
| 1434 |
+
194
|
| 1435 |
+
],
|
| 1436 |
+
"page_idx": 9
|
| 1437 |
+
},
|
| 1438 |
+
{
|
| 1439 |
+
"type": "text",
|
| 1440 |
+
"text": "J. P. Boyle and R. L. Dykstra. A method for finding projections onto the intersection of convex sets in hilbert spaces. In Advances in order restricted statistical inference, pages 28–47. Springer, 1986. ",
|
| 1441 |
+
"bbox": [
|
| 1442 |
+
173,
|
| 1443 |
+
200,
|
| 1444 |
+
828,
|
| 1445 |
+
228
|
| 1446 |
+
],
|
| 1447 |
+
"page_idx": 9
|
| 1448 |
+
},
|
| 1449 |
+
{
|
| 1450 |
+
"type": "text",
|
| 1451 |
+
"text": "C. Chao. A note on block circulant matrices. Kyungpook Mathematical Journal, 14:97–100, 1974. ",
|
| 1452 |
+
"bbox": [
|
| 1453 |
+
173,
|
| 1454 |
+
234,
|
| 1455 |
+
758,
|
| 1456 |
+
250
|
| 1457 |
+
],
|
| 1458 |
+
"page_idx": 9
|
| 1459 |
+
},
|
| 1460 |
+
{
|
| 1461 |
+
"type": "text",
|
| 1462 |
+
"text": "W. Cheney and A. A. Goldstein. Proximity maps for convex sets. Proceedings of the American Mathematical Society, 10(3):448–450, 1959. ISSN 00029939, 10886826. URL http://www.jstor.org/stable/ 2032864. ",
|
| 1463 |
+
"bbox": [
|
| 1464 |
+
173,
|
| 1465 |
+
256,
|
| 1466 |
+
830,
|
| 1467 |
+
295
|
| 1468 |
+
],
|
| 1469 |
+
"page_idx": 9
|
| 1470 |
+
},
|
| 1471 |
+
{
|
| 1472 |
+
"type": "text",
|
| 1473 |
+
"text": "M. Cisse, P. Bojanowski, E. Grave, Y. Dauphin, and N. Usunier. Parseval networks: Improving robustness to adversarial examples. ICML, 2017. ",
|
| 1474 |
+
"bbox": [
|
| 1475 |
+
169,
|
| 1476 |
+
301,
|
| 1477 |
+
825,
|
| 1478 |
+
329
|
| 1479 |
+
],
|
| 1480 |
+
"page_idx": 9
|
| 1481 |
+
},
|
| 1482 |
+
{
|
| 1483 |
+
"type": "text",
|
| 1484 |
+
"text": "H. Drucker and Y. Le Cun. Improving generalization performance using double backpropagation. IEEE Transactions on Neural Networks, 3(6):991–997, 1992. ",
|
| 1485 |
+
"bbox": [
|
| 1486 |
+
174,
|
| 1487 |
+
337,
|
| 1488 |
+
825,
|
| 1489 |
+
363
|
| 1490 |
+
],
|
| 1491 |
+
"page_idx": 9
|
| 1492 |
+
},
|
| 1493 |
+
{
|
| 1494 |
+
"type": "text",
|
| 1495 |
+
"text": "I. Goodfellow, Y. Bengio, and A. Courville. Deep Learning. MIT Press, 2016. http://www. deeplearningbook.org. ",
|
| 1496 |
+
"bbox": [
|
| 1497 |
+
174,
|
| 1498 |
+
369,
|
| 1499 |
+
825,
|
| 1500 |
+
398
|
| 1501 |
+
],
|
| 1502 |
+
"page_idx": 9
|
| 1503 |
+
},
|
| 1504 |
+
{
|
| 1505 |
+
"type": "text",
|
| 1506 |
+
"text": "H. Gouk, E. Frank, B. Pfahringer, and M. Cree. Regularisation of neural networks by enforcing lipschitz continuity. arXiv preprint arXiv:1804.04368, 2018a. ",
|
| 1507 |
+
"bbox": [
|
| 1508 |
+
173,
|
| 1509 |
+
405,
|
| 1510 |
+
823,
|
| 1511 |
+
431
|
| 1512 |
+
],
|
| 1513 |
+
"page_idx": 9
|
| 1514 |
+
},
|
| 1515 |
+
{
|
| 1516 |
+
"type": "text",
|
| 1517 |
+
"text": "H. Gouk, B. Pfahringer, E. Frank, and M. Cree. MaxGain: Regularisation of neural networks by constraining activation magnitudes. arXiv preprint arXiv:1804.05965, 2018b. ",
|
| 1518 |
+
"bbox": [
|
| 1519 |
+
171,
|
| 1520 |
+
438,
|
| 1521 |
+
825,
|
| 1522 |
+
465
|
| 1523 |
+
],
|
| 1524 |
+
"page_idx": 9
|
| 1525 |
+
},
|
| 1526 |
+
{
|
| 1527 |
+
"type": "text",
|
| 1528 |
+
"text": "R. M. Gray. Toeplitz and circulant matrices: A review. Foundations and Trends® in Communications and Information Theory, 2(3):155–239, 2006. ",
|
| 1529 |
+
"bbox": [
|
| 1530 |
+
174,
|
| 1531 |
+
472,
|
| 1532 |
+
823,
|
| 1533 |
+
500
|
| 1534 |
+
],
|
| 1535 |
+
"page_idx": 9
|
| 1536 |
+
},
|
| 1537 |
+
{
|
| 1538 |
+
"type": "text",
|
| 1539 |
+
"text": "K. He, X. Zhang, S. Ren, and J. Sun. Identity mappings in deep residual networks. In European Conference on Computer Vision, pages 630–645. Springer, 2016. http://download.tensorflow.org/models/official/resnet_v2_imagenet_checkpoint.tar.gz; downloaded on on 5/1/18. ",
|
| 1540 |
+
"bbox": [
|
| 1541 |
+
174,
|
| 1542 |
+
506,
|
| 1543 |
+
831,
|
| 1544 |
+
558
|
| 1545 |
+
],
|
| 1546 |
+
"page_idx": 9
|
| 1547 |
+
},
|
| 1548 |
+
{
|
| 1549 |
+
"type": "text",
|
| 1550 |
+
"text": "M. Hein and M. Andriushchenko. Formal guarantees on the robustness of a classifier against adversarial manipulation. In NIPS, pages 2266–2276, 2017. ",
|
| 1551 |
+
"bbox": [
|
| 1552 |
+
169,
|
| 1553 |
+
565,
|
| 1554 |
+
825,
|
| 1555 |
+
592
|
| 1556 |
+
],
|
| 1557 |
+
"page_idx": 9
|
| 1558 |
+
},
|
| 1559 |
+
{
|
| 1560 |
+
"type": "text",
|
| 1561 |
+
"text": "S. Hochreiter. Untersuchungen zu dynamischen neuronalen netzen. Diploma, Technische Universität München, 91:1, 1991. ",
|
| 1562 |
+
"bbox": [
|
| 1563 |
+
173,
|
| 1564 |
+
599,
|
| 1565 |
+
825,
|
| 1566 |
+
626
|
| 1567 |
+
],
|
| 1568 |
+
"page_idx": 9
|
| 1569 |
+
},
|
| 1570 |
+
{
|
| 1571 |
+
"type": "text",
|
| 1572 |
+
"text": "S. Hochreiter, Y. Bengio, P. Frasconi, J. Schmidhuber, et al. Gradient flow in recurrent nets: the difficulty of learning long-term dependencies, 2001. ",
|
| 1573 |
+
"bbox": [
|
| 1574 |
+
173,
|
| 1575 |
+
633,
|
| 1576 |
+
823,
|
| 1577 |
+
661
|
| 1578 |
+
],
|
| 1579 |
+
"page_idx": 9
|
| 1580 |
+
},
|
| 1581 |
+
{
|
| 1582 |
+
"type": "text",
|
| 1583 |
+
"text": "R. A. Horn and C. R. Johnson. Matrix Analysis. Cambridge University Press, New York, NY, USA, 2nd edition, 2012. ISBN 0521548233, 9780521548236. ",
|
| 1584 |
+
"bbox": [
|
| 1585 |
+
171,
|
| 1586 |
+
666,
|
| 1587 |
+
825,
|
| 1588 |
+
694
|
| 1589 |
+
],
|
| 1590 |
+
"page_idx": 9
|
| 1591 |
+
},
|
| 1592 |
+
{
|
| 1593 |
+
"type": "text",
|
| 1594 |
+
"text": "A. K. Jain. Fundamentals of digital image processing. Englewood Cliffs, NJ: Prentice Hall„ 1989. ",
|
| 1595 |
+
"bbox": [
|
| 1596 |
+
171,
|
| 1597 |
+
700,
|
| 1598 |
+
758,
|
| 1599 |
+
717
|
| 1600 |
+
],
|
| 1601 |
+
"page_idx": 9
|
| 1602 |
+
},
|
| 1603 |
+
{
|
| 1604 |
+
"type": "text",
|
| 1605 |
+
"text": "Y. LeCun, L. Bottou, Y. Bengio, and P. Haffner. Gradient-based learning applied to document recognition. Proceedings of the IEEE, 86(11):2278–2324, 1998. ",
|
| 1606 |
+
"bbox": [
|
| 1607 |
+
176,
|
| 1608 |
+
723,
|
| 1609 |
+
828,
|
| 1610 |
+
750
|
| 1611 |
+
],
|
| 1612 |
+
"page_idx": 9
|
| 1613 |
+
},
|
| 1614 |
+
{
|
| 1615 |
+
"type": "text",
|
| 1616 |
+
"text": "S. Lefkimmiatis, J. P. Ward, and M. Unser. Hessian Schatten-norm regularization for linear inverse problems. IEEE transactions on image processing, 22(5):1873–1888, 2013. ",
|
| 1617 |
+
"bbox": [
|
| 1618 |
+
169,
|
| 1619 |
+
756,
|
| 1620 |
+
825,
|
| 1621 |
+
784
|
| 1622 |
+
],
|
| 1623 |
+
"page_idx": 9
|
| 1624 |
+
},
|
| 1625 |
+
{
|
| 1626 |
+
"type": "text",
|
| 1627 |
+
"text": "T. Miyato, T. Kataoka, M. Koyama, and Y. Yoshida. Spectral normalization for generative adversarial networks. ICLR, 2018. ",
|
| 1628 |
+
"bbox": [
|
| 1629 |
+
174,
|
| 1630 |
+
790,
|
| 1631 |
+
823,
|
| 1632 |
+
818
|
| 1633 |
+
],
|
| 1634 |
+
"page_idx": 9
|
| 1635 |
+
},
|
| 1636 |
+
{
|
| 1637 |
+
"type": "text",
|
| 1638 |
+
"text": "J. Pennington, S. Schoenholz, and S. Ganguli. Resurrecting the sigmoid in deep learning through dynamical isometry: theory and practice. In Advances in neural information processing systems, pages 4788–4798, 2017. ",
|
| 1639 |
+
"bbox": [
|
| 1640 |
+
173,
|
| 1641 |
+
824,
|
| 1642 |
+
825,
|
| 1643 |
+
852
|
| 1644 |
+
],
|
| 1645 |
+
"page_idx": 9
|
| 1646 |
+
},
|
| 1647 |
+
{
|
| 1648 |
+
"type": "text",
|
| 1649 |
+
"text": "A. M. Saxe, J. L. McClelland, and S. Ganguli. Exact solutions to the nonlinear dynamics of learning in deep linear neural networks. arXiv preprint arXiv:1312.6120, 2013. ",
|
| 1650 |
+
"bbox": [
|
| 1651 |
+
173,
|
| 1652 |
+
858,
|
| 1653 |
+
821,
|
| 1654 |
+
886
|
| 1655 |
+
],
|
| 1656 |
+
"page_idx": 9
|
| 1657 |
+
},
|
| 1658 |
+
{
|
| 1659 |
+
"type": "text",
|
| 1660 |
+
"text": "Y. Yoshida and T. Miyato. Spectral norm regularization for improving the generalizability of deep learning. arXiv preprint arXiv:1705.10941, 2017. ",
|
| 1661 |
+
"bbox": [
|
| 1662 |
+
171,
|
| 1663 |
+
892,
|
| 1664 |
+
823,
|
| 1665 |
+
920
|
| 1666 |
+
],
|
| 1667 |
+
"page_idx": 9
|
| 1668 |
+
},
|
| 1669 |
+
{
|
| 1670 |
+
"type": "text",
|
| 1671 |
+
"text": "A NumPy code for operator norm projection ",
|
| 1672 |
+
"text_level": 1,
|
| 1673 |
+
"bbox": [
|
| 1674 |
+
174,
|
| 1675 |
+
103,
|
| 1676 |
+
578,
|
| 1677 |
+
117
|
| 1678 |
+
],
|
| 1679 |
+
"page_idx": 10
|
| 1680 |
+
},
|
| 1681 |
+
{
|
| 1682 |
+
"type": "text",
|
| 1683 |
+
"text": "def Clip_OperatorNorm(kernel, input_shape, clip_to): transform_coefficients $=$ np.fft.fft2(kernel, input_shape, axes $\\displaystyle { \\varepsilon }$ [0, 1]) U, D, $\\texttt { V } =$ np.linalg.svd(transform_coefficients, compute_uv $\\mathbf { \\bar { \\Pi } } = \\mathbf { \\bar { \\Pi } }$ True, full_matrices $\\underline { { \\underline { { \\mathbf { \\Pi } } } } }$ False) D_clipped $=$ np.minimum(D, clip_to) ",
|
| 1684 |
+
"bbox": [
|
| 1685 |
+
171,
|
| 1686 |
+
133,
|
| 1687 |
+
923,
|
| 1688 |
+
190
|
| 1689 |
+
],
|
| 1690 |
+
"page_idx": 10
|
| 1691 |
+
},
|
| 1692 |
+
{
|
| 1693 |
+
"type": "text",
|
| 1694 |
+
"text": "if kernel.shape[2] $>$ kernel.shape[3]: ",
|
| 1695 |
+
"bbox": [
|
| 1696 |
+
196,
|
| 1697 |
+
190,
|
| 1698 |
+
508,
|
| 1699 |
+
203
|
| 1700 |
+
],
|
| 1701 |
+
"page_idx": 10
|
| 1702 |
+
},
|
| 1703 |
+
{
|
| 1704 |
+
"type": "text",
|
| 1705 |
+
"text": "clipped_transform_coefficients $=$ np.matmul(U, D_clipped[..., None] \\* V) else: ",
|
| 1706 |
+
"bbox": [
|
| 1707 |
+
183,
|
| 1708 |
+
204,
|
| 1709 |
+
820,
|
| 1710 |
+
231
|
| 1711 |
+
],
|
| 1712 |
+
"page_idx": 10
|
| 1713 |
+
},
|
| 1714 |
+
{
|
| 1715 |
+
"type": "text",
|
| 1716 |
+
"text": "clipped_transform_coefficients $=$ np.matmul(U \\* D_clipped[..., None, :], V) clipped_kernel $=$ np.fft.ifft2(clipped_transform_coefficients, axes $=$ [0, 1]).real return clipped_kernel[np.ix_(\\*[range(d) for d in kernel.shape])] ",
|
| 1717 |
+
"bbox": [
|
| 1718 |
+
191,
|
| 1719 |
+
231,
|
| 1720 |
+
870,
|
| 1721 |
+
272
|
| 1722 |
+
],
|
| 1723 |
+
"page_idx": 10
|
| 1724 |
+
},
|
| 1725 |
+
{
|
| 1726 |
+
"type": "text",
|
| 1727 |
+
"text": "B Test error vs. training time ",
|
| 1728 |
+
"text_level": 1,
|
| 1729 |
+
"bbox": [
|
| 1730 |
+
176,
|
| 1731 |
+
294,
|
| 1732 |
+
450,
|
| 1733 |
+
309
|
| 1734 |
+
],
|
| 1735 |
+
"page_idx": 10
|
| 1736 |
+
},
|
| 1737 |
+
{
|
| 1738 |
+
"type": "text",
|
| 1739 |
+
"text": "Figure 4 shows the plots of test error vs. training time in our CIFAR-10 experiment. ",
|
| 1740 |
+
"bbox": [
|
| 1741 |
+
173,
|
| 1742 |
+
325,
|
| 1743 |
+
718,
|
| 1744 |
+
340
|
| 1745 |
+
],
|
| 1746 |
+
"page_idx": 10
|
| 1747 |
+
},
|
| 1748 |
+
{
|
| 1749 |
+
"type": "image",
|
| 1750 |
+
"img_path": "images/16182abaa61eb2491c74d1791275021b6cb0a5a33588bd499de658f57826f6d3.jpg",
|
| 1751 |
+
"image_caption": [
|
| 1752 |
+
"Figure 4: Test error vs. training time for ResNet model (He et al., 2016) for CIFAR-10. "
|
| 1753 |
+
],
|
| 1754 |
+
"image_footnote": [],
|
| 1755 |
+
"bbox": [
|
| 1756 |
+
341,
|
| 1757 |
+
358,
|
| 1758 |
+
658,
|
| 1759 |
+
559
|
| 1760 |
+
],
|
| 1761 |
+
"page_idx": 10
|
| 1762 |
+
},
|
| 1763 |
+
{
|
| 1764 |
+
"type": "text",
|
| 1765 |
+
"text": "C The official pre-trained ResNet model ",
|
| 1766 |
+
"bbox": [
|
| 1767 |
+
173,
|
| 1768 |
+
616,
|
| 1769 |
+
544,
|
| 1770 |
+
632
|
| 1771 |
+
],
|
| 1772 |
+
"page_idx": 10
|
| 1773 |
+
},
|
| 1774 |
+
{
|
| 1775 |
+
"type": "image",
|
| 1776 |
+
"img_path": "images/670ced69ed852252c2545e4ebf004a4911c911a0667c1ac6d6e75836cc91b167.jpg",
|
| 1777 |
+
"image_caption": [
|
| 1778 |
+
"Figure 5: Plot of the singular values of the linear operators associated with the convolutional layers of the pretrained \"ResNet V2\" from the TensorFlow website. "
|
| 1779 |
+
],
|
| 1780 |
+
"image_footnote": [],
|
| 1781 |
+
"bbox": [
|
| 1782 |
+
362,
|
| 1783 |
+
665,
|
| 1784 |
+
630,
|
| 1785 |
+
823
|
| 1786 |
+
],
|
| 1787 |
+
"page_idx": 10
|
| 1788 |
+
},
|
| 1789 |
+
{
|
| 1790 |
+
"type": "text",
|
| 1791 |
+
"text": "The singular values of the convolutional layers from the official “Resnet $\\mathbf { V } 2 ^ { \\mathbf { \\mathfrak { s } } }$ pre-trained model (He et al., 2016) are plotted in Figure 5. The singular values are ordered by value. Only layers with kernels larger than $1 \\times 1$ are plotted. The curves are plotted with a mixture of red and green; layers closer to the input are plotted with colors with a greater share of red. The transformations with the largest operator norms are closest to the inputs. As the data has undergone more rounds of processing, as we proceed through the layers, the number of non-negligible singular values increases for a while, but at the end, it tapers off. ",
|
| 1792 |
+
"bbox": [
|
| 1793 |
+
174,
|
| 1794 |
+
882,
|
| 1795 |
+
825,
|
| 1796 |
+
924
|
| 1797 |
+
],
|
| 1798 |
+
"page_idx": 10
|
| 1799 |
+
},
|
| 1800 |
+
{
|
| 1801 |
+
"type": "image",
|
| 1802 |
+
"img_path": "images/921efa0f13c6eee7ac71d664f437e5ccc2cc5a08dd2f7fe04e1bdf51684c6cc4.jpg",
|
| 1803 |
+
"image_caption": [
|
| 1804 |
+
"Figure 6: Plot of the ratio of singular values to maximum singular value of the linear operators associated with the convolutional layers of the pretrained \"ResNet V2\" from the TensorFlow website. "
|
| 1805 |
+
],
|
| 1806 |
+
"image_footnote": [],
|
| 1807 |
+
"bbox": [
|
| 1808 |
+
334,
|
| 1809 |
+
118,
|
| 1810 |
+
651,
|
| 1811 |
+
306
|
| 1812 |
+
],
|
| 1813 |
+
"page_idx": 11
|
| 1814 |
+
},
|
| 1815 |
+
{
|
| 1816 |
+
"type": "image",
|
| 1817 |
+
"img_path": "images/0f31db2c8ee9490026570859907e73364cf336b1887958a36edfcea9e824d188.jpg",
|
| 1818 |
+
"image_caption": [
|
| 1819 |
+
"Figure 7: Plot of the ratio of singular values to maximum singular value of the linear operators associated with the convolutional layers of the pretrained \"ResNet V2\" normalized by size of the convolution. "
|
| 1820 |
+
],
|
| 1821 |
+
"image_footnote": [],
|
| 1822 |
+
"bbox": [
|
| 1823 |
+
334,
|
| 1824 |
+
378,
|
| 1825 |
+
643,
|
| 1826 |
+
565
|
| 1827 |
+
],
|
| 1828 |
+
"page_idx": 11
|
| 1829 |
+
},
|
| 1830 |
+
{
|
| 1831 |
+
"type": "text",
|
| 1832 |
+
"text": "",
|
| 1833 |
+
"bbox": [
|
| 1834 |
+
173,
|
| 1835 |
+
647,
|
| 1836 |
+
826,
|
| 1837 |
+
704
|
| 1838 |
+
],
|
| 1839 |
+
"page_idx": 11
|
| 1840 |
+
},
|
| 1841 |
+
{
|
| 1842 |
+
"type": "text",
|
| 1843 |
+
"text": "In Figure 5, we plotted the singular values ordered by value. It can be observed that while singular values in the first layer are much larger than the rest, many layers have a lot of singular values that are pretty big. For example, most of the layers have at least 10000 singular values that are at least 1. To give a complementary view, Figure 6 presents a plot of the ratios of the singular values in each layer with the largest singular value in that layer. We see that the effective rank of the convolutional layers is larger closer to the inputs. ",
|
| 1844 |
+
"bbox": [
|
| 1845 |
+
173,
|
| 1846 |
+
710,
|
| 1847 |
+
825,
|
| 1848 |
+
794
|
| 1849 |
+
],
|
| 1850 |
+
"page_idx": 11
|
| 1851 |
+
},
|
| 1852 |
+
{
|
| 1853 |
+
"type": "text",
|
| 1854 |
+
"text": "Figure 6 shows that different convolutional layers have significantly different numbers of non-negligible singular values. A question that may arise is to what extent this was due to the fact that different layers simply are of different sizes, so that the total number of their singular values, tiny or not, was different. To look into this, instead of plotting the singular value ratios as a function of the rank of the singular values, as in the Figure 6, we normalized the values on the horizontal axis by dividing by the total number of singular values. The result is shown in Figure 7. ",
|
| 1855 |
+
"bbox": [
|
| 1856 |
+
173,
|
| 1857 |
+
801,
|
| 1858 |
+
825,
|
| 1859 |
+
885
|
| 1860 |
+
],
|
| 1861 |
+
"page_idx": 11
|
| 1862 |
+
}
|
| 1863 |
+
]
|
parse/train/rJevYoA9Fm/rJevYoA9Fm_middle.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
parse/train/rJevYoA9Fm/rJevYoA9Fm_model.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
parse/train/rkgNKkHtvB/rkgNKkHtvB.md
ADDED
|
@@ -0,0 +1,274 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# REFORMER: THE EFFICIENT TRANSFORMER
|
| 2 |
+
|
| 3 |
+
Nikita Kitaev∗ U.C. Berkeley & Google Research kitaev@cs.berkeley.edu
|
| 4 |
+
|
| 5 |
+
Łukasz Kaiser∗ Anselm Levskaya Google Research Google Research {lukaszkaiser,levskaya}@google.com
|
| 6 |
+
|
| 7 |
+
# ABSTRACT
|
| 8 |
+
|
| 9 |
+
Large Transformer models routinely achieve state-of-the-art results on a number of tasks but training these models can be prohibitively costly, especially on long sequences. We introduce two techniques to improve the efficiency of Transformers. For one, we replace dot-product attention by one that uses locality-sensitive hashing, changing its complexity from $\mathrm { O } ( L ^ { 2 } )$ to $\mathrm { O } ( L \log L )$ , where $L$ is the length of the sequence. Furthermore, we use reversible residual layers instead of the standard residuals, which allows storing activations only once in the training process instead of $N$ times, where $N$ is the number of layers. The resulting model, the Reformer, performs on par with Transformer models while being much more memory-efficient and much faster on long sequences.
|
| 10 |
+
|
| 11 |
+
# 1 INTRODUCTION
|
| 12 |
+
|
| 13 |
+
The Transformer architecture (Vaswani et al., 2017) is widely used in natural language processing and yields state-of-the-art results on a number of tasks. To obtain these results, researchers have resorted to training ever larger Transformer models. The number of parameters exceeds 0.5B per layer in the largest configuration reported in (Shazeer et al., 2018) while the number of layers goes up to 64 in (Al-Rfou et al., 2018). Transformer models are also used on increasingly long sequences. Up to 11 thousand tokens of text in a single example were processed in (Liu et al., 2018) and when processing other modalities, like music (Huang et al., 2018) and images (Parmar et al., 2018), even longer sequences are commonplace. These large-scale long-sequence models yield great results but strain resources to the point where some argue that this trend is breaking NLP research1. Many large Transformer models can only realistically be trained in large industrial research laboratories and such models trained with model parallelism cannot even be fine-tuned on a single GPU as their memory requirements demand a multi-accelerator hardware setup even for a single training step.
|
| 14 |
+
|
| 15 |
+
Do large Transformer models fundamentally require such huge resources or are they simply inefficient? Consider the following calculation: the 0.5B parameters used in the largest reported Transformer layer account for 2GB of memory. Activations for 64K tokens with embedding size 1024 and batch size 8 account for $6 4 \mathrm { K } \times 1 \mathrm { K } \times 8 = 0 . 5 \mathrm { B }$ floats, requiring another 2GB of memory. If our memory use was only per-layer, then we should fairly easily fit a large Transformer even on sequences of length 64K on a single accelerator. Further, the whole corpus used to train BERT only requires 17GB to store. Why is it then that we cannot even fine-tune these models on single machines?
|
| 16 |
+
|
| 17 |
+
The above estimate includes only per-layer memory and input activations cost and does not take into account the following major sources of memory use in the Transformer.
|
| 18 |
+
|
| 19 |
+
• Memory in a model with $N$ layers is $N$ -times larger than in a single-layer model due to the fact that activations need to be stored for back-propagation. • Since the depth $d _ { f f }$ of intermediate feed-forward layers is often much larger than the depth $d _ { m o d e l }$ of attention activations, it accounts for a large fraction of memory use. • Attention on sequences of length $L$ is $\mathrm { O } ( L ^ { 2 } )$ in both computational and memory complexity, so even for a single sequence of 64K tokens can exhaust accelerator memory.
|
| 20 |
+
|
| 21 |
+
We introduce the Reformer model which solves these problems using the following techniques:
|
| 22 |
+
|
| 23 |
+
• Reversible layers, first introduced in Gomez et al. (2017), enable storing only a single copy of activations in the whole model, so the $N$ factor disappears.
|
| 24 |
+
• Splitting activations inside feed-forward layers and processing them in chunks removes the $d _ { f f }$ factor and saves memory inside feed-forward layers.
|
| 25 |
+
• Approximate attention computation based on locality-sensitive hashing replaces the $\mathrm { O } ( L ^ { 2 } )$ factor in attention layers with $\mathrm { O } ( L \log L )$ and so allows operating on long sequences.
|
| 26 |
+
|
| 27 |
+
We study these techniques and show that they have negligible impact on the training process compared to the standard Transformer. Splitting activations in fact only affects the implementation; it is numerically identical to the layers used in the Transformer. Applying reversible residuals instead of the standard ones does change the model but has a negligible effect on training in all configurations we experimented with. Finally, locality-sensitive hashing in attention is a more major change that can influence the training dynamics, depending on the number of concurrent hashes used. We study this parameter and find a value which is both efficient to use and yields results very close to full attention.
|
| 28 |
+
|
| 29 |
+
We experiment on a synthetic task, a text task (enwik8) with sequences of length 64K and an image generation task (imagenet-64 generation) with sequences of length 12K. In both cases we show that Reformer matches the results obtained with full Transformer but runs much faster, especially on the text task, and with orders of magnitude better memory efficiency.
|
| 30 |
+
|
| 31 |
+
# 2 LOCALITY-SENSITIVE HASHING ATTENTION
|
| 32 |
+
|
| 33 |
+
Dot-product attention. The standard attention used in the Transformer is the scaled dot-product attention (Vaswani et al., 2017). The input consists of queries and keys of dimension $d _ { k }$ , and values√ of dimension $d _ { v }$ . The dot products of the query with all keys are computed, scaled by $\sqrt { d _ { k } }$ , and a softmax function is applied to obtain the weights on the values. In practice, the attention function on a set of queries is computed simultaneously, packed together into a matrix $Q$ . Assuming the keys and values are also packed together into matrices $K$ and $V$ , the matrix of outputs is defined as:
|
| 34 |
+
|
| 35 |
+
$$
|
| 36 |
+
\mathrm { A t t e n t i o n } ( Q , K , V ) = \mathrm { s o f t m a x } ( \frac { Q K ^ { T } } { \sqrt { d _ { k } } } ) V
|
| 37 |
+
$$
|
| 38 |
+
|
| 39 |
+
Multi-head attention. In the Transformer, instead of performing a single attention function with $d _ { m o d e l }$ -dimensional keys, values and queries, one linearly projects the queries, keys and values $h$ times with different, learned linear projections to $d _ { k } , d _ { k }$ and $d _ { v }$ dimensions, respectively. Attention is applied to each of these projected versions of queries, keys and values in parallel, yielding $d _ { v }$ - dimensional output values. These are concatenated and once again projected, resulting in the final values. This mechanism is known as multi-head attention.
|
| 40 |
+
|
| 41 |
+
Memory-efficient attention. To calculate the memory use of the attention mechanism, let us focus on the attention computation from Equation 1. Let us assume that Q, K and $\mathrm { v }$ all have the shape $\left[ b a t c h \_ s i z e , l e n g t h , d _ { m o d e l } \right]$ . The main issue is the term $Q K ^ { T }$ , which has the shape [batch size, length, length]. In the experimental section we train a model on sequences of length $6 4 K$ – in this case, even at batch-size of 1, this is a $6 4 K \times 6 4 K$ matrix, which in 32-bit floats would take 16GB of memory. This is impractical and has hindered the use of the Transformer for long sequences. But it is important to note that the $Q K ^ { T }$ matrix does not need to be fully materialized in memory. The attention can indeed be computed for each query $q _ { i }$ separately, only calculating $\mathrm { s o f t m a x } ( \frac { q _ { i } K ^ { T } } { \sqrt { d _ { k } } } ) V$ once in memory, and then re-computing it on the backward pass when needed for gradients. This way of computing attention may be less efficient but it only uses memory proportional to length. We use this memory-efficient implementation of attention to run the full-attention baselines presented in the experimental section.
|
| 42 |
+
|
| 43 |
+
Where do Q, K, V come from? The multi-head attention described above operates on keys, queries and values, but usually we are only given a single tensor of activations A of the shape [batch size, length, $d _ { m o d e l } ]$ – e.g., coming from embedding the tokens in a sentence into vectors.
|
| 44 |
+
|
| 45 |
+

|
| 46 |
+
Figure 1: An angular locality sensitive hash uses random rotations of spherically projected points to establish buckets by an argmax over signed axes projections. In this highly simplified 2D depiction, two points $x$ and $y$ are unlikely to share the same hash buckets (above) for the three different angular hashes unless their spherical projections are close to one another (below).
|
| 47 |
+
|
| 48 |
+
To build Q, K and V from A, the Transformer uses 3 different linear layers projecting A into Q, K and $\mathrm { v }$ with different parameters. For models with LSH attention, we want queries and keys (Q and K) to be identical. This is easily achieved by using the same linear layer to go from A to Q and K, and a separate one for V. We call a model that behaves like this a shared-QK Transformer. It turns out that sharing QK does not affect the performance of Transformer, even if we additionally normalize the length of the keys K, as we show in the experimental Section 5.
|
| 49 |
+
|
| 50 |
+
Hashing attention. For the LSH attention, we start with two tensors, $\mathrm { Q } { = } \mathrm { K }$ and $\mathrm { v }$ of the shape [batch size, length, $d _ { m o d e l } ]$ . We keep the multi-head mechanism intact and focus on the attention computation from Equation 1. As already mentioned, the main issue is the term $Q K ^ { T }$ , which has the shape [batch size, length, length]. But note that we are actually only interested in softmax $\left( Q K ^ { T } \right)$ . Since softmax is dominated by the largest elements, for each query $q _ { i }$ we only need to focus on the keys in K that are closest to $q _ { i }$ . For example, if K is of length 64K, for each $q _ { i }$ we could only consider a small subset of, say, the 32 or 64 closest keys. That is much more efficient, but how can we find the nearest neighbors among the keys?
|
| 51 |
+
|
| 52 |
+
Locality sensitive hashing. The problem of finding nearest neighbors quickly in high-dimensional spaces can be solved by locality-sensitive hashing (LSH). A hashing scheme that assigns each vector $x$ to a hash $h ( x )$ is called locality-sensitive if nearby vectors get the same hash with high probability and distant ones do not. In our case, we actually only require that nearby vectors get the same hash with high probability and that hash-buckets are of similar size with high probability.
|
| 53 |
+
|
| 54 |
+
We achieve this by employing random projections as follows (see Figure 1). To get $b$ hashes, we first fix a random matrix $R$ of size $[ d _ { k } , b / 2 ]$ . We then define $h ( x ) = \arg \operatorname* { m a x } ( [ x R ; - x R ] )$ where $[ u ; v ]$ denotes the concatenation of two vectors. This method is a known LSH scheme (Andoni et al., 2015) and is easy to implement and apply to batches of vectors.
|
| 55 |
+
|
| 56 |
+
LSH attention. Knowing our LSH scheme and the general idea of hashing attention, we will now formalize the LSH attention we use in this paper. We first rewrite the equation for normal attention, (1), for a single query position $i$ at a time:
|
| 57 |
+
|
| 58 |
+
$$
|
| 59 |
+
o _ { i } = \sum _ { j \in \mathcal { P } _ { i } } \exp \left( q _ { i } \cdot k _ { j } - z ( i , \mathcal { P } _ { i } ) \right) v _ { j }
|
| 60 |
+
$$
|
| 61 |
+
|
| 62 |
+
We introduce the notation $\mathcal { P } _ { i }$ to represent the set that the query at position $i$ attends to, and $z$ to denote the partition function (i.e. the normalizing term in the softmax). For clarity, we also omit scaling by $\sqrt { d _ { k } }$ .
|
| 63 |
+
|
| 64 |
+
For batching purposes we typically perform attention over a larger set $\widetilde { \mathcal { P } } _ { i } = \{ 0 , 1 , \ldots , l \} \supseteq \mathcal { P } _ { i }$ while masking out elements not in $\mathcal { P } _ { i }$ :
|
| 65 |
+
|
| 66 |
+
$$
|
| 67 |
+
o _ { i } = \sum _ { j \in \widetilde { \mathcal { P } } _ { i } } \exp \left( q _ { i } \cdot k _ { j } - m ( j , \mathcal { P } _ { i } ) - z ( i , \mathcal { P } _ { i } ) \right) v _ { j } \quad \mathrm { ~ w h e r e ~ } m ( j , \mathcal { P } _ { i } ) = \left\{ \begin{array} { l l } { \infty } & { \mathrm { i f ~ } j \notin \mathcal { P } _ { i } } \\ { 0 } & { \mathrm { o t h e r w i s e } } \end{array} \right.
|
| 68 |
+
$$
|
| 69 |
+
|
| 70 |
+

|
| 71 |
+
Figure 2: Simplified depiction of LSH Attention showing the hash-bucketing, sorting, and chunking steps and the resulting causal attentions. (a-d) Attention matrices for these varieties of attention.
|
| 72 |
+
|
| 73 |
+
Now we turn to LSH attention, which we can think of in terms of restricting the set $\mathcal { P } _ { i }$ of target items a query position $i$ can attend to, by only allowing attention within a single hash bucket.
|
| 74 |
+
|
| 75 |
+
$$
|
| 76 |
+
\mathcal { P } _ { i } = \{ j : h ( q _ { i } ) = h ( k _ { j } ) \}
|
| 77 |
+
$$
|
| 78 |
+
|
| 79 |
+
Figure 2(a-b) shows a schematic comparison of full-attention with a hashed variant. Part (a) depicts that the attention matrix for full attention is typically sparse, but the computation does not take advantage of this sparsity. In (b), the queries and keys have been sorted according to their hash bucket. Since similar items fall in the same bucket with high probability, the full attention pattern can be approximated by only allowing attention within each bucket.
|
| 80 |
+
|
| 81 |
+
Hash buckets in this formulation tend to be uneven in size, which makes it difficult to batch across buckets. Moreover, the number of queries and the number of keys within a bucket may be unequal – in fact, it is possible for a bucket to contain many queries but no keys. To alleviate these issues, we first ensure that h(kj ) = h(qj ) by setting kj = $\begin{array} { r } { k _ { j } = \frac { \dot { q _ { j } } } { | | q _ { j } | | } } \end{array}$ . Next, we sort the queries by bucket number and, within each bucket, by sequence position; this defines a permutation where $i \mapsto s _ { i }$ after sorting. In the sorted attention matrix, pairs from the same bucket will cluster near the diagonal (as depicted in Figure $2 \mathrm { c }$ ). We can follow a batching approach where chunks of $m$ consecutive queries (after sorting) attend to each other, and one chunk back (Figure 2d). Following our earlier notation, this corresponds to setting:
|
| 82 |
+
|
| 83 |
+
$$
|
| 84 |
+
\widetilde { \mathcal { P } } _ { i } = \left\{ j : \left\lfloor { \frac { s _ { i } } { m } } \right\rfloor - 1 \leq \left\lfloor { \frac { s _ { j } } { m } } \right\rfloor \leq \left\lfloor { \frac { s _ { i } } { m } } \right\rfloor \right\}
|
| 85 |
+
$$
|
| 86 |
+
|
| 87 |
+
If $\operatorname* { m a x } _ { i } \left| \mathcal { P } _ { i } \right| < m$ , then $\mathcal { P } _ { i } \subseteq \widetilde { \mathcal { P } } _ { i }$ . In practice we set $\begin{array} { r } { m = \frac { 2 l } { n _ { b u c k e t s } } } \end{array}$ (where $l$ is the sequence length). The average bucket size is $\frac { l } { n _ { b u c k e t s } }$ , and we assume that the probability of a bucket growing to twice that size is sufficiently low. The overall process of LSH attention is summarized in Figure 2.
|
| 88 |
+
|
| 89 |
+
Multi-round LSH attention. With hashing, there is always a small probability that similar items nevertheless fall in different buckets. This probability can be reduced by doing multiple rounds of hashing with $n _ { r o u n d s }$ distinct hash functions $\{ h ^ { ( 1 ) } , h ^ { \left( 2 \right) } , \ldots \}$ , such that:
|
| 90 |
+
|
| 91 |
+
$$
|
| 92 |
+
{ \mathcal P } _ { i } = \bigcup _ { r = 1 } ^ { n _ { r o u n d s } } { \mathcal P } _ { i } ^ { ( r ) } \qquad \mathrm { w h e r e } ~ { \mathcal P } _ { i } ^ { ( r ) } = \Big \{ j : h ^ { ( r ) } ( q _ { i } ) = h ^ { ( r ) } ( q _ { j } ) \Big \}
|
| 93 |
+
$$
|
| 94 |
+
|
| 95 |
+
The multi-round case essentially involves performing LSH attention $n _ { r o u n d s }$ times in parallel; the details of the procedure are described in in Appendix A.
|
| 96 |
+
|
| 97 |
+
Causal masking for shared-QK attention. In a Transformer decoder, masking (denoted by $m ( j , \mathcal { P } _ { i } )$ in Equation 3) is used to prevent positions from attending into the future. To implement masking in LSH attention, we associate every query/key vector with a position index, re-order the position indices using the same permutations used to sort the query/key vectors, and then use a comparison operation to compute the mask.
|
| 98 |
+
|
| 99 |
+
Table 1: Memory and time complexity of attention variants. We write $l$ for length, $b$ for batch size, $n _ { h }$ for the number of heads, $n _ { c }$ for the number of LSH chunks, $n _ { r }$ for the number of hash repetitions.
|
| 100 |
+
|
| 101 |
+
<table><tr><td>Attention Type</td><td>Memory Complexity</td><td>Time Complexity</td></tr><tr><td>Scaled Dot-Product</td><td>max(bnnldk,bnnl²)</td><td>max(bnnldk,bnnl2)</td></tr><tr><td>Memory-Efficient</td><td>max(bnnldk,bnnl²)</td><td>max(bnhldk,bnnl²)</td></tr><tr><td>LSH Attention</td><td>max(bnnldk,bnnlnr(4l/nc)2)</td><td>max(bnhldk,bnhnrl(4l/nc)²)</td></tr></table>
|
| 102 |
+
|
| 103 |
+
Table 2: Accuracies on the duplication task of a 1-layer Transformer model with full attention and with locality-sensitive hashing attention using different number of parallel hashes.
|
| 104 |
+
|
| 105 |
+
<table><tr><td></td><td rowspan="2">Eval</td><td rowspan="2">Full Attention</td><td rowspan="2">LSH-8</td><td rowspan="2">LSH-4</td><td rowspan="2">LSH-2</td><td rowspan="2">LSH-1</td></tr><tr><td>Train</td></tr><tr><td>Full Attention</td><td></td><td>100%</td><td>94.8%</td><td>92.5%</td><td>76.9%</td><td>52.5%</td></tr><tr><td colspan="2">LSH-4</td><td>0.8%</td><td>100%</td><td>99.9%</td><td>99.4%</td><td>91.9%</td></tr><tr><td colspan="2">LSH-2</td><td>0.8%</td><td>100%</td><td>99.9%</td><td>98.1%</td><td>86.8%</td></tr><tr><td colspan="2">LSH-1</td><td>0.8%</td><td>99.9%</td><td>99.6%</td><td>94.8%</td><td>77.9%</td></tr></table>
|
| 106 |
+
|
| 107 |
+
While attention to the future is not allowed, typical implementations of the Transformer do allow a position to attend to itself. Such behavior is undesirable in a shared-QK formulation because the dot-product of a query vector with itself will almost always be greater than the dot product of a query vector with a vector at another position. We therefore modify the masking to forbid a token from attending to itself, except in situations where a token has no other valid attention targets (e.g. the first token in a sequence).
|
| 108 |
+
|
| 109 |
+
# 2.1 ANALYSIS ON A SYNTHETIC TASK
|
| 110 |
+
|
| 111 |
+
To verify the performance of LSH attention and study its behavior, we start with the following synthetic task: duplicate a sequence of symbols. In this task, each training and testing example has the form $0 w 0 w$ where $w \in \bar { \{ 1 , \ldots , N \} ^ { * } }$ is a sequence of symbols ranging from 1 to $N$ (we use $N = 1 2 7$ in our experiments). An example with the word $w$ of length 3 is given below.
|
| 112 |
+
|
| 113 |
+
<table><tr><td rowspan=1 colspan=1>Example:</td><td rowspan=1 colspan=1>0</td><td rowspan=1 colspan=1>19</td><td rowspan=1 colspan=1>113</td><td rowspan=1 colspan=1>72</td><td rowspan=1 colspan=1>0</td><td rowspan=1 colspan=1>19</td><td rowspan=1 colspan=1>113</td><td rowspan=1 colspan=1>72</td></tr></table>
|
| 114 |
+
|
| 115 |
+
To study LSH attention, we train a language model on examples of the above form where each $w$ is of length 511 (so the whole input $0 w 0 w$ is of length 1024). As this is a language modeling task, we always predict the next symbol given all the previous ones, but we mask the loss and accuracy to only consider positions in the second half of the input, i.e., those that can actually be predicted.
|
| 116 |
+
|
| 117 |
+
The above task can be solved perfectly (to accuracy $100 \%$ and loss 0) by a 1-layer Transformer model. Note though, that it requires non-local attention lookups, so it cannot be solved by any model relying on sparse attention with a limited span. To make it easy and fast to train but similar to models used in NLP, we use a 1-layer Transformer with $d _ { m o d e l } = d _ { f f } = 2 5 6$ and 4 heads. We train it for 150K steps in 4 different settings: with full attention, LSH attention with $n _ { r o u n d s } = 1$ , $n _ { r o u n d s } = 2$ and $n _ { r o u n d s } = 4$ .
|
| 118 |
+
|
| 119 |
+
From the results summarized in Table 2 we see that a model trained with full attention can be immediately used with LSH attention, but at some loss of accuracy. When trained from scratch with LSH attention, the model trained with 4 hashes achieves almost perfect accuracy as well. Interestingly, the accuracy becomes perfect when evaluated with 8 hashes. It goes down when evaluated with 2 or 1 hashes. Models trained with less hashes show worse results but even the model trained with just 1 hash performs almost perfectly when evaluated with 8 hashes.
|
| 120 |
+
|
| 121 |
+
# 3 REVERSIBLE TRANSFORMER
|
| 122 |
+
|
| 123 |
+
As the above section shows, the complexity of attention can be reduced from square in length to linear, provided an approximation is acceptable. But it is clear from Table 1 that each field starts with a $b \cdot n _ { h } \cdot l$ term: the $b \cdot n _ { h } \cdot l \cdot d _ { k }$ , or alternatively $b \cdot l \cdot d _ { m o d e l }$ cost cannot be avoided. Indeed, the activations before each layer are already of the size $b \cdot l \cdot d _ { m o d e l }$ , so the memory use of the whole model with $n _ { l }$ layers is at least $b \cdot l \cdot d _ { m o d e l } \cdot n _ { l }$ . Even worse: inside the feed-forward layers of Transformer this goes up to $\boldsymbol { b } \cdot \boldsymbol { l } \cdot d _ { f f } \cdot n _ { l }$ . In a big Transformer it is usual to set $d _ { f f } = 4 K$ and $n _ { l } = 1 6$ so with $l = 6 4 K$ this again would use an impractical $1 6 G B$ of memory
|
| 124 |
+
|
| 125 |
+
In this section, we show how to reduce this cost by first dealing with the $n _ { l }$ part of the term using reversible layers and then showing how chunking can allow us to handle the $d _ { f f }$ problem. The effects of each of these approaches on memory and time complexity are summarized in Table 3.
|
| 126 |
+
|
| 127 |
+
RevNets. Reversible residual networks were introduced by Gomez et al. (2017) where it was shown that they can replace ResNets for image classification. The main idea is to allow the activations at any given layer to be recovered from the activations at the following layer, using only the model parameters. Rather than having to checkpoint intermediate values for use in the backward pass, layers can be reversed one-by-one as back-propagation proceeds from the output of the network to its input. Whereas a normal residual layer performs a function $x \mapsto y$ that operates on a single input and produces a single output and has the form $y = x + F ( x )$ , a reversible layer works on pairs of inputs/outputs: $( x _ { 1 } , x _ { 2 } ) \mapsto ( y _ { 1 } , y _ { 2 } )$ , and follows the equations:
|
| 128 |
+
|
| 129 |
+
$$
|
| 130 |
+
y _ { 1 } = x _ { 1 } + F ( x _ { 2 } ) y _ { 2 } = x _ { 2 } + G ( y _ { 1 } )
|
| 131 |
+
$$
|
| 132 |
+
|
| 133 |
+
A layer can be reversed by subtracting (rather than adding) the residuals:
|
| 134 |
+
|
| 135 |
+
$$
|
| 136 |
+
x _ { 2 } = y _ { 2 } - G ( y _ { 1 } ) x _ { 1 } = y _ { 1 } - F ( x _ { 2 } )
|
| 137 |
+
$$
|
| 138 |
+
|
| 139 |
+
Reversible Transformer. We apply the RevNet idea to the Transformer by combining the attention and feed-forward layers inside the revnet block. In the notation above, F becomes an attention layer while $\mathbf { G }$ becomes the feed-forward layer. Note that Layer Normalization (Ba et al., 2016) is moved inside the residual blocks.
|
| 140 |
+
|
| 141 |
+
$$
|
| 142 |
+
Y _ { 1 } = X _ { 1 } + \mathrm { A t t e n t i o n } ( X _ { 2 } ) \qquad Y _ { 2 } = X _ { 2 } + \mathrm { F e e d F o r w a r d } ( Y _ { 1 } )
|
| 143 |
+
$$
|
| 144 |
+
|
| 145 |
+
The reversible Transformer does not need to store activations in each layer and so gets rid of the $n _ { l }$ term. In Section 5 we show that it performs the same as the normal Transformer when using the same number of parameters; we achieve this by having both $x _ { 1 }$ and $x _ { 2 }$ have size $d _ { m o d e l }$ .
|
| 146 |
+
|
| 147 |
+
Chunking. While reversibility covers the $n _ { l }$ term, the thicker layers can still use a lot of memory. The feed-forward layer in particular can use intermediate vectors of dimensionality $d _ { f f } = 4 K$ or higher. However, computations in feed-forward layers are completely independent across positions in a sequence, so the computation can be split into $c$ chunks:
|
| 148 |
+
|
| 149 |
+
$$
|
| 150 |
+
Y _ { 2 } = \left[ Y _ { 2 } ^ { ( 1 ) } ; \ldots ; Y _ { 2 } ^ { ( c ) } \right] = \left[ X _ { 2 } ^ { ( 1 ) } + { \mathrm { F e e d F o r w a r d } } ( Y _ { 1 } ^ { ( 1 ) } ) ; \ldots ; X _ { 2 } ^ { ( c ) } + { \mathrm { F e e d F o r w a r d } } ( Y _ { 1 } ^ { ( c ) } ) \right]
|
| 151 |
+
$$
|
| 152 |
+
|
| 153 |
+
This layer is typically batched by performing operations for all positions in parallel, but operating on one chunk at a time can reduce memory. The reverse computation in (8) and the backward pass are also chunked. In addition to the feed-forward layers, for models with large vocabulary (more than $d _ { m o d e l }$ word types) we also chunk the log-probabilities at the output and calculate the loss for sections of the sequence at a time.
|
| 154 |
+
|
| 155 |
+
Chunking, large batches and parameter reuse. With chunking and reversible layers the memory we use for activations in the whole network is independent of the number of layers. The same is not true for parameters though as their number grows with the number of layers. This problem is remedied though because we can swap layer parameters to and from CPU memory when this layer is not computing. In a standard Transformer this would be inefficient because memory transfer to CPU is slow. The batch size multiplied by length in Reformer is much larger though and therefore the amount of compute done with the parameters amortizes the cost of their transfer.
|
| 156 |
+
|
| 157 |
+
Table 3: Memory and time complexity of Transformer variants. We write $d _ { m o d e l }$ and $d _ { f f }$ for model depth and assume $d _ { f f } \geq d _ { m o d e l }$ ; $b$ stands for batch size, $l$ for length, $n _ { l }$ for the number of layers. We assume $n _ { c } = l / 3 2$ so $4 l / n _ { c } = 1 2 8$ and we write $c = 1 2 8 ^ { 2 }$ .
|
| 158 |
+
|
| 159 |
+
<table><tr><td>Model Type</td><td>Memory Complexity</td><td>Time Complexity</td></tr><tr><td>Transformer</td><td>max(bldff,bnnl²)nt</td><td>(bldff+bnnl²)nt</td></tr><tr><td>Reversible Transformer</td><td>max(bldff,bnhl²)</td><td>(bnhldff+bnnl2)nl</td></tr><tr><td>Chunked Reversible Transformer</td><td>max(bldmodet, bnnl2)</td><td>(bnnldff+bnnl²)nl</td></tr><tr><td>LSHTransformer</td><td>max(bldff,bnnlnrc)ni</td><td>(bldff+bnhnrlc)ni</td></tr><tr><td>Reformer</td><td>max(bldmodel,bnhlnrc)</td><td>(bldff+bnhnrlc)ni</td></tr></table>
|
| 160 |
+
|
| 161 |
+
# 4 RELATED WORK
|
| 162 |
+
|
| 163 |
+
The Transformer model introduced in (Vaswani et al., 2017) has been used widely in natural language tasks and further extended to model diverse data such as music scores (Huang et al., 2018), and images (Parmar et al., 2018; Ramachandran et al., 2019). Most notably, this model class has been applied successfully in the self-supervised training of extremely large language models (Devlin et al., 2018; Radford et al., 2019).
|
| 164 |
+
|
| 165 |
+
Given the enormous computational requirements of state of the art sequence models, there has been increasing interest in finding methods to reduce the memory footprint and computational requirements of Transformer models. In addition to standard methods such as precision reduction and gradient checkpointing (Sohoni et al., 2019), more efficient versions of the Transformer model’s self-attention mechanism (Sukhbaatar et al., 2019a;b) have also recently been explored.
|
| 166 |
+
|
| 167 |
+
In particular, leveraging sparsity in the attention layers has proved fruitful. OpenAI introduced the sparse Transformer (Child et al., 2019) which exploits a factorized sparse representation of attention. Using product-key attention to increase the key space has also been used to reduce memory requirements in the feed-forward layers with no loss in performance (Lample et al., 2019).
|
| 168 |
+
|
| 169 |
+
Locality-sensitive hashing (LSH) has, to our knowledge, not been directly applied to Transformer attention layers before. But previous work using external memory with neural networks has dealt with memories of large sizes. The original implementation of memory networks (Weston et al., 2014) and later work on scaling it (Bordes et al., 2015; Chandar et al., 2016) used memory with size in the millions. The cost of doing so is that the memory must be fixed prior to training. Moreover, since during the beginning of training the model is unlikely to query the memory correctly, strong supervision is used to encourage the model to query memory locations that are useful. These hints are either given as additional supervising information by the task or determined heuristically as in Hill et al. (2015). The requirement that the memory be fixed before has been removed in Santoro et al. (2016) at the cost of memory size and later alleviated by Rae et al. (2016). The last paper considered memory lookups with approximate nearest neighbors including both LSH and random kd-trees, but only for lookups in external memory.
|
| 170 |
+
|
| 171 |
+
# 5 EXPERIMENTS
|
| 172 |
+
|
| 173 |
+
In this section we present experimental results demonstrating the techniques described above. We analyze the techniques one-by-one to make clear which combinations have impact on performance. We start by showing that reversible layers and shared query-key spaces do not impact performance, then proceed to analyze hashing attention and finally the full Reformer model.
|
| 174 |
+
|
| 175 |
+
We ran our experiments on the imagenet64 and enwik8-64K tasks, where the latter is a variant of enwik8 that is chunked into subsequences of $2 ^ { 1 6 } \ : = \ : 6 4 K$ tokens. We use 3-layer models for our ablations so as to make it tractable to compare with the regular Transformer, which has high memory usage and performs full $O ( l ^ { 2 } )$ attention. All experiments have $d _ { m o d e l } = 1 0 2 4$ , $d _ { f f } = 4 0 9 6$ , $n _ { h e a d s } ~ = ~ 8$ , and a total batch size of 8 sequences. We used the Adafactor optimizer (Shazeer & Stern, 2018) for training these models. We also evaluate on the WMT 2014 English-to-German translation task, following the hyperparameters of Vaswani et al. (2017). Training for all experiments was parallelized across 8 devices (8 GPUs or 8 TPU v3 cores). Code for training our models is made publicly available.2
|
| 176 |
+
|
| 177 |
+

|
| 178 |
+
Figure 3: Effect of shared query-key space (left) and reversibility (right) on performance on enwik8 and imagenet64 training. The curves show bits per dim on held-out data.
|
| 179 |
+
|
| 180 |
+
Table 4: BLEU scores on newstest2014 for WMT English-German (En–De). We additionally report detokenized BLEU scores as computed by sacreBLEU (Post, 2018).
|
| 181 |
+
|
| 182 |
+
<table><tr><td rowspan="2">Model</td><td colspan="3">sacreBLEU</td></tr><tr><td>BLEU</td><td>Uncased3</td><td>Cased4</td></tr><tr><td>Vaswani etal. (2017),base model</td><td>27.3</td><td></td><td></td></tr><tr><td>Vaswani et al. (2017), big</td><td>28.4</td><td></td><td></td></tr><tr><td>Ott et al. (2018), big</td><td>29.3</td><td></td><td></td></tr><tr><td>Reversible Transformer (base,10oK steps)</td><td>27.6</td><td>27.4</td><td>26.9</td></tr><tr><td>Reversible Transformer (base,5OoK steps,no weight sharing)</td><td>28.0</td><td>27.9</td><td>27.4</td></tr><tr><td>Reversible Transformer (big,3OOK steps,no weight sharing)</td><td>29.1</td><td>28.9</td><td>28.4</td></tr></table>
|
| 183 |
+
|
| 184 |
+
Effect of sharing QK. We first consider the effect of shared-QK attention on a regular Transformer model. Shared-QK attention sets $\begin{array} { r } { k _ { j } ~ = ~ \frac { q _ { j } } { \parallel q _ { j } \parallel } } \end{array}$ and prevents tokens from attending to themselves (except when no other context is available). In the left part of Figure 3, we plot perplexity curves for both regular and shared-QK attention. A shared query-key space does not perform worse than regular attention; in fact, for enwik8 it appears to train slightly faster. In other words, we are not sacrificing accuracy by switching to shared-QK attention.
|
| 185 |
+
|
| 186 |
+
Effect of reversible layers. In the two plots on the right in Figure 3, we compare a regular Transformer per Vaswani et al. (2017) with the reversible one describe in Section 3. The two models have identical parameter counts, and the learning curves likewise appear to be nearly the same. These results show that the memory savings in the reversible Transformer do not come at the expense of accuracy.
|
| 187 |
+
|
| 188 |
+
Reversible layers in machine translation. We also evaluate reversible layers in the context of an encoder-decoder Transformer model for machine translation from English to German. We start by making both the encoder and the decoder fully reversible in the Transformer-base architecture, and see that the resulting model performs comparably to Vaswani et al. (2017) when trained for 100K steps. We also evaluate training for a greater number of steps and with a larger model. Reformer models are very memory-efficient, so for the latter two experiments we do not need to save memory by sharing embedding and output projection weight matrices throughout the model. Results are shown in Table 4. We do not apply LSH attention in this setting because examples are single sentences, and sentences tend to be relatively short. Our typical LSH attention configuration uses chunks of 128 tokens after hashing and sorting, whereas the examples in the WMT14 test set are all shorter than 128 tokens.
|
| 189 |
+
|
| 190 |
+

|
| 191 |
+
Figure 4: LSH attention performance as a function of hashing rounds on imagenet64.
|
| 192 |
+
|
| 193 |
+

|
| 194 |
+
Figure 5: Left: LSH attention performance as a function of number of layers on enwik8. Right: Speed of attention evaluation as a function of input length for full- and LSH- attention.
|
| 195 |
+
|
| 196 |
+
LSH attention in Transformer. LSH attention is an approximation for full attention that, as evidenced in Figure 4, becomes more accurate as the number of hashes increases. At $n _ { r o u n d s } = 8$ , it already almost matches full attention. The computational cost of a model grows with the number of hashes, so this hyperparameter can be adjusted depending on the available compute budget. Additionally, as in Table 2, the number of hashes can be increased at evaluation time to produce more accurate results. On the right half of Figure 5, we plot the speed of different attention types vs. the sequence length, while holding the total number of tokens fixed. We see that while regular attention becomes slower at longer sequence length, LSH attention speed remains flat.
|
| 197 |
+
|
| 198 |
+
Large Reformer models. To verify that the Reformer can indeed fit large models on a single core and train fast on long sequences, we train up to 20-layer big Reformers on enwik8 and imagenet64. As can be seen in Figure 5, these models fit into memory and train. We were not able to train Transformer baselines in this case as they are too slow and memory-hungry, but we see clear improvement with the number of layers. A 12-layer model on enwik8 trained for 20K steps with a dropout rate of 0.1 achieves 1.19 bits/dim on the test set. We also trained a 12-layer Reformer model for longer with further tuning and improvements and we reached 1.05 bits/dim on the enwiki8 test set.
|
| 199 |
+
|
| 200 |
+
# 6 CONCLUSION
|
| 201 |
+
|
| 202 |
+
Reformer combines the modeling capacity of a Transformer with an architecture that can be executed efficiently on long sequences and with small memory use even for models with a large number of layers. We believe that this will help large, richly-parameterized Transformer models become more widespread and accessible. Also, the ability to handle long sequences opens the way for the use of the Reformer on many generative tasks. In addition to generating very long coherent text, the Reformer can bring the power of Transformer models to other domains like time-series forecasting, music, image and video generation.
|
| 203 |
+
|
| 204 |
+
# REFERENCES
|
| 205 |
+
|
| 206 |
+
Rami Al-Rfou, Dokook Choe, Noah Constant, Mandy Guo, and Llion Jones. Character-level language modeling with deeper self-attention. CoRR, abs/1808.04444, 2018. URL http: //arxiv.org/abs/1808.04444.
|
| 207 |
+
Alexandr Andoni, Piotr Indyk, Thijs Laarhoven, Ilya P. Razenshteyn, and Ludwig Schmidt. Practical and optimal LSH for angular distance. CoRR, abs/1509.02897, 2015. URL http://arxiv. org/abs/1509.02897.
|
| 208 |
+
Jimmy Lei Ba, Jamie Ryan Kiros, and Geoffrey E Hinton. Layer normalization. arXiv preprint arXiv:1607.06450, 2016. URL http://arxiv.org/abs/1607.06450.
|
| 209 |
+
Antoine Bordes, Nicolas Usunier, Sumit Chopra, and Jason Weston. Large-scale simple question answering with memory networks. CoRR, abs/1506.02075, 2015. URL http://arxiv.org/ abs/1506.02075.
|
| 210 |
+
Sarath Chandar, Sungjin Ahn, Hugo Larochelle, Pascal Vincent, Gerald Tesauro, and Yoshua Bengio. Hierarchical memory networks. arXiv preprint arXiv:1605.07427, 2016.
|
| 211 |
+
Rewon Child, Scott Gray, Alec Radford, and Ilya Sutskever. Generating long sequences with sparse transformers. URL https://openai.com/blog/sparse-transformers, 2019.
|
| 212 |
+
Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. BERT: pre-training of deep bidirectional transformers for language understanding. CoRR, abs/1810.04805, 2018. URL http://arxiv.org/abs/1810.04805.
|
| 213 |
+
Aidan N Gomez, Mengye Ren, Raquel Urtasun, and Roger B Grosse. The reversible residual network: Backpropagation without storing activations. In Advances in neural information processing systems, pp. 2214–2224, 2017.
|
| 214 |
+
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. URL http://arxiv.org/abs/1511.02301.
|
| 215 |
+
Cheng-Zhi Anna Huang, Ashish Vaswani, Jakob Uszkoreit, Noam Shazeer, Curtis Hawthorne, Andrew M Dai, Matthew D Hoffman, and Douglas Eck. Music transformer: Generating music with long-term structure. arXiv preprint arXiv:1809.04281, 2018.
|
| 216 |
+
Guillaume Lample, Alexandre Sablayrolles, Marc’Aurelio Ranzato, Ludovic Denoyer, and Herve´ Jegou. Large memory layers with product keys. ´ CoRR, abs/1907.05242, 2019. URL http: //arxiv.org/abs/1907.05242.
|
| 217 |
+
Peter J. Liu, Mohammad Saleh, Etienne Pot, Ben Goodrich, Ryan Sepassi, Lukasz Kaiser, and Noam Shazeer. Generating wikipedia by summarizing long sequences. CoRR, abs/1801.10198, 2018. URL http://arxiv.org/abs/1801.10198.
|
| 218 |
+
Myle Ott, Sergey Edunov, David Grangier, and Michael Auli. Scaling neural machine translation. In Proceedings of the Third Conference on Machine Translation: Research Papers, pp. 1–9, Brussels, Belgium, October 2018. Association for Computational Linguistics. doi: 10.18653/v1/W18-6301. URL https://www.aclweb.org/anthology/W18-6301.
|
| 219 |
+
|
| 220 |
+
Niki Parmar, Ashish Vaswani, Jakob Uszkoreit, Lukasz Kaiser, Noam Shazeer, and Alexander Ku. Image transformer. CoRR, abs/1802.05751, 2018. URL http://arxiv.org/abs/1802. 05751.
|
| 221 |
+
|
| 222 |
+
Matt Post. A call for clarity in reporting BLEU scores. In Proceedings of the Third Conference on Machine Translation: Research Papers, pp. 186–191, Belgium, Brussels, October 2018. Association for Computational Linguistics. URL https://www.aclweb.org/anthology/ W18-6319.
|
| 223 |
+
|
| 224 |
+
Alec Radford, Jeff Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. Language models are unsupervised multitask learners. 2019.
|
| 225 |
+
|
| 226 |
+
Jack W Rae, Jonathan J Hunt, Tim Harley, Ivo Danihelka, Andrew Senior, Greg Wayne, Alex Graves, and Timothy P Lillicrap. Scaling memory-augmented neural networks with sparse reads and writes. In Advances in Neural Information Processing Systems, (NIPS), 2016.
|
| 227 |
+
|
| 228 |
+
Prajit Ramachandran, Niki Parmar, Ashish Vaswani, Irwan Bello, Anselm Levskaya, and Jonathon Shlens. Stand-alone self-attention in vision models. CoRR, abs/1906.05909, 2019. URL http: //arxiv.org/abs/1906.05909.
|
| 229 |
+
|
| 230 |
+
Adam Santoro, Sergey Bartunov, Matthew Botvinick, Daan Wierstra, and Timothy P. Lillicrap. Oneshot learning with memory-augmented neural networks. CoRR, abs/1605.06065, 2016. URL http://arxiv.org/abs/1605.06065.
|
| 231 |
+
|
| 232 |
+
Noam Shazeer and Mitchell Stern. Adafactor: Adaptive learning rates with sublinear memory cost. CoRR, abs/1804.04235, 2018. URL http://arxiv.org/abs/1804.04235.
|
| 233 |
+
|
| 234 |
+
Noam Shazeer, Youlong Cheng, Niki Parmar, Dustin Tran, Ashish Vaswani, Penporn Koanantakool, Peter Hawkins, HyoukJoong Lee, Mingsheng Hong, Cliff Young, Ryan Sepassi, and Blake Hechtman. Mesh-tensorflow: Deep learning for supercomputers. CoRR, abs/1811.02084, 2018. URL http://arxiv.org/abs/1811.02084.
|
| 235 |
+
|
| 236 |
+
Nimit Sharad Sohoni, Christopher Richard Aberger, Megan Leszczynski, Jian Zhang, and Christopher Re. Low-memory neural network training: A technical report. ´ CoRR, abs/1904.10631, 2019. URL http://arxiv.org/abs/1904.10631.
|
| 237 |
+
|
| 238 |
+
Sainbayar Sukhbaatar, Edouard Grave, Piotr Bojanowski, and Armand Joulin. Adaptive attention span in transformers. CoRR, abs/1905.07799, 2019a. URL http://arxiv.org/abs/ 1905.07799.
|
| 239 |
+
|
| 240 |
+
Sainbayar Sukhbaatar, Edouard Grave, Guillaume Lample, Herve J ´ egou, and Armand Joulin. Aug- ´ menting self-attention with persistent memory. CoRR, abs/1907.01470, 2019b. URL http: //arxiv.org/abs/1907.01470.
|
| 241 |
+
|
| 242 |
+
Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention is all you need. CoRR, 2017. URL http: //arxiv.org/abs/1706.03762.
|
| 243 |
+
|
| 244 |
+
Jason Weston, Sumit Chopra, and Antoine Bordes. Memory networks. CoRR, abs/1410.3916, 2014. URL http://arxiv.org/abs/1410.3916.
|
| 245 |
+
|
| 246 |
+
# A MULTI-ROUND LSH ATTENTION
|
| 247 |
+
|
| 248 |
+
In this section we describe in more detail the multi-hash version of our LSH attention mechanism. We first repeat Equation (3) from the main text, which describes a general formulation of attention with sparsity:
|
| 249 |
+
|
| 250 |
+
$$
|
| 251 |
+
o _ { i } = \sum _ { j \in \widetilde { \mathcal { P } } _ { i } } \exp \left( q _ { i } \cdot k _ { j } - m ( j , \mathcal { P } _ { i } ) - z ( i , \mathcal { P } _ { i } ) \right) v _ { j } \quad \mathrm { ~ w h e r e ~ } m ( j , \mathcal { P } _ { i } ) = \left\{ \begin{array} { l l } { \infty } & { \mathrm { i f ~ } j \notin \mathcal { P } _ { i } } \\ { 0 } & { \mathrm { o t h e r w i s e } } \end{array} \right.
|
| 252 |
+
$$
|
| 253 |
+
|
| 254 |
+
In the multi-round case, a query position $i$ can attend to key positions $\mathcal { P } _ { i }$ as defined in (6), which we also repeat here:
|
| 255 |
+
|
| 256 |
+
$$
|
| 257 |
+
{ \mathcal P } _ { i } = \bigcup _ { r = 1 } ^ { n _ { r o u n d s } } { \mathcal P } _ { i } ^ { ( r ) } \qquad \mathrm { w h e r e } ~ { \mathcal P } _ { i } ^ { ( r ) } = \Big \{ j : h ^ { ( r ) } ( q _ { i } ) = h ^ { ( r ) } ( q _ { j } ) \Big \}
|
| 258 |
+
$$
|
| 259 |
+
|
| 260 |
+
For batching purposes, attention is performed on chunks of sorted queries/keys:
|
| 261 |
+
|
| 262 |
+
$$
|
| 263 |
+
\widetilde { \mathcal { P } } _ { i } ^ { ( r ) } = \left\{ j : \left\lfloor \frac { s _ { i } ^ { ( r ) } } { m } \right\rfloor - 1 \leq \left\lfloor \frac { s _ { j } ^ { ( r ) } } { m } \right\rfloor \leq \left\lfloor \frac { s _ { i } ^ { ( r ) } } { m } \right\rfloor \right\}
|
| 264 |
+
$$
|
| 265 |
+
|
| 266 |
+
Combining (3) and (6) gives:
|
| 267 |
+
|
| 268 |
+
$$
|
| 269 |
+
\begin{array} { r l r } { { \alpha _ { i } = \sum _ { j \in \Gamma } \exp ( q _ { i } \cdot k _ { j } - m ( j , \mathcal { P } _ { i } ) - z ( i , \mathcal { P } _ { j } ) ) \times } } \\ & { } & { \beta _ { i } \leq \frac { 1 } { \beta \epsilon _ { i } ^ { p ( \cdot ) } } , } \\ & { } & { \gamma = \sum _ { s = 1 } ^ { N _ { t } } \exp ( z ( i , \mathcal { P } _ { i } ^ { ( r ) } ) - z ( i , \mathcal { P } _ { j } ) ) \sum _ { j \in \Gamma } \frac { 1 } { N _ { t } } \frac { 1 } { N _ { t } } \exp ( q _ { i } \cdot k _ { i } - m ( j , \mathcal { P } _ { i } ^ { ( r ) } ) - z ( i , \mathcal { P } _ { j } ^ { ( r ) } ) ) \times } \\ & { } & { \exp ( z ( i , \mathcal { P } _ { i } ^ { ( r ) } ) - z ( i , \mathcal { P } _ { j } ^ { ( r ) } ) ) , } \\ & { } & { ( 1 3 , \exp ( z ( i , \mathcal { P } _ { i } ^ { ( r ) } ) - z ( i , \mathcal { P } _ { j } ) ) \alpha _ { i } ^ { ( r ) } } \\ & { } & { \exp ( z ( i , \mathcal { P } _ { i } ^ { ( r ) } ) - z ( i , \mathcal { P } _ { j } ^ { ( r ) } ) ) \exp ( z ( i , \mathcal { P } _ { i } ^ { ( r ) } ) ) \exp ( \mathrm { ~ \it 1 4 ~ } } \\ & { } & { \exp ( \phi ( i , k _ { j } - m ( i _ { j } ^ { ( r ) } ) - z ( i , \mathcal { P } _ { j } ^ { ( r ) } ) ) ) \exp _ { j } } \\ & { } & { \beta _ { i } \leq \mathrm { \it ~ \it ~ \it ~ \alpha ~ } _ { j } \leq \mathrm { \it ~ \it ~ \alpha ~ } _ { i } \leq \mathrm { \it ~ \it ~ \alpha ~ } _ { j } } \\ & { } & \exp ( N _ { t } \exp N _ { i , j } + | \{ \begin{array} { l l } { \Gamma _ { j } ^ { ( r ) } \cdot \xi _ { j } \in \mathcal { P } _ { j } ^ { ( r ) } } \\ { \Gamma _ { j } ^ { ( r ) } \cdot \xi _ { j } \in \mathcal { P } _ { j } ^ { ( r ) } } \end{array} \} \mathrm { ~ a n d ~ } m _ { i j } ^ ( \end{array}
|
| 270 |
+
$$
|
| 271 |
+
|
| 272 |
+
Each round of LSH attention produces a vector $o _ { i } ^ { ( r ) }$ that can be computed independently from other rounds, except for the inclusion of a term $N _ { i , j }$ to avoid double-counting elements when constructing the union of $\mathcal { P } _ { i } ^ { ( r ) }$ sets. In our implementation we fold the $N _ { i , j }$ factor into the masking term $m _ { i , j } ^ { ( r ) }$ .
|
| 273 |
+
|
| 274 |
+
We also modify $m _ { i , j _ { . } } ^ { ( r ) }$ to introduce a special case for $i = j$ . This case is added because causal masking in a standard Transformer allows position to attend to itself, which is not desirable in a shared-QK formulation. We set the mask to a large but finite value to disallow attention-in-place, except in the situation where a token has no other valid attention targets. For example, the first token in a sequence attends only to itself, because no prior context is available.
|
parse/train/rkgNKkHtvB/rkgNKkHtvB_content_list.json
ADDED
|
@@ -0,0 +1,1316 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
| 3 |
+
"type": "text",
|
| 4 |
+
"text": "REFORMER: THE EFFICIENT TRANSFORMER ",
|
| 5 |
+
"text_level": 1,
|
| 6 |
+
"bbox": [
|
| 7 |
+
173,
|
| 8 |
+
98,
|
| 9 |
+
705,
|
| 10 |
+
121
|
| 11 |
+
],
|
| 12 |
+
"page_idx": 0
|
| 13 |
+
},
|
| 14 |
+
{
|
| 15 |
+
"type": "text",
|
| 16 |
+
"text": "Nikita Kitaev∗ U.C. Berkeley & Google Research kitaev@cs.berkeley.edu ",
|
| 17 |
+
"bbox": [
|
| 18 |
+
183,
|
| 19 |
+
145,
|
| 20 |
+
413,
|
| 21 |
+
186
|
| 22 |
+
],
|
| 23 |
+
"page_idx": 0
|
| 24 |
+
},
|
| 25 |
+
{
|
| 26 |
+
"type": "text",
|
| 27 |
+
"text": "Łukasz Kaiser∗ Anselm Levskaya Google Research Google Research {lukaszkaiser,levskaya}@google.com ",
|
| 28 |
+
"bbox": [
|
| 29 |
+
437,
|
| 30 |
+
145,
|
| 31 |
+
803,
|
| 32 |
+
188
|
| 33 |
+
],
|
| 34 |
+
"page_idx": 0
|
| 35 |
+
},
|
| 36 |
+
{
|
| 37 |
+
"type": "text",
|
| 38 |
+
"text": "ABSTRACT ",
|
| 39 |
+
"text_level": 1,
|
| 40 |
+
"bbox": [
|
| 41 |
+
454,
|
| 42 |
+
223,
|
| 43 |
+
544,
|
| 44 |
+
238
|
| 45 |
+
],
|
| 46 |
+
"page_idx": 0
|
| 47 |
+
},
|
| 48 |
+
{
|
| 49 |
+
"type": "text",
|
| 50 |
+
"text": "Large Transformer models routinely achieve state-of-the-art results on a number of tasks but training these models can be prohibitively costly, especially on long sequences. We introduce two techniques to improve the efficiency of Transformers. For one, we replace dot-product attention by one that uses locality-sensitive hashing, changing its complexity from $\\mathrm { O } ( L ^ { 2 } )$ to $\\mathrm { O } ( L \\log L )$ , where $L$ is the length of the sequence. Furthermore, we use reversible residual layers instead of the standard residuals, which allows storing activations only once in the training process instead of $N$ times, where $N$ is the number of layers. The resulting model, the Reformer, performs on par with Transformer models while being much more memory-efficient and much faster on long sequences. ",
|
| 51 |
+
"bbox": [
|
| 52 |
+
233,
|
| 53 |
+
256,
|
| 54 |
+
764,
|
| 55 |
+
395
|
| 56 |
+
],
|
| 57 |
+
"page_idx": 0
|
| 58 |
+
},
|
| 59 |
+
{
|
| 60 |
+
"type": "text",
|
| 61 |
+
"text": "1 INTRODUCTION ",
|
| 62 |
+
"text_level": 1,
|
| 63 |
+
"bbox": [
|
| 64 |
+
176,
|
| 65 |
+
424,
|
| 66 |
+
334,
|
| 67 |
+
439
|
| 68 |
+
],
|
| 69 |
+
"page_idx": 0
|
| 70 |
+
},
|
| 71 |
+
{
|
| 72 |
+
"type": "text",
|
| 73 |
+
"text": "The Transformer architecture (Vaswani et al., 2017) is widely used in natural language processing and yields state-of-the-art results on a number of tasks. To obtain these results, researchers have resorted to training ever larger Transformer models. The number of parameters exceeds 0.5B per layer in the largest configuration reported in (Shazeer et al., 2018) while the number of layers goes up to 64 in (Al-Rfou et al., 2018). Transformer models are also used on increasingly long sequences. Up to 11 thousand tokens of text in a single example were processed in (Liu et al., 2018) and when processing other modalities, like music (Huang et al., 2018) and images (Parmar et al., 2018), even longer sequences are commonplace. These large-scale long-sequence models yield great results but strain resources to the point where some argue that this trend is breaking NLP research1. Many large Transformer models can only realistically be trained in large industrial research laboratories and such models trained with model parallelism cannot even be fine-tuned on a single GPU as their memory requirements demand a multi-accelerator hardware setup even for a single training step. ",
|
| 74 |
+
"bbox": [
|
| 75 |
+
174,
|
| 76 |
+
457,
|
| 77 |
+
825,
|
| 78 |
+
622
|
| 79 |
+
],
|
| 80 |
+
"page_idx": 0
|
| 81 |
+
},
|
| 82 |
+
{
|
| 83 |
+
"type": "text",
|
| 84 |
+
"text": "Do large Transformer models fundamentally require such huge resources or are they simply inefficient? Consider the following calculation: the 0.5B parameters used in the largest reported Transformer layer account for 2GB of memory. Activations for 64K tokens with embedding size 1024 and batch size 8 account for $6 4 \\mathrm { K } \\times 1 \\mathrm { K } \\times 8 = 0 . 5 \\mathrm { B }$ floats, requiring another 2GB of memory. If our memory use was only per-layer, then we should fairly easily fit a large Transformer even on sequences of length 64K on a single accelerator. Further, the whole corpus used to train BERT only requires 17GB to store. Why is it then that we cannot even fine-tune these models on single machines? ",
|
| 85 |
+
"bbox": [
|
| 86 |
+
173,
|
| 87 |
+
630,
|
| 88 |
+
825,
|
| 89 |
+
741
|
| 90 |
+
],
|
| 91 |
+
"page_idx": 0
|
| 92 |
+
},
|
| 93 |
+
{
|
| 94 |
+
"type": "text",
|
| 95 |
+
"text": "The above estimate includes only per-layer memory and input activations cost and does not take into account the following major sources of memory use in the Transformer. ",
|
| 96 |
+
"bbox": [
|
| 97 |
+
174,
|
| 98 |
+
748,
|
| 99 |
+
823,
|
| 100 |
+
776
|
| 101 |
+
],
|
| 102 |
+
"page_idx": 0
|
| 103 |
+
},
|
| 104 |
+
{
|
| 105 |
+
"type": "text",
|
| 106 |
+
"text": "• Memory in a model with $N$ layers is $N$ -times larger than in a single-layer model due to the fact that activations need to be stored for back-propagation. • Since the depth $d _ { f f }$ of intermediate feed-forward layers is often much larger than the depth $d _ { m o d e l }$ of attention activations, it accounts for a large fraction of memory use. • Attention on sequences of length $L$ is $\\mathrm { O } ( L ^ { 2 } )$ in both computational and memory complexity, so even for a single sequence of 64K tokens can exhaust accelerator memory. ",
|
| 107 |
+
"bbox": [
|
| 108 |
+
215,
|
| 109 |
+
789,
|
| 110 |
+
826,
|
| 111 |
+
886
|
| 112 |
+
],
|
| 113 |
+
"page_idx": 0
|
| 114 |
+
},
|
| 115 |
+
{
|
| 116 |
+
"type": "text",
|
| 117 |
+
"text": "We introduce the Reformer model which solves these problems using the following techniques: ",
|
| 118 |
+
"bbox": [
|
| 119 |
+
173,
|
| 120 |
+
103,
|
| 121 |
+
797,
|
| 122 |
+
118
|
| 123 |
+
],
|
| 124 |
+
"page_idx": 1
|
| 125 |
+
},
|
| 126 |
+
{
|
| 127 |
+
"type": "text",
|
| 128 |
+
"text": "• Reversible layers, first introduced in Gomez et al. (2017), enable storing only a single copy of activations in the whole model, so the $N$ factor disappears. \n• Splitting activations inside feed-forward layers and processing them in chunks removes the $d _ { f f }$ factor and saves memory inside feed-forward layers. \n• Approximate attention computation based on locality-sensitive hashing replaces the $\\mathrm { O } ( L ^ { 2 } )$ factor in attention layers with $\\mathrm { O } ( L \\log L )$ and so allows operating on long sequences. ",
|
| 129 |
+
"bbox": [
|
| 130 |
+
215,
|
| 131 |
+
130,
|
| 132 |
+
825,
|
| 133 |
+
227
|
| 134 |
+
],
|
| 135 |
+
"page_idx": 1
|
| 136 |
+
},
|
| 137 |
+
{
|
| 138 |
+
"type": "text",
|
| 139 |
+
"text": "We study these techniques and show that they have negligible impact on the training process compared to the standard Transformer. Splitting activations in fact only affects the implementation; it is numerically identical to the layers used in the Transformer. Applying reversible residuals instead of the standard ones does change the model but has a negligible effect on training in all configurations we experimented with. Finally, locality-sensitive hashing in attention is a more major change that can influence the training dynamics, depending on the number of concurrent hashes used. We study this parameter and find a value which is both efficient to use and yields results very close to full attention. ",
|
| 140 |
+
"bbox": [
|
| 141 |
+
173,
|
| 142 |
+
238,
|
| 143 |
+
825,
|
| 144 |
+
349
|
| 145 |
+
],
|
| 146 |
+
"page_idx": 1
|
| 147 |
+
},
|
| 148 |
+
{
|
| 149 |
+
"type": "text",
|
| 150 |
+
"text": "We experiment on a synthetic task, a text task (enwik8) with sequences of length 64K and an image generation task (imagenet-64 generation) with sequences of length 12K. In both cases we show that Reformer matches the results obtained with full Transformer but runs much faster, especially on the text task, and with orders of magnitude better memory efficiency. ",
|
| 151 |
+
"bbox": [
|
| 152 |
+
174,
|
| 153 |
+
356,
|
| 154 |
+
825,
|
| 155 |
+
412
|
| 156 |
+
],
|
| 157 |
+
"page_idx": 1
|
| 158 |
+
},
|
| 159 |
+
{
|
| 160 |
+
"type": "text",
|
| 161 |
+
"text": "2 LOCALITY-SENSITIVE HASHING ATTENTION ",
|
| 162 |
+
"text_level": 1,
|
| 163 |
+
"bbox": [
|
| 164 |
+
174,
|
| 165 |
+
433,
|
| 166 |
+
576,
|
| 167 |
+
449
|
| 168 |
+
],
|
| 169 |
+
"page_idx": 1
|
| 170 |
+
},
|
| 171 |
+
{
|
| 172 |
+
"type": "text",
|
| 173 |
+
"text": "Dot-product attention. The standard attention used in the Transformer is the scaled dot-product attention (Vaswani et al., 2017). The input consists of queries and keys of dimension $d _ { k }$ , and values√ of dimension $d _ { v }$ . The dot products of the query with all keys are computed, scaled by $\\sqrt { d _ { k } }$ , and a softmax function is applied to obtain the weights on the values. In practice, the attention function on a set of queries is computed simultaneously, packed together into a matrix $Q$ . Assuming the keys and values are also packed together into matrices $K$ and $V$ , the matrix of outputs is defined as: ",
|
| 174 |
+
"bbox": [
|
| 175 |
+
173,
|
| 176 |
+
464,
|
| 177 |
+
825,
|
| 178 |
+
547
|
| 179 |
+
],
|
| 180 |
+
"page_idx": 1
|
| 181 |
+
},
|
| 182 |
+
{
|
| 183 |
+
"type": "equation",
|
| 184 |
+
"img_path": "images/9cb6853b84289d7f7cb3fce665cdc585ea953917672cf535fb92129ff9824f8e.jpg",
|
| 185 |
+
"text": "$$\n\\mathrm { A t t e n t i o n } ( Q , K , V ) = \\mathrm { s o f t m a x } ( \\frac { Q K ^ { T } } { \\sqrt { d _ { k } } } ) V\n$$",
|
| 186 |
+
"text_format": "latex",
|
| 187 |
+
"bbox": [
|
| 188 |
+
356,
|
| 189 |
+
565,
|
| 190 |
+
642,
|
| 191 |
+
601
|
| 192 |
+
],
|
| 193 |
+
"page_idx": 1
|
| 194 |
+
},
|
| 195 |
+
{
|
| 196 |
+
"type": "text",
|
| 197 |
+
"text": "Multi-head attention. In the Transformer, instead of performing a single attention function with $d _ { m o d e l }$ -dimensional keys, values and queries, one linearly projects the queries, keys and values $h$ times with different, learned linear projections to $d _ { k } , d _ { k }$ and $d _ { v }$ dimensions, respectively. Attention is applied to each of these projected versions of queries, keys and values in parallel, yielding $d _ { v }$ - dimensional output values. These are concatenated and once again projected, resulting in the final values. This mechanism is known as multi-head attention. ",
|
| 198 |
+
"bbox": [
|
| 199 |
+
174,
|
| 200 |
+
609,
|
| 201 |
+
825,
|
| 202 |
+
694
|
| 203 |
+
],
|
| 204 |
+
"page_idx": 1
|
| 205 |
+
},
|
| 206 |
+
{
|
| 207 |
+
"type": "text",
|
| 208 |
+
"text": "Memory-efficient attention. To calculate the memory use of the attention mechanism, let us focus on the attention computation from Equation 1. Let us assume that Q, K and $\\mathrm { v }$ all have the shape $\\left[ b a t c h \\_ s i z e , l e n g t h , d _ { m o d e l } \\right]$ . The main issue is the term $Q K ^ { T }$ , which has the shape [batch size, length, length]. In the experimental section we train a model on sequences of length $6 4 K$ – in this case, even at batch-size of 1, this is a $6 4 K \\times 6 4 K$ matrix, which in 32-bit floats would take 16GB of memory. This is impractical and has hindered the use of the Transformer for long sequences. But it is important to note that the $Q K ^ { T }$ matrix does not need to be fully materialized in memory. The attention can indeed be computed for each query $q _ { i }$ separately, only calculating $\\mathrm { s o f t m a x } ( \\frac { q _ { i } K ^ { T } } { \\sqrt { d _ { k } } } ) V$ once in memory, and then re-computing it on the backward pass when needed for gradients. This way of computing attention may be less efficient but it only uses memory proportional to length. We use this memory-efficient implementation of attention to run the full-attention baselines presented in the experimental section. ",
|
| 209 |
+
"bbox": [
|
| 210 |
+
174,
|
| 211 |
+
700,
|
| 212 |
+
825,
|
| 213 |
+
875
|
| 214 |
+
],
|
| 215 |
+
"page_idx": 1
|
| 216 |
+
},
|
| 217 |
+
{
|
| 218 |
+
"type": "text",
|
| 219 |
+
"text": "Where do Q, K, V come from? The multi-head attention described above operates on keys, queries and values, but usually we are only given a single tensor of activations A of the shape [batch size, length, $d _ { m o d e l } ]$ – e.g., coming from embedding the tokens in a sentence into vectors. ",
|
| 220 |
+
"bbox": [
|
| 221 |
+
176,
|
| 222 |
+
882,
|
| 223 |
+
823,
|
| 224 |
+
924
|
| 225 |
+
],
|
| 226 |
+
"page_idx": 1
|
| 227 |
+
},
|
| 228 |
+
{
|
| 229 |
+
"type": "image",
|
| 230 |
+
"img_path": "images/933641c2e559997bd69cf9ce03c0b729d65931c290db258544018d21c672f8d7.jpg",
|
| 231 |
+
"image_caption": [
|
| 232 |
+
"Figure 1: An angular locality sensitive hash uses random rotations of spherically projected points to establish buckets by an argmax over signed axes projections. In this highly simplified 2D depiction, two points $x$ and $y$ are unlikely to share the same hash buckets (above) for the three different angular hashes unless their spherical projections are close to one another (below). "
|
| 233 |
+
],
|
| 234 |
+
"image_footnote": [],
|
| 235 |
+
"bbox": [
|
| 236 |
+
236,
|
| 237 |
+
98,
|
| 238 |
+
758,
|
| 239 |
+
272
|
| 240 |
+
],
|
| 241 |
+
"page_idx": 2
|
| 242 |
+
},
|
| 243 |
+
{
|
| 244 |
+
"type": "text",
|
| 245 |
+
"text": "To build Q, K and V from A, the Transformer uses 3 different linear layers projecting A into Q, K and $\\mathrm { v }$ with different parameters. For models with LSH attention, we want queries and keys (Q and K) to be identical. This is easily achieved by using the same linear layer to go from A to Q and K, and a separate one for V. We call a model that behaves like this a shared-QK Transformer. It turns out that sharing QK does not affect the performance of Transformer, even if we additionally normalize the length of the keys K, as we show in the experimental Section 5. ",
|
| 246 |
+
"bbox": [
|
| 247 |
+
173,
|
| 248 |
+
363,
|
| 249 |
+
825,
|
| 250 |
+
449
|
| 251 |
+
],
|
| 252 |
+
"page_idx": 2
|
| 253 |
+
},
|
| 254 |
+
{
|
| 255 |
+
"type": "text",
|
| 256 |
+
"text": "Hashing attention. For the LSH attention, we start with two tensors, $\\mathrm { Q } { = } \\mathrm { K }$ and $\\mathrm { v }$ of the shape [batch size, length, $d _ { m o d e l } ]$ . We keep the multi-head mechanism intact and focus on the attention computation from Equation 1. As already mentioned, the main issue is the term $Q K ^ { T }$ , which has the shape [batch size, length, length]. But note that we are actually only interested in softmax $\\left( Q K ^ { T } \\right)$ . Since softmax is dominated by the largest elements, for each query $q _ { i }$ we only need to focus on the keys in K that are closest to $q _ { i }$ . For example, if K is of length 64K, for each $q _ { i }$ we could only consider a small subset of, say, the 32 or 64 closest keys. That is much more efficient, but how can we find the nearest neighbors among the keys? ",
|
| 257 |
+
"bbox": [
|
| 258 |
+
173,
|
| 259 |
+
455,
|
| 260 |
+
825,
|
| 261 |
+
568
|
| 262 |
+
],
|
| 263 |
+
"page_idx": 2
|
| 264 |
+
},
|
| 265 |
+
{
|
| 266 |
+
"type": "text",
|
| 267 |
+
"text": "Locality sensitive hashing. The problem of finding nearest neighbors quickly in high-dimensional spaces can be solved by locality-sensitive hashing (LSH). A hashing scheme that assigns each vector $x$ to a hash $h ( x )$ is called locality-sensitive if nearby vectors get the same hash with high probability and distant ones do not. In our case, we actually only require that nearby vectors get the same hash with high probability and that hash-buckets are of similar size with high probability. ",
|
| 268 |
+
"bbox": [
|
| 269 |
+
174,
|
| 270 |
+
573,
|
| 271 |
+
825,
|
| 272 |
+
643
|
| 273 |
+
],
|
| 274 |
+
"page_idx": 2
|
| 275 |
+
},
|
| 276 |
+
{
|
| 277 |
+
"type": "text",
|
| 278 |
+
"text": "We achieve this by employing random projections as follows (see Figure 1). To get $b$ hashes, we first fix a random matrix $R$ of size $[ d _ { k } , b / 2 ]$ . We then define $h ( x ) = \\arg \\operatorname* { m a x } ( [ x R ; - x R ] )$ where $[ u ; v ]$ denotes the concatenation of two vectors. This method is a known LSH scheme (Andoni et al., 2015) and is easy to implement and apply to batches of vectors. ",
|
| 279 |
+
"bbox": [
|
| 280 |
+
173,
|
| 281 |
+
650,
|
| 282 |
+
825,
|
| 283 |
+
707
|
| 284 |
+
],
|
| 285 |
+
"page_idx": 2
|
| 286 |
+
},
|
| 287 |
+
{
|
| 288 |
+
"type": "text",
|
| 289 |
+
"text": "LSH attention. Knowing our LSH scheme and the general idea of hashing attention, we will now formalize the LSH attention we use in this paper. We first rewrite the equation for normal attention, (1), for a single query position $i$ at a time: ",
|
| 290 |
+
"bbox": [
|
| 291 |
+
173,
|
| 292 |
+
713,
|
| 293 |
+
825,
|
| 294 |
+
756
|
| 295 |
+
],
|
| 296 |
+
"page_idx": 2
|
| 297 |
+
},
|
| 298 |
+
{
|
| 299 |
+
"type": "equation",
|
| 300 |
+
"img_path": "images/525103dc3c8755e5e88c93e6a679f309047d2e85184d38540a79184a8bc54e82.jpg",
|
| 301 |
+
"text": "$$\no _ { i } = \\sum _ { j \\in \\mathcal { P } _ { i } } \\exp \\left( q _ { i } \\cdot k _ { j } - z ( i , \\mathcal { P } _ { i } ) \\right) v _ { j }\n$$",
|
| 302 |
+
"text_format": "latex",
|
| 303 |
+
"bbox": [
|
| 304 |
+
258,
|
| 305 |
+
757,
|
| 306 |
+
496,
|
| 307 |
+
792
|
| 308 |
+
],
|
| 309 |
+
"page_idx": 2
|
| 310 |
+
},
|
| 311 |
+
{
|
| 312 |
+
"type": "text",
|
| 313 |
+
"text": "We introduce the notation $\\mathcal { P } _ { i }$ to represent the set that the query at position $i$ attends to, and $z$ to denote the partition function (i.e. the normalizing term in the softmax). For clarity, we also omit scaling by $\\sqrt { d _ { k } }$ . ",
|
| 314 |
+
"bbox": [
|
| 315 |
+
173,
|
| 316 |
+
801,
|
| 317 |
+
825,
|
| 318 |
+
844
|
| 319 |
+
],
|
| 320 |
+
"page_idx": 2
|
| 321 |
+
},
|
| 322 |
+
{
|
| 323 |
+
"type": "text",
|
| 324 |
+
"text": "For batching purposes we typically perform attention over a larger set $\\widetilde { \\mathcal { P } } _ { i } = \\{ 0 , 1 , \\ldots , l \\} \\supseteq \\mathcal { P } _ { i }$ while masking out elements not in $\\mathcal { P } _ { i }$ : ",
|
| 325 |
+
"bbox": [
|
| 326 |
+
173,
|
| 327 |
+
851,
|
| 328 |
+
823,
|
| 329 |
+
882
|
| 330 |
+
],
|
| 331 |
+
"page_idx": 2
|
| 332 |
+
},
|
| 333 |
+
{
|
| 334 |
+
"type": "equation",
|
| 335 |
+
"img_path": "images/08f4522cdd3c1a8ddd1b481c92ad266a1a369c444b0e7912d6a3419871afbcbf.jpg",
|
| 336 |
+
"text": "$$\no _ { i } = \\sum _ { j \\in \\widetilde { \\mathcal { P } } _ { i } } \\exp \\left( q _ { i } \\cdot k _ { j } - m ( j , \\mathcal { P } _ { i } ) - z ( i , \\mathcal { P } _ { i } ) \\right) v _ { j } \\quad \\mathrm { ~ w h e r e ~ } m ( j , \\mathcal { P } _ { i } ) = \\left\\{ \\begin{array} { l l } { \\infty } & { \\mathrm { i f ~ } j \\notin \\mathcal { P } _ { i } } \\\\ { 0 } & { \\mathrm { o t h e r w i s e } } \\end{array} \\right.\n$$",
|
| 337 |
+
"text_format": "latex",
|
| 338 |
+
"bbox": [
|
| 339 |
+
212,
|
| 340 |
+
885,
|
| 341 |
+
782,
|
| 342 |
+
928
|
| 343 |
+
],
|
| 344 |
+
"page_idx": 2
|
| 345 |
+
},
|
| 346 |
+
{
|
| 347 |
+
"type": "image",
|
| 348 |
+
"img_path": "images/1e04a6a1048a7c4f8520f431a67d94733d4c42885c7030ea46659a056ee2e509.jpg",
|
| 349 |
+
"image_caption": [
|
| 350 |
+
"Figure 2: Simplified depiction of LSH Attention showing the hash-bucketing, sorting, and chunking steps and the resulting causal attentions. (a-d) Attention matrices for these varieties of attention. "
|
| 351 |
+
],
|
| 352 |
+
"image_footnote": [],
|
| 353 |
+
"bbox": [
|
| 354 |
+
207,
|
| 355 |
+
103,
|
| 356 |
+
789,
|
| 357 |
+
287
|
| 358 |
+
],
|
| 359 |
+
"page_idx": 3
|
| 360 |
+
},
|
| 361 |
+
{
|
| 362 |
+
"type": "text",
|
| 363 |
+
"text": "Now we turn to LSH attention, which we can think of in terms of restricting the set $\\mathcal { P } _ { i }$ of target items a query position $i$ can attend to, by only allowing attention within a single hash bucket. ",
|
| 364 |
+
"bbox": [
|
| 365 |
+
176,
|
| 366 |
+
358,
|
| 367 |
+
820,
|
| 368 |
+
387
|
| 369 |
+
],
|
| 370 |
+
"page_idx": 3
|
| 371 |
+
},
|
| 372 |
+
{
|
| 373 |
+
"type": "equation",
|
| 374 |
+
"img_path": "images/132a1fc75b22088573f49deec2ae0e5c573305452abab541a04f5de22a1fc21b.jpg",
|
| 375 |
+
"text": "$$\n\\mathcal { P } _ { i } = \\{ j : h ( q _ { i } ) = h ( k _ { j } ) \\}\n$$",
|
| 376 |
+
"text_format": "latex",
|
| 377 |
+
"bbox": [
|
| 378 |
+
411,
|
| 379 |
+
393,
|
| 380 |
+
586,
|
| 381 |
+
412
|
| 382 |
+
],
|
| 383 |
+
"page_idx": 3
|
| 384 |
+
},
|
| 385 |
+
{
|
| 386 |
+
"type": "text",
|
| 387 |
+
"text": "Figure 2(a-b) shows a schematic comparison of full-attention with a hashed variant. Part (a) depicts that the attention matrix for full attention is typically sparse, but the computation does not take advantage of this sparsity. In (b), the queries and keys have been sorted according to their hash bucket. Since similar items fall in the same bucket with high probability, the full attention pattern can be approximated by only allowing attention within each bucket. ",
|
| 388 |
+
"bbox": [
|
| 389 |
+
173,
|
| 390 |
+
426,
|
| 391 |
+
825,
|
| 392 |
+
497
|
| 393 |
+
],
|
| 394 |
+
"page_idx": 3
|
| 395 |
+
},
|
| 396 |
+
{
|
| 397 |
+
"type": "text",
|
| 398 |
+
"text": "Hash buckets in this formulation tend to be uneven in size, which makes it difficult to batch across buckets. Moreover, the number of queries and the number of keys within a bucket may be unequal – in fact, it is possible for a bucket to contain many queries but no keys. To alleviate these issues, we first ensure that h(kj ) = h(qj ) by setting kj = $\\begin{array} { r } { k _ { j } = \\frac { \\dot { q _ { j } } } { | | q _ { j } | | } } \\end{array}$ . Next, we sort the queries by bucket number and, within each bucket, by sequence position; this defines a permutation where $i \\mapsto s _ { i }$ after sorting. In the sorted attention matrix, pairs from the same bucket will cluster near the diagonal (as depicted in Figure $2 \\mathrm { c }$ ). We can follow a batching approach where chunks of $m$ consecutive queries (after sorting) attend to each other, and one chunk back (Figure 2d). Following our earlier notation, this corresponds to setting: ",
|
| 399 |
+
"bbox": [
|
| 400 |
+
173,
|
| 401 |
+
502,
|
| 402 |
+
825,
|
| 403 |
+
631
|
| 404 |
+
],
|
| 405 |
+
"page_idx": 3
|
| 406 |
+
},
|
| 407 |
+
{
|
| 408 |
+
"type": "equation",
|
| 409 |
+
"img_path": "images/03268e04bb4e5c07fa9dc76659b0067e16a6ca4e5834cbc1fd41b4eeff5c39cb.jpg",
|
| 410 |
+
"text": "$$\n\\widetilde { \\mathcal { P } } _ { i } = \\left\\{ j : \\left\\lfloor { \\frac { s _ { i } } { m } } \\right\\rfloor - 1 \\leq \\left\\lfloor { \\frac { s _ { j } } { m } } \\right\\rfloor \\leq \\left\\lfloor { \\frac { s _ { i } } { m } } \\right\\rfloor \\right\\}\n$$",
|
| 411 |
+
"text_format": "latex",
|
| 412 |
+
"bbox": [
|
| 413 |
+
367,
|
| 414 |
+
630,
|
| 415 |
+
630,
|
| 416 |
+
659
|
| 417 |
+
],
|
| 418 |
+
"page_idx": 3
|
| 419 |
+
},
|
| 420 |
+
{
|
| 421 |
+
"type": "text",
|
| 422 |
+
"text": "If $\\operatorname* { m a x } _ { i } \\left| \\mathcal { P } _ { i } \\right| < m$ , then $\\mathcal { P } _ { i } \\subseteq \\widetilde { \\mathcal { P } } _ { i }$ . In practice we set $\\begin{array} { r } { m = \\frac { 2 l } { n _ { b u c k e t s } } } \\end{array}$ (where $l$ is the sequence length). The average bucket size is $\\frac { l } { n _ { b u c k e t s } }$ , and we assume that the probability of a bucket growing to twice that size is sufficiently low. The overall process of LSH attention is summarized in Figure 2. ",
|
| 423 |
+
"bbox": [
|
| 424 |
+
174,
|
| 425 |
+
662,
|
| 426 |
+
825,
|
| 427 |
+
713
|
| 428 |
+
],
|
| 429 |
+
"page_idx": 3
|
| 430 |
+
},
|
| 431 |
+
{
|
| 432 |
+
"type": "text",
|
| 433 |
+
"text": "Multi-round LSH attention. With hashing, there is always a small probability that similar items nevertheless fall in different buckets. This probability can be reduced by doing multiple rounds of hashing with $n _ { r o u n d s }$ distinct hash functions $\\{ h ^ { ( 1 ) } , h ^ { \\left( 2 \\right) } , \\ldots \\}$ , such that: ",
|
| 434 |
+
"bbox": [
|
| 435 |
+
174,
|
| 436 |
+
719,
|
| 437 |
+
825,
|
| 438 |
+
763
|
| 439 |
+
],
|
| 440 |
+
"page_idx": 3
|
| 441 |
+
},
|
| 442 |
+
{
|
| 443 |
+
"type": "equation",
|
| 444 |
+
"img_path": "images/ed32fa46b9d72dc92ab141aa5df595500b7b012f5bc737cb273b33143cd78bd0.jpg",
|
| 445 |
+
"text": "$$\n{ \\mathcal P } _ { i } = \\bigcup _ { r = 1 } ^ { n _ { r o u n d s } } { \\mathcal P } _ { i } ^ { ( r ) } \\qquad \\mathrm { w h e r e } ~ { \\mathcal P } _ { i } ^ { ( r ) } = \\Big \\{ j : h ^ { ( r ) } ( q _ { i } ) = h ^ { ( r ) } ( q _ { j } ) \\Big \\}\n$$",
|
| 446 |
+
"text_format": "latex",
|
| 447 |
+
"bbox": [
|
| 448 |
+
259,
|
| 449 |
+
770,
|
| 450 |
+
738,
|
| 451 |
+
813
|
| 452 |
+
],
|
| 453 |
+
"page_idx": 3
|
| 454 |
+
},
|
| 455 |
+
{
|
| 456 |
+
"type": "text",
|
| 457 |
+
"text": "The multi-round case essentially involves performing LSH attention $n _ { r o u n d s }$ times in parallel; the details of the procedure are described in in Appendix A. ",
|
| 458 |
+
"bbox": [
|
| 459 |
+
173,
|
| 460 |
+
818,
|
| 461 |
+
823,
|
| 462 |
+
848
|
| 463 |
+
],
|
| 464 |
+
"page_idx": 3
|
| 465 |
+
},
|
| 466 |
+
{
|
| 467 |
+
"type": "text",
|
| 468 |
+
"text": "Causal masking for shared-QK attention. In a Transformer decoder, masking (denoted by $m ( j , \\mathcal { P } _ { i } )$ in Equation 3) is used to prevent positions from attending into the future. To implement masking in LSH attention, we associate every query/key vector with a position index, re-order the position indices using the same permutations used to sort the query/key vectors, and then use a comparison operation to compute the mask. ",
|
| 469 |
+
"bbox": [
|
| 470 |
+
173,
|
| 471 |
+
853,
|
| 472 |
+
825,
|
| 473 |
+
924
|
| 474 |
+
],
|
| 475 |
+
"page_idx": 3
|
| 476 |
+
},
|
| 477 |
+
{
|
| 478 |
+
"type": "table",
|
| 479 |
+
"img_path": "images/24470169d739301dd482f090bfc26a0d6a989d04559e3a83297597120ba2219e.jpg",
|
| 480 |
+
"table_caption": [
|
| 481 |
+
"Table 1: Memory and time complexity of attention variants. We write $l$ for length, $b$ for batch size, $n _ { h }$ for the number of heads, $n _ { c }$ for the number of LSH chunks, $n _ { r }$ for the number of hash repetitions. "
|
| 482 |
+
],
|
| 483 |
+
"table_footnote": [],
|
| 484 |
+
"table_body": "<table><tr><td>Attention Type</td><td>Memory Complexity</td><td>Time Complexity</td></tr><tr><td>Scaled Dot-Product</td><td>max(bnnldk,bnnl²)</td><td>max(bnnldk,bnnl2)</td></tr><tr><td>Memory-Efficient</td><td>max(bnnldk,bnnl²)</td><td>max(bnhldk,bnnl²)</td></tr><tr><td>LSH Attention</td><td>max(bnnldk,bnnlnr(4l/nc)2)</td><td>max(bnhldk,bnhnrl(4l/nc)²)</td></tr></table>",
|
| 485 |
+
"bbox": [
|
| 486 |
+
202,
|
| 487 |
+
145,
|
| 488 |
+
795,
|
| 489 |
+
208
|
| 490 |
+
],
|
| 491 |
+
"page_idx": 4
|
| 492 |
+
},
|
| 493 |
+
{
|
| 494 |
+
"type": "table",
|
| 495 |
+
"img_path": "images/e3bbe130dad74e831b3d58b32876d854487242e403c5ea97ca47c263e1a728d0.jpg",
|
| 496 |
+
"table_caption": [
|
| 497 |
+
"Table 2: Accuracies on the duplication task of a 1-layer Transformer model with full attention and with locality-sensitive hashing attention using different number of parallel hashes. "
|
| 498 |
+
],
|
| 499 |
+
"table_footnote": [],
|
| 500 |
+
"table_body": "<table><tr><td></td><td rowspan=\"2\">Eval</td><td rowspan=\"2\">Full Attention</td><td rowspan=\"2\">LSH-8</td><td rowspan=\"2\">LSH-4</td><td rowspan=\"2\">LSH-2</td><td rowspan=\"2\">LSH-1</td></tr><tr><td>Train</td></tr><tr><td>Full Attention</td><td></td><td>100%</td><td>94.8%</td><td>92.5%</td><td>76.9%</td><td>52.5%</td></tr><tr><td colspan=\"2\">LSH-4</td><td>0.8%</td><td>100%</td><td>99.9%</td><td>99.4%</td><td>91.9%</td></tr><tr><td colspan=\"2\">LSH-2</td><td>0.8%</td><td>100%</td><td>99.9%</td><td>98.1%</td><td>86.8%</td></tr><tr><td colspan=\"2\">LSH-1</td><td>0.8%</td><td>99.9%</td><td>99.6%</td><td>94.8%</td><td>77.9%</td></tr></table>",
|
| 501 |
+
"bbox": [
|
| 502 |
+
254,
|
| 503 |
+
282,
|
| 504 |
+
741,
|
| 505 |
+
369
|
| 506 |
+
],
|
| 507 |
+
"page_idx": 4
|
| 508 |
+
},
|
| 509 |
+
{
|
| 510 |
+
"type": "text",
|
| 511 |
+
"text": "While attention to the future is not allowed, typical implementations of the Transformer do allow a position to attend to itself. Such behavior is undesirable in a shared-QK formulation because the dot-product of a query vector with itself will almost always be greater than the dot product of a query vector with a vector at another position. We therefore modify the masking to forbid a token from attending to itself, except in situations where a token has no other valid attention targets (e.g. the first token in a sequence). ",
|
| 512 |
+
"bbox": [
|
| 513 |
+
173,
|
| 514 |
+
412,
|
| 515 |
+
825,
|
| 516 |
+
497
|
| 517 |
+
],
|
| 518 |
+
"page_idx": 4
|
| 519 |
+
},
|
| 520 |
+
{
|
| 521 |
+
"type": "text",
|
| 522 |
+
"text": "2.1 ANALYSIS ON A SYNTHETIC TASK ",
|
| 523 |
+
"text_level": 1,
|
| 524 |
+
"bbox": [
|
| 525 |
+
176,
|
| 526 |
+
527,
|
| 527 |
+
447,
|
| 528 |
+
541
|
| 529 |
+
],
|
| 530 |
+
"page_idx": 4
|
| 531 |
+
},
|
| 532 |
+
{
|
| 533 |
+
"type": "text",
|
| 534 |
+
"text": "To verify the performance of LSH attention and study its behavior, we start with the following synthetic task: duplicate a sequence of symbols. In this task, each training and testing example has the form $0 w 0 w$ where $w \\in \\bar { \\{ 1 , \\ldots , N \\} ^ { * } }$ is a sequence of symbols ranging from 1 to $N$ (we use $N = 1 2 7$ in our experiments). An example with the word $w$ of length 3 is given below. ",
|
| 535 |
+
"bbox": [
|
| 536 |
+
174,
|
| 537 |
+
558,
|
| 538 |
+
825,
|
| 539 |
+
616
|
| 540 |
+
],
|
| 541 |
+
"page_idx": 4
|
| 542 |
+
},
|
| 543 |
+
{
|
| 544 |
+
"type": "table",
|
| 545 |
+
"img_path": "images/696df21446f4bd78a9b2abf31dd3683a1734cf855a47daaa421e391d52ede6c2.jpg",
|
| 546 |
+
"table_caption": [],
|
| 547 |
+
"table_footnote": [],
|
| 548 |
+
"table_body": "<table><tr><td rowspan=1 colspan=1>Example:</td><td rowspan=1 colspan=1>0</td><td rowspan=1 colspan=1>19</td><td rowspan=1 colspan=1>113</td><td rowspan=1 colspan=1>72</td><td rowspan=1 colspan=1>0</td><td rowspan=1 colspan=1>19</td><td rowspan=1 colspan=1>113</td><td rowspan=1 colspan=1>72</td></tr></table>",
|
| 549 |
+
"bbox": [
|
| 550 |
+
305,
|
| 551 |
+
642,
|
| 552 |
+
687,
|
| 553 |
+
660
|
| 554 |
+
],
|
| 555 |
+
"page_idx": 4
|
| 556 |
+
},
|
| 557 |
+
{
|
| 558 |
+
"type": "text",
|
| 559 |
+
"text": "To study LSH attention, we train a language model on examples of the above form where each $w$ is of length 511 (so the whole input $0 w 0 w$ is of length 1024). As this is a language modeling task, we always predict the next symbol given all the previous ones, but we mask the loss and accuracy to only consider positions in the second half of the input, i.e., those that can actually be predicted. ",
|
| 560 |
+
"bbox": [
|
| 561 |
+
174,
|
| 562 |
+
686,
|
| 563 |
+
825,
|
| 564 |
+
742
|
| 565 |
+
],
|
| 566 |
+
"page_idx": 4
|
| 567 |
+
},
|
| 568 |
+
{
|
| 569 |
+
"type": "text",
|
| 570 |
+
"text": "The above task can be solved perfectly (to accuracy $100 \\%$ and loss 0) by a 1-layer Transformer model. Note though, that it requires non-local attention lookups, so it cannot be solved by any model relying on sparse attention with a limited span. To make it easy and fast to train but similar to models used in NLP, we use a 1-layer Transformer with $d _ { m o d e l } = d _ { f f } = 2 5 6$ and 4 heads. We train it for 150K steps in 4 different settings: with full attention, LSH attention with $n _ { r o u n d s } = 1$ , $n _ { r o u n d s } = 2$ and $n _ { r o u n d s } = 4$ . ",
|
| 571 |
+
"bbox": [
|
| 572 |
+
173,
|
| 573 |
+
750,
|
| 574 |
+
825,
|
| 575 |
+
834
|
| 576 |
+
],
|
| 577 |
+
"page_idx": 4
|
| 578 |
+
},
|
| 579 |
+
{
|
| 580 |
+
"type": "text",
|
| 581 |
+
"text": "From the results summarized in Table 2 we see that a model trained with full attention can be immediately used with LSH attention, but at some loss of accuracy. When trained from scratch with LSH attention, the model trained with 4 hashes achieves almost perfect accuracy as well. Interestingly, the accuracy becomes perfect when evaluated with 8 hashes. It goes down when evaluated with 2 or 1 hashes. Models trained with less hashes show worse results but even the model trained with just 1 hash performs almost perfectly when evaluated with 8 hashes. ",
|
| 582 |
+
"bbox": [
|
| 583 |
+
173,
|
| 584 |
+
839,
|
| 585 |
+
825,
|
| 586 |
+
924
|
| 587 |
+
],
|
| 588 |
+
"page_idx": 4
|
| 589 |
+
},
|
| 590 |
+
{
|
| 591 |
+
"type": "text",
|
| 592 |
+
"text": "3 REVERSIBLE TRANSFORMER ",
|
| 593 |
+
"text_level": 1,
|
| 594 |
+
"bbox": [
|
| 595 |
+
176,
|
| 596 |
+
102,
|
| 597 |
+
446,
|
| 598 |
+
118
|
| 599 |
+
],
|
| 600 |
+
"page_idx": 5
|
| 601 |
+
},
|
| 602 |
+
{
|
| 603 |
+
"type": "text",
|
| 604 |
+
"text": "As the above section shows, the complexity of attention can be reduced from square in length to linear, provided an approximation is acceptable. But it is clear from Table 1 that each field starts with a $b \\cdot n _ { h } \\cdot l$ term: the $b \\cdot n _ { h } \\cdot l \\cdot d _ { k }$ , or alternatively $b \\cdot l \\cdot d _ { m o d e l }$ cost cannot be avoided. Indeed, the activations before each layer are already of the size $b \\cdot l \\cdot d _ { m o d e l }$ , so the memory use of the whole model with $n _ { l }$ layers is at least $b \\cdot l \\cdot d _ { m o d e l } \\cdot n _ { l }$ . Even worse: inside the feed-forward layers of Transformer this goes up to $\\boldsymbol { b } \\cdot \\boldsymbol { l } \\cdot d _ { f f } \\cdot n _ { l }$ . In a big Transformer it is usual to set $d _ { f f } = 4 K$ and $n _ { l } = 1 6$ so with $l = 6 4 K$ this again would use an impractical $1 6 G B$ of memory ",
|
| 605 |
+
"bbox": [
|
| 606 |
+
173,
|
| 607 |
+
133,
|
| 608 |
+
825,
|
| 609 |
+
233
|
| 610 |
+
],
|
| 611 |
+
"page_idx": 5
|
| 612 |
+
},
|
| 613 |
+
{
|
| 614 |
+
"type": "text",
|
| 615 |
+
"text": "In this section, we show how to reduce this cost by first dealing with the $n _ { l }$ part of the term using reversible layers and then showing how chunking can allow us to handle the $d _ { f f }$ problem. The effects of each of these approaches on memory and time complexity are summarized in Table 3. ",
|
| 616 |
+
"bbox": [
|
| 617 |
+
174,
|
| 618 |
+
238,
|
| 619 |
+
823,
|
| 620 |
+
281
|
| 621 |
+
],
|
| 622 |
+
"page_idx": 5
|
| 623 |
+
},
|
| 624 |
+
{
|
| 625 |
+
"type": "text",
|
| 626 |
+
"text": "RevNets. Reversible residual networks were introduced by Gomez et al. (2017) where it was shown that they can replace ResNets for image classification. The main idea is to allow the activations at any given layer to be recovered from the activations at the following layer, using only the model parameters. Rather than having to checkpoint intermediate values for use in the backward pass, layers can be reversed one-by-one as back-propagation proceeds from the output of the network to its input. Whereas a normal residual layer performs a function $x \\mapsto y$ that operates on a single input and produces a single output and has the form $y = x + F ( x )$ , a reversible layer works on pairs of inputs/outputs: $( x _ { 1 } , x _ { 2 } ) \\mapsto ( y _ { 1 } , y _ { 2 } )$ , and follows the equations: ",
|
| 627 |
+
"bbox": [
|
| 628 |
+
173,
|
| 629 |
+
287,
|
| 630 |
+
825,
|
| 631 |
+
400
|
| 632 |
+
],
|
| 633 |
+
"page_idx": 5
|
| 634 |
+
},
|
| 635 |
+
{
|
| 636 |
+
"type": "equation",
|
| 637 |
+
"img_path": "images/9e3cd54d2f60af4e972bd8d8520244671774f629b0bac926627e4614217752f6.jpg",
|
| 638 |
+
"text": "$$\ny _ { 1 } = x _ { 1 } + F ( x _ { 2 } ) y _ { 2 } = x _ { 2 } + G ( y _ { 1 } )\n$$",
|
| 639 |
+
"text_format": "latex",
|
| 640 |
+
"bbox": [
|
| 641 |
+
310,
|
| 642 |
+
406,
|
| 643 |
+
686,
|
| 644 |
+
426
|
| 645 |
+
],
|
| 646 |
+
"page_idx": 5
|
| 647 |
+
},
|
| 648 |
+
{
|
| 649 |
+
"type": "text",
|
| 650 |
+
"text": "A layer can be reversed by subtracting (rather than adding) the residuals: ",
|
| 651 |
+
"bbox": [
|
| 652 |
+
173,
|
| 653 |
+
440,
|
| 654 |
+
651,
|
| 655 |
+
455
|
| 656 |
+
],
|
| 657 |
+
"page_idx": 5
|
| 658 |
+
},
|
| 659 |
+
{
|
| 660 |
+
"type": "equation",
|
| 661 |
+
"img_path": "images/ede7b87e7d7a707641831c268d6cf050d5f88e9f6e70adf497e8129d93d74e78.jpg",
|
| 662 |
+
"text": "$$\nx _ { 2 } = y _ { 2 } - G ( y _ { 1 } ) x _ { 1 } = y _ { 1 } - F ( x _ { 2 } )\n$$",
|
| 663 |
+
"text_format": "latex",
|
| 664 |
+
"bbox": [
|
| 665 |
+
312,
|
| 666 |
+
463,
|
| 667 |
+
686,
|
| 668 |
+
482
|
| 669 |
+
],
|
| 670 |
+
"page_idx": 5
|
| 671 |
+
},
|
| 672 |
+
{
|
| 673 |
+
"type": "text",
|
| 674 |
+
"text": "Reversible Transformer. We apply the RevNet idea to the Transformer by combining the attention and feed-forward layers inside the revnet block. In the notation above, F becomes an attention layer while $\\mathbf { G }$ becomes the feed-forward layer. Note that Layer Normalization (Ba et al., 2016) is moved inside the residual blocks. ",
|
| 675 |
+
"bbox": [
|
| 676 |
+
173,
|
| 677 |
+
496,
|
| 678 |
+
825,
|
| 679 |
+
553
|
| 680 |
+
],
|
| 681 |
+
"page_idx": 5
|
| 682 |
+
},
|
| 683 |
+
{
|
| 684 |
+
"type": "equation",
|
| 685 |
+
"img_path": "images/75b4d028a678d86bf0ee6e3647e153cef36cd85379afd04c356fb37787c36d96.jpg",
|
| 686 |
+
"text": "$$\nY _ { 1 } = X _ { 1 } + \\mathrm { A t t e n t i o n } ( X _ { 2 } ) \\qquad Y _ { 2 } = X _ { 2 } + \\mathrm { F e e d F o r w a r d } ( Y _ { 1 } )\n$$",
|
| 687 |
+
"text_format": "latex",
|
| 688 |
+
"bbox": [
|
| 689 |
+
261,
|
| 690 |
+
560,
|
| 691 |
+
736,
|
| 692 |
+
579
|
| 693 |
+
],
|
| 694 |
+
"page_idx": 5
|
| 695 |
+
},
|
| 696 |
+
{
|
| 697 |
+
"type": "text",
|
| 698 |
+
"text": "The reversible Transformer does not need to store activations in each layer and so gets rid of the $n _ { l }$ term. In Section 5 we show that it performs the same as the normal Transformer when using the same number of parameters; we achieve this by having both $x _ { 1 }$ and $x _ { 2 }$ have size $d _ { m o d e l }$ . ",
|
| 699 |
+
"bbox": [
|
| 700 |
+
174,
|
| 701 |
+
593,
|
| 702 |
+
825,
|
| 703 |
+
637
|
| 704 |
+
],
|
| 705 |
+
"page_idx": 5
|
| 706 |
+
},
|
| 707 |
+
{
|
| 708 |
+
"type": "text",
|
| 709 |
+
"text": "Chunking. While reversibility covers the $n _ { l }$ term, the thicker layers can still use a lot of memory. The feed-forward layer in particular can use intermediate vectors of dimensionality $d _ { f f } = 4 K$ or higher. However, computations in feed-forward layers are completely independent across positions in a sequence, so the computation can be split into $c$ chunks: ",
|
| 710 |
+
"bbox": [
|
| 711 |
+
174,
|
| 712 |
+
642,
|
| 713 |
+
825,
|
| 714 |
+
700
|
| 715 |
+
],
|
| 716 |
+
"page_idx": 5
|
| 717 |
+
},
|
| 718 |
+
{
|
| 719 |
+
"type": "equation",
|
| 720 |
+
"img_path": "images/1e10308d22e821b8cd31af648d801fa0dba5dc03220433cba375c5431ea97066.jpg",
|
| 721 |
+
"text": "$$\nY _ { 2 } = \\left[ Y _ { 2 } ^ { ( 1 ) } ; \\ldots ; Y _ { 2 } ^ { ( c ) } \\right] = \\left[ X _ { 2 } ^ { ( 1 ) } + { \\mathrm { F e e d F o r w a r d } } ( Y _ { 1 } ^ { ( 1 ) } ) ; \\ldots ; X _ { 2 } ^ { ( c ) } + { \\mathrm { F e e d F o r w a r d } } ( Y _ { 1 } ^ { ( c ) } ) \\right]\n$$",
|
| 722 |
+
"text_format": "latex",
|
| 723 |
+
"bbox": [
|
| 724 |
+
184,
|
| 725 |
+
707,
|
| 726 |
+
784,
|
| 727 |
+
734
|
| 728 |
+
],
|
| 729 |
+
"page_idx": 5
|
| 730 |
+
},
|
| 731 |
+
{
|
| 732 |
+
"type": "text",
|
| 733 |
+
"text": "This layer is typically batched by performing operations for all positions in parallel, but operating on one chunk at a time can reduce memory. The reverse computation in (8) and the backward pass are also chunked. In addition to the feed-forward layers, for models with large vocabulary (more than $d _ { m o d e l }$ word types) we also chunk the log-probabilities at the output and calculate the loss for sections of the sequence at a time. ",
|
| 734 |
+
"bbox": [
|
| 735 |
+
174,
|
| 736 |
+
750,
|
| 737 |
+
825,
|
| 738 |
+
819
|
| 739 |
+
],
|
| 740 |
+
"page_idx": 5
|
| 741 |
+
},
|
| 742 |
+
{
|
| 743 |
+
"type": "text",
|
| 744 |
+
"text": "Chunking, large batches and parameter reuse. With chunking and reversible layers the memory we use for activations in the whole network is independent of the number of layers. The same is not true for parameters though as their number grows with the number of layers. This problem is remedied though because we can swap layer parameters to and from CPU memory when this layer is not computing. In a standard Transformer this would be inefficient because memory transfer to CPU is slow. The batch size multiplied by length in Reformer is much larger though and therefore the amount of compute done with the parameters amortizes the cost of their transfer. ",
|
| 745 |
+
"bbox": [
|
| 746 |
+
173,
|
| 747 |
+
825,
|
| 748 |
+
825,
|
| 749 |
+
924
|
| 750 |
+
],
|
| 751 |
+
"page_idx": 5
|
| 752 |
+
},
|
| 753 |
+
{
|
| 754 |
+
"type": "table",
|
| 755 |
+
"img_path": "images/f0bb78213a31e944db874448563833dfc16a49d2bace547e66dac7e2a7626aee.jpg",
|
| 756 |
+
"table_caption": [
|
| 757 |
+
"Table 3: Memory and time complexity of Transformer variants. We write $d _ { m o d e l }$ and $d _ { f f }$ for model depth and assume $d _ { f f } \\geq d _ { m o d e l }$ ; $b$ stands for batch size, $l$ for length, $n _ { l }$ for the number of layers. We assume $n _ { c } = l / 3 2$ so $4 l / n _ { c } = 1 2 8$ and we write $c = 1 2 8 ^ { 2 }$ . "
|
| 758 |
+
],
|
| 759 |
+
"table_footnote": [],
|
| 760 |
+
"table_body": "<table><tr><td>Model Type</td><td>Memory Complexity</td><td>Time Complexity</td></tr><tr><td>Transformer</td><td>max(bldff,bnnl²)nt</td><td>(bldff+bnnl²)nt</td></tr><tr><td>Reversible Transformer</td><td>max(bldff,bnhl²)</td><td>(bnhldff+bnnl2)nl</td></tr><tr><td>Chunked Reversible Transformer</td><td>max(bldmodet, bnnl2)</td><td>(bnnldff+bnnl²)nl</td></tr><tr><td>LSHTransformer</td><td>max(bldff,bnnlnrc)ni</td><td>(bldff+bnhnrlc)ni</td></tr><tr><td>Reformer</td><td>max(bldmodel,bnhlnrc)</td><td>(bldff+bnhnrlc)ni</td></tr></table>",
|
| 761 |
+
"bbox": [
|
| 762 |
+
210,
|
| 763 |
+
160,
|
| 764 |
+
789,
|
| 765 |
+
251
|
| 766 |
+
],
|
| 767 |
+
"page_idx": 6
|
| 768 |
+
},
|
| 769 |
+
{
|
| 770 |
+
"type": "text",
|
| 771 |
+
"text": "4 RELATED WORK ",
|
| 772 |
+
"text_level": 1,
|
| 773 |
+
"bbox": [
|
| 774 |
+
176,
|
| 775 |
+
284,
|
| 776 |
+
344,
|
| 777 |
+
300
|
| 778 |
+
],
|
| 779 |
+
"page_idx": 6
|
| 780 |
+
},
|
| 781 |
+
{
|
| 782 |
+
"type": "text",
|
| 783 |
+
"text": "The Transformer model introduced in (Vaswani et al., 2017) has been used widely in natural language tasks and further extended to model diverse data such as music scores (Huang et al., 2018), and images (Parmar et al., 2018; Ramachandran et al., 2019). Most notably, this model class has been applied successfully in the self-supervised training of extremely large language models (Devlin et al., 2018; Radford et al., 2019). ",
|
| 784 |
+
"bbox": [
|
| 785 |
+
174,
|
| 786 |
+
319,
|
| 787 |
+
825,
|
| 788 |
+
388
|
| 789 |
+
],
|
| 790 |
+
"page_idx": 6
|
| 791 |
+
},
|
| 792 |
+
{
|
| 793 |
+
"type": "text",
|
| 794 |
+
"text": "Given the enormous computational requirements of state of the art sequence models, there has been increasing interest in finding methods to reduce the memory footprint and computational requirements of Transformer models. In addition to standard methods such as precision reduction and gradient checkpointing (Sohoni et al., 2019), more efficient versions of the Transformer model’s self-attention mechanism (Sukhbaatar et al., 2019a;b) have also recently been explored. ",
|
| 795 |
+
"bbox": [
|
| 796 |
+
174,
|
| 797 |
+
396,
|
| 798 |
+
823,
|
| 799 |
+
465
|
| 800 |
+
],
|
| 801 |
+
"page_idx": 6
|
| 802 |
+
},
|
| 803 |
+
{
|
| 804 |
+
"type": "text",
|
| 805 |
+
"text": "In particular, leveraging sparsity in the attention layers has proved fruitful. OpenAI introduced the sparse Transformer (Child et al., 2019) which exploits a factorized sparse representation of attention. Using product-key attention to increase the key space has also been used to reduce memory requirements in the feed-forward layers with no loss in performance (Lample et al., 2019). ",
|
| 806 |
+
"bbox": [
|
| 807 |
+
174,
|
| 808 |
+
473,
|
| 809 |
+
825,
|
| 810 |
+
529
|
| 811 |
+
],
|
| 812 |
+
"page_idx": 6
|
| 813 |
+
},
|
| 814 |
+
{
|
| 815 |
+
"type": "text",
|
| 816 |
+
"text": "Locality-sensitive hashing (LSH) has, to our knowledge, not been directly applied to Transformer attention layers before. But previous work using external memory with neural networks has dealt with memories of large sizes. The original implementation of memory networks (Weston et al., 2014) and later work on scaling it (Bordes et al., 2015; Chandar et al., 2016) used memory with size in the millions. The cost of doing so is that the memory must be fixed prior to training. Moreover, since during the beginning of training the model is unlikely to query the memory correctly, strong supervision is used to encourage the model to query memory locations that are useful. These hints are either given as additional supervising information by the task or determined heuristically as in Hill et al. (2015). The requirement that the memory be fixed before has been removed in Santoro et al. (2016) at the cost of memory size and later alleviated by Rae et al. (2016). The last paper considered memory lookups with approximate nearest neighbors including both LSH and random kd-trees, but only for lookups in external memory. ",
|
| 817 |
+
"bbox": [
|
| 818 |
+
174,
|
| 819 |
+
535,
|
| 820 |
+
825,
|
| 821 |
+
702
|
| 822 |
+
],
|
| 823 |
+
"page_idx": 6
|
| 824 |
+
},
|
| 825 |
+
{
|
| 826 |
+
"type": "text",
|
| 827 |
+
"text": "5 EXPERIMENTS ",
|
| 828 |
+
"text_level": 1,
|
| 829 |
+
"bbox": [
|
| 830 |
+
176,
|
| 831 |
+
728,
|
| 832 |
+
326,
|
| 833 |
+
744
|
| 834 |
+
],
|
| 835 |
+
"page_idx": 6
|
| 836 |
+
},
|
| 837 |
+
{
|
| 838 |
+
"type": "text",
|
| 839 |
+
"text": "In this section we present experimental results demonstrating the techniques described above. We analyze the techniques one-by-one to make clear which combinations have impact on performance. We start by showing that reversible layers and shared query-key spaces do not impact performance, then proceed to analyze hashing attention and finally the full Reformer model. ",
|
| 840 |
+
"bbox": [
|
| 841 |
+
174,
|
| 842 |
+
763,
|
| 843 |
+
823,
|
| 844 |
+
819
|
| 845 |
+
],
|
| 846 |
+
"page_idx": 6
|
| 847 |
+
},
|
| 848 |
+
{
|
| 849 |
+
"type": "text",
|
| 850 |
+
"text": "We ran our experiments on the imagenet64 and enwik8-64K tasks, where the latter is a variant of enwik8 that is chunked into subsequences of $2 ^ { 1 6 } \\ : = \\ : 6 4 K$ tokens. We use 3-layer models for our ablations so as to make it tractable to compare with the regular Transformer, which has high memory usage and performs full $O ( l ^ { 2 } )$ attention. All experiments have $d _ { m o d e l } = 1 0 2 4$ , $d _ { f f } = 4 0 9 6$ , $n _ { h e a d s } ~ = ~ 8$ , and a total batch size of 8 sequences. We used the Adafactor optimizer (Shazeer & Stern, 2018) for training these models. We also evaluate on the WMT 2014 English-to-German translation task, following the hyperparameters of Vaswani et al. (2017). Training for all experiments was parallelized across 8 devices (8 GPUs or 8 TPU v3 cores). Code for training our models is made publicly available.2 ",
|
| 851 |
+
"bbox": [
|
| 852 |
+
174,
|
| 853 |
+
825,
|
| 854 |
+
825,
|
| 855 |
+
924
|
| 856 |
+
],
|
| 857 |
+
"page_idx": 6
|
| 858 |
+
},
|
| 859 |
+
{
|
| 860 |
+
"type": "image",
|
| 861 |
+
"img_path": "images/c2fe4e4314fc0b82d2981ba18326ffd9fc27b3df97ee0b18eda40840efe41fac.jpg",
|
| 862 |
+
"image_caption": [
|
| 863 |
+
"Figure 3: Effect of shared query-key space (left) and reversibility (right) on performance on enwik8 and imagenet64 training. The curves show bits per dim on held-out data. "
|
| 864 |
+
],
|
| 865 |
+
"image_footnote": [],
|
| 866 |
+
"bbox": [
|
| 867 |
+
210,
|
| 868 |
+
104,
|
| 869 |
+
784,
|
| 870 |
+
367
|
| 871 |
+
],
|
| 872 |
+
"page_idx": 7
|
| 873 |
+
},
|
| 874 |
+
{
|
| 875 |
+
"type": "table",
|
| 876 |
+
"img_path": "images/296cf61e1a648082213a0790080061668c5c48262a7253f9397d3a0df41d9f52.jpg",
|
| 877 |
+
"table_caption": [
|
| 878 |
+
"Table 4: BLEU scores on newstest2014 for WMT English-German (En–De). We additionally report detokenized BLEU scores as computed by sacreBLEU (Post, 2018). "
|
| 879 |
+
],
|
| 880 |
+
"table_footnote": [],
|
| 881 |
+
"table_body": "<table><tr><td rowspan=\"2\">Model</td><td colspan=\"3\">sacreBLEU</td></tr><tr><td>BLEU</td><td>Uncased3</td><td>Cased4</td></tr><tr><td>Vaswani etal. (2017),base model</td><td>27.3</td><td></td><td></td></tr><tr><td>Vaswani et al. (2017), big</td><td>28.4</td><td></td><td></td></tr><tr><td>Ott et al. (2018), big</td><td>29.3</td><td></td><td></td></tr><tr><td>Reversible Transformer (base,10oK steps)</td><td>27.6</td><td>27.4</td><td>26.9</td></tr><tr><td>Reversible Transformer (base,5OoK steps,no weight sharing)</td><td>28.0</td><td>27.9</td><td>27.4</td></tr><tr><td>Reversible Transformer (big,3OOK steps,no weight sharing)</td><td>29.1</td><td>28.9</td><td>28.4</td></tr></table>",
|
| 882 |
+
"bbox": [
|
| 883 |
+
178,
|
| 884 |
+
477,
|
| 885 |
+
820,
|
| 886 |
+
590
|
| 887 |
+
],
|
| 888 |
+
"page_idx": 7
|
| 889 |
+
},
|
| 890 |
+
{
|
| 891 |
+
"type": "text",
|
| 892 |
+
"text": "",
|
| 893 |
+
"bbox": [
|
| 894 |
+
176,
|
| 895 |
+
622,
|
| 896 |
+
823,
|
| 897 |
+
651
|
| 898 |
+
],
|
| 899 |
+
"page_idx": 7
|
| 900 |
+
},
|
| 901 |
+
{
|
| 902 |
+
"type": "text",
|
| 903 |
+
"text": "Effect of sharing QK. We first consider the effect of shared-QK attention on a regular Transformer model. Shared-QK attention sets $\\begin{array} { r } { k _ { j } ~ = ~ \\frac { q _ { j } } { \\parallel q _ { j } \\parallel } } \\end{array}$ and prevents tokens from attending to themselves (except when no other context is available). In the left part of Figure 3, we plot perplexity curves for both regular and shared-QK attention. A shared query-key space does not perform worse than regular attention; in fact, for enwik8 it appears to train slightly faster. In other words, we are not sacrificing accuracy by switching to shared-QK attention. ",
|
| 904 |
+
"bbox": [
|
| 905 |
+
174,
|
| 906 |
+
659,
|
| 907 |
+
825,
|
| 908 |
+
744
|
| 909 |
+
],
|
| 910 |
+
"page_idx": 7
|
| 911 |
+
},
|
| 912 |
+
{
|
| 913 |
+
"type": "text",
|
| 914 |
+
"text": "Effect of reversible layers. In the two plots on the right in Figure 3, we compare a regular Transformer per Vaswani et al. (2017) with the reversible one describe in Section 3. The two models have identical parameter counts, and the learning curves likewise appear to be nearly the same. These results show that the memory savings in the reversible Transformer do not come at the expense of accuracy. ",
|
| 915 |
+
"bbox": [
|
| 916 |
+
173,
|
| 917 |
+
751,
|
| 918 |
+
825,
|
| 919 |
+
821
|
| 920 |
+
],
|
| 921 |
+
"page_idx": 7
|
| 922 |
+
},
|
| 923 |
+
{
|
| 924 |
+
"type": "text",
|
| 925 |
+
"text": "Reversible layers in machine translation. We also evaluate reversible layers in the context of an encoder-decoder Transformer model for machine translation from English to German. We start by making both the encoder and the decoder fully reversible in the Transformer-base architecture, and see that the resulting model performs comparably to Vaswani et al. (2017) when trained for 100K steps. We also evaluate training for a greater number of steps and with a larger model. Reformer models are very memory-efficient, so for the latter two experiments we do not need to save memory by sharing embedding and output projection weight matrices throughout the model. Results are shown in Table 4. We do not apply LSH attention in this setting because examples are single sentences, and sentences tend to be relatively short. Our typical LSH attention configuration uses chunks of 128 tokens after hashing and sorting, whereas the examples in the WMT14 test set are all shorter than 128 tokens. ",
|
| 926 |
+
"bbox": [
|
| 927 |
+
174,
|
| 928 |
+
829,
|
| 929 |
+
825,
|
| 930 |
+
871
|
| 931 |
+
],
|
| 932 |
+
"page_idx": 7
|
| 933 |
+
},
|
| 934 |
+
{
|
| 935 |
+
"type": "image",
|
| 936 |
+
"img_path": "images/da5d76906fcbfcc141fd40ccc521929fac0f14397c36dfbe9348757cafb44e35.jpg",
|
| 937 |
+
"image_caption": [
|
| 938 |
+
"Figure 4: LSH attention performance as a function of hashing rounds on imagenet64. "
|
| 939 |
+
],
|
| 940 |
+
"image_footnote": [],
|
| 941 |
+
"bbox": [
|
| 942 |
+
181,
|
| 943 |
+
108,
|
| 944 |
+
816,
|
| 945 |
+
297
|
| 946 |
+
],
|
| 947 |
+
"page_idx": 8
|
| 948 |
+
},
|
| 949 |
+
{
|
| 950 |
+
"type": "image",
|
| 951 |
+
"img_path": "images/a6f457e38c79efcd959c9f60f3b2617e1d74b576a80218106af9af3bde2fe678.jpg",
|
| 952 |
+
"image_caption": [
|
| 953 |
+
"Figure 5: Left: LSH attention performance as a function of number of layers on enwik8. Right: Speed of attention evaluation as a function of input length for full- and LSH- attention. "
|
| 954 |
+
],
|
| 955 |
+
"image_footnote": [],
|
| 956 |
+
"bbox": [
|
| 957 |
+
179,
|
| 958 |
+
362,
|
| 959 |
+
805,
|
| 960 |
+
502
|
| 961 |
+
],
|
| 962 |
+
"page_idx": 8
|
| 963 |
+
},
|
| 964 |
+
{
|
| 965 |
+
"type": "text",
|
| 966 |
+
"text": "",
|
| 967 |
+
"bbox": [
|
| 968 |
+
174,
|
| 969 |
+
589,
|
| 970 |
+
825,
|
| 971 |
+
700
|
| 972 |
+
],
|
| 973 |
+
"page_idx": 8
|
| 974 |
+
},
|
| 975 |
+
{
|
| 976 |
+
"type": "text",
|
| 977 |
+
"text": "LSH attention in Transformer. LSH attention is an approximation for full attention that, as evidenced in Figure 4, becomes more accurate as the number of hashes increases. At $n _ { r o u n d s } = 8$ , it already almost matches full attention. The computational cost of a model grows with the number of hashes, so this hyperparameter can be adjusted depending on the available compute budget. Additionally, as in Table 2, the number of hashes can be increased at evaluation time to produce more accurate results. On the right half of Figure 5, we plot the speed of different attention types vs. the sequence length, while holding the total number of tokens fixed. We see that while regular attention becomes slower at longer sequence length, LSH attention speed remains flat. ",
|
| 978 |
+
"bbox": [
|
| 979 |
+
174,
|
| 980 |
+
708,
|
| 981 |
+
825,
|
| 982 |
+
819
|
| 983 |
+
],
|
| 984 |
+
"page_idx": 8
|
| 985 |
+
},
|
| 986 |
+
{
|
| 987 |
+
"type": "text",
|
| 988 |
+
"text": "Large Reformer models. To verify that the Reformer can indeed fit large models on a single core and train fast on long sequences, we train up to 20-layer big Reformers on enwik8 and imagenet64. As can be seen in Figure 5, these models fit into memory and train. We were not able to train Transformer baselines in this case as they are too slow and memory-hungry, but we see clear improvement with the number of layers. A 12-layer model on enwik8 trained for 20K steps with a dropout rate of 0.1 achieves 1.19 bits/dim on the test set. We also trained a 12-layer Reformer model for longer with further tuning and improvements and we reached 1.05 bits/dim on the enwiki8 test set. ",
|
| 989 |
+
"bbox": [
|
| 990 |
+
173,
|
| 991 |
+
825,
|
| 992 |
+
825,
|
| 993 |
+
924
|
| 994 |
+
],
|
| 995 |
+
"page_idx": 8
|
| 996 |
+
},
|
| 997 |
+
{
|
| 998 |
+
"type": "text",
|
| 999 |
+
"text": "6 CONCLUSION ",
|
| 1000 |
+
"text_level": 1,
|
| 1001 |
+
"bbox": [
|
| 1002 |
+
174,
|
| 1003 |
+
102,
|
| 1004 |
+
318,
|
| 1005 |
+
117
|
| 1006 |
+
],
|
| 1007 |
+
"page_idx": 9
|
| 1008 |
+
},
|
| 1009 |
+
{
|
| 1010 |
+
"type": "text",
|
| 1011 |
+
"text": "Reformer combines the modeling capacity of a Transformer with an architecture that can be executed efficiently on long sequences and with small memory use even for models with a large number of layers. We believe that this will help large, richly-parameterized Transformer models become more widespread and accessible. Also, the ability to handle long sequences opens the way for the use of the Reformer on many generative tasks. In addition to generating very long coherent text, the Reformer can bring the power of Transformer models to other domains like time-series forecasting, music, image and video generation. ",
|
| 1012 |
+
"bbox": [
|
| 1013 |
+
174,
|
| 1014 |
+
133,
|
| 1015 |
+
825,
|
| 1016 |
+
231
|
| 1017 |
+
],
|
| 1018 |
+
"page_idx": 9
|
| 1019 |
+
},
|
| 1020 |
+
{
|
| 1021 |
+
"type": "text",
|
| 1022 |
+
"text": "REFERENCES ",
|
| 1023 |
+
"text_level": 1,
|
| 1024 |
+
"bbox": [
|
| 1025 |
+
174,
|
| 1026 |
+
253,
|
| 1027 |
+
285,
|
| 1028 |
+
268
|
| 1029 |
+
],
|
| 1030 |
+
"page_idx": 9
|
| 1031 |
+
},
|
| 1032 |
+
{
|
| 1033 |
+
"type": "text",
|
| 1034 |
+
"text": "Rami Al-Rfou, Dokook Choe, Noah Constant, Mandy Guo, and Llion Jones. Character-level language modeling with deeper self-attention. CoRR, abs/1808.04444, 2018. URL http: //arxiv.org/abs/1808.04444. \nAlexandr Andoni, Piotr Indyk, Thijs Laarhoven, Ilya P. Razenshteyn, and Ludwig Schmidt. Practical and optimal LSH for angular distance. CoRR, abs/1509.02897, 2015. URL http://arxiv. org/abs/1509.02897. \nJimmy Lei Ba, Jamie Ryan Kiros, and Geoffrey E Hinton. Layer normalization. arXiv preprint arXiv:1607.06450, 2016. URL http://arxiv.org/abs/1607.06450. \nAntoine Bordes, Nicolas Usunier, Sumit Chopra, and Jason Weston. Large-scale simple question answering with memory networks. CoRR, abs/1506.02075, 2015. URL http://arxiv.org/ abs/1506.02075. \nSarath Chandar, Sungjin Ahn, Hugo Larochelle, Pascal Vincent, Gerald Tesauro, and Yoshua Bengio. Hierarchical memory networks. arXiv preprint arXiv:1605.07427, 2016. \nRewon Child, Scott Gray, Alec Radford, and Ilya Sutskever. Generating long sequences with sparse transformers. URL https://openai.com/blog/sparse-transformers, 2019. \nJacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. BERT: pre-training of deep bidirectional transformers for language understanding. CoRR, abs/1810.04805, 2018. URL http://arxiv.org/abs/1810.04805. \nAidan N Gomez, Mengye Ren, Raquel Urtasun, and Roger B Grosse. The reversible residual network: Backpropagation without storing activations. In Advances in neural information processing systems, pp. 2214–2224, 2017. \nFelix Hill, Antoine Bordes, Sumit Chopra, and Jason Weston. The goldilocks principle: Reading children’s books with explicit memory representations. CoRR, abs/1511.02301, 2015. URL http://arxiv.org/abs/1511.02301. \nCheng-Zhi Anna Huang, Ashish Vaswani, Jakob Uszkoreit, Noam Shazeer, Curtis Hawthorne, Andrew M Dai, Matthew D Hoffman, and Douglas Eck. Music transformer: Generating music with long-term structure. arXiv preprint arXiv:1809.04281, 2018. \nGuillaume Lample, Alexandre Sablayrolles, Marc’Aurelio Ranzato, Ludovic Denoyer, and Herve´ Jegou. Large memory layers with product keys. ´ CoRR, abs/1907.05242, 2019. URL http: //arxiv.org/abs/1907.05242. \nPeter J. Liu, Mohammad Saleh, Etienne Pot, Ben Goodrich, Ryan Sepassi, Lukasz Kaiser, and Noam Shazeer. Generating wikipedia by summarizing long sequences. CoRR, abs/1801.10198, 2018. URL http://arxiv.org/abs/1801.10198. \nMyle Ott, Sergey Edunov, David Grangier, and Michael Auli. Scaling neural machine translation. In Proceedings of the Third Conference on Machine Translation: Research Papers, pp. 1–9, Brussels, Belgium, October 2018. Association for Computational Linguistics. doi: 10.18653/v1/W18-6301. URL https://www.aclweb.org/anthology/W18-6301. ",
|
| 1035 |
+
"bbox": [
|
| 1036 |
+
171,
|
| 1037 |
+
273,
|
| 1038 |
+
826,
|
| 1039 |
+
926
|
| 1040 |
+
],
|
| 1041 |
+
"page_idx": 9
|
| 1042 |
+
},
|
| 1043 |
+
{
|
| 1044 |
+
"type": "text",
|
| 1045 |
+
"text": "Niki Parmar, Ashish Vaswani, Jakob Uszkoreit, Lukasz Kaiser, Noam Shazeer, and Alexander Ku. Image transformer. CoRR, abs/1802.05751, 2018. URL http://arxiv.org/abs/1802. 05751. ",
|
| 1046 |
+
"bbox": [
|
| 1047 |
+
173,
|
| 1048 |
+
103,
|
| 1049 |
+
823,
|
| 1050 |
+
146
|
| 1051 |
+
],
|
| 1052 |
+
"page_idx": 10
|
| 1053 |
+
},
|
| 1054 |
+
{
|
| 1055 |
+
"type": "text",
|
| 1056 |
+
"text": "Matt Post. A call for clarity in reporting BLEU scores. In Proceedings of the Third Conference on Machine Translation: Research Papers, pp. 186–191, Belgium, Brussels, October 2018. Association for Computational Linguistics. URL https://www.aclweb.org/anthology/ W18-6319. ",
|
| 1057 |
+
"bbox": [
|
| 1058 |
+
173,
|
| 1059 |
+
155,
|
| 1060 |
+
825,
|
| 1061 |
+
210
|
| 1062 |
+
],
|
| 1063 |
+
"page_idx": 10
|
| 1064 |
+
},
|
| 1065 |
+
{
|
| 1066 |
+
"type": "text",
|
| 1067 |
+
"text": "Alec Radford, Jeff Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. Language models are unsupervised multitask learners. 2019. ",
|
| 1068 |
+
"bbox": [
|
| 1069 |
+
173,
|
| 1070 |
+
219,
|
| 1071 |
+
823,
|
| 1072 |
+
250
|
| 1073 |
+
],
|
| 1074 |
+
"page_idx": 10
|
| 1075 |
+
},
|
| 1076 |
+
{
|
| 1077 |
+
"type": "text",
|
| 1078 |
+
"text": "Jack W Rae, Jonathan J Hunt, Tim Harley, Ivo Danihelka, Andrew Senior, Greg Wayne, Alex Graves, and Timothy P Lillicrap. Scaling memory-augmented neural networks with sparse reads and writes. In Advances in Neural Information Processing Systems, (NIPS), 2016. ",
|
| 1079 |
+
"bbox": [
|
| 1080 |
+
174,
|
| 1081 |
+
257,
|
| 1082 |
+
823,
|
| 1083 |
+
301
|
| 1084 |
+
],
|
| 1085 |
+
"page_idx": 10
|
| 1086 |
+
},
|
| 1087 |
+
{
|
| 1088 |
+
"type": "text",
|
| 1089 |
+
"text": "Prajit Ramachandran, Niki Parmar, Ashish Vaswani, Irwan Bello, Anselm Levskaya, and Jonathon Shlens. Stand-alone self-attention in vision models. CoRR, abs/1906.05909, 2019. URL http: //arxiv.org/abs/1906.05909. ",
|
| 1090 |
+
"bbox": [
|
| 1091 |
+
174,
|
| 1092 |
+
309,
|
| 1093 |
+
823,
|
| 1094 |
+
352
|
| 1095 |
+
],
|
| 1096 |
+
"page_idx": 10
|
| 1097 |
+
},
|
| 1098 |
+
{
|
| 1099 |
+
"type": "text",
|
| 1100 |
+
"text": "Adam Santoro, Sergey Bartunov, Matthew Botvinick, Daan Wierstra, and Timothy P. Lillicrap. Oneshot learning with memory-augmented neural networks. CoRR, abs/1605.06065, 2016. URL http://arxiv.org/abs/1605.06065. ",
|
| 1101 |
+
"bbox": [
|
| 1102 |
+
173,
|
| 1103 |
+
361,
|
| 1104 |
+
825,
|
| 1105 |
+
404
|
| 1106 |
+
],
|
| 1107 |
+
"page_idx": 10
|
| 1108 |
+
},
|
| 1109 |
+
{
|
| 1110 |
+
"type": "text",
|
| 1111 |
+
"text": "Noam Shazeer and Mitchell Stern. Adafactor: Adaptive learning rates with sublinear memory cost. CoRR, abs/1804.04235, 2018. URL http://arxiv.org/abs/1804.04235. ",
|
| 1112 |
+
"bbox": [
|
| 1113 |
+
173,
|
| 1114 |
+
412,
|
| 1115 |
+
823,
|
| 1116 |
+
441
|
| 1117 |
+
],
|
| 1118 |
+
"page_idx": 10
|
| 1119 |
+
},
|
| 1120 |
+
{
|
| 1121 |
+
"type": "text",
|
| 1122 |
+
"text": "Noam Shazeer, Youlong Cheng, Niki Parmar, Dustin Tran, Ashish Vaswani, Penporn Koanantakool, Peter Hawkins, HyoukJoong Lee, Mingsheng Hong, Cliff Young, Ryan Sepassi, and Blake Hechtman. Mesh-tensorflow: Deep learning for supercomputers. CoRR, abs/1811.02084, 2018. URL http://arxiv.org/abs/1811.02084. ",
|
| 1123 |
+
"bbox": [
|
| 1124 |
+
173,
|
| 1125 |
+
450,
|
| 1126 |
+
825,
|
| 1127 |
+
507
|
| 1128 |
+
],
|
| 1129 |
+
"page_idx": 10
|
| 1130 |
+
},
|
| 1131 |
+
{
|
| 1132 |
+
"type": "text",
|
| 1133 |
+
"text": "Nimit Sharad Sohoni, Christopher Richard Aberger, Megan Leszczynski, Jian Zhang, and Christopher Re. Low-memory neural network training: A technical report. ´ CoRR, abs/1904.10631, 2019. URL http://arxiv.org/abs/1904.10631. ",
|
| 1134 |
+
"bbox": [
|
| 1135 |
+
174,
|
| 1136 |
+
516,
|
| 1137 |
+
823,
|
| 1138 |
+
559
|
| 1139 |
+
],
|
| 1140 |
+
"page_idx": 10
|
| 1141 |
+
},
|
| 1142 |
+
{
|
| 1143 |
+
"type": "text",
|
| 1144 |
+
"text": "Sainbayar Sukhbaatar, Edouard Grave, Piotr Bojanowski, and Armand Joulin. Adaptive attention span in transformers. CoRR, abs/1905.07799, 2019a. URL http://arxiv.org/abs/ 1905.07799. ",
|
| 1145 |
+
"bbox": [
|
| 1146 |
+
171,
|
| 1147 |
+
568,
|
| 1148 |
+
825,
|
| 1149 |
+
609
|
| 1150 |
+
],
|
| 1151 |
+
"page_idx": 10
|
| 1152 |
+
},
|
| 1153 |
+
{
|
| 1154 |
+
"type": "text",
|
| 1155 |
+
"text": "Sainbayar Sukhbaatar, Edouard Grave, Guillaume Lample, Herve J ´ egou, and Armand Joulin. Aug- ´ menting self-attention with persistent memory. CoRR, abs/1907.01470, 2019b. URL http: //arxiv.org/abs/1907.01470. ",
|
| 1156 |
+
"bbox": [
|
| 1157 |
+
171,
|
| 1158 |
+
619,
|
| 1159 |
+
823,
|
| 1160 |
+
661
|
| 1161 |
+
],
|
| 1162 |
+
"page_idx": 10
|
| 1163 |
+
},
|
| 1164 |
+
{
|
| 1165 |
+
"type": "text",
|
| 1166 |
+
"text": "Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention is all you need. CoRR, 2017. URL http: //arxiv.org/abs/1706.03762. ",
|
| 1167 |
+
"bbox": [
|
| 1168 |
+
171,
|
| 1169 |
+
670,
|
| 1170 |
+
823,
|
| 1171 |
+
713
|
| 1172 |
+
],
|
| 1173 |
+
"page_idx": 10
|
| 1174 |
+
},
|
| 1175 |
+
{
|
| 1176 |
+
"type": "text",
|
| 1177 |
+
"text": "Jason Weston, Sumit Chopra, and Antoine Bordes. Memory networks. CoRR, abs/1410.3916, 2014. URL http://arxiv.org/abs/1410.3916. ",
|
| 1178 |
+
"bbox": [
|
| 1179 |
+
173,
|
| 1180 |
+
723,
|
| 1181 |
+
821,
|
| 1182 |
+
751
|
| 1183 |
+
],
|
| 1184 |
+
"page_idx": 10
|
| 1185 |
+
},
|
| 1186 |
+
{
|
| 1187 |
+
"type": "text",
|
| 1188 |
+
"text": "A MULTI-ROUND LSH ATTENTION",
|
| 1189 |
+
"text_level": 1,
|
| 1190 |
+
"bbox": [
|
| 1191 |
+
174,
|
| 1192 |
+
102,
|
| 1193 |
+
482,
|
| 1194 |
+
118
|
| 1195 |
+
],
|
| 1196 |
+
"page_idx": 11
|
| 1197 |
+
},
|
| 1198 |
+
{
|
| 1199 |
+
"type": "text",
|
| 1200 |
+
"text": "In this section we describe in more detail the multi-hash version of our LSH attention mechanism. We first repeat Equation (3) from the main text, which describes a general formulation of attention with sparsity: ",
|
| 1201 |
+
"bbox": [
|
| 1202 |
+
174,
|
| 1203 |
+
132,
|
| 1204 |
+
825,
|
| 1205 |
+
176
|
| 1206 |
+
],
|
| 1207 |
+
"page_idx": 11
|
| 1208 |
+
},
|
| 1209 |
+
{
|
| 1210 |
+
"type": "equation",
|
| 1211 |
+
"img_path": "images/c698a8ac04a86c2288eda3fd6b70b8d7f3fdaeebd217422220845a953a859c64.jpg",
|
| 1212 |
+
"text": "$$\no _ { i } = \\sum _ { j \\in \\widetilde { \\mathcal { P } } _ { i } } \\exp \\left( q _ { i } \\cdot k _ { j } - m ( j , \\mathcal { P } _ { i } ) - z ( i , \\mathcal { P } _ { i } ) \\right) v _ { j } \\quad \\mathrm { ~ w h e r e ~ } m ( j , \\mathcal { P } _ { i } ) = \\left\\{ \\begin{array} { l l } { \\infty } & { \\mathrm { i f ~ } j \\notin \\mathcal { P } _ { i } } \\\\ { 0 } & { \\mathrm { o t h e r w i s e } } \\end{array} \\right.\n$$",
|
| 1213 |
+
"text_format": "latex",
|
| 1214 |
+
"bbox": [
|
| 1215 |
+
210,
|
| 1216 |
+
184,
|
| 1217 |
+
782,
|
| 1218 |
+
227
|
| 1219 |
+
],
|
| 1220 |
+
"page_idx": 11
|
| 1221 |
+
},
|
| 1222 |
+
{
|
| 1223 |
+
"type": "text",
|
| 1224 |
+
"text": "In the multi-round case, a query position $i$ can attend to key positions $\\mathcal { P } _ { i }$ as defined in (6), which we also repeat here: ",
|
| 1225 |
+
"bbox": [
|
| 1226 |
+
171,
|
| 1227 |
+
239,
|
| 1228 |
+
825,
|
| 1229 |
+
270
|
| 1230 |
+
],
|
| 1231 |
+
"page_idx": 11
|
| 1232 |
+
},
|
| 1233 |
+
{
|
| 1234 |
+
"type": "equation",
|
| 1235 |
+
"img_path": "images/8bd9e21ce93bf29073f8ffb40510ff311dfb03738267269e1164385c3010bfa0.jpg",
|
| 1236 |
+
"text": "$$\n{ \\mathcal P } _ { i } = \\bigcup _ { r = 1 } ^ { n _ { r o u n d s } } { \\mathcal P } _ { i } ^ { ( r ) } \\qquad \\mathrm { w h e r e } ~ { \\mathcal P } _ { i } ^ { ( r ) } = \\Big \\{ j : h ^ { ( r ) } ( q _ { i } ) = h ^ { ( r ) } ( q _ { j } ) \\Big \\}\n$$",
|
| 1237 |
+
"text_format": "latex",
|
| 1238 |
+
"bbox": [
|
| 1239 |
+
258,
|
| 1240 |
+
275,
|
| 1241 |
+
740,
|
| 1242 |
+
318
|
| 1243 |
+
],
|
| 1244 |
+
"page_idx": 11
|
| 1245 |
+
},
|
| 1246 |
+
{
|
| 1247 |
+
"type": "text",
|
| 1248 |
+
"text": "For batching purposes, attention is performed on chunks of sorted queries/keys: ",
|
| 1249 |
+
"bbox": [
|
| 1250 |
+
173,
|
| 1251 |
+
330,
|
| 1252 |
+
694,
|
| 1253 |
+
345
|
| 1254 |
+
],
|
| 1255 |
+
"page_idx": 11
|
| 1256 |
+
},
|
| 1257 |
+
{
|
| 1258 |
+
"type": "equation",
|
| 1259 |
+
"img_path": "images/4fcd4d809d819d6a82e4fdae9ab507c0d452b5d53b5a490aa2883cd260c33f43.jpg",
|
| 1260 |
+
"text": "$$\n\\widetilde { \\mathcal { P } } _ { i } ^ { ( r ) } = \\left\\{ j : \\left\\lfloor \\frac { s _ { i } ^ { ( r ) } } { m } \\right\\rfloor - 1 \\leq \\left\\lfloor \\frac { s _ { j } ^ { ( r ) } } { m } \\right\\rfloor \\leq \\left\\lfloor \\frac { s _ { i } ^ { ( r ) } } { m } \\right\\rfloor \\right\\}\n$$",
|
| 1261 |
+
"text_format": "latex",
|
| 1262 |
+
"bbox": [
|
| 1263 |
+
336,
|
| 1264 |
+
351,
|
| 1265 |
+
661,
|
| 1266 |
+
396
|
| 1267 |
+
],
|
| 1268 |
+
"page_idx": 11
|
| 1269 |
+
},
|
| 1270 |
+
{
|
| 1271 |
+
"type": "text",
|
| 1272 |
+
"text": "Combining (3) and (6) gives: ",
|
| 1273 |
+
"bbox": [
|
| 1274 |
+
173,
|
| 1275 |
+
407,
|
| 1276 |
+
366,
|
| 1277 |
+
422
|
| 1278 |
+
],
|
| 1279 |
+
"page_idx": 11
|
| 1280 |
+
},
|
| 1281 |
+
{
|
| 1282 |
+
"type": "equation",
|
| 1283 |
+
"img_path": "images/14e11b6d03f03c3ad5351eba38b21724ea66fab063e871cfe4504b5f335c2b02.jpg",
|
| 1284 |
+
"text": "$$\n\\begin{array} { r l r } { { \\alpha _ { i } = \\sum _ { j \\in \\Gamma } \\exp ( q _ { i } \\cdot k _ { j } - m ( j , \\mathcal { P } _ { i } ) - z ( i , \\mathcal { P } _ { j } ) ) \\times } } \\\\ & { } & { \\beta _ { i } \\leq \\frac { 1 } { \\beta \\epsilon _ { i } ^ { p ( \\cdot ) } } , } \\\\ & { } & { \\gamma = \\sum _ { s = 1 } ^ { N _ { t } } \\exp ( z ( i , \\mathcal { P } _ { i } ^ { ( r ) } ) - z ( i , \\mathcal { P } _ { j } ) ) \\sum _ { j \\in \\Gamma } \\frac { 1 } { N _ { t } } \\frac { 1 } { N _ { t } } \\exp ( q _ { i } \\cdot k _ { i } - m ( j , \\mathcal { P } _ { i } ^ { ( r ) } ) - z ( i , \\mathcal { P } _ { j } ^ { ( r ) } ) ) \\times } \\\\ & { } & { \\exp ( z ( i , \\mathcal { P } _ { i } ^ { ( r ) } ) - z ( i , \\mathcal { P } _ { j } ^ { ( r ) } ) ) , } \\\\ & { } & { ( 1 3 , \\exp ( z ( i , \\mathcal { P } _ { i } ^ { ( r ) } ) - z ( i , \\mathcal { P } _ { j } ) ) \\alpha _ { i } ^ { ( r ) } } \\\\ & { } & { \\exp ( z ( i , \\mathcal { P } _ { i } ^ { ( r ) } ) - z ( i , \\mathcal { P } _ { j } ^ { ( r ) } ) ) \\exp ( z ( i , \\mathcal { P } _ { i } ^ { ( r ) } ) ) \\exp ( \\mathrm { ~ \\it 1 4 ~ } } \\\\ & { } & { \\exp ( \\phi ( i , k _ { j } - m ( i _ { j } ^ { ( r ) } ) - z ( i , \\mathcal { P } _ { j } ^ { ( r ) } ) ) ) \\exp _ { j } } \\\\ & { } & { \\beta _ { i } \\leq \\mathrm { \\it ~ \\it ~ \\it ~ \\alpha ~ } _ { j } \\leq \\mathrm { \\it ~ \\it ~ \\alpha ~ } _ { i } \\leq \\mathrm { \\it ~ \\it ~ \\alpha ~ } _ { j } } \\\\ & { } & \\exp ( N _ { t } \\exp N _ { i , j } + | \\{ \\begin{array} { l l } { \\Gamma _ { j } ^ { ( r ) } \\cdot \\xi _ { j } \\in \\mathcal { P } _ { j } ^ { ( r ) } } \\\\ { \\Gamma _ { j } ^ { ( r ) } \\cdot \\xi _ { j } \\in \\mathcal { P } _ { j } ^ { ( r ) } } \\end{array} \\} \\mathrm { ~ a n d ~ } m _ { i j } ^ ( \\end{array}\n$$",
|
| 1285 |
+
"text_format": "latex",
|
| 1286 |
+
"bbox": [
|
| 1287 |
+
171,
|
| 1288 |
+
428,
|
| 1289 |
+
820,
|
| 1290 |
+
674
|
| 1291 |
+
],
|
| 1292 |
+
"page_idx": 11
|
| 1293 |
+
},
|
| 1294 |
+
{
|
| 1295 |
+
"type": "text",
|
| 1296 |
+
"text": "Each round of LSH attention produces a vector $o _ { i } ^ { ( r ) }$ that can be computed independently from other rounds, except for the inclusion of a term $N _ { i , j }$ to avoid double-counting elements when constructing the union of $\\mathcal { P } _ { i } ^ { ( r ) }$ sets. In our implementation we fold the $N _ { i , j }$ factor into the masking term $m _ { i , j } ^ { ( r ) }$ . ",
|
| 1297 |
+
"bbox": [
|
| 1298 |
+
173,
|
| 1299 |
+
688,
|
| 1300 |
+
823,
|
| 1301 |
+
738
|
| 1302 |
+
],
|
| 1303 |
+
"page_idx": 11
|
| 1304 |
+
},
|
| 1305 |
+
{
|
| 1306 |
+
"type": "text",
|
| 1307 |
+
"text": "We also modify $m _ { i , j _ { . } } ^ { ( r ) }$ to introduce a special case for $i = j$ . This case is added because causal masking in a standard Transformer allows position to attend to itself, which is not desirable in a shared-QK formulation. We set the mask to a large but finite value to disallow attention-in-place, except in the situation where a token has no other valid attention targets. For example, the first token in a sequence attends only to itself, because no prior context is available. ",
|
| 1308 |
+
"bbox": [
|
| 1309 |
+
173,
|
| 1310 |
+
747,
|
| 1311 |
+
825,
|
| 1312 |
+
820
|
| 1313 |
+
],
|
| 1314 |
+
"page_idx": 11
|
| 1315 |
+
}
|
| 1316 |
+
]
|
parse/train/rkgNKkHtvB/rkgNKkHtvB_middle.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
parse/train/rkgNKkHtvB/rkgNKkHtvB_model.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|