ZHANGYUXUAN-zR commited on
Commit
61bac7a
·
verified ·
1 Parent(s): 869ad37

Add files using upload-large-folder tool

Browse files
parse/train/Arn2E4IRjEB/Arn2E4IRjEB.md ADDED
@@ -0,0 +1,377 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Flow Network based Generative Models for Non-Iterative Diverse Candidate Generation
2
+
3
+ Emmanuel Bengio1,2, Moksh Jain1,5, Maksym Korablyov1 Doina Precup1,2,4, Yoshua Bengio1,3 1Mila, 2McGill University, 3Université de Montréal, 4DeepMind, 5Microsof
4
+
5
+ # Abstract
6
+
7
+ This paper is about the problem of learning a stochastic policy for generating an object (like a molecular graph) from a sequence of actions, such that the probability of generating an object is proportional to a given positive reward for that object. Whereas standard return maximization tends to converge to a single return-maximizing sequence, there are cases where we would like to sample a diverse set of high-return solutions. These arise, for example, in black-box function optimization when few rounds are possible, each with large batches of queries, where the batches should be diverse, e.g., in the design of new molecules. One can also see this as a problem of approximately converting an energy function to a generative distribution. While MCMC methods can achieve that, they are expensive and generally only perform local exploration. Instead, training a generative policy amortizes the cost of search during training and yields to fast generation. Using insights from Temporal Difference learning, we propose GFlowNet, based on a view of the generative process as a flow network, making it possible to handle the tricky case where different trajectories can yield the same final state, e.g., there are many ways to sequentially add atoms to generate some molecular graph. We cast the set of trajectories as a flow and convert the flow consistency equations into a learning objective, akin to the casting of the Bellman equations into Temporal Difference methods. We prove that any global minimum of the proposed objectives yields a policy which samples from the desired distribution, and demonstrate the improved performance and diversity of GFlowNet on a simple domain where there are many modes to the reward function, and on a molecule synthesis task.
8
+
9
+ # 1 Introduction
10
+
11
+ The maximization of expected return $R$ in reinforcement learning (RL) is generally achieved by putting all the probability mass of the policy $\pi$ on the highest-return sequence of actions. In this paper, we study the scenario where our objective is not to generate the single highest-reward sequence of actions but rather to sample a distribution of trajectories whose probability is proportional to a given positive return or reward function. This can be useful in tasks where exploration is important, i.e., we want to sample from the leading modes of the return function. This is equivalent to the problem of turning an energy function into a corresponding generative model, where the object to be generated is obtained via a sequence of actions. By changing the temperature of the energy function (i.e., scaling it multiplicatively) or by taking the power of the return, one can control how selective the generator should be, i.e., only generate from around the highest modes at low temperature or explore more with a higher temperature.
12
+
13
+ A motivating application for this setup is iterative black-box optimization where the learner has access to an oracle which can compute a reward for a large batch of candidates at each round, e.g., in drug-discovery applications. Diversity of the generated candidates is particularly important when the oracle is itself uncertain, e.g., it may consist of cellular assays which is a cheap proxy for clinical trials, or it may consist of the result of a docking simulation (estimating how well a candidate small molecule binds to a target protein) which is a proxy for more accurate but more expensive downstream evaluations (like cellular assays or in-vivo assays in mice).
14
+
15
+ When calling the oracle is expensive (e.g. it involves a biological experiment), a standard way (Angermueller et al., 2020) to apply machine learning in such exploration settings is to take the data already collected from the oracle (say a set of $( x , y )$ pairs where $x$ is a candidate solution an $y$ is a scalar evaluation of $x$ from the oracle) and train a supervised proxy $f$ (viewed as a simulator) which predicts $y$ from $x$ . The function $f$ or a variant of $f$ which incorporates uncertainty about its value, like in Bayesian optimization (Srinivas et al., 2010; Negoescu et al., 2011), can then be used as a reward function $R$ to train a generative model or a policy that will produce a batch of candidates for the next experimental assays. Searching for $x$ which maximizes $R ( x )$ is not sufficient because we would like to sample for the batch of queries a representative set of $x$ ’s with high values of $R$ , i.e., around modes of $R ( x )$ . Note that alternative ways to obtain diversity exist, e.g., with batch Bayesian optimization (Kirsch et al., 2019). An advantage of the proposed approach is that the computational cost is linear in the size of the batch (by opposition with methods which compare pairs of candidates, which is at least quadratic). With the possibility of assays of a hundred thousand candidates using synthetic biology, linear scaling would be a great advantage.
16
+
17
+ In this paper, we thus focus on the specific machine learning problem of turning a given positive reward or return function into a generative policy which samples with a probability proportional to the return. In applications like the one mentioned above, we only apply the reward function after having generated a candidate, i.e., the reward is zero except in a terminal state, and the return is the terminal reward. We are in the so-called episodic setting of RL.
18
+
19
+ The proposed approach views the probability assigned to an action given a state as the flow associated with a network whose nodes are states, and outgoing edges from that node are deterministic transitions driven by an action (not to be confused with normalizing flows; Rezende and Mohamed (2016)). The total flow into the network is the sum of the rewards in the terminal states (i.e., a partition function) and can be shown to be the flow at the root node (or start state). The proposed algorithm is inspired by Bellman updates and converges when the incoming and outgoing flow into and out of each state match. A policy which chooses an action with probability proportional to the outgoing flow corresponding to that action is proven to achieve the desired result, i.e., the probability of sampling a terminal state is proportional to its reward. In addition, we show that the resulting setup is off-policy; it converges to the above solution even if the training trajectories come from a different policy, so long as it has large enough support on the state space.
20
+
21
+ The main contributions of this paper are as follows:
22
+
23
+ • We propose GFlowNet, a novel generative method for unnormalized probability distributions based on flow networks and local flow-matching conditions: the flow incoming to a state must match the outgoing flow.
24
+ • We prove crucial properties of GFlowNet, including the link between the flow-matching conditions (which many training objectives can provide) and the resulting match of the generated policy with the target reward function. We also prove its offline properties and asymptotic convergence (if the training objective can be minimized). We also demonstrate that previous related work (Buesing et al., 2019) which sees the generative process like a tree would fail when there are many action sequences which can lead to the same state.
25
+ We demonstrate on synthetic data the usefulness of departing from seeking one mode of the return, and instead seeking to model the entire distribution and all its modes.
26
+ • We successfully apply GFlowNet to a large scale molecule synthesis domain, with comparative experiments against PPO and MCMC methods.
27
+
28
+ All implementations are available at https://github.com/bengioe/gflownet.
29
+
30
+ # 2 Approximating Flow Network generative models with a TD-like objective
31
+
32
+ Consider a discrete set $\mathcal { X }$ and policy $\pi ( a | s )$ to sequentially build $x \in \mathcal { X }$ with probability $\pi ( x )$ with
33
+
34
+ $$
35
+ \pi ( x ) \approx { \frac { R ( x ) } { Z } } = { \frac { R ( x ) } { \sum _ { x ^ { \prime } \in { \mathcal { X } } } R ( x ^ { \prime } ) } }
36
+ $$
37
+
38
+ where $R ( x ) > 0$ is a reward for a terminal state $x$ . This would be useful to sample novel drug-like molecules when given a reward function $R$ that scores molecules based on their chemical properties. Being able to sample from the high modes of $R ( x )$ would provide diversity in the batches of generated molecules sent to assays. This is in contrast with the typical RL objective of maximizing return which we have found to often end up focusing around one or very few good molecules. In our context, $R ( x )$ is a proxy for the actual values obtained from assays, which means it can be called often and cheaply. $R ( x )$ is retrained or fine-tuned each time we acquire new data from the assays.
39
+
40
+ What method should one use to generate batches sampled from $\pi ( x ) \propto R ( x ) ?$ Let’s first think of the state space under which we would operate.
41
+
42
+ Let $s$ denote the set of states and $\mathcal { X } \subset \mathcal { S }$ denote the set of terminal states. Let $\mathcal { A }$ be a finite set, the alphabet, ${ \mathcal { A } } ( s ) \subseteq A$ be the set of allowed actions at state $s$ , and let $\mathcal { A } ^ { \ast } ( s )$ be the set of all sequences of actions allowed after state $s$ . To every action sequence $\vec { a } = ( a _ { 1 } , a _ { 2 } , a _ { 3 } , . . . , a _ { h } )$ of $a _ { i } \in \mathcal { A } , h \le H$ corresponds a single $x$ , i.e. the environment is deterministic so we can define a function $C$ mapping a sequence of actions $\vec { a }$ to an $x$ . If such a sequence is ‘incomplete’ we define its reward to be 0. When the correspondence between action sequences and states is bijective, a state $s$ is uniquely described by some sequence $\vec { a }$ , and we can visualize the generative process as the traversal of a tree from a single root node to a leaf corresponding to the sequence of actions along the way.
43
+
44
+ However, when this correspondence is non-injective, i.e. when multiple action sequences describe the same $x$ , things get trickier. Instead of a tree, we get a directed acyclic graph or DAG (assuming that the sequences must be of finite length, i.e., there are no deterministic cycles), as illustrated in Figure 1. For example, and of interest here, molecules can be seen as graphs, which can be described in multiple orders (canonical representations such as SMILES strings also have this problem: there may be multiple descriptions for the same actual molecule). The standard approach to such a sampling problem is to use iterative MCMC methods (Xie et al., 2021; Grathwohl et al., 2021). Another option is to relax the desire to have $p ( x ) \propto R ( x )$ and to use non-interative (sequential) RL methods (Gottipati et al., 2020), but these are at high risk of getting stuck in local maxima and of missing modes. Indeed, in our setting, the policy which maximizes the expected return (which is the expected final reward) generates the sequence with the highest return (i.e., a single molecule).
45
+
46
+ # 2.1 Flow Networks
47
+
48
+ In this section we propose the Generative Flow Network framework, or GFlowNet, which enables us to learn policies such that $p ( x ) \propto R ( x )$ when sampled. We first discuss why existing methods are inadequate, and then show how we can use the metaphor of flows, sinks and sources, to construct adequate policies. We then show that such policies can be learned via a flow-matching objective.
49
+
50
+ With existing methods in the bijective case, one can think of the sequential generation of one $x$ as an episode in a tree-structured deterministic MDP, where all leaves $x$ are terminal states (with reward $R ( x ) )$ and the root is initial state $s _ { 0 }$ . Interestingly, in such a case one can express the pseudo-value of a state $\tilde { V } ( s )$ as the sum of all the rewards of the descendants of $s$ (Buesing et al., 2019).
51
+
52
+ In the non-injective case, these methods are inadequate. Constructing $\pi ( \tau ) \approx R ( \tau ) / Z$ , e.g. as per Buesing et al. (2019), MaxEnt RL (Haarnoja et al., 2017), or via an autoregressive method (Nash and Durkan, 2019; Shi et al., 2021) has a particular problem as shown below: if multiple action sequences $\vec { a }$ (i.e. multiple trajectories $\tau$ ) lead to a final state $x$ , then a serious bias can be introduced in the generative probabilities. Let us denote ${ \vec { a } } + { \vec { b } }$ as the concatenation of the two sequences of actions $\vec { a }$ and $\vec { b }$ , and by extension $s + { \vec { b } }$ the state reached by applying the actions in $\vec { b }$ from state $s$ .
53
+
54
+ Proposition 1. Let $C : { \mathcal { A } } ^ { * } \mapsto { \mathcal { S } }$ associate each allowed action sequence $\vec { a } \in \mathcal { A } ^ { \ast }$ to a state $s = C ( \vec { a } ) \in S$ . Let $\tilde { V } : { \cal S } \mapsto { { \bf R } ^ { + } }$ associate each state $s \in S$ to $\begin{array} { r } { \tilde { V } ( s ) = \sum _ { \vec { b } \in \mathcal { A } ^ { * } ( s ) } R ( s + \vec { b } ) > 0 , } \end{array}$ where $\mathcal { A } ^ { \ast } ( s )$ is the set of allowed continuations from s and $s + { \vec { b } }$ denotes the resulting state, i.e., $\tilde { V } ( s )$ is the sum of the rewards of all the states reachable from $s$ . Consider a policy $\pi$ which starts from the state corresponding to the empty string $s _ { 0 } = C ( \emptyset )$ and chooses from state $s \in S$ an allowable action a ∈ A(s) with probability π(a|s) = $\begin{array} { r } { \pi ( a | s ) = \frac { \tilde { V } ( s + a ) } { \sum _ { b \in { \cal A } ( s ) } \tilde { V } ( s + b ) } } \end{array}$ . Denote $\pi ( \vec { a } = ( a _ { 1 } , \ldots , a _ { N } ) ) =$ $\begin{array} { r } { \prod _ { i = 1 } ^ { N } \pi ( a _ { i } | C ( a _ { 1 } , \dots , a _ { i - 1 } ) ) } \end{array}$ and $\pi ( s )$ with $s \in S$ the probability of visiting a state s with this policy. The following then obtains:
55
+ (a) $\begin{array} { r } { \dot { \pi } ( s ) = \dot { \sum } _ { \vec { a } _ { i } : C ( \vec { a } _ { i } ) = s } \pi ( \vec { a } _ { i } ) } \end{array}$ .
56
+
57
+ $( b )$ If $C$ is bijective, then $\begin{array} { r } { \pi ( s ) = \frac { \tilde { V } ( s ) } { \tilde { V } ( s _ { 0 } ) } } \end{array}$ and as a special case for terminal states $x$ , $\begin{array} { r } { \pi ( x ) = \frac { R ( x ) } { \sum _ { x \in \mathcal { X } } R ( x ) } } \end{array}$ . (c) If $C$ is non-injective and there are $n ( x )$ distinct action sequences $\vec { a } _ { i }$ s.t. $C ( \vec { a } _ { i } ) = \dot { x }$ , then $\begin{array} { r } { \pi ( x ) = \frac { n ( x ) R ( x ) } { \sum _ { x ^ { \prime } \in \mathcal { X } } n ( x ^ { \prime } ) R ( x ^ { \prime } ) } } \end{array}$ .
58
+
59
+ See Appendix A.1 for the proof. In combinatorial spaces, such as for molecules, where $C$ is noninjective (there are many ways to construct a molecule graph), this can become exponentially bad as trajectory lengths increase. It means that larger molecules would be exponentially more likely to be sampled than smaller ones, just because of the many more paths leading to them. In this scenario, the pseudo-value $\tilde { V }$ is “misinterpreting” the MDP’s structure as a tree, leading to the wrong $\pi ( x )$ .
60
+
61
+ An alternative is to see the MDP as a flow network, that is, leverage the DAG structure of the MDP, and learn a flow $F$ , rather than estimating the pseudo-value $\tilde { V }$ as a sum of descendant rewards, as elaborated below. We define the flow network as a having a single source, the root node (or initial state) $s _ { 0 }$ with in-flow $Z$ , and one sink for each leaf (or terminal state) $x$ with out-flow $R ( x ) > 0$ . We write $T ( s , a ) = s ^ { \prime }$ to denote that the state-action pair $( s , a )$ leads to state $s ^ { \prime }$ . Note that because $C$ is not a bijection, i.e., there are many paths (action sequences) leading to some node, a node can have multiple parents, i.e. $| \{ ( s , a ) \mid \bar { T ( s , a ) } = s ^ { \prime } \} | \geq 1$ , except for the root, which has no parent. We write $F ( s , a )$ for the flow between node $s$ and node $s ^ { \prime } = T ( s , a )$ , $F ( s )$ for the total flow going through $s ^ { \th }$ 1. This construction is illustrated in Fig. 1.
62
+
63
+ ![](images/390eb9d5c13ec96c0daad8748cbe2eda9e5b15367cc919510da6f556c5da8aaa.jpg)
64
+ Figure 1: A flow network MDP. Episodes start at source $s _ { 0 }$ with flow $Z$ . Like with SMILES strings, there are no cycles. Terminal states are sinks with out-flow $R ( s )$ . Exemplar state $s _ { 3 }$ has parents $\left\{ ( s , a ) | T ( s , a ) = s _ { 3 } \right\} = \left\{ ( s _ { 1 } , a _ { 2 } ) , ( s _ { 2 } , a _ { 5 } ) \right\}$ and allowed actions $\overset { \cdot } { \underset { \cdot } { A } } ( s _ { 3 } ) = \{ a _ { 4 } , a _ { 7 } \}$ . $s _ { 4 }$ is a terminal sink state with $R ( s _ { 4 } ) > 0$ and only one parent. The goal is to estimate $F ( s , a )$ such that the flow equations are satisfied for all states: for each node, incoming flow equals outgoing flow.
65
+
66
+ To satisfy flow conditions, we require that for any node, the incoming flow equals the outgoing flow, which is the total flow $F ( s )$ of node $s$ . Boundary conditions are given by the flow into the terminal nodes $x$ , $R ( x )$ . Formally, for any node $s ^ { \prime }$ , we must have that the in-flow
67
+
68
+ $$
69
+ F ( s ^ { \prime } ) = \sum _ { s , a : T ( s , a ) = s ^ { \prime } } F ( s , a )
70
+ $$
71
+
72
+ equals the out-flow
73
+
74
+ $$
75
+ F ( s ^ { \prime } ) = \sum _ { a ^ { \prime } \in \mathcal { A } ( s ^ { \prime } ) } F ( s ^ { \prime } , a ^ { \prime } ) .
76
+ $$
77
+
78
+ More concisely, with $R ( s ) = 0$ for interior nodes, and $\mathcal { A } ( s ) = \emptyset$ for leaf (sink/terminal) nodes, we write the following flow consistency equations:
79
+
80
+ $$
81
+ \sum _ { s , a : T ( s , a ) = s ^ { \prime } } F ( s , a ) = R ( s ^ { \prime } ) + \sum _ { a ^ { \prime } \in A ( s ^ { \prime } ) } F ( s ^ { \prime } , a ^ { \prime } ) .
82
+ $$
83
+
84
+ with $F$ being a flow, $F ( s , a ) > 0 \forall s , a$ (for this we needed to constrain $R ( x )$ to be positive too). One could include in principle nodes and edges with zero flow but it would make it difficult to talk about the logarithm of the flow, as we do below, and such states can always be excluded by the allowed set of actions for their parent states. Let us now show that such a flow correctly produces $\pi ( x ) = R ( x ) / Z$ when the above flow equations are satisfied.
85
+
86
+ Proposition 2. Let us define a policy $\pi$ that generates trajectories starting in state $s _ { 0 }$ by sampling actions $a \in { \mathcal { A } } ( s )$ according to
87
+
88
+ $$
89
+ \pi ( a | s ) = { \frac { F ( s , a ) } { F ( s ) } }
90
+ $$
91
+
92
+ where $F ( s , a ) > 0$ is the flow through allowed edge $( s , a )$ , $\begin{array} { r } { F ( s ) = R ( s ) + \sum _ { a \in \mathcal { A } ( s ) } F ( s , a ) } \end{array}$ where $R ( s ) = 0$ for non-terminal nodes s and $F ( x ) = R ( x ) > 0$ for terminal nodes $x$ , and the flow consistency equation $\begin{array} { r } { \sum _ { s , a : T ( s , a ) = s ^ { \prime } } F ( s , a ) = R ( s ^ { \prime } ) + \sum _ { a ^ { \prime } \in A ( s ^ { \prime } ) } F ( s ^ { \prime } , a ^ { \prime } ) } \end{array}$ is satisfied. Let $\pi ( s )$ denote the probability of visiting state $s$ when starting at $s _ { 0 }$ and following $\pi ( \cdot | \cdot )$ . Then
93
+
94
+ (a) $\begin{array} { r } { \pi ( s ) = \frac { F ( s ) } { F ( s _ { 0 } ) } } \end{array}$ (b) $\begin{array} { r } { F ( s _ { 0 } ) = \sum _ { x \in \mathcal { X } } R ( x ) } \end{array}$ (c) π(x) = P R(x)x0∈X R(x0) .
95
+
96
+ Proof. We have $\pi ( s _ { 0 } ) = 1$ since we always start in root node $s _ { 0 }$ . Note that $\begin{array} { r } { \sum _ { x \in \mathcal { X } } \pi ( x ) = 1 } \end{array}$ because terminal states are mutually exclusive, but in the case of non-bijective $C$ , we cannot say that $\textstyle \sum _ { s \in S } \pi ( s )$ equals 1 because the different states are not mutually exclusive in general. This notation is different from the one typically used in RL where $\pi ( s )$ refers to the asymptotic distribution of the Markov chain. Then
97
+
98
+ $$
99
+ \pi ( s ^ { \prime } ) = \sum _ { ( a , s ) : T ( s , a ) = s ^ { \prime } } \pi ( a | s ) \pi ( s )
100
+ $$
101
+
102
+ i.e., using Eq. 5,
103
+
104
+ $$
105
+ \pi ( s ^ { \prime } ) = \sum _ { ( a , s ) : T ( s , a ) = s ^ { \prime } } { \frac { F ( s , a ) } { F ( s ) } } \pi ( s ) .
106
+ $$
107
+
108
+ We can now conjecture that the statement
109
+
110
+ $$
111
+ \pi ( s ) = { \frac { F ( s ) } { F ( s _ { 0 } ) } }
112
+ $$
113
+
114
+ is true and prove it by induction. This is trivially true for the root, which is our base statement, since $\pi ( s _ { 0 } ) = 1$ . By induction, we then have that if the statement is true for parents $s$ of $s ^ { \prime }$ , then
115
+
116
+ $$
117
+ \pi ( s ^ { \prime } ) = \sum _ { s , a : T ( s , a ) = s ^ { \prime } } { \frac { F ( s , a ) } { F ( s ) } } { \frac { F ( s ) } { F ( s _ { 0 } ) } } = { \frac { \sum _ { s , a : T ( s , a ) = s ^ { \prime } } F ( s , a ) } { F ( s _ { 0 } ) } } = { \frac { F ( s ^ { \prime } ) } { F ( s _ { 0 } ) } }
118
+ $$
119
+
120
+ which proves the statement, i.e., the first conclusion (a) of the theorem. We can then apply it to the case of terminal states $x$ , whose flow is fixed to $F ( x ) = R ( x )$ and obtain
121
+
122
+ $$
123
+ \pi ( x ) = { \frac { R ( x ) } { F ( s _ { 0 } ) } } .
124
+ $$
125
+
126
+ Noting that $\begin{array} { r } { \sum _ { x \in X } \pi ( x ) = 1 } \end{array}$ and summing both sides of Eq. 10 over $x$ we thus obtain (b), i.e., F (s0) = Px∈X R(x). Plugging this back into Eq. 10, we obtain (c), i.e., π(x) = P R(x)x0∈X R(x0) . □
127
+
128
+ Thus our choice of $\pi ( a | s )$ satisfies our desiderata: it maps a reward function $R$ to a generative model which generates $x$ with probability $\pi ( x ) \propto R ( x )$ , whether $C$ is bijective or non-injective (the former being a special case of the latter, and we just provided a proof for the general non-injective case).
129
+
130
+ # 2.2 Objective Functions for GFlowNet
131
+
132
+ We can now leverage our RL intuitions to create a learning algorithm out of the above theoretical results. In particular, we propose to approximate the flows $F$ such that the flow consistency equations are respected at convergence with enough capacity in our estimator of $F$ , just like the Bellman equations for temporal-difference (TD) algorithms (Sutton and Barto, 2018). This could yield the following objective for a trajectory $\tau$ :
133
+
134
+ $$
135
+ \tilde { \mathcal { L } } _ { \theta } ( \tau ) = \sum _ { s ^ { \prime } \in \tau \neq s _ { 0 } } \left( \sum _ { s , a : T ( s , a ) = s ^ { \prime } } F _ { \theta } ( s , a ) - R ( s ^ { \prime } ) - \sum _ { a ^ { \prime } \in A ( s ^ { \prime } ) } F _ { \theta } ( s ^ { \prime } , a ^ { \prime } ) \right) ^ { 2 } .
136
+ $$
137
+
138
+ One issue from a learning point of view is that the flow will be very large for nodes near the root (early in the trajectory) and tiny for nodes near the leaves (late in the trajectory). In high-dimensional spaces where the cardinality of $\mathcal { X }$ is exponential (e.g., in the typical number of actions to form an $x$ ), the $F ( s , a )$ and $F ( s )$ for early states will be exponentially larger than for later states. Since we want $F ( s , a )$ to be the output of a neural network, this would lead to serious numerical issues.
139
+
140
+ To avoid this problem, we define the flow matching objective on a log-scale, where we match not the incoming and outgoing flows but their logarithms, and we train our predictor to estimate $F _ { \theta } ^ { \log } ( s , a ) = \log F ( s , a )$ , and exponentiate-sum-log the of logs: $F _ { \theta } ^ { \mathrm { l o g } }$ predictions to compute the loss, yielding
141
+
142
+ $$
143
+ \mathcal { L } _ { \theta , \epsilon } ( \tau ) = \sum _ { s ^ { \prime } \in \tau \neq s _ { 0 } } \left( \log \left[ \epsilon + \sum _ { s , a : T ( s , a ) = s ^ { \prime } } F _ { \theta } ^ { \log } ( s , a ) \right] - \log \left[ \epsilon + R ( s ^ { \prime } ) + \sum _ { a ^ { \prime } \in A ( s ^ { \prime } ) } \exp F _ { \theta } ^ { \log } ( s ^ { \prime } , a ^ { \prime } ) \right] \right) ^ { 2 }
144
+ $$
145
+
146
+ which gives equal gradient weighing to large and small magnitude predictions. Note that matching the logs of the flows is equivalent to making the ratio of the incoming and outgoing flow closer to 1. To give more weight to errors on large flows and avoid taking the logarithm of a tiny number, we compare log( $\epsilon +$ incoming flow) with log( $\epsilon +$ outgoing flow). It does not change the global minimum, which is still when the flow equations are satisfied, but it avoids numerical issues with taking the log of a tiny flow. The hyper-parameter $\epsilon$ also trades-off how much pressure we put on matching large versus small flows, and in our experiments is set to be close to the smallest value $R$ can take. Since we want to discover the top modes of $R$ , it makes sense to care more for the larger flows. Many other objectives are possible for which flow matching is also a global minimum.
147
+
148
+ An interesting advantage of such objective functions is that they yield off-policy offline methods. The predicted flows $F$ do not depend on the policy used to sample trajectories (apart from the fact that the samples should sufficiently cover the space of trajectories in order to obtain generalization). This is formalized below, which shows that we can use any broad-support policy to sample training trajectories and still obtain the correct flows and generative model, i.e., training can be off-policy.
149
+
150
+ Proposition 3. Let trajectories $\tau$ used to train $F _ { \theta }$ be sampled from an exploratory policy $P$ with the same support as the optimal $\pi$ defined in Eq. 5 for a consistent flow $F ^ { * } \in { \mathcal { F } } ^ { * }$ . A flow is consistent if Eq. 4 is respected. Also assume that $\exists \theta : F _ { \theta } = F ^ { * }$ , i.e., we choose a sufficiently rich family of predictors. Let $\theta ^ { * } \in \mathrm { a r g m i n } _ { \theta } E _ { P ( \tau ) } [ L _ { \theta } ( \tau ) ]$ a minimizer of the expected training loss. Let $L _ { \theta } ( \tau )$ have the property that when flows are matched it achieves its lowest possible value. First, it can $b e$ shown that this property is satisfied for the loss in Eq. 12. Then
151
+
152
+ $$
153
+ { \cal F } _ { \theta ^ { * } } = { \cal F } ^ { * } , \mathrm { a n d } { \cal L } _ { \theta ^ { * } } ( \tau ) = 0 \forall \tau \sim { \cal P } ( \theta ) ,
154
+ $$
155
+
156
+ i.e., a global optimum of the expected loss provides the correct flows. If πθ∗ (a|s) = P Fθ∗ (s,a)a0∈A(s) Fθ∗ (s,a0) then we also have
157
+
158
+ $$
159
+ \pi _ { \theta ^ { \ast } } ( x ) = \frac { R ( x ) } { Z } .
160
+ $$
161
+
162
+ The proof is in Appendix A.1. Note that, in RL terms, this method is akin to asynchronous dynamic programming (Sutton and Barto, 2018, $\ S 4 . 5$ ), which is an off-policy off-line method which converges provided every state is visited infinitely many times asymptotically.
163
+
164
+ # 3 Related Work
165
+
166
+ The objective of training a policy generating states with a probability proportional to rewards was presented by Buesing et al. (2019) but the proposed method only makes sense when there is a bijection between action sequences and states. In contrast, GFlowNet is applicable in the more general setting where many paths can lead to the same state. The objective to sample with probability proportional to a given unnormalized positive function is achieved by many MCMC methods (Grathwohl et al., 2021; Dai et al., 2020). However, when mixing between modes is challenging (e.g., in high-dimensional spaces with well-separated modes occupying a fraction of the total volume) convergence to the target distribution can be extremely slow. In contrast, GFlowNet is not iterative and amortizes the challenge of sampling from such modes through a training procedure which must be sufficiently exploratory.
167
+
168
+ This sampling problem comes up in molecule generation and has been studied in this context with numerous generative models (Shi et al., 2020; Jin et al., 2020; Luo et al., 2021), MCMC methods (Seff et al., 2019; Xie et al., 2021), RL (Segler et al., 2017; Cao and Kipf, 2018; Popova et al., 2019; Gottipati et al., 2020; Angermueller et al., 2020) and evolutionary methods (Brown et al., 2004; Jensen, 2019; Swersky et al., 2020). Some of these methods rely on a given set of "positive examples" (high-reward) to train a generative model, thus not taking advantage of the "negative examples" and the continuous nature of the measurements (some examples should be generated more often than others). Others rely on the traditional return maximization objectives of RL, which tends to focus on one or a few dominant modes, as we find in our experiments. Beyond molecules, there are previous works generating data non-greedily through RL (Bachman and Precup, 2015) or energy-based GANs (Dai et al., 2017).
169
+
170
+ The objective that we formulate in (12) may remind the reader of the objective of control-asinference’s Soft Q-Learning (Haarnoja et al., 2017), with the difference that we include all the parents of a state in the in-flow, whereas Soft Q-Learning only uses the parent contained in the trajectory. Soft Q-Learning induces a different policy, as shown by Proposition 1, one where $P ( \tau ) \propto R ( \tau )$ rather than $P ( x ) \propto \bar { R } ( x )$ . More generally, we only consider deterministic generative settings whereas RL is a more general framework for stochastic environments.
171
+
172
+ Literature at the intersection of network flow and deep learning is sparse, and is mostly concerned with solving maximum flow problems (Nazemi and Omidi, 2012; Chen and Zhang, 2020) or classification within existing flow networks (Rahul et al., 2017; Pekta¸s and Acarman, 2019). Finally, the idea of accounting for the search space being a DAG rather than a tree in MCTS, known as transpositions (Childs et al., 2008), also has some links with the proposed method.
173
+
174
+ # 4 Empirical Results
175
+
176
+ We first verify that GFlowNet works as advertised on an artificial domain small enough to compute the partition function exactly, and compare its abilities to recover modes compared to standard MCMC and RL methods, with its sampling distribution better matching the normalized reward. We find that GFlowNet (A) converges to $\pi ( x ) \propto R ( x )$ , (B) requires less samples to achieve some level of performance than MCMC and PPO methods and (C) recovers all the modes and does so faster than MCMC and PPO, both in terms of wall-time and number of states visited and queried. We then test GFlowNet on a large scale domain, which consists in generating small drug molecule graphs, with a reward that estimates their binding affinity to a target protein (see Appendix A.3). We find that GFlowNet finds higher reward and more diverse molecules faster than baselines.
177
+
178
+ # 4.1 A (hyper-)grid domain
179
+
180
+ Consider an MDP where states are the cells of a $n$ -dimensional hypercubic grid of side length $H$ . The agent starts at coordinate $x = ( 0 , 0 , \ldots )$ and is only allowed to increase coordinate $i$ with action $a _ { i }$ (up to $H$ , upon which the episode terminates). A stop action indicates to terminate the trajectory. There are many action sequences that lead to the same coordinate, making this MDP a DAG.The reward for ending the trajectory in $x$ is some $R ( x ) > 0$ . For MCMC methods, in order to have an ergodic chain, we allow the iteration to decrease coordinates as well, and there is no stop action.
181
+
182
+ We ran experiments with this reward function:
183
+
184
+ $$
185
+ \begin{array} { r } { R ( x ) = R _ { 0 } + R _ { 1 } \prod _ { i } \mathbb { I } ( 0 . 2 5 < | x _ { i } / H - 0 . 5 | ) + R _ { 2 } \prod _ { i } \mathbb { I } ( 0 . 3 < | x _ { i } / H - 0 . 5 | < 0 . 4 ) } \end{array}
186
+ $$
187
+
188
+ with $0 < R _ { 0 } \ll R _ { 1 } < R _ { 2 }$ , pictured when $n = 2$ on the right. For this choice of $R$ , there are only interesting rewards near the corners of the grid, and there are exactly $2 ^ { n }$ modes. We set $R _ { 1 } \stackrel { \cdot } { = } 1 / 2$ , $R _ { 2 } = 2$ . By varying $R _ { 0 }$ and setting it closer to 0, we make this problem artificially harder, creating a region of the state space which it is undesirable to explore. To measure the performance of a method, we measure the empirical L1 error $\mathbb { E } [ | p ( x ) - \pi ( { \bar { x } } ) | ]$ . $p ( x ) = R ( x ) / Z$ is known in this domain, and $\pi$ is estimated by repeated sampling and counting frequencies for each possible $x$ . We also measure the number of modes with at least 1 visit as a function of the number of states visited.
189
+
190
+ We run the above experiment for $R _ { 0 } \in \{ 1 0 ^ { - 1 } , 1 0 ^ { - 2 } , 1 0 ^ { - 3 } \}$ with $n = 4$ , $H = 8$ . In Fig. 2 we see that GFlowNet is robust to $R _ { 0 }$ and obtains a low L1 error, while a Metropolis-Hastings-MCMC based method requires exponentially more samples than GFlowNet to achieve some level of L1 error. This is apparent in Fig. 2 (with a log-scale horizontal axis) by comparing the slope of progress of GFlowNet (beyond the initial stage) and that of the MCMC sampler. We also see that MCMC takes much longer to visit each mode once as $R _ { 0 }$ decreases, while GFlowNet is only slightly affected, with GFlowNet converging to some level of L1 error faster, as per hypothesis (B). This suggests that
191
+
192
+ GFlowNet is robust to the separation between modes (represented by $R _ { 0 }$ being smaller) and thus recovers all the modes much faster than MCMC (again, noting the log-scale of the horizontal axis).
193
+
194
+ To compare to RL, we run PPO (Schulman et al., 2017). To discover all the modes in a reasonable time, we need to set the entropy maximization term much higher (0.5) than usual $( \ll 1 )$ ). We verify that PPO is not overly regularized by comparing it to a random agent. PPO finds all the modes faster than uniform sampling, but much more slowly than GFlowNet, and is also robust to the choice of $R _ { 0 }$ . This and the previous result validates hypothesis (C). We also run SAC (Haarnoja et al., 2018), finding similar or worse results. We provide additional results and discussion in Appendix A.6.
195
+
196
+ ![](images/f78e0a7efa3a201cb3d3a0ed1cb2db9072c6757469cb48b28d92d7518573dc09.jpg)
197
+ Figure 2: Hypergrid domain. Changing the task difficulty $R _ { 0 }$ to illustrate the advantage of GFlowNet over others. We see that as $R _ { 0 }$ gets smaller, MCMC struggles to fit the distribution because it struggles to visit all the modes. PPO also struggles to find all the modes, and requires very large entropy regularization, but is robust to the choice of $R _ { 0 }$ . We plot means over 10 runs for each setting.
198
+
199
+ # 4.2 Generating small molecules
200
+
201
+ Here our goal is to generate a diverse set of small molecules that have a high reward. We define a large-scale environment which allows an agent to sequentially generate molecules. This environment is challenging, with up to $1 0 ^ { 1 6 }$ states and between 100 and 2000 actions depending on the state.
202
+
203
+ We follow the framework of Jin et al. (2020) and generate molecules by parts using a predefined vocabulary of building blocks that can be joined together forming a junction tree (detailed in A.3). This is also known as fragment-based drug design (Kumar et al., 2012; Xie et al., 2021). Generating such a graph can be described as a sequence of additive edits: given a molecule and constraints of chemical validity, we choose an atom to attach a block to. The action space is thus the product of choosing where to attach a block and choosing which block to attach. There is an extra action to stop the editing sequence. This sequence of edits yields a DAG MDP, as there are multiple action sequences that lead to the same molecule graph, and no edge removal actions, which prevents cycles.
204
+
205
+ The reward is computed with a pretrained proxy model that predicts the binding energy of a molecule to a particular protein target (soluble epoxide hydrolase, sEH, see A.3). Although computing binding energy is computationally expensive, we can call this proxy cheaply. Note that for realistic drug design, we would need to consider many more quantities such as drug-likeness (Bickerton et al., 2012), toxicity, or synthesizability. Our goal here is not solve this problem, and our work situates itself within such a larger project. Instead, we want to show that given a proxy $R$ in the space of molecules, we can quickly match its induced distribution $\pi ( x ) \propto R ( x )$ and find many of its modes.
206
+
207
+ We parameterize the proxy with an MPNN (Gilmer et al., 2017) over the atom graph. Our flow predictor $F _ { \theta }$ is parameterized similarly to MARS (Xie et al., 2021), with an MPNN, but over the junction tree graph (the graph of blocks), which had better performance. For fairness, this architecture is used for both GFlowNet and the baselines. Complete details can be found in Appendix A.4.
208
+
209
+ We pretrain the proxy with a semi-curated semi-random dataset of $3 0 0 \mathrm { k }$ molecules (see A.4) down to a test MSE of 0.6; molecules are scored according to the docking score (Trott and Olson, 2010), renormalized so that most scores fall between 0 and 10 (to have $\bar { R ( } x { ) } > 0 { ) }$ . We plot the dataset’s reward distribution in Fig. 3. We train all generative models with up to $1 0 ^ { 6 }$ molecules. During training, sampling follows exploratory policy $P ( \boldsymbol { a } | \boldsymbol { s } )$ which is a mixture between $\pi ( a | s )$ (Eq. 5), used with probability 0.95, and a uniform distribution over allowed actions with probability 0.05.
210
+
211
+ Experimental results In Fig. 3 we show the empirical distribution of rewards in two settings; first when we train our model with $R ( x )$ , then with ${ \bar { R } } ( x ) ^ { \beta }$ . If GFlowNet learns a reasonable policy $\pi$ this should shift the distribution to the right. This is indeed what we observe. We compare GFlowNet to MARS (Xie et al., 2021), known to work well in the molecule domain, and observe the same shift. Note that GFlowNet finds more high reward molecules than MARS with these $\beta$ values; this is consistent with the hypothesis that it finds high-reward modes faster (since MARS is an MCMC method, it would eventually converge to the same distribution, but takes more time).
212
+
213
+ ![](images/56144c31df71789119b3f527b0faeaa77f9787cb0bbabacc12616ad4ac31580d.jpg)
214
+ Figure 3: Empirical density of rewards. We verify that GFlowNet is consistent by training it with $R ^ { \beta }$ , $\beta = 4$ , which has the hypothesized effect of shifting the density to the right.
215
+
216
+ ![](images/ae057cac7ada7b6e331edd1d4fc3208b0beff1c559881aabc17c7e680348ab95.jpg)
217
+ Figure 4: The average reward of the top- $k$ as a function of learning (averaged over 3 runs). Only unique hits are counted. Note the log scale. Our method finds more unique good molecules faster.
218
+
219
+ In Fig. 4, we show the average reward of the top- $k$ molecules found so far, without allowing for duplicates (based on SMILES). We compare GFlowNet with MARS, PPO, and JT-VAE (Jin et al., 2020) with Bayesian Optimization. As expected, PPO plateaus after a while; RL tends to be satisfied with good enough trajectories unless it is strongly regularized with exploration mechanisms. For GFlowNet and for MARS, the more molecules are visited, the better they become, with a slow convergence towards the proxy’s max reward. Given the same compute time, $\scriptstyle \mathbf { J } \mathbf { T } - \mathbf { V } \mathbf { A } \mathbf { E } + \mathbf { B } \mathbf { O }$ generates only about $1 0 ^ { 3 }$ molecules (due to its expensive Gaussian Process) and so does not perform well.
220
+
221
+ The maximum reward in the proxy’s dataset is 10, with only 233 examples above 8. In our best run, we find 2339 unique molecules during training with a score above 8, only 39 of which are in the dataset. We compute the average pairwise Tanimoto similarity for the top 1000 samples: GFlowNet has a mean of $0 . 4 4 \pm 0 . 0 1$ , PPO, $0 . 6 2 \pm 0 . 0 3$ , and MARS, $0 . 5 9 \pm 0 . 0 2$ (mean and std over 3 runs). As expected, our MCMC baseline (MARS) and RL baseline (PPO) find less diverse candidates. We also find that GFlowNet discovers many more modes $( > 1 5 0 0$ with $R > 8$ vs $< 1 0 0$ for MARS). This is shown in Fig. 5 where we consider a mode to be a Bemis-Murcko scaffold (Bemis and Murcko, 1996), counted for molecules above a certain reward threshold. We provide additional insights into how GFlowNet matches the rewards in Appendix A.7.
222
+
223
+ ![](images/4f6c3d3fd8d0bad63785195c8151dd88346a1ad41ea3cef93552e73c8e733869.jpg)
224
+ Figure 5: Number of diverse Bemis-Murcko scaffolds found above reward threshold $T$ as a function of the number of molecules seen. Left, $T = 7 . 5$ . Right, $T = 8$ .
225
+
226
+ # 4.3 Multi-Round Experiments
227
+
228
+ To demonstrate the importance of diverse candidate generation in an active learning setting, we consider a sequential acquisition task. We simulate the setting where there is a limited budget for calls to the true oracle $O$ . We use a proxy $M$ initialized by training on a limited dataset of $( x , R ( x ) )$
229
+
230
+ pairs $D _ { 0 }$ , where $R ( x )$ is the true reward from the oracle. The generative model $\left( \pi _ { \boldsymbol { \theta } } \right)$ is trained to fit to the unnormalized probability function learned by the proxy $M$ . We then sample a batch $B = \{ x _ { 1 } , x _ { 2 } , . . . x _ { k } \}$ where $x _ { i } \sim \pi _ { \theta }$ , which is evaluated with the oracle $O$ . The proxy $M$ is updated with this newly acquired and labeled batch, and the process is repeated for $N$ iterations. We discuss the experimental setting in more detail in Appendix A.5.
231
+
232
+ ![](images/57f77d159cae3745834d0ddf9b599ff5f9e8a19b8e5dd554012b7e815a7b0fe3.jpg)
233
+ Figure 6: The top- $\mathbf { \nabla } \cdot \mathbf { k }$ return (mean over 3 runs) in the 4-D Hyper-grid task with active learning. GFlowNet gets the highest return faster.
234
+
235
+ ![](images/6b4940bf58465c3496eea9644bbc71a972ddbd721a83526315b3b6676df6500d.jpg)
236
+ Figure 7: The top- $\mathbf { \nabla } \cdot \mathbf { k }$ docking reward (mean over 3 runs) in the molecule task with active learning. GFlowNet consistently generates better samples.
237
+
238
+ Hyper-grid domain We present results for the multi-round task in the 4-D hyper-grid domain in Figure 6. We use a Gaussian Process (Williams and Rasmussen, 1995) as the proxy. We compare the Top- $k$ Return for all the methods, which is defined as mean(t $\mathrm { \gamma } \mathrm { p } { - } k ( D _ { i } ) ) { - } \mathrm { m e a n } \big ( \mathrm { t o p } { - } k ( D _ { i - 1 } ) \big )$ , where $D _ { i }$ is the dataset of points acquired until step $i$ , and $k = 1 0$ for this experiment. The initial dataset $D _ { 0 }$ $\left. \left| D _ { 0 } \right| \right. = \left. 5 1 2 \right.$ is the same for all the methods compared. We observe that GFlowNet consistently outperforms the baselines in terms of return over the initial set. We also observe that the mean pairwise L2-distance between the top - $k$ points at the end of the final round is $0 . 8 3 \pm 0 . 0 3$ , $0 . 6 1 \pm 0 . 0 1$ and $0 . 5 1 \pm 0 . 0 2$ for GFlowNet, MCMC and PPO respectively. This demonstrates the ability of GFlowNet to capture the modes, even in the absence of the true oracle, as well as the importance of capturing this diversity in multi-round settings.
239
+
240
+ Small Molecules For the molecule discovery task, we initialize an MPNN proxy to predict docking scores from AutoDock (Trott and Olson, 2010), with $| D _ { 0 } | = 2 0 0 0$ molecules. At the end of each round we generate 200 molecules which are evaluated with AutoDock and used to update the proxy. Figure 7 shows GFlowNet discovers molecules with significantly higher energies than the initial set $D _ { 0 }$ . It also consistently outperforms MARS as well as Random Acquisition. PPO training was unstable and diverged consistently so the numbers are not reported. The mean pairwise Tanimoto similarity in the initial set is 0.60. At the end of the final round, it is $0 . 5 4 \pm 0 . 0 4$ for GFlowNet and $0 . 6 4 \pm 0 . 0 3$ for MARS. This further demonstrates the ability of GFlowNet to generate diverse candidates, which ultimately helps improve the final performance on the task. Similar to the single step setting, we observe that JT-VAE $+ \mathrm { B O }$ is only able to generate $1 0 ^ { 3 }$ molecules with similar compute time, and thus performs poorly.
241
+
242
+ # 5 Discussion & Limitations
243
+
244
+ In this paper we have introduced a novel TD-like objective for learning a flow for each state and (state, action) pair such that policies sampling actions proportional to these flows draw terminal states in proportion to their reward. This can be seen as an alternative approach to turn an energy function into a fast generative model, without the need for an iterative method like that needed with MCMC methods, and with the advantage that when training succeeds, the policy generates a great diversity of samples near the main modes of the target distribution without being slowed by issues of mixing between modes.
245
+
246
+ Limitations. One downside of the proposed method is that, as for TD-based methods, the use of bootstrapping may cause optimization challenges (Kumar et al., 2020; Bengio et al., 2020) and limit its performance. In applications like drug discovery, sampling from the regions surrounding each mode is already an important advantage, but future work should investigate how to combine such a generative approach to local optimization in order to refine the generated samples and approach the local maxima of reward while keeping the batches of candidates diverse.
247
+
248
+ Negative Social Impact. The authors do not foresee negative social impacts of this work specifically.
249
+
250
+ # Acknowledgments and Disclosure of Funding
251
+
252
+ This research was enabled in part by computational resources provided by Calcul Québec (www. calculquebec.ca) and Compute Canada (www.computecanada.ca). All authors are funded by their primary academic institution. We also acknowledge funding from Samsung Electronics Co., Ldt., CIFAR and IBM.
253
+
254
+ The authors are grateful to Andrei Nica for generating the molecule dataset, to Maria Kadukova for advice on molecular docking, to Harsh Satija for feedback on the paper, as well as to all the members of the Mila Molecule Discovery team for the many research discussions on the challenges we faced.
255
+
256
+ # Author Contributions
257
+
258
+ EB and YB contributed to the original idea, and wrote most sections of the paper. YB wrote the proofs of Propositions 1-3, EB the proof of Proposition 4. EB wrote the code and ran experiments for sections 4.1 (hypergrid) and 4.2 (small molecules). MJ wrote the code and ran experiments for section 4.3 (multi-round) and wrote the corresponding results section of the paper. MK wrote the biochemical framework upon which the molecule experiments are built, assisted in debugging and running experiments for section 4.3, implemented mode-counting routines used in 4.2, and wrote the biochemical details of the paper.
259
+
260
+ MK, DP and YB provided supervision for the project. All authors contributed to proofreading and editing the paper.
261
+
262
+ # References
263
+
264
+ Christof Angermueller, David Dohan, David Belanger, Ramya Deshpande, Kevin Murphy, and Lucy Colwell. Model-based reinforcement learning for biological sequence design. In International Conference on Learning Representations, 2020.
265
+ Philip Bachman and Doina Precup. Data generation as sequential decision making. Advances in Neural Information Processing Systems, 28:3249–3257, 2015.
266
+ Guy W Bemis and Mark A Murcko. The properties of known drugs. 1. molecular frameworks. Journal of medicinal chemistry, 39(15):2887–2893, 1996.
267
+ Emmanuel Bengio, Joelle Pineau, and Doina Precup. Interference and generalization in temporal difference learning. In International Conference on Machine Learning, pages 767–777. PMLR, 2020.
268
+ G Richard Bickerton, Gaia V Paolini, Jérémy Besnard, Sorel Muresan, and Andrew L Hopkins. Quantifying the chemical beauty of drugs. Nature chemistry, 4(2):90–98, 2012.
269
+ Nathan Brown, Ben McKay, François Gilardoni, and Johann Gasteiger. A graph-based genetic algorithm and its application to the multiobjective evolution of median molecules. Journal of chemical information and computer sciences, 44(3):1079–1087, 2004.
270
+ Lars Buesing, Nicolas Heess, and Theophane Weber. Approximate inference in discrete distributions with monte carlo tree search and value functions, 2019.
271
+ Nicola De Cao and Thomas Kipf. Molgan: An implicit generative model for small molecular graphs, 2018.
272
+ Yize Chen and Baosen Zhang. Learning to solve network flow problems via neural decoding. arXiv preprint arXiv:2002.04091, 2020.
273
+ Benjamin E Childs, James H Brodeur, and Levente Kocsis. Transpositions and move groups in monte carlo tree search. In 2008 IEEE Symposium On Computational Intelligence and Games, pages 389–395. IEEE, 2008.
274
+ Hanjun Dai, Rishabh Singh, Bo Dai, Charles Sutton, and Dale Schuurmans. Learning discrete energy-based models via auxiliary-variable local exploration. In Neural Information Processing Systems (NeurIPS), 2020.
275
+
276
+ Zihang Dai, Amjad Almahairi, Philip Bachman, Eduard Hovy, and Aaron Courville. Calibrating energy-based generative adversarial networks. arXiv preprint arXiv:1702.01691, 2017.
277
+
278
+ Justin Gilmer, Samuel S. Schoenholz, Patrick F. Riley, Oriol Vinyals, and George E. Dahl. Neural message passing for quantum chemistry, 2017.
279
+
280
+ Sai Krishna Gottipati, Boris Sattarov, Sufeng Niu, Yashaswi Pathak, Haoran Wei, Shengchao Liu, Karam M. J. Thomas, Simon Blackburn, Connor W. Coley, Jian Tang, Sarath Chandar, and Yoshua Bengio. Learning to navigate the synthetically accessible chemical space using reinforcement learning, 2020.
281
+
282
+ Will Grathwohl, Kevin Swersky, Milad Hashemi, David Duvenaud, and Chris J. Maddison. Oops i took a gradient: Scalable sampling for discrete distributions, 2021.
283
+
284
+ Tuomas Haarnoja, Haoran Tang, Pieter Abbeel, and Sergey Levine. Reinforcement learning with deep energy-based policies. In International Conference on Machine Learning, pages 1352–1361. PMLR, 2017.
285
+
286
+ Tuomas Haarnoja, Aurick Zhou, Pieter Abbeel, and Sergey Levine. Soft actor-critic: Off-policy maximum entropy deep reinforcement learning with a stochastic actor, 2018.
287
+
288
+ Jan H Jensen. A graph-based genetic algorithm and generative model/monte carlo tree search for the exploration of chemical space. Chemical science, 10(12):3567–3572, 2019.
289
+
290
+ Wengong Jin, Regina Barzilay, and Tommi Jaakkola. Chapter 11. junction tree variational autoencoder for molecular graph generation. Drug Discovery, page 228–249, 2020. ISSN 2041-3211. doi: 10. 1039/9781788016841-00228. URL http://dx.doi.org/10.1039/9781788016841-00228.
291
+
292
+ Andreas Kirsch, Joost van Amersfoort, and Yarin Gal. Batchbald: Efficient and diverse batch acquisition for deep bayesian active learning, 2019.
293
+
294
+ Ashutosh Kumar, A Voet, and KYJ Zhang. Fragment based drug design: from experimental to computational approaches. Current medicinal chemistry, 19(30):5128–5147, 2012.
295
+
296
+ Aviral Kumar, Rishabh Agarwal, Dibya Ghosh, and Sergey Levine. Implicit under-parameterization inhibits data-efficient deep reinforcement learning, 2020.
297
+
298
+ Greg Landrum. Rdkit: Open-source cheminformatics. URL http://www.rdkit.org.
299
+
300
+ Youzhi Luo, Keqiang Yan, and Shuiwang Ji. Graphdf: A discrete flow model for molecular graph generation, 2021.
301
+
302
+ Charlie Nash and Conor Durkan. Autoregressive energy machines, 2019.
303
+
304
+ Alireza Nazemi and Farahnaz Omidi. A capable neural network model for solving the maximum flow problem. Journal of Computational and Applied Mathematics, 236(14):3498–3513, 2012.
305
+
306
+ Diana M. Negoescu, Peter I. Frazier, and Warren B. Powell. The knowledge-gradient algorithm for sequencing experiments in drug discovery. 23(3):346–363, 2011. ISSN 1526-5528. doi: 10.1287/ijoc.1100.0417. URL https://doi.org/10.1287/ijoc.1100.0417.
307
+
308
+ Andrew Y Ng, Stuart J Russell, et al. Algorithms for inverse reinforcement learning. In Icml, volume 1, page 2, 2000.
309
+
310
+ Adam Paszke, Sam Gross, Francisco Massa, Adam Lerer, James Bradbury, Gregory Chanan, Trevor Killeen, Zeming Lin, Natalia Gimelshein, Luca Antiga, Alban Desmaison, Andreas Kopf, Edward Yang, Zachary DeVito, Martin Raison, Alykhan Tejani, Sasank Chilamkurthy, Benoit Steiner, Lu Fang, Junjie Bai, and Soumith Chintala. Pytorch: An imperative style, high-performance deep learning library. In H. Wallach, H. Larochelle, A. Beygelzimer, F. d'Alché- Buc, E. Fox, and R. Garnett, editors, Advances in Neural Information Processing Systems 32, pages 8024–8035. Curran Associates, Inc., 2019. URL http://papers.neurips.cc/paper/ 9015-pytorch-an-imperative-style-high-performance-deep-learning-library. pdf.
311
+
312
+ Abdurrahman Pekta¸s and Tankut Acarman. Deep learning to detect botnet via network flow summaries. Neural Computing and Applications, 31(11):8021–8033, 2019.
313
+
314
+ Mariya Popova, Mykhailo Shvets, Junier Oliva, and Olexandr Isayev. Molecularrnn: Generating realistic molecular graphs with optimized properties, 2019.
315
+
316
+ RK Rahul, T Anjali, Vijay Krishna Menon, and KP Soman. Deep learning for network flow analysis and malware classification. In International Symposium on Security in Computing and Communication, pages 226–235. Springer, 2017.
317
+
318
+ Danilo Jimenez Rezende and Shakir Mohamed. Variational inference with normalizing flows, 2016.
319
+
320
+ John Schulman, Filip Wolski, Prafulla Dhariwal, Alec Radford, and Oleg Klimov. Proximal policy optimization algorithms, 2017.
321
+
322
+ Ari Seff, Wenda Zhou, Farhan Damani, Abigail Doyle, and Ryan P Adams. Discrete object generation with reversible inductive construction. arXiv preprint arXiv:1907.08268, 2019.
323
+
324
+ Marwin H. S. Segler, Thierry Kogej, Christian Tyrchan, and Mark P. Waller. Generating focussed molecule libraries for drug discovery with recurrent neural networks, 2017.
325
+
326
+ Chence Shi, Minkai Xu, Zhaocheng Zhu, Weinan Zhang, Ming Zhang, and Jian Tang. Graphaf: a flow-based autoregressive model for molecular graph generation, 2020.
327
+
328
+ Yunsheng Shi, Zhengjie Huang, Shikun Feng, Hui Zhong, Wenjin Wang, and Yu Sun. Masked label prediction: Unified message passing model for semi-supervised classification, 2021.
329
+
330
+ Niranjan Srinivas, Andreas Krause, S. Kakade, and M. Seeger. Gaussian process optimization in the bandit setting: No regret and experimental design. In ICML, 2010.
331
+
332
+ Teague Sterling and John J Irwin. Zinc 15–ligand discovery for everyone. Journal of chemical information and modeling, 55(11):2324–2337, 2015.
333
+
334
+ Richard S Sutton and Andrew G Barto. Reinforcement learning: An introduction. MIT press, 2018.
335
+
336
+ Kevin Swersky, Yulia Rubanova, David Dohan, and Kevin Murphy. Amortized bayesian optimization over discrete spaces. In Conference on Uncertainty in Artificial Intelligence, pages 769–778. PMLR, 2020.
337
+
338
+ Oleg Trott and Arthur J Olson. Autodock vina: improving the speed and accuracy of docking with a new scoring function, efficient optimization, and multithreading. Journal of computational chemistry, 31(2):455–461, 2010.
339
+
340
+ C. K. Williams and C. Rasmussen. Gaussian processes for regression. In Neural Information Processing Systems (NeurIPS), 1995.
341
+
342
+ Yutong Xie, Chence Shi, Hao Zhou, Yuwei Yang, Weinan Zhang, Yong Yu, and Lei Li. {MARS}: Markov molecular sampling for multi-objective drug discovery. In International Conference on Learning Representations, 2021. URL https://openreview.net/forum?id=kHSu4ebxFXY.
343
+
344
+ # Checklist
345
+
346
+ 1. For all authors...
347
+
348
+ (a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes] We provide proofs (see Section 2 and Appendix) for our theoretical claims and fair empirical results with our proposed methods and baselines (see Section 4).
349
+ (b) Did you describe the limitations of your work? [Yes] GFlowNet is limited by its use of bootstrapping, which is known to be challenging in Deep RL (see Section 5).
350
+ (c) Did you discuss any potential negative societal impacts of your work? [Yes] Our theoretical work is fairly agnostic to applications, and aims to compete with existing MCMC-based methods (see Sections 1, 4, and 5). Our empirical work situates itself in the context of automated drug-discovery.
351
+
352
+ (d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
353
+
354
+ 2. If you are including theoretical results...
355
+
356
+ (a) Did you state the full set of assumptions of all theoretical results? [Yes] (b) Did you include complete proofs of all theoretical results? [Yes] All complete proofs are available in the Appendix.
357
+
358
+ 3. If you ran experiments...
359
+
360
+ (a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes]
361
+ (b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] Hyperparameters and architectural choices are reported in the Appendix, and verifiable in the provided code.
362
+ (c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [No] We omit error bars for clarity, but we report standard deviations in the Appendix to verify the significance of our results.
363
+ (d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] See A.3.
364
+
365
+ 4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
366
+
367
+ (a) If your work uses existing assets, did you cite the creators? [Yes]
368
+ (b) Did you mention the license of the assets? [N/A]
369
+ (c) Did you include any new assets either in the supplemental material or as a URL? [N/A]
370
+ (d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A]
371
+ (e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A]
372
+
373
+ 5. If you used crowdsourcing or conducted research with human subjects...
374
+
375
+ (a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
376
+ (b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
377
+ (c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
parse/train/Arn2E4IRjEB/Arn2E4IRjEB_content_list.json ADDED
@@ -0,0 +1,1847 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "type": "text",
4
+ "text": "Flow Network based Generative Models for Non-Iterative Diverse Candidate Generation ",
5
+ "text_level": 1,
6
+ "bbox": [
7
+ 232,
8
+ 122,
9
+ 766,
10
+ 172
11
+ ],
12
+ "page_idx": 0
13
+ },
14
+ {
15
+ "type": "text",
16
+ "text": "Emmanuel Bengio1,2, Moksh Jain1,5, Maksym Korablyov1 Doina Precup1,2,4, Yoshua Bengio1,3 1Mila, 2McGill University, 3Université de Montréal, 4DeepMind, 5Microsof ",
17
+ "bbox": [
18
+ 245,
19
+ 219,
20
+ 743,
21
+ 265
22
+ ],
23
+ "page_idx": 0
24
+ },
25
+ {
26
+ "type": "text",
27
+ "text": "Abstract ",
28
+ "text_level": 1,
29
+ "bbox": [
30
+ 462,
31
+ 300,
32
+ 535,
33
+ 318
34
+ ],
35
+ "page_idx": 0
36
+ },
37
+ {
38
+ "type": "text",
39
+ "text": "This paper is about the problem of learning a stochastic policy for generating an object (like a molecular graph) from a sequence of actions, such that the probability of generating an object is proportional to a given positive reward for that object. Whereas standard return maximization tends to converge to a single return-maximizing sequence, there are cases where we would like to sample a diverse set of high-return solutions. These arise, for example, in black-box function optimization when few rounds are possible, each with large batches of queries, where the batches should be diverse, e.g., in the design of new molecules. One can also see this as a problem of approximately converting an energy function to a generative distribution. While MCMC methods can achieve that, they are expensive and generally only perform local exploration. Instead, training a generative policy amortizes the cost of search during training and yields to fast generation. Using insights from Temporal Difference learning, we propose GFlowNet, based on a view of the generative process as a flow network, making it possible to handle the tricky case where different trajectories can yield the same final state, e.g., there are many ways to sequentially add atoms to generate some molecular graph. We cast the set of trajectories as a flow and convert the flow consistency equations into a learning objective, akin to the casting of the Bellman equations into Temporal Difference methods. We prove that any global minimum of the proposed objectives yields a policy which samples from the desired distribution, and demonstrate the improved performance and diversity of GFlowNet on a simple domain where there are many modes to the reward function, and on a molecule synthesis task. ",
40
+ "bbox": [
41
+ 232,
42
+ 330,
43
+ 766,
44
+ 633
45
+ ],
46
+ "page_idx": 0
47
+ },
48
+ {
49
+ "type": "text",
50
+ "text": "1 Introduction ",
51
+ "text_level": 1,
52
+ "bbox": [
53
+ 174,
54
+ 657,
55
+ 310,
56
+ 675
57
+ ],
58
+ "page_idx": 0
59
+ },
60
+ {
61
+ "type": "text",
62
+ "text": "The maximization of expected return $R$ in reinforcement learning (RL) is generally achieved by putting all the probability mass of the policy $\\pi$ on the highest-return sequence of actions. In this paper, we study the scenario where our objective is not to generate the single highest-reward sequence of actions but rather to sample a distribution of trajectories whose probability is proportional to a given positive return or reward function. This can be useful in tasks where exploration is important, i.e., we want to sample from the leading modes of the return function. This is equivalent to the problem of turning an energy function into a corresponding generative model, where the object to be generated is obtained via a sequence of actions. By changing the temperature of the energy function (i.e., scaling it multiplicatively) or by taking the power of the return, one can control how selective the generator should be, i.e., only generate from around the highest modes at low temperature or explore more with a higher temperature. ",
63
+ "bbox": [
64
+ 174,
65
+ 689,
66
+ 825,
67
+ 840
68
+ ],
69
+ "page_idx": 0
70
+ },
71
+ {
72
+ "type": "text",
73
+ "text": "A motivating application for this setup is iterative black-box optimization where the learner has access to an oracle which can compute a reward for a large batch of candidates at each round, e.g., in drug-discovery applications. Diversity of the generated candidates is particularly important when the oracle is itself uncertain, e.g., it may consist of cellular assays which is a cheap proxy for clinical trials, or it may consist of the result of a docking simulation (estimating how well a candidate small molecule binds to a target protein) which is a proxy for more accurate but more expensive downstream evaluations (like cellular assays or in-vivo assays in mice). ",
74
+ "bbox": [
75
+ 174,
76
+ 847,
77
+ 823,
78
+ 904
79
+ ],
80
+ "page_idx": 0
81
+ },
82
+ {
83
+ "type": "text",
84
+ "text": "",
85
+ "bbox": [
86
+ 174,
87
+ 90,
88
+ 823,
89
+ 133
90
+ ],
91
+ "page_idx": 1
92
+ },
93
+ {
94
+ "type": "text",
95
+ "text": "When calling the oracle is expensive (e.g. it involves a biological experiment), a standard way (Angermueller et al., 2020) to apply machine learning in such exploration settings is to take the data already collected from the oracle (say a set of $( x , y )$ pairs where $x$ is a candidate solution an $y$ is a scalar evaluation of $x$ from the oracle) and train a supervised proxy $f$ (viewed as a simulator) which predicts $y$ from $x$ . The function $f$ or a variant of $f$ which incorporates uncertainty about its value, like in Bayesian optimization (Srinivas et al., 2010; Negoescu et al., 2011), can then be used as a reward function $R$ to train a generative model or a policy that will produce a batch of candidates for the next experimental assays. Searching for $x$ which maximizes $R ( x )$ is not sufficient because we would like to sample for the batch of queries a representative set of $x$ ’s with high values of $R$ , i.e., around modes of $R ( x )$ . Note that alternative ways to obtain diversity exist, e.g., with batch Bayesian optimization (Kirsch et al., 2019). An advantage of the proposed approach is that the computational cost is linear in the size of the batch (by opposition with methods which compare pairs of candidates, which is at least quadratic). With the possibility of assays of a hundred thousand candidates using synthetic biology, linear scaling would be a great advantage. ",
96
+ "bbox": [
97
+ 174,
98
+ 140,
99
+ 825,
100
+ 333
101
+ ],
102
+ "page_idx": 1
103
+ },
104
+ {
105
+ "type": "text",
106
+ "text": "In this paper, we thus focus on the specific machine learning problem of turning a given positive reward or return function into a generative policy which samples with a probability proportional to the return. In applications like the one mentioned above, we only apply the reward function after having generated a candidate, i.e., the reward is zero except in a terminal state, and the return is the terminal reward. We are in the so-called episodic setting of RL. ",
107
+ "bbox": [
108
+ 174,
109
+ 339,
110
+ 825,
111
+ 409
112
+ ],
113
+ "page_idx": 1
114
+ },
115
+ {
116
+ "type": "text",
117
+ "text": "The proposed approach views the probability assigned to an action given a state as the flow associated with a network whose nodes are states, and outgoing edges from that node are deterministic transitions driven by an action (not to be confused with normalizing flows; Rezende and Mohamed (2016)). The total flow into the network is the sum of the rewards in the terminal states (i.e., a partition function) and can be shown to be the flow at the root node (or start state). The proposed algorithm is inspired by Bellman updates and converges when the incoming and outgoing flow into and out of each state match. A policy which chooses an action with probability proportional to the outgoing flow corresponding to that action is proven to achieve the desired result, i.e., the probability of sampling a terminal state is proportional to its reward. In addition, we show that the resulting setup is off-policy; it converges to the above solution even if the training trajectories come from a different policy, so long as it has large enough support on the state space. ",
118
+ "bbox": [
119
+ 174,
120
+ 415,
121
+ 825,
122
+ 568
123
+ ],
124
+ "page_idx": 1
125
+ },
126
+ {
127
+ "type": "text",
128
+ "text": "The main contributions of this paper are as follows: ",
129
+ "bbox": [
130
+ 174,
131
+ 574,
132
+ 511,
133
+ 588
134
+ ],
135
+ "page_idx": 1
136
+ },
137
+ {
138
+ "type": "text",
139
+ "text": "• We propose GFlowNet, a novel generative method for unnormalized probability distributions based on flow networks and local flow-matching conditions: the flow incoming to a state must match the outgoing flow. \n• We prove crucial properties of GFlowNet, including the link between the flow-matching conditions (which many training objectives can provide) and the resulting match of the generated policy with the target reward function. We also prove its offline properties and asymptotic convergence (if the training objective can be minimized). We also demonstrate that previous related work (Buesing et al., 2019) which sees the generative process like a tree would fail when there are many action sequences which can lead to the same state. \nWe demonstrate on synthetic data the usefulness of departing from seeking one mode of the return, and instead seeking to model the entire distribution and all its modes. \n• We successfully apply GFlowNet to a large scale molecule synthesis domain, with comparative experiments against PPO and MCMC methods. ",
140
+ "bbox": [
141
+ 205,
142
+ 594,
143
+ 825,
144
+ 789
145
+ ],
146
+ "page_idx": 1
147
+ },
148
+ {
149
+ "type": "text",
150
+ "text": "All implementations are available at https://github.com/bengioe/gflownet. ",
151
+ "bbox": [
152
+ 174,
153
+ 795,
154
+ 717,
155
+ 810
156
+ ],
157
+ "page_idx": 1
158
+ },
159
+ {
160
+ "type": "text",
161
+ "text": "2 Approximating Flow Network generative models with a TD-like objective ",
162
+ "text_level": 1,
163
+ "bbox": [
164
+ 176,
165
+ 829,
166
+ 816,
167
+ 847
168
+ ],
169
+ "page_idx": 1
170
+ },
171
+ {
172
+ "type": "text",
173
+ "text": "Consider a discrete set $\\mathcal { X }$ and policy $\\pi ( a | s )$ to sequentially build $x \\in \\mathcal { X }$ with probability $\\pi ( x )$ with ",
174
+ "bbox": [
175
+ 174,
176
+ 859,
177
+ 818,
178
+ 876
179
+ ],
180
+ "page_idx": 1
181
+ },
182
+ {
183
+ "type": "equation",
184
+ "img_path": "images/0723c164a902cd15483925d2c374ec5dedc95f3e7b6edbcf81b5f95f3d9d1019.jpg",
185
+ "text": "$$\n\\pi ( x ) \\approx { \\frac { R ( x ) } { Z } } = { \\frac { R ( x ) } { \\sum _ { x ^ { \\prime } \\in { \\mathcal { X } } } R ( x ^ { \\prime } ) } }\n$$",
186
+ "text_format": "latex",
187
+ "bbox": [
188
+ 392,
189
+ 880,
190
+ 606,
191
+ 916
192
+ ],
193
+ "page_idx": 1
194
+ },
195
+ {
196
+ "type": "text",
197
+ "text": "where $R ( x ) > 0$ is a reward for a terminal state $x$ . This would be useful to sample novel drug-like molecules when given a reward function $R$ that scores molecules based on their chemical properties. Being able to sample from the high modes of $R ( x )$ would provide diversity in the batches of generated molecules sent to assays. This is in contrast with the typical RL objective of maximizing return which we have found to often end up focusing around one or very few good molecules. In our context, $R ( x )$ is a proxy for the actual values obtained from assays, which means it can be called often and cheaply. $R ( x )$ is retrained or fine-tuned each time we acquire new data from the assays. ",
198
+ "bbox": [
199
+ 174,
200
+ 90,
201
+ 825,
202
+ 189
203
+ ],
204
+ "page_idx": 2
205
+ },
206
+ {
207
+ "type": "text",
208
+ "text": "What method should one use to generate batches sampled from $\\pi ( x ) \\propto R ( x ) ?$ Let’s first think of the state space under which we would operate. ",
209
+ "bbox": [
210
+ 173,
211
+ 194,
212
+ 823,
213
+ 223
214
+ ],
215
+ "page_idx": 2
216
+ },
217
+ {
218
+ "type": "text",
219
+ "text": "Let $s$ denote the set of states and $\\mathcal { X } \\subset \\mathcal { S }$ denote the set of terminal states. Let $\\mathcal { A }$ be a finite set, the alphabet, ${ \\mathcal { A } } ( s ) \\subseteq A$ be the set of allowed actions at state $s$ , and let $\\mathcal { A } ^ { \\ast } ( s )$ be the set of all sequences of actions allowed after state $s$ . To every action sequence $\\vec { a } = ( a _ { 1 } , a _ { 2 } , a _ { 3 } , . . . , a _ { h } )$ of $a _ { i } \\in \\mathcal { A } , h \\le H$ corresponds a single $x$ , i.e. the environment is deterministic so we can define a function $C$ mapping a sequence of actions $\\vec { a }$ to an $x$ . If such a sequence is ‘incomplete’ we define its reward to be 0. When the correspondence between action sequences and states is bijective, a state $s$ is uniquely described by some sequence $\\vec { a }$ , and we can visualize the generative process as the traversal of a tree from a single root node to a leaf corresponding to the sequence of actions along the way. ",
220
+ "bbox": [
221
+ 173,
222
+ 228,
223
+ 825,
224
+ 340
225
+ ],
226
+ "page_idx": 2
227
+ },
228
+ {
229
+ "type": "text",
230
+ "text": "However, when this correspondence is non-injective, i.e. when multiple action sequences describe the same $x$ , things get trickier. Instead of a tree, we get a directed acyclic graph or DAG (assuming that the sequences must be of finite length, i.e., there are no deterministic cycles), as illustrated in Figure 1. For example, and of interest here, molecules can be seen as graphs, which can be described in multiple orders (canonical representations such as SMILES strings also have this problem: there may be multiple descriptions for the same actual molecule). The standard approach to such a sampling problem is to use iterative MCMC methods (Xie et al., 2021; Grathwohl et al., 2021). Another option is to relax the desire to have $p ( x ) \\propto R ( x )$ and to use non-interative (sequential) RL methods (Gottipati et al., 2020), but these are at high risk of getting stuck in local maxima and of missing modes. Indeed, in our setting, the policy which maximizes the expected return (which is the expected final reward) generates the sequence with the highest return (i.e., a single molecule). ",
231
+ "bbox": [
232
+ 173,
233
+ 345,
234
+ 825,
235
+ 498
236
+ ],
237
+ "page_idx": 2
238
+ },
239
+ {
240
+ "type": "text",
241
+ "text": "2.1 Flow Networks ",
242
+ "text_level": 1,
243
+ "bbox": [
244
+ 174,
245
+ 515,
246
+ 318,
247
+ 530
248
+ ],
249
+ "page_idx": 2
250
+ },
251
+ {
252
+ "type": "text",
253
+ "text": "In this section we propose the Generative Flow Network framework, or GFlowNet, which enables us to learn policies such that $p ( x ) \\propto R ( x )$ when sampled. We first discuss why existing methods are inadequate, and then show how we can use the metaphor of flows, sinks and sources, to construct adequate policies. We then show that such policies can be learned via a flow-matching objective. ",
254
+ "bbox": [
255
+ 174,
256
+ 540,
257
+ 825,
258
+ 597
259
+ ],
260
+ "page_idx": 2
261
+ },
262
+ {
263
+ "type": "text",
264
+ "text": "With existing methods in the bijective case, one can think of the sequential generation of one $x$ as an episode in a tree-structured deterministic MDP, where all leaves $x$ are terminal states (with reward $R ( x ) )$ and the root is initial state $s _ { 0 }$ . Interestingly, in such a case one can express the pseudo-value of a state $\\tilde { V } ( s )$ as the sum of all the rewards of the descendants of $s$ (Buesing et al., 2019). ",
265
+ "bbox": [
266
+ 174,
267
+ 602,
268
+ 823,
269
+ 660
270
+ ],
271
+ "page_idx": 2
272
+ },
273
+ {
274
+ "type": "text",
275
+ "text": "In the non-injective case, these methods are inadequate. Constructing $\\pi ( \\tau ) \\approx R ( \\tau ) / Z$ , e.g. as per Buesing et al. (2019), MaxEnt RL (Haarnoja et al., 2017), or via an autoregressive method (Nash and Durkan, 2019; Shi et al., 2021) has a particular problem as shown below: if multiple action sequences $\\vec { a }$ (i.e. multiple trajectories $\\tau$ ) lead to a final state $x$ , then a serious bias can be introduced in the generative probabilities. Let us denote ${ \\vec { a } } + { \\vec { b } }$ as the concatenation of the two sequences of actions $\\vec { a }$ and $\\vec { b }$ , and by extension $s + { \\vec { b } }$ the state reached by applying the actions in $\\vec { b }$ from state $s$ . ",
276
+ "bbox": [
277
+ 173,
278
+ 666,
279
+ 825,
280
+ 756
281
+ ],
282
+ "page_idx": 2
283
+ },
284
+ {
285
+ "type": "text",
286
+ "text": "Proposition 1. Let $C : { \\mathcal { A } } ^ { * } \\mapsto { \\mathcal { S } }$ associate each allowed action sequence $\\vec { a } \\in \\mathcal { A } ^ { \\ast }$ to a state $s = C ( \\vec { a } ) \\in S$ . Let $\\tilde { V } : { \\cal S } \\mapsto { { \\bf R } ^ { + } }$ associate each state $s \\in S$ to $\\begin{array} { r } { \\tilde { V } ( s ) = \\sum _ { \\vec { b } \\in \\mathcal { A } ^ { * } ( s ) } R ( s + \\vec { b } ) > 0 , } \\end{array}$ where $\\mathcal { A } ^ { \\ast } ( s )$ is the set of allowed continuations from s and $s + { \\vec { b } }$ denotes the resulting state, i.e., $\\tilde { V } ( s )$ is the sum of the rewards of all the states reachable from $s$ . Consider a policy $\\pi$ which starts from the state corresponding to the empty string $s _ { 0 } = C ( \\emptyset )$ and chooses from state $s \\in S$ an allowable action a ∈ A(s) with probability π(a|s) = $\\begin{array} { r } { \\pi ( a | s ) = \\frac { \\tilde { V } ( s + a ) } { \\sum _ { b \\in { \\cal A } ( s ) } \\tilde { V } ( s + b ) } } \\end{array}$ . Denote $\\pi ( \\vec { a } = ( a _ { 1 } , \\ldots , a _ { N } ) ) =$ $\\begin{array} { r } { \\prod _ { i = 1 } ^ { N } \\pi ( a _ { i } | C ( a _ { 1 } , \\dots , a _ { i - 1 } ) ) } \\end{array}$ and $\\pi ( s )$ with $s \\in S$ the probability of visiting a state s with this policy. The following then obtains: \n(a) $\\begin{array} { r } { \\dot { \\pi } ( s ) = \\dot { \\sum } _ { \\vec { a } _ { i } : C ( \\vec { a } _ { i } ) = s } \\pi ( \\vec { a } _ { i } ) } \\end{array}$ . ",
287
+ "bbox": [
288
+ 173,
289
+ 762,
290
+ 826,
291
+ 915
292
+ ],
293
+ "page_idx": 2
294
+ },
295
+ {
296
+ "type": "text",
297
+ "text": "$( b )$ If $C$ is bijective, then $\\begin{array} { r } { \\pi ( s ) = \\frac { \\tilde { V } ( s ) } { \\tilde { V } ( s _ { 0 } ) } } \\end{array}$ and as a special case for terminal states $x$ , $\\begin{array} { r } { \\pi ( x ) = \\frac { R ( x ) } { \\sum _ { x \\in \\mathcal { X } } R ( x ) } } \\end{array}$ . (c) If $C$ is non-injective and there are $n ( x )$ distinct action sequences $\\vec { a } _ { i }$ s.t. $C ( \\vec { a } _ { i } ) = \\dot { x }$ , then $\\begin{array} { r } { \\pi ( x ) = \\frac { n ( x ) R ( x ) } { \\sum _ { x ^ { \\prime } \\in \\mathcal { X } } n ( x ^ { \\prime } ) R ( x ^ { \\prime } ) } } \\end{array}$ . ",
298
+ "bbox": [
299
+ 173,
300
+ 88,
301
+ 825,
302
+ 148
303
+ ],
304
+ "page_idx": 3
305
+ },
306
+ {
307
+ "type": "text",
308
+ "text": "See Appendix A.1 for the proof. In combinatorial spaces, such as for molecules, where $C$ is noninjective (there are many ways to construct a molecule graph), this can become exponentially bad as trajectory lengths increase. It means that larger molecules would be exponentially more likely to be sampled than smaller ones, just because of the many more paths leading to them. In this scenario, the pseudo-value $\\tilde { V }$ is “misinterpreting” the MDP’s structure as a tree, leading to the wrong $\\pi ( x )$ . ",
309
+ "bbox": [
310
+ 173,
311
+ 156,
312
+ 825,
313
+ 229
314
+ ],
315
+ "page_idx": 3
316
+ },
317
+ {
318
+ "type": "text",
319
+ "text": "An alternative is to see the MDP as a flow network, that is, leverage the DAG structure of the MDP, and learn a flow $F$ , rather than estimating the pseudo-value $\\tilde { V }$ as a sum of descendant rewards, as elaborated below. We define the flow network as a having a single source, the root node (or initial state) $s _ { 0 }$ with in-flow $Z$ , and one sink for each leaf (or terminal state) $x$ with out-flow $R ( x ) > 0$ . We write $T ( s , a ) = s ^ { \\prime }$ to denote that the state-action pair $( s , a )$ leads to state $s ^ { \\prime }$ . Note that because $C$ is not a bijection, i.e., there are many paths (action sequences) leading to some node, a node can have multiple parents, i.e. $| \\{ ( s , a ) \\mid \\bar { T ( s , a ) } = s ^ { \\prime } \\} | \\geq 1$ , except for the root, which has no parent. We write $F ( s , a )$ for the flow between node $s$ and node $s ^ { \\prime } = T ( s , a )$ , $F ( s )$ for the total flow going through $s ^ { \\th }$ 1. This construction is illustrated in Fig. 1. ",
320
+ "bbox": [
321
+ 173,
322
+ 234,
323
+ 826,
324
+ 362
325
+ ],
326
+ "page_idx": 3
327
+ },
328
+ {
329
+ "type": "image",
330
+ "img_path": "images/390eb9d5c13ec96c0daad8748cbe2eda9e5b15367cc919510da6f556c5da8aaa.jpg",
331
+ "image_caption": [
332
+ "Figure 1: A flow network MDP. Episodes start at source $s _ { 0 }$ with flow $Z$ . Like with SMILES strings, there are no cycles. Terminal states are sinks with out-flow $R ( s )$ . Exemplar state $s _ { 3 }$ has parents $\\left\\{ ( s , a ) | T ( s , a ) = s _ { 3 } \\right\\} = \\left\\{ ( s _ { 1 } , a _ { 2 } ) , ( s _ { 2 } , a _ { 5 } ) \\right\\}$ and allowed actions $\\overset { \\cdot } { \\underset { \\cdot } { A } } ( s _ { 3 } ) = \\{ a _ { 4 } , a _ { 7 } \\}$ . $s _ { 4 }$ is a terminal sink state with $R ( s _ { 4 } ) > 0$ and only one parent. The goal is to estimate $F ( s , a )$ such that the flow equations are satisfied for all states: for each node, incoming flow equals outgoing flow. "
333
+ ],
334
+ "image_footnote": [],
335
+ "bbox": [
336
+ 246,
337
+ 375,
338
+ 746,
339
+ 487
340
+ ],
341
+ "page_idx": 3
342
+ },
343
+ {
344
+ "type": "text",
345
+ "text": "To satisfy flow conditions, we require that for any node, the incoming flow equals the outgoing flow, which is the total flow $F ( s )$ of node $s$ . Boundary conditions are given by the flow into the terminal nodes $x$ , $R ( x )$ . Formally, for any node $s ^ { \\prime }$ , we must have that the in-flow ",
346
+ "bbox": [
347
+ 173,
348
+ 577,
349
+ 826,
350
+ 618
351
+ ],
352
+ "page_idx": 3
353
+ },
354
+ {
355
+ "type": "equation",
356
+ "img_path": "images/6a8df3398bbf6f4f12444dc3e54dfc616ddd58b189bad2764e0c30e185e41571.jpg",
357
+ "text": "$$\nF ( s ^ { \\prime } ) = \\sum _ { s , a : T ( s , a ) = s ^ { \\prime } } F ( s , a )\n$$",
358
+ "text_format": "latex",
359
+ "bbox": [
360
+ 401,
361
+ 622,
362
+ 596,
363
+ 659
364
+ ],
365
+ "page_idx": 3
366
+ },
367
+ {
368
+ "type": "text",
369
+ "text": "equals the out-flow ",
370
+ "bbox": [
371
+ 174,
372
+ 662,
373
+ 300,
374
+ 676
375
+ ],
376
+ "page_idx": 3
377
+ },
378
+ {
379
+ "type": "equation",
380
+ "img_path": "images/6e6ea01bc624453c34f7510a387923550cbe44d86c5482673fe056c8a626b8de.jpg",
381
+ "text": "$$\nF ( s ^ { \\prime } ) = \\sum _ { a ^ { \\prime } \\in \\mathcal { A } ( s ^ { \\prime } ) } F ( s ^ { \\prime } , a ^ { \\prime } ) .\n$$",
382
+ "text_format": "latex",
383
+ "bbox": [
384
+ 408,
385
+ 675,
386
+ 589,
387
+ 712
388
+ ],
389
+ "page_idx": 3
390
+ },
391
+ {
392
+ "type": "text",
393
+ "text": "More concisely, with $R ( s ) = 0$ for interior nodes, and $\\mathcal { A } ( s ) = \\emptyset$ for leaf (sink/terminal) nodes, we write the following flow consistency equations: ",
394
+ "bbox": [
395
+ 174,
396
+ 713,
397
+ 823,
398
+ 741
399
+ ],
400
+ "page_idx": 3
401
+ },
402
+ {
403
+ "type": "equation",
404
+ "img_path": "images/59aaf587e0145d5c3810e4ce7c4cff6de11c7d560d140b640c5cdfd5a48cef77.jpg",
405
+ "text": "$$\n\\sum _ { s , a : T ( s , a ) = s ^ { \\prime } } F ( s , a ) = R ( s ^ { \\prime } ) + \\sum _ { a ^ { \\prime } \\in A ( s ^ { \\prime } ) } F ( s ^ { \\prime } , a ^ { \\prime } ) .\n$$",
406
+ "text_format": "latex",
407
+ "bbox": [
408
+ 333,
409
+ 746,
410
+ 665,
411
+ 782
412
+ ],
413
+ "page_idx": 3
414
+ },
415
+ {
416
+ "type": "text",
417
+ "text": "with $F$ being a flow, $F ( s , a ) > 0 \\forall s , a$ (for this we needed to constrain $R ( x )$ to be positive too). One could include in principle nodes and edges with zero flow but it would make it difficult to talk about the logarithm of the flow, as we do below, and such states can always be excluded by the allowed set of actions for their parent states. Let us now show that such a flow correctly produces $\\pi ( x ) = R ( x ) / Z$ when the above flow equations are satisfied. ",
418
+ "bbox": [
419
+ 173,
420
+ 792,
421
+ 825,
422
+ 863
423
+ ],
424
+ "page_idx": 3
425
+ },
426
+ {
427
+ "type": "text",
428
+ "text": "Proposition 2. Let us define a policy $\\pi$ that generates trajectories starting in state $s _ { 0 }$ by sampling actions $a \\in { \\mathcal { A } } ( s )$ according to ",
429
+ "bbox": [
430
+ 168,
431
+ 90,
432
+ 825,
433
+ 119
434
+ ],
435
+ "page_idx": 4
436
+ },
437
+ {
438
+ "type": "equation",
439
+ "img_path": "images/ef05dc8e9f8dec6cff30946f2053cb0c42703f7db0971e2d3cbfafe6d0ad5c89.jpg",
440
+ "text": "$$\n\\pi ( a | s ) = { \\frac { F ( s , a ) } { F ( s ) } }\n$$",
441
+ "text_format": "latex",
442
+ "bbox": [
443
+ 437,
444
+ 123,
445
+ 560,
446
+ 157
447
+ ],
448
+ "page_idx": 4
449
+ },
450
+ {
451
+ "type": "text",
452
+ "text": "where $F ( s , a ) > 0$ is the flow through allowed edge $( s , a )$ , $\\begin{array} { r } { F ( s ) = R ( s ) + \\sum _ { a \\in \\mathcal { A } ( s ) } F ( s , a ) } \\end{array}$ where $R ( s ) = 0$ for non-terminal nodes s and $F ( x ) = R ( x ) > 0$ for terminal nodes $x$ , and the flow consistency equation $\\begin{array} { r } { \\sum _ { s , a : T ( s , a ) = s ^ { \\prime } } F ( s , a ) = R ( s ^ { \\prime } ) + \\sum _ { a ^ { \\prime } \\in A ( s ^ { \\prime } ) } F ( s ^ { \\prime } , a ^ { \\prime } ) } \\end{array}$ is satisfied. Let $\\pi ( s )$ denote the probability of visiting state $s$ when starting at $s _ { 0 }$ and following $\\pi ( \\cdot | \\cdot )$ . Then ",
453
+ "bbox": [
454
+ 173,
455
+ 160,
456
+ 826,
457
+ 222
458
+ ],
459
+ "page_idx": 4
460
+ },
461
+ {
462
+ "type": "text",
463
+ "text": "(a) $\\begin{array} { r } { \\pi ( s ) = \\frac { F ( s ) } { F ( s _ { 0 } ) } } \\end{array}$ (b) $\\begin{array} { r } { F ( s _ { 0 } ) = \\sum _ { x \\in \\mathcal { X } } R ( x ) } \\end{array}$ (c) π(x) = P R(x)x0∈X R(x0) . ",
464
+ "bbox": [
465
+ 171,
466
+ 223,
467
+ 343,
468
+ 281
469
+ ],
470
+ "page_idx": 4
471
+ },
472
+ {
473
+ "type": "text",
474
+ "text": "Proof. We have $\\pi ( s _ { 0 } ) = 1$ since we always start in root node $s _ { 0 }$ . Note that $\\begin{array} { r } { \\sum _ { x \\in \\mathcal { X } } \\pi ( x ) = 1 } \\end{array}$ because terminal states are mutually exclusive, but in the case of non-bijective $C$ , we cannot say that $\\textstyle \\sum _ { s \\in S } \\pi ( s )$ equals 1 because the different states are not mutually exclusive in general. This notation is different from the one typically used in RL where $\\pi ( s )$ refers to the asymptotic distribution of the Markov chain. Then ",
475
+ "bbox": [
476
+ 173,
477
+ 292,
478
+ 825,
479
+ 364
480
+ ],
481
+ "page_idx": 4
482
+ },
483
+ {
484
+ "type": "equation",
485
+ "img_path": "images/72fd7d73a3aa16ee3dc379e973b7362a6f63ad99d80bdc454ab1c85350cf093b.jpg",
486
+ "text": "$$\n\\pi ( s ^ { \\prime } ) = \\sum _ { ( a , s ) : T ( s , a ) = s ^ { \\prime } } \\pi ( a | s ) \\pi ( s )\n$$",
487
+ "text_format": "latex",
488
+ "bbox": [
489
+ 385,
490
+ 358,
491
+ 612,
492
+ 395
493
+ ],
494
+ "page_idx": 4
495
+ },
496
+ {
497
+ "type": "text",
498
+ "text": "i.e., using Eq. 5, ",
499
+ "bbox": [
500
+ 173,
501
+ 396,
502
+ 282,
503
+ 411
504
+ ],
505
+ "page_idx": 4
506
+ },
507
+ {
508
+ "type": "equation",
509
+ "img_path": "images/8be396e0c5177c4197edd0d4de84302398435f4ce1b7c5391b7e77137a82d835.jpg",
510
+ "text": "$$\n\\pi ( s ^ { \\prime } ) = \\sum _ { ( a , s ) : T ( s , a ) = s ^ { \\prime } } { \\frac { F ( s , a ) } { F ( s ) } } \\pi ( s ) .\n$$",
511
+ "text_format": "latex",
512
+ "bbox": [
513
+ 379,
514
+ 407,
515
+ 619,
516
+ 449
517
+ ],
518
+ "page_idx": 4
519
+ },
520
+ {
521
+ "type": "text",
522
+ "text": "We can now conjecture that the statement ",
523
+ "bbox": [
524
+ 174,
525
+ 449,
526
+ 446,
527
+ 464
528
+ ],
529
+ "page_idx": 4
530
+ },
531
+ {
532
+ "type": "equation",
533
+ "img_path": "images/5cf0cbe78c9ccd1ebdb014b26ac01a6a8bcd158767645a0024c320fa7d2c97a1.jpg",
534
+ "text": "$$\n\\pi ( s ) = { \\frac { F ( s ) } { F ( s _ { 0 } ) } }\n$$",
535
+ "text_format": "latex",
536
+ "bbox": [
537
+ 449,
538
+ 467,
539
+ 549,
540
+ 501
541
+ ],
542
+ "page_idx": 4
543
+ },
544
+ {
545
+ "type": "text",
546
+ "text": "is true and prove it by induction. This is trivially true for the root, which is our base statement, since $\\pi ( s _ { 0 } ) = 1$ . By induction, we then have that if the statement is true for parents $s$ of $s ^ { \\prime }$ , then ",
547
+ "bbox": [
548
+ 169,
549
+ 503,
550
+ 823,
551
+ 532
552
+ ],
553
+ "page_idx": 4
554
+ },
555
+ {
556
+ "type": "equation",
557
+ "img_path": "images/a9c97a6cf2533a95838558914acfc8f67237b870fa753bd8b9ee137806b93032.jpg",
558
+ "text": "$$\n\\pi ( s ^ { \\prime } ) = \\sum _ { s , a : T ( s , a ) = s ^ { \\prime } } { \\frac { F ( s , a ) } { F ( s ) } } { \\frac { F ( s ) } { F ( s _ { 0 } ) } } = { \\frac { \\sum _ { s , a : T ( s , a ) = s ^ { \\prime } } F ( s , a ) } { F ( s _ { 0 } ) } } = { \\frac { F ( s ^ { \\prime } ) } { F ( s _ { 0 } ) } }\n$$",
559
+ "text_format": "latex",
560
+ "bbox": [
561
+ 259,
562
+ 535,
563
+ 738,
564
+ 579
565
+ ],
566
+ "page_idx": 4
567
+ },
568
+ {
569
+ "type": "text",
570
+ "text": "which proves the statement, i.e., the first conclusion (a) of the theorem. We can then apply it to the case of terminal states $x$ , whose flow is fixed to $F ( x ) = R ( x )$ and obtain ",
571
+ "bbox": [
572
+ 173,
573
+ 588,
574
+ 825,
575
+ 617
576
+ ],
577
+ "page_idx": 4
578
+ },
579
+ {
580
+ "type": "equation",
581
+ "img_path": "images/0439cdc68bff7812a51f845f20fe4a544fc8a659d248946603c60dbc01b104ab.jpg",
582
+ "text": "$$\n\\pi ( x ) = { \\frac { R ( x ) } { F ( s _ { 0 } ) } } .\n$$",
583
+ "text_format": "latex",
584
+ "bbox": [
585
+ 446,
586
+ 621,
587
+ 552,
588
+ 655
589
+ ],
590
+ "page_idx": 4
591
+ },
592
+ {
593
+ "type": "text",
594
+ "text": "Noting that $\\begin{array} { r } { \\sum _ { x \\in X } \\pi ( x ) = 1 } \\end{array}$ and summing both sides of Eq. 10 over $x$ we thus obtain (b), i.e., F (s0) = Px∈X R(x). Plugging this back into Eq. 10, we obtain (c), i.e., π(x) = P R(x)x0∈X R(x0) . □ ",
595
+ "bbox": [
596
+ 174,
597
+ 657,
598
+ 826,
599
+ 696
600
+ ],
601
+ "page_idx": 4
602
+ },
603
+ {
604
+ "type": "text",
605
+ "text": "Thus our choice of $\\pi ( a | s )$ satisfies our desiderata: it maps a reward function $R$ to a generative model which generates $x$ with probability $\\pi ( x ) \\propto R ( x )$ , whether $C$ is bijective or non-injective (the former being a special case of the latter, and we just provided a proof for the general non-injective case). ",
606
+ "bbox": [
607
+ 173,
608
+ 709,
609
+ 826,
610
+ 752
611
+ ],
612
+ "page_idx": 4
613
+ },
614
+ {
615
+ "type": "text",
616
+ "text": "2.2 Objective Functions for GFlowNet ",
617
+ "text_level": 1,
618
+ "bbox": [
619
+ 174,
620
+ 760,
621
+ 452,
622
+ 775
623
+ ],
624
+ "page_idx": 4
625
+ },
626
+ {
627
+ "type": "text",
628
+ "text": "We can now leverage our RL intuitions to create a learning algorithm out of the above theoretical results. In particular, we propose to approximate the flows $F$ such that the flow consistency equations are respected at convergence with enough capacity in our estimator of $F$ , just like the Bellman equations for temporal-difference (TD) algorithms (Sutton and Barto, 2018). This could yield the following objective for a trajectory $\\tau$ : ",
629
+ "bbox": [
630
+ 174,
631
+ 781,
632
+ 825,
633
+ 853
634
+ ],
635
+ "page_idx": 4
636
+ },
637
+ {
638
+ "type": "equation",
639
+ "img_path": "images/fc2249bfcf70828fdaaf4a2a4b0a97344b91e44b51b91a16f6524ccf2e109103.jpg",
640
+ "text": "$$\n\\tilde { \\mathcal { L } } _ { \\theta } ( \\tau ) = \\sum _ { s ^ { \\prime } \\in \\tau \\neq s _ { 0 } } \\left( \\sum _ { s , a : T ( s , a ) = s ^ { \\prime } } F _ { \\theta } ( s , a ) - R ( s ^ { \\prime } ) - \\sum _ { a ^ { \\prime } \\in A ( s ^ { \\prime } ) } F _ { \\theta } ( s ^ { \\prime } , a ^ { \\prime } ) \\right) ^ { 2 } .\n$$",
641
+ "text_format": "latex",
642
+ "bbox": [
643
+ 281,
644
+ 858,
645
+ 717,
646
+ 910
647
+ ],
648
+ "page_idx": 4
649
+ },
650
+ {
651
+ "type": "text",
652
+ "text": "One issue from a learning point of view is that the flow will be very large for nodes near the root (early in the trajectory) and tiny for nodes near the leaves (late in the trajectory). In high-dimensional spaces where the cardinality of $\\mathcal { X }$ is exponential (e.g., in the typical number of actions to form an $x$ ), the $F ( s , a )$ and $F ( s )$ for early states will be exponentially larger than for later states. Since we want $F ( s , a )$ to be the output of a neural network, this would lead to serious numerical issues. ",
653
+ "bbox": [
654
+ 174,
655
+ 90,
656
+ 825,
657
+ 161
658
+ ],
659
+ "page_idx": 5
660
+ },
661
+ {
662
+ "type": "text",
663
+ "text": "To avoid this problem, we define the flow matching objective on a log-scale, where we match not the incoming and outgoing flows but their logarithms, and we train our predictor to estimate $F _ { \\theta } ^ { \\log } ( s , a ) = \\log F ( s , a )$ , and exponentiate-sum-log the of logs: $F _ { \\theta } ^ { \\mathrm { l o g } }$ predictions to compute the loss, yielding ",
664
+ "bbox": [
665
+ 174,
666
+ 166,
667
+ 823,
668
+ 226
669
+ ],
670
+ "page_idx": 5
671
+ },
672
+ {
673
+ "type": "equation",
674
+ "img_path": "images/127271c49256a237d802a8df35f9cbecb8bb4cffca0f5a0fb96cd54f2be7ab7a.jpg",
675
+ "text": "$$\n\\mathcal { L } _ { \\theta , \\epsilon } ( \\tau ) = \\sum _ { s ^ { \\prime } \\in \\tau \\neq s _ { 0 } } \\left( \\log \\left[ \\epsilon + \\sum _ { s , a : T ( s , a ) = s ^ { \\prime } } F _ { \\theta } ^ { \\log } ( s , a ) \\right] - \\log \\left[ \\epsilon + R ( s ^ { \\prime } ) + \\sum _ { a ^ { \\prime } \\in A ( s ^ { \\prime } ) } \\exp F _ { \\theta } ^ { \\log } ( s ^ { \\prime } , a ^ { \\prime } ) \\right] \\right) ^ { 2 }\n$$",
676
+ "text_format": "latex",
677
+ "bbox": [
678
+ 181,
679
+ 232,
680
+ 785,
681
+ 285
682
+ ],
683
+ "page_idx": 5
684
+ },
685
+ {
686
+ "type": "text",
687
+ "text": "which gives equal gradient weighing to large and small magnitude predictions. Note that matching the logs of the flows is equivalent to making the ratio of the incoming and outgoing flow closer to 1. To give more weight to errors on large flows and avoid taking the logarithm of a tiny number, we compare log( $\\epsilon +$ incoming flow) with log( $\\epsilon +$ outgoing flow). It does not change the global minimum, which is still when the flow equations are satisfied, but it avoids numerical issues with taking the log of a tiny flow. The hyper-parameter $\\epsilon$ also trades-off how much pressure we put on matching large versus small flows, and in our experiments is set to be close to the smallest value $R$ can take. Since we want to discover the top modes of $R$ , it makes sense to care more for the larger flows. Many other objectives are possible for which flow matching is also a global minimum. ",
688
+ "bbox": [
689
+ 173,
690
+ 290,
691
+ 826,
692
+ 416
693
+ ],
694
+ "page_idx": 5
695
+ },
696
+ {
697
+ "type": "text",
698
+ "text": "An interesting advantage of such objective functions is that they yield off-policy offline methods. The predicted flows $F$ do not depend on the policy used to sample trajectories (apart from the fact that the samples should sufficiently cover the space of trajectories in order to obtain generalization). This is formalized below, which shows that we can use any broad-support policy to sample training trajectories and still obtain the correct flows and generative model, i.e., training can be off-policy. ",
699
+ "bbox": [
700
+ 173,
701
+ 421,
702
+ 826,
703
+ 491
704
+ ],
705
+ "page_idx": 5
706
+ },
707
+ {
708
+ "type": "text",
709
+ "text": "Proposition 3. Let trajectories $\\tau$ used to train $F _ { \\theta }$ be sampled from an exploratory policy $P$ with the same support as the optimal $\\pi$ defined in Eq. 5 for a consistent flow $F ^ { * } \\in { \\mathcal { F } } ^ { * }$ . A flow is consistent if Eq. 4 is respected. Also assume that $\\exists \\theta : F _ { \\theta } = F ^ { * }$ , i.e., we choose a sufficiently rich family of predictors. Let $\\theta ^ { * } \\in \\mathrm { a r g m i n } _ { \\theta } E _ { P ( \\tau ) } [ L _ { \\theta } ( \\tau ) ]$ a minimizer of the expected training loss. Let $L _ { \\theta } ( \\tau )$ have the property that when flows are matched it achieves its lowest possible value. First, it can $b e$ shown that this property is satisfied for the loss in Eq. 12. Then ",
710
+ "bbox": [
711
+ 173,
712
+ 494,
713
+ 826,
714
+ 579
715
+ ],
716
+ "page_idx": 5
717
+ },
718
+ {
719
+ "type": "equation",
720
+ "img_path": "images/c4ca2c999b9a0eb89f409cb0b6802a0608367e2f93fcfeafb0de4d84ea4c37e7.jpg",
721
+ "text": "$$\n{ \\cal F } _ { \\theta ^ { * } } = { \\cal F } ^ { * } , \\mathrm { a n d } { \\cal L } _ { \\theta ^ { * } } ( \\tau ) = 0 \\forall \\tau \\sim { \\cal P } ( \\theta ) ,\n$$",
722
+ "text_format": "latex",
723
+ "bbox": [
724
+ 349,
725
+ 582,
726
+ 647,
727
+ 599
728
+ ],
729
+ "page_idx": 5
730
+ },
731
+ {
732
+ "type": "text",
733
+ "text": "i.e., a global optimum of the expected loss provides the correct flows. If πθ∗ (a|s) = P Fθ∗ (s,a)a0∈A(s) Fθ∗ (s,a0) then we also have ",
734
+ "bbox": [
735
+ 171,
736
+ 603,
737
+ 820,
738
+ 636
739
+ ],
740
+ "page_idx": 5
741
+ },
742
+ {
743
+ "type": "equation",
744
+ "img_path": "images/c19a29407339354b4e12ef1999e14d7d86d98da62e1edc6f7c11f922084c05cb.jpg",
745
+ "text": "$$\n\\pi _ { \\theta ^ { \\ast } } ( x ) = \\frac { R ( x ) } { Z } .\n$$",
746
+ "text_format": "latex",
747
+ "bbox": [
748
+ 442,
749
+ 635,
750
+ 557,
751
+ 666
752
+ ],
753
+ "page_idx": 5
754
+ },
755
+ {
756
+ "type": "text",
757
+ "text": "The proof is in Appendix A.1. Note that, in RL terms, this method is akin to asynchronous dynamic programming (Sutton and Barto, 2018, $\\ S 4 . 5$ ), which is an off-policy off-line method which converges provided every state is visited infinitely many times asymptotically. ",
758
+ "bbox": [
759
+ 174,
760
+ 671,
761
+ 825,
762
+ 714
763
+ ],
764
+ "page_idx": 5
765
+ },
766
+ {
767
+ "type": "text",
768
+ "text": "3 Related Work ",
769
+ "text_level": 1,
770
+ "bbox": [
771
+ 174,
772
+ 726,
773
+ 323,
774
+ 743
775
+ ],
776
+ "page_idx": 5
777
+ },
778
+ {
779
+ "type": "text",
780
+ "text": "The objective of training a policy generating states with a probability proportional to rewards was presented by Buesing et al. (2019) but the proposed method only makes sense when there is a bijection between action sequences and states. In contrast, GFlowNet is applicable in the more general setting where many paths can lead to the same state. The objective to sample with probability proportional to a given unnormalized positive function is achieved by many MCMC methods (Grathwohl et al., 2021; Dai et al., 2020). However, when mixing between modes is challenging (e.g., in high-dimensional spaces with well-separated modes occupying a fraction of the total volume) convergence to the target distribution can be extremely slow. In contrast, GFlowNet is not iterative and amortizes the challenge of sampling from such modes through a training procedure which must be sufficiently exploratory. ",
781
+ "bbox": [
782
+ 173,
783
+ 752,
784
+ 825,
785
+ 877
786
+ ],
787
+ "page_idx": 5
788
+ },
789
+ {
790
+ "type": "text",
791
+ "text": "This sampling problem comes up in molecule generation and has been studied in this context with numerous generative models (Shi et al., 2020; Jin et al., 2020; Luo et al., 2021), MCMC methods (Seff et al., 2019; Xie et al., 2021), RL (Segler et al., 2017; Cao and Kipf, 2018; Popova et al., 2019; Gottipati et al., 2020; Angermueller et al., 2020) and evolutionary methods (Brown et al., 2004; Jensen, 2019; Swersky et al., 2020). Some of these methods rely on a given set of \"positive examples\" (high-reward) to train a generative model, thus not taking advantage of the \"negative examples\" and the continuous nature of the measurements (some examples should be generated more often than others). Others rely on the traditional return maximization objectives of RL, which tends to focus on one or a few dominant modes, as we find in our experiments. Beyond molecules, there are previous works generating data non-greedily through RL (Bachman and Precup, 2015) or energy-based GANs (Dai et al., 2017). ",
792
+ "bbox": [
793
+ 173,
794
+ 883,
795
+ 825,
796
+ 911
797
+ ],
798
+ "page_idx": 5
799
+ },
800
+ {
801
+ "type": "text",
802
+ "text": "",
803
+ "bbox": [
804
+ 173,
805
+ 90,
806
+ 826,
807
+ 215
808
+ ],
809
+ "page_idx": 6
810
+ },
811
+ {
812
+ "type": "text",
813
+ "text": "The objective that we formulate in (12) may remind the reader of the objective of control-asinference’s Soft Q-Learning (Haarnoja et al., 2017), with the difference that we include all the parents of a state in the in-flow, whereas Soft Q-Learning only uses the parent contained in the trajectory. Soft Q-Learning induces a different policy, as shown by Proposition 1, one where $P ( \\tau ) \\propto R ( \\tau )$ rather than $P ( x ) \\propto \\bar { R } ( x )$ . More generally, we only consider deterministic generative settings whereas RL is a more general framework for stochastic environments. ",
814
+ "bbox": [
815
+ 173,
816
+ 222,
817
+ 826,
818
+ 305
819
+ ],
820
+ "page_idx": 6
821
+ },
822
+ {
823
+ "type": "text",
824
+ "text": "Literature at the intersection of network flow and deep learning is sparse, and is mostly concerned with solving maximum flow problems (Nazemi and Omidi, 2012; Chen and Zhang, 2020) or classification within existing flow networks (Rahul et al., 2017; Pekta¸s and Acarman, 2019). Finally, the idea of accounting for the search space being a DAG rather than a tree in MCTS, known as transpositions (Childs et al., 2008), also has some links with the proposed method. ",
825
+ "bbox": [
826
+ 174,
827
+ 311,
828
+ 825,
829
+ 381
830
+ ],
831
+ "page_idx": 6
832
+ },
833
+ {
834
+ "type": "text",
835
+ "text": "4 Empirical Results ",
836
+ "text_level": 1,
837
+ "bbox": [
838
+ 174,
839
+ 388,
840
+ 354,
841
+ 406
842
+ ],
843
+ "page_idx": 6
844
+ },
845
+ {
846
+ "type": "text",
847
+ "text": "We first verify that GFlowNet works as advertised on an artificial domain small enough to compute the partition function exactly, and compare its abilities to recover modes compared to standard MCMC and RL methods, with its sampling distribution better matching the normalized reward. We find that GFlowNet (A) converges to $\\pi ( x ) \\propto R ( x )$ , (B) requires less samples to achieve some level of performance than MCMC and PPO methods and (C) recovers all the modes and does so faster than MCMC and PPO, both in terms of wall-time and number of states visited and queried. We then test GFlowNet on a large scale domain, which consists in generating small drug molecule graphs, with a reward that estimates their binding affinity to a target protein (see Appendix A.3). We find that GFlowNet finds higher reward and more diverse molecules faster than baselines. ",
848
+ "bbox": [
849
+ 173,
850
+ 415,
851
+ 825,
852
+ 540
853
+ ],
854
+ "page_idx": 6
855
+ },
856
+ {
857
+ "type": "text",
858
+ "text": "4.1 A (hyper-)grid domain ",
859
+ "text_level": 1,
860
+ "bbox": [
861
+ 174,
862
+ 550,
863
+ 370,
864
+ 565
865
+ ],
866
+ "page_idx": 6
867
+ },
868
+ {
869
+ "type": "text",
870
+ "text": "Consider an MDP where states are the cells of a $n$ -dimensional hypercubic grid of side length $H$ . The agent starts at coordinate $x = ( 0 , 0 , \\ldots )$ and is only allowed to increase coordinate $i$ with action $a _ { i }$ (up to $H$ , upon which the episode terminates). A stop action indicates to terminate the trajectory. There are many action sequences that lead to the same coordinate, making this MDP a DAG.The reward for ending the trajectory in $x$ is some $R ( x ) > 0$ . For MCMC methods, in order to have an ergodic chain, we allow the iteration to decrease coordinates as well, and there is no stop action. ",
871
+ "bbox": [
872
+ 173,
873
+ 571,
874
+ 826,
875
+ 655
876
+ ],
877
+ "page_idx": 6
878
+ },
879
+ {
880
+ "type": "text",
881
+ "text": "We ran experiments with this reward function: ",
882
+ "bbox": [
883
+ 174,
884
+ 661,
885
+ 477,
886
+ 676
887
+ ],
888
+ "page_idx": 6
889
+ },
890
+ {
891
+ "type": "equation",
892
+ "img_path": "images/258a1185fb3947d8faf78bde2f3e7d39653dcd5d768c5a18995049eea6f48468.jpg",
893
+ "text": "$$\n\\begin{array} { r } { R ( x ) = R _ { 0 } + R _ { 1 } \\prod _ { i } \\mathbb { I } ( 0 . 2 5 < | x _ { i } / H - 0 . 5 | ) + R _ { 2 } \\prod _ { i } \\mathbb { I } ( 0 . 3 < | x _ { i } / H - 0 . 5 | < 0 . 4 ) } \\end{array}\n$$",
894
+ "text_format": "latex",
895
+ "bbox": [
896
+ 173,
897
+ 689,
898
+ 723,
899
+ 707
900
+ ],
901
+ "page_idx": 6
902
+ },
903
+ {
904
+ "type": "text",
905
+ "text": "with $0 < R _ { 0 } \\ll R _ { 1 } < R _ { 2 }$ , pictured when $n = 2$ on the right. For this choice of $R$ , there are only interesting rewards near the corners of the grid, and there are exactly $2 ^ { n }$ modes. We set $R _ { 1 } \\stackrel { \\cdot } { = } 1 / 2$ , $R _ { 2 } = 2$ . By varying $R _ { 0 }$ and setting it closer to 0, we make this problem artificially harder, creating a region of the state space which it is undesirable to explore. To measure the performance of a method, we measure the empirical L1 error $\\mathbb { E } [ | p ( x ) - \\pi ( { \\bar { x } } ) | ]$ . $p ( x ) = R ( x ) / Z$ is known in this domain, and $\\pi$ is estimated by repeated sampling and counting frequencies for each possible $x$ . We also measure the number of modes with at least 1 visit as a function of the number of states visited. ",
906
+ "bbox": [
907
+ 174,
908
+ 710,
909
+ 826,
910
+ 809
911
+ ],
912
+ "page_idx": 6
913
+ },
914
+ {
915
+ "type": "text",
916
+ "text": "We run the above experiment for $R _ { 0 } \\in \\{ 1 0 ^ { - 1 } , 1 0 ^ { - 2 } , 1 0 ^ { - 3 } \\}$ with $n = 4$ , $H = 8$ . In Fig. 2 we see that GFlowNet is robust to $R _ { 0 }$ and obtains a low L1 error, while a Metropolis-Hastings-MCMC based method requires exponentially more samples than GFlowNet to achieve some level of L1 error. This is apparent in Fig. 2 (with a log-scale horizontal axis) by comparing the slope of progress of GFlowNet (beyond the initial stage) and that of the MCMC sampler. We also see that MCMC takes much longer to visit each mode once as $R _ { 0 }$ decreases, while GFlowNet is only slightly affected, with GFlowNet converging to some level of L1 error faster, as per hypothesis (B). This suggests that ",
917
+ "bbox": [
918
+ 174,
919
+ 813,
920
+ 825,
921
+ 911
922
+ ],
923
+ "page_idx": 6
924
+ },
925
+ {
926
+ "type": "text",
927
+ "text": "GFlowNet is robust to the separation between modes (represented by $R _ { 0 }$ being smaller) and thus recovers all the modes much faster than MCMC (again, noting the log-scale of the horizontal axis). ",
928
+ "bbox": [
929
+ 173,
930
+ 92,
931
+ 823,
932
+ 119
933
+ ],
934
+ "page_idx": 7
935
+ },
936
+ {
937
+ "type": "text",
938
+ "text": "To compare to RL, we run PPO (Schulman et al., 2017). To discover all the modes in a reasonable time, we need to set the entropy maximization term much higher (0.5) than usual $( \\ll 1 )$ ). We verify that PPO is not overly regularized by comparing it to a random agent. PPO finds all the modes faster than uniform sampling, but much more slowly than GFlowNet, and is also robust to the choice of $R _ { 0 }$ . This and the previous result validates hypothesis (C). We also run SAC (Haarnoja et al., 2018), finding similar or worse results. We provide additional results and discussion in Appendix A.6. ",
939
+ "bbox": [
940
+ 174,
941
+ 126,
942
+ 825,
943
+ 209
944
+ ],
945
+ "page_idx": 7
946
+ },
947
+ {
948
+ "type": "image",
949
+ "img_path": "images/f78e0a7efa3a201cb3d3a0ed1cb2db9072c6757469cb48b28d92d7518573dc09.jpg",
950
+ "image_caption": [
951
+ "Figure 2: Hypergrid domain. Changing the task difficulty $R _ { 0 }$ to illustrate the advantage of GFlowNet over others. We see that as $R _ { 0 }$ gets smaller, MCMC struggles to fit the distribution because it struggles to visit all the modes. PPO also struggles to find all the modes, and requires very large entropy regularization, but is robust to the choice of $R _ { 0 }$ . We plot means over 10 runs for each setting. "
952
+ ],
953
+ "image_footnote": [],
954
+ "bbox": [
955
+ 199,
956
+ 224,
957
+ 790,
958
+ 364
959
+ ],
960
+ "page_idx": 7
961
+ },
962
+ {
963
+ "type": "text",
964
+ "text": "4.2 Generating small molecules ",
965
+ "text_level": 1,
966
+ "bbox": [
967
+ 176,
968
+ 440,
969
+ 405,
970
+ 455
971
+ ],
972
+ "page_idx": 7
973
+ },
974
+ {
975
+ "type": "text",
976
+ "text": "Here our goal is to generate a diverse set of small molecules that have a high reward. We define a large-scale environment which allows an agent to sequentially generate molecules. This environment is challenging, with up to $1 0 ^ { 1 6 }$ states and between 100 and 2000 actions depending on the state. ",
977
+ "bbox": [
978
+ 174,
979
+ 463,
980
+ 825,
981
+ 505
982
+ ],
983
+ "page_idx": 7
984
+ },
985
+ {
986
+ "type": "text",
987
+ "text": "We follow the framework of Jin et al. (2020) and generate molecules by parts using a predefined vocabulary of building blocks that can be joined together forming a junction tree (detailed in A.3). This is also known as fragment-based drug design (Kumar et al., 2012; Xie et al., 2021). Generating such a graph can be described as a sequence of additive edits: given a molecule and constraints of chemical validity, we choose an atom to attach a block to. The action space is thus the product of choosing where to attach a block and choosing which block to attach. There is an extra action to stop the editing sequence. This sequence of edits yields a DAG MDP, as there are multiple action sequences that lead to the same molecule graph, and no edge removal actions, which prevents cycles. ",
988
+ "bbox": [
989
+ 174,
990
+ 511,
991
+ 825,
992
+ 622
993
+ ],
994
+ "page_idx": 7
995
+ },
996
+ {
997
+ "type": "text",
998
+ "text": "The reward is computed with a pretrained proxy model that predicts the binding energy of a molecule to a particular protein target (soluble epoxide hydrolase, sEH, see A.3). Although computing binding energy is computationally expensive, we can call this proxy cheaply. Note that for realistic drug design, we would need to consider many more quantities such as drug-likeness (Bickerton et al., 2012), toxicity, or synthesizability. Our goal here is not solve this problem, and our work situates itself within such a larger project. Instead, we want to show that given a proxy $R$ in the space of molecules, we can quickly match its induced distribution $\\pi ( x ) \\propto R ( x )$ and find many of its modes. ",
999
+ "bbox": [
1000
+ 173,
1001
+ 627,
1002
+ 825,
1003
+ 726
1004
+ ],
1005
+ "page_idx": 7
1006
+ },
1007
+ {
1008
+ "type": "text",
1009
+ "text": "We parameterize the proxy with an MPNN (Gilmer et al., 2017) over the atom graph. Our flow predictor $F _ { \\theta }$ is parameterized similarly to MARS (Xie et al., 2021), with an MPNN, but over the junction tree graph (the graph of blocks), which had better performance. For fairness, this architecture is used for both GFlowNet and the baselines. Complete details can be found in Appendix A.4. ",
1010
+ "bbox": [
1011
+ 174,
1012
+ 731,
1013
+ 825,
1014
+ 787
1015
+ ],
1016
+ "page_idx": 7
1017
+ },
1018
+ {
1019
+ "type": "text",
1020
+ "text": "We pretrain the proxy with a semi-curated semi-random dataset of $3 0 0 \\mathrm { k }$ molecules (see A.4) down to a test MSE of 0.6; molecules are scored according to the docking score (Trott and Olson, 2010), renormalized so that most scores fall between 0 and 10 (to have $\\bar { R ( } x { ) } > 0 { ) }$ . We plot the dataset’s reward distribution in Fig. 3. We train all generative models with up to $1 0 ^ { 6 }$ molecules. During training, sampling follows exploratory policy $P ( \\boldsymbol { a } | \\boldsymbol { s } )$ which is a mixture between $\\pi ( a | s )$ (Eq. 5), used with probability 0.95, and a uniform distribution over allowed actions with probability 0.05. ",
1021
+ "bbox": [
1022
+ 174,
1023
+ 794,
1024
+ 825,
1025
+ 877
1026
+ ],
1027
+ "page_idx": 7
1028
+ },
1029
+ {
1030
+ "type": "text",
1031
+ "text": "Experimental results In Fig. 3 we show the empirical distribution of rewards in two settings; first when we train our model with $R ( x )$ , then with ${ \\bar { R } } ( x ) ^ { \\beta }$ . If GFlowNet learns a reasonable policy $\\pi$ this should shift the distribution to the right. This is indeed what we observe. We compare GFlowNet to MARS (Xie et al., 2021), known to work well in the molecule domain, and observe the same shift. Note that GFlowNet finds more high reward molecules than MARS with these $\\beta$ values; this is consistent with the hypothesis that it finds high-reward modes faster (since MARS is an MCMC method, it would eventually converge to the same distribution, but takes more time). ",
1032
+ "bbox": [
1033
+ 173,
1034
+ 882,
1035
+ 823,
1036
+ 911
1037
+ ],
1038
+ "page_idx": 7
1039
+ },
1040
+ {
1041
+ "type": "image",
1042
+ "img_path": "images/56144c31df71789119b3f527b0faeaa77f9787cb0bbabacc12616ad4ac31580d.jpg",
1043
+ "image_caption": [
1044
+ "Figure 3: Empirical density of rewards. We verify that GFlowNet is consistent by training it with $R ^ { \\beta }$ , $\\beta = 4$ , which has the hypothesized effect of shifting the density to the right. "
1045
+ ],
1046
+ "image_footnote": [],
1047
+ "bbox": [
1048
+ 176,
1049
+ 84,
1050
+ 486,
1051
+ 234
1052
+ ],
1053
+ "page_idx": 8
1054
+ },
1055
+ {
1056
+ "type": "image",
1057
+ "img_path": "images/ae057cac7ada7b6e331edd1d4fc3208b0beff1c559881aabc17c7e680348ab95.jpg",
1058
+ "image_caption": [
1059
+ "Figure 4: The average reward of the top- $k$ as a function of learning (averaged over 3 runs). Only unique hits are counted. Note the log scale. Our method finds more unique good molecules faster. "
1060
+ ],
1061
+ "image_footnote": [],
1062
+ "bbox": [
1063
+ 511,
1064
+ 85,
1065
+ 818,
1066
+ 234
1067
+ ],
1068
+ "page_idx": 8
1069
+ },
1070
+ {
1071
+ "type": "text",
1072
+ "text": "",
1073
+ "bbox": [
1074
+ 174,
1075
+ 314,
1076
+ 825,
1077
+ 383
1078
+ ],
1079
+ "page_idx": 8
1080
+ },
1081
+ {
1082
+ "type": "text",
1083
+ "text": "In Fig. 4, we show the average reward of the top- $k$ molecules found so far, without allowing for duplicates (based on SMILES). We compare GFlowNet with MARS, PPO, and JT-VAE (Jin et al., 2020) with Bayesian Optimization. As expected, PPO plateaus after a while; RL tends to be satisfied with good enough trajectories unless it is strongly regularized with exploration mechanisms. For GFlowNet and for MARS, the more molecules are visited, the better they become, with a slow convergence towards the proxy’s max reward. Given the same compute time, $\\scriptstyle \\mathbf { J } \\mathbf { T } - \\mathbf { V } \\mathbf { A } \\mathbf { E } + \\mathbf { B } \\mathbf { O }$ generates only about $1 0 ^ { 3 }$ molecules (due to its expensive Gaussian Process) and so does not perform well. ",
1084
+ "bbox": [
1085
+ 173,
1086
+ 390,
1087
+ 825,
1088
+ 486
1089
+ ],
1090
+ "page_idx": 8
1091
+ },
1092
+ {
1093
+ "type": "text",
1094
+ "text": "The maximum reward in the proxy’s dataset is 10, with only 233 examples above 8. In our best run, we find 2339 unique molecules during training with a score above 8, only 39 of which are in the dataset. We compute the average pairwise Tanimoto similarity for the top 1000 samples: GFlowNet has a mean of $0 . 4 4 \\pm 0 . 0 1$ , PPO, $0 . 6 2 \\pm 0 . 0 3$ , and MARS, $0 . 5 9 \\pm 0 . 0 2$ (mean and std over 3 runs). As expected, our MCMC baseline (MARS) and RL baseline (PPO) find less diverse candidates. We also find that GFlowNet discovers many more modes $( > 1 5 0 0$ with $R > 8$ vs $< 1 0 0$ for MARS). This is shown in Fig. 5 where we consider a mode to be a Bemis-Murcko scaffold (Bemis and Murcko, 1996), counted for molecules above a certain reward threshold. We provide additional insights into how GFlowNet matches the rewards in Appendix A.7. ",
1095
+ "bbox": [
1096
+ 173,
1097
+ 492,
1098
+ 826,
1099
+ 617
1100
+ ],
1101
+ "page_idx": 8
1102
+ },
1103
+ {
1104
+ "type": "image",
1105
+ "img_path": "images/4f6c3d3fd8d0bad63785195c8151dd88346a1ad41ea3cef93552e73c8e733869.jpg",
1106
+ "image_caption": [
1107
+ "Figure 5: Number of diverse Bemis-Murcko scaffolds found above reward threshold $T$ as a function of the number of molecules seen. Left, $T = 7 . 5$ . Right, $T = 8$ . "
1108
+ ],
1109
+ "image_footnote": [],
1110
+ "bbox": [
1111
+ 184,
1112
+ 632,
1113
+ 810,
1114
+ 792
1115
+ ],
1116
+ "page_idx": 8
1117
+ },
1118
+ {
1119
+ "type": "text",
1120
+ "text": "4.3 Multi-Round Experiments ",
1121
+ "text_level": 1,
1122
+ "bbox": [
1123
+ 174,
1124
+ 849,
1125
+ 397,
1126
+ 864
1127
+ ],
1128
+ "page_idx": 8
1129
+ },
1130
+ {
1131
+ "type": "text",
1132
+ "text": "To demonstrate the importance of diverse candidate generation in an active learning setting, we consider a sequential acquisition task. We simulate the setting where there is a limited budget for calls to the true oracle $O$ . We use a proxy $M$ initialized by training on a limited dataset of $( x , R ( x ) )$ ",
1133
+ "bbox": [
1134
+ 174,
1135
+ 869,
1136
+ 825,
1137
+ 911
1138
+ ],
1139
+ "page_idx": 8
1140
+ },
1141
+ {
1142
+ "type": "text",
1143
+ "text": "pairs $D _ { 0 }$ , where $R ( x )$ is the true reward from the oracle. The generative model $\\left( \\pi _ { \\boldsymbol { \\theta } } \\right)$ is trained to fit to the unnormalized probability function learned by the proxy $M$ . We then sample a batch $B = \\{ x _ { 1 } , x _ { 2 } , . . . x _ { k } \\}$ where $x _ { i } \\sim \\pi _ { \\theta }$ , which is evaluated with the oracle $O$ . The proxy $M$ is updated with this newly acquired and labeled batch, and the process is repeated for $N$ iterations. We discuss the experimental setting in more detail in Appendix A.5. ",
1144
+ "bbox": [
1145
+ 173,
1146
+ 90,
1147
+ 825,
1148
+ 161
1149
+ ],
1150
+ "page_idx": 9
1151
+ },
1152
+ {
1153
+ "type": "image",
1154
+ "img_path": "images/57f77d159cae3745834d0ddf9b599ff5f9e8a19b8e5dd554012b7e815a7b0fe3.jpg",
1155
+ "image_caption": [
1156
+ "Figure 6: The top- $\\mathbf { \\nabla } \\cdot \\mathbf { k }$ return (mean over 3 runs) in the 4-D Hyper-grid task with active learning. GFlowNet gets the highest return faster. "
1157
+ ],
1158
+ "image_footnote": [],
1159
+ "bbox": [
1160
+ 181,
1161
+ 170,
1162
+ 480,
1163
+ 301
1164
+ ],
1165
+ "page_idx": 9
1166
+ },
1167
+ {
1168
+ "type": "image",
1169
+ "img_path": "images/6b4940bf58465c3496eea9644bbc71a972ddbd721a83526315b3b6676df6500d.jpg",
1170
+ "image_caption": [
1171
+ "Figure 7: The top- $\\mathbf { \\nabla } \\cdot \\mathbf { k }$ docking reward (mean over 3 runs) in the molecule task with active learning. GFlowNet consistently generates better samples. "
1172
+ ],
1173
+ "image_footnote": [],
1174
+ "bbox": [
1175
+ 519,
1176
+ 171,
1177
+ 812,
1178
+ 299
1179
+ ],
1180
+ "page_idx": 9
1181
+ },
1182
+ {
1183
+ "type": "text",
1184
+ "text": "Hyper-grid domain We present results for the multi-round task in the 4-D hyper-grid domain in Figure 6. We use a Gaussian Process (Williams and Rasmussen, 1995) as the proxy. We compare the Top- $k$ Return for all the methods, which is defined as mean(t $\\mathrm { \\gamma } \\mathrm { p } { - } k ( D _ { i } ) ) { - } \\mathrm { m e a n } \\big ( \\mathrm { t o p } { - } k ( D _ { i - 1 } ) \\big )$ , where $D _ { i }$ is the dataset of points acquired until step $i$ , and $k = 1 0$ for this experiment. The initial dataset $D _ { 0 }$ $\\left. \\left| D _ { 0 } \\right| \\right. = \\left. 5 1 2 \\right.$ is the same for all the methods compared. We observe that GFlowNet consistently outperforms the baselines in terms of return over the initial set. We also observe that the mean pairwise L2-distance between the top - $k$ points at the end of the final round is $0 . 8 3 \\pm 0 . 0 3$ , $0 . 6 1 \\pm 0 . 0 1$ and $0 . 5 1 \\pm 0 . 0 2$ for GFlowNet, MCMC and PPO respectively. This demonstrates the ability of GFlowNet to capture the modes, even in the absence of the true oracle, as well as the importance of capturing this diversity in multi-round settings. ",
1185
+ "bbox": [
1186
+ 173,
1187
+ 367,
1188
+ 826,
1189
+ 507
1190
+ ],
1191
+ "page_idx": 9
1192
+ },
1193
+ {
1194
+ "type": "text",
1195
+ "text": "Small Molecules For the molecule discovery task, we initialize an MPNN proxy to predict docking scores from AutoDock (Trott and Olson, 2010), with $| D _ { 0 } | = 2 0 0 0$ molecules. At the end of each round we generate 200 molecules which are evaluated with AutoDock and used to update the proxy. Figure 7 shows GFlowNet discovers molecules with significantly higher energies than the initial set $D _ { 0 }$ . It also consistently outperforms MARS as well as Random Acquisition. PPO training was unstable and diverged consistently so the numbers are not reported. The mean pairwise Tanimoto similarity in the initial set is 0.60. At the end of the final round, it is $0 . 5 4 \\pm 0 . 0 4$ for GFlowNet and $0 . 6 4 \\pm 0 . 0 3$ for MARS. This further demonstrates the ability of GFlowNet to generate diverse candidates, which ultimately helps improve the final performance on the task. Similar to the single step setting, we observe that JT-VAE $+ \\mathrm { B O }$ is only able to generate $1 0 ^ { 3 }$ molecules with similar compute time, and thus performs poorly. ",
1196
+ "bbox": [
1197
+ 173,
1198
+ 512,
1199
+ 825,
1200
+ 665
1201
+ ],
1202
+ "page_idx": 9
1203
+ },
1204
+ {
1205
+ "type": "text",
1206
+ "text": "5 Discussion & Limitations ",
1207
+ "text_level": 1,
1208
+ "bbox": [
1209
+ 174,
1210
+ 676,
1211
+ 416,
1212
+ 694
1213
+ ],
1214
+ "page_idx": 9
1215
+ },
1216
+ {
1217
+ "type": "text",
1218
+ "text": "In this paper we have introduced a novel TD-like objective for learning a flow for each state and (state, action) pair such that policies sampling actions proportional to these flows draw terminal states in proportion to their reward. This can be seen as an alternative approach to turn an energy function into a fast generative model, without the need for an iterative method like that needed with MCMC methods, and with the advantage that when training succeeds, the policy generates a great diversity of samples near the main modes of the target distribution without being slowed by issues of mixing between modes. ",
1219
+ "bbox": [
1220
+ 173,
1221
+ 704,
1222
+ 825,
1223
+ 800
1224
+ ],
1225
+ "page_idx": 9
1226
+ },
1227
+ {
1228
+ "type": "text",
1229
+ "text": "Limitations. One downside of the proposed method is that, as for TD-based methods, the use of bootstrapping may cause optimization challenges (Kumar et al., 2020; Bengio et al., 2020) and limit its performance. In applications like drug discovery, sampling from the regions surrounding each mode is already an important advantage, but future work should investigate how to combine such a generative approach to local optimization in order to refine the generated samples and approach the local maxima of reward while keeping the batches of candidates diverse. ",
1230
+ "bbox": [
1231
+ 174,
1232
+ 806,
1233
+ 825,
1234
+ 890
1235
+ ],
1236
+ "page_idx": 9
1237
+ },
1238
+ {
1239
+ "type": "text",
1240
+ "text": "Negative Social Impact. The authors do not foresee negative social impacts of this work specifically. ",
1241
+ "bbox": [
1242
+ 174,
1243
+ 897,
1244
+ 823,
1245
+ 911
1246
+ ],
1247
+ "page_idx": 9
1248
+ },
1249
+ {
1250
+ "type": "text",
1251
+ "text": "Acknowledgments and Disclosure of Funding ",
1252
+ "text_level": 1,
1253
+ "bbox": [
1254
+ 174,
1255
+ 88,
1256
+ 553,
1257
+ 107
1258
+ ],
1259
+ "page_idx": 10
1260
+ },
1261
+ {
1262
+ "type": "text",
1263
+ "text": "This research was enabled in part by computational resources provided by Calcul Québec (www. calculquebec.ca) and Compute Canada (www.computecanada.ca). All authors are funded by their primary academic institution. We also acknowledge funding from Samsung Electronics Co., Ldt., CIFAR and IBM. ",
1264
+ "bbox": [
1265
+ 174,
1266
+ 119,
1267
+ 826,
1268
+ 175
1269
+ ],
1270
+ "page_idx": 10
1271
+ },
1272
+ {
1273
+ "type": "text",
1274
+ "text": "The authors are grateful to Andrei Nica for generating the molecule dataset, to Maria Kadukova for advice on molecular docking, to Harsh Satija for feedback on the paper, as well as to all the members of the Mila Molecule Discovery team for the many research discussions on the challenges we faced. ",
1275
+ "bbox": [
1276
+ 174,
1277
+ 181,
1278
+ 825,
1279
+ 224
1280
+ ],
1281
+ "page_idx": 10
1282
+ },
1283
+ {
1284
+ "type": "text",
1285
+ "text": "Author Contributions ",
1286
+ "text_level": 1,
1287
+ "bbox": [
1288
+ 176,
1289
+ 242,
1290
+ 357,
1291
+ 260
1292
+ ],
1293
+ "page_idx": 10
1294
+ },
1295
+ {
1296
+ "type": "text",
1297
+ "text": "EB and YB contributed to the original idea, and wrote most sections of the paper. YB wrote the proofs of Propositions 1-3, EB the proof of Proposition 4. EB wrote the code and ran experiments for sections 4.1 (hypergrid) and 4.2 (small molecules). MJ wrote the code and ran experiments for section 4.3 (multi-round) and wrote the corresponding results section of the paper. MK wrote the biochemical framework upon which the molecule experiments are built, assisted in debugging and running experiments for section 4.3, implemented mode-counting routines used in 4.2, and wrote the biochemical details of the paper. ",
1298
+ "bbox": [
1299
+ 174,
1300
+ 273,
1301
+ 825,
1302
+ 371
1303
+ ],
1304
+ "page_idx": 10
1305
+ },
1306
+ {
1307
+ "type": "text",
1308
+ "text": "MK, DP and YB provided supervision for the project. All authors contributed to proofreading and editing the paper. ",
1309
+ "bbox": [
1310
+ 174,
1311
+ 376,
1312
+ 823,
1313
+ 406
1314
+ ],
1315
+ "page_idx": 10
1316
+ },
1317
+ {
1318
+ "type": "text",
1319
+ "text": "References ",
1320
+ "text_level": 1,
1321
+ "bbox": [
1322
+ 174,
1323
+ 424,
1324
+ 266,
1325
+ 440
1326
+ ],
1327
+ "page_idx": 10
1328
+ },
1329
+ {
1330
+ "type": "text",
1331
+ "text": "Christof Angermueller, David Dohan, David Belanger, Ramya Deshpande, Kevin Murphy, and Lucy Colwell. Model-based reinforcement learning for biological sequence design. In International Conference on Learning Representations, 2020. \nPhilip Bachman and Doina Precup. Data generation as sequential decision making. Advances in Neural Information Processing Systems, 28:3249–3257, 2015. \nGuy W Bemis and Mark A Murcko. The properties of known drugs. 1. molecular frameworks. Journal of medicinal chemistry, 39(15):2887–2893, 1996. \nEmmanuel Bengio, Joelle Pineau, and Doina Precup. Interference and generalization in temporal difference learning. In International Conference on Machine Learning, pages 767–777. PMLR, 2020. \nG Richard Bickerton, Gaia V Paolini, Jérémy Besnard, Sorel Muresan, and Andrew L Hopkins. Quantifying the chemical beauty of drugs. Nature chemistry, 4(2):90–98, 2012. \nNathan Brown, Ben McKay, François Gilardoni, and Johann Gasteiger. A graph-based genetic algorithm and its application to the multiobjective evolution of median molecules. Journal of chemical information and computer sciences, 44(3):1079–1087, 2004. \nLars Buesing, Nicolas Heess, and Theophane Weber. Approximate inference in discrete distributions with monte carlo tree search and value functions, 2019. \nNicola De Cao and Thomas Kipf. Molgan: An implicit generative model for small molecular graphs, 2018. \nYize Chen and Baosen Zhang. Learning to solve network flow problems via neural decoding. arXiv preprint arXiv:2002.04091, 2020. \nBenjamin E Childs, James H Brodeur, and Levente Kocsis. Transpositions and move groups in monte carlo tree search. In 2008 IEEE Symposium On Computational Intelligence and Games, pages 389–395. IEEE, 2008. \nHanjun Dai, Rishabh Singh, Bo Dai, Charles Sutton, and Dale Schuurmans. Learning discrete energy-based models via auxiliary-variable local exploration. In Neural Information Processing Systems (NeurIPS), 2020. ",
1332
+ "bbox": [
1333
+ 171,
1334
+ 444,
1335
+ 828,
1336
+ 917
1337
+ ],
1338
+ "page_idx": 10
1339
+ },
1340
+ {
1341
+ "type": "text",
1342
+ "text": "Zihang Dai, Amjad Almahairi, Philip Bachman, Eduard Hovy, and Aaron Courville. Calibrating energy-based generative adversarial networks. arXiv preprint arXiv:1702.01691, 2017. ",
1343
+ "bbox": [
1344
+ 171,
1345
+ 90,
1346
+ 823,
1347
+ 119
1348
+ ],
1349
+ "page_idx": 11
1350
+ },
1351
+ {
1352
+ "type": "text",
1353
+ "text": "Justin Gilmer, Samuel S. Schoenholz, Patrick F. Riley, Oriol Vinyals, and George E. Dahl. Neural message passing for quantum chemistry, 2017. ",
1354
+ "bbox": [
1355
+ 171,
1356
+ 128,
1357
+ 823,
1358
+ 159
1359
+ ],
1360
+ "page_idx": 11
1361
+ },
1362
+ {
1363
+ "type": "text",
1364
+ "text": "Sai Krishna Gottipati, Boris Sattarov, Sufeng Niu, Yashaswi Pathak, Haoran Wei, Shengchao Liu, Karam M. J. Thomas, Simon Blackburn, Connor W. Coley, Jian Tang, Sarath Chandar, and Yoshua Bengio. Learning to navigate the synthetically accessible chemical space using reinforcement learning, 2020. ",
1365
+ "bbox": [
1366
+ 173,
1367
+ 167,
1368
+ 826,
1369
+ 224
1370
+ ],
1371
+ "page_idx": 11
1372
+ },
1373
+ {
1374
+ "type": "text",
1375
+ "text": "Will Grathwohl, Kevin Swersky, Milad Hashemi, David Duvenaud, and Chris J. Maddison. Oops i took a gradient: Scalable sampling for discrete distributions, 2021. ",
1376
+ "bbox": [
1377
+ 174,
1378
+ 233,
1379
+ 821,
1380
+ 263
1381
+ ],
1382
+ "page_idx": 11
1383
+ },
1384
+ {
1385
+ "type": "text",
1386
+ "text": "Tuomas Haarnoja, Haoran Tang, Pieter Abbeel, and Sergey Levine. Reinforcement learning with deep energy-based policies. In International Conference on Machine Learning, pages 1352–1361. PMLR, 2017. ",
1387
+ "bbox": [
1388
+ 174,
1389
+ 272,
1390
+ 826,
1391
+ 314
1392
+ ],
1393
+ "page_idx": 11
1394
+ },
1395
+ {
1396
+ "type": "text",
1397
+ "text": "Tuomas Haarnoja, Aurick Zhou, Pieter Abbeel, and Sergey Levine. Soft actor-critic: Off-policy maximum entropy deep reinforcement learning with a stochastic actor, 2018. ",
1398
+ "bbox": [
1399
+ 173,
1400
+ 324,
1401
+ 823,
1402
+ 353
1403
+ ],
1404
+ "page_idx": 11
1405
+ },
1406
+ {
1407
+ "type": "text",
1408
+ "text": "Jan H Jensen. A graph-based genetic algorithm and generative model/monte carlo tree search for the exploration of chemical space. Chemical science, 10(12):3567–3572, 2019. ",
1409
+ "bbox": [
1410
+ 173,
1411
+ 363,
1412
+ 823,
1413
+ 392
1414
+ ],
1415
+ "page_idx": 11
1416
+ },
1417
+ {
1418
+ "type": "text",
1419
+ "text": "Wengong Jin, Regina Barzilay, and Tommi Jaakkola. Chapter 11. junction tree variational autoencoder for molecular graph generation. Drug Discovery, page 228–249, 2020. ISSN 2041-3211. doi: 10. 1039/9781788016841-00228. URL http://dx.doi.org/10.1039/9781788016841-00228. ",
1420
+ "bbox": [
1421
+ 176,
1422
+ 401,
1423
+ 821,
1424
+ 444
1425
+ ],
1426
+ "page_idx": 11
1427
+ },
1428
+ {
1429
+ "type": "text",
1430
+ "text": "Andreas Kirsch, Joost van Amersfoort, and Yarin Gal. Batchbald: Efficient and diverse batch acquisition for deep bayesian active learning, 2019. ",
1431
+ "bbox": [
1432
+ 173,
1433
+ 454,
1434
+ 823,
1435
+ 483
1436
+ ],
1437
+ "page_idx": 11
1438
+ },
1439
+ {
1440
+ "type": "text",
1441
+ "text": "Ashutosh Kumar, A Voet, and KYJ Zhang. Fragment based drug design: from experimental to computational approaches. Current medicinal chemistry, 19(30):5128–5147, 2012. ",
1442
+ "bbox": [
1443
+ 173,
1444
+ 492,
1445
+ 823,
1446
+ 521
1447
+ ],
1448
+ "page_idx": 11
1449
+ },
1450
+ {
1451
+ "type": "text",
1452
+ "text": "Aviral Kumar, Rishabh Agarwal, Dibya Ghosh, and Sergey Levine. Implicit under-parameterization inhibits data-efficient deep reinforcement learning, 2020. ",
1453
+ "bbox": [
1454
+ 173,
1455
+ 530,
1456
+ 823,
1457
+ 560
1458
+ ],
1459
+ "page_idx": 11
1460
+ },
1461
+ {
1462
+ "type": "text",
1463
+ "text": "Greg Landrum. Rdkit: Open-source cheminformatics. URL http://www.rdkit.org. ",
1464
+ "bbox": [
1465
+ 173,
1466
+ 569,
1467
+ 746,
1468
+ 584
1469
+ ],
1470
+ "page_idx": 11
1471
+ },
1472
+ {
1473
+ "type": "text",
1474
+ "text": "Youzhi Luo, Keqiang Yan, and Shuiwang Ji. Graphdf: A discrete flow model for molecular graph generation, 2021. ",
1475
+ "bbox": [
1476
+ 176,
1477
+ 593,
1478
+ 823,
1479
+ 622
1480
+ ],
1481
+ "page_idx": 11
1482
+ },
1483
+ {
1484
+ "type": "text",
1485
+ "text": "Charlie Nash and Conor Durkan. Autoregressive energy machines, 2019. ",
1486
+ "bbox": [
1487
+ 174,
1488
+ 632,
1489
+ 655,
1490
+ 648
1491
+ ],
1492
+ "page_idx": 11
1493
+ },
1494
+ {
1495
+ "type": "text",
1496
+ "text": "Alireza Nazemi and Farahnaz Omidi. A capable neural network model for solving the maximum flow problem. Journal of Computational and Applied Mathematics, 236(14):3498–3513, 2012. ",
1497
+ "bbox": [
1498
+ 173,
1499
+ 656,
1500
+ 818,
1501
+ 686
1502
+ ],
1503
+ "page_idx": 11
1504
+ },
1505
+ {
1506
+ "type": "text",
1507
+ "text": "Diana M. Negoescu, Peter I. Frazier, and Warren B. Powell. The knowledge-gradient algorithm for sequencing experiments in drug discovery. 23(3):346–363, 2011. ISSN 1526-5528. doi: 10.1287/ijoc.1100.0417. URL https://doi.org/10.1287/ijoc.1100.0417. ",
1508
+ "bbox": [
1509
+ 174,
1510
+ 695,
1511
+ 826,
1512
+ 738
1513
+ ],
1514
+ "page_idx": 11
1515
+ },
1516
+ {
1517
+ "type": "text",
1518
+ "text": "Andrew Y Ng, Stuart J Russell, et al. Algorithms for inverse reinforcement learning. In Icml, volume 1, page 2, 2000. ",
1519
+ "bbox": [
1520
+ 174,
1521
+ 747,
1522
+ 823,
1523
+ 776
1524
+ ],
1525
+ "page_idx": 11
1526
+ },
1527
+ {
1528
+ "type": "text",
1529
+ "text": "Adam Paszke, Sam Gross, Francisco Massa, Adam Lerer, James Bradbury, Gregory Chanan, Trevor Killeen, Zeming Lin, Natalia Gimelshein, Luca Antiga, Alban Desmaison, Andreas Kopf, Edward Yang, Zachary DeVito, Martin Raison, Alykhan Tejani, Sasank Chilamkurthy, Benoit Steiner, Lu Fang, Junjie Bai, and Soumith Chintala. Pytorch: An imperative style, high-performance deep learning library. In H. Wallach, H. Larochelle, A. Beygelzimer, F. d'Alché- Buc, E. Fox, and R. Garnett, editors, Advances in Neural Information Processing Systems 32, pages 8024–8035. Curran Associates, Inc., 2019. URL http://papers.neurips.cc/paper/ 9015-pytorch-an-imperative-style-high-performance-deep-learning-library. pdf. ",
1530
+ "bbox": [
1531
+ 176,
1532
+ 786,
1533
+ 826,
1534
+ 911
1535
+ ],
1536
+ "page_idx": 11
1537
+ },
1538
+ {
1539
+ "type": "text",
1540
+ "text": "Abdurrahman Pekta¸s and Tankut Acarman. Deep learning to detect botnet via network flow summaries. Neural Computing and Applications, 31(11):8021–8033, 2019. ",
1541
+ "bbox": [
1542
+ 173,
1543
+ 92,
1544
+ 825,
1545
+ 119
1546
+ ],
1547
+ "page_idx": 12
1548
+ },
1549
+ {
1550
+ "type": "text",
1551
+ "text": "Mariya Popova, Mykhailo Shvets, Junier Oliva, and Olexandr Isayev. Molecularrnn: Generating realistic molecular graphs with optimized properties, 2019. ",
1552
+ "bbox": [
1553
+ 173,
1554
+ 127,
1555
+ 823,
1556
+ 156
1557
+ ],
1558
+ "page_idx": 12
1559
+ },
1560
+ {
1561
+ "type": "text",
1562
+ "text": "RK Rahul, T Anjali, Vijay Krishna Menon, and KP Soman. Deep learning for network flow analysis and malware classification. In International Symposium on Security in Computing and Communication, pages 226–235. Springer, 2017. ",
1563
+ "bbox": [
1564
+ 176,
1565
+ 164,
1566
+ 823,
1567
+ 207
1568
+ ],
1569
+ "page_idx": 12
1570
+ },
1571
+ {
1572
+ "type": "text",
1573
+ "text": "Danilo Jimenez Rezende and Shakir Mohamed. Variational inference with normalizing flows, 2016. ",
1574
+ "bbox": [
1575
+ 171,
1576
+ 214,
1577
+ 826,
1578
+ 231
1579
+ ],
1580
+ "page_idx": 12
1581
+ },
1582
+ {
1583
+ "type": "text",
1584
+ "text": "John Schulman, Filip Wolski, Prafulla Dhariwal, Alec Radford, and Oleg Klimov. Proximal policy optimization algorithms, 2017. ",
1585
+ "bbox": [
1586
+ 173,
1587
+ 238,
1588
+ 825,
1589
+ 267
1590
+ ],
1591
+ "page_idx": 12
1592
+ },
1593
+ {
1594
+ "type": "text",
1595
+ "text": "Ari Seff, Wenda Zhou, Farhan Damani, Abigail Doyle, and Ryan P Adams. Discrete object generation with reversible inductive construction. arXiv preprint arXiv:1907.08268, 2019. ",
1596
+ "bbox": [
1597
+ 173,
1598
+ 275,
1599
+ 821,
1600
+ 304
1601
+ ],
1602
+ "page_idx": 12
1603
+ },
1604
+ {
1605
+ "type": "text",
1606
+ "text": "Marwin H. S. Segler, Thierry Kogej, Christian Tyrchan, and Mark P. Waller. Generating focussed molecule libraries for drug discovery with recurrent neural networks, 2017. ",
1607
+ "bbox": [
1608
+ 173,
1609
+ 311,
1610
+ 821,
1611
+ 340
1612
+ ],
1613
+ "page_idx": 12
1614
+ },
1615
+ {
1616
+ "type": "text",
1617
+ "text": "Chence Shi, Minkai Xu, Zhaocheng Zhu, Weinan Zhang, Ming Zhang, and Jian Tang. Graphaf: a flow-based autoregressive model for molecular graph generation, 2020. ",
1618
+ "bbox": [
1619
+ 174,
1620
+ 348,
1621
+ 823,
1622
+ 377
1623
+ ],
1624
+ "page_idx": 12
1625
+ },
1626
+ {
1627
+ "type": "text",
1628
+ "text": "Yunsheng Shi, Zhengjie Huang, Shikun Feng, Hui Zhong, Wenjin Wang, and Yu Sun. Masked label prediction: Unified message passing model for semi-supervised classification, 2021. ",
1629
+ "bbox": [
1630
+ 176,
1631
+ 385,
1632
+ 825,
1633
+ 415
1634
+ ],
1635
+ "page_idx": 12
1636
+ },
1637
+ {
1638
+ "type": "text",
1639
+ "text": "Niranjan Srinivas, Andreas Krause, S. Kakade, and M. Seeger. Gaussian process optimization in the bandit setting: No regret and experimental design. In ICML, 2010. ",
1640
+ "bbox": [
1641
+ 173,
1642
+ 422,
1643
+ 823,
1644
+ 452
1645
+ ],
1646
+ "page_idx": 12
1647
+ },
1648
+ {
1649
+ "type": "text",
1650
+ "text": "Teague Sterling and John J Irwin. Zinc 15–ligand discovery for everyone. Journal of chemical information and modeling, 55(11):2324–2337, 2015. ",
1651
+ "bbox": [
1652
+ 174,
1653
+ 459,
1654
+ 821,
1655
+ 488
1656
+ ],
1657
+ "page_idx": 12
1658
+ },
1659
+ {
1660
+ "type": "text",
1661
+ "text": "Richard S Sutton and Andrew G Barto. Reinforcement learning: An introduction. MIT press, 2018. ",
1662
+ "bbox": [
1663
+ 169,
1664
+ 496,
1665
+ 823,
1666
+ 511
1667
+ ],
1668
+ "page_idx": 12
1669
+ },
1670
+ {
1671
+ "type": "text",
1672
+ "text": "Kevin Swersky, Yulia Rubanova, David Dohan, and Kevin Murphy. Amortized bayesian optimization over discrete spaces. In Conference on Uncertainty in Artificial Intelligence, pages 769–778. PMLR, 2020. ",
1673
+ "bbox": [
1674
+ 174,
1675
+ 518,
1676
+ 825,
1677
+ 561
1678
+ ],
1679
+ "page_idx": 12
1680
+ },
1681
+ {
1682
+ "type": "text",
1683
+ "text": "Oleg Trott and Arthur J Olson. Autodock vina: improving the speed and accuracy of docking with a new scoring function, efficient optimization, and multithreading. Journal of computational chemistry, 31(2):455–461, 2010. ",
1684
+ "bbox": [
1685
+ 176,
1686
+ 569,
1687
+ 823,
1688
+ 612
1689
+ ],
1690
+ "page_idx": 12
1691
+ },
1692
+ {
1693
+ "type": "text",
1694
+ "text": "C. K. Williams and C. Rasmussen. Gaussian processes for regression. In Neural Information Processing Systems (NeurIPS), 1995. ",
1695
+ "bbox": [
1696
+ 176,
1697
+ 621,
1698
+ 821,
1699
+ 648
1700
+ ],
1701
+ "page_idx": 12
1702
+ },
1703
+ {
1704
+ "type": "text",
1705
+ "text": "Yutong Xie, Chence Shi, Hao Zhou, Yuwei Yang, Weinan Zhang, Yong Yu, and Lei Li. {MARS}: Markov molecular sampling for multi-objective drug discovery. In International Conference on Learning Representations, 2021. URL https://openreview.net/forum?id=kHSu4ebxFXY. ",
1706
+ "bbox": [
1707
+ 176,
1708
+ 657,
1709
+ 825,
1710
+ 700
1711
+ ],
1712
+ "page_idx": 12
1713
+ },
1714
+ {
1715
+ "type": "text",
1716
+ "text": "Checklist ",
1717
+ "text_level": 1,
1718
+ "bbox": [
1719
+ 174,
1720
+ 724,
1721
+ 254,
1722
+ 741
1723
+ ],
1724
+ "page_idx": 12
1725
+ },
1726
+ {
1727
+ "type": "text",
1728
+ "text": "1. For all authors... ",
1729
+ "bbox": [
1730
+ 214,
1731
+ 751,
1732
+ 339,
1733
+ 765
1734
+ ],
1735
+ "page_idx": 12
1736
+ },
1737
+ {
1738
+ "type": "text",
1739
+ "text": "(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes] We provide proofs (see Section 2 and Appendix) for our theoretical claims and fair empirical results with our proposed methods and baselines (see Section 4). \n(b) Did you describe the limitations of your work? [Yes] GFlowNet is limited by its use of bootstrapping, which is known to be challenging in Deep RL (see Section 5). \n(c) Did you discuss any potential negative societal impacts of your work? [Yes] Our theoretical work is fairly agnostic to applications, and aims to compete with existing MCMC-based methods (see Sections 1, 4, and 5). Our empirical work situates itself in the context of automated drug-discovery. ",
1740
+ "bbox": [
1741
+ 232,
1742
+ 768,
1743
+ 825,
1744
+ 911
1745
+ ],
1746
+ "page_idx": 12
1747
+ },
1748
+ {
1749
+ "type": "text",
1750
+ "text": "(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes] ",
1751
+ "bbox": [
1752
+ 236,
1753
+ 90,
1754
+ 823,
1755
+ 119
1756
+ ],
1757
+ "page_idx": 13
1758
+ },
1759
+ {
1760
+ "type": "text",
1761
+ "text": "2. If you are including theoretical results... ",
1762
+ "bbox": [
1763
+ 214,
1764
+ 123,
1765
+ 493,
1766
+ 138
1767
+ ],
1768
+ "page_idx": 13
1769
+ },
1770
+ {
1771
+ "type": "text",
1772
+ "text": "(a) Did you state the full set of assumptions of all theoretical results? [Yes] (b) Did you include complete proofs of all theoretical results? [Yes] All complete proofs are available in the Appendix. ",
1773
+ "bbox": [
1774
+ 238,
1775
+ 142,
1776
+ 825,
1777
+ 188
1778
+ ],
1779
+ "page_idx": 13
1780
+ },
1781
+ {
1782
+ "type": "text",
1783
+ "text": "3. If you ran experiments... ",
1784
+ "bbox": [
1785
+ 214,
1786
+ 191,
1787
+ 393,
1788
+ 207
1789
+ ],
1790
+ "page_idx": 13
1791
+ },
1792
+ {
1793
+ "type": "text",
1794
+ "text": "(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] \n(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] Hyperparameters and architectural choices are reported in the Appendix, and verifiable in the provided code. \n(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [No] We omit error bars for clarity, but we report standard deviations in the Appendix to verify the significance of our results. \n(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] See A.3. ",
1795
+ "bbox": [
1796
+ 238,
1797
+ 210,
1798
+ 825,
1799
+ 357
1800
+ ],
1801
+ "page_idx": 13
1802
+ },
1803
+ {
1804
+ "type": "text",
1805
+ "text": "4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets... ",
1806
+ "bbox": [
1807
+ 210,
1808
+ 361,
1809
+ 823,
1810
+ 376
1811
+ ],
1812
+ "page_idx": 13
1813
+ },
1814
+ {
1815
+ "type": "text",
1816
+ "text": "(a) If your work uses existing assets, did you cite the creators? [Yes] \n(b) Did you mention the license of the assets? [N/A] \n(c) Did you include any new assets either in the supplemental material or as a URL? [N/A] \n(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A] \n(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A] ",
1817
+ "bbox": [
1818
+ 238,
1819
+ 380,
1820
+ 825,
1821
+ 501
1822
+ ],
1823
+ "page_idx": 13
1824
+ },
1825
+ {
1826
+ "type": "text",
1827
+ "text": "5. If you used crowdsourcing or conducted research with human subjects... ",
1828
+ "bbox": [
1829
+ 214,
1830
+ 505,
1831
+ 705,
1832
+ 520
1833
+ ],
1834
+ "page_idx": 13
1835
+ },
1836
+ {
1837
+ "type": "text",
1838
+ "text": "(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A] \n(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A] \n(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A] ",
1839
+ "bbox": [
1840
+ 238,
1841
+ 523,
1842
+ 825,
1843
+ 613
1844
+ ],
1845
+ "page_idx": 13
1846
+ }
1847
+ ]
parse/train/Arn2E4IRjEB/Arn2E4IRjEB_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/train/Arn2E4IRjEB/Arn2E4IRjEB_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/train/H4e7mBnC9f0/H4e7mBnC9f0.md ADDED
@@ -0,0 +1,310 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Differentiable Spike: Rethinking Gradient-Descent for Training Spiking Neural Networks
2
+
3
+ Yuhang $\mathbf { L i } ^ { 1 : }$ ∗, Yufei $\mathbf { G u o ^ { 2 * } }$ , Shanghang Zhang3, Shikuang Deng1, Yongqing $\mathbf { H a i } ^ { 2 }$ , Shi $\mathbf { G u } ^ { \mathrm { 1 } \boxtimes }$
4
+
5
+ 1University of Electronic Science and Technology of China, 2Peking University, 3University of California Berkeley liyuhang699@gmail.com, yfguo@pku.edu.cn, gus@uestc.edu.cn
6
+
7
+ # Abstract
8
+
9
+ Spiking neural networks (SNNs) have emerged as a biology-inspired method mimicking the spiking nature of brain neurons. This biomimicry derives SNNs’ energy efficiency of inference on neuromorphic hardware. However, it also causes an intrinsic disadvantage in training high-performing SNNs from scratch since the discrete spike prohibits the gradient calculation. To overcome this issue, the surrogate gradient (SG) approach has been proposed as a continuous relaxation. Yet the heuristic choice of SG leaves it vacant how the SG benefits the SNN training. In this work, we first theoretically study the gradient descent problem in SNN training and introduce finite difference gradient to quantitatively analyze the training behavior of SNN. Based on the introduced finite difference gradient, we propose a new family of Differentiable Spike (Dspike) functions that can adaptively evolve during training to find the optimal shape and smoothness for gradient estimation. Extensive experiments over several popular network structures show that training SNN with Dspike consistently outperforms the state-of-the-art training methods. For example, on the CIFAR10-DVS classification task, we can train a spiking ResNet-18 and achieve $7 5 . 4 \%$ top-1 accuracy with 10 time steps.
10
+
11
+ # 1 Introduction
12
+
13
+ Recently, spiking neural networks (SNNs) have received increasing attention due to their biologyinspired neural behavior and efficient computation. SNNs deal with binary spike information and therefore enjoy the advantage of multiplication-free inference. Neuromorphic hardware such as TrueNorth [1] and Loihi [2] demonstrates that SNNs can save energy by orders of magnitude. Hybrid architecture like Tianjic [3] suggests its potential power for general intelligence when integrated with traditional artificial infrastructure. However, the bio-mimicry also causes an intrinsic disadvantage in training high-performing SNNs from scratch due to the discrete spike. As a result, obtaining a high-performing SNN has long been a critical problem limiting SNN’s deployment in practice.
14
+
15
+ To be more specific, the appealing advantage of the multiplication-free computation in SNN is not recognized in its training [4]. Modern ML frameworks such as Pytorch [5], JAX [6], and Tensorflow [7] do not provide efficient and general instructions or high-level functions to accelerate the convolution with 0/1 spike activation. Moreover, the binary activation in SNN produces allor-nothing gradients [8] that are incompatible with typical gradient-based optimization methods for efficient neural network training. To circumvent this problem, many works adopt surrogate gradients [8] (typically the derivative of a soft-relaxed function) to replace the spike non-linear gradient. Although the heuristic choice of SG is beneficial to enable the gradient descent in SNN training, the theoretical soundness of SG has not been justified so far. What’s more, the gradient descent in SNN training may follow different updating rules from ANN. In fact, since the true gradient value of spike activation does not exist, the adoption of SG raises a new question of how to replace the $\infty$ -gradient adaptively through the training process for a good updating strategy of parameters.
16
+
17
+ ![](images/012f9c41f16a3f7d725581105934c4ac57dfecbb0474bbc6673af5b5ff35c998.jpg)
18
+ Figure 1: Overall workflow of the proposed algorithm. We use a general, flexible Dspike function and control its shape with finite difference method to facilitate the surrogate gradient descent in training SNN.
19
+
20
+ In this work, we study this specialized problem of adaptive gradient estimation in SNN training. We first revisit the gradient descent algorithm with the finite difference method to accurately depict the loss landscape of adopting a surrogate gradient for the non-differentiable spike firing function. Then we further propose the Differentiable Spike (Dspike) function, which can adaptively change its shape and capture the direction of finite difference gradients. With such adaptive surrogate gradients, we establish an efficient algorithm of training SNN with large-scale models. The overall workflow of our algorithm is visualized in Fig. 1.
21
+
22
+ Our contributions can be summarized as follows:
23
+
24
+ • We identify the problem of adaptively estimating gradient in SNN training and propose a novel analysis framework for SNN’s surrogate gradient, through which we are able to not only explain why it works well but also indicate how we can improve its adaptivity to data through training. • We also introduce the novel Dspike function built from the hyperbolic tangent function. The Dspike function can learn its shape accordingly by matching it with the finite difference gradient. • Extensive experiments on both static and dynamic datasets show that our method is highly effective and efficient. For example, our model can achieve $7 5 . 4 \%$ top-1 accuracy on the CIFAR-DVS. Our SNN also only consumes $7 . 8 \%$ energy of the corresponding ANN on CIFAR-10.
25
+
26
+ # 2 Related Work
27
+
28
+ ANN-SNN Conversion. Generally, the algorithms to obtain a high-performance can be divided into two routes: (1) ANN-SNN conversion and (2) direct training SNN from scratch. Conversion-based methods [9, 10] utilize the knowledge from ANN and convert the ReLU activation to spike activation mechanism. This type of method can produce an SNN in a short time. For example, Rueckauer et al. [11] propose to traverse the training dataset to find the maximum activation. Then, the SNN can be converted by directly replacing several modules. In [12], maximum activation is abandoned since it may out-lie the central range of activation. The authors choose to find the percentile numbers for threshold voltage to improve the robustness. TSC [13] adopts the soft-reset (also known as reset by subtraction) mechanism and no leakage for conversion, which proves to be effective in conversion. Deng & Gu [14] decompose the conversion error to each layer, then propose to reduce the error by shifting the bias term. [15] first propose the calibration to reduce the conversion accuracy. ANN-SNN conversion is fast and accurate. However, achieving near lossless conversion requires a considerable amount of time steps $( > 2 0 0 )$ to accumulate the spikes, which may significantly add up the latency.
29
+
30
+ Direct Training SNN. In contrast to the conversion method, direct training of SNNs can lower the time step and may further reduce energy consumption. Direct training leverages gradient-descent algorithms. And many works have been developed to tackle the non-differentiability of spike activation. This non-differentiable activation function is similar to the quantization or binarization neural network [16, 17, 18] or adder neural network [19]. [20] achieve high performance on CIFAR10 and other neuromorphic datasets. Some works use probabilistic models to approximate the gradient [21], which is also developed in binary stochastic model [22]. Another common approach is to use rate-encoding networks for gradients calculation [23, 24]. They quantize the spike rate as the magnitude of information transmitted. (Wu et al. 2019 [25] improves the leaky integrate-and-fire (LIF) model to an iterative LIF model and develops STBP learning algorithm. Zheng et al. [26] further propose the tdBN algorithm to balance the gradient norm and smooth the loss function in SNN training, enabling large-scale model optimization.
31
+
32
+ # 3 Preliminary
33
+
34
+ # 3.1 Leaky Integrate-and-Fire Model
35
+
36
+ We use bold italic letters for vector representations. For example, $_ { \textbf { \em x } }$ and $\textbf { { y } }$ denote the input and target output variables. Bold capital letters like W denote the matrices (or tensors as clear from the text). Constants are denoted by small upright letters, e.g., $a$ . With bracketed superscript and subscript, we can denote the time dimension and the element indices, respectively. For example, $\mathbf { \boldsymbol { \mathsf { u } } } _ { i } ^ { ( t ) }$ means the $i$ -th membrane potential at time step $t$ . We adopt the well-known Leaky Integrate-and-Fire (LIF) neuron model for a spiking neural network (SNN). Given a membrane potential $\mathbf { \boldsymbol { u } } ^ { ( t ) }$ , the pre-synaptic potential is updated as
37
+
38
+ $$
39
+ \begin{array} { r } { \pmb { u } ^ { ( t + 1 ) , \mathrm { p r e } } = \tau \pmb { u } ^ { ( t ) } + \pmb { c } ^ { ( t + 1 ) } , \mathrm { w h e r e } \ \pmb { c } ^ { ( t + 1 ) } = \mathbf { W } \pmb { x } ^ { ( t + 1 ) } . } \end{array}
40
+ $$
41
+
42
+ Here, $\tau$ is a constant leaky factor within $( 0 , 1 )$ and $c ^ { ( t + 1 ) }$ is the pre-synaptic input at time step $t + 1$ . The input can be calculated from the dot-product between the weights and the spike from the previous layer. Let $V _ { t h }$ be the firing threshold, the membrane potential will fire a spike when it exceeds the threshold, and then hard-reset to 0, given by
43
+
44
+ $$
45
+ \pmb { y } ^ { ( t + 1 ) } = \{ \begin{array} { l l } { 1 } & { \mathrm { i f ~ } \pmb { u } ^ { ( t + 1 ) , \mathrm { p r e } } > V _ { t h } } \\ { 0 } & { \mathrm { o t h e r w i s e } } \end{array} , \pmb { u } ^ { ( t + 1 ) } = \pmb { u } ^ { ( t + 1 ) , \mathrm { p r e } } \cdot ( 1 - \pmb { y } ^ { ( t + 1 ) } )
46
+ $$
47
+
48
+ After firing, the spike output $\pmb { y } ^ { ( t + 1 ) }$ will propagate to the next layer and become the input $\boldsymbol { x } ^ { ( t + 1 ) }$ of the next layer, (note that we omit the layer index for simplicity). $V _ { t h }$ is set to 0.5 in this work.
49
+
50
+ Softmax in SNN. In the general classification model, the final network output will be leveraged to compute the softmax and then to find the winner class. However, the network output is highly variant per input sample, and unlike ReLU activation, the output could be positive or negative. For this reason, we choose to only integrate the network output, and do not fire them across time, as did in recent practices [26, 27].
51
+
52
+ $$
53
+ { \pmb y } _ { \mathrm { n e t } } = \frac { 1 } { T } \sum _ { i = 1 } ^ { T } { \pmb c } _ { \mathrm { n e t } } ^ { ( t ) } = \frac { 1 } { T } \sum _ { i = 1 } ^ { T } { \bf W } { \pmb x } ^ { ( t ) } ,
54
+ $$
55
+
56
+ Then, we can compute the cross-entropy loss based on the ture label and Softmax $( y _ { \mathrm { n e t } } )$
57
+
58
+ # 3.2 Time-dependent Batch Normalization
59
+
60
+ Batch Normalization (BN) [28] is used to reduce internal covariate shift and smooth the loss landscape [29] during the optimization of an ANN. It enables the stable training of ANN even with more than 100 layers on the large-scale dataset, e.g. ResNet-152 [30]. However, BN layers are not designed to normalize spatial-temporal data at first. And simply transplanting BN in SNN training will lead to undesired results. To solve this problem, Zheng et al. [26] propose time-dependent Batch Normalization (tdBN), which normalizes the data in both spatial and temporal paradigm. tdBN will gather the pre-synaptic input along the time dimension, denoted by $\mathbf { C } = [ \pmb { c } ^ { ( 1 ) } , \pmb { c } ^ { ( 2 ) } , \pmb { , . . . } , \pmb { c } ^ { ( T ) } ]$ , and then normalize it by
61
+
62
+ $$
63
+ \begin{array} { r l r } & { \bar { \bf C } = \frac { \alpha V _ { t h } \left( { \bf C } - \mathbb { E } \left[ { \bf C } \right] \right) } { \sqrt { \mathbb { V } \mathbb { A } \mathbb { R } \left( { \bf C } \right) + \epsilon } } \qquad } & { \# \mathrm { n o r m a l i z e } } \\ & { \hat { \bf C } = \gamma \bar { \bf C } + \beta , \qquad } & { \# \mathrm { a f f i n e ~ t r a n s f o r m a t i o n } } \end{array}
64
+ $$
65
+
66
+ where $\mathbb { E }$ and $\mathbb { V } \mathbb { A } \mathbb { R }$ compute the mean and variance in channel dimension. $\gamma$ and $\beta$ are learnable parameters. Note that in tdBN the normalized tensor will multiply $\alpha V _ { t h }$ , which can prevent over-fire and under-fire by choosing $\alpha$ wisely. After tdBN, the pre-synaptic input in each time step will be fed into Eq. (1). tdBN stabilizes the training of SNN and achieves good results. We also adopt this training technique in our framework. See [26] for more details of tdBN.
67
+
68
+ # 4 Methodology
69
+
70
+ # 4.1 Non-Differentiable Spike
71
+
72
+ One of the most notorious problems in SNN training is the non-differentiability of the firing function Eq. (2). The firing function could be viewed as a variant of sign function, whose derivative is identified as the Dirac delta function. This derivative is 0 almost everywhere except for the threshold that grows to infinity. Seemingly, directly using the Dirac delta function is not an ideal choice for gradient descent-based learning. To demonstrate this problem, let $L$ denote the task loss objective, we can compute the gradient of weights parameters using the spatial-temporal backpropagation (STBP):
73
+
74
+ $$
75
+ \frac { \partial L } { \partial \mathbf { W } } = \sum _ { t } \frac { \partial L } { \partial \pmb { y } ^ { ( t ) } } \frac { \partial \pmb { y } ^ { ( t ) } } { \partial \pmb { u } ^ { ( t ) , \mathrm { p r e } } } \frac { \partial \pmb { u } ^ { ( t ) , \mathrm { p r e } } } { \partial \pmb { c } ^ { ( t ) } } \frac { \partial \pmb { c } ^ { ( t ) } } { \partial \mathbf { W } } .
76
+ $$
77
+
78
+ In above equation, $\frac { \partial \pmb { y } ^ { ( t ) } } { \partial \pmb { u } ^ { ( t ) , \mathrm { p r e } } }$ is the gradient of firing function and is 0 almost everywhere, as aforementioned. As a consequence, the gradient descent $\begin{array} { r } { ( \mathbf { W } \mathbf { W } - \eta \frac { \partial L } { \partial \mathbf { W } } ) } \end{array}$ either freezes weights or updates the weights to infinity.
79
+
80
+ To mitigate this problem, prior work seeks an alternative gradient (also known as surrogate gradient) to circumvent this problem. A popular surrogate gradient may refer to the rectangular function proposed in [4], given by
81
+
82
+ $$
83
+ \frac { \partial \pmb { y } ^ { ( t ) } } { \partial \pmb { u } ^ { ( t ) , \mathrm { p r e } } } = \frac { 1 } { a } \mathrm { s i g n } \left( \left| \pmb { u } ^ { ( t ) , \mathrm { p r e } } - V _ { t h } \right| < \frac { a } { 2 } \right) ,
84
+ $$
85
+
86
+ where $a$ is a hyper-parameter and usually set to 1. When $V _ { t h } = 0 . 5 , a = 1$ , the gradient is simplified to 1 if $0 \leq u ^ { ( t ) , \mathrm { p r e } } \leq 1$ otherwise 0. This is known as the Straight-Through Estimator in Bengio et al. [22] and is broadly applied in binary networks [31]. Another family of surrogate gradient may refer to triangular gradients [32], given by
87
+
88
+ $$
89
+ \frac { \partial \pmb { y } ^ { ( t ) } } { \partial \pmb { u } ^ { ( t ) , \mathrm { p r e } } } = \gamma \operatorname* { m a x } \left( 0 , 1 - \left| \frac { \pmb { u } ^ { ( t ) , \mathrm { p r e } } } { V _ { t h } } - 1 \right| \right) .
90
+ $$
91
+
92
+ This surrogate gradient is computed based on the distance between the potential and threshold. Despite various surrogate gradients achieve acceptable accuracy, there lacks a theoretical justification for its reason and effectiveness.
93
+
94
+ # 4.2 Rethinking Gradient-Descent in Spiking Neural Networks
95
+
96
+ Gradient-descent (GD) algorithm is a first-order iterative optimization method. Theoretically, for each iteration, GD aims to find the steepest direction for the descent that minimizes the task loss:
97
+
98
+ $$
99
+ \operatorname* { m i n } _ { | | \Delta \mathbf { W } | | \leq \varepsilon } L ( \mathbf { W } + \Delta \mathbf { W } ) \approx \operatorname* { m i n } _ { | | \Delta \mathbf { W } | | \leq \varepsilon } L ( \mathbf { W } ) + \Delta \mathbf { W } \frac { \partial L } { \partial \mathbf { W } }
100
+ $$
101
+
102
+ Note that the right-hand side of the minimization is approximated by the first-order Taylor expansion. Given that $L ( \mathbf { W } )$ is constant at the current iteration, therefore we only have to find the right $\Delta \mathbf { W }$ that minimizes the second term. Since the 2nd term is a linear in $\Delta \mathbf { W }$ , it can be made as negative as we like by taking $\Delta { \bf W }$ large. Therefore the minimum is $\begin{array} { r } { \Delta \mathbf { W } = - \varepsilon \frac { \nabla \mathbf { w } L } { | | \nabla \mathbf { w } L | | } } \end{array}$ , (where $\begin{array} { r } { \nabla { \bf w } L = \frac { \partial L } { \partial \bf W } . } \end{array}$ ∂ L∂ W ).
103
+
104
+ Note that the above condition is only sufficient for $\varepsilon 0$ to correctly approximate the loss with Taylor expansion. However, $\varepsilon 0$ means $\begin{array} { r } { \Delta \mathbf { W } = - \varepsilon \frac { \nabla \mathbf { w } L } { | | \nabla \mathbf { w } L | | } 0 } \end{array}$ , but in practice GD updates the weights by a small step (determined by learning rate), which, indicates a mismatch between the practical implementation and the theoretical assumption. In other words, gradient only inspects the change rate of loss around an infinitely small neighborhood, however, we are interested in the change rate around a tiny (but not infinitely small) area. In the case of SNN, the gradient will always be $0 ^ { \mathit { \Phi } }$ , yet for a tiny neighborhood the loss function will change, leading to non-zero gradients. To penetrate the non-differentiability of the firing function, we adopt a technique called finite difference. It estimates the gradient by evaluating the loss objective near the coordinate:
105
+
106
+ ![](images/45783978b928cbb997105b7291a1e3566ef066a2a4fbc4c021e17b11b23e1ac2.jpg)
107
+ Figure $\mathbf { 2 \alpha \& }$ Table 1: Left: The cosine similarity between the gradients used for update and the FDG. In (a) we show ANN gradients and in (b) we show SNN rectangular surrogate gradients. Right: Training SNN with finite difference gradient, given different $\varepsilon$ .
108
+
109
+ $$
110
+ \hat { \nabla } _ { \varepsilon , w } L = \left( \frac { L ( w _ { 1 } + \varepsilon e _ { 1 } ) - L ( w _ { 1 } - \varepsilon e _ { 1 } ) } { 2 \varepsilon } , \ldots , \frac { L ( w _ { k } + \varepsilon e _ { k } ) - L ( w _ { k } - \varepsilon e _ { k } ) } { 2 \varepsilon } \right) ,
111
+ $$
112
+
113
+ where $\textbf { \em w }$ is the flattened vector of $\mathbf { W }$ and $e _ { i }$ refers to standard basis vector with 1 at $i$ -th index. $\varepsilon$ is some small constant, e.g. 0.001. We call $\hat { \nabla } _ { \varepsilon , w } L$ as finite difference gradient (FDG). By the definition of gradient, we know FDG becomes the true gradient when $\varepsilon 0$ . FDG can be a useful tool in GD-based learning, however, evaluating finite difference for each element in the weight vector is tedious, which greatly slows down the training process. Nevertheless, FDG still offers us a choice to evaluate the gradient mismatch problem quantitatively.
114
+
115
+ In order to illustrate this, we construct a toy problem: a simple 2-layer CNN on the MNIST dataset. The first layer is a $3 \mathrm { x } 3$ convolutional layer (output channel number is 6) with ReLU activation (or LIF spike activation) and average pooling for down-sampling. Then, we directly add a fully connected layer to predict the classification results. We train the toy model on MNIST for 5 epochs, with batch size 128 and learning rate 0.01 decayed to 0. In an effort to compute the FDG of the first layer, we have to perform $2 \times 1 \times 6 \times 3 \times 3 = 1 0 8$ times forward pass 3. In contrast, one has to perform 22 million times forward passes on a ResNet-18 [30] to compute the FDG of all parameters.
116
+
117
+ Experiment I: FDG in ANN. We first train an ANN on MNIST and compare the disparity between real gradients and FDG. We use cosine similarity (i.e. $\begin{array} { r } { \cos _ { - } \sin ( { \pmb x } _ { 1 } , { \pmb x } _ { 2 } ) = \frac { { \pmb x } _ { 1 } { \pmb x } _ { 2 } } { | | { \pmb x } _ { 1 } | | _ { 2 } | | { \pmb x } _ { 2 } | | _ { 2 } } ) } \end{array}$ x1x2||x1||2||x2||2 ) to determine the angle between these two gradient vectors. For each epoch, we compute the mean cosine similarity in the first 100 training iterations. The results are demonstrated in Fig. 2(a). The FDG and real gradients consistently have an extremely similar direction $( > 0 . 9 9 \mathrm { c o s \_ s i m } )$ with $\varepsilon$ varying from 0.1 to 0.001. In conclusion, we show that (1) FDG is a valid signal and (2) the real gradients can effectively find the change rate within a small neighborhood in ANN optimization.
118
+
119
+ Experiment II: FDG in SNN. Then, we compare the cosine similarity between the surrogate gradients in SNN and the FDG. In Fig. 2(b), we can tell that surrogate gradients share similar gradient direction with FDG when $\varepsilon = 0 . 1$ (i.e. more than 0.8 cosine similarity). However, decreasing $\varepsilon$ will lead to lower cosine similarity. In the case of $\varepsilon = 0 . 0 0 1$ , the angle between FDG and the surrogate gradients is nearly 90 degrees, (for comparison, in high-dimensional space, two arbitrary random Gaussian vectors are very likely to be orthogonal). This observation concludes that surrogate gradient can predict the change rate of loss in a relatively larger neighborhood, which justifies the soundness of surrogate gradients. However, SG fails to predict the FDG in small step size $\varepsilon$ . To this end, we need to figure out whether a large step size is better or a small step size is better.
120
+
121
+ Experiment III: Training SNN with FDG. In SNN optimization, a natural question arises: What ε is optimal for gradient descent? First, the $\varepsilon$ has to be small enough to compute the non-linearity of the loss surface, meanwhile, it has to be large enough to ignore the noise from the rough step function. For this reason, we explore the optimal $\varepsilon$ by applying FDG in SNN optimization. The results are demonstrated in the Table 1. Note that all methods are trained on MNIST for only 10 epochs here. We show that the rectangular surrogate gradient with $a = 1$ reaches $9 4 . 9 \%$ accuracy. For FDG optimization, we evaluate $\varepsilon$ ranging from 0.001 to 0.5, and we find 0.1 is the best choice for optimizing SNN. The results confirm our assumption that $\varepsilon$ has to be neither too big nor too small. It also tells us using the instant change rate (very small $\varepsilon$ ) will lead to undesired performance degradation.
122
+
123
+ # 4.3 Differentiable Spike
124
+
125
+ In this section, we introduce the Dspike function, a novel surrogate gradient estimator, which can cover a large range of choices for SG. We choose the hyperbolic tangent function $\begin{array} { r } { \operatorname { t a n h } ( x ) = \frac { e ^ { x } - e ^ { - x } } { e ^ { x } + e ^ { - x } } } \end{array}$ as our basic building function for gradient estimation:
126
+
127
+ $$
128
+ \operatorname { D s p i k e } ( x ) = { \left\{ \begin{array} { l l } { 1 } & { { \mathrm { i f ~ } } x > 1 } \\ { a \cdot \operatorname { t a n h } ( b ( x - c ) ) + d } & { { \mathrm { i f ~ } } 0 \leq x \leq 1 } \\ { 0 } & { { \mathrm { i f ~ } } x < 0 } \end{array} \right. }
129
+ $$
130
+
131
+ When $x < 0$ or $x > 1$ , we choose to clip $x$ as did in other practice. The vanilla tanh function maps $( - \infty , + \infty )$ to $( - 1 , 1 )$ , thus we have four parameters to control its shape to alter the function mapping: from $[ - 1 , 1 ]$ to [1, 1]. We first use $c = V _ { t h } = 0 . 5$ to set the symmetry center to (0.5, 0.5). Parameter $b ( b > 0 )$ is called the temperature factor, it controls the shape of the Dspike function. Parameter $a$ and $d$ can then be determined by setting $\mathrm { D s p i k e ( 0 ) } = 0 , \mathrm { D s p i k e ( 1 ) } = 1$ . As a result, we can rewrite the function as:
132
+
133
+ $$
134
+ \mathrm { D s p i k e } ( x , b ) = \frac { \operatorname { t a n h } ( b ( x - 0 . 5 ) ) + \operatorname { t a n h } ( b / 2 ) } { 2 ( \operatorname { t a n h } ( b / 2 ) ) } , \mathrm { i f ~ } 0 \leq x \leq 1 .
135
+ $$
136
+
137
+ Dspike function has the capability to adjust the shape of the function, leading to different surrogate gradient estimations. To demonstrate that, we have the following lemma:
138
+
139
+ Lemma 4.1. By changing the temperature $b$ , the shape of Dspike function can be altered. Specifically, we have $\dim _ { b \to 0 _ { + } } { \mathrm { D s p i k e } } ( x ) \to x$ and $\scriptstyle \operatorname* { l i m } _ { b \to + \infty }$ $\mathrm { D s p i k e } ( x ) \to \mathrm { s i g n } ( x - 0 . 5 )$ .
140
+
141
+ Proof. We first prove the case $b \to 0 _ { + }$ . In this case, applying Taylor expansion to the tanh we have:
142
+
143
+ $$
144
+ \operatorname { t a n h } ( b x ) \approx b x - { \frac { b ^ { 3 } x ^ { 3 } } { 3 } } + \cdots + { \frac { 2 ^ { ( 2 n ) } ( 2 ^ { ( 2 n ) } - 1 ) B _ { 2 n } ( b x ) ^ { 2 n - 1 } } { ( 2 n ) ! } } ,
145
+ $$
146
+
147
+ where $B _ { n }$ is the $n$ -th Bernoulli number. When $b \to 0$ , we can safely ignore higher-order terms and only keep $b x$ . Thus, we can rewrite Eq. (12) to ${ \mathrm { D s p i k e } } ( x , b ) = { \sqrt [ { b } ] { b } } { \stackrel { - } { = } } x$ . Then, we prove the case $b \to + \infty$ . Since $\scriptstyle \operatorname* { l i m } _ { x \to + \infty } \operatorname { t a n h } ( x ) \to 1$ , we have:
148
+
149
+ $$
150
+ \operatorname* { l i m } _ { b \to + \infty } \operatorname { D s p i k e } ( x , b ) \{ \{ \begin{array} { l l } { \frac { 2 * \operatorname { t a n h } ( + \infty ) } { 2 * \operatorname { t a n h } ( + \infty ) } = 1 } & { \mathrm { i f ~ } x > 0 . 5 } \\ { \frac { \operatorname { t a n h } ( + \infty ) } { 2 * \operatorname { t a n h } ( + \infty ) } = 0 . 5 } & { \mathrm { i f ~ } x = 0 . 5 } \\ { \frac { 0 } { 2 * \operatorname { t a n h } ( + \infty ) } = 0 } & { \mathrm { i f ~ } x < 0 . 5 } \end{array}
151
+ $$
152
+
153
+ With this temperature factor, our algorithm can simulate a wide range of surrogate gradients with different smoothness. We visualize the transition in Fig. 3 from both forward perspective and backward perspective. As aforementioned, surrogate gradient can mimic the FDG in a relatively large neighborhood. Our intuition is that the optimal surrogate gradient can be found by choosing temperature wisely. Thus our task becomes to optimize temperature and network parameters simultaneously during training. As did in former toy experiments (Sec. 4.2), we verify the cosine similarity between our Dspike gradients and the FDG at the beginning of each training epoch and update the temperature to better match the FDG. This algorithm is detailed in Algo. 1.
154
+
155
+ As abovementioned, evaluating FDG could be time-consuming, due to the two times evaluation of the final loss for each weight element. Therefore, we choose to only compute the FDG in the first layer for two reasons. First, the first layer has much fewer weights. In ResNet-18 (for CIFAR10 dataset), the first layer only has $3 \times 3 \times 3 \times 6 4 = 5 7 6$ elements. Second, the gradient propagation may accumulate the error in the former layers, which effectively measures the gradient mismatch.
156
+
157
+ ![](images/b058289d96cf2a3af515bea104b590c2e4c5ac976b0e01ce56486282f76a0509.jpg)
158
+ Figure 3: The forward plot (left) as well as the backward plot (right) of Dspike function. By changing temperature parameter we can manipulate the gradient estimation in SNN training.
159
+
160
+ # Algorithm 1: Training SNN with Dspike gradient
161
+
162
+ Input: SNN to be trained; Training dataset, total training epoch $E$ , total training iteration in one epoch $I$ , FDG step size $\varepsilon$ , temperature update step size $\Delta b$ , initialized temperature $b ^ { 0 }$ .
163
+ for all $e = 1 , 2 , \ldots , E$ -th epoch do Collect input data and labels, computing the FDG $( \hat { \nabla } _ { \varepsilon , w } L )$ of the first layer using $\varepsilon$ ; for all $b$ in $\{ b ^ { e - 1 } , b ^ { e - 1 } + \Delta b , b ^ { e - 1 } - \Delta b \}$ do Compute Dsipke surrogate gradient $\nabla _ { b , w } L$ and $\cos \underline { { \mathrm { ~ \scriptstyle ~ \psi ~ } } } \mathrm { s i m } ( \hat { \nabla } _ { \varepsilon , w } L , \nabla _ { b , w } L )$ Find the optimal temperature with the highest cosine similarity and update it to $b ^ { e }$ ; for all $i = 1 , 2 , \dots , I$ -iteration do Get training data and labels, compute Dspike surrogate gradient using optimal $b$ ; Descend loss function and update weights;
164
+
165
+ return trained SNN.
166
+
167
+ # 4.4 Time Inheritance Training
168
+
169
+ We also introduce a novel training pipeline that can effectively reduce the time for training multiple SNNs. Unlike ANN-SNN conversion, direct training SNN is performed with a fixed time step $T$ . As a result, we must learn a new SNN from scratch if we decide to use another different $T$ . We propose Time Inheritance Training (TIT) pipeline to ameliorate this problem. First, we train an SNN to converge with high $T$ , e.g. 20. Then, we use this well-trained model to initialize an SNN with lower $T$ , say $T = 1 0$ . Consequently, the initialized model has exactly the same output as the former model in the first 10 time steps, enabling better initialization and faster convergence. In other words, TIT progressively reduces the time step finetuning from a higher time step SNN first. This idea resembles the curriculum learning proposed in Bengio et al. [33], which suggests learning the easy task first. Armed with TIT, we can reduce the training time of subsequent models by $7 5 \%$ , while sharing the same task performances.
170
+
171
+ # 5 Experiments
172
+
173
+ In this section, we report experimental results for our Dspike algorithm on CIFAR [34] and ImageNet dataset [35]. For static image dataset, we encode the images to spike using the first layer in the SNN, as adopted in recent works [27]. For the neuromorphic image dataset, the images are already converted to 0/1 spike format. We also replace the max-pooling layer with the average-pooling layer in the network architecture. The detailed implementation is described in each subsection.
174
+
175
+ # 5.1 Network Architecture Choice
176
+
177
+ For CIFAR series experiments. We mainly adopt the ResNet-family architectures [30]. Unlike traditional ResNet structure [30], we use a modified version with 3 stem layers and avg-downsample block, as introduced in [36]. Our ResNet-18 architectures contains 4 stages with 2 basic residual block in each stage. Our initial channel is set to 64 and doubled in each stage. In comparison with [26], they use ResNet-19 with 3 stages, with 3 blocks in the first 2 stages and 2 blocks in the last stage. However, they choose 128 channel and they has larger receptive field than our model. In general, their ResNet-19 has ${ \sim } 1 0$ times more operations than our ResNet-18. For ImageNet, we use the same VGG-16 as used in [27] and the same ResNet-34 as used in [26].
178
+
179
+ Table 2: Training Spiking Neural Networks on CIFAR10 and CIFAR100.
180
+
181
+ <table><tr><td>Dataset</td><td>Method</td><td>Type</td><td>Architecture</td><td>Time Step</td><td>Accuracy</td></tr><tr><td rowspan="10">CIFAR10</td><td>SpikeNorm [10]</td><td>ANN-SNN conversion</td><td>VGG-16</td><td>2500</td><td>91.55</td></tr><tr><td>Hybrid-Train [40]</td><td>Hybrid</td><td>VGG-16</td><td>200</td><td>92.02</td></tr><tr><td>Spike-based BP [41]</td><td>SNN training</td><td>ResNet-11</td><td>100</td><td>90.95</td></tr><tr><td>STBP [4]</td><td>SNN training</td><td>5Conv, 2FC</td><td>12</td><td>90.53</td></tr><tr><td>TSSL-BP [42]</td><td>SNN training</td><td>5Conv,2FC</td><td>5</td><td>91.41</td></tr><tr><td>Diet-SNN [27]</td><td>SNN training</td><td>VGG-16</td><td>5</td><td>92.70</td></tr><tr><td></td><td>SNN training</td><td></td><td>6</td><td>93.16</td></tr><tr><td rowspan="3">STBP-tdBN[26]</td><td rowspan="3"></td><td>ResNet-19</td><td>4</td><td>92.92</td></tr><tr><td></td><td>2</td><td>92.34</td></tr><tr><td></td><td>6</td><td>94.25±0.07</td></tr><tr><td rowspan="3"></td><td>Dspike</td><td>SNN training</td><td>ResNet-18</td><td>4</td><td>93.66±0.05</td></tr><tr><td></td><td></td><td></td><td>2</td><td>93.13±0.07</td></tr><tr><td>BinarySNN [43] Diet-SNN [27]</td><td>BNN-SNN conversion SNN training</td><td>VGG-15 VGG-16</td><td>62</td><td>63.20</td></tr><tr><td rowspan="3">CIFAR100</td><td></td><td></td><td></td><td>5</td><td>69.67</td></tr><tr><td>Dspike</td><td>SNN training</td><td>ResNet-18</td><td>6 4</td><td>74.24±0.10 73.35±0.14</td></tr><tr><td></td><td></td><td></td><td>2</td><td>71.68±0.12</td></tr><tr><td rowspan="3"></td><td>Rollout [44]</td><td>Streaming roll out ANN</td><td>DenseNet</td><td></td><td></td></tr><tr><td>CIFAR10-DVS STBP-tdBN [26]</td><td>SNN training</td><td>ResNet-19</td><td>10 10</td><td>66.8</td></tr><tr><td>Dspike</td><td>SNN training</td><td>ResNet-18</td><td>10</td><td>67.8 75.4±0.05</td></tr></table>
182
+
183
+ # 5.2 CIFAR
184
+
185
+ The CIFAR10 (100) dataset contains 50K training and 10K test images with $3 2 \times 3 2$ pixels. We use AutoAugment [37] and Cutout [38] for data augmentation. We use ResNet-18 architecture for running experiments. We train the corresponding ANN first and use it to initialize the first SNN with $( T = 6$ ), then we use Time Inheritance Training to gradually reduce the time step to 2. For FDG computation, we use the best practice $\varepsilon = 0 . 1$ in the toy experiments. The temperature is initialized to 1, and we set the update step size to $\Delta b = 0 . 2$ . We adopt SGD optimizer with 0.9 momentum. In the first round of TIT, we train the model for 300 epochs with a learning rate of 0.01 cosine decayed [39] to 0. In the rest rounds of TIT, we only train the model for 50 epochs with a learning rate of 0.004. Weight decay (L2 regularization) is set to 0.0001. We run the model with 4 GTX 1080Tis. For each run, we report the mean accuracy as well as the standard deviation with 3 trials.
186
+
187
+ We summarize the overall results in Table 2. On CIFAR10, our work can outperform state-of-the-art by $1 . 0 9 \%$ accuracy when $T = 6$ . It is also worth noting that the ResNet-19 used in [26] has $2 \mathbf { x }$ channel numbers and a larger feature-map, translating to $1 0 \mathrm { x }$ computation cost. Nevertheless, our ResNet-18 with Dspike still achieves higher accuracy. Notably, our ResNet-18 $T = 2 , 4$ ) is trained with TIT for only 50 epochs, yet still reaches a new state-of-the-art. We also conduct an ablation study: training a 2 time step spiking ResNet-18 without TIT for 300 epochs. The accuracy is only $9 3 . 1 3 \%$ which is subpar with the TIT method. We also verify Dspike on CIFAR100, with the same training pipeline here and we find our model can achieve much better performances than Diet-SNN [27].
188
+
189
+ To further demonstrate the effectiveness of our method, we apply the Dspike function on the eventstream dataset CIFAR10-DVS [45]. CIFAR10-DVS contains 10k $1 2 8 \times 1 2 8$ images converted from CIFAR10. We split the dataset into 9k training images and $1 \mathrm { k }$ test images following the prior practice [26]. For data pre-processing and augmentation, we first resize the training image frames to $4 8 \times 4 8$ , then apply random horizontal flip. Additionally, we apply random roll within 5 pixels. The test images are directly resized to $4 8 \times 4 8$ . Training hyper-parameters are kept the same with the CIFAR10 experiments. Our proposed method can achieve $7 5 . 4 \%$ averaged top-1 accuracy on CIFAR10-DVS, with $7 . 6 \%$ absolute accuracy improvement compared with the existing state of the art.
190
+
191
+ ![](images/62ca32b702e6f8b0fce46b1b5de2fee86e70e10e3991c02c4413ea2c9190f967.jpg)
192
+ Figure 4 & Table 3: Left: Activation sparsity for each LIF layer. The $\mathbf { X }$ -axis denotes the layer index while the $\mathbf { y }$ -axis denotes the activation sparsity. Right: The computation operations count and the energy consumption comparison between ANN and SNN for each run, we select SNN from existing literature.
193
+
194
+ Table 4: Training Spiking Neural Networks on ImageNet.
195
+
196
+ <table><tr><td>Method</td><td>Type</td><td>Architecture</td><td>Time Step</td><td> Accuracy</td></tr><tr><td>SpikeNorm [10]</td><td>ANN-SNN conversion</td><td>ResNet-34</td><td>2500</td><td>65.47</td></tr><tr><td>Hybrid-Train [40]</td><td>Hybrid</td><td>ResNet-34</td><td>250</td><td>61.48</td></tr><tr><td>Hybrid-Train [41]</td><td>Hybrid</td><td>VGG-16</td><td>250</td><td>65.19</td></tr><tr><td>STBP-tdBN [4]</td><td>SNN training</td><td>ResNet-34</td><td>6</td><td>63.72</td></tr><tr><td>Diet-SNN [27]</td><td>SNN training</td><td>VGG-16</td><td>5</td><td>69.00</td></tr><tr><td>Dspike</td><td>SNN training</td><td>ResNet-34</td><td>6</td><td>68.19</td></tr><tr><td>Dspike</td><td>SNN training</td><td>VGG-16</td><td>5</td><td>71.24</td></tr></table>
197
+
198
+ # 5.3 ImageNet
199
+
200
+ In this section we verify our algorithm on the ImageNet dataset. ImageNet dataset has more than $1 2 5 0 \mathrm { k }$ training images and 50k test images. We use the standard pre-processing and augmentation for training data [30]. The test data is directly centered cropped to $2 2 4 \times 2 2 4$ . We train ResNet-34 and VGG-16 on ImageNet using the same architecture in the CIFAR experiments. Each network is trained for 100 epochs with SGD optimizer with 0.9 momentum. The learning rate is set to 0.04 and weight decay is set to 0.00004. We train each model on 32 GTX 1080Tis with batch size of 10 per GPU. Following [26], to avoid the biased statistics, we synchronize the batch mean and variance across each device. Results are demonstrated in Table 4, Dspike training obtain $4 . 5 \%$ improvement compared to STBP-tdBN [26] and $2 . 2 \%$ improvement compared to Diet-SNN [27].
201
+
202
+ # 5.4 Sparsity, Efficiency, and Energy Cost
203
+
204
+ In this section, we measure the sparsity and efficient computation as well as the energy consumption of SNN. For ANN, the dot-product performs multiply-accumulate (MAC) operation, which is composed of an addition and a multiplication. In the case of SNN, its event-based operation and binary activation enable multiplication-free (except for the first rate-encoding layer) inference. Only one addition is needed if a spike is activated. In Fig. 4 we visualize the mean sparsity of activation of our spiking ResNet-18 on the whole CIFAR10 test set. We can see that each LIF layer has no more than $32 \%$ sparsity rate, which greatly saves energy. We also measure the operation number in Table 3. The addition count is calculated by $s * T * A$ , where $s$ is the mean sparsity, $T$ is the time step and $A$ is the addition number in ANN. For multiplication in SNN, we set it to the FLOPs of the first layer and scale it by $T$ . Our spiking ResNet-18 with 2 time-step has the lowest operation need for the inference. Then, we measure the energy consumption. Following [27], the energy is measured in $4 5 \mathrm { { n m } }$ CMOS technology. The MAC operation in ANN costs $4 . 6 p J$ energy and the accumulation in SNN costs $0 . 9 p J$ energy. Based on this, we compute the energy cost and put it in the table. Our network only costs $8 0 . 3 m J$ for a single forward, and consumes $1 2 . 8 \times$ lower energy compared with ANN.
205
+
206
+ # 5.5 Ablation Study
207
+
208
+ Our experiments use the same $\varepsilon$ for dataset and network architectures. In this section, we use different
209
+
210
+ value for $\varepsilon$ and compare their results. The results is included in Table 5. Generally, we find a low temperature will decrease the performance, as we explained in Sec. 4.2, the desired optimization algorithm should ensure each update will decrease the loss function. Thus, the instantaneous derivative in SNN cannot measure such curvature information since the instantaneous
211
+
212
+ Table 5: Accuracy comparison given different $\varepsilon$
213
+
214
+ <table><tr><td>Dataset</td><td>ε=0.01</td><td>ε=0.05 ε=0.1 ε=0.2</td><td></td></tr><tr><td>CIFAR10</td><td>91.78</td><td>93.11</td><td>94.07</td></tr><tr><td>CIFAR100</td><td>70.97</td><td>72.19</td><td>93.84 74.31 74.57</td></tr></table>
215
+
216
+ derivative is always 0. Therefore, we find a large epsilon can help improve the performance. Indeed, the optimal $\varepsilon$ requires tuning, but our empirical results show that 0.1 can have good results.
217
+
218
+ # 5.6 Visualization
219
+
220
+ In this section, we provide further experimental visualization. In Fig. 5, we plot the temperature curve for CIFAR10-DVS experiments. The spiking ResNet-18 was trained for 300 epochs with cosine learning rate decay. We initialize $b$ to 1.0 and use $\Delta b { = } 0 . 2$ to optimize both temperature for gradient calculation and the weights parameters for network learning. For the initial 25 epochs, the temperature remains less-than-1. We think this is primarily due to the complex loss landscape at the starting stage of the training. During the 20 to 80 epoch, the temperature continues to be increasing. In this stage of learning the FDG desires to learn a sharp, narrow gradient with low bias but high variance. We also find the accuracy curve becomes more unstable in this stage of the training, as a consequence of the sharp gradient. After 80 epochs, the temperature becomes decreasing. Although the decreasing process is not aggressive as the former increasing stage, the trend is still obvious. From 80-250, the temperature decreases from 4.0 to 1.6 with some fluctuations. Then, at the end of the training stage, the temperature again becomes increasing.
221
+
222
+ The intuition behind this tuning mechanism may remain unexplainable right now, however, we think it is the intrinsic nature of the gradient estimation in SNN. Through FDG, we are able to optimize the gradient calculation along with the weights learning.
223
+
224
+ ![](images/cbb32f98c9e8e60b4ab37fe6eeffec456f9a770d5e75d61cb0dff82ce30137ae.jpg)
225
+ Figure 5: The evolutution of temperature $^ { b }$ during optimization.
226
+
227
+ # 6 Discussion
228
+
229
+ In this work, we inspect the training process of SNN when using the surrogate gradient. The proposed finite difference gradient and Dspike function can be assembled with other optimization methods as a fundamental module of gradient estimation for training SNN. This suggests that the performance of SNN can be further increased when more sophisticated training approaches are integrated with the currently proposed methods in the future. Although the improvement on model performance is very significant, be that as it may, our work is still an extension to the conventional SG. How to efficiently find the best FDG gradient to directly deal with the non-linearity of spiking function still remains a problem. In addition, we only consider the LIF neurons for the analyses here, the efficiency of the proposed approaches on other types of spiking neurons still needs examination in practice.
230
+
231
+ References
232
+ [1] Filipp Akopyan, Jun Sawada, Andrew Cassidy, Rodrigo Alvarez-Icaza, John Arthur, Paul Merolla, Nabil Imam, Yutaka Nakamura, Pallab Datta, Gi-Joon Nam, et al. Truenorth: Design and tool flow of a 65 mw 1 million neuron programmable neurosynaptic chip. IEEE transactions on computer-aided design of integrated circuits and systems, 34(10):1537–1557, 2015.
233
+ [2] Mike Davies, Narayan Srinivasa, Tsung-Han Lin, Gautham Chinya, Yongqiang Cao, Sri Harsha Choday, Georgios Dimou, Prasad Joshi, Nabil Imam, Shweta Jain, et al. Loihi: A neuromorphic manycore processor with on-chip learning. IEEE Micro, 38(1):82–99, 2018.
234
+ [3] Jing Pei, Lei Deng, Sen Song, Mingguo Zhao, Youhui Zhang, Shuang Wu, Guanrui Wang, Zhe Zou, Zhenzhi Wu, Wei He, et al. Towards artificial general intelligence with hybrid tianjic chip architecture. Nature, 572(7767):106–111, 2019.
235
+ [4] Yujie Wu, Lei Deng, Guoqi Li, Jun Zhu, Yuan Xie, and Luping Shi. Direct training for spiking neural networks: Faster, larger, better. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 33, pages 1311–1318, 2019.
236
+ [5] Adam Paszke, Sam Gross, Francisco Massa, Adam Lerer, James Bradbury, Gregory Chanan, Trevor Killeen, Zeming Lin, Natalia Gimelshein, Luca Antiga, et al. Pytorch: An imperative style, high-performance deep learning library. arXiv preprint arXiv:1912.01703, 2019.
237
+ [6] James Bradbury, Roy Frostig, Peter Hawkins, Matthew James Johnson, Chris Leary, Dougal Maclaurin, George Necula, Adam Paszke, Jake VanderPlas, Skye Wanderman-Milne, and Qiao Zhang. JAX: composable transformations of Python+NumPy programs, 2018.
238
+ [7] Martín Abadi, Paul Barham, Jianmin Chen, Zhifeng Chen, Andy Davis, Jeffrey Dean, Matthieu Devin, Sanjay Ghemawat, Geoffrey Irving, Michael Isard, et al. Tensorflow: A system for large-scale machine learning. In 12th {USENIX} symposium on operating systems design and implementation ({OSDI} 16), pages 265–283, 2016.
239
+ [8] Emre O Neftci, Hesham Mostafa, and Friedemann Zenke. Surrogate gradient learning in spiking neural networks: Bringing the power of gradient-based optimization to spiking neural networks. IEEE Signal Processing Magazine, 36(6):51–63, 2019. [9] Bing Han, Gopalakrishnan Srinivasan, and Kaushik Roy. Rmp-snn: Residual membrane potential neuron for enabling deeper high-accuracy and low-latency spiking neural network. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 13558–13567, 2020.
240
+ [10] Abhronil Sengupta, Yuting Ye, Robert Wang, Chiao Liu, and Kaushik Roy. Going deeper in spiking neural networks: Vgg and residual architectures. Frontiers in Neuroscience, 13:95, 2019.
241
+ [11] Bodo Rueckauer, Iulia-Alexandra Lungu, Yuhuang Hu, and Michael Pfeiffer. Theory and tools for the conversion of analog to spiking convolutional neural networks. arXiv preprint arXiv:1612.04052, 2016.
242
+ [12] Bodo Rueckauer, Iulia-Alexandra Lungu, Yuhuang Hu, Michael Pfeiffer, and Shih-Chii Liu. Conversion of continuous-valued deep networks to efficient event-driven networks for image classification. Frontiers in Neuroscience, 11:682, 2017.
243
+ [13] Bing Han and Kaushik Roy. Deep spiking neural network: Energy efficiency through time based coding. In Proc. IEEE Eur. Conf. Comput. Vis.(ECCV), pages 388–404, 2020.
244
+ [14] Shikuang Deng and Shi Gu. Optimal conversion of conventional artificial neural networks to spiking neural networks. arXiv preprint arXiv:2103.00476, 2021.
245
+ [15] Yuhang Li, Shikuang Deng, Xin Dong, Ruihao Gong, and Shi Gu. A free lunch from ann: Towards efficient, accurate spiking neural networks calibration. arXiv preprint arXiv:2106.06984, 2021.
246
+ [16] Yuhang Li, Xin Dong, and Wei Wang. Additive powers-of-two quantization: An efficient non-uniform discretization for neural networks. arXiv preprint arXiv:1909.13144, 2019.
247
+ [17] Yuhang Li, Ruihao Gong, Xu Tan, Yang Yang, Peng Hu, Qi Zhang, Fengwei Yu, Wei Wang, and Shi Gu. Brecq: Pushing the limit of post-training quantization by block reconstruction. arXiv preprint arXiv:2102.05426, 2021.
248
+ [18] Yuhang Li, Mingzhu Shen, Jian Ma, Yan Ren, Mingxin Zhao, Qi Zhang, Ruihao Gong, Fengwei Yu, and Junjie Yan. MQBench: Towards reproducible and deployable model quantization benchmark. In Thirty-fifth Conference on Neural Information Processing Systems Datasets and Benchmarks Track (Round 1), 2021.
249
+ [19] Hanting Chen, Yunhe Wang, Chunjing Xu, Boxin Shi, Chao Xu, Qi Tian, and Chang Xu. Addernet: Do we really need multiplications in deep learning? In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 1468–1477, 2020.
250
+ [20] Arnon Amir, Brian Taba, David Berg, Timothy Melano, Jeffrey McKinstry, Carmelo Di Nolfo, Tapan Nayak, Alexander Andreopoulos, Guillaume Garreau, Marcela Mendoza, et al. A low power, fully event-based gesture recognition system. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 7243–7252, 2017.
251
+ [21] Johanni Brea, Walter Senn, and Jean-Pascal Pfister. Matching recall and storage in sequence learning with spiking neural networks. Journal of neuroscience, 33(23):9565–9575, 2013.
252
+ [22] Yoshua Bengio, Nicholas Léonard, and Aaron Courville. Estimating or propagating gradients through stochastic neurons for conditional computation. arXiv preprint arXiv:1308.3432, 2013.
253
+ [23] Jun Haeng Lee, Tobi Delbruck, and Michael Pfeiffer. Training deep spiking neural networks using backpropagation. Frontiers in Neuroscience, 10:508, 2016.
254
+ [24] Emre O Neftci, Charles Augustine, Somnath Paul, and Georgios Detorakis. Event-driven random back-propagation: Enabling neuromorphic deep learning machines. Frontiers in Neuroscience, 11:324, 2017.
255
+ [25] Yujie Wu, Lei Deng, Guoqi Li, Jun Zhu, and Luping Shi. Spatio-temporal backpropagation for training high-performance spiking neural networks. Frontiers in Neuroscience, 12:331, 2018.
256
+ [26] Hanle Zheng, Yujie Wu, Lei Deng, Yifan Hu, and Guoqi Li. Going deeper with directly-trained larger spiking neural networks. arXiv preprint arXiv:2011.05280, 2020.
257
+ [27] Nitin Rathi and Kaushik Roy. Diet-snn: Direct input encoding with leakage and threshold optimization in deep spiking neural networks. arXiv preprint arXiv:2008.03658, 2020.
258
+ [28] Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. In ICML, 2015.
259
+ [29] Shibani Santurkar, Dimitris Tsipras, Andrew Ilyas, and Aleksander Madry. How does batch normalization help optimization? arXiv preprint arXiv:1805.11604, 2018.
260
+ [30] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In CVPR, 2016.
261
+ [31] Matthieu Courbariaux, Yoshua Bengio, and Jean-Pierre David. Binaryconnect: Training deep neural networks with binary weights during propagations. In NeurIPS, 2015.
262
+ [32] Guillaume Bellec, Darjan Salaj, Anand Subramoney, Robert Legenstein, and Wolfgang Maass. Long short-term memory and learning-to-learn in networks of spiking neurons. arXiv preprint arXiv:1803.09574, 2018.
263
+ [33] Yoshua Bengio, Jérôme Louradour, Ronan Collobert, and Jason Weston. Curriculum learning. In Proceedings of the 26th annual international conference on machine learning, pages 41–48, 2009.
264
+ [34] Alex Krizhevsky, Vinod Nair, and Geoffrey Hinton. Cifar-10 (canadian institute for advanced research).
265
+ [35] Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. In CVPR, 2009.
266
+ [36] Tong He, Zhi Zhang, Hang Zhang, Zhongyue Zhang, Junyuan Xie, and Mu Li. Bag of tricks for image classification with convolutional neural networks. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 558–567, 2019.
267
+ [37] Ekin D Cubuk, Barret Zoph, Dandelion Mane, Vijay Vasudevan, and Quoc V Le. Autoaugment: Learning augmentation policies from data. arXiv preprint arXiv:1805.09501, 2018.
268
+ [38] Terrance DeVries and Graham W Taylor. Improved regularization of convolutional neural networks with cutout. arXiv preprint arXiv:1708.04552, 2017.
269
+ [39] Ilya Loshchilov and Frank Hutter. Sgdr: Stochastic gradient descent with warm restarts. arXiv preprint arXiv:1608.03983, 2016.
270
+ [40] Nitin Rathi, Gopalakrishnan Srinivasan, Priyadarshini Panda, and Kaushik Roy. Enabling deep spiking neural networks with hybrid conversion and spike timing dependent backpropagation. arXiv preprint arXiv:2005.01807, 2020.
271
+ [41] Chankyu Lee, Syed Shakib Sarwar, Priyadarshini Panda, Gopalakrishnan Srinivasan, and Kaushik Roy. Enabling spike-based backpropagation for training deep neural network architectures. Frontiers in Neuroscience, 14, 2020.
272
+ [42] Wenrui Zhang and Peng Li. Temporal spike sequence learning via backpropagation for deep spiking neural networks. arXiv preprint arXiv:2002.10085, 2020.
273
+ [43] Sen Lu and Abhronil Sengupta. Exploring the connection between binary and spiking neural networks. Frontiers in Neuroscience, 14:535, 2020.
274
+ [44] Alexander Kugele, Thomas Pfeil, Michael Pfeiffer, and Elisabetta Chicca. Efficient processing of spatio-temporal data streams with spiking neural networks. Frontiers in Neuroscience, 14:439, 2020.
275
+ [45] Hongmin Li, Hanchao Liu, Xiangyang Ji, Guoqi Li, and Luping Shi. Cifar10-dvs: an eventstream dataset for object classification. Frontiers in Neuroscience, 11:309, 2017.
276
+
277
+ # Checklist
278
+
279
+ 1. For all authors...
280
+
281
+ (a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
282
+ (b) Did you describe the limitations of your work? [Yes] Please see our discussion in Sec. 6
283
+ (c) Did you discuss any potential negative societal impacts of your work? [No]
284
+ (d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
285
+
286
+ 2. If you are including theoretical results...
287
+
288
+ (a) Did you state the full set of assumptions of all theoretical results? [Yes] (b) Did you include complete proofs of all theoretical results? [Yes] The proof is available in Sec. 4.3.
289
+
290
+ 3. If you ran experiments...
291
+
292
+ (a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] Our code will be available in the supplemental.
293
+ (b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] All implementations are described in the experiments section.
294
+ (c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes] We report the mean as well as the standard deviation accuracy in CIFAR experiments. For time consideration, we did not run them for ImageNet experiments, the results may be updated in the future.
295
+ (d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] The computation resources description is provided in the experiment section.
296
+
297
+ 4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
298
+
299
+ (a) If your work uses existing assets, did you cite the creators? [Yes] We use CIFAR10/100 [34], ImageNet [35], and CIFAR10-DVS [45].
300
+ (b) Did you mention the license of the assets? [No] We adopt public datasets.
301
+ (c) Did you include any new assets either in the supplemental material or as a URL? [No]
302
+ (d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [No]
303
+
304
+ (e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [No]
305
+
306
+ 5. If you used crowdsourcing or conducted research with human subjects...
307
+
308
+ (a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
309
+ (b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
310
+ (c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
parse/train/H4e7mBnC9f0/H4e7mBnC9f0_content_list.json ADDED
@@ -0,0 +1,1372 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "type": "text",
4
+ "text": "Differentiable Spike: Rethinking Gradient-Descent for Training Spiking Neural Networks ",
5
+ "text_level": 1,
6
+ "bbox": [
7
+ 191,
8
+ 122,
9
+ 808,
10
+ 172
11
+ ],
12
+ "page_idx": 0
13
+ },
14
+ {
15
+ "type": "text",
16
+ "text": "Yuhang $\\mathbf { L i } ^ { 1 : }$ ∗, Yufei $\\mathbf { G u o ^ { 2 * } }$ , Shanghang Zhang3, Shikuang Deng1, Yongqing $\\mathbf { H a i } ^ { 2 }$ , Shi $\\mathbf { G u } ^ { \\mathrm { 1 } \\boxtimes }$ ",
17
+ "bbox": [
18
+ 184,
19
+ 224,
20
+ 813,
21
+ 241
22
+ ],
23
+ "page_idx": 0
24
+ },
25
+ {
26
+ "type": "text",
27
+ "text": "1University of Electronic Science and Technology of China, 2Peking University, 3University of California Berkeley liyuhang699@gmail.com, yfguo@pku.edu.cn, gus@uestc.edu.cn ",
28
+ "bbox": [
29
+ 254,
30
+ 241,
31
+ 741,
32
+ 284
33
+ ],
34
+ "page_idx": 0
35
+ },
36
+ {
37
+ "type": "text",
38
+ "text": "Abstract ",
39
+ "text_level": 1,
40
+ "bbox": [
41
+ 462,
42
+ 318,
43
+ 535,
44
+ 335
45
+ ],
46
+ "page_idx": 0
47
+ },
48
+ {
49
+ "type": "text",
50
+ "text": "Spiking neural networks (SNNs) have emerged as a biology-inspired method mimicking the spiking nature of brain neurons. This biomimicry derives SNNs’ energy efficiency of inference on neuromorphic hardware. However, it also causes an intrinsic disadvantage in training high-performing SNNs from scratch since the discrete spike prohibits the gradient calculation. To overcome this issue, the surrogate gradient (SG) approach has been proposed as a continuous relaxation. Yet the heuristic choice of SG leaves it vacant how the SG benefits the SNN training. In this work, we first theoretically study the gradient descent problem in SNN training and introduce finite difference gradient to quantitatively analyze the training behavior of SNN. Based on the introduced finite difference gradient, we propose a new family of Differentiable Spike (Dspike) functions that can adaptively evolve during training to find the optimal shape and smoothness for gradient estimation. Extensive experiments over several popular network structures show that training SNN with Dspike consistently outperforms the state-of-the-art training methods. For example, on the CIFAR10-DVS classification task, we can train a spiking ResNet-18 and achieve $7 5 . 4 \\%$ top-1 accuracy with 10 time steps. ",
51
+ "bbox": [
52
+ 233,
53
+ 349,
54
+ 766,
55
+ 570
56
+ ],
57
+ "page_idx": 0
58
+ },
59
+ {
60
+ "type": "text",
61
+ "text": "1 Introduction ",
62
+ "text_level": 1,
63
+ "bbox": [
64
+ 176,
65
+ 594,
66
+ 310,
67
+ 612
68
+ ],
69
+ "page_idx": 0
70
+ },
71
+ {
72
+ "type": "text",
73
+ "text": "Recently, spiking neural networks (SNNs) have received increasing attention due to their biologyinspired neural behavior and efficient computation. SNNs deal with binary spike information and therefore enjoy the advantage of multiplication-free inference. Neuromorphic hardware such as TrueNorth [1] and Loihi [2] demonstrates that SNNs can save energy by orders of magnitude. Hybrid architecture like Tianjic [3] suggests its potential power for general intelligence when integrated with traditional artificial infrastructure. However, the bio-mimicry also causes an intrinsic disadvantage in training high-performing SNNs from scratch due to the discrete spike. As a result, obtaining a high-performing SNN has long been a critical problem limiting SNN’s deployment in practice. ",
74
+ "bbox": [
75
+ 174,
76
+ 621,
77
+ 825,
78
+ 731
79
+ ],
80
+ "page_idx": 0
81
+ },
82
+ {
83
+ "type": "text",
84
+ "text": "To be more specific, the appealing advantage of the multiplication-free computation in SNN is not recognized in its training [4]. Modern ML frameworks such as Pytorch [5], JAX [6], and Tensorflow [7] do not provide efficient and general instructions or high-level functions to accelerate the convolution with 0/1 spike activation. Moreover, the binary activation in SNN produces allor-nothing gradients [8] that are incompatible with typical gradient-based optimization methods for efficient neural network training. To circumvent this problem, many works adopt surrogate gradients [8] (typically the derivative of a soft-relaxed function) to replace the spike non-linear gradient. Although the heuristic choice of SG is beneficial to enable the gradient descent in SNN training, the theoretical soundness of SG has not been justified so far. What’s more, the gradient descent in SNN training may follow different updating rules from ANN. In fact, since the true gradient value of spike activation does not exist, the adoption of SG raises a new question of how to replace the $\\infty$ -gradient adaptively through the training process for a good updating strategy of parameters. ",
85
+ "bbox": [
86
+ 174,
87
+ 738,
88
+ 825,
89
+ 876
90
+ ],
91
+ "page_idx": 0
92
+ },
93
+ {
94
+ "type": "image",
95
+ "img_path": "images/012f9c41f16a3f7d725581105934c4ac57dfecbb0474bbc6673af5b5ff35c998.jpg",
96
+ "image_caption": [
97
+ "Figure 1: Overall workflow of the proposed algorithm. We use a general, flexible Dspike function and control its shape with finite difference method to facilitate the surrogate gradient descent in training SNN. "
98
+ ],
99
+ "image_footnote": [],
100
+ "bbox": [
101
+ 173,
102
+ 88,
103
+ 825,
104
+ 262
105
+ ],
106
+ "page_idx": 1
107
+ },
108
+ {
109
+ "type": "text",
110
+ "text": "",
111
+ "bbox": [
112
+ 171,
113
+ 327,
114
+ 823,
115
+ 354
116
+ ],
117
+ "page_idx": 1
118
+ },
119
+ {
120
+ "type": "text",
121
+ "text": "In this work, we study this specialized problem of adaptive gradient estimation in SNN training. We first revisit the gradient descent algorithm with the finite difference method to accurately depict the loss landscape of adopting a surrogate gradient for the non-differentiable spike firing function. Then we further propose the Differentiable Spike (Dspike) function, which can adaptively change its shape and capture the direction of finite difference gradients. With such adaptive surrogate gradients, we establish an efficient algorithm of training SNN with large-scale models. The overall workflow of our algorithm is visualized in Fig. 1. ",
122
+ "bbox": [
123
+ 174,
124
+ 361,
125
+ 825,
126
+ 458
127
+ ],
128
+ "page_idx": 1
129
+ },
130
+ {
131
+ "type": "text",
132
+ "text": "Our contributions can be summarized as follows: ",
133
+ "bbox": [
134
+ 174,
135
+ 464,
136
+ 495,
137
+ 478
138
+ ],
139
+ "page_idx": 1
140
+ },
141
+ {
142
+ "type": "text",
143
+ "text": "• We identify the problem of adaptively estimating gradient in SNN training and propose a novel analysis framework for SNN’s surrogate gradient, through which we are able to not only explain why it works well but also indicate how we can improve its adaptivity to data through training. • We also introduce the novel Dspike function built from the hyperbolic tangent function. The Dspike function can learn its shape accordingly by matching it with the finite difference gradient. • Extensive experiments on both static and dynamic datasets show that our method is highly effective and efficient. For example, our model can achieve $7 5 . 4 \\%$ top-1 accuracy on the CIFAR-DVS. Our SNN also only consumes $7 . 8 \\%$ energy of the corresponding ANN on CIFAR-10. ",
144
+ "bbox": [
145
+ 171,
146
+ 489,
147
+ 826,
148
+ 606
149
+ ],
150
+ "page_idx": 1
151
+ },
152
+ {
153
+ "type": "text",
154
+ "text": "2 Related Work ",
155
+ "text_level": 1,
156
+ "bbox": [
157
+ 174,
158
+ 628,
159
+ 321,
160
+ 645
161
+ ],
162
+ "page_idx": 1
163
+ },
164
+ {
165
+ "type": "text",
166
+ "text": "ANN-SNN Conversion. Generally, the algorithms to obtain a high-performance can be divided into two routes: (1) ANN-SNN conversion and (2) direct training SNN from scratch. Conversion-based methods [9, 10] utilize the knowledge from ANN and convert the ReLU activation to spike activation mechanism. This type of method can produce an SNN in a short time. For example, Rueckauer et al. [11] propose to traverse the training dataset to find the maximum activation. Then, the SNN can be converted by directly replacing several modules. In [12], maximum activation is abandoned since it may out-lie the central range of activation. The authors choose to find the percentile numbers for threshold voltage to improve the robustness. TSC [13] adopts the soft-reset (also known as reset by subtraction) mechanism and no leakage for conversion, which proves to be effective in conversion. Deng & Gu [14] decompose the conversion error to each layer, then propose to reduce the error by shifting the bias term. [15] first propose the calibration to reduce the conversion accuracy. ANN-SNN conversion is fast and accurate. However, achieving near lossless conversion requires a considerable amount of time steps $( > 2 0 0 )$ to accumulate the spikes, which may significantly add up the latency. ",
167
+ "bbox": [
168
+ 173,
169
+ 661,
170
+ 825,
171
+ 840
172
+ ],
173
+ "page_idx": 1
174
+ },
175
+ {
176
+ "type": "text",
177
+ "text": "Direct Training SNN. In contrast to the conversion method, direct training of SNNs can lower the time step and may further reduce energy consumption. Direct training leverages gradient-descent algorithms. And many works have been developed to tackle the non-differentiability of spike activation. This non-differentiable activation function is similar to the quantization or binarization neural network [16, 17, 18] or adder neural network [19]. [20] achieve high performance on CIFAR10 and other neuromorphic datasets. Some works use probabilistic models to approximate the gradient [21], which is also developed in binary stochastic model [22]. Another common approach is to use rate-encoding networks for gradients calculation [23, 24]. They quantize the spike rate as the magnitude of information transmitted. (Wu et al. 2019 [25] improves the leaky integrate-and-fire (LIF) model to an iterative LIF model and develops STBP learning algorithm. Zheng et al. [26] further propose the tdBN algorithm to balance the gradient norm and smooth the loss function in SNN training, enabling large-scale model optimization. ",
178
+ "bbox": [
179
+ 176,
180
+ 856,
181
+ 823,
182
+ 911
183
+ ],
184
+ "page_idx": 1
185
+ },
186
+ {
187
+ "type": "text",
188
+ "text": "",
189
+ "bbox": [
190
+ 173,
191
+ 90,
192
+ 825,
193
+ 203
194
+ ],
195
+ "page_idx": 2
196
+ },
197
+ {
198
+ "type": "text",
199
+ "text": "3 Preliminary ",
200
+ "text_level": 1,
201
+ "bbox": [
202
+ 174,
203
+ 220,
204
+ 305,
205
+ 238
206
+ ],
207
+ "page_idx": 2
208
+ },
209
+ {
210
+ "type": "text",
211
+ "text": "3.1 Leaky Integrate-and-Fire Model ",
212
+ "text_level": 1,
213
+ "bbox": [
214
+ 174,
215
+ 253,
216
+ 439,
217
+ 270
218
+ ],
219
+ "page_idx": 2
220
+ },
221
+ {
222
+ "type": "text",
223
+ "text": "We use bold italic letters for vector representations. For example, $_ { \\textbf { \\em x } }$ and $\\textbf { { y } }$ denote the input and target output variables. Bold capital letters like W denote the matrices (or tensors as clear from the text). Constants are denoted by small upright letters, e.g., $a$ . With bracketed superscript and subscript, we can denote the time dimension and the element indices, respectively. For example, $\\mathbf { \\boldsymbol { \\mathsf { u } } } _ { i } ^ { ( t ) }$ means the $i$ -th membrane potential at time step $t$ . We adopt the well-known Leaky Integrate-and-Fire (LIF) neuron model for a spiking neural network (SNN). Given a membrane potential $\\mathbf { \\boldsymbol { u } } ^ { ( t ) }$ , the pre-synaptic potential is updated as ",
224
+ "bbox": [
225
+ 173,
226
+ 279,
227
+ 826,
228
+ 382
229
+ ],
230
+ "page_idx": 2
231
+ },
232
+ {
233
+ "type": "equation",
234
+ "img_path": "images/e1b0abba2d5975e50ded4dd169b4904bbda9f04327fc2e1e4562c4767489dd23.jpg",
235
+ "text": "$$\n\\begin{array} { r } { \\pmb { u } ^ { ( t + 1 ) , \\mathrm { p r e } } = \\tau \\pmb { u } ^ { ( t ) } + \\pmb { c } ^ { ( t + 1 ) } , \\mathrm { w h e r e } \\ \\pmb { c } ^ { ( t + 1 ) } = \\mathbf { W } \\pmb { x } ^ { ( t + 1 ) } . } \\end{array}\n$$",
236
+ "text_format": "latex",
237
+ "bbox": [
238
+ 316,
239
+ 387,
240
+ 681,
241
+ 406
242
+ ],
243
+ "page_idx": 2
244
+ },
245
+ {
246
+ "type": "text",
247
+ "text": "Here, $\\tau$ is a constant leaky factor within $( 0 , 1 )$ and $c ^ { ( t + 1 ) }$ is the pre-synaptic input at time step $t + 1$ . The input can be calculated from the dot-product between the weights and the spike from the previous layer. Let $V _ { t h }$ be the firing threshold, the membrane potential will fire a spike when it exceeds the threshold, and then hard-reset to 0, given by ",
248
+ "bbox": [
249
+ 173,
250
+ 411,
251
+ 826,
252
+ 468
253
+ ],
254
+ "page_idx": 2
255
+ },
256
+ {
257
+ "type": "equation",
258
+ "img_path": "images/0ab4c9628707e472e92d6affedfa1802807c77e6f434647d5fe14d1c391b6028.jpg",
259
+ "text": "$$\n\\pmb { y } ^ { ( t + 1 ) } = \\{ \\begin{array} { l l } { 1 } & { \\mathrm { i f ~ } \\pmb { u } ^ { ( t + 1 ) , \\mathrm { p r e } } > V _ { t h } } \\\\ { 0 } & { \\mathrm { o t h e r w i s e } } \\end{array} , \\pmb { u } ^ { ( t + 1 ) } = \\pmb { u } ^ { ( t + 1 ) , \\mathrm { p r e } } \\cdot ( 1 - \\pmb { y } ^ { ( t + 1 ) } )\n$$",
260
+ "text_format": "latex",
261
+ "bbox": [
262
+ 263,
263
+ 474,
264
+ 735,
265
+ 510
266
+ ],
267
+ "page_idx": 2
268
+ },
269
+ {
270
+ "type": "text",
271
+ "text": "After firing, the spike output $\\pmb { y } ^ { ( t + 1 ) }$ will propagate to the next layer and become the input $\\boldsymbol { x } ^ { ( t + 1 ) }$ of the next layer, (note that we omit the layer index for simplicity). $V _ { t h }$ is set to 0.5 in this work. ",
272
+ "bbox": [
273
+ 173,
274
+ 518,
275
+ 823,
276
+ 547
277
+ ],
278
+ "page_idx": 2
279
+ },
280
+ {
281
+ "type": "text",
282
+ "text": "Softmax in SNN. In the general classification model, the final network output will be leveraged to compute the softmax and then to find the winner class. However, the network output is highly variant per input sample, and unlike ReLU activation, the output could be positive or negative. For this reason, we choose to only integrate the network output, and do not fire them across time, as did in recent practices [26, 27]. ",
283
+ "bbox": [
284
+ 173,
285
+ 553,
286
+ 825,
287
+ 623
288
+ ],
289
+ "page_idx": 2
290
+ },
291
+ {
292
+ "type": "equation",
293
+ "img_path": "images/c7626e384ef5f413990e19b75b8faab634e4c08dbd90a8353aa425bbeb07cae8.jpg",
294
+ "text": "$$\n{ \\pmb y } _ { \\mathrm { n e t } } = \\frac { 1 } { T } \\sum _ { i = 1 } ^ { T } { \\pmb c } _ { \\mathrm { n e t } } ^ { ( t ) } = \\frac { 1 } { T } \\sum _ { i = 1 } ^ { T } { \\bf W } { \\pmb x } ^ { ( t ) } ,\n$$",
295
+ "text_format": "latex",
296
+ "bbox": [
297
+ 380,
298
+ 628,
299
+ 616,
300
+ 672
301
+ ],
302
+ "page_idx": 2
303
+ },
304
+ {
305
+ "type": "text",
306
+ "text": "Then, we can compute the cross-entropy loss based on the ture label and Softmax $( y _ { \\mathrm { n e t } } )$ ",
307
+ "bbox": [
308
+ 171,
309
+ 678,
310
+ 750,
311
+ 693
312
+ ],
313
+ "page_idx": 2
314
+ },
315
+ {
316
+ "type": "text",
317
+ "text": "3.2 Time-dependent Batch Normalization ",
318
+ "text_level": 1,
319
+ "bbox": [
320
+ 174,
321
+ 708,
322
+ 477,
323
+ 723
324
+ ],
325
+ "page_idx": 2
326
+ },
327
+ {
328
+ "type": "text",
329
+ "text": "Batch Normalization (BN) [28] is used to reduce internal covariate shift and smooth the loss landscape [29] during the optimization of an ANN. It enables the stable training of ANN even with more than 100 layers on the large-scale dataset, e.g. ResNet-152 [30]. However, BN layers are not designed to normalize spatial-temporal data at first. And simply transplanting BN in SNN training will lead to undesired results. To solve this problem, Zheng et al. [26] propose time-dependent Batch Normalization (tdBN), which normalizes the data in both spatial and temporal paradigm. tdBN will gather the pre-synaptic input along the time dimension, denoted by $\\mathbf { C } = [ \\pmb { c } ^ { ( 1 ) } , \\pmb { c } ^ { ( 2 ) } , \\pmb { , . . . } , \\pmb { c } ^ { ( T ) } ]$ , and then normalize it by ",
330
+ "bbox": [
331
+ 173,
332
+ 733,
333
+ 825,
334
+ 847
335
+ ],
336
+ "page_idx": 2
337
+ },
338
+ {
339
+ "type": "equation",
340
+ "img_path": "images/af5882e9266d0097e3f54590a96a71a47d00d150f3009b0b074e9b6ad582e6bd.jpg",
341
+ "text": "$$\n\\begin{array} { r l r } & { \\bar { \\bf C } = \\frac { \\alpha V _ { t h } \\left( { \\bf C } - \\mathbb { E } \\left[ { \\bf C } \\right] \\right) } { \\sqrt { \\mathbb { V } \\mathbb { A } \\mathbb { R } \\left( { \\bf C } \\right) + \\epsilon } } \\qquad } & { \\# \\mathrm { n o r m a l i z e } } \\\\ & { \\hat { \\bf C } = \\gamma \\bar { \\bf C } + \\beta , \\qquad } & { \\# \\mathrm { a f f i n e ~ t r a n s f o r m a t i o n } } \\end{array}\n$$",
342
+ "text_format": "latex",
343
+ "bbox": [
344
+ 284,
345
+ 852,
346
+ 712,
347
+ 910
348
+ ],
349
+ "page_idx": 2
350
+ },
351
+ {
352
+ "type": "text",
353
+ "text": "where $\\mathbb { E }$ and $\\mathbb { V } \\mathbb { A } \\mathbb { R }$ compute the mean and variance in channel dimension. $\\gamma$ and $\\beta$ are learnable parameters. Note that in tdBN the normalized tensor will multiply $\\alpha V _ { t h }$ , which can prevent over-fire and under-fire by choosing $\\alpha$ wisely. After tdBN, the pre-synaptic input in each time step will be fed into Eq. (1). tdBN stabilizes the training of SNN and achieves good results. We also adopt this training technique in our framework. See [26] for more details of tdBN. ",
354
+ "bbox": [
355
+ 174,
356
+ 90,
357
+ 825,
358
+ 161
359
+ ],
360
+ "page_idx": 3
361
+ },
362
+ {
363
+ "type": "text",
364
+ "text": "4 Methodology ",
365
+ "text_level": 1,
366
+ "bbox": [
367
+ 174,
368
+ 180,
369
+ 315,
370
+ 196
371
+ ],
372
+ "page_idx": 3
373
+ },
374
+ {
375
+ "type": "text",
376
+ "text": "4.1 Non-Differentiable Spike ",
377
+ "text_level": 1,
378
+ "bbox": [
379
+ 174,
380
+ 213,
381
+ 387,
382
+ 229
383
+ ],
384
+ "page_idx": 3
385
+ },
386
+ {
387
+ "type": "text",
388
+ "text": "One of the most notorious problems in SNN training is the non-differentiability of the firing function Eq. (2). The firing function could be viewed as a variant of sign function, whose derivative is identified as the Dirac delta function. This derivative is 0 almost everywhere except for the threshold that grows to infinity. Seemingly, directly using the Dirac delta function is not an ideal choice for gradient descent-based learning. To demonstrate this problem, let $L$ denote the task loss objective, we can compute the gradient of weights parameters using the spatial-temporal backpropagation (STBP): ",
389
+ "bbox": [
390
+ 173,
391
+ 238,
392
+ 825,
393
+ 323
394
+ ],
395
+ "page_idx": 3
396
+ },
397
+ {
398
+ "type": "equation",
399
+ "img_path": "images/e7d2d57bface8d1c9a9e59cc543fd3e9a61af2f5ea3c9fec2fa28b70a127d99a.jpg",
400
+ "text": "$$\n\\frac { \\partial L } { \\partial \\mathbf { W } } = \\sum _ { t } \\frac { \\partial L } { \\partial \\pmb { y } ^ { ( t ) } } \\frac { \\partial \\pmb { y } ^ { ( t ) } } { \\partial \\pmb { u } ^ { ( t ) , \\mathrm { p r e } } } \\frac { \\partial \\pmb { u } ^ { ( t ) , \\mathrm { p r e } } } { \\partial \\pmb { c } ^ { ( t ) } } \\frac { \\partial \\pmb { c } ^ { ( t ) } } { \\partial \\mathbf { W } } .\n$$",
401
+ "text_format": "latex",
402
+ "bbox": [
403
+ 356,
404
+ 329,
405
+ 642,
406
+ 369
407
+ ],
408
+ "page_idx": 3
409
+ },
410
+ {
411
+ "type": "text",
412
+ "text": "In above equation, $\\frac { \\partial \\pmb { y } ^ { ( t ) } } { \\partial \\pmb { u } ^ { ( t ) , \\mathrm { p r e } } }$ is the gradient of firing function and is 0 almost everywhere, as aforementioned. As a consequence, the gradient descent $\\begin{array} { r } { ( \\mathbf { W } \\mathbf { W } - \\eta \\frac { \\partial L } { \\partial \\mathbf { W } } ) } \\end{array}$ either freezes weights or updates the weights to infinity. ",
413
+ "bbox": [
414
+ 174,
415
+ 377,
416
+ 825,
417
+ 428
418
+ ],
419
+ "page_idx": 3
420
+ },
421
+ {
422
+ "type": "text",
423
+ "text": "To mitigate this problem, prior work seeks an alternative gradient (also known as surrogate gradient) to circumvent this problem. A popular surrogate gradient may refer to the rectangular function proposed in [4], given by ",
424
+ "bbox": [
425
+ 173,
426
+ 433,
427
+ 825,
428
+ 474
429
+ ],
430
+ "page_idx": 3
431
+ },
432
+ {
433
+ "type": "equation",
434
+ "img_path": "images/6192c78e9a91e3a70b28323af6b93dfd7a94ced7ba38ae600394e39937ee6843.jpg",
435
+ "text": "$$\n\\frac { \\partial \\pmb { y } ^ { ( t ) } } { \\partial \\pmb { u } ^ { ( t ) , \\mathrm { p r e } } } = \\frac { 1 } { a } \\mathrm { s i g n } \\left( \\left| \\pmb { u } ^ { ( t ) , \\mathrm { p r e } } - V _ { t h } \\right| < \\frac { a } { 2 } \\right) ,\n$$",
436
+ "text_format": "latex",
437
+ "bbox": [
438
+ 354,
439
+ 481,
440
+ 642,
441
+ 515
442
+ ],
443
+ "page_idx": 3
444
+ },
445
+ {
446
+ "type": "text",
447
+ "text": "where $a$ is a hyper-parameter and usually set to 1. When $V _ { t h } = 0 . 5 , a = 1$ , the gradient is simplified to 1 if $0 \\leq u ^ { ( t ) , \\mathrm { p r e } } \\leq 1$ otherwise 0. This is known as the Straight-Through Estimator in Bengio et al. [22] and is broadly applied in binary networks [31]. Another family of surrogate gradient may refer to triangular gradients [32], given by ",
448
+ "bbox": [
449
+ 173,
450
+ 520,
451
+ 825,
452
+ 578
453
+ ],
454
+ "page_idx": 3
455
+ },
456
+ {
457
+ "type": "equation",
458
+ "img_path": "images/d2aae9322b8d60fccc67674c65ff8ea44d61fa53b6a2d2d437a67583716ab22b.jpg",
459
+ "text": "$$\n\\frac { \\partial \\pmb { y } ^ { ( t ) } } { \\partial \\pmb { u } ^ { ( t ) , \\mathrm { p r e } } } = \\gamma \\operatorname* { m a x } \\left( 0 , 1 - \\left| \\frac { \\pmb { u } ^ { ( t ) , \\mathrm { p r e } } } { V _ { t h } } - 1 \\right| \\right) .\n$$",
460
+ "text_format": "latex",
461
+ "bbox": [
462
+ 352,
463
+ 584,
464
+ 645,
465
+ 621
466
+ ],
467
+ "page_idx": 3
468
+ },
469
+ {
470
+ "type": "text",
471
+ "text": "This surrogate gradient is computed based on the distance between the potential and threshold. Despite various surrogate gradients achieve acceptable accuracy, there lacks a theoretical justification for its reason and effectiveness. ",
472
+ "bbox": [
473
+ 174,
474
+ 626,
475
+ 826,
476
+ 669
477
+ ],
478
+ "page_idx": 3
479
+ },
480
+ {
481
+ "type": "text",
482
+ "text": "4.2 Rethinking Gradient-Descent in Spiking Neural Networks ",
483
+ "text_level": 1,
484
+ "bbox": [
485
+ 173,
486
+ 684,
487
+ 617,
488
+ 700
489
+ ],
490
+ "page_idx": 3
491
+ },
492
+ {
493
+ "type": "text",
494
+ "text": "Gradient-descent (GD) algorithm is a first-order iterative optimization method. Theoretically, for each iteration, GD aims to find the steepest direction for the descent that minimizes the task loss: ",
495
+ "bbox": [
496
+ 174,
497
+ 710,
498
+ 826,
499
+ 739
500
+ ],
501
+ "page_idx": 3
502
+ },
503
+ {
504
+ "type": "equation",
505
+ "img_path": "images/92eabb09597cb37c6f28a6f711cfae9fd5ae7fc36ef51591a884b6d1c5173c7a.jpg",
506
+ "text": "$$\n\\operatorname* { m i n } _ { | | \\Delta \\mathbf { W } | | \\leq \\varepsilon } L ( \\mathbf { W } + \\Delta \\mathbf { W } ) \\approx \\operatorname* { m i n } _ { | | \\Delta \\mathbf { W } | | \\leq \\varepsilon } L ( \\mathbf { W } ) + \\Delta \\mathbf { W } \\frac { \\partial L } { \\partial \\mathbf { W } }\n$$",
507
+ "text_format": "latex",
508
+ "bbox": [
509
+ 312,
510
+ 746,
511
+ 686,
512
+ 779
513
+ ],
514
+ "page_idx": 3
515
+ },
516
+ {
517
+ "type": "text",
518
+ "text": "Note that the right-hand side of the minimization is approximated by the first-order Taylor expansion. Given that $L ( \\mathbf { W } )$ is constant at the current iteration, therefore we only have to find the right $\\Delta \\mathbf { W }$ that minimizes the second term. Since the 2nd term is a linear in $\\Delta \\mathbf { W }$ , it can be made as negative as we like by taking $\\Delta { \\bf W }$ large. Therefore the minimum is $\\begin{array} { r } { \\Delta \\mathbf { W } = - \\varepsilon \\frac { \\nabla \\mathbf { w } L } { | | \\nabla \\mathbf { w } L | | } } \\end{array}$ , (where $\\begin{array} { r } { \\nabla { \\bf w } L = \\frac { \\partial L } { \\partial \\bf W } . } \\end{array}$ ∂ L∂ W ). ",
519
+ "bbox": [
520
+ 174,
521
+ 785,
522
+ 826,
523
+ 845
524
+ ],
525
+ "page_idx": 3
526
+ },
527
+ {
528
+ "type": "text",
529
+ "text": "Note that the above condition is only sufficient for $\\varepsilon 0$ to correctly approximate the loss with Taylor expansion. However, $\\varepsilon 0$ means $\\begin{array} { r } { \\Delta \\mathbf { W } = - \\varepsilon \\frac { \\nabla \\mathbf { w } L } { | | \\nabla \\mathbf { w } L | | } 0 } \\end{array}$ , but in practice GD updates the weights by a small step (determined by learning rate), which, indicates a mismatch between the practical implementation and the theoretical assumption. In other words, gradient only inspects the change rate of loss around an infinitely small neighborhood, however, we are interested in the change rate around a tiny (but not infinitely small) area. In the case of SNN, the gradient will always be $0 ^ { \\mathit { \\Phi } }$ , yet for a tiny neighborhood the loss function will change, leading to non-zero gradients. To penetrate the non-differentiability of the firing function, we adopt a technique called finite difference. It estimates the gradient by evaluating the loss objective near the coordinate: ",
530
+ "bbox": [
531
+ 174,
532
+ 851,
533
+ 825,
534
+ 912
535
+ ],
536
+ "page_idx": 3
537
+ },
538
+ {
539
+ "type": "image",
540
+ "img_path": "images/45783978b928cbb997105b7291a1e3566ef066a2a4fbc4c021e17b11b23e1ac2.jpg",
541
+ "image_caption": [
542
+ "Figure $\\mathbf { 2 \\alpha \\& }$ Table 1: Left: The cosine similarity between the gradients used for update and the FDG. In (a) we show ANN gradients and in (b) we show SNN rectangular surrogate gradients. Right: Training SNN with finite difference gradient, given different $\\varepsilon$ . "
543
+ ],
544
+ "image_footnote": [],
545
+ "bbox": [
546
+ 173,
547
+ 88,
548
+ 820,
549
+ 228
550
+ ],
551
+ "page_idx": 4
552
+ },
553
+ {
554
+ "type": "text",
555
+ "text": "",
556
+ "bbox": [
557
+ 173,
558
+ 299,
559
+ 826,
560
+ 369
561
+ ],
562
+ "page_idx": 4
563
+ },
564
+ {
565
+ "type": "equation",
566
+ "img_path": "images/58d8cd0dadd6ec7daa301f8ca1ddbe12b45417e8d2aece7303f08dfdb941588c.jpg",
567
+ "text": "$$\n\\hat { \\nabla } _ { \\varepsilon , w } L = \\left( \\frac { L ( w _ { 1 } + \\varepsilon e _ { 1 } ) - L ( w _ { 1 } - \\varepsilon e _ { 1 } ) } { 2 \\varepsilon } , \\ldots , \\frac { L ( w _ { k } + \\varepsilon e _ { k } ) - L ( w _ { k } - \\varepsilon e _ { k } ) } { 2 \\varepsilon } \\right) ,\n$$",
568
+ "text_format": "latex",
569
+ "bbox": [
570
+ 212,
571
+ 375,
572
+ 756,
573
+ 410
574
+ ],
575
+ "page_idx": 4
576
+ },
577
+ {
578
+ "type": "text",
579
+ "text": "where $\\textbf { \\em w }$ is the flattened vector of $\\mathbf { W }$ and $e _ { i }$ refers to standard basis vector with 1 at $i$ -th index. $\\varepsilon$ is some small constant, e.g. 0.001. We call $\\hat { \\nabla } _ { \\varepsilon , w } L$ as finite difference gradient (FDG). By the definition of gradient, we know FDG becomes the true gradient when $\\varepsilon 0$ . FDG can be a useful tool in GD-based learning, however, evaluating finite difference for each element in the weight vector is tedious, which greatly slows down the training process. Nevertheless, FDG still offers us a choice to evaluate the gradient mismatch problem quantitatively. ",
580
+ "bbox": [
581
+ 173,
582
+ 414,
583
+ 825,
584
+ 500
585
+ ],
586
+ "page_idx": 4
587
+ },
588
+ {
589
+ "type": "text",
590
+ "text": "In order to illustrate this, we construct a toy problem: a simple 2-layer CNN on the MNIST dataset. The first layer is a $3 \\mathrm { x } 3$ convolutional layer (output channel number is 6) with ReLU activation (or LIF spike activation) and average pooling for down-sampling. Then, we directly add a fully connected layer to predict the classification results. We train the toy model on MNIST for 5 epochs, with batch size 128 and learning rate 0.01 decayed to 0. In an effort to compute the FDG of the first layer, we have to perform $2 \\times 1 \\times 6 \\times 3 \\times 3 = 1 0 8$ times forward pass 3. In contrast, one has to perform 22 million times forward passes on a ResNet-18 [30] to compute the FDG of all parameters. ",
591
+ "bbox": [
592
+ 173,
593
+ 506,
594
+ 825,
595
+ 603
596
+ ],
597
+ "page_idx": 4
598
+ },
599
+ {
600
+ "type": "text",
601
+ "text": "Experiment I: FDG in ANN. We first train an ANN on MNIST and compare the disparity between real gradients and FDG. We use cosine similarity (i.e. $\\begin{array} { r } { \\cos _ { - } \\sin ( { \\pmb x } _ { 1 } , { \\pmb x } _ { 2 } ) = \\frac { { \\pmb x } _ { 1 } { \\pmb x } _ { 2 } } { | | { \\pmb x } _ { 1 } | | _ { 2 } | | { \\pmb x } _ { 2 } | | _ { 2 } } ) } \\end{array}$ x1x2||x1||2||x2||2 ) to determine the angle between these two gradient vectors. For each epoch, we compute the mean cosine similarity in the first 100 training iterations. The results are demonstrated in Fig. 2(a). The FDG and real gradients consistently have an extremely similar direction $( > 0 . 9 9 \\mathrm { c o s \\_ s i m } )$ with $\\varepsilon$ varying from 0.1 to 0.001. In conclusion, we show that (1) FDG is a valid signal and (2) the real gradients can effectively find the change rate within a small neighborhood in ANN optimization. ",
602
+ "bbox": [
603
+ 173,
604
+ 608,
605
+ 825,
606
+ 709
607
+ ],
608
+ "page_idx": 4
609
+ },
610
+ {
611
+ "type": "text",
612
+ "text": "Experiment II: FDG in SNN. Then, we compare the cosine similarity between the surrogate gradients in SNN and the FDG. In Fig. 2(b), we can tell that surrogate gradients share similar gradient direction with FDG when $\\varepsilon = 0 . 1$ (i.e. more than 0.8 cosine similarity). However, decreasing $\\varepsilon$ will lead to lower cosine similarity. In the case of $\\varepsilon = 0 . 0 0 1$ , the angle between FDG and the surrogate gradients is nearly 90 degrees, (for comparison, in high-dimensional space, two arbitrary random Gaussian vectors are very likely to be orthogonal). This observation concludes that surrogate gradient can predict the change rate of loss in a relatively larger neighborhood, which justifies the soundness of surrogate gradients. However, SG fails to predict the FDG in small step size $\\varepsilon$ . To this end, we need to figure out whether a large step size is better or a small step size is better. ",
613
+ "bbox": [
614
+ 173,
615
+ 714,
616
+ 825,
617
+ 840
618
+ ],
619
+ "page_idx": 4
620
+ },
621
+ {
622
+ "type": "text",
623
+ "text": "Experiment III: Training SNN with FDG. In SNN optimization, a natural question arises: What ε is optimal for gradient descent? First, the $\\varepsilon$ has to be small enough to compute the non-linearity of the loss surface, meanwhile, it has to be large enough to ignore the noise from the rough step function. For this reason, we explore the optimal $\\varepsilon$ by applying FDG in SNN optimization. The results are demonstrated in the Table 1. Note that all methods are trained on MNIST for only 10 epochs here. We show that the rectangular surrogate gradient with $a = 1$ reaches $9 4 . 9 \\%$ accuracy. For FDG optimization, we evaluate $\\varepsilon$ ranging from 0.001 to 0.5, and we find 0.1 is the best choice for optimizing SNN. The results confirm our assumption that $\\varepsilon$ has to be neither too big nor too small. It also tells us using the instant change rate (very small $\\varepsilon$ ) will lead to undesired performance degradation. ",
624
+ "bbox": [
625
+ 174,
626
+ 845,
627
+ 823,
628
+ 875
629
+ ],
630
+ "page_idx": 4
631
+ },
632
+ {
633
+ "type": "text",
634
+ "text": "",
635
+ "bbox": [
636
+ 173,
637
+ 90,
638
+ 826,
639
+ 203
640
+ ],
641
+ "page_idx": 5
642
+ },
643
+ {
644
+ "type": "text",
645
+ "text": "4.3 Differentiable Spike ",
646
+ "text_level": 1,
647
+ "bbox": [
648
+ 174,
649
+ 217,
650
+ 352,
651
+ 233
652
+ ],
653
+ "page_idx": 5
654
+ },
655
+ {
656
+ "type": "text",
657
+ "text": "In this section, we introduce the Dspike function, a novel surrogate gradient estimator, which can cover a large range of choices for SG. We choose the hyperbolic tangent function $\\begin{array} { r } { \\operatorname { t a n h } ( x ) = \\frac { e ^ { x } - e ^ { - x } } { e ^ { x } + e ^ { - x } } } \\end{array}$ as our basic building function for gradient estimation: ",
658
+ "bbox": [
659
+ 174,
660
+ 242,
661
+ 825,
662
+ 290
663
+ ],
664
+ "page_idx": 5
665
+ },
666
+ {
667
+ "type": "equation",
668
+ "img_path": "images/7a93428e1bca6efe0c9ed5f97b5d2b2236dd810d491bdcb421042840c7acdce7.jpg",
669
+ "text": "$$\n\\operatorname { D s p i k e } ( x ) = { \\left\\{ \\begin{array} { l l } { 1 } & { { \\mathrm { i f ~ } } x > 1 } \\\\ { a \\cdot \\operatorname { t a n h } ( b ( x - c ) ) + d } & { { \\mathrm { i f ~ } } 0 \\leq x \\leq 1 } \\\\ { 0 } & { { \\mathrm { i f ~ } } x < 0 } \\end{array} \\right. }\n$$",
670
+ "text_format": "latex",
671
+ "bbox": [
672
+ 318,
673
+ 292,
674
+ 679,
675
+ 343
676
+ ],
677
+ "page_idx": 5
678
+ },
679
+ {
680
+ "type": "text",
681
+ "text": "When $x < 0$ or $x > 1$ , we choose to clip $x$ as did in other practice. The vanilla tanh function maps $( - \\infty , + \\infty )$ to $( - 1 , 1 )$ , thus we have four parameters to control its shape to alter the function mapping: from $[ - 1 , 1 ]$ to [1, 1]. We first use $c = V _ { t h } = 0 . 5$ to set the symmetry center to (0.5, 0.5). Parameter $b ( b > 0 )$ is called the temperature factor, it controls the shape of the Dspike function. Parameter $a$ and $d$ can then be determined by setting $\\mathrm { D s p i k e ( 0 ) } = 0 , \\mathrm { D s p i k e ( 1 ) } = 1$ . As a result, we can rewrite the function as: ",
682
+ "bbox": [
683
+ 173,
684
+ 345,
685
+ 826,
686
+ 429
687
+ ],
688
+ "page_idx": 5
689
+ },
690
+ {
691
+ "type": "equation",
692
+ "img_path": "images/1b59cfc2c20fbfb26639208290198b22855af34af127dc047b15900cb284bf78.jpg",
693
+ "text": "$$\n\\mathrm { D s p i k e } ( x , b ) = \\frac { \\operatorname { t a n h } ( b ( x - 0 . 5 ) ) + \\operatorname { t a n h } ( b / 2 ) } { 2 ( \\operatorname { t a n h } ( b / 2 ) ) } , \\mathrm { i f ~ } 0 \\leq x \\leq 1 .\n$$",
694
+ "text_format": "latex",
695
+ "bbox": [
696
+ 295,
697
+ 428,
698
+ 700,
699
+ 462
700
+ ],
701
+ "page_idx": 5
702
+ },
703
+ {
704
+ "type": "text",
705
+ "text": "Dspike function has the capability to adjust the shape of the function, leading to different surrogate gradient estimations. To demonstrate that, we have the following lemma: ",
706
+ "bbox": [
707
+ 174,
708
+ 463,
709
+ 821,
710
+ 492
711
+ ],
712
+ "page_idx": 5
713
+ },
714
+ {
715
+ "type": "text",
716
+ "text": "Lemma 4.1. By changing the temperature $b$ , the shape of Dspike function can be altered. Specifically, we have $\\dim _ { b \\to 0 _ { + } } { \\mathrm { D s p i k e } } ( x ) \\to x$ and $\\scriptstyle \\operatorname* { l i m } _ { b \\to + \\infty }$ $\\mathrm { D s p i k e } ( x ) \\to \\mathrm { s i g n } ( x - 0 . 5 )$ . ",
717
+ "bbox": [
718
+ 173,
719
+ 494,
720
+ 823,
721
+ 523
722
+ ],
723
+ "page_idx": 5
724
+ },
725
+ {
726
+ "type": "text",
727
+ "text": "Proof. We first prove the case $b \\to 0 _ { + }$ . In this case, applying Taylor expansion to the tanh we have: ",
728
+ "bbox": [
729
+ 169,
730
+ 536,
731
+ 823,
732
+ 551
733
+ ],
734
+ "page_idx": 5
735
+ },
736
+ {
737
+ "type": "equation",
738
+ "img_path": "images/d9b62ee7cbb22f56faff29bc4f801acf63e237e0ec33b86500934de942e2a0fd.jpg",
739
+ "text": "$$\n\\operatorname { t a n h } ( b x ) \\approx b x - { \\frac { b ^ { 3 } x ^ { 3 } } { 3 } } + \\cdots + { \\frac { 2 ^ { ( 2 n ) } ( 2 ^ { ( 2 n ) } - 1 ) B _ { 2 n } ( b x ) ^ { 2 n - 1 } } { ( 2 n ) ! } } ,\n$$",
740
+ "text_format": "latex",
741
+ "bbox": [
742
+ 287,
743
+ 553,
744
+ 710,
745
+ 588
746
+ ],
747
+ "page_idx": 5
748
+ },
749
+ {
750
+ "type": "text",
751
+ "text": "where $B _ { n }$ is the $n$ -th Bernoulli number. When $b \\to 0$ , we can safely ignore higher-order terms and only keep $b x$ . Thus, we can rewrite Eq. (12) to ${ \\mathrm { D s p i k e } } ( x , b ) = { \\sqrt [ { b } ] { b } } { \\stackrel { - } { = } } x$ . Then, we prove the case $b \\to + \\infty$ . Since $\\scriptstyle \\operatorname* { l i m } _ { x \\to + \\infty } \\operatorname { t a n h } ( x ) \\to 1$ , we have: ",
752
+ "bbox": [
753
+ 173,
754
+ 590,
755
+ 826,
756
+ 632
757
+ ],
758
+ "page_idx": 5
759
+ },
760
+ {
761
+ "type": "equation",
762
+ "img_path": "images/c23e0b9f9daaa34722e3b151dfd45d07fab89251464961afd0f333bd1f9867b6.jpg",
763
+ "text": "$$\n\\operatorname* { l i m } _ { b \\to + \\infty } \\operatorname { D s p i k e } ( x , b ) \\{ \\{ \\begin{array} { l l } { \\frac { 2 * \\operatorname { t a n h } ( + \\infty ) } { 2 * \\operatorname { t a n h } ( + \\infty ) } = 1 } & { \\mathrm { i f ~ } x > 0 . 5 } \\\\ { \\frac { \\operatorname { t a n h } ( + \\infty ) } { 2 * \\operatorname { t a n h } ( + \\infty ) } = 0 . 5 } & { \\mathrm { i f ~ } x = 0 . 5 } \\\\ { \\frac { 0 } { 2 * \\operatorname { t a n h } ( + \\infty ) } = 0 } & { \\mathrm { i f ~ } x < 0 . 5 } \\end{array} \n$$",
764
+ "text_format": "latex",
765
+ "bbox": [
766
+ 310,
767
+ 633,
768
+ 691,
769
+ 695
770
+ ],
771
+ "page_idx": 5
772
+ },
773
+ {
774
+ "type": "text",
775
+ "text": "With this temperature factor, our algorithm can simulate a wide range of surrogate gradients with different smoothness. We visualize the transition in Fig. 3 from both forward perspective and backward perspective. As aforementioned, surrogate gradient can mimic the FDG in a relatively large neighborhood. Our intuition is that the optimal surrogate gradient can be found by choosing temperature wisely. Thus our task becomes to optimize temperature and network parameters simultaneously during training. As did in former toy experiments (Sec. 4.2), we verify the cosine similarity between our Dspike gradients and the FDG at the beginning of each training epoch and update the temperature to better match the FDG. This algorithm is detailed in Algo. 1. ",
776
+ "bbox": [
777
+ 173,
778
+ 723,
779
+ 826,
780
+ 837
781
+ ],
782
+ "page_idx": 5
783
+ },
784
+ {
785
+ "type": "text",
786
+ "text": "As abovementioned, evaluating FDG could be time-consuming, due to the two times evaluation of the final loss for each weight element. Therefore, we choose to only compute the FDG in the first layer for two reasons. First, the first layer has much fewer weights. In ResNet-18 (for CIFAR10 dataset), the first layer only has $3 \\times 3 \\times 3 \\times 6 4 = 5 7 6$ elements. Second, the gradient propagation may accumulate the error in the former layers, which effectively measures the gradient mismatch. ",
787
+ "bbox": [
788
+ 174,
789
+ 842,
790
+ 825,
791
+ 911
792
+ ],
793
+ "page_idx": 5
794
+ },
795
+ {
796
+ "type": "image",
797
+ "img_path": "images/b058289d96cf2a3af515bea104b590c2e4c5ac976b0e01ce56486282f76a0509.jpg",
798
+ "image_caption": [
799
+ "Figure 3: The forward plot (left) as well as the backward plot (right) of Dspike function. By changing temperature parameter we can manipulate the gradient estimation in SNN training. "
800
+ ],
801
+ "image_footnote": [],
802
+ "bbox": [
803
+ 241,
804
+ 89,
805
+ 758,
806
+ 262
807
+ ],
808
+ "page_idx": 6
809
+ },
810
+ {
811
+ "type": "text",
812
+ "text": "Algorithm 1: Training SNN with Dspike gradient ",
813
+ "text_level": 1,
814
+ "bbox": [
815
+ 173,
816
+ 320,
817
+ 503,
818
+ 337
819
+ ],
820
+ "page_idx": 6
821
+ },
822
+ {
823
+ "type": "text",
824
+ "text": "Input: SNN to be trained; Training dataset, total training epoch $E$ , total training iteration in one epoch $I$ , FDG step size $\\varepsilon$ , temperature update step size $\\Delta b$ , initialized temperature $b ^ { 0 }$ . \nfor all $e = 1 , 2 , \\ldots , E$ -th epoch do Collect input data and labels, computing the FDG $( \\hat { \\nabla } _ { \\varepsilon , w } L )$ of the first layer using $\\varepsilon$ ; for all $b$ in $\\{ b ^ { e - 1 } , b ^ { e - 1 } + \\Delta b , b ^ { e - 1 } - \\Delta b \\}$ do Compute Dsipke surrogate gradient $\\nabla _ { b , w } L$ and $\\cos \\underline { { \\mathrm { ~ \\scriptstyle ~ \\psi ~ } } } \\mathrm { s i m } ( \\hat { \\nabla } _ { \\varepsilon , w } L , \\nabla _ { b , w } L )$ Find the optimal temperature with the highest cosine similarity and update it to $b ^ { e }$ ; for all $i = 1 , 2 , \\dots , I$ -iteration do Get training data and labels, compute Dspike surrogate gradient using optimal $b$ ; Descend loss function and update weights; ",
825
+ "bbox": [
826
+ 174,
827
+ 338,
828
+ 805,
829
+ 492
830
+ ],
831
+ "page_idx": 6
832
+ },
833
+ {
834
+ "type": "text",
835
+ "text": "return trained SNN. ",
836
+ "bbox": [
837
+ 173,
838
+ 497,
839
+ 310,
840
+ 511
841
+ ],
842
+ "page_idx": 6
843
+ },
844
+ {
845
+ "type": "text",
846
+ "text": "4.4 Time Inheritance Training ",
847
+ "text_level": 1,
848
+ "bbox": [
849
+ 174,
850
+ 541,
851
+ 398,
852
+ 556
853
+ ],
854
+ "page_idx": 6
855
+ },
856
+ {
857
+ "type": "text",
858
+ "text": "We also introduce a novel training pipeline that can effectively reduce the time for training multiple SNNs. Unlike ANN-SNN conversion, direct training SNN is performed with a fixed time step $T$ . As a result, we must learn a new SNN from scratch if we decide to use another different $T$ . We propose Time Inheritance Training (TIT) pipeline to ameliorate this problem. First, we train an SNN to converge with high $T$ , e.g. 20. Then, we use this well-trained model to initialize an SNN with lower $T$ , say $T = 1 0$ . Consequently, the initialized model has exactly the same output as the former model in the first 10 time steps, enabling better initialization and faster convergence. In other words, TIT progressively reduces the time step finetuning from a higher time step SNN first. This idea resembles the curriculum learning proposed in Bengio et al. [33], which suggests learning the easy task first. Armed with TIT, we can reduce the training time of subsequent models by $7 5 \\%$ , while sharing the same task performances. ",
859
+ "bbox": [
860
+ 173,
861
+ 566,
862
+ 825,
863
+ 719
864
+ ],
865
+ "page_idx": 6
866
+ },
867
+ {
868
+ "type": "text",
869
+ "text": "5 Experiments ",
870
+ "text_level": 1,
871
+ "bbox": [
872
+ 174,
873
+ 738,
874
+ 312,
875
+ 756
876
+ ],
877
+ "page_idx": 6
878
+ },
879
+ {
880
+ "type": "text",
881
+ "text": "In this section, we report experimental results for our Dspike algorithm on CIFAR [34] and ImageNet dataset [35]. For static image dataset, we encode the images to spike using the first layer in the SNN, as adopted in recent works [27]. For the neuromorphic image dataset, the images are already converted to 0/1 spike format. We also replace the max-pooling layer with the average-pooling layer in the network architecture. The detailed implementation is described in each subsection. ",
882
+ "bbox": [
883
+ 174,
884
+ 771,
885
+ 825,
886
+ 840
887
+ ],
888
+ "page_idx": 6
889
+ },
890
+ {
891
+ "type": "text",
892
+ "text": "5.1 Network Architecture Choice ",
893
+ "text_level": 1,
894
+ "bbox": [
895
+ 174,
896
+ 857,
897
+ 416,
898
+ 872
899
+ ],
900
+ "page_idx": 6
901
+ },
902
+ {
903
+ "type": "text",
904
+ "text": "For CIFAR series experiments. We mainly adopt the ResNet-family architectures [30]. Unlike traditional ResNet structure [30], we use a modified version with 3 stem layers and avg-downsample block, as introduced in [36]. Our ResNet-18 architectures contains 4 stages with 2 basic residual block in each stage. Our initial channel is set to 64 and doubled in each stage. In comparison with [26], they use ResNet-19 with 3 stages, with 3 blocks in the first 2 stages and 2 blocks in the last stage. However, they choose 128 channel and they has larger receptive field than our model. In general, their ResNet-19 has ${ \\sim } 1 0$ times more operations than our ResNet-18. For ImageNet, we use the same VGG-16 as used in [27] and the same ResNet-34 as used in [26]. ",
905
+ "bbox": [
906
+ 174,
907
+ 883,
908
+ 821,
909
+ 911
910
+ ],
911
+ "page_idx": 6
912
+ },
913
+ {
914
+ "type": "table",
915
+ "img_path": "images/36ccfb7a46364a67ac604c6c1da492e6d294f37259cecdfdc3ad91bc69ecdf16.jpg",
916
+ "table_caption": [
917
+ "Table 2: Training Spiking Neural Networks on CIFAR10 and CIFAR100. "
918
+ ],
919
+ "table_footnote": [],
920
+ "table_body": "<table><tr><td>Dataset</td><td>Method</td><td>Type</td><td>Architecture</td><td>Time Step</td><td>Accuracy</td></tr><tr><td rowspan=\"10\">CIFAR10</td><td>SpikeNorm [10]</td><td>ANN-SNN conversion</td><td>VGG-16</td><td>2500</td><td>91.55</td></tr><tr><td>Hybrid-Train [40]</td><td>Hybrid</td><td>VGG-16</td><td>200</td><td>92.02</td></tr><tr><td>Spike-based BP [41]</td><td>SNN training</td><td>ResNet-11</td><td>100</td><td>90.95</td></tr><tr><td>STBP [4]</td><td>SNN training</td><td>5Conv, 2FC</td><td>12</td><td>90.53</td></tr><tr><td>TSSL-BP [42]</td><td>SNN training</td><td>5Conv,2FC</td><td>5</td><td>91.41</td></tr><tr><td>Diet-SNN [27]</td><td>SNN training</td><td>VGG-16</td><td>5</td><td>92.70</td></tr><tr><td></td><td>SNN training</td><td></td><td>6</td><td>93.16</td></tr><tr><td rowspan=\"3\">STBP-tdBN[26]</td><td rowspan=\"3\"></td><td>ResNet-19</td><td>4</td><td>92.92</td></tr><tr><td></td><td>2</td><td>92.34</td></tr><tr><td></td><td>6</td><td>94.25±0.07</td></tr><tr><td rowspan=\"3\"></td><td>Dspike</td><td>SNN training</td><td>ResNet-18</td><td>4</td><td>93.66±0.05</td></tr><tr><td></td><td></td><td></td><td>2</td><td>93.13±0.07</td></tr><tr><td>BinarySNN [43] Diet-SNN [27]</td><td>BNN-SNN conversion SNN training</td><td>VGG-15 VGG-16</td><td>62</td><td>63.20</td></tr><tr><td rowspan=\"3\">CIFAR100</td><td></td><td></td><td></td><td>5</td><td>69.67</td></tr><tr><td>Dspike</td><td>SNN training</td><td>ResNet-18</td><td>6 4</td><td>74.24±0.10 73.35±0.14</td></tr><tr><td></td><td></td><td></td><td>2</td><td>71.68±0.12</td></tr><tr><td rowspan=\"3\"></td><td>Rollout [44]</td><td>Streaming roll out ANN</td><td>DenseNet</td><td></td><td></td></tr><tr><td>CIFAR10-DVS STBP-tdBN [26]</td><td>SNN training</td><td>ResNet-19</td><td>10 10</td><td>66.8</td></tr><tr><td>Dspike</td><td>SNN training</td><td>ResNet-18</td><td>10</td><td>67.8 75.4±0.05</td></tr></table>",
921
+ "bbox": [
922
+ 178,
923
+ 111,
924
+ 816,
925
+ 422
926
+ ],
927
+ "page_idx": 7
928
+ },
929
+ {
930
+ "type": "text",
931
+ "text": "",
932
+ "bbox": [
933
+ 173,
934
+ 446,
935
+ 826,
936
+ 531
937
+ ],
938
+ "page_idx": 7
939
+ },
940
+ {
941
+ "type": "text",
942
+ "text": "5.2 CIFAR ",
943
+ "text_level": 1,
944
+ "bbox": [
945
+ 174,
946
+ 540,
947
+ 263,
948
+ 555
949
+ ],
950
+ "page_idx": 7
951
+ },
952
+ {
953
+ "type": "text",
954
+ "text": "The CIFAR10 (100) dataset contains 50K training and 10K test images with $3 2 \\times 3 2$ pixels. We use AutoAugment [37] and Cutout [38] for data augmentation. We use ResNet-18 architecture for running experiments. We train the corresponding ANN first and use it to initialize the first SNN with $( T = 6$ ), then we use Time Inheritance Training to gradually reduce the time step to 2. For FDG computation, we use the best practice $\\varepsilon = 0 . 1$ in the toy experiments. The temperature is initialized to 1, and we set the update step size to $\\Delta b = 0 . 2$ . We adopt SGD optimizer with 0.9 momentum. In the first round of TIT, we train the model for 300 epochs with a learning rate of 0.01 cosine decayed [39] to 0. In the rest rounds of TIT, we only train the model for 50 epochs with a learning rate of 0.004. Weight decay (L2 regularization) is set to 0.0001. We run the model with 4 GTX 1080Tis. For each run, we report the mean accuracy as well as the standard deviation with 3 trials. ",
955
+ "bbox": [
956
+ 173,
957
+ 565,
958
+ 825,
959
+ 704
960
+ ],
961
+ "page_idx": 7
962
+ },
963
+ {
964
+ "type": "text",
965
+ "text": "We summarize the overall results in Table 2. On CIFAR10, our work can outperform state-of-the-art by $1 . 0 9 \\%$ accuracy when $T = 6$ . It is also worth noting that the ResNet-19 used in [26] has $2 \\mathbf { x }$ channel numbers and a larger feature-map, translating to $1 0 \\mathrm { x }$ computation cost. Nevertheless, our ResNet-18 with Dspike still achieves higher accuracy. Notably, our ResNet-18 $T = 2 , 4$ ) is trained with TIT for only 50 epochs, yet still reaches a new state-of-the-art. We also conduct an ablation study: training a 2 time step spiking ResNet-18 without TIT for 300 epochs. The accuracy is only $9 3 . 1 3 \\%$ which is subpar with the TIT method. We also verify Dspike on CIFAR100, with the same training pipeline here and we find our model can achieve much better performances than Diet-SNN [27]. ",
966
+ "bbox": [
967
+ 173,
968
+ 710,
969
+ 825,
970
+ 821
971
+ ],
972
+ "page_idx": 7
973
+ },
974
+ {
975
+ "type": "text",
976
+ "text": "To further demonstrate the effectiveness of our method, we apply the Dspike function on the eventstream dataset CIFAR10-DVS [45]. CIFAR10-DVS contains 10k $1 2 8 \\times 1 2 8$ images converted from CIFAR10. We split the dataset into 9k training images and $1 \\mathrm { k }$ test images following the prior practice [26]. For data pre-processing and augmentation, we first resize the training image frames to $4 8 \\times 4 8$ , then apply random horizontal flip. Additionally, we apply random roll within 5 pixels. The test images are directly resized to $4 8 \\times 4 8$ . Training hyper-parameters are kept the same with the CIFAR10 experiments. Our proposed method can achieve $7 5 . 4 \\%$ averaged top-1 accuracy on CIFAR10-DVS, with $7 . 6 \\%$ absolute accuracy improvement compared with the existing state of the art. ",
977
+ "bbox": [
978
+ 174,
979
+ 828,
980
+ 825,
981
+ 911
982
+ ],
983
+ "page_idx": 7
984
+ },
985
+ {
986
+ "type": "image",
987
+ "img_path": "images/62ca32b702e6f8b0fce46b1b5de2fee86e70e10e3991c02c4413ea2c9190f967.jpg",
988
+ "image_caption": [
989
+ "Figure 4 & Table 3: Left: Activation sparsity for each LIF layer. The $\\mathbf { X }$ -axis denotes the layer index while the $\\mathbf { y }$ -axis denotes the activation sparsity. Right: The computation operations count and the energy consumption comparison between ANN and SNN for each run, we select SNN from existing literature. "
990
+ ],
991
+ "image_footnote": [],
992
+ "bbox": [
993
+ 173,
994
+ 89,
995
+ 823,
996
+ 179
997
+ ],
998
+ "page_idx": 8
999
+ },
1000
+ {
1001
+ "type": "table",
1002
+ "img_path": "images/9a7c27d956cdeb3fa5e0845e6b0e3b69fe36b1a9011c3cc103eb295f844ed0dd.jpg",
1003
+ "table_caption": [
1004
+ "Table 4: Training Spiking Neural Networks on ImageNet. "
1005
+ ],
1006
+ "table_footnote": [],
1007
+ "table_body": "<table><tr><td>Method</td><td>Type</td><td>Architecture</td><td>Time Step</td><td> Accuracy</td></tr><tr><td>SpikeNorm [10]</td><td>ANN-SNN conversion</td><td>ResNet-34</td><td>2500</td><td>65.47</td></tr><tr><td>Hybrid-Train [40]</td><td>Hybrid</td><td>ResNet-34</td><td>250</td><td>61.48</td></tr><tr><td>Hybrid-Train [41]</td><td>Hybrid</td><td>VGG-16</td><td>250</td><td>65.19</td></tr><tr><td>STBP-tdBN [4]</td><td>SNN training</td><td>ResNet-34</td><td>6</td><td>63.72</td></tr><tr><td>Diet-SNN [27]</td><td>SNN training</td><td>VGG-16</td><td>5</td><td>69.00</td></tr><tr><td>Dspike</td><td>SNN training</td><td>ResNet-34</td><td>6</td><td>68.19</td></tr><tr><td>Dspike</td><td>SNN training</td><td>VGG-16</td><td>5</td><td>71.24</td></tr></table>",
1008
+ "bbox": [
1009
+ 245,
1010
+ 282,
1011
+ 750,
1012
+ 406
1013
+ ],
1014
+ "page_idx": 8
1015
+ },
1016
+ {
1017
+ "type": "text",
1018
+ "text": "",
1019
+ "bbox": [
1020
+ 174,
1021
+ 439,
1022
+ 823,
1023
+ 482
1024
+ ],
1025
+ "page_idx": 8
1026
+ },
1027
+ {
1028
+ "type": "text",
1029
+ "text": "5.3 ImageNet ",
1030
+ "text_level": 1,
1031
+ "bbox": [
1032
+ 174,
1033
+ 507,
1034
+ 281,
1035
+ 522
1036
+ ],
1037
+ "page_idx": 8
1038
+ },
1039
+ {
1040
+ "type": "text",
1041
+ "text": "In this section we verify our algorithm on the ImageNet dataset. ImageNet dataset has more than $1 2 5 0 \\mathrm { k }$ training images and 50k test images. We use the standard pre-processing and augmentation for training data [30]. The test data is directly centered cropped to $2 2 4 \\times 2 2 4$ . We train ResNet-34 and VGG-16 on ImageNet using the same architecture in the CIFAR experiments. Each network is trained for 100 epochs with SGD optimizer with 0.9 momentum. The learning rate is set to 0.04 and weight decay is set to 0.00004. We train each model on 32 GTX 1080Tis with batch size of 10 per GPU. Following [26], to avoid the biased statistics, we synchronize the batch mean and variance across each device. Results are demonstrated in Table 4, Dspike training obtain $4 . 5 \\%$ improvement compared to STBP-tdBN [26] and $2 . 2 \\%$ improvement compared to Diet-SNN [27]. ",
1042
+ "bbox": [
1043
+ 174,
1044
+ 537,
1045
+ 825,
1046
+ 662
1047
+ ],
1048
+ "page_idx": 8
1049
+ },
1050
+ {
1051
+ "type": "text",
1052
+ "text": "5.4 Sparsity, Efficiency, and Energy Cost ",
1053
+ "text_level": 1,
1054
+ "bbox": [
1055
+ 176,
1056
+ 688,
1057
+ 470,
1058
+ 704
1059
+ ],
1060
+ "page_idx": 8
1061
+ },
1062
+ {
1063
+ "type": "text",
1064
+ "text": "In this section, we measure the sparsity and efficient computation as well as the energy consumption of SNN. For ANN, the dot-product performs multiply-accumulate (MAC) operation, which is composed of an addition and a multiplication. In the case of SNN, its event-based operation and binary activation enable multiplication-free (except for the first rate-encoding layer) inference. Only one addition is needed if a spike is activated. In Fig. 4 we visualize the mean sparsity of activation of our spiking ResNet-18 on the whole CIFAR10 test set. We can see that each LIF layer has no more than $32 \\%$ sparsity rate, which greatly saves energy. We also measure the operation number in Table 3. The addition count is calculated by $s * T * A$ , where $s$ is the mean sparsity, $T$ is the time step and $A$ is the addition number in ANN. For multiplication in SNN, we set it to the FLOPs of the first layer and scale it by $T$ . Our spiking ResNet-18 with 2 time-step has the lowest operation need for the inference. Then, we measure the energy consumption. Following [27], the energy is measured in $4 5 \\mathrm { { n m } }$ CMOS technology. The MAC operation in ANN costs $4 . 6 p J$ energy and the accumulation in SNN costs $0 . 9 p J$ energy. Based on this, we compute the energy cost and put it in the table. Our network only costs $8 0 . 3 m J$ for a single forward, and consumes $1 2 . 8 \\times$ lower energy compared with ANN. ",
1065
+ "bbox": [
1066
+ 173,
1067
+ 718,
1068
+ 825,
1069
+ 911
1070
+ ],
1071
+ "page_idx": 8
1072
+ },
1073
+ {
1074
+ "type": "text",
1075
+ "text": "5.5 Ablation Study ",
1076
+ "text_level": 1,
1077
+ "bbox": [
1078
+ 174,
1079
+ 92,
1080
+ 318,
1081
+ 106
1082
+ ],
1083
+ "page_idx": 9
1084
+ },
1085
+ {
1086
+ "type": "text",
1087
+ "text": "Our experiments use the same $\\varepsilon$ for dataset and network architectures. In this section, we use different ",
1088
+ "bbox": [
1089
+ 181,
1090
+ 116,
1091
+ 820,
1092
+ 131
1093
+ ],
1094
+ "page_idx": 9
1095
+ },
1096
+ {
1097
+ "type": "text",
1098
+ "text": "value for $\\varepsilon$ and compare their results. The results is included in Table 5. Generally, we find a low temperature will decrease the performance, as we explained in Sec. 4.2, the desired optimization algorithm should ensure each update will decrease the loss function. Thus, the instantaneous derivative in SNN cannot measure such curvature information since the instantaneous ",
1099
+ "bbox": [
1100
+ 174,
1101
+ 131,
1102
+ 485,
1103
+ 241
1104
+ ],
1105
+ "page_idx": 9
1106
+ },
1107
+ {
1108
+ "type": "table",
1109
+ "img_path": "images/31a6cbda4c470ffa5457223268b018f1c939d6b0c2a6c27fc476c3d2cb1e6fe2.jpg",
1110
+ "table_caption": [
1111
+ "Table 5: Accuracy comparison given different $\\varepsilon$ "
1112
+ ],
1113
+ "table_footnote": [],
1114
+ "table_body": "<table><tr><td>Dataset</td><td>ε=0.01</td><td>ε=0.05 ε=0.1 ε=0.2</td><td></td></tr><tr><td>CIFAR10</td><td>91.78</td><td>93.11</td><td>94.07</td></tr><tr><td>CIFAR100</td><td>70.97</td><td>72.19</td><td>93.84 74.31 74.57</td></tr></table>",
1115
+ "bbox": [
1116
+ 496,
1117
+ 167,
1118
+ 823,
1119
+ 223
1120
+ ],
1121
+ "page_idx": 9
1122
+ },
1123
+ {
1124
+ "type": "text",
1125
+ "text": "derivative is always 0. Therefore, we find a large epsilon can help improve the performance. Indeed, the optimal $\\varepsilon$ requires tuning, but our empirical results show that 0.1 can have good results. ",
1126
+ "bbox": [
1127
+ 176,
1128
+ 241,
1129
+ 825,
1130
+ 268
1131
+ ],
1132
+ "page_idx": 9
1133
+ },
1134
+ {
1135
+ "type": "text",
1136
+ "text": "5.6 Visualization ",
1137
+ "text_level": 1,
1138
+ "bbox": [
1139
+ 174,
1140
+ 284,
1141
+ 303,
1142
+ 299
1143
+ ],
1144
+ "page_idx": 9
1145
+ },
1146
+ {
1147
+ "type": "text",
1148
+ "text": "In this section, we provide further experimental visualization. In Fig. 5, we plot the temperature curve for CIFAR10-DVS experiments. The spiking ResNet-18 was trained for 300 epochs with cosine learning rate decay. We initialize $b$ to 1.0 and use $\\Delta b { = } 0 . 2$ to optimize both temperature for gradient calculation and the weights parameters for network learning. For the initial 25 epochs, the temperature remains less-than-1. We think this is primarily due to the complex loss landscape at the starting stage of the training. During the 20 to 80 epoch, the temperature continues to be increasing. In this stage of learning the FDG desires to learn a sharp, narrow gradient with low bias but high variance. We also find the accuracy curve becomes more unstable in this stage of the training, as a consequence of the sharp gradient. After 80 epochs, the temperature becomes decreasing. Although the decreasing process is not aggressive as the former increasing stage, the trend is still obvious. From 80-250, the temperature decreases from 4.0 to 1.6 with some fluctuations. Then, at the end of the training stage, the temperature again becomes increasing. ",
1149
+ "bbox": [
1150
+ 174,
1151
+ 309,
1152
+ 825,
1153
+ 476
1154
+ ],
1155
+ "page_idx": 9
1156
+ },
1157
+ {
1158
+ "type": "text",
1159
+ "text": "The intuition behind this tuning mechanism may remain unexplainable right now, however, we think it is the intrinsic nature of the gradient estimation in SNN. Through FDG, we are able to optimize the gradient calculation along with the weights learning. ",
1160
+ "bbox": [
1161
+ 176,
1162
+ 482,
1163
+ 825,
1164
+ 523
1165
+ ],
1166
+ "page_idx": 9
1167
+ },
1168
+ {
1169
+ "type": "image",
1170
+ "img_path": "images/cbb32f98c9e8e60b4ab37fe6eeffec456f9a770d5e75d61cb0dff82ce30137ae.jpg",
1171
+ "image_caption": [
1172
+ "Figure 5: The evolutution of temperature $^ { b }$ during optimization. "
1173
+ ],
1174
+ "image_footnote": [],
1175
+ "bbox": [
1176
+ 253,
1177
+ 534,
1178
+ 745,
1179
+ 709
1180
+ ],
1181
+ "page_idx": 9
1182
+ },
1183
+ {
1184
+ "type": "text",
1185
+ "text": "6 Discussion ",
1186
+ "text_level": 1,
1187
+ "bbox": [
1188
+ 173,
1189
+ 755,
1190
+ 294,
1191
+ 771
1192
+ ],
1193
+ "page_idx": 9
1194
+ },
1195
+ {
1196
+ "type": "text",
1197
+ "text": "In this work, we inspect the training process of SNN when using the surrogate gradient. The proposed finite difference gradient and Dspike function can be assembled with other optimization methods as a fundamental module of gradient estimation for training SNN. This suggests that the performance of SNN can be further increased when more sophisticated training approaches are integrated with the currently proposed methods in the future. Although the improvement on model performance is very significant, be that as it may, our work is still an extension to the conventional SG. How to efficiently find the best FDG gradient to directly deal with the non-linearity of spiking function still remains a problem. In addition, we only consider the LIF neurons for the analyses here, the efficiency of the proposed approaches on other types of spiking neurons still needs examination in practice. ",
1198
+ "bbox": [
1199
+ 174,
1200
+ 786,
1201
+ 825,
1202
+ 911
1203
+ ],
1204
+ "page_idx": 9
1205
+ },
1206
+ {
1207
+ "type": "text",
1208
+ "text": "References \n[1] Filipp Akopyan, Jun Sawada, Andrew Cassidy, Rodrigo Alvarez-Icaza, John Arthur, Paul Merolla, Nabil Imam, Yutaka Nakamura, Pallab Datta, Gi-Joon Nam, et al. Truenorth: Design and tool flow of a 65 mw 1 million neuron programmable neurosynaptic chip. IEEE transactions on computer-aided design of integrated circuits and systems, 34(10):1537–1557, 2015. \n[2] Mike Davies, Narayan Srinivasa, Tsung-Han Lin, Gautham Chinya, Yongqiang Cao, Sri Harsha Choday, Georgios Dimou, Prasad Joshi, Nabil Imam, Shweta Jain, et al. Loihi: A neuromorphic manycore processor with on-chip learning. IEEE Micro, 38(1):82–99, 2018. \n[3] Jing Pei, Lei Deng, Sen Song, Mingguo Zhao, Youhui Zhang, Shuang Wu, Guanrui Wang, Zhe Zou, Zhenzhi Wu, Wei He, et al. Towards artificial general intelligence with hybrid tianjic chip architecture. Nature, 572(7767):106–111, 2019. \n[4] Yujie Wu, Lei Deng, Guoqi Li, Jun Zhu, Yuan Xie, and Luping Shi. Direct training for spiking neural networks: Faster, larger, better. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 33, pages 1311–1318, 2019. \n[5] Adam Paszke, Sam Gross, Francisco Massa, Adam Lerer, James Bradbury, Gregory Chanan, Trevor Killeen, Zeming Lin, Natalia Gimelshein, Luca Antiga, et al. Pytorch: An imperative style, high-performance deep learning library. arXiv preprint arXiv:1912.01703, 2019. \n[6] James Bradbury, Roy Frostig, Peter Hawkins, Matthew James Johnson, Chris Leary, Dougal Maclaurin, George Necula, Adam Paszke, Jake VanderPlas, Skye Wanderman-Milne, and Qiao Zhang. JAX: composable transformations of Python+NumPy programs, 2018. \n[7] Martín Abadi, Paul Barham, Jianmin Chen, Zhifeng Chen, Andy Davis, Jeffrey Dean, Matthieu Devin, Sanjay Ghemawat, Geoffrey Irving, Michael Isard, et al. Tensorflow: A system for large-scale machine learning. In 12th {USENIX} symposium on operating systems design and implementation ({OSDI} 16), pages 265–283, 2016. \n[8] Emre O Neftci, Hesham Mostafa, and Friedemann Zenke. Surrogate gradient learning in spiking neural networks: Bringing the power of gradient-based optimization to spiking neural networks. IEEE Signal Processing Magazine, 36(6):51–63, 2019. [9] Bing Han, Gopalakrishnan Srinivasan, and Kaushik Roy. Rmp-snn: Residual membrane potential neuron for enabling deeper high-accuracy and low-latency spiking neural network. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 13558–13567, 2020. \n[10] Abhronil Sengupta, Yuting Ye, Robert Wang, Chiao Liu, and Kaushik Roy. Going deeper in spiking neural networks: Vgg and residual architectures. Frontiers in Neuroscience, 13:95, 2019. \n[11] Bodo Rueckauer, Iulia-Alexandra Lungu, Yuhuang Hu, and Michael Pfeiffer. Theory and tools for the conversion of analog to spiking convolutional neural networks. arXiv preprint arXiv:1612.04052, 2016. \n[12] Bodo Rueckauer, Iulia-Alexandra Lungu, Yuhuang Hu, Michael Pfeiffer, and Shih-Chii Liu. Conversion of continuous-valued deep networks to efficient event-driven networks for image classification. Frontiers in Neuroscience, 11:682, 2017. \n[13] Bing Han and Kaushik Roy. Deep spiking neural network: Energy efficiency through time based coding. In Proc. IEEE Eur. Conf. Comput. Vis.(ECCV), pages 388–404, 2020. \n[14] Shikuang Deng and Shi Gu. Optimal conversion of conventional artificial neural networks to spiking neural networks. arXiv preprint arXiv:2103.00476, 2021. \n[15] Yuhang Li, Shikuang Deng, Xin Dong, Ruihao Gong, and Shi Gu. A free lunch from ann: Towards efficient, accurate spiking neural networks calibration. arXiv preprint arXiv:2106.06984, 2021. \n[16] Yuhang Li, Xin Dong, and Wei Wang. Additive powers-of-two quantization: An efficient non-uniform discretization for neural networks. arXiv preprint arXiv:1909.13144, 2019. \n[17] Yuhang Li, Ruihao Gong, Xu Tan, Yang Yang, Peng Hu, Qi Zhang, Fengwei Yu, Wei Wang, and Shi Gu. Brecq: Pushing the limit of post-training quantization by block reconstruction. arXiv preprint arXiv:2102.05426, 2021. \n[18] Yuhang Li, Mingzhu Shen, Jian Ma, Yan Ren, Mingxin Zhao, Qi Zhang, Ruihao Gong, Fengwei Yu, and Junjie Yan. MQBench: Towards reproducible and deployable model quantization benchmark. In Thirty-fifth Conference on Neural Information Processing Systems Datasets and Benchmarks Track (Round 1), 2021. \n[19] Hanting Chen, Yunhe Wang, Chunjing Xu, Boxin Shi, Chao Xu, Qi Tian, and Chang Xu. Addernet: Do we really need multiplications in deep learning? In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 1468–1477, 2020. \n[20] Arnon Amir, Brian Taba, David Berg, Timothy Melano, Jeffrey McKinstry, Carmelo Di Nolfo, Tapan Nayak, Alexander Andreopoulos, Guillaume Garreau, Marcela Mendoza, et al. A low power, fully event-based gesture recognition system. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 7243–7252, 2017. \n[21] Johanni Brea, Walter Senn, and Jean-Pascal Pfister. Matching recall and storage in sequence learning with spiking neural networks. Journal of neuroscience, 33(23):9565–9575, 2013. \n[22] Yoshua Bengio, Nicholas Léonard, and Aaron Courville. Estimating or propagating gradients through stochastic neurons for conditional computation. arXiv preprint arXiv:1308.3432, 2013. \n[23] Jun Haeng Lee, Tobi Delbruck, and Michael Pfeiffer. Training deep spiking neural networks using backpropagation. Frontiers in Neuroscience, 10:508, 2016. \n[24] Emre O Neftci, Charles Augustine, Somnath Paul, and Georgios Detorakis. Event-driven random back-propagation: Enabling neuromorphic deep learning machines. Frontiers in Neuroscience, 11:324, 2017. \n[25] Yujie Wu, Lei Deng, Guoqi Li, Jun Zhu, and Luping Shi. Spatio-temporal backpropagation for training high-performance spiking neural networks. Frontiers in Neuroscience, 12:331, 2018. \n[26] Hanle Zheng, Yujie Wu, Lei Deng, Yifan Hu, and Guoqi Li. Going deeper with directly-trained larger spiking neural networks. arXiv preprint arXiv:2011.05280, 2020. \n[27] Nitin Rathi and Kaushik Roy. Diet-snn: Direct input encoding with leakage and threshold optimization in deep spiking neural networks. arXiv preprint arXiv:2008.03658, 2020. \n[28] Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. In ICML, 2015. \n[29] Shibani Santurkar, Dimitris Tsipras, Andrew Ilyas, and Aleksander Madry. How does batch normalization help optimization? arXiv preprint arXiv:1805.11604, 2018. \n[30] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In CVPR, 2016. \n[31] Matthieu Courbariaux, Yoshua Bengio, and Jean-Pierre David. Binaryconnect: Training deep neural networks with binary weights during propagations. In NeurIPS, 2015. \n[32] Guillaume Bellec, Darjan Salaj, Anand Subramoney, Robert Legenstein, and Wolfgang Maass. Long short-term memory and learning-to-learn in networks of spiking neurons. arXiv preprint arXiv:1803.09574, 2018. \n[33] Yoshua Bengio, Jérôme Louradour, Ronan Collobert, and Jason Weston. Curriculum learning. In Proceedings of the 26th annual international conference on machine learning, pages 41–48, 2009. \n[34] Alex Krizhevsky, Vinod Nair, and Geoffrey Hinton. Cifar-10 (canadian institute for advanced research). \n[35] Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. In CVPR, 2009. \n[36] Tong He, Zhi Zhang, Hang Zhang, Zhongyue Zhang, Junyuan Xie, and Mu Li. Bag of tricks for image classification with convolutional neural networks. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 558–567, 2019. \n[37] Ekin D Cubuk, Barret Zoph, Dandelion Mane, Vijay Vasudevan, and Quoc V Le. Autoaugment: Learning augmentation policies from data. arXiv preprint arXiv:1805.09501, 2018. \n[38] Terrance DeVries and Graham W Taylor. Improved regularization of convolutional neural networks with cutout. arXiv preprint arXiv:1708.04552, 2017. \n[39] Ilya Loshchilov and Frank Hutter. Sgdr: Stochastic gradient descent with warm restarts. arXiv preprint arXiv:1608.03983, 2016. \n[40] Nitin Rathi, Gopalakrishnan Srinivasan, Priyadarshini Panda, and Kaushik Roy. Enabling deep spiking neural networks with hybrid conversion and spike timing dependent backpropagation. arXiv preprint arXiv:2005.01807, 2020. \n[41] Chankyu Lee, Syed Shakib Sarwar, Priyadarshini Panda, Gopalakrishnan Srinivasan, and Kaushik Roy. Enabling spike-based backpropagation for training deep neural network architectures. Frontiers in Neuroscience, 14, 2020. \n[42] Wenrui Zhang and Peng Li. Temporal spike sequence learning via backpropagation for deep spiking neural networks. arXiv preprint arXiv:2002.10085, 2020. \n[43] Sen Lu and Abhronil Sengupta. Exploring the connection between binary and spiking neural networks. Frontiers in Neuroscience, 14:535, 2020. \n[44] Alexander Kugele, Thomas Pfeil, Michael Pfeiffer, and Elisabetta Chicca. Efficient processing of spatio-temporal data streams with spiking neural networks. Frontiers in Neuroscience, 14:439, 2020. \n[45] Hongmin Li, Hanchao Liu, Xiangyang Ji, Guoqi Li, and Luping Shi. Cifar10-dvs: an eventstream dataset for object classification. Frontiers in Neuroscience, 11:309, 2017. ",
1209
+ "bbox": [
1210
+ 171,
1211
+ 75,
1212
+ 828,
1213
+ 916
1214
+ ],
1215
+ "page_idx": 10
1216
+ },
1217
+ {
1218
+ "type": "text",
1219
+ "text": "",
1220
+ "bbox": [
1221
+ 171,
1222
+ 75,
1223
+ 828,
1224
+ 915
1225
+ ],
1226
+ "page_idx": 11
1227
+ },
1228
+ {
1229
+ "type": "text",
1230
+ "text": "",
1231
+ "bbox": [
1232
+ 171,
1233
+ 90,
1234
+ 828,
1235
+ 357
1236
+ ],
1237
+ "page_idx": 12
1238
+ },
1239
+ {
1240
+ "type": "text",
1241
+ "text": "Checklist ",
1242
+ "text_level": 1,
1243
+ "bbox": [
1244
+ 174,
1245
+ 376,
1246
+ 254,
1247
+ 392
1248
+ ],
1249
+ "page_idx": 12
1250
+ },
1251
+ {
1252
+ "type": "text",
1253
+ "text": "1. For all authors... ",
1254
+ "bbox": [
1255
+ 214,
1256
+ 409,
1257
+ 339,
1258
+ 422
1259
+ ],
1260
+ "page_idx": 12
1261
+ },
1262
+ {
1263
+ "type": "text",
1264
+ "text": "(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes] \n(b) Did you describe the limitations of your work? [Yes] Please see our discussion in Sec. 6 \n(c) Did you discuss any potential negative societal impacts of your work? [No] \n(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes] ",
1265
+ "bbox": [
1266
+ 238,
1267
+ 428,
1268
+ 825,
1269
+ 532
1270
+ ],
1271
+ "page_idx": 12
1272
+ },
1273
+ {
1274
+ "type": "text",
1275
+ "text": "2. If you are including theoretical results... ",
1276
+ "bbox": [
1277
+ 214,
1278
+ 536,
1279
+ 493,
1280
+ 551
1281
+ ],
1282
+ "page_idx": 12
1283
+ },
1284
+ {
1285
+ "type": "text",
1286
+ "text": "(a) Did you state the full set of assumptions of all theoretical results? [Yes] (b) Did you include complete proofs of all theoretical results? [Yes] The proof is available in Sec. 4.3. ",
1287
+ "bbox": [
1288
+ 238,
1289
+ 555,
1290
+ 825,
1291
+ 599
1292
+ ],
1293
+ "page_idx": 12
1294
+ },
1295
+ {
1296
+ "type": "text",
1297
+ "text": "3. If you ran experiments... ",
1298
+ "bbox": [
1299
+ 214,
1300
+ 604,
1301
+ 393,
1302
+ 619
1303
+ ],
1304
+ "page_idx": 12
1305
+ },
1306
+ {
1307
+ "type": "text",
1308
+ "text": "(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] Our code will be available in the supplemental. \n(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] All implementations are described in the experiments section. \n(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes] We report the mean as well as the standard deviation accuracy in CIFAR experiments. For time consideration, we did not run them for ImageNet experiments, the results may be updated in the future. \n(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] The computation resources description is provided in the experiment section. ",
1309
+ "bbox": [
1310
+ 238,
1311
+ 623,
1312
+ 825,
1313
+ 796
1314
+ ],
1315
+ "page_idx": 12
1316
+ },
1317
+ {
1318
+ "type": "text",
1319
+ "text": "4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets... ",
1320
+ "bbox": [
1321
+ 215,
1322
+ 801,
1323
+ 823,
1324
+ 816
1325
+ ],
1326
+ "page_idx": 12
1327
+ },
1328
+ {
1329
+ "type": "text",
1330
+ "text": "(a) If your work uses existing assets, did you cite the creators? [Yes] We use CIFAR10/100 [34], ImageNet [35], and CIFAR10-DVS [45]. \n(b) Did you mention the license of the assets? [No] We adopt public datasets. \n(c) Did you include any new assets either in the supplemental material or as a URL? [No] \n(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [No] ",
1331
+ "bbox": [
1332
+ 238,
1333
+ 820,
1334
+ 825,
1335
+ 912
1336
+ ],
1337
+ "page_idx": 12
1338
+ },
1339
+ {
1340
+ "type": "text",
1341
+ "text": "(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [No] ",
1342
+ "bbox": [
1343
+ 236,
1344
+ 92,
1345
+ 823,
1346
+ 119
1347
+ ],
1348
+ "page_idx": 13
1349
+ },
1350
+ {
1351
+ "type": "text",
1352
+ "text": "5. If you used crowdsourcing or conducted research with human subjects... ",
1353
+ "bbox": [
1354
+ 214,
1355
+ 123,
1356
+ 707,
1357
+ 138
1358
+ ],
1359
+ "page_idx": 13
1360
+ },
1361
+ {
1362
+ "type": "text",
1363
+ "text": "(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A] \n(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A] \n(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A] ",
1364
+ "bbox": [
1365
+ 238,
1366
+ 142,
1367
+ 826,
1368
+ 232
1369
+ ],
1370
+ "page_idx": 13
1371
+ }
1372
+ ]
parse/train/H4e7mBnC9f0/H4e7mBnC9f0_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/train/H4e7mBnC9f0/H4e7mBnC9f0_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/train/R-616EWWKF5/R-616EWWKF5.md ADDED
@@ -0,0 +1,235 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Do Vision Transformers See Like Convolutional Neural Networks?
2
+
3
+ Maithra Raghu Google Research, Brain Team maithrar@gmail.com
4
+
5
+ Thomas Unterthiner Google Research, Brain Team unterthiner@google.com
6
+
7
+ Simon Kornblith Google Research, Brain Team kornblith@google.com
8
+
9
+ Chiyuan Zhang Google Research, Brain Team chiyuan@google.com
10
+
11
+ Alexey Dosovitskiy Google Research, Brain Team adosovitskiy@google.com
12
+
13
+ # Abstract
14
+
15
+ Convolutional neural networks (CNNs) have so far been the de-facto model for visual data. Recent work has shown that (Vision) Transformer models (ViT) can achieve comparable or even superior performance on image classification tasks. This raises a central question: how are Vision Transformers solving these tasks? Are they acting like convolutional networks, or learning entirely different visual representations? Analyzing the internal representation structure of ViTs and CNNs on image classification benchmarks, we find striking differences between the two architectures, such as ViT having more uniform representations across all layers. We explore how these differences arise, finding crucial roles played by self-attention, which enables early aggregation of global information, and ViT residual connections, which strongly propagate features from lower to higher layers. We study the ramifications for spatial localization, demonstrating ViTs successfully preserve input spatial information, with noticeable effects from different classification methods. Finally, we study the effect of (pretraining) dataset scale on intermediate features and transfer learning, and conclude with a discussion on connections to new architectures such as the MLP-Mixer.
16
+
17
+ # 1 Introduction
18
+
19
+ Over the past several years, the successes of deep learning on visual tasks has critically relied on convolutional neural networks [20, 16]. This is largely due to the powerful inductive bias of spatial equivariance encoded by convolutional layers, which have been key to learning general purpose visual representations for easy transfer and strong performance. Remarkably however, recent work has demonstrated that Transformer neural networks are capable of equal or superior performance on image classification tasks at large scale [14]. These Vision Transformers (ViT) operate almost identically to Transformers used in language [13], using self-attention, rather than convolution, to aggregate information across locations. This is in contrast with a large body of prior work, which has focused on more explicitly incorporating image-specific inductive biases [30, 9, 4]
20
+
21
+ This breakthrough highlights a fundamental question: how are Vision Transformers solving these image based tasks? Do they act like convolutions, learning the same inductive biases from scratch? Or are they developing novel task representations? What is the role of scale in learning these representations? And are there ramifications for downstream tasks? In this paper, we study these questions, uncovering key representational differences between ViTs and CNNs, the ways in which these difference arise, and effects on classification and transfer learning. Specifically, our contributions are:
22
+
23
+ 35th Conference on Neural Information Processing Systems (NeurIPS 2021).
24
+
25
+ • We investigate the internal representation structure of ViTs and CNNs, finding striking differences between the two models, such as ViT having more uniform representations, with greater similarity between lower and higher layers.
26
+ • Analyzing how local/global spatial information is utilised, we find ViT incorporates more global information than ResNet at lower layers, leading to quantitatively different features.
27
+ • Nevertheless, we find that incorporating local information at lower layers remains vital, with large-scale pre-training data helping early attention layers learn to do this
28
+ • We study the uniform internal structure of ViT, finding that skip connections in ViT are even more influential than in ResNets, having strong effects on performance and representation similarity.
29
+ • Motivated by potential future uses in object detection, we examine how well input spatial information is preserved, finding connections between spatial localization and methods of classification.
30
+ • We study the effects of dataset scale on transfer learning, with a linear probes study revealing its importance for high quality intermediate representations.
31
+
32
+ # 2 Related Work
33
+
34
+ Developing non-convolutional neural networks to tackle computer vision tasks, particularly Transformer neural networks [44] has been an active area of research. Prior works have looked at local multiheaded self-attention, drawing from the structure of convolutional receptive fields [30, 36], directly combining CNNs with self-attention [4, 2, 46] or applying Transformers to smaller-size images [6, 9]. In comparison to these, the Vision Transformer [14] performs even less modification to the Transformer architecture, making it especially interesting to compare to CNNs. Since its development, there has also been very recent work analyzing aspects of ViT, particularly robustness [3, 31, 28] and effects of self-supervision [5, 7]. Other recent related work has looked at designing hybrid ViT-CNN models [49, 11], drawing on structural differences between the models. Comparison between Transformers and CNNs are also recently studied in the text domain [41].
35
+
36
+ Our work focuses on the representational structure of ViTs. To study ViT representations, we draw on techniques from neural network representation similarity, which allow the quantitative comparisons of representations within and across neural networks [17, 34, 26, 19]. These techniques have been very successful in providing insights on properties of different vision architectures [29, 22, 18], representation structure in language models [48, 25, 47, 21], dynamics of training methods [33, 24] and domain specific model behavior [27, 35, 38]. We also apply linear probes in our study, which has been shown to be useful to analyze the learned representations in both vision [1] and text [8, 32, 45] models.
37
+
38
+ # 3 Background and Experimental Setup
39
+
40
+ Our goal is to understand whether there are differences in the way ViTs represent and solve image tasks compared to CNNs. Based on the results of Dosovitskiy et al. [14], we take a representative set of CNN and ViT models — ResNet50x1, ResNet152x2, ViT-B/32, ViT-B/16, ViT-L/16 and ViT-H/14. Unless otherwise specified, models are trained on the JFT-300M dataset [40], although we also investigate models trained on the ImageNet ILSVRC 2012 dataset [12, 37] and standard transfer learning benchmarks [50, 14]. We use a variety of analysis methods to study the layer representations of these models, gaining many insights into how these models function. We provide further details of the experimental setting in Appendix A.
41
+
42
+ Representation Similarity and CKA (Centered Kernel Alignment): Analyzing (hidden) layer representations of neural networks is challenging because their features are distributed across a large number of neurons. This distributed aspect also makes it difficult to meaningfully compare representations across neural networks. Centered kernel alignment (CKA) [17, 10] addresses these challenges, enabling quantitative comparisons of representations within and across networks. Specifically, CKA takes as input $\mathbf { X } \in \mathbb { R } ^ { m \times p _ { 1 } }$ and $\mathbf { Y } \in \mathbb { R } ^ { \bar { m } \times p _ { 2 } }$ which are representations (activation matrices), of two layers, with $p _ { 1 }$ and $p _ { 2 }$ neurons respectively, evaluated on the same $m$ examples. Letting $K = X X ^ { \top }$ and $\pmb { L } = \pmb { Y } \pmb { Y } ^ { \top }$ denote the Gram matrices for the two layers (which measures the similarity of a pair of datapoints according to layer representations) CKA computes:
43
+
44
+ $$
45
+ \operatorname { C K A } ( K , L ) = { \frac { \operatorname { H S I C } ( K , L ) } { \sqrt { \operatorname { H S I C } ( K , K ) \operatorname { H S I C } ( L , L ) } } } ,
46
+ $$
47
+
48
+ ![](images/6c5a9b6bab30d7d98cdfbdbc8c227090753b2fe9a3879c54d415bd98c335c458.jpg)
49
+ Figure 1: Representation structure of ViTs and convolutional networks show significant differences, with ViTs having highly similar representations throughout the model, while the ResNet models show much lower similarity between lower and higher layers. We plot CKA similarities between all pairs of layers across different model architectures. The results are shown as a heatmap, with the x and y axes indexing the layers from input to output. We observe that ViTs have relatively uniform layer similarity structure, with a clear grid-like pattern and large similarity between lower and higher layers. By contrast, the ResNet models show clear stages in similarity structure, with smaller similarity scores between lower and higher layers.
50
+
51
+ ![](images/8a4393cdf55bae8dbc53a5b8d7bc4fe6b0b545fc47427224ecdfabf1f9bbf2ea.jpg)
52
+ Figure 2: Cross model CKA heatmap between ViT and ResNet illustrate that a larger number of lower layers in the ResNet are similar to a smaller set of the lowest ViT layers. We compute a CKA heatmap comparing all layers of ViT to all layers of ResNet, for two different ViT models. We observe that the lower half of ResNet layers are similar to around the lowest quarter of ViT layers. The remaining half of the ResNet is similar to approximately the next third of ViT layers, with the highest ViT layers dissimilar to lower and higher ResNet layers.
53
+
54
+ where HSIC is the Hilbert-Schmidt independence criterion [15]. Given the centering matrix $\begin{array} { r } { \pmb { H } = \pmb { I } _ { n } - \frac { 1 } { n } \pmb { 1 } \pmb { 1 } ^ { \top } } \end{array}$ and the centered Gram matrices $K ^ { \prime } = H K H$ and $L ^ { \prime } = H L H$ , $\mathrm { H S I C } ( \bar { K } , L ) =$ $\mathrm { v e c } ( K ^ { \prime } ) \cdot \mathrm { v e c } ( L ^ { \prime } ) / ( m - 1 ) ^ { 2 }$ , the similarity between these centered Gram matrices. CKA is invariant to orthogonal transformation of representations (including permutation of neurons), and the normalization term ensures invariance to isotropic scaling. These properties enable meaningful comparison and analysis of neural network hidden representations. To work at scale with our models and tasks, we approximate the unbiased estimator of HSIC [39] using minibatches, as suggested in [29].
55
+
56
+ # 4 Representation Structure of ViTs and Convolutional Networks
57
+
58
+ We begin our investigation by using CKA to study the internal representation structure of each model. How are representations propagated within the two architectures, and are there signs of functional differences? To answer these questions, we take every pair of layers $X , Y$ within a model and compute their CKA similarity. Note that we take representations not only from outputs of ViT/ResNet blocks, but also from intermediate layers, such as normalization layers and the hidden activations inside a ViT MLP. Figure 1 shows the results as a heatmap, for multiple ViTs and ResNets. We observe clear differences between the internal representation structure between the two model architectures: (1) ViTs show a much more uniform similarity structure, with a clear grid like structure (2) lower and higher layers in ViT show much greater similarity than in the ResNet, where similarity is divided into different (lower/higher) stages.
59
+
60
+ We also perform cross-model comparisons, where we take all layers $\boldsymbol { X }$ from ViT and compare to all layers $\mathbf { Y }$ from ResNet. We observe (Figure 2) that the lower half of 60 ResNet layers are similar to approximately the lowest quarter of ViT layers. In particular, many more lower layers in the ResNet are needed to compute similar representations to the lower layers of ViT. The top half of the ResNet is approximately similar to the next third of the ViT layers. The final third of ViT layers is less similar to all ResNet layers, likely because this set of layers mainly manipulates the CLS token representation, further studied in Section 6.
61
+
62
+ ![](images/386cf223d2ffbb35198c4009d6b4a85458145d4f75ffea87e1a006a2a358ffcf.jpg)
63
+ Figure 3: Plotting attention head mean distances shows lower ViT layers attend both locally and globally, while higher layers primarily incorporate global information. For each attention head, we compute the pixel distance it attends to, weighted by the attention weights, and then average over 5000 datapoints to get an average attention head distance. We plot the heads sorted by their average attention distance for the two lowest and two highest layers in the ViT, observing that the lower layers attend both locally and globally, while the higher layers attend entirely globally.
64
+
65
+ Taken together, these results suggest that (i) ViT lower layers compute representations in a different way to lower layers in the ResNet, (ii) ViT also more strongly propagates representations between lower and higher layers (iii) the highest layers of ViT have quite different representations to ResNet.
66
+
67
+ # 5 Local and Global Information in Layer Representations
68
+
69
+ In the previous section, we observed much greater similarity between lower and higher layers in ViT, and we also saw that ResNet required more lower layers to compute similar representations to a smaller set of ViT lower layers. In this section, we explore one possible reason for this difference: the difference in the ability to incorporate global information between the two models. How much global information is aggregated by early self-attention layers in ViT? Are there noticeable resulting differences to the features of CNNs, which have fixed, local receptive fields in early layers? In studying these questions, we demonstrate the influence of global representations and a surprising connection between scale and self-attention distances.
70
+
71
+ Analyzing Attention Distances: We start by analyzing ViT self-attention layers, which are the mechanism for ViT to aggregate information from other spatial locations, and structurally very different to the fixed receptive field sizes of CNNs. Each self-attention layer comprises multiple self-attention heads, and for each head we can compute the average distance between the query patch position and the locations it attends to. This reveals how much local vs global information each self-attention layer is aggregating for the representation. Specifically, we weight the pixel distances by the attention weights for each attention head and average over 5000 datapoints, with results shown in Figure 3. In agreement with Dosovitskiy et al. [14], we observe that even in the lowest layers of ViT, self-attention layers have a mix of local heads (small distances) and global heads (large distances). This is in contrast to CNNs, which are hardcoded to attend only locally in the lower layers. At higher layers, all self-attention heads are global.
72
+
73
+ Interestingly, we see a clear effect of scale on attention. In Figure 4, we look at attention distances when training only on ImageNet (no large-scale pre-training), which leads to much lower performance in ViT-L/16 and ViT-H/14 [14]. Comparing to Figure 3, we see that with not enough data, ViT does not learn to attend locally in earlier layers. Together, this suggests that using local information early on for image tasks (which is hardcoded into CNN architectures) is important for strong performance.
74
+
75
+ Does access to global information result in different features? The results of Figure 3 demonstrate that ViTs have access to more global information than CNNs in their lower layers. But does this result in different learned features? As an interventional test, we take subsets of the ViT attention heads from the first encoder block, ranging from the subset corresponding to the most local attention heads to a subset of the representation corresponding to the most global attention heads. We then compute CKA similarity between these subsets and the lower layer representations of ResNet.
76
+
77
+ ![](images/3e35bf39b04f38b85758bdc7dde0ef4f00adc22579434f00626ddb89b2b308a2.jpg)
78
+ Figure 4: With less training data, lower attention layers do not learn to attend locally. Comparing the results to Figure 3, we see that training only on ImageNet leads to the lower layers not learning to attend more locally. These models also perform much worse when only trained on ImageNet, suggesting that incorporating local features (which is hardcoded into CNNs) may be important for strong performance. (See also Figure C.5.)
79
+
80
+ ![](images/b50de76cabe93c93d104733399583c33ea0cff5a1f97fe5aaa2edc900e257f5b.jpg)
81
+ Figure 5: Lower layer representations of ResNet are most similar to representations corresponding to local attention heads of ViT. We take subsets of ViT attention heads in the first encoder block, ranging from the most locally attending heads (smallest mean distance) to the most global heads (largest mean distance). We then compute CKA similarity between these subsets and lower layer representations in the ResNet. We observe that lower ResNet layers are most similar to the features learned by local attention heads of ViT, and decrease monotonically in similarity as more global information is incorporated, demonstrating that the global heads learn quantitatively different features.
82
+
83
+ The results, shown in Figure 5, which plot the mean distance for each subset against CKA similarity, clearly show a monotonic decrease in similarity as mean attention distance grows, demonstrating that access to more global information also leads to quantitatively different features than computed by the local receptive fields in the lower layers of the ResNet.
84
+
85
+ Effective Receptive Fields: We conclude by computing effective receptive fields [23] for both ResNets and ViTs, with results in Figure 6 and Appendix C. We observe that lower layer effective receptive fields for ViT are indeed larger than in ResNets, and while ResNet effective receptive fields grow gradually, ViT receptive fields become much more global midway through the network. ViT receptive fields also show strong dependence on their center patch due to their strong residual connections, studied in the next section. As we show in Appendix C, in attention sublayers, receptive fields taken before the residual connection show far less dependence on this central patch.
86
+
87
+ # 6 Representation Propagation through Skip Connections
88
+
89
+ The results of the previous section demonstrate that ViTs learn different representations to ResNets in lower layers due to access to global information, which explains some of the differences in represen tation structure observed in Section 4. However, the highly uniform nature of ViT representations (Figure 1) also suggests lower representations are faithfully propagated to higher layers. But how does this happen? In this section, we explore the role of skip connections in representation propagation across ViTs and ResNets, discovering ViT skip connections are highly influential, with a clear phase transition from preserving the CLS (class) token representation (in lower layers) to spatial token representations (in higher layers).
90
+
91
+ ![](images/9a061c043fa6a16a6fb6148580ad5f97d001bbc7aadf155ecf3200d8d3560545.jpg)
92
+
93
+ Figure 7: Most information in ViT passes through skip connections. Comparison of representation norms between the skip-connection (identity) and the long branch for ViT-B/16 trained on ImageNet and a ResNet. For ViT, we show the CLS token separately from the rest of the representation. (left) shows the ratios separated for the first few tokens (token 0 is CLS), (right) shows averages over all tokens.
94
+
95
+ Like Transformers, ViTs contain skip (aka identity or shortcut) connections throughout, which are added on after the (i) self-attention layer, and (ii) MLP layer. To study their effect, we plot the norm ratio $\vert \vert z _ { i } \vert \vert / \vert \vert f ( z _ { i } ) \vert \vert$ where $z _ { i }$ is the hidden representation of the ith layer coming from the skip connection, and $f ( z _ { i } )$ is the transformation of $z _ { i }$ from the long branch (i.e. MLP or self-attention.)
96
+
97
+ The results are in Figure 7 (with additional cosine similarity analysis in Figure E.2.) The heatmap on the left shows $\| z _ { i } \| / \| f ( z _ { i } ) \|$ for different token representations. We observe a striking phase transition: in the first half of the network, the CLS token (token 0) representation is primarily propagated by the skip connection branch (high norm ratio), while the spatial token representations have a large contribution coming from the long branch (lower norm ratio). Strikingly, in the second half of the network, this is reversed.
98
+
99
+ The right pane, which has line plots of these norm ratios across ResNet50, the ViT CLS token and the ViT spatial tokens additionally demonstrates that skip connection is much more influential in ViT compared to ResNet: we observe much higher norm ratios for ViT throughout, along with the phase transition from CLS to spatial token propagation (shown for the MLP and self-attention layers.)
100
+
101
+ ViT Representation Structure without Skip Connections: The norm ratio results strongly suggest that skip connections play a key role in the representational structure of ViT. To test this interventionally, we train ViT models with skip connections removed in block $i$ for varying $i$ , and plot the CKA representation heatmap. The results, in Figure 8, illustrate that removing the skip connections in a block partitions the layer representations on either side. (We note a performance drop of $4 \%$ when removing skip connections from middle blocks.) This demonstrates the importance of representations being propagated by skip connections for the uniform similarity structure of ViT in Figure 1.
102
+
103
+ ![](images/9b62311e77302ff7ef59a66afb9f1da37e84703cc6a2b2c790b1d5ecf845180d.jpg)
104
+ Figure 8: ViT models trained without any skip connections in block $_ { i }$ show very little representation similarity between layers before/after block $_ { i }$ . We train several ViT models without any skip connections at block $_ { i }$ for varying $_ { i }$ to interventionally test the effect on representation structure. For middle blocks without skip connections, we observe a performance drop of $4 \%$ . We also observe that removing a skip connection at block $i$ partitions similar representations to before/after block $_ { i }$ — this demonstrates the importance of skip connections in ViT’s standard uniform representation structure.
105
+
106
+ ![](images/662f361e4843c907fbb6de40fb853fe028d23912e05dc0d404aafad244aa59bb.jpg)
107
+ ViT-B/32 final block Token at Location(0, 0) Token at Location(2, 1) Token at Location(4, 2) Token at Location(4, 4)
108
+ Figure 9: Higher layers of ViT maintain spatial location information more faithfully than ResNets. Each heatmap plot shows the CKA similarity between a single token representation in final block of the model and the input images, which are divided into non-overlapping patches. We observe that ViT tokens have strongest similarity to their corresponding spatial location in the image, but tokens corresponding to spatial locations at the edge of the image (e.g. token 0) additionally show similarity to other edge positions. This demonstrates that spatial information from the input is preserved even at the final layer of ViT. By contrast, ResNet “tokens” (features at a specific spatial location) are much less spatially discriminative, showing comparable similarity across a broad set of input spatial locations. See Appendix for additional layers and results.
109
+
110
+ # 7 Spatial Information and Localization
111
+
112
+ The results so far, on the role of self-attention in aggregating spatial information in ViTs, and skipconnections faithfully propagating representations to higher layers, suggest an important followup question: how well can ViTs perform spatial localization? Specifically, is spatial information from the input preserved in the higher layers of ViT? And how does it compare in this aspect to ResNet? An affirmative answer to this is crucial for uses of ViT beyond classification, such as object detection.
113
+
114
+ ![](images/432c77b207c0b6573a8801829a2edb45dffeed4ebea0d9b3aebcd4620aeb6b23.jpg)
115
+ Figure 10: When trained with global average pooling (GAP) instead of a CLS token, ViTs show less clear localization (compare Figure 9). We plot the same CKA heatmap between a token and different input images patches as in Figure 9, but for a ViT model trained with global average pooling (like ResNet) instead of a CLS token. We observe significantly less localization.
116
+
117
+ ![](images/4242cbfab2085256e8701780af666b8dac30524eed706bbb422c4fa5623e85d3.jpg)
118
+ Figure 11: Spatial localization experiments with linear probes. We train linear classifiers on 10-shot ImageNet classification from the representations extracted from different layers of ViT-B/32 models. We then plot the accuracy of the probe versus the (normalized) layer number. Left: We train a classifier on each token separately and report the average accuracy over all tokens (excluding the CLS token for the ViT CLS model.) Right: Comparison of ViT models pre-trained with a classification token or with global average pooling (GAP) and then evaluated with different ways of aggregating the token representations.
119
+
120
+ We begin by comparing token representations in the higher layers of ViT and ResNet to those of input patches. Recall that ViT tokens have a corresponding input patch, and thus a corresponding input spatial location. For ResNet, we define a token representation to be all the convolutional channels at a particular spatial location. This also gives it a corresponding input spatial location. We can then take a token representation and compute its CKA score with input image patches at different locations. The results are illustrated for different tokens (with their spatial locations labelled) in Figure 9.
121
+
122
+ For ViT, we observe that tokens corresponding to locations at the edge of the image are similar to edge image patches, but tokens corresponding to interior locations are well localized, with their representations being most similar to the corresponding image patch. By contrast, for ResNet, we see significantly weaker localization (though Figure D.3 shows improvements for earlier layers.)
123
+
124
+ One factor influencing this clear difference between architectures is that ResNet is trained to classify with a global average pooling step, while ViT has a separate classification (CLS) token. To examine this further, we test a ViT architecture trained with global average pooling (GAP) for localization (see Appendix A for training details). The results, shown in Figure 10, demonstrate that global average pooling does indeed reduce localization in the higher layers. More results in Appendix Section D.
125
+
126
+ Localization and Linear Probe Classification: The previous results have looked at localization through direct comparison of each token with input patches. To complete the picture, we look at using each token separately to perform classification with linear probes. We do this across different layers of the model, training linear probes to classify image label with closed-form few-shot linear regression similar to Dosovitskiy et al. [14] (details in Appendix A). Results are in Figure 11, with further results in Appendix F. The left pane shows average accuracy of classifiers trained on individual tokens, where we see that ResNet50 and ViT with GAP model tokens perform well at higher layers, while in the standard ViT trained with a CLS token the spatial tokens do poorly – likely because their representations remain spatially localized at higher layers, which makes global classification challenging. Supporting this are results on the right pane, which shows that a single token from the
127
+
128
+ ![](images/37a3520a72f917ad75d6afc376cbe417d5caefc64c20aab034592ff4aee318cf.jpg)
129
+ Figure 12: Measuring similarity of representations learned with varying amounts of data shows the importance of large datasets for higher layers and larger model representations. We compute the similarity of representations at each block for ViT models that have been trained on smaller subsets of the data to a model that has been trained on the full data on ViT-L/16 (left) and ViT-B/32 (right). We observe that while lower layer representations have high similarity even with $1 0 \%$ of the data, higher layers and larger models require significantly more data to learn similar representations.
130
+
131
+ ![](images/c97923c1aa3f362a320d1633b6d95d1e61546552b5c9a331942efa2cc1c3dcde.jpg)
132
+ Figure 13: Experiments with linear probes. We train linear classifiers on 10-shot ImageNet classification from the aggregated representations of different layers of different models. We then plot the accuracy of the probe versus the (normalized) layer number. Left: Comparison of ViTs pre-trained on JFT-300M or ImageNet and evaluated with linear probes on Imagenet. Right: Comparison of ViT and ResNet models trained JFT- $3 0 0 \mathrm { m }$ evaluated with linear probes on ImageNet.
133
+
134
+ ViT-GAP model achieves comparable accuracy in the highest layer to all tokens pooled together. With the results of Figure 9, this suggests all higher layer tokens in GAP models learn similar (global) representations.
135
+
136
+ # 8 Effects of Scale on Transfer Learning
137
+
138
+ Motivated by the results of Dosovitskiy et al. [14] that demonstrate the importance of dataset scale for high performing ViTs, and our earlier result (Figure 4) on needing scale for local attention, we perform a study of the effect of dataset scale on representations in transfer learning.
139
+
140
+ We begin by studying the effect on representations as the JFT-300M pretraining dataset size is varied. Figure 12 illustrates the results on ViT-B/32 and ViT-L/16. Even with $3 \%$ of the entire dataset, lower layer representations are very similar to the model trained on the whole dataset, but higher layers require larger amounts of pretraining data to learn the same representations as at large data scale, especially with the large model size. In Section G, we study how much representations change in finetuning, finding heterogeneity over datasets.
141
+
142
+ We next look at dataset size effect on the larger ViT-L/16 and ViT-H/14 models. Specifically, in the left pane of Figure 13, we train linear classifer probes on ImageNet classes for models pretrained on JFT-300M vs models only pretrained on ImageNet. We observe the JFT-300M pretained models achieve much higher accuracies even with middle layer representations, with a $3 0 \%$ gap in absolute accuracy to the models pretrained only on ImageNet. This suggests that for larger models, the larger dataset is especially helpful in learning high quality intermediate representations. This conclusion is further supported by the results of the right pane of Figure 13, which shows linear probes on different ResNet and ViT models, all pretrained on JFT-300M. We again see the larger ViT models learn much stronger intermediate representations than the ResNets. Additional linear probes experiments in Section F demonstrate this same conclusion for transfer to CIFAR-10 and CIFAR-100.
143
+
144
+ # 9 Discussion
145
+
146
+ Limitations: Our study uses CKA [17], which summarizes measurements into a single scalar, to provide quantitative insights on representation similarity. While we have complemented this with interventional tests and other analyses (e.g. linear probes), more fine-grained methods may reveal additional insights and variations in the representations.
147
+
148
+ Conclusion: Given the central role of convolutional neural networks in computer vision breakthroughs, it is remarkable that Transformer architectures (almost identical to those used in language) are capable of similar performance. This raises fundamental questions on whether these architectures work in the same way as CNNs. Drawing on representational similarity techniques, we find surprisingly clear differences in the features and internal structures of ViTs and CNNs. An analysis of self-attention and the strength of skip connections demonstrates the role of earlier global features and strong representation propagation in ViTs for these differences, while also revealing that some CNN properties, e.g. local information aggregation at lower layers, are important to ViTs, being learned from scratch at scale. We examine the potential for ViTs to be used beyond classification through a study of spatial localization, discovering ViTs with CLS tokens show strong preservation of spatial information — promising for future uses in object detection. Finally, we investigate the effect of scale for transfer learning, finding larger ViT models develop significantly stronger intermediate representations through larger pretraining datasets. These results are also very pertinent to understanding MLP-based architectures for vision proposed by concurrent work [42, 43], further discussed in Section H, and together answer central questions on differences between ViTs and CNNs, and suggest new directions for future study. From the perspective of societal impact, these findings and future work may help identify potential failures as well as greater model interpretability.
149
+
150
+ # References
151
+
152
+ [1] G. Alain and Y. Bengio. Understanding intermediate layers using linear classifier probes. arXiv preprint arXiv:1610.01644, 2016.
153
+ [2] I. Bello, B. Zoph, A. Vaswani, J. Shlens, and Q. V. Le. Attention augmented convolutional networks. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 3286–3295, 2019.
154
+ [3] S. Bhojanapalli, A. Chakrabarti, D. Glasner, D. Li, T. Unterthiner, and A. Veit. Understanding robustness of transformers for image classification. arXiv preprint arXiv:2103.14586, 2021.
155
+ [4] N. Carion, F. Massa, G. Synnaeve, N. Usunier, A. Kirillov, and S. Zagoruyko. End-to-end object detection with transformers. In European Conference on Computer Vision, pages 213–229. Springer, 2020.
156
+ [5] M. Caron, H. Touvron, I. Misra, H. Jégou, J. Mairal, P. Bojanowski, and A. Joulin. Emerging properties in self-supervised vision transformers. arXiv preprint arXiv:2104.14294, 2021.
157
+ [6] M. Chen, A. Radford, R. Child, J. Wu, H. Jun, D. Luan, and I. Sutskever. Generative pretraining from pixels. In International Conference on Machine Learning, pages 1691–1703. PMLR, 2020.
158
+ [7] X. Chen, S. Xie, and K. He. An empirical study of training self-supervised vision transformers. arXiv preprint arXiv:2104.02057, 2021.
159
+ [8] A. Conneau, G. Kruszewski, G. Lample, L. Barrault, and M. Baroni. What you can cram into a single vector: Probing sentence embeddings for linguistic properties. In ACL, 2018.
160
+ [9] J.-B. Cordonnier, A. Loukas, and M. Jaggi. On the relationship between self-attention and convolutional layers. arXiv preprint arXiv:1911.03584, 2019.
161
+ [10] C. Cortes, M. Mohri, and A. Rostamizadeh. Algorithms for learning kernels based on centered alignment. The Journal of Machine Learning Research, 13(1):795–828, 2012.
162
+ [11] S. d’Ascoli, H. Touvron, M. Leavitt, A. Morcos, G. Biroli, and L. Sagun. Convit: Improving vision transformers with soft convolutional inductive biases. arXiv preprint arXiv:2103.10697, 2021.
163
+ [12] J. Deng, W. Dong, R. Socher, L.-J. Li, K. Li, and L. Fei-Fei. Imagenet: A large-scale hierarchical image database. In 2009 IEEE conference on computer vision and pattern recognition, pages 248–255. Ieee, 2009.
164
+ [13] J. Devlin, M.-W. Chang, K. Lee, and K. Toutanova. Bert: Pre-training of deep bidirectional transformers for language understanding. arXiv preprint arXiv:1810.04805, 2018.
165
+ [14] A. Dosovitskiy, L. Beyer, A. Kolesnikov, D. Weissenborn, X. Zhai, T. Unterthiner, M. Dehghani, M. Minderer, G. Heigold, S. Gelly, et al. An image is worth 16x16 words: Transformers for image recognition at scale. arXiv preprint arXiv:2010.11929, 2020.
166
+ [15] A. Gretton, K. Fukumizu, C. H. Teo, L. Song, B. Schölkopf, A. J. Smola, et al. A kernel statistical test of independence. In Nips, volume 20, pages 585–592. Citeseer, 2007.
167
+ [16] A. Kolesnikov, L. Beyer, X. Zhai, J. Puigcerver, J. Yung, S. Gelly, and N. Houlsby. Big transfer (bit): General visual representation learning. arXiv preprint arXiv:1912.11370, 6(2):8, 2019.
168
+ [17] S. Kornblith, M. Norouzi, H. Lee, and G. Hinton. Similarity of neural network representations revisited. In ICML, 2019.
169
+ [18] S. Kornblith, H. Lee, T. Chen, and M. Norouzi. What’s in a loss function for image classification? arXiv preprint arXiv:2010.16402, 2020.
170
+ [19] N. Kriegeskorte, M. Mur, and P. A. Bandettini. Representational similarity analysis-connecting the branches of systems neuroscience. Frontiers in systems neuroscience, 2:4, 2008.
171
+ [20] A. Krizhevsky, I. Sutskever, and G. E. Hinton. Imagenet classification with deep convolutional neural networks. Advances in neural information processing systems, 25:1097–1105, 2012.
172
+ [21] S. R. Kudugunta, A. Bapna, I. Caswell, N. Arivazhagan, and O. Firat. Investigating multilingual nmt representations at scale. arXiv preprint arXiv:1909.02197, 2019.
173
+ [22] G. W. Lindsay. Convolutional neural networks as a model of the visual system: past, present, and future. Journal of cognitive neuroscience, pages 1–15, 2020.
174
+ [23] W. Luo, Y. Li, R. Urtasun, and R. Zemel. Understanding the effective receptive field in deep convolutional neural networks. arXiv preprint arXiv:1701.04128, 2017.
175
+ [24] N. Maheswaranathan, A. H. Williams, M. D. Golub, S. Ganguli, and D. Sussillo. Universality and individuality in neural dynamics across large populations of recurrent networks. Advances in neural information processing systems, 2019:15629, 2019.
176
+ [25] A. Merchant, E. Rahimtoroghi, E. Pavlick, and I. Tenney. What happens to bert embeddings during fine-tuning? arXiv preprint arXiv:2004.14448, 2020.
177
+ [26] A. S. Morcos, M. Raghu, and S. Bengio. Insights on representational similarity in neural networks with canonical correlation. arXiv preprint arXiv:1806.05759, 2018.
178
+ [27] B. Mustafa, A. Loh, J. Freyberg, P. MacWilliams, M. Wilson, S. M. McKinney, M. Sieniek, J. Winkens, Y. Liu, P. Bui, et al. Supervised transfer learning at scale for medical imaging. arXiv preprint arXiv:2101.05913, 2021.
179
+ [28] M. Naseer, K. Ranasinghe, S. Khan, M. Hayat, F. S. Khan, and M.-H. Yang. Intriguing properties of vision transformers, 2021.
180
+ [29] T. Nguyen, M. Raghu, and S. Kornblith. Do wide and deep networks learn the same things? uncovering how neural network representations vary with width and depth. arXiv preprint arXiv:2010.15327, 2020.
181
+ [30] N. Parmar, A. Vaswani, J. Uszkoreit, L. Kaiser, N. Shazeer, A. Ku, and D. Tran. Image transformer. In International Conference on Machine Learning, pages 4055–4064. PMLR, 2018.
182
+ [31] S. Paul and P.-Y. Chen. Vision transformers are robust learners. arXiv preprint arXiv:2105.07581, 2021.
183
+ [32] M. E. Peters, M. Neumann, L. Zettlemoyer, and W.-t. Yih. Dissecting contextual word embeddings: Architecture and representation. In EMNLP, 2018.
184
+ [33] A. Raghu, M. Raghu, S. Bengio, and O. Vinyals. Rapid learning or feature reuse? towards understanding the effectiveness of maml. arXiv preprint arXiv:1909.09157, 2019.
185
+ [34] M. Raghu, J. Gilmer, J. Yosinski, and J. Sohl-Dickstein. Svcca: Singular vector canonical correlation analysis for deep learning dynamics and interpretability. arXiv preprint arXiv:1706.05806, 2017.
186
+ [35] M. Raghu, C. Zhang, J. Kleinberg, and S. Bengio. Transfusion: Understanding transfer learning for medical imaging. arXiv preprint arXiv:1902.07208, 2019.
187
+ [36] P. Ramachandran, N. Parmar, A. Vaswani, I. Bello, A. Levskaya, and J. Shlens. Stand-alone self-attention in vision models. arXiv preprint arXiv:1906.05909, 2019.
188
+ [37] O. Russakovsky, J. Deng, H. Su, J. Krause, S. Satheesh, S. Ma, Z. Huang, A. Karpathy, A. Khosla, M. Bernstein, et al. Imagenet large scale visual recognition challenge. International journal of computer vision, 115(3):211–252, 2015.
189
+ [38] J. Shi, E. Shea-Brown, and M. Buice. Comparison against task driven artificial neural networks reveals functional properties in mouse visual cortex. Advances in Neural Information Processing Systems, 32:5764–5774, 2019.
190
+ [39] L. Song, A. Smola, A. Gretton, J. Bedo, and K. Borgwardt. Feature selection via dependence maximization. Journal of Machine Learning Research, 13(5), 2012.
191
+ [40] C. Sun, A. Shrivastava, S. Singh, and A. Gupta. Revisiting unreasonable effectiveness of data in deep learning era. In Proceedings of the IEEE international conference on computer vision, pages 843–852, 2017.
192
+ [41] Y. Tay, M. Dehghani, J. Gupta, D. Bahri, V. Aribandi, Z. Qin, and D. Metzler. Are pre-trained convolutions better than pre-trained transformers? arXiv preprint arXiv:2105.03322, 2021.
193
+ [42] I. Tolstikhin, N. Houlsby, A. Kolesnikov, L. Beyer, X. Zhai, T. Unterthiner, J. Yung, D. Keysers, J. Uszkoreit, M. Lucic, et al. Mlp-mixer: An all-mlp architecture for vision. arXiv preprint arXiv:2105.01601, 2021.
194
+ [43] H. Touvron, P. Bojanowski, M. Caron, M. Cord, A. El-Nouby, E. Grave, A. Joulin, G. Synnaeve, J. Verbeek, and H. Jégou. Resmlp: Feedforward networks for image classification with dataefficient training. arXiv preprint arXiv:2105.03404, 2021.
195
+ [44] A. Vaswani, N. Shazeer, N. Parmar, J. Uszkoreit, L. Jones, A. N. Gomez, L. Kaiser, and I. Polosukhin. Attention is all you need. arXiv preprint arXiv:1706.03762, 2017.
196
+ [45] E. Voita, R. Sennrich, and I. Titov. The bottom-up evolution of representations in the transformer: A study with machine translation and language modeling objectives. In EMNLP, 2019.
197
+ [46] B. Wu, C. Xu, X. Dai, A. Wan, P. Zhang, Z. Yan, M. Tomizuka, J. Gonzalez, K. Keutzer, and P. Vajda. Visual transformers: Token-based image representation and processing for computer vision. arXiv preprint arXiv:2006.03677, 2020.
198
+ [47] J. M. Wu, Y. Belinkov, H. Sajjad, N. Durrani, F. Dalvi, and J. Glass. Similarity analysis of contextual word representation models. arXiv preprint arXiv:2005.01172, 2020.
199
+ [48] S. Wu, A. Conneau, H. Li, L. Zettlemoyer, and V. Stoyanov. Emerging cross-lingual structure in pretrained language models. arXiv preprint arXiv:1911.01464, 2019.
200
+ [49] L. Yuan, Y. Chen, T. Wang, W. Yu, Y. Shi, Z. Jiang, F. E. Tay, J. Feng, and S. Yan. Tokens-to-token vit: Training vision transformers from scratch on imagenet. arXiv preprint arXiv:2101.11986, 2021.
201
+ [50] X. Zhai, J. Puigcerver, A. Kolesnikov, P. Ruyssen, C. Riquelme, M. Lucic, J. Djolonga, A. S. Pinto, M. Neumann, A. Dosovitskiy, et al. The visual task adaptation benchmark. 2019.
202
+
203
+ # Checklist
204
+
205
+ 1. For all authors...
206
+
207
+ (a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
208
+ (b) Did you describe the limitations of your work? [Yes] See Section 9
209
+ (c) Did you discuss any potential negative societal impacts of your work? [N/A]
210
+ (d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
211
+
212
+ 2. If you are including theoretical results...
213
+
214
+ (a) Did you state the full set of assumptions of all theoretical results? [N/A] (b) Did you include complete proofs of all theoretical results? [N/A]
215
+
216
+ 3. If you ran experiments...
217
+
218
+ (a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [No]
219
+ (b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes]
220
+ (c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [No] Where possible, we show variation arising from different sampling aspects, be that dataset samples or model runs. Note that for some of the pretrained models, we only have access to one pretrained checkpoint, and so we show results across multiple model architectures to demonstrate the results hold more broadly.
221
+ (d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [No]
222
+
223
+ 4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
224
+
225
+ (a) If your work uses existing assets, did you cite the creators? [Yes]
226
+ (b) Did you mention the license of the assets? [No]
227
+ (c) Did you include any new assets either in the supplemental material or as a URL? [N/A]
228
+ (d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A]
229
+ (e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A]
230
+
231
+ 5. If you used crowdsourcing or conducted research with human subjects...
232
+
233
+ (a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
234
+ (b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
235
+ (c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
parse/train/R-616EWWKF5/R-616EWWKF5_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/train/S1erHoR5t7/S1erHoR5t7.md ADDED
@@ -0,0 +1,592 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # THE RELATIVISTIC DISCRIMINATOR: A KEY ELEMENT MISSING FROM STANDARD GAN
2
+
3
+ Alexia Jolicoeur-Martineau
4
+ Lady Davis Institute
5
+ MILA, Université de Montréal
6
+ Montreal, Canada
7
+ alexia.jolicoeur-martineau@mail.mcgill.ca
8
+
9
+ # ABSTRACT
10
+
11
+ In standard generative adversarial network (SGAN), the discriminator $D$ estimates the probability that the input data is real. The generator $G$ is trained to increase the probability that fake data is real. We argue that it should also simultaneously decrease the probability that real data is real because 1) this would account for $a$ priori knowledge that half of the data in the mini-batch is fake, 2) this would be observed with divergence minimization, and 3) SGAN would be more similar to integral probability metric (IPM) GANs.
12
+
13
+ We show that this property can be induced by using a “relativistic discriminator” which estimate the probability that the given real data is more realistic than a randomly sampled fake data. We also present a variant in which the discriminator estimate the probability that the given real data is more realistic than fake data, on average. We generalize both approaches to non-standard GAN loss functions and we refer to them respectively as Relativistic GANs (RGANs) and Relativistic average GANs (RaGANs). We show that IPM-based GANs are a subset of RGANs which use the identity function.
14
+
15
+ Empirically, we observe that 1) RGANs and RaGANs are significantly more stable and generate higher quality data samples than their non-relativistic counterparts, 2) Standard RaGAN with gradient penalty generate data of better quality than WGAN-GP while only requiring a single discriminator update per generator update (reducing the time taken for reaching the state-of-the-art by $400 \%$ ), and 3) RaGANs are able to generate plausible high resolutions images (256x256) from a very small sample $\scriptstyle ( \mathrm { N } = 2 0 1 1$ ), while GAN and LSGAN cannot; these images are of significantly better quality than the ones generated by WGAN-GP and SGAN with spectral normalization.
16
+
17
+ The code is freely available on https://github.com/AlexiaJM/RelativisticGAN.
18
+
19
+ # 1 INTRODUCTION
20
+
21
+ Generative adversarial networks (GANs) (Hong et al., 2017) form a broad class of generative models in which a game is played between two competing neural networks, the discriminator $D$ and the generator $G$ . $D$ is trained to discriminate real from fake data, while $G$ is trained to generate fake data that $D$ will mistakenly recognize as real. In the original GAN by Goodfellow et al. (2014), which we refer to as Standard GAN (SGAN), $D$ is a classifier, thus it is predicting the probability that the input data is real. When $D$ is optimal, the loss function of SGAN is approximately equal to the Jensen–Shannon divergence (JSD) (Goodfellow et al., 2014).
22
+
23
+ SGAN has two variants for the generator loss functions: saturating and non-saturating. In practice, the former has been found to be very unstable, while the latter has been found to more stable (Goodfellow et al., 2014). Under certain conditions, Arjovsky & Bottou (2017) proved that, if real and fake data are perfectly classified, the saturating loss has zero gradient and the non-saturating loss has non-zero, but volatile gradient. In practice, this means that the discriminator in SGAN often cannot be trained to optimality or with a too high learning rate; otherwise, gradients may vanish and, if so, training will stop. This problem is generally more noticeable in high-dimensional setting (e.g., high resolution images and discriminator architectures with high expressive power) given that there are enough degrees of freedom available to perfectly classify the training set.
24
+
25
+ To improve on SGAN, many GAN variants have been suggested using different loss functions and discriminators that are not classifiers (e.g., LSGAN (Mao et al., 2017), WGAN (Arjovsky et al., 2017)). Although these approaches have partially succeeded in improving stability and data quality, the large-scale study by Lucic et al. (2017) suggests that these approaches do not consistently improve on SGAN. Additionally, some of the most successful approaches, such as WGAN-GP (Gulrajani et al., 2017), are much more computationally demanding than SGAN.
26
+
27
+ Many of the recent successful GANs variants have been based on Integral probability metrics (IPMs) (Müller, 1997) (e.g., WGAN , WGAN-GP, Fisher GAN (Mroueh & Sercu, 2017), Sobolev GAN (Mroueh et al., 2017)). In IPM-based GANs, the discriminator is real-valued and constrained to a specific class of function which regularize the discriminator. See Mroueh et al. (2017) for a review of the different IPMs.
28
+
29
+ These IPM constraints have been shown to be beneficial even in non-IPM based GANs. Spectral normalization (Miyato et al., 2018) improves the stability of various GANs and it consists in making the discriminator Lipschitz-1, which is the constraint of WGAN. Similarly, the gradient penalty of WGAN-GP also provides improve the stability of SGAN (Fedus et al., 2017). Although this shows that certain IPM constraints improve the stability of GANs, it does not explain why IPM-based GANs generally provide increased stability over other metrics/divergences in GANs (e.g., JSD for SGAN, $f$ -divergences for $f$ -GANs (Nowozin et al., 2016)).
30
+
31
+ Note that although powerful, IPM-based GANs tend to more computationally demanding than other GANs. Certain IPM-based GANs use a gradient penalty (e.g. WGAN-GP, Sobolev GAN) which is very computationally costly and most IPM-based GANs need more than one discriminator update per generator update (WGAN-GP requires at least 5 (Gulrajani et al., 2017)). Assuming equal training time for $D$ and $G$ , every additional discriminator update increase training time by a significant $50 \%$ .
32
+
33
+ In this paper, we argue that non-IPM-based GANs are missing a key ingredient, a relativistic discriminator, which IPM-based GANs already possess. We show that a relativistic discriminator is necessary to make GANs analogous to divergence minimization and produce sensible predictions based on the a priori knowledge that half of the samples in the mini-batch are fake. We provide empirical evidence showing that GANs with a relativistic discriminator are more stable and produce data of higher quality.
34
+
35
+ # 2 BACKGROUND
36
+
37
+ # 2.1 GENERATIVE ADVERSARIAL NETWORKS
38
+
39
+ GANs can be defined very generally in terms of the discriminator in the following way:
40
+
41
+ $$
42
+ { \cal L } _ { D } = \mathbb { E } _ { \boldsymbol { x } _ { r } \sim \mathbb { P } } \left[ \tilde { f } _ { 1 } ( D ( \boldsymbol { x } _ { r } ) ) \right] + \mathbb { E } _ { \boldsymbol { z } \sim \mathbb { P } _ { z } } \left[ \tilde { f } _ { 2 } ( D ( G ( \boldsymbol { z } ) ) ) \right] ,
43
+ $$
44
+
45
+ and
46
+
47
+ $$
48
+ L _ { G } = \mathbb { E } _ { x _ { r } \sim \mathbb { P } } \left[ \tilde { g } _ { 1 } ( D ( x _ { r } ) ) \right] + \mathbb { E } _ { z \sim \mathbb { P } _ { z } } \left[ \tilde { g } _ { 2 } ( D ( G ( z ) ) ) \right] ,
49
+ $$
50
+
51
+ where $\tilde { f } _ { 1 } , \tilde { f } _ { 2 } , \tilde { g } _ { 1 } , \tilde { g } _ { 2 }$ are scalar-to-scalar functions, $\mathbb { P }$ is the distribution of real data, $\mathbb { P } _ { z }$ is generally a multivariate normal distribution centered at 0 with variance 1, $D ( x )$ is the discriminator evaluated at $x$ , $G ( z )$ is the generator evaluated at $\mathbf { Z }$ ( $\mathbb { Q }$ is the distribution of fake data, thus of $G ( z ) _ { , }$ ). Note that, through the paper, we refer to real data as $x _ { r }$ and fake data as $x _ { f }$ . Without loss of generality, we assume that both $L _ { D }$ and $L _ { G }$ are loss functions to be minimized.
52
+
53
+ Most GANs can be separated into two classes: non-saturating and saturating loss functions. GANs with the saturating loss are such that $\tilde { g } _ { 1 } = - \tilde { f } _ { 1 }$ and $\tilde { g } _ { 2 } { = } { - } \tilde { f } _ { 2 }$ , while GANs with the non-saturating loss are such that $\tilde { g } _ { 1 } { = } \tilde { \tilde { f } _ { 2 } }$ and $\tilde { g } _ { 2 } { = } \tilde { f } _ { 1 }$ . Saturating GANs are intuitive as they can be interpreted as alternating between maximizing and minimizing the same loss function. After training $D$ to optimality, the loss function is generally an approximation of a divergence (e.g., Jensen–Shannon divergence (JSD) for SGAN (Goodfellow et al., 2014), $f$ -divergences for F-GANs (Nowozin et al., 2016), and Wassertein distance for WGAN (Arjovsky et al., 2017)). Thus, training $G$ to minimize $L _ { G }$ can be roughly interpreted as minimizing the approximated divergence (although this is not technically true; see
54
+
55
+ Jolicoeur-Martineau (2018)). On the other hand, non-saturating GANs can be thought as optimizing the same loss function, but swapping real data with fake data (and vice-versa). In this article, unless otherwise specified, we assume a non-saturating loss for all GANs.
56
+
57
+ SGAN assumes a cross-entropy loss, i.e., $\tilde { f } _ { 1 } ( D ( x ) ) = - \log ( D ( x ) )$ and $\tilde { f } _ { 2 } ( D ( x ) ) = - \log ( 1 -$ $D ( x ) )$ , where $D ( x ) = { \mathrm { s i g m o i d } } ( C ( x ) )$ , and $C ( x )$ is the non-transformed discriminator output (which we call the critic as per Arjovsky et al. (2017)). In most GANs, $C ( x )$ can be interpreted as how realistic the input data is; a negative number means that the input data looks fake (e.g., in SGAN, $D ( x ) = { \mathrm { s i g m o i d } } ( - 5 ) = 0 )$ , while a positive number means that the input data looks real (e.g., in SGAN, $D ( x ) = { \mathrm { s i g m o i d } } ( 5 ) = 1 \qquad $ ).
58
+
59
+ # 2.2 INTEGRAL PROBABILITY METRICS
60
+
61
+ IPMs are statistical divergences represented mathematically as:
62
+
63
+ $$
64
+ I P M _ { F } ( \mathbb { P } | | \mathbb { Q } ) = \operatorname* { s u p } _ { C \in \mathcal { F } } \mathbb { E } _ { x \sim \mathbb { P } } [ C ( x ) ] - \mathbb { E } _ { x \sim \mathbb { Q } } [ C ( x ) ] ,
65
+ $$
66
+
67
+ where $\mathcal { F }$ is a class of real-valued functions.
68
+
69
+ IPM-based GANs can be defined using equation 1 and 2 where $\tilde { f } _ { 1 } ( D ( x ) ) = \tilde { g } _ { 2 } ( D ( x ) ) = - D ( x )$ and $\tilde { f } _ { 2 } ( D ( x ) ) = \tilde { g } _ { 1 } ( D ( x ) ) = D ( x )$ , where $D ( x ) = C ( x )$ (i.e., no transformation is applied). It can be observed that both discriminator and generator loss functions are unbounded and would diverge to $- \infty$ if optimized directly. However, IPMs assume that the discriminator is of a certain class of function that does not grow too quickly which prevent the loss functions from diverging. Each IPM applies a different constraint to the discriminator (e.g., WGAN assumes a Lipschitz $D$ , WGAN-GP assumes that $D$ has a gradient norm equal to 1 around real and fake data).
70
+
71
+ # 3 MISSING PROPERTY OF SGAN
72
+
73
+ We argue that the key missing property of SGAN is that the probability of real data being real $( D ( x _ { r } ) )$ should decrease as the probability of fake data being real $( D ( x _ { f } ) )$ increase. We provide three arguments suggesting that SGAN should have this property.
74
+
75
+ # 3.1 PRIOR KNOWLEDGE ARGUMENT
76
+
77
+ Assuming a rational human was shown half real data and half fake data. If they perceived all samples shown as equally real $( C ( x _ { f } ) \approx C ( x _ { r } )$ for most $x _ { r }$ and $x _ { f }$ ), they would assume that each sample has probability .50 of being real. However, this is not the case for the discriminator in SGAN. If all samples looked real $( C ( x _ { f } ) \approx C ( x _ { r } ) \ge 3 )$ , $D$ would assume incorrectly that they are indeed all real $( \bar { D ( \boldsymbol { x } ) } \approx 1$ for all $x$ ). Of course, once trained with the labels, $D$ would decrease $D ( x _ { f } )$ and thus would obtain more reasonable estimates. However, if $D ( x _ { r } )$ decreased as $D ( x _ { f } )$ increased, we would have had that $D ( x ) \approx . 5 0$ for all $x$ before even retraining $D$ . A rational human would not require retraining. IPM-based GANs implicitly account for the fact that some of the samples must be fake because they compare how realistic real data is compared to fake data. This is the behavior that we would want.
78
+
79
+ # 3.2 DIVERGENCE MINIMIZATION ARGUMENT
80
+
81
+ In SGAN, when optimized, we have that the discriminator loss function is equal to the Jensen–Shannon divergence (JSD) (Goodfellow et al., 2014). The JSD is minimized $\begin{array} { r l } { ( J S { \bar { D } } ( \mathbb { P } | | \mathbb { Q } ) = } \end{array}$ 0) when $\begin{array} { r } { D ( x _ { r } ) = D ( \bar { x } _ { f } ) = \frac { 1 } { 2 } } \end{array}$ for all $x _ { r } \in \mathbb { P }$ and $x _ { f } \in \mathbb { Q }$ and maximized $( J S D ( \mathbb { P } | | \mathbb { Q } ) = \log ( 2 ) )$ when $D ( x _ { r } ) = 1$ , $D ( x _ { f } ) = 0 \quad$ for all $x _ { r } \in \mathbb { P }$ and $x _ { f } \in \mathbb { Q }$ . Thus, if we were directly minimizing the divergence from maximum to minimum, we would expect $D ( x _ { r } )$ to smoothly decrease from 1 to .50 for most $x _ { r }$ and $D ( x _ { f } )$ to smoothly increase from 0 to .50 for most $x _ { f }$ (Figure 1a). However, when minimizing the saturating loss in SGAN, we are only increasing $D ( x _ { f } )$ , we are not decreasing $D ( x _ { r } )$ (Figure 1b). Furthermore, we are bringing $D ( x _ { f } )$ closer to 1 rather than .50.
82
+
83
+ This means that SGAN dynamics are very different from the minimization of the JSD. To bring SGAN closer to divergence minimization, training the generator should not only increase $D ( x _ { f } )$ but also decrease $D ( x _ { r } )$ (Figure 1c). Note that although specific to the JSD, similar dynamics are true for other divergences; when the divergence is maximal, $D ( x _ { r } )$ and $D ( x _ { f } )$ are very far from one another, but they converge to the same value as the divergence approach zero. Thus, this argument applies to other divergences.
84
+
85
+ ![](images/b84d5b5dac7cbba09e1f162763dc7cf99a89df94239e4e6081eac3fafae929d0.jpg)
86
+ Figure 1: Expected discriminator output of the real and fake data for the a) direct minimization of the Jensen–Shannon divergence, b) actual training of the generator to minimize its loss function, and c) ideal training of the generator to minimize its loss function (lines are dotted when they cross beyond the equilibrium to signify that this may or may not be necessary).
87
+
88
+ # 3.3 GRADIENT ARGUMENT
89
+
90
+ We compare the gradients of standard GAN and IPM-based GANs for further insight. It can be shown that the gradients of the discriminator and generator in non-saturating SGAN are respectively:
91
+
92
+ $$
93
+ \nabla _ { \boldsymbol { w } } L _ { D } ^ { G A N } = - \mathbb { E } _ { \boldsymbol { x } _ { r } \sim \mathbb { P } } \left[ ( 1 - D ( \boldsymbol { x } _ { r } ) ) \nabla _ { \boldsymbol { w } } C ( \boldsymbol { x } _ { r } ) \right] + \mathbb { E } _ { \boldsymbol { x } _ { f } \sim \mathbb { Q } _ { \boldsymbol { \theta } } } \left[ D ( \boldsymbol { x } _ { f } ) \nabla _ { \boldsymbol { w } } C ( \boldsymbol { x } _ { f } ) \right] ,
94
+ $$
95
+
96
+ $$
97
+ \nabla _ { \boldsymbol { \theta } } L _ { G } ^ { G A N } = - \mathbb { E } _ { z \sim \mathbb { P } _ { z } } \left[ ( 1 - D ( G ( z ) ) ) \nabla _ { \boldsymbol { x } } C ( G ( z ) ) J _ { \boldsymbol { \theta } } G ( z ) \right] ,
98
+ $$
99
+
100
+ where $J$ is the Jacobian.
101
+
102
+ It can be shown that the gradients of the discriminator and generator in IPM-based GANs are respectively:
103
+
104
+ $$
105
+ \nabla _ { w } L _ { D } ^ { I P M } = - \mathbb { E } _ { x _ { r } \sim \mathbb { P } } [ \nabla _ { w } C ( x _ { r } ) ] + \mathbb { E } _ { x _ { f } \sim \mathbb { Q } _ { \theta } } [ \nabla _ { w } C ( x _ { f } ) ] ,
106
+ $$
107
+
108
+ $$
109
+ \nabla _ { \boldsymbol { \theta } } L _ { G } ^ { I P M } = - \mathbb { E } _ { z \sim \mathbb { P } _ { z } } [ \nabla _ { \boldsymbol { x } } C ( G ( z ) ) J _ { \boldsymbol { \theta } } G ( z ) ] ,
110
+ $$
111
+
112
+ where $C ( x ) \in \mathcal F$ (the class of functions assigned by the IPM).
113
+
114
+ From these equations, it can be observed that SGAN leads to the same dynamics as IPM-based GANs when we have that:
115
+
116
+ 1. $D ( x _ { r } ) = 0$ , $D ( x _ { f } ) = 1$ in the discriminator step of SGAN
117
+ 2. $D ( x _ { f } ) = 0$ in the generator step of SGAN.
118
+ 3. $C ( x ) \in \mathcal F$
119
+
120
+ Assuming that the discriminator and generator are trained to optimality in each step (which we sometimes do for $D$ , but never for $G$ ) and that it is possible to perfectly distinguish real from the fake data (strong assumption, but generally true early in training); we would have that $D ( x _ { r } ) = 1$ , $D ( x _ { f } ) = 0$ in the generator step and that $D ( x _ { r } ) = 1$ , $D ( x _ { f } ) = 1$ in the discriminator step for most $x _ { r }$ and $x _ { f }$ (Figure 1b). Thus, the only missing assumption would be that $D ( x _ { r } ) = 0$ in the discriminator step.
121
+
122
+ Although the above scenario is not realistic (because we never train $G$ to optimality), if all the assumptions were respected and the generator could indirectly influence $D ( x _ { r } )$ , we would have that $D ( x _ { r } ) = 0$ , $D ( x _ { f } ) = 1$ . Thus, SGAN would have the same gradients as IPM-based GANs. We conjecture that making SGAN more similar to IPM-based GANs could potentially improve its stability (our results will show that it does in fact improves stability).
123
+
124
+ # 4 METHOD
125
+
126
+ # 4.1 RELATIVISTIC STANDARD GAN
127
+
128
+ In standard GAN, the discriminator can be defined, in term of the non-transformed layer $C ( x )$ , as $D ( x ) = { \mathrm { s i g m o i d } } ( C ( x ) )$ . A simple way to make discriminator relativistic (i.e., having the output of $D$ depends on both real and fake data) is to sample from real/fake data pairs $\tilde { \boldsymbol { x } } = \left( \boldsymbol { x } _ { r } , \boldsymbol { x } _ { f } \right)$ and define it as $\bar { D } ( \tilde { x } ) = \mathrm { s i g m o i d } ( C ( x _ { r } ) - C ( x _ { f } ) )$ .
129
+
130
+ We can interpret this modification in the following way: the discriminator estimates the probability that the given real data is more realistic than a randomly sampled fake data. Similarly, we can define $\bar { D _ { r e v } } ( \tilde { x } ) = \mathrm { s i g m o i d } ( C ( x _ { f } ) - C ( x _ { r } ) )$ as the probability that the given fake data is more realistic than a randomly sampled real data. An interesting property of this discriminator is that we do not need to include $D _ { r e v }$ in the loss function through $\log ( 1 - D _ { r e v } ( \tilde { x } ) )$ because we have that $1 - D _ { r e v } ( \tilde { x } ) = 1 - \mathrm { s i g m o i d } ( C ( x _ { f } ) - C ( x _ { r } ) ) = \mathrm { s i g m o i d } ( C ( x _ { r } ) - C ( x _ { f } ) ) = D ( \tilde { x } ) ;$ thus, $\log ( D ( \tilde { x } ) )$ $= \log ( 1 - D _ { r e v } ( \tilde { x } ) )$ .
131
+
132
+ The discriminator and generator (non-saturating) loss functions of the Relativistic Standard GAN (RSGAN) can be written as:
133
+
134
+ $$
135
+ \begin{array} { r l } & { L _ { D } ^ { R S G A N } = - \mathbb { E } _ { ( x _ { r } , x _ { f } ) \sim ( \mathbb { P } , \mathbb { Q } ) } \left[ \log ( \mathrm { s i g m o i d } ( C ( x _ { r } ) - C ( x _ { f } ) ) ) \right] . } \\ & { } \\ & { L _ { G } ^ { R S G A N } = - \mathbb { E } _ { ( x _ { r } , x _ { f } ) \sim ( \mathbb { P } , \mathbb { Q } ) } \left[ \log ( \mathrm { s i g m o i d } ( C ( x _ { f } ) - C ( x _ { r } ) ) ) \right] . } \end{array}
136
+ $$
137
+
138
+ # 4.2 RELATIVISTIC GANS
139
+
140
+ More generally, we consider any discriminator defined as $a ( C ( x _ { r } ) - C ( x _ { f } ) )$ , where $a$ is the activation function, to be relativistic. This means that almost any GAN can have a relativistic discriminator. This forms a new class of models which we call Relativistic GANs (RGANs).
141
+
142
+ Most GANs can be parametrized very generally in terms of the critic:
143
+
144
+ $$
145
+ L _ { D } ^ { G A N } = \mathbb { E } _ { x _ { r } \sim \mathbb { P } } \left[ f _ { 1 } ( C ( x _ { r } ) ) \right] + \mathbb { E } _ { x _ { f } \sim \mathbb { Q } } \left[ f _ { 2 } ( C ( x _ { f } ) ) \right]
146
+ $$
147
+
148
+ and
149
+
150
+ $$
151
+ L _ { G } ^ { G A N } = \mathbb { E } _ { x _ { r } \sim \mathbb { P } } \left[ g _ { 1 } ( C ( x _ { r } ) ) \right] + \mathbb { E } _ { x _ { f } \sim \mathbb { Q } } \left[ g _ { 2 } ( C ( x _ { f } ) ) \right] ,
152
+ $$
153
+
154
+ where $f _ { 1 } , f _ { 2 } , g _ { 1 } , g _ { 2 }$ are scalar-to-scalar functions. If we use a relativistic discriminator, these GANs now have the following form:
155
+
156
+ $$
157
+ L _ { D } ^ { R G A N } = \mathbb { E } _ { ( x _ { r } , x _ { f } ) \sim ( \mathbb { P } , \mathbb { Q } ) } \left[ f _ { 1 } ( C ( x _ { r } ) - C ( x _ { f } ) ) \right] + \mathbb { E } _ { ( x _ { r } , x _ { f } ) \sim ( \mathbb { P } , \mathbb { Q } ) } \left[ f _ { 2 } ( C ( x _ { f } ) - C ( x _ { r } ) ) \right]
158
+ $$
159
+
160
+ and
161
+
162
+ $$
163
+ L _ { G } ^ { R G A N } = \mathbb { E } _ { ( x _ { r } , x _ { f } ) \sim ( \mathbb { P } , \mathbb { Q } ) } \left[ g _ { 1 } ( C ( x _ { r } ) - C ( x _ { f } ) ) \right] + \mathbb { E } _ { ( x _ { r } , x _ { f } ) \sim ( \mathbb { P } , \mathbb { Q } ) } \left[ g _ { 2 } ( C ( x _ { f } ) - C ( x _ { r } ) ) \right] .
164
+ $$
165
+
166
+ If one use the identity function (i.e., $f _ { 1 } ( y ) = g _ { 2 } ( y ) = - y$ , $f _ { 2 } ( y ) = g _ { 1 } ( y ) = y )$ , this results in a degenerate case since there is no supremum/maximum. However, if one adds a constraint so that $C ( x _ { r } ) - C ( x _ { f } )$ is bounded, then there is a supremum and one arrives at IPM-based GANs. Thus, although different, IPM-based GANs share a very similar loss function focused on the difference in critics.
167
+
168
+ Importantly, $g _ { 1 }$ is normally ignored in GANs because its gradient is zero since the generator does not influence it. However, in RGANs, $g _ { 1 }$ is influenced by fake data, thus by the generator.
169
+
170
+ # 4.3 RELATIVISTIC AVERAGE GANS
171
+
172
+ The discriminator has a very different interpretation in SGAN compared to RSGAN. In SGAN, $D ( x )$ estimates the probability that $x$ is real, while in RGANs, $D ( x _ { r } , x _ { f } )$ estimates the probability that $x _ { r }$ is more realistic than $x _ { f }$ . As a middle ground, we developed an alternative to the Relativistic Discriminator, which retains approximately the same interpretation as the discriminator in SGAN while still being relativistic.
173
+
174
+ We propose the Relativistic average Discriminator (RaD) which compares the critic of the input data to the average critic of samples of the opposite type. The discriminator loss function for this approach can be formulated as:
175
+
176
+ $$
177
+ { \cal L } _ { D } ^ { R a S G A N } = - \mathbb { E } _ { x _ { r } \sim \mathbb { P } } \left[ \log \left( \bar { D } ( x _ { r } ) \right) \right] - \mathbb { E } _ { x _ { f } \sim \mathbb { Q } } \left[ \log \left( 1 - \bar { D } ( x _ { f } ) \right) \right] ,
178
+ $$
179
+
180
+ where
181
+
182
+ $$
183
+ \bar { D } ( x ) = \left\{ \begin{array} { l l } { \mathrm { s i g m o i d } ( C ( x ) - \mathbb { E } _ { x _ { f } \sim \mathbb { Q } } C ( x _ { f } ) ) } & { \mathrm { i f ~ } x \mathrm { ~ i s ~ r e a l ~ } } \\ { \mathrm { s i g m o i d } ( C ( x ) - \mathbb { E } _ { x _ { r } \sim \mathbb { P } } C ( x _ { r } ) ) } & { \mathrm { i f ~ } x \mathrm { ~ i s ~ f a k e . } } \end{array} \right.
184
+ $$
185
+
186
+ RaD has a more similar interpretation to the standard discriminator than the relativistic discriminator. With RaD, the discriminator estimates the probability that the given real data is more realistic than fake data, on average.
187
+
188
+ As before, we can generalize this approach to work with any GAN loss function using the following formulation:
189
+
190
+ $$
191
+ { \cal L } _ { D } ^ { R a G A N } = \mathbb { E } _ { x _ { r } \sim \mathbb { P } } [ f _ { 1 } ( C ( x _ { r } ) - \mathbb { E } _ { x _ { f } \sim \mathbb { Q } } C ( x _ { f } ) ) ) ] + \mathbb { E } _ { x _ { f } \sim \mathbb { Q } } [ f _ { 2 } ( C ( x _ { f } ) - \mathbb { E } _ { x _ { r } \sim \mathbb { P } } C ( x _ { r } ) ) ] .
192
+ $$
193
+
194
+ $L _ { G } ^ { R a G A N } = \mathbb { E } _ { x _ { r } \sim \mathbb { P } } [ g _ { 1 } ( C ( x _ { r } ) - \mathbb { E } _ { x _ { f } \sim \mathbb { Q } } C ( x _ { f } ) ) ) ] + \mathbb { E } _ { x _ { f } \sim \mathbb { Q } } [ g _ { 2 } ( C ( x _ { f } ) - \mathbb { E } _ { x _ { r } \sim \mathbb { P } } C ( x _ { r } ) ) ] .$ We call this general approach Relativistic average GAN (RaGAN).
195
+
196
+ # 5 EXPERIMENTS
197
+
198
+ Experiments were conducted on the CIFAR-10 dataset (Krizhevsky, 2009) and the CAT dataset (Zhang et al., 2008). Code was written in Pytorch (Paszke et al., 2017) and models were trained using the Adam optimizer (Kingma & Ba, 2014) for 100K generator iterations with seed 1 (which shows that we did not fish for the best seed, instead, we selected the seed a priori). We report the Fréchet Inception Distance (FID) (Heusel et al., 2017), a measure that is generally better correlated with data quality than the Inception Distance (Salimans et al., 2016) (Borji, 2018); lower FID means that the generated images are of better quality.
199
+
200
+ For the models architectures, we used the standard CNN described by Miyato et al. (2018) on CIFAR10 and a relatively standard DCGAN architecture (Radford et al., 2015) on CAT (see Appendix). We also provide the source code required to replicate all analyses presented in this paper (See our repository: [Anonymous until peer review is finished]).
201
+
202
+ # 5.1 CIFAR-10
203
+
204
+ In these analyses, we compared standard GAN (SGAN), least-squares GAN (LSGAN), Wassertein GAN improved (WGAN-GP), Hinge-loss GAN (HingeGAN) (Miyato et al., 2018), Relativistic SGAN (RSGAN), Relativistic average SGAN (RaSGAN), Relativistic average LSGAN (RaLSGAN), and Relativistic average HingeGAN (RaHingeGAN) using the standard CNN architecture on stable setups (See Appendix for details on the loss functions used). Additionally, we tested RSGAN and RaSGAN with the same gradient-penalty as WGAN-GP (named RSGAN-GP and RaSGAN-GP respectively).
205
+
206
+ We used the following two known stable setups: (DCGAN setup) $l r = . 0 0 0 2$ , $n _ { D } = 1$ , $\beta _ { 1 } = . 5 0$ and $\beta _ { 2 } = . 9 9 9$ (Radford et al., 2015), and (WGAN-GP setup) $l r = . 0 0 0 1$ , $n _ { D } = 5$ , $\beta _ { 1 } = . 5 0$ and $\beta _ { 2 } = . 9$ (Gulrajani et al., 2017), where $l r$ is the learning rate, $n _ { D }$ is the number of discriminator updates per generator update, and $\beta _ { 1 }$ , $\beta _ { 2 }$ are the ADAM momentum parameters. For optimal stability, we used batch norm (Ioffe & Szegedy, 2015) in $G$ and spectral norm (Miyato et al., 2018) in $D$ .
207
+
208
+ Results are presented in Table 1. We observe that RSGAN and RaSGAN generally performed better than SGAN. Similarly, RaHingeGAN performed better than HingeGAN. RaLSGAN performed on par with LSGAN, albeit sightly worse. WGAN-GP performed poorly in the DCGAN setup, but very well in the WGAN-GP setup. RasGAN-GP performed poorly; however, RSGAN-GP performed better than all other loss functions using only one discriminator update per generator update. Importantly, the resulting FID of 25.60 is on par with the lowest FID obtained for this architecture using spectral normalization, as reported by Miyato et al. (2018) (25.5). Overall, these results show that using a relativistic discriminator generally improve data generation quality and that RSGAN works very well in conjunction with gradient penalty to obtain state-of-the-art results.
209
+
210
+ Table 1: Fréchet Inception Distance (FID) at exactly $1 0 0 \mathrm { k }$ generator iterations on the CIFAR-10 dataset using stable setups with different GAN loss functions. We used spectral norm in $D$ and batch norm in $G$ . All models were trained using the same a priori selected seed (seed $^ { = 1 }$ ).
211
+
212
+ <table><tr><td>Loss</td><td>lr = .0002 lr = .0001 β = (.50,.999) β = (.50,.9) nD=1 nD=5</td></tr><tr><td>SGAN 40.64</td><td>41.32</td></tr><tr><td>RSGAN 36.61</td><td>55.29</td></tr><tr><td>RaSGAN</td><td>31.98 37.92</td></tr><tr><td>LSGAN</td><td>29.53 187.01</td></tr><tr><td>RaLSGAN 30.92</td><td>219.39</td></tr><tr><td>HingeGAN</td><td>49.53 80.85</td></tr><tr><td>RaHingeGAN</td><td>39.12 37.72</td></tr><tr><td>WGAN-GP</td><td>83.89 27.81</td></tr><tr><td>RSGAN-GP</td><td>25.60 28.13</td></tr><tr><td>RaSGAN-GP</td><td>331.86</td></tr></table>
213
+
214
+ # 5.2 CAT
215
+
216
+ CAT is a dataset containing around $1 0 \mathrm { k }$ pictures of cats with annotations. We cropped the pictures to the faces of the cats using those annotations. After removing outliers (hidden faces, blurriness, etc.), the CAT dataset contained 9304 images $\geq 6 4 \mathrm { x } 6 4$ , 6645 images $\geq 1 2 8 \mathrm { x } 1 2 8$ , and 2011 images $\geq$ 256x256. The CAT dataset is particularly challenging due to its small sample size and high-resolution images; this makes it perfect for testing the stability of different GAN loss functions.
217
+
218
+ We trained different GAN loss functions on $6 4 \mathrm { x } 6 4$ , $1 2 8 \mathrm { x } 1 2 8$ , $2 5 6 \mathrm { x } 2 5 6$ images. For $2 5 6 \times 2 5 6$ images, we compared RaGANs to known stable approaches: SpectralSGAN (SGAN with spectral normalization in $D$ ) and WGAN-GP. Although some approaches were able to train on $2 5 6 \times 2 5 6$ images, they did so with significant mode collapse. To alleviate this problem, for $2 5 6 \mathrm { x } 2 5 6$ images, we packed the discriminator (Lin et al., 2017) (i.e., $D$ took a concatenated pair of images instead of a single image). We looked at the minimum, maximum, mean and standard deviation (SD) of the FID at 20k, 30k, ..., 100k generator iterations; results are presented in Table 2.
219
+
220
+ Overall, we observe lower minimum FID, maximum FID, mean and standard deviation (sd) for RGANs and RaGANs than their non-relativistic counterparts (SGAN, LSGAN, RaLSGAN).
221
+
222
+ In 64x64 resolution, both SGAN and LSGAN generated images with low FID, but they did so in a very unstable matter. For example, SGAN went from a FID of 17.50 at 30k iterations, to 310.56 at 40k iterations, and back to 27.72 at $5 0 \mathrm { k }$ iterations. Similarly, LSGAN went from a FID of 20.27 at $2 0 \mathrm { k }$ iterations, to 224.97 at 30k iterations, and back to 51.98 at 40k iterations. On the other hand, RaGANs were much more stable (lower max and SD) while also resulting in lower minimum FID. Using gradient-penalty did not improve data quality; however, it reduced the SD lower than without gradient penalty, thus increasing stability further.
223
+
224
+ SGAN was unable to converge on $1 2 8 \mathrm { x } 1 2 8$ or bigger images and LSGAN was unable to converge on $2 5 6 \times 2 5 6$ images. Meanwhile, RaGANs were able to generate plausible images with low FID in all resolutions. Although SpectralSGAN and WGAN-GP were able to generate 256x256 images of cats, the samples they generated were of poor quality (high FID). Thus, in this very difficult setting, relativism provided a greater improvement in quality than gradient penalty or spectral normalization.
225
+
226
+ # 6 CONCLUSION AND FUTURE WORK
227
+
228
+ In this paper, we proposed the relativistic discriminator as a way to fix and improve on standard GAN. We further generalized this approach to any GAN loss and introduced a generally more stable variant called RaD. Our results suggest that relativism significantly improve data quality and stability of
229
+
230
+ Table 2: Minimum (min), maximum (max), mean, and standard deviation (SD) of the Fréchet Inception Distance (FID) calculated at 20k, 30k . . . , 100k generator iterations on the CAT dataset with different GAN loss functions. The hyper-parameters used were $l r = . 0 0 0 2$ , $\beta = ( . 5 0 , . 9 9 9 )$ , $n _ { D } = 1$ , and batch norm (BN) in $D$ and $G$ . All models were trained using the same a priori selected seed (seed $^ { = 1 }$ ). Note: A missing number imply that the model did not converge and became stuck in the first few iterations.
231
+
232
+ <table><tr><td>Loss</td><td>Min</td><td>Max</td><td>Mean</td><td>SD</td></tr><tr><td colspan="5">64x64 images (N=9304)</td></tr><tr><td>SGAN</td><td>16.56</td><td>310.56</td><td>52.54</td><td>96.81</td></tr><tr><td>RSGAN</td><td>19.03</td><td>42.05</td><td>32.16</td><td>7.01</td></tr><tr><td>RaSGAN</td><td>15.38</td><td>33.11</td><td>20.53</td><td>5.68</td></tr><tr><td>LSGAN RaLSGAN</td><td>20.27 11.97</td><td>224.97 19.29</td><td>73.62 15.61</td><td>61.02 2.55</td></tr><tr><td>HingeGAN</td><td>17.60</td><td>50.94</td><td>32.23</td><td>14.44 3.96</td></tr><tr><td>RaHingeGAN RSGAN-GP</td><td>14.62</td><td>27.31</td><td>20.29</td><td>1.82</td></tr><tr><td>RaSGAN-GP</td><td>16.41 17.32</td><td>22.34 22</td><td>18.20 19.58</td><td>1.81</td></tr><tr><td>SGAN</td><td>128x128 images (N=6645) -</td><td>=</td><td></td><td></td></tr><tr><td>RaSGAN</td><td>21.05</td><td>39.65</td><td>28.53</td><td>6.52</td></tr><tr><td>LSGAN RaLSGAN</td><td>19.03 15.85</td><td>51.36 40.26</td><td>30.28 22.36</td><td>10.16 7.53</td></tr><tr><td>SGAN1</td><td>256x256 images (N=2011)</td><td></td><td></td><td></td></tr><tr><td>RaSGAN</td><td>= 32.11</td><td>= 102.76</td><td>= 56.64</td><td>21.03</td></tr><tr><td>SpectralSGAN</td><td>54.08 =</td><td>90.43</td><td>64.92</td><td>12.00</td></tr><tr><td>LSGAN1</td><td></td><td>1</td><td>1</td><td>=</td></tr><tr><td>RaLSGAN WGAN-GP</td><td>35.21 155.46</td><td>299.52 437.48</td><td>70.44 341.91</td><td>86.01 101.11</td></tr></table>
233
+
234
+ GANs at no computational cost. Furthermore, using a relativistic discriminator with other tools of the trade (spectral norm, gradient penalty, etc.) may lead to better state-of-the-art.
235
+
236
+ Future research is needed to fully understand the mathematical implications of adding relativism to GANs. Furthermore, our experiments were limited to certain loss functions using only one seed, due to computational constraints. More experiments are required to determine which relativistic GAN loss function is best over a wide-range of datasets and hyper-parameters. We greatly encourage researchers and machine learning enthusiasts with greater computing power to experiment further with our approach.
237
+
238
+ # REFERENCES
239
+
240
+ Martin Arjovsky and Léon Bottou. Towards principled methods for training generative adversarial networks. arXiv preprint arXiv:1701.04862, 2017.
241
+
242
+ Martin Arjovsky, Soumith Chintala, and Léon Bottou. Wasserstein generative adversarial networks. In International Conference on Machine Learning, pp. 214–223, 2017.
243
+
244
+ Ali Borji. Pros and cons of gan evaluation measures. arXiv preprint arXiv:1802.03446, 2018.
245
+
246
+ William Fedus, Mihaela Rosca, Balaji Lakshminarayanan, Andrew M Dai, Shakir Mohamed, and Ian Goodfellow. Many paths to equilibrium: Gans do not need to decrease adivergence at every step. arXiv preprint arXiv:1710.08446, 2017.
247
+
248
+ Ian Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. Generative adversarial nets. In Z. Ghahramani, M. Welling, C. Cortes, N. D. Lawrence, and K. Q. Weinberger (eds.), Advances in Neural Information Processing Systems 27, pp. 2672–2680. Curran Associates, Inc., 2014. URL http://papers.nips.cc/paper/5423-generative-adversarial-nets.pdf.
249
+
250
+ Ishaan Gulrajani, Faruk Ahmed, Martin Arjovsky, Vincent Dumoulin, and Aaron C Courville. Improved training of wasserstein gans. In I. Guyon, U. V. Luxburg, S. Bengio, H. Wallach, R. Fergus, S. Vishwanathan, and R. Garnett (eds.), Advances in Neural Information Processing Systems 30, pp. 5767–5777. Curran Associates, Inc., 2017. URL http://papers.nips.cc/ paper/7159-improved-training-of-wasserstein-gans.pdf.
251
+
252
+ Martin Heusel, Hubert Ramsauer, Thomas Unterthiner, Bernhard Nessler, Günter Klambauer, and Sepp Hochreiter. Gans trained by a two time-scale update rule converge to a nash equilibrium. arXiv preprint arXiv:1706.08500, 2017.
253
+
254
+ Yongjun Hong, Uiwon Hwang, Jaeyoon Yoo, and Sungroh Yoon. How generative adversarial nets and its variants work: An overview of gan. arXiv preprint arXiv:1711.05914, 2017.
255
+
256
+ Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. arXiv preprint arXiv:1502.03167, 2015.
257
+
258
+ Alexia Jolicoeur-Martineau. Gans beyond divergence minimization. arXiv preprint arXiv:1809.02145, 2018.
259
+
260
+ Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
261
+
262
+ Alex Krizhevsky. Learning multiple layers of features from tiny images. 2009.
263
+
264
+ Zinan Lin, Ashish Khetan, Giulia Fanti, and Sewoong Oh. Pacgan: The power of two samples in generative adversarial networks. arXiv preprint arXiv:1712.04086, 2017.
265
+
266
+ Mario Lucic, Karol Kurach, Marcin Michalski, Sylvain Gelly, and Olivier Bousquet. Are gans created equal? a large-scale study. arXiv preprint arXiv:1711.10337, 2017.
267
+
268
+ Xudong Mao, Qing Li, Haoran Xie, Raymond YK Lau, Zhen Wang, and Stephen Paul Smolley. Least squares generative adversarial networks. In 2017 IEEE International Conference on Computer Vision (ICCV), pp. 2813–2821. IEEE, 2017.
269
+
270
+ Takeru Miyato, Toshiki Kataoka, Masanori Koyama, and Yuichi Yoshida. Spectral normalization for generative adversarial networks. arXiv preprint arXiv:1802.05957, 2018.
271
+
272
+ Youssef Mroueh and Tom Sercu. Fisher gan. In I. Guyon, U. V. Luxburg, S. Bengio, H. Wallach, R. Fergus, S. Vishwanathan, and R. Garnett (eds.), Advances in Neural Information Processing Systems 30, pp. 2513–2523. Curran Associates, Inc., 2017. URL http://papers.nips.cc/ paper/6845-fisher-gan.pdf.
273
+
274
+ Youssef Mroueh, Chun-Liang Li, Tom Sercu, Anant Raj, and Yu Cheng. Sobolev gan. arXiv preprint arXiv:1711.04894, 2017.
275
+
276
+ Alfred Müller. Integral probability metrics and their generating classes of functions. Advances in Applied Probability, 29(2):429–443, 1997.
277
+
278
+ Sebastian Nowozin, Botond Cseke, and Ryota Tomioka. f-gan: Training generative neural samplers using variational divergence minimization. In D. D. Lee, M. Sugiyama, U. V. Luxburg, I. Guyon, and R. Garnett (eds.), Advances in Neural Information Processing Systems 29, pp. 271–279. Curran Associates, Inc., 2016. URL http://papers.nips.cc/paper/6066-f-gan-training-generativeneural-samplers-using-variational-divergence-minimization.pdf.
279
+
280
+ Adam Paszke, Sam Gross, Soumith Chintala, Gregory Chanan, Edward Yang, Zachary DeVito, Zeming Lin, Alban Desmaison, Luca Antiga, and Adam Lerer. Automatic differentiation in pytorch. 2017.
281
+
282
+ Alec Radford, Luke Metz, and Soumith Chintala. Unsupervised representation learning with deep convolutional generative adversarial networks. arXiv preprint arXiv:1511.06434, 2015.
283
+
284
+ Tim Salimans, Ian Goodfellow, Wojciech Zaremba, Vicki Cheung, Alec Radford, Xi Chen, and Xi Chen. Improved techniques for training gans. In D. D. Lee, M. Sugiyama, U. V. Luxburg, I. Guyon, and R. Garnett (eds.), Advances in Neural Information Processing Systems 29, pp. 2234–2242. Curran Associates, Inc., 2016. URL http://papers.nips.cc/paper/6125- improved-techniques-for-training-gans.pdf.
285
+
286
+ Weiwei Zhang, Jian Sun, and Xiaoou Tang. Cat head detection-how to effectively exploit shape and texture features. In European Conference on Computer Vision, pp. 802–816. Springer, 2008.
287
+
288
+ # APPENDICES
289
+
290
+ A INTUITIVE AND MEMEFUL VISUAL REPRESENTATION OF RAGANS
291
+
292
+ Table 3: An illustrative example of the discriminator’s output in standard GAN as traditionally defined $( P ( x _ { r } { \mathrm { ~ i s ~ r e a l } } ) = { \mathrm { ~ s i g m o i d } } ( C ( x _ { r } ) ) )$ versus the Relativistic average Discriminator (RaD) $( P ( x _ { r } \mathrm { i s } \mathrm { r e a l } | \overline { { C ( x _ { f } ) } } ) = \mathrm { s i g m o i d } ( C ( x _ { r } ) - \overline { { C ( x _ { f } ) } } ) )$ . Breads represent real images, while dogs
293
+
294
+ <table><tr><td colspan="2">resentfakeimages.</td><td colspan="2">Relative probability (Relativistic average Standard GAN)</td></tr><tr><td>Scenario</td><td>Absolute probability (Standard GAN)</td><td colspan="2"></td></tr><tr><td rowspan="2">Real image looks real and fake images look fake</td><td></td><td></td><td></td></tr><tr><td>C(xr)=8 P(xr is bread) = 1</td><td>C(xf)=-5 P(xr is bread|C(xf)) = 1</td><td></td></tr><tr><td rowspan="2">Real image looks real but fake images look similarly real on average</td><td></td><td></td><td></td></tr><tr><td>C(xr)=8 P(xr is bread) = 1</td><td>C(xf)=7</td><td>P(xr is bread|C(xf)) = .73</td></tr><tr><td rowspan="2">Real image looks fake but fake images look more fake on average P(xr is bread) = .05</td><td>福</td><td></td><td></td></tr><tr><td>C(xr)= -3</td><td>C(xf)</td><td>=-5 P(xr is bread|C(xf)) = .88</td></tr></table>
295
+
296
+ # B INTUITION BEHIND RAGANS
297
+
298
+ Although the relative discriminator provide the missing property that we want in GANs (i.e., $G$ influencing $D ( x _ { r } ) )$ , its interpretation is different from the standard discriminator. Rather than measuring “the probability that the input data is real”, it is now measuring “the probability that the input data is more realistic than a randomly sampled data of the opposing type (fake if the input is real or real if the input is fake)”. To make the relativistic discriminator act more globally, as in its original definition, our initial idea was the following: average the relativistic discriminator over random samples of data of the opposing type. This can be conceptualized in the following way:
299
+
300
+ $$
301
+ \begin{array} { r l } & { P ( x _ { r } \mathrm { ~ i s ~ r e a l } ) : = \mathbb { E } _ { x _ { f } \sim \mathbb { Q } } [ P ( x _ { r } \mathrm { ~ i s ~ m o r e ~ r e a l ~ t h a n ~ } x _ { f } ) ] } \\ & { \quad \quad \quad = \mathbb { E } _ { x _ { f } \sim \mathbb { Q } } [ \mathrm { s i g m o i d } ( C ( x _ { r } ) - C ( x _ { f } ) ) ] } \\ & { \quad \quad \quad = \mathbb { E } _ { x _ { f } \sim \mathbb { Q } } [ D ( x _ { r } , x _ { f } ) ] , } \end{array}
302
+ $$
303
+
304
+ $$
305
+ \begin{array} { r l } & { P ( x _ { f } \mathrm { ~ i s ~ r e a l } ) : = \mathbb { E } _ { x _ { r } \sim \mathbb { P } } [ P ( x _ { f } \mathrm { ~ i s ~ m o r e ~ r e a l ~ t h a n ~ } x _ { r } ) ] } \\ & { \phantom { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } = \mathbb { E } _ { x _ { r } \sim \mathbb { P } } [ \mathrm { s i g m o i d } ( C ( x _ { f } ) - C ( x _ { r } ) ) ] } \\ & { \phantom { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } = \mathbb { E } _ { x _ { r } \sim \mathbb { P } } [ D ( x _ { f } , x _ { r } ) ] , } \end{array}
306
+ $$
307
+
308
+ where $D ( x _ { r } , x _ { f } ) = \mathrm { s i g m o i d } ( C ( x _ { r } ) - C ( x _ { f } ) )$ .
309
+
310
+ Then, the following loss function for $D$ could be applied:
311
+
312
+ $$
313
+ L _ { D } = - \mathbb { E } _ { x _ { r } \sim \mathbb { P } } [ \log ( \mathbb { E } _ { x _ { f } \sim \mathbb { Q } } [ D ( x _ { r } , x _ { f } ) ] ) ) ] - \mathbb { E } _ { x _ { f } \sim \mathbb { Q } } [ \log ( 1 - \mathbb { E } _ { x _ { r } \sim \mathbb { P } } [ D ( x _ { f } , x _ { r } ) ] ) ] .
314
+ $$
315
+
316
+ The main problem with this idea is that it would require looking at all possible combinations of real and fake data in the mini-batch. This would transform the problem from $\mathcal { O } ( m )$ to $\mathcal { O } ( m ^ { 2 } )$ complexity, where $m$ is the batch size. This is problematic; therefore, we do not use this approach.
317
+
318
+ Instead, we propose to use the Relativistic average Discriminator (RaD) which compares the critic of the input data to the average critic of samples of the opposite type (See section 4.3). This approach has $\mathcal { O } ( m )$ complexity.
319
+
320
+ # C GRADIENTS
321
+
322
+ # C.1 SGAN
323
+
324
+ $$
325
+ \begin{array} { r l } & { \nabla _ { w } L _ { D } ^ { G A N } = - \nabla _ { w } \mathbb { E } _ { x _ { r } \sim \mathbb { P } } [ \log D ( x _ { r } ) ] - \nabla _ { w } \mathbb { E } _ { x _ { f } \sim \mathbb { Q } _ { \theta } } [ \log ( 1 - D ( x _ { f } ) ) ] } \\ & { \hphantom { \frac { \prod } { \prod } } = - \nabla _ { w } \mathbb { E } _ { x _ { r } \sim \mathbb { P } } [ \log ( \frac { e ^ { C ( x _ { r } ) } } { e ^ { C ( x _ { r } ) } + 1 } ) ] - \nabla _ { w } \mathbb { E } _ { x _ { f } \sim \mathbb { Q } _ { \theta } } [ \log ( 1 - \frac { e ^ { C ( x _ { f } ) } } { e ^ { C ( x _ { f } ) } + 1 } ) ] } \\ & { \hphantom { \frac { \prod } { \prod } } = - \nabla _ { w } \mathbb { E } _ { x _ { r } \sim \mathbb { P } } [ C ( x _ { r } ) - \log ( e ^ { C ( x _ { r } ) } + 1 ) ] - \nabla _ { w } \mathbb { E } _ { x _ { f } \sim \mathbb { Q } _ { \theta } } [ \log ( 1 ) - \log ( e ^ { C ( x _ { f } ) } + 1 ) ] } \\ & { \hphantom { \frac { \prod } { \prod } } = - \mathbb { E } _ { x _ { r } \sim \mathbb { P } } [ \nabla _ { w } C ( x _ { r } ) ] + \mathbb { E } _ { x _ { r } \sim \mathbb { P } } [ \frac { e ^ { C ( x _ { r } ) } } { e ^ { C ( x _ { r } ) } + 1 } \nabla _ { w } C ( x _ { r } ) ] + \mathbb { E } _ { x _ { f } \sim \mathbb { Q } _ { \theta } } [ \frac { e ^ { C ( x _ { f } ) } } { e ^ { C ( x _ { f } ) } + 1 } \nabla _ { w } C ( x _ { f } ) ] } \\ & \hphantom { \frac { \prod } { \prod } } = - \mathbb { E } _ { x _ { r } \sim \mathbb { P } } [ \nabla _ { w } C ( x _ { r } ) ] + \mathbb { E } _ { x _ { r } \sim \mathbb { P } } [ D ( x _ { r } ) \nabla _ { w } C ( x _ { r } ) ] + \mathbb { E } _ { x _ { f } \sim \mathbb { Q } _ { \theta } } [ D ( x _ { f } ) \nabla _ { w } C ( x _ f \end{array}
326
+ $$
327
+
328
+ $$
329
+ \begin{array} { r l } { \nabla _ { \theta } L _ { G } ^ { G A N } = - \nabla _ { \theta } \mathbb { E } _ { z \sim \mathbb { P } _ { z } } \left[ \log D ( G ( z ) ) \right] } & { } \\ { = - \nabla _ { \theta } \mathbb { E } _ { z \sim \mathbb { P } _ { z } } \left[ \log \left( \frac { e ^ { C ( G ( z ) ) } } { e ^ { C ( G ( z ) ) } + 1 } \right) \right] } & { } \\ { = - \nabla _ { \theta } \mathbb { E } _ { z \sim \mathbb { P } _ { z } } \left[ C ( G ( z ) ) - \log \left( e ^ { C ( G ( z ) ) } + 1 \right) \right] } & { } \\ { = - \mathbb { E } _ { z \sim \mathbb { P } _ { z } } \left[ \nabla _ { x } C ( G ( z ) ) J _ { \theta } G ( z ) - \left( \frac { e ^ { C ( G ( z ) ) } } { e ^ { C ( G ( z ) ) } + 1 } \right) \nabla _ { x } C ( G ( z ) ) J _ { \theta } G ( z ) \right] } & { } \\ { = - \mathbb { E } _ { z \sim \mathbb { P } _ { z } } \left[ ( 1 - D ( G ( z ) ) ) \nabla _ { x } C ( G ( z ) ) J _ { \theta } G ( z ) \right] } & { } \end{array}
330
+ $$
331
+
332
+ # C.2 IPM-BASED GANS
333
+
334
+ $$
335
+ \begin{array} { r } { \nabla _ { \boldsymbol { w } } L _ { D } ^ { I P M } = - \nabla _ { \boldsymbol { w } } \mathbb { E } _ { \boldsymbol { x } _ { r } \sim \mathbb { P } } [ C ( \boldsymbol { x } _ { r } ) ] + \nabla _ { \boldsymbol { w } } \mathbb { E } _ { \boldsymbol { x } _ { f } \sim \mathbb { Q } _ { \boldsymbol { \theta } } } [ C ( \boldsymbol { x } _ { f } ) ] } \\ { = - \mathbb { E } _ { \boldsymbol { x } _ { r } \sim \mathbb { P } } [ \nabla _ { \boldsymbol { w } } C ( \boldsymbol { x } _ { r } ) ] + \mathbb { E } _ { \boldsymbol { x } _ { f } \sim \mathbb { Q } _ { \boldsymbol { \theta } } } [ \nabla _ { \boldsymbol { w } } C ( \boldsymbol { x } _ { f } ) ] } \end{array}
336
+ $$
337
+
338
+ $$
339
+ \begin{array} { r l } & { \nabla _ { \theta } L _ { G } ^ { I P M } = - \nabla _ { \theta } \mathbb { E } _ { z \sim \mathbb { P } _ { z } } [ C ( G ( z ) ) ] } \\ & { \qquad = - \mathbb { E } _ { z \sim \mathbb { P } _ { z } } [ \nabla _ { x } C ( G ( z ) ) J _ { \theta } G ( z ) ] } \end{array}
340
+ $$
341
+
342
+ # D SIMPLIFIED FORM OF RELATIVISTIC SATURATING AND NON-SATURATING GANS
343
+
344
+ The formulation of RGANs can be simplified when we have the following two properties: (1) $f _ { 2 } ( - y ) = f _ { 1 } ( y )$ and (2) the generator assumes a non-saturating loss $( g _ { 1 } ( y ) \overset { \cdot } { = } f _ { 2 } ( \overset { \cdot } { y } )$ and $g _ { 2 } ( y ) =$ $f _ { 1 } ( y ) )$ . These two properties are observed in standard GAN, LSGAN using symmetric labels (e.g., $^ { - 1 }$ and 1), IPM-based GANs, etc. With these two properties, RGANs with non-saturating loss can be formulated simply as:
345
+
346
+ $$
347
+ L _ { D } ^ { R G A N * } = \mathbb { E } _ { ( x _ { r } , x _ { f } ) \sim ( \mathbb { P } , \mathbb { Q } ) } \left[ f _ { 1 } ( C ( x _ { r } ) - C ( x _ { f } ) ) \right]
348
+ $$
349
+
350
+ and
351
+
352
+ $$
353
+ L _ { G } ^ { R G A N * } = \mathbb { E } _ { ( x _ { r } , x _ { f } ) \sim ( \mathbb { P } , \mathbb { Q } ) } \left[ f _ { 1 } ( C ( x _ { f } ) - C ( x _ { r } ) ) \right] .
354
+ $$
355
+
356
+ Assuming $f _ { 2 } ( - y ) = f _ { 1 } ( y )$ , we have that
357
+
358
+ $$
359
+ \begin{array} { r l } & { L _ { D } ^ { R G A N } = \mathbb { E } _ { ( x _ { r } , x _ { f } ) \sim ( \mathbb { P } , \mathbb { Q } ) } \left[ f _ { 1 } ( C ( x _ { r } ) - C ( x _ { f } ) ) \right] + \mathbb { E } _ { ( x _ { r } , x _ { f } ) \sim ( \mathbb { P } , \mathbb { Q } ) } \left[ f _ { 2 } ( C ( x _ { f } ) - C ( x _ { r } ) ) \right] } \\ & { \qquad = \mathbb { E } _ { ( x _ { r } , x _ { f } ) \sim ( \mathbb { P } , \mathbb { Q } ) } \left[ f _ { 1 } ( C ( x _ { r } ) - C ( x _ { f } ) ) \right] + \mathbb { E } _ { ( x _ { r } , x _ { f } ) \sim ( \mathbb { P } , \mathbb { Q } ) } \left[ f _ { 1 } ( C ( x _ { r } ) - C ( x _ { f } ) ) \right] } \\ & { \qquad = 2 \mathbb { E } _ { ( x _ { r } , x _ { f } ) \sim ( \mathbb { P } , \mathbb { Q } ) } \left[ f _ { 1 } ( C ( x _ { r } ) - C ( x _ { f } ) ) \right] . } \end{array}
360
+ $$
361
+
362
+ If $g _ { 1 } ( y ) = - f _ { 1 } ( y )$ and $g _ { 2 } ( y ) = - f _ { 2 } ( y )$ (saturating GAN), we have that
363
+
364
+ $$
365
+ \begin{array} { r l } & { L _ { G } ^ { R G A N - S } = \mathbb { E } _ { ( x _ { r } , x _ { f } ) \sim ( \mathbb { P } , \mathbb { Q } ) } \left[ g _ { 1 } ( C ( x _ { r } ) - C ( x _ { f } ) ) \right] + \mathbb { E } _ { ( x _ { r } , x _ { f } ) \sim ( \mathbb { P } , \mathbb { Q } ) } \left[ g _ { 2 } ( C ( x _ { f } ) - C ( x _ { r } ) ) \right] } \\ & { \quad \quad \quad \quad \quad = - \mathbb { E } _ { ( x _ { r } , x _ { f } ) \sim ( \mathbb { P } , \mathbb { Q } ) } \left[ f _ { 1 } ( C ( x _ { r } ) - C ( x _ { f } ) ) \right] - \mathbb { E } _ { ( x _ { r } , x _ { f } ) \sim ( \mathbb { P } , \mathbb { Q } ) } \left[ f _ { 2 } ( C ( x _ { f } ) - C ( x _ { r } ) ) \right] } \\ & { \quad \quad \quad = - \mathbb { E } _ { ( x _ { r } , x _ { f } ) \sim ( \mathbb { P } , \mathbb { Q } ) } \left[ f _ { 1 } ( C ( x _ { r } ) - C ( x _ { f } ) ) \right] - \mathbb { E } _ { ( x _ { r } , x _ { f } ) \sim ( \mathbb { P } , \mathbb { Q } ) } \left[ f _ { 1 } ( C ( x _ { r } ) - C ( x _ { f } ) ) \right] } \\ & { \quad \quad \quad = - 2 \mathbb { E } _ { ( x _ { r } , x _ { f } ) \sim ( \mathbb { P } , \mathbb { Q } ) } \left[ f _ { 1 } ( C ( x _ { r } ) - C ( x _ { f } ) ) \right] . } \end{array}
366
+ $$
367
+
368
+ If $g _ { 1 } ( y ) = f _ { 2 } ( y )$ and $g _ { 2 } ( y ) = f _ { 1 } ( y )$ (non-saturating GAN), we have that
369
+
370
+ $$
371
+ \begin{array} { r l } & { L _ { G } ^ { R G A N - N S } = \mathbb { E } _ { ( x _ { r } , x _ { f } ) \sim ( \mathbb { P } , \mathbb { Q } ) } \left[ g _ { 1 } ( C ( x _ { r } ) - C ( x _ { f } ) ) \right] + \mathbb { E } _ { ( x _ { r } , x _ { f } ) \sim ( \mathbb { P } , \mathbb { Q } ) } \left[ g _ { 2 } ( C ( x _ { f } ) - C ( x _ { r } ) ) \right] } \\ & { \quad \quad \quad \quad = \mathbb { E } _ { ( x _ { r } , x _ { f } ) \sim ( \mathbb { P } , \mathbb { Q } ) } \left[ f _ { 2 } ( C ( x _ { r } ) - C ( x _ { f } ) ) \right] + \mathbb { E } _ { ( x _ { r } , x _ { f } ) \sim ( \mathbb { P } , \mathbb { Q } ) } \left[ f _ { 1 } ( C ( x _ { f } ) - C ( x _ { r } ) ) \right] } \\ & { \quad \quad \quad = \mathbb { E } _ { ( x _ { r } , x _ { f } ) \sim ( \mathbb { P } , \mathbb { Q } ) } \left[ f _ { 1 } ( C ( x _ { f } ) - C ( x _ { r } ) ) \right] + \mathbb { E } _ { ( x _ { r } , x _ { f } ) \sim ( \mathbb { P } , \mathbb { Q } ) } \left[ f _ { 1 } ( C ( x _ { f } ) - C ( x _ { r } ) ) \right] } \\ & { \quad \quad \quad = 2 \mathbb { E } _ { ( x _ { r } , x _ { f } ) \sim ( \mathbb { P } , \mathbb { Q } ) } \left[ f _ { 1 } ( C ( x _ { f } ) - C ( x _ { r } ) ) \right] . } \end{array}
372
+ $$
373
+
374
+ # E TESTING THE GRADIENT ARGUMENT
375
+
376
+ Previously, we argued that SGAN could be equivalent to IPM-GANs under very strict conditions and assumptions. We mentioned that although most assumptions are reasonable, the assumption that the generator is trained to optimality is unrealistic. In which case, SGAN would not be equivalent to IPM-based GANs since $D ( x _ { r } )$ would not reach 0.
377
+
378
+ As an experiment, we calculated the mini-batch average of $D ( x _ { r } )$ in the first 100 iterations of the training for the CAT dataset in $2 5 6 \times 2 5 6$ . Note that SGAN becomes stuck at around 200 iterations and can never go beyond generating noise. Thus, a difference in the distribution of $D ( x _ { r } )$ could reveal something meaningful about why Relativistic GANs can converge while their non-relativistic counterparts cannot.
379
+
380
+ In those 100 iterations, we have that the distance between $\mathbb { P }$ and $\mathbb { Q }$ is maximal since $G$ only generate noise. Thus, we can perfectly distinguish real from fake data, which is one of the assumptions. The remaining assumptions were that $D$ and $G$ would be trained to optimality. Although we did not train $D$ more than once, after the discriminator step, we generally had that $D ( x _ { r } ) \approx 1$ . What we wanted to verify is whether $D ( x _ { r } ) \approx 0$ after the generator step in Relativistic GANs, even though we did not train $G$ enough to reach optimality.
381
+
382
+ ![](images/f064e75600f2f13637acd2cebb1789f632bd9aebd04b8a689a6df29ebac6f20d.jpg)
383
+ Figure 2: Density plots of the mini-batch average of $D ( x _ { r } )$ during the first 100 iterations of training on CAT with $2 5 6 \mathrm { x } 2 5 6$ images using only one or two generator updates per discriminator updates. If $D ( x _ { r } ) = 0$ in all iterations, this would mean that the loss function would be the same as IPM-based GANs.
384
+
385
+ Results are shown in Figure 2. We observe that with only one generator update per discriminator update $\because G = 1 \mathrm { \Omega }$ ), RSGAN and RaSGAN never reach an average $D ( x _ { r } )$ of 0 but the distribution is much less concentrated around 1 than with SGAN. With $n _ { G } = 2$ , RSGAN and RaSGAN sometimes reach an average $D ( x _ { r } )$ of 0 and they form an almost uniform distribution around $[ 0 , 1 ]$ . This suggests that with the missing property (i.e., using Relativistic GANs), SGAN can be made more similar to IPM-based GANs, but never equivalent. Thus, Relativistic Standard GANs can be seen as having a dynamic in-between SGAN and IPM-based GANs.
386
+
387
+ # F CIFAR-10 HARD/UNSTABLE EXPERIMENTS
388
+
389
+ In these analyses, we compared SGAN, LSGAN, WGAN-GP, RSGAN, RaSGAN, RaLSGAN, and RaHingeGAN with the standard CNN architecture on unstable setups in CIFAR-10. Unless otherwise specified, we used $l r = . 0 0 0 2$ , $\beta _ { 1 } = . 5$ , $\beta _ { 2 } = . 9 9 9$ , $n _ { D } = 1$ , and batch norm (Ioffe & Szegedy, 2015) in $G$ and $D$ . We tested the following four unstable setups: (1) $l r = . 0 0 1$ , (2) $\beta _ { 1 } = . 9$ , $\beta _ { 2 } = . 9$ , (3) no batch norm in $G$ or $D$ , and (4) all activation functions replaced with Tanh in both $G$ and $D$ (except for the output activation function of $D$ ).
390
+
391
+ Results are presented in Table 4. We observe that RaLSGAN performed better than LSGAN in all setups. RaHingeGAN performed slightly worse than HingeGAN in most setups. RSGAN and RaSGAN performed better than SGAN in two out of four setups, although differences were small. WGAN-GP generally performed poorly which we suspect is due to the single discriminator update per generator update. Overall, this provide good support for the improved stability of using the relative discriminator with LSGAN, but not with HingeGAN and SGAN. Although results are worse for the relativistic discriminator in some settings, differences are minimal and probably reflect natural variations.
392
+
393
+ It is surprising to observe low FID for SGAN without batch normalization considering its well-known difficulty with this setting (Arjovsky et al., 2017). Given these results, we suspected that CIFAR-10 may be too easy to fully observe the stabilizing effects of using the relative discriminator. Therefore, in the manuscript, we focused on the more difficult CAT dataset with high resolution pictures.
394
+
395
+ # G LOSS FUNCTIONS USED IN EXPERIMENTS
396
+
397
+ # G.1 SGAN (NON-SATURATING)
398
+
399
+ $$
400
+ \begin{array} { c } { { L _ { D } ^ { S G A N } = - \mathbb { E } _ { x _ { r } \sim \mathbb { P } } \left[ \log \left( \mathrm { s i g m o i d } ( C ( x _ { r } ) ) \right) \right] - \mathbb { E } _ { x _ { f } \sim \mathbb { Q } } \left[ \log \left( 1 - \mathrm { s i g m o i d } ( C ( x _ { f } ) ) \right) \right] } } \\ { { L _ { G } ^ { S G A N } = - \mathbb { E } _ { x _ { f } \sim \mathbb { Q } } \left[ \log \left( \mathrm { s i g m o i d } ( C ( x _ { f } ) ) \right) \right] } } \end{array}
401
+ $$
402
+
403
+ G.2 RSGAN
404
+
405
+ $$
406
+ { \cal L } _ { D } ^ { R S G A N } = - \mathbb { E } _ { ( x _ { r } , x _ { f } ) \sim ( \mathbb { P } , \mathbb { Q } ) } \left[ \log ( \operatorname { s i g m o i d } ( C ( x _ { r } ) - C ( x _ { f } ) ) ) \right]
407
+ $$
408
+
409
+ Table 4: Fréchet Inception Distance (FID) at exactly $1 0 0 \mathrm { k }$ generator iterations on the CIFAR-10 dataset using unstable setups with different GAN loss functions. Unless otherwise specified, we used $l r = . 0 0 0 2$ , $\beta = ( . 5 0 , . 9 9 9 )$ , $n _ { D } = 1$ , and batch norm (BN) in $D$ and $G$ . All models were trained using the same a priori selected seed (seed $^ { = 1 }$ ).
410
+
411
+ <table><tr><td>Loss</td><td>lr= .001</td><td>β=(.9,.9)</td><td>No BN</td><td>Tanh</td></tr><tr><td>SGAN</td><td>154.20</td><td>35.29</td><td>35.54</td><td>59.17</td></tr><tr><td>RSGAN</td><td>50.95</td><td>45.12</td><td>37.11</td><td>77.21</td></tr><tr><td>RaSGAN</td><td>55.55</td><td>43.46</td><td>41.96</td><td>54.42</td></tr><tr><td>LSGAN</td><td>52.27</td><td>225.94</td><td>38.54</td><td>147.87</td></tr><tr><td>RaLSGAN</td><td>33.33</td><td>48.92</td><td>34.66</td><td>53.07</td></tr><tr><td>HingeGAN</td><td>43.28</td><td>33.47</td><td>34.21</td><td>58.51</td></tr><tr><td>RaHingeGAN</td><td>51.05</td><td>42.78</td><td>43.75</td><td>50.69</td></tr><tr><td>WGAN-GP</td><td>61.97</td><td>104.95</td><td>85.27</td><td>59.94</td></tr></table>
412
+
413
+ $$
414
+ { \cal L } _ { G } ^ { R S G A N } = - \mathbb { E } _ { ( x _ { r } , x _ { f } ) \sim ( \mathbb { P } , \mathbb { Q } ) } \left[ \log ( \operatorname { s i g m o i d } ( C ( x _ { f } ) - C ( x _ { r } ) ) ) \right]
415
+ $$
416
+
417
+ # G.3 RASGAN
418
+
419
+ $$
420
+ \begin{array} { r l } & { \quad L _ { D } ^ { R a S G A N } = - \mathbb { E } _ { x _ { r } \sim \mathbb { P } } \left[ \log \left( \tilde { D } ( x _ { r } ) \right) \right] - \mathbb { E } _ { x _ { f } \sim \mathbb { Q } } \left[ \log \left( 1 - \tilde { D } ( x _ { f } ) \right) \right] } \\ & { \quad L _ { G } ^ { R a S G A N } = - \mathbb { E } _ { x _ { f } \sim \mathbb { Q } } \left[ \log \left( \tilde { D } ( x _ { f } ) \right) \right] - \mathbb { E } _ { x _ { r } \sim \mathbb { P } } \left[ \log \left( 1 - \tilde { D } ( x _ { r } ) \right) \right] } \\ & { \quad \tilde { D } ( x _ { r } ) = \mathrm { s i g m o i d } \left( C ( x _ { r } ) - \mathbb { E } _ { x _ { f } \sim \mathbb { Q } } C ( x _ { f } ) \right) } \\ & { \quad \tilde { D } ( x _ { f } ) = \mathrm { s i g m o i d } \left( C ( x _ { f } ) - \mathbb { E } _ { x _ { r } \sim \mathbb { P } } C ( x _ { r } ) \right) } \end{array}
421
+ $$
422
+
423
+ # G.4 LSGAN
424
+
425
+ $$
426
+ L _ { D } ^ { L S G A N } = \mathbb { E } _ { x _ { r } \sim \mathbb { P } } \left[ ( C ( x _ { r } ) - 0 ) ^ { 2 } \right] + \mathbb { E } _ { x _ { f } \sim \mathbb { Q } } \left[ ( C ( x _ { f } ) - 1 ) ^ { 2 } \right]
427
+ $$
428
+
429
+ $$
430
+ L _ { G } ^ { L S G A N } = \mathbb { E } _ { x _ { f } \sim \mathbb { Q } } \left[ ( C ( x _ { f } ) - 0 ) ^ { 2 } \right]
431
+ $$
432
+
433
+ # G.5 RALSGAN
434
+
435
+ $$
436
+ L _ { D } ^ { R a L S G A N } = \mathbb { E } _ { x _ { r } \sim \mathbb { P } } \left[ \left( C ( x _ { r } ) - \mathbb { E } _ { x _ { f } \sim \mathbb { Q } } C ( x _ { f } ) - 1 \right) ^ { 2 } \right] + \mathbb { E } _ { x _ { f } \sim \mathbb { Q } } \left[ \left( C ( x _ { f } ) - \mathbb { E } _ { x _ { r } \sim \mathbb { P } } C ( x _ { r } ) + 1 \right) ^ { 2 } \right]
437
+ $$
438
+
439
+ $$
440
+ L _ { G } ^ { R a L S G A N } = \mathbb { E } _ { x _ { f } \sim \mathbb { P } } [ ( C ( x _ { f } ) - \mathbb { E } _ { x _ { r } \sim \mathbb { P } } C ( x _ { r } ) - 1 ) ^ { 2 } ] + \mathbb { E } _ { x _ { r } \sim \mathbb { P } } [ ( C ( x _ { r } ) - \mathbb { E } _ { x _ { f } \sim \mathbb { Q } } C ( x _ { f } ) + 1 ) ^ { 2 } ]
441
+ $$
442
+
443
+ # G.6 HINGEGAN
444
+
445
+ $$
446
+ L _ { D } ^ { H i n g e G A N } = \mathbb { E } _ { x _ { r } \sim \mathbb { P } } \left[ \operatorname* { m a x } ( 0 , 1 - C ( x _ { r } ) ) \right] + \mathbb { E } _ { x _ { f } \sim \mathbb { Q } } \left[ \operatorname* { m a x } ( 0 , 1 + C ( x _ { f } ) ) \right]
447
+ $$
448
+
449
+ $$
450
+ L _ { G } ^ { H i n g e G A N } = - \mathbb { E } _ { x _ { f } \sim \mathbb { Q } } \left[ C ( x _ { f } ) \right]
451
+ $$
452
+
453
+ # G.7 RAHINGEGAN
454
+
455
+ $$
456
+ L _ { D } ^ { H i n g e G A N } = \mathbb { E } _ { x _ { r } \sim \mathbb { P } } \left[ \operatorname* { m a x } ( 0 , 1 - \tilde { D } ( x _ { r } ) ) \right] + \mathbb { E } _ { x _ { f } \sim \mathbb { Q } } \left[ \operatorname* { m a x } ( 0 , 1 + \tilde { D } ( x _ { f } ) ) \right]
457
+ $$
458
+
459
+ $$
460
+ \begin{array} { c } { { L _ { G } ^ { H i n g e G A N } = \mathbb { E } _ { x _ { f } \sim \mathbb { P } } \left[ \operatorname* { m a x } ( 0 , 1 - \tilde { D } ( x _ { f } ) ) \right] + \mathbb { E } _ { x _ { r } \sim \mathbb { Q } } \left[ \operatorname* { m a x } ( 0 , 1 + \tilde { D } ( x _ { r } ) ) \right] } } \\ { { \tilde { D } ( x _ { r } ) = C ( x _ { r } ) - \mathbb { E } _ { x _ { f } \sim \mathbb { Q } } C ( x _ { f } ) } } \end{array}
461
+ $$
462
+
463
+ # G.8 WGAN-GP
464
+
465
+ $$
466
+ { \cal L } _ { D } ^ { W G A N - G P } = - \mathbb { E } _ { x _ { r } \sim \mathbb { P } } \left[ C ( x _ { r } ) \right] + \mathbb { E } _ { x _ { f } \sim \mathbb { Q } } \left[ C ( x _ { f } ) \right] + \lambda \mathbb { E } _ { \hat { x } \sim \mathbb { P } _ { \hat { x } } } \left[ \left( | | \nabla _ { \hat { x } } C ( \hat { x } ) | | _ { 2 } - 1 \right) ^ { 2 } \right]
467
+ $$
468
+
469
+ $$
470
+ L _ { G } ^ { W G A N - G P } = - \mathbb { E } _ { x _ { f } \sim \mathbb { Q } } \left[ C ( x _ { f } ) \right]
471
+ $$
472
+
473
+ $\mathbb { P } _ { \hat { x } }$ is the distribution of $\hat { x } = \epsilon x _ { r } + ( 1 - \epsilon ) x _ { f }$ , where $x _ { r } \sim \mathbb { P } , x _ { f } \sim \mathbb { Q } , \epsilon \sim U [ 0 , 1 ]$ .
474
+
475
+ # G.9 RSGAN-GP
476
+
477
+ $$
478
+ { \cal L } _ { D } ^ { R S G A N } = - \mathbb { E } _ { ( x _ { r } , x _ { f } ) \sim ( \mathbb { P } , \mathbb { Q } ) } \left[ \log ( { \mathrm { s i g m o i d } ( C ( x _ { r } ) - C ( x _ { f } ) ) } ) \right] + \lambda \mathbb { E } _ { \hat { x } \sim \mathbb { P } _ { \hat { x } } } \left[ \left( | | \nabla _ { \hat { x } } C ( \hat { x } ) | | _ { 2 } - 1 \right) ^ { 2 } \right]
479
+ $$
480
+
481
+ $$
482
+ { \cal L } _ { G } ^ { R S G A N } = - \mathbb { E } _ { ( x _ { r } , x _ { f } ) \sim ( \mathbb { P } , \mathbb { Q } ) } \left[ \log ( \operatorname { s i g m o i d } ( C ( x _ { f } ) - C ( x _ { r } ) ) ) \right]
483
+ $$
484
+
485
+ $\mathbb { P } _ { \hat { x } }$ is the distribution of $\hat { x } = \epsilon x _ { r } + ( 1 - \epsilon ) x _ { f }$ , where $x _ { r } \sim \mathbb { P } , x _ { f } \sim \mathbb { Q } , \epsilon \sim U [ 0 , 1 ]$ .
486
+
487
+ # G.10 RASGAN-GP
488
+
489
+ $$
490
+ \cdot \mathtt { R a S G A N } = - \mathbb { E } _ { x \sim \mathbb { P } } \left[ \log \left( \tilde { D } ( x _ { r } ) \right) \right] - \mathbb { E } _ { x _ { f } \sim \mathbb { Q } } \left[ \log \left( 1 - \tilde { D } ( x _ { f } ) \right) \right] + \lambda \mathbb { E } _ { \hat { x } \sim \mathbb { P } _ { \hat { z } } } \left[ \left( | | \nabla _ { \tilde { x } } C ( \hat { x } ) | | _ { 2 } - \underline { { 1 } } \right) ^ { 2 } \right]
491
+ $$
492
+
493
+ $$
494
+ L _ { G } ^ { R a S G A N } = - \mathbb { E } _ { x _ { f } \sim \mathbb { Q } } \left[ \log \left( \tilde { D } ( x _ { f } ) \right) \right] - \mathbb { E } _ { x _ { r } \sim \mathbb { P } } \left[ \log \left( 1 - \tilde { D } ( x _ { r } ) \right) \right]
495
+ $$
496
+
497
+ $\tilde { D } ( x _ { r } ) =$ sigmoid $\left( C ( x _ { r } ) - \mathbb { E } _ { x _ { f } \sim \mathbb { Q } } C ( x _ { f } ) \right)$
498
+ $\tilde { D } ( x _ { f } ) =$ sigmoid $( C ( x _ { f } ) - \mathbb { E } _ { x _ { r } \sim \mathbb { P } } C ( x _ { r } ) )$
499
+ $\mathbb { P } _ { \hat { x } }$ is the distribution of $\hat { x } = \epsilon x _ { r } + ( 1 - \epsilon ) x _ { f }$ , where $x _ { r } \sim \mathbb { P } , x _ { f } \sim \mathbb { Q } , \epsilon \sim U [ 0 , 1 ]$ .
500
+
501
+ # H ALGORITHMS
502
+
503
+ # Algorithm 1 Training algorithm for non-saturating RGANs with symmetric loss functions
504
+
505
+ Require: The number of $D$ iterations $n _ { D }$ ( $n _ { D } = 1$ unless one seeks to train $D$ to optimality), batch size $m$ , and functions $f$ which determine the objective function of the discriminator ( $f$ is $f _ { 1 }$ from equation 10 assuming that $f _ { 2 } ( - y ) = f _ { 1 } ( y )$ , which is true for many GANs).
506
+
507
+ hile $\theta$ has not converged do for $t = 1 , \dots , n _ { D }$ do Sample $\{ \boldsymbol { x } ^ { ( i ) } \} _ { i = 1 } ^ { m } \sim \mathbb { P }$ Sample $\{ z ^ { ( i ) } \} _ { i = 1 } ^ { m } \sim { \mathbb { P } _ { z } }$ Update $w$ using SGD by ascending with $\begin{array} { r } { \nabla _ { w } \frac { 1 } { m } \sum _ { i = 1 } ^ { m } \left[ f ( C _ { w } ( x ^ { ( i ) } ) - C _ { w } ( G _ { \theta } ( z ^ { ( i ) } ) ) ) \right] } \end{array}$ end for
508
+ Sample $\{ \boldsymbol { x } ^ { ( i ) } \} _ { i = 1 } ^ { m } \sim \mathbb { P }$
509
+ Sample $\{ z ^ { ( i ) } \} _ { i = 1 } ^ { m } \sim { \mathbb { P } } _ { z }$
510
+ Update $\theta$ using SGD by ascending with $\begin{array} { r } { \nabla _ { \theta } \frac { 1 } { m } \sum _ { i = 1 } ^ { m } \left[ f ( C _ { w } ( G _ { \theta } ( z ^ { ( i ) } ) ) - C _ { w } ( x ^ { ( i ) } ) ) \right] } \end{array}$
511
+
512
+ end while
513
+
514
+ # Algorithm 2 Training algorithm for non-saturating RaGANs
515
+
516
+ Require: The number of $D$ iterations $n _ { D }$ $n _ { D } = 1$ unless one seek to train $D$ to optimality), batch size $m$ , and functions $f _ { 1 }$ and $f _ { 2 }$ which determine the objective function of the discriminator (see equation 10).
517
+
518
+ while $\theta$ has not converged do for $t = 1 , \dots , n _ { D }$ do Sample $\{ \boldsymbol { x } ^ { ( i ) } \} _ { i = 1 } ^ { m } \sim \mathbb { P }$ Sample Let Let $\begin{array} { r } { \overline { { C _ { w } ( x _ { r } ) } } = { \frac { 1 } { m } } \sum _ { i = 1 } ^ { m } C _ { w } ( x ^ { ( i ) } ) } \end{array}$ $\{ z ^ { ( i ) } \} _ { i = 1 } ^ { m } \sim { \mathbb { P } } _ { z }$ $\begin{array} { r } { \overline { { C _ { w } ( x _ { f } ) } } = \frac { 1 } { m } \sum _ { i = 1 } ^ { m } C _ { w } ( G _ { \theta } ( z ^ { ( i ) } ) ) } \end{array}$
519
+
520
+ Update $w$ using SGD by ascending with
521
+
522
+ $$
523
+ \begin{array} { r } { \nabla _ { w } \frac { 1 } { m } \sum _ { i = 1 } ^ { m } \biggl [ f _ { 1 } ( C _ { w } ( x ^ { ( i ) } ) - \overline { { C _ { w } ( x _ { f } ) } } ) + f _ { 2 } ( C _ { w } ( G _ { \theta } ( z ^ { ( i ) } ) ) - \overline { { C _ { w } ( x _ { r } ) } } ) \biggr ] } \end{array}
524
+ $$
525
+
526
+ # end for
527
+
528
+ Update $\theta$ using SGD by ascending with
529
+
530
+ $$
531
+ \begin{array} { r } { \nabla _ { \theta } \frac { 1 } { m } \sum _ { i = 1 } ^ { m } \Bigl [ f _ { 1 } \bigl ( C _ { w } \bigl ( G _ { \theta } \bigl ( z ^ { ( i ) } \bigr ) \bigr ) - \overline { { C _ { w } \bigl ( x _ { r } \bigr ) } } \bigr ) + f _ { 2 } \bigl ( C _ { w } \bigl ( x ^ { ( i ) } \bigr ) - \overline { { C _ { w } \bigl ( x _ { f } \bigr ) } } \bigr ) \Bigr ] } \end{array}
532
+ $$
533
+
534
+ end while
535
+
536
+ Generator
537
+
538
+ <table><tr><td rowspan=1 colspan=1>z ∈ R128 ~ N(0,I)</td></tr><tr><td rowspan=1 colspan=1>linear, 128 -&gt; 512*4*4</td></tr><tr><td rowspan=1 colspan=1>Reshape, 512*4*4 -&gt; 512 x 4 x 4</td></tr><tr><td rowspan=1 colspan=1>ConvTranspose2d 4x4, stride 2, pad 1, 512-&gt;256</td></tr><tr><td rowspan=1 colspan=1>BN and ReLU</td></tr><tr><td rowspan=1 colspan=1>ConvTranspose2d 4x4, stride 2, pad 1, 256-&gt;128</td></tr><tr><td rowspan=1 colspan=1>BN and ReLU</td></tr><tr><td rowspan=1 colspan=1>ConvTranspose2d 4x4, stride 2, pad 1, 128-&gt;64</td></tr><tr><td rowspan=1 colspan=1>BN and ReLU</td></tr><tr><td rowspan=1 colspan=1>ConvTranspose2d 3x3, stride 1, pad 1, 64-&gt;3</td></tr><tr><td rowspan=1 colspan=1>Tanh</td></tr></table>
539
+
540
+ Discriminator
541
+
542
+ <table><tr><td rowspan=1 colspan=1>CER3x32x32</td></tr><tr><td rowspan=1 colspan=1>Conv2d 3x3,stride 1, pad 1,3-&gt;64</td></tr><tr><td rowspan=1 colspan=1>LeakyReLU 0.1</td></tr><tr><td rowspan=1 colspan=1>Conv2d 4x4, stride 2, pad 1, 64-&gt;64</td></tr><tr><td rowspan=1 colspan=1>LeakyReLU 0.1</td></tr><tr><td rowspan=1 colspan=1>Conv2d 3x3, stride 1, pad 1, 64-&gt;128</td></tr><tr><td rowspan=1 colspan=1>LeakyReLU 0.1</td></tr><tr><td rowspan=1 colspan=1>Conv2d 4x4,stride 2, pad 1, 128-&gt;128</td></tr><tr><td rowspan=1 colspan=1>LeakyReLU 0.1</td></tr><tr><td rowspan=1 colspan=1>Conv2d 3x3, stride 1, pad 1, 128-&gt;256</td></tr><tr><td rowspan=1 colspan=1>LeakyReLU 0.1</td></tr><tr><td rowspan=1 colspan=1>Conv2d 4x4, stride 2, pad 1, 256-&gt;256</td></tr><tr><td rowspan=1 colspan=1>LeakyReLU 0.1</td></tr><tr><td rowspan=1 colspan=1>Conv2d 3x3, stride 1, pad 1, 256-&gt;512</td></tr><tr><td rowspan=1 colspan=1>Reshape,512 x 4 x 4 -&gt; 512*4*4</td></tr><tr><td rowspan=1 colspan=1>linear, 512*4*4 -&gt; 1</td></tr></table>
543
+
544
+ # I.2 DCGAN 64X64
545
+
546
+ Generator
547
+
548
+ <table><tr><td rowspan=1 colspan=1>z ∈ R128 ~ N(0,I)</td></tr><tr><td rowspan=1 colspan=1>ConvTranspose2d 4x4,stride 1, pad 0, no bias,128-&gt;512</td></tr><tr><td rowspan=1 colspan=1>BN and ReLU</td></tr><tr><td rowspan=1 colspan=1>ConvTranspose2d 4x4,stride 2, pad 1, no bias,512-&gt;256</td></tr><tr><td rowspan=1 colspan=1>BN and ReLU</td></tr><tr><td rowspan=1 colspan=1>ConvTranspose2d 4x4,stride 2, pad 1, no bias,256-&gt;128</td></tr><tr><td rowspan=1 colspan=1>BN and ReLU</td></tr><tr><td rowspan=1 colspan=1>ConvTranspose2d 4x4, stride 2, pad 1, no bias,128-&gt;64</td></tr><tr><td rowspan=1 colspan=1>BN and ReLU</td></tr><tr><td rowspan=1 colspan=1>ConvTranspose2d 4x4,stride 2, pad 1, no bias, 64-&gt;3</td></tr><tr><td rowspan=1 colspan=1>Tanh</td></tr></table>
549
+
550
+ Discriminator
551
+
552
+ <table><tr><td rowspan=1 colspan=1>x∈ R3x64x64</td></tr><tr><td rowspan=1 colspan=1>Conv2d 4x4, stride 2, pad 1, no bias, 3-&gt;64</td></tr><tr><td rowspan=1 colspan=1>LeakyReLU 0.2</td></tr><tr><td rowspan=1 colspan=1>Conv2d 4x4, stride 2,pad 1, no bias, 64-&gt;128</td></tr><tr><td rowspan=1 colspan=1>BN and LeakyReLU 0.2</td></tr><tr><td rowspan=1 colspan=1>Conv2d 4x4, stride 2, pad 1, no bias,128-&gt;256</td></tr><tr><td rowspan=1 colspan=1>BN and LeakyReLU 0.2</td></tr><tr><td rowspan=1 colspan=1>Conv2d 4x4,stride 2, pad 1, no bias,256-&gt;512</td></tr><tr><td rowspan=1 colspan=1>BN and LeakyReLU 0.2</td></tr><tr><td rowspan=1 colspan=1>Conv2d 4x4, stride 2, pad 1, no bias,512-&gt;1</td></tr></table>
553
+
554
+ Generator
555
+
556
+ <table><tr><td rowspan=1 colspan=1>z ∈ R128 ~ N(0,I)</td></tr><tr><td rowspan=1 colspan=1>ConvTranspose2d 4x4,stride 1, pad 0, no bias,128-&gt;1024</td></tr><tr><td rowspan=1 colspan=1>BN and ReLU</td></tr><tr><td rowspan=1 colspan=1>ConvTranspose2d 4x4,stride 2,pad 1, no bias,1024-&gt;512</td></tr><tr><td rowspan=1 colspan=1>BN and ReLU</td></tr><tr><td rowspan=1 colspan=1>ConvTranspose2d 4x4, stride 2, pad 1, no bias, 512-&gt;256</td></tr><tr><td rowspan=1 colspan=1>BN and ReLU</td></tr><tr><td rowspan=1 colspan=1>ConvTranspose2d 4x4, stride 2, pad 1, no bias,256-&gt;128</td></tr><tr><td rowspan=1 colspan=1>BN and ReLU</td></tr><tr><td rowspan=1 colspan=1>ConvTranspose2d 4x4, stride 2, pad 1, no bias,128-&gt;64</td></tr><tr><td rowspan=1 colspan=1>BN and ReLU</td></tr><tr><td rowspan=1 colspan=1>ConvTranspose2d 4x4, stride 2, pad 1, no bias, 64-&gt;3</td></tr><tr><td rowspan=1 colspan=1>Tanh</td></tr></table>
557
+
558
+ Discriminator
559
+
560
+ <table><tr><td rowspan=1 colspan=1>C∈R3x128x128</td></tr><tr><td rowspan=1 colspan=1>Conv2d 4x4, stride 2, pad 1, no bias,3-&gt;64</td></tr><tr><td rowspan=1 colspan=1>LeakyReLU 0.2</td></tr><tr><td rowspan=1 colspan=1>Conv2d 4x4, stride 2, pad 1, no bias,64-&gt;128</td></tr><tr><td rowspan=1 colspan=1>BN and LeakyReLU 0.2</td></tr><tr><td rowspan=1 colspan=1>Conv2d 4x4, stride 2,pad 1, no bias,128-&gt;256</td></tr><tr><td rowspan=1 colspan=1>BN and LeakyReLU 0.2</td></tr><tr><td rowspan=1 colspan=1>Conv2d 4x4, stride 2, pad 1, no bias, 256-&gt;512</td></tr><tr><td rowspan=1 colspan=1>BN and LeakyReLU 0.2</td></tr><tr><td rowspan=1 colspan=1>Conv2d 4x4, stride 2, pad 1, no bias, 512-&gt;1024</td></tr><tr><td rowspan=1 colspan=1>BN and LeakyReLU 0.2</td></tr><tr><td rowspan=1 colspan=1>Conv2d 4x4, stride 2, pad 1, no bias,1024-&gt;1</td></tr></table>
561
+
562
+ Generator
563
+
564
+ <table><tr><td rowspan=1 colspan=1>z ∈ R128 ~ N(0,I)</td></tr><tr><td rowspan=1 colspan=1>ConvTranspose2d 4x4, stride 1, pad 0, no bias,128-&gt;1024</td></tr><tr><td rowspan=1 colspan=1>BN and ReLU</td></tr><tr><td rowspan=1 colspan=1>ConvTranspose2d 4x4, stride 2, pad 1, no bias,1024-&gt;512</td></tr><tr><td rowspan=1 colspan=1>BN and ReLU</td></tr><tr><td rowspan=1 colspan=1>ConvTranspose2d 4x4, stride 2,pad 1, no bias, 512-&gt;256</td></tr><tr><td rowspan=1 colspan=1>BN and ReLU</td></tr><tr><td rowspan=1 colspan=1>ConvTranspose2d 4x4,stride 2, pad 1, no bias,256-&gt;128</td></tr><tr><td rowspan=1 colspan=1>BN and ReLU</td></tr><tr><td rowspan=1 colspan=1>ConvTranspose2d 4x4, stride 2, pad 1, no bias,128-&gt;64</td></tr><tr><td rowspan=1 colspan=1>BN and ReLU</td></tr><tr><td rowspan=1 colspan=1>ConvTranspose2d 4x4,stride 2, pad 1, no bias, 64-&gt;32</td></tr><tr><td rowspan=1 colspan=1>BN and ReLU</td></tr><tr><td rowspan=1 colspan=1>ConvTranspose2d 4x4, stride 2, pad 1, no bias, 64-&gt;3</td></tr><tr><td rowspan=1 colspan=1>Tanh</td></tr></table>
565
+
566
+ <table><tr><td rowspan=1 colspan=1>x1 ∈R3x256x56,x2 ∈R3x56x256</td></tr><tr><td rowspan=1 colspan=1>Concatenate [x1, x2] ∈ R6x256x256</td></tr><tr><td rowspan=1 colspan=1>Conv2d 4x4, stride 2, pad 1, no bias,6-&gt;32</td></tr><tr><td rowspan=1 colspan=1>LeakyReLU0.2</td></tr><tr><td rowspan=1 colspan=1>Conv2d 4x4, stride 2,pad 1, no bias,32-&gt;64</td></tr><tr><td rowspan=1 colspan=1>LeakyReLU 0.2</td></tr><tr><td rowspan=1 colspan=1>Conv2d 4x4, stride 2, pad 1, no bias, 64-&gt;128</td></tr><tr><td rowspan=1 colspan=1>BN andLeakyReLU0.2</td></tr><tr><td rowspan=1 colspan=1>Conv2d 4x4, stride 2, pad 1, no bias,128-&gt;256</td></tr><tr><td rowspan=1 colspan=1>BN and LeakyReLU 0.2</td></tr><tr><td rowspan=1 colspan=1>Conv2d 4x4, stride 2,pad 1, no bias,256-&gt;512</td></tr><tr><td rowspan=1 colspan=1>BN andLeakyReLU 0.2</td></tr><tr><td rowspan=1 colspan=1>Conv2d 4x4,stride 2,pad 1, no bias, 512-&gt;1024</td></tr><tr><td rowspan=1 colspan=1>BN and LeakyReLU 0.2</td></tr><tr><td rowspan=1 colspan=1>Conv2d 4x4, stride 2, pad 1, no bias,1024-&gt;1</td></tr></table>
567
+
568
+ This shows a selection of cats from certain models. Images shown are from the lowest FID registered at every 10k generator iterations. Given space constraint, with cats in high resolution, we show some of the nicer looking cats for each approach, there are evidently some worse looking cats (See https://github.com/AlexiaJM/RelativisticGAN/tree/ master/images/full_minibatch for all cats of the mini-batch).
569
+
570
+ ![](images/6c96b0c47d6a681d92402ec5819612a513b648d7333b75c6a99421b030e49a34.jpg)
571
+ Figure 3: 64x64 cats with RaLSGAN $( \mathrm { F I D } = 1 1 . 9 7 )$ )
572
+
573
+ ![](images/93a5e5e60d1f48b307024a2ea7bcf313fa53b7bbf270f2e2d92f734138f70064.jpg)
574
+ Figure 4: 128x128 cats with RaLSGAN $\mathrm { ( F I D = 1 } 5 . 8 5$ )
575
+
576
+ ![](images/af5d952d7811d39e05822e2300131f2558e09547e3e34785aa15c00c7a36b0f9.jpg)
577
+ Figure 5: $2 5 6 \times 2 5 6$ cats with GAN (5k iterations)
578
+
579
+ ![](images/9b4fd66ead28838503f85ab7e0f7982c1b042e018ce72ff87de624b49c99449b.jpg)
580
+ Figure 6: 256x256 cats with LSGAN (5k iterations)
581
+
582
+ ![](images/efafc9497a5ad1da5dff98ddf0d9b98904fb811bf44c1c18a165273455db1016.jpg)
583
+ Figure 7: 256x256 cats with RaSGAN (FID = 32.11)
584
+
585
+ ![](images/59bc6b8f154af9dd0a9abeaa90488a79336057e5e418eb2598ad7a8761318c87.jpg)
586
+ Figure 8: 256x256 cats with RaLSGAN $\mathrm { ( F I D } = 3 5 . 2 1 $ )
587
+
588
+ ![](images/17027e182d3ca70500c9843b6e2eb5ef057a03afa9d32e38432cafb95ee49051.jpg)
589
+ Figure 9: 256x256 cats with SpectralSGAN $\mathrm { ( F I D } = 5 4 . 7 3 $ )
590
+
591
+ ![](images/4b743c332f15e44aa1a77a85337371f1b44e2e93a7697fcb4da9d8003a0c5b56.jpg)
592
+ Figure 10: 256x256 cats with WGAN-GP $\mathrm { { F I D } > 1 0 0 } )$ )
parse/train/S1erHoR5t7/S1erHoR5t7_content_list.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/train/SkhQHMW0W/SkhQHMW0W.md ADDED
@@ -0,0 +1,355 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # DEEP GRADIENT COMPRESSION: REDUCING THE COMMUNICATION BANDWIDTH FOR DISTRIBUTED TRAINING
2
+
3
+ Yujun Lin ∗
4
+ Tsinghua University
5
+ Beijing National Research Center
6
+ for Information Science and Technology
7
+ linyy14@mails.tsinghua.edu.cn
8
+ Song Han †
9
+ Stanford University
10
+ Google Brain
11
+ songhan@stanford.edu
12
+
13
+ Huizi Mao Stanford University huizi@stanford.edu
14
+
15
+ # Yu Wang
16
+
17
+ Tsinghua University Beijing National Research Center for Information Science and Technology yu-wang@mail.tsinghua.edu.cn
18
+
19
+ William J. Dally Stanford University NVIDIA dally@stanford.edu
20
+
21
+ # ABSTRACT
22
+
23
+ Large-scale distributed training requires significant communication bandwidth for gradient exchange that limits the scalability of multi-node training, and requires expensive high-bandwidth network infrastructure. The situation gets even worse with distributed training on mobile devices (federated learning), which suffers from higher latency, lower throughput, and intermittent poor connections. In this paper, we find $9 9 . 9 \%$ of the gradient exchange in distributed SGD are redundant, and propose Deep Gradient Compression (DGC) to greatly reduce the communication bandwidth. To preserve accuracy during this compression, DGC employs four methods: momentum correction, local gradient clipping, momentum factor masking, and warm-up training. We have applied Deep Gradient Compression to image classification, speech recognition, and language modeling with multiple datasets including Cifar10, ImageNet, Penn Treebank, and Librispeech Corpus. On these scenarios, Deep Gradient Compression achieves a gradient compression ratio from $2 7 0 \times$ to $6 0 0 \times$ without losing accuracy, cutting the gradient size of ResNet-50 from 97MB to 0.35MB, and for DeepSpeech from 488MB to 0.74MB. Deep gradient compression enables large-scale distributed training on inexpensive commodity 1Gbps Ethernet and facilitates distributed training on mobile.
24
+
25
+ # 1 INTRODUCTION
26
+
27
+ Large-scale distributed training improves the productivity of training deeper and larger models (Chilimbi et al., 2014; Xing et al., 2015; Moritz et al., 2015; Zinkevich et al., 2010). Synchronous stochastic gradient descent (SGD) is widely used for distributed training. By increasing the number of training nodes and taking advantage of data parallelism, the total computation time of the forward-backward passes on the same size training data can be dramatically reduced. However, gradient exchange is costly and dwarfs the savings of computation time (Li et al., 2014; Wen et al.,
28
+
29
+ ![](images/4fc386e290a584c321a5ceece6dddea87170b012d181d7057dd735c2a74c1c93.jpg)
30
+ Figure 1: Deep Gradient Compression can reduce the communication time, improve the scalability, and speed up distributed training.
31
+
32
+ 2017), especially for recurrent neural networks (RNN) where the computation-to-communication ratio is low. Therefore, the network bandwidth becomes a significant bottleneck for scaling up distributed training. This bandwidth problem gets even worse when distributed training is performed on mobile devices, such as federated learning (McMahan et al., 2016; Konecnˇ y et al., 2016). Training \` on mobile devices is appealing due to better privacy and better personalization (Google, 2017), but a critical problem is that those mobile devices suffer from even lower network bandwidth, intermittent network connections, and expensive mobile data plan.
33
+
34
+ Deep Gradient Compression (DGC) solves the communication bandwidth problem by compressing the gradients, as shown in Figure 1. To ensure no loss of accuracy, DGC employs momentum correction and local gradient clipping on top of the gradient sparsification to maintain model performance. DGC also uses momentum factor masking and warmup training to overcome the staleness problem caused by reduced communication.
35
+
36
+ We empirically verified Deep Gradient Compression on a wide range of tasks, models, and datasets: CNN for image classification (with Cifar10 and ImageNet), RNN for language modeling (with Penn Treebank) and speech recognition (with Librispeech Corpus). These experiments demonstrate that gradients can be compressed up to $6 0 0 \times$ without loss of accuracy, which is an order of magnitude higher than previous work (Aji & Heafield, 2017).
37
+
38
+ # 2 RELATED WORK
39
+
40
+ Researchers have proposed many approaches to overcome the communication bottleneck in distributed training. For instance, asynchronous SGD accelerates the training by removing gradient synchronization and updating parameters immediately once a node has completed back-propagation (Dean et al., 2012; Recht et al., 2011; Li et al., 2014). Gradient quantization and sparsification to reduce communication data size are also extensively studied.
41
+
42
+ Gradient Quantization Quantizing the gradients to low-precision values can reduce the communication bandwidth. Seide et al. (2014) proposed 1-bit SGD to reduce gradients transfer data size and achieved $1 0 \times$ speedup in traditional speech applications. Alistarh et al. (2016) proposed another approach called QSGD which balance the trade-off between accuracy and gradient precision. Similar to QSGD, Wen et al. (2017) developed TernGrad which uses 3-level gradients. Both of these works demonstrate the convergence of quantized training, although TernGrad only examined CNNs and QSGD only examined the training loss of RNNs. There are also attempts to quantize the entire model, including gradients. DoReFa-Net (Zhou et al., 2016) uses 1-bit weights with 2-bit gradients.
43
+
44
+ Gradient Sparsification Strom (2015) proposed threshold quantization to only send gradients larger than a predefined constant threshold. However, the threshold is hard to choose in practice. Therefore, Dryden et al. (2016) chose a fixed proportion of positive and negative gradient updates separately, and Aji & Heafield (2017) proposed Gradient Dropping to sparsify the gradients by a single threshold based on the absolute value. To keep the convergence speed, Gradient Dropping
45
+
46
+ # Algorithm 1 Gradient Sparsification on node $k$
47
+
48
+ Input: dataset $\chi$
49
+ Input: minibatch size $^ { b }$ per node
50
+ Input: the number of nodes $N$
51
+ Input: optimization function $S G D$
52
+ Input: init parameters $w = \{ w [ 0 ] , w [ 1 ] , \cdot \cdot \cdot , w [ M ] \}$
53
+ 1: $G ^ { k } 0$
54
+ 2: for $t = 0 , 1 , \cdots$ do
55
+ 3: $G _ { t } ^ { k } \gets \hat { G } _ { t - 1 } ^ { k }$
56
+ 4: for $i = 1 , \cdots , b \bullet$ do
57
+ 5: Sample data $x$ from $\chi$
58
+ 6: $\begin{array} { r } { G _ { t } ^ { k } \stackrel { \cdot } { } G _ { t } ^ { k } + \frac { 1 } { N b } \nabla f \tilde { ( } x ; w _ { t } ) } \end{array}$
59
+ 7: end for
60
+ 8: for $j = 0 , \cdots , M$ do
61
+ 9: Select threshold: $t h r s \%$ of $\left. G _ { t } ^ { k } [ j ] \right.$
62
+ 10: $\begin{array} { r l } & { M a s k | G _ { t } ^ { k } [ j ] | > t h r } \\ & { \widetilde { G } _ { t } ^ { k } [ j ] G _ { t } ^ { k } [ j ] \odot M a s k } \\ & { G _ { t } ^ { k } [ j ] G _ { t } ^ { k } [ j ] \odot \neg M a s k } \end{array}$
63
+ 11:
64
+ 12:
65
+ 13: 14: $A l l$ d for-reduce $\begin{array} { r } { G _ { t } ^ { k } : G _ { t } \gets \sum _ { k = 1 } ^ { N } e n c o d e ( \widetilde { G } _ { t } ^ { k } ) } \end{array}$
66
+ 15: $w _ { t + 1 } \gets S G D \left( w _ { t } , G _ { t } \right)$
67
+ 16: end for
68
+
69
+ ![](images/124b78f7ccaaa13342437c8a70de1680a2c9c82ac80fc3a7636059550529fc06.jpg)
70
+ Figure 2: Momentum Correction
71
+
72
+ requires adding the layer normalization(Lei Ba et al., 2016). Gradient Dropping saves $9 9 \%$ of gradient exchange while incurring $0 . 3 \%$ loss of BLEU score on a machine translation task. Concurrently, Chen et al. (2017) proposed to automatically tunes the compression rate depending on local gradient activity, and gained compression ratio around $2 0 0 \times$ for fully-connected layers and $4 0 \times$ for convolutional layers with negligible degradation of top-1 accuracy on ImageNet dataset.
73
+
74
+ Compared to the previous work, DGC pushes the gradient compression ratio to up to $6 0 0 \times$ for the whole model (same compression ratio for all layers). DGC does not require extra layer normalization, and thus does not need to change the model structure. Most importantly, Deep Gradient Compression results in no loss of accuracy.
75
+
76
+ # 3 DEEP GRADIENT COMPRESSION
77
+
78
+ # 3.1 GRADIENT SPARSIFICATION
79
+
80
+ We reduce the communication bandwidth by sending only the important gradients (sparse update). We use the gradient magnitude as a simple heuristics for importance: only gradients larger than a threshold are transmitted. To avoid losing information, we accumulate the rest of the gradients locally. Eventually, these gradients become large enough to be transmitted. Thus, we send the large gradients immediately but eventually send all of the gradients over time, as shown in Algorithm 1. The encode() function packs the 32-bit nonzero gradient values and 16-bit run lengths of zeros.
81
+
82
+ The insight is that the local gradient accumulation is equivalent to increasing the batch size over time. Let $F ( w )$ be the loss function which we want to optimize. Synchronous Distributed SGD performs the following update with $N$ training nodes in total:
83
+
84
+ $$
85
+ F ( w ) = \frac { 1 } { | \chi | } \sum _ { x \in \chi } f ( x , w ) , \qquad w _ { t + 1 } = w _ { t } - \eta \frac { 1 } { N b } \sum _ { k = 1 } ^ { N } \sum _ { x \in \mathcal { B } _ { k , t } } \nabla f ( x , w _ { t } )
86
+ $$
87
+
88
+ where $\chi$ is the training dataset, $w$ are the weights of a network, $f ( x , w )$ is the loss computed from samples $x \in \chi , \eta$ is the learning rate, $N$ is the number of training nodes, and $B _ { k , t }$ for $1 \leq k < N$ is a sequence of $N$ minibatches sampled from $\chi$ at iteration $t$ , each of size $b$ .
89
+
90
+ Consider the weight value $w ^ { ( i ) }$ of $i$ -th position in flattened weights $w$ . After $T$ iterations, we have
91
+
92
+ $$
93
+ w _ { t + T } ^ { ( i ) } = w _ { t } ^ { ( i ) } - \eta T \cdot \frac { 1 } { N b T } \sum _ { k = 1 } ^ { N } \left( \sum _ { \tau = 0 } ^ { T - 1 } \sum _ { x \in \mathcal { B } _ { k , t + \tau } } \nabla ^ { ( i ) } f ( x , w _ { t + \tau } ) \right)
94
+ $$
95
+
96
+ Equation 2 shows that local gradient accumulation can be considered as increasing the batch size from $N b$ to $N b T$ (the second summation over $\tau$ ), where $T$ is the length of the sparse update interval between two iterations at which the gradient of $w ^ { ( i ) }$ is sent. Learning rate scaling (Goyal et al., 2017) is a commonly used technique to deal with large minibatch. It is automatically satisfied in Equation 2 where the $T$ in the learning rate $\eta T$ and batch size $N b T$ are canceled out.
97
+
98
+ # 3.2 IMPROVING THE LOCAL GRADIENT ACCUMULATION
99
+
100
+ Without care, the sparse update will greatly harm convergence when sparsity is extremely high (Chen et al., 2017). For example, Algorithm 1 incurred more than $1 . 0 \%$ loss of accuracy on the Cifar10 dataset, as shown in Figure 3(a). We find momentum correction and local gradient clipping can mitigate this problem.
101
+
102
+ Momentum Correction Momentum SGD is widely used in place of vanilla SGD. However, Algorithm 1 doesn’t directly apply to SGD with the momentum term, since it ignores the discounting factor between the sparse update intervals.
103
+
104
+ Distributed training with vanilla momentum SGD on $N$ training nodes follows (Qian, 1999),
105
+
106
+ $$
107
+ u _ { t } = m u _ { t - 1 } + \sum _ { k = 1 } ^ { N } \left( \nabla _ { k , t } \right) , \quad w _ { t + 1 } = w _ { t } - \eta u _ { t }
108
+ $$
109
+
110
+ where $m$ is the momentum, $N$ is the number of training nodes, and $\begin{array} { r } { \nabla _ { k , t } = \frac { 1 } { N b } \sum _ { x \in { \mathcal { B } _ { k , t } } } \nabla f ( x , w _ { t } ) } \end{array}$
111
+
112
+ Consider the weight value $w ^ { ( i ) }$ of $i$ -th position in flattened weights $w$ . After $T$ iterations, the change in weight value $w ^ { ( i ) }$ shows as follows,
113
+
114
+ $$
115
+ w _ { t + T } ^ { ( i ) } = w _ { t } ^ { ( i ) } - \eta \left[ \cdots + \left( \sum _ { \tau = 0 } ^ { T - 2 } m ^ { \tau } \right) \nabla _ { k , t + 1 } ^ { ( i ) } + \left( \sum _ { \tau = 0 } ^ { T - 1 } m ^ { \tau } \right) \nabla _ { k , t } ^ { ( i ) } \right]
116
+ $$
117
+
118
+ If SGD with the momentum is directly applied to the sparse gradient scenario (line 15 in Algorithm 1), the update rule is no longer equivalent to Equation 3, which becomes:
119
+
120
+ $$
121
+ v _ { k , t } = v _ { k , t - 1 } + \nabla _ { k , t } , \quad u _ { t } = m u _ { t - 1 } + \sum _ { k = 1 } ^ { N } s p a r s e \left( v _ { k , t } \right) , \quad w _ { t + 1 } = w _ { t } - \eta u _ { t }
122
+ $$
123
+
124
+ where the first term is the local gradient accumulation on the training node $k$ . Once the accumulation result $v _ { k , t }$ is larger than a threshold, it will pass hard thresholding in the sparse () function, and be encoded and get sent over the network in the second term. Similarly to the line 12 in Algorithm 1, the accumulation result $v _ { k , t }$ gets cleared by the mask in the sparse $( )$ function.
125
+
126
+ The change in weight value $w ^ { ( i ) }$ after the sparse update interval $T$ becomes,
127
+
128
+ $$
129
+ w _ { t + T } ^ { ( i ) } = w _ { t } ^ { ( i ) } - \eta \left( \cdot \cdot \cdot + \nabla _ { k , t + 1 } ^ { ( i ) } + \nabla _ { k , t } ^ { ( i ) } \right)
130
+ $$
131
+
132
+ The disappearance of the accumulated discounting factor $\scriptstyle \sum _ { \tau = 0 } ^ { T - 1 } m ^ { \tau }$ in Equation 6 compared to Equation 4 leads to the loss of convergence performance. It is illustrated in Figure 2(a), where Equation 4 drives the optimization from point $A$ to point $B$ , but with local gradient accumulation, Equation 4 goes to point $C$ . When the gradient sparsity is high, the update interval $T$ dramatically increases, and thus the significant side effect will harm the model performance. To avoid this error, we need momentum correction on top of Equation 5 to make sure the sparse update is equivalent to the dense update as in Equation 3.
133
+
134
+ If we regard the velocity $u _ { t }$ in Equation 3 as ”gradient”, the second term of Equation 3 can be considered as the vanilla SGD for the ”gradient” $u _ { t }$ . The local gradient accumulation is proved to be effective for the vanilla SGD in Section 3.1. Therefore, we can locally accumulate the velocity $u _ { t }$ instead of the real gradient $\nabla _ { k , t }$ to migrate Equation 5 to approach Equation 3:
135
+
136
+ $$
137
+ u _ { k , t } = m u _ { k , t - 1 } + \nabla _ { k , t } , \quad v _ { k , t } = v _ { k , t - 1 } + u _ { k , t } , \quad w _ { t + 1 } = w _ { t } - \eta \sum _ { k = 1 } ^ { N } s p a r s e \left( v _ { k , t } \right) ,
138
+ $$
139
+
140
+ where the first two terms are the corrected local gradient accumulation, and the accumulation result $v _ { k , t }$ is used for the subsequent sparsification and communication. Bumulation, we can deduce the accumulated discounting factor le change in the localin Equation 4 from $\scriptstyle \sum _ { \tau = 0 } ^ { T - 1 } m ^ { \tau }$ Equation 7, as shown in Figure 2(b).
141
+
142
+ We refer to this migration as the momentum correction. It is a tweak to the update equation, it doesn’t incur any hyper parameter. Beyond the vanilla momentum SGD, we also look into Nesterov momentum SGD in Appendix B, which is similar to momentum SGD.
143
+
144
+ Local Gradient Clipping Gradient clipping is widely adopted to avoid the exploding gradient problem (Bengio et al., 1994). The method proposed by Pascanu et al. (2013) rescales the gradients whenever the sum of their L2-norms exceeds a threshold. This step is conventionally executed after gradient aggregation from all nodes. Because we accumulate gradients over iterations on each node independently, we perform the gradient clipping locally before adding the current gradient $G _ { t }$ to previous accumulation $( G _ { t - 1 }$ in Algorithm 1). As explained in Appendix C, we scale the threshold by $N ^ { - 1 / 2 }$ , the current node’s fraction of the global threshold if all $N$ nodes had identical gradient distributions. In practice, we find that the local gradient clipping behaves very similarly to the vanilla gradient clipping in training, which suggests that our assumption might be valid in real-world data.
145
+
146
+ As we will see in Section 4, momentum correction and local gradient clipping help improve the word error rate from $1 4 . 1 \%$ to $1 2 . 9 \%$ on the AN4 corpus, while training curves follow the momentum SGD more closely.
147
+
148
+ # 3.3 OVERCOMING THE STALENESS EFFECT
149
+
150
+ Because we delay the update of small gradients, when these updates do occur, they are outdated or stale. In our experiments, most of the parameters are updated every 600 to 1000 iterations when gradient sparsity is $9 9 . 9 \%$ , which is quite long compared to the number of iterations per epoch. Staleness can slow down convergence and degrade model performance. We mitigate staleness with momentum factor masking and warm-up training.
151
+
152
+ Momentum Factor Masking Mitliagkas et al. (2016) discussed the staleness caused by asynchrony and attributed it to a term described as implicit momentum. Inspired by their work, we introduce momentum factor masking, to alleviate staleness. Instead of searching for a new momentum coefficient as suggested in Mitliagkas et al. (2016), we simply apply the same mask to both the accumulated gradients $v _ { k , t }$ and the momentum factor $u _ { k , t }$ in Equation 7:
153
+
154
+ $$
155
+ M a s k \gets | v _ { k , t } | > t h r , \quad v _ { k , t } \gets v _ { k , t } \odot \neg M a s k , \quad u _ { k , t } \gets u _ { k , t } \odot \neg M a s k
156
+ $$
157
+
158
+ This mask stops the momentum for delayed gradients, preventing the stale momentum from carrying the weights in the wrong direction.
159
+
160
+ Warm-up Training In the early stages of training, the network is changing rapidly, and the gradients are more diverse and aggressive. Sparsifying gradients limits the range of variation of the model, and thus prolongs the period when the network changes dramatically. Meanwhile, the remaining aggressive gradients from the early stage are accumulated before being chosen for the next update, and therefore they may outweigh the latest gradients and misguide the optimization direction. The warm-up training method introduced in large minibatch training (Goyal et al., 2017) is helpful. During the warm-up period, we use a less aggressive learning rate to slow down the changing speed of the neural network at the start of training, and also less aggressive gradient sparsity, to reduce the number of extreme gradients being delayed. Instead of linearly ramping up the learning rate during the first several epochs, we exponentially increase the gradient sparsity from a relatively small value to the final value, in order to help the training adapt to the gradients of larger sparsity.
161
+
162
+ Table 1: Techniques in Deep Gradient Compression
163
+
164
+ <table><tr><td rowspan=1 colspan=1>Techniques</td><td rowspan=1 colspan=1>Gradient DeepDropping Gradient(Aji &amp; Heafield,2017) Compression</td><td rowspan=1 colspan=1>Overcome StalenessReduce Ensure MaintainImproveBandwidthConvergenceAccuracyConvergenceIterations</td></tr><tr><td rowspan=1 colspan=1>GradientSparsification</td><td rowspan=1 colspan=1>√</td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1>Local GradientAccumulation</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1>MomentumCorrection</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1>Local GradientClipping</td><td rowspan=1 colspan=1>√</td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1>MomentumFactor Masking</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>√</td></tr><tr><td rowspan=1 colspan=1>Warm-upTraining</td><td rowspan=1 colspan=1>√</td><td rowspan=1 colspan=1>√ √</td></tr></table>
165
+
166
+ As shown in Table 1, momentum correction and local gradient clipping improve the local gradient accumulation, while the momentum factor masking and warm-up training alleviate the staleness effect. On top of gradient sparsification and local gradient accumulation, these four techniques make up the Deep Gradient Compression (pseudo code in Appendix D), and help push the gradient compression ratio higher while maintaining the accuracy.
167
+
168
+ # 4 EXPERIMENTS
169
+
170
+ # 4.1 EXPERIMENT SETTINGS
171
+
172
+ We validate our approach on three types of machine learning tasks: image classification on Cifar10 and ImageNet, language modeling on Penn Treebank dataset, and speech recognition on AN4 and Librispeech corpus. The only hyper-parameter introduced by Deep Gradient Compression is the warm-up training strategy. In all experiments related to DGC, we rise the sparsity in the warm-up period as follows: $7 5 \%$ , $9 3 . 7 5 \%$ , $9 8 . 4 3 7 5 \%$ , $9 9 . 6 \%$ , $9 9 . 9 \%$ (exponentially increase till $9 9 . 9 \%$ ). We evaluate the reduction in the network bandwidth by the gradient compression ratio as follows,
173
+
174
+ $$
175
+ \mathrm { \ " { s r a d i e n t } ~ C o m p r e s s i o n ~ R a t i o } = s i z e \left[ e n c o d e \left( s p a r s e ( G ^ { k } ) \right) \right] / s i z e \left[ G ^ { k } \right]
176
+ $$
177
+
178
+ where $G ^ { k }$ is the gradients computed on the training node $k$ .
179
+
180
+ Image Classification We studied ResNet-110 on Cifar10, AlexNet and ResNet-50 on ImageNet. Cifar10 consists of 50,000 training images and 10,000 validation images in 10 classes (Krizhevsky & Hinton, 2009), while ImageNet contains over 1 million training images and 50,000 validation images in 1000 classes (Deng et al., 2009). We train the models with momentum SGD following the training schedule in Gross & Wilber (2016). The warm-up period for DGC is 4 epochs out of164 epochs for Cifar10 and 4 epochs out of 90 epochs for ImageNet Dataset.
181
+
182
+ Language Modeling The Penn Treebank corpus (PTB) dataset consists of 923,000 training, 73,000 validation and 82,000 test words (Marcus et al., 1993). The vocabulary we select is the same as the one in Mikolov et al. (2010). We adopt the 2-layer LSTM language model architecture with 1500 hidden units per layer (Press & Wolf, 2016), tying the weights of encoder and decoder as suggested in Inan et al. (2016) and using vanilla SGD with gradient clipping, while learning rate decays when no improvement has been made in validation loss. The warm-up period is 1 epoch out of 40 epochs.
183
+
184
+ Table 2: ResNet-110 trained on Cifar10 Dataset
185
+
186
+ <table><tr><td># GPUs in total</td><td>Batchsize in total per iteration</td><td>Training Method</td><td>Top 1 Accuracy</td><td></td></tr><tr><td rowspan="3">4</td><td rowspan="3">128</td><td>Baseline</td><td>93.75%</td><td></td></tr><tr><td>Gradient Dropping (Aji &amp; Heafield, 2017)</td><td>92.75%</td><td>-1.00%</td></tr><tr><td>Deep Gradient Compression</td><td>93.87%</td><td>+0.12%</td></tr><tr><td rowspan="3">8</td><td rowspan="3">256</td><td>Baseline</td><td>92.92%</td><td></td></tr><tr><td>Gradient Dropping (Aji &amp; Heafield,2017)</td><td>93.02%</td><td>+0.10%</td></tr><tr><td>Deep Gradient Compression</td><td>93.28%</td><td>+0.37%</td></tr><tr><td rowspan="3">16</td><td rowspan="3">512</td><td>Baseline</td><td>93.14%</td><td>-0.21%</td></tr><tr><td>Gradient Dropping (Aji &amp; Heafield, 2017)</td><td>92.93%</td><td></td></tr><tr><td>Deep Gradient Compression</td><td>93.20%</td><td>+0.06%</td></tr><tr><td rowspan="3">32</td><td rowspan="3">1024</td><td>Baseline</td><td>93.10%</td><td></td></tr><tr><td>Gradient Dropping (Aji &amp; Heafield, 2017)</td><td>92.10%</td><td>-1.00%</td></tr><tr><td>Deep Gradient Compression</td><td>93.18%</td><td>+0.08%</td></tr></table>
187
+
188
+ Table 3: Comparison of gradient compression ratio on ImageNet Dataset
189
+
190
+ <table><tr><td>Model</td><td>Training Method</td><td>Top-1 Accuracy</td><td>Top-5 Accuracy</td><td>Gradient Size</td><td>Compression Ratio</td></tr><tr><td rowspan="5">AlexNet</td><td>Baseline</td><td>58.17%</td><td>80.19%</td><td>232.56 MB</td><td>1x</td></tr><tr><td>TernGrad</td><td>57.28%</td><td>80.23%</td><td>1 29.18 MB</td><td>8×</td></tr><tr><td>(Wen et al., 2017) Deep Gradient</td><td>(-0.89%) 58.20%</td><td>(+0.04%) 80.20%</td><td>2</td><td></td></tr><tr><td>Compression</td><td>(+0.03%)</td><td>(+0.01%)</td><td>0.39 MB</td><td>597 ×</td></tr><tr><td>Baseline</td><td>75.96</td><td>92.91%</td><td>97.49 MB</td><td>1×</td></tr><tr><td>ResNet-50</td><td>Deep Gradient Compression</td><td>76.15 (+0.19%)</td><td>92.97% (+0.06%)</td><td>0.35 MB</td><td>277×</td></tr></table>
191
+
192
+ Speech Recognition The AN4 dataset contains 948 training and 130 test utterances (Acero, 1990) while Librispeech corpus contains 960 hours of reading speech (Panayotov et al., 2015). We use DeepSpeech architecture without $\mathbf { n }$ -gram language model, which is a multi-layer RNN following a stack of convolution layers (Hannun et al., 2014). We train a 5-layer LSTM of 800 hidden units per layer for AN4, and a 7-layer GRU of 1200 hidden units per layer for LibriSpeech, with Nesterov momentum $S G D$ and gradient clipping, while learning rate anneals every epoch. The warm-up period for DGC is 1 epoch out of 80 epochs.
193
+
194
+ # 4.2 RESULTS AND ANALYSIS
195
+
196
+ We first examine Deep Gradient Compression on image classification task. Figure 3(a) and 3(b) are the Top-1 accuracy and training loss of ResNet-110 on Cifar10 with 4 nodes. The gradient sparsity is $9 9 . 9 \%$ (only $0 . 1 \%$ is non-zero). The learning curve of Gradient Dropping (Aji & Heafield, 2017) (red) is worse than the baseline due to gradient staleness. With momentum correction (yellow), the learning curve converges slightly faster, and the accuracy is much closer to the baseline. With momentum factor masking and warm-up training techniques (blue), gradient staleness is eliminated, and the learning curve closely follows the baseline. Table 2 shows the detailed accuracy. The accuracy of ResNet-110 is fully maintained while using Deep Gradient Compression.
197
+
198
+ When scaling to the large-scale dataset, Figure 3(c) and 3(d) show the learning curve of ResNet-50 when the gradient sparsity is $9 9 . 9 \%$ . The accuracy fully matches the baseline. An interesting observation is that the top-1 error of training with sparse gradients decreases faster than the baseline with the same training loss. Table 3 shows the results of AlexNet and ResNet-50 training on ImageNet with 4 nodes. We compare the gradient compression ratio with Terngrad (Wen et al., 2017) on AlexNet (ResNet is not studied in Wen et al. (2017)). Deep Gradient Compression gives $7 5 \times$ better compression than Terngrad with no loss of accuracy. For ResNet-50, the compression ratio is slightly lower ( $2 7 7 \times$ vs. $5 9 7 \times$ ) with a slight increase in accuracy.
199
+
200
+ ![](images/e656c450092c001f7c593a39af68523f3d343082b527c6df59aca5c41a496228.jpg)
201
+ Figure 3: Learning curves of ResNet in image classification task (the gradient sparsity is $9 9 . 9 \%$ ).
202
+
203
+ Table 4: Training results of language modeling and speech recognition with 4 nodes
204
+
205
+ <table><tr><td rowspan=1 colspan=1>Task</td><td rowspan=1 colspan=3>Language Modeling on PTB</td><td rowspan=1 colspan=3> Speech Recognition on LibriSpeech</td></tr><tr><td rowspan=2 colspan=1>TrainingMethod</td><td rowspan=2 colspan=1>Perplexity</td><td rowspan=2 colspan=1>GradientSize</td><td rowspan=2 colspan=1>CompressionRatio</td><td rowspan=1 colspan=1>Word Error Rate (WER)</td><td rowspan=2 colspan=1>GradientSize</td><td rowspan=2 colspan=1>CompressionRatio</td></tr><tr><td rowspan=1 colspan=1>test-clean test-other</td></tr><tr><td rowspan=1 colspan=1>Baseline</td><td rowspan=1 colspan=1>72.30</td><td rowspan=1 colspan=1>194.68MB</td><td rowspan=1 colspan=1>1x</td><td rowspan=1 colspan=1>9.45% 27.07%</td><td rowspan=1 colspan=1>488.08 MB</td><td rowspan=1 colspan=1>1x</td></tr><tr><td rowspan=1 colspan=1>Deep GradientCompression</td><td rowspan=1 colspan=1>72.24(-0.06)</td><td rowspan=1 colspan=1>0.42 MB</td><td rowspan=1 colspan=1>462 ×</td><td rowspan=1 colspan=1>9.06% 27.04%(-0.39%) (-0.03%)</td><td rowspan=1 colspan=1>0.74 MB</td><td rowspan=1 colspan=1>608×</td></tr></table>
206
+
207
+ For language modeling, Figure 4 shows the perplexity and training loss of the language model trained with 4 nodes when the gradient sparsity is $9 9 . 9 \%$ . The training loss with Deep Gradient Compression closely match the baseline, so does the validation perplexity. From Table 4, Deep Gradient Compression compresses the gradient by $4 6 2 \times$ with a slight reduction in perplexity.
208
+
209
+ For speech recognition, Figure 5 shows the word error rate (WER) and training loss curve of 5-layer LSTM on AN4 Dataset with 4 nodes when the gradient sparsity is $9 9 . 9 \%$ . The learning curves show the same improvement acquired from techniques in Deep Gradient Compression as for the image network. Table 4 shows word error rate (WER) performance on LibriSpeech test dataset, where test-clean contains clean speech and test-other noisy speech. The model trained with Deep Gradient Compression gains better recognition ability on both clean and noisy speech, even when gradients size is compressed by $6 0 8 \times$ .
210
+
211
+ # 5 SYSTEM ANALYSIS AND PERFORMANCE
212
+
213
+ Implementing DGC requires gradient top- $k$ selection. Given the target sparsity ratio of $9 9 . 9 \%$ , we need to pick the top $0 . 1 \%$ largest over millions of weights. Its complexity is $O ( n )$ , where $n$ is the number of the gradient elements (Cormen, 2009). We propose to use sampling to reduce top- $k$ selection time. We sample only $0 . 1 \%$ to $1 \%$ of the gradients and perform top- $k$ selection on the samples to estimate the threshold for the entire population. If the number of gradients exceeding the threshold is far more than expected, a precise threshold is calculated from the already-selected gradients. Hierarchically calculating the threshold significantly reduces top- $k$ selection time. In practice, total extra computation time is negligible compared to network communication time which is usually from hundreds of milliseconds to several seconds depending on the network bandwidth.
214
+
215
+ ![](images/da729b546b722eb99540362f021c38de97675aa8a17d5ae1cd3d1a74da50f94a.jpg)
216
+ Figure 4: Perplexity and training loss of LSTM language model on PTB dataset (the gradient sparsity is $9 9 . 9 \%$ ).
217
+
218
+ ![](images/bb4e3055bd7875c3516526a76cdc8c3060114f813f5a668f138b55bd3fbae26b.jpg)
219
+ Figure 5: WER and training loss of 5-layer LSTM on AN4 (the gradient sparsity is $9 9 . 9 \%$
220
+
221
+ ![](images/94ecc53592aacda14a957cf87a0316a83bf0163aa1dd7c6c51ff89d2d819db0b.jpg)
222
+
223
+ ![](images/01aa745236eba55636af83f7a478017e6ef9f97dacffb205e6d02938d815c04f.jpg)
224
+ Figure 6: Deep Gradient Compression improves the speedup and scalability of distributed training. Each training node has 4 NVIDIA Titan XP GPUs and one PCI switch.
225
+
226
+ We use the performance model proposed in Wen et al. (2017) to perform the scalability analysis, combining the lightweight profiling on single training node with the analytical communication modeling. With the all-reduce communication model (Rabenseifner, 2004; Bruck et al., 1997), the density of sparse data doubles at every aggregation step in the worst case. However, even considering this effect, Deep Gradient Compression still significantly reduces the network communication time, as implied in Figure 6.
227
+
228
+ Figure 6 shows the speedup of multi-node training compared with single-node training. Conventional training achieves much worse speedup with 1Gbps (Figure 6(a)) than 10Gbps Ethernet (Figure 6(b)). Nonetheless, Deep Gradient Compression enables the training with 1Gbps Ethernet to be competitive with conventional training with 10Gbps Ethernet. For instance, when training AlexNet with 64 nodes, conventional training only achieves about $3 0 \times$ speedup with 10Gbps Ethernet (Apache, 2016), while with DGC, more than $4 0 \times$ speedup is achieved with only 1Gbps Ethernet. From the comparison of Figure 6(a) and 6(b), Deep Gradient Compression benefits even more when the communication-to-computation ratio of the model is higher and the network bandwidth is lower.
229
+
230
+ # 6 CONCLUSION
231
+
232
+ Deep Gradient Compression (DGC) compresses the gradient by $2 7 0 { - } 6 0 0 \times$ for a wide range of CNNs and RNNs. To achieve this compression without slowing down the convergence, DGC employs momentum correction, local gradient clipping, momentum factor masking and warm-up training. We further propose hierarchical threshold selection to speed up the gradient sparsification process. Deep Gradient Compression reduces the required communication bandwidth and improves the scalability of distributed training with inexpensive, commodity networking infrastructure.
233
+
234
+ # 7 ACKNOWLEDGEMENT
235
+
236
+ This work was supported by National Natural Science Foundation of China (No.61622403), Tsinghua University Initiative Scientific Research Program and Beijing National Research Center for Information Science and Technology. We are also thankful to reviewers for their helpful suggestions.
237
+
238
+ # REFERENCES
239
+
240
+ Alejandro Acero. Acoustical and environmental robustness in automatic speech recognition. In Proc. of ICASSP, 1990.
241
+
242
+ Alham Fikri Aji and Kenneth Heafield. Sparse communication for distributed gradient descent. In Empirical Methods in Natural Language Processing (EMNLP), 2017.
243
+
244
+ Dan Alistarh, Jerry Li, Ryota Tomioka, and Milan Vojnovic. Qsgd: Randomized quantization for communication-optimal stochastic gradient descent. arXiv preprint arXiv:1610.02132, 2016.
245
+
246
+ Apache. Image classification with mxnet. https://github.com/apache/incubator-mxnet/ tree/master/example/image-classification, 2016.
247
+
248
+ Yoshua Bengio, Patrice Simard, and Paolo Frasconi. Learning long-term dependencies with gradient descent is difficult. IEEE transactions on neural networks, 5(2):157–166, 1994.
249
+
250
+ Jehoshua Bruck, Ching-Tien Ho, Shlomo Kipnis, Eli Upfal, and Derrick Weathersby. Efficient algorithms for all-to-all communications in multiport message-passing systems. IEEE Transactions on parallel and distributed systems, 8(11):1143–1156, 1997.
251
+
252
+ Chia-Yu Chen, Jungwook Choi, Daniel Brand, Ankur Agrawal, Wei Zhang, and Kailash Gopalakrishnan. Adacomp: Adaptive residual gradient compression for data-parallel distributed training. arXiv preprint arXiv:1712.02679, 2017.
253
+
254
+ Trishul M Chilimbi, Yutaka Suzue, Johnson Apacible, and Karthik Kalyanaraman. Project adam: Building an efficient and scalable deep learning training system. In OSDI, volume 14, pp. 571–582, 2014.
255
+
256
+ Thomas H Cormen. Introduction to algorithms. MIT press, 2009.
257
+
258
+ Jeffrey Dean, Greg Corrado, Rajat Monga, Kai Chen, Matthieu Devin, Mark Mao, Andrew Senior, Paul Tucker, Ke Yang, Quoc V Le, et al. Large scale distributed deep networks. In Advances in neural information processing systems, pp. 1223–1231, 2012.
259
+
260
+ J. Deng, W. Dong, R. Socher, L.-J. Li, K. Li, and L. Fei-Fei. ImageNet: A Large-Scale Hierarchical Image Database. In CVPR09, 2009.
261
+
262
+ Nikoli Dryden, Sam Ade Jacobs, Tim Moon, and Brian Van Essen. Communication quantization for dataparallel training of deep neural networks. In Proceedings of the Workshop on Machine Learning in High Performance Computing Environments, pp. 1–8. IEEE Press, 2016.
263
+
264
+ Google. Federated learning: Collaborative machine learning without centralized training data, 2017. URL https://research.googleblog.com/2017/04/ federated-learning-collaborative.html.
265
+
266
+ Priya Goyal, Piotr Dollar, Ross Girshick, Pieter Noordhuis, Lukasz Wesolowski, Aapo Kyrola, Andrew Tulloch, ´ Yangqing Jia, and Kaiming He. Accurate, large minibatch sgd: Training imagenet in 1 hour. arXiv preprint arXiv:1706.02677, 2017.
267
+
268
+ S. Gross and M. Wilber. Training and investigating residual nets. https://github.com/facebook/ fb.resnet.torch, 2016.
269
+
270
+ Awni Hannun, Carl Case, Jared Casper, Bryan Catanzaro, Greg Diamos, Erich Elsen, Ryan Prenger, Sanjeev Satheesh, Shubho Sengupta, Adam Coates, et al. Deep speech: Scaling up end-to-end speech recognition. arXiv preprint arXiv:1412.5567, 2014.
271
+
272
+ Hakan Inan, Khashayar Khosravi, and Richard Socher. Tying word vectors and word classifiers: A loss framework for language modeling. arXiv preprint arXiv:1611.01462, 2016.
273
+
274
+ Jakub Konecnˇ y, H Brendan McMahan, Felix X Yu, Peter Richt \` arik, Ananda Theertha Suresh, and Dave Bacon. ´ Federated learning: Strategies for improving communication efficiency. arXiv preprint arXiv:1610.05492, 2016.
275
+
276
+ Alex Krizhevsky and Geoffrey Hinton. Learning multiple layers of features from tiny images. 2009.
277
+ J. Lei Ba, J. R. Kiros, and G. E. Hinton. Layer Normalization. ArXiv e-prints, July 2016.
278
+ Mu Li, David G Andersen, Alexander J Smola, and Kai Yu. Communication efficient distributed machine learning with the parameter server. In Advances in Neural Information Processing Systems, pp. 19–27, 2014.
279
+ Mitchell P. Marcus, Beatrice Santorini, and Mary Ann Marcinkiewicz. Building a large annotated corpus of english: The penn treebank. COMPUTATIONAL LINGUISTICS, 19(2):313–330, 1993.
280
+ H Brendan McMahan, Eider Moore, Daniel Ramage, Seth Hampson, et al. Communication-efficient learning of deep networks from decentralized data. arXiv preprint arXiv:1602.05629, 2016.
281
+ Tomas Mikolov, Martin Karafiat, Lukas Burget, Jan Cernock ´ y, and Sanjeev Khudanpur. Recurrent neural \` network based language model. In Interspeech, volume 2, pp. 3, 2010.
282
+ Ioannis Mitliagkas, Ce Zhang, Stefan Hadjis, and Christopher Re. Asynchrony begets momentum, with an ´ application to deep learning. In Communication, Control, and Computing (Allerton), 2016 54th Annual Allerton Conference on, pp. 997–1004. IEEE, 2016.
283
+ Philipp Moritz, Robert Nishihara, Ion Stoica, and Michael I Jordan. Sparknet: Training deep networks in spark. arXiv preprint arXiv:1511.06051, 2015.
284
+ Yurii Nesterov. A method of solving a convex programming problem with convergence rate o (1/k2). In Soviet Mathematics Doklady, volume 27, pp. 372–376, 1983.
285
+ Vassil Panayotov, Guoguo Chen, Daniel Povey, and Sanjeev Khudanpur. Librispeech: an asr corpus based on public domain audio books. In Acoustics, Speech and Signal Processing (ICASSP), 2015 IEEE International Conference on, pp. 5206–5210. IEEE, 2015.
286
+ Razvan Pascanu, Tomas Mikolov, and Yoshua Bengio. On the difficulty of training recurrent neural networks. In International Conference on Machine Learning, pp. 1310–1318, 2013.
287
+ Ofir Press and Lior Wolf. Using the output embedding to improve language models. arXiv preprint arXiv:1608.05859, 2016.
288
+ Ning Qian. On the momentum term in gradient descent learning algorithms. Neural networks, 12(1):145–151, 1999.
289
+ Rolf Rabenseifner. Optimization of collective reduction operations. In International Conference on Computational Science, pp. 1–9. Springer, 2004.
290
+ Benjamin Recht, Christopher Re, Stephen Wright, and Feng Niu. Hogwild: A lock-free approach to parallelizing stochastic gradient descent. In Advances in neural information processing systems, pp. 693–701, 2011.
291
+
292
+ Frank Seide, Hao Fu, Jasha Droppo, Gang Li, and Dong Yu. 1-bit stochastic gradient descent and its application to data-parallel distributed training of speech dnns. In Fifteenth Annual Conference of the International Speech Communication Association, 2014.
293
+
294
+ Nikko Strom. Scalable distributed dnn training using commodity gpu cloud computing. In Sixteenth Annual Conference of the International Speech Communication Association, 2015.
295
+
296
+ Wei Wen, Cong Xu, Feng Yan, Chunpeng Wu, Yandan Wang, Yiran Chen, and Hai Li. Terngrad: Ternary gradients to reduce communication in distributed deep learning. In Advances in Neural Information Processing Systems, 2017.
297
+
298
+ Eric P Xing, Qirong Ho, Wei Dai, Jin Kyu Kim, Jinliang Wei, Seunghak Lee, Xun Zheng, Pengtao Xie, Abhimanu Kumar, and Yaoliang Yu. Petuum: A new platform for distributed machine learning on big data. IEEE Transactions on Big Data, 1(2):49–67, 2015.
299
+
300
+ Shuchang Zhou, Yuxin Wu, Zekun Ni, Xinyu Zhou, He Wen, and Yuheng Zou. Dorefa-net: Training low bitwidth convolutional neural networks with low bitwidth gradients. arXiv preprint arXiv:1606.06160, 2016.
301
+
302
+ Martin Zinkevich, Markus Weimer, Lihong Li, and Alex J Smola. Parallelized stochastic gradient descent. In Advances in neural information processing systems, pp. 2595–2603, 2010.
303
+
304
+ # A SYNCHRONOUS DISTRIBUTED STOCHASTIC GRADIENT DESCENT
305
+
306
+ In practice, each training node performs the forward-backward pass on different batches sampled from the training dataset with the same network model. The gradients from all nodes are summed up to optimize their models. By this synchronization step, models on different nodes are always the same during the training. The aggregation step can be achieved in two ways. One method is using the parameter servers as the intermediary which store the parameters among several servers (Dean et al., 2012). The nodes push the gradients to the servers while the servers are waiting for the gradients from all nodes. Once all gradients are sent, the servers update the parameters, and then all nodes pull the latest parameters from the servers. The other method is to perform the All-reduce operation on the gradients among all nodes and to update the parameters on each node independently (Goyal et al., 2017), as shown in Algorithm 2 and Figure 7. In this paper, we adopt the latter approach by default.
307
+
308
+ ![](images/6a08c0a3c8217ddfc8762679dfb0d2ce41f9f699504333c8d85bc675d5029e10.jpg)
309
+
310
+ (a) Each node independently calculates gradients (b) All-reduce operation of gradient aggregation
311
+
312
+ ![](images/cab34d62dbb8bc5a0de99b3b2c221d8236282b11e6cf8dd54c5510e70657cec4.jpg)
313
+ Figure 7: Distributed Synchronous SGD
314
+
315
+ <table><tr><td>Algorithm 2 Distributed Synchronous SGD on node k</td></tr><tr><td>Input: Dataset X Input: minibatch size b per node Input: the number of nodes N Input: Optimization Function SGD Input: Init parameters w = {w[0],·,w[M]} 1: for t =0,1,. do</td></tr></table>
316
+
317
+ # B GRADIENT SPARSIFICATION WITH NESTROV MOMENTUM CORRECTION
318
+
319
+ The conventional update rule for Nesterov momentum SGD (Nesterov, 1983) follows,
320
+
321
+ $$
322
+ u _ { t + 1 } = m u _ { t } + \sum _ { k = 1 } ^ { N } \left( \nabla _ { k , t } \right) , \quad w _ { t + 1 } = w _ { t } - \eta \left( m \cdot u _ { t + 1 } + \nabla _ { t } \right)
323
+ $$
324
+
325
+ where $m$ is the momentum, $N$ is the number of training nodes, and $\begin{array} { r } { \nabla _ { k , t } = \frac { 1 } { N b } \sum _ { x \in { \mathcal { B } _ { k , t } } } \nabla f ( x , w _ { t } ) } \end{array}$ . Before momentum correction, the sparse update follows,
326
+
327
+ $$
328
+ v _ { k , t + 1 } = v _ { k , t } + \nabla _ { k , t } , \quad u _ { t + 1 } = m u _ { t } + \sum _ { k = 1 } ^ { N } s p a r s e \left( v _ { k , t + 1 } \right) , \quad w _ { t + 1 } = w _ { t } - \eta u _ { t + 1 }
329
+ $$
330
+
331
+ After momentum correction sharing the same methodology with Equation 7, it becomes,
332
+
333
+ $$
334
+ \iota _ { k , t + 1 } = m u _ { k , t } + \nabla _ { k , t } , \quad v _ { k , t + 1 } = v _ { k , t } + \left( m \cdot u _ { k , t + 1 } + \nabla _ { k , t } \right) , \quad w _ { t + 1 } = w _ { t } - \eta \sum _ { k = 1 } ^ { N } s p a r s e \left( v _ { k , t + 1 } \right) .
335
+ $$
336
+
337
+ # C LOCAL GRADIENT CLIPPING
338
+
339
+ When training the recurrent neural network with gradient clipping, we perform the gradient clipping locally before adding the current gradient $G _ { t } ^ { k }$ to previous accumulation $G _ { t - 1 } ^ { k }$ in Algorithm 1. Denote the origin threshold for the gradients L2-norm $| | G | | _ { 2 }$ as $t h r _ { G }$ , and the threshold for the local gradients L2-norm $| | G ^ { k } | | _ { 2 }$ as as $t h r _ { G ^ { k } }$ .
340
+
341
+ Assuming all $N$ training nodes have independent identical gradient distributions with the variance $\sigma ^ { 2 }$ , the sum of gradients from all nodes have the variance $N \bar { \sigma } ^ { 2 }$ . Therefore,
342
+
343
+ $$
344
+ E \left[ | | G ^ { k } | | _ { 2 } \right] \approx \sigma , \quad E \left[ | | G | | _ { 2 } \right] \approx N ^ { 1 / 2 } \sigma
345
+ $$
346
+
347
+ Thus, We scale the threshold by $N ^ { - 1 / 2 }$ , the current node’s fraction of the global threshold,
348
+
349
+ $$
350
+ t h r _ { G ^ { k } } = N ^ { - 1 / 2 } \cdot t h r _ { G }
351
+ $$
352
+
353
+ # D DEEP GRADIENT COMPRESSION ALGORITHM
354
+
355
+ <table><tr><td>vanilla momentum SGD on node k</td><td>Algorithm 3 Deep Gradient Compression for Algorithm 4 Deep Gradient Compression for Nesterc momentum SGD on node k</td></tr><tr><td>Input: dataset X</td><td>Input: dataset X</td></tr><tr><td>Input: minibatch size b per node</td><td>Input:minibatch size b per node</td></tr><tr><td>Input: momentum m</td><td>Input: momentum m</td></tr><tr><td></td><td></td></tr><tr><td>Input: the number of nodes N</td><td>Input: the number of nodes N</td></tr><tr><td>Input: optimization function SGD Input: initial parameters w= {w[O],··,w[M]}</td><td>Input: optimization function SGD Input: initial parameters w={w[O],··,w[M]}</td></tr><tr><td>1:Uk ←0,Vk ←0</td><td>1:Uk←0,Vk←0</td></tr><tr><td>2: for t=0,1,.·. do</td><td>2: for t = 0,1,.· do</td></tr><tr><td>3: G←</td><td>3: G←0</td></tr><tr><td>4: fori=1,.,bdo</td><td>4: fori=1,.,bdo</td></tr><tr><td>5: Sample data x from X</td><td>5: Sample data x from X</td></tr><tr><td>G←G+f(x;0t) 6:</td><td>G←G+f(x;0t) 6:</td></tr><tr><td>7: end for</td><td>7: end for</td></tr><tr><td>8: if Gradient Clipping then</td><td>8: if Gradient Clipping then</td></tr><tr><td>9: Gk ← Local-Gradient_Clipping(Gk)</td><td>9: Gl ← Local_Gradient_Clipping(Gt)</td></tr><tr><td>10: end if</td><td>10: end if</td></tr><tr><td>11: U←m.Uk-1+Gk</td><td>11: U←m·(U-1+G&#x27;)</td></tr><tr><td>12: V←V1+U</td><td>12: V←V1+U+G</td></tr><tr><td>13: forj=0,..,M do</td><td>13: for j=0,..,M do</td></tr><tr><td>14: thr ←s%of|V[j]l</td><td>14: thr ←s%of|Vk[j]l</td></tr><tr><td>15: Mask ← |V[j] &gt;thr</td><td>15: Mask ← |V[]| &gt;thr</td></tr><tr><td>G[] ←V Mask 16:</td><td>16: G]←V[j]Mask</td></tr><tr><td>17: V[j] ←Vj]-Mask</td><td>17: V] ←V-Mask</td></tr><tr><td>18: U]←Uj-Mask</td><td>18: U←U-Mask</td></tr><tr><td>19: end for</td><td>19: end for</td></tr><tr><td>20:</td><td>20: All-reduce: Gt ← ∑N 1 encode(G&#x27;)</td></tr><tr><td>21: 0t+1 ← SGD(0t,Gt)</td><td>21: 0t+1 ← SGD(0t,Gt) 22:</td></tr></table>
parse/train/SkhQHMW0W/SkhQHMW0W_content_list.json ADDED
@@ -0,0 +1,1660 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "type": "text",
4
+ "text": "DEEP GRADIENT COMPRESSION: REDUCING THE COMMUNICATION BANDWIDTH FOR DISTRIBUTED TRAINING ",
5
+ "text_level": 1,
6
+ "bbox": [
7
+ 173,
8
+ 99,
9
+ 823,
10
+ 171
11
+ ],
12
+ "page_idx": 0
13
+ },
14
+ {
15
+ "type": "text",
16
+ "text": "Yujun Lin ∗ \nTsinghua University \nBeijing National Research Center \nfor Information Science and Technology \nlinyy14@mails.tsinghua.edu.cn \nSong Han † \nStanford University \nGoogle Brain \nsonghan@stanford.edu ",
17
+ "bbox": [
18
+ 184,
19
+ 195,
20
+ 468,
21
+ 265
22
+ ],
23
+ "page_idx": 0
24
+ },
25
+ {
26
+ "type": "text",
27
+ "text": "",
28
+ "bbox": [
29
+ 540,
30
+ 195,
31
+ 738,
32
+ 251
33
+ ],
34
+ "page_idx": 0
35
+ },
36
+ {
37
+ "type": "text",
38
+ "text": "Huizi Mao Stanford University huizi@stanford.edu ",
39
+ "bbox": [
40
+ 183,
41
+ 286,
42
+ 362,
43
+ 328
44
+ ],
45
+ "page_idx": 0
46
+ },
47
+ {
48
+ "type": "text",
49
+ "text": "Yu Wang ",
50
+ "text_level": 1,
51
+ "bbox": [
52
+ 539,
53
+ 286,
54
+ 604,
55
+ 300
56
+ ],
57
+ "page_idx": 0
58
+ },
59
+ {
60
+ "type": "text",
61
+ "text": "Tsinghua University Beijing National Research Center for Information Science and Technology yu-wang@mail.tsinghua.edu.cn ",
62
+ "bbox": [
63
+ 537,
64
+ 301,
65
+ 812,
66
+ 356
67
+ ],
68
+ "page_idx": 0
69
+ },
70
+ {
71
+ "type": "text",
72
+ "text": "William J. Dally Stanford University NVIDIA dally@stanford.edu ",
73
+ "bbox": [
74
+ 183,
75
+ 377,
76
+ 362,
77
+ 433
78
+ ],
79
+ "page_idx": 0
80
+ },
81
+ {
82
+ "type": "text",
83
+ "text": "ABSTRACT ",
84
+ "text_level": 1,
85
+ "bbox": [
86
+ 454,
87
+ 469,
88
+ 544,
89
+ 484
90
+ ],
91
+ "page_idx": 0
92
+ },
93
+ {
94
+ "type": "text",
95
+ "text": "Large-scale distributed training requires significant communication bandwidth for gradient exchange that limits the scalability of multi-node training, and requires expensive high-bandwidth network infrastructure. The situation gets even worse with distributed training on mobile devices (federated learning), which suffers from higher latency, lower throughput, and intermittent poor connections. In this paper, we find $9 9 . 9 \\%$ of the gradient exchange in distributed SGD are redundant, and propose Deep Gradient Compression (DGC) to greatly reduce the communication bandwidth. To preserve accuracy during this compression, DGC employs four methods: momentum correction, local gradient clipping, momentum factor masking, and warm-up training. We have applied Deep Gradient Compression to image classification, speech recognition, and language modeling with multiple datasets including Cifar10, ImageNet, Penn Treebank, and Librispeech Corpus. On these scenarios, Deep Gradient Compression achieves a gradient compression ratio from $2 7 0 \\times$ to $6 0 0 \\times$ without losing accuracy, cutting the gradient size of ResNet-50 from 97MB to 0.35MB, and for DeepSpeech from 488MB to 0.74MB. Deep gradient compression enables large-scale distributed training on inexpensive commodity 1Gbps Ethernet and facilitates distributed training on mobile. ",
96
+ "bbox": [
97
+ 233,
98
+ 503,
99
+ 764,
100
+ 738
101
+ ],
102
+ "page_idx": 0
103
+ },
104
+ {
105
+ "type": "text",
106
+ "text": "1 INTRODUCTION ",
107
+ "text_level": 1,
108
+ "bbox": [
109
+ 176,
110
+ 767,
111
+ 336,
112
+ 784
113
+ ],
114
+ "page_idx": 0
115
+ },
116
+ {
117
+ "type": "text",
118
+ "text": "Large-scale distributed training improves the productivity of training deeper and larger models (Chilimbi et al., 2014; Xing et al., 2015; Moritz et al., 2015; Zinkevich et al., 2010). Synchronous stochastic gradient descent (SGD) is widely used for distributed training. By increasing the number of training nodes and taking advantage of data parallelism, the total computation time of the forward-backward passes on the same size training data can be dramatically reduced. However, gradient exchange is costly and dwarfs the savings of computation time (Li et al., 2014; Wen et al., ",
119
+ "bbox": [
120
+ 174,
121
+ 800,
122
+ 825,
123
+ 885
124
+ ],
125
+ "page_idx": 0
126
+ },
127
+ {
128
+ "type": "image",
129
+ "img_path": "images/4fc386e290a584c321a5ceece6dddea87170b012d181d7057dd735c2a74c1c93.jpg",
130
+ "image_caption": [
131
+ "Figure 1: Deep Gradient Compression can reduce the communication time, improve the scalability, and speed up distributed training. "
132
+ ],
133
+ "image_footnote": [],
134
+ "bbox": [
135
+ 174,
136
+ 95,
137
+ 825,
138
+ 276
139
+ ],
140
+ "page_idx": 1
141
+ },
142
+ {
143
+ "type": "text",
144
+ "text": "2017), especially for recurrent neural networks (RNN) where the computation-to-communication ratio is low. Therefore, the network bandwidth becomes a significant bottleneck for scaling up distributed training. This bandwidth problem gets even worse when distributed training is performed on mobile devices, such as federated learning (McMahan et al., 2016; Konecnˇ y et al., 2016). Training \\` on mobile devices is appealing due to better privacy and better personalization (Google, 2017), but a critical problem is that those mobile devices suffer from even lower network bandwidth, intermittent network connections, and expensive mobile data plan. ",
145
+ "bbox": [
146
+ 174,
147
+ 339,
148
+ 825,
149
+ 438
150
+ ],
151
+ "page_idx": 1
152
+ },
153
+ {
154
+ "type": "text",
155
+ "text": "Deep Gradient Compression (DGC) solves the communication bandwidth problem by compressing the gradients, as shown in Figure 1. To ensure no loss of accuracy, DGC employs momentum correction and local gradient clipping on top of the gradient sparsification to maintain model performance. DGC also uses momentum factor masking and warmup training to overcome the staleness problem caused by reduced communication. ",
156
+ "bbox": [
157
+ 174,
158
+ 444,
159
+ 825,
160
+ 513
161
+ ],
162
+ "page_idx": 1
163
+ },
164
+ {
165
+ "type": "text",
166
+ "text": "We empirically verified Deep Gradient Compression on a wide range of tasks, models, and datasets: CNN for image classification (with Cifar10 and ImageNet), RNN for language modeling (with Penn Treebank) and speech recognition (with Librispeech Corpus). These experiments demonstrate that gradients can be compressed up to $6 0 0 \\times$ without loss of accuracy, which is an order of magnitude higher than previous work (Aji & Heafield, 2017). ",
167
+ "bbox": [
168
+ 174,
169
+ 521,
170
+ 825,
171
+ 590
172
+ ],
173
+ "page_idx": 1
174
+ },
175
+ {
176
+ "type": "text",
177
+ "text": "2 RELATED WORK ",
178
+ "text_level": 1,
179
+ "bbox": [
180
+ 176,
181
+ 611,
182
+ 344,
183
+ 627
184
+ ],
185
+ "page_idx": 1
186
+ },
187
+ {
188
+ "type": "text",
189
+ "text": "Researchers have proposed many approaches to overcome the communication bottleneck in distributed training. For instance, asynchronous SGD accelerates the training by removing gradient synchronization and updating parameters immediately once a node has completed back-propagation (Dean et al., 2012; Recht et al., 2011; Li et al., 2014). Gradient quantization and sparsification to reduce communication data size are also extensively studied. ",
190
+ "bbox": [
191
+ 174,
192
+ 642,
193
+ 825,
194
+ 712
195
+ ],
196
+ "page_idx": 1
197
+ },
198
+ {
199
+ "type": "text",
200
+ "text": "Gradient Quantization Quantizing the gradients to low-precision values can reduce the communication bandwidth. Seide et al. (2014) proposed 1-bit SGD to reduce gradients transfer data size and achieved $1 0 \\times$ speedup in traditional speech applications. Alistarh et al. (2016) proposed another approach called QSGD which balance the trade-off between accuracy and gradient precision. Similar to QSGD, Wen et al. (2017) developed TernGrad which uses 3-level gradients. Both of these works demonstrate the convergence of quantized training, although TernGrad only examined CNNs and QSGD only examined the training loss of RNNs. There are also attempts to quantize the entire model, including gradients. DoReFa-Net (Zhou et al., 2016) uses 1-bit weights with 2-bit gradients. ",
201
+ "bbox": [
202
+ 174,
203
+ 727,
204
+ 825,
205
+ 838
206
+ ],
207
+ "page_idx": 1
208
+ },
209
+ {
210
+ "type": "text",
211
+ "text": "Gradient Sparsification Strom (2015) proposed threshold quantization to only send gradients larger than a predefined constant threshold. However, the threshold is hard to choose in practice. Therefore, Dryden et al. (2016) chose a fixed proportion of positive and negative gradient updates separately, and Aji & Heafield (2017) proposed Gradient Dropping to sparsify the gradients by a single threshold based on the absolute value. To keep the convergence speed, Gradient Dropping ",
212
+ "bbox": [
213
+ 174,
214
+ 853,
215
+ 823,
216
+ 924
217
+ ],
218
+ "page_idx": 1
219
+ },
220
+ {
221
+ "type": "text",
222
+ "text": "Algorithm 1 Gradient Sparsification on node $k$ ",
223
+ "text_level": 1,
224
+ "bbox": [
225
+ 176,
226
+ 128,
227
+ 462,
228
+ 142
229
+ ],
230
+ "page_idx": 2
231
+ },
232
+ {
233
+ "type": "text",
234
+ "text": "Input: dataset $\\chi$ \nInput: minibatch size $^ { b }$ per node \nInput: the number of nodes $N$ \nInput: optimization function $S G D$ \nInput: init parameters $w = \\{ w [ 0 ] , w [ 1 ] , \\cdot \\cdot \\cdot , w [ M ] \\}$ \n1: $G ^ { k } 0$ \n2: for $t = 0 , 1 , \\cdots$ do \n3: $G _ { t } ^ { k } \\gets \\hat { G } _ { t - 1 } ^ { k }$ \n4: for $i = 1 , \\cdots , b \\bullet$ do \n5: Sample data $x$ from $\\chi$ \n6: $\\begin{array} { r } { G _ { t } ^ { k } \\stackrel { \\cdot } { } G _ { t } ^ { k } + \\frac { 1 } { N b } \\nabla f \\tilde { ( } x ; w _ { t } ) } \\end{array}$ \n7: end for \n8: for $j = 0 , \\cdots , M$ do \n9: Select threshold: $t h r s \\%$ of $\\left. G _ { t } ^ { k } [ j ] \\right.$ \n10: $\\begin{array} { r l } & { M a s k | G _ { t } ^ { k } [ j ] | > t h r } \\\\ & { \\widetilde { G } _ { t } ^ { k } [ j ] G _ { t } ^ { k } [ j ] \\odot M a s k } \\\\ & { G _ { t } ^ { k } [ j ] G _ { t } ^ { k } [ j ] \\odot \\neg M a s k } \\end{array}$ \n11: \n12: \n13: 14: $A l l$ d for-reduce $\\begin{array} { r } { G _ { t } ^ { k } : G _ { t } \\gets \\sum _ { k = 1 } ^ { N } e n c o d e ( \\widetilde { G } _ { t } ^ { k } ) } \\end{array}$ \n15: $w _ { t + 1 } \\gets S G D \\left( w _ { t } , G _ { t } \\right)$ \n16: end for ",
235
+ "bbox": [
236
+ 174,
237
+ 146,
238
+ 493,
239
+ 421
240
+ ],
241
+ "page_idx": 2
242
+ },
243
+ {
244
+ "type": "image",
245
+ "img_path": "images/124b78f7ccaaa13342437c8a70de1680a2c9c82ac80fc3a7636059550529fc06.jpg",
246
+ "image_caption": [
247
+ "Figure 2: Momentum Correction "
248
+ ],
249
+ "image_footnote": [],
250
+ "bbox": [
251
+ 529,
252
+ 117,
253
+ 790,
254
+ 420
255
+ ],
256
+ "page_idx": 2
257
+ },
258
+ {
259
+ "type": "text",
260
+ "text": "requires adding the layer normalization(Lei Ba et al., 2016). Gradient Dropping saves $9 9 \\%$ of gradient exchange while incurring $0 . 3 \\%$ loss of BLEU score on a machine translation task. Concurrently, Chen et al. (2017) proposed to automatically tunes the compression rate depending on local gradient activity, and gained compression ratio around $2 0 0 \\times$ for fully-connected layers and $4 0 \\times$ for convolutional layers with negligible degradation of top-1 accuracy on ImageNet dataset. ",
261
+ "bbox": [
262
+ 173,
263
+ 462,
264
+ 825,
265
+ 534
266
+ ],
267
+ "page_idx": 2
268
+ },
269
+ {
270
+ "type": "text",
271
+ "text": "Compared to the previous work, DGC pushes the gradient compression ratio to up to $6 0 0 \\times$ for the whole model (same compression ratio for all layers). DGC does not require extra layer normalization, and thus does not need to change the model structure. Most importantly, Deep Gradient Compression results in no loss of accuracy. ",
272
+ "bbox": [
273
+ 174,
274
+ 539,
275
+ 825,
276
+ 595
277
+ ],
278
+ "page_idx": 2
279
+ },
280
+ {
281
+ "type": "text",
282
+ "text": "3 DEEP GRADIENT COMPRESSION ",
283
+ "text_level": 1,
284
+ "bbox": [
285
+ 176,
286
+ 619,
287
+ 473,
288
+ 636
289
+ ],
290
+ "page_idx": 2
291
+ },
292
+ {
293
+ "type": "text",
294
+ "text": "3.1 GRADIENT SPARSIFICATION ",
295
+ "text_level": 1,
296
+ "bbox": [
297
+ 176,
298
+ 654,
299
+ 408,
300
+ 667
301
+ ],
302
+ "page_idx": 2
303
+ },
304
+ {
305
+ "type": "text",
306
+ "text": "We reduce the communication bandwidth by sending only the important gradients (sparse update). We use the gradient magnitude as a simple heuristics for importance: only gradients larger than a threshold are transmitted. To avoid losing information, we accumulate the rest of the gradients locally. Eventually, these gradients become large enough to be transmitted. Thus, we send the large gradients immediately but eventually send all of the gradients over time, as shown in Algorithm 1. The encode() function packs the 32-bit nonzero gradient values and 16-bit run lengths of zeros. ",
307
+ "bbox": [
308
+ 174,
309
+ 681,
310
+ 825,
311
+ 766
312
+ ],
313
+ "page_idx": 2
314
+ },
315
+ {
316
+ "type": "text",
317
+ "text": "The insight is that the local gradient accumulation is equivalent to increasing the batch size over time. Let $F ( w )$ be the loss function which we want to optimize. Synchronous Distributed SGD performs the following update with $N$ training nodes in total: ",
318
+ "bbox": [
319
+ 174,
320
+ 772,
321
+ 825,
322
+ 815
323
+ ],
324
+ "page_idx": 2
325
+ },
326
+ {
327
+ "type": "equation",
328
+ "img_path": "images/d3c8238449f53ea823bf258c11239dc8d0c8cfae0e506ac17e531e488a001420.jpg",
329
+ "text": "$$\nF ( w ) = \\frac { 1 } { | \\chi | } \\sum _ { x \\in \\chi } f ( x , w ) , \\qquad w _ { t + 1 } = w _ { t } - \\eta \\frac { 1 } { N b } \\sum _ { k = 1 } ^ { N } \\sum _ { x \\in \\mathcal { B } _ { k , t } } \\nabla f ( x , w _ { t } )\n$$",
330
+ "text_format": "latex",
331
+ "bbox": [
332
+ 261,
333
+ 824,
334
+ 736,
335
+ 871
336
+ ],
337
+ "page_idx": 2
338
+ },
339
+ {
340
+ "type": "text",
341
+ "text": "where $\\chi$ is the training dataset, $w$ are the weights of a network, $f ( x , w )$ is the loss computed from samples $x \\in \\chi , \\eta$ is the learning rate, $N$ is the number of training nodes, and $B _ { k , t }$ for $1 \\leq k < N$ is a sequence of $N$ minibatches sampled from $\\chi$ at iteration $t$ , each of size $b$ . ",
342
+ "bbox": [
343
+ 176,
344
+ 881,
345
+ 823,
346
+ 924
347
+ ],
348
+ "page_idx": 2
349
+ },
350
+ {
351
+ "type": "text",
352
+ "text": "Consider the weight value $w ^ { ( i ) }$ of $i$ -th position in flattened weights $w$ . After $T$ iterations, we have ",
353
+ "bbox": [
354
+ 169,
355
+ 102,
356
+ 813,
357
+ 119
358
+ ],
359
+ "page_idx": 3
360
+ },
361
+ {
362
+ "type": "equation",
363
+ "img_path": "images/c81644f2d37ca151b77aae6cd00ecd4a1bba0bd79a4ea56c2c4052265ce7b376.jpg",
364
+ "text": "$$\nw _ { t + T } ^ { ( i ) } = w _ { t } ^ { ( i ) } - \\eta T \\cdot \\frac { 1 } { N b T } \\sum _ { k = 1 } ^ { N } \\left( \\sum _ { \\tau = 0 } ^ { T - 1 } \\sum _ { x \\in \\mathcal { B } _ { k , t + \\tau } } \\nabla ^ { ( i ) } f ( x , w _ { t + \\tau } ) \\right)\n$$",
365
+ "text_format": "latex",
366
+ "bbox": [
367
+ 285,
368
+ 125,
369
+ 710,
370
+ 176
371
+ ],
372
+ "page_idx": 3
373
+ },
374
+ {
375
+ "type": "text",
376
+ "text": "Equation 2 shows that local gradient accumulation can be considered as increasing the batch size from $N b$ to $N b T$ (the second summation over $\\tau$ ), where $T$ is the length of the sparse update interval between two iterations at which the gradient of $w ^ { ( i ) }$ is sent. Learning rate scaling (Goyal et al., 2017) is a commonly used technique to deal with large minibatch. It is automatically satisfied in Equation 2 where the $T$ in the learning rate $\\eta T$ and batch size $N b T$ are canceled out. ",
377
+ "bbox": [
378
+ 173,
379
+ 181,
380
+ 826,
381
+ 253
382
+ ],
383
+ "page_idx": 3
384
+ },
385
+ {
386
+ "type": "text",
387
+ "text": "3.2 IMPROVING THE LOCAL GRADIENT ACCUMULATION ",
388
+ "text_level": 1,
389
+ "bbox": [
390
+ 174,
391
+ 271,
392
+ 581,
393
+ 286
394
+ ],
395
+ "page_idx": 3
396
+ },
397
+ {
398
+ "type": "text",
399
+ "text": "Without care, the sparse update will greatly harm convergence when sparsity is extremely high (Chen et al., 2017). For example, Algorithm 1 incurred more than $1 . 0 \\%$ loss of accuracy on the Cifar10 dataset, as shown in Figure 3(a). We find momentum correction and local gradient clipping can mitigate this problem. ",
400
+ "bbox": [
401
+ 173,
402
+ 296,
403
+ 825,
404
+ 354
405
+ ],
406
+ "page_idx": 3
407
+ },
408
+ {
409
+ "type": "text",
410
+ "text": "Momentum Correction Momentum SGD is widely used in place of vanilla SGD. However, Algorithm 1 doesn’t directly apply to SGD with the momentum term, since it ignores the discounting factor between the sparse update intervals. ",
411
+ "bbox": [
412
+ 174,
413
+ 369,
414
+ 825,
415
+ 412
416
+ ],
417
+ "page_idx": 3
418
+ },
419
+ {
420
+ "type": "text",
421
+ "text": "Distributed training with vanilla momentum SGD on $N$ training nodes follows (Qian, 1999), ",
422
+ "bbox": [
423
+ 174,
424
+ 417,
425
+ 779,
426
+ 434
427
+ ],
428
+ "page_idx": 3
429
+ },
430
+ {
431
+ "type": "equation",
432
+ "img_path": "images/15bb8402e149dc3429a789ac4c70c7b9a7196933a7e8510a99631c737f11a9ce.jpg",
433
+ "text": "$$\nu _ { t } = m u _ { t - 1 } + \\sum _ { k = 1 } ^ { N } \\left( \\nabla _ { k , t } \\right) , \\quad w _ { t + 1 } = w _ { t } - \\eta u _ { t }\n$$",
434
+ "text_format": "latex",
435
+ "bbox": [
436
+ 339,
437
+ 440,
438
+ 656,
439
+ 486
440
+ ],
441
+ "page_idx": 3
442
+ },
443
+ {
444
+ "type": "text",
445
+ "text": "where $m$ is the momentum, $N$ is the number of training nodes, and $\\begin{array} { r } { \\nabla _ { k , t } = \\frac { 1 } { N b } \\sum _ { x \\in { \\mathcal { B } _ { k , t } } } \\nabla f ( x , w _ { t } ) } \\end{array}$ ",
446
+ "bbox": [
447
+ 171,
448
+ 492,
449
+ 821,
450
+ 511
451
+ ],
452
+ "page_idx": 3
453
+ },
454
+ {
455
+ "type": "text",
456
+ "text": "Consider the weight value $w ^ { ( i ) }$ of $i$ -th position in flattened weights $w$ . After $T$ iterations, the change in weight value $w ^ { ( i ) }$ shows as follows, ",
457
+ "bbox": [
458
+ 176,
459
+ 518,
460
+ 823,
461
+ 550
462
+ ],
463
+ "page_idx": 3
464
+ },
465
+ {
466
+ "type": "equation",
467
+ "img_path": "images/ead087014a331c4c320e69d7e4a04f3441b82b650433a06ca276b51d8dc50eb2.jpg",
468
+ "text": "$$\nw _ { t + T } ^ { ( i ) } = w _ { t } ^ { ( i ) } - \\eta \\left[ \\cdots + \\left( \\sum _ { \\tau = 0 } ^ { T - 2 } m ^ { \\tau } \\right) \\nabla _ { k , t + 1 } ^ { ( i ) } + \\left( \\sum _ { \\tau = 0 } ^ { T - 1 } m ^ { \\tau } \\right) \\nabla _ { k , t } ^ { ( i ) } \\right]\n$$",
469
+ "text_format": "latex",
470
+ "bbox": [
471
+ 282,
472
+ 558,
473
+ 715,
474
+ 602
475
+ ],
476
+ "page_idx": 3
477
+ },
478
+ {
479
+ "type": "text",
480
+ "text": "If SGD with the momentum is directly applied to the sparse gradient scenario (line 15 in Algorithm 1), the update rule is no longer equivalent to Equation 3, which becomes: ",
481
+ "bbox": [
482
+ 169,
483
+ 614,
484
+ 825,
485
+ 643
486
+ ],
487
+ "page_idx": 3
488
+ },
489
+ {
490
+ "type": "equation",
491
+ "img_path": "images/60dfd25e7b27acd7a860e41d73d6ca539daa0c3fd4b39664f634ca8ef33c9a92.jpg",
492
+ "text": "$$\nv _ { k , t } = v _ { k , t - 1 } + \\nabla _ { k , t } , \\quad u _ { t } = m u _ { t - 1 } + \\sum _ { k = 1 } ^ { N } s p a r s e \\left( v _ { k , t } \\right) , \\quad w _ { t + 1 } = w _ { t } - \\eta u _ { t }\n$$",
493
+ "text_format": "latex",
494
+ "bbox": [
495
+ 236,
496
+ 650,
497
+ 761,
498
+ 694
499
+ ],
500
+ "page_idx": 3
501
+ },
502
+ {
503
+ "type": "text",
504
+ "text": "where the first term is the local gradient accumulation on the training node $k$ . Once the accumulation result $v _ { k , t }$ is larger than a threshold, it will pass hard thresholding in the sparse () function, and be encoded and get sent over the network in the second term. Similarly to the line 12 in Algorithm 1, the accumulation result $v _ { k , t }$ gets cleared by the mask in the sparse $( )$ function. ",
505
+ "bbox": [
506
+ 173,
507
+ 700,
508
+ 825,
509
+ 758
510
+ ],
511
+ "page_idx": 3
512
+ },
513
+ {
514
+ "type": "text",
515
+ "text": "The change in weight value $w ^ { ( i ) }$ after the sparse update interval $T$ becomes, ",
516
+ "bbox": [
517
+ 173,
518
+ 765,
519
+ 674,
520
+ 781
521
+ ],
522
+ "page_idx": 3
523
+ },
524
+ {
525
+ "type": "equation",
526
+ "img_path": "images/8d12d7e8f5d507e60b76e175d7504cbf1895ce6372c1e11a127813e0774a4189.jpg",
527
+ "text": "$$\nw _ { t + T } ^ { ( i ) } = w _ { t } ^ { ( i ) } - \\eta \\left( \\cdot \\cdot \\cdot + \\nabla _ { k , t + 1 } ^ { ( i ) } + \\nabla _ { k , t } ^ { ( i ) } \\right)\n$$",
528
+ "text_format": "latex",
529
+ "bbox": [
530
+ 362,
531
+ 789,
532
+ 635,
533
+ 815
534
+ ],
535
+ "page_idx": 3
536
+ },
537
+ {
538
+ "type": "text",
539
+ "text": "The disappearance of the accumulated discounting factor $\\scriptstyle \\sum _ { \\tau = 0 } ^ { T - 1 } m ^ { \\tau }$ in Equation 6 compared to Equation 4 leads to the loss of convergence performance. It is illustrated in Figure 2(a), where Equation 4 drives the optimization from point $A$ to point $B$ , but with local gradient accumulation, Equation 4 goes to point $C$ . When the gradient sparsity is high, the update interval $T$ dramatically increases, and thus the significant side effect will harm the model performance. To avoid this error, we need momentum correction on top of Equation 5 to make sure the sparse update is equivalent to the dense update as in Equation 3. ",
540
+ "bbox": [
541
+ 173,
542
+ 823,
543
+ 825,
544
+ 924
545
+ ],
546
+ "page_idx": 3
547
+ },
548
+ {
549
+ "type": "text",
550
+ "text": "If we regard the velocity $u _ { t }$ in Equation 3 as ”gradient”, the second term of Equation 3 can be considered as the vanilla SGD for the ”gradient” $u _ { t }$ . The local gradient accumulation is proved to be effective for the vanilla SGD in Section 3.1. Therefore, we can locally accumulate the velocity $u _ { t }$ instead of the real gradient $\\nabla _ { k , t }$ to migrate Equation 5 to approach Equation 3: ",
551
+ "bbox": [
552
+ 176,
553
+ 103,
554
+ 823,
555
+ 160
556
+ ],
557
+ "page_idx": 4
558
+ },
559
+ {
560
+ "type": "equation",
561
+ "img_path": "images/d502270da579dc5cf9a98e5b17e02caea5630a0ac018a8acd0eab6826aa8e745.jpg",
562
+ "text": "$$\nu _ { k , t } = m u _ { k , t - 1 } + \\nabla _ { k , t } , \\quad v _ { k , t } = v _ { k , t - 1 } + u _ { k , t } , \\quad w _ { t + 1 } = w _ { t } - \\eta \\sum _ { k = 1 } ^ { N } s p a r s e \\left( v _ { k , t } \\right) ,\n$$",
563
+ "text_format": "latex",
564
+ "bbox": [
565
+ 220,
566
+ 167,
567
+ 779,
568
+ 212
569
+ ],
570
+ "page_idx": 4
571
+ },
572
+ {
573
+ "type": "text",
574
+ "text": "where the first two terms are the corrected local gradient accumulation, and the accumulation result $v _ { k , t }$ is used for the subsequent sparsification and communication. Bumulation, we can deduce the accumulated discounting factor le change in the localin Equation 4 from $\\scriptstyle \\sum _ { \\tau = 0 } ^ { T - 1 } m ^ { \\tau }$ Equation 7, as shown in Figure 2(b). ",
575
+ "bbox": [
576
+ 174,
577
+ 219,
578
+ 825,
579
+ 279
580
+ ],
581
+ "page_idx": 4
582
+ },
583
+ {
584
+ "type": "text",
585
+ "text": "We refer to this migration as the momentum correction. It is a tweak to the update equation, it doesn’t incur any hyper parameter. Beyond the vanilla momentum SGD, we also look into Nesterov momentum SGD in Appendix B, which is similar to momentum SGD. ",
586
+ "bbox": [
587
+ 174,
588
+ 285,
589
+ 825,
590
+ 327
591
+ ],
592
+ "page_idx": 4
593
+ },
594
+ {
595
+ "type": "text",
596
+ "text": "Local Gradient Clipping Gradient clipping is widely adopted to avoid the exploding gradient problem (Bengio et al., 1994). The method proposed by Pascanu et al. (2013) rescales the gradients whenever the sum of their L2-norms exceeds a threshold. This step is conventionally executed after gradient aggregation from all nodes. Because we accumulate gradients over iterations on each node independently, we perform the gradient clipping locally before adding the current gradient $G _ { t }$ to previous accumulation $( G _ { t - 1 }$ in Algorithm 1). As explained in Appendix C, we scale the threshold by $N ^ { - 1 / 2 }$ , the current node’s fraction of the global threshold if all $N$ nodes had identical gradient distributions. In practice, we find that the local gradient clipping behaves very similarly to the vanilla gradient clipping in training, which suggests that our assumption might be valid in real-world data. ",
597
+ "bbox": [
598
+ 173,
599
+ 343,
600
+ 825,
601
+ 472
602
+ ],
603
+ "page_idx": 4
604
+ },
605
+ {
606
+ "type": "text",
607
+ "text": "As we will see in Section 4, momentum correction and local gradient clipping help improve the word error rate from $1 4 . 1 \\%$ to $1 2 . 9 \\%$ on the AN4 corpus, while training curves follow the momentum SGD more closely. ",
608
+ "bbox": [
609
+ 176,
610
+ 477,
611
+ 823,
612
+ 520
613
+ ],
614
+ "page_idx": 4
615
+ },
616
+ {
617
+ "type": "text",
618
+ "text": "3.3 OVERCOMING THE STALENESS EFFECT ",
619
+ "text_level": 1,
620
+ "bbox": [
621
+ 176,
622
+ 537,
623
+ 486,
624
+ 553
625
+ ],
626
+ "page_idx": 4
627
+ },
628
+ {
629
+ "type": "text",
630
+ "text": "Because we delay the update of small gradients, when these updates do occur, they are outdated or stale. In our experiments, most of the parameters are updated every 600 to 1000 iterations when gradient sparsity is $9 9 . 9 \\%$ , which is quite long compared to the number of iterations per epoch. Staleness can slow down convergence and degrade model performance. We mitigate staleness with momentum factor masking and warm-up training. ",
631
+ "bbox": [
632
+ 174,
633
+ 564,
634
+ 825,
635
+ 635
636
+ ],
637
+ "page_idx": 4
638
+ },
639
+ {
640
+ "type": "text",
641
+ "text": "Momentum Factor Masking Mitliagkas et al. (2016) discussed the staleness caused by asynchrony and attributed it to a term described as implicit momentum. Inspired by their work, we introduce momentum factor masking, to alleviate staleness. Instead of searching for a new momentum coefficient as suggested in Mitliagkas et al. (2016), we simply apply the same mask to both the accumulated gradients $v _ { k , t }$ and the momentum factor $u _ { k , t }$ in Equation 7: ",
642
+ "bbox": [
643
+ 173,
644
+ 650,
645
+ 825,
646
+ 722
647
+ ],
648
+ "page_idx": 4
649
+ },
650
+ {
651
+ "type": "equation",
652
+ "img_path": "images/b49d852870b1037656d13680d30c725a009d8991e82d14b343075452a3d0e5e1.jpg",
653
+ "text": "$$\nM a s k \\gets | v _ { k , t } | > t h r , \\quad v _ { k , t } \\gets v _ { k , t } \\odot \\neg M a s k , \\quad u _ { k , t } \\gets u _ { k , t } \\odot \\neg M a s k\n$$",
654
+ "text_format": "latex",
655
+ "bbox": [
656
+ 251,
657
+ 729,
658
+ 748,
659
+ 746
660
+ ],
661
+ "page_idx": 4
662
+ },
663
+ {
664
+ "type": "text",
665
+ "text": "This mask stops the momentum for delayed gradients, preventing the stale momentum from carrying the weights in the wrong direction. ",
666
+ "bbox": [
667
+ 173,
668
+ 753,
669
+ 823,
670
+ 782
671
+ ],
672
+ "page_idx": 4
673
+ },
674
+ {
675
+ "type": "text",
676
+ "text": "Warm-up Training In the early stages of training, the network is changing rapidly, and the gradients are more diverse and aggressive. Sparsifying gradients limits the range of variation of the model, and thus prolongs the period when the network changes dramatically. Meanwhile, the remaining aggressive gradients from the early stage are accumulated before being chosen for the next update, and therefore they may outweigh the latest gradients and misguide the optimization direction. The warm-up training method introduced in large minibatch training (Goyal et al., 2017) is helpful. During the warm-up period, we use a less aggressive learning rate to slow down the changing speed of the neural network at the start of training, and also less aggressive gradient sparsity, to reduce the number of extreme gradients being delayed. Instead of linearly ramping up the learning rate during the first several epochs, we exponentially increase the gradient sparsity from a relatively small value to the final value, in order to help the training adapt to the gradients of larger sparsity. ",
677
+ "bbox": [
678
+ 173,
679
+ 797,
680
+ 825,
681
+ 924
682
+ ],
683
+ "page_idx": 4
684
+ },
685
+ {
686
+ "type": "table",
687
+ "img_path": "images/8db09cb678177982b3f2a11ae2f254756b21c0d28d4e9b256e214b3667e6a75c.jpg",
688
+ "table_caption": [
689
+ "Table 1: Techniques in Deep Gradient Compression "
690
+ ],
691
+ "table_footnote": [],
692
+ "table_body": "<table><tr><td rowspan=1 colspan=1>Techniques</td><td rowspan=1 colspan=1>Gradient DeepDropping Gradient(Aji &amp; Heafield,2017) Compression</td><td rowspan=1 colspan=1>Overcome StalenessReduce Ensure MaintainImproveBandwidthConvergenceAccuracyConvergenceIterations</td></tr><tr><td rowspan=1 colspan=1>GradientSparsification</td><td rowspan=1 colspan=1>√</td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1>Local GradientAccumulation</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1>MomentumCorrection</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1>Local GradientClipping</td><td rowspan=1 colspan=1>√</td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1>MomentumFactor Masking</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>√</td></tr><tr><td rowspan=1 colspan=1>Warm-upTraining</td><td rowspan=1 colspan=1>√</td><td rowspan=1 colspan=1>√ √</td></tr></table>",
693
+ "bbox": [
694
+ 178,
695
+ 127,
696
+ 821,
697
+ 363
698
+ ],
699
+ "page_idx": 5
700
+ },
701
+ {
702
+ "type": "text",
703
+ "text": "",
704
+ "bbox": [
705
+ 174,
706
+ 390,
707
+ 821,
708
+ 419
709
+ ],
710
+ "page_idx": 5
711
+ },
712
+ {
713
+ "type": "text",
714
+ "text": "As shown in Table 1, momentum correction and local gradient clipping improve the local gradient accumulation, while the momentum factor masking and warm-up training alleviate the staleness effect. On top of gradient sparsification and local gradient accumulation, these four techniques make up the Deep Gradient Compression (pseudo code in Appendix D), and help push the gradient compression ratio higher while maintaining the accuracy. ",
715
+ "bbox": [
716
+ 174,
717
+ 424,
718
+ 825,
719
+ 494
720
+ ],
721
+ "page_idx": 5
722
+ },
723
+ {
724
+ "type": "text",
725
+ "text": "4 EXPERIMENTS ",
726
+ "text_level": 1,
727
+ "bbox": [
728
+ 176,
729
+ 516,
730
+ 326,
731
+ 532
732
+ ],
733
+ "page_idx": 5
734
+ },
735
+ {
736
+ "type": "text",
737
+ "text": "4.1 EXPERIMENT SETTINGS ",
738
+ "text_level": 1,
739
+ "bbox": [
740
+ 174,
741
+ 547,
742
+ 382,
743
+ 563
744
+ ],
745
+ "page_idx": 5
746
+ },
747
+ {
748
+ "type": "text",
749
+ "text": "We validate our approach on three types of machine learning tasks: image classification on Cifar10 and ImageNet, language modeling on Penn Treebank dataset, and speech recognition on AN4 and Librispeech corpus. The only hyper-parameter introduced by Deep Gradient Compression is the warm-up training strategy. In all experiments related to DGC, we rise the sparsity in the warm-up period as follows: $7 5 \\%$ , $9 3 . 7 5 \\%$ , $9 8 . 4 3 7 5 \\%$ , $9 9 . 6 \\%$ , $9 9 . 9 \\%$ (exponentially increase till $9 9 . 9 \\%$ ). We evaluate the reduction in the network bandwidth by the gradient compression ratio as follows, ",
750
+ "bbox": [
751
+ 173,
752
+ 574,
753
+ 825,
754
+ 659
755
+ ],
756
+ "page_idx": 5
757
+ },
758
+ {
759
+ "type": "equation",
760
+ "img_path": "images/589d3ed0ac9ac0e346b081b1f466295631ca19586d79642a24fcbf99a871e871.jpg",
761
+ "text": "$$\n\\mathrm { \\ \" { s r a d i e n t } ~ C o m p r e s s i o n ~ R a t i o } = s i z e \\left[ e n c o d e \\left( s p a r s e ( G ^ { k } ) \\right) \\right] / s i z e \\left[ G ^ { k } \\right]\n$$",
762
+ "text_format": "latex",
763
+ "bbox": [
764
+ 264,
765
+ 666,
766
+ 740,
767
+ 686
768
+ ],
769
+ "page_idx": 5
770
+ },
771
+ {
772
+ "type": "text",
773
+ "text": "where $G ^ { k }$ is the gradients computed on the training node $k$ . ",
774
+ "bbox": [
775
+ 174,
776
+ 694,
777
+ 563,
778
+ 709
779
+ ],
780
+ "page_idx": 5
781
+ },
782
+ {
783
+ "type": "text",
784
+ "text": "Image Classification We studied ResNet-110 on Cifar10, AlexNet and ResNet-50 on ImageNet. Cifar10 consists of 50,000 training images and 10,000 validation images in 10 classes (Krizhevsky & Hinton, 2009), while ImageNet contains over 1 million training images and 50,000 validation images in 1000 classes (Deng et al., 2009). We train the models with momentum SGD following the training schedule in Gross & Wilber (2016). The warm-up period for DGC is 4 epochs out of164 epochs for Cifar10 and 4 epochs out of 90 epochs for ImageNet Dataset. ",
785
+ "bbox": [
786
+ 173,
787
+ 724,
788
+ 825,
789
+ 810
790
+ ],
791
+ "page_idx": 5
792
+ },
793
+ {
794
+ "type": "text",
795
+ "text": "Language Modeling The Penn Treebank corpus (PTB) dataset consists of 923,000 training, 73,000 validation and 82,000 test words (Marcus et al., 1993). The vocabulary we select is the same as the one in Mikolov et al. (2010). We adopt the 2-layer LSTM language model architecture with 1500 hidden units per layer (Press & Wolf, 2016), tying the weights of encoder and decoder as suggested in Inan et al. (2016) and using vanilla SGD with gradient clipping, while learning rate decays when no improvement has been made in validation loss. The warm-up period is 1 epoch out of 40 epochs. ",
796
+ "bbox": [
797
+ 173,
798
+ 825,
799
+ 825,
800
+ 924
801
+ ],
802
+ "page_idx": 5
803
+ },
804
+ {
805
+ "type": "table",
806
+ "img_path": "images/0c3c1c38abc10127aec8e3478a82d92caa82f17cbcddb9cffc25b863b3ecb584.jpg",
807
+ "table_caption": [
808
+ "Table 2: ResNet-110 trained on Cifar10 Dataset "
809
+ ],
810
+ "table_footnote": [],
811
+ "table_body": "<table><tr><td># GPUs in total</td><td>Batchsize in total per iteration</td><td>Training Method</td><td>Top 1 Accuracy</td><td></td></tr><tr><td rowspan=\"3\">4</td><td rowspan=\"3\">128</td><td>Baseline</td><td>93.75%</td><td></td></tr><tr><td>Gradient Dropping (Aji &amp; Heafield, 2017)</td><td>92.75%</td><td>-1.00%</td></tr><tr><td>Deep Gradient Compression</td><td>93.87%</td><td>+0.12%</td></tr><tr><td rowspan=\"3\">8</td><td rowspan=\"3\">256</td><td>Baseline</td><td>92.92%</td><td></td></tr><tr><td>Gradient Dropping (Aji &amp; Heafield,2017)</td><td>93.02%</td><td>+0.10%</td></tr><tr><td>Deep Gradient Compression</td><td>93.28%</td><td>+0.37%</td></tr><tr><td rowspan=\"3\">16</td><td rowspan=\"3\">512</td><td>Baseline</td><td>93.14%</td><td>-0.21%</td></tr><tr><td>Gradient Dropping (Aji &amp; Heafield, 2017)</td><td>92.93%</td><td></td></tr><tr><td>Deep Gradient Compression</td><td>93.20%</td><td>+0.06%</td></tr><tr><td rowspan=\"3\">32</td><td rowspan=\"3\">1024</td><td>Baseline</td><td>93.10%</td><td></td></tr><tr><td>Gradient Dropping (Aji &amp; Heafield, 2017)</td><td>92.10%</td><td>-1.00%</td></tr><tr><td>Deep Gradient Compression</td><td>93.18%</td><td>+0.08%</td></tr></table>",
812
+ "bbox": [
813
+ 192,
814
+ 121,
815
+ 807,
816
+ 320
817
+ ],
818
+ "page_idx": 6
819
+ },
820
+ {
821
+ "type": "table",
822
+ "img_path": "images/dc5e80e3bcd4541266faae9f517572525beb45cd502ce29d96d8bf12f1c5e8dd.jpg",
823
+ "table_caption": [
824
+ "Table 3: Comparison of gradient compression ratio on ImageNet Dataset "
825
+ ],
826
+ "table_footnote": [],
827
+ "table_body": "<table><tr><td>Model</td><td>Training Method</td><td>Top-1 Accuracy</td><td>Top-5 Accuracy</td><td>Gradient Size</td><td>Compression Ratio</td></tr><tr><td rowspan=\"5\">AlexNet</td><td>Baseline</td><td>58.17%</td><td>80.19%</td><td>232.56 MB</td><td>1x</td></tr><tr><td>TernGrad</td><td>57.28%</td><td>80.23%</td><td>1 29.18 MB</td><td>8×</td></tr><tr><td>(Wen et al., 2017) Deep Gradient</td><td>(-0.89%) 58.20%</td><td>(+0.04%) 80.20%</td><td>2</td><td></td></tr><tr><td>Compression</td><td>(+0.03%)</td><td>(+0.01%)</td><td>0.39 MB</td><td>597 ×</td></tr><tr><td>Baseline</td><td>75.96</td><td>92.91%</td><td>97.49 MB</td><td>1×</td></tr><tr><td>ResNet-50</td><td>Deep Gradient Compression</td><td>76.15 (+0.19%)</td><td>92.97% (+0.06%)</td><td>0.35 MB</td><td>277×</td></tr></table>",
828
+ "bbox": [
829
+ 178,
830
+ 362,
831
+ 816,
832
+ 517
833
+ ],
834
+ "page_idx": 6
835
+ },
836
+ {
837
+ "type": "text",
838
+ "text": "Speech Recognition The AN4 dataset contains 948 training and 130 test utterances (Acero, 1990) while Librispeech corpus contains 960 hours of reading speech (Panayotov et al., 2015). We use DeepSpeech architecture without $\\mathbf { n }$ -gram language model, which is a multi-layer RNN following a stack of convolution layers (Hannun et al., 2014). We train a 5-layer LSTM of 800 hidden units per layer for AN4, and a 7-layer GRU of 1200 hidden units per layer for LibriSpeech, with Nesterov momentum $S G D$ and gradient clipping, while learning rate anneals every epoch. The warm-up period for DGC is 1 epoch out of 80 epochs. ",
839
+ "bbox": [
840
+ 173,
841
+ 542,
842
+ 825,
843
+ 641
844
+ ],
845
+ "page_idx": 6
846
+ },
847
+ {
848
+ "type": "text",
849
+ "text": "4.2 RESULTS AND ANALYSIS ",
850
+ "text_level": 1,
851
+ "bbox": [
852
+ 176,
853
+ 659,
854
+ 388,
855
+ 671
856
+ ],
857
+ "page_idx": 6
858
+ },
859
+ {
860
+ "type": "text",
861
+ "text": "We first examine Deep Gradient Compression on image classification task. Figure 3(a) and 3(b) are the Top-1 accuracy and training loss of ResNet-110 on Cifar10 with 4 nodes. The gradient sparsity is $9 9 . 9 \\%$ (only $0 . 1 \\%$ is non-zero). The learning curve of Gradient Dropping (Aji & Heafield, 2017) (red) is worse than the baseline due to gradient staleness. With momentum correction (yellow), the learning curve converges slightly faster, and the accuracy is much closer to the baseline. With momentum factor masking and warm-up training techniques (blue), gradient staleness is eliminated, and the learning curve closely follows the baseline. Table 2 shows the detailed accuracy. The accuracy of ResNet-110 is fully maintained while using Deep Gradient Compression. ",
862
+ "bbox": [
863
+ 174,
864
+ 684,
865
+ 825,
866
+ 796
867
+ ],
868
+ "page_idx": 6
869
+ },
870
+ {
871
+ "type": "text",
872
+ "text": "When scaling to the large-scale dataset, Figure 3(c) and 3(d) show the learning curve of ResNet-50 when the gradient sparsity is $9 9 . 9 \\%$ . The accuracy fully matches the baseline. An interesting observation is that the top-1 error of training with sparse gradients decreases faster than the baseline with the same training loss. Table 3 shows the results of AlexNet and ResNet-50 training on ImageNet with 4 nodes. We compare the gradient compression ratio with Terngrad (Wen et al., 2017) on AlexNet (ResNet is not studied in Wen et al. (2017)). Deep Gradient Compression gives $7 5 \\times$ better compression than Terngrad with no loss of accuracy. For ResNet-50, the compression ratio is slightly lower ( $2 7 7 \\times$ vs. $5 9 7 \\times$ ) with a slight increase in accuracy. ",
873
+ "bbox": [
874
+ 174,
875
+ 803,
876
+ 823,
877
+ 886
878
+ ],
879
+ "page_idx": 6
880
+ },
881
+ {
882
+ "type": "image",
883
+ "img_path": "images/e656c450092c001f7c593a39af68523f3d343082b527c6df59aca5c41a496228.jpg",
884
+ "image_caption": [
885
+ "Figure 3: Learning curves of ResNet in image classification task (the gradient sparsity is $9 9 . 9 \\%$ ). "
886
+ ],
887
+ "image_footnote": [],
888
+ "bbox": [
889
+ 183,
890
+ 109,
891
+ 795,
892
+ 472
893
+ ],
894
+ "page_idx": 7
895
+ },
896
+ {
897
+ "type": "table",
898
+ "img_path": "images/2ca96e8553aa94a6140fa492cc38bc5e994e2241030507f065ba70571b17ae26.jpg",
899
+ "table_caption": [
900
+ "Table 4: Training results of language modeling and speech recognition with 4 nodes "
901
+ ],
902
+ "table_footnote": [],
903
+ "table_body": "<table><tr><td rowspan=1 colspan=1>Task</td><td rowspan=1 colspan=3>Language Modeling on PTB</td><td rowspan=1 colspan=3> Speech Recognition on LibriSpeech</td></tr><tr><td rowspan=2 colspan=1>TrainingMethod</td><td rowspan=2 colspan=1>Perplexity</td><td rowspan=2 colspan=1>GradientSize</td><td rowspan=2 colspan=1>CompressionRatio</td><td rowspan=1 colspan=1>Word Error Rate (WER)</td><td rowspan=2 colspan=1>GradientSize</td><td rowspan=2 colspan=1>CompressionRatio</td></tr><tr><td rowspan=1 colspan=1>test-clean test-other</td></tr><tr><td rowspan=1 colspan=1>Baseline</td><td rowspan=1 colspan=1>72.30</td><td rowspan=1 colspan=1>194.68MB</td><td rowspan=1 colspan=1>1x</td><td rowspan=1 colspan=1>9.45% 27.07%</td><td rowspan=1 colspan=1>488.08 MB</td><td rowspan=1 colspan=1>1x</td></tr><tr><td rowspan=1 colspan=1>Deep GradientCompression</td><td rowspan=1 colspan=1>72.24(-0.06)</td><td rowspan=1 colspan=1>0.42 MB</td><td rowspan=1 colspan=1>462 ×</td><td rowspan=1 colspan=1>9.06% 27.04%(-0.39%) (-0.03%)</td><td rowspan=1 colspan=1>0.74 MB</td><td rowspan=1 colspan=1>608×</td></tr></table>",
904
+ "bbox": [
905
+ 137,
906
+ 523,
907
+ 862,
908
+ 623
909
+ ],
910
+ "page_idx": 7
911
+ },
912
+ {
913
+ "type": "text",
914
+ "text": "",
915
+ "bbox": [
916
+ 176,
917
+ 648,
918
+ 825,
919
+ 676
920
+ ],
921
+ "page_idx": 7
922
+ },
923
+ {
924
+ "type": "text",
925
+ "text": "For language modeling, Figure 4 shows the perplexity and training loss of the language model trained with 4 nodes when the gradient sparsity is $9 9 . 9 \\%$ . The training loss with Deep Gradient Compression closely match the baseline, so does the validation perplexity. From Table 4, Deep Gradient Compression compresses the gradient by $4 6 2 \\times$ with a slight reduction in perplexity. ",
926
+ "bbox": [
927
+ 173,
928
+ 684,
929
+ 825,
930
+ 739
931
+ ],
932
+ "page_idx": 7
933
+ },
934
+ {
935
+ "type": "text",
936
+ "text": "For speech recognition, Figure 5 shows the word error rate (WER) and training loss curve of 5-layer LSTM on AN4 Dataset with 4 nodes when the gradient sparsity is $9 9 . 9 \\%$ . The learning curves show the same improvement acquired from techniques in Deep Gradient Compression as for the image network. Table 4 shows word error rate (WER) performance on LibriSpeech test dataset, where test-clean contains clean speech and test-other noisy speech. The model trained with Deep Gradient Compression gains better recognition ability on both clean and noisy speech, even when gradients size is compressed by $6 0 8 \\times$ . ",
937
+ "bbox": [
938
+ 173,
939
+ 746,
940
+ 825,
941
+ 844
942
+ ],
943
+ "page_idx": 7
944
+ },
945
+ {
946
+ "type": "text",
947
+ "text": "5 SYSTEM ANALYSIS AND PERFORMANCE ",
948
+ "text_level": 1,
949
+ "bbox": [
950
+ 174,
951
+ 864,
952
+ 540,
953
+ 881
954
+ ],
955
+ "page_idx": 7
956
+ },
957
+ {
958
+ "type": "text",
959
+ "text": "Implementing DGC requires gradient top- $k$ selection. Given the target sparsity ratio of $9 9 . 9 \\%$ , we need to pick the top $0 . 1 \\%$ largest over millions of weights. Its complexity is $O ( n )$ , where $n$ is the number of the gradient elements (Cormen, 2009). We propose to use sampling to reduce top- $k$ selection time. We sample only $0 . 1 \\%$ to $1 \\%$ of the gradients and perform top- $k$ selection on the samples to estimate the threshold for the entire population. If the number of gradients exceeding the threshold is far more than expected, a precise threshold is calculated from the already-selected gradients. Hierarchically calculating the threshold significantly reduces top- $k$ selection time. In practice, total extra computation time is negligible compared to network communication time which is usually from hundreds of milliseconds to several seconds depending on the network bandwidth. ",
960
+ "bbox": [
961
+ 173,
962
+ 895,
963
+ 823,
964
+ 924
965
+ ],
966
+ "page_idx": 7
967
+ },
968
+ {
969
+ "type": "image",
970
+ "img_path": "images/da729b546b722eb99540362f021c38de97675aa8a17d5ae1cd3d1a74da50f94a.jpg",
971
+ "image_caption": [
972
+ "Figure 4: Perplexity and training loss of LSTM language model on PTB dataset (the gradient sparsity is $9 9 . 9 \\%$ ). "
973
+ ],
974
+ "image_footnote": [],
975
+ "bbox": [
976
+ 183,
977
+ 102,
978
+ 792,
979
+ 265
980
+ ],
981
+ "page_idx": 8
982
+ },
983
+ {
984
+ "type": "image",
985
+ "img_path": "images/bb4e3055bd7875c3516526a76cdc8c3060114f813f5a668f138b55bd3fbae26b.jpg",
986
+ "image_caption": [
987
+ "Figure 5: WER and training loss of 5-layer LSTM on AN4 (the gradient sparsity is $9 9 . 9 \\%$ "
988
+ ],
989
+ "image_footnote": [],
990
+ "bbox": [
991
+ 184,
992
+ 301,
993
+ 472,
994
+ 464
995
+ ],
996
+ "page_idx": 8
997
+ },
998
+ {
999
+ "type": "image",
1000
+ "img_path": "images/94ecc53592aacda14a957cf87a0316a83bf0163aa1dd7c6c51ff89d2d819db0b.jpg",
1001
+ "image_caption": [],
1002
+ "image_footnote": [],
1003
+ "bbox": [
1004
+ 511,
1005
+ 303,
1006
+ 790,
1007
+ 463
1008
+ ],
1009
+ "page_idx": 8
1010
+ },
1011
+ {
1012
+ "type": "image",
1013
+ "img_path": "images/01aa745236eba55636af83f7a478017e6ef9f97dacffb205e6d02938d815c04f.jpg",
1014
+ "image_caption": [
1015
+ "Figure 6: Deep Gradient Compression improves the speedup and scalability of distributed training. Each training node has 4 NVIDIA Titan XP GPUs and one PCI switch. "
1016
+ ],
1017
+ "image_footnote": [],
1018
+ "bbox": [
1019
+ 179,
1020
+ 497,
1021
+ 815,
1022
+ 696
1023
+ ],
1024
+ "page_idx": 8
1025
+ },
1026
+ {
1027
+ "type": "text",
1028
+ "text": "",
1029
+ "bbox": [
1030
+ 174,
1031
+ 736,
1032
+ 825,
1033
+ 833
1034
+ ],
1035
+ "page_idx": 8
1036
+ },
1037
+ {
1038
+ "type": "text",
1039
+ "text": "We use the performance model proposed in Wen et al. (2017) to perform the scalability analysis, combining the lightweight profiling on single training node with the analytical communication modeling. With the all-reduce communication model (Rabenseifner, 2004; Bruck et al., 1997), the density of sparse data doubles at every aggregation step in the worst case. However, even considering this effect, Deep Gradient Compression still significantly reduces the network communication time, as implied in Figure 6. ",
1040
+ "bbox": [
1041
+ 174,
1042
+ 840,
1043
+ 825,
1044
+ 924
1045
+ ],
1046
+ "page_idx": 8
1047
+ },
1048
+ {
1049
+ "type": "text",
1050
+ "text": "Figure 6 shows the speedup of multi-node training compared with single-node training. Conventional training achieves much worse speedup with 1Gbps (Figure 6(a)) than 10Gbps Ethernet (Figure 6(b)). Nonetheless, Deep Gradient Compression enables the training with 1Gbps Ethernet to be competitive with conventional training with 10Gbps Ethernet. For instance, when training AlexNet with 64 nodes, conventional training only achieves about $3 0 \\times$ speedup with 10Gbps Ethernet (Apache, 2016), while with DGC, more than $4 0 \\times$ speedup is achieved with only 1Gbps Ethernet. From the comparison of Figure 6(a) and 6(b), Deep Gradient Compression benefits even more when the communication-to-computation ratio of the model is higher and the network bandwidth is lower. ",
1051
+ "bbox": [
1052
+ 173,
1053
+ 103,
1054
+ 825,
1055
+ 215
1056
+ ],
1057
+ "page_idx": 9
1058
+ },
1059
+ {
1060
+ "type": "text",
1061
+ "text": "6 CONCLUSION ",
1062
+ "text_level": 1,
1063
+ "bbox": [
1064
+ 176,
1065
+ 234,
1066
+ 318,
1067
+ 251
1068
+ ],
1069
+ "page_idx": 9
1070
+ },
1071
+ {
1072
+ "type": "text",
1073
+ "text": "Deep Gradient Compression (DGC) compresses the gradient by $2 7 0 { - } 6 0 0 \\times$ for a wide range of CNNs and RNNs. To achieve this compression without slowing down the convergence, DGC employs momentum correction, local gradient clipping, momentum factor masking and warm-up training. We further propose hierarchical threshold selection to speed up the gradient sparsification process. Deep Gradient Compression reduces the required communication bandwidth and improves the scalability of distributed training with inexpensive, commodity networking infrastructure. ",
1074
+ "bbox": [
1075
+ 174,
1076
+ 265,
1077
+ 825,
1078
+ 349
1079
+ ],
1080
+ "page_idx": 9
1081
+ },
1082
+ {
1083
+ "type": "text",
1084
+ "text": "7 ACKNOWLEDGEMENT ",
1085
+ "text_level": 1,
1086
+ "bbox": [
1087
+ 176,
1088
+ 369,
1089
+ 387,
1090
+ 386
1091
+ ],
1092
+ "page_idx": 9
1093
+ },
1094
+ {
1095
+ "type": "text",
1096
+ "text": "This work was supported by National Natural Science Foundation of China (No.61622403), Tsinghua University Initiative Scientific Research Program and Beijing National Research Center for Information Science and Technology. We are also thankful to reviewers for their helpful suggestions. ",
1097
+ "bbox": [
1098
+ 174,
1099
+ 400,
1100
+ 825,
1101
+ 443
1102
+ ],
1103
+ "page_idx": 9
1104
+ },
1105
+ {
1106
+ "type": "text",
1107
+ "text": "REFERENCES ",
1108
+ "text_level": 1,
1109
+ "bbox": [
1110
+ 176,
1111
+ 462,
1112
+ 285,
1113
+ 477
1114
+ ],
1115
+ "page_idx": 9
1116
+ },
1117
+ {
1118
+ "type": "text",
1119
+ "text": "Alejandro Acero. Acoustical and environmental robustness in automatic speech recognition. In Proc. of ICASSP, 1990. ",
1120
+ "bbox": [
1121
+ 174,
1122
+ 483,
1123
+ 825,
1124
+ 510
1125
+ ],
1126
+ "page_idx": 9
1127
+ },
1128
+ {
1129
+ "type": "text",
1130
+ "text": "Alham Fikri Aji and Kenneth Heafield. Sparse communication for distributed gradient descent. In Empirical Methods in Natural Language Processing (EMNLP), 2017. ",
1131
+ "bbox": [
1132
+ 173,
1133
+ 517,
1134
+ 823,
1135
+ 545
1136
+ ],
1137
+ "page_idx": 9
1138
+ },
1139
+ {
1140
+ "type": "text",
1141
+ "text": "Dan Alistarh, Jerry Li, Ryota Tomioka, and Milan Vojnovic. Qsgd: Randomized quantization for communication-optimal stochastic gradient descent. arXiv preprint arXiv:1610.02132, 2016. ",
1142
+ "bbox": [
1143
+ 173,
1144
+ 551,
1145
+ 823,
1146
+ 579
1147
+ ],
1148
+ "page_idx": 9
1149
+ },
1150
+ {
1151
+ "type": "text",
1152
+ "text": "Apache. Image classification with mxnet. https://github.com/apache/incubator-mxnet/ tree/master/example/image-classification, 2016. ",
1153
+ "bbox": [
1154
+ 176,
1155
+ 587,
1156
+ 823,
1157
+ 613
1158
+ ],
1159
+ "page_idx": 9
1160
+ },
1161
+ {
1162
+ "type": "text",
1163
+ "text": "Yoshua Bengio, Patrice Simard, and Paolo Frasconi. Learning long-term dependencies with gradient descent is difficult. IEEE transactions on neural networks, 5(2):157–166, 1994. ",
1164
+ "bbox": [
1165
+ 173,
1166
+ 619,
1167
+ 823,
1168
+ 647
1169
+ ],
1170
+ "page_idx": 9
1171
+ },
1172
+ {
1173
+ "type": "text",
1174
+ "text": "Jehoshua Bruck, Ching-Tien Ho, Shlomo Kipnis, Eli Upfal, and Derrick Weathersby. Efficient algorithms for all-to-all communications in multiport message-passing systems. IEEE Transactions on parallel and distributed systems, 8(11):1143–1156, 1997. ",
1175
+ "bbox": [
1176
+ 174,
1177
+ 654,
1178
+ 823,
1179
+ 694
1180
+ ],
1181
+ "page_idx": 9
1182
+ },
1183
+ {
1184
+ "type": "text",
1185
+ "text": "Chia-Yu Chen, Jungwook Choi, Daniel Brand, Ankur Agrawal, Wei Zhang, and Kailash Gopalakrishnan. Adacomp: Adaptive residual gradient compression for data-parallel distributed training. arXiv preprint arXiv:1712.02679, 2017. ",
1186
+ "bbox": [
1187
+ 174,
1188
+ 700,
1189
+ 823,
1190
+ 739
1191
+ ],
1192
+ "page_idx": 9
1193
+ },
1194
+ {
1195
+ "type": "text",
1196
+ "text": "Trishul M Chilimbi, Yutaka Suzue, Johnson Apacible, and Karthik Kalyanaraman. Project adam: Building an efficient and scalable deep learning training system. In OSDI, volume 14, pp. 571–582, 2014. ",
1197
+ "bbox": [
1198
+ 171,
1199
+ 747,
1200
+ 821,
1201
+ 775
1202
+ ],
1203
+ "page_idx": 9
1204
+ },
1205
+ {
1206
+ "type": "text",
1207
+ "text": "Thomas H Cormen. Introduction to algorithms. MIT press, 2009. ",
1208
+ "bbox": [
1209
+ 173,
1210
+ 781,
1211
+ 563,
1212
+ 796
1213
+ ],
1214
+ "page_idx": 9
1215
+ },
1216
+ {
1217
+ "type": "text",
1218
+ "text": "Jeffrey Dean, Greg Corrado, Rajat Monga, Kai Chen, Matthieu Devin, Mark Mao, Andrew Senior, Paul Tucker, Ke Yang, Quoc V Le, et al. Large scale distributed deep networks. In Advances in neural information processing systems, pp. 1223–1231, 2012. ",
1219
+ "bbox": [
1220
+ 176,
1221
+ 804,
1222
+ 825,
1223
+ 843
1224
+ ],
1225
+ "page_idx": 9
1226
+ },
1227
+ {
1228
+ "type": "text",
1229
+ "text": "J. Deng, W. Dong, R. Socher, L.-J. Li, K. Li, and L. Fei-Fei. ImageNet: A Large-Scale Hierarchical Image Database. In CVPR09, 2009. ",
1230
+ "bbox": [
1231
+ 174,
1232
+ 851,
1233
+ 823,
1234
+ 877
1235
+ ],
1236
+ "page_idx": 9
1237
+ },
1238
+ {
1239
+ "type": "text",
1240
+ "text": "Nikoli Dryden, Sam Ade Jacobs, Tim Moon, and Brian Van Essen. Communication quantization for dataparallel training of deep neural networks. In Proceedings of the Workshop on Machine Learning in High Performance Computing Environments, pp. 1–8. IEEE Press, 2016. ",
1241
+ "bbox": [
1242
+ 176,
1243
+ 885,
1244
+ 823,
1245
+ 924
1246
+ ],
1247
+ "page_idx": 9
1248
+ },
1249
+ {
1250
+ "type": "text",
1251
+ "text": "Google. Federated learning: Collaborative machine learning without centralized training data, 2017. URL https://research.googleblog.com/2017/04/ federated-learning-collaborative.html. ",
1252
+ "bbox": [
1253
+ 171,
1254
+ 104,
1255
+ 823,
1256
+ 143
1257
+ ],
1258
+ "page_idx": 10
1259
+ },
1260
+ {
1261
+ "type": "text",
1262
+ "text": "Priya Goyal, Piotr Dollar, Ross Girshick, Pieter Noordhuis, Lukasz Wesolowski, Aapo Kyrola, Andrew Tulloch, ´ Yangqing Jia, and Kaiming He. Accurate, large minibatch sgd: Training imagenet in 1 hour. arXiv preprint arXiv:1706.02677, 2017. ",
1263
+ "bbox": [
1264
+ 174,
1265
+ 154,
1266
+ 821,
1267
+ 191
1268
+ ],
1269
+ "page_idx": 10
1270
+ },
1271
+ {
1272
+ "type": "text",
1273
+ "text": "S. Gross and M. Wilber. Training and investigating residual nets. https://github.com/facebook/ fb.resnet.torch, 2016. ",
1274
+ "bbox": [
1275
+ 173,
1276
+ 200,
1277
+ 823,
1278
+ 228
1279
+ ],
1280
+ "page_idx": 10
1281
+ },
1282
+ {
1283
+ "type": "text",
1284
+ "text": "Awni Hannun, Carl Case, Jared Casper, Bryan Catanzaro, Greg Diamos, Erich Elsen, Ryan Prenger, Sanjeev Satheesh, Shubho Sengupta, Adam Coates, et al. Deep speech: Scaling up end-to-end speech recognition. arXiv preprint arXiv:1412.5567, 2014. ",
1285
+ "bbox": [
1286
+ 174,
1287
+ 236,
1288
+ 823,
1289
+ 276
1290
+ ],
1291
+ "page_idx": 10
1292
+ },
1293
+ {
1294
+ "type": "text",
1295
+ "text": "Hakan Inan, Khashayar Khosravi, and Richard Socher. Tying word vectors and word classifiers: A loss framework for language modeling. arXiv preprint arXiv:1611.01462, 2016. ",
1296
+ "bbox": [
1297
+ 173,
1298
+ 285,
1299
+ 821,
1300
+ 313
1301
+ ],
1302
+ "page_idx": 10
1303
+ },
1304
+ {
1305
+ "type": "text",
1306
+ "text": "Jakub Konecnˇ y, H Brendan McMahan, Felix X Yu, Peter Richt \\` arik, Ananda Theertha Suresh, and Dave Bacon. ´ Federated learning: Strategies for improving communication efficiency. arXiv preprint arXiv:1610.05492, 2016. ",
1307
+ "bbox": [
1308
+ 176,
1309
+ 320,
1310
+ 825,
1311
+ 361
1312
+ ],
1313
+ "page_idx": 10
1314
+ },
1315
+ {
1316
+ "type": "text",
1317
+ "text": "Alex Krizhevsky and Geoffrey Hinton. Learning multiple layers of features from tiny images. 2009. \nJ. Lei Ba, J. R. Kiros, and G. E. Hinton. Layer Normalization. ArXiv e-prints, July 2016. \nMu Li, David G Andersen, Alexander J Smola, and Kai Yu. Communication efficient distributed machine learning with the parameter server. In Advances in Neural Information Processing Systems, pp. 19–27, 2014. \nMitchell P. Marcus, Beatrice Santorini, and Mary Ann Marcinkiewicz. Building a large annotated corpus of english: The penn treebank. COMPUTATIONAL LINGUISTICS, 19(2):313–330, 1993. \nH Brendan McMahan, Eider Moore, Daniel Ramage, Seth Hampson, et al. Communication-efficient learning of deep networks from decentralized data. arXiv preprint arXiv:1602.05629, 2016. \nTomas Mikolov, Martin Karafiat, Lukas Burget, Jan Cernock ´ y, and Sanjeev Khudanpur. Recurrent neural \\` network based language model. In Interspeech, volume 2, pp. 3, 2010. \nIoannis Mitliagkas, Ce Zhang, Stefan Hadjis, and Christopher Re. Asynchrony begets momentum, with an ´ application to deep learning. In Communication, Control, and Computing (Allerton), 2016 54th Annual Allerton Conference on, pp. 997–1004. IEEE, 2016. \nPhilipp Moritz, Robert Nishihara, Ion Stoica, and Michael I Jordan. Sparknet: Training deep networks in spark. arXiv preprint arXiv:1511.06051, 2015. \nYurii Nesterov. A method of solving a convex programming problem with convergence rate o (1/k2). In Soviet Mathematics Doklady, volume 27, pp. 372–376, 1983. \nVassil Panayotov, Guoguo Chen, Daniel Povey, and Sanjeev Khudanpur. Librispeech: an asr corpus based on public domain audio books. In Acoustics, Speech and Signal Processing (ICASSP), 2015 IEEE International Conference on, pp. 5206–5210. IEEE, 2015. \nRazvan Pascanu, Tomas Mikolov, and Yoshua Bengio. On the difficulty of training recurrent neural networks. In International Conference on Machine Learning, pp. 1310–1318, 2013. \nOfir Press and Lior Wolf. Using the output embedding to improve language models. arXiv preprint arXiv:1608.05859, 2016. \nNing Qian. On the momentum term in gradient descent learning algorithms. Neural networks, 12(1):145–151, 1999. \nRolf Rabenseifner. Optimization of collective reduction operations. In International Conference on Computational Science, pp. 1–9. Springer, 2004. \nBenjamin Recht, Christopher Re, Stephen Wright, and Feng Niu. Hogwild: A lock-free approach to parallelizing stochastic gradient descent. In Advances in neural information processing systems, pp. 693–701, 2011. ",
1318
+ "bbox": [
1319
+ 169,
1320
+ 342,
1321
+ 826,
1322
+ 929
1323
+ ],
1324
+ "page_idx": 10
1325
+ },
1326
+ {
1327
+ "type": "text",
1328
+ "text": "Frank Seide, Hao Fu, Jasha Droppo, Gang Li, and Dong Yu. 1-bit stochastic gradient descent and its application to data-parallel distributed training of speech dnns. In Fifteenth Annual Conference of the International Speech Communication Association, 2014. ",
1329
+ "bbox": [
1330
+ 174,
1331
+ 104,
1332
+ 823,
1333
+ 142
1334
+ ],
1335
+ "page_idx": 11
1336
+ },
1337
+ {
1338
+ "type": "text",
1339
+ "text": "Nikko Strom. Scalable distributed dnn training using commodity gpu cloud computing. In Sixteenth Annual Conference of the International Speech Communication Association, 2015. ",
1340
+ "bbox": [
1341
+ 171,
1342
+ 151,
1343
+ 823,
1344
+ 179
1345
+ ],
1346
+ "page_idx": 11
1347
+ },
1348
+ {
1349
+ "type": "text",
1350
+ "text": "Wei Wen, Cong Xu, Feng Yan, Chunpeng Wu, Yandan Wang, Yiran Chen, and Hai Li. Terngrad: Ternary gradients to reduce communication in distributed deep learning. In Advances in Neural Information Processing Systems, 2017. ",
1351
+ "bbox": [
1352
+ 174,
1353
+ 188,
1354
+ 821,
1355
+ 226
1356
+ ],
1357
+ "page_idx": 11
1358
+ },
1359
+ {
1360
+ "type": "text",
1361
+ "text": "Eric P Xing, Qirong Ho, Wei Dai, Jin Kyu Kim, Jinliang Wei, Seunghak Lee, Xun Zheng, Pengtao Xie, Abhimanu Kumar, and Yaoliang Yu. Petuum: A new platform for distributed machine learning on big data. IEEE Transactions on Big Data, 1(2):49–67, 2015. ",
1362
+ "bbox": [
1363
+ 174,
1364
+ 234,
1365
+ 823,
1366
+ 273
1367
+ ],
1368
+ "page_idx": 11
1369
+ },
1370
+ {
1371
+ "type": "text",
1372
+ "text": "Shuchang Zhou, Yuxin Wu, Zekun Ni, Xinyu Zhou, He Wen, and Yuheng Zou. Dorefa-net: Training low bitwidth convolutional neural networks with low bitwidth gradients. arXiv preprint arXiv:1606.06160, 2016. ",
1373
+ "bbox": [
1374
+ 173,
1375
+ 282,
1376
+ 823,
1377
+ 309
1378
+ ],
1379
+ "page_idx": 11
1380
+ },
1381
+ {
1382
+ "type": "text",
1383
+ "text": "Martin Zinkevich, Markus Weimer, Lihong Li, and Alex J Smola. Parallelized stochastic gradient descent. In Advances in neural information processing systems, pp. 2595–2603, 2010. ",
1384
+ "bbox": [
1385
+ 171,
1386
+ 318,
1387
+ 823,
1388
+ 344
1389
+ ],
1390
+ "page_idx": 11
1391
+ },
1392
+ {
1393
+ "type": "text",
1394
+ "text": "A SYNCHRONOUS DISTRIBUTED STOCHASTIC GRADIENT DESCENT ",
1395
+ "text_level": 1,
1396
+ "bbox": [
1397
+ 173,
1398
+ 102,
1399
+ 754,
1400
+ 118
1401
+ ],
1402
+ "page_idx": 12
1403
+ },
1404
+ {
1405
+ "type": "text",
1406
+ "text": "In practice, each training node performs the forward-backward pass on different batches sampled from the training dataset with the same network model. The gradients from all nodes are summed up to optimize their models. By this synchronization step, models on different nodes are always the same during the training. The aggregation step can be achieved in two ways. One method is using the parameter servers as the intermediary which store the parameters among several servers (Dean et al., 2012). The nodes push the gradients to the servers while the servers are waiting for the gradients from all nodes. Once all gradients are sent, the servers update the parameters, and then all nodes pull the latest parameters from the servers. The other method is to perform the All-reduce operation on the gradients among all nodes and to update the parameters on each node independently (Goyal et al., 2017), as shown in Algorithm 2 and Figure 7. In this paper, we adopt the latter approach by default. ",
1407
+ "bbox": [
1408
+ 173,
1409
+ 132,
1410
+ 825,
1411
+ 285
1412
+ ],
1413
+ "page_idx": 12
1414
+ },
1415
+ {
1416
+ "type": "image",
1417
+ "img_path": "images/6a08c0a3c8217ddfc8762679dfb0d2ce41f9f699504333c8d85bc675d5029e10.jpg",
1418
+ "image_caption": [],
1419
+ "image_footnote": [],
1420
+ "bbox": [
1421
+ 179,
1422
+ 299,
1423
+ 460,
1424
+ 390
1425
+ ],
1426
+ "page_idx": 12
1427
+ },
1428
+ {
1429
+ "type": "text",
1430
+ "text": "(a) Each node independently calculates gradients (b) All-reduce operation of gradient aggregation ",
1431
+ "bbox": [
1432
+ 178,
1433
+ 396,
1434
+ 465,
1435
+ 410
1436
+ ],
1437
+ "page_idx": 12
1438
+ },
1439
+ {
1440
+ "type": "image",
1441
+ "img_path": "images/cab34d62dbb8bc5a0de99b3b2c221d8236282b11e6cf8dd54c5510e70657cec4.jpg",
1442
+ "image_caption": [
1443
+ "Figure 7: Distributed Synchronous SGD "
1444
+ ],
1445
+ "image_footnote": [],
1446
+ "bbox": [
1447
+ 179,
1448
+ 417,
1449
+ 460,
1450
+ 501
1451
+ ],
1452
+ "page_idx": 12
1453
+ },
1454
+ {
1455
+ "type": "text",
1456
+ "text": "",
1457
+ "bbox": [
1458
+ 178,
1459
+ 508,
1460
+ 464,
1461
+ 522
1462
+ ],
1463
+ "page_idx": 12
1464
+ },
1465
+ {
1466
+ "type": "table",
1467
+ "img_path": "images/94356c511685fe4b71bbf005ee555b462c45e64c82e3c4f08fd2e57bac9229dd.jpg",
1468
+ "table_caption": [],
1469
+ "table_footnote": [],
1470
+ "table_body": "<table><tr><td>Algorithm 2 Distributed Synchronous SGD on node k</td></tr><tr><td>Input: Dataset X Input: minibatch size b per node Input: the number of nodes N Input: Optimization Function SGD Input: Init parameters w = {w[0],·,w[M]} 1: for t =0,1,. do</td></tr></table>",
1471
+ "bbox": [
1472
+ 488,
1473
+ 306,
1474
+ 815,
1475
+ 534
1476
+ ],
1477
+ "page_idx": 12
1478
+ },
1479
+ {
1480
+ "type": "text",
1481
+ "text": "B GRADIENT SPARSIFICATION WITH NESTROV MOMENTUM CORRECTION ",
1482
+ "text_level": 1,
1483
+ "bbox": [
1484
+ 171,
1485
+ 566,
1486
+ 797,
1487
+ 583
1488
+ ],
1489
+ "page_idx": 12
1490
+ },
1491
+ {
1492
+ "type": "text",
1493
+ "text": "The conventional update rule for Nesterov momentum SGD (Nesterov, 1983) follows, ",
1494
+ "bbox": [
1495
+ 173,
1496
+ 597,
1497
+ 738,
1498
+ 613
1499
+ ],
1500
+ "page_idx": 12
1501
+ },
1502
+ {
1503
+ "type": "equation",
1504
+ "img_path": "images/2fdcc77ca01b8a4fe2cd1219af489e6f6171c470b7d63c175efeb6ac49f6ac14.jpg",
1505
+ "text": "$$\nu _ { t + 1 } = m u _ { t } + \\sum _ { k = 1 } ^ { N } \\left( \\nabla _ { k , t } \\right) , \\quad w _ { t + 1 } = w _ { t } - \\eta \\left( m \\cdot u _ { t + 1 } + \\nabla _ { t } \\right)\n$$",
1506
+ "text_format": "latex",
1507
+ "bbox": [
1508
+ 292,
1509
+ 614,
1510
+ 705,
1511
+ 659
1512
+ ],
1513
+ "page_idx": 12
1514
+ },
1515
+ {
1516
+ "type": "text",
1517
+ "text": "where $m$ is the momentum, $N$ is the number of training nodes, and $\\begin{array} { r } { \\nabla _ { k , t } = \\frac { 1 } { N b } \\sum _ { x \\in { \\mathcal { B } _ { k , t } } } \\nabla f ( x , w _ { t } ) } \\end{array}$ . Before momentum correction, the sparse update follows, ",
1518
+ "bbox": [
1519
+ 173,
1520
+ 660,
1521
+ 825,
1522
+ 699
1523
+ ],
1524
+ "page_idx": 12
1525
+ },
1526
+ {
1527
+ "type": "equation",
1528
+ "img_path": "images/21b08082858a9ac146bab20cc37861b015e19d049aa00d7a40c9903ee3aae432.jpg",
1529
+ "text": "$$\nv _ { k , t + 1 } = v _ { k , t } + \\nabla _ { k , t } , \\quad u _ { t + 1 } = m u _ { t } + \\sum _ { k = 1 } ^ { N } s p a r s e \\left( v _ { k , t + 1 } \\right) , \\quad w _ { t + 1 } = w _ { t } - \\eta u _ { t + 1 }\n$$",
1530
+ "text_format": "latex",
1531
+ "bbox": [
1532
+ 220,
1533
+ 700,
1534
+ 777,
1535
+ 744
1536
+ ],
1537
+ "page_idx": 12
1538
+ },
1539
+ {
1540
+ "type": "text",
1541
+ "text": "After momentum correction sharing the same methodology with Equation 7, it becomes, ",
1542
+ "bbox": [
1543
+ 171,
1544
+ 746,
1545
+ 754,
1546
+ 761
1547
+ ],
1548
+ "page_idx": 12
1549
+ },
1550
+ {
1551
+ "type": "equation",
1552
+ "img_path": "images/4598211f3c8e2edee9f4857eb77462634990192bca5d3bade00d761680fb2bd0.jpg",
1553
+ "text": "$$\n\\iota _ { k , t + 1 } = m u _ { k , t } + \\nabla _ { k , t } , \\quad v _ { k , t + 1 } = v _ { k , t } + \\left( m \\cdot u _ { k , t + 1 } + \\nabla _ { k , t } \\right) , \\quad w _ { t + 1 } = w _ { t } - \\eta \\sum _ { k = 1 } ^ { N } s p a r s e \\left( v _ { k , t + 1 } \\right) .\n$$",
1554
+ "text_format": "latex",
1555
+ "bbox": [
1556
+ 181,
1557
+ 762,
1558
+ 831,
1559
+ 805
1560
+ ],
1561
+ "page_idx": 12
1562
+ },
1563
+ {
1564
+ "type": "text",
1565
+ "text": "C LOCAL GRADIENT CLIPPING ",
1566
+ "text_level": 1,
1567
+ "bbox": [
1568
+ 176,
1569
+ 837,
1570
+ 449,
1571
+ 853
1572
+ ],
1573
+ "page_idx": 12
1574
+ },
1575
+ {
1576
+ "type": "text",
1577
+ "text": "When training the recurrent neural network with gradient clipping, we perform the gradient clipping locally before adding the current gradient $G _ { t } ^ { k }$ to previous accumulation $G _ { t - 1 } ^ { k }$ in Algorithm 1. Denote the origin threshold for the gradients L2-norm $| | G | | _ { 2 }$ as $t h r _ { G }$ , and the threshold for the local gradients L2-norm $| | G ^ { k } | | _ { 2 }$ as as $t h r _ { G ^ { k } }$ . ",
1578
+ "bbox": [
1579
+ 174,
1580
+ 867,
1581
+ 825,
1582
+ 925
1583
+ ],
1584
+ "page_idx": 12
1585
+ },
1586
+ {
1587
+ "type": "text",
1588
+ "text": "Assuming all $N$ training nodes have independent identical gradient distributions with the variance $\\sigma ^ { 2 }$ , the sum of gradients from all nodes have the variance $N \\bar { \\sigma } ^ { 2 }$ . Therefore, ",
1589
+ "bbox": [
1590
+ 169,
1591
+ 103,
1592
+ 823,
1593
+ 132
1594
+ ],
1595
+ "page_idx": 13
1596
+ },
1597
+ {
1598
+ "type": "equation",
1599
+ "img_path": "images/22f25d4b8bfb3693b17b290510e4a7691337649fdc6c13fa3ec3b351222e4345.jpg",
1600
+ "text": "$$\nE \\left[ | | G ^ { k } | | _ { 2 } \\right] \\approx \\sigma , \\quad E \\left[ | | G | | _ { 2 } \\right] \\approx N ^ { 1 / 2 } \\sigma\n$$",
1601
+ "text_format": "latex",
1602
+ "bbox": [
1603
+ 366,
1604
+ 138,
1605
+ 632,
1606
+ 160
1607
+ ],
1608
+ "page_idx": 13
1609
+ },
1610
+ {
1611
+ "type": "text",
1612
+ "text": "Thus, We scale the threshold by $N ^ { - 1 / 2 }$ , the current node’s fraction of the global threshold, ",
1613
+ "bbox": [
1614
+ 171,
1615
+ 166,
1616
+ 769,
1617
+ 183
1618
+ ],
1619
+ "page_idx": 13
1620
+ },
1621
+ {
1622
+ "type": "equation",
1623
+ "img_path": "images/1cb6d5bf8689b380cdf48b088d2e7fafa5550b02e021eab455e0d7c32a6ab5e9.jpg",
1624
+ "text": "$$\nt h r _ { G ^ { k } } = N ^ { - 1 / 2 } \\cdot t h r _ { G }\n$$",
1625
+ "text_format": "latex",
1626
+ "bbox": [
1627
+ 419,
1628
+ 189,
1629
+ 578,
1630
+ 208
1631
+ ],
1632
+ "page_idx": 13
1633
+ },
1634
+ {
1635
+ "type": "text",
1636
+ "text": "D DEEP GRADIENT COMPRESSION ALGORITHM ",
1637
+ "text_level": 1,
1638
+ "bbox": [
1639
+ 174,
1640
+ 227,
1641
+ 589,
1642
+ 243
1643
+ ],
1644
+ "page_idx": 13
1645
+ },
1646
+ {
1647
+ "type": "table",
1648
+ "img_path": "images/4b36e6e2acf37812054b8f1fcde6c7e2da624af20f15dfed3b7f2ce093d3f6a8.jpg",
1649
+ "table_caption": [],
1650
+ "table_footnote": [],
1651
+ "table_body": "<table><tr><td>vanilla momentum SGD on node k</td><td>Algorithm 3 Deep Gradient Compression for Algorithm 4 Deep Gradient Compression for Nesterc momentum SGD on node k</td></tr><tr><td>Input: dataset X</td><td>Input: dataset X</td></tr><tr><td>Input: minibatch size b per node</td><td>Input:minibatch size b per node</td></tr><tr><td>Input: momentum m</td><td>Input: momentum m</td></tr><tr><td></td><td></td></tr><tr><td>Input: the number of nodes N</td><td>Input: the number of nodes N</td></tr><tr><td>Input: optimization function SGD Input: initial parameters w= {w[O],··,w[M]}</td><td>Input: optimization function SGD Input: initial parameters w={w[O],··,w[M]}</td></tr><tr><td>1:Uk ←0,Vk ←0</td><td>1:Uk←0,Vk←0</td></tr><tr><td>2: for t=0,1,.·. do</td><td>2: for t = 0,1,.· do</td></tr><tr><td>3: G←</td><td>3: G←0</td></tr><tr><td>4: fori=1,.,bdo</td><td>4: fori=1,.,bdo</td></tr><tr><td>5: Sample data x from X</td><td>5: Sample data x from X</td></tr><tr><td>G←G+f(x;0t) 6:</td><td>G←G+f(x;0t) 6:</td></tr><tr><td>7: end for</td><td>7: end for</td></tr><tr><td>8: if Gradient Clipping then</td><td>8: if Gradient Clipping then</td></tr><tr><td>9: Gk ← Local-Gradient_Clipping(Gk)</td><td>9: Gl ← Local_Gradient_Clipping(Gt)</td></tr><tr><td>10: end if</td><td>10: end if</td></tr><tr><td>11: U←m.Uk-1+Gk</td><td>11: U←m·(U-1+G&#x27;)</td></tr><tr><td>12: V←V1+U</td><td>12: V←V1+U+G</td></tr><tr><td>13: forj=0,..,M do</td><td>13: for j=0,..,M do</td></tr><tr><td>14: thr ←s%of|V[j]l</td><td>14: thr ←s%of|Vk[j]l</td></tr><tr><td>15: Mask ← |V[j] &gt;thr</td><td>15: Mask ← |V[]| &gt;thr</td></tr><tr><td>G[] ←V Mask 16:</td><td>16: G]←V[j]Mask</td></tr><tr><td>17: V[j] ←Vj]-Mask</td><td>17: V] ←V-Mask</td></tr><tr><td>18: U]←Uj-Mask</td><td>18: U←U-Mask</td></tr><tr><td>19: end for</td><td>19: end for</td></tr><tr><td>20:</td><td>20: All-reduce: Gt ← ∑N 1 encode(G&#x27;)</td></tr><tr><td>21: 0t+1 ← SGD(0t,Gt)</td><td>21: 0t+1 ← SGD(0t,Gt) 22:</td></tr></table>",
1652
+ "bbox": [
1653
+ 173,
1654
+ 284,
1655
+ 816,
1656
+ 685
1657
+ ],
1658
+ "page_idx": 13
1659
+ }
1660
+ ]
parse/train/SkhQHMW0W/SkhQHMW0W_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/train/SkhQHMW0W/SkhQHMW0W_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/train/SybqeKgA-/SybqeKgA-.md ADDED
@@ -0,0 +1,294 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ON BATCH ADAPTIVE TRAINING FOR DEEP LEARNING: LOWER LOSS AND LARGER STEP SIZE
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Mini-batch gradient descent and its variants are commonly used in deep learning. The principle of mini-batch gradient descent is to use noisy gradient calculated on a batch to estimate the real gradient, thus balancing the computation cost per iteration and the uncertainty of noisy gradient. However, its batch size is a fixed hyper parameter requiring manual setting before training the neural network. Yin et al. (2017) proposed a batch adaptive stochastic gradient descent (BA-SGD) that can dynamically choose a proper batch size as learning proceeds. We extend the BA-SGD to momentum algorithm, and evaluate both the BA-SGD and the batch adaptive momentum (BA-Momentum) on two deep learning tasks from natural language processing to image classification. Experiments confirm that batch adaptive methods can achieve a lower loss compared with mini-batch methods and methods that manually increase the batch size, after scanning the same epochs of data. Furthermore, our BA-Momentum is more robust against larger step sizes, in that it can dynamically enlarge the batch size to reduce the larger uncertainty brought by larger step sizes. We also identified an interesting phenomenon, batch size boom. The code implementing the batch adaptive framework is now open source, applicable to any gradient-based optimization problems.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Efficiency of training large neural networks becomes increasingly important as deep neural networks tend to have more parameters and require more training data to achieve the state-of-the-art performance on a wide variety of tasks (Goodfellow et al., 2015). For training deep neural networks, stochastic gradient descent (SGD) (Robbins & Monro, 1951) and its variants, including momentum, which utilizes past updates with an exponential decay (Qian, 1999), and other methods that can adapt different learning rates for each dimension, such as ADAGRAD (Duchi et al., 2010), ADADELTA (Zeiler, 2012) and ADAM (Kingma & Ba, 2014), are commonly used.
12
+
13
+ SGD approximates the gradient by only using a single data instance in each iteration, which may lead to uncertainty of approximation. This uncertainty can be reduced by adopting a batch of instances to do the approximation. In mini-batch SGD, the batch size is a fixed hyper parameter requiring manual setting before training the neural network. Setting the batch size typically involves a tuning procedure in which the best batch size is chosen by a series of attempts.
14
+
15
+ Yin et al. (2017) has developed a batch adaptive stochastic gradient descent (BA-SGD) that can dynamically choose a proper batch size as learning proceeds. BA-SGD models the decrease of objective value as a Gaussian random walk game with rebound on the basis of Taylor extension and central limit theorem. Its core idea is to only update the parameters when the ratio between the expected decrease of objective value and the current batch size is large enough, otherwise enlarge the batch size to better approximate the gradient. It claimed that by smartly choosing the batch size, the BA-SGD not only conserves the fast convergence of SGD algorithm but also avoids too frequent model updates, and compared with mini-batch SGD, its objective value decreases more, after scanning the same amount of data.
16
+
17
+ However, the experiment in Yin et al. (2017) was only conducted on some simple classification tasks using fully connected neural network with one input layer, one output layer and two hidden layers. What about the evaluation on some complex neural networks, such as convolutional neural network (CNN) and recurrent neural network (RNN)? How well would the batch adaptive algorithm perform on other complicated tasks related to natural language processing and computer vision? Furthermore, empirical studies reveal that SGD usually performs not so well in some deep and complex neural networks (Sutskever et al., 2013). Can this batch adaptive framework be extended to other gradient based optimization algorithms except SGD?
18
+
19
+ Therefore, in this paper we extend the batch adaptive framework to momentum algorithm, and evaluate both the batch adaptive SGD (BA-SGD) and the batch adaptive momentum (BA-Momentum) on two deep learning tasks from natural language processing to image classification. These two tasks use RNN and CNN respectively, which cover most of the deep learning models.
20
+
21
+ In our experiments, we have the following observations. First, for batch adaptive methods, their loss functions converge to lower values after scanning same epoches of data, compared with fixedbatch-size methods. Second, BA-Momentum is more robust against large step sizes by dynamically enlarging the batch size to counteract with the larger noise brought by larger step sizes. Third, we observed a batch size boom, a concentrated period where the batch size frequently increases to larger values, in the training of BA-Momentum. The batch size boom is of significance in that it always appears at the point where mini-batch method starts to reach its lowest possible loss and it helps BA-Momentum keep dropping to even lower loss. More details on these observations and their analysis can be found in Section 4. The code implementing the batch adaptive framework using Theano (AlR) is now open source 1, which is applicable to any gradient-based optimization problems.
22
+
23
+ This paper is organized as follows. In Section 2, we briefly introduce the batch adaptive framework proposed by Yin et al. (2017). In Section 3, we extend the batch adaptive framework to momentum algorithm. In Section 4, we demonstrate the performance of BA-M and BA-SGD on Fashion-MNIST (Xiao et al., 2017) and relation extraction task, and then reveal the robustness of BA-Momentum against large step sizes. In Section 5, we discuss some efficiency issue concerned with implementing this batch adaptive framework, and also propose several promising applications based on this framework.
24
+
25
+ # 2 PREREQUISITES
26
+
27
+ In this section we briefly summarize the batch adaptive stochastic gradient descent proposed by Yin et al. (2017).
28
+
29
+ # 2.1 NOTATIONS
30
+
31
+ We use $\mathcal { X }$ and $\mathcal { V }$ to respectively denote the training data set and its random subset. The vector of model parameters is denoted by $\vec { \theta }$ and is subscripted by $t$ to denote an iteration. F is used to denote objective function, while $\mathbf { f } _ { \vec { \theta } }$ is the partial derivative of function F with model parameters $\vec { \theta }$ (i.e. the gradient, computed over the whole data set).
32
+
33
+ # 2.2 BATCH ADAPTIVE FRAMEWORK
34
+
35
+ Let $\vec { \xi _ { j } }$ denote the difference between the approximate gradient computed on an individual instance $\mathbf { g } _ { \vec { \theta } } ^ { j }$ and the real gradient $\mathbf { f } _ { \vec { \theta } }$ , thus, $\hat { \mathbf { f } } _ { \vec { \theta } }$ , the approximate gradient computed on a batch $\mathcal { V }$ can be written
36
+
37
+ $$
38
+ \hat { \mathbf { f } } _ { \vec { \theta } } = \frac { \sum _ { \mathbf { y } _ { j } \in \mathcal { V } } \mathbf { g } _ { \vec { \theta } } ^ { j } } { | \mathcal { V } | } = \mathbf { f } _ { \vec { \theta } } + \frac { \sum _ { \mathbf { y } _ { j } \in \mathcal { V } } \vec { \xi _ { j } } } { | \mathcal { V } | }
39
+ $$
40
+
41
+ The term $\frac { \sum _ { \mathbf { y } _ { j } \in \mathcal { y } } \vec { \xi _ { j } } } { | \mathcal { y } | }$ can be viewed as a random variable determined by the randomly sampled batch $\mathcal { V }$ . On the basis of Central Limit Theorem (CLT), it should satisfy a multi-dimension normal distribution $\begin{array} { r } { \mathcal { N } ( \mathbf { 0 } , \frac { \Sigma } { | \mathcal { V } | } ) } \end{array}$ , where $\pmb { \Sigma }$ is the covariance matrix of $\vec { \xi _ { j } }$ . $\mathbf { f } _ { \vec { \theta } }$ is the real gradient, computed on the whole data set and treated as a constant given the parameters $\vec { \theta }$ . Thus we have $\hat { \mathbf { f } } _ { \vec { \theta } } \sim \mathcal { N } ( \mathbf { f } _ { \vec { \theta } } , \frac { \Sigma } { | \mathcal { V } | } )$ .
42
+
43
+ After modelling the estimation of gradient on a batch as a normally distributed random variable, Yin et al. (2017) uses first-order Taylor extension to approximate the objective function $\mathbb { F } ( \vec { \theta } )$ at any parameter configuration. The equation is shown below.
44
+
45
+ $$
46
+ \boldsymbol { \mathsf { F } } ( \overrightarrow { \theta } ) = \boldsymbol { \mathsf { F } } ( \overrightarrow { \theta _ { 0 } } ) + \mathbf { f } _ { \overrightarrow { \theta _ { 0 } } } ^ { T } \cdot ( \overrightarrow { \theta } - \overrightarrow { \theta _ { 0 } } ) + \mathtt { h } _ { \overrightarrow { \theta _ { 0 } } } ( \overrightarrow { \theta } )
47
+ $$
48
+
49
+ where the function $\mathtt { h } _ { \vec { \theta } _ { 0 } } ( \vec { \theta } )$ is the remainder term satisfying $\begin{array} { r } { \operatorname* { l i m } _ { \vec { \theta } \to \vec { \theta } _ { 0 } } \mathtt { h } _ { \vec { \theta } _ { 0 } } ( \vec { \theta } ) = 0 } \end{array}$
50
+
51
+ If SGD optimization algorithm is adopted to update the parameters, with Equation (1) and Equation (2), the decrease of objective value can be expressed as:
52
+
53
+ $$
54
+ \Delta \mathbf { F } ( \vec { \theta } _ { 0 } ) = \mathbf { F } ( \vec { \theta } _ { 0 } - \eta \hat { \mathbf { f } } _ { \vec { \theta } _ { 0 } } ) - \mathbf { F } ( \vec { \theta } _ { 0 } ) \approx - \eta \mathbf { f } _ { \vec { \theta } _ { 0 } } ^ { T } \cdot \left( \mathbf { f } _ { \vec { \theta } _ { 0 } } + \frac { \sum _ { \mathbf { y } _ { j } \in \mathcal { N } } \vec { \xi } _ { j } } { | \mathcal { y } | } \right) = - \eta \cdot \mathbf { f } _ { \vec { \theta } _ { 0 } } ^ { T } \mathbf { f } _ { \vec { \theta } _ { 0 } } - \eta \cdot \mathbf { f } _ { \vec { \theta } _ { 0 } } ^ { T } \cdot \vec { \varepsilon } _ { \mathcal { V } }
55
+ $$
56
+
57
+ where $\eta$ is the learning rate, and the noise term satisfies $\vec { \varepsilon } _ { y } \sim \mathcal { N } ( \mathbf { 0 } , \frac { \Sigma } { | y | } )$ , then $\vec { \varepsilon } _ { y } ^ { T } \cdot \mathbf { f } _ { \vec { \theta } _ { 0 } }$ can be viewed as a weighted sum of each dimension of vector $\vec { \varepsilon } _ { y }$ , thus satisfying a one-dimension Gaussian distribution, i.e. $\begin{array} { r } { \vec { \varepsilon } _ { y } ^ { T } \cdot \mathbf { f } _ { \vec { \theta _ { 0 } } } \sim \mathcal { N } ( 0 , \frac { \mathbf { f } _ { \vec { \theta _ { 0 } } } ^ { T } \cdot \pmb { \Sigma } \cdot \mathbf { f } _ { \vec { \theta _ { 0 } } } } { | \mathcal { V } | } ) } \end{array}$ Tθ\~0 ·Σ·fθ\~0|Y| ). Then ∆F(\~θ0) also satisfies a Gaussian distribution, i.e. $\begin{array} { r } { \Delta \mathbb { F } ( \vec { \theta _ { 0 } } ) \sim \mathcal { N } ( - \eta \mathbf { f } _ { \vec { \theta _ { 0 } } } ^ { T } \mathbf { f } _ { \vec { \theta _ { 0 } } } , \eta ^ { 2 } \frac { \mathbf { f } _ { \vec { \theta _ { 0 } } } ^ { T } \cdot \Sigma \cdot \mathbf { f } _ { \vec { \theta _ { 0 } } } } { | \mathcal { V } | } ) } \end{array}$ . In practice, they use the approximate gradient $\hat { \mathbf { f } } _ { \vec { \theta _ { 0 } } }$ to calculate the mean and variance of $\Delta \mathbb { F } ( { \vec { \theta } } _ { 0 } )$ .
58
+
59
+ For the covariance matrix of $\vec { \varepsilon } _ { \mathcal { Y } } , \pmb { \Sigma }$ , its unbiased estimation $\hat { \Sigma }$ is:
60
+
61
+ $$
62
+ \hat { \mathbf { \Sigma } } = \frac { \sum _ { \mathbf { y } _ { j } \in \mathcal { Y } } ( \mathbf { g } _ { \vec { \theta _ { 0 } } } ^ { j } - \hat { \mathbf { f } } _ { \vec { \theta _ { 0 } } } ) ( \mathbf { g } _ { \vec { \theta _ { 0 } } } ^ { j } - \hat { \mathbf { f } } _ { \vec { \theta _ { 0 } } } ) ^ { T } } { | \mathcal { Y } | - 1 }
63
+ $$
64
+
65
+ After modelling the decrease of objective value as a normally distributed random variable, Yin et al.
66
+ (2017) abstract the process of objective value change as a random walk game with a Gaussian dice.
67
+
68
+ In the game, the objective value is regarded as a state. For the simplicity of notation, we define a state $s _ { t }$ as below.
69
+
70
+ $$
71
+ s _ { t } = - \frac { \Delta \mathsf { F } } { \eta }
72
+ $$
73
+
74
+ The decrease of objective value, namely the transfer from the current state to the next state is determined by a Gaussian dice, of which the mean solely depend on the current state and the variance is controlled by the state and the batch to be chosen. They define the domain of game state as a half closed set of real numbers $[ S ^ { * } , + \infty )$ , where $S ^ { * }$ is the minimum objective value that the learning can possibly achieve. The game starts with a random state and the goal is to move as close as possible to $S ^ { * }$ . There are two ways of state transfer: one directly decreasing from $S _ { i }$ to $S _ { j }$ , another first reaching minimum point $S ^ { * }$ and then rebounding to $S _ { j }$ .
75
+
76
+ Formally, for state $s _ { t }$ , the moving step $\triangle { s _ { t } }$ is generated by a Gaussian dice $\begin{array} { r } { \mathcal { N } ( \mu _ { t } , \frac { \sigma _ { t } ^ { 2 } } { m } ) } \end{array}$ σ 2t ) , where $\boldsymbol { \mu } _ { t } = \hat { \mathbf { f } } _ { \vec { \theta _ { t } } } ^ { T } \hat { \mathbf { f } } _ { \vec { \theta _ { t } } }$ , $\sigma _ { t } ^ { 2 } = \hat { \mathbf { f } } _ { \vec { \theta } _ { t } } ^ { T } \hat { \Sigma } \hat { \mathbf { f } } _ { \vec { \theta } _ { t } }$ = fˆTθ\~t , $m = | \mathcal { V } |$ , denoting the batch size. The state transition equation is presented below.
77
+
78
+ $$
79
+ s _ { t + 1 } = | s _ { t } - S ^ { * } - \eta \triangle s _ { t } | + S ^ { * } = \left\{ { s _ { t } } - \eta \triangle s _ { t } , \quad \quad \mathrm { i f ~ } s _ { t } - \eta \triangle s _ { t } \geq S ^ { * } \right.
80
+ $$
81
+
82
+ Let $p _ { m } ^ { s _ { t } } ( \triangle s _ { t } )$ denote the probability density function for a random moving step $\begin{array} { r } { \triangle s _ { t } \sim \mathcal N \left( \mu _ { t } , \frac { \sigma _ { t } ^ { 2 } } { m } \right) } \end{array}$ .
83
+ The expected value of next state can be expressed as follows.
84
+
85
+ $$
86
+ \begin{array} { l } { \displaystyle { \bf E } _ { m } ^ { s _ { t } } ( s _ { t + 1 } ) = \int _ { - \infty } ^ { + \infty } p _ { m } ^ { s _ { t } } ( \triangle s _ { t } ) ( | s _ { t } - S ^ { * } - \eta \cdot \triangle s _ { t } | + S ^ { * } ) d \triangle s _ { t } } \\ { = ( s _ { t } - S ^ { * } - \eta \mu _ { t } ) \left\{ \Phi ( a ) - \Phi ( - a ) \right\} + \frac { \eta \sigma _ { t } } { \sqrt { m } } \sqrt { \frac { 2 } { \pi } } e ^ { - \frac { a ^ { 2 } } { 2 } } + S ^ { * } } \\ { \mathrm { w h e r e ~ } a = \frac { s _ { t } - S ^ { * } - \eta \mu _ { t } } { \eta \sigma _ { t } } \sqrt { m } } \end{array}
87
+ $$
88
+
89
+ To decide the best batch size, one should consider both the variance of estimated gradients and computation cost. Large batch can reduce the variance and therefore make more accurate updates, whereas it also requires more computations. Yin et al. (2017) then define a utility function to find a balance. Maximizing the utility means achieving the largest expected decrease of loss per data instance.
90
+
91
+ $$
92
+ \mathbf { u } ( m , s _ { t } ) = { \frac { s _ { t } - \mathbf { E } _ { m } ^ { s _ { t } } \left( s _ { t + 1 } \right) } { m } }
93
+ $$
94
+
95
+ $$
96
+ m ^ { * } \gets \arg \operatorname* { m a x } _ { m } \mathtt { u } ( m , s _ { t } )
97
+ $$
98
+
99
+ where $m ^ { * }$ is the best batch size for the $( t + 1 )$ -th iteration.
100
+
101
+ For more specifications on the BA-SGD algorithm, see Yin et al. (2017).
102
+
103
+ # 3 BATCH ADAPTIVE MOMENTUM
104
+
105
+ The main appeal of momentum is its ability to reduce oscillations and accelerate convergence (Goh, 2017). The idea behind momentum is that it accelerates learning along dimensions where gradient continues pointing to the same direction, and slows down those where sign of gradient constantly changes (Zeiler, 2012). Recent work on momentum, called YellowFin, an automatic tuner for both momentum and learning rate, helps momentum optimizer converge in even fewer iterations than ADAM on large ResNet and LSTM models (Zhang et al., 2017). Since it is both powerful and popular, we would like to also apply the batch adaptive framework to momentum optimizer.
106
+
107
+ # 3.1 MOMENTUM
108
+
109
+ Momentum utilizes past parameter updates with an exponential decay. Its way of update is given by
110
+
111
+ $$
112
+ { \vec { \theta } } _ { t + 1 } = { \vec { \theta } } _ { t } - \mathtt { m } _ { t }
113
+ $$
114
+
115
+ $$
116
+ \boldsymbol { \mathfrak { m } } _ { t } = \rho \boldsymbol { \mathfrak { m } } _ { t - 1 } + \eta \hat { \boldsymbol { \mathfrak { f } } } _ { \vec { \theta _ { t } } }
117
+ $$
118
+
119
+ where ${ \mathfrak { m } } _ { t }$ denotes momentum at the $t$ -th iteration and $\rho$ is the rate controlling the decay of the previous parameter updates. Equation 11 can also be written in the following form.
120
+
121
+ $$
122
+ \mathtt { m } _ { t } = \eta \sum _ { \tau = 0 } ^ { t } \rho ^ { t - \tau } \hat { \mathbf { f } } _ { \vec { \theta } _ { \tau } }
123
+ $$
124
+
125
+ # 3.2 DERIVATION
126
+
127
+ Referring to Equation 3, we can analogically estimate the decrease of objective value in the following expression.
128
+
129
+ $$
130
+ \begin{array} { r } { \Delta \mathtt { F } _ { t } = \mathtt { F } ( \vec { \theta } _ { t + 1 } ) - \mathtt { F } ( \vec { \theta _ { t } } ) = \mathtt { f } _ { \vec { \theta _ { t } } } ^ { T } ( \vec { \theta _ { t + 1 } } - \vec { \theta _ { t } } ) = - \mathtt { f } _ { \vec { \theta _ { t } } } ^ { T } \mathtt { m } _ { t } } \\ { = - \eta \mathtt { f } _ { \vec { \theta _ { t } } } ^ { T } \displaystyle \sum _ { \tau = 0 } ^ { t } \rho ^ { t - \tau } \hat { \mathtt { f } } _ { \vec { \theta _ { \tau } } } = - \eta \mathtt { f } _ { \vec { \theta _ { t } } } ^ { T } \displaystyle \sum _ { \tau = 0 } ^ { t } \rho ^ { t - \tau } ( \mathtt { f } _ { \vec { \theta _ { \tau } } } + \vec { \varepsilon } _ { \tau } ) } \end{array}
131
+ $$
132
+
133
+ where $\begin{array} { r } { \vec { \varepsilon } _ { \tau } = \frac { \sum _ { \mathbf { y } _ { j } \in \mathcal { y } _ { \tau } } \vec { \xi } _ { j } } { | \mathcal { y } _ { \tau } | } } \end{array}$ is the noise term which represents the difference between the real gradient and the estimated gradient calculated on a batch ${ \mathcal { D } } _ { \tau }$ chosen at the $\tau$ -th iteration. Though the estimated gradient from the previous iterations (i.e. $\tau = 0 . . . t - 1 )$ has noise, their batches which respectively determine their noise have already been selected, thus their noise is no longer a random variable but a constant. However, for the $t$ -th iteration, we have not decided which batch to be sampled, therefore $\vec { \varepsilon _ { t } }$ is indeed a random variable, and on the basis of CLT we know it is normally distributed, i.e. $\begin{array} { r } { \vec { \varepsilon _ { t } } \sim \mathcal { N } ( \mathbf { 0 } , \frac { \Sigma _ { t } } { | \mathcal { V } _ { t } | } ) } \end{array}$ . Based on this and the fact that real gradients, $\mathbf { f } _ { \vec { \theta } _ { \tau } }$ $( \tau = 0 . . . t )$ , are all constants for the $t$ -th iteration, we then have the decrease of objective value, $\Delta \mathsf { F } _ { t }$ , satisfying a one-dimensional Gaussian distribution, which is also experimentally verified in Appendix B.
134
+
135
+ We need to calculate the mean and variance of $\Delta \mathsf { F } _ { t }$ , but we prefer not to record all the $\hat { \mathbf { f } } _ { \vec { \theta } _ { \tau } }$ from previous iterations. Therefore, we construct a recurrence formula to avoid the trouble.
136
+
137
+ Let $\begin{array} { r } { \mathcal { P } _ { t } = \sum _ { \tau = 0 } ^ { t } \rho ^ { t - \tau } \big ( \mathbf { f } _ { \vec { \theta } _ { \tau } } + \vec { \varepsilon } _ { \tau } \big ) } \end{array}$ , then we have the following recurrence formula.
138
+
139
+ $$
140
+ \mathcal { P } _ { t } = ( \pounds _ { \vec { \theta _ { t } } } + \vec { \varepsilon _ { t } } ) + \rho \mathcal { P } _ { t - 1 }
141
+ $$
142
+
143
+ Thus the mean and variance of $\mathcal { P } _ { t }$ can be calculated in the following forms.
144
+
145
+ $$
146
+ \begin{array} { c } { \displaystyle \mu _ { \mathcal { P } _ { t } } = \rho \mu _ { \mathcal { P } _ { t - 1 } } + \hat { \mathbf { f } } _ { \vec { \theta _ { t } } } } \\ { \displaystyle \Sigma _ { \mathcal { P } _ { t } } = \frac { \hat { \mathrm { \Sigma } } _ { t } } { | \mathcal { V } _ { t } | } } \end{array}
147
+ $$
148
+
149
+ Now we have trated in Secti $\Delta \mathbf { F } _ { t } \sim \mathcal { N } ( - \eta \hat { \mathbf { f } } _ { \vec { \theta _ { t } } } ^ { T } \mu _ { \mathcal { P } _ { t } } , \eta ^ { 2 } \hat { \mathbf { f } } _ { \vec { \theta _ { t } } } ^ { T } \Sigma _ { \mathcal { P } _ { t } } \hat { \mathbf { f } } _ { \vec { \theta _ { t } } } )$ ith rebound illus-. $\begin{array} { r } { \triangle s _ { t } \sim \mathcal N ( \hat { \mathbf f } _ { \vec { \theta } _ { t } } ^ { T } \mu _ { \mathcal P _ { t } } , \hat { \mathbf f } _ { \vec { \theta _ { t } } } ^ { T } \Sigma _ { \mathcal P _ { t } } \hat { \mathbf f } _ { \vec { \theta _ { t } } } ) } \end{array}$
150
+
151
+ For simplicity, we let $\sigma _ { t } ^ { 2 } = \hat { \mathbf { f } } _ { \vec { \theta _ { t } } } ^ { T } \hat { \Sigma } _ { t } \hat { \mathbf { f } } _ { \vec { \theta _ { t } } }$ , $\mu _ { t } = \hat { \mathbf { f } } _ { \vec { \theta _ { t } } } ^ { T } \mu _ { \mathcal { P } _ { t } }$ , $m = | \mathcal { D } _ { t } |$ , thus $\begin{array} { r } { \triangle s _ { t } \sim N ( \mu _ { t } , \frac { \sigma _ { t } ^ { 2 } } { m } ) } \end{array}$ . Then the expected value of the next state shares the same expression with Equation 7, though the mean of $\triangle { s _ { t } }$ is different.
152
+
153
+ For batch adaptive momentum algorithm, we also adopt the utility function in Equation 8, and the best batch size is the one that maximizes the utility function, calculated through Equation 9.
154
+
155
+ # 3.3 ALGORITHM
156
+
157
+ At the end of this section, we would like to summarize how the batch adaptive momentum algorithm is implemented by presenting the pseudo code below. In the pseudo code, the $M$ stands for the total budget, i.e. the total number of instances used for training, the $m _ { 0 }$ means sampling step, the smallest batch increment. The rest symbols have been introduced before. In this pseudo code, we aim to calculate the optimal batch size for each update step. When an optimal size is determined and it is larger than the current batch size, we need to add more instances to enlarge the batch. However, $s _ { t } , \mu _ { t } , \sigma _ { t }$ will change every time we add more instances, leading to a different optimal size. Thus
158
+
159
+ # Algorithm 1 Batch-Adaptive Momentum
160
+
161
+ <table><tr><td colspan="3">1: procedure BA-MOMENTUM(X,0,n, ρ, M, mo)</td></tr><tr><td colspan="3">while M&gt;O do</td></tr><tr><td>2: 3:</td><td>Vt←</td><td></td></tr><tr><td>4:</td><td>repeat</td><td></td></tr><tr><td>5:</td><td>random sample Z from X - Vt with |Z|= mo</td><td></td></tr><tr><td>6:</td><td>Vt ←VtUz</td><td></td></tr><tr><td>7:</td><td>calculate f,∑t with Vt</td><td>Equation (1) and (4</td></tr><tr><td>8:</td><td>calculate μpt With μPt-1 and ff</td><td>Equation (15</td></tr><tr><td>9:</td><td>St←F(jVt),μt←μpt,Ot←√</td><td></td></tr><tr><td>10:</td><td>m* ← arg maXm u(m, st) where S* is user-specified</td><td></td></tr><tr><td>11:</td><td>until |Vt| ≥ min{m*,|x|}</td><td></td></tr><tr><td>12:</td><td>mt= pmt-1+nfθt</td><td></td></tr><tr><td>13:</td><td>日←日-mt</td><td></td></tr><tr><td>14: 15:</td><td>M←M-|Vtl</td><td></td></tr><tr><td>16:</td><td>t=t+1</td><td></td></tr><tr><td>17:</td><td>end while return θ</td><td></td></tr><tr><td>18:</td><td></td><td></td></tr><tr><td></td><td>end procedure</td><td></td></tr></table>
162
+
163
+ in practice, we can only gradually increase the batch size until it becomes larger than or equal to a running estimate of the optimal batch size. Lastly, when implementing the algorithm, one may note that it is time-consuming to calculate the covariance matrix, $\hat { \Sigma } _ { t }$ . We will discuss a tradeoff and the computation cost of this algorithm in Appendix C.
164
+
165
+ # 4 EXPERIMENT
166
+
167
+ In this section, we present the learning efficiency of different learning algorithms on two deep learning models. One is the CNN for image classification on the dataset of Fashion MNIST (Xiao et al., 2017), and the other is a more complex RNN model for relation extraction on financial documents (Miwa & Bansal, 2016). To evaluate our learning efficiency regardless of the size of the data set, we use epoch as the unit of scanned data and one epoch means all instances in the whole training set. We calculate the training loss on the whole training set each time when the model has scanned one more epoch of data.
168
+
169
+ # 4.1 MODEL AND DATASET
170
+
171
+ Fashion MNIST is a data set of Zalando’s article images, which consists of 60000 training samples and 10000 test samples. Each sample is a $2 8 \times 2 8$ grayscale image, associated with a label from 10 classes. We design a CNN model with 3 convolutional layers for this experiment.
172
+
173
+ Another model we use for relation extraction task is a bi-directional LSTM RNN (Gers, 2001). To train this model, we use 3855 training instances. A detailed description on the specific task and architecture of networks for the two experiments can be found in Appendix A.
174
+
175
+ # 4.2 LOWER LOSS WITH BUDGET LIMIT
176
+
177
+ In both experiments, 12 different optimization algorithms are used. They are BA-Momentum, BASGD, mini-batch momentum and mini-batch SGD with a fixed size of 32, 64, 128, 256 respectively, and manually adjusted mini-batch momentum and SGD (denoted as Manual-Momentum and Manual-SGD). Smith et al. (2017) proposed this manually adjusted mini-batch method that increases the batch size after every manually set number of epochs to reduce the noise scale of estimated gradients during training. Here we let “Manual” methods start with batch sizes of 32 and double their sizes every 25 epochs for image classification task (100 epochs as total budget) and every 75 epochs for relation extraction task (300 epochs as total budget), eventually their sizes will reach 256.
178
+
179
+ For simplicity, we denote mini-batch momentum with a fixed size of 32 as “Mini-32-Momentum”. The same rule applies to “Mini-256-SGD” etc. We choose “Manual” methods and mini-batch methods with different sizes ranging from 32 to 256 as baselines. This is because with a budget limit, the small batch method can have more but less accurate updates, while the large batch method can make fewer but more accurate updates. More updates and accurate updates both can to some extent help the model achieve a lower loss, thus we use these small and large batch methods, together with “Manual” methods as baselines to make the comparative test with “BA” methods more convincing. For “BA” methods, the smallest batch increment, $m _ { 0 }$ , is 32.
180
+
181
+ The result of image classification task on Fashion MNIST is plotted in Figure 1 and Figure 3a. The observation shows that for six different momentum-based optimizations, BA-Momentum achieves a lower loss than the rest five methods after 100 epochs of training. Furthermore, BA-Momentum has fewer fluctuations in later training stage than most of the methods with fixed batch sizes. For the SGD-based optimizations, BA-SGD achieves a second lowest loss while the lowest one is achieved by Mini-32-SGD.
182
+
183
+ Now we take a look at the batch size change per iteration, plotted in Figure 3a. For both BAMomentum and BA-SGD, the batch size keeps almost constant at 32 in an early stage, while it more frequently increases to larger sizes in later training stage. The tendency is especially evident for BA-SGD. The lines in Figure 3a for BA-SGD gets denser as iterations increase, indicating the batch size rises more frequently from 32 to larger sizes. Also, the largest possible batch size for BA-SGD enlarges from 64 to almost 500 as learning proceeds.
184
+
185
+ We display the result of relation extraction task in Figure 2 and Figure 3b. BA-Momentum still achieves the lowest loss. For SGD-based methods, BA-SGD has a similar curve with Mini-32-SGD, while BA-SGD fluctuates much less in later training stage and eventually reach a lower training loss than Mini-32-SGD does. The batch size change for BA-SGD on relation extraction task have the similar trend observed in the image classification result but much less frequent, and the batch size of BA-Momentum stays nearly constant at 32. This might be because each training instance in the relation extraction task is a sentence containing dozens of possible quadruples for binary classification, and a batch of 32 instances is already a relatively large batch in terms of number of binary classifications. Furthermore, the test accuracies in Appendix D show that for this task the larger the batch size is, the worse the model will generalize, thus it is smart for BA-SGD and BAMomentum to choose smaller sizes. In addition, one may note that there is a sudden rise of loss from 0.05 to 0.30 at the 224th epoch in Figure 2b during the training of BA-SGD and the loss soon drops back after this epoch. We presume it is due to encountering some very inaccurate estimates of gradients.
186
+
187
+ From Figure 3, we can see that BA-SGD tends to have much larger batch sizes than BA-Momentum does on both tasks. This might be because momentum-based method is better at reducing the uncertainty of updates by taking into account previous updates, thus it does not need that large a batch which SGD requires, to further reduce the uncertainty.
188
+
189
+ Above all, for the four figures below, the proposed “BA” methods reach the lowest loss in three cases and always perform better than the “Manual” methods. As for test accuracies, we present them in Appendix D.
190
+
191
+ Here we analyze why “BA” methods can achieve the lowest loss in most cases. The “BA” methods adopt a smaller batch in an early stage, which allows them to have more iterations per epoch, then they dynamically enlarge their batch size in later stage to reduce the noise of estimated gradients, because the noise has a larger impact on the accuracy of parameter update in later training stage. Therefore “BA” methods can conserve the fast decrease of Mini-32 methods in early stage and meanwhile keep decreasing rather than severely fluctuate like Mini-32 methods do in later stage.
192
+
193
+ ![](images/62d34abe356430a8bea3c5bda533f38c20a470436ccf1f79ecc96b62ff774b4f.jpg)
194
+ Figure 1: Training loss per epoch on Fashion MNIST.
195
+
196
+ ![](images/94709bee8477fa56220acf2d8dab723abeb21454f7cca1e2982f1fa7fa131214.jpg)
197
+ Figure 2: Training loss per epoch on relation extraction.
198
+
199
+ ![](images/7315d4bcb23c8430087f51be0fec205594ed20a394fd35c9fe6ea5c6ce03eb56.jpg)
200
+ Figure 3: Batch size per iteration on Fashion MNIST and relation extraction.
201
+
202
+ # 4.3 ROBUSTNESS TO LARGE STEP SIZE
203
+
204
+ In the fine tuning process of BA-Momentum, we find that BA-Momentum is robust against large step sizes. Specifically, under a certain range of learning rates, when we tune the learning rate to a higher value, BA-Momentum can still achieve the same or even lower loss while the performance of other mini-batch methods will be degraded, converging to higher loss and fluctuating more. For simplicity, we only choose Mini-32-Momentum as baseline. We choose four different learning rates to test the robustness of BA-Momentum. They are 0.005, 0.01, 0.02, and 0.05.
205
+
206
+ The result is displayed in Figure 4. As shown in Figure 4a, when learning rate rises from 0.005 to 0.01 and then 0.02, BA-Momentum ends up with lower loss from 1.13e-4 to $1 . 6 9 \mathrm { e } { - 5 }$ and then 5.77e6. In contrast, Mini-32-Momentum fluctuates more when the learning rate rises from 0.005 to 0.01, and it ends up with much higher loss when the learning rate increases from 0.01 to 0.02. However, when the learning rate is tuned to 0.05, both BA-Momentum and Mini-32-Momentum suffer from a very high loss. These observations confirm that BA-Momentum is more robust against larger step sizes within a certain reasonable range.
207
+
208
+ We offer an explanation on the robustness of BA-Momentum. As the density of lines in Figure 4b suggests, the higher the learning rate is given, the larger our batch size tends to become. BAMomentum enlarges the batch size to counteract with the larger uncertainty of parameter updates brought by higher learning rate. In this way, it successfully avoids the fluctuations and meanwhile benefits from the larger step size to converge faster.
209
+
210
+ ![](images/0e9ebffb5d1c0bb156766ad1b6360ed5eae8b72ebd7ce6ada9d3dce73928b3bf.jpg)
211
+ Figure 4: Effect of different learning rates on BA-Momentum.
212
+
213
+ # 4.4 BATCH SIZE BOOM
214
+
215
+ We find an intriguing phenomenon when conducting experiments testing the robustness of BAMomentum. In the process of learning, the batch size of BA-Momentum will experience a batch size boom, a concentrated period where the batch size frequently increases to larger values. For example, the batch size boom in Figure 5a is from 80000 iterations to 110000 iterations, while the batch size boom in Figure 5b is from 60000 iterations to 80000 iterations. In the process of learning, when a batch size boom appears, the curve of BA-Momentum starts to diverge with the curve of Mini-32-Momentum. This makes sense because using a larger batch can help BA-Momentum make more accurate updates and thus decrease to a lower loss. Interestingly, the batch size boom always appears at the point in which Mini-32-Momentum reaches its lowest possible loss and after which it fluctuates around that loss. This can be observed in all three plots in Figure 5. As learning rate increases, Mini-32-Momentum reaches its lowest loss earlier, and the batch size boom also appears earlier, helping BA-Momentum keep decreasing to lower loss.
216
+
217
+ ![](images/42c808016d3b7fccfd57503d755d18d8efd8207b64aea8babead6bdd5a51c13f.jpg)
218
+ Figure 5: Batch size boom on different learning rates.
219
+
220
+ # 5 CONCLUSION AND DISCUSSION
221
+
222
+ In this work we developed BA-Momentum algorithm, an extension of the BA-SGD proposed by Yin et al. (2017). We also evaluate the two algorithms on natural language processing and image classification tasks using RNN and CNN respectively. The experiments show that in most cases both batch adaptive methods can achieve lower loss than mini-batch methods after scanning same epochs of data. Furthermore, we also confirm that within a certain range of step sizes, BA-Momentum is more robust against large step size compared with mini-batch methods.
223
+
224
+ In the experiments, we did not evaluate the decrease of training loss with respect to training time. This is because, in the BA-SGD and BA-Momentum algorithm, we have to calculate the derivatives of the loss of each instance from a batch with respect to parameters, and then derive a covariance matrix through Equation 4 from the derivatives. Computing derivatives by backpropagation is time consuming, and now we have to compute all the derivatives of every instance in a batch. However, in mini-batch gradient descent, it is a common practice to calculate an average loss from a batch and then the derivative of this average loss, which requires less time. A feasible approach to reduce the computation cost might be to modify the way Theano do the derivation for a batch of instances and return the square sum of the derivatives, which we plan to study in future work.
225
+
226
+ The batch adaptive framework can have many important applications. It can be adapted to accelerate distributed deep learning. For distributed deep learning, communication cost for synchronizing gradients and parameters among workers and parameter server is its well-known bottleneck (Li et al., 2014a;b; Wen et al., 2017). A larger batch may help make more accurate updates, thus reducing the total number of iterations needed to converge, lowering the communication cost. However, a larger batch also causes a higher computation cost per iteration. In this update-costly environment, the batch adaptive framework may be modified to take both the computation and communication cost into consideration when deciding a proper batch size, which is worth further exploring.
227
+
228
+ Another application is that the batch adaptive framework may help remedy the generalization degradation of using large batch studied by Keskar et al. (2016). They provided solid numeric evidence suggesting that using a larger batch will degrade the quality of the model, as measured by its ability to generalize. They also studied the cause for this generalization drop and presented evidence supporting the view that large-batch methods tend to converge to sharp minimizers of the training and testing functions, which causes this generalization drop. Several strategies to help large-batch methods eliminate this generalization drop was proposed in their work. The most promising one is to warm-start with certain epochs of small-batch regime, and then use large batch for the rest of the training. However, the number of epochs needed to warm start with small batch varies for different data sets, thus a batch adaptive method that can dynamically change the batch size against the characteristics of data is the key to solving this problem. The batch adaptive framework sheds light on this issue. Difficulty lies in how to identify a sharp minima accurately and efficiently in the process of learning and limit the batch size when encountering a sharp minima, which we plan to study in future work.
229
+
230
+ # REFERENCES
231
+
232
+ Theano: A python framework for fast computation of mathematical expressions.
233
+
234
+ John C. Duchi, Elad Hazan, and Yoram Singer. Adaptive subgradient methods for online learning and stochastic optimization. In COLT, 2010.
235
+ Felix Gers. Long short-term memory in recurrent neural networks. Unpublished PhD dissertation, Ecole Polytechnique Fed´ erale de Lausanne, Lausanne, Switzerland ´ , 2001.
236
+ Gabriel Goh. Why momentum really works. Distill, 2017. doi: 10.23915/distill.00006. URL http://distill.pub/2017/momentum.
237
+ Ian J. Goodfellow, Yoshua Bengio, Aaron C. Courville, and Geoffrey E. Hinton. Deep learning. Scholarpedia, 10:32832, 2015.
238
+ Nitish Shirish Keskar, Dheevatsa Mudigere, Jorge Nocedal, Mikhail Smelyanskiy, and Ping Tak Peter Tang. On large-batch training for deep learning: Generalization gap and sharp minima. CoRR, abs/1609.04836, 2016.
239
+ Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. CoRR, abs/1412.6980, 2014.
240
+ Mu Li, David G. Andersen, Alexander J. Smola, and Kai Yu. Communication efficient distributed machine learning with the parameter server. In NIPS, 2014a.
241
+ Mu Li, Tong Zhang, Yuqiang Chen, and Alexander J. Smola. Efficient mini-batch training for stochastic optimization. In KDD, 2014b.
242
+ M. Lichman. UCI machine learning repository. http://archive.ics.uci.edu/ml, 2013.
243
+ Makoto Miwa and Mohit Bansal. End-to-end relation extraction using lstms on sequences and tree structures. CoRR, abs/1601.00770, 2016.
244
+ Ning Qian. On the momentum term in gradient descent learning algorithms. Neural networks, 12 (1):145–151, 1999.
245
+ Herbert Robbins and Sutton Monro. A stochastic approximation method. Ann. Math. Statist., 22(3): 400–407, 09 1951. doi: 10.1214/aoms/1177729586. URL https://doi.org/10.1214/ aoms/1177729586.
246
+ Samuel L. Smith, Pieter-Jan Kindermans, and Quoc V. Le. Don’t decay the learning rate, increase the batch size. CoRR, abs/1711.00489, 2017. URL http://arxiv.org/abs/1711.00489.
247
+ Nitish Srivastava, Geoffrey E. Hinton, Alex Krizhevsky, Ilya Sutskever, and Ruslan Salakhutdinov. Dropout: a simple way to prevent neural networks from overfitting. Journal of Machine Learning Research, 15:1929–1958, 2014.
248
+ Ilya Sutskever, James Martens, George E. Dahl, and Geoffrey E. Hinton. On the importance of initialization and momentum in deep learning. In ICML, 2013.
249
+
250
+ Wei Wen, Cong Xu, Feng Yan, Chunpeng Wu, Yandan Wang, Yiran Chen, and Hai Li. Terngrad: Ternary gradients to reduce communication in distributed deep learning. CoRR, abs/1705.07878, 2017.
251
+
252
+ Han Xiao, Kashif Rasul, and Roland Vollgraf. Fashion-mnist: a novel image dataset for benchmarking machine learning algorithms, 2017.
253
+
254
+ Peifeng Yin, Ping Luo, and Taiga Nakamura. Small batch or large batch?: Gaussian walk with rebound can teach. In KDD, 2017.
255
+
256
+ Matthew D. Zeiler. Adadelta: An adaptive learning rate method. CoRR, abs/1212.5701, 2012.
257
+
258
+ Jian Zhang, Ioannis Mitliagkas, and Christopher Re. Yellowfin and the art of momentum tuning. ´ CoRR, abs/1706.03471, 2017. URL http://arxiv.org/abs/1706.03471.
259
+
260
+ # A ARCHITECTURE OF NETWORKS
261
+
262
+ For the classification task on Fashion MNIST, we use 3 convolutional layers, where each layer has 32, 64, 128 filters respectively, with MaxPool after each convolutional layer. For all layers, we use ReLU activations and Dropout (Srivastava et al., 2014).
263
+
264
+ The relation extraction task aims to extract quadruples in which the elements are correctly matched with each other. The input training instance consists of a sequence representing a sentence from financial documents, and all possible quadruples in this sequence. For the model, a bi-directional LSTM RNN is used. There are two layers of bi-directional LSTM, and a softmax outputs the probability of each quadruple being correct.
265
+
266
+ # B MODEL VERIFICATION
267
+
268
+ In our BA-Momentum method, we model the decrease of objective value as a random variable satisfying a one-dimensional Gaussian distribution in Equation 13. This derivation is on the basis of first order Taylor extension and central limit theorem, involving some approximation. After modelling the decrease of objective value as normally distributed, we then estimated its mean and variance in Equation 15 and Equation 16. Here we would like to use real data from Fashion-MNIST to verify that the decrease of objective value truly satisfies a Gaussian distribution and our estimation is close to its real mean and variance.
269
+
270
+ We compute the decrease of objective value on the whole data set after 10 iterations for 500 times with batches randomly sampled and size fixed at 100. The result is plotted in Figure 6. The observation confirms that the decrease of objective value distributes normally. Its mean and standard deviation are -7.94253e-10 and 3.48414e-11 respectively, while its estimated mean and standard deviation are -8.58165e-10 and 4.58062e-12. Therefore, the decrease of objective value in our BA-M algorithm satisfies a Gaussian distribution and our estimation for its mean and variance is close to the real ones.
271
+
272
+ # C IMPLEMENTATION ISSUES
273
+
274
+ When calculating the covariance matrix in Equation 4, one should note that it takes a space of $O ( d ^ { 2 } )$ with $d$ denoting the dimension of the model parameter vector to store the covariance matrix. The cost is quite high for complex models with a large amount of parameters. Yin et al. (2017) has proposed a practical tradeoff assuming that model parameters are independent of each other, then the covariance matrix becomes a diagonal one, greatly reducing the space and time cost. Here we use a small data set from UCI machine learning repository (Lichman, 2013) to test whether the tradeoff will affect the performance of BA-Momentum.
275
+
276
+ We use two different BA-Momentum. One calculates the exact covariance matrix, while the other calculates its estimated diagonal matrix. The task is a classification task with 3 classes and 42 features. The training set is composed of around 60000 data instances. After training for 14 epochs, we yield the following result. The Figure 7a show the batch size change as learning proceeds for matrix method and diagonal method respectively. The Figure 7b demonstrates different training loss per epoch for two different methods. From the figures we can see that the trend of batch size change for two methods are almost the same, therefore they perform equally well on the training loss descent. This indicates estimating the covariance matrix by its diagonal matrix will not cause degradation to the performance of BA-Momentum.
277
+
278
+ ![](images/631a7ece17b02842ed50fb260091e79e25fbb37b6a60b33e7d42134143a4b6f0.jpg)
279
+ Figure 6: Verification on the distribution of decrease of objective value
280
+
281
+ ![](images/12e4c1d901185c0d1349a93f845f5df1a445f68b1f14a6adb99c8a836ac4ce75.jpg)
282
+ Figure 7: Effects of calculating exact covariance matrix and its estimated diagonal.
283
+
284
+ As for the cost of computing the optimal batch size, on average it takes up $1 . 0 3 \%$ and $0 . 6 1 \%$ of the total computing time per iteration for BA-Momentum and BA-SGD respectively on the image classification task, and the percentage on the relation extraction task is $1 . 3 1 \%$ and $0 . 9 2 \%$ for BAMomentum and BA-SGD respectively. Computing the optimal batch size involves calculating some means and variances, and a binary search to find the $m ^ { * }$ that maximizes the utility function. Both operations take little time.
285
+
286
+ # D TEST ACCURACIES
287
+
288
+ We show the test accuracies of different methods on the image classification task and relation extraction task in Table 1. For the relation extraction task, we would like to mention that its accuracy is an intersection over union, specifically defined as the ratio of the intersection of the predicted quadruples and the ground truth quadruples to their union. For the evaluation, we record the test accuracies of each method after every epoch’s training and present below the best test accuracies achieved by each method during their whole budget’s training (100 epochs for image classification task and 300 epochs for relation extraction task).
289
+
290
+ The proposed “BA” methods achieve two best test accuracies in the following four cases (SGD-based on Fashion MNIST and SGD-based on relation extraction). In the other two cases, the test accuracies achieved by “BA” methods, $9 1 . 3 3 \%$ and $8 8 . 4 6 \%$ , are still very close to the best ones, $9 1 . 6 4 \%$ and $8 9 . 0 2 \%$ respectively. What’s more, these results are realized in a self-adaptive way and require no fine tuning, while the best accuracies in the two momentum-based cases are achieved by totally different fixed batch sizes, indicating a tuning process. In contrast with “BA” methods, “Manual” methods which manually increase the batch size performs well on Fashion MNIST, whereas they ends up with the fourth highest test accuracies on the relation extraction task, indicating that “Manual” methods also need fine tuning to realize a satisfactory generalization.
291
+
292
+ Table 1: Best test accuracies achieved by different methods on Fashion MNIST and relation extraction
293
+
294
+ <table><tr><td rowspan="2"></td><td colspan="2">Fashion MNIST</td><td colspan="2">Relation extraction</td></tr><tr><td>Momentum</td><td>SGD</td><td>Momentum</td><td>SGD</td></tr><tr><td>Mini-32</td><td>90.93%</td><td>90.87%</td><td>89.02%</td><td>75.13%</td></tr><tr><td>Mini-64</td><td>91.17%</td><td>90.64%</td><td>87.12%</td><td>58.01%</td></tr><tr><td>Mini-128</td><td>91.64%</td><td>90.37%</td><td>85.33%</td><td>31.21%</td></tr><tr><td>Mini-256</td><td>90.76%</td><td>90.16%</td><td>79.37%</td><td>28.11%</td></tr><tr><td>Manual</td><td>91.35%</td><td>90.84%</td><td>86.31%</td><td>50.02%</td></tr><tr><td>BA</td><td>91.33%</td><td>91.01 %</td><td>88.46%</td><td>75.57%</td></tr></table>
parse/train/SybqeKgA-/SybqeKgA-_content_list.json ADDED
@@ -0,0 +1,1454 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "type": "text",
4
+ "text": "ON BATCH ADAPTIVE TRAINING FOR DEEP LEARNING: LOWER LOSS AND LARGER STEP SIZE ",
5
+ "text_level": 1,
6
+ "bbox": [
7
+ 176,
8
+ 98,
9
+ 821,
10
+ 146
11
+ ],
12
+ "page_idx": 0
13
+ },
14
+ {
15
+ "type": "text",
16
+ "text": "Anonymous authors Paper under double-blind review ",
17
+ "bbox": [
18
+ 184,
19
+ 171,
20
+ 400,
21
+ 198
22
+ ],
23
+ "page_idx": 0
24
+ },
25
+ {
26
+ "type": "text",
27
+ "text": "ABSTRACT ",
28
+ "text_level": 1,
29
+ "bbox": [
30
+ 454,
31
+ 234,
32
+ 544,
33
+ 251
34
+ ],
35
+ "page_idx": 0
36
+ },
37
+ {
38
+ "type": "text",
39
+ "text": "Mini-batch gradient descent and its variants are commonly used in deep learning. The principle of mini-batch gradient descent is to use noisy gradient calculated on a batch to estimate the real gradient, thus balancing the computation cost per iteration and the uncertainty of noisy gradient. However, its batch size is a fixed hyper parameter requiring manual setting before training the neural network. Yin et al. (2017) proposed a batch adaptive stochastic gradient descent (BA-SGD) that can dynamically choose a proper batch size as learning proceeds. We extend the BA-SGD to momentum algorithm, and evaluate both the BA-SGD and the batch adaptive momentum (BA-Momentum) on two deep learning tasks from natural language processing to image classification. Experiments confirm that batch adaptive methods can achieve a lower loss compared with mini-batch methods and methods that manually increase the batch size, after scanning the same epochs of data. Furthermore, our BA-Momentum is more robust against larger step sizes, in that it can dynamically enlarge the batch size to reduce the larger uncertainty brought by larger step sizes. We also identified an interesting phenomenon, batch size boom. The code implementing the batch adaptive framework is now open source, applicable to any gradient-based optimization problems. ",
40
+ "bbox": [
41
+ 233,
42
+ 265,
43
+ 764,
44
+ 501
45
+ ],
46
+ "page_idx": 0
47
+ },
48
+ {
49
+ "type": "text",
50
+ "text": "1 INTRODUCTION ",
51
+ "text_level": 1,
52
+ "bbox": [
53
+ 176,
54
+ 523,
55
+ 334,
56
+ 540
57
+ ],
58
+ "page_idx": 0
59
+ },
60
+ {
61
+ "type": "text",
62
+ "text": "Efficiency of training large neural networks becomes increasingly important as deep neural networks tend to have more parameters and require more training data to achieve the state-of-the-art performance on a wide variety of tasks (Goodfellow et al., 2015). For training deep neural networks, stochastic gradient descent (SGD) (Robbins & Monro, 1951) and its variants, including momentum, which utilizes past updates with an exponential decay (Qian, 1999), and other methods that can adapt different learning rates for each dimension, such as ADAGRAD (Duchi et al., 2010), ADADELTA (Zeiler, 2012) and ADAM (Kingma & Ba, 2014), are commonly used. ",
63
+ "bbox": [
64
+ 174,
65
+ 554,
66
+ 825,
67
+ 651
68
+ ],
69
+ "page_idx": 0
70
+ },
71
+ {
72
+ "type": "text",
73
+ "text": "SGD approximates the gradient by only using a single data instance in each iteration, which may lead to uncertainty of approximation. This uncertainty can be reduced by adopting a batch of instances to do the approximation. In mini-batch SGD, the batch size is a fixed hyper parameter requiring manual setting before training the neural network. Setting the batch size typically involves a tuning procedure in which the best batch size is chosen by a series of attempts. ",
74
+ "bbox": [
75
+ 174,
76
+ 659,
77
+ 823,
78
+ 728
79
+ ],
80
+ "page_idx": 0
81
+ },
82
+ {
83
+ "type": "text",
84
+ "text": "Yin et al. (2017) has developed a batch adaptive stochastic gradient descent (BA-SGD) that can dynamically choose a proper batch size as learning proceeds. BA-SGD models the decrease of objective value as a Gaussian random walk game with rebound on the basis of Taylor extension and central limit theorem. Its core idea is to only update the parameters when the ratio between the expected decrease of objective value and the current batch size is large enough, otherwise enlarge the batch size to better approximate the gradient. It claimed that by smartly choosing the batch size, the BA-SGD not only conserves the fast convergence of SGD algorithm but also avoids too frequent model updates, and compared with mini-batch SGD, its objective value decreases more, after scanning the same amount of data. ",
85
+ "bbox": [
86
+ 174,
87
+ 736,
88
+ 825,
89
+ 861
90
+ ],
91
+ "page_idx": 0
92
+ },
93
+ {
94
+ "type": "text",
95
+ "text": "However, the experiment in Yin et al. (2017) was only conducted on some simple classification tasks using fully connected neural network with one input layer, one output layer and two hidden layers. What about the evaluation on some complex neural networks, such as convolutional neural network (CNN) and recurrent neural network (RNN)? How well would the batch adaptive algorithm perform on other complicated tasks related to natural language processing and computer vision? Furthermore, empirical studies reveal that SGD usually performs not so well in some deep and complex neural networks (Sutskever et al., 2013). Can this batch adaptive framework be extended to other gradient based optimization algorithms except SGD? ",
96
+ "bbox": [
97
+ 174,
98
+ 867,
99
+ 823,
100
+ 922
101
+ ],
102
+ "page_idx": 0
103
+ },
104
+ {
105
+ "type": "text",
106
+ "text": "",
107
+ "bbox": [
108
+ 174,
109
+ 103,
110
+ 823,
111
+ 160
112
+ ],
113
+ "page_idx": 1
114
+ },
115
+ {
116
+ "type": "text",
117
+ "text": "Therefore, in this paper we extend the batch adaptive framework to momentum algorithm, and evaluate both the batch adaptive SGD (BA-SGD) and the batch adaptive momentum (BA-Momentum) on two deep learning tasks from natural language processing to image classification. These two tasks use RNN and CNN respectively, which cover most of the deep learning models. ",
118
+ "bbox": [
119
+ 174,
120
+ 166,
121
+ 825,
122
+ 222
123
+ ],
124
+ "page_idx": 1
125
+ },
126
+ {
127
+ "type": "text",
128
+ "text": "In our experiments, we have the following observations. First, for batch adaptive methods, their loss functions converge to lower values after scanning same epoches of data, compared with fixedbatch-size methods. Second, BA-Momentum is more robust against large step sizes by dynamically enlarging the batch size to counteract with the larger noise brought by larger step sizes. Third, we observed a batch size boom, a concentrated period where the batch size frequently increases to larger values, in the training of BA-Momentum. The batch size boom is of significance in that it always appears at the point where mini-batch method starts to reach its lowest possible loss and it helps BA-Momentum keep dropping to even lower loss. More details on these observations and their analysis can be found in Section 4. The code implementing the batch adaptive framework using Theano (AlR) is now open source 1, which is applicable to any gradient-based optimization problems. ",
129
+ "bbox": [
130
+ 174,
131
+ 229,
132
+ 825,
133
+ 382
134
+ ],
135
+ "page_idx": 1
136
+ },
137
+ {
138
+ "type": "text",
139
+ "text": "This paper is organized as follows. In Section 2, we briefly introduce the batch adaptive framework proposed by Yin et al. (2017). In Section 3, we extend the batch adaptive framework to momentum algorithm. In Section 4, we demonstrate the performance of BA-M and BA-SGD on Fashion-MNIST (Xiao et al., 2017) and relation extraction task, and then reveal the robustness of BA-Momentum against large step sizes. In Section 5, we discuss some efficiency issue concerned with implementing this batch adaptive framework, and also propose several promising applications based on this framework. ",
140
+ "bbox": [
141
+ 174,
142
+ 388,
143
+ 825,
144
+ 486
145
+ ],
146
+ "page_idx": 1
147
+ },
148
+ {
149
+ "type": "text",
150
+ "text": "2 PREREQUISITES ",
151
+ "text_level": 1,
152
+ "bbox": [
153
+ 176,
154
+ 508,
155
+ 338,
156
+ 525
157
+ ],
158
+ "page_idx": 1
159
+ },
160
+ {
161
+ "type": "text",
162
+ "text": "In this section we briefly summarize the batch adaptive stochastic gradient descent proposed by Yin et al. (2017). ",
163
+ "bbox": [
164
+ 173,
165
+ 540,
166
+ 823,
167
+ 569
168
+ ],
169
+ "page_idx": 1
170
+ },
171
+ {
172
+ "type": "text",
173
+ "text": "2.1 NOTATIONS ",
174
+ "text_level": 1,
175
+ "bbox": [
176
+ 174,
177
+ 587,
178
+ 295,
179
+ 601
180
+ ],
181
+ "page_idx": 1
182
+ },
183
+ {
184
+ "type": "text",
185
+ "text": "We use $\\mathcal { X }$ and $\\mathcal { V }$ to respectively denote the training data set and its random subset. The vector of model parameters is denoted by $\\vec { \\theta }$ and is subscripted by $t$ to denote an iteration. F is used to denote objective function, while $\\mathbf { f } _ { \\vec { \\theta } }$ is the partial derivative of function F with model parameters $\\vec { \\theta }$ (i.e. the gradient, computed over the whole data set). ",
186
+ "bbox": [
187
+ 174,
188
+ 613,
189
+ 825,
190
+ 674
191
+ ],
192
+ "page_idx": 1
193
+ },
194
+ {
195
+ "type": "text",
196
+ "text": "2.2 BATCH ADAPTIVE FRAMEWORK ",
197
+ "text_level": 1,
198
+ "bbox": [
199
+ 174,
200
+ 691,
201
+ 439,
202
+ 707
203
+ ],
204
+ "page_idx": 1
205
+ },
206
+ {
207
+ "type": "text",
208
+ "text": "Let $\\vec { \\xi _ { j } }$ denote the difference between the approximate gradient computed on an individual instance $\\mathbf { g } _ { \\vec { \\theta } } ^ { j }$ and the real gradient $\\mathbf { f } _ { \\vec { \\theta } }$ , thus, $\\hat { \\mathbf { f } } _ { \\vec { \\theta } }$ , the approximate gradient computed on a batch $\\mathcal { V }$ can be written ",
209
+ "bbox": [
210
+ 173,
211
+ 718,
212
+ 825,
213
+ 762
214
+ ],
215
+ "page_idx": 1
216
+ },
217
+ {
218
+ "type": "equation",
219
+ "img_path": "images/4aac4f2ff1fb8f9929be4d0135342eb52dd738a2bda31f6313680847302cbdb8.jpg",
220
+ "text": "$$\n\\hat { \\mathbf { f } } _ { \\vec { \\theta } } = \\frac { \\sum _ { \\mathbf { y } _ { j } \\in \\mathcal { V } } \\mathbf { g } _ { \\vec { \\theta } } ^ { j } } { | \\mathcal { V } | } = \\mathbf { f } _ { \\vec { \\theta } } + \\frac { \\sum _ { \\mathbf { y } _ { j } \\in \\mathcal { V } } \\vec { \\xi _ { j } } } { | \\mathcal { V } | }\n$$",
221
+ "text_format": "latex",
222
+ "bbox": [
223
+ 375,
224
+ 760,
225
+ 620,
226
+ 800
227
+ ],
228
+ "page_idx": 1
229
+ },
230
+ {
231
+ "type": "text",
232
+ "text": "The term $\\frac { \\sum _ { \\mathbf { y } _ { j } \\in \\mathcal { y } } \\vec { \\xi _ { j } } } { | \\mathcal { y } | }$ can be viewed as a random variable determined by the randomly sampled batch $\\mathcal { V }$ . On the basis of Central Limit Theorem (CLT), it should satisfy a multi-dimension normal distribution $\\begin{array} { r } { \\mathcal { N } ( \\mathbf { 0 } , \\frac { \\Sigma } { | \\mathcal { V } | } ) } \\end{array}$ , where $\\pmb { \\Sigma }$ is the covariance matrix of $\\vec { \\xi _ { j } }$ . $\\mathbf { f } _ { \\vec { \\theta } }$ is the real gradient, computed on the whole data set and treated as a constant given the parameters $\\vec { \\theta }$ . Thus we have $\\hat { \\mathbf { f } } _ { \\vec { \\theta } } \\sim \\mathcal { N } ( \\mathbf { f } _ { \\vec { \\theta } } , \\frac { \\Sigma } { | \\mathcal { V } | } )$ . ",
233
+ "bbox": [
234
+ 173,
235
+ 805,
236
+ 825,
237
+ 885
238
+ ],
239
+ "page_idx": 1
240
+ },
241
+ {
242
+ "type": "text",
243
+ "text": "After modelling the estimation of gradient on a batch as a normally distributed random variable, Yin et al. (2017) uses first-order Taylor extension to approximate the objective function $\\mathbb { F } ( \\vec { \\theta } )$ at any parameter configuration. The equation is shown below. ",
244
+ "bbox": [
245
+ 174,
246
+ 103,
247
+ 825,
248
+ 148
249
+ ],
250
+ "page_idx": 2
251
+ },
252
+ {
253
+ "type": "equation",
254
+ "img_path": "images/8b8d3d59680d053121aa6c696e1f4c102e6fdcfd2fb18d934d6595d25ab4d40d.jpg",
255
+ "text": "$$\n\\boldsymbol { \\mathsf { F } } ( \\overrightarrow { \\theta } ) = \\boldsymbol { \\mathsf { F } } ( \\overrightarrow { \\theta _ { 0 } } ) + \\mathbf { f } _ { \\overrightarrow { \\theta _ { 0 } } } ^ { T } \\cdot ( \\overrightarrow { \\theta } - \\overrightarrow { \\theta _ { 0 } } ) + \\mathtt { h } _ { \\overrightarrow { \\theta _ { 0 } } } ( \\overrightarrow { \\theta } )\n$$",
256
+ "text_format": "latex",
257
+ "bbox": [
258
+ 367,
259
+ 152,
260
+ 632,
261
+ 176
262
+ ],
263
+ "page_idx": 2
264
+ },
265
+ {
266
+ "type": "text",
267
+ "text": "where the function $\\mathtt { h } _ { \\vec { \\theta } _ { 0 } } ( \\vec { \\theta } )$ is the remainder term satisfying $\\begin{array} { r } { \\operatorname* { l i m } _ { \\vec { \\theta } \\to \\vec { \\theta } _ { 0 } } \\mathtt { h } _ { \\vec { \\theta } _ { 0 } } ( \\vec { \\theta } ) = 0 } \\end{array}$ ",
268
+ "bbox": [
269
+ 174,
270
+ 183,
271
+ 694,
272
+ 202
273
+ ],
274
+ "page_idx": 2
275
+ },
276
+ {
277
+ "type": "text",
278
+ "text": "If SGD optimization algorithm is adopted to update the parameters, with Equation (1) and Equation (2), the decrease of objective value can be expressed as: ",
279
+ "bbox": [
280
+ 173,
281
+ 207,
282
+ 820,
283
+ 236
284
+ ],
285
+ "page_idx": 2
286
+ },
287
+ {
288
+ "type": "equation",
289
+ "img_path": "images/90eeb748c7ba707993952bf78c8e248a5bd198ab777403d58ed211d81dc895b9.jpg",
290
+ "text": "$$\n\\Delta \\mathbf { F } ( \\vec { \\theta } _ { 0 } ) = \\mathbf { F } ( \\vec { \\theta } _ { 0 } - \\eta \\hat { \\mathbf { f } } _ { \\vec { \\theta } _ { 0 } } ) - \\mathbf { F } ( \\vec { \\theta } _ { 0 } ) \\approx - \\eta \\mathbf { f } _ { \\vec { \\theta } _ { 0 } } ^ { T } \\cdot \\left( \\mathbf { f } _ { \\vec { \\theta } _ { 0 } } + \\frac { \\sum _ { \\mathbf { y } _ { j } \\in \\mathcal { N } } \\vec { \\xi } _ { j } } { | \\mathcal { y } | } \\right) = - \\eta \\cdot \\mathbf { f } _ { \\vec { \\theta } _ { 0 } } ^ { T } \\mathbf { f } _ { \\vec { \\theta } _ { 0 } } - \\eta \\cdot \\mathbf { f } _ { \\vec { \\theta } _ { 0 } } ^ { T } \\cdot \\vec { \\varepsilon } _ { \\mathcal { V } }\n$$",
291
+ "text_format": "latex",
292
+ "bbox": [
293
+ 183,
294
+ 239,
295
+ 795,
296
+ 280
297
+ ],
298
+ "page_idx": 2
299
+ },
300
+ {
301
+ "type": "text",
302
+ "text": "where $\\eta$ is the learning rate, and the noise term satisfies $\\vec { \\varepsilon } _ { y } \\sim \\mathcal { N } ( \\mathbf { 0 } , \\frac { \\Sigma } { | y | } )$ , then $\\vec { \\varepsilon } _ { y } ^ { T } \\cdot \\mathbf { f } _ { \\vec { \\theta } _ { 0 } }$ can be viewed as a weighted sum of each dimension of vector $\\vec { \\varepsilon } _ { y }$ , thus satisfying a one-dimension Gaussian distribution, i.e. $\\begin{array} { r } { \\vec { \\varepsilon } _ { y } ^ { T } \\cdot \\mathbf { f } _ { \\vec { \\theta _ { 0 } } } \\sim \\mathcal { N } ( 0 , \\frac { \\mathbf { f } _ { \\vec { \\theta _ { 0 } } } ^ { T } \\cdot \\pmb { \\Sigma } \\cdot \\mathbf { f } _ { \\vec { \\theta _ { 0 } } } } { | \\mathcal { V } | } ) } \\end{array}$ Tθ\\~0 ·Σ·fθ\\~0|Y| ). Then ∆F(\\~θ0) also satisfies a Gaussian distribution, i.e. $\\begin{array} { r } { \\Delta \\mathbb { F } ( \\vec { \\theta _ { 0 } } ) \\sim \\mathcal { N } ( - \\eta \\mathbf { f } _ { \\vec { \\theta _ { 0 } } } ^ { T } \\mathbf { f } _ { \\vec { \\theta _ { 0 } } } , \\eta ^ { 2 } \\frac { \\mathbf { f } _ { \\vec { \\theta _ { 0 } } } ^ { T } \\cdot \\Sigma \\cdot \\mathbf { f } _ { \\vec { \\theta _ { 0 } } } } { | \\mathcal { V } | } ) } \\end{array}$ . In practice, they use the approximate gradient $\\hat { \\mathbf { f } } _ { \\vec { \\theta _ { 0 } } }$ to calculate the mean and variance of $\\Delta \\mathbb { F } ( { \\vec { \\theta } } _ { 0 } )$ . ",
303
+ "bbox": [
304
+ 173,
305
+ 285,
306
+ 826,
307
+ 388
308
+ ],
309
+ "page_idx": 2
310
+ },
311
+ {
312
+ "type": "text",
313
+ "text": "For the covariance matrix of $\\vec { \\varepsilon } _ { \\mathcal { Y } } , \\pmb { \\Sigma }$ , its unbiased estimation $\\hat { \\Sigma }$ is: ",
314
+ "bbox": [
315
+ 173,
316
+ 395,
317
+ 599,
318
+ 411
319
+ ],
320
+ "page_idx": 2
321
+ },
322
+ {
323
+ "type": "equation",
324
+ "img_path": "images/d947c934eb6c6c99273cd7c7519ed1a789c8dfec729dfdc472c8618f365be1e2.jpg",
325
+ "text": "$$\n\\hat { \\mathbf { \\Sigma } } = \\frac { \\sum _ { \\mathbf { y } _ { j } \\in \\mathcal { Y } } ( \\mathbf { g } _ { \\vec { \\theta _ { 0 } } } ^ { j } - \\hat { \\mathbf { f } } _ { \\vec { \\theta _ { 0 } } } ) ( \\mathbf { g } _ { \\vec { \\theta _ { 0 } } } ^ { j } - \\hat { \\mathbf { f } } _ { \\vec { \\theta _ { 0 } } } ) ^ { T } } { | \\mathcal { Y } | - 1 }\n$$",
326
+ "text_format": "latex",
327
+ "bbox": [
328
+ 369,
329
+ 415,
330
+ 629,
331
+ 457
332
+ ],
333
+ "page_idx": 2
334
+ },
335
+ {
336
+ "type": "text",
337
+ "text": "After modelling the decrease of objective value as a normally distributed random variable, Yin et al. \n(2017) abstract the process of objective value change as a random walk game with a Gaussian dice. ",
338
+ "bbox": [
339
+ 171,
340
+ 467,
341
+ 823,
342
+ 497
343
+ ],
344
+ "page_idx": 2
345
+ },
346
+ {
347
+ "type": "text",
348
+ "text": "In the game, the objective value is regarded as a state. For the simplicity of notation, we define a state $s _ { t }$ as below. ",
349
+ "bbox": [
350
+ 171,
351
+ 502,
352
+ 823,
353
+ 531
354
+ ],
355
+ "page_idx": 2
356
+ },
357
+ {
358
+ "type": "equation",
359
+ "img_path": "images/d8de9eb8847f590938af4b36e5e2d48e4a4056eca18af569748de3e1a8020312.jpg",
360
+ "text": "$$\ns _ { t } = - \\frac { \\Delta \\mathsf { F } } { \\eta }\n$$",
361
+ "text_format": "latex",
362
+ "bbox": [
363
+ 459,
364
+ 535,
365
+ 537,
366
+ 568
367
+ ],
368
+ "page_idx": 2
369
+ },
370
+ {
371
+ "type": "text",
372
+ "text": "The decrease of objective value, namely the transfer from the current state to the next state is determined by a Gaussian dice, of which the mean solely depend on the current state and the variance is controlled by the state and the batch to be chosen. They define the domain of game state as a half closed set of real numbers $[ S ^ { * } , + \\infty )$ , where $S ^ { * }$ is the minimum objective value that the learning can possibly achieve. The game starts with a random state and the goal is to move as close as possible to $S ^ { * }$ . There are two ways of state transfer: one directly decreasing from $S _ { i }$ to $S _ { j }$ , another first reaching minimum point $S ^ { * }$ and then rebounding to $S _ { j }$ . ",
373
+ "bbox": [
374
+ 173,
375
+ 571,
376
+ 825,
377
+ 671
378
+ ],
379
+ "page_idx": 2
380
+ },
381
+ {
382
+ "type": "text",
383
+ "text": "Formally, for state $s _ { t }$ , the moving step $\\triangle { s _ { t } }$ is generated by a Gaussian dice $\\begin{array} { r } { \\mathcal { N } ( \\mu _ { t } , \\frac { \\sigma _ { t } ^ { 2 } } { m } ) } \\end{array}$ σ 2t ) , where $\\boldsymbol { \\mu } _ { t } = \\hat { \\mathbf { f } } _ { \\vec { \\theta _ { t } } } ^ { T } \\hat { \\mathbf { f } } _ { \\vec { \\theta _ { t } } }$ , $\\sigma _ { t } ^ { 2 } = \\hat { \\mathbf { f } } _ { \\vec { \\theta } _ { t } } ^ { T } \\hat { \\Sigma } \\hat { \\mathbf { f } } _ { \\vec { \\theta } _ { t } }$ = fˆTθ\\~t , $m = | \\mathcal { V } |$ , denoting the batch size. The state transition equation is presented below. ",
384
+ "bbox": [
385
+ 173,
386
+ 679,
387
+ 825,
388
+ 732
389
+ ],
390
+ "page_idx": 2
391
+ },
392
+ {
393
+ "type": "equation",
394
+ "img_path": "images/feb0a027ad3c59b8e5220e529e474787cb2e455d4374b5fb03ee2d8a990b3e30.jpg",
395
+ "text": "$$\ns _ { t + 1 } = | s _ { t } - S ^ { * } - \\eta \\triangle s _ { t } | + S ^ { * } = \\left\\{ { s _ { t } } - \\eta \\triangle s _ { t } , \\quad \\quad \\mathrm { i f ~ } s _ { t } - \\eta \\triangle s _ { t } \\geq S ^ { * } \\right.\n$$",
396
+ "text_format": "latex",
397
+ "bbox": [
398
+ 245,
399
+ 737,
400
+ 751,
401
+ 772
402
+ ],
403
+ "page_idx": 2
404
+ },
405
+ {
406
+ "type": "text",
407
+ "text": "Let $p _ { m } ^ { s _ { t } } ( \\triangle s _ { t } )$ denote the probability density function for a random moving step $\\begin{array} { r } { \\triangle s _ { t } \\sim \\mathcal N \\left( \\mu _ { t } , \\frac { \\sigma _ { t } ^ { 2 } } { m } \\right) } \\end{array}$ . \nThe expected value of next state can be expressed as follows. ",
408
+ "bbox": [
409
+ 173,
410
+ 781,
411
+ 825,
412
+ 816
413
+ ],
414
+ "page_idx": 2
415
+ },
416
+ {
417
+ "type": "equation",
418
+ "img_path": "images/c6c751fdc7cbc1a488486b6c1c7eec8aa7d764c5e546fe2d89b6d315602be4b7.jpg",
419
+ "text": "$$\n\\begin{array} { l } { \\displaystyle { \\bf E } _ { m } ^ { s _ { t } } ( s _ { t + 1 } ) = \\int _ { - \\infty } ^ { + \\infty } p _ { m } ^ { s _ { t } } ( \\triangle s _ { t } ) ( | s _ { t } - S ^ { * } - \\eta \\cdot \\triangle s _ { t } | + S ^ { * } ) d \\triangle s _ { t } } \\\\ { = ( s _ { t } - S ^ { * } - \\eta \\mu _ { t } ) \\left\\{ \\Phi ( a ) - \\Phi ( - a ) \\right\\} + \\frac { \\eta \\sigma _ { t } } { \\sqrt { m } } \\sqrt { \\frac { 2 } { \\pi } } e ^ { - \\frac { a ^ { 2 } } { 2 } } + S ^ { * } } \\\\ { \\mathrm { w h e r e ~ } a = \\frac { s _ { t } - S ^ { * } - \\eta \\mu _ { t } } { \\eta \\sigma _ { t } } \\sqrt { m } } \\end{array}\n$$",
420
+ "text_format": "latex",
421
+ "bbox": [
422
+ 290,
423
+ 821,
424
+ 705,
425
+ 930
426
+ ],
427
+ "page_idx": 2
428
+ },
429
+ {
430
+ "type": "text",
431
+ "text": "To decide the best batch size, one should consider both the variance of estimated gradients and computation cost. Large batch can reduce the variance and therefore make more accurate updates, whereas it also requires more computations. Yin et al. (2017) then define a utility function to find a balance. Maximizing the utility means achieving the largest expected decrease of loss per data instance. ",
432
+ "bbox": [
433
+ 173,
434
+ 103,
435
+ 825,
436
+ 172
437
+ ],
438
+ "page_idx": 3
439
+ },
440
+ {
441
+ "type": "equation",
442
+ "img_path": "images/067fbf3bf59b45aebcfbb58d210dbe89e92147588ce0a53f30cd5c35b87c8509.jpg",
443
+ "text": "$$\n\\mathbf { u } ( m , s _ { t } ) = { \\frac { s _ { t } - \\mathbf { E } _ { m } ^ { s _ { t } } \\left( s _ { t + 1 } \\right) } { m } }\n$$",
444
+ "text_format": "latex",
445
+ "bbox": [
446
+ 405,
447
+ 170,
448
+ 593,
449
+ 200
450
+ ],
451
+ "page_idx": 3
452
+ },
453
+ {
454
+ "type": "equation",
455
+ "img_path": "images/8e60495f60fcfe760a8895af6402ffc9b34ea2d58158f347184445a4d91c4eaa.jpg",
456
+ "text": "$$\nm ^ { * } \\gets \\arg \\operatorname* { m a x } _ { m } \\mathtt { u } ( m , s _ { t } )\n$$",
457
+ "text_format": "latex",
458
+ "bbox": [
459
+ 415,
460
+ 212,
461
+ 583,
462
+ 234
463
+ ],
464
+ "page_idx": 3
465
+ },
466
+ {
467
+ "type": "text",
468
+ "text": "where $m ^ { * }$ is the best batch size for the $( t + 1 )$ -th iteration. ",
469
+ "bbox": [
470
+ 173,
471
+ 238,
472
+ 558,
473
+ 253
474
+ ],
475
+ "page_idx": 3
476
+ },
477
+ {
478
+ "type": "text",
479
+ "text": "For more specifications on the BA-SGD algorithm, see Yin et al. (2017). ",
480
+ "bbox": [
481
+ 174,
482
+ 260,
483
+ 648,
484
+ 275
485
+ ],
486
+ "page_idx": 3
487
+ },
488
+ {
489
+ "type": "text",
490
+ "text": "3 BATCH ADAPTIVE MOMENTUM ",
491
+ "text_level": 1,
492
+ "bbox": [
493
+ 176,
494
+ 295,
495
+ 468,
496
+ 311
497
+ ],
498
+ "page_idx": 3
499
+ },
500
+ {
501
+ "type": "text",
502
+ "text": "The main appeal of momentum is its ability to reduce oscillations and accelerate convergence (Goh, 2017). The idea behind momentum is that it accelerates learning along dimensions where gradient continues pointing to the same direction, and slows down those where sign of gradient constantly changes (Zeiler, 2012). Recent work on momentum, called YellowFin, an automatic tuner for both momentum and learning rate, helps momentum optimizer converge in even fewer iterations than ADAM on large ResNet and LSTM models (Zhang et al., 2017). Since it is both powerful and popular, we would like to also apply the batch adaptive framework to momentum optimizer. ",
503
+ "bbox": [
504
+ 173,
505
+ 327,
506
+ 825,
507
+ 426
508
+ ],
509
+ "page_idx": 3
510
+ },
511
+ {
512
+ "type": "text",
513
+ "text": "3.1 MOMENTUM ",
514
+ "text_level": 1,
515
+ "bbox": [
516
+ 174,
517
+ 443,
518
+ 303,
519
+ 457
520
+ ],
521
+ "page_idx": 3
522
+ },
523
+ {
524
+ "type": "text",
525
+ "text": "Momentum utilizes past parameter updates with an exponential decay. Its way of update is given by ",
526
+ "bbox": [
527
+ 173,
528
+ 468,
529
+ 823,
530
+ 484
531
+ ],
532
+ "page_idx": 3
533
+ },
534
+ {
535
+ "type": "equation",
536
+ "img_path": "images/d32cc351a6ad7f9d9d81fccd3b85025499fa4a1f8b079d6853c6ad7cffa1d57b.jpg",
537
+ "text": "$$\n { \\vec { \\theta } } _ { t + 1 } = { \\vec { \\theta } } _ { t } - \\mathtt { m } _ { t }\n$$",
538
+ "text_format": "latex",
539
+ "bbox": [
540
+ 446,
541
+ 493,
542
+ 550,
543
+ 513
544
+ ],
545
+ "page_idx": 3
546
+ },
547
+ {
548
+ "type": "equation",
549
+ "img_path": "images/70e9e5632b2bbdf1a74f9340e2a8469e76595fb387b782039fa3d73d9c9eb1e9.jpg",
550
+ "text": "$$\n\\boldsymbol { \\mathfrak { m } } _ { t } = \\rho \\boldsymbol { \\mathfrak { m } } _ { t - 1 } + \\eta \\hat { \\boldsymbol { \\mathfrak { f } } } _ { \\vec { \\theta _ { t } } }\n$$",
551
+ "text_format": "latex",
552
+ "bbox": [
553
+ 434,
554
+ 530,
555
+ 562,
556
+ 550
557
+ ],
558
+ "page_idx": 3
559
+ },
560
+ {
561
+ "type": "text",
562
+ "text": "where ${ \\mathfrak { m } } _ { t }$ denotes momentum at the $t$ -th iteration and $\\rho$ is the rate controlling the decay of the previous parameter updates. Equation 11 can also be written in the following form. ",
563
+ "bbox": [
564
+ 169,
565
+ 553,
566
+ 823,
567
+ 582
568
+ ],
569
+ "page_idx": 3
570
+ },
571
+ {
572
+ "type": "equation",
573
+ "img_path": "images/14b9b87d2ae89125f72f0aa982f3a2d0b592c49b03ccd7dd7a15303fabf98a20.jpg",
574
+ "text": "$$\n\\mathtt { m } _ { t } = \\eta \\sum _ { \\tau = 0 } ^ { t } \\rho ^ { t - \\tau } \\hat { \\mathbf { f } } _ { \\vec { \\theta } _ { \\tau } }\n$$",
575
+ "text_format": "latex",
576
+ "bbox": [
577
+ 431,
578
+ 588,
579
+ 563,
580
+ 632
581
+ ],
582
+ "page_idx": 3
583
+ },
584
+ {
585
+ "type": "text",
586
+ "text": "3.2 DERIVATION ",
587
+ "text_level": 1,
588
+ "bbox": [
589
+ 174,
590
+ 647,
591
+ 303,
592
+ 661
593
+ ],
594
+ "page_idx": 3
595
+ },
596
+ {
597
+ "type": "text",
598
+ "text": "Referring to Equation 3, we can analogically estimate the decrease of objective value in the following expression. ",
599
+ "bbox": [
600
+ 174,
601
+ 672,
602
+ 825,
603
+ 702
604
+ ],
605
+ "page_idx": 3
606
+ },
607
+ {
608
+ "type": "equation",
609
+ "img_path": "images/10e4d759b07b7f8941a1ee3d73d85e9544750316cc5d11ce58d243974aa23eca.jpg",
610
+ "text": "$$\n\\begin{array} { r } { \\Delta \\mathtt { F } _ { t } = \\mathtt { F } ( \\vec { \\theta } _ { t + 1 } ) - \\mathtt { F } ( \\vec { \\theta _ { t } } ) = \\mathtt { f } _ { \\vec { \\theta _ { t } } } ^ { T } ( \\vec { \\theta _ { t + 1 } } - \\vec { \\theta _ { t } } ) = - \\mathtt { f } _ { \\vec { \\theta _ { t } } } ^ { T } \\mathtt { m } _ { t } } \\\\ { = - \\eta \\mathtt { f } _ { \\vec { \\theta _ { t } } } ^ { T } \\displaystyle \\sum _ { \\tau = 0 } ^ { t } \\rho ^ { t - \\tau } \\hat { \\mathtt { f } } _ { \\vec { \\theta _ { \\tau } } } = - \\eta \\mathtt { f } _ { \\vec { \\theta _ { t } } } ^ { T } \\displaystyle \\sum _ { \\tau = 0 } ^ { t } \\rho ^ { t - \\tau } ( \\mathtt { f } _ { \\vec { \\theta _ { \\tau } } } + \\vec { \\varepsilon } _ { \\tau } ) } \\end{array}\n$$",
611
+ "text_format": "latex",
612
+ "bbox": [
613
+ 323,
614
+ 707,
615
+ 673,
616
+ 777
617
+ ],
618
+ "page_idx": 3
619
+ },
620
+ {
621
+ "type": "text",
622
+ "text": "where $\\begin{array} { r } { \\vec { \\varepsilon } _ { \\tau } = \\frac { \\sum _ { \\mathbf { y } _ { j } \\in \\mathcal { y } _ { \\tau } } \\vec { \\xi } _ { j } } { | \\mathcal { y } _ { \\tau } | } } \\end{array}$ is the noise term which represents the difference between the real gradient and the estimated gradient calculated on a batch ${ \\mathcal { D } } _ { \\tau }$ chosen at the $\\tau$ -th iteration. Though the estimated gradient from the previous iterations (i.e. $\\tau = 0 . . . t - 1 )$ has noise, their batches which respectively determine their noise have already been selected, thus their noise is no longer a random variable but a constant. However, for the $t$ -th iteration, we have not decided which batch to be sampled, therefore $\\vec { \\varepsilon _ { t } }$ is indeed a random variable, and on the basis of CLT we know it is normally distributed, i.e. $\\begin{array} { r } { \\vec { \\varepsilon _ { t } } \\sim \\mathcal { N } ( \\mathbf { 0 } , \\frac { \\Sigma _ { t } } { | \\mathcal { V } _ { t } | } ) } \\end{array}$ . Based on this and the fact that real gradients, $\\mathbf { f } _ { \\vec { \\theta } _ { \\tau } }$ $( \\tau = 0 . . . t )$ , are all constants for the $t$ -th iteration, we then have the decrease of objective value, $\\Delta \\mathsf { F } _ { t }$ , satisfying a one-dimensional Gaussian distribution, which is also experimentally verified in Appendix B. ",
623
+ "bbox": [
624
+ 173,
625
+ 784,
626
+ 825,
627
+ 924
628
+ ],
629
+ "page_idx": 3
630
+ },
631
+ {
632
+ "type": "text",
633
+ "text": "We need to calculate the mean and variance of $\\Delta \\mathsf { F } _ { t }$ , but we prefer not to record all the $\\hat { \\mathbf { f } } _ { \\vec { \\theta } _ { \\tau } }$ from previous iterations. Therefore, we construct a recurrence formula to avoid the trouble. ",
634
+ "bbox": [
635
+ 171,
636
+ 103,
637
+ 823,
638
+ 133
639
+ ],
640
+ "page_idx": 4
641
+ },
642
+ {
643
+ "type": "text",
644
+ "text": "Let $\\begin{array} { r } { \\mathcal { P } _ { t } = \\sum _ { \\tau = 0 } ^ { t } \\rho ^ { t - \\tau } \\big ( \\mathbf { f } _ { \\vec { \\theta } _ { \\tau } } + \\vec { \\varepsilon } _ { \\tau } \\big ) } \\end{array}$ , then we have the following recurrence formula. ",
645
+ "bbox": [
646
+ 176,
647
+ 141,
648
+ 705,
649
+ 159
650
+ ],
651
+ "page_idx": 4
652
+ },
653
+ {
654
+ "type": "equation",
655
+ "img_path": "images/43bf954133bf829519105d04548022b13dde0d836f93df4e9d09dd528ac66bce.jpg",
656
+ "text": "$$\n\\mathcal { P } _ { t } = ( \\pounds _ { \\vec { \\theta _ { t } } } + \\vec { \\varepsilon _ { t } } ) + \\rho \\mathcal { P } _ { t - 1 }\n$$",
657
+ "text_format": "latex",
658
+ "bbox": [
659
+ 413,
660
+ 160,
661
+ 584,
662
+ 179
663
+ ],
664
+ "page_idx": 4
665
+ },
666
+ {
667
+ "type": "text",
668
+ "text": "Thus the mean and variance of $\\mathcal { P } _ { t }$ can be calculated in the following forms. ",
669
+ "bbox": [
670
+ 174,
671
+ 179,
672
+ 668,
673
+ 194
674
+ ],
675
+ "page_idx": 4
676
+ },
677
+ {
678
+ "type": "equation",
679
+ "img_path": "images/a4ed9e9f5dac49d2b676fd35877188b703549c8dd60cb0852ca7af899a0e9c7c.jpg",
680
+ "text": "$$\n\\begin{array} { c } { \\displaystyle \\mu _ { \\mathcal { P } _ { t } } = \\rho \\mu _ { \\mathcal { P } _ { t - 1 } } + \\hat { \\mathbf { f } } _ { \\vec { \\theta _ { t } } } } \\\\ { \\displaystyle \\Sigma _ { \\mathcal { P } _ { t } } = \\frac { \\hat { \\mathrm { \\Sigma } } _ { t } } { | \\mathcal { V } _ { t } | } } \\end{array}\n$$",
681
+ "text_format": "latex",
682
+ "bbox": [
683
+ 426,
684
+ 193,
685
+ 573,
686
+ 260
687
+ ],
688
+ "page_idx": 4
689
+ },
690
+ {
691
+ "type": "text",
692
+ "text": "Now we have trated in Secti $\\Delta \\mathbf { F } _ { t } \\sim \\mathcal { N } ( - \\eta \\hat { \\mathbf { f } } _ { \\vec { \\theta _ { t } } } ^ { T } \\mu _ { \\mathcal { P } _ { t } } , \\eta ^ { 2 } \\hat { \\mathbf { f } } _ { \\vec { \\theta _ { t } } } ^ { T } \\Sigma _ { \\mathcal { P } _ { t } } \\hat { \\mathbf { f } } _ { \\vec { \\theta _ { t } } } )$ ith rebound illus-. $\\begin{array} { r } { \\triangle s _ { t } \\sim \\mathcal N ( \\hat { \\mathbf f } _ { \\vec { \\theta } _ { t } } ^ { T } \\mu _ { \\mathcal P _ { t } } , \\hat { \\mathbf f } _ { \\vec { \\theta _ { t } } } ^ { T } \\Sigma _ { \\mathcal P _ { t } } \\hat { \\mathbf f } _ { \\vec { \\theta _ { t } } } ) } \\end{array}$ ",
693
+ "bbox": [
694
+ 174,
695
+ 265,
696
+ 821,
697
+ 305
698
+ ],
699
+ "page_idx": 4
700
+ },
701
+ {
702
+ "type": "text",
703
+ "text": "For simplicity, we let $\\sigma _ { t } ^ { 2 } = \\hat { \\mathbf { f } } _ { \\vec { \\theta _ { t } } } ^ { T } \\hat { \\Sigma } _ { t } \\hat { \\mathbf { f } } _ { \\vec { \\theta _ { t } } }$ , $\\mu _ { t } = \\hat { \\mathbf { f } } _ { \\vec { \\theta _ { t } } } ^ { T } \\mu _ { \\mathcal { P } _ { t } }$ , $m = | \\mathcal { D } _ { t } |$ , thus $\\begin{array} { r } { \\triangle s _ { t } \\sim N ( \\mu _ { t } , \\frac { \\sigma _ { t } ^ { 2 } } { m } ) } \\end{array}$ . Then the expected value of the next state shares the same expression with Equation 7, though the mean of $\\triangle { s _ { t } }$ is different. ",
704
+ "bbox": [
705
+ 174,
706
+ 314,
707
+ 825,
708
+ 363
709
+ ],
710
+ "page_idx": 4
711
+ },
712
+ {
713
+ "type": "text",
714
+ "text": "For batch adaptive momentum algorithm, we also adopt the utility function in Equation 8, and the best batch size is the one that maximizes the utility function, calculated through Equation 9. ",
715
+ "bbox": [
716
+ 174,
717
+ 369,
718
+ 823,
719
+ 398
720
+ ],
721
+ "page_idx": 4
722
+ },
723
+ {
724
+ "type": "text",
725
+ "text": "3.3 ALGORITHM ",
726
+ "text_level": 1,
727
+ "bbox": [
728
+ 174,
729
+ 414,
730
+ 303,
731
+ 428
732
+ ],
733
+ "page_idx": 4
734
+ },
735
+ {
736
+ "type": "text",
737
+ "text": "At the end of this section, we would like to summarize how the batch adaptive momentum algorithm is implemented by presenting the pseudo code below. In the pseudo code, the $M$ stands for the total budget, i.e. the total number of instances used for training, the $m _ { 0 }$ means sampling step, the smallest batch increment. The rest symbols have been introduced before. In this pseudo code, we aim to calculate the optimal batch size for each update step. When an optimal size is determined and it is larger than the current batch size, we need to add more instances to enlarge the batch. However, $s _ { t } , \\mu _ { t } , \\sigma _ { t }$ will change every time we add more instances, leading to a different optimal size. Thus ",
738
+ "bbox": [
739
+ 173,
740
+ 439,
741
+ 825,
742
+ 537
743
+ ],
744
+ "page_idx": 4
745
+ },
746
+ {
747
+ "type": "text",
748
+ "text": "Algorithm 1 Batch-Adaptive Momentum ",
749
+ "text_level": 1,
750
+ "bbox": [
751
+ 176,
752
+ 550,
753
+ 446,
754
+ 565
755
+ ],
756
+ "page_idx": 4
757
+ },
758
+ {
759
+ "type": "table",
760
+ "img_path": "images/bd16ed44af955b208ed65f2866582434dcb274d8023b45ee06c188b1bab8b4f3.jpg",
761
+ "table_caption": [],
762
+ "table_footnote": [],
763
+ "table_body": "<table><tr><td colspan=\"3\">1: procedure BA-MOMENTUM(X,0,n, ρ, M, mo)</td></tr><tr><td colspan=\"3\">while M&gt;O do</td></tr><tr><td>2: 3:</td><td>Vt←</td><td></td></tr><tr><td>4:</td><td>repeat</td><td></td></tr><tr><td>5:</td><td>random sample Z from X - Vt with |Z|= mo</td><td></td></tr><tr><td>6:</td><td>Vt ←VtUz</td><td></td></tr><tr><td>7:</td><td>calculate f,∑t with Vt</td><td>Equation (1) and (4</td></tr><tr><td>8:</td><td>calculate μpt With μPt-1 and ff</td><td>Equation (15</td></tr><tr><td>9:</td><td>St←F(jVt),μt←μpt,Ot←√</td><td></td></tr><tr><td>10:</td><td>m* ← arg maXm u(m, st) where S* is user-specified</td><td></td></tr><tr><td>11:</td><td>until |Vt| ≥ min{m*,|x|}</td><td></td></tr><tr><td>12:</td><td>mt= pmt-1+nfθt</td><td></td></tr><tr><td>13:</td><td>日←日-mt</td><td></td></tr><tr><td>14: 15:</td><td>M←M-|Vtl</td><td></td></tr><tr><td>16:</td><td>t=t+1</td><td></td></tr><tr><td>17:</td><td>end while return θ</td><td></td></tr><tr><td>18:</td><td></td><td></td></tr><tr><td></td><td>end procedure</td><td></td></tr></table>",
764
+ "bbox": [
765
+ 174,
766
+ 569,
767
+ 818,
768
+ 853
769
+ ],
770
+ "page_idx": 4
771
+ },
772
+ {
773
+ "type": "text",
774
+ "text": "in practice, we can only gradually increase the batch size until it becomes larger than or equal to a running estimate of the optimal batch size. Lastly, when implementing the algorithm, one may note that it is time-consuming to calculate the covariance matrix, $\\hat { \\Sigma } _ { t }$ . We will discuss a tradeoff and the computation cost of this algorithm in Appendix C. ",
775
+ "bbox": [
776
+ 173,
777
+ 866,
778
+ 825,
779
+ 924
780
+ ],
781
+ "page_idx": 4
782
+ },
783
+ {
784
+ "type": "text",
785
+ "text": "4 EXPERIMENT ",
786
+ "text_level": 1,
787
+ "bbox": [
788
+ 174,
789
+ 102,
790
+ 316,
791
+ 117
792
+ ],
793
+ "page_idx": 5
794
+ },
795
+ {
796
+ "type": "text",
797
+ "text": "In this section, we present the learning efficiency of different learning algorithms on two deep learning models. One is the CNN for image classification on the dataset of Fashion MNIST (Xiao et al., 2017), and the other is a more complex RNN model for relation extraction on financial documents (Miwa & Bansal, 2016). To evaluate our learning efficiency regardless of the size of the data set, we use epoch as the unit of scanned data and one epoch means all instances in the whole training set. We calculate the training loss on the whole training set each time when the model has scanned one more epoch of data. ",
798
+ "bbox": [
799
+ 174,
800
+ 133,
801
+ 825,
802
+ 231
803
+ ],
804
+ "page_idx": 5
805
+ },
806
+ {
807
+ "type": "text",
808
+ "text": "4.1 MODEL AND DATASET ",
809
+ "text_level": 1,
810
+ "bbox": [
811
+ 176,
812
+ 247,
813
+ 370,
814
+ 262
815
+ ],
816
+ "page_idx": 5
817
+ },
818
+ {
819
+ "type": "text",
820
+ "text": "Fashion MNIST is a data set of Zalando’s article images, which consists of 60000 training samples and 10000 test samples. Each sample is a $2 8 \\times 2 8$ grayscale image, associated with a label from 10 classes. We design a CNN model with 3 convolutional layers for this experiment. ",
821
+ "bbox": [
822
+ 176,
823
+ 273,
824
+ 825,
825
+ 315
826
+ ],
827
+ "page_idx": 5
828
+ },
829
+ {
830
+ "type": "text",
831
+ "text": "Another model we use for relation extraction task is a bi-directional LSTM RNN (Gers, 2001). To train this model, we use 3855 training instances. A detailed description on the specific task and architecture of networks for the two experiments can be found in Appendix A. ",
832
+ "bbox": [
833
+ 176,
834
+ 323,
835
+ 825,
836
+ 364
837
+ ],
838
+ "page_idx": 5
839
+ },
840
+ {
841
+ "type": "text",
842
+ "text": "4.2 LOWER LOSS WITH BUDGET LIMIT ",
843
+ "text_level": 1,
844
+ "bbox": [
845
+ 176,
846
+ 382,
847
+ 459,
848
+ 397
849
+ ],
850
+ "page_idx": 5
851
+ },
852
+ {
853
+ "type": "text",
854
+ "text": "In both experiments, 12 different optimization algorithms are used. They are BA-Momentum, BASGD, mini-batch momentum and mini-batch SGD with a fixed size of 32, 64, 128, 256 respectively, and manually adjusted mini-batch momentum and SGD (denoted as Manual-Momentum and Manual-SGD). Smith et al. (2017) proposed this manually adjusted mini-batch method that increases the batch size after every manually set number of epochs to reduce the noise scale of estimated gradients during training. Here we let “Manual” methods start with batch sizes of 32 and double their sizes every 25 epochs for image classification task (100 epochs as total budget) and every 75 epochs for relation extraction task (300 epochs as total budget), eventually their sizes will reach 256. ",
855
+ "bbox": [
856
+ 174,
857
+ 409,
858
+ 825,
859
+ 520
860
+ ],
861
+ "page_idx": 5
862
+ },
863
+ {
864
+ "type": "text",
865
+ "text": "For simplicity, we denote mini-batch momentum with a fixed size of 32 as “Mini-32-Momentum”. The same rule applies to “Mini-256-SGD” etc. We choose “Manual” methods and mini-batch methods with different sizes ranging from 32 to 256 as baselines. This is because with a budget limit, the small batch method can have more but less accurate updates, while the large batch method can make fewer but more accurate updates. More updates and accurate updates both can to some extent help the model achieve a lower loss, thus we use these small and large batch methods, together with “Manual” methods as baselines to make the comparative test with “BA” methods more convincing. For “BA” methods, the smallest batch increment, $m _ { 0 }$ , is 32. ",
866
+ "bbox": [
867
+ 174,
868
+ 526,
869
+ 825,
870
+ 637
871
+ ],
872
+ "page_idx": 5
873
+ },
874
+ {
875
+ "type": "text",
876
+ "text": "The result of image classification task on Fashion MNIST is plotted in Figure 1 and Figure 3a. The observation shows that for six different momentum-based optimizations, BA-Momentum achieves a lower loss than the rest five methods after 100 epochs of training. Furthermore, BA-Momentum has fewer fluctuations in later training stage than most of the methods with fixed batch sizes. For the SGD-based optimizations, BA-SGD achieves a second lowest loss while the lowest one is achieved by Mini-32-SGD. ",
877
+ "bbox": [
878
+ 174,
879
+ 645,
880
+ 825,
881
+ 728
882
+ ],
883
+ "page_idx": 5
884
+ },
885
+ {
886
+ "type": "text",
887
+ "text": "Now we take a look at the batch size change per iteration, plotted in Figure 3a. For both BAMomentum and BA-SGD, the batch size keeps almost constant at 32 in an early stage, while it more frequently increases to larger sizes in later training stage. The tendency is especially evident for BA-SGD. The lines in Figure 3a for BA-SGD gets denser as iterations increase, indicating the batch size rises more frequently from 32 to larger sizes. Also, the largest possible batch size for BA-SGD enlarges from 64 to almost 500 as learning proceeds. ",
888
+ "bbox": [
889
+ 174,
890
+ 734,
891
+ 825,
892
+ 819
893
+ ],
894
+ "page_idx": 5
895
+ },
896
+ {
897
+ "type": "text",
898
+ "text": "We display the result of relation extraction task in Figure 2 and Figure 3b. BA-Momentum still achieves the lowest loss. For SGD-based methods, BA-SGD has a similar curve with Mini-32-SGD, while BA-SGD fluctuates much less in later training stage and eventually reach a lower training loss than Mini-32-SGD does. The batch size change for BA-SGD on relation extraction task have the similar trend observed in the image classification result but much less frequent, and the batch size of BA-Momentum stays nearly constant at 32. This might be because each training instance in the relation extraction task is a sentence containing dozens of possible quadruples for binary classification, and a batch of 32 instances is already a relatively large batch in terms of number of binary classifications. Furthermore, the test accuracies in Appendix D show that for this task the larger the batch size is, the worse the model will generalize, thus it is smart for BA-SGD and BAMomentum to choose smaller sizes. In addition, one may note that there is a sudden rise of loss from 0.05 to 0.30 at the 224th epoch in Figure 2b during the training of BA-SGD and the loss soon drops back after this epoch. We presume it is due to encountering some very inaccurate estimates of gradients. ",
899
+ "bbox": [
900
+ 174,
901
+ 825,
902
+ 825,
903
+ 924
904
+ ],
905
+ "page_idx": 5
906
+ },
907
+ {
908
+ "type": "text",
909
+ "text": "",
910
+ "bbox": [
911
+ 174,
912
+ 103,
913
+ 825,
914
+ 200
915
+ ],
916
+ "page_idx": 6
917
+ },
918
+ {
919
+ "type": "text",
920
+ "text": "From Figure 3, we can see that BA-SGD tends to have much larger batch sizes than BA-Momentum does on both tasks. This might be because momentum-based method is better at reducing the uncertainty of updates by taking into account previous updates, thus it does not need that large a batch which SGD requires, to further reduce the uncertainty. ",
921
+ "bbox": [
922
+ 174,
923
+ 208,
924
+ 825,
925
+ 263
926
+ ],
927
+ "page_idx": 6
928
+ },
929
+ {
930
+ "type": "text",
931
+ "text": "Above all, for the four figures below, the proposed “BA” methods reach the lowest loss in three cases and always perform better than the “Manual” methods. As for test accuracies, we present them in Appendix D. ",
932
+ "bbox": [
933
+ 174,
934
+ 271,
935
+ 825,
936
+ 313
937
+ ],
938
+ "page_idx": 6
939
+ },
940
+ {
941
+ "type": "text",
942
+ "text": "Here we analyze why “BA” methods can achieve the lowest loss in most cases. The “BA” methods adopt a smaller batch in an early stage, which allows them to have more iterations per epoch, then they dynamically enlarge their batch size in later stage to reduce the noise of estimated gradients, because the noise has a larger impact on the accuracy of parameter update in later training stage. Therefore “BA” methods can conserve the fast decrease of Mini-32 methods in early stage and meanwhile keep decreasing rather than severely fluctuate like Mini-32 methods do in later stage. ",
943
+ "bbox": [
944
+ 173,
945
+ 320,
946
+ 825,
947
+ 404
948
+ ],
949
+ "page_idx": 6
950
+ },
951
+ {
952
+ "type": "image",
953
+ "img_path": "images/62d34abe356430a8bea3c5bda533f38c20a470436ccf1f79ecc96b62ff774b4f.jpg",
954
+ "image_caption": [
955
+ "Figure 1: Training loss per epoch on Fashion MNIST. "
956
+ ],
957
+ "image_footnote": [],
958
+ "bbox": [
959
+ 174,
960
+ 438,
961
+ 745,
962
+ 626
963
+ ],
964
+ "page_idx": 6
965
+ },
966
+ {
967
+ "type": "image",
968
+ "img_path": "images/94709bee8477fa56220acf2d8dab723abeb21454f7cca1e2982f1fa7fa131214.jpg",
969
+ "image_caption": [
970
+ "Figure 2: Training loss per epoch on relation extraction. "
971
+ ],
972
+ "image_footnote": [],
973
+ "bbox": [
974
+ 174,
975
+ 695,
976
+ 743,
977
+ 885
978
+ ],
979
+ "page_idx": 6
980
+ },
981
+ {
982
+ "type": "image",
983
+ "img_path": "images/7315d4bcb23c8430087f51be0fec205594ed20a394fd35c9fe6ea5c6ce03eb56.jpg",
984
+ "image_caption": [
985
+ "Figure 3: Batch size per iteration on Fashion MNIST and relation extraction. "
986
+ ],
987
+ "image_footnote": [],
988
+ "bbox": [
989
+ 192,
990
+ 121,
991
+ 745,
992
+ 308
993
+ ],
994
+ "page_idx": 7
995
+ },
996
+ {
997
+ "type": "text",
998
+ "text": "4.3 ROBUSTNESS TO LARGE STEP SIZE ",
999
+ "text_level": 1,
1000
+ "bbox": [
1001
+ 176,
1002
+ 366,
1003
+ 460,
1004
+ 380
1005
+ ],
1006
+ "page_idx": 7
1007
+ },
1008
+ {
1009
+ "type": "text",
1010
+ "text": "In the fine tuning process of BA-Momentum, we find that BA-Momentum is robust against large step sizes. Specifically, under a certain range of learning rates, when we tune the learning rate to a higher value, BA-Momentum can still achieve the same or even lower loss while the performance of other mini-batch methods will be degraded, converging to higher loss and fluctuating more. For simplicity, we only choose Mini-32-Momentum as baseline. We choose four different learning rates to test the robustness of BA-Momentum. They are 0.005, 0.01, 0.02, and 0.05. ",
1011
+ "bbox": [
1012
+ 173,
1013
+ 393,
1014
+ 825,
1015
+ 477
1016
+ ],
1017
+ "page_idx": 7
1018
+ },
1019
+ {
1020
+ "type": "text",
1021
+ "text": "The result is displayed in Figure 4. As shown in Figure 4a, when learning rate rises from 0.005 to 0.01 and then 0.02, BA-Momentum ends up with lower loss from 1.13e-4 to $1 . 6 9 \\mathrm { e } { - 5 }$ and then 5.77e6. In contrast, Mini-32-Momentum fluctuates more when the learning rate rises from 0.005 to 0.01, and it ends up with much higher loss when the learning rate increases from 0.01 to 0.02. However, when the learning rate is tuned to 0.05, both BA-Momentum and Mini-32-Momentum suffer from a very high loss. These observations confirm that BA-Momentum is more robust against larger step sizes within a certain reasonable range. ",
1022
+ "bbox": [
1023
+ 173,
1024
+ 483,
1025
+ 825,
1026
+ 582
1027
+ ],
1028
+ "page_idx": 7
1029
+ },
1030
+ {
1031
+ "type": "text",
1032
+ "text": "We offer an explanation on the robustness of BA-Momentum. As the density of lines in Figure 4b suggests, the higher the learning rate is given, the larger our batch size tends to become. BAMomentum enlarges the batch size to counteract with the larger uncertainty of parameter updates brought by higher learning rate. In this way, it successfully avoids the fluctuations and meanwhile benefits from the larger step size to converge faster. ",
1033
+ "bbox": [
1034
+ 174,
1035
+ 588,
1036
+ 825,
1037
+ 659
1038
+ ],
1039
+ "page_idx": 7
1040
+ },
1041
+ {
1042
+ "type": "image",
1043
+ "img_path": "images/0e9ebffb5d1c0bb156766ad1b6360ed5eae8b72ebd7ce6ada9d3dce73928b3bf.jpg",
1044
+ "image_caption": [
1045
+ "Figure 4: Effect of different learning rates on BA-Momentum. "
1046
+ ],
1047
+ "image_footnote": [],
1048
+ "bbox": [
1049
+ 184,
1050
+ 694,
1051
+ 745,
1052
+ 882
1053
+ ],
1054
+ "page_idx": 7
1055
+ },
1056
+ {
1057
+ "type": "text",
1058
+ "text": "4.4 BATCH SIZE BOOM ",
1059
+ "text_level": 1,
1060
+ "bbox": [
1061
+ 176,
1062
+ 103,
1063
+ 348,
1064
+ 117
1065
+ ],
1066
+ "page_idx": 8
1067
+ },
1068
+ {
1069
+ "type": "text",
1070
+ "text": "We find an intriguing phenomenon when conducting experiments testing the robustness of BAMomentum. In the process of learning, the batch size of BA-Momentum will experience a batch size boom, a concentrated period where the batch size frequently increases to larger values. For example, the batch size boom in Figure 5a is from 80000 iterations to 110000 iterations, while the batch size boom in Figure 5b is from 60000 iterations to 80000 iterations. In the process of learning, when a batch size boom appears, the curve of BA-Momentum starts to diverge with the curve of Mini-32-Momentum. This makes sense because using a larger batch can help BA-Momentum make more accurate updates and thus decrease to a lower loss. Interestingly, the batch size boom always appears at the point in which Mini-32-Momentum reaches its lowest possible loss and after which it fluctuates around that loss. This can be observed in all three plots in Figure 5. As learning rate increases, Mini-32-Momentum reaches its lowest loss earlier, and the batch size boom also appears earlier, helping BA-Momentum keep decreasing to lower loss. ",
1071
+ "bbox": [
1072
+ 173,
1073
+ 131,
1074
+ 825,
1075
+ 296
1076
+ ],
1077
+ "page_idx": 8
1078
+ },
1079
+ {
1080
+ "type": "image",
1081
+ "img_path": "images/42c808016d3b7fccfd57503d755d18d8efd8207b64aea8babead6bdd5a51c13f.jpg",
1082
+ "image_caption": [
1083
+ "Figure 5: Batch size boom on different learning rates. "
1084
+ ],
1085
+ "image_footnote": [],
1086
+ "bbox": [
1087
+ 174,
1088
+ 314,
1089
+ 808,
1090
+ 467
1091
+ ],
1092
+ "page_idx": 8
1093
+ },
1094
+ {
1095
+ "type": "text",
1096
+ "text": "5 CONCLUSION AND DISCUSSION ",
1097
+ "text_level": 1,
1098
+ "bbox": [
1099
+ 176,
1100
+ 522,
1101
+ 470,
1102
+ 537
1103
+ ],
1104
+ "page_idx": 8
1105
+ },
1106
+ {
1107
+ "type": "text",
1108
+ "text": "In this work we developed BA-Momentum algorithm, an extension of the BA-SGD proposed by Yin et al. (2017). We also evaluate the two algorithms on natural language processing and image classification tasks using RNN and CNN respectively. The experiments show that in most cases both batch adaptive methods can achieve lower loss than mini-batch methods after scanning same epochs of data. Furthermore, we also confirm that within a certain range of step sizes, BA-Momentum is more robust against large step size compared with mini-batch methods. ",
1109
+ "bbox": [
1110
+ 174,
1111
+ 554,
1112
+ 825,
1113
+ 638
1114
+ ],
1115
+ "page_idx": 8
1116
+ },
1117
+ {
1118
+ "type": "text",
1119
+ "text": "In the experiments, we did not evaluate the decrease of training loss with respect to training time. This is because, in the BA-SGD and BA-Momentum algorithm, we have to calculate the derivatives of the loss of each instance from a batch with respect to parameters, and then derive a covariance matrix through Equation 4 from the derivatives. Computing derivatives by backpropagation is time consuming, and now we have to compute all the derivatives of every instance in a batch. However, in mini-batch gradient descent, it is a common practice to calculate an average loss from a batch and then the derivative of this average loss, which requires less time. A feasible approach to reduce the computation cost might be to modify the way Theano do the derivation for a batch of instances and return the square sum of the derivatives, which we plan to study in future work. ",
1120
+ "bbox": [
1121
+ 174,
1122
+ 645,
1123
+ 825,
1124
+ 770
1125
+ ],
1126
+ "page_idx": 8
1127
+ },
1128
+ {
1129
+ "type": "text",
1130
+ "text": "The batch adaptive framework can have many important applications. It can be adapted to accelerate distributed deep learning. For distributed deep learning, communication cost for synchronizing gradients and parameters among workers and parameter server is its well-known bottleneck (Li et al., 2014a;b; Wen et al., 2017). A larger batch may help make more accurate updates, thus reducing the total number of iterations needed to converge, lowering the communication cost. However, a larger batch also causes a higher computation cost per iteration. In this update-costly environment, the batch adaptive framework may be modified to take both the computation and communication cost into consideration when deciding a proper batch size, which is worth further exploring. ",
1131
+ "bbox": [
1132
+ 174,
1133
+ 777,
1134
+ 825,
1135
+ 888
1136
+ ],
1137
+ "page_idx": 8
1138
+ },
1139
+ {
1140
+ "type": "text",
1141
+ "text": "Another application is that the batch adaptive framework may help remedy the generalization degradation of using large batch studied by Keskar et al. (2016). They provided solid numeric evidence suggesting that using a larger batch will degrade the quality of the model, as measured by its ability to generalize. They also studied the cause for this generalization drop and presented evidence supporting the view that large-batch methods tend to converge to sharp minimizers of the training and testing functions, which causes this generalization drop. Several strategies to help large-batch methods eliminate this generalization drop was proposed in their work. The most promising one is to warm-start with certain epochs of small-batch regime, and then use large batch for the rest of the training. However, the number of epochs needed to warm start with small batch varies for different data sets, thus a batch adaptive method that can dynamically change the batch size against the characteristics of data is the key to solving this problem. The batch adaptive framework sheds light on this issue. Difficulty lies in how to identify a sharp minima accurately and efficiently in the process of learning and limit the batch size when encountering a sharp minima, which we plan to study in future work. ",
1142
+ "bbox": [
1143
+ 174,
1144
+ 895,
1145
+ 823,
1146
+ 924
1147
+ ],
1148
+ "page_idx": 8
1149
+ },
1150
+ {
1151
+ "type": "text",
1152
+ "text": "",
1153
+ "bbox": [
1154
+ 174,
1155
+ 104,
1156
+ 825,
1157
+ 270
1158
+ ],
1159
+ "page_idx": 9
1160
+ },
1161
+ {
1162
+ "type": "text",
1163
+ "text": "REFERENCES ",
1164
+ "text_level": 1,
1165
+ "bbox": [
1166
+ 174,
1167
+ 291,
1168
+ 285,
1169
+ 306
1170
+ ],
1171
+ "page_idx": 9
1172
+ },
1173
+ {
1174
+ "type": "text",
1175
+ "text": "Theano: A python framework for fast computation of mathematical expressions. ",
1176
+ "bbox": [
1177
+ 173,
1178
+ 314,
1179
+ 697,
1180
+ 329
1181
+ ],
1182
+ "page_idx": 9
1183
+ },
1184
+ {
1185
+ "type": "text",
1186
+ "text": "John C. Duchi, Elad Hazan, and Yoram Singer. Adaptive subgradient methods for online learning and stochastic optimization. In COLT, 2010. \nFelix Gers. Long short-term memory in recurrent neural networks. Unpublished PhD dissertation, Ecole Polytechnique Fed´ erale de Lausanne, Lausanne, Switzerland ´ , 2001. \nGabriel Goh. Why momentum really works. Distill, 2017. doi: 10.23915/distill.00006. URL http://distill.pub/2017/momentum. \nIan J. Goodfellow, Yoshua Bengio, Aaron C. Courville, and Geoffrey E. Hinton. Deep learning. Scholarpedia, 10:32832, 2015. \nNitish Shirish Keskar, Dheevatsa Mudigere, Jorge Nocedal, Mikhail Smelyanskiy, and Ping Tak Peter Tang. On large-batch training for deep learning: Generalization gap and sharp minima. CoRR, abs/1609.04836, 2016. \nDiederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. CoRR, abs/1412.6980, 2014. \nMu Li, David G. Andersen, Alexander J. Smola, and Kai Yu. Communication efficient distributed machine learning with the parameter server. In NIPS, 2014a. \nMu Li, Tong Zhang, Yuqiang Chen, and Alexander J. Smola. Efficient mini-batch training for stochastic optimization. In KDD, 2014b. \nM. Lichman. UCI machine learning repository. http://archive.ics.uci.edu/ml, 2013. \nMakoto Miwa and Mohit Bansal. End-to-end relation extraction using lstms on sequences and tree structures. CoRR, abs/1601.00770, 2016. \nNing Qian. On the momentum term in gradient descent learning algorithms. Neural networks, 12 (1):145–151, 1999. \nHerbert Robbins and Sutton Monro. A stochastic approximation method. Ann. Math. Statist., 22(3): 400–407, 09 1951. doi: 10.1214/aoms/1177729586. URL https://doi.org/10.1214/ aoms/1177729586. \nSamuel L. Smith, Pieter-Jan Kindermans, and Quoc V. Le. Don’t decay the learning rate, increase the batch size. CoRR, abs/1711.00489, 2017. URL http://arxiv.org/abs/1711.00489. \nNitish Srivastava, Geoffrey E. Hinton, Alex Krizhevsky, Ilya Sutskever, and Ruslan Salakhutdinov. Dropout: a simple way to prevent neural networks from overfitting. Journal of Machine Learning Research, 15:1929–1958, 2014. \nIlya Sutskever, James Martens, George E. Dahl, and Geoffrey E. Hinton. On the importance of initialization and momentum in deep learning. In ICML, 2013. ",
1187
+ "bbox": [
1188
+ 171,
1189
+ 319,
1190
+ 826,
1191
+ 924
1192
+ ],
1193
+ "page_idx": 9
1194
+ },
1195
+ {
1196
+ "type": "text",
1197
+ "text": "Wei Wen, Cong Xu, Feng Yan, Chunpeng Wu, Yandan Wang, Yiran Chen, and Hai Li. Terngrad: Ternary gradients to reduce communication in distributed deep learning. CoRR, abs/1705.07878, 2017. ",
1198
+ "bbox": [
1199
+ 176,
1200
+ 103,
1201
+ 823,
1202
+ 146
1203
+ ],
1204
+ "page_idx": 10
1205
+ },
1206
+ {
1207
+ "type": "text",
1208
+ "text": "Han Xiao, Kashif Rasul, and Roland Vollgraf. Fashion-mnist: a novel image dataset for benchmarking machine learning algorithms, 2017. ",
1209
+ "bbox": [
1210
+ 173,
1211
+ 155,
1212
+ 823,
1213
+ 183
1214
+ ],
1215
+ "page_idx": 10
1216
+ },
1217
+ {
1218
+ "type": "text",
1219
+ "text": "Peifeng Yin, Ping Luo, and Taiga Nakamura. Small batch or large batch?: Gaussian walk with rebound can teach. In KDD, 2017. ",
1220
+ "bbox": [
1221
+ 171,
1222
+ 191,
1223
+ 825,
1224
+ 220
1225
+ ],
1226
+ "page_idx": 10
1227
+ },
1228
+ {
1229
+ "type": "text",
1230
+ "text": "Matthew D. Zeiler. Adadelta: An adaptive learning rate method. CoRR, abs/1212.5701, 2012. ",
1231
+ "bbox": [
1232
+ 173,
1233
+ 229,
1234
+ 790,
1235
+ 244
1236
+ ],
1237
+ "page_idx": 10
1238
+ },
1239
+ {
1240
+ "type": "text",
1241
+ "text": "Jian Zhang, Ioannis Mitliagkas, and Christopher Re. Yellowfin and the art of momentum tuning. ´ CoRR, abs/1706.03471, 2017. URL http://arxiv.org/abs/1706.03471. ",
1242
+ "bbox": [
1243
+ 173,
1244
+ 253,
1245
+ 823,
1246
+ 282
1247
+ ],
1248
+ "page_idx": 10
1249
+ },
1250
+ {
1251
+ "type": "text",
1252
+ "text": "A ARCHITECTURE OF NETWORKS ",
1253
+ "text_level": 1,
1254
+ "bbox": [
1255
+ 176,
1256
+ 308,
1257
+ 472,
1258
+ 324
1259
+ ],
1260
+ "page_idx": 10
1261
+ },
1262
+ {
1263
+ "type": "text",
1264
+ "text": "For the classification task on Fashion MNIST, we use 3 convolutional layers, where each layer has 32, 64, 128 filters respectively, with MaxPool after each convolutional layer. For all layers, we use ReLU activations and Dropout (Srivastava et al., 2014). ",
1265
+ "bbox": [
1266
+ 174,
1267
+ 339,
1268
+ 823,
1269
+ 381
1270
+ ],
1271
+ "page_idx": 10
1272
+ },
1273
+ {
1274
+ "type": "text",
1275
+ "text": "The relation extraction task aims to extract quadruples in which the elements are correctly matched with each other. The input training instance consists of a sequence representing a sentence from financial documents, and all possible quadruples in this sequence. For the model, a bi-directional LSTM RNN is used. There are two layers of bi-directional LSTM, and a softmax outputs the probability of each quadruple being correct. ",
1276
+ "bbox": [
1277
+ 174,
1278
+ 388,
1279
+ 825,
1280
+ 458
1281
+ ],
1282
+ "page_idx": 10
1283
+ },
1284
+ {
1285
+ "type": "text",
1286
+ "text": "B MODEL VERIFICATION ",
1287
+ "text_level": 1,
1288
+ "bbox": [
1289
+ 176,
1290
+ 478,
1291
+ 400,
1292
+ 494
1293
+ ],
1294
+ "page_idx": 10
1295
+ },
1296
+ {
1297
+ "type": "text",
1298
+ "text": "In our BA-Momentum method, we model the decrease of objective value as a random variable satisfying a one-dimensional Gaussian distribution in Equation 13. This derivation is on the basis of first order Taylor extension and central limit theorem, involving some approximation. After modelling the decrease of objective value as normally distributed, we then estimated its mean and variance in Equation 15 and Equation 16. Here we would like to use real data from Fashion-MNIST to verify that the decrease of objective value truly satisfies a Gaussian distribution and our estimation is close to its real mean and variance. ",
1299
+ "bbox": [
1300
+ 174,
1301
+ 510,
1302
+ 825,
1303
+ 607
1304
+ ],
1305
+ "page_idx": 10
1306
+ },
1307
+ {
1308
+ "type": "text",
1309
+ "text": "We compute the decrease of objective value on the whole data set after 10 iterations for 500 times with batches randomly sampled and size fixed at 100. The result is plotted in Figure 6. The observation confirms that the decrease of objective value distributes normally. Its mean and standard deviation are -7.94253e-10 and 3.48414e-11 respectively, while its estimated mean and standard deviation are -8.58165e-10 and 4.58062e-12. Therefore, the decrease of objective value in our BA-M algorithm satisfies a Gaussian distribution and our estimation for its mean and variance is close to the real ones. ",
1310
+ "bbox": [
1311
+ 174,
1312
+ 614,
1313
+ 825,
1314
+ 712
1315
+ ],
1316
+ "page_idx": 10
1317
+ },
1318
+ {
1319
+ "type": "text",
1320
+ "text": "C IMPLEMENTATION ISSUES ",
1321
+ "text_level": 1,
1322
+ "bbox": [
1323
+ 176,
1324
+ 732,
1325
+ 424,
1326
+ 747
1327
+ ],
1328
+ "page_idx": 10
1329
+ },
1330
+ {
1331
+ "type": "text",
1332
+ "text": "When calculating the covariance matrix in Equation 4, one should note that it takes a space of $O ( d ^ { 2 } )$ with $d$ denoting the dimension of the model parameter vector to store the covariance matrix. The cost is quite high for complex models with a large amount of parameters. Yin et al. (2017) has proposed a practical tradeoff assuming that model parameters are independent of each other, then the covariance matrix becomes a diagonal one, greatly reducing the space and time cost. Here we use a small data set from UCI machine learning repository (Lichman, 2013) to test whether the tradeoff will affect the performance of BA-Momentum. ",
1333
+ "bbox": [
1334
+ 174,
1335
+ 763,
1336
+ 825,
1337
+ 861
1338
+ ],
1339
+ "page_idx": 10
1340
+ },
1341
+ {
1342
+ "type": "text",
1343
+ "text": "We use two different BA-Momentum. One calculates the exact covariance matrix, while the other calculates its estimated diagonal matrix. The task is a classification task with 3 classes and 42 features. The training set is composed of around 60000 data instances. After training for 14 epochs, we yield the following result. The Figure 7a show the batch size change as learning proceeds for matrix method and diagonal method respectively. The Figure 7b demonstrates different training loss per epoch for two different methods. From the figures we can see that the trend of batch size change for two methods are almost the same, therefore they perform equally well on the training loss descent. This indicates estimating the covariance matrix by its diagonal matrix will not cause degradation to the performance of BA-Momentum. ",
1344
+ "bbox": [
1345
+ 174,
1346
+ 867,
1347
+ 823,
1348
+ 924
1349
+ ],
1350
+ "page_idx": 10
1351
+ },
1352
+ {
1353
+ "type": "image",
1354
+ "img_path": "images/631a7ece17b02842ed50fb260091e79e25fbb37b6a60b33e7d42134143a4b6f0.jpg",
1355
+ "image_caption": [
1356
+ "Figure 6: Verification on the distribution of decrease of objective value "
1357
+ ],
1358
+ "image_footnote": [],
1359
+ "bbox": [
1360
+ 348,
1361
+ 112,
1362
+ 635,
1363
+ 289
1364
+ ],
1365
+ "page_idx": 11
1366
+ },
1367
+ {
1368
+ "type": "text",
1369
+ "text": "",
1370
+ "bbox": [
1371
+ 174,
1372
+ 351,
1373
+ 825,
1374
+ 420
1375
+ ],
1376
+ "page_idx": 11
1377
+ },
1378
+ {
1379
+ "type": "image",
1380
+ "img_path": "images/12e4c1d901185c0d1349a93f845f5df1a445f68b1f14a6adb99c8a836ac4ce75.jpg",
1381
+ "image_caption": [
1382
+ "Figure 7: Effects of calculating exact covariance matrix and its estimated diagonal. "
1383
+ ],
1384
+ "image_footnote": [],
1385
+ "bbox": [
1386
+ 194,
1387
+ 454,
1388
+ 743,
1389
+ 643
1390
+ ],
1391
+ "page_idx": 11
1392
+ },
1393
+ {
1394
+ "type": "text",
1395
+ "text": "As for the cost of computing the optimal batch size, on average it takes up $1 . 0 3 \\%$ and $0 . 6 1 \\%$ of the total computing time per iteration for BA-Momentum and BA-SGD respectively on the image classification task, and the percentage on the relation extraction task is $1 . 3 1 \\%$ and $0 . 9 2 \\%$ for BAMomentum and BA-SGD respectively. Computing the optimal batch size involves calculating some means and variances, and a binary search to find the $m ^ { * }$ that maximizes the utility function. Both operations take little time. ",
1396
+ "bbox": [
1397
+ 173,
1398
+ 686,
1399
+ 825,
1400
+ 770
1401
+ ],
1402
+ "page_idx": 11
1403
+ },
1404
+ {
1405
+ "type": "text",
1406
+ "text": "D TEST ACCURACIES ",
1407
+ "text_level": 1,
1408
+ "bbox": [
1409
+ 176,
1410
+ 792,
1411
+ 369,
1412
+ 809
1413
+ ],
1414
+ "page_idx": 11
1415
+ },
1416
+ {
1417
+ "type": "text",
1418
+ "text": "We show the test accuracies of different methods on the image classification task and relation extraction task in Table 1. For the relation extraction task, we would like to mention that its accuracy is an intersection over union, specifically defined as the ratio of the intersection of the predicted quadruples and the ground truth quadruples to their union. For the evaluation, we record the test accuracies of each method after every epoch’s training and present below the best test accuracies achieved by each method during their whole budget’s training (100 epochs for image classification task and 300 epochs for relation extraction task). ",
1419
+ "bbox": [
1420
+ 173,
1421
+ 825,
1422
+ 825,
1423
+ 924
1424
+ ],
1425
+ "page_idx": 11
1426
+ },
1427
+ {
1428
+ "type": "text",
1429
+ "text": "The proposed “BA” methods achieve two best test accuracies in the following four cases (SGD-based on Fashion MNIST and SGD-based on relation extraction). In the other two cases, the test accuracies achieved by “BA” methods, $9 1 . 3 3 \\%$ and $8 8 . 4 6 \\%$ , are still very close to the best ones, $9 1 . 6 4 \\%$ and $8 9 . 0 2 \\%$ respectively. What’s more, these results are realized in a self-adaptive way and require no fine tuning, while the best accuracies in the two momentum-based cases are achieved by totally different fixed batch sizes, indicating a tuning process. In contrast with “BA” methods, “Manual” methods which manually increase the batch size performs well on Fashion MNIST, whereas they ends up with the fourth highest test accuracies on the relation extraction task, indicating that “Manual” methods also need fine tuning to realize a satisfactory generalization. ",
1430
+ "bbox": [
1431
+ 174,
1432
+ 103,
1433
+ 825,
1434
+ 229
1435
+ ],
1436
+ "page_idx": 12
1437
+ },
1438
+ {
1439
+ "type": "table",
1440
+ "img_path": "images/a9fda26fe39e529a3cf975829f5c16833e5218869bdfada62044499ae9f18654.jpg",
1441
+ "table_caption": [
1442
+ "Table 1: Best test accuracies achieved by different methods on Fashion MNIST and relation extraction "
1443
+ ],
1444
+ "table_footnote": [],
1445
+ "table_body": "<table><tr><td rowspan=\"2\"></td><td colspan=\"2\">Fashion MNIST</td><td colspan=\"2\">Relation extraction</td></tr><tr><td>Momentum</td><td>SGD</td><td>Momentum</td><td>SGD</td></tr><tr><td>Mini-32</td><td>90.93%</td><td>90.87%</td><td>89.02%</td><td>75.13%</td></tr><tr><td>Mini-64</td><td>91.17%</td><td>90.64%</td><td>87.12%</td><td>58.01%</td></tr><tr><td>Mini-128</td><td>91.64%</td><td>90.37%</td><td>85.33%</td><td>31.21%</td></tr><tr><td>Mini-256</td><td>90.76%</td><td>90.16%</td><td>79.37%</td><td>28.11%</td></tr><tr><td>Manual</td><td>91.35%</td><td>90.84%</td><td>86.31%</td><td>50.02%</td></tr><tr><td>BA</td><td>91.33%</td><td>91.01 %</td><td>88.46%</td><td>75.57%</td></tr></table>",
1446
+ "bbox": [
1447
+ 271,
1448
+ 287,
1449
+ 727,
1450
+ 404
1451
+ ],
1452
+ "page_idx": 12
1453
+ }
1454
+ ]
parse/train/SybqeKgA-/SybqeKgA-_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/train/SybqeKgA-/SybqeKgA-_model.json ADDED
The diff for this file is too large to render. See raw diff