kelseye commited on
Commit
631bfae
·
verified ·
1 Parent(s): 4fc706c

Upload folder using huggingface_hub (part 6)

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. md/train/BkUHlMZ0b/BkUHlMZ0b.md +393 -0
  2. md/train/BkV4VS9ll/BkV4VS9ll.md +599 -0
  3. md/train/BkVsEMYel/BkVsEMYel.md +0 -0
  4. md/train/BkVsWbbAW/BkVsWbbAW.md +321 -0
  5. md/train/BkXmYfbAZ/BkXmYfbAZ.md +293 -0
  6. md/train/Bkab5dqxe/Bkab5dqxe.md +220 -0
  7. md/train/BkbY4psgg/BkbY4psgg.md +623 -0
  8. md/train/BkdpaH9ll/BkdpaH9ll.md +273 -0
  9. md/train/Bke4KsA5FX/Bke4KsA5FX.md +598 -0
  10. md/train/Bke6vTVYwH/Bke6vTVYwH.md +291 -0
  11. md/train/Bke96sC5tm/Bke96sC5tm.md +300 -0
  12. md/train/BkeOp6EKDH/BkeOp6EKDH.md +202 -0
  13. md/train/BkeStsCcKQ/BkeStsCcKQ.md +259 -0
  14. md/train/BkeWw6VFwr/BkeWw6VFwr.md +0 -0
  15. md/train/BkeaEyBYDB/BkeaEyBYDB.md +234 -0
  16. md/train/BkedwoC5t7/BkedwoC5t7.md +357 -0
  17. md/train/Bkeeca4Kvr/Bkeeca4Kvr.md +398 -0
  18. md/train/Bkepl7cee/Bkepl7cee.md +210 -0
  19. md/train/BkeqO7x0-/BkeqO7x0-.md +475 -0
  20. md/train/Bkeuz20cYm/Bkeuz20cYm.md +491 -0
  21. md/train/BkevoJSYPB/BkevoJSYPB.md +656 -0
  22. md/train/BkewX2C9tX/BkewX2C9tX.md +253 -0
  23. md/train/BkfbpsAcF7/BkfbpsAcF7.md +426 -0
  24. md/train/Bkg0u3Etwr/Bkg0u3Etwr.md +561 -0
  25. md/train/Bkg2viA5FQ/Bkg2viA5FQ.md +0 -0
  26. md/train/Bkg3g2R9FX/Bkg3g2R9FX.md +643 -0
  27. md/train/Bkg6RiCqY7/Bkg6RiCqY7.md +342 -0
  28. md/train/BkgBvsC9FQ/BkgBvsC9FQ.md +275 -0
  29. md/train/BkgMbCVFvr/BkgMbCVFvr.md +226 -0
  30. md/train/BkgNqkHFPr/BkgNqkHFPr.md +375 -0
  31. md/train/BkgRe1SFDS/BkgRe1SFDS.md +440 -0
  32. md/train/BkgStySKPB/BkgStySKPB.md +480 -0
  33. md/train/BkgWHnR5tm/BkgWHnR5tm.md +462 -0
  34. md/train/BkgXT24tDS/BkgXT24tDS.md +337 -0
  35. md/train/BkgYPREtPr/BkgYPREtPr.md +398 -0
  36. md/train/Bkgk624KDB/Bkgk624KDB.md +310 -0
  37. md/train/BkglSTNFDB/BkglSTNFDB.md +683 -0
  38. md/train/BkgnhTEtDS/BkgnhTEtDS.md +381 -0
  39. md/train/Bkgq9ANKvB/Bkgq9ANKvB.md +0 -0
  40. md/train/BkgrBgSYDS/BkgrBgSYDS.md +0 -0
  41. md/train/BkgtDsCcKQ/BkgtDsCcKQ.md +0 -0
  42. md/train/Bkgwp3NtDH/Bkgwp3NtDH.md +190 -0
  43. md/train/BkgzniCqY7/BkgzniCqY7.md +580 -0
  44. md/train/Bki4EfWCb/Bki4EfWCb.md +366 -0
  45. md/train/BkisuzWRW/BkisuzWRW.md +308 -0
  46. md/train/BkjLkSqxg/BkjLkSqxg.md +280 -0
  47. md/train/Bkl086VYvH/Bkl086VYvH.md +193 -0
  48. md/train/Bkl5kxrKDr/Bkl5kxrKDr.md +0 -0
  49. md/train/BklEF3VFPB/BklEF3VFPB.md +256 -0
  50. md/train/BklEFpEYwS/BklEFpEYwS.md +500 -0
md/train/BkUHlMZ0b/BkUHlMZ0b.md ADDED
@@ -0,0 +1,393 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # EVALUATING THE ROBUSTNESS OF NEURAL NETWORKS: AN EXTREME VALUE THEORY APPROACH
2
+
3
+ Tsui-Wei Weng1∗, Huan Zhang2∗, Pin-Yu Chen3, Jinfeng $\mathbf { Y _ { i } ^ { * } }$ , Dong $\mathbf { S } \mathbf { u } ^ { 3 }$ , Yupeng $\mathbf { G a o } ^ { 3 }$ , Cho-Jui Hsieh2, Luca Daniel1
4
+
5
+ 1Massachusetts Institute of Technology, Cambridge, MA 02139
6
+ 2University of California, Davis, CA 95616
7
+ 3IBM Research AI, Yorktown Heights, NY 10598
8
+ 4Tencent AI Lab, Bellevue, WA 98004
9
+ twweng@mit.edu, ecezhang@ucdavis.edu,
10
+ pin-yu.chen@ibm.com, jinfengyi.ustc@gmail.com,
11
+ {dong.su,yupeng.gao}@ibm.com, chohsieh@ucdavis.edu, dluca@mit.edu
12
+
13
+ # ABSTRACT
14
+
15
+ The robustness of neural networks to adversarial examples has received great attention due to security implications. Despite various attack approaches to crafting visually imperceptible adversarial examples, little has been developed towards a comprehensive measure of robustness. In this paper, we provide a theoretical justification for converting robustness analysis into a local Lipschitz constant estimation problem, and propose to use the Extreme Value Theory for efficient evaluation. Our analysis yields a novel robustness metric called CLEVER, which is short for Cross Lipschitz Extreme Value for nEtwork Robustness. The proposed CLEVER score is attack-agnostic and computationally feasible for large neural networks. Experimental results on various networks, including ResNet, Inceptionv3 and MobileNet, show that (i) CLEVER is aligned with the robustness indication measured by the $\ell _ { 2 }$ and $\ell _ { \infty }$ norms of adversarial examples from powerful attacks, and (ii) defended networks using defensive distillation or bounded ReLU indeed achieve better CLEVER scores. To the best of our knowledge, CLEVER is the first attack-independent robustness metric that can be applied to any neural network classifier.
16
+
17
+ # 1 INTRODUCTION
18
+
19
+ Recent studies have highlighted the lack of robustness in state-of-the-art neural network models, e.g., a visually imperceptible adversarial image can be easily crafted to mislead a well-trained network (Szegedy et al., 2013; Goodfellow et al., 2015; Chen et al., 2017a). Even worse, researchers have identified that these adversarial examples are not only valid in the digital space but also plausible in the physical world (Kurakin et al., 2016a; Evtimov et al., 2017). The vulnerability to adversarial examples calls into question safety-critical applications and services deployed by neural networks, including autonomous driving systems and malware detection protocols, among others.
20
+
21
+ In the literature, studying adversarial examples of neural networks has twofold purposes: (i) security implications: devising effective attack algorithms for crafting adversarial examples, and (ii) robustness analysis: evaluating the intrinsic model robustness to adversarial perturbations to normal examples. Although in principle the means of tackling these two problems are expected to be independent, that is, the evaluation of a neural network’s intrinsic robustness should be agnostic to attack methods, and vice versa, existing approaches extensively use different attack results as a measure of robustness of a target neural network. Specifically, given a set of normal examples, the attack success rate and distortion of the corresponding adversarial examples crafted from a particular attack algorithm are treated as robustness metrics. Consequently, the network robustness is entangled with the attack algorithms used for evaluation and the analysis is limited by the attack capabilities. More importantly, the dependency between robustness evaluation and attack approaches can cause biased analysis. For example, adversarial training is a commonly used technique for improving the robustness of a neural network, accomplished by generating adversarial examples and retraining the network with corrected labels. However, while such an adversarially trained network is made robust to attacks used to craft adversarial examples for training, it can still be vulnerable to unseen attacks.
22
+
23
+ Motivated by the evaluation criterion for assessing the quality of text and image generation that is completely independent of the underlying generative processes, such as the BLEU score for texts (Papineni et al., 2002) and the INCEPTION score for images (Salimans et al., 2016), we aim to propose a comprehensive and attack-agnostic robustness metric for neural networks. Stemming from a perturbation analysis of an arbitrary neural network classifier, we derive a universal lower bound on the minimal distortion required to craft an adversarial example from an original one, where the lower bound applies to any attack algorithm and any $\ell _ { p }$ norm for $p \geq 1$ . We show that this lower bound associates with the maximum norm of the local gradients with respect to the original example, and therefore robustness evaluation becomes a local Lipschitz constant estimation problem. To efficiently and reliably estimate the local Lipschitz constant, we propose to use extreme value theory (De Haan & Ferreira, 2007) for robustness evaluation. In this context, the extreme value corresponds to the local Lipschitz constant of our interest, which can be inferred by a set of independently and identically sampled local gradients.With the aid of extreme value theory, we propose a robustness metric called CLEVER, which is short for Cross Lipschitz Extreme Value for nEtwork Robustness. We note that CLEVER is an attack-independent robustness metric that applies to any neural network classifier. In contrast, the robustness metric proposed in Hein & Andriushchenko (2017), albeit attack-agnostic, only applies to a neural network classifier with one hidden layer.
24
+
25
+ We highlight the main contributions of this paper as follows:
26
+
27
+ We propose a novel robustness metric called CLEVER, which is short for Cross Lipschitz Extreme Value for nEtwork Robustness. To the best of our knowledge, CLEVER is the first robustness metric that is attack-independent and can be applied to any arbitrary neural network classifier and scales to large networks for ImageNet. The proposed CLEVER score is well supported by our theoretical analysis on formal robustness guarantees and the use of extreme value theory. Our robustness analysis extends the results in Hein & Andriushchenko (2017) from continuously differentiable functions to a special class of non-differentiable functions – neural+ networks with ReLU activations. We corroborate the effectiveness of CLEVER by conducting experiments on state-of-theart models for ImageNet, including ResNet (He et al., 2016), Inception-v3 (Szegedy et al., 2016) and MobileNet (Howard et al., 2017). We also use CLEVER to investigate defended networks against adversarial examples, including the use of defensive distillation (Papernot et al., 2016) and bounded ReLU (Zantedeschi et al., 2017). Experimental results show that our CLEVER score well aligns with the attack-specific robustness indicated by the $\ell _ { 2 }$ and $\ell _ { \infty }$ distortions of adversarial examples.
28
+
29
+ # 2 BACKGROUND AND RELATED WORK
30
+
31
+ # 2.1 ATTACKING NEURAL NETWORKS USING ADVERSARIAL EXAMPLES
32
+
33
+ One of the most popular formulations found in literature for crafting adversarial examples to mislead a neural network is to formulate it as a minimization problem, where the variable $\pmb { \delta } \in \mathbb { R } ^ { d }$ to be optimized refers to the perturbation to the original example, and the objective function takes into account unsuccessful adversarial perturbations as well as a specific norm on $\delta$ for assuring similarity. For instance, the success of adversarial examples can be evaluated by their cross-entropy loss (Szegedy et al., 2013; Goodfellow et al., 2015) or model prediction (Carlini & Wagner, 2017b). The norm constraint on $\delta$ can be implemented in a clipping manner (Kurakin et al., 2016b) or treated as a penalty for any (Carlini & Wagner, 2017b). The , is often used for crafting adve $\ell _ { p }$ norm of rial exa $\pmb { \delta }$ , defined as ples. In pa $\begin{array} { r } { \| \pmb { \delta } \| _ { p } = ( \sum _ { i = 1 } ^ { d } | \pmb { \delta } _ { i } | ^ { p } ) ^ { 1 / p } } \end{array}$ $p \geq 1$ $p ~ = ~ \infty$ $\lVert \delta \rVert _ { \infty } = \mathrm { m a x } _ { i \in \{ 1 , \ldots , d \} } | \delta _ { i } |$ measures the maximal variation among all dimensions in $\delta$ . When $p = 2$ , $\lVert \delta \rVert _ { 2 }$ becomes the Euclidean norm of $\pmb { \delta }$ . When $p = 1$ , $\begin{array} { r } { \| \pmb { \delta } \| _ { 1 } = \sum _ { i = 1 } ^ { p } | \pmb { \delta } _ { i } | } \end{array}$ measures the total variation of $\delta$ . The state-of-the-art attack methods for $\ell _ { \infty }$ , $\ell _ { 2 }$ and $\ell _ { 1 }$ norms are the iterative fast gradient sign method (I-FGSM) (Goodfellow et al., 2015; Kurakin et al., 2016b), Carlini and Wagner’s attack (CW attack) (Carlini & Wagner, 2017b), and elastic-net attacks to deep neural networks (EAD) (Chen et al., 2017b), respectively. These attacks fall into the category of white-box attacks since the network model is assumed to be transparent to an attacker. Adversarial examples can also be crafted from a black-box network model using an ensemble approach (Liu et al., 2016), training a substitute model (Papernot et al., 2017), or employing zeroth-order optimization based attacks (Chen et al., 2017c).
34
+
35
+ # 2.2 EXISTING DEFENSE METHODS
36
+
37
+ Since the discovery of vulnerability to adversarial examples (Szegedy et al., 2013), various defense methods have been proposed to improve the robustness of neural networks. The rationale for defense is to make a neural network more resilient to adversarial perturbations, while ensuring the resulting defended model still attains similar test accuracy as the original undefended network. Papernot et al. proposed defensive distillation (Papernot et al., 2016), which uses the distillation technique (Hinton et al., 2015) and a modified softmax function at the final layer to retrain the network parameters with the prediction probabilities (i.e., soft labels) from the original network. Zantedeschi et al. (2017) showed that by changing the ReLU function to a bounded ReLU function, a neural network can be made more resilient. Another popular defense approach is adversarial training, which generates and augments adversarial examples with the original training data during the network training stage. On MNIST, the adversarially trained model proposed by Madry et al. (2017) can successfully defend a majority of adversarial examples at the price of increased network capacity. Model ensemble has also been discussed to increase the robustness to adversarial examples (Tramer et al. \` , 2017; Liu et al., 2017). In addition, detection methods such as feature squeezing (Xu et al., 2017) and example reforming (Meng & Chen, 2017) can also be used to identify adversarial examples. However, the CW attack is shown to be able to bypass 10 different detection methods (Carlini & Wagner, 2017a). In this paper, we focus on evaluating the intrinsic robustness of a neural network model to adversarial examples. The effect of detection methods is beyond our scope.
38
+
39
+ # 2.3 THEORETICAL ROBUSTNESS GUARANTEES FOR NEURAL NETWORKS
40
+
41
+ Szegedy et al. (2013) compute global Lipschitz constant for each layer and use their product to explain the robustness issue in neural networks, but the global Lipschitz constant often gives a very loose bound. Hein & Andriushchenko (2017) gave a robustness lower bound using a local Lipschitz continuous condition and derived a closed-form bound for a multi-layer perceptron (MLP) with a single hidden layer and softplus activation. Nevertheless, a closed-form bound is hard to derive for a neural network with more than one hidden layer. Wang et al. (2016) utilized terminologies from topology to study robustness. However, no robustness bounds or estimates were provided for neural networks. On the other hand, works done by Ehlers (2017); Katz et al. (2017a;b); Huang et al. (2017) focus on formally verifying the viability of certain properties in neural networks for any possible input, and transform this formal verification problem into satisfiability modulo theory (SMT) and large-scale linear programming (LP) problems. These SMT or LP based approaches have high computational complexity and are only plausible for very small networks.
42
+
43
+ Intuitively, we can use the distortion of adversarial examples found by a certain attack algorithm as a robustness metric. For example, Bastani et al. (2016) proposed a linear programming (LP) formulation to find adversarial examples and use the distortions as the robustness metric. They observe that the LP formulation can find adversarial examples with smaller distortions than other gradient-based attacks like L-BFGS (Szegedy et al., 2013). However, the distortion found by these algorithms is an upper bound of the true minimum distortion and depends on specific attack algorithms. These methods differ from our proposed robustness measure CLEVER, because CLEVER is an estimation of the lower bound of the minimum distortion and is independent of attack algorithms. Additionally, unlike LP-based approaches which are impractical for large networks, CLEVER is computationally feasible for large networks like Inception-v3. The concept of minimum distortion and upper/lower bound will be formally defined in Section 3.
44
+
45
+ # 3 ANALYSIS OF FORMAL ROBUSTNESS GUARANTEES FOR A CLASSIFIER
46
+
47
+ In this section, we provide formal robustness guarantees of a classifier in Theorem 3.2. Our robustness guarantees are general since they only require a mild assumption on Lipschitz continuity of the classification function. For differentiable classification functions, our results are consistent with the main theorem in (Hein & Andriushchenko, 2017) but are obtained by a much simpler and more intuitive manner1. Furthermore, our robustness analysis can be easily extended to non-differentiable classification functions (e.g. neural networks with ReLU) as in Lemma 3.3, whereas the analysis in Hein & Andriushchenko (2017) is restricted to differentiable functions. Specifically, Corollary 3.2.1 shows that the robustness analysis in (Hein & Andriushchenko, 2017) is in fact a special case of our analysis. We start our analysis by defining the notion of adversarial examples, minimum $\ell _ { p }$ distortions, and lower/upper bounds. All the notations are summarized in Table 1.
48
+
49
+ Table 1: Table of Notation
50
+
51
+ <table><tr><td>Notation d δ∈Rd p</td><td>Definition dimensionality of the input vector number of output classes</td><td>Notation △p,min</td><td>Definition minimum lp distortion of xo lower bound of minimum distortion</td></tr><tr><td>K f:Rd→RK</td><td>adversarial example distortion := xa -xo Bp(xo,R)</td><td>βL</td><td></td></tr><tr><td>xo∈Rd x∈Rd</td><td>neural network classifier original input vector</td><td>βu L</td><td>upper bound of minimum distortion Lipschitz constant local Lipschitz constant</td></tr></table>
52
+
53
+ Definition 3.1 (perturbed example and adversarial example). Let $\pmb { x _ { 0 } } ~ \in ~ \mathbb { R } ^ { d }$ be an input vector of a $K$ -class classification function $f ~ : ~ \mathbb { R } ^ { d } ~ \to ~ \mathbb { R } ^ { K }$ and the prediction is given as $c ( \pmb { x _ { 0 } } ) \ =$ $\operatorname { a r g m a x } _ { 1 \leq i \leq K } f _ { i } ( { \pmb x } _ { 0 } )$ . Given $\scriptstyle { \mathbf { x _ { 0 } } }$ , we say $\scriptstyle { \mathbf { { \mathit { x } } } } _ { a }$ is a perturbed example of $\scriptstyle { \mathbf { { \vec { x } } } } _ { \mathbf { 0 } }$ with noise $\pmb { \delta } \in \mathbb { R } ^ { d }$ and $\ell _ { p }$ -distortion $\Delta _ { p }$ if ${ \pmb x } _ { \pmb a } = { \pmb x } _ { \mathbf 0 } + \delta$ and $\Delta _ { p } = \| \delta \| _ { p }$ . An adversarial example is a perturbed example $\scriptstyle { \mathbf { { \mathit { x } } } } _ { a }$ that changes $c ( \pmb { x _ { 0 } } )$ . A successful untargeted attack is to find a $\scriptstyle { \mathbf { { \mathit { x } } } } _ { a }$ such that $c ( \pmb { x _ { a } } ) \neq c ( \pmb { x _ { 0 } } )$ while a successful targeted attack is to find a $\scriptstyle { \mathbf { { \mathit { x } } } } _ { a }$ such that $c ( { \pmb x } _ { \pmb a } ) = t$ given a target class $t \neq c ( \pmb { x _ { 0 } } )$ .
54
+
55
+ Definition 3.2 (minimum adversarial distortion $\Delta _ { p , \mathrm { { m i n } } } ,$ ). Given an input vector $\scriptstyle { \mathbf { { \vec { x } } } } _ { \mathbf { 0 } }$ of a classifier $f$ , the minimum $\ell _ { p }$ adversarial distortion of $\scriptstyle { \mathbf { x _ { 0 } } }$ , denoted as $\Delta _ { p , \mathrm { { m i n } } }$ , is defined as the smallest $\Delta _ { p }$ over all adversarial examples of $\scriptstyle { \mathbf { x _ { 0 } } }$ .
56
+
57
+ Definition 3.3 (lower bound of $\Delta _ { p , \mathrm { { m i n } } } ,$ ). Suppose $\Delta _ { p , \mathrm { { m i n } } }$ is the minimum adversarial distortion of $\scriptstyle { \mathbf { x _ { 0 } } }$ . A lower bound of $\Delta _ { p , \mathrm { { m i n } } }$ , denoted by $\beta _ { L }$ where $\beta _ { L } \le \Delta _ { p , \mathrm { { m i n } } }$ , is defined such that any perturbed examples of $\scriptstyle { \mathbf { { \vec { x } } } } _ { \mathbf { 0 } }$ with $\| \pmb { \delta } \| _ { p } \leq \beta _ { L }$ are not adversarial examples.
58
+
59
+ Definition 3.4 (upper bound of $\Delta _ { p , \mathrm { { m i n } } } .$ ). Suppose $\Delta _ { p , \mathrm { { m i n } } }$ is the minimum adversarial distortion of $\scriptstyle { \mathbf { x _ { 0 } } }$ . An upper bound of $\Delta _ { p , \mathrm { { m i n } } }$ , denoted by $\beta _ { U }$ where $\dot { \beta } _ { U } \ge \Delta _ { p , \mathrm { { m i n } } }$ , is defined such that there exists an adversarial example of $\scriptstyle { \mathbf { { \mathit { x } } } } _ { \mathbf { 0 } }$ with $\| \delta \| _ { p } \ge \beta _ { U }$ .
60
+
61
+ The lower and upper bounds are instance-specific because they depend on the input $\scriptstyle { \mathbf { { \mathit { x } } } } _ { \mathbf { 0 } }$ . While $\beta _ { U }$ can be easily given by finding an adversarial example of $\scriptstyle { \mathbf { x _ { 0 } } }$ using any attack method, $\beta _ { L }$ is not easy to find. $\beta _ { L }$ guarantees that the classifier is robust to any perturbations with $\| \delta \| _ { p } \le \beta _ { L }$ , certifying the robustness of the classifier. Below we show how to derive a formal robustness guarantee of a classifier with Lipschitz continuity assumption. Specifically, our analysis obtains a lower bound of $\ell _ { p }$ minimum adversarial distortion $\begin{array} { r } { \beta _ { L } = \operatorname* { m i n } _ { j \neq c } \frac { \bar { f } _ { c } ( \pmb { x _ { 0 } } ) - f _ { j } \bar { ( \pmb { x _ { 0 } } ) } } { L _ { q } ^ { j } } } \end{array}$ .
62
+
63
+ Lemma 3.1 (Lipschitz continuity and its relationship with gradient norm (Paulavicius & ˇ Zilinskas ˇ , 2006)). Let $\dot { S } \subset \mathbb { R } ^ { d }$ be a convex bounded closed set and let $h ( \pmb { x } ) : S \mathbb { R }$ be a continuously differentiable function on an open set containing $S$ . Then, $h ( { \pmb x } )$ is a Lipschitz function with Lipschitz constant $L _ { q }$ if the following inequality holds for any $\mathbf { \Delta } _ { \pmb { x } , \pmb { y } } \in S$ :
64
+
65
+ $$
66
+ | h ( \pmb { x } ) - h ( \pmb { y } ) | \leq L _ { q } \| \pmb { x } - \pmb { y } \| _ { p } ,
67
+ $$
68
+
69
+ where $\begin{array} { r } { L _ { q } = \operatorname* { m a x } \{ \| \nabla h ( \pmb { x } ) \| _ { q } : \pmb { x } \in S \} , \nabla h ( \pmb { x } ) = ( \frac { \partial h ( \pmb { x } ) } { \partial x _ { 1 } } , \cdot \cdot \cdot , \frac { \partial h ( \pmb { x } ) } { \partial x _ { d } } ) ^ { \top } \ \xi } \end{array}$ , ∂h(x) )> is the gradient of h(x), and $\begin{array} { r } { \frac { 1 } { p } + \frac { 1 } { q } = 1 , 1 \leq p , q \leq \infty } \end{array}$ .
70
+
71
+ Given Lemma 3.1, we then provide a formal guarantee to the lower bound $\beta _ { L }$ .
72
+
73
+ Theorem 3.2 (Formal guarantee on lower bound $\beta _ { L }$ for untargeted attack). Let $\pmb { x _ { 0 } } ~ \in ~ \mathbb { R } ^ { d }$ and $f : \mathbb { R } ^ { d } \mathbb { R } ^ { K }$ be a multi-class classifier with continuously differentiable components $f _ { i }$ and let $c = \operatorname { a r g m a x } _ { 1 \leq i \leq K } f _ { i } ( \pmb { x _ { 0 } } )$ be the class which $f$ predicts for $\scriptstyle { \mathbf { x _ { 0 } } }$ . For all $\pmb { \delta } \in \mathbb { R } ^ { d }$ with
74
+
75
+ $$
76
+ \| \pmb { \delta } \| _ { p } \leq \operatorname* { m i n } _ { j \neq c } \frac { f _ { c } ( \pmb { x _ { 0 } } ) - f _ { j } ( \pmb { x _ { 0 } } ) } { L _ { q } ^ { j } } ,
77
+ $$
78
+
79
+ $\operatorname { a r g m a x } _ { 1 \leq i \leq K } f _ { i } ( x _ { 0 } + \delta ) = c$ holds with $\textstyle { \frac { 1 } { p } } + { \frac { 1 } { q } } = 1 , 1 \leq p , q \leq \infty$ and $L _ { q } ^ { j }$ is the Lipschitz constant for the function $f _ { c } ( { \pmb x } ) - f _ { j } ( { \pmb x } )$ in $\ell _ { p }$ norm. In other words, $\begin{array} { r } { \beta _ { L } = \operatorname* { m i n } _ { j \neq c } \frac { f _ { c } ( \pmb { x _ { 0 } } ) - f _ { j } ( \pmb { x _ { 0 } } ) } { L _ { q } ^ { j } } } \end{array}$ fc(x0)−fj (x0) is a lower bound of minimum distortion.
80
+
81
+ The intuitions behind Theorem 3.2 is shown in Figure 1 with an one-dimensional example. The function value $g ( x ) = f _ { c } ( x ) - f _ { j } ( x )$ near point $x _ { 0 }$ is inside a double cone formed by two lines passing $( x _ { 0 } , g ( x _ { 0 } ) )$ and with slopes equal to $\pm L _ { q }$ , where $L _ { q }$ is the (local) Lipschitz constant of $g ( x )$ near $x _ { 0 }$ . In other words, the function value of $g ( x )$ around $x _ { 0 }$ , i.e. $g ( x _ { 0 } + \delta )$ can be bounded by $g ( x _ { 0 } )$ , $\delta$ and the Lipschitz constant $L _ { q }$ . When $g ( x _ { 0 } + \delta )$ is decreased to 0, an adversarial example is found and the minimal change of $\delta$ is $\frac { g ( x _ { 0 } ) } { L _ { q } }$ . The complete proof is deferred to Appendix A.
82
+
83
+ ![](images/79f34835ec0f121d7b93b45cfc52576e6a0a4dc1df5c37f3e3380a0817faa25e.jpg)
84
+ Figure 1: Intuitions behind Theorem 3.2.
85
+
86
+ Remark 1. $L _ { q } ^ { j }$ is the Lipschitz constant of the function involving cross terms: $f _ { c } ( { \pmb x } ) - f _ { j } ( { \pmb x } )$ , hence we also call it cross Lipschitz constant following (Hein & Andriushchenko, 2017).
87
+
88
+ To distinguish our analysis from (Hein & Andriushchenko, 2017), we show in Corollary 3.2.1 that we can obtain the same result in (Hein & Andriushchenko, 2017) by Theorem 3.2. In fact, the analysis in (Hein & Andriushchenko, 2017) is a special case of our analysis because the authors implicitly assume Lipschitz continuity on $f _ { i } ( { \pmb x } )$ when requiring $f _ { i } ( { \pmb x } )$ to be continuously differentiable. They use local Lipschitz constant $( L _ { q , x _ { 0 } } )$ instead of global Lipschitz constant $( L _ { q } )$ to obtain a tighter bound in the adversarial perturbation $\delta$ .
89
+
90
+ Corollary 3.2.1 (Formal guarantee on $\beta _ { L }$ for untargeted attack). 2 Let $L _ { q , x _ { 0 } } ^ { j }$ be local Lipschitz constant of function $f _ { c } ( { \pmb x } ) - f _ { j } ( { \pmb x } )$ at $\scriptstyle { \mathbf { { \mathit { x } } } } _ { \mathbf { 0 } }$ over some fixed ball $B _ { p } ( \pmb { x _ { 0 } } , R ) : = \{ \pmb { x } \in \mathbb { R } ^ { d } \ | \ \| \pmb { x } - \pmb { x _ { 0 } } \| _ { p } \ \leq$ $R \}$ and let $\pmb { \delta } \in B _ { p } ( \mathbf { 0 } , R )$ . By Theorem 3.2, we obtain the bound in (Hein & Andriushchenko, 2017):
91
+
92
+ $$
93
+ \| \pmb { \delta } \| _ { p } \leq \operatorname* { m i n } \bigg \{ \operatorname* { m i n } _ { j \neq c } \frac { f _ { c } ( \pmb { x _ { 0 } } ) - f _ { j } ( \pmb { x _ { 0 } } ) } { L _ { q , x _ { 0 } } ^ { j } } , R \bigg \} .
94
+ $$
95
+
96
+ An important use case of Theorem 3.2 and Corollary 3.2.1 is the bound for targeted attack:
97
+
98
+ Corollary 3.2.2 (Formal guarantee on $\beta _ { L }$ for targeted attack). Assume the same notation as in Theorem 3.2 and Corollary 3.2.1. For a specified target class $j$ , we have $\begin{array} { r l } { \| \delta \| _ { p } } & { { } \leq } \end{array}$ $\begin{array} { r } { \operatorname* { m i n } \left\{ \frac { f _ { c } ( \pmb { x _ { 0 } } ) - f _ { j } ( \pmb { x _ { 0 } } ) } { L _ { q , x _ { 0 } } ^ { j } } , R \right\} } \end{array}$
99
+
100
+ In addition, we further extend Theorem 3.2 to a special case of non-differentiable functions – neural networks with ReLU activations. In this case the Lipchitz constant used in Lemma 3.1 can be replaced by the maximum norm of directional derivative, and our analysis above will go through.
101
+
102
+ Lemma 3.3 (Formal guarantee on $\beta _ { L }$ for ReLU networks). 3 Let $h ( \cdot )$ be a $l$ -layer ReLU neural network with $W _ { i }$ as the weights for layer $i$ . We ignore bias terms as they don’t contribute to gradient.
103
+
104
+ $$
105
+ h ( \pmb { x } ) = \sigma ( W _ { l } \sigma ( W _ { l - 1 } \dots \sigma ( W _ { 1 } \pmb { x } ) ) )
106
+ $$
107
+
108
+ where $\sigma ( u ) = \operatorname* { m a x } ( 0 , u )$ . Let $S \subset \mathbb { R } ^ { d }$ be a convex bounded closed set, then equation (1) holds with $\begin{array} { r } { L _ { q } = \operatorname* { s u p } _ { \pmb { x } \in S } \{ | \operatorname* { s u p } _ { \| \pmb { d } \| _ { p } = 1 } D ^ { + } h ( \pmb { x } ; \pmb { d } ) | \} } \end{array}$ where $\begin{array} { r } { D ^ { + } h ( { \pmb x } ; { \pmb d } ) : = \operatorname* { l i m } _ { t 0 ^ { + } } \frac { h ( { \pmb x } + t { \pmb d } ) - h ( { \pmb x } ) } { t } } \end{array}$ h(x+td)−h(x) is the one-sided directional direvative, then Theorem 3.2, Corollary 3.2.1 and Corollary 3.2.2 still hold.
109
+
110
+ # 4 THE CLEVER ROBUSTNESS METRIC VIA EXTREME VALUE THEORY
111
+
112
+ In this section, we provide an algorithm to compute the robustness metric CLEVER with the aid of extreme value theory, where CLEVER can be viewed as an efficient estimator of the lower bound $\beta _ { L }$ and is the first attack-agnostic score that applies to any neural network classifiers. Recall in Section 3 we show that the lower bound of network robustness is associated with $g ( x _ { 0 } )$ and its cross Lipschitz constant $L _ { q , x _ { 0 } } ^ { j }$ , where $g ( \pmb { x _ { 0 } } ) = f _ { c } ( \pmb { x _ { 0 } } ) - f _ { j } ( \pmb { x _ { 0 } } )$ is readily available at the output of a classifier and $L _ { q , x _ { 0 } } ^ { j }$ is defined as $\mathrm { m a x } _ { \pmb { x } \in B _ { p } ( { \pmb x } _ { 0 } , R ) } \| \nabla g ( { \pmb x } ) \| _ { q }$ . Although $\nabla g ( { \pmb x } )$ can be calculated easily via back propagation, computing $L _ { q , x _ { 0 } } ^ { j }$ is more involved because it requires to obtain the maximum value of $\| \nabla g ( \pmb { x } ) \| _ { q }$ in a ball. Exhaustive search on low dimensional $_ { \textbf { \em x } }$ in $B _ { p } ( { \pmb x } _ { 0 } , R )$ seems already infeasible, not to mention the image classifiers with large feature dimensions of our interest. For instance, the feature dimension $d = 7 8 4 , 3 0 7 2 , 1 5 0 5 2 8$ for MNIST, CIFAR and ImageNet respectively.
113
+
114
+ One approach to compute $L _ { q , x _ { 0 } } ^ { j }$ is through sampling a set of points $\pmb { x } ^ { ( i ) }$ in a ball $B _ { p } ( { \pmb x } _ { 0 } , R )$ around $\scriptstyle { \mathbf { { \mathit { x } } } } _ { 0 }$ and taking the maximum value of $\| \nabla g ( \pmb { x } ^ { ( i ) } ) \| _ { q }$ . However, a significant amount of samples might be needed to obtain a good estimate of max $| | \vec { \nabla } \dot { g } ( { \pmb x } ) | | _ { q }$ and it is unknown how good the estimate is compared to the true maximum. Fortunately, Extreme Value Theory ensures that the maximum value of random variables can only follow one of the three extreme value distributions, which is useful to estimate max $\| \nabla g ( { \pmb x } ) \| _ { q }$ with only a tractable number of samples.
115
+
116
+ It is worth noting that although Wood & Zhang (1996) also applied extreme value theory to estimate the Lipschitz constant. However, there are two main differences between their work and this paper. First of all, the sampling methodology is entirely different. Wood & Zhang (1996) calculates the slopes between pairs of sample points whereas we directly take samples on the norm of gradient as in Lemma 3.1. Secondly, the functions considered in Wood & Zhang (1996) are only one-dimensional as opposed to the high-dimensional classification functions considered in this paper. For comparison, we show in our experiment that the approach in Wood & Zhang (1996), denoted as SLOPE in Table 3 and Figure 4, perform poorly for high-dimensional classifiers such as deep neural networks.
117
+
118
+ # 4.1 ESTIMATE $L _ { q , x _ { 0 } } ^ { j }$ VIA EXTREME VALUE THEORY
119
+
120
+ When sampling a point $_ { \textbf { \em x } }$ uniformly in $B _ { p } ( { \pmb x } _ { 0 } , R )$ , $\| \nabla g ( { \pmb x } ) \| _ { q }$ can be viewed as a random variable characterized by a cumulative distribution function (CDF). For the purpose of illustration, we derived the CDF for a 2-layer neural network in Theorem D.1.4 For any neural networks, suppose we have $n$ samples $\{ \| \nabla g ( \pmb { x } ^ { ( i ) } ) \| _ { q } \}$ , and denote them as a sequence of independent and identically distributed (iid) random variables $Y _ { 1 } , Y _ { 2 } , \cdots , Y _ { n }$ , each with CDF $F _ { Y } ( y )$ . The CDF of $\operatorname* { m a x } \{ Y _ { 1 } , \cdot \cdot \cdot , Y _ { n } \}$ , denoted as $F _ { Y } ^ { n } ( y )$ , is called the limit distribution of $F _ { Y } ( y )$ . Fisher-TippettGnedenko theorem says that $F _ { Y } ^ { n } ( y )$ , if exists, can only be one of the three family of extreme value distributions – the Gumbel class, the Frechet class and the reverse Weibull class. ´
121
+
122
+ Theorem 4.1 (Fisher-Tippett-Gnedenko Theorem). If there exists a sequence of pairs of real numbers $\left( a _ { n } , b _ { n } \right)$ such that $a _ { n } > 0$ and $\begin{array} { r } { \operatorname* { l i m } _ { n \to \infty } F _ { Y } ^ { n } ( a _ { n } y + b _ { n } ) = G ( y ) } \end{array}$ , where $G$ is a non-degenerate distribution function, then $G$ belongs to either the Gumbel class (Type $I )$ , the Frechet class (Type II) ´ or the Reverse Weibull class (Type III) with their CDFs as follows:
123
+
124
+ $$
125
+ \begin{array} { r l r } & { } & { \mathrm { G u m b e l ~ c l a s s ~ ( T y p e ~ I ) } ; \quad G ( y ) = \exp \big \{ - \exp \big [ - \frac { y - a _ { W } } { b _ { W } } \big ] \big \} , \quad y \in \mathbb { R } , } \\ & { } & { \mathrm { F r } { \ ' e c h e t ~ c l a s s ~ ( T y p e ~ I I ) } ; \quad G ( y ) = \Big \{ \begin{array} { l l } { 0 , } & { \mathrm { ~ i f ~ } y < a _ { W } , } \\ { \exp \{ - \big ( \frac { y - a _ { W } } { b _ { W } } \big ) ^ { - c _ { w } } \} , } & { \mathrm { ~ i f ~ } y \geq a _ { W } , } \end{array} } \\ & { } & { \mathrm { \it ~ r e r s e ~ W e i b u l l ~ c l a s s ~ ( T y p e ~ I I I ) } ; \quad G ( y ) = \Big \{ \begin{array} { l l } { \exp \{ - \big ( \frac { a _ { W } - y } { b _ { W } } \big ) ^ { c _ { w } } \} , } & { \mathrm { ~ i f ~ } y < a _ { W } , } \\ { 1 , } & { \mathrm { ~ i f ~ } y \geq a _ { W } , } \end{array} \Big \} , } \\ & { } & { \mathrm { \it ~ i f ~ } y \geq a _ { W } , } \end{array}
126
+ $$
127
+
128
+ where $a _ { W } \in \mathbb { R } ,$ $b _ { W } > 0$ and $c _ { W } > 0$ are the location, scale and shape parameters, respectively. Theorem 4.1 implies that the maximum values of the samples follow one of the three families of distributions. If $g ( { \pmb x } )$ has a bounded Lipschitz constant, $\| \nabla g ( \pmb { x } ^ { ( i ) } ) \| _ { q }$ is also bounded, thus its limit distribution must have a finite right end-point. We are particularly interested in the reverse Weibull class, as its CDF has a finite right end-point (denoted as $a w$ ). The right end-point reveals the upper limit of the distribution, cross Lipschitz constant $L _ { q , \pmb { x } _ { 0 } } ^ { j }$ as the extreme value. The extreme value is exactly thewe would like to estimate in this paper. To estimate Ljq,x0 own local, we first generate $N _ { s }$ samples of $\mathbf { \boldsymbol { x } } ^ { ( i ) }$ over a fixed ball $B _ { p } ( { \pmb x } _ { \mathbf { 0 } } , R )$ uniformly and independently in each batch with a total of $N _ { b }$ batches. We then compute $\| \nabla g ( \pmb { x } ^ { ( i ) } ) \| _ { q }$ and store the maximum values of each batch in set $S$ . Next, with samples in $S$ , we perform a maximum likelihood estimation of reverse Weibull distribution parameters, and the location estimate $\hat { a } _ { W }$ is used as an estimate of $L _ { q , \pmb { x } _ { 0 } } ^ { j }$ .
129
+
130
+ Given an instance $\scriptstyle { \mathbf { { \mathit { x } } } } _ { \mathbf { 0 } }$ , its classifier $f ( x _ { 0 } )$ and a target class $j$ , a targeted CLEVER score of the classifier’s robustness can be computed via $g ( x _ { 0 } )$ and $L _ { q , x _ { 0 } } ^ { j }$ . Similarly, untargeted CLEVER scores can be computed. With the proposed procedure of estimating $L _ { q , x _ { 0 } } ^ { j }$ described in Section 4.1, we summarize the flow of computing CLEVER score for both targeted attacks and un-targeted attacks in Algorithm 1 and 2, respectively.
131
+
132
+ # Algorithm 1: CLEVER-t, compute CLEVER score for targeted attack
133
+
134
+ Input: a $K$ -class classifier $f ( { \pmb x } )$ , data example $\scriptstyle { \mathbf { { \mathit { x } } } } _ { \mathbf { 0 } }$ with predicted class $c$ , target class $j$ , batch size $N _ { b }$ , number of samples per batch $N _ { s }$ , perturbation norm $p$ , maximum perturbation $R$ Result: CLEVER Score $\mu \in \mathbb { R } _ { + }$ for target class $j$ 1 $S \gets \{ \emptyset \}$ $\begin{array} { r } { \cdot \{ \emptyset \} , g ( { \pmb x } ) f _ { c } ( { \pmb x } ) - f _ { j } ( { \pmb x } ) , q \frac { p } { p - 1 } , } \end{array}$ . 2 for $i \gets 1$ to $N _ { b }$ do 3 for $k \gets 1$ to $N _ { s }$ do 4 randomly select a point $\pmb { x } ^ { ( i , k ) } \in B _ { p } ( \pmb { x } _ { 0 } , R )$ 5 compute $b _ { i k } \| \nabla g ( \pmb { x } ^ { ( i , k ) } ) \| _ { q }$ via back propagation 6 end 7 $S \gets S \cup \{ \operatorname* { m a x } _ { k } \{ b _ { i k } \} \}$ 8 end 9 $\hat { a } _ { W } \gets \mathbf { M } \mathbf { L } \mathbf { E }$ of location parameter of reverse Weibull distribution on $S$ 10 $\begin{array} { r } { \mu \operatorname* { m i n } ( \frac { g ( \pmb { x _ { 0 } } ) } { \hat { a } } , R ) } \end{array}$
135
+
136
+ # Algorithm 2: CLEVER-u, compute CLEVER score for un-targeted attack
137
+
138
+ Input: Same as Algorithm 1, but without a target class $j$ Result: CLEVER score $\nu \in \mathbb { R } _ { + }$ for un-targeted attack 1 for $j 1$ to $K$ , $j \neq c$ do 2 $| \quad \mu _ { j } \gets \mathrm { C L E V E R - t } ( f , \boldsymbol { x } _ { 0 } , c , j , N _ { b } , N _ { s } , p , R )$ 3 end 4 $\nu \gets \operatorname* { m i n } _ { j } \{ \mu _ { j } \}$
139
+
140
+ # 5 EXPERIMENTAL RESULTS
141
+
142
+ # 5.1 NETWORKS AND PARAMETER SETUP
143
+
144
+ We conduct experiments on CIFAR-10 (CIFAR for short), MNIST, and ImageNet data sets. For the former two smaller datasets CIFAR and MNIST, we evaluate CLEVER scores on four relatively small networks: a single hidden layer MLP with softplus activation (with the same number of hidden units as in (Hein & Andriushchenko, 2017)), a 7-layer AlexNet-like CNN (with the same structure as in (Carlini & Wagner, 2017b)), and the 7-layer CNN with defensive distillation (Papernot et al., 2016) (DD) and bounded ReLU (Zantedeschi et al., 2017) (BReLU) defense techniques employed.
145
+
146
+ For ImageNet data set, we use three popular deep network architectures: a 50-layer Residual Network (He et al., 2016) (ResNet-50), Inception-v3 (Szegedy et al., 2016) and MobileNet (Howard et al., 2017). They were chosen for the following reasons: (i) they all yield (close to) state-of-theart performance among equal-sized networks; and (ii) their architectures are significantly different with unique building blocks, i.e., residual block in ResNet, inception module in Inception net, and depthwise separable convolution in MobileNet. Therefore, their diversity in network architectures is appropriate to test our robustness metric. For MobileNet, we set the width multiplier to 1.0, achieving a ${ \bar { 7 } } 0 . 6 \%$ accuracy on ImageNet. We used public pretrained weights for all ImageNet models5.
147
+
148
+ In all our experiments, we set the sampling parameters $N _ { b } = 5 0 0$ , $N _ { s } = 1 0 2 4$ and $R = 5$ . For targeted attacks, we use 500 test-set images for CIFAR and MNIST and use 100 test-set images for ImageNet; for each image, we evaluate its targeted CLEVER score for three targets: a random target class, a least likely class (the class with lowest probability when predicting the original example), and the top-2 class (the class with largest probability except for the true class, which is usually the easiest target to attack). We also conduct untargeted attacks on MNIST and CIFAR for 100 test-set images, and evaluate their untargeted CLEVER scores. Our experiment code is publicly available6.
149
+
150
+ 5.2 FITTING GRADIENT NORM SAMPLES WITH REVERSE WEIBULL DISTRIBUTIONS
151
+
152
+ We fit the cross Lipschitz constant samples in $S$ (see Algorithm 1) with reverse Weibull class distribution to obtain the maximum likelihood estimate of the location parameter $\hat { a } _ { W }$ , scale parameter $\hat { b } _ { W }$ and shape parameter $\hat { c } _ { W }$ , as introduced in Theorem 4.1. To validate that reverse Weibull distribution is a good fit to the empirical distribution of the cross Lipschitz constant samples, we conduct Kolmogorov-Smirnov goodness-of-fit test (a.k.a. K-S test) to calculate the K-S test statistics $D$ and corresponding $p$ -values. The null hypothesis is that samples $S$ follow a reverse Weibull distribution.
153
+
154
+ Figure 2 plots the probability distribution function of the cross Lipschitz constant samples and the fitted Reverse Weibull distribution for images from various data sets and network architectures. The estimated MLE parameters, $p$ -values, and the K-S test statistics $D$ are also shown. We also calculate the percentage of examples whose estimation have $p$ -values greater than 0.05, as illustrated in Figure 3. If the $p$ -value is greater than 0.05, the null hypothesis cannot be rejected, meaning that the underlying data samples fit a reverse Weibull distribution well. Figure 3 shows that all numbers are close to $100 \%$ , validating the use of reverse Weibull distribution as an underlying distribution of gradient norm samples empirically. Therefore, the fitted location parameter of reverse Weibull distribution (i.e., the extreme value), $\hat { a } _ { W }$ , can be used as a good estimation of local cross Lipschitz constant to calculate the CLEVER score. The exact numbers are shown in Table 5 in Appendix E.
155
+
156
+ ![](images/1594e63d524ab271966776e460313e84135394152f920d2f7c78c1d759846c0b.jpg)
157
+ Figure 2: The cross Lipschitz constant samples for three images from CIFAR, MNIST and ImageNet datasets, and their fitted Reverse Weibull distributions with the corresponding MLE estimates of location, scale and shape parameters $\left( a _ { W } , b _ { W } , c _ { W } \right)$ shown on the top of each plot. The $D$ -statistics of K-S test and p-values are denoted as $k s$ and pval. With small $k s$ and high p-value, the hypothesized reverse Weibull distribution fits the empirical distribution of cross Lipschitz constant samples well.
158
+
159
+ ![](images/0cf944bfbb1a233a359e6510ba5e6a25da12f69cf0636e763b81b369a014a232.jpg)
160
+ Figure 3: The percentage of examples whose null hypothesis (the samples $S$ follow a reverse Weibull distribution) cannot be rejected by K-S test with a significance level of 0.05 for $p = 2$ and $p = \infty$ . All numbers for each model are close to $100 \%$ , indicating $S$ fits reverse Weibull distributions well.
161
+
162
+ # 5.3 COMPARING CLEVER SCORE WITH ATTACK-SPECIFIC NETWORK ROBUSTNESS
163
+
164
+ We apply the state-of-the-art white-box attack methods, iterative fast gradient sign method (IFGSM) (Goodfellow et al., 2015; Kurakin et al., 2016b) and Carlini and Wagner’s attack (CW) (Carlini & Wagner, 2017b), to find adversarial examples for 11 networks, including 4 networks trained on CIFAR, 4 networks trained on MNIST, and 3 networks trained on ImageNet. For CW attack, we run 1000 iterations for ImageNet and CIFAR, and 2000 iterations for MNIST, as MNIST has shown to be more difficult to attack (Chen et al., 2017b). Attack learning rate is individually tuned for each model: 0.001 for Inception-v3 and ResNet-50, 0.0005 for MobileNet and 0.01 for all other networks. For I-FGSM, we run 50 iterations and choose the optimal $\epsilon \in \{ 0 . 0 1 , 0 . 0 2 5 , 0 . 0 5 , 0 . 1 , 0 . 3 , 0 . 5 , 0 . 8 , 1 . 0 \}$ to achieve the smallest $\ell _ { \infty }$ distortion for each individual image. For defensively distilled (DD) networks, 50 iterations of I-FGSM are not sufficient; we use 250 iterations for CIFAR-DD and 500 iterations for MNIST-DD to achieve a $100 \%$ success rate. For the problem to be non-trivial, images that are classified incorrectly are skipped. We report $100 \%$ attack success rates for all the networks, and thus the average distortion of adversarial examples can indicate the attack-specific robustness of each network. For comparison, we compute the CLEVER scores for the same set of images and attack targets. To the best of our knowledge, CLEVER is the first attack-independent robustness score that is capable of handling the large networks studied in this paper, so we directly compare it with the attack-induced distortion metrics in our study.
165
+
166
+ We evaluate the effectiveness of our CLEVER score by comparing the upper bound $\beta _ { U }$ (found by attacks) and CLEVER score, where CLEVER serves as an estimated lower bound, $\beta _ { L }$ . Table 3 compares the average $\ell _ { 2 }$ and $\ell _ { \infty }$ distortions of adversarial examples found by targeted CW and I-FGSM attacks and the corresponding average targeted CLEVER scores for $\ell _ { 2 }$ and $\ell _ { \infty }$ norms, and Figure 4 visualizes the results for $\ell _ { \infty }$ norm. Similarly, Table 2 compares untargeted CW and I-FGSM attacks with untargeted CLEVER scores. As expected, CLEVER is smaller than the distortions of adversarial images in most cases. More importantly, since CLEVER is independent of attack algorithms, the reported CLEVER scores can roughly indicate the distortion of the best possible attack in terms of a specific $\ell _ { p }$ distortion. The average $\ell _ { 2 }$ distortion found by CW attack is close to the $\ell _ { 2 }$ CLEVER score, indicating CW is a strong $\ell _ { 2 }$ attack. In addition, when a defense mechanism (Defensive Distillation or Bounded ReLU) is used, the corresponding CLEVER scores are consistently increased (except for CIFAR-BReLU), indicating that the network is indeed made more resilient to adversarial perturbations. For CIFAR-BReLU, both CLEVER scores and $\ell _ { p }$ norm of adversarial examples found by CW attack decrease, implying that bound ReLU is an ineffective defense for CIFAR. CLEVER scores can be seen as a security checkpoint for unseen attacks. For example, if there is a substantial gap in distortion between the CLEVER score and the considered attack algorithms, it may suggest the existence of a more effective attack that can close the gap.
167
+
168
+ Since CLEVER score is derived from an estimation of the robustness lower bound, we further verify the viability of CLEVER per each example, i.e., whether it is usually smaller than the upper bound found by attacks. Table 4 shows the percentage of inaccurate estimations where the CLEVER score is larger than the distortion of adversarial examples found by CW and I-FGSM attacks in three ImageNet networks. We found that CLEVER score provides an accurate estimation for most of the examples. For MobileNet and Resnet-50, our CLEVER score is a strict lower bound of these two attacks for more than $96 \%$ of tested examples. For Inception-v3, the condition of strict lower bound
169
+
170
+ Table 2: Comparison between the average untargeted CLEVER score and distortion found by CW and I-FGSM untargeted attacks. DD and BReLU represent Defensive Distillation and Bounded ReLU defending methods applied to the baseline CNN network.
171
+
172
+ <table><tr><td></td><td colspan="2">CW</td><td colspan="2">I-FGSM</td><td colspan="2">CLEVER</td></tr><tr><td></td><td>l2</td><td>lo</td><td>l2</td><td>lo</td><td>l2</td><td>l</td></tr><tr><td>MNIST-MLP</td><td>1.113</td><td>0.215</td><td>3.564</td><td>0.178</td><td>0.819</td><td>0.041</td></tr><tr><td>MNIST-CNN</td><td>1.500</td><td>0.455</td><td>4.439</td><td>0.288</td><td>0.721</td><td>0.057</td></tr><tr><td>MNIST-DD</td><td>1.548</td><td>0.409</td><td>5.617</td><td>0.283</td><td>0.865</td><td>0.063</td></tr><tr><td>MNIST-BReLU</td><td>1.337</td><td>0.433</td><td>3.851</td><td>0.285</td><td>0.833</td><td>0.065</td></tr><tr><td>CIFAR-MLP</td><td>0.253</td><td>0.018</td><td>0.885</td><td>0.016</td><td>0.219</td><td>0.005</td></tr><tr><td>CIFAR-CNN</td><td>0.195</td><td>0.023</td><td>0.721</td><td>0.018</td><td>0.072</td><td>0.002</td></tr><tr><td>CIFAR-DD</td><td>0.285</td><td>0.032</td><td>1.136</td><td>0.024</td><td>0.130</td><td>0.004</td></tr><tr><td>CIFAR-BReLU</td><td>0.159</td><td>0.019</td><td>0.519</td><td>0.013</td><td>0.045</td><td>0.001</td></tr></table>
173
+
174
+ Table 3: Comparison of the average targeted CLEVER scores with average $\ell _ { \infty }$ and $\ell _ { 2 }$ distortions found by CW, I-FSGM attacks, and the average scores calculated by using the algorithm in Wood & Zhang (1996) (denoted as SLOPE) to estimate Lipschitz constant. DD and BReLU denote Defensive Distillation and Bounded ReLU defending methods applied to the CNN network. We did not include SLOPE in ImageNet networks because it has been shown to be ineffective even for smaller networks.
175
+
176
+ (a) avergage $\ell _ { \infty }$ distortion of CW and I-FGSM targeted attacks, and CLEVER and SLOPE estimation. Some very large SLOPE estimates (in parentheses) exceeding the maximum possible $\ell _ { \infty }$ distortion are reported as 1.
177
+
178
+ <table><tr><td rowspan="2"></td><td colspan="4">LeastLikely Target</td><td colspan="4">Random Target</td><td colspan="4">Top-2 Target</td></tr><tr><td>CW</td><td>I-FGSM</td><td>CLEVER</td><td>SLOPE</td><td>CW</td><td>I-FGSM</td><td>CLEVER</td><td>SLOPE</td><td>CW</td><td>I-FGSM</td><td>CLEVER</td><td>SLOPE</td></tr><tr><td>MNIST-MLP</td><td>0.475</td><td>0.223</td><td>0.071</td><td>0.808</td><td>0.337</td><td>0.173</td><td>0.072</td><td>0.813</td><td>0.218</td><td>0.119</td><td>0.069</td><td>0.786</td></tr><tr><td>MNIST-CNN</td><td>0.601</td><td>0.313</td><td>0.090</td><td>0.996</td><td>0.550</td><td>0.264</td><td>0.088</td><td>0.982</td><td>0.451</td><td>0.211</td><td>0.070</td><td>0.826</td></tr><tr><td>MNIST-DD</td><td>0.578</td><td>0.283</td><td>0.103</td><td>1 (1.090)</td><td>0.531</td><td>0.238</td><td>0.091</td><td>0.953</td><td>0.412</td><td>0.165</td><td>0.091</td><td>0.984</td></tr><tr><td>MNIST-BReLU</td><td>0.601</td><td>0.276</td><td>0.257</td><td>1 (5.327)</td><td>0.544</td><td>0.238</td><td>0.187</td><td>3.907</td><td>0.442</td><td>0.196</td><td>0.117</td><td>1 (2.470)</td></tr><tr><td>CIFAR-MLP</td><td>0.086</td><td>0.039</td><td>0.014</td><td>0.294</td><td>0.051</td><td>0.024</td><td>0.014</td><td>0.284</td><td>0.019</td><td>0.013</td><td>0.014</td><td>0.286</td></tr><tr><td>CIFAR-CNN</td><td>0.053</td><td>0.033</td><td>0.005</td><td>0.153</td><td>0.042</td><td>0.023</td><td>0.005</td><td>0.148</td><td>0.022</td><td>0.013</td><td>0.004</td><td>0.129</td></tr><tr><td>CIFAR-DD</td><td>0.091</td><td>0.053</td><td>0.011</td><td>0.278</td><td>0.066</td><td>0.032</td><td>0.010</td><td>0.255</td><td>0.033</td><td>0.014</td><td>0.007</td><td>0.184</td></tr><tr><td>CIFAR-BReLU</td><td>0.045</td><td>0.030</td><td>0.004</td><td>0.250</td><td>0.034</td><td>0.022</td><td>0.003</td><td>0.173</td><td>0.018</td><td>0.012</td><td>0.002</td><td>0.095</td></tr><tr><td>Inception-v3</td><td>0.023</td><td>0.011</td><td>0.002</td><td>-</td><td>0.021</td><td>0.012</td><td>0.002</td><td>-</td><td>0.010</td><td>0.011</td><td>0.001</td><td>-</td></tr><tr><td>Resnet-50</td><td>0.031</td><td>0.015</td><td>0.002</td><td>-</td><td>0.025</td><td>0.012</td><td>0.002</td><td>-</td><td>0.010</td><td>0.010</td><td>0.001</td><td>-</td></tr><tr><td>MobileNet</td><td>0.025</td><td>0.010</td><td>0.003</td><td>-</td><td>0.018</td><td>0.010</td><td>0.002</td><td>-</td><td>0.006</td><td>0.010</td><td>0.001</td><td>=</td></tr></table>
179
+
180
+ (b) average $\ell _ { 2 }$ distortion of CW and I-FGSM targeted attacks, and CLEVER and SLOPE estimation. Some very large SLOPE estimates (in parentheses) exceeding the sampling radius $R = 5$ are reported as 5.
181
+
182
+ <table><tr><td rowspan="2"></td><td colspan="4">LeastLikely Target</td><td colspan="4">Random Target</td><td colspan="4">Top-2 Target</td></tr><tr><td>CW</td><td>I-FGSM</td><td>CLEVER</td><td>SLOPE</td><td>CW</td><td>I-FGSM</td><td>CLEVER</td><td>SLOPE</td><td>CW</td><td>I-FGSM</td><td>CLEVER</td><td>SLOPE</td></tr><tr><td>MNIST-MLP</td><td>2.575</td><td>4.273</td><td>1.409</td><td>5(8.028)</td><td>1.833</td><td>3.369</td><td>1.432</td><td>5(8.102)</td><td>1.128</td><td>2.374</td><td>1.383</td><td>5(7.853)</td></tr><tr><td>MNIST-CNN</td><td>2.377</td><td>4.417</td><td>1.257</td><td>5 (9.947)</td><td>2.005</td><td>3.902</td><td>1.227</td><td>5 (9.619)</td><td>1.504</td><td>3.242</td><td>0.987</td><td>5 (7.921)</td></tr><tr><td>MNIST-DD</td><td>2.644</td><td>4.957</td><td>1.532</td><td>5 (10.628)</td><td>2.240</td><td>4.253</td><td>1.340</td><td>5 (9.493)</td><td>1.542</td><td>3.010</td><td>1.330</td><td>5 (9.646)</td></tr><tr><td>MNIST-BReLU</td><td>2.349</td><td>5.170</td><td>3.312</td><td>5(52.058)</td><td>1.923</td><td>4.544</td><td>2.565</td><td>5 (37.531)</td><td>1.404</td><td>3.778</td><td>1.583</td><td>5(23.548)</td></tr><tr><td>CIFAR-MLP</td><td>1.123</td><td>1.896</td><td>0.620</td><td>5 (5.013)</td><td>0.673</td><td>1.214</td><td>0.597</td><td>4.806</td><td>0.262</td><td>0.689</td><td>0.599</td><td>4.949</td></tr><tr><td>CIFAR-CNN</td><td>0.836</td><td>1.067</td><td>0.156</td><td>2.630</td><td>0.372</td><td>0.837</td><td>0.146</td><td>2.497</td><td>0.188</td><td>0.552</td><td>0.123</td><td>2.195</td></tr><tr><td>CIFAR-DD</td><td>2.065</td><td>1.540</td><td>0.347</td><td>4.735</td><td>0.624</td><td>1.097</td><td>0.307</td><td>4.279</td><td>0.296</td><td>0.582</td><td>0.220</td><td>3.083</td></tr><tr><td>CIFAR-BReLU</td><td>0.407</td><td>0.928</td><td>0.140</td><td>4.125</td><td>0.303</td><td>0.732</td><td>0.103</td><td>2.944</td><td>0.152</td><td>0.494</td><td>0.052</td><td>1.564</td></tr><tr><td>Inception-v3</td><td>0.628</td><td>2.244</td><td>0.524</td><td>-</td><td>0.595</td><td>2.261</td><td>0.466</td><td>-</td><td>0.287</td><td>2.073</td><td>0.234</td><td>-</td></tr><tr><td>Resnet-50</td><td>0.767</td><td>2.410</td><td>0.357</td><td>=</td><td>0.647</td><td>2.098</td><td>0.299</td><td>·</td><td>0.212</td><td>1.682</td><td>0.134</td><td>=</td></tr><tr><td>MobileNet</td><td>0.837</td><td>2.195</td><td>0.617</td><td>-</td><td>0.603</td><td>2.066</td><td>0.439</td><td>=</td><td>0.190</td><td>1.771</td><td>0.144</td><td>=</td></tr></table>
183
+
184
+ ![](images/bfd96f9277bcc8ece64b8c64329fc08b3906f8ddb874b4ac1e0980e7e17d51d8.jpg)
185
+ Figure 4: Comparison of $\ell _ { \infty }$ distortion obtained by CW and I-FGSM attacks, CLEVER score and the slope based Lipschitz constant estimation (SLOPE) by Wood & Zhang (1996). SLOPE significantly exceeds the distortions found by attacks, thus it is an inappropriate estimation of lower bound $\beta _ { L }$ .
186
+
187
+ is worse (still more than $7 5 \%$ ), but we found that in these cases the attack distortion only differs from our CLEVER score by a fairly small amount. In Figure 5 we show the empirical CDF of the gap between CLEVER score and the $\ell _ { 2 }$ norm of adversarial distortion generated by CW attack for the same set of images in Table 4. In Figure 6, we plot the $\ell _ { 2 }$ distortion and CLEVER scores for each individual image. A positive gap indicates that CLEVER (estimated lower bound) is indeed less than the upper bound found by CW attack. Most images have a small positive gap, which signifies the near-optimality of CW attack in terms of $\ell _ { 2 }$ distortion, as CLEVER suffices for an estimated capacity of the best possible attack.
188
+
189
+ ![](images/dc5c8a9647fb400eddcbbc9fc76bdc4f9d782d4b0ece480d60712f2f60e93286.jpg)
190
+ Figure 5: The empirical CDF of the gap between CLEVER score and the $\ell _ { 2 }$ norm of adversarial distortion generated by CW attack with random targets for 100 images on 3 ImageNet networks.
191
+
192
+ ![](images/64df8c749987404a647a215080bebd611c3baa46d20ee8e2ee1ac1445ed26d51.jpg)
193
+ Figure 6: Comparison of the CLEVER scores (circle) and the $\ell _ { 2 }$ norm of adversarial distortion generated by CW attack (triangle) with random targets for 100 images. The x-axis is image ID and the y-axis is the $\ell _ { 2 }$ distortion metric.
194
+
195
+ ![](images/e357a021ac2d2f266a10dfddaf24380546875e34e83cf83af83ca69168b2c398.jpg)
196
+ Figure 7: Comparison of the CLEVER score calculated by $N _ { b } = \{ 5 0 , 1 0 0 , 2 5 0 , 5 0 0 \}$ and the $\ell _ { 2 }$ norm of adversarial distortion found by CW attack (CW) on 3 ImageNet models and 3 target types.
197
+
198
+ # 5.4 TIME V.S. ESTIMATION ACCURACY
199
+
200
+ In Figure 7, we vary the number of samples $( N _ { b } = 5 0 , 1 0 0 , 2 5 0 , 5 0 0 )$ and compute the $\ell _ { 2 }$ CLEVER scores for three large ImageNet models, Inception-v3, ResNet-50 and MobileNet. We observe that
201
+
202
+ 50 or 100 samples are usually sufficient to obtain a reasonably accurate robustness estimation despite using a smaller number of samples. On a single GTX 1080 Ti GPU, the cost of 1 sample (with $N _ { s } = 1 0 2 4 )$ is measured as $2 . 9 \ : \mathrm { s }$ for MobileNet, 5.0 s for ResNet-50 and $8 . 9 \ : \mathrm { s }$ for Inception-v3, thus the computational cost of CLEVER is feasible for state-of-the-art large-scale deep neural networks. Additional figures for MNIST and CIFAR datasets are given in Appendix E.
203
+
204
+ # 6 CONCLUSION
205
+
206
+ In this paper, we propose the CLEVER score, a novel and generic metric to evaluate the robustness of a target neural network classifier to adversarial examples. Compared to the existing robustness evaluation approaches, our metric has the following advantages: (i) attack-agnostic; (ii) applicable to any neural network classifier; (iii) comes with strong theoretical guarantees; and (iv) is computationally feasible for large neural networks. Our extensive experiments show that the CLEVER score well matches the practical robustness indication of a wide range of natural and defended networks.
207
+
208
+ Acknowledgment. Luca Daniel and Tsui-Wei Weng are partially supported by MIT-Skoltech program and MIT-IBM Watson AI Lab. Cho-Jui Hsieh and Huan Zhang acknowledge the support of NSF via IIS-1719097.
209
+
210
+ # REFERENCES
211
+
212
+ Osbert Bastani, Yani Ioannou, Leonidas Lampropoulos, Dimitrios Vytiniotis, Aditya Nori, and Antonio Criminisi. Measuring neural net robustness with constraints. In Advances in Neural Information Processing Systems, pp. 2613–2621, 2016.
213
+
214
+ Nicholas Carlini and David Wagner. Adversarial examples are not easily detected: Bypassing ten detection methods. arXiv preprint arXiv:1705.07263, 2017a.
215
+
216
+ Nicholas Carlini and David Wagner. Towards evaluating the robustness of neural networks. In IEEE Symposium on Security and Privacy (SP), pp. 39–57, 2017b.
217
+
218
+ Hongge Chen, Huan Zhang, Pin-Yu Chen, Jinfeng Yi, and Cho-Jui Hsieh. Show-and-fool: Crafting adversarial examples for neural image captioning. CoRR, abs/1712.02051, 2017a.
219
+
220
+ Pin-Yu Chen, Yash Sharma, Huan Zhang, Jinfeng Yi, and Cho-Jui Hsieh. Ead: Elastic-net attacks to deep neural networks via adversarial examples. arXiv preprint arXiv:1709.04114, 2017b.
221
+
222
+ Pin-Yu Chen, Huan Zhang, Yash Sharma, Jinfeng Yi, and Cho-Jui Hsieh. Zoo: Zeroth order optimization based black-box attacks to deep neural networks without training substitute models. arXiv preprint arXiv:1708.03999, 2017c.
223
+
224
+ Laurens De Haan and Ana Ferreira. Extreme value theory: an introduction. Springer Science & Business Media, 2007.
225
+
226
+ Ruediger Ehlers. Formal verification of piece-wise linear feed-forward neural networks. arXiv preprint arXiv:1705.01320, 2017.
227
+
228
+ Ivan Evtimov, Kevin Eykholt, Earlence Fernandes, Tadayoshi Kohno, Bo Li, Atul Prakash, Amir Rahmati, and Dawn Song. Robust physical-world attacks on machine learning models. arXiv preprint arXiv:1707.08945, 2017.
229
+
230
+ Ian J Goodfellow, Jonathon Shlens, and Christian Szegedy. Explaining and harnessing adversarial examples. ICLR’15; arXiv preprint arXiv:1412.6572, 2015.
231
+
232
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 770–778, 2016.
233
+
234
+ Matthias Hein and Maksym Andriushchenko. Formal guarantees on the robustness of a classifier against adversarial manipulation. arXiv preprint arXiv:1705.08475, 2017.
235
+
236
+ Geoffrey Hinton, Oriol Vinyals, and Jeff Dean. Distilling the knowledge in a neural network. arXiv preprint arXiv:1503.02531, 2015.
237
+
238
+ Andrew G Howard, Menglong Zhu, Bo Chen, Dmitry Kalenichenko, Weijun Wang, Tobias Weyand, Marco Andreetto, and Hartwig Adam. Mobilenets: Efficient convolutional neural networks for mobile vision applications. arXiv preprint arXiv:1704.04861, 2017.
239
+
240
+ Xiaowei Huang, Marta Kwiatkowska, Sen Wang, and Min Wu. Safety verification of deep neural networks. In International Conference on Computer Aided Verification, pp. 3–29. Springer, 2017.
241
+
242
+ Guy Katz, Clark Barrett, David Dill, Kyle Julian, and Mykel Kochenderfer. Reluplex: An efficient smt solver for verifying deep neural networks. arXiv preprint arXiv:1702.01135, 2017a.
243
+
244
+ Guy Katz, Clark Barrett, David L Dill, Kyle Julian, and Mykel J Kochenderfer. Towards proving the adversarial robustness of deep neural networks. arXiv preprint arXiv:1709.02802, 2017b.
245
+
246
+ Alexey Kurakin, Ian Goodfellow, and Samy Bengio. Adversarial examples in the physical world. arXiv preprint arXiv:1607.02533, 2016a.
247
+
248
+ Alexey Kurakin, Ian Goodfellow, and Samy Bengio. Adversarial machine learning at scale. ICLR’17; arXiv preprint arXiv:1611.01236, 2016b.
249
+
250
+ Xuanqing Liu, Minhao Cheng, Huan Zhang, and Cho-Jui Hsieh. Towards robust neural networks via random self-ensemble. arXiv preprint arXiv:1712.00673, 2017.
251
+
252
+ Yanpei Liu, Xinyun Chen, Chang Liu, and Dawn Song. Delving into transferable adversarial examples and black-box attacks. arXiv preprint arXiv:1611.02770, 2016.
253
+
254
+ Aleksander Madry, Aleksandar Makelov, Ludwig Schmidt, Dimitris Tsipras, and Adrian Vladu. Towards deep learning models resistant to adversarial attacks. arXiv preprint arXiv:1706.06083, 2017.
255
+
256
+ Dongyu Meng and Hao Chen. Magnet: a two-pronged defense against adversarial examples. arXiv preprint arXiv:1705.09064, 2017.
257
+
258
+ Nicolas Papernot, Patrick McDaniel, Xi Wu, Somesh Jha, and Ananthram Swami. Distillation as a defense to adversarial perturbations against deep neural networks. In IEEE Symposium on Security and Privacy (SP), pp. 582–597, 2016.
259
+
260
+ Nicolas Papernot, Patrick McDaniel, Ian Goodfellow, Somesh Jha, Z Berkay Celik, and Ananthram Swami. Practical black-box attacks against machine learning. In ACM Asia Conference on Computer and Communications Security, pp. 506–519, 2017.
261
+
262
+ Kishore Papineni, Salim Roukos, Todd Ward, and Wei-Jing Zhu. Bleu: a method for automatic evaluation of machine translation. In Proceedings of the 40th annual meeting on association for computational linguistics, pp. 311–318. Association for Computational Linguistics, 2002.
263
+
264
+ Remigijus Paulavicius and Julius ˇ Zilinskas. Analysis of different norms and corresponding lipschitz ˇ constants for global optimization. Technological and Economic Development of Economy, 12(4): 301–306, 2006.
265
+
266
+ Tim Salimans, Ian Goodfellow, Wojciech Zaremba, Vicki Cheung, Alec Radford, and Xi Chen. Improved techniques for training gans. In Advances in Neural Information Processing Systems, pp. 2234–2242, 2016.
267
+
268
+ Christian Szegedy, Wojciech Zaremba, Ilya Sutskever, Joan Bruna, Dumitru Erhan, Ian Goodfellow, and Rob Fergus. Intriguing properties of neural networks. arXiv preprint arXiv:1312.6199, 2013.
269
+
270
+ Christian Szegedy, Vincent Vanhoucke, Sergey Ioffe, Jon Shlens, and Zbigniew Wojna. Rethinking the inception architecture for computer vision. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 2818–2826, 2016.
271
+
272
+ Florian Tramer, Alexey Kurakin, Nicolas Papernot, Dan Boneh, and Patrick McDaniel. Ensemble \` adversarial training: Attacks and defenses. arXiv preprint arXiv:1705.07204, 2017.
273
+
274
+ Beilun Wang, Ji Gao, and Yanjun Qi. A theoretical framework for robustness of (deep) classifiers under adversarial noise. arXiv preprint arXiv:1612.00334, 2016.
275
+ GR Wood and BP Zhang. Estimation of the lipschitz constant of a function. Journal of Global Optimization, 8(1):91–103, 1996.
276
+ Weilin Xu, David Evans, and Yanjun Qi. Feature squeezing: Detecting adversarial examples in deep neural networks. arXiv preprint arXiv:1704.01155, 2017.
277
+ Valentina Zantedeschi, Maria-Irina Nicolae, and Ambrish Rawat. Efficient defenses against adversarial attacks. arXiv preprint arXiv:1707.06728, 2017.
278
+
279
+ # APPENDIX
280
+
281
+ A PROOF OF THEOREM 3.2
282
+
283
+ Proof. According to Lemma 3.1, the assumption that $g ( { \pmb x } ) : = f _ { c } ( { \pmb x } ) - f _ { j } ( { \pmb x } )$ is Lipschitz continuous with Lipschitz constant $L _ { q } ^ { j }$ gives
284
+
285
+ $$
286
+ | g ( \pmb { x } ) - g ( \pmb { y } ) | \leq L _ { q } ^ { j } \| \pmb { x } - \pmb { y } \| _ { p } .
287
+ $$
288
+
289
+ Let ${ \pmb x } = { \pmb x } _ { \mathbf { 0 } } + \delta$ and $\mathbf { \mu } _ { y } = \mathbf { \mathcal { x } } _ { \mathbf { 0 } }$ in (4), we get
290
+
291
+ $$
292
+ | g ( \pmb { x _ { 0 } } + \pmb { \delta } ) - g ( \pmb { x _ { 0 } } ) | \leq L _ { q } ^ { j } \| \pmb { \delta } \| _ { p } ,
293
+ $$
294
+
295
+ which can be rearranged into the following form
296
+
297
+ $$
298
+ g ( { \pmb x _ { 0 } } ) - L _ { q } ^ { j } \| \pmb \delta \| _ { p } \leq g ( { \pmb x _ { 0 } } + { \pmb \delta } ) \leq g ( { \pmb x _ { 0 } } ) + L _ { q } ^ { j } \| \pmb \delta \| _ { p } .
299
+ $$
300
+
301
+ When $g ( \pmb { x _ { 0 } } + \pmb { \delta } ) = 0$ , an adversarial example is found. As indicated by (5), $g ( \pmb { x _ { 0 } } + \pmb { \delta } )$ is lower bounded by $g ( \pmb { x _ { 0 } } ) - L _ { q } ^ { j } \| \delta \| _ { p }$ . If $\| \delta \| _ { p }$ is small enough such that $g ( \pmb { x _ { 0 } } ) - L _ { q } ^ { j } \| \pmb { \delta } \| _ { p } \geq 0$ , no adversarial examples can be found:
302
+
303
+ $$
304
+ g ( { \pmb x _ { 0 } } ) - L _ { q } ^ { j } \| \delta \| _ { p } \geq 0 \Rightarrow \| \delta \| _ { p } \leq \frac { g ( { \pmb x _ { 0 } } ) } { L _ { q } ^ { j } } \Rightarrow \| \delta \| _ { p } \leq \frac { f _ { c } ( { \pmb x _ { 0 } } ) - f _ { j } ( { \pmb x _ { 0 } } ) } { L _ { q } ^ { j } } ,
305
+ $$
306
+
307
+ Finally, to achieve $\begin{array} { r } { \mathrm { a r g m a x } _ { 1 \le i \le K } f _ { i } ( { \pmb x } _ { 0 } + { \pmb \delta } ) = c } \end{array}$ , we take the minimum of the bound on $\| \delta \| _ { p }$ in (A) over $j \neq c$ . I.e. if
308
+
309
+ $$
310
+ \| \pmb { \delta } \| _ { p } \leq \operatorname* { m i n } _ { j \neq c } \frac { f _ { c } ( \pmb { x _ { 0 } } ) - f _ { j } ( \pmb { x _ { 0 } } ) } { L _ { q } ^ { j } } ,
311
+ $$
312
+
313
+ the classifier decision can never be changed and the attack will never succeed.
314
+
315
+ # B PROOF OF COROLLARY 3.2.1
316
+
317
+ Proof. By Lemma 3.1 and let $\mathit { \Pi } _ { g } ~ = ~ f _ { c } - f _ { j }$ , we get $\begin{array} { r } { L _ { q , x _ { 0 } } ^ { j } \ = \ \operatorname* { m a x } _ { y \in B _ { p } ( x _ { 0 } , R ) } \| \nabla g ( y ) \| _ { q } \ = \ } \end{array}$ $\begin{array} { r } { \operatorname* { m a x } _ { y \in B _ { p } ( x _ { 0 } , R ) } \| \nabla f _ { j } ( y ) - \nabla f _ { c } ( y ) \| _ { q } } \end{array}$ , which then gives the bound in Theorem 2.1 of (Hein & Andriushchenko, 2017).
318
+
319
+ # C PROOF OF LEMMA 3.3
320
+
321
+ Proof. For any $\mathbf { \nabla } _ { \mathbf { x } , \mathbf { y } }$ , let $\begin{array} { r } { \pmb { d } = \frac { \pmb { y } - \pmb { x } } { \Vert \pmb { y } - \pmb { x } \Vert _ { p } } } \end{array}$ be the unit vector pointing from $_ { \textbf { \em x } }$ to $\textbf { { y } }$ and $r = \| \pmb { y } - \pmb { x } \| _ { p }$ . Define uni-variate function $u ( z ) = \dot { h } ( \pmb { x } + z \pmb { d } )$ , then $u ( 0 ) = h ( \pmb { x } )$ and $u ( r ) = h ( \pmb { y } )$ and observe that $D ^ { + } h ( { \pmb x } + z d ; d )$ and $D ^ { + } h ( { \pmb x } + z { \pmb d } ; - { \pmb d } )$ are the right-hand and left-hand derivatives of $u ( z )$ , we have
322
+
323
+ $$
324
+ u ^ { \prime } ( z ) = { \left\{ \begin{array} { l l } { D ^ { + } h ( { \boldsymbol { x } } + { \boldsymbol { z } } d ; d ) \leq L _ { q } } & { { \mathrm { ~ i f ~ } } D ^ { + } h ( { \boldsymbol { x } } + { \boldsymbol { z } } d ; d ) = D ^ { + } h ( { \boldsymbol { x } } + { \boldsymbol { z } } d ; - d ) } \\ { { \mathrm { u n d e f i n e d } } } & { { \mathrm { ~ i f ~ } } D ^ { + } h ( { \boldsymbol { x } } + { \boldsymbol { z } } d ; d ) \neq D ^ { + } h ( { \boldsymbol { x } } + { \boldsymbol { z } } d ; - d ) } \end{array} \right. }
325
+ $$
326
+
327
+ For ReLU network, there can be at most finite number of points in $z \in ( 0 , r )$ such that $g ^ { \prime } ( z )$ does not exist. This can be shown because each discontinuous $z$ is caused by some ReLU activation, and there are only finite combinations. Let $0 = z _ { 0 } < z _ { 1 } < \dots < z _ { k - 1 } < z _ { k } = 1$ be those points. Then, using the fundamental theorem of calculus on each interval separately, there exists $\bar { z } _ { i } \in \mathsf { \Gamma } ( z _ { i } , z _ { i - 1 } )$ for each $i$ such that
328
+
329
+ $$
330
+ \begin{array} { l } { \displaystyle u ( r ) - u ( 0 ) \le \sum _ { i = 1 } ^ { k } | u ( z _ { i } ) - u ( z _ { i - 1 } ) | } \\ { \displaystyle \le \sum _ { i = 1 } ^ { k } | u ^ { \prime } ( \bar { z } _ { i } ) ( z _ { i } - z _ { i - 1 } ) | } \\ { \displaystyle \le \sum _ { i = 1 } ^ { k } L _ { q } | z _ { i } - z _ { i - 1 } | _ { p } } \\ { \displaystyle = L _ { q } | | x - y | | _ { p } . } \end{array}
331
+ $$
332
+
333
+ (Mean value theorem)
334
+
335
+ Theorem 3.2 and its corollaries remain valid after replacing Lemma 3.1 with Lemma 3.3.
336
+
337
+ # D THEOREM D.1 AND ITS PROOF
338
+
339
+ Theorem D.1 $( F _ { Y } ( y )$ of one-hidden-layer neural network). Consider a neural network $f : \mathbb { R } ^ { d } $ $\mathbb { R } ^ { K }$ with input $\pmb { x _ { 0 } } \in \mathbb { R } ^ { d }$ , a hidden layer with $U$ hidden neurons, and rectified linear unit (ReLU) activation function. If we sample uniformly in a ball $B _ { p } ( { \pmb x } _ { \mathbf { 0 } } , R )$ , then the cumulative distribution function of $\| \nabla g ( { \pmb x } ) \| _ { q }$ , denoted as $F _ { Y } ( y )$ , is piece-wise linear with at most $\begin{array} { r } { M = \sum _ { i = 0 } ^ { d } \binom { U } { i } } \end{array}$ pieces, where $g ( { \pmb x } ) = f _ { c } ( { \pmb x } ) - f _ { j } ( { \pmb x } )$ for some given $c$ and $j$ , and $\begin{array} { r } { \frac { 1 } { p } + \frac { 1 } { q } = 1 , 1 \leq p , q \leq \infty } \end{array}$ .
340
+
341
+ Proof. The $j _ { \mathrm { t h } }$ output of a one-hidden-layer neural network can be written as
342
+
343
+ $$
344
+ f _ { j } ( \pmb { x } ) = \sum _ { r = 1 } ^ { U } V _ { j r } \cdot \sigma \left( \sum _ { i = 1 } ^ { d } W _ { r i } \cdot x _ { i } + b _ { r } \right) = \sum _ { r = 1 } ^ { U } V _ { j r } \cdot \sigma \left( { \pmb { w } } _ { r } { \pmb { x } } + b _ { r } \right) ,
345
+ $$
346
+
347
+ where $\sigma ( z ) = \operatorname* { m a x } ( z , 0 )$ is ReLU activation function, $W$ and $V$ are the weight matrices of the first and second layer respectively, and ${ \pmb w } _ { r }$ is the $r _ { \mathrm { t h } }$ row of $W$ . Thus, we can compute $g ( { \pmb x } )$ and $\| \nabla g ( { \pmb x } ) \| _ { q }$ below:
348
+
349
+ $$
350
+ \begin{array} { l } { { \displaystyle g ( { \pmb x } ) = f _ { c } ( { \pmb x } ) - f _ { j } ( { \pmb x } ) = \sum _ { r = 1 } ^ { U } V _ { c r } \cdot \sigma \left( { \pmb w } _ { r } { \pmb x } + b _ { r } \right) - \sum _ { r = 1 } ^ { U } V _ { j r } \cdot \sigma \left( { \pmb w } _ { r } { \pmb x } + b _ { r } \right) } } \\ { { \displaystyle ~ = \sum _ { r = 1 } ^ { U } ( V _ { c r } - V _ { j r } ) \cdot \sigma \left( { \pmb w } _ { r } { \pmb x } + b _ { r } \right) } } \end{array}
351
+ $$
352
+
353
+ and
354
+
355
+ $$
356
+ \| \nabla g ( \pmb { x } ) \| _ { q } = \left\| \sum _ { r = 1 } ^ { U } \mathbb { I } ( \pmb { w } _ { r } \pmb { x } + b _ { r } ) ( \pmb { V } _ { c r } - \pmb { V } _ { j r } ) \pmb { w } _ { r } ^ { \top } \right\| _ { q } ,
357
+ $$
358
+
359
+ where $\mathbb { I } ( z )$ is an univariate indicator function:
360
+
361
+ $$
362
+ \mathbb { I } ( z ) = { \left\{ \begin{array} { l l } { 1 , } & { { \mathrm { ~ i f ~ } } z > 0 , } \\ { 0 , } & { { \mathrm { ~ i f ~ } } z \leq 0 . } \end{array} \right. }
363
+ $$
364
+
365
+ ![](images/56b620730d75efaa9d614cdfb55ac36793f6aa4d7027323b0f00242d9ba8da42.jpg)
366
+ Figure 8: Illustration of Theorem D.1 with $d = 2$ , $q = 2$ and $U = 3$ . The three hyperplanes ${ \pmb w } _ { i } { \pmb x } + b _ { i } = 0$ divide the space into seven regions (with different colors). The red dash line encloses the ball $B _ { 2 } ( { \pmb x } _ { \mathbf 0 } , R _ { 1 } )$ and the blue dash line encloses a larger ball $B _ { 2 } ( { \pmb x } _ { \mathbf 0 } , R _ { 2 } )$ . If we draw samples uniformly within the balls, the probability of $\| \nabla g ( { \pmb x } ) \| _ { 2 } = y$ is proportional to the intersected volumes of the ball and the regions with $\| \nabla g ( { \pmb x } ) \| _ { 2 } = y$ .
367
+
368
+ As illustrated in Figure 8, the hyperplanes ${ \pmb w } _ { r } { \pmb x } + b _ { r } = 0 , r \in \{ 1 , . . . , U \}$ divide the $d$ dimensional spaces $\mathbb { R } ^ { d }$ into different regions, with the interior of each region satisfying a different set of inequality constraints, e.g. ${ \pmb w } _ { r _ { + } } { \pmb x } + b _ { r _ { + } } > 0$ and ${ \pmb w } _ { r _ { - } } { \pmb x } + b _ { r _ { - } } < 0$ . Given $_ { \textbf { \em x } }$ , we can identify which region it belongs to by checking the sign of ${ \pmb w } _ { r } { \pmb x } + b _ { r }$ for each $r$ . Notice that the gradient norm is the same for all the points in the same region, i.e. for any $\scriptstyle { \mathbf { { \vec { x } } } } _ { 1 }$ , $\mathbf { \boldsymbol { x } } _ { 2 }$ satisfying $\mathbb { I } ( \pmb { w } _ { r } \pmb { x } _ { 1 } + b _ { r } ) = \mathbb { I } ( \pmb { w } _ { r } \pmb { x } _ { 2 } + b _ { r } ) \ \forall r$ , we hfor a e -d $\| \nabla g ( \pmb { x } _ { 1 } ) \| _ { q } = \| \nabla g ( \pmb { x } _ { 2 } ) \| _ { q }$ . Since theperplanes, t most can ta $\begin{array} { r } { M = \sum _ { i = 0 } ^ { d } \binom { U } { i } } \end{array}$ different regionserent values. $d$ $U$ $\| \nabla g ( { \pmb x } ) \| _ { q }$ $M$
369
+
370
+ Therefore, if we perform uniform sampling in a ball $B _ { p } ( { \pmb x } _ { 0 } , R )$ centered at $\scriptstyle { \mathbf { { \mathit { x } } } } _ { \mathbf { 0 } }$ with radius $R$ and denote $\| \nabla g ( { \pmb x } ) \| _ { q }$ as a random variable $Y$ , the probability distribution of $Y$ is discrete and its CDF is piece-wise constant with at most $M$ pieces. Without loss of generality, assume there are $M _ { 0 } \leq M$ distinct values for $Y$ and denote them as ${ \mathfrak { m } } _ { ( 1 ) } , { \mathfrak { m } } _ { ( 2 ) } , \ldots , { \mathfrak { m } } _ { ( M _ { 0 } ) }$ in an increasing order, the CDF of $Y$ , denoted as $F _ { Y } ( y )$ , is the following:
371
+
372
+ $$
373
+ F _ { Y } ( m _ { ( i ) } ) = F _ { Y } ( m _ { ( i - 1 ) } ) + \frac { \mathbb { V } _ { d } ( \{ x \mid \| \nabla g ( x ) \| _ { q } = m _ { ( i ) } \} ) \cap \mathbb { V } _ { d } ( B _ { p } ( x _ { 0 } , R ) ) ) } { \mathbb { V } _ { d } ( B _ { p } ( x _ { 0 } , R ) ) } , i = 1 , \ldots , M _ { 0 } ,
374
+ $$
375
+
376
+ where $F _ { Y } ( m _ { ( 0 ) } ) = 0$ with $m _ { ( 0 ) } < m _ { ( 1 ) } , \mathbb { V } _ { d } ( E )$ is the volume of $E$ in a $d$ dimensional space.
377
+
378
+ # E ADDITIONAL EXPERIMENTAL RESULTS
379
+
380
+ # E.1 PERCENTAGE OF EXAMPLES HAVING P VALUE $> 0 . 0 5$
381
+
382
+ Table 5 shows the percentage of examples where the null hypothesis cannot be rejected by K-S test, indicating that the maximum gradient norm samples fit reverse Weibull distribution well.
383
+
384
+ Table 5: Percentage of estimations where the null hypothesis cannot be rejected by K-S test for a significance level of 0.05. The bar plots of this table are illustrated in Figure 3.
385
+
386
+ <table><tr><td rowspan="2"></td><td colspan="2">Least Likely</td><td colspan="2">Random</td><td colspan="2">Top-2</td></tr><tr><td>L2</td><td>L8</td><td>L2</td><td>Lo</td><td>L2</td><td>L8</td></tr><tr><td>MNIST-MLP</td><td>100.0</td><td>100.0</td><td>100.0</td><td>100.0</td><td>100.0</td><td>100.0</td></tr><tr><td>MNIST-CNN</td><td>99.6</td><td>99.8</td><td>99.2</td><td>100.0</td><td>99.4</td><td>100.0</td></tr><tr><td>MNIST-DD</td><td>99.8</td><td>100.0</td><td>99.6</td><td>99.8</td><td>99.8</td><td>99.8</td></tr><tr><td>MNIST-BReLU</td><td>93.3</td><td>95.4</td><td>96.8</td><td>96.8</td><td>97.6</td><td>98.2</td></tr><tr><td>CIFAR-MLP</td><td>100.0</td><td>100.0</td><td>100.0</td><td>100.0</td><td>100.0</td><td>100.0</td></tr><tr><td>CIFAR-CNN</td><td>100.0</td><td>100.0</td><td>100.0</td><td>100.0</td><td>100.0</td><td>100.0</td></tr><tr><td>CIFAR-DD</td><td>99.7</td><td>99.5</td><td>100.0</td><td>100.0</td><td>99.7</td><td>99.7</td></tr><tr><td>CIFAR-BReLU</td><td>99.5</td><td>99.2</td><td>100.0</td><td>100.0</td><td>99.7</td><td>99.7</td></tr><tr><td>Inception-v3</td><td>100.0</td><td>100.0</td><td>100.0</td><td>100.0</td><td>100.0</td><td>100.0</td></tr><tr><td>Resnet-50</td><td>99.0</td><td>100.0</td><td>100.0</td><td>100.0</td><td>100.0</td><td>100.0</td></tr><tr><td>MobileNet</td><td>100.0</td><td>100.0</td><td>100.0</td><td>100.0</td><td>98.0</td><td>99.0</td></tr></table>
387
+
388
+ # E.2 CLEVER V.S. NUMBER OF SAMPLES
389
+
390
+ Figure 9 shows the $\ell _ { 2 }$ CLEVER score with different number of samples $( N _ { b } = 5 0 , 1 0 0 , 2 5 0 , 5 0 0 )$ for MNIST and CIFAR models. For most models except MNIST-BReLU, reducing the number of samples only change CLEVER scores very slightly. For MNIST-BReLU, increasing the number of samples improves the estimated lower bound, suggesting that a larger number of samples is preferred. In practice, we can start with a relatively small $N _ { b } = a$ , and also try $2 a , 4 a , \cdots$ samples to see if CLEVER scores change significantly. If CLEVER scores stay roughly the same despite increasing $N _ { b }$ , we can conclude that using $N _ { b } = a$ is sufficient.
391
+
392
+ ![](images/8d8d92c68e248fd5bbce1188fe6900b0788983f16c652d8097c4b743abcac4fc.jpg)
393
+ Figure 9: Comparison of the CLEVER score calculated by $N _ { b } = \{ 5 0 , 1 0 0 , 2 5 0 , 5 0 0 \}$ and the $\ell _ { 2 }$ norm of adversarial distortion found by CW attack (CW) on MNIST and CIFAR models with 3 target types.
md/train/BkV4VS9ll/BkV4VS9ll.md ADDED
@@ -0,0 +1,599 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # THE INCREDIBLE SHRINKING NEURAL NETWORK: NEW PERSPECTIVES ON LEARNING REPRESENTATIONS THROUGH THE LENS OF PRUNING
2
+
3
+ Nikolas Wolfe, Aditya Sharma & Bhiksha Raj
4
+ School of Computer Science
5
+ Carnegie Mellon University
6
+ Pittsburgh, PA 15213, USA
7
+ {nwolfe, bhiksha}@cs.cmu.edu, adityasharma@cmu.edu
8
+
9
+ Lukas Drude Universitat Paderborn drude@nt.upb.de
10
+
11
+ # ABSTRACT
12
+
13
+ How much can pruning algorithms teach us about the fundamentals of learning representations in neural networks? A lot, it turns out. Neural network model compression has become a topic of great interest in recent years, and many different techniques have been proposed to address this problem. In general, this is motivated by the idea that smaller models typically lead to better generalization. At the same time, the decision of what to prune and when to prune necessarily forces us to confront our assumptions about how neural networks actually learn to represent patterns in data. In this work we set out to test several long-held hypotheses about neural network learning representations and numerical approaches to pruning. To accomplish this we first reviewed the historical literature and derived a novel algorithm to prune whole neurons (as opposed to the traditional method of pruning weights) from optimally trained networks using a second-order Taylor method. We then set about testing the performance of our algorithm and analyzing the quality of the decisions it made. As a baseline for comparison we used a first-order Taylor method based on the Skeletonization algorithm and an exhaustive brute-force serial pruning algorithm. Our proposed algorithm worked well compared to a first-order method, but not nearly as well as the brute-force method. Our error analysis led us to question the validity of many widely-held assumptions behind pruning algorithms in general and the trade-offs we often make in the interest of reducing computational complexity. We discovered that there is a straightforward way, however expensive, to serially prune $40 \%$ of the neurons in a trained network with minimal effect on the learning representation and without any re-training.
14
+
15
+ # 1 INTRODUCTION
16
+
17
+ In this work we propose and evaluate a novel algorithm for pruning whole neurons from a trained neural network without any re-training and examine its performance compared to two simpler methods. We then analyze the kinds of errors made by our algorithm and use this as a stepping off point to launch an investigation into the fundamental nature of learning representations in neural networks. Our results corroborate an insightful though largely forgotten observation by Mozer & Smolensky (1989a) concerning the nature of neural network learning. This observation is best summarized in a quotation from Segee & Carter (1991) on the notion of fault-tolerance in multilayer perceptron networks:
18
+
19
+ Contrary to the belief widely held, multilayer networks are not inherently fault tolerant. In fact, the loss of a single weight is frequently sufficient to completely disrupt a learned function approximation. Furthermore, having a large number of weights does not seem to improve fault tolerance. [Emphasis added]
20
+
21
+ Essentially, Mozer & Smolensky (1989b) observed that during training neural networks do not distribute the learning representation evenly or equitably across hidden units. What actually happens is that a few, elite neurons learn an approximation of the input-output function, and the remaining units must learn a complex interdependence function which cancels out their respective influence on the network output. Furthermore, assuming enough units exist to learn the function in question, increasing the number of parameters does not increase the richness or robustness of the learned approximation, but rather simply increases the likelihood of overfitting and the number of noisy parameters to be canceled during training. This is evinced by the fact that in many cases, multiple neurons can be removed from a network with no re-training and with negligible impact on the quality of the output approximation. In other words, there are few bipartisan units in a trained network. A unit is typically either part of the (possibly overfit) input-output function approximation, or it is part of an elaborate noise cancellation task force. Assuming this is the case, most of the compute-time spent training a neural network is likely occupied by this arguably wasteful procedure of silencing superfluous parameters, and pruning can be viewed as a necessary procedure to “trim the fat.”
22
+
23
+ We observed copious evidence of this phenomenon in our experiments, and this is the motivation behind our decision to evaluate the pruning algorithms in this study on the simple criteria of their ability to trim neurons without any re-training. If we were to employ re-training as part of our evaluation criteria, we would arguably not be evaluating the quality of our algorithm’s pruning decisions per se but rather the ability of back-propagation trained networks to recover from faults caused by non-ideal pruning decisions, as suggested by the conclusions of Segee & Carter (1991) and Mozer & Smolensky (1989a). Moreover, as Fahlman & Lebiere (1989) discuss, due to the “herd effect” and “moving target” phenomena in back-propagation learning, the remaining units in a network will simply shift course to account for whatever error signal is re-introduced as a result of a bad pruning decision or network fault. So long as there are enough critical parameters to learn the function in question, a network can typically recover faults with additional training. This limits the conclusions we can draw about the quality of our pruning criteria when we employ re-training.
24
+
25
+ In terms of removing units without re-training, what we discovered is that predicting the behavior of a network when a unit is to be pruned is very difficult, and most of the approximation techniques put forth in existing pruning algorithms do not fare well at all when compared to a brute-force search. To begin our discussion of how we arrived at our algorithm and set up our experiments, we review of the existing literature.
26
+
27
+ # 2 LITERATURE REVIEW
28
+
29
+ Pruning algorithms, as comprehensively surveyed by Reed (1993), are a useful set of heuristics designed to identify and remove elements from a neural network which are either redundant or do not significantly contribute to the output of the network. This is motivated by the observed tendency of neural networks to overfit to the idiosyncrasies of their training data given too many trainable parameters or too few input patterns from which to generalize, as stated by Chauvin (1990).
30
+
31
+ Network architecture design and hyperparameter selection are inherently difficult tasks typically approached using a few well-known rules of thumb, e.g. various weight initialization procedures, choosing the width and number of layers, different activation functions, learning rates, momentum, etc. Some of this “black art” appears unavoidable. For problems which cannot be solved using linear threshold units alone, Baum & Haussler (1989) demonstrate that there is no way to precisely determine the appropriate size of a neural network a priori given any random set of training instances. Using too few neurons seems to inhibit learning, and so in practice it is common to attempt to overparameterize networks initially using a large number of hidden units and weights, and then prune or compress them afterwards if necessary. Of course, as the old saying goes, there’s more than one way to skin a neural network.
32
+
33
+ # 2.1 NON-PRUNING BASED GENERALIZATION & COMPRESSION TECHNIQUES
34
+
35
+ The generalization behavior of neural networks has been well studied, and apart from pruning algorithms many heuristics have been used to avoid overfitting, such as dropout (Srivastava et al.
36
+
37
+ (2014)), maxout (Goodfellow et al. (2013)), and cascade correlation (Fahlman & Lebiere (1989)), among others. Of course, while cascade correlation specifically tries to construct of minimal networks, many techniques to improve network generalization do not explicitly attempt to reduce the total number of parameters or the memory footprint of a trained network per se.
38
+
39
+ Model compression often has benefits with respect to generalization performance and the portability of neural networks to operate in memory-constrained or embedded environments. Without explicitly removing parameters from the network, weight quantization allows for a reduction in the number of bytes used to represent each weight parameter, as investigated by Balzer et al. (1991), Dundar & Rose (1994), and Hoehfeld & Fahlman (1992).
40
+
41
+ A recently proposed method for compressing recurrent neural networks (Prabhavalkar et al. (2016)) uses the singular values of a trained weight matrix as basis vectors from which to derive a compressed hidden layer. Øland & Raj (2015) successfully implemented network compression through weight quantization with an encoding step while others such as Han et al. (2016) have tried to expand on this by adding weight-pruning as a preceding step to quantization and encoding.
42
+
43
+ In summary, we can say that there are many different ways to improve network generalization by altering the training procedure, the objective error function, or by using compressed representations of the network parameters. But these are not, strictly speaking, examples of techniques to reduce the number of parameters in a network. For this we must employ some form of pruning criteria.
44
+
45
+ # 2.2 PRUNING TECHNIQUES
46
+
47
+ If we wanted to continually shrink a neural network down to minimum size, the most straightforward brute-force way to do it is to individually switch each element off and measure the increase in total error on the training set. We then pick the element which has the least impact on the total error, and remove it. Rinse and repeat. This is extremely computationally expensive, given a reasonably large neural network and training set. Alternatively, we might accomplish this using any number of much faster off-the-shelf pruning algorithms, such as Skeletonization (Mozer & Smolensky (1989a)), Optimal Brain Damage (LeCun et al. (1989)), or later variants such as Optimal Brain Surgeon (Hassibi & Stork (1993)). In fact, we borrow much of our inspiration from these algorithms, with one major variation: Instead of pruning individual weights, we prune entire neurons, thereby eliminating all of their incoming and outgoing weight parameters in one go, resulting in more memory saved, faster.
48
+
49
+ The algorithm developed for this paper is targeted at reducing the total number of neurons in a trained network, which is one way of reducing its computational memory footprint. This is often a desirable criteria to minimize in the case of resource-constrained or embedded devices, and also allows us to probe the limitations of pruning down to the very last essential network elements. In terms of generalization as well, we can measure the error of the network on the test set as each element is sequentially removed from the network. With an oracle pruning algorithm, what we expect to observe is that the output of the network remains stable as the first few superfluous neurons are removed, and as we start to bite into the more crucial members of the function approximation, the error should start to rise dramatically. In this paper, the brute-force approach described at the beginning of this section serves as a proxy for an oracle pruning algorithm.
50
+
51
+ One reason to choose to rank and prune individual neurons as opposed to weights is that there are far fewer elements to consider. Furthermore, the removal of a single weight from a large network is a drop in the bucket in terms of reducing a network’s core memory footprint. If we want to reduce the size of a network as efficiently as possible, we argue that pruning neurons instead of weights is more efficient computationally as well as practically in terms of quickly reaching a hypothetical target reduction in memory consumption. This approach also offers downstream applications a realistic expectation of the minimal increase in error resulting from the removal of a specified percentage of neurons. Such trade-offs are unavoidable, but performance impacts can be limited if a principled approach is used to find the best candidate neurons for removal.
52
+
53
+ It is well known that too many free parameters in a neural network can lead to overfitting. Regardless of the number of weights used in a given network, as Segee & Carter (1991) assert, the representation of a learned function approximation is almost never evenly distributed over the hidden units, and thus the removal of any single hidden unit at random can actually result in a network fault. Mozer & Smolensky (1989b) argue that only a subset of the hidden units in a neural network actually latch on to the invariant or generalizing properties of the training inputs, and the rest learn to either mutually cancel each other’s influence or begin overfitting to the noise in the data. We leverage this idea in the current work to rank all neurons in pre-trained networks based on their effective contributions to the overall performance. We then remove the unnecessary neurons to reduce the network’s footprint. Through our experiments we not only concretely validate the theory put forth by Mozer & Smolensky (1989b) but we also successfully build on it to prune networks to 40 to 60 $\%$ of their original size without any major loss in performance.
54
+
55
+ # 3 PRUNING NEURONS TO SHRINK NEURAL NETWORKS
56
+
57
+ As discussed in Section 1 our aim is to leverage the highly non-uniform distribution of the learning representation in pre-trained neural networks to eliminate redundant neurons, without focusing on individual weight parameters. Taking this approach enables us to remove all the weights (incoming and outgoing) associated with a non-contributing neuron at once. We would like to note here that in an ideal scenario, based on the neuron interdependency theory put forward by Mozer & Smolensky (1989a), one would evaluate all possible combinations of neurons to remove (one at a time, two at a time, three at a time and so forth) to find the optimal subset of neurons to keep. This is computationally unacceptable, and so we will only focus on removing one neuron at a time and explore more “greedy” algorithms to do this in a more efficient manner.
58
+
59
+ The general approach taken to prune an optimally trained neural network here is to create a ranked list of all the neurons in the network based off of one of the 3 proposed ranking criteria: a brute force approximation, a linear approximation and a quadratic approximation of the neuron’s impact on the output of the network. We then test the effects of removing neurons on the accuracy and error of the network. All the algorithms and methods presented here are easily parallelizable as well.
60
+
61
+ One last thing to note here before moving forward is that the methods discussed in this section involve some non-trivial derivations which are beyond the scope of this paper. We are more focused on analyzing the implications of these methods on our understanding of neural network learning representations. However, a complete step-by-step derivation and proof of all the results presented is provided in the Supplementary Material as an Appendix.
62
+
63
+ # 3.1 BRUTE FORCE REMOVAL APPROACH
64
+
65
+ This is perhaps the most naive yet the most accurate method for pruning the network. It is also the slowest and hence possibly unusable on large-scale neural networks with thousands of neurons. This method explicitly evaluates each neuron in the network. The idea is to manually check the effect of every single neuron on the output. This is done by running a forward propagation on the validation set $K$ times (where $K$ is the total number of neurons in the network), turning off exactly one neuron each time (keeping all other neurons active) and noting down the change in error. Turning a neuron off can be achieved by simply setting its output to 0. This results in all the outgoing weights from that neuron being turned off. This change in error is then used to generate the ranked list.
66
+
67
+ # 3.2 TAYLOR SERIES REPRESENTATION OF ERROR
68
+
69
+ Let us denote the total error from the optimally trained neural network for any given validation dataset by $E$ . $E$ can be seen as a function of $O$ , where $O$ is the output of any general neuron in the network. This error can be approximated at a particular neuron’s output (say $O _ { k }$ ) by using the 2nd order Taylor Series as,
70
+
71
+ $$
72
+ \hat { E } ( \boldsymbol { O } ) \approx E ( \boldsymbol { O } _ { k } ) + ( \boldsymbol { O } - \boldsymbol { O } _ { k } ) \cdot \left. \frac { \partial E } { \partial \boldsymbol { O } } \right| _ { \boldsymbol { O } _ { k } } + 0 . 5 \cdot ( \boldsymbol { O } - \boldsymbol { O } _ { k } ) ^ { 2 } \cdot \left. \frac { \partial ^ { 2 } E } { \partial \boldsymbol { O } ^ { 2 } } \right| _ { \boldsymbol { O } _ { k } } ,
73
+ $$
74
+
75
+ When a neuron is pruned, its output $O$ becomes 0.
76
+
77
+ Replacing $O$ by $O _ { k }$ in equation 1 shows us that the error is approximated perfectly by equation 1 at $O _ { k }$ . So:
78
+
79
+ $$
80
+ \Delta E _ { k } = \hat { E } ( 0 ) - \hat { E } ( O _ { k } ) = - O _ { k } \cdot \left. \frac { \partial E } { \partial O } \right| _ { O _ { k } } + 0 . 5 \cdot O _ { k } ^ { 2 } \cdot \left. \frac { \partial ^ { 2 } E } { \partial O ^ { 2 } } \right| _ { O _ { k } } ,
81
+ $$
82
+
83
+ where $\Delta E _ { k }$ is the change in the total error of the network when exactly one neuron $( k )$ is turned off. Most of the terms in this equation are fairly easy to compute, as we have $O _ { k }$ already from the activations of the hidden units and we already compute $\frac { \partial E } { \partial O } \big | _ { O _ { k } } ^ { \star }$ for each training instance during backpropagation. The ∂2E∂O2 |Ok terms are a little more difficult to compute. This is derived in the appendix and summarized in the sections below.
84
+
85
+ # 3.2.1 LINEAR APPROXIMATION APPROACH
86
+
87
+ We can use equation 2 to get the linear error approximation of the change in error due to the $k$ th neuron being turned off and represent it as $\Delta E _ { k } ^ { 1 }$ as follows:
88
+
89
+ $$
90
+ \Delta E _ { k } ^ { 1 } = - O _ { k } \cdot \left. \frac { \partial E } { \partial O } \right| _ { O _ { k } }
91
+ $$
92
+
93
+ The derivative term above is the first-order gradient which represents the change in error with respect to the output a given neuron. This term can be collected during back-propagation. As we shall see further in this section, linear approximations are not reliable indicators of change in error but they provide us with an interesting basis for comparison with the other methods discussed in this paper.
94
+
95
+ # 3.2.2 QUADRATIC APPROXIMATION APPROACH
96
+
97
+ As above, we can use equation 2 to get the quadratic error approximation of the change in error due to the $k$ th neuron being turned off and represent it as $\Delta E _ { k } ^ { 2 }$ as follows:
98
+
99
+ $$
100
+ \Delta E _ { k } ^ { 2 } = - O _ { k } \cdot \left. \frac { \partial E } { \partial O } \right| _ { O _ { k } } + 0 . 5 \cdot O _ { k } ^ { 2 } \cdot \left. \frac { \partial ^ { 2 } E } { \partial O ^ { 2 } } \right| _ { O _ { k } }
101
+ $$
102
+
103
+ The additional second-order gradient term appearing above represents the quadratic change in error with respect to the output of a given neuron. This term can be generated by performing backpropagation using second order derivatives. Collecting these quadratic gradients involves some non-trivial mathematics, the entire step-by-step derivation procedure of which is provided in the Supplementary Material as an Appendix.
104
+
105
+ # 3.3 PROPOSED PRUNING ALGORITHM
106
+
107
+ Figure 1 shows a random error function plotted against the output of any given neuron. Note that this figure is for illustration purposes only. The error function is minimized at a particular value of the neuron output as can be seen in the figure. The process of training a neural network is essentially the process of finding these minimizing output values for all the neurons in the network. Pruning this particular neuron (which translates to getting a zero output from it will result in a change in the total overall error. This change in error is represented by distance between the original minimum error (shown by the dashed line) and the top red arrow. This neuron is clearly a bad candidate for removal since removing it will result in a huge error increase.
108
+
109
+ The straight red line in the figure represents the first-order approximation of the error using Taylor Series as described before while the parabola represents a second-order approximation. It can be clearly seen that the second-order approximation is a much better estimate of the change in error.
110
+
111
+ One thing to note here is that it is possible in some cases that there is some thresholding required when trying to approximate the error using the 2nd order Taylor Series expansion. These cases might arise when the parabolic approximation undergoes a steep slope change. To take into account such cases, mean and median thresholding were employed, where any change above a certain threshold was assigned a mean or median value respectively.
112
+
113
+ ![](images/8929f89922ec55a25582733c3951852988d2670f00571fb1d58e8125f53f3282.jpg)
114
+ Figure 1: The intuition behind 1st & 2nd order neuron pruning decisions
115
+
116
+ Two pruning algorithms are proposed here. They are different in the way the neurons are ranked but both of them use $\Delta E _ { k }$ , the approximation of the change in error as the basis for the ranking. $\Delta E _ { k }$ can be calculated using the Brute Force method, or one of the two Taylor Series approximations discussed previously.
117
+
118
+ The first step in both the algorithms is to decide a stopping criterion. This can vary depending on the application but some intuitive stopping criteria can be: maximum number of neurons to remove, percentage scaling needed, maximum allowable accuracy drop etc.
119
+
120
+ # 3.3.1 ALGORITHM I: SINGLE OVERALL RANKING
121
+
122
+ The complete algorithm is shown in Algorithm 1. The idea here is to generate a single ranked list based on the values of $\Delta E _ { k }$ . This involves a single pass of second-order back-propagation (without weight updates) to collect the gradients for each neuron. The neurons from this rank-list (with the lowest values of $\Delta E _ { k }$ ) are then pruned according to the stopping criterion decided. We note here that this algorithm is intentionally naive and is used for comparison only.
123
+
124
+ Data: optimally trained network, training set
125
+ Result: A pruned network
126
+ initialize and define stopping criterion ;
127
+ perform forward propagation over the training set ;
128
+ perform second-order back-propagation without updating weights and collect linear and quadratic gradients ;
129
+ rank the remaining neurons based on $\Delta E _ { k }$ ;
130
+ while stopping criterion is not met do
131
+ remove the last ranked neuron ;
132
+ end
133
+
134
+ Algorithm 1: Single Overall Ranking
135
+
136
+ # 3.3.2 ALGORITHM II: ITERATIVE RE-RANKING
137
+
138
+ In this greedy variation of the algorithm (Algorithm 2), after each neuron removal, the remaining network undergoes a single forward and backward pass of second-order back-propagation (without weight updates) and the rank list is formed again. Hence, each removal involves a new pass through the network. This method is computationally more expensive but takes into account the dependencies the neurons might have on one another which would lead to a change in error contribution every time a dependent neuron is removed.
139
+
140
+ Data: optimally trained network, training set
141
+ Result: A pruned network
142
+ initialize and define stopping criterion ;
143
+ while stopping criterion is not met do perform forward propagation over the training set ; perform second-order back-propagation without updating weights and collect linear and quadratic gradients ; rank the remaining neurons based on $\Delta E _ { k }$ ; remove the worst neuron based on the ranking ;
144
+ end
145
+
146
+ Algorithm 2: Iterative Re-Ranking
147
+
148
+ # 4 EXPERIMENTAL RESULTS
149
+
150
+ # 4.1 EXAMPLE REGRESSION PROBLEM
151
+
152
+ This problem serves as a quick example to demonstrate many of the phenomena described in previous sections. We trained two networks to learn the cosine function, with one input and one output. This is a task which requires no more than 11 sigmoid neurons to solve entirely, and in this case we don’t care about overfitting because the cosine function has a precise definition. Furthermore, the cosine function is a good toy example because it is a smooth continuous function and, as demonstrated by Nielsen (2015), if we were to tinker directly with the weights and bias parameters of the network, we could allocate individual units within the network to be responsible for constrained ranges of inputs, similar to a basis spline function with many control points. This would distribute the learned function approximation evenly across all hidden units, and thus we have presented the network with a problem in which it could productively use as many hidden units as we give it. In this case, a pruning algorithm would observe a fairly consistent increase in error after the removal of each successive unit. In practice however, regardless of the number of experimental trials, this is not what happens. The network will always use 10-11 hidden units and leave the rest to cancel each other’s influence.
153
+
154
+ ![](images/e73e5fe11a82446cfd4987309b32c5c6d05f9884d42adcf4434d27d7fc3baf2e.jpg)
155
+ Figure 2: Degradation in squared error after pruning a two-layer network trained to compute the cosine function (Left Network: 2 layers, 10 neurons each, 1 output, logistic sigmoid activation, starting test accuracy: 0.9999993, Right Network: 2 layers, 50 neurons each, 1 output, logistic sigmoid activation, starting test accuracy: 0.9999996)
156
+
157
+ Figure 2 shows two graphs. Both graphs demonstrate the use of the iterative re-ranking algorithm and the comparative performance of the brute-force pruning method (in blue), the first order method (in green), and the second order method (in red). The graph on the left shows the performance of these algorithms starting from a network with two layers of 10 neurons (20 total), and the graph on the right shows a network with two layers of 50 neurons (100 total).
158
+
159
+ In the left graph, we see that the brute-force method shows a graceful degradation, and the error only begins to rise sharply after $50 \%$ of the total neurons have been removed. The error is basically constant up to that point. In the first and second order methods, we see evidence of poor decision making in the sense that both made mistakes early on, which disrupted the output function approximation. The first order method made a large error early on, though we see after a few more neurons were removed this error was corrected somewhat (though it only got worse from there). This is direct evidence of the lack of fault tolerance in a trained neural network. This phenomenon is even more starkly demonstrated in the second order method. After making a few poor neuron removal decisions in a row, the error signal rose sharply, and then went back to zero after the 6th neuron was removed. This is due to the fact that the neurons it chose to remove were trained to cancel each others’ influence within a localized part of the network. After the entire group was eliminated, the approximation returned to normal. This can only happen if the output function approximation is not evenly distributed over the hidden units in a trained network.
160
+
161
+ This phenomenon is even more starkly demonstrated in the graph on the right. Here we see the first order method got “lucky” in the beginning and made decent decisions up to about the 40th removed neuron. The second order method had a small error in the beginning which it recovered from gracefully and proceeded to pass the 50 neuron point before finally beginning to unravel. The brute force method, in sharp contrast, shows little to no increase in error at all until $90 \%$ of the neurons in the network have been obliterated. Clearly first and second order methods have some value in that they do not make completely arbitrary choices, but the brute force method is far better at this task.
162
+
163
+ This also demonstrates the sharp dualism in neuron roles within a trained network. These networks were trained to near-perfect precision and each pruning method was applied without any re-training of any kind. Clearly, in the case of the brute force or oracle method, up to $90 \%$ of the network can be completely extirpated before the output approximation even begins to show any signs of degradation. This would be impossible if the learning representation were evenly or equitably distributed. Note, for example, that the degradation point in both cases is approximately the same. This example is not a real-world application of course, but it brings into very clear focus the kind of phenomena we will discuss in the following sections.
164
+
165
+ # 4.2 RESULTS ON MNIST DATASET
166
+
167
+ For all the results presented in this section, the MNIST database of Handwritten Digits by LeCun & Cortes (2010) was used. It is worth noting that due to the time taken by the brute force algorithm we rather used a 5000 image subset of the MNIST database in which we have normalized the pixel values between 0 and 1.0, and compressed the image sizes to $2 0 \mathrm { x } 2 0$ images rather than $2 8 \mathbf { x } 2 8$ , so the starting test accuracy reported here appears higher than those reported by LeCun et al. We do not believe that this affects the interpretation of the presented results because the basic learning problem does not change with a larger dataset or input dimension.
168
+
169
+ # 4.3 PRUNING A 1-LAYER NETWORK
170
+
171
+ The network architecture in this case consisted of 1 layer, 100 neurons, 10 outputs, logistic sigmoid activations, and a starting test accuracy of 0.998.
172
+
173
+ # 4.3.1 SINGLE OVERALL RANKING ALGORITHM
174
+
175
+ We first present the results for a single-layer neural network in Figure 3, using the Single Overall algorithm (Algorithm 1) as proposed in Section 3. (We again note that this algorithm is intentionally naive and is used for comparison only. Its performance should be expected to be poor.) After training, each neuron is assigned its permanent ranking based on the three criteria discussed previously: A brute force “ground truth” ranking, and two approximations of this ranking using first and second order Taylor estimations of the change in network output error resulting from the removal of each neuron.
176
+
177
+ An interesting observation here is that with only a single layer, no criteria for ranking the neurons in the network (brute force or the two Taylor Series variants) using Algorithm 1 emerges superior, indicating that the 1st and 2nd order Taylor Series methods are actually reasonable approximations of the brute force method under certain conditions. Of course, this method is still quite bad in terms of the rate of degradation of the classification accuracy and in practice we would likely follow Algorithm 2 which is takes into account Mozer & Smolensky (1989a)’s observations stated in the Related Work section. The purpose of the present investigation, however, is to demonstrate how much of a trained network can be theoretically removed without altering the network’s learned parameters in any way.
178
+
179
+ ![](images/3f7401a91547f59ce2214f799ef499b05b258d9cc687aa7dc02d9b2e7cf72c62.jpg)
180
+ Figure 3: Degradation in squared error (left) and classification accuracy (right) after pruning a single-layer network using The Single Overall Ranking algorithm (Network: 1 layer, 100 neurons, 10 outputs, logistic sigmoid activation, starting test accuracy: 0.998)
181
+
182
+ ![](images/b669e1a6ef4582ef4a674f62cfaea46f2c83353cf54e0e108102682ef854a4ea.jpg)
183
+ 4.3.2 ITERATIVE RE-RANKING ALGORITHM
184
+ Figure 4: Degradation in squared error (left) and classification accuracy (right) after pruning a single-layer network the iterative re-ranking algorithm (Network: 1 layer, 100 neurons, 10 outputs, logistic sigmoid activation, starting test accuracy: 0.998)
185
+
186
+ In Figure 4 we present our results using Algorithm 2 (The iterative re-ranking Algorithm) in which all remaining neurons are re-ranked after each successive neuron is switched off. We compute the same brute force rankings and Taylor series approximations of error deltas over the remaining active neurons in the network after each pruning decision. This is intended to account for the effects of cancelling interactions between neurons.
187
+
188
+ There are 2 key observations here. Using the brute force ranking criteria, almost $60 \%$ of the neurons in the network can be pruned away without any major loss in performance. The other noteworthy observation here is that the 2nd order Taylor Series approximation of the error performs consistently better than its 1st order version, in most situations, though Figure 21 is a poignant counter-example.
189
+
190
+ # 4.3.3 VISUALIZATION OF ERROR SURFACE & PRUNING DECISIONS
191
+
192
+ As explained in Section 3, these graphs are a visualization of the error surface of the network output with respect to the neurons chosen for removal using each of the 3 ranking criteria, represented in intervals of 10 neurons. In each graph, the error surface of the network output is displayed in log space (left) and in real space (right) with respect to each candidate neuron chosen for removal. We create these plots during the pruning exercise by picking a neuron to switch off, and then multiplying its output by a scalar gain value $\alpha$ which is adjusted from 0.0 to 10.0 with a step size of 0.001. When the value of $\alpha$ is 1.0, this represents the unperturbed neuron output learned during training. Between 0.0 and 1.0, we are graphing the literal effect of turning the neuron off $( \alpha = 0$ ), and when $\alpha > 1 . 0$ we are simulating a boosting of the neuron’s influence in the network, i.e. inflating the value of its outgoing weight parameters.
193
+
194
+ We graph the effect of boosting the neuron’s output to demonstrate that for certain neurons in the network, even doubling, tripling, or quadrupling the scalar output of the neuron has no effect on the overall error of the network, indicating the remarkable degree to which the network has learned to ignore the value of certain parameters. In other cases, we can get a sense of the sensitivity of the network’s output to the value of a given neuron when the curve rises steeply after the red 1.0 line. This indicates that the learned value of the parameters emanating from a given neuron are relatively important, and this is why we should ideally see sharper upticks in the curves for the later-removed neurons in the network, that is, when the neurons crucial to the learning representation start to be picked off. Some very interesting observations can be made in each of these graphs.
195
+
196
+ Remember that lower is better in terms of the height of the curve and minimal (or negative) horizontal change between the vertical red line at 1.0 (neuron on, $\alpha = 1 . 0$ ) and 0.0 (neuron off, $\alpha = 0 . 0$ ) is indicative of a good candidate neuron to prune, i.e. there will be minimal effect on the network output when the neuron is removed.
197
+
198
+ ![](images/5e2026c73907b899f3f5faa95783e795c71304d33b65c434b147f86cd012bdd9.jpg)
199
+ 4.3.4 VISUALIZATION OF BRUTE FORCE PRUNING DECISIONS
200
+ Figure 5: Error surface of the network output in log space (left) and real space (right) with respect to each candidate neuron chosen for removal using the brute force criterion; (Network: 1 layer, 100 neurons, 10 outputs, logistic sigmoid activation, starting test accuracy: 0.998)
201
+
202
+ In Figure ??, we notice how low to the floor and flat most of the curves are. It’s only until the 90th removed neuron that we see a higher curve with a more convex shape (clearly a more sensitive, influential piece of the network).
203
+
204
+ # 4.3.5 VISUALIZATION OF 1ST ORDER APPROXIMATION PRUNING DECISIONS
205
+
206
+ It can be seen in Figure 6 that most choices seem to have flat or negatively sloped curves, indicating that the first order approximation seems to be pretty good, but examining the brute force choices shows they could be better.
207
+
208
+ # 4.3.6 VISUALIZATION OF 2ND ORDER APPROXIMATION PRUNING DECISIONS
209
+
210
+ The method in Figure 7 looks similar to the brute force method choices, though clearly not as good (they’re more spread out). Notice the difference in convexity between the 2nd and 1st order method
211
+
212
+ ![](images/ccb022fe797d4a28e300ba53d4193a5875f80e982897af701e2542524f15109b.jpg)
213
+ Figure 6: Error surface of the network output in log space (left) and real space (right) with respect to each candidate neuron chosen for removal using the 1st order Taylor Series error approximation criterion; (Network: 1 layer, 100 neurons, 10 outputs, logistic sigmoid activation, starting test accuracy: 0.998)
214
+
215
+ ![](images/2f67e270ed88851d2da60495f5d00e163fe822d09c4430b73350311753f27722.jpg)
216
+ Figure 7: Error surface of the network output in log space (left) and real space (right) with respect to each candidate neuron chosen for removal using the 2nd order Taylor Series error approximation criterion; (Network: 1 layer, 100 neurons, 10 outputs, logistic sigmoid activation, starting test accuracy: 0.998)
217
+
218
+ choices. It’s clear that the first order method is fitting a line and the 2nd order method is fitting a parabola in their approximation.
219
+
220
+ # 4.4 PRUNING A 2-LAYER NETWORK
221
+
222
+ The network architecture in this case consisted of 2 layers, 50 neurons per layer, 10 outputs, logistic sigmoid activations, and a starting test accuracy of 1.000.
223
+
224
+ # 4.4.1 SINGLE OVERALL RANKING ALGORITHM
225
+
226
+ Figure 8 shows the pruning results for Algorithm 1 on a 2-layer network. The ranking procedure is identical to the one used to generate Figure 3. (We again note that this algorithm is intentionally naive and is used for comparison only. Its performance should be expected to be poor.)
227
+
228
+ Unsurprisingly, a 2-layer network is harder to prune because a single overall ranking will never capture the interdependencies between neurons in different layers. It makes sense that this is worse
229
+
230
+ ![](images/9129b45eed3db6c60043d662b2f96d7ea3a9adf84f1021bc7f075c39a5a1004c.jpg)
231
+ Figure 8: Degradation in squared error (left) and classification accuracy (right) after pruning a 2- layer network using the Single Overall Ranking algorithm; (Network: 2 layers, 50 neurons/layer, 10 outputs, logistic sigmoid activation, starting test accuracy: 1.000)
232
+
233
+ than the performance on the 1-layer network, even if this method is already known to be bad, and we’d likely never use it in practice.
234
+
235
+ # 4.4.2 ITERATIVE RE-RANKING ALGORITHM
236
+
237
+ ![](images/673b4f0cba69e177a1c4d2230ea6b2b5768024682751218a6bc64b1fb8c5c754.jpg)
238
+ Figure 9: Degradation in squared error (left) and classification accuracy (right) after pruning a 2- layer network using the iterative re-ranking algorithm; (Network: 2 layers, 50 neurons/layer, 10 outputs, logistic sigmoid activation, starting test accuracy: 1.000)
239
+
240
+ Figure 9 shows the results from using Algorithm 2 on a 2-layer network. We compute the same brute force rankings and Taylor series approximations of error deltas over the remaining active neurons in the network after each pruning decision used to generate Figure 4. Again, this is intended to account for the effects of cancelling interactions between neurons.
241
+
242
+ It is clear that it becomes harder to remove neurons 1-by-1 with a deeper network (which makes sense because the neurons have more interdependencies in a deeper network), but we see an overall better performance with 2nd order method vs. 1st order, except for the first $20 \%$ of the neurons (but this doesn’t seem to make much difference for classification accuracy.)
243
+
244
+ Perhaps a more important observation here is that even with a more complex network, it is possible to remove up to $40 \%$ of the neurons with no major loss in performance which is clearly illustrated by the brute force curve. This shows the clear potential of an ideal pruning technique and also shows how inconsistent 1st and 2nd order Taylor Series approximations of the error can be as ranking criteria.
245
+
246
+ # 4.4.3 VISUALIZATION OF ERROR SURFACE & PRUNING DECISIONS
247
+
248
+ As seen in the case of a single layered network, these graphs are a visualization the error surface of the network output with respect to the neurons chosen for removal using each algorithm, represented in intervals of 10 neurons.
249
+
250
+ ![](images/746a20d47b60364aa1683e5c4287fed6605c636809365c30eb7c5a2e97ba5868.jpg)
251
+ 4.4.4 VISUALIZATION OF BRUTE FORCE PRUNING DECISIONS
252
+ Figure 10: Error surface of the network output in log space (left) and real space (right) with respect to each candidate neuron chosen for removal using the brute force criterion; (Network: 2 layers, 50 neurons/layer, 10 outputs, logistic sigmoid activation, starting test accuracy: 1.000)
253
+
254
+ In Figure 10, it is clear why these neurons got chosen, their graphs clearly show little change when neuron is removed, are mostly near the floor, and show convex behaviour of error surface, which argues for the rationalization of using 2nd order methods to estimate difference in error when they are turned off.
255
+
256
+ ![](images/63aaca3855f3f260642932314c184faaa96a54aefa42e64cfaf906b353f721fa.jpg)
257
+ 4.4.5 VISUALIZATION OF 1ST ORDER APPROXIMATION PRUNING DECISIONS
258
+ Figure 11: Error surface of the network output in log space (left) and real space (right) with respect to each candidate neuron chosen for removal using the 1st order Taylor Series error approximation criterion; (Network: 2 layers, 50 neurons/layer, 10 outputs, logistic sigmoid activation, starting test accuracy: 1.000)
259
+
260
+ Drawing a flat line at the point of each neurons intersection with the red vertical line (no change in gain) shows that the 1st derivative method is actually accurate for estimation of change in error in these cases, but still ultimately leads to poor decisions.
261
+
262
+ ![](images/d227e5d55230eaaab0c162b960d8b9a7c581fa585c4bda7b3e8cfbb006dd3bc8.jpg)
263
+ Figure 12: Error surface of the network output in log space (left) and real space (right) with respect to each candidate neuron chosen for removal using the 2nd order Taylor Series error approximation criterion; (Network: 2 layers, 50 neurons/layer, 10 outputs, logistic sigmoid activation, starting test accuracy: 1.000)
264
+
265
+ Clearly these neurons are not overtly poor candidates for removal (error doesn’t change much between 1.0 & zero-crossing left-hand-side), but could be better (as described above in the brute force Criterion discussion).
266
+
267
+ # 4.5 INVESTIGATION OF PRUNING PERFORMANCE WITH IMPERFECT STARTING CONDITIONS
268
+
269
+ In our experiments thus far we have tacitly assumed that we start with a network which has learned an “optimal” representation of the training objective, i.e. it has been trained to the point where we accept its performance on the test set. Here we explore what happens when we prune with a sub-optimal starting network.
270
+
271
+ If the assumptions of this paper regarding the nature of neural network learning are correct, we expect that two processes are essentially at work during back-propagation training. First, we expect that the neurons which directly participate in the fundamental learning representation (even if redundantly) work together to reduce error on the training data. Second, we expect that neurons which do not directly participate in the learning representation work to cancel each other’s negative influence. Furthermore, we expect that these two groups are essentially distinct, as evinced by the fact that multiple neurons can often be removed as a group with little to no effect on the network output. Some non-trivial portion of the training time, then, is spent doing work which has nothing intrinsically to do with the learning representation and essentially functions as noise cancellation.
272
+
273
+ If this is the case, when we attempt to prune a network which has not fully canceled the noisy influence of extraneous or redundant units, we might expect to see the error actually improve after removing a few bad apples. This is in fact what we observe, as demonstrated in the following experiments.
274
+
275
+ For each experiment in this section we trained with the full MNIST training set (LeCun & Cortes (2010)), uncompressed and without any data normalization. We trained three different networks to learn to distinguish a single handwritten digit from the rest of the data. The network architectures were each composed of 784 inputs, 1 hidden layer with 100 neurons, and 2 soft-max outputs; one to say yes, and the other to say no. These networks were trained to distinguish the digits 0, 1, and 2, and their respective starting accuracies were a sub-optimal 0.9757, 0.9881, and 0.9513. Finally, we only consider the iterative re-ranking algorithm, as the single overall ranking algorithm is clearly nonviable.
276
+
277
+ # 4.5.1 MNIST SINGLE DIGIT CLASSIFICATION: DIGIT 0
278
+
279
+ Figure 13 shows the degradation in squared error after removing neurons from a network trained to distinguish the digit 0. What we observe is that the first and second order methods both fail in different ways, though clearly the second order method makes better decisions overall. The first order method explodes spectacularly in the first few iterations. The brute force method, in stark contrast, actually improves in the first few iterations, and remains essentially flat until around the $60 \%$ mark, at which point it begins to gradually increase and meet the other curves.
280
+
281
+ ![](images/4cae68ce132985710ddb73c2643e439cca07fa0a33e22220ff024ff559e6e196.jpg)
282
+ Figure 13: Degradation in squared error after pruning a single-layer network trained to do a oneversus-all classification of the digit 0 using the iterative re-ranking algorithm
283
+
284
+ The behavior of the brute force method here demonstrates that the network was essentially working to cancel the effect of a few bad neurons when the training convergence criteria were met, i.e. the network was no longer able to make progress on the training set. After removing these neurons during pruning, the output improved. We can investigate this by looking at the error surface with respect to the neurons chosen for removal by each method in turn. Below in Figure 14 is the graph of the brute force method.
285
+
286
+ ![](images/7af2b8cffd4ba03d4ba619d01f8b36baf42cb2fc066ab91b28ef45096eab139f.jpg)
287
+ Figure 14: Error surface of the network output in log space (left) and real space (right) with respect to each candidate neuron chosen for removal using the brute force iterative re-ranking removal criterion
288
+
289
+ Figure 14 shows an interesting phenomenon, which we will see in later experiments as well. The high blue curve corresponding to neuron 0 is negatively sloped in the beginning and clearly after removing this neuron, the output will improve. The rest of the curves, in correspondence with the squared error degradation curve above, are mostly flat and tightly layered together, indicating that they are good neurons to remove.
290
+
291
+ In Figure 15 below, we observe a stark contrast to this. The curves corresponding to neurons 0 and 10 are mostly flat, and fairly lower than the rest, though clearly a mistake was made early on and the rest of the curves are clearly bad choices. In all of these cases however, we see that the curves are easily approximated with a straight line and so the first order method may have been fairly accurate in its predictions, even though it still made poor decisions.
292
+
293
+ ![](images/2fe2e16f3bb221b175cfa4e491475bee48d5db0a89cb01670f1eab23b01292c0.jpg)
294
+ Figure 15: Error surface of the network output in log space (left) and real space (right) with respect to each candidate neuron chosen for removal using the first-order iterative re-ranking removal criterion
295
+
296
+ Figure 15 is an example of how things can go south once a few bad mistakes are made at the outset. Figure 16 shows a much better set of choices made by the second order method, though clearly not as good as the brute force method. The log-space plots make it a bit easier to see the difference between the brute force and second order methods in Figures 14 and 16, respectively.
297
+
298
+ ![](images/5e0066757a968ef64a926b5ec645668bc6495add02244279cf83e7346dcafe15.jpg)
299
+ Figure 16: Error surface of the network output in log space (left) and real space (right) with respect to each candidate neuron chosen for removal using the second-order iterative re-ranking removal criterion
300
+
301
+ # 4.5.2 MNIST SINGLE DIGIT CLASSIFICATION: DIGIT 1
302
+
303
+ Examining Figure 17, we see a much starker example of the previous phenomenon, in which the brute force method continues to improve the performance of the network after removing $80 \%$ of the neurons in the network. The first and second order methods fail early and proceed in fits and starts (clearly demonstrating evidence of interrelated groups of noise-canceling neurons), and never fully recover. It should be noted that it would be impossible to see curves like this if neural networks evenly distributed the learning representation evenly or equitably over their hidden units.
304
+
305
+ One of the most striking things about the blue curve in Figure 17 is the fact that the network never drops below its starting error until it crosses the $80 \%$ mark, indicating that only $20 \%$ of the neurons in this network are actually essential to the learning the training objective. In this sense, we can only wonder how much of the training time was spent winnowing the error out of the remaining $80 \%$ of the network.
306
+
307
+ ![](images/55afb1d0c3115f6bbcfca29f885505a8633ffbf456473c0d45a7204bb6728c0e.jpg)
308
+ Figure 17: Degradation in squared error after pruning a single-layer network trained to do a oneversus-all classification of the digit 1 using the iterative re-ranking algorithm
309
+
310
+ ![](images/6bd14e27499aacc97403e3528028715b00c170b0ff88f59d4c250c1ddb81ba64.jpg)
311
+ Figure 18: Error surface of the network output in log space (left) and real space (right) with respect to each candidate neuron chosen for removal using the brute force iterative re-ranking removal criterion
312
+
313
+ In Figures 18, 19 and 20 we can examine the choices made by the respective methods. The brute force method serves as our example of a near-optimal pruning regimen, and the rest are first and second order approximations of this. Small differences, clearly, can lead to large effects on the network output as shown in Figure 17.
314
+
315
+ # 4.5.3 MNIST SINGLE DIGIT CLASSIFICATION: DIGIT 2
316
+
317
+ Figure 21 is an interesting case because it shatters our confidence in the reliability of the second order method to make good pruning decisions, and further demonstrates the phenomenon of how much the error can improve if the right neurons are removed after training gets stuck. In this case, though still a poor performance overall, the first order method vastly outperforms the second order method.
318
+
319
+ Figure 22 shows us a clear example of the first element to remove having a negative error slope, and improving the output as a result. The rest of the pruning decisions are reasonable. Comparing with the blue curve in Figure 21, we see the correspondence between the first pruning decision improving the output, and the remaining pruning decisions keeping the output fairly flat. Clearly, however, there isn’t much room to get worse given our starting point with a sub-optimal network, and we see that the ending sum of squared errors is not much higher than the starting point. At the same time, we can still see the contrast in performance if we make optimal pruning decisions, and most of the neurons in this network were clearly doing nothing.
320
+
321
+ ![](images/5ddba69f7a6caaa4bedb865c5ead154c5bb22f58668e7ba1b7e9d2e97990d006.jpg)
322
+ Figure 19: Error surface of the network output in log space (left) and real space (right) with respect to each candidate neuron chosen for removal using the first-order iterative re-ranking removal criterion
323
+
324
+ ![](images/cb8fd8310e443aca57980e5070a459f7fd6dc970f98ed5083137f3b594d93d43.jpg)
325
+ Figure 20: Error surface of the network output in log space (left) and real space (right) with respect to each candidate neuron chosen for removal using the second-order iterative re-ranking removal criterion
326
+
327
+ ![](images/177e8e76f9e3f5b63a0b9cb8331d59ac785482149009f15c5ffe20f85256abef.jpg)
328
+ Figure 21: Degradation in squared error after pruning a single-layer network trained to do a oneversus-all classification of the digit 2 using the iterative re-ranking algorithm
329
+
330
+ In Figure 23, we see a mixed bag in which the decisions are clearly sub-optimal, though much better than Figure 24, in which we can observe how a bad first decision essentially ruined the network for good. The jagged edges of the red curve in Figure 21 correspond with the positive and negative slopes of the cluster of bad pruning decisions in 24. Once again, these are not necessarily bad decisions, but the starting point is already bad and this cannot be recovered without re-training the network.
331
+
332
+ ![](images/e8ee4df327f2b331017a2994a8044b609dd133cd793a5d43a66fcce65adc8691.jpg)
333
+ Figure 22: Error surface of the network output in log space (left) and real space (right) with respect to each candidate neuron chosen for removal using the brute force iterative re-ranking removal criterion
334
+
335
+ ![](images/e343333e875ed834c0806f9bf6e274d8154dbd1f0b230f6f073bd70446e54f70.jpg)
336
+ Figure 23: Error surface of the network output in log space (left) and real space (right) with respect to each candidate neuron chosen for removal using the first-order iterative re-ranking removal criterion
337
+
338
+ # 4.5.4 ASIDE: IMPLICATIONS OF THIS EXPERIMENT
339
+
340
+ From the three examples above, we see that in each case, starting from a sub-optimal network, a brute force removal technique consistently improves performance for the first few pruning iterations, and the sum of squared errors does not degrade beyond the starting point until around $60 \%$ of the neurons have been removed. This is only possible if we have an essentially strict dichotomy between the roles of different neurons during training. If the network needs only $20 \%$ of the neurons it began with, the training process is essentially dominated by the task of canceling the residual noise of redundant neurons. Furthermore, the network can get stuck in training with redundant units and distort the final output. This is strong evidence of our thesis that the learning representation is neither equitably nor evenly distributed and that most of the neurons which do not directly participate in the learning representation can be removed without any retraining.
341
+
342
+ # 4.6 EXPERIMENTS ON TOY DATASETS
343
+
344
+ As can be seen from the experiments on MNIST, even though the 2nd-order approximation criterion is consistently better than 1st-order, its performance is not nearly as good as brute force based ranking, especially beyond the first layer. What is interesting to note is that from some other experiments conducted on toy datasets (predicting whether a given point would lie inside a given shape on the Cartesian plane), the performance of the 2nd-order method was found to be exceptionally good and produced results very close to the brute force method. The 1st-order method, as expected, performed poorly here as well. Some of these results are illustrated in Figure 25.
345
+
346
+ ![](images/a6ac666301d4ceb7bb13a64280fa0b095fa0e5f2dd3ca6a436346fc626ce2c6f.jpg)
347
+ Figure 24: Error surface of the network output in log space (left) and real space (right) with respect to each candidate neuron chosen for removal using the second-order iterative re-ranking removal criterion
348
+
349
+ ![](images/16f0ed87a39bafdf016ec556dd06eefeb877cf70b5be73eaf95d0678da6d4ec9.jpg)
350
+ Figure 25: Degradation in squared error (left) and classification accuracy (right) after pruning a 2- layer network using the iterative re-ranking algorithm on a toy “diamond” shape dataset (top) and a toy “random shape” dataset (below); (Network: 2 layers, 50 neurons/layer, 10 outputs, logistic sigmoid activation, starting test accuracy: 0.992(diamond); 0.986(random shape)
351
+
352
+ # 5 CONCLUSIONS & FUTURE WORK
353
+
354
+ In conclusion, we must first re-assert that we do not present this work as a bench-marking study of the algorithm we derived and tested. We have merely used this algorithm as a jumping off point to investigate the nature of learning representations in neural networks. What we discovered is that first and second order methods do not make particularly good pruning decisions, and can get hopelessly lost after making a bad pruning decision resulting in a network fault. Furthermore, the brute-force algorithm does surprisingly well, despite being computationally expensive. This method does so well in fact, we argue that further investigation is warranted to make this algorithm computationally tractable, though we do not speculate on how that should be done here.
355
+
356
+ We also observed strong evidence for the hypotheses of Mozer & Smolensky (1989a) regarding the “dualist” nature of hidden units, i.e. that learning representations are divided between units which either participate in the output approximation or learn to cancel each others influence. This suggests that neural networks may in fact learn a minimal network implicitly, though we cannot say for sure that this is the case without further investigation. A necessary experiment to this end would be to compare the size of network constructed using cascade correlation (Fahlman & Lebiere (1989)) and compare it to the results described herein.
357
+
358
+ We have presented a novel algorithm for pruning whole neurons from a trained neural network using a second-order Taylor series approximation of the change in error resulting from the removal a given neuron as a pruning criteria. We compared this method to a first order method and a bruteforce serial removal method which exhaustively found the next best single neuron to remove at each stage. Our algorithm relies on a combination of assumptions similar to the ones made by Mozer & Smolensky (1989a) and LeCun et al. (1989) in the formulation of the Skeletonization and Optimal Brain Damage algorithms.
359
+
360
+ First, we assumed that the error function with respect to each individual neuron can be approximated with a straight line or more precisely with a parabola. Second, for second derivative terms we consider only the diagonal elements of the Hessian matrix, i.e. we assume that each neuron-weight connection can be treated independently of the other elements in the network. Third, we assumed that pruning could be done in a serial fashion in which we find the single least productive element in the network, remove it, and move on. We found that all of these assumptions are deeply flawed in the sense that the true relevance of a neuron can only be partially approximated by a first or second order method, and only at certain stages of the pruning process.
361
+
362
+ For most problems, these methods can usually remove between $10 { - } 3 0 \%$ of the neurons in a trained network, but beyond this point their reliability breaks down. For certain problems, none of the described methods seem to perform very well, though for obvious reasons the brute-force method always exhibits the best results. The reason for this is that the error function with respect to each hidden unit is more complex than a simple second-order Taylor series can approximate. Furthermore, we have not directly taken into account the interdependence of elements within a network, though the work of Hassibi & Stork (1993) could provide some guidance in this regard. This is another critical issue to investigate in the future.
363
+
364
+ Re-training may help in this regard. We freely admit that our algorithm does not use re-training to recover from errors made in pruning decisions. We argue that evaluating a network pruning algorithm using re-training does not allow us to make fair comparisons between the kinds of decisions made by these algorithms. Neural networks are very good at recovering from the removal of individual elements with re-training and so this compensates for sub-optimal pruning criteria.
365
+
366
+ We have observed that pruning whole neurons from an optimally trained network without major loss in performance is not only possible but also enables compressing networks to $40 \%$ of their original size, which is of great importance in constrained memory environments like embedded devices. We cite the results of our experiments using the brute force criterion as evidence of this conclusion. However expensive, it would be extremely easy to parallelize this method, or potentially approximate it using a subset of the training data to decide which neurons to prune. This avoids the problem of trying to approximate the importance of a unit and potentially making a mistake.
367
+
368
+ It would also be interesting to see how these methods perform on deeper networks and on some other popular and real world datasets. In our case, on the MNIST dataset, we observed that it was more difficult to prune neurons from a deeper network than from one with a single layer. We should expect this trend to continue as networks get deeper and deeper, which also calls into further question the reliability of the described first and second order methods. We did investigate the order in which neurons were plucked from each layer of the networks and we found that the brute force method primarily removes neurons from the deepest layer of the network first, but there was no obvious pattern in layer preference for the other two methods.
369
+
370
+ Our experiments using the visualization of error surfaces and pruning decisions concretely establish the fact that not all neurons in a network contribute to its performance in the same way, and the observed complexity of these functions demonstrates limitations of the approximations we used.
371
+
372
+ Finally, we encourage the readers of this work to take these results into consideration when making decisions as to which methods to use to improve network generalization or compress their models. It should be remembered that various heuristics may perform well in practice for reasons which are in fact orthogonal to the accepted justifications given by their proponents.
373
+
374
+ # REFERENCES
375
+
376
+ Wolfgang Balzer, Masanobu Takahashi, Jun Ohta, and Kazuo Kyuma. Weight quantization in boltzmann machines. Neural Networks, 4(3):405–409, 1991.
377
+
378
+ Eric B Baum and David Haussler. What size net gives valid generalization? Neural computation, 1 (1):151–160, 1989.
379
+
380
+ Yves Chauvin. Generalization performance of overtrained back-propagation networks. In Neural Networks, pp. 45–55. Springer, 1990.
381
+
382
+ Gunhan Dundar and Kenneth Rose. The effects of quantization on multilayer neural networks. IEEE transactions on neural networks/a publication of the IEEE Neural Networks Council, 6(6): 1446–1451, 1994.
383
+
384
+ Scott E Fahlman and Christian Lebiere. The cascade-correlation learning architecture. 1989.
385
+
386
+ Ian J Goodfellow, David Warde-Farley, Mehdi Mirza, Aaron Courville, and Yoshua Bengio. Maxout networks. arXiv preprint arXiv:1302.4389, 2013.
387
+
388
+ Song Han, Huizi Mao, and William J Dally. Deep compression: Compressing deep neural networks with pruning, trained quantization and huffman coding. arXiv preprint arXiv:1510.00149v5, 2016.
389
+
390
+ Babak Hassibi and David G Stork. Second order derivatives for network pruning: Optimal brain surgeon. Morgan Kaufmann, 1993.
391
+
392
+ Markus Hoehfeld and Scott E Fahlman. Learning with limited numerical precision using the cascade-correlation algorithm. IEEE Transactions on Neural Networks, 3(4):602–611, 1992.
393
+
394
+ Yann LeCun and Corinna Cortes. MNIST handwritten digit database. 2010.
395
+
396
+ Yann LeCun, John S Denker, Sara A Solla, Richard E Howard, and Lawrence D Jackel. Optimal brain damage. In NIPs, volume 89, 1989.
397
+
398
+ Michael C Mozer and Paul Smolensky. Skeletonization: A technique for trimming the fat from a network via relevance assessment. In Advances in neural information processing systems, pp. 107–115, 1989a.
399
+
400
+ Michael C Mozer and Paul Smolensky. Using relevance to reduce network size automatically. Connection Science, 1(1):3–16, 1989b.
401
+
402
+ Michael A Nielsen. Neural networks and deep learning. http://neuralnetworksanddeeplearning.com/chap4.html.(visited: 01.11. 2014), 2015.
403
+
404
+ URL:
405
+
406
+ Anders Øland and Bhiksha Raj. Reducing communication overhead in distributed learning by an order of magnitude (almost). In IEEE International Conference on Acoustics, Speech and Signal Processing, pp. 2219–2223, 2015.
407
+
408
+ Rohit Prabhavalkar, Ouais Alsharif, Antoine Bruguier, and Lan McGraw. On the compression of recurrent neural networks with an application to lvcsr acoustic modeling for embedded speech recognition. In 2016 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pp. 5970–5974. IEEE, 2016.
409
+
410
+ Russell Reed. Pruning algorithms-a survey. Neural Networks, IEEE Transactions on, 4(5):740–747, 1993.
411
+
412
+ Bruce E Segee and Michael J Carter. Fault tolerance of pruned multilayer networks. In Neural Networks, 1991., IJCNN-91-Seattle International Joint Conference on, volume 2, pp. 447–452. IEEE, 1991.
413
+
414
+ Nitish Srivastava, Geoffrey Hinton, Alex Krizhevsky, Ilya Sutskever, and Ruslan Salakhutdinov. Dropout: A simple way to prevent neural networks from overfitting. The Journal of Machine Learning Research, 15(1):1929–1958, 2014.
415
+
416
+ # APPENDIX
417
+
418
+ # A SECOND DERIVATIVE BACK-PROPAGATION
419
+
420
+ ![](images/deb403e0a17e99892bfab8eca78161b1fb0224250acb3f45453d8bd5acc9c0a1.jpg)
421
+ Figure 26: A computational graph of a simple feed-forward network illustrating the naming of different variables, where $\sigma ( \cdot )$ is the nonlinearity, MSE is the mean-squared error cost function and $E$ is the overall loss.
422
+
423
+ Name and network definitions:
424
+
425
+ $$
426
+ E = { \frac { 1 } { 2 } } \sum _ { i } ( o _ { i } ^ { ( 0 ) } - t _ { i } ) ^ { 2 } \quad o _ { i } ^ { ( m ) } = \sigma ( x _ { i } ^ { ( m ) } ) \quad x _ { i } ^ { ( m ) } = \sum _ { j } w _ { j i } ^ { ( m ) } o _ { j } ^ { ( m + 1 ) } \quad c _ { j i } ^ { ( m ) } = w _ { j i } ^ { ( m ) } o _ { j } ^ { ( m + 1 ) }
427
+ $$
428
+
429
+ Superscripts represent the index of the layer of the network in question, with 0 representing the output layer. $E$ is the squared-error network cost function. $o _ { i } ^ { ( m ) }$ is the $i$ th output in layer $m$ generated by the activation function $\sigma$ , which in this paper is is the standard logistic sigmoid . x(m)i i s the weighted sumneuron in the puts to the ith neuron in the layer to the input of the ith $m$ th layer, and ron in the m $c _ { j i } ^ { ( m ) }$ is the contribution of the er. $j$ th $m + 1$
430
+
431
+ # A.1 FIRST AND SECOND DERIVATIVES
432
+
433
+ The first and second derivatives of the cost function with respect to the outputs:
434
+
435
+ $$
436
+ \frac { \partial E } { \partial o _ { i } ^ { ( 0 ) } } = o _ { i } ^ { ( 0 ) } - t _ { i }
437
+ $$
438
+
439
+ $$
440
+ \frac { \partial ^ { 2 } E } { \partial o _ { i } ^ { ( 0 ) ^ { 2 } } } = 1
441
+ $$
442
+
443
+ The first and second derivatives of the sigmoid function in forms depending only on the output:
444
+
445
+ $$
446
+ \begin{array} { l } { { \sigma ^ { \prime } ( x ) = \sigma ( x ) \left( 1 - \sigma ( x ) \right) } } \\ { { \sigma ^ { \prime \prime } ( x ) = \sigma ^ { \prime } ( x ) \left( 1 - 2 \sigma ( x ) \right) } } \end{array}
447
+ $$
448
+
449
+ The second derivative of the sigmoid is easily derived from the first derivative:
450
+
451
+ $$
452
+ { \begin{array} { l } { \displaystyle \sigma ^ { \prime } ( x ) = \sigma ( x ) \left( 1 - \sigma ( x ) \right) } \\ { \displaystyle \sigma ^ { \prime \prime } ( x ) = { \frac { \mathrm { d } } { \mathrm { d } x } } { \frac { \sigma ( x ) } { f ( x ) } } { \frac { \left( 1 - \sigma ( x ) \right) } { g ( x ) } } } \\ { \displaystyle \sigma ^ { \prime \prime } ( x ) = f ^ { \prime } ( x ) g ( x ) + f ( x ) g ^ { \prime } ( x ) } \\ { \displaystyle \sigma ^ { \prime \prime } ( x ) = \sigma ^ { \prime } ( x ) \left( 1 - \sigma ( x ) \right) - \sigma ( x ) \sigma ^ { \prime } ( x ) } \\ { \displaystyle \sigma ^ { \prime \prime } ( x ) = \sigma ^ { \prime } ( x ) - 2 \sigma ( x ) \sigma ^ { \prime } ( x ) } \\ { \displaystyle \sigma ^ { \prime \prime } ( x ) = \sigma ^ { \prime } ( x ) \left( 1 - 2 \sigma ( x ) \right) } \end{array} }
453
+ $$
454
+
455
+ And for future convenience:
456
+
457
+ $$
458
+ \begin{array} { l } { { \displaystyle { \frac { \mathrm { d } { \partial _ { i } ^ { ( m ) } } } { \mathrm { d } x _ { i } ^ { ( m ) } } = \frac { \mathrm { d } } { \mathrm { d } x _ { i } ^ { ( m ) } } \left( \sigma _ { i } ^ { ( m ) } = \sigma ( x _ { i } ^ { ( m ) } ) \right) } } } \\ { { \displaystyle { \phantom { \frac { \mathrm { d } { \partial _ { i } ^ { ( m ) } } } { \mathrm { d } x _ { i } ^ { ( m ) } } = \left( \sigma _ { i } ^ { ( m ) } \right) \left( 1 - \sigma _ { i } ^ { ( m ) } \right) } } } } \\ { { \displaystyle { \phantom { \frac { \mathrm { d } { \partial _ { i } ^ { ( m ) } } } { \mathrm { d } x _ { i } ^ { ( m ) } } = \sigma ^ { \prime } \left( x _ { i } ^ { ( m ) } \right) } \left( \frac { \mathrm { d } { \partial _ { i } ^ { ( m ) } } } { \mathrm { d } x _ { i } ^ { ( m ) } } = \left( \sigma _ { i } ^ { ( m ) } \right) \left( 1 - \sigma _ { i } ^ { ( m ) } \right) \right) } } } \\ { { \displaystyle { \phantom { \frac { \mathrm { d } { \partial _ { i } ^ { ( m ) } } } { \mathrm { d } x _ { i } ^ { ( m ) } } = \frac { \mathrm { d } } { \mathrm { d } x _ { i } ^ { ( m ) } } \left( \frac { \mathrm { d } { \partial _ { i } ^ { ( m ) } } } { \mathrm { d } x _ { i } ^ { ( m ) } } = \left( \sigma _ { i } ^ { ( m ) } \right) \left( 1 - 2 \sigma _ { i } ^ { ( m ) } \right) \right) } } } } \\ { \displaystyle { \phantom { \frac { \mathrm { d } { \partial _ { i } ^ { ( m ) } } } { \mathrm { d } x _ { i } ^ { ( m ) } } = \left( \sigma _ { i } ^ { ( m ) } \left( 1 - \sigma _ { i } ^ { ( m ) } \right) \right) \left( 1 - 2 \sigma _ { i } ^ { ( m ) } \right) } } } \\ { \displaystyle { \phantom { \frac { \mathrm { d } { \partial _ { i } ^ { ( m ) } } } { \mathrm { d } x _ { i } ^ { ( m ) } } = \sigma ^ { \prime } \left( x _ { i } ^ { ( m ) } \right) } } } \end{array}
459
+ $$
460
+
461
+ Derivative of the error with respect to the ith neuron’s input $x _ { i } ^ { ( 0 ) }$ in the output layer:
462
+
463
+ $$
464
+ \begin{array} { r l } & { \frac { \partial E } { \partial x _ { i } ^ { ( 0 ) } } = \frac { \partial E } { \partial \sigma _ { i } ^ { ( 0 ) } } \frac { \partial \sigma _ { i } ^ { ( 0 ) } } { \partial x _ { i } ^ { ( 0 ) } } } \\ & { \qquad = \underbrace { \left( \sigma _ { i } ^ { ( 0 ) } - t _ { i } \right) } _ { \mathrm { f r o m ~ ( 6 ) } } \underbrace { \sigma \left( x _ { i } ^ { ( 0 ) } \right) \left( 1 - \sigma \left( x _ { i } ^ { ( 0 ) } \right) \right) } _ { \mathrm { f r o m ~ ( 8 ) } } } \\ & { \qquad = \left( \sigma _ { i } ^ { ( 0 ) } - t _ { i } \right) \left( \sigma _ { i } ^ { ( 0 ) } \left( 1 - \sigma _ { i } ^ { ( 0 ) } \right) \right) } \\ & { \qquad = \left( \sigma _ { i } ^ { ( 0 ) } - t _ { i } \right) \sigma ^ { \prime } \left( x _ { i } ^ { ( 0 ) } \right) } \end{array}
465
+ $$
466
+
467
+ Second derivative of the error with respect to the ith neuron’s input $x _ { i } ^ { ( 0 ) }$ in the output layer:
468
+
469
+ $$
470
+ \begin{array} { r l r } { { \frac { \partial ^ { 2 } E } { \partial x _ { i } ^ { ( 0 ) ^ { 2 } } } = \frac { \partial } { \partial x _ { i } ^ { ( 0 ) } } ( \frac { \partial E } { \partial \sigma _ { i } ^ { ( 0 ) } } \frac { \partial \sigma _ { i } ^ { ( 0 ) } } { \partial x _ { i } ^ { ( 0 ) } } ) } } \\ & { } & { = \frac { \partial ^ { 2 } E } { \partial x _ { i } ^ { ( 0 ) } \partial \sigma _ { i } ^ { ( 0 ) } } \frac { \partial \sigma _ { i } ^ { ( 0 ) } } { \partial x _ { i } ^ { ( 0 ) } } + \frac { \partial E } { \partial \sigma _ { i } ^ { ( 0 ) } } \frac { \partial ^ { 2 } \sigma _ { i } ^ { ( 0 ) } } { \partial x _ { i } ^ { ( 0 ) ^ { 2 } } } } \\ & { } & { = \frac { \partial ^ { 2 } E } { \partial x _ { i } ^ { ( 0 ) } \partial \sigma _ { i } ^ { ( 0 ) } } \underbrace { ( \frac { \sigma _ { i } ^ { ( 0 ) } } { i } ( 1 - \sigma _ { i } ^ { ( 0 ) } ) ) } _ { \mathrm { f r o m ~ ( 8 ) } } + \underbrace { ( \sigma _ { i } ^ { ( 0 ) } - t _ { i } ) } _ { \mathrm { f r o m ~ ( 6 ) } } \underbrace { ( \sigma _ { i } ^ { ( 0 ) } ( 1 - \sigma _ { i } ^ { ( 0 ) } ) ) ( 1 - 2 \sigma _ { i } ^ { ( 0 ) } ) } _ { \mathrm { f r o m ~ ( 9 ) } } } \end{array}
471
+ $$
472
+
473
+ $$
474
+ \left( \frac { \partial ^ { 2 } E } { \partial x _ { i } ^ { ( 0 ) } \partial \sigma _ { i } ^ { ( 0 ) } } \right) = \frac { \partial } { \partial x _ { i } ^ { ( 0 ) } } \frac { \partial E } { \partial \sigma _ { i } ^ { ( 0 ) } } = \frac { \partial } { \partial x _ { i } ^ { ( 0 ) } } \underbrace { \left( \sigma _ { i } ^ { ( 0 ) } - t _ { i } \right) } _ { \left( \partial x _ { i } ^ { ( 0 ) } \right) } = \frac { \partial \sigma _ { i } ^ { ( 0 ) } } { \partial x _ { i } ^ { ( 0 ) } } = \underbrace { \left( \sigma _ { i } ^ { ( 0 ) } \left( 1 - \sigma _ { i } ^ { ( 0 ) } \right) \right) } _ { \left( \partial x _ { i } ^ { ( 0 ) } \right) }
475
+ $$
476
+
477
+ $$
478
+ \begin{array} { c } { { \displaystyle { \frac { \partial ^ { 2 } E } { \partial { x _ { i } ^ { ( 0 ) } } ^ { 2 } } = \left( o _ { i } ^ { ( 0 ) } \left( 1 - o _ { i } ^ { ( 0 ) } \right) \right) ^ { 2 } + \left( o _ { i } ^ { ( 0 ) } - t _ { i } \right) \left( o _ { i } ^ { ( 0 ) } \left( 1 - o _ { i } ^ { ( 0 ) } \right) \right) \left( 1 - 2 o _ { i } ^ { ( 0 ) } \right) } } } \\ { { \mathrm { } } } \\ { { \displaystyle { = \left( \sigma ^ { \prime } \left( x _ { i } ^ { ( 0 ) } \right) \right) ^ { 2 } + \left( o _ { i } ^ { ( 0 ) } - t _ { i } \right) \sigma ^ { \prime \prime } \left( x _ { i } ^ { ( 0 ) } \right) } } } \end{array}
479
+ $$
480
+
481
+ First derivative of the error with respect to a single input contribution $c _ { j i } ^ { ( 0 ) }$ from neuron $j$ to neuron i with weight w(0)ji in the output layer:
482
+
483
+ $$
484
+ \begin{array} { r l r } { { \frac { \partial E } { \partial c _ { j i } ^ { ( 0 ) } } = \frac { \partial E } { \partial o _ { i } ^ { ( 0 ) } } \frac { \partial o _ { i } ^ { ( 0 ) } } { \partial x _ { i } ^ { ( 0 ) } } \frac { \partial x _ { i } ^ { ( 0 ) } } { \partial c _ { j i } ^ { ( 0 ) } } } } \\ & { } & { = \underbrace { ( o _ { i } ^ { ( 0 ) } - t _ { i } ) } _ { \mathrm { f r o m ~ ( 6 ) } } \underbrace { ( o _ { i } ^ { ( 0 ) } ( 1 - o _ { i } ^ { ( 0 ) } ) ) } _ { \mathrm { f r o m ~ ( 8 ) } } \frac { \partial x _ { i } ^ { ( 0 ) } } { \partial c _ { j i } ^ { ( 0 ) } } } \end{array}
485
+ $$
486
+
487
+ $$
488
+ \begin{array} { r l } & { \left( \displaystyle \frac { \partial x _ { i } ^ { ( m ) } } { \partial c _ { j i } ^ { ( m ) } } \right) = \displaystyle \frac { \partial } { \partial c _ { j i } ^ { ( m ) } } \left( x _ { i } ^ { ( m ) } = \sum _ { j } w _ { j i } ^ { ( m ) } o _ { j } ^ { ( m + 1 ) } \right) = \displaystyle \frac { \partial } { \partial c _ { j i } ^ { ( m ) } } \left( c _ { j i } ^ { ( m ) } + k \right) = 1 } \\ & { \qquad \displaystyle \frac { \partial E } { \partial c _ { j i } ^ { ( 0 ) } } = \left( o _ { i } ^ { ( 0 ) } - l _ { i } \right) \left( o _ { i } ^ { ( 0 ) } \left( 1 - o _ { i } ^ { ( 0 ) } \right) \right) } \\ & { \qquad \displaystyle = \underbrace { \left( o _ { i } ^ { ( 0 ) } - t _ { i } \right) \sigma ^ { \prime } \left( x _ { i } ^ { ( 0 ) } \right) } _ { \mathrm { t r o m ~ ( 2 5 ) } } } \\ & { \qquad \displaystyle \frac { \partial E } { \partial c _ { j i } ^ { ( 0 ) } } = \frac { \partial E } { \partial x _ { i } ^ { ( 0 ) } } } \end{array}
489
+ $$
490
+
491
+ Second derivative of the error with respect to a single input contribution $c _ { j i } ^ { ( 0 ) }$ :
492
+
493
+ $$
494
+ \begin{array} { r l } { \frac { \partial ^ { 2 } E } { \partial t _ { 3 } ^ { ( 0 ) } } ^ { 2 } = \frac { \partial } { \partial t _ { 3 } ^ { ( 0 ) } } \frac { \partial } { \partial t _ { 3 } ^ { ( 0 ) } } ( \frac { \partial E } { \partial x _ { 3 } ^ { ( 0 ) } } ^ { 2 } = \underbrace { ( \alpha ^ { ( 0 ) } - i \delta ) \sigma ^ { \prime } ( x _ { 3 } ^ { ( 0 ) } ) } _ { i \mathrm { m i n } ( \infty ( s ) ) } ) } & { } \\ { = \frac { \partial } { \partial t _ { 3 } ^ { ( 0 ) } } ( ( \varepsilon ( \frac { i \delta } { s } ) ^ { 2 } ) - i _ { z } ) \sigma ^ { \prime } ( \overline { { \alpha } } _ { i } ^ { ( 0 ) } ) } & { } \\ { = \frac { \partial } { \partial t _ { 3 } ^ { ( 0 ) } } ( \tau ( \sum _ { s } w _ { i } ^ { ( 0 ) } , \sigma _ { i j } ^ { ( 0 ) } + 1 ) - \kappa _ { k } ) \sigma ^ { \prime } ( \sum _ { s } w _ { i } ^ { ( 0 ) } , \sigma _ { j i } ^ { ( 0 + 1 ) } ) } & { } \\ { = \frac { \partial } { \partial t _ { 3 } ^ { ( 0 ) } } ( \tau ( \sum _ { s } w _ { i } ^ { ( 0 ) } ) - i _ { z } ) \sigma ^ { \prime } ( \sum _ { s } w _ { i } ^ { ( 0 ) } ) } & { } \\ { = \frac { \partial } { \partial t _ { 3 } ^ { ( 0 ) } } ( \frac { \partial } { \partial t _ { 3 } ^ { ( 0 ) } } ( \frac { \partial \sigma ( x _ { i j } ^ { ( 0 ) } + k ) } { \partial t _ { 3 } ^ { ( 0 ) } } - 1 ) \sigma ^ { \prime } ( \sum _ { s } w _ { i } ^ { ( 0 ) } ) } & { } \\ = \frac { \partial } { \partial t _ { 3 } ^ { ( 0 ) } } \frac { \partial } { \partial t _ { 3 } ^ { ( 0 ) } } ( \frac { \partial \sigma ( x _ { i j } ^ { ( 0 ) } + k ) } { \partial t _ { 3 } ^ { ( 0 ) } ( \varepsilon ( x _ { i j } ^ { ( 0 ) } ) } - 1 ) \sigma ^ { \prime } ( \sum _ { s } w _ { i } ^ \end{array}
495
+ $$
496
+
497
+ We now make use of the abbreviations $f$ and $g$ :
498
+
499
+ $$
500
+ \begin{array} { r l } & { \quad = \bar { f } \left( \mathcal { L } _ { \beta } ^ { ( 0 ) } \right) g \left( c _ { \beta \gamma } ^ { ( 0 ) } \right) + \bar { f } \left( c _ { \beta \gamma } ^ { ( 0 ) } \right) g ^ { \prime } \left( c _ { \beta \gamma } ^ { ( 0 ) } \right) } \\ & { \quad = \sigma ^ { \prime } \left( c _ { \beta \gamma } ^ { ( 0 ) } + k \right) \sigma ^ { \prime } \left( c _ { \beta \gamma } ^ { ( 0 ) } + k \right) + \left( \sigma \left( c _ { \beta \gamma } ^ { ( 0 ) } + k \right) - l _ { \downarrow } \right) \sigma ^ { \prime \prime } \left( c _ { \beta \gamma } ^ { ( 0 ) } + k \right) } \\ & { \quad = \sigma ^ { \prime } \left( c _ { \beta \gamma } ^ { ( 0 ) } + k \right) ^ { 2 } + \left( \sigma _ { \downarrow } ^ { ( 0 ) } - t _ { \downarrow } \right) \sigma ^ { \prime \prime } \left( c _ { \beta \gamma } ^ { ( 0 ) } + k \right) } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \frac { \partial ^ { 2 } F } { \partial c _ { \beta \gamma } ^ { ( 0 ) } } } \\ & { \quad \quad \quad \quad \quad \frac { \partial ^ { 2 } F } { \partial c _ { \beta \gamma } ^ { ( 0 ) } } ^ { 2 } = \underbrace { \left( \sigma ^ { \prime } \left( x _ { \langle } ^ { ( 0 ) } \right) \right) ^ { 2 } + \left( \sigma _ { \downarrow } ^ { ( 0 ) } - t _ { \downarrow } \right) \sigma ^ { \prime \prime } \left( c _ { \downarrow } ^ { ( 0 ) } \right) } _ { \mathrm { e m ~ \ c a l ~ \lambda \mit t } } } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \end{array}
501
+ $$
502
+
503
+ # A.1.1 SUMMARY OF OUTPUT LAYER DERIVATIVES
504
+
505
+ $$
506
+ \frac { \partial E } { \partial o _ { i } ^ { ( 0 ) } } = o _ { i } ^ { ( 0 ) } - t _ { i } \quad \quad \quad \quad \quad \frac { \partial ^ { 2 } E } { { \partial o _ { i } ^ { ( 0 ) } } ^ { 2 } } = 1
507
+ $$
508
+
509
+ $$
510
+ \frac { \partial E } { \partial x _ { i } ^ { ( 0 ) } } = \left( o _ { i } ^ { ( 0 ) } - t _ { i } \right) \sigma ^ { \prime } \left( x _ { i } ^ { ( 0 ) } \right) \quad \quad \frac { \partial ^ { 2 } E } { \partial { x _ { i } ^ { ( 0 ) } } ^ { 2 } } = \left( \sigma ^ { \prime } \left( x _ { i } ^ { ( 0 ) } \right) \right) ^ { 2 } + \left( o _ { i } ^ { ( 0 ) } - t _ { i } \right) \sigma ^ { \prime \prime } \left( x _ { i } ^ { ( 0 ) } \right)
511
+ $$
512
+
513
+ $$
514
+ { \frac { \partial E } { \partial c _ { j i } ^ { ( 0 ) } } } = { \frac { \partial E } { \partial x _ { i } ^ { ( 0 ) } } } \qquad { \frac { \partial ^ { 2 } E } { \partial c _ { j i } ^ { ( 0 ) ^ { 2 } } } } = { \frac { \partial ^ { 2 } E } { \partial { x _ { i } ^ { ( 0 ) } } ^ { 2 } } }
515
+ $$
516
+
517
+ # A.1.2 HIDDEN LAYER DERIVATIVES
518
+
519
+ The first derivative of the error with respect to a neuron with output $o _ { j } ^ { ( 1 ) }$ in the first hidden layer, summing over all partial derivative contributions from the output layer:
520
+
521
+ $$
522
+ \frac { \partial E } { \partial o _ { j } ^ { ( 1 ) } } = \sum _ { i } \frac { \partial E } { \partial o _ { i } ^ { ( 0 ) } } \frac { \partial o _ { i } ^ { ( 0 ) } } { \partial x _ { i } ^ { ( 0 ) } } \frac { \partial x _ { i } ^ { ( 0 ) } } { \partial c _ { j i } ^ { ( 0 ) } } \frac { \partial c _ { j i } ^ { ( 0 ) } } { \partial o _ { j } ^ { ( 1 ) } } = \sum _ { i } \underbrace { \left( o _ { i } ^ { ( 0 ) } - t _ { i } \right) \sigma ^ { \prime } \left( x _ { i } ^ { ( 0 ) } \right) } _ { \textit { i } } w _ { j i } ^ { ( 0 ) }
523
+ $$
524
+
525
+ $$
526
+ \begin{array} { c } { { \displaystyle { \frac { \partial c _ { j i } ^ { ( m ) } } { \partial o _ { j } ^ { ( m + 1 ) } } = \frac { \partial } { \partial o _ { j } ^ { ( m + 1 ) } } \left( c _ { j i } ^ { ( m ) } = w _ { j i } ^ { ( m ) } o _ { j } ^ { ( m + 1 ) } \right) = w _ { j i } ^ { ( m ) } } } } \\ { { \displaystyle { \frac { \partial E } { \partial o _ { j } ^ { ( 1 ) } } = \sum _ { i } \frac { \partial E } { \partial x _ { i } ^ { ( 0 ) } } w _ { j i } ^ { ( 0 ) } } } } \end{array}
527
+ $$
528
+
529
+ Note that this equation does not depend on the specific form o f ∂E∂x(0) , whether it involves a sigmoid or any other activation function. We can therefore replace the specific indexes with general ones, and use this equation in the future.
530
+
531
+ $$
532
+ \frac { \partial E } { \partial o _ { j } ^ { ( m + 1 ) } } = \sum _ { i } \frac { \partial E } { \partial x _ { i } ^ { ( m ) } } w _ { j i } ^ { ( m ) }
533
+ $$
534
+
535
+ The second derivative of the error with respect to a neuron with output $o _ { j } ^ { ( 1 ) }$ in the first hidden layer:
536
+
537
+ $$
538
+ \begin{array} { l } { { \displaystyle { \frac { \partial ^ { 2 } E } { \partial { o _ { j } ^ { ( 1 ) } } ^ { 2 } } = \frac { \partial } { \partial { o _ { j } ^ { ( 1 ) } } } \frac { \partial E } { \partial { o _ { j } ^ { ( 1 ) } } } } } } \\ { { \displaystyle { \ = \frac { \partial } { \partial { o _ { j } ^ { ( 1 ) } } } \sum _ { i } \frac { \partial E } { \partial { x _ { i } ^ { ( 0 ) } } } w _ { j i } ^ { ( 0 ) } } } } \\ { { \displaystyle { \ = \frac { \partial } { \partial { o _ { j } ^ { ( 1 ) } } } \sum _ { i } \left( o _ { i } ^ { ( 0 ) } - t _ { i } \right) \sigma ^ { \prime } \left( { x _ { i } ^ { ( 0 ) } } \right) w _ { j i } ^ { ( 0 ) } } } } \end{array}
539
+ $$
540
+
541
+ If we now make use of the fact, that $\begin{array} { r } { o _ { i } ^ { ( 0 ) } = \sigma \left( x _ { i } ^ { ( 0 ) } \right) = \sigma \left( \sum _ { j } \left( w _ { j i } ^ { ( 0 ) } o _ { j } ^ { ( 1 ) } \right) \right) } \end{array}$ , we can evaluate the expression further.
542
+
543
+ $$
544
+ \begin{array} { r l } { \frac { \partial \hat { \mathcal { F } } ( R ) } { \partial \theta _ { 0 } ^ { ( 1 ) } } = \frac { \partial } { \partial \theta _ { 0 } ^ { ( 1 ) } } \sum _ { t } ( \underbrace { \sigma ( \sum _ { s } \alpha _ { 0 } ^ { ( 0 , 0 , 1 ) } \alpha _ { 0 } ^ { ( 1 ) } ) } _ { t \in \mathcal { N } _ { 1 } ^ { ( 0 , 1 ) } } - \nu _ { s } ) \cdot ( \sum _ { s } \gamma _ { s } \alpha _ { 0 } ^ { ( 0 , 0 , 0 ) } ) \frac { \alpha _ { 0 } ^ { ( 1 ) } } { s ! } } & { = } \\ & { \quad - \sum _ { s } ( \mathcal { C } ( \frac { \partial ^ { ( 0 , 0 ) } } { \partial s } ) \alpha _ { 0 } ^ { ( 0 , 0 ) } ) - f ( \alpha _ { 0 } ^ { ( 1 ) } - 1 ) \cdot \sqrt { ( \alpha _ { 0 } ^ { ( 0 , 1 ) } ) } } & { = } \\ & { \quad - \sum _ { s ^ { \prime } } ( ( \sum _ { s } \alpha _ { 0 } ^ { ( 0 , 0 ) } \beta _ { 0 } ^ { ( 1 ) } ) \alpha _ { 0 } ^ { ( 0 , 0 ) } - f ( \sum _ { s } \alpha _ { 0 } ^ { ( 1 ) } ) ) \cdot ( \alpha _ { 0 } ^ { ( 0 , 1 ) } ) } \\ & { \quad \sum _ { s ^ { \prime } } ( \varepsilon ( \sum _ { s } \gamma _ { s } ^ { ( 0 , 0 , 1 ) } ) \alpha _ { 0 } ^ { ( 1 ) } - \varepsilon ( \sum _ { s } \alpha _ { 0 } ^ { ( 0 , 0 ) } \beta _ { 0 } ^ { ( 1 ) } ) ) \frac { \alpha _ { 0 } ^ { ( 1 ) } } { s ^ { 2 } } + \dots } \\ & \quad \sum _ { s ^ { \prime } } ( \varepsilon ( \sum _ { s } \gamma _ { s } ^ { ( 0 , 0 , 1 ) } ) - ( \sum _ { s } \gamma _ { s } ^ { ( 0 , 0 , 0 ) } \varepsilon ) \frac { \alpha _ { 0 } ^ { ( 1 ) } } { s ^ { 2 } } ) \cdot ( \sum _ { s } \alpha _ { 0 } ^ { ( 1 ) } \varepsilon ) \frac { \partial ^ { ( 0 , 0 ) } } { \partial s ^ { \prime } } ) ( \varepsilon ( \frac { \partial ^ { ( 0 , 0 ) } } \end{array}
545
+ $$
546
+
547
+ Summing up, we obtain the more general expression:
548
+
549
+ $$
550
+ \frac { \partial ^ { 2 } E } { { \partial o _ { j } ^ { ( 1 ) } } ^ { 2 } } = \sum _ { i } \frac { \partial ^ { 2 } E } { { \partial x _ { i } ^ { ( 0 ) } } ^ { 2 } } \left( w _ { j i } ^ { ( 0 ) } \right) ^ { 2 }
551
+ $$
552
+
553
+ Note that the equation in (65) does not depend on the form o f ∂2E∂x(0)x 2 , which means we can replace the specific indexes with general ones:
554
+
555
+ $$
556
+ \frac { \partial ^ { 2 } E } { \partial o _ { j } ^ { ( m + 1 ) ^ { 2 } } } = \sum _ { i } \frac { \partial ^ { 2 } E } { \partial x _ { i } ^ { ( m ) ^ { 2 } } } \left( w _ { j i } ^ { ( m ) } \right) ^ { 2 }
557
+ $$
558
+
559
+ At this point we are beginning to see the recursion in the form of the 2nd derivative terms which can be thought of analogously to the first derivative recursion which is central to the back-propagation algorithm. The formulation above which makes specific reference to layer indexes also works in the general case.
560
+
561
+ Consider the $i$ th neuron in any layer $m$ with output $o _ { i } ^ { ( m ) }$ and input $x _ { i } ^ { ( m ) }$ . The first and second derivatives of the error $E$ with respect to this neuron’s input are:
562
+
563
+ $$
564
+ \frac { \partial E } { \partial x _ { i } ^ { ( m ) } } = \frac { \partial E } { \partial o _ { i } ^ { ( m ) } } \frac { \partial o _ { i } ^ { ( m ) } } { \partial x _ { i } ^ { ( m ) } }
565
+ $$
566
+
567
+ $$
568
+ \begin{array} { r l } & { \frac { \partial ^ { 2 } E } { \partial z _ { 2 } ^ { ( \mathrm { i n k } ) } } = \frac { \partial } { \partial z _ { 2 } ^ { ( \mathrm { i n k } ) } } \frac { \partial E } { \partial x _ { 1 } ^ { ( \mathrm { i n k } ) } } } \\ & { \phantom { \frac { \partial ^ { 2 } E } { \partial z _ { 2 } ^ { ( \mathrm { i n k } ) } } = } - \frac { \partial ^ { 2 } E } { \partial z _ { 2 } ^ { ( \mathrm { i n k } ) } } \frac { \partial E } { \partial x _ { 1 } ^ { ( \mathrm { i n k } ) } } } \\ & { \phantom { \frac { \partial ^ { 2 } E } { \partial z _ { 2 } ^ { ( \mathrm { i n k } ) } } = } - \frac { \partial ^ { 2 } E } { \partial z _ { 2 } ^ { ( \mathrm { i n k } ) } } ( \frac { \partial ^ { 2 } E } { \partial z _ { 1 } ^ { ( \mathrm { i n k } ) } } \frac { \partial ^ { 2 } E ^ { ( \mathrm { i n k } ) } } { \partial z _ { 1 } ^ { ( \mathrm { i n k } ) } } ) } \\ & { \phantom { \frac { \partial ^ { 2 } E } { \partial z _ { 2 } ^ { ( \mathrm { i n k } ) } } = } - \frac { \partial ^ { 2 } E } { \partial z _ { 2 } ^ { ( \mathrm { i n k } ) } } \frac { \partial ^ { 2 } E } { \partial z _ { 1 } ^ { ( \mathrm { i n k } ) } } \frac { \partial ^ { 2 } E } { \partial z _ { 2 } ^ { ( \mathrm { i n k } ) } } } \\ & { \phantom { \frac { \partial ^ { 2 } E } { \partial z _ { 2 } ^ { ( \mathrm { i n k } ) } } = } \frac { \partial ^ { 2 } E } { \partial z _ { 2 } ^ { ( \mathrm { i n k } ) } \partial z _ { 1 } ^ { ( \mathrm { i n k } ) } } \frac { \partial ^ { 2 } E } { \partial z _ { 2 } ^ { ( \mathrm { i n k } ) } } \frac { \partial ^ { 2 } E } { \partial z _ { 2 } ^ { ( \mathrm { i n k } ) } } } \\ & \phantom \frac { \partial ^ { 2 } E } { \partial z _ { 2 } ^ { ( \mathrm { i n k } ) } } = \frac { \partial ^ { 2 } E } { \partial z _ { 2 } ^ { ( \mathrm { i n k } ) } } ( \frac { \partial ^ { 2 } E } { \partial z _ { 1 } ^ { ( \mathrm { i n k } ) } } - \frac { \partial ^ { 2 } E } \partial z _ { 1 } ^ ( \ \end{array}
569
+ $$
570
+
571
+ Note the form of this equation is the general form of what was derived for the output layer in (31). Both of the above first and second terms are easily computable and can be stored as we propagate back from the output of the network to the input. With respect to the output layer, the first and second derivative terms have already been derived above. In the case of the $m + 1$ hidden layer during back propagation, there is a summation of terms calculated in the mth layer. For the first derivative, we have this from (55).
572
+
573
+ $$
574
+ \frac { \partial E } { \partial o _ { j } ^ { ( m + 1 ) } } = \sum _ { i } \frac { \partial E } { \partial x _ { i } ^ { ( m ) } } w _ { j i } ^ { ( m ) }
575
+ $$
576
+
577
+ And the second derivative for the $j$ th neuron in the $m + 1$ layer:
578
+
579
+ $$
580
+ \frac { \partial ^ { 2 } E } { \partial x _ { j } ^ { ( m + 1 ) ^ { 2 } } } = \frac { \partial ^ { 2 } E } { \partial o _ { j } ^ { ( m + 1 ) ^ { 2 } } } \left( \sigma ^ { \prime } \left( x _ { j } ^ { ( m + 1 ) } \right) \right) ^ { 2 } + \frac { \partial E } { \partial o _ { j } ^ { ( m + 1 ) } } \sigma ^ { \prime \prime } \left( x _ { j } ^ { ( m + 1 ) } \right)
581
+ $$
582
+
583
+ We can replace both derivative terms with the forms which depend on the previous layer:
584
+
585
+ $$
586
+ \frac { \partial ^ { 2 } E } { \partial x _ { j } ^ { ( m + 1 ) ^ { 2 } } } = \underbrace { \sum _ { i } \frac { \partial ^ { 2 } E } { \partial x _ { i } ^ { ( 0 ) ^ { 2 } } } \left( w _ { j i } ^ { ( 0 ) } \right) ^ { 2 } } _ { \mathrm { f r o m ~ ( 6 6 ) } } \left( \sigma ^ { \prime } \left( x _ { j } ^ { ( m + 1 ) } \right) \right) ^ { 2 } + \underbrace { \sum _ { i } \frac { \partial E } { \partial x _ { i } ^ { ( m ) } } w _ { j i } ^ { ( m ) } } _ { \mathrm { f r o m ~ ( 5 5 ) } } \sigma ^ { \prime \prime } \left( x _ { j } ^ { ( m + 1 ) } \right)
587
+ $$
588
+
589
+ And this horrible mouthful of an equation gives you a general form for any neuron in the $j$ th position of the $m + 1$ layer. Taking very careful note of the indexes, this can be more or less translated painlessly to code. You are welcome, world.
590
+
591
+ # A.1.3 SUMMARY OF HIDDEN LAYER DERIVATIVES
592
+
593
+ $$
594
+ \frac { \partial E } { \partial \sigma _ { j } ^ { ( m + 1 ) } } = \sum _ { i } \frac { \partial E } { \partial x _ { i } ^ { ( m ) } } w _ { j i } ^ { ( m ) } \qquad \frac { \partial ^ { 2 } E } { \partial \sigma _ { j } ^ { ( m + 1 ) ^ { 2 } } } = \sum _ { i } \frac { \partial ^ { 2 } E } { \partial x _ { i } ^ { ( m ) ^ { 2 } } } \left( w _ { j i } ^ { ( m ) } \right) ^ { 2 }
595
+ $$
596
+
597
+ $$
598
+ \begin{array} { r l r } { { \frac { \partial E } { \partial x _ { i } ^ { ( m ) } } = \frac { \partial E } { \partial o _ { i } ^ { ( m ) } } \frac { \partial o _ { i } ^ { ( m ) } } { \partial x _ { i } ^ { ( m ) } } } } \\ & { \frac { \partial ^ { 2 } E } { \partial x _ { j } ^ { ( m + 1 ) ^ { 2 } } } = \frac { \partial ^ { 2 } E } { \partial o _ { j } ^ { ( m + 1 ) ^ { 2 } } } ( \sigma ^ { \prime } ( x _ { j } ^ { ( m + 1 ) } ) ) ^ { 2 } + \frac { \partial E } { \partial o _ { j } ^ { ( m + 1 ) } } \sigma ^ { \prime \prime } ( x _ { j } ^ { ( m + 1 ) } ) } \end{array}
599
+ $$
md/train/BkVsEMYel/BkVsEMYel.md ADDED
The diff for this file is too large to render. See raw diff
 
md/train/BkVsWbbAW/BkVsWbbAW.md ADDED
@@ -0,0 +1,321 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # DEEP GENERATIVE DUAL MEMORY NETWORK FOR CONTINUAL LEARNING
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Despite advances in deep learning, artificial neural networks do not learn the same way as humans do. Today, neural networks can learn multiple tasks when trained on them jointly, but cannot maintain performance on learnt tasks when tasks are presented one at a time – this phenomenon called catastrophic forgetting is a fundamental challenge to overcome before neural networks can learn continually from incoming data. In this work, we derive inspiration from human memory to develop an architecture capable of learning continuously from sequentially incoming tasks, while averting catastrophic forgetting. Specifically, our model consists of a dual memory architecture to emulate the complementary learning systems (hippocampus and the neocortex) in the human brain and maintains a consolidated long-term memory via generative replay of past experiences. We (i) substantiate our claim that replay should be generative, (ii) show the benefits of generative replay and dual memory via experiments, and (iii) demonstrate improved performance retention even for small models with low capacity. Our architecture displays many important characteristics of the human memory and provides insights on the connection between sleep and learning in humans.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Many machine learning models, when trained sequentially on tasks, forget how to perform the previously learnt tasks. This phenomenon called catastrophic forgetting is prominent in neural networks (McCloskey & Cohen, 1989). Without a way to avert catastrophic forgetting, a learning system needs to store all training data and relearn on it along with new incoming data, when retraining. Hence, it is an important challenge to overcome in order to enable systems to learn continuously.
12
+
13
+ McCloskey & Cohen (1989) first suggested that the underlying cause of forgetting was the distributed shared representation of tasks via network weights. Subsequent works attempted to remedy the issue by reducing representational overlap between input representations via activation sharpening algorithms (Kortge, 1990), orthogonal recoding of inputs (Lewandowsky, 1991) or orthogonal activations at all hidden layers (McRae & Hetherington, 1993; French, 1994). More recent works have explored activations like dropout (Goodfellow et al., 2015) and local winner-takes-all (Srivastava et al., 2013) to create sparse, less correlated feature representations. But such sparse encodings can be task specific at times and in general act as heuristics to mildly pacify the underlying problem.
14
+
15
+ Further, natural cognitive systems are also connectionist in nature and yet they forget gradually but not ‘catastrophically’. For instance, humans demonstrate gradual systematic forgetting. Frequently and recently encountered tasks tend to survive much longer in the human memory, while those rarely encountered are slowly forgotten. Some of the earlier tasks may be seen again, but it is not necessary for them to be retained in memory (French, 1999). Hence only sparsifying representations does not solve the problem. Instead, neuroscientific evidence suggests that humans have evolved mechanisms to separately learn new incoming tasks and consolidate the learning with previous knowledge to avert catastrophic forgetting (McClelland et al., 1995; O’Neill et al., 2010; French, 1999).
16
+
17
+ Complementary learning systems: McClelland et al. (1995) suggested that this separation has been achieved in the human brain via evolution of two separate areas of the brain, the hippocampus and the neocortex. The neocortex is a long term memory which specializes in consolidating new information with previous knowledge and gradually learns the joint structure of all tasks and experiences; whereas the hippocampus acts as a temporary memory to rapidly learn new tasks and then slowly transfer the knowledge to neocortex after acquisition.
18
+
19
+ Experience replay: Another factor deemed essential for sequential learning is experience replay. McClelland et al. (1995); O’Neill et al. (2010) have emphasized the importance of replayed data patterns in the human brain during sleep and waking rest. Robins (1995; 2004) proposed several replay techniques (a.k.a. pseudopattern rehearsal) to achieve replay, but they involved generating replay data without storing input representations and our experiments show that they lack the accuracy required for consolidation.
20
+
21
+ Weight consolidation or freezing: Recent evidence from neuroscience also suggests that mammalian brain protects knowledge in the neocortex via task-specific consolidation of neural synapses over long periods of time (Yang et al., 2014; Benna & Fusi, 2016). Such techniques have recently been employed in progressive neural networks (Rusu et al., 2016) and Pathnets (Fernando et al., 2017) both of which freeze neural network weights after learning tasks. Kirkpatrick et al. (2017) have used the fisher information matrix (FIM) to slow down learning on network weights which correlate with previously acquired knowledge.
22
+
23
+ In this paper, we address the catastrophic forgetting problem by drawing inspiration from the above neuroscientific insights and present a method to overcome catastrophic forgetting. More specifically, we propose a dual-memory architecture for learning tasks sequentially while averting catastrophic forgetting. Our model comprises of two generative models: a short-term memory (STM) to emulate the human hippocampal system and a long term memory (LTM) to emulate the neocortical learning system. The STM learns new tasks without interfering with previously learnt tasks in the LTM. The LTM stores all previously learnt tasks and aids the STM in learning tasks similar to previous tasks. During sleep/down-time, the STM generates and transfers samples of learnt tasks to the LTM. These are gradually consolidated with the LTM’s knowledge base of previous tasks via generative replay.
24
+
25
+ Our approach is inspired from the strengths of deep generative models, experience replay and the complementary learning systems literature. We demonstrate our method’s effectiveness in averting catastrophic forgetting by sequentially learning multiple tasks. Moreover, our experiments shed light on some characteristics of human memory as observed in the psychology and neuroscience literature.
26
+
27
+ # 2 PROBLEM SETTING: SEQUENTIAL MULTITASK LEARNING
28
+
29
+ Formally, our problem setting can be called Sequential Multitask Learning and is characterized by a set of tasks $\mathbb { T }$ , which are to be learnt by a model parameterized by weights $\theta$ (e.g. a neural network). From here on, we will use the the phrase model and neural network interchangeably. In this work we mainly consider supervised learning tasks i.e. task $t \in \mathbb { T }$ has training examples: $\{ x _ { i } ^ { t } , y _ { i } ^ { t } \} _ { i = 1 : N _ { t } }$ for $x _ { i } ^ { t } \in \mathcal X$ and $y _ { i } ^ { t } \in \bar { \mathcal { V } }$ , but our model easily generalizes to unsupervised learning settings. Note that tasks are presented sequentially and the total number of tasks $\lvert \mathbb { T } \rvert$ is not known a priori.
30
+
31
+ Finite memory: We further assume that any training algorithm can store some examples from each task if needed, but the storage $( N _ { m a x } )$ is limited and can be smaller than the total number of examples from all tasks $\left( \sum _ { t = 1 } ^ { | \mathbb { T } | } N _ { t } \right)$ . So, algorithms cannot store all training examples and re-learn on them when new tasks arrive. The same restriction applies to algorithms with generative models i.e. no more than $N _ { m a x }$ examples allowed at any time (generated $^ +$ stored).
32
+
33
+ For testing, the model can be asked to predict the label $y ^ { t } \in \mathcal { V }$ for any example $x ^ { t } \in \mathcal { X }$ from any previously seen task $t \in \mathbb { T }$ . Our goal is to devise an algorithm which learns these tasks sequentially while avoiding catastrophic forgetting and can achieve a test loss close to that of a model which learnt all the tasks jointly.
34
+
35
+ # 3 DEEP GENERATIVE DUAL MEMORY NETWORK
36
+
37
+ The idea of replaying experience to a neural network has been used previously for reinforcement learning (Lin, 1993; Mnih et al., 2015). A study by O’Neill et al. (2010) suggests that experience replay also occurs in the human brain during sleep and waking rest and aids in consolidation of learnt experiences. We propose that experience replay must be generative in nature. This is better than storing all samples in replay memories as is common in reinforcement learning (Mnih et al., 2015), since sampling from a generative model automatically provides the most frequently encountered samples. It is also feasible with limited total memory, whereas explicitly storing samples from previous tasks requires determining which and how many samples to store for each task. Determining this can depend on the total tasks $\left| \mathbb { T } \right|$ , number of examples per task $N _ { t }$ and frequency of occurrence of samples, which are often not available a priori.
38
+
39
+ Previously proposed non-generative approaches to experience replay (Robins, 1995; French, 1997; Robins, 2004) propose to preserve neural networks’ learnt mappings by arbitrarily sampling random inputs and their corresponding outputs from the neural networks and using them along with new task samples while training. These approaches have only been tested in small binary input spaces in previous works, and our experiments in section 4 show that sampling random inputs in highdimensional spaces (e.g. images) does not preserve the mapping learnt by neural networks.
40
+
41
+ # 3.1 GENERATIVE EXPERIENCE REPLAY
42
+
43
+ ![](images/6170b28f0b9ad0e31d7cc1635be8649edabf848daa9d52ed8abbc48ead26cfa6.jpg)
44
+ Figure 1: Deep Generative Replay to train a Deep Generative Memory
45
+
46
+ Deep Generative Memory (DGM): We first introduce a sub-model called the Deep Generative Memory (see figure 1) which has three elements: (i) a generative model (the generator $G$ ), (ii) a feedforward network (the learner $L$ ), and (iii) a dictionary $( D _ { d g m } )$ with task IDs of learnt tasks and the number of times they were encountered. We call this a memory because of its weights and learning capacity, not due to any recurrent connections. We assume availability of unique task IDs for replay and to identify repetition. In practice, a task identification system (e.g., a HMM-based inference model) like in previous works (Kirkpatrick et al., 2017) suffices for this purpose. We choose variational autoencoder (VAE) (Kingma & Welling, 2014) for the generator, since our generative model requires reconstruction capabilities (see section 3.2).
47
+
48
+ Deep Generative Replay (DGR): We update a DGM with samples from (multiple) new tasks using our algorithm Deep Generative Replay (see figure 1 above and algorithm 1 in appendix A). Given new incoming samples $( X , Y )$ , DGR first computes the fraction of total samples that should come from incoming samples $( \eta _ { t a s k s } )$ and the fraction to come from previous task samples $( \eta _ { g e n } )$ proportionate to the number of tasks (counting repetitions). It allots a minimum fraction $\kappa$ of the memory capacity $N _ { m a x }$ per new task. This ensures that as the DGM saturates with tasks over time, new tasks are still learnt at the cost of gradually losing performance on the least recent previous tasks. This saturation is synonymous to how learning slows down in humans as they age but they still continue to learn new tasks while forgetting old things gradually (French, 1999). Next, DGR computes the number of samples to be generated from previous tasks and subsamples the incoming samples (if needed) to obey maximum memory capacity $( N _ { m a x } )$ . It then generates samples of previously learnt tasks $( X _ { g e n } , Y _ { g e n } )$ using the generator and learner, reconstructs the data $\{ X , X _ { g e n } \}$ using the generator (hence we use a VAE) and then trains the DGM on resulting samples $\scriptstyle ( X _ { r e c o n }$ , $\{ Y , Y _ { g e n } \} )$ . Doing this final reconstruction provides robustness to noise and occlusion (section 5).
49
+
50
+ # 3.2 DUAL MEMORY NETWORKS
51
+
52
+ A good continual learning system needs to quickly acquire new tasks and also retain performance on previously learnt tasks. These conflicting requirements are hard to satisfy simultaneously. Hence, inspired by nature’s solution to this problem, we propose a dual memory network to combat forgetting.
53
+
54
+ ![](images/81669f8d5703e75d381c36489d050107cda125a58c6375aa8cb5d5b7d89b3746.jpg)
55
+ Figure 2: Deep Generative Dual Memory Network (DGDMN)
56
+
57
+ Our architecture (DGDMN) shown in figure 2 comprises of a large deep generative memory (DGM) called the long-term memory (LTM) which stores information of all previously learnt tasks like the neocortex, and a short-term memory (STM) which behaves similar to the hippocampus and learns new incoming tasks quickly without interference from previous tasks. The STM is a collection of small, dedicated, task-specific deep generative memories (called short-term task memory – STTM), which can each learn one unique task. If an incoming task comes is already in an STTM, the same STTM is used to retrain on it, otherwise a fresh STTM is allocated to the task. Additionally, if the task has been previously consolidated then the LTM reconstructs the incoming samples for that task using the generator (hence we use a VAE), predicts labels for the reconstructions using its learner and sends these newly generated samples to the STTM allocated to this task. This provides extra samples on tasks which have been learnt previously and helps to learn them better, while also preserving the previous performance on that task to some extent.
58
+
59
+ Once all $\left( n _ { S T M } \right)$ STTMs are exhausted, the architecture sleeps (like humans) to consolidate all tasks into the LTM and free up the STTMs for new tasks. While asleep, the STM generates and sends samples of learnt tasks to the LTM, where these are consolidated via deep generative replay (see figure 2). While testing on task $t$ (even intermittently between tasks), if any STTM currently contains task $t$ , it is used to predict the labels, else the prediction is deferred to the LTM. This allows predicting on all tasks seen uptil now (including the most recent ones) without sleeping.
60
+
61
+ # 4 EXPERIMENTS
62
+
63
+ We perform experiments to demonstrate forgetting on sequential image classification tasks. We briefly describe our datasets here (details in appendix B): (a) Permnist is a catastrophic forgetting (Goodfellow et al., 2015; Kirkpatrick et al., 2017) benchmark and each task contains a fixed permutation of pixels on MNIST images (LeCun et al., 1998), (b) Digits dataset involves classifying a single MNIST digit per task, (c) TDigits is a transformed variant of MNIST similar to Digits but with 40 tasks for long task sequences, (d) Shapes contains several geometric shape classification tasks, and (e) Hindi contains a sequence of 8 tasks with hindi language consonant recognition.
64
+
65
+ Along with our model (DGDMN), we test several baselines for catastrophic forgetting, which are briefly described here (implementation and hyperparameter details in appendix B): (a) Feedforward neural networks (NN): We use these to characterize the forgetting in the absence of any prevention mechanism and as a datum for other approaches, (b) Neural nets with dropout (DropNN): Goodfellow et al. (2015) suggested using dropout as a means to prevent representational overlaps and pacify catastrophic forgetting, (c) Pseudopattern Rehearsal (PPR): A non-generative approach to experience replay (Robins, 2004), (d) Elastic Weight Consolidation (EWC): Kirkpatrick et al. (2017) proposed using the Fisher Information Matrix for task-specific consolidation of weights in a neural network, and (e) Deep Generative Replay (DGR): Using a single DGM to separate the effects of generative replay and dual memory architecture.
66
+
67
+ In our preliminary experiments, we observed that large networks with excessive parameters can more easily adapt to sequentially incoming tasks, thereby masking the severity of catastrophic forgetting. So we have chosen network architectures which have to share all their parameters appropriately amongst the various tasks in a dataset to achieve reasonable joint accuracy on the dataset. This allows us to evaluate an algorithm carefully while ignoring the benefits provided by excessive parameterization.
68
+
69
+ # 4.1 ACCURACY AND FORGETTING CURVES
70
+
71
+ ![](images/f90671a567428e4bdd15231af6701dd7dee23b3dc65ef2700483768a4983043a.jpg)
72
+ Figure 3: Accuracy curves for Permnist (x: tasks seen, y: classification accuracy on task).
73
+
74
+ We trained DGDMN and all above baselines sequentially on the image classification tasks of Permnist, Digits, Shapes and Hindi datasets (separately). We show results on the Shapes and Hindi dataset in appendix A. The classification accuracy on a held out test set for each task, after training on the $t ^ { t h }$ task has been shown in figures 3 and 4. We used the same network architecture for each of NN, PPR, EWC, learner in DGR, and learner in the LTM of DGDMN (for a single dataset). DropNN had two intermediate dropout layers after each hidden layer (see appendix B for details).
75
+
76
+ We observe from figures 3a and 3b, that NN and DropNN forget catastrophically when they learn new tasks. This shows that sparse representation based methods rely on the neural network being of high enough capacity to learn sparse representations (Goodfellow et al., 2015) and may not perform well if the network does not have redundant weights available. EWC forgets less than NN and DropNN, but it rapidly slows down learning on many weights and its learning effectively stagnates after Task 3 (e.g. see Tasks 5 and 6 in figure 3d). The learning slowdown on weights hinders EWC from reusing those weights later on to jointly discover common structures amongst previously learnt and newly incoming tasks. Note that the networks do have the capacity to learn all tasks and our algorithms DGR and DGDMN outperform all baselines by learning all tasks sequentially with this same learner network (figures 3e, 3f).
77
+
78
+ We observed heavy forgetting on Digits (figure 4) for most baselines, which is expected because all samples in the $t ^ { t h }$ task have a single label $\mathbf { \rho } ( t )$ and so the $t ^ { t h }$ task can be learnt on its own by setting the $\hat { t } ^ { t h }$ bias of the softmax layer to be high and the other biases low. Such sequential tasks cause catastrophic forgetting. We observed that NN, DropNN, PPR and EWC learnt only the task being trained on and forgot all previous knowledge immediately. Sometimes, we also observed saturation due to the softmax bias being set very high and then being unable to recover from it. PPR showed severe saturation since its replay prevented it from coming out of the saturation.
79
+
80
+ DGR and DGDMN still retain performance on all tasks of Digits, and our replay strategy prevents saturation by appropriately balancing the ratios of new incoming samples and generated samples from previous tasks. The average forgetting on all tasks $\in \{ 1 , \ldots , t \}$ , after training on the $t ^ { t h }$ task (for both Digits and Permnist) is shown in figure 5. For absolute reference, the accuracy of NN by training it jointly on all tasks uptil the $t ^ { t h }$ task has also been shown for each $t$ . Again DGR and DGDMN outperform baselines in terms of retained average accuracy. In figure 5b, NN, DropNN, PPR and EWC follow nearly overlapping curves $\begin{array} { r } { ( a c c \approx \frac { 1 } { t } } \end{array}$ ) since they are only able to learn one task at a time. Further, though PPR involves experience replay, it does not compare against DGR and
81
+
82
+ ![](images/18714c2ef10b46abede86490f2ee7f34c52a46f8fc88844d5515b77a16b2e69d.jpg)
83
+ Figure 4: Accuracy curves for Digits (x: tasks seen, y: classification accuracy on task).
84
+
85
+ ![](images/c51550482d517a0103f006376cf5c3ec3bae898c93b182b62c7ce37e79a7f42d.jpg)
86
+ Figure 5: Forgetting curves (x: tasks seen, y: avg classification accuracy on tasks seen).
87
+
88
+ DGDMN (figures 3c, 4c). Although, it does preserve its learnt mapping around the points randomly sampled from its domain, these random samples are not close to real images and fail to preserve performance. These observations substantiate our claim that any replay mechanism must model the input domain accurately and hence needs to be generative in nature. We observed similar results for the Shapes and Hindi dataset (appendix A).
89
+
90
+ We point out that datasets like Digits, which contain tasks with highly correlated input (and/or output) samples should be important benchmarks for continual learning for two main reasons: (i) High correlation amongst task samples promotes overfitting to the new incoming task and therefore causes catastrophic forgetting. Being able to retain performance on such task sequences is a strong indicator of the efficacy of a continual learning algorithm. (ii) Humans also learn by seeing many correlated samples together in a short span of time, rather than witnessing nearly IID samples (like in Permnist). For examples, kids learn a single alphabet per day in kindergarten by seeing and writing that alphabet many times that day. Since NN, DropNN and PPR do not fare well on such tasks, we show experiments on EWC, DGR and DGDMN from here on.
91
+
92
+ # 4.2 REPEATED TASKS AND REVISION
93
+
94
+ It is well known in psychology literature that human learning improves via revision (Kahana & Howard, 2005; Cepeda et al., 2006). We show performance of EWC and DGDMN on Permnist, when some tasks are repeated (figure 6). DGR performs very similar to DGDMN, hence we omit it. EWC stagnates and once learning has slowed down on the weights important for Task 1, the weights cannot be changed again, not even for improving Task 1. Further, it did not learn Task 6 the first time and revision does not help either. However, DGDMN learns all tasks uptil Task 6, then benefits by revising Task 1 again (accuracy goes up), and somewhat for Task 6 (it did not forget Task 6 substantially). We reiterate that DGDMN, by its design, benefits significantly from revision because STTMs learning a repeated task gain extra samples from the LTM (or generated samples from themselves, if they had learnt the task before). While many previous works do not investigate revision, it is crucial for learning continuously and should improve performance on tasks. The ability to learn from correlated task samples and revision makes our memory architecture functionally similar to that of humans.
95
+
96
+ ![](images/eae57c9c87ebd7c5affebc56623c475814c7bb1417300a3e17e7091d2aed7d27.jpg)
97
+ Figure 6: Accuracy curves when tasks are revised: (a) EWC, (b) DGDMN.
98
+
99
+ # 4.3 CONNECTIONS TO COMPLEMENTARY LEARNING SYSTEMS AND SLEEP
100
+
101
+ To explore the role of the dual memory architecture and differentiate between DGDMN and DGR, we trained these algorithms on the long sequence of 40 tasks from TDigits dataset. We limited $N _ { m a x }$ to 120, 000 samples for this task to explore the case where the LTM in DGDMN (DGM in DGR) cannot regenerate as many samples as in the full dataset and has to forget some tasks. At least $\kappa = 0 . 0 5$ fraction of memory was ensured per new task and consolidation in DGDMN happened after $n _ { S T M } = 5$ tasks.
102
+
103
+ ![](images/551b6c0ce39a768723325fa8dfec54d2c5ca847b4712a311f8e4fb3e4524d2f4.jpg)
104
+ Figure 7: Accuracy curves for TDigits on: (a) tasks seen so far, (b) last 10 tasks seen.
105
+
106
+ The average forgetting curves vs. tasks encountered are plotted in figure 7a. DGDMN and DGR start around an average accuracy of 1.0, but start dropping after 10 tasks since the LTM (DGM for DGR) begins to saturate. While DGDMN drops slowly and retains $> 4 0 \%$ accuracy on all tasks, DGR drops below $2 0 \%$ accuracy. This is because DGR consolidates its DGM too often and the DGM’s self-generated slightly erroneous samples compound errors quite fast. DGDMN uses small STTMs to learn single tasks with low error and transfers them simultaneously to the LTM. As a consequence, DGDMN consolidates its LTM with more accurate samples and less often, hence its error accumulates much slower. We discuss the effect of the small error in STTM representations in section 5.
107
+
108
+ Even though DGDMN displays inevitable forgetting in figure $\mathrm { 7 a }$ (due to memory constraint), the forgetting is gradual and not catastrophic as seen for NN, DropNN, PPR etc. on Digits dataset. We also measure average accuracy on the most recent few tasks seen (say 10). Figure 7b shows that DGDMN oscillates around $9 0 \%$ average accuracy, whereas DGR’s frequent consolidation propagates errors too fast and its accuracy drops even on this metric.
109
+
110
+ Another advantage of dual memories is revealed by the training time for the algorithms. Figure 9a shows an order of magnitude of difference between DGDMN and DGR in training time. This is because STTMs are smaller and faster to train than the LTM. LTM preserves all the tasks seen so far and hence requires a large number of samples to consolidate, which is costly and should not be done after every task. Learning new tasks quickly in the STM and holding them till sleep provides a speed advantage and allows learning quickly with only periodic consolidation.
111
+
112
+ The dual memory architecture is a critical design choice for scalability and has also emerged naturally in humans, in the form of the complementary learning systems and the need to sleep periodically. Even though sleeping is a dangerous behavior for any organism since it can be harmed or attacked by a predator while asleep, sleep has still survived through eons of evolution and never been lost (Joiner, 2016). Today, most organisms with even a slightly developed nervous system (centralized or diffuse) display either sleep or light-resting behavior (Nath et al., 2017). The experiment demonstrates the importance of sleep, since without the dual memory architecture intertwined with periodic sleep, learning would be very short lived and highly time consuming (as in DGR).
113
+
114
+ # 5 ANALYSIS AND DISCUSSION
115
+
116
+ In this section we show that DGDMN shares some more remarkable characteristics with the human memory and present a discussion of some more related ideas. Due to space constraints, visualizations of the learnt latent structures when training jointly vs. sequentially have been deferred to appendix A. The hyperparameters of DGDMN $\kappa$ and $n _ { S T M }$ ) have intuitive interpretations and we have provided simple heuristics to choose them without any complex searches (in appendix B).
117
+
118
+ Resilience to noise and occlusion: We use a VAE to be able to reconstruct representations of samples. Reconstructed images are less noisy and can recover from partial occlusion, which gives our model human-like abilities to recognize objects in noisy, distorted or occluded images. We test our LTM model and a NN model by jointly training on uncorrupted Digits data and testing on noisy and occluded images. We see that the LTM is more robust to noisy and occluded images and exhibits smoother degradation in classification accuracy because of its denoising reconstructive properties (see figure 8).
119
+
120
+ ![](images/b1a7b1d3587e4b7d8ba4199220da570ab89bff3e6745f2c708d9bca8f8c3211e.jpg)
121
+ Figure 8: (a) LTM reconstruction from noisy and occluded digits, (b) Classification accuracy with increasing gaussian noise, and (c) Classification accuracy with increasing occlusion factor.
122
+
123
+ The choice of underlying generative model: Our consolidation ability and retention performance relies heavily on the generation and reconstruction ability of the underlying generative model. We chose a VAE for its reconstructive capabilities but our architecture is agnostic to the choice of the underlying generative model as long as the generator can generate reliable samples and reconstruct incoming samples accurately. Hence, variants of Generative Adversarial Networks (GAN) Goodfellow et al. (2014) like BiGANs (Donahue et al., 2017), ALI (Dumoulin et al., 2017) and AVB (Mescheder et al., 2017) can also be used for the generative model depending on the modeled domain.
124
+
125
+ ![](images/9158c81af36b3949c6e51f753ee820453a27c854b40008e26b8f5668e9eedb3e.jpg)
126
+ Figure 9: (a) Training time for DGDMN and DGR, (b) Accuracy curves: DGDMN (no STM).
127
+
128
+ Why use short-term memory?: Our LTM always learns from STTMs and never from real data, and the STTMs’ errors slowly propagate into the LTM and contribute to forgetting. An alternative could be to directly store data from new incoming tasks, consolidate it into the LTM after periodic intervals, and then discard the data. We show the accuracy curves on Digits dataset for this approach in figure 9b. This results in higher retention compared to DGDMN in figure 4 because LTM now learns from real data. However, this approach is not truly online since recently learnt tasks cannot be used immediately until after a sleep phase. Since the STM’s error can be made smaller by using high capacity generators and classifiers, we suggest using a STM for true online continual learning.
129
+
130
+ Connections to knowledge distillation: Previous works on (joint) multitask learning have also proposed approaches to learn individual tasks with small networks and then “distilling” them jointly into a larger neural network (Rusu et al., 2015). Such distillation can sometimes improve performance on individual tasks if they share structure and at other times mitigate inter-task interference due to refinement of learnt functions while distilling (Parisotto et al., 2016). Though we do not use temperature-controlled soft-labels while consolidating tasks into the LTM (unlike distillation), we surmise that due to refinement and compression during consolidation phase, DGDMN is also able to learn joint task structure effectively while mitigating interference between tasks.
131
+
132
+ Approaches based on synaptic consolidation: Though our architecture draws inspiration from complementary learning systems and experience replay in the human brain, there is also considerable neuroscientific evidence for synaptic consolidation in the human brain (like in EWC). It might be interesting to explore how synaptic consolidation can be incorporated in our dual memory architecture without causing stagnation and we leave this to future work. We also plan to extend our architecture to learning optimal policies over time via reinforcement learning without explicit replay memories.
133
+
134
+ # 6 CONCLUSION
135
+
136
+ In this work, we have developed a model capable of learning continuously on sequentially incoming tasks, while averting catastrophic forgetting. Our model employs a dual memory architecture to emulate the complementary learning systems (hippocampus and the neocortex) in the human brain and maintains a consolidated long-term memory via generative replay of past experiences. We have shown that generative replay performs the best for long-term performance retention even for neural networks with small capacity, while demonstrating the benefits of using generative replay and a dual memory architecture via our experiments. Our model hyperparameters have simple interpretations and can be set without much tuning. Moreover, our architecture displays remarkable parallels with the human memory system and provides useful insights about the connection between sleep and learning in humans.
137
+
138
+ # REFERENCES
139
+
140
+ Marcus K Benna and Stefano Fusi. Computational principles of synaptic memory consolidation. Nature neuroscience, 2016.
141
+
142
+ Nicholas J Cepeda, Harold Pashler, Edward Vul, John T Wixted, and Doug Rohrer. Distributed practice in verbal recall tasks: A review and quantitative synthesis. Psychological bulletin, 132(3): 354, 2006.
143
+
144
+ Jeff Donahue, Philipp Krähenbühl, and Trevor Darrell. Adversarial feature learning. In International Conference on Learning Representations (ICLR), 2017.
145
+
146
+ Vincent Dumoulin, Ishmael Belghazi, Ben Poole, Alex Lamb, Martin Arjovsky, Olivier Mastropietro, and Aaron Courville. Adversarially learned inference. In International Conference on Learning Representations (ICLR), 2017.
147
+
148
+ Chrisantha Fernando, Dylan Banarse, Charles Blundell, Yori Zwols, David Ha, Andrei A Rusu, Alexander Pritzel, and Daan Wierstra. Pathnet: Evolution channels gradient descent in super neural networks. arXiv preprint arXiv:1701.08734, 2017.
149
+
150
+ Robert M French. Dynamically constraining connectionist networks to produce distributed, orthogonal representations to reduce catastrophic interference. network, 1111:00001, 1994.
151
+
152
+ Robert M French. Pseudo-recurrent connectionist networks: An approach to the’sensitivitystability’dilemma. Connection Science, 9(4):353–380, 1997.
153
+
154
+ Robert M French. Catastrophic forgetting in connectionist networks. Trends in cognitive sciences, 3 (4):128–135, 1999.
155
+
156
+ Ian Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. Generative adversarial nets. In Neural Information Processing Systems (NIPS), pp. 2672–2680, 2014.
157
+
158
+ Ian J Goodfellow, Mehdi Mirza, Da Xiao, Aaron Courville, and Yoshua Bengio. An empirical investigation of catastrophic forgetting in gradient-based neural networks. arXiv preprint arXiv:1312.6211, 2015.
159
+
160
+ Google. The quick, draw! dataset. URL: https://github.com/googlecreativelab/quickdraw-dataset, 2017.
161
+
162
+ Geoffrey Hinton. Neural networks for machine learning - lecture 6a - overview of mini-batch gradient descent, 2012.
163
+
164
+ William J Joiner. Unraveling the evolutionary determinants of sleep. Current Biology, 26(20): R1073–R1087, 2016.
165
+
166
+ Kaggle. Devanagari character set. URL: https://www.kaggle.com/rishianand/devanagari-character-set, 2017.
167
+
168
+ Michael J Kahana and Marc W Howard. Spacing and lag effects in free recall of pure lists. Psychonomic Bulletin & Review, 12(1):159–164, 2005.
169
+
170
+ D. P. Kingma and M. Welling. Auto-encoding variational bayes. In International Conference on Learning Representations (ICLR), 2014.
171
+
172
+ James Kirkpatrick, Razvan Pascanu, Neil Rabinowitz, Joel Veness, Guillaume Desjardins, Andrei A Rusu, Kieran Milan, John Quan, Tiago Ramalho, Agnieszka Grabska-Barwinska, et al. Overcoming catastrophic forgetting in neural networks. Proceedings of the National Academy of Sciences, pp. 201611835, 2017.
173
+
174
+ Chris A Kortge. Episodic memory in connectionist networks. In Proceedings of the 12th Annual Conference of the Cognitive Science Society, volume 764, pp. 771. Erlbaum, 1990.
175
+
176
+ Yann LeCun, Léon Bottou, Yoshua Bengio, and Patrick Haffner. Gradient-based learning applied to document recognition. Proceedings of the IEEE, 86(11):2278–2324, 1998.
177
+
178
+ Stephan Lewandowsky. Gradual unlearning and catastrophic interference: A comparison of distributed architectures. Relating theory and data: Essays on human memory in honor of Bennet B. Murdock, pp. 445–476, 1991.
179
+
180
+ Long-Ji Lin. Reinforcement learning for robots using neural networks. PhD thesis, Fujitsu Laboratories Ltd, 1993.
181
+
182
+ Laurens van der Maaten and Geoffrey Hinton. Visualizing data using t-sne. Journal of Machine Learning Research, 9(Nov):2579–2605, 2008.
183
+
184
+ James L McClelland, Bruce L McNaughton, and Randall C O’reilly. Why there are complementary learning systems in the hippocampus and neocortex: insights from the successes and failures of connectionist models of learning and memory. Psychological review, 102(3):419, 1995.
185
+
186
+ Michael McCloskey and Neal J Cohen. Catastrophic interference in connectionist networks: The sequential learning problem. Psychology of learning and motivation, 24:109–165, 1989.
187
+
188
+ Ken McRae and Phil A Hetherington. Catastrophic interference is eliminated in pretrained networks. In Proceedings of the 15h Annual Conference of the Cognitive Science Society, pp. 723–728, 1993.
189
+
190
+ Lars Mescheder, Sebastian Nowozin, and Andreas Geiger. Adversarial variational bayes: Unifying variational autoencoders and generative adversarial networks. arXiv preprint arXiv:1701.04722, 2017.
191
+
192
+ Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Andrei A Rusu, Joel Veness, Marc G Bellemare, Alex Graves, Martin Riedmiller, Andreas K Fidjeland, Georg Ostrovski, et al. Human-level control through deep reinforcement learning. Nature, 518(7540):529–533, 2015.
193
+
194
+ Decebal Constantin Mocanu, Maria Torres Vega, Eric Eaton, Peter Stone, and Antonio Liotta. Online contrastive divergence with generative replay: Experience replay without storing data. CoRR, abs/1610.05555, 2016.
195
+
196
+ Ravi D Nath, Claire N Bedbrook, Michael J Abrams, Ty Basinger, Justin S Bois, David A Prober, Paul W Sternberg, Viviana Gradinaru, and Lea Goentoro. The jellyfish cassiopea exhibits a sleep-like state. Current Biology, 27(19):2984–2990, 2017.
197
+
198
+ Joseph O’Neill, Barty Pleydell-Bouverie, David Dupret, and Jozsef Csicsvari. Play it again: reactivation of waking experience and memory. Trends in neurosciences, 33(5):220–229, 2010.
199
+
200
+ Emilio Parisotto, Jimmy Lei Ba, and Ruslan Salakhutdinov. Actor-mimic: Deep multitask and transfer reinforcement learning. In International Conference on Learning Representations (ICLR), 2016.
201
+
202
+ Anthony Robins. Catastrophic forgetting, rehearsal and pseudorehearsal. Connection Science, 7(2): 123–146, 1995.
203
+
204
+ Anthony Robins. Sequential learning in neural networks: A review and a discussion of pseudorehearsal based methods. Intelligent Data Analysis, 8(3):301–322, 2004.
205
+
206
+ Andrei A Rusu, Sergio Gomez Colmenarejo, Caglar Gulcehre, Guillaume Desjardins, James Kirkpatrick, Razvan Pascanu, Volodymyr Mnih, Koray Kavukcuoglu, and Raia Hadsell. Policy distillation. arXiv preprint arXiv:1511.06295, 2015.
207
+
208
+ Andrei A Rusu, Neil C Rabinowitz, Guillaume Desjardins, Hubert Soyer, James Kirkpatrick, Koray Kavukcuoglu, Razvan Pascanu, and Raia Hadsell. Progressive neural networks. arXiv preprint arXiv:1606.04671, 2016.
209
+
210
+ Hanul Shin, Jung Kwon Lee, Jaehong Kim, and Jiwon Kim. Continual learning with deep generative replay. In Neural Information Processing Systems (NIPS), 2017.
211
+
212
+ Rupesh K Srivastava, Jonathan Masci, Sohrob Kazerounian, Faustino Gomez, and Jürgen Schmidhuber. Compete to compute. In Neural Information Processing Systems (NIPS), pp. 2310–2318, 2013.
213
+
214
+ Guang Yang, Cora Sau Wan Lai, Joseph Cichon, Lei Ma, Wei Li, and Wen-Biao Gan. Sleep promotes branch-specific formation of dendritic spines after learning. Science, 344(6188):1173–1178, 2014.
215
+
216
+ # 7 APPENDIX A
217
+
218
+ 7.1 DEEP GENERATIVE REPLAY
219
+
220
+ # Algorithm 1: Deep Generative Replay
221
+
222
+ 1: Input: Current parameters of DGM, new samples: $( X , Y )$ , dictionary for new samples: $D _ { t a s k s }$ (there can be multiple tasks), minimum fraction: $\kappa$ , memory capacity: $N _ { m a x }$
223
+ 2: Output: New parameters of DGM // Compute sampling fractions
224
+ 3: ηtasks := P tasksDdgm+P Dtasks and $\eta _ { g e n } : = 1 - \eta _ { t a s k s }$
225
+ 4: if $\eta _ { t a s k s } < \kappa | D _ { t a s k s } |$ then
226
+ 5: $\eta _ { t a s k s } : = \kappa | D _ { t a s k s } |$ and $\eta _ { g e n } : = 1 - \eta _ { t a s k s }$
227
+ 6: end if // Compute number of samples
228
+ 7: if $| X | > \eta _ { t a s k s } \times N _ { m a x }$ then
229
+ 8: $n _ { t a s k s } : = \eta _ { t a s k s } \times N _ { m a x }$ and $n _ { g e n } : = N _ { m a x } - n _ { t a s k s }$
230
+ 9: Subsample $( X , Y )$ to meet size $n _ { t a s k s }$
231
+ 10: else
232
+ 11: $n _ { t a s k s } : = | X |$ and $\begin{array} { r } { n _ { g e n } : = \frac { \eta _ { g e n } } { \eta _ { t a s k s } } \times | \boldsymbol { X } | } \end{array}$
233
+ 12 : end if // Generate and reconstruct samples
234
+ 13: Generate $n _ { g e n }$ samples: $X _ { g e n }$ from generator $G$ and labels from learner $L$ : $Y _ { g e n } = L ( X _ { g e n } )$
235
+ 14: $X _ { r e c o n } = \mathrm { R }$ econstruct $\{ X , \bar { X } _ { g e n } \}$ using the generator $G$ // Train the DGM
236
+ 15: Train the generator $G$ on $X _ { r e c o n }$
237
+ 16: Train the learner $L$ on $( X _ { r e c o n } , \{ Y , Y _ { g e n } \} )$
238
+
239
+ Deep Generative Replay (algorithm 1), as described in section 3.1, consolidates new tasks for a DGM with previously learnt tasks. It first computes sampling fractions for new tasks $( \eta _ { t a s k s } )$ and previously learnt tasks $( \eta _ { g e n } )$ and ensures a minimum fraction $\left( \kappa \right)$ per new task (lines 3–6). Then it computes the number of samples to generate from previous tasks and whether to subsample the incoming task samples to satisfy the memory capacity $N _ { m a x }$ (lines 7–12). Finally, it generates the required number of samples from previous tasks, reconstructs all data and trains the DGM on resulting data (lines 13–16). For a dictionary $D , \sum D$ is the total number of tasks in $D$ counting repetitions, while $| D |$ is the total number of tasks without repetitions. $| X |$ is the number of samples in set $X$ .
240
+
241
+ Shin et al. (2017) have recently proposed a similar idea independently and Mocanu et al. (2016) have also employed a generative replay in two-layer restricted boltzmann machines, but they do not describe balancing new and generated samples and cannot recognize repeated tasks (section 4.2). Their generative replay without a dual memory architecture is costly to train (section 4.3) and a lack of reconstruction for new samples makes their representations less robust to noise and occlusions (section 5).
242
+
243
+ # .2 MORE EXPERIMENTS WITH ACCURACY AND FORGETTING CURVES
244
+
245
+ In this section, we present more experiments on the Shapes and the Hindi dataset, which contain sequences of tasks with geometric shapes and hindi consonants recognition respectively. We observed similar forgetting patterns as on the Digits dataset in section 4. All baselines exhibited catastrophic forgetting on these sequences of tasks, but DGR and DGDMN were able to learn the task structure sequentially (figures 10, 11). The same is reflected in the average forgetting curves in figure 12.
246
+
247
+ # 7.3 JOINTLY VS. SEQUENTIALLY LEARNT STRUCTURE
248
+
249
+ To explore whether learning tasks sequentially results in a similar structure as learning them jointly, we visualized t-SNE (Maaten & Hinton, 2008) embeddings of the latent vectors of the LTM generator (VAE) in DGDMN after training it: (a) jointly over all tasks (Figure 13a), and (b) sequentially over tasks seen one at a time (Figure 13b) on the Digits dataset. To maintain consistency, we used the same random seed in t-SNE for both joint and sequential embeddings.
250
+
251
+ ![](images/05b4bab32d0b9e68553bda5e373e69654589fb514fc51d925f2d5818d6e2ca9a.jpg)
252
+ Figure 10: Accuracy curves for Shapes (x: tasks seen, y: classification accuracy on task).
253
+
254
+ ![](images/b51f69223903dc4952bd19665dde326e9ed7cba7903da592f2e9073496931e4f.jpg)
255
+ Figure 11: Accuracy curves for Hindi (x: tasks seen, y: classification accuracy on task).
256
+
257
+ We observe that the LTM’s latent space effectively segregates the 10 digits in both cases (joint and sequential). Though the absolute locations of the digit clusters differ in the two plots, the relative locations of digits share some similarity between both plots i.e. the neighboring digit clusters for each cluster are roughly similar. This may not be sufficient to conclude that the LTM discovers the same latent representation for the underlying shared structure of tasks in these cases and we leave a more thorough investigation to future work.
258
+
259
+ # 7.4 VISUALIZATIONS FOR THE JOINTLY AND SEQUENTIALLY LEARNT LTM
260
+
261
+ We also show visualizations of digits from the LTM when trained jointly on Digits tasks (Figure 14a) and when trained sequentially (Figure 14b). Though the digits generated from the jointly trained LTM are quite sharp, the same is not true for the sequentially trained LTM. We observe that the
262
+
263
+ ![](images/e79a088951e726503a561fe4995d32d1972ad7a91f519bbfe083393efc4407a4.jpg)
264
+ Figure 12: Forgetting curves on Shapes and Hindi dataset (x: tasks seen, y: avg classification accuracy on tasks seen).
265
+
266
+ ![](images/b346b7c891174d1856f608b81586a975de69cf624acbc77171f782633274087d.jpg)
267
+ Figure 13: t-SNE embedding for latent vectors of the VAE generator on Digits dataset when: (a) tasks are learnt jointly, and (b) tasks are learnt sequentially.
268
+
269
+ sequentially trained LTM produces sharp samples of the recently learnt tasks (digits 6, 7, 8 and 9), but blurred samples of previously learnt tasks, which is due to partial forgetting on these previous tasks.
270
+
271
+ ![](images/a1824bc3921b759388c7ee5826f4e401c4ef0a1b98d34fba3c8635d2c1683845.jpg)
272
+ Figure 14: Visualization of digits from LTM when trained: (a) jointly, (b) sequentially
273
+
274
+ # 8 APPENDIX B
275
+
276
+ # 8.1 DATASET PREPROCESSING
277
+
278
+ All our datasets have images with intensities normalized in the range [0.0, 1.0] and size $( 2 8 \times 2 8 )$ , except Hindi which has $( 3 2 \times 3 2 )$ size images.
279
+
280
+ Permnist: Our version involved six tasks, each containing a fixed permutation on images sampled from the original MNIST dataset. We sampled 30, 000 images from the training set and all the 10, 000 test set images for each task. The tasks were as follows: (i) Original MNIST, (ii) 8x8 central patch of each image blackened, (iii) 8x8 central patch of each image whitened, (iv) 8x8 central patch of each image permuted with a fixed random permutation, (v) 12x12 central patch of each image permuted with a fixed random permutation, and (vi) mirror images of MNIST. This way each task is as hard as MNIST and the tasks share some common underlying structure.
281
+
282
+ Digits: We introduce this smaller dataset which contains 10 tasks with the $t ^ { t h }$ task being classification of digit $t$ from the MNIST dataset.
283
+
284
+ TDigits: We introduced a transformed variant of MNIST containing all ten digits, their mirror images, their upside down images, and their images when reflected about the main diagonal making a total of 40 tasks. This dataset poses similar difficulty as the Digits dataset and we use it for experiments involving longer sequence of tasks.
285
+
286
+ Shapes: This dataset was extracted from the Quick, Draw! dataset recently released by Google (2017), which contains 50 million drawings across 345 categories of hand-drawn images. We subsampled 4, 500 training images and 500 test images from all geometric shapes in Quick, Draw! (namely circle, hexagon, octagon, square, triangle and zigzag).
287
+
288
+ Hindi: Extracted from the Devanagri dataset (Kaggle, 2017) and contains a sequence of 8 tasks, each involving image classification of a hindi language consonant.
289
+
290
+ # 8.2 TRAINING ALGORITHM AND ITS PARAMETERS
291
+
292
+ All models were trained with RMSProp (Hinton, 2012) using learning rate $= \ 0 . 0 0 1$ , $\rho = 0 . 9$ , $\epsilon = 1 0 ^ { - 8 }$ and no decay. We used a batch size of 128 and all classifiers were provided 20 epochs of training when trained jointly, and 6 epochs when trained sequentially over tasks. For generative models (VAEs), we used gradient clipping in RMSProp with $\mathtt { c l i p n o r m = 1 . 0 }$ and clipvalue $=$ 0.5, and they were always trained for 25 epochs regardless of the task or dataset involved.
293
+
294
+ # 8.3 NEURAL NETWORK ARCHITECTURES
295
+
296
+ We chose all our models by first training them jointly on all tasks in a dataset to ensure that our models had enough capacity to perform reasonably well on all tasks. But we gave preference to simpler models over very high capacity models.
297
+
298
+ Classifier Models: Our implementation of NN, DropNN, PPR, EWC, learner for DGR and the learner for LTM in DGDMN used a neural network with three fully-connected layers with the number of units tuned differently according to the dataset (24, 24 units for Digits, 48, 48 for Permnist and 36, 36 for TDigits). DropNN also added two dropout layers, one after each hidden layer with droput rate $= 0 . 2$ each. The classifiers (learners) for Shapes and Hindi datasets had two convolutional layers (1 $2 , 2 0 : 3 \times 3$ kernels for Shapes and 2 $4 , 3 2 : 3 \times 3$ kernels for Hindi) each followed by a $2 \times 2$ max-pooling layer. The last two layers were fully-connected (16, 6 for Shapes and 144, 36 for Hindi). The hidden layers used ReLU activations, the last layer had a softmax activation, and the model was trained to minimize the cross-entropy objective function. The learners for STTMs in DGDMN were kept smaller for speed and efficiency concerns.
299
+
300
+ Generative models: The generators (VAE) for DGR and LTM of DGDMN employed encoders and decoders with two fully connected hidden layers each with ReLU activation for Permnist, Digits and TDigits, and convolutional variants for Shapes and Hindi. The sizes and number of units/kernels in the layers were tuned independently for each dataset with an approximate coarse grid-search. The size of the latent variable $z$ was set to 32 for Digits, 64 for Permnist, 96 for TDigits, 32 for Shapes and 48 for Hindi. The STTM generators for DGDMN were kept smaller for speed and efficiency.
301
+
302
+ # 8.4 HYPERPARAMETERS OF DGDMN
303
+
304
+ DGDMN has two new hyperparameters: (i) $\kappa$ : minimum fraction of $N _ { m a x }$ reserved for incoming tasks, and (ii) $n _ { S T M }$ : number of STTMs (also sleep/consolidation frequency). Both these have straightforward interpretations and can be set directly without complex hyperparameter searches.
305
+
306
+ $\kappa$ ensures continual incorporation of new tasks by guaranteeing them a minimum fraction of LTM samples during consolidation. Given that LTM should perform well on last $K$ tasks seen in long
307
+
308
+ task sequence of $T$ tasks, we observed that it is safe to assume that about $5 0 \%$ of the LTM would be
309
+ crowded by the earlier $T - K$ tasks. The remaining 0.5 fraction should be distributed to the last $K$
310
+ tasks. So choosing this choice in secti $\textstyle \kappa = { \frac { 0 . 5 } { K } }$ woith in pand as a good starting point for tuning). We made, and hence plotted the average accuracy over $K = 1 0$ $\kappa = 0 . 0 5$
311
+ the last 10 tasks as a metric.
312
+
313
+ $n _ { S T M }$ controls the consolidation cycle frequency. Increasing $n _ { S T M }$ gives more STTMs, less frequent consolidations and hence a learning speed advantage. But this also means that fewer samples of previous tasks would participate in consolidation (due to maximum capacity $N _ { m a x }$ of LTM), and hence more forgetting might occur. This parameter does not affect learning much till the LTM remains unsaturated (i.e. $N _ { m a x }$ capacity is unfilled by generated $^ +$ new samples) and becomes active after that. For long sequences of tasks, we found it best to keep at least $7 5 \%$ of the total samples from previously learnt tasks to have appropriate retention. Hence, $n _ { S T M }$ can be set as approximately $\frac { 0 . 2 5 } { \kappa }$ in practice (as we did in section 4.3), or as a starting point for tuning.
314
+
315
+ # 8.5 ALGORITHM SPECIFIC HYPERPARAMETERS
316
+
317
+ PPR: We used a maximum memory capacity of about $3 - 6$ times the number of samples in a task for the dataset being learnt on (i.e. 18, 000 for Digits, 60, 000 for Permnist, 15, 000 for Shapes and 5, 400 for Hindi). While replaying, apart from the task samples, the remaining memory was filled with random samples and corresponding labels.
318
+
319
+ EWC: Most values of the coefficient of the Fisher Information Matrix based regularizer between 1 to 500 worked reasonably well for our datasets. We chose 100 for our experiments.
320
+
321
+ DGR and DGDMN: $N _ { m a x }$ for the DGM in DGR and for the LTM in DGDMN for Digits, Permnist, Shapes and Hindi was set as the total number of samples in the datasets (summed over all tasks) to ensure that there was enough capacity to regenerate the datasets well. For TDigits, we deliberately restricted memory capacity to see the effects of learning tasks over a long time and we kept $N _ { m a x }$ as half the total number of samples. $n _ { S T M }$ was kept at 2 for Digits, Permnist and Shapes, 5 for TDigits and 2 for Hindi. $\kappa$ was set to be small, so that it does not come into play for Digits, Permnist, Shapes and Hindi since we already provided memories with full capacity for all samples. For TDigits, we used $\kappa = 0 . 0 5$ which would let us incorporate roughly 10 out of the 40 tasks well.
md/train/BkXmYfbAZ/BkXmYfbAZ.md ADDED
@@ -0,0 +1,293 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # BEYOND SHARED HIERARCHIES: DEEP MULTITASK LEARNING THROUGH SOFT LAYER ORDERING
2
+
3
+ Elliot Meyerson & Risto Miikkulainen
4
+ The University of Texas at Austin and Sentient Technologies, Inc. {ekm, risto} $@$ cs.utexas.edu
5
+
6
+ # ABSTRACT
7
+
8
+ Existing deep multitask learning (MTL) approaches align layers shared between tasks in a parallel ordering. Such an organization significantly constricts the types of shared structure that can be learned. The necessity of parallel ordering for deep MTL is first tested by comparing it with permuted ordering of shared layers. The results indicate that a flexible ordering can enable more effective sharing, thus motivating the development of a soft ordering approach, which learns how shared layers are applied in different ways for different tasks. Deep MTL with soft ordering outperforms parallel ordering methods across a series of domains. These results suggest that the power of deep MTL comes from learning highly general building blocks that can be assembled to meet the demands of each task.
9
+
10
+ # 1 INTRODUCTION
11
+
12
+ In multitask learning (MTL) (Caruana, 1998), auxiliary data sets are harnessed to improve overall performance by exploiting regularities present across tasks. As deep learning has yielded state-ofthe-art systems across a range of domains, there has been increased focus on developing deep MTL techniques. Such techniques have been applied across settings such as vision (Bilen and Vedaldi, 2016; 2017; Jou and Chang, 2016; Lu et al., 2017; Misra et al., 2016; Ranjan et al., 2016; Yang and Hospedales, 2017; Zhang et al., 2014), natural language (Collobert and Weston, 2008; Dong et al., 2015; Hashimoto et al., 2016; Liu et al., 2015a; Luong et al., 2016), speech (Huang et al., 2013; 2015; Seltzer and Droppo, 2013; Wu et al., 2015), and reinforcement learning (Devin et al., 2016; Fernando et al., 2017; Jaderberg et al., 2017; Rusu et al., 2016). Although they improve performance over single-task learning in these settings, these approaches have generally been constrained to joint training of relatively few and/or closely-related tasks.
13
+
14
+ On the other hand, from a perspective of Kolmogorov complexity, “transfer should always be useful”; any pair of distributions underlying a pair of tasks must have something in common (Mahmud, 2009; Mahmud and Ray, 2008). In principle, even tasks that are “superficially unrelated” such as those in vision and NLP can benefit from sharing (even without an adaptor task, such as image captioning). In other words, for a sufficiently expressive class of models, the inductive bias of requiring a model to fit multiple tasks simultaneously should encourage learning to converge to more realistic representations. The expressivity and success of deep models suggest they are ideal candidates for improvement via MTL. So, why have existing approaches to deep MTL been so restricted in scope?
15
+
16
+ MTL is based on the assumption that learned transformations can be shared across tasks. This paper identifies an additional implicit assumption underlying existing approaches to deep MTL: this sharing takes place through parallel ordering of layers. That is, sharing between tasks occurs only at aligned levels (layers) in the feature hierarchy implied by the model architecture. This constraint limits the kind of sharing that can occur between tasks. It requires subsequences of task feature hierarchies to match, which may be difficult to establish as tasks become plentiful and diverse.
17
+
18
+ This paper investigates whether parallel ordering of layers is necessary for deep MTL. As an alternative, it introduces methods that make deep MTL more flexible. First, existing approaches are reviewed in the context of their reliance on parallel ordering. Then, as a foil to parallel ordering, permuted ordering is introduced, in which shared layers are applied in different orders for different tasks. The increased ability of permuted ordering to support integration of information across tasks is analyzed, and the results are used to develop a soft ordering approach to deep MTL. In this approach, a joint model learns how to apply shared layers in different ways at different depths for different tasks as it simultaneously learns the parameters of the layers themselves. In a suite of experiments, soft ordering is shown to improve performance over single-task learning as well as over fixed order deep MTL methods.
19
+
20
+ ![](images/9b12ec1c0f5ad83779cd8c777dc2b416ea4556beb858d6c3e5488d3d10520472.jpg)
21
+ Figure 1: Classes of existing deep multitask learning architectures. (a) Classical approaches add a task-specific decoder to the output of the core single-task model for each task; (b) Columnbased approaches include a network column for each task, and define a mechanism for sharing between columns; (c) Supervision at custom depths adds output decoders at depths based on a task hierarchy; (d) Universal representations adapts each layer with a small number of task-specific scaling parameters. Underlying each of these approaches is the assumption of parallel ordering of shared layers (Section 2.2): each one requires aligned sequences of feature extractors across tasks.
22
+
23
+ Importantly, soft ordering is not simply a technical improvement, but a new way of thinking about deep MTL. Learning a different soft ordering of layers for each task amounts to discovering a set of generalizable modules that are assembled in different ways for different tasks. This perspective points to future approaches that train a collection of layers on a set of training tasks, which can then be assembled in novel ways for future unseen tasks. Some of the most striking structural regularities observed in the natural, technological and sociological worlds are those that are repeatedly observed across settings and scales; they are ubiquitous and universal. By forcing shared transformations to occur at matching depths in hierarchical feature extraction, deep MTL falls short of capturing this sort of functional regularity. Soft ordering is thus a step towards enabling deep MTL to realize the diverse array of structural regularities found across complex tasks drawn from the real world.
24
+
25
+ # 2 PARALLEL ORDERING OF LAYERS IN DEEP MTL
26
+
27
+ This section presents a high-level classification of existing deep MTL approaches (Sec. 2.1) that is sufficient to expose the reliance of these approaches on the parallel ordering assumption (Sec. 2.2).
28
+
29
+ # 2.1 A CLASSIFICATION OF EXISTING APPROACHES TO DEEP MULTITASK LEARNING
30
+
31
+ Designing a deep MTL system requires answering the key question: How should learned parameters be shared across tasks? The landscape of existing deep MTL approaches can be organized based on how they answer this question at the joint network architecture level (Figure 1).
32
+
33
+ Classical approaches. Neural network MTL was first introduced in the case of shallow networks (Caruana, 1998), before deep networks were prevalent. The key idea was to add output neurons to predict auxiliary labels for related tasks, which would act as regularizers for the hidden representation. Many deep learning extensions remain close in nature to this approach, learning a shared representation at a high-level layer, followed by task-specific (i.e., unshared) decoders that extract labels for each task (Devin et al., 2016; Dong et al., 2015; Huang et al., 2013; 2015; Jaderberg et al., 2017; Liu et al., 2015a; Ranjan et al., 2016; Wu et al., 2015; Zhang et al., 2014) (Figure 1a). This approach can be extended to task-specific input encoders (Devin et al., 2016; Luong et al., 2016), and the underlying single-task model may be adapted to ease task integration (Ranjan et al., 2016; Wu et al., 2015), but the core network is still shared in its entirety.
34
+
35
+ Column-based approaches. Column-based approaches (Jou and Chang, 2016; Misra et al., 2016; Rusu et al., 2016; Yang and Hospedales, 2017), assign each task its own layer of task-specific parameters at each shared depth (Figure 1b). They then define a mechanism for sharing parameters between tasks at each shared depth, e.g., by having a shared tensor factor across tasks (Yang and Hospedales, 2017), or allowing some form of communication between columns (Jou and Chang,
36
+
37
+ 2016; Misra et al., 2016; Rusu et al., 2016). Observations of negative effects of sharing in columnbased methods (Rusu et al., 2016) can be attributed to mismatches between the features required at the same depth between tasks that are too dissimilar.
38
+
39
+ Supervision at custom depths. There may be an intuitive hierarchy describing how a set of tasks are related. Several approaches integrate supervised feedback from each task at levels consistent with such a hierarchy (Hashimoto et al., 2016; Toshniwal et al., 2017; Zhang and Weiss, 2016) (Figure 1c). This method can be sensitive to the design of the hierarchy (Toshniwal et al., 2017), and to which tasks are included therein (Hashimoto et al., 2016). One approach learns a task-relationship hierarchy during training (Lu et al., 2017), though learned parameters are still only shared across matching depths. Supervision at custom depths has also been extended to include explicit recurrence that reintegrates information from earlier predictions (Bilen and Vedaldi, 2016; Zamir et al., 2016). Although these recurrent methods still rely on pre-defined hierarchical relationships between tasks, they provide evidence of the potential of learning transformations that have a different function for different tasks at different depths, i.e., in this case, at different depths unrolled in time.
40
+
41
+ Universal representations. One approach shares all core model parameters except batch normalization scaling factors (Bilen and Vedaldi, 2017) (Figure 1d). When the number of classes is equal across tasks, even output layers can be shared, and the small number of task-specific parameters enables strong performance to be maintained. This method was applied to a diverse array of vision tasks, demonstrating the power of a small number of scaling parameters in adapting layer functionality for different tasks. This observation helps to motivate the method developed in Section 3.
42
+
43
+ # 2.2 THE PARALLEL ORDERING ASSUMPTION
44
+
45
+ A common interpretation of deep learning is that layers extract progressively higher level features at later depths (Lecun et al., 2015). A natural assumption is then that the learned transformations that extract these features are also tied to the depth at which they are learned. The core assumption motivating MTL is that regularities across tasks will result in learned transformations that can be leveraged to improve generalization. However, the methods reviewed in Section 2.1 add the further assumption that subsequences of the feature hierarchy align across tasks and sharing between tasks occurs only at aligned depths (Figure 1); we call this the parallel ordering assumption.
46
+
47
+ Consider $T$ tasks $t _ { 1 } , \dots , t _ { T }$ to be learned jointly, with each $t _ { i }$ associated with a model $y _ { i } = \mathcal { F } _ { i } ( x _ { i } )$ . Suppose sharing across tasks occurs at $D$ consecutive depths. Let $\mathcal { E } _ { i }$ $( \mathcal { D } _ { i } )$ be $t _ { i }$ ’s task-specific encoder (decoder) to (from) the core sharable portion of the network from its inputs (to its outputs). Let $W _ { k } ^ { i }$ be the layer of learned weights (e.g., affine or convolutional) for task $i$ at shared depth $k$ , with $\phi _ { k }$ an optional nonlinearity. The parallel ordering assumption implies
48
+
49
+ $$
50
+ y _ { i } = \left( \mathcal { D } _ { i } \circ \phi _ { D } \circ W _ { D } ^ { i } \circ \phi _ { D - 1 } \circ W _ { D - 1 } ^ { i } \circ \hdots \circ \phi _ { 1 } \circ W _ { 1 } ^ { i } \circ \mathcal { E } _ { i } \right) ( x _ { i } ) , \mathrm { w i t h } W _ { k } ^ { i } \approx W _ { k } ^ { j } \forall ( i , j , k ) .
51
+ $$
52
+
53
+ The approximate equality $\ " \approx \ "$ means that at each shared depth the applied weight tensors for each task are similar and compatible for sharing. For example, learned parameters may be shared across all $W _ { k } ^ { i }$ for a given $k$ , but not between $W _ { k } ^ { i }$ and $W _ { l } ^ { j }$ for any $k \neq l$ . For closely-related tasks, this assumption may be a reasonable constraint. However, as more tasks are added to a joint model, it may be more difficult for each layer to represent features of its given depth for all tasks. Furthermore, for very distant tasks, it may be unreasonable to expect that task feature hierarchies match up at all, even if the tasks are related intuitively. The conjecture explored in this paper is that parallel ordering limits the potential of deep MTL by the strong constraint it enforces on the use of each layer.
54
+
55
+ # 3 DEEP MULTITASK LEARNING WITH SOFT ORDERING OF LAYERS
56
+
57
+ Now that parallel ordering has been identified as a constricting feature of deep MTL approaches, its necessity can be tested, and the resulting observations can be used to develop more flexible methods.
58
+
59
+ 3.1 A FOIL FOR THE PARALLEL ORDERING ASSUMPTION: PERMUTING SHARED LAYERS
60
+
61
+ Consider the most common deep MTL setting: hard-sharing of layers, where each layer in $\{ W _ { k } \} _ { k = 1 } ^ { D }$ is shared in its entirety across all tasks. The baseline deep MTL model for each task $t _ { i }$ is given by
62
+
63
+ $$
64
+ y _ { i } = ( { \mathcal { D } } _ { i } \circ \phi _ { D } \circ W _ { D } \circ \phi _ { D - 1 } \circ W _ { D - 1 } \circ \dots \circ \phi _ { 1 } \circ W _ { 1 } \circ { \mathcal { E } } _ { i } ) ( x _ { i } ) .
65
+ $$
66
+
67
+ ![](images/18d0d580e527b38db1746dbbc59e20f9b3e1651f75947f3541ac1a077477e868.jpg)
68
+ Figure 2: Fitting two random tasks. (a) The dotted lines show that permuted ordering fits $n$ samples as well as parallel fits $n / 2$ for linear networks; (b) For ReLU networks, permuted ordering enjoys a similar advantage. Thus, permuted ordering of shared layers eases integration of information across disparate tasks.
69
+
70
+ This setup satisfies the parallel ordering assumption. Consider now an alternative scheme, equivalent to the above, except with learned layers applied in different orders for different task. That is,
71
+
72
+ $$
73
+ y _ { i } = \big ( \mathscr { D } _ { i } \circ \phi _ { D } \circ W _ { \rho _ { i } ( D ) } \circ \phi _ { D - 1 } \circ W _ { \rho _ { i } ( D - 1 ) } \circ \dots \circ \phi _ { 1 } \circ W _ { \rho _ { i } ( 1 ) } \circ \mathcal { E } _ { i } \big ) \big ( x _ { i } \big ) ,
74
+ $$
75
+
76
+ where $\rho _ { i }$ is a task-specific permutation of size $D$ , and $\rho _ { i }$ is fixed before training. If there are sets of tasks for which joint training of the model defined by Eq. 3 achieves similar or improved performance over Eq. 2, then parallel ordering is not a necessary requirement for deep MTL. Of course, in this formulation, it is required that the $W _ { k }$ can be applied in any order. See Section 6 for examples of possible generalizations.
77
+
78
+ Note that this multitask permuted ordering differs from an approach of training layers in multiple orders for a single task. The single-task case results in a model with increased commutativity between layers, a behavior that has also been observed in residual networks (Veit et al., 2016), whereas here the result is a set of layers that are assembled in different ways for different tasks.
79
+
80
+ # 3.2 THE INCREASED EXPRESSIVITY OF PERMUTED ORDERING
81
+
82
+ Fitting tasks of random patterns. Permuted ordering is evaluated by comparing it to parallel ordering on a set of tasks. Randomly generated tasks (similar to (Kirkpatrick et al., 2017)) are the most disparate possible tasks, in that they share minimal information, and thus help build intuition for how permuting layers could help integrate information in broad settings. The following experiments investigate how accurately a model can jointly fit two tasks of $n$ samples. The data set for task $t _ { i }$ is $\{ ( x _ { i j } , y _ { i j } ) \} _ { j = 1 } ^ { n }$ , with each $x _ { i j }$ drawn uniformly from $[ 0 , 1 ] ^ { m }$ , and each $y _ { i j }$ drawn uniformly from $\{ 0 , 1 \}$ . There are two shared learned affine layers $W _ { k } : \mathbb { R } ^ { m } \mathbb { R } ^ { m }$ . The models with permuted ordering (Eq. 3) are given by
83
+
84
+ $$
85
+ y _ { 1 } = ( O \circ \phi \circ W _ { 2 } \circ \phi \circ W _ { 1 } ) ( x _ { 1 } ) { \mathrm { ~ a n d ~ } } y _ { 2 } = ( O \circ \phi \circ W _ { 1 } \circ \phi \circ W _ { 2 } ) ( x _ { 2 } ) ,
86
+ $$
87
+
88
+ where $O$ is a final shared classification layer. The reference parallel ordering models are defined identically, but with $W _ { k }$ in the same order for both tasks. Note that fitting the parallel model with $n$ samples is equivalent to a single-task model with $2 n$ . In the first experiment, $m \ : = \ : 1 2 8$ and $\phi = I$ . Although adding depth does not add expressivity in the single-task linear case, it is useful for examining the effects of permuted ordering, and deep linear networks are known to share properties with nonlinear networks (Saxe et al., 2013). In the second experiment, $m = 1 6$ and $\phi = \mathrm { R e L U }$ .
89
+
90
+ The results are shown in Figure 2. Remarkably, in the linear case, permuted ordering of shared layers does not lose accuracy compared to the single-task case. A similar gap in performance is seen in the nonlinear case, indicating that this behavior extends to more powerful models. Thus, the learned permuted layers are able to successfully adapt to their different orderings in different tasks.
91
+
92
+ Looking at conditions that make this result possible can shed further light on this behavior. For instance, consider $T$ tasks $t _ { 1 } , \dots , t _ { T }$ , with input and output size both $m$ , and optimal linear solutions $F _ { 1 } , \ldots , F _ { T }$ , respectively. Let $F _ { 1 } , \dots , F _ { T }$ be $m \times m$ matrices, and suppose there exist matrices
93
+
94
+ ![](images/37be84aa7f5a2e6f13e16f2ad46a4a5144deab0453ab219808c5e18d87231462.jpg)
95
+ Figure 3: Soft ordering of shared layers. Sample soft ordering network with three shared layers. Soft ordering (Eq. 7) generalizes Eqs. 2 and 3, by learning a tensor $S$ of task-specific scaling parameters. $S$ is learned jointly with the $F _ { j }$ , to allow flexible sharing across tasks and depths. The $F _ { j }$ in this figure each include a shared weight layer and any nonlinearity. This architecture enables the learning of layers that are used in different ways at different depths for different tasks.
96
+
97
+ $G _ { 1 } , \ldots , G _ { T }$ such that $F _ { i } = G _ { i } G _ { ( i + 1 \bmod T ) } \dots G _ { ( i - 1 \bmod T ) } \forall i$ . Then, because the matrix trace is invariant under cyclic permutations, the constraint arises that
98
+
99
+ $$
100
+ \operatorname { t r } ( F _ { 1 } ) = \operatorname { t r } ( F _ { 2 } ) = . . . = \operatorname { t r } ( F _ { T } ) .
101
+ $$
102
+
103
+ In the case of random matrices induced by the random tasks above, the traces of the $F _ { i }$ are all equal in expectation and concentrate well as their dimensionality increases. So, the restrictive effect of Eq. 5 on the expressivity of permuted ordering here is negligible.
104
+
105
+ Adding a small number of task-specific scaling parameters. Of course, real world tasks are generally much more structured than random ones, so such reliable expressivity of permuted ordering might not always be expected. However, adding a small number of task-specific scaling parameters can help adapt learned layers to particular tasks. This observation has been previously exploited in the parallel ordering setting, for learning task-specific batch normalization scaling parameters (Bilen and Vedaldi, 2017) and controlling communication between columns (Misra et al., 2016). Similarly, in the permuted ordering setting, the constraint induced by Eq. 5 can be reduced by adding task-specific scalars $\{ s _ { i } \} _ { i = 2 } ^ { T }$ such that $F _ { i } = s _ { i } G _ { i } G _ { ( i + 1 \bmod T ) } \dots G _ { ( i - 1 \bmod T ) }$ , and $s _ { 1 } = 1$ . The constraint given by Eq. 5 then reduces to
106
+
107
+ $$
108
+ \mathrm { t r } \big ( F _ { i } / { } s _ { i } \big ) = \mathrm { t r } \big ( F _ { i + 1 } / { } s _ { i + 1 } \big ) \forall 1 \leq i < T \implies s _ { i + 1 } = s _ { i } \big ( \mathrm { t r } ( F _ { i + 1 } ) \big / \mathrm { t r } ( F _ { i } ) \big ) ,
109
+ $$
110
+
111
+ which are defined when $\mathrm { t r } ( F _ { i } ) \ne 0 \forall i < T$ . Importantly, the number of task-specific parameters does not depend on $m$ , which is useful for scalability as well as encouraging maximal sharing between tasks. The idea of using a small number of task-specific scaling parameters is incorporated in the soft ordering approach introduced in the next section.
112
+
113
+ # 3.3 SOFT ORDERING OF SHARED LAYERS
114
+
115
+ Permuted ordering tests the parallel ordering assumption, but still fixes an a priori layer ordering for each task before training. Here, a more flexible soft ordering approach is introduced, which allows jointly trained models to learn how layers are applied while simultaneously learning the layers themselves. Consider again a core network of depth $D$ with layers $W _ { 1 } , \ldots , W _ { D }$ learned and shared across tasks. The soft ordering model for task $t _ { i }$ is defined as follows:
116
+
117
+ $$
118
+ y _ { i } ^ { k } = \sum _ { j = 1 } ^ { D } s _ { ( i , j , k ) } ( \phi _ { k } [ W _ { j } ( y _ { i } ^ { k - 1 } ) ] ) , \mathrm { ~ w i t h ~ } \sum _ { j = 1 } ^ { D } s _ { ( i , j , k ) } = 1 \forall ( i , k ) ,
119
+ $$
120
+
121
+ where $y _ { i } ^ { 0 } = \mathcal { E } _ { i } ( x _ { i } )$ , $y _ { i } = \mathcal { D } _ { i } ( y _ { i } ^ { D } )$ , and each $s _ { ( i , j , k ) }$ is drawn from $S$ : a tensor of learned scales for each task $t _ { i }$ for each layer $W _ { j }$ at each depth $k$ . Figure 3 shows an example of a resulting depth three model. Motivated by Section 3.2 and previous work (Misra et al., 2016), $S$ adds only $D ^ { 2 }$ scaling parameters per task, which is notably not a function of the size of any $W _ { j }$ . The constraint that all $s _ { ( i , j , k ) }$ sum to 1 for any $( i , k )$ is implemented via softmax, and emphasizes the idea that a soft ordering is what is being learned; in particular, this formulation subsumes any fixed layer ordering $\rho _ { i }$ by $s _ { ( i , \rho _ { i } ( k ) , k ) } = 1 \bar { \forall } ( i , k )$ . $S$ can be learned jointly with the other learnable parameters in the $W _ { k }$ , $\mathcal { E } _ { i }$ , and $\mathcal { D } _ { i }$ via backpropagation. In training, all $s _ { ( i , j , k ) }$ are initialized with equal values, to reduce initial bias of layer function across tasks. It is also helpful to apply dropout after each shared layer. Aside from its usual benefits (Srivastava et al., 2014), dropout has been shown to be useful in increasing the generalization capacity of shared representations (Devin et al., 2016). Since the trained layers in Eq. 7 are used for different tasks and in different locations, dropout makes them more robust to supporting different functionalities. These ideas are tested empirically on the MNIST, UCI, Omniglot, and CelebA data sets in the next section.
122
+
123
+ # 4 EMPIRICAL EVALUATION OF SOFT LAYER ORDERING
124
+
125
+ These experiments evaluate soft ordering against fixed ordering MTL and single-task learning. The first experiment applies them to intuitively related MNIST tasks, the second to “superficially unrelated” UCI tasks, the third to the real-world problem of Omniglot character recognition, and the fourth to large-scale facial attribute recognition. In each experiment, single task, parallel ordering (Eq. 2), permuted ordering (Eq. 3), and soft ordering (Eq. 7) train an equivalent set of core layers. In permuted ordering, the order of layers were randomly generated for each task each trial. See Appendix A for additional details, including additional details specific to each experiment.
126
+
127
+ 4.1 DISENTANGLING RELATED TASKS: MNIST DIGIT $^ 1$ -VS.-DIGIT $^ 2$ BINARY CLASSIFICATION
128
+
129
+ This experiment evaluates the ability of multitask methods to exploit tasks that are intuitively related, but have disparate input representations. Binary classification problems derived from the MNIST hand-written digit dataset are a common test bed for evaluating deep learning methods that require multiple tasks (Fernando et al., 2017; Kirkpatrick et al., 2017; Yang and Hospedales, 2017). Here, the goal of each task is to distinguish between two distinct randomly selected digits. To create initial dissimilarity across tasks that multitask models must disentangle, each $\mathcal { E } _ { i }$ is a random frozen fullyconnected ReLU layer with output size 64. There are four core layers, each a fully-connected ReLU layer with 64 units. Each $\mathcal { D } _ { i }$ is an unshared dense layer with a single sigmoid classification output.
130
+
131
+ ![](images/be1ea50055988d5088c4103bfcec74edb6832241175098b4dc3e6efbf807bb82.jpg)
132
+ Figure 4: MNIST results. (a) Relative performance of permuted and soft ordering compared to parallel ordering improves as the number of tasks increases, showing how flexibility of order can help in scaling to more tasks. Note that cost savings of multitask over single task models in terms of number of trainable parameters scales linearly with the number of tasks. For a representative two-task soft order experiment (b) the layer-wise distance between scalings of the tasks increases by iteration, and (c) the scalings move towards a hard ordering. (d) The final learned relative scale of each shared layer at each depth for each task is indicated by shading, with the strongest path drawn, showing that a distinct soft order is learned for each task (• marks the shared model boundary).
133
+
134
+ Results are shown in Figure 4. The relative performance of permuted ordering and soft ordering compared to parallel ordering increases with the number of tasks trained jointly (Figure 4a), showing how flexibility of order can help in scaling to more tasks. This result is consistent with the hypothesis that parallel ordering has increased negative effects as the number of tasks increases. Figure 4bd show what soft ordering actually learns: The scalings for tasks diverge as layers specialize to different functions for different tasks.
135
+
136
+ Figure 5: UCI data sets and results. (a) The ten UCI tasks used in joint training; the varying types of problems and dataset characteristics show the diversity of this set of tasks. (b) Mean test error over all ten tasks by iteration. Permuted and parallel order show no improvement after the first 1000 iterations, while soft order decisively outperforms the other methods.
137
+
138
+ <table><tr><td>Dataset</td><td>Input Features</td><td>Output classes</td><td>Samples</td></tr><tr><td>Australian credit</td><td>14</td><td>2</td><td>690</td></tr><tr><td>Breast cancer</td><td>30</td><td>2</td><td>569</td></tr><tr><td>Ecoli</td><td>7</td><td>8</td><td>336</td></tr><tr><td>German credit</td><td>24</td><td>2</td><td>1000</td></tr><tr><td>Heart disease</td><td>13</td><td>5</td><td>303</td></tr><tr><td>Hepatitis</td><td>19</td><td>2</td><td>155</td></tr><tr><td>Iris</td><td>4</td><td>3</td><td>150</td></tr><tr><td>Pima diabetes</td><td>8</td><td>2</td><td>768</td></tr><tr><td>Wine</td><td>13</td><td>3</td><td>178</td></tr><tr><td>Yeast</td><td>8</td><td>10</td><td>1484</td></tr></table>
139
+
140
+ ![](images/5500de8ff21b0ce07d1f224a6029810c53d475eb180bc037d711a660e64ecfba.jpg)
141
+
142
+ 4.2 SUPERIFICALLY UNRELATED TASKS: JOINT TRAINING OF TEN POPULAR UCI DATASETS
143
+
144
+ The next experiment evaluates the ability of soft ordering to integrate information across a diverse set of “superficially unrelated” tasks (Mahmud and Ray, 2008), i.e., tasks with no immediate intuition for how they may be related. Ten tasks are taken from some of most popular UCI classification data sets (Lichman, 2013). Descriptions of these tasks are given in Figure 5a. Inputs and outputs have no a priori shared meaning across tasks. Each $\mathcal { E } _ { i }$ is a learned fully-connected ReLU layer with output size 32. There are four core layers, each a fully-connected ReLU layer with 32 units. Each $\mathcal { D } _ { i }$ is an unshared dense softmax layer for the given number of classes. The results in Figure 5(b) show that, while parallel and permuted show no improvement in error after the first 1000 iterations, soft ordering significantly outperforms the other methods. With this flexible layer ordering, the model is eventually able to exploit significant regularities underlying these seemingly disparate domains.
145
+
146
+ # 4.3 EXTENSION TO CONVOLUTIONS: MULTI-ALPHABET CHARACTER RECOGNITION
147
+
148
+ The Omniglot dataset (Lake et al., 2015) consists of fifty alphabets, each of which induces a different character recognition task. Deep MTL approaches have recently shown promise on this dataset (Yang and Hospedales, 2017). It is a useful benchmark for MTL because the large number of tasks allows analysis of performance as a function of the number of tasks trained jointly, and there is clear intuition for how knowledge of some alphabets will increase the ability to learn others. Omniglot is also a good setting for evaluating the ability of soft ordering to learn how to compose layers in different ways for different tasks: it was developed as a problem with inherent composibility, e.g., similar kinds of strokes are applied in different ways to draw characters from different alphabets (Lake et al., 2015). Consequently, it has been used as a test bed for deep generative models (Rezende et al., 2016). To evaluate performance for a given number of tasks $T$ , a single random ordering of tasks was created, from which the first $T$ tasks are considered. Train/test splits are created in the same way as previous work (Yang and Hospedales, 2017), using $10 \%$ or $20 \%$ of data for testing.
149
+
150
+ This experiment is a scale-up of the previous experiments in that it evaluates soft ordering of convolutional layers. The models are made as close as possible in architecture to previous work (Yang and Hospedales, 2017), while allowing soft ordering to be applied. There are four core layers, each convolutional followed by max pooling. $\mathcal { E } _ { i } ( x _ { i } ) = x _ { i } \forall i$ , and each $\mathcal { D } _ { i }$ is a fully-connected softmax layer with output size equal to the number of classes. The results show that soft ordering is able to consistently outperform other deep MTL approaches (Figure 6). The improvements are robust to the number of tasks (Figure 6a) and the amount of training data (Figure 6c), suggesting that soft ordering, not task complexity or model complexity, is responsible for the improvement.
151
+
152
+ Permuted ordering performs significantly worse than parallel ordering in this domain. This is not surprising, as deep vision systems are known to induce a common feature hierarchy, especially within the first couple of layers (Lee et al., 2008; Lecun et al., 2015). Parallel ordering has this hierarchy built in; for permuted ordering it is more difficult to exploit. However, the existence of this feature hierarchy does not preclude the possibility that the functions (i.e., layers) used to produce the hierarchy may be useful in other contexts. Soft ordering allows the discovery of such uses. Figure 6b shows how each layer is used more or less at different depths. The soft ordering model learns a “soft hierarchy” of layers, in which each layer has a distribution of increased or decreased usage at each depth. In this case, the usage of each layer is correlated (or inversely correlated) with depth. For instance, the usage of Layer 3 decreases as the depth increases, suggesting that its primary purpose is low-level feature extraction, though it is still sees substantial use in deeper contexts. Section 5 describes an experiment that further investigates the behavior of a single layer in different contexts.
153
+
154
+ ![](images/bfd065f8c6423bb009328ca630d4ab1d8a26e919da9bc074084e1621dabdf36f.jpg)
155
+ Figure 6: Omniglot results. (a) Error by number of tasks trained jointly. Soft ordering significantly outperforms single task and both fixed ordering approaches for each number of tasks; (b) Distribution of learned layer usage by depth across all 50 tasks for a soft order run. The usage of each layer is correlated (or inversely correlated) with depth. This coincides with the understanding that there is some innate hierarchy in convolutional networks, which soft ordering is able to discover. For instance, the usage of Layer 3 decreases as the depth increases, suggesting that its primary purpose is low-level feature extraction, though it is still sees substantial use in deeper contexts; (c) Errors with all 50 tasks for different training set sizes. The first five methods are previous deep MTL results (Yang and Hospedales, 2017), which use multitask tensor factorization methods in a shared parallel ordering. Soft ordering significantly outperforms the other approaches, showing the approach scales to real-world tasks requiring specialized components such as convolutional layers.
156
+
157
+ 4.4 LARGE-SCALE APPLICATION: FACIAL ATTRIBUTE RECOGNITION
158
+
159
+ Although facial attributes are all high-level concepts, they do not intuitively exist at the same level of a shared hierarchy (even one that is learned; Lu et al., 2017). Rather, these concepts are related in multiple subtle and overlapping ways in semantic space. This experiment investigates how a soft ordering approach, as a component in a larger system, can exploit these relationships.
160
+
161
+ The CelebA dataset consists of ${ \approx } 2 0 0 \mathrm { K }$ $1 7 8 \times 2 1 8$ color images, each with binary labels for 40 facial attributes (Liu et al., 2015b). In this experiment, each label defines a task, and parallel and soft order models are based on a ResNet-50 vision model (He et al., 2016), which has also been used in recent state-of-the-art approaches to CelebA (Günther et al., 2017; He et al., 2017). Let $\mathcal { E } _ { i }$ be a ResNet-50 model truncated to the final average pooling layer, followed by a linear layer projecting the embedding to size 256. $\mathcal { E } _ { i }$ is shared across all tasks. There are four core layers, each a dense ReLU layer with 256 units. Each $\mathcal { D } _ { i }$ is an unshared dense sigmoid layer. Parallel ordering and soft ordering models were compared. To further test the robustness of learning, models were trained with and without the inclusion of an additional facial landmark detection regression task. Soft order models were also tested with and without the inclusion of a fixed identity layer at each depth. The identity layer can increase consistency of representation across contexts, which can ease learning of each layer, while also allowing soft ordering to tune how much total non-identity transformation to use for each individual task. This is especially relevant for the case of attributes, since different tasks can have different levels of complexity and abstraction.
162
+
163
+ The results are given in Figure 7c. Existing work that used a ResNet-50 vision model showed that using a parallel order multitask model improved test error over single-task learning from 10.37 to 9.58 (He et al., 2017). With our faster training strategy and the added core layers, our parallel ordering model achieves a test error of 10.21. The soft ordering model yielded a substantial improvement beyond this to 8.79, demonstrating that soft ordering can add value to a larger deep learning system. Including landmark detection yielded a marginal improvement to 8.75, while for parallel ordering it degraded performance slightly, indicating that soft ordering is more robust to joint training of diverse kinds of tasks. Including the identity layer improved performance to 8.64, though with both the landmark detection and the identity layer this improvement was slightly diminished. One explanation for this degredation is that the added flexibility provided by the identity layer offsets the regularization provided by landmark detection. Note that previous work has shown that adaptive weighting of task loss (He et al., 2017; Rudd et al., 2016), data augmentation and ensembling (Günther et al., 2017), and a larger underlying vision model (Lu et al., 2017) each can also yield significant improvements. Aside from soft ordering, none of these improvements alter the multitask topology, so their benefits are expected to be complementary to that of soft ordering demonstrated in this experiment. By coupling them with soft ordering, greater improvements should be possible.
164
+
165
+ ![](images/5a71757820af176e6415d72244b5e789480cc38d7c7799bc29e599a8f79fd31f.jpg)
166
+ Figure 7: CelebA results. Layer usage by depth (a) without and (b) with inclusion of the identity layer. In both cases, layers with lower usage at lower depths have higher usage at higher depths, and vice versa. The identity layer almost always sees increased usage; its application can increase consistency of representation across contexts. (c) Soft order models achieve a significant improvement over parallel ordering, and receive a boost from including the identity layer. The first two rows are previous work with ResNet-50 that show their baseline improvement from single task to multitask.
167
+
168
+ <table><tr><td>Deep MTL method</td><td>Test Error %</td></tr><tr><td>Single Task (He et al.,2017)</td><td>10.37</td></tr><tr><td>MTL Baseline (He et al.,2017)</td><td>9.58</td></tr><tr><td>Parallel Order</td><td>10.21</td></tr><tr><td>Parallel Order + Landmarks</td><td>10.29</td></tr><tr><td>Soft Order</td><td>8.79</td></tr><tr><td>Soft Order + Landmarks</td><td>8.75</td></tr><tr><td>Soft Order + Identity</td><td>8.64</td></tr><tr><td>Soft Order + Landmarks + Identity</td><td>8.68</td></tr></table>
169
+
170
+ Figures 7a-b characterize the usage of each layer learned by soft order models. Like in the case of Omniglot, layers that are used less at lower depths are used more at higher depths, and vice versa, giving further evidence that the models learn a “soft hierarchy” of layer usage. When the identity layer is included, its usage is almost always increased through training, as it allows the model to use smaller specialized proportions of nonlinear structure for each individual task.
171
+
172
+ # 5 VISUALIZING THE BEHAVIOR OF SOFT ORDERING LAYERS
173
+
174
+ The success of soft layer ordering suggests that layers learn functional primitives with similar effects in different contexts. To explore this idea qualitatively, the following experiment uses generative visual tasks. The goal of each task is to learn a function $( x , y ) \to v$ , where $( x , y )$ is a pixel coordinate and $v$ is a brightness value, all normalized to [0, 1]. Each task is defined by a single image of a “4” drawn from the MNIST dataset; all of its pixels are used as training data. Ten tasks are trained using soft ordering with four shared dense ReLU layers of 100 units each. $\mathcal { E } _ { i }$ is a linear encoder that is shared across tasks, and $\mathcal { D } _ { i }$ is a global average pooling decoder. Thus, task models are distinguished completely by their learned soft ordering scaling parameters $s _ { t }$ . To visualize the behavior of layer $l$ at depth $d$ for task $t$ , the predicted image for task $t$ is generated across varying magnitudes of $\mathbf { \sigma } ^ { s } ( t , l , d ) \cdot$ . The results for the first two tasks and the first layer are shown in Table 1. Similar function is observed in each of the six contexts, suggesting that the layers indeed learn functional primitives.
175
+
176
+ ![](images/850e349ffb192a29d5b3083a0953bce9d02e9cbf83bfa99d956e730ace5670ed.jpg)
177
+ Table 1: Example behavior of a soft order layer. For each task $t$ , and at each depth $d$ , the effect of increasing the activation of of this particular layer is to expand the left side of the $" 4 "$ in a manner appropriate to the functional context (e.g., the magnitude of the effect decreases with depth). Results for other layers are similar, suggesting that the layers implement functional primitives.
178
+
179
+ # 6 DISCUSSION AND FUTURE WORK
180
+
181
+ In the interest of clarity, the soft ordering approach in this paper was developed as a relatively small step away from the parallel ordering assumption. To develop more practical and specialized methods, inspiration can be taken from recurrent architectures, the approach can be extended to layers of more general structure, and applied to training and understanding general functional building blocks.
182
+
183
+ Connections to recurrent architectures. Eq. 7 is defined recursively with respect to the learned layers shared across tasks. Thus, the soft-ordering architecture can be viewed as a new type of recurrent architecture designed specifically for MTL. From this perspective, Figure 3 shows an unrolling of a soft layer module: different scaling parameters are applied at different depths when unrolled for different tasks. Since the type of recurrence induced by soft ordering does not require task input or output to be sequential, methods that use recurrence in such a setting are of particular interest (Liang and Hu, 2015; Liao and Poggio, 2016; Pinheiro and Collobert, 2014; Socher et al., 2011; Zamir et al., 2016). Recurrent methods can also be used to reduce the size of $S$ below $O ( T D ^ { 2 } )$ , e.g., via recurrent hypernetworks (Ha et al., 2016). Finally, Section 4 demonstrated soft ordering where shared learned layers were fully-connected or convolutional; it is also straightforward to extend soft ordering to shared layers with internal recurrence, such as LSTMs (Hochreiter and Schmidhuber, 1997). In this setting, soft ordering can be viewed as inducing a higher-level recurrence.
184
+
185
+ Generalizing the structure of shared layers. For clarity, in this paper all core layers in a given setup had the same shape. Of course, it would be useful to have a generalization of soft ordering that could subsume any modern deep architecture with many layers of varying structure. As given by Eq. 7, soft ordering requires the same shape inputs to the element-wise sum at each depth. Reshapes and/or resampling can be added as adapters between tensors of different shape; alternatively, a function other than a sum could be used. For example, instead of learning a weighting across layers at each depth, a probability of applying each module could be learned in a manner similar to adaptive dropout (Ba and Frey, 2013; Li et al., 2016) or a sparsely-gated mixture of experts (Shazeer et al., 2017). Furthermore, the idea of a soft ordering of layers can be extended to soft ordering over modules with more general structure, which may more succinctly capture recurring modularity.
186
+
187
+ Training generalizable building blocks. Because they are used in different ways at different locations for different tasks, the shared trained layers in permuted and soft ordering have learned more general functionality than layers trained in a fixed location or for a single task. A natural hypothesis is that they are then more likely to generalize to future unseen tasks, perhaps even without further training. This ability would be especially useful in the small data regime, where the number of trainable parameters should be limited. For example, given a collection of these layers trained on a previous set of tasks, a model for a new task could learn how to apply these building blocks, e.g., by learning a soft order, while keeping their internal parameters fixed. Learning an efficient set of such generalizable layers would then be akin to learning a set of functional primitives. Such functional modularity and repetition is evident in the natural, technological and sociological worlds, so such a set of functional primitives may align well with complex real-world models. This perspective is related to recent work in reusing modules in the parallel ordering setting (Fernando et al., 2017). The different ways in which different tasks learn to use the same set of modules can also help shed light on how tasks are related, especially those that seem superficially disparate (e.g., by extending the analysis performed for Figure 4d), thus assisting in the discovery of real-world regularities.
188
+
189
+ # 7 CONCLUSION
190
+
191
+ This paper has identified parallel ordering of shared layers as a common assumption underlying existing deep MTL approaches. This assumption restricts the kinds of shared structure that can be learned between tasks. Experiments demonstrate how direct approaches to removing this assumption can ease the integration of information across plentiful and diverse tasks. Soft ordering is introduced as a method for learning how to apply layers in different ways at different depths for different tasks, while simultaneously learning the layers themselves. Soft ordering is shown to outperform parallel ordering methods as well as single-task learning across a suite of domains. These results show that deep MTL can be improved while generating a compact set of multipurpose functional primitives, thus aligning more closely with our understanding of complex real-world processes.
192
+
193
+ # ACKNOWLEDGMENTS
194
+
195
+ We would like to thank Matt Feiszli for valuable discussions and all anonymous reviewers for their helpful feedback.
196
+
197
+ # REFERENCES
198
+
199
+ M. Abadi, A. Agarwal, P. Barham, E. Brevdo, Z. Chen, C. Citro, G. S. Corrado, A. Davis, J. Dean, M. Devin, S. Ghemawat, I. Goodfellow, A. Harp, G. Irving, M. Isard, Y. Jia, R. Jozefowicz, L. Kaiser, M. Kudlur, J. Levenberg, D. Mané, R. Monga, S. Moore, D. Murray, C. Olah, M. Schuster, J. Shlens, B. Steiner, I. Sutskever, K. Talwar, P. Tucker, V. Vanhoucke, V. Vasudevan, F. Viégas, O. Vinyals, P. Warden, M. Wattenberg, M. Wicke, Y. Yu, and X. Zheng. TensorFlow: Large-scale machine learning on heterogeneous systems, 2015. URL http://tensorflow.org/. Software available from tensorflow.org.
200
+ J. Ba and B. Frey. Adaptive dropout for training deep neural networks. In NIPS, pages 3084–3092. 2013.
201
+ H. Bilen and A. Vedaldi. Integrated perception with recurrent multi-task neural networks. In NIPS, pages 235–243. 2016.
202
+ H. Bilen and A. Vedaldi. Universal representations: The missing link between faces, text, planktons, and cat breeds. CoRR, abs/1701.07275, 2017.
203
+ R. Caruana. Multitask learning. In Learning to learn, pages 95–133. Springer US, 1998.
204
+ F. Chollet et al. Keras, 2015.
205
+ R. Collobert and J. Weston. A unified architecture for natural language processing: Deep neural networks with multitask learning. In ICML, pages 160–167, 2008.
206
+ C. Devin, A. Gupta, T. Darrell, P. Abbeel, and S. Levine. Learning modular neural network policies for multitask and multi-robot transfer. CoRR, abs/1609.07088, 2016.
207
+ D. Dong, H. Wu, W. He, D. Yu, and H. Wang. Multi-task learning for multiple language translation. In ACL, pages 1723–1732, 2015.
208
+ C. Fernando, D. Banarse, C. Blundell, Y. Zwols, D. Ha, A. A. Rusu, A. Pritzel, and D. Wierstra. Pathnet: Evolution channels gradient descent in super neural networks. CoRR, abs/1701.08734, 2017.
209
+ M. Günther, A. Rozsa, and T. E. Boult. AFFACT - alignment free facial attribute classification technique. CoRR, abs/1611.06158v2, 2017.
210
+ D. Ha, A. M. Dai, and Q. V. Le. Hypernetworks. CoRR, abs/1609.09106, 2016.
211
+ K. Hashimoto, C. Xiong, Y. Tsuruoka, and R. Socher. A joint many-task model: Growing a neural network for multiple NLP tasks. CoRR, abs/1611.01587, 2016.
212
+ K. He, X. Zhang, S. Ren, and J. Sun. Deep residual learning for image recognition. In CVPR, pages 770–778, 2016.
213
+ K. He, Z. Wang, Y. Fu, R. Feng, Y.-G. Jiang, and X. Xue. Adaptively weighted multi-task deep network for person attribute classification. 2017.
214
+ S. Hochreiter and J. Schmidhuber. Long short-term memory. Neural Computation, 9(8):1735–1780, 1997. ISSN 0899-7667.
215
+ J. T. Huang, J. Li, D. Yu, L. Deng, and Y. Gong. Cross-language knowledge transfer using multilingual deep neural network with shared hidden layers. In ICASSP, pages 7304–7308, 2013.
216
+ Z. Huang, J. Li, S. M. Siniscalchi, I.-F. Chen, J. Wu, and C.-H. Lee. Rapid adaptation for deep neural networks through multi-task learning. In INTERSPEECH, 2015.
217
+ M. Jaderberg, V. Mnih, W. M. Czarnecki, T. Schaul, J. Z. Leibo, D. Silver, and K. Kavukcuoglu. Reinforcement learning with unsupervised auxiliary tasks. In ICLR, 2017.
218
+ B. Jou and S.-F. Chang. Deep cross residual learning for multitask visual recognition. In MM, pages 998–1007, 2016.
219
+ D. P. Kingma and J. Ba. Adam: A method for stochastic optimization. CoRR, abs/1412.6980, 2014.
220
+ J. Kirkpatrick, R. Pascanu, N. Rabinowitz, J. Veness, et al. Overcoming catastrophic forgetting in neural networks. PNAS, 114(13):3521–3526, 2017.
221
+ B. M. Lake, R. Salakhutdinov, and J. B. Tenenbaum. Human-level concept learning through probabilistic program induction. Science, 350(6266):1332–1338, 2015.
222
+ Y. Lecun, Y. Bengio, and G. Hinton. Deep learning. Nature, 521(7553):436–444, 2015.
223
+ H. Lee, C. Ekanadham, and A. Y. Ng. Sparse deep belief net model for visual area v2. In NIPS, pages 873–880. 2008.
224
+ Z. Li, B. Gong, and T. Yang. Improved dropout for shallow and deep learning. In NIPS, pages 2523–2531. 2016.
225
+ M. Liang and X. Hu. Recurrent convolutional neural network for object recognition. In CVPR, 2015.
226
+ Q. Liao and T. A. Poggio. Bridging the gaps between residual learning, recurrent neural networks and visual cortex. CoRR, abs/1604.03640, 2016.
227
+ M. Lichman. UCI machine learning repository, 2013.
228
+ X. Liu, J. Gao, X. He, L. Deng, K. Duh, and Y. Y. Wang. Representation learning using multi-task deep neural networks for semantic classification and information retrieval. In NAACL, pages 912–921, 2015a.
229
+ Z. Liu, P. Luo, X. Wang, and X. Tang. Deep learning face attributes in the wild. In Proceedings of International Conference on Computer Vision (ICCV), 2015b.
230
+ Y. Lu, A. Kumar, S. Zhai, Y. Cheng, T. Javidi, and R. S. Feris. Fully-adaptive feature sharing in multi-task networks with applications in person attribute classification. CVPR, 2017.
231
+ M. Luong, Q. V. Le, I. Sutskever, O. Vinyals, and L. Kaiser. Multi-task sequence to sequence learning. In ICLR, 2016.
232
+ M. H. Mahmud. On universal transfer learning. Theoretical Computer Science, 410(19):1826 – 1846, 2009. ISSN 0304-3975.
233
+ M. M. Mahmud and S. Ray. Transfer learning using Kolmogorov complexity: Basic theory and empirical evaluations. In NIPS, pages 985–992. 2008.
234
+ I. Misra, A. Shrivastava, A. Gupta, and M. Hebert. Cross-stitch networks for multi-task learning. In CVPR, 2016.
235
+ P. Pinheiro and R. Collobert. Recurrent convolutional neural networks for scene labeling. In ICML, pages 82–90, 2014.
236
+ R. Ranjan, V. M. Patel, and R. Chellappa. Hyperface: A deep multi-task learning framework for face detection, landmark localization, pose estimation, and gender recognition. CoRR, abs/1603.01249, 2016.
237
+ D. Rezende, Shakir, I. Danihelka, K. Gregor, and D. Wierstra. One-shot generalization in deep generative models. In ICML, pages 1521–1529, 2016.
238
+ E. M. Rudd, M. Günther, and T. E. Boult. MOON: A mixed objective optimization network for the recognition of facial attributes. In ECCV, pages 19–35, 2016.
239
+ A. A. Rusu, N. C. Rabinowitz, G. Desjardins, H. Soyer, et al. Progressive neural networks. CoRR, abs/1606.04671, 2016.
240
+ A. M. Saxe, J. L. McClelland, and S. Ganguli. Exact solutions to the nonlinear dynamics of learning in deep linear neural networks. CoRR, abs/1312.6120, 2013.
241
+ M. L. Seltzer and J. Droppo. Multi-task learning in deep neural networks for improved phoneme recognition. In ICASSP, pages 6965–6969, 2013.
242
+ N. Shazeer, A. Mirhoseini, K. Maziarz, A. Davis, Q. V. Le, G. E. Hinton, and J. Dean. Outrageously large neural networks: The sparsely-gated mixture-of-experts layer. In ICLR, 2017.
243
+ R. Socher, C. C.-Y. Lin, A. Y. Ng, and C. D. Manning. Parsing natural scenes and natural language with recursive neural networks. In ICML, pages 129–136, 2011.
244
+ N. Srivastava, G. Hinton, A. Krizhevsky, I. Sutskever, and R. Salakhutdinov. Dropout: A Simple Way to Prevent Neural Networks from Overfitting. JMLR, 15(1):1929–1958, 2014.
245
+ S. Toshniwal, H. Tang, L. Lu, and K. Livescu. Multitask Learning with Low-Level Auxiliary Tasks for EncoderDecoder Based Speech Recognition. CoRR, abs/1704.01631, 2017.
246
+ A. Veit, M. J. Wilber, and S. Belongie. Residual networks behave like ensembles of relatively shallow networks. In NIPS, pages 550–558. 2016.
247
+ Z. Wu, C. Valentini-Botinhao, O. Watts, and S. King. Deep neural networks employing multi-task learning and stacked bottleneck features for speech synthesis. In ICASSP, pages 4460–4464, 2015.
248
+ Y. Yang and T. Hospedales. Deep multi-task representation learning: A tensor factorisation approach. In ICLR, 2017.
249
+ A. R. Zamir, T. Wu, L. Sun, W. Shen, J. Malik, and S. Saverese. Feedback networks. CoRR, abs/1612.09508, 2016.
250
+ Y. Zhang and D. Weiss. Stack-propagation: Improved representation learning for syntax. CoRR, abs/1603.06598, 2016.
251
+ Z. Zhang, P. Luo, C. C. Loy, and X. Tang. Facial landmark detection by deep multi-task learning. In ECCV, pages 94–108, 2014.
252
+
253
+ # A EXPERIMENTAL DETAILS
254
+
255
+ All experiments were run with the Keras deep learning framework Chollet et al. (2015), using the Tensorflow backend (Abadi et al., 2015). All experiments used the Adam optimizer with default parameters (Kingma and Ba, 2014) unless otherwise specified.
256
+
257
+ In each iteration of multitask training, a random batch for each task is processed, and the results are combined across tasks into a single update. Compared to alternating batches between tasks (Luong et al., 2016), processing all tasks simultaneously simplified the training procedure, and led to faster and lower final convergence. When encoders are shared, the inputs of the samples in each batch are the same across tasks. Cross-entropy loss was used for all classification tasks. The overall validation loss is the sum over all per task validation losses.
258
+
259
+ In each experiment, single task, parallel ordering (Eq. 2), permuted ordering (Eq. 3), and soft ordering (Eq. 7) trained an equivalent set of core layers. In permuted ordering, the order of layers was randomly generated for each task each trial. Several trials were run for each setup to produce confidence bounds.
260
+
261
+ # A.1 MNIST EXPERIMENTS
262
+
263
+ Input pixel values were normalized to be between 0 and 1. The training and test sets for each task were the MNIST train and test sets restricted to the two selected digits. A dropout rate of 0.5 was applied at the output of each core layer. Each setup was trained for 20K iterations, with each batch consisting of 64 samples for each task.
264
+
265
+ When randomly selecting the pairs of digits that define a set of tasks, digits were selected without replacement within a task, and with replacement across tasks, so there were 45 possible tasks, and $4 5 ^ { k }$ possible sets of tasks of size $k$ .
266
+
267
+ # A.2 UCI EXPERIMENTS
268
+
269
+ For all tasks, each input feature was scaled to be between 0 and 1. For each task, training and validation data were created by a random 80-20 split. This split was fixed across trials. A dropout rate of 0.8 was applied at the output of each core layer.
270
+
271
+ # A.3 OMNIGLOT EXPERIMENTS
272
+
273
+ To enable soft ordering, the output of all shared layers must have the same shape. For comparability, the models were made as close as possible in architecture to previous work (Yang and Hospedales, 2017), in which models had four sharable layers, three of which were 2D convolutions followed by $2 \times 2$ max-pooling, of which two had $3 \times 3$ kernels. So, in this experiment, to evaluate soft ordering of convolutional layers, there were four core layers, each a 2D convolutional layer with ReLU activation and kernel size $3 \times 3$ . Each convolutional layer was followed by a $2 \times 2$ maxpooling layer. The number of filters for each convolutional layer was set at 53, which makes the number of total model parameters as close as possible to the reference model. A dropout rate of 0.5 was applied at the output of after each core layer.
274
+
275
+ The Omniglot dataset consists of $1 0 5 \times 1 0 5$ black-and-white images. There are fifty alphabets of characters and twenty images per character. To be compatible with the shapes of shared layers, the input was zero-padded along the third dimension so that its shape was $1 0 5 \times 1 0 5 \times 5 3$ , i.e., with the first $1 0 5 \times 1 0 5$ slice containing the image data and the remainder zeros. To evaluate approaches on $k$ tasks, a random ordering of the fifty tasks was created and fixed across all trials. In each trial, the first $k$ tasks in this ordering were trained jointly for 5000 iterations, with each training batch containing $k$ random samples, one from each task. The fixed ordering of tasks was as follows:
276
+
277
+ [Gujarati, Sylheti, Arcadian, Tibetan, Old Church Slavonic (Cyrillic), Angelic, Malay (Jawi-Arabic), Sanskrit, Cyrillic, Anglo-Saxon Futhorc, Syriac (Estrangelo), Ge’ez, Japanese (katakana), Keble, Manipuri, Alphabet of the Magi, Gurmukhi, Korean, Early Aramaic, Atemayar Qelisayer, Tagalog, Mkhedruli (Georgian), Inuktitut (Canadian Aboriginal Syllabics), Tengwar, Hebrew, N’Ko, Grantha, Latin, Syriac (Serto), Tifinagh, Balinese, Mongolian, ULOG, Futurama, Malayalam, Oriya, Ojibwe (Canadian Aboriginal Syllabics), Avesta, Kannada, Bengali, Japanese (hiragana), Armenian, AurekBesh, Glagolitic, Asomtavruli (Georgian), Greek, Braille, Burmese (Myanmar), Blackfoot (Canadian Aboriginal Syllabics), Atlantean].
278
+
279
+ # A.4 CELEBA EXPERIMENTS
280
+
281
+ The training, validation, and test splits provided by Liu et al. (2015b) were used. There are ${ \approx } 1 6 0 \mathrm { K }$ images for training, ${ \approx } 2 0 \mathrm { K }$ for validation, and ${ \approx } 2 0 \mathrm { K }$ for testing. The dataset contains 20 images of each of approximately ${ \approx } 1 0 \mathrm { K }$ celebrities. The images for a given celebrity occur in only one of the three dataset splits, so models must also generalize to new human identities.
282
+
283
+ The weights for ResNet-50 were initialized with the pre-trained imagenet weights provided in the Keras framework Chollet et al. (2015). Image preprocessing was done with the default Keras image preprocessing function, including resizing all images to $2 2 4 \times 2 2 4$ .
284
+
285
+ The output for the facial landmark detection task is a 10 dimensional vector indicating the $( x , y )$ locations of five landmarks, normalized between 0 and 1. Mean squared error was used as the training loss. When landmark detection is included, the target metric is still attribute classification error. This is because the aligned CelebA images are used, so accurate landmark detection is not a challenge, but including it as an additional task can still provide additional regularization to a multitask model.
286
+
287
+ A dropout rate of 0.5 was applied at the output of after each core layer. The experiments used a batch size of 32. After validation loss converges via Adam, models are trained with RMSProp with learning rate $1 e ^ { - 5 }$ , which is a similar approach to that used by Günther et al. (2017).
288
+
289
+ # A.5 EXPERIMENTS ON VISUALIZING LAYER BEHAVIOR
290
+
291
+ To produce the resulting image for a fixed model, the predictions at each pixel locations were generated, denormalized, and mapped back to the pixel coordinate space. The loss used for this experiment was mean squared error (MSE). Since all pixels for a task image are used for training, there is no sense of generalization to unseen data within a task. As a result, no dropout was used in this experiment.
292
+
293
+ Task models are distinguished completely by their learned soft ordering scaling parameters $s _ { t }$ , so the joint model can be viewed as a generative model which generates different 4’s for varying values of $s _ { t }$ . To visualize the behavior of layer $l$ at depth $d$ for task $t$ , the output of the model for task $t$ was visualized while sweeping $\mathbf { \Xi } ^ { S } ( t , l , d )$ across [0, 1]. To enable this sweeping while keeping the rest of the model behavior fixed, the softmax for each task at each depth was replaced with a sigmoid activation. Note that due to the global avgerage pooling decoder, altering the weight of a single layer has no observable effect at depth four.
md/train/Bkab5dqxe/Bkab5dqxe.md ADDED
@@ -0,0 +1,220 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # A COMPOSITIONAL OBJECT-BASED APPROACH TO LEARNING PHYSICAL DYNAMICS
2
+
3
+ Michael B. Chang\*, Tomer Ullman\*\*, Antonio Torralba\*, and Joshua B. Tenenbaum\*\* \*Department of Electrical Engineering and Computer Science, MIT \*Department of Brain and Cognitive Sciences, MIT {mbchang,tomeru,torralba,jbt}@mit.edu
4
+
5
+ # ABSTRACT
6
+
7
+ We present the Neural Physics Engine (NPE), a framework for learning simulators of intuitive physics that naturally generalize across variable object count and different scene configurations. We propose a factorization of a physical scene into composable object-based representations and a neural network architecture whose compositional structure factorizes object dynamics into pairwise interactions. Like a symbolic physics engine, the NPE is endowed with generic notions of objects and their interactions; realized as a neural network, it can be trained via stochastic gradient descent to adapt to specific object properties and dynamics of different worlds. We evaluate the efficacy of our approach on simple rigid body dynamics in two-dimensional worlds. By comparing to less structured architectures, we show that the NPE’s compositional representation of the structure in physical interactions improves its ability to predict movement, generalize across variable object count and different scene configurations, and infer latent properties of objects such as mass.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Endowing an agent with a program for physical reasoning constrains the agent’s representation of the environment by establishing a prior on the environment’s physics. The agent can leverage these constraints to rapidly learn new tasks, to flexibly adapt to changes in inputs and goals, and to naturally generalize reasoning to novel scenes (Lake et al., 2016).
12
+
13
+ For example, a foundational sense of intuitive physics is a prior that guides humans to decompose a scene into objects and carry expectations of object boundaries and motion across different scenarios (Spelke, 1990). Humans perceive balls on a billiard table not as meaningless patches of color but rather as impermeable objects. They expect balls moving toward each other to bounce a certain way after a collision rather than pass through each other, crumble into pieces, or disperse into smoke. Replace one billiard ball with a bowling ball and expectations for ball-to-ball interactions will differ, but the underlying sense of inertia and collisions remain. Arrange immovable wooden obstacles on the table and expectations for how a ball’s surface interacts with wood remain constant regardless of how the obstacles are arranged. The ability to plan trajectories in this space without having to relearn physics from scratch each time, regardless of whether there are three balls or eight balls, whether there are obstacles or not, whether obstacles are arranged in one way or another, whether or not the configuration of objects has been seen before, suggests that humans leverage a prior on physics to reason at a level of abstraction where objects, relations, and events are primitive.
14
+
15
+ This paper explores the question of building this prior into an agent as a program. We view this program as a simulator that takes input provided by a physical scene and the past states of objects, and outputs the future states and physical properties of relevant objects (Anderson, 1990; Battaglia et al., 2013; Goodman and Tenenbaum, 2016). Our goal is to design a program that naturally generalizes across variable object count and different scene configurations without additional retraining. Our proposed framework, the Neural Physics Engine (NPE), outlines several ingredients useful for realizing these two generalization capabilities. We describe these ingredients in the context of a specific instantiation of the NPE applied to two-dimensional worlds of balls and obstacles.
16
+
17
+ # 1.1 A HYBRID DESIGN
18
+
19
+ Two general approaches have emerged in the search for a program that captures common-sense physical reasoning. The top-down approach (Bates et al., 2015; Battaglia et al., 2013; Hamrick et al., 2011; Ullman et al., 2014; Wu et al., 2015) formulates the problem as inference over the parameters of a symbolic physics engine, while the bottom-up approach (Agrawal et al., 2016; Fragkiadaki et al., 2015b; Lerer et al., 2016; Li et al., 2016; Mottaghi et al., 2015; 2016; Sutskever et al., 2009) learns to directly map observations to motion prediction or physical judgments. A program under the top-down approach can generalize across any scenario supported by the entities and operators in its description language. However, it may be brittle under scenarios not supported by its description language, and adapting to these new scenarios requires modifying the code or generating new code for the physics engine itself. In contrast, gradient-based bottom-up approaches can apply the same model architecture and learning algorithm to specific scenarios without requiring the physical dynamics of the scenario to be pre-specified. This often comes at the cost of reduced generality: transferring knowledge to new scenes may require extensive retraining, even in cases that seem trivial to human reasoning.
20
+
21
+ The NPE takes a step toward bridging the gap between expressivity and adaptability by combining the strengths of both approaches. The NPE framework is realized as a differentiable physics simulator that combines rough symbolic structure with gradient-based learning. It exhibits several strong inductive biases that are explicitly present in symbolic physics engines, such as a notion of objects-specific properties and object interactions. Implemented as a neural network, the NPE can also flexibly tailor itself to specific object properties and dynamics of a given world through training. By design, it can extrapolate to a variable number of objects and different scene configurations with only spatially and temporally local computation.
22
+
23
+ # 1.2 INGREDIENTS USEFUL FOR GENERALIZATION
24
+
25
+ Our framework proposes four key ingredients useful for generalization across variable object count and different scene configurations without additional retraining. The first ingredient is the view of objects as primitives of physical reasoning. The second is a mechanism for selecting context objects given a particular object. Together, these ingredients reflect two natural assumptions about a physical environment: There exist objects and these objects interact in a factorized manner.
26
+
27
+ The third and fourth ingredients are factorization and compositionality, which are both applied on two levels: the scene and the network architecture. On the level of the physical scene, the NPE factorizes the scene into object-based representations, and composes smaller building blocks to form larger objects. This method of representation adapts to scene configurations of variable complexity and shape. On the level of the network architecture, the NPE explicitly reflects a causal structure in object interactions by factorizing object dynamics into pairwise interactions. The NPE models the future state of a single object as a function composition of the pairwise interactions between itself and other context objects in the scene. This structure serves to guide learning towards objectbased reasoning and is designed for physical knowledge to transfer across variable number objects anywhere in the scene.
28
+
29
+ # 1.3 A STEP TOWARDS EMULATING A GENERAL-PURPOSE PHYSICS ENGINE
30
+
31
+ While previous bottom-up approaches (Sec. 4) have coupled learning vision and learning physical dynamics, we take a different approach for two reasons. First, we see that disentangling the visual properties of an object from its physical dynamics is a step toward achieving the generality of a physics engine. Both vision and dynamics are necessary, but we believe that keeping these functionalities separate is important for common-sense generalization that is robust to cases where the visual appearance changes but the dynamics remain the same. Second, we are optimistic that those two components indeed can be decoupled, that a vision model can map visual input to an intermediate state space, and a dynamics model can evolve objects in that state space through time. For example, there is work in object detection and localization (e.g. Eslami et al. 2016) for extracting position and velocity, as well as work for extracting latent object properties (Wu et al., 2015; 2016). Therefore this paper focuses on learning dynamics in that state space, taking a small step toward emulating a general-purpose physics engine, with the eventual goal of building a system that exhibits the compositionality, modularity, and generality of a physics engine whose internal components can be learned through observation.
32
+
33
+ ![](images/dd6dea5ce4b76d95b0f2f6572777eb2f6e98dab30ac9224461e1400cf71a5ad9.jpg)
34
+ Figure 1: Physics Programs: We consider the space of physics programs over object-based representations under physical laws that are Markovian and translation-invariant. We consider each object in turn and predict its future state conditioned on the past states of itself and its context objects.
35
+
36
+ In Sec. 2 we present a specific instantiation of the NPE that uses a neighborhood mask to select context objects. In Sec. 3 we apply that instantiation to investigate variations on two-dimensional worlds of balls and obstacles from the matter-js physics engine (Brummitt, 2014) as a testbed for exploring the NPE’s capabilities to model simple rigid-body dynamics. While these worlds are generated from a simplified physics engine, we believe that learning to model such simple physics under the NPE’s framework is a first and necessary step towards emulating the full capacity of a general physics engine, while maintaining a differentiability that can allow it to eventually learn complex real-world physical phenomena that would be challenging to engineer into conventional physics engines. This paper establishes that important step.
37
+
38
+ # 2 APPROACH
39
+
40
+ # 2.1 NEURAL PHYSICS ENGINE
41
+
42
+ We consider in detail a specific instantiation of the NPE that uses a neighborhood mask to select context objects. This section discusses each of the four ingredients of the NPE framework, that, when combined, comprise a neural network-based physics simulator that learns from observation.
43
+
44
+ Object-Based Representations We make two observations (Fig. 1) in our factorization of the scene. The first regards spatially local computation. Because physics does not change across inertial frames, it suffices to separately predict the future state of each object conditioned on the past states of itself and the other objects in its neighborhood, similar to Fragkiadaki et al. (2015b). Sec. 3.5 shows that when large structures are represented as a composition of smaller objects, a spatially local attention window helps achieve invariance to scene configuration. The second observation regards temporally local computation. Because physics is Markovian, this prediction need only be for the immediate next timestep, which we show in Sec. 3 is enough to predict physics effectively over long timescales. Given these two observations, it is natural to choose an object-based state representation. A state vector comprises extrinsic properties (position, velocity, orientation, angular velocity), intrinsic properties (mass, object type, object size), and global properties (gravitational, frictional, and pairwise forces) at a given time instance.
45
+
46
+ Pairwise Factorization Letting a particular object be the focus object $f$ and all other objects in the scene be context objects $c$ , the NPE models the focus object’s velocity $v _ { f } ^ { [ t + 1 ] }$ as a composition of the pairwise interactions between itself and other neighboring context objects in the scene during time $t \mathrm { ~ - ~ } 1$ and $t$ . This input is represented as pairs of object state vectors $\left\{ \left( o _ { f } , o _ { c _ { 1 } } \right) ^ { \left[ t - 1 , t \right] } , \left( o _ { f } , o _ { c _ { 2 } } \right) ^ { \left[ t - 1 , t \right] } , \ldots \right\}$ . As shown in Fig. 2b, the NPE composes an encoder function and a decoder function. The encoder function $f _ { e n c }$ summarizes the interaction of a single object pair. The sum of encodings of all pairs is then concatenated with the focus object’s past state as input to the decoder function. The focus object is a necessary input to the decoder because if there are no neighboring context objects, the summed encoder output would be zero. The decoder function then predicts the focus object’s velocity $v _ { f } ^ { [ t + 1 ] }$ . In practice, the NPE predicts the change $\Delta v$ between $t$ and $t + 1$ to compute $v ^ { [ t + 1 ] } = v ^ { [ t ] } + \Delta v$ , and updates position using the velocity as a first-order approximation1. We predict velocity rather than position to help avoid memorizing the environment; training the network to predict position conditions the network on the worlds in the training domain, making it more difficult to transfer knowledge across environments. We do not include acceleration in the state representation because position and velocity fully parametrize an object’s state. Thus acceleration (e.g. collisions) can be learned by observing velocity for two consecutive timesteps, hence our choice for two input timesteps. We explored longer input durations as well and found no additional benefit.
47
+
48
+ Context Selection Each $\left( o _ { f } , o _ { c } \right)$ pair is selected to be in the set of neighbors of $f$ by the neighborhood masking function $\lfloor \bar { \lceil } \rceil | p _ { c } - p _ { f } ) | | < N ( o _ { f } ) \rfloor$ , which takes value 1 if the Euclidean distance between the positions $p _ { f }$ and $p _ { c }$ of the focus and context object respectively at time $t$ is less the neighborhood threshold $\dot { \boldsymbol { N } } ( \boldsymbol { o } _ { f } )$ . Many physics engines use a collision detection scheme with two phases. Broad phase is used for computational efficiency and uses a neighborhood threshold to select objects that might, but not necessarily will, collide an object. Narrow phase performs the actual collision detection on that smaller subset of objects and also resolves the collisions for the objects that do collide. Analogously, our neighborhood mask implements broad phase, and the NPE implements narrow phase. The mask only constrains the search space of context objects, and the network figures out how to detect and resolve collisions. This mask is a specific case of a more general attention mechanism to select contextual elements of a scene.
49
+
50
+ Function Composition Symbolic physics engines evolve objects through time based on dynamics that dictate their independent behavior (e.g. inertia) and their behavior with other objects (e.g. collisions). Notably, in a particular object’s reference frame, the forces it feels from other objects are additive. The NPE architecture incorporates several inductive biases that reflect this recipe. The composition of $f _ { e n c }$ and $f _ { d e c }$ induce a causal structure on the pairs of objects. We provide a loose interpretation of the encoder output $e _ { c , f }$ as the effect of object $c$ on object $f$ , and require that these effects are additive as forces are. This design allows the NPE to scale naturally to different numbers of neighboring context objects. These inductive biases have the effect of strongly constraining the space of possible simulators that the NPE can learn, focusing on compositional programs that reflect pairwise causal structure in object interactions.
51
+
52
+ # 2.2 BASELINES
53
+
54
+ The purpose of contrasting the NPE with the following two baselines is to illustrate the benefit of pairwise factorization and function composition, which are the key architectural features of the NPE. As the architectures for both baselines have been shown to work well in similar tasks, it is not immediately clear whether the NPE’s assumptions are useful or necessary, so these are good baselines for comparison. Viewed in another way, comparing with these baselines is a lesion study on the NPE because each baseline lacks an aspect of the NPE structure.
55
+
56
+ No-Pairwise The No-Pairwise (NP) baseline is summarized by Fig. 2c. It is very similar to the NPE but does not compute pairwise interactions; otherwise its encoder and decoder are the same as the NPE’s. Therefore the NP most directly highlights the value of the NPE’s pairwise factorization. The NP is also a Markovian variant of the Social LSTM (Alahi et al., 2016); it sums the encodings of context objects after encoding each object independently, similar to the Social LSTM’s “social pooling.” Information for modeling how objects interact would only be present after the encoding step. A possible mechanism for predicting dynamics with the NP is if the encoder’s object encoding consists of an abstract object representation and a force field created by that object. Therefore the decoder could apply the sum of the force fields of all context objects to the focus object’s abstract object representation to predict the focus object’s velocity. As Alahi et al. (2016) has demonstrated the Social LSTM’s performance in modeling human trajectories, it would be interesting to see how the same architectural assumptions perform for the physics of moving objects.
57
+
58
+ ![](images/51572477e5f832e557281e245813f144ff74dcfd13d1891321980c98c31884b5.jpg)
59
+ Figure 2: Scenario and Models: This figure compares the NPE, the NP and the LSTM architectures in predicting the velocity of object 3 for an example scenario [a] of two heavy balls (cyan) and two light balls (yellow-green). Objects 2 and 4 are in object 3’s neighborhood, so object 1 is ignored. [b]: The NPE encoder consists of a pairwise layer (yellow) and a feedforward network (red) and its decoder (blue) is also a feedforward network. The input to the decoder is the concatenation of the summed pairwise encodings and the input state of object 3. [c]: The NP encoder is the same as the NPE encoder, but without the pairwise layer. The NP decoder is the same as the NPE decoder. The input to the decoder is the concatenation of the summed context encodings and the encoding of object 3. [d]: We shuffle the context objects inputted into the LSTM and use a binary flag to indicate whether an object is a context or focus object.
60
+
61
+ LSTM Long Short-Term Memory (LSTM) networks (Hochreiter and Schmidhuber, 1997) have been shown to sequentially attend to objects (Eslami et al., 2016), so it is interesting to test whether a LSTM is well-suited for modeling object interactions, when the object states are explicitly given as input. From a cognitive science viewpoint, an LSTM can be interpreted as a serial mechanism in object tracking (Pylyshyn and Annan, 2006). Our LSTM architecture (Fig. 2d) accepts the state of each context object until the last step, at which it takes in the focus object’s state and predicts its velocity. Because the LSTM moves through the object space sequentially, its lack of factorized compositional structure highlights the value of the NPE’s function composition of the independent interactions between an object and its neighbors. Our notion of compositionality treats each object and pairwise interaction as independently encapsulated in a separate computational entity that can be reused and rearranged; the NPE encoder is a function that is applied to each $\left( o _ { f } , o _ { c } \right)$ pair. This function encapsulates this computation and can be repeatedly applied to all neighboring context objects equally, such that the NPE composes this repeated encoding function with the decoder function to predict velocity. The LSTM does not exhibit this notion of compositionality because it is not designed to take advantage of the factorized structure of the scene. Unlike the NPE and NP, the LSTM’s structure does not differentiate between focus and context object, so we add a flag to the state representation to indicate to whether an object is a context or focus object. We shuffle the order of the context objects to account for an ordering bias.
62
+
63
+ # 3 EXPERIMENTS
64
+
65
+ Object-based representations (ingredient 1) are necessary for the other three ingredients, and having explained the motivation for object-based representations in Sec. 1.3 and Sec. 2.1, we now analyze the other three ingredients in the context of several experiments. In the prediction task (Sec. 3.1), we first test if the NPE is even capable of predicting physics when the number of objects is held constant. In the generalization task (Sec. 3.2), we test the NPE’s capability to generalize across variable object count. In the inference task (Sec. 3.3), we test if the NPE can be inverted to infer mass in both the prediction and generalization settings. In these experiments, we compare against the NPE-NN, a modified NPE without the neighborhood mask, to analyze the context selection mechanism (ingredient 2), the NP to analyze factorization (ingredient 3), the LSTM to analyze compositionality (ingredient 4). Sec. 3.4 analyzes the neighborhood mask in depth. We test the NPE’s capability to generalize across different scene configurations in Sec. 3.5.
66
+
67
+ Using the matter-js physics engine, we evaluate the NPE on worlds of balls and obstacles. These worlds exhibit nonlinear dynamics and support a wide variety of scenarios. Bouncing balls have been of interest in cognitive science to study causality and counterfactual reasoning, as in Gerstenberg et al. (2012). We trained on 3-timestep windows in trajectories of 60 timesteps (10 timesteps $\approx 1$ second). For a world of $k$ objects, we generate 50,000 such trajectories. For experiments where we train on multiple worlds together, we shuffle the examples across all training worlds and train without a curriculum schedule. All worlds have a vertical dimension of 600 pixels and a horizontal dimension of 800 pixels, and we constrain the maximum velocity of an object to be 60 pixels/second. We normalize positions to $[ 0 , 1 ]$ by dividing by the horizontal dimension, and we normalize velocities to $[ - 1 , 1 ]$ by dividing by the maximum velocity.
68
+
69
+ Like those of Battaglia et al. (2016) the NPE predictions can be effective over long timescales even when the NPE is only trained to predict the immediate next time step. Randomly selected simulation videos can be found at $\mathtt { h t t p s : / / q o o . q l / B W Y u O F }$ . Plots show results over three independent runs averaged over held-out test data with different random seeds. As shown in the graphs in Fig. 3 (top two rows) and Fig. 5, both the NP and LSTM’s predicted trajectories diverge from the ground truth, but for different reasons, which the videos illuminate. While the NP and LSTM fail to predict plausible physical movement entirely, the NPE’s predictions initially adhere closely to the ground truth, then slowly diverge due to the accumulation of subtle errors, just as the human perceptual system also accumulates errors (Smith and Vul, 2013). However, the NPE preserves the general intuitive physical dynamics that may roughly be consistent with people’s intuitive expectations.
70
+
71
+ # 3.1 PREDICTION TASK
72
+
73
+ We consider simple worlds of four balls of uniform mass (Fig. 3a). To measure performance in simulation, we visualize the cosine similarity between the predicted velocity and the ground truth velocity as well as the relative error in magnitude between the predicted velocity and the ground truth velocity over 50 timesteps of simulation. The models take timesteps 1 and 2 as initial input, and then use previous predictions as input to future predictions. To measure progress through training, we also display the Mean Squared Error (MSE) on the normalized velocity.
74
+
75
+ # 3.2 GENERALIZATION TASK
76
+
77
+ We test whether learned knowledge of these simple physics concepts can be transferred and extrapolated to worlds with a number of objects previously unseen (Fig. 3b). The unseen worlds (6, 7, 8 balls) in the test data are combinatorially more complex and varied than the observed worlds (3, 4, 5 balls) in the training data. All objects have equal mass. During simulation, the NPE’s predictions are more consistent, whereas the NP and LSTM’s prediction begin to diverge wildly towards the end of 50 timesteps of simulation (Fig. 3b, middle row). The NPE consistently outperforms the baselines by 0.5 to 1 order of magnitude in velocity prediction (Fig. 3b, bottom row).
78
+
79
+ # 3.3 INFERENCE TASK
80
+
81
+ We now show that the NPE can infer latent properties such as mass. This proposal is motivated by the experiments in Battaglia et al. (2013), which uses a probabilistic physics simulator to infer various properties of a scene configuration. Whereas the physical rules of their simulator were manually pre-specified, the NPE learns these rules from observation. We train on the same worlds used in both the prediction and generalization tasks, but we uniformly sampled the mass for each ball from the log-spaced set $\{ 1 , 5 , 2 5 \}$ . We chose to use discrete-valued masses to simplify our qualitative understanding of the model’s capacity to infer. For future work we would like to investigate continuously valued masses and evaluate with binary comparisons (e.g. ”Which is heavier?”).
82
+
83
+ As summarized by Fig. 3c and Fig. 4a, we select scenarios exhibiting collisions with the focus object, fix the masses of all other objects, and score the NPE’s prediction under all possible mass hypotheses for the focus object. The prediction is scored against the ground-truth under the same MSE loss used in training. The hypothesis whose prediction yields the lowest error is the NPE’s maximum likelihood estimate of the focus object’s mass. Outperforming all baselines, the NPE achieves about $90 \%$ accuracy, meaning it has $90 \%$ probability of inferring the correct mass.
84
+
85
+ ![](images/6093b84d8d2ee4c6482a60670345ddc1b48ae0f3a86357390c4354ec123cc435.jpg)
86
+ Figure 3: Quantitative evaluation (balls): [a,b]: Prediction and generalization tasks. Top two rows: The cosine similarity and the relative error in magnitude. Bottom row: The MSE of velocity on the test set over the course of training. Because these worlds are chaotic systems, it is not surprising that all predictions diverge from the ground truth with time, but NPE consistently outperforms the other two baselines on all fronts, especially when testing on 6, 7, and 8 objects in the generalization task. The NPE’s performance continues to improve with training while the NPE-NN (an NPE without a neighborhood mask, see Sec. 3.4), NP and LSTM quickly plateau. We hypothesize that the NPE’s structured factorization of the state space guides it from wasting time exploring suboptimal programs. [c]: The NPE’s accuracy is significantly greater than the baseline models’ in mass inference. Notably, the NPE achieves similar inference performance whether in the prediction or generalization settings, further showcasing its strong generalization capabilities. The LSTM performs poorest, reaching just above random guessing ( $3 3 \%$ accuracy). [d]: We analyze the effectiveness of different neighborhood thresholds for the NPE on the constant-mass prediction task. The neighborhood threshold is quite robust from 3 to 5 ball radii.
87
+
88
+ The NPE predicts outputs given inputs and infers inputs given outputs. Though we adopted a particular parametrization of an object, the NPE is not limited to the semantic meaning of the elements of its input, so we expect other latent object properties can be inferred this way. Because the NPE is differentiable, we expect that it can also infer object properties by backpropagating prediction error to its a randomly sampled input. This would be useful for inferring non-categorical values, such as positions of “invisible” objects, whose effects are felt but whose positions are unknown.
89
+
90
+ # 3.4 NEIGHBORHOOD MASK
91
+
92
+ In Fig. 3d we vary the NPE’s neighborhood threshold $N ( o _ { f } )$ and evaluate performance on the constant-mass prediction task. $N ( o _ { f } )$ is in units of ball radii, so $N ( o _ { f } ) = 2$ means that a context object is only detected if it is exactly touching the focus object. Because ball radii are 60 pixels and the maximum velocity is 60 pixels per timestep, the maximum distance two balls can initially be before touching at the next timestep is 4 ball radii. Given that velocities were sampled uniformly, it makes sense that the NPE performs well in and is robust2 to the range $N ( o _ { f } ) \in \left[ 3 , 5 \right]$ , but performance drops off with smaller and larger $N ( o _ { f } )$ . It is important to note that different $N ( o _ { f } )$ may work better for different domains and object geometries.
93
+
94
+ ![](images/3383b854b5973a5d0af62bf54985e07788f74a27f6506bbb22d91ba1a8bb1a5c.jpg)
95
+ Figure 4: Visualizations: The NPE scales to complex dynamics and world configurations while the NP and LSTM cannot. The masses are visualized as: cyan $= 2 5$ , red $= 5$ , yellow-green $= 1$ . [a] Consider the collision in the 7 balls world (circled). In the ground truth, the collision happens between balls 1 and 2, and the NPE correctly predicts this. The NP predicts a slower movement for ball 1, so ball 2 overlaps with ball 3. The LSTM predicts a slower movement and incorrect angle off the world boundary, so ball 2 overlaps with ball 3. [b] At first glance, all models seem to handle collisions well in the $\mathbf { \tilde { \Sigma } } ^ { 6 6 } \mathbf { O } ^ { 5 }$ world (diamond), but when there are internal obstacles (cloud), only the NPE can successfully resolve collisions. This suggests that the NPE pairwise factorization handles object interactions well, letting it generalize to different world configurations, whereas the NP and LSTM have only memorized the geometry of the “O” world.
96
+
97
+ We include analysis in the prediction and generalization tasks on an NPE without the neighborhood mask, the NPE-NN $\mathrm { N N } = \mathrm { N o }$ Neighborhood). The neighborhood mask gives the NPE about an order of magnitude improvement in velocity prediction loss (Fig. 3a,b: bottom row and Fig. 6). While the NPE loss continues to improve through training, the NPE-NN loss quickly plateaus. It is interesting that the NPE-NN performs no better than both the NP and LSTM in predictive error, but outperforms the LSTM in mass inference. These two observations suggest that computing the interactions the focus object shares with each context object is more effective for inferring a property of the focus object than disregarding these factorized effects. They also suggest that the additional spatial structure from constraining the context space with the neighborhood mask prevents the NPE from naively finding associations with objects that cannot influence the focus object.
98
+
99
+ In our experiments, the neighborhood mask has the additional practical benefit of reducing computational complexity from $O ( k )$ to $O ( 1 )$ , where $k$ is the number of objects in the scene, because the number of context-focus object pairs the NPE considers is bounded above by the neighborhood mask at a constant number. Though beyond the scope of this work, to extend the functionality of such context selection mechanism to include worlds that contain forces that act from a distance, future instantiations of the NPE may investigate a more general context selection mechanism that can be learned jointly with the other model parameters.
100
+
101
+ # 3.5 DIFFERENT SCENE CONFIGURATIONS
102
+
103
+ We demonstrate representing large structures as a composition of smaller objects as building blocks. This is important for testing the NPE’s invariance to scene configuration; the scene configuration should not matter if the underlying physical laws remain the same. These worlds contain 2 balls bouncing around in variations of 4 different wall geometries. “O” and “L” geometries have no internal obstacles and are in the shape of a rectangle and “L” respectively. “U” and “I” have internal obstacles. Obstacles in “U” are linearly attached to the wall like a protrusion, while obstacles in “I”
104
+
105
+ ![](images/2a3b2837e9336194a5a7fca1154ac62174098ee0cdb0f09f3e04e67edc15e834.jpg)
106
+ Figure 5: Quantitative evalution (walls and obstacles): The compositional state representation simplifies the physical prediction problem to only be over local arrangements of context balls and obstacles, even when the wall geometries are more complex and varied on a macroscopic scale. Therefore, it is not surprising that the models perform consistently across wall geometries. Note that the NPE consistently outperforms the other models, and this gap in performance increases with more varied internal obstacles for the cosine similarity of the velocity angle. This gap is more prominent in “L” and “U” geometries for relative error in magnitude.
107
+
108
+ have no constraint in position. We randomly vary the position and orientation of the “L” concavity and the “U” protrusion. We randomly sample the positions of the “I” internal obstacles.
109
+
110
+ We train on conceptually simpler “O” and “L” worlds and test on more complex “U” and “I” worlds. Variations in wall geometries adds to the difficulty of this extrapolation task. At most 12 context objects are present in the focus object’s neighborhood at a time. The “U” geometries have 33 objects in the scene, the most out of all the wall geometries. As shown in Fig. 4b and 5, the NPE is robust to scenes with internal obstacles, even when it has not observed such scenes during training.
111
+
112
+ # 3.6 ANALYSIS
113
+
114
+ We explain the NPE’s superior performance in generalization from the perspective of context selection, factorization, and compositionality. By design, all three ingredients transform the testing data distribution to be similar to the training data distribution, such that generalization across variable object count and different scene configurations happens naturally.
115
+
116
+ Consider generalizing across variable object count. The neighborhood mask selects context objects such that the NPE need only focus on a bounded subset of the objects regardless of the total number of objects. Factorizing the scene into pairwise interactions induces a causal structure between each context object and the focus object, such that no matter the object count, this causal structure remains consistent because the input is merely a set of object pairs. Composing these pairwise interactions together with a summation encourages the encoder output to be additive, such that the decoder receives the appropriate net effect from the context objects, regardless of how many there are.
117
+
118
+ Consider generalizing across different scene configurations. Our state representation composes larger structures from smaller objects, just as many real-world objects are composed of smaller components. Therefore, even when wall geometries are complex and varied on a macroscopic scale, the input distribution to the NPE remains roughly the same, because the prediction problem still remains only over objects in a local glimpse the entire scene.
119
+
120
+ # 4 RELATED WORK
121
+
122
+ Top-down and bottom-up approaches A recent set of top-down approaches investigate probabilistic game physics engines as computational models for physical simulation in humans (Bates et al., 2015; Battaglia et al., 2013; Hamrick et al., 2011; Ullman et al., 2014). However, these models require a full specification of the physical laws and object geometries. Given such a specification, inferring how physical laws compose and apply to a given scenario are their strength, but automatically inferring from visual data what physical laws and object properties are present requires more work in inverse graphics (Chen et al., 2016; Kulkarni et al., 2014; 2015a;b; Whitney et al., 2016) and physics-based visual understanding (Brand, 1997; Wu et al., 2015; 2016). The NPE builds on top of the key structural assumptions of these top-down approaches, but its differentiable architecture opens a possible path for joint training with a vision model that can automatically adapt to the specific physical properties of the scene.
123
+
124
+ Bottom-up approaches attempt to bypass the intermediate step of finding physics representations and directly map visual observations to physical judgments (Lerer et al., 2016; Li et al., 2016; Mottaghi et al., 2015; 2016) or passive (Lerer et al., 2016; Srivastava et al., 2015; Sutskever et al., 2009) and action-conditioned (Agrawal et al., 2016; Finn et al., 2016; Fragkiadaki et al., 2015b) motion prediction. Because these work historically have not been compositional in nature, they have had limited flexibility to transfer knowledge to conceptually similar worlds where the physics remain the same, but the number of objects or complexity of object configurations varies. Moreover, these approaches above do not infer latent properties as the NPE does.
125
+
126
+ Other work have taken similar hybrid approaches as the NPE, such as the NeuroAnimator (Grzeszczuk et al., 1998), one of the first work to train a neural network to emulate a physics simulator, and the interaction network (Battaglia et al., 2016), which learns to simulate physics over a graph of objects and their relations.
127
+
128
+ Sketching The NPE combines a symbolic structure that assumes generic objects and interactions with a differentiability that allows the specific nature of these interactions to be learned from training. This approach of starting with a general sketch of a program and filling in the specifics is inspired by ideas from the program synthesis community (Ellis et al., 2015; Gaunt et al., 2016; Solar-Lezama, 2008). Examples of other work that combine symbolic with neural approaches via sketching include graph-based neural networks (Jain et al., 2016; Li et al., 2015; Scarselli et al., 2009) and transforming autoencoders (Hinton et al., 2011).
129
+
130
+ Composing functions for reuse Just as the NPE repeatedly applies the same encoder to each object pair, iteratively applies itself to each object in the scene as a focus object, and recursively predicts future timesteps using predictions from previous timesteps, employing function reuse to achieve generalization is also featured in work such as Abelson et al. (1996); Andreas et al. (2016); Lake et al. (2015); Reed and de Freitas (2015); Socher et al. (2011). These work all assemble small subprograms to form larger programs. The NPE also dynamically composes its internal modules (encoder and decoder) based on the number of objects and the arrangement of context objects.
131
+
132
+ Object-based approaches Fragkiadaki et al. (2015b) and Battaglia et al. (2016) are two notably similar work in the sense that our work and theirs all take an object-based approach to model the bouncing balls environment. Our work was inspired by Fragkiadaki et al. (2015b)’s iterative approach to predicting the motion of each object in turn, conditioned on a context. The key contrast is that their model assumes no relational structure between objects beyond a visual attention window centered around the focus object, whereas ours explicitly processes the interaction between the focus and each context object.
133
+
134
+ If we compare their simulation videos (Fragkiadaki et al., 2015a) to ours, we see some specific and significant improvements evident in our approach. For example, in their work, the balls appear attracted to each other and to the walls; the balls appear to bounce along the walls even when no attractive force should be present. The balls rarely touch during collisions, but magnetically repel each other when at a short distance. The NPE does not exhibit these behaviors and tends to preserve the intuitive physical dynamics of colliding balls. In addition to these differences, we show strong predictive performance on generalizing to eight balls, five more than the balls in their videos. We also crucially show this performance under stronger generalization conditions, variable mass, and more complex scene configurations.
135
+
136
+ Recently, Battaglia et al. (2016) independently and in parallel developed an architecture that they call the interaction network for learning to model physical systems. They show how such an architecture can apply to several different kinds of physical systems, including n-body gravitational interactions and a string falling under gravity. Like their work, our model can simulate over many timesteps very effectively when only trained for next-timestep prediction, and can generalize to different world configurations and different numbers of objects.
137
+
138
+ Compared to the interaction network, a main difference in our architecture is that ours does not take object relations as explicit input, but instead learns the nature of these relations by constraining attention to a neighborhood set of objects. Another difference is in function reuse: we demonstrated that a trained NPE can automatically infer properties of its input such as mass without further retraining. In contrast, they train an additional classifier on top of their model to do inference. Their work also exhibits the four ingredients in our framework, and we view the similarities between their and our work as converging evidence for the utility of object-based representations and compositional model architectures in learning to emulate general-purpose physics engines.
139
+
140
+ # 5 DISCUSSION
141
+
142
+ While this paper is not the first to explore learning a physics simulator, here we take the opportunity to highlight the value of this paper’s contributions. We hope these contributions can seed further research that builds on the NPE framework this paper proposes.
143
+
144
+ We showed that object-based representations, a context selection mechanism, factorization, and compositionality are useful ingredients for learning a physics simulator that generalizes across variable object count and different scene configurations with only spatially and temporally local computation. This generalization is possible because these ingredients transform the testing data distribution to be similar to the training data distribution.
145
+
146
+ The NPE makes few but strong assumptions about the nature of objects in a physical environment. These assumptions are inductive biases that not only give the NPE enough structure to help constrain it to model physical phenomena in terms of objects but also are general enough for the NPE to learn physical dynamics almost exclusively from observation.
147
+
148
+ We applied the NPE to simple two-dimensional worlds of bouncing balls ranging in complexity. We showed that NPE achieves low prediction error, extrapolates learned physical knowledge to previously unseen number of objects and world configurations, and can infer latent properties such as mass. We compared against several baselines designed to test the ingredients of the NPE framework and found superior performance when all these ingredients are combined in the NPE. Though we demonstrated the NPE in the balls environment with nonlinear dynamics and complex scene configurations, the state representation and NPE architecture we propose are quite general-purpose because they assume little about the specific dynamics of a scene.
149
+
150
+ This paper works toward emulating a general purpose physics engine under a framework where visual and physical aspects of a scene are disentangled. Next steps include linking the NPE with perceptual models that extract properties such as position and mass from visual input. Learning to simulate is unsupervised learning of the structure of the environment. When a simulator like the NPE is incorporated into an agent in the context of model-based planning and model-based reinforcement learning, it becomes a prior on the environment that guides learning and reasoning. By combining the expressiveness of physics engines and the adaptability of neural networks in a compositional architecture that supports generalization in fundamental aspects of physical reasoning, the Neural Physics Engine is an important step towards lifting an agent’s ability to think at a level of abstraction where the concept of physics is primitive.
151
+
152
+ # ACKNOWLEDGMENTS
153
+
154
+ We thank Tejas Kulkarni for insightful discussions and guidance. We thank Ilker Yildirim, Erin Reynolds, Feras Saad, Andreas Stuhlmuller, Adam Lerer, Chelsea Finn, Jiajun Wu, and the anony- ¨ mous reviewers for valuable feedback. We thank Liam Brummit, Kevin Kwok, and Guillermo Webster for help with matter-js. This work was supported MIT’s SuperUROP and UROP programs, and by the Center for Minds, Brains and Machines under NSF STC award CCF-1231216 and an ONR grant N00014-16-1-2007.
155
+
156
+ REFERENCES
157
+ H. Abelson, G. J. Sussman, and J. Sussman. Structure and interpretation of computer programs. Justin Kelly, 1996.
158
+ P. Agrawal, A. Nair, P. Abbeel, J. Malik, and S. Levine. Learning to poke by poking: Experiential learning of intuitive physics. arXiv preprint arXiv:1606.07419, 2016.
159
+ A. Alahi, K. Goel, V. Ramanathan, A. Robicquet, L. Fei-Fei, and S. Savarese. Social lstm: Human trajectory prediction in crowded spaces. 2016.
160
+ J. R. Anderson. Cognitive psychology and its implications . WH Freeman/Times Books/Henry Holt & Co, 1990.
161
+ J. Andreas, M. Rohrbach, T. Darrell, and D. Klein. Learning to compose neural networks for question answering. In Proceedings of NAACL-HLT, pages 1545–1554, 2016.
162
+ C. J. Bates, I. Yildirim, J. B. Tenenbaum, and P. W. Battaglia. Humans predict liquid dynamics using probabilistic simulation. 2015.
163
+ P. Battaglia, R. Pascanu, M. Lai, D. Jimenez Rezende, and K. Koray. Interaction networks for learning about objects, relations and physics. In Advances in Neural Information Processing Systems, 2016.
164
+ P. W. Battaglia, J. B. Hamrick, and J. B. Tenenbaum. Simulation as an engine of physical scene understanding. Proceedings of the National Academy of Sciences, 110(45):18327–18332, 2013.
165
+ M. Brand. Physics-based visual understanding. Computer Vision and Image Understanding, 65(2): 192–205, 1997.
166
+ L. Brummitt. http://brm.io/matter-js, 2014. URL http://brm.io/matter-js.
167
+ X. Chen, Y. Duan, R. Houthooft, J. Schulman, I. Sutskever, and P. Abbeel. Infogan: Interpretable representation learning by information maximizing generative adversarial nets. In Advances in Neural Information Processing Systems, pages 2172–2180, 2016.
168
+ R. Collobert, K. Kavukcuoglu, and C. Farabet. Torch7: A matlab-like environment for machine learning. In BigLearn, NIPS Workshop, number EPFL-CONF-192376, 2011.
169
+ K. Ellis, A. Solar-Lezama, and J. Tenenbaum. Unsupervised learning by program synthesis. In Advances in Neural Information Processing Systems, pages 973–981, 2015.
170
+ S. Eslami, N. Heess, T. Weber, Y. Tassa, K. Kavukcuoglu, and G. E. Hinton. Attend, infer, repeat: Fast scene understanding with generative models. arXiv preprint arXiv:1603.08575, 2016.
171
+ C. Finn, I. Goodfellow, and S. Levine. Unsupervised learning for physical interaction through video prediction. arXiv preprint arXiv:1605.07157, 2016.
172
+ K. Fragkiadaki, P. Agrawal, S. Levine, and J. Malik. Intuitive physics. https://sites. google.com/site/intuitivephysicsnips15/, 2015a. (Accessed on 03/03/2017).
173
+ K. Fragkiadaki, P. Agrawal, S. Levine, and J. Malik. Learning visual predictive models of physics for playing billiards. arXiv preprint arXiv:1511.07404, 2015b.
174
+ A. L. Gaunt, M. Brockschmidt, R. Singh, N. Kushman, P. Kohli, J. Taylor, and D. Tarlow. Terpret: A probabilistic programming language for program induction. arXiv preprint arXiv:1608.04428, 2016.
175
+ T. Gerstenberg, N. Goodman, D. A. Lagnado, and J. B. Tenenbaum. Noisy newtons: Unifying process and dependency accounts of causal attribution. In In proceedings of the 34th. Citeseer, 2012.
176
+ N. D. Goodman and J. B. Tenenbaum. Probabilistic models of cognition, 2016. URL http: //probmods.org.
177
+
178
+ R. Grzeszczuk, D. Terzopoulos, and G. Hinton. Neuroanimator: Fast neural network emulation and control of physics-based models. In Proceedings of the 25th annual conference on Computer graphics and interactive techniques, pages 9–20. ACM, 1998.
179
+
180
+ J. Hamrick, P. Battaglia, and J. B. Tenenbaum. Internal physics models guide probabilistic judgments about object dynamics. 2011.
181
+ G. E. Hinton, A. Krizhevsky, and S. D. Wang. Transforming auto-encoders. In Artificial Neural Networks and Machine Learning–ICANN 2011, pages 44–51. Springer, 2011.
182
+ S. Hochreiter and J. Schmidhuber. Long short-term memory. Neural computation, 9(8):1735–1780, 1997.
183
+ A. Jain, A. R. Zamir, S. Savarese, and A. Saxena. Structural-rnn: Deep learning on spatio-temporal graphs. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 5308–5317, 2016.
184
+ T. D. Kulkarni, V. K. Mansinghka, P. Kohli, and J. B. Tenenbaum. Inverse graphics with probabilistic cad models. arXiv preprint arXiv:1407.1339, 2014.
185
+ T. D. Kulkarni, P. Kohli, J. B. Tenenbaum, and V. Mansinghka. Picture: A probabilistic programming language for scene perception. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 4390–4399, 2015a.
186
+ T. D. Kulkarni, W. F. Whitney, P. Kohli, and J. Tenenbaum. Deep convolutional inverse graphics network. In Advances in Neural Information Processing Systems, pages 2530–2538, 2015b.
187
+ B. M. Lake, R. Salakhutdinov, and J. B. Tenenbaum. Human-level concept learning through probabilistic program induction. Science, 350(6266):1332–1338, 2015.
188
+ B. M. Lake, T. D. Ullman, J. B. Tenenbaum, and S. J. Gershman. Building machines that learn and think like people. arXiv preprint arXiv:1604.00289, 2016.
189
+ N. Leonard, S. Waghmare, and Y. Wang. rnn: Recurrent library for torch. ´ arXiv preprint arXiv:1511.07889, 2015.
190
+ A. Lerer, S. Gross, R. Fergus, and J. Malik. Learning physical intuition of block towers by example. arXiv preprint arXiv:1603.01312, 2016.
191
+ W. Li, S. Azimi, A. Leonardis, and M. Fritz. To fall or not to fall: A visual approach to physical stability prediction. arXiv preprint arXiv:1604.00066, 2016.
192
+ Y. Li, D. Tarlow, M. Brockschmidt, and R. Zemel. Gated graph sequence neural networks. arXiv preprint arXiv:1511.05493, 2015.
193
+ R. Mottaghi, H. Bagherinezhad, M. Rastegari, and A. Farhadi. Newtonian image understanding: Unfolding the dynamics of objects in static images. arXiv preprint arXiv:1511.04048, 2015.
194
+ R. Mottaghi, M. Rastegari, A. Gupta, and A. Farhadi. ” what happens if...” learning to predict the effect of forces in images. arXiv preprint arXiv:1603.05600, 2016.
195
+ Z. W. Pylyshyn and V. Annan. Dynamics of target selection in multiple object tracking (mot). Spatial vision, 19(6):485–504, 2006.
196
+ S. Reed and N. de Freitas. Neural programmer-interpreters. arXiv preprint arXiv:1511.06279, 2015.
197
+ F. Scarselli, M. Gori, A. C. Tsoi, M. Hagenbuchner, and G. Monfardini. The graph neural network model. IEEE Transactions on Neural Networks, 20(1):61–80, 2009.
198
+ K. A. Smith and E. Vul. Sources of uncertainty in intuitive physics. Topics in cognitive science, 5 (1):185–199, 2013.
199
+ R. Socher, E. H. Huang, J. Pennington, A. Y. Ng, and C. D. Manning. Dynamic pooling and unfolding recursive autoencoders for paraphrase detection. 2011.
200
+ A. Solar-Lezama. Program synthesis by sketching. ProQuest, 2008.
201
+ E. S. Spelke. Principles of object perception. Cognitive science, 14(1):29–56, 1990.
202
+ N. Srivastava, E. Mansimov, and R. Salakhutdinov. Unsupervised learning of video representations using lstms. 2015.
203
+ I. Sutskever, G. E. Hinton, and G. W. Taylor. The recurrent temporal restricted boltzmann machine. In Advances in Neural Information Processing Systems, pages 1601–1608, 2009.
204
+ T. Tieleman and G. Hinton. Lecture 6.5—RmsProp: Divide the gradient by a running average of its recent magnitude. COURSERA: Neural Networks for Machine Learning, 2012.
205
+ T. Ullman, A. Stuhlmuller, and N. Goodman. Learning physics from dynamical scenes. 2014. ¨
206
+ W. F. Whitney, M. Chang, T. Kulkarni, and J. B. Tenenbaum. Understanding visual concepts with continuation learning. arXiv preprint arXiv:1602.06822, 2016.
207
+ J. Wu, I. Yildirim, J. J. Lim, B. Freeman, and J. Tenenbaum. Galileo: Perceiving physical object properties by integrating a physics engine with deep learning. In Advances in Neural Information Processing Systems, pages 127–135, 2015.
208
+ J. Wu, J. J. Lim, H. Zhang, J. B. Tenenbaum, and W. T. Freeman. Physics 101: Learning physical object properties from unlabeled videos. In British Machine Vision Conference, 2016.
209
+
210
+ # A IMPLEMENTATION
211
+
212
+ We trained all models using the rmsprop (Tieleman and Hinton, 2012) backpropagation algorithm with a Euclidean loss for 1,200,000 iterations with a learning rate of 0.0003 and a learning rate decay of 0.99 every 2,500 training iterations, beginning at iteration 50,000. We used minibatches of size 50 and used a 70-15-15 split for training, validation, and test data.
213
+
214
+ All models are implemented using the neural network libraries built by Collobert et al. (2011); Leonard et al. (2015). The NPE encoder consists of a pairwise layer of 25 hidden units and a 5-layer ´ feedforward network of 50 hidden units per layer each with rectified linear activations. Because we use a binary mask to zero out non-neighboring objects, we implement the encoder layers without bias such that non-neighboring objects do not contribute to the encoder activations. The encoding parameters are shared across all object pairs. The decoder is a five-layer network with 50 hidden units per layer and rectified linear activations after all but the last layer. The NP encoder architecture is the same as the NPE encoder, but without the pairwise layer. The NP decoder architecture is the same as the NPE decoder. The LSTM has three layers of 100 hidden units and a linear layer after the last layer. It has rectified linear activations after each layer.
215
+
216
+ We informally explored several hyperparameters, varying the number of layers from 2 to 5, the hidden dimension from 50 to 100, and learning rates in $\{ 1 \bar { 0 } ^ { - 5 } , 3 \times 1 0 ^ { - 5 } , 1 0 ^ { - \bar { 4 } } , 3 \times 1 0 ^ { - 4 } , 1 0 ^ { - 3 } , 3 \times$ $1 0 ^ { - 3 } \}$ . Though this is far from an exhaustive search, we found that the above hyperparameter settings work well.
217
+
218
+ # B QUANTITATIVE ANALYSIS
219
+
220
+ <table><tr><td rowspan=1 colspan=11>Experiments Train - Test LSTM NP NPE-NN NPE</td></tr><tr><td rowspan=1 colspan=3>Prediction Task 4-4</td><td rowspan=1 colspan=1>2.177e-03</td><td rowspan=1 colspan=1>2.276e-02</td><td rowspan=1 colspan=1>1.822e-03</td><td rowspan=1 colspan=1>1.923e-02</td><td rowspan=1 colspan=1>2.684e-03</td><td rowspan=1 colspan=1>2.283e-02</td><td rowspan=1 colspan=1>2.469e-04</td><td rowspan=1 colspan=1>4.362e-03</td></tr><tr><td rowspan=1 colspan=3>Prediction Task Variable Mass 4-4</td><td rowspan=1 colspan=1>3.521e-03</td><td rowspan=1 colspan=1>2.725e-02</td><td rowspan=1 colspan=1>2.534e-03</td><td rowspan=1 colspan=1>1.829e-02</td><td rowspan=1 colspan=1>4.278e-03</td><td rowspan=1 colspan=1>2.562e-02</td><td rowspan=1 colspan=1>5.312e-04</td><td rowspan=1 colspan=1>6.379e-03</td></tr><tr><td rowspan=1 colspan=3>345-3</td><td rowspan=1 colspan=1>1.783e-03</td><td rowspan=1 colspan=1>1.872e-02</td><td rowspan=1 colspan=1>5.844e-04</td><td rowspan=1 colspan=1>8.118e-03</td><td rowspan=1 colspan=1>1.667e-03</td><td rowspan=1 colspan=1>1.700e-02</td><td rowspan=1 colspan=1>1.651e-04</td><td rowspan=1 colspan=1>3.523e-03</td></tr><tr><td rowspan=1 colspan=3>345-4</td><td rowspan=1 colspan=1>2.237e-03</td><td rowspan=1 colspan=1>2.336e-02</td><td rowspan=1 colspan=1>1.172e-03</td><td rowspan=1 colspan=1>1.329e-02</td><td rowspan=1 colspan=1>2.554e-03</td><td rowspan=1 colspan=1>2.222e-02</td><td rowspan=1 colspan=1>2.372e-04</td><td rowspan=1 colspan=1>4.508e-03</td></tr><tr><td rowspan=2 colspan=3>345-5Generalization Task345-6</td><td rowspan=1 colspan=1>2.839e-03</td><td rowspan=1 colspan=1>2.909e-02</td><td rowspan=1 colspan=1>1.944e-03</td><td rowspan=1 colspan=1>1.959e-02</td><td rowspan=1 colspan=1>3.543e-03</td><td rowspan=1 colspan=1>2.810e-02</td><td rowspan=1 colspan=1>3.069e-04</td><td rowspan=1 colspan=1>5.514e-03</td></tr><tr><td rowspan=1 colspan=1>3.757e-03</td><td rowspan=1 colspan=1>3.636e-02</td><td rowspan=1 colspan=1>2.897e-03</td><td rowspan=1 colspan=1>2.665e-02</td><td rowspan=1 colspan=1>4.542e-03</td><td rowspan=1 colspan=1>3.381e-02</td><td rowspan=1 colspan=1>4.066e-04</td><td rowspan=1 colspan=1>6.676e-03</td></tr><tr><td rowspan=2 colspan=3>345-7345-8</td><td rowspan=1 colspan=1>5.085e-03</td><td rowspan=1 colspan=1>4.546e-02</td><td rowspan=1 colspan=1>3.894e-03</td><td rowspan=1 colspan=1>3.395e-02</td><td rowspan=1 colspan=1>5.654e-03</td><td rowspan=1 colspan=1>3.944e-02</td><td rowspan=1 colspan=1>4.951e-04</td><td rowspan=1 colspan=1>7.858e-03</td></tr><tr><td rowspan=1 colspan=1>6.943e-03</td><td rowspan=1 colspan=1>5.595e-02</td><td rowspan=1 colspan=1>5.091e-03</td><td rowspan=1 colspan=1>4.182e-02</td><td rowspan=1 colspan=1>6.913e-03</td><td rowspan=1 colspan=1>4.604e-02</td><td rowspan=1 colspan=1>5.992e-04</td><td rowspan=1 colspan=1>9.174e-03</td></tr><tr><td rowspan=1 colspan=3>345-3</td><td rowspan=1 colspan=1>2.663e-03</td><td rowspan=1 colspan=1>2.218e-02</td><td rowspan=1 colspan=1>2.228e-03</td><td rowspan=1 colspan=1>1.638e-02</td><td rowspan=1 colspan=1>2.785e-03</td><td rowspan=1 colspan=1>1.913e-02</td><td rowspan=1 colspan=1>3.546e-04</td><td rowspan=1 colspan=1>4.790e-03</td></tr><tr><td rowspan=1 colspan=3>345-4</td><td rowspan=1 colspan=1>3.588e-03</td><td rowspan=1 colspan=1>2.784e-02</td><td rowspan=1 colspan=1>3.486e-03</td><td rowspan=1 colspan=1>2.375e-02</td><td rowspan=1 colspan=1>4.291e-03</td><td rowspan=1 colspan=1>2.563e-02</td><td rowspan=1 colspan=1>5.393e-04</td><td rowspan=1 colspan=1>6.215e-03</td></tr><tr><td rowspan=2 colspan=3>345-5Generalization Task Variable Mass345-6</td><td rowspan=1 colspan=1>4.719e-03</td><td rowspan=1 colspan=1>3.472e-02</td><td rowspan=1 colspan=1>4.918e-03</td><td rowspan=1 colspan=1>3.164e-02</td><td rowspan=1 colspan=1>5.848e-03</td><td rowspan=1 colspan=1>3.273e-02</td><td rowspan=1 colspan=1>6.983e-04</td><td rowspan=1 colspan=1>7.719e-03</td></tr><tr><td rowspan=1 colspan=1>345-6</td><td rowspan=1 colspan=1>6.389e-03</td><td rowspan=1 colspan=1>4.302e-02</td><td rowspan=1 colspan=1>6.733e-03</td><td rowspan=1 colspan=1>3.982e-02</td><td rowspan=1 colspan=1>7.927e-03</td><td rowspan=1 colspan=1>4.092e-02</td><td rowspan=1 colspan=1>9.414e-04</td><td rowspan=1 colspan=1>9.398e-03</td></tr><tr><td rowspan=1 colspan=2></td><td rowspan=2 colspan=2>345-7345-8</td><td rowspan=1 colspan=1>8.581e-03</td><td rowspan=1 colspan=1>5.276e-02</td><td rowspan=1 colspan=1>8.746e-03</td><td rowspan=1 colspan=1>4.853e-02</td><td rowspan=1 colspan=1>1.012e-02</td><td rowspan=1 colspan=1>4.998e-02</td><td rowspan=1 colspan=1>1.196e-03</td></tr><tr><td></td><td></td><td rowspan=1 colspan=1>1.153e-02</td><td rowspan=1 colspan=1>6.469e-02</td><td rowspan=1 colspan=1>1.086e-02</td><td rowspan=1 colspan=1>5.724e-02</td><td rowspan=1 colspan=1>1.244e-02</td><td rowspan=1 colspan=1>5.967e-02</td><td rowspan=1 colspan=1>1.592e-03</td><td rowspan=1 colspan=1>1.367e-02</td></tr><tr><td rowspan=1 colspan=3>OL-O</td><td rowspan=1 colspan=1>5.967e-03</td><td rowspan=1 colspan=1>5.546e-02</td><td rowspan=1 colspan=1>1.010e-03</td><td rowspan=1 colspan=1>1.358e-02</td><td rowspan=1 colspan=1>N/A</td><td rowspan=1 colspan=1>N/A</td><td rowspan=1 colspan=1>3.338e-04</td><td rowspan=1 colspan=1>5.921e-03</td></tr><tr><td rowspan=2 colspan=3>OL-LDifferent Scene ConfigurationsOL-U</td><td rowspan=1 colspan=1>8.658e-03</td><td rowspan=1 colspan=1>6.995e-02</td><td rowspan=1 colspan=1>2.680e-03</td><td rowspan=1 colspan=1>2.663e-02</td><td rowspan=1 colspan=1>N/A</td><td rowspan=1 colspan=1>N/A</td><td rowspan=1 colspan=1>7.117e-04</td><td rowspan=1 colspan=1>1.019e-02</td></tr><tr><td rowspan=1 colspan=1>1.083e-02</td><td rowspan=1 colspan=1>7.765e-02</td><td rowspan=1 colspan=1>4.152e-03</td><td rowspan=1 colspan=1>3.201e-02</td><td rowspan=1 colspan=1>N/A</td><td rowspan=1 colspan=1>N/A</td><td rowspan=1 colspan=1>8.193e-04</td><td rowspan=1 colspan=1>1.141e-02</td></tr><tr><td rowspan=1 colspan=3>OL--</td><td rowspan=1 colspan=1>1.201e-02</td><td rowspan=1 colspan=1>7.947e-02</td><td rowspan=1 colspan=1>6.206e-03</td><td rowspan=1 colspan=1>3.565e-02</td><td rowspan=1 colspan=1>N/A</td><td rowspan=1 colspan=1>N/A</td><td rowspan=1 colspan=1>1.605e-03</td><td rowspan=1 colspan=1>1.482e-02</td></tr></table>
md/train/BkbY4psgg/BkbY4psgg.md ADDED
@@ -0,0 +1,623 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # MAKING NEURAL PROGRAMMING ARCHITECTURES GENERALIZE VIA RECURSION
2
+
3
+ Jonathon Cai, Richard Shin, Dawn Song
4
+ Department of Computer Science
5
+ University of California, Berkeley
6
+ Berkeley, CA 94720, USA
7
+ {jonathon,ricshin,dawnsong}@cs.berkeley.edu
8
+
9
+ # ABSTRACT
10
+
11
+ Empirically, neural networks that attempt to learn programs from data have exhibited poor generalizability. Moreover, it has traditionally been difficult to reason about the behavior of these models beyond a certain level of input complexity. In order to address these issues, we propose augmenting neural architectures with a key abstraction: recursion. As an application, we implement recursion in the Neural Programmer-Interpreter framework on four tasks: grade-school addition, bubble sort, topological sort, and quicksort. We demonstrate superior generalizability and interpretability with small amounts of training data. Recursion divides the problem into smaller pieces and drastically reduces the domain of each neural network component, making it tractable to prove guarantees about the overall system’s behavior. Our experience suggests that in order for neural architectures to robustly learn program semantics, it is necessary to incorporate a concept like recursion.
12
+
13
+ # 1 INTRODUCTION
14
+
15
+ Training neural networks to synthesize robust programs from a small number of examples is a challenging task. The space of possible programs is extremely large, and composing a program that performs robustly on the infinite space of possible inputs is difficult—in part because it is impractical to obtain enough training examples to easily disambiguate amongst all possible programs. Nevertheless, we would like the model to quickly learn to represent the right semantics of the underlying program from a small number of training examples, not an exhaustive number of them.
16
+
17
+ Thus far, to evaluate the efficacy of neural models on programming tasks, the only metric that has been used is generalization of expected behavior to inputs of greater complexity (Vinyals et al. (2015), Kaiser & Sutskever (2015), Reed & de Freitas (2016), Graves et al. (2016), Zaremba et al. (2016)). For example, for the addition task, the model is trained on short inputs and then tested on its ability to sum inputs with much longer numbers of digits. Empirically, existing models suffer from a common limitation—generalization becomes poor beyond a threshold level of complexity. Errors arise due to undesirable and uninterpretable dependencies and associations the architecture learns to store in some high-dimensional hidden state. This makes it difficult to reason about what the model will do when given complex inputs.
18
+
19
+ One common strategy to improve generalization is to use curriculum learning, where the model is trained on inputs of gradually increasing complexity. However, models that make use of this strategy eventually fail after a certain level of complexity (e.g. the single-digit multiplication task in Zaremba et al. (2016), the bubble sort task in Reed & de Freitas (2016), and the graph tasks in Graves et al. (2016)). In this version of curriculum learning, even though the inputs are gradually becoming more complex, the semantics of the program is succinct and does not change. Although the model is exposed to more and more data, it might learn spurious and overly complex representations of the program, as suggested in Zaremba et al. (2016). That is to say, the network does not learn the true program semantics.
20
+
21
+ In this paper, we propose to resolve these issues by explicitly incorporating recursion into neural architectures. Recursion is an important concept in programming languages and a critical tool to reduce the complexity of programs. We find that recursion makes it easier for the network to learn the right program and generalize to unknown situations. Recursion enables provable guarantees on neural programs’ behavior without needing to exhaustively enumerate all possible inputs to the programs. This paper is the first (to our knowledge) to investigate the important problem of provable generalization properties of neural programs. As an application, we incorporate recursion into the Neural Programmer-Interpreter architecture and consider four sample tasks: grade-school addition, bubble sort, topological sort, and quicksort. Empirically, we observe that the learned recursive programs solve all valid inputs with $100 \%$ accuracy after training on a very small number of examples, out-performing previous generalization results. Given verification sets that cover all the base cases and reduction rules, we can provide proofs that these learned programs generalize perfectly. This is the first time one can provide provable guarantees of perfect generalization for neural programs.
22
+
23
+ # 2 THE PROBLEM AND OUR APPROACH
24
+
25
+ # 2.1 THE PROBLEM OF GENERALIZATION
26
+
27
+ When constructing a neural network for the purpose of learning a program, there are two orthogonal aspects to consider. The first is the actual model architecture. Numerous models have been proposed for learning programs; to name a few, this includes the Differentiable Neural Computer (Graves et al., 2016), Neural Turing Machine (Graves et al., 2014), Neural GPU (Kaiser & Sutskever, 2015), Neural Programmer (Neelakantan et al., 2015), Pointer Network (Vinyals et al., 2015), Hierarchical Attentive Memory (Andrychowicz & Kurach, 2016), and Neural Random Access Machine (Kurach et al., 2016). The architecture usually possesses some form of memory, which could be internal (such as the hidden state of a recurrent neural network) or external (such as a discrete “scratch pad” or a memory block with differentiable access). The second is the training procedure, which consists of the form of the training data and the optimization process. Almost all architectures train on program input/output pairs. The only model, to our knowledge, that does not train on input-output pairs is the Neural Programmer-Interpreter (Reed & de Freitas, 2016), which trains on synthetic execution traces.
28
+
29
+ To evaluate a neural network that learns a neural program to accomplish a certain task, one common evaluation metric is how well the learned model $M$ generalizes. More specifically, when $M$ is trained on simpler inputs, such as inputs of a small length, the generalization metric evaluates how well $M$ will do on more complex inputs, such as inputs of much longer length. $M$ is considered to have perfect generalization if $M$ can give the right answer for any input, such as inputs of arbitrary length.
30
+
31
+ As mentioned in Section 1, all approaches to neural programming today fare poorly on this generalization issue. We hypothesize that the reason for this is that the neural network learns to spuriously depend on specific characteristics of the training examples that are irrelevant to the true program semantics, such as length of the training inputs, and thus fails to generalize to more complex inputs.
32
+
33
+ In addition, none of the current approaches to neural programming provide a method or even aim to enable provable guarantees about generalization. The memory updates of these neural programs are so complex and interdependent that it is difficult to reason about the behaviors of the learned neural program under previously unseen situations (such as problems with longer inputs). This is highly undesirable, since being able to provide the correct answer in all possible settings is one of the most important aspects of any learned neural program.
34
+
35
+ # 2.2 OUR APPROACH USING RECURSION
36
+
37
+ In this paper, we propose that the key abstraction of recursion is necessary for neural programs to generalize. The general notion of recursion has been an important concept in many domains, including mathematics and computer science. In computer science, recursion (as opposed to iteration) involves solving a larger problem by combining solutions to smaller instances of the same problem. Formally, a function exhibits recursive behavior when it possesses two properties: (1) Base cases— terminating scenarios that do not use recursion to produce answers; (2) A set of rules that reduces all other problems toward the base cases. Some functional programming languages go so far as not to define any looping constructs but rely solely on recursion to enable repeated execution of the same code.
38
+
39
+ In this paper, we propose that recursion is an important concept for neural programs as well. In fact, we argue that recursion is an essential element for neural programs to generalize, and makes it tractable to prove the generalization of neural programs. Recursion can be implemented differently for different neural programming models. Here as a concrete and general example, we consider a general Neural Programming Architecture (NPA), similar to Neural Programmer-Interpreter (NPI) in Reed & de Freitas (2016). In this architecture, we consider a core controller, e.g., an LSTM in NPI’s case, but possibly other networks in different cases. There is a (changing) list of neural programs used to accomplish a given task. The core controller acts as a dispatcher for the programs. At each time step, the core controller can decide to select one of the programs to call with certain arguments. When the program is called, the current context including the caller’s memory state is stored on a stack; when the program returns, the stored context is popped off the stack to resume execution in the previous caller’s context.
40
+
41
+ In this general Neural Programming Architecture, we show it is easy to support recursion. In particular, recursion can be implemented as a program calling itself. Because the context of the caller is stored on a stack when it calls another program and the callee starts in a fresh context, this enables recursion simply by allowing a program to call itself. In practice, we can additionally use tail recursion optimization to avoid problems with the call stack growing too deep. Thus, any general Neural Programming Architecture supporting such a call structure can be made to support recursion. In particular, this condition is satisfied by NPI, and thus the NPI model naturally supports recursion (even though the authors of NPI did not consider this aspect explicitly).
42
+
43
+ By nature, recursion reduces the complexity of a problem to simpler instances. Thus, recursion helps decompose a problem and makes it easier to reason about a program’s behavior for previously unseen situations such as longer inputs. In particular, given that a recursion is defined by two properties as mentioned before, the base cases and the set of reduction rules, we can prove a recursive neural program generalizes perfectly if we can prove that (1) it performs correctly on the base cases; (2) it learns the reduction rules correctly. For many problems, the base cases and reduction rules usually consist of a finite (often small) number of cases. For problems where the base cases may be extremely large or infinite, such as certain forms of motor control, recursion can still help reduce the problem of generalization to these two aspects and make the generalization problem significantly simpler to handle and reason about.
44
+
45
+ As a concrete instantiation, we show in this paper that we can enable recursive neural programs in the NPI model, and thus enable perfectly generalizable neural programs for tasks such as sorting where the original, non-recursive NPI program fails. As aforementioned, the NPI model naturally supports recursion. However, the authors of NPI did not consider explicitly the notion of recursion and as a consequence, did not learn recursive programs. We show that by modifying the training procedure, we enable the NPI model to learn recursive neural programs. As a consequence, our learned neural programs empirically achieve perfect generalization from a very small number of training examples. Furthermore, given a verification input set that covers all base cases and reduction rules, we can formally prove that the learned neural programs achieve perfect generalization after verifying its behavior on the verification input set. This is the first time one can provide provable guarantees of perfect generalization for neural programs.
46
+
47
+ We would also like to point out that in this paper, we provide as an example one way to train a recursive neural program, by providing a certain training execution trace to the NPI model. However, our concept of recursion for neural programs is general. In fact, it is one of our future directions to explore new ways to train a recursive neural program without providing explicit training execution traces or with only partial or non-recursive traces.
48
+
49
+ # 3 APPLICATION TO LEARNING RECURSIVE NEURAL PROGRAMS WITH NPI
50
+
51
+ # 3.1 BACKGROUND: NPI ARCHITECTURE
52
+
53
+ As discussed in Section 2, the Neural Programmer-Interpreter (NPI) is an instance of a Neural Programmer Architecture and hence it naturally supports recursion. In this section, we give a brief review of the NPI architecture from Reed & de Freitas (2016) as background.
54
+
55
+ We describe the details of the NPI model relevant to our contributions. We adapt machinery from the original paper slightly to fit our needs. The NPI model has three learnable components: a task-agnostic core, a program-key embedding, and domain-specific encoders that allow the NPI to operate in diverse environments.
56
+
57
+ The NPI accesses an external environment, $Q$ , which varies according to the task. The core module of the NPI is an LSTM controller that takes as input a slice of the current external environment, via a set of pointers, and a program and arguments to execute. NPI then outputs the return probability and next program and arguments to execute. Formally, the NPI is represented by the following set of equations:
58
+
59
+ $$
60
+ \begin{array} { c } { s _ { t } = f _ { e n c } ( e _ { t } , a _ { t } ) } \\ { h _ { t } = f _ { l s t m } ( s _ { t } , p _ { t } , h _ { t - 1 } ) } \\ { r _ { t } = f _ { e n d } ( h _ { t } ) , p _ { t + 1 } = f _ { p r o g } ( h _ { t } ) , a _ { t + 1 } = f _ { a r g } ( h _ { t } ) } \end{array}
61
+ $$
62
+
63
+ $t$ is a subscript denoting the time-step; $f _ { e n c }$ is a domain-specific encoder (to be described later) that takes in the environment slice $e _ { t }$ and arguments $a _ { t }$ ; $f _ { l s t m }$ represents the core module, which takes in the state $s _ { t }$ generated by $f _ { e n c }$ , a program embedding $p _ { t } \in \mathbb { R } ^ { P }$ , and hidden LSTM state $h _ { t }$ ; $f _ { e n d }$ decodes the return probability $r _ { t }$ ; $f _ { p r o g }$ decodes a program key embedding $p _ { t + 1 }$ ;1 and $f _ { a r g }$ decodes arguments $a _ { t + 1 }$ . The outputs $r _ { t } , p _ { t + 1 } , a _ { t + 1 }$ are used to determine the next action, as described in Algorithm 1. If the program is primitive, the next environmental state $e _ { t + 1 }$ will be affected by $p _ { t }$ and $a _ { t }$ , i.e. $e _ { t + 1 } \sim f _ { e n v } ( e _ { t } , p _ { t } , a _ { t } )$ . As with the original NPI architecture, the experiments for this paper always used a 3-tuple of integers $a _ { t } = ( a _ { t } ( 1 ) , \hat { a } _ { t } ( 2 ) , a _ { t } ( 3 ) )$ .
64
+
65
+ Algorithm 1 Neural programming inference
66
+
67
+ <table><tr><td>1:</td><td>Inputs: Environment observation e, program p,arguments a, stop threshold α</td></tr><tr><td>2:</td><td>function RUN(e,p, a)</td></tr><tr><td>3:</td><td>h↑0,r←0</td></tr><tr><td>4:</td><td>whiler&lt;αdo</td></tr><tr><td>5:</td><td>s ←fenc(e,a),h ←fistm(s,p,h)</td></tr><tr><td>6:</td><td>r ←fend(h),p2 ← fprog(h),a2 ← farg(h)</td></tr><tr><td>7:</td><td>if p is a primitive function then</td></tr><tr><td>8:</td><td>e ← fenv(e,p,a).</td></tr><tr><td>9:</td><td>else</td></tr><tr><td>10:</td><td>function RUN(e,P2, a2)</td></tr></table>
68
+
69
+ A description of the inference procedure is given in Algorithm 1. Each step during an execution of the program does one of three things: (1) another subprogram along with associated arguments is called, as in Line 10, (2) the program writes to the environment if it is primitive, as in Line 8, or (3) the loop is terminated if the return probability exceeds a threshold $\alpha$ , after which the stack frame is popped and control is returned to the caller. In all experiments, $\alpha$ is set to 0.5. Each time a subprogram is called, the stack depth increases.
70
+
71
+ The training data for the Neural Programmer-Interpreter consists of full execution traces for the program of interest. A single element of an execution trace consists of a step input-step output pair, which can be synthesized from Algorithm 1: this corresponds to, for a given time-step, the step input tuple $( e , p , a )$ and step output tuple $( r , p _ { 2 } , a _ { 2 } )$ . An example of part of an addition task trace, written in shorthand, is given in Figure 1. For example, a step input-step output pair in Lines 2 and 3 of the left-hand side of Figure 1 is (ADD1, WRITE OUT 1). In this pair, the step input runs a subprogram ADD1 that has no arguments, and the step output contains a program WRITE that has arguments of OUT and 1. The environment and return probability are omitted for readability. Indentation indicates the stack is one level deeper than before.
72
+
73
+ It is important to emphasize that at inference time in the NPI, the hidden state of the LSTM controller is reset (to zero) at each subprogram call, as in Line 3 of Algorithm 1 $h \mathbf { 0 }$ ). This functionality is critical for implementing recursion, since it permits us to restrict our attention to the currently relevant recursive call, ignoring irrelevant details about other contexts.
74
+
75
+ ![](images/400738f1bb6ec680e00398081df8b91a36e097048042ec5fdd599e1e2221cb5f.jpg)
76
+ Figure 1: Addition Task. The non-recursive trace loops on cycles of ADD1 and LSHIFT, whereas in the recursive version, the ADD function calls itself (bolded).
77
+
78
+ # 3.2 RECURSIVE FORMULATIONS FOR NPI PROGRAMS
79
+
80
+ We emphasize the overall goal of this work is to enable the learning of a recursive program. The learned recursive program is different from neural programs learned in all previous work in an important aspect: previous approaches do not explicitly incorporate this abstraction, and hence generalize poorly, whereas our learned neural programs incorporate recursion and achieve perfect generalization.
81
+
82
+ Since NPI naturally supports the notion of recursion, a key question is how to enable NPI to learn recursive programs. We found that changing the NPI training traces is a simple way to enable this. In particular, we construct new training traces which explicitly contain recursive elements and show that with this type of trace, NPI easily learns recursive programs. In future work, we would like to decrease supervision and construct models that are capable of coming up with recursive abstractions themselves.
83
+
84
+ In what follows, we describe the way in which we constructed NPI training traces so as to make them contain recursive elements and thus enable NPI to learn recursive programs. We describe the recursive re-formulation of traces for two tasks from the original NPI paper—grade-school addition and bubble sort. For these programs, we re-use the appropriate program sets (the associated subprograms), and we refer the reader to the appendix of Reed & de Freitas (2016) for further details on the subprograms used in addition and bubble sort. Finally, we implement recursive traces for our own topological sort and quicksort tasks.
85
+
86
+ Grade School Addition. For grade-school addition, the domain-specific encoder is
87
+
88
+ $$
89
+ \begin{array} { r } { f _ { e n c } ( Q , i _ { 1 } , i _ { 2 } , i _ { 3 } , i _ { 4 } , a _ { t } ) = M L P ( [ Q ( 1 , i _ { 1 } ) , Q ( 2 , i _ { 2 } ) , Q ( 3 , i _ { 3 } ) , Q ( 4 , i _ { 4 } ) , a _ { t } ( 1 ) , a _ { t } ( 2 ) , a _ { t } ( 3 ) ] ) , } \end{array}
90
+ $$
91
+
92
+ where the environment $Q \in \mathbb { R } ^ { 4 \times N \times K }$ is a scratch-pad that contains four rows (the first input number, the second input number, the carry bits, and the output) and $N$ columns. $K$ is set to 11, to represent the range of 10 possible digits, along with a token representing the end of input.2 At any given time, the NPI has access to values pointed to by four pointers in each of the four rows, represented by $Q ( 1 , i _ { 1 } ) , Q ( 2 , i _ { 2 } ) , Q ( 3 , i _ { 3 } )$ , and $Q ( 4 , i _ { 4 } )$ .
93
+
94
+ The non-recursive trace loops on cycles of ADD1 and LSHIFT. ADD1 is a subprogram that adds the current column (writing the appropriate digit to the output row and carrying a bit to the next column if needed). LSHIFT moves the four pointers to the left, to move to the next column. The program terminates when seeing no numbers in the current column.
95
+
96
+ Figure 1 shows examples of non-recursive and recursive addition traces. We make the trace recursive by adding a tail recursive call into the trace for the ADD program after calling ADD1 and LSHIFT,
97
+
98
+ # Full Recursive
99
+
100
+ ![](images/54ac005719045e00f6d938466b5b91cbc2d9b186869b92dd8c3b93eb2423cdb1.jpg)
101
+ Figure 2: Bubble Sort Task. The non-recursive trace loops on cycles of BUBBLE and RESET. The difference between the partial recursive and full recursive versions is in the indentation of Lines 10-15 and 20-22 (bolded), since in the full recursive version, BSTEP and LSHIFT are made tail recursive; the final calls to BSTEP and LSHIFT return immediately as they occur after the pointer reaches the end of the array. Also note that COMPSWAP conditionally swaps numbers under the bubble pointers.
102
+
103
+ as in Line 13 of the right-hand side of Figure 1. Via the recursive call, we effectively forget that the column just added exists, since the recursive call to ADD starts with a new hidden state for the LSTM controller. Consequently, there is no concept of length relevant to the problem, which has traditionally been an important focus of length-based curriculum learning.
104
+
105
+ Bubble Sort. For bubble sort, the domain-specific encoder is
106
+
107
+ $$
108
+ f _ { e n c } ( Q , i _ { 1 } , i _ { 2 } , i _ { 3 } , a _ { t } ) = M L P ( [ Q ( 1 , i _ { 1 } ) , Q ( 1 , i _ { 2 } ) , i _ { 3 } = l e n g t h , a _ { t } ( 1 ) , a _ { t } ( 2 ) , a _ { t } ( 3 ) ] ) ,
109
+ $$
110
+
111
+ where the environment $Q \in \mathbb { R } ^ { 1 \times N \times K }$ is a scratch-pad that contains 1 row, to represent the state of the array as sorting proceeds in-place, and $N$ columns. $K$ is set to 11, to denote the range of possible numbers (0 through 9), along with the start/end token (represented with the same encoding) which is observed when a pointer reaches beyond the bounds of the input. At any given time, the NPI has access to the values referred to by two pointers, represented by $Q ( 1 , i _ { 1 } )$ and $Q ( 1 , i _ { 2 } )$ ,. The pointers at index $i _ { 1 }$ and $i _ { 2 }$ are used to compare the pair of numbers considered during the bubble sweep, swapping them if the number at $i _ { 1 }$ is greater than that in $i _ { 2 }$ . These pointers are referred to as bubble pointers. The pointer at index $i _ { 3 }$ represents a counter internal to the environment that is incremented once after each pass of the algorithm (one cycle of BUBBLE and RESET); when incremented a number of times equal to the length of the array, the flag $i _ { 3 } = =$ length becomes true and terminates the entire algorithm .
112
+
113
+ The non-recursive trace loops on cycles of BUBBLE and RESET, which logically represents one bubble sweep through the array and reset of the two bubble pointers to the very beginning of the array, respectively. In this version, there is a dependence on length: BSTEP and LSHIFT are called a number of times equivalent to one less than the length of the input array, in BUBBLE and RESET respectively.
114
+
115
+ Inside BUBBLE and RESET, there are two operations that can be made recursive. BSTEP, used in BUBBLE, compares pairs of numbers, continuously moving the bubble pointers once to the right each time until reaching the end of the array. LSHIFT, used in RESET, shifts the pointers left until reaching the start token.
116
+
117
+ We experiment with two levels of recursion—partial and full. Partial recursion only adds a tail recursive call to BUBBLESORT after BUBBLE and RESET, similar to the tail recursive call described previously for addition. The partial recursion is not enough for perfect generalization, as will be presented later in Section 4. Full recursion, in addition to making the aforementioned tail recursive call, adds two additional recursive calls; BSTEP and LSHIFT are made tail recursive. Figure 2 shows examples of traces for the different versions of bubble sort. Training on the full recursive trace leads to perfect generalization, as shown in Section 4. We performed experiments on the partially recursive version in order to examine what happens when only one recursive call is implemented, when in reality three are required for perfect generalization.
118
+
119
+ # Algorithm 2 Depth First Search Topological Sort
120
+
121
+ 1: Color all vertices white.
122
+ 2: Initialize an empty stack $S$ and a directed acyclic graph $D A G$ to traverse. 3: Begin traversing from Vertex 1 in the DAG. 4: function TOPOSORT $( D A G )$ 5: while there is still a white vertex $u$ : do 6: color[u] = grey 7: $v _ { a c t i v e } = u$ 8: do
123
+ 9: if $v _ { a c t i v e }$ has a white child $v$ then
124
+ 10: $\operatorname { c o l o r } [ v ] = \operatorname { g r e y }$
125
+ 11: push $v _ { a c t i v e }$ onto $S$
126
+ 12: $v _ { a c t i v e } = v$
127
+ 13: else
128
+ 14: $\mathrm { c o l o r } [ v _ { a c t i v e } ] = \mathrm { b l a c k }$
129
+ 15: Write $v _ { a c t i v e }$ to result
130
+ 16: if $S$ is empty then pass
131
+ 17: else pop the top vertex off $S$ and set it to $v _ { a c t i v e }$
132
+ 18: while $S$ is not empty
133
+
134
+ Topological Sort. We choose to implement a topological sort task for graphs. A topological sort is a linear ordering of vertices such that for every directed edge $( u , v )$ from $u$ to $v , u$ comes before $v$ in the ordering. This is possible if and only if the graph has no directed cycles; that is to say, it must be a directed acyclic graph (DAG). In our experiments, we only present DAG’s as inputs and represent the vertices as values ranging from $1 , \ldots , n$ , where the DAG contains $n$ vertices.
135
+
136
+ Directed acyclic graphs are structurally more diverse than inputs in the two tasks of grade-school addition and bubble sort. The degree for any vertex in the DAG is variable. Also the DAG can have potentially more than one connected component, meaning it is necessary to transition between these components appropriately.
137
+
138
+ Algorithm 2 shows the topological sort task of interest. This algorithm is a variant of depth first search. We created a program set that reflects the semantics of Algorithm 2. For brevity, we refer the reader to the appendix for further details on the program set and non-recursive and recursive trace-generating functions used for topological sort.
139
+
140
+ For topological sort, the domain-specific encoder is
141
+
142
+ $$
143
+ \begin{array} { r l } & { \ f _ { e n c } ( D A G , Q _ { c o l o r } , p _ { s t a c k } , p _ { s t a r t } , v _ { a c t i v e } , c h i l d L i s t , a _ { t } ) } \\ & { = M L P ( [ Q _ { c o l o r } ( p _ { s t a r t } ) , Q _ { c o l o r } ( D A G [ v _ { a c t i v e } ] [ c h i l d L i s t [ v _ { a c t i v e } ] ] ) , p _ { s t a c k } = = 1 , a _ { t } ( 1 ) , a _ { t } ( 2 ) , a _ { t } ( 3 ) , a _ { t } ) } \end{array}
144
+ $$
145
+
146
+ where $Q _ { c o l o r } \in \mathbb { R } ^ { U \times 4 }$ is a scratch-pad that contains $U$ rows, each containing one of four colors (white, gray, black, invalid) with one-hot encoding. $U$ varies with the number of vertices in the graph. We further have $Q _ { r e s u l t } \in \mathbb { N } ^ { U }$ , a scratch-pad which contains the sorted list of vertices at the end of execution, and $Q _ { s t a c k } \in \mathbb { N } ^ { U }$ , which serves the role of the stack $S$ in Algorithm 2. The contents of $Q _ { r e s u l t }$ and $Q _ { s t a c k }$ are not exposed directly through the domain-specific encoder; rather, we define primitive functions which manipulate these scratch-pads.
147
+
148
+ The DAG is represented as an adjacency list where $D A G [ i ] [ j ]$ refers to the $j$ -th child of vertex $i$ . There are 3 pointers $( p _ { r e s u l t } , p _ { s t a c k } , p _ { s t a r t } )$ , $p _ { r e s u l t }$ points to the next empty location in $Q _ { r e s u l t }$ $p _ { s t a c k }$ points to the top of the stack in $Q _ { s t a c k }$ , and $p _ { s t a r t }$ points to the candidate starting node for a connected component. There are 2 variables ( $\boldsymbol { v } _ { a c t i v e }$ and $v _ { s a v e . }$ ); $v _ { a c t i v e }$ holds the active vertex (as in Algorithm 2) and $v _ { s a v e }$ holds the value of $v _ { a c t i v e }$ before executing Line 12 of Algorithm 2. $c h i l d L i s t \in \mathbb { N } ^ { U }$ is a vector of pointers, where childList[i] points to the next child under consideration for vertex $i$ .
149
+
150
+ The three environment observations aid with control flow in Algorithm 2. $Q _ { c o l o r } ( p _ { s t a r t } )$ contains the color of the current start vertex, used in the evaluation of the condition in the WHILE loop in Line 5 of Algorithm 2. $Q _ { c o l o r } ( D A G [ v _ { a c t i v e } ] [ c h i l d L i s t [ v _ { a c t i v e } ] ] )$ refers to the color of the next child of $v _ { a c t i v e }$ , used in the evaluation of the condition in the IF branch in Line 9 of Algorithm 2. Finally, the boolean $p _ { s t a c k } = = 1$ is used to check whether the stack is empty in Line 18 of Algorithm 2.
151
+
152
+ An alternative way of representing the environment slice is to expose the values of the absolute vertices to the model; however, this makes it difficult to scale the model to larger graphs, since large vertex values are not seen during training time.
153
+
154
+ We refer the reader to the appendix for the non-recursive trace generating functions. In the non-recursive trace, there are four functions that can be made recursive—TOPOSORT, CHECK CHILD, EXPLORE, and NEXT START, and we add a tail recursive call to each of these functions in order to make the recursive trace. In particular, in the EXPLORE function, adding a tail recursive call resets and stores the hidden states associated with vertices in a stack-like fashion. This makes it so that we only need to consider the vertices in the subgraph that are currently relevant for computing the sort, allowing simpler reasoning about behavior for large graphs. The sequence of primitive operations (MOVE and WRITE operations) for the non-recursive and recursive versions are exactly the same.
155
+
156
+ Quicksort. We implement a quicksort task, in order to demonstrate that recursion helps with learning divide-and-conquer algorithms. We use the Lomuto partition scheme; the logic for the recursive trace is shown in Algorithm 3. For brevity, we refer the reader to the appendix for information about the program set and non-recursive and recursive trace-generating functions for quicksort. The logic for the non-recursive trace is shown in Algorithm 4 in the appendix.
157
+
158
+ # Algorithm 3 Recursive Quicksort
159
+
160
+ 1: Initialize an array $A$ to sort.
161
+ 2: Initialize $l o$ and $h i$ to be 1 and $n$ , where $n$ is the length of $A$ .
162
+ 3:
163
+ 4: function QUICKSORT $( A , l o , h i )$
164
+ 5: if $l o < h i$ : then
165
+ 6: $\mathsf { p } = \mathsf { P A R T I T I O N } ( A , l o , h i )$
166
+ 7: $\mathrm { Q U I C K S O R T } ( A , l o , p - 1 )$
167
+ 8: $\operatorname { Q U I C K S O R T } ( A , p + 1 , h i )$
168
+ 9:
169
+ 10: function PARTITION $( A , l o , h i )$
170
+ 11: $p i v o t = l o$
171
+ 12: for $j \in [ l o , h i - 1 ] : \mathbf { d o }$
172
+ 13: if $A [ j ] \leq A [ h i ]$ then
173
+ 14: swap A[pivot] with $A [ j ]$
174
+ 15: pivot = pivot + 1
175
+ 16: swap A[pivot] with A[hi]
176
+ 17: return pivot
177
+
178
+ For quicksort, the domain-specific encoder is
179
+
180
+ $$
181
+ \begin{array} { r l } & { f _ { e n c } ( Q _ { a r r a y } , Q _ { s t a c k L o } , Q _ { s t a c k H i } , p _ { l o } , p _ { h i } , p _ { s t a c k L o } , p _ { s t a c k H i } , p _ { p i v o t } , p _ { j } , a _ { t } ) = } \\ & { \qquad M L P ( [ Q _ { a r r a y } ( p _ { j } ) \leq Q _ { a r r a y } ( p _ { h i } ) , p _ { j } = = p _ { h i } , } \\ & { \qquad Q _ { s t a c k L o } ( p _ { s t a c k L o } - 1 ) < Q _ { s t a c k H i } ( p _ { s t a c k H i } - 1 ) , p _ { s t a c k L o } = = } \\ & { \qquad \quad M L P ( [ Q _ { a r r a y } ( p _ { j } ) \leq \mathfrak { a } _ { t } ( 2 ) , a _ { t } ( 3 ) ] ) , } \end{array}
182
+ $$
183
+
184
+ where $Q _ { a r r a y } \in \mathbb { R } ^ { U \times 1 1 }$ is a scratch-pad that contains $U$ rows, each containing one of 11 values (one of the numbers 0 through 9 or an invalid state). Our implementation uses two stacks $Q _ { s t a c k L o }$ and
185
+
186
+ $Q _ { s t a c k H i }$ , each in $\mathbb { R } ^ { U }$ , that store the arguments to the recursive QUICKSORT calls in Algorithm 3; before each recursive call, the appropriate arguments are popped off the stack and written to $p _ { l o }$ and $p _ { h i }$ .
187
+
188
+ There are 6 pointers $( p _ { l o } , p _ { h i } , p _ { s t a c k L o } , p _ { s t a c k H i } , p _ { p i v o t } , p _ { j } )$ . $p _ { l o }$ and $p _ { h i }$ point to the lo and hi indices of the array, as in Algorithm 3. $p _ { s t a c k L o }$ and $p _ { s t a c k H i }$ point to the top (empty) positions in $Q _ { s t a c k L o }$ and $Q _ { s t a c k H i }$ . $p _ { p i v o t }$ and $p _ { j }$ point to the pivot and $j$ indices of the array, used in the PARTITION function in Algorithm 3. The 4 environment observations aid with control flow; $Q _ { s t a c k L o } ( p _ { s t a c k L o } - 1 ) < Q _ { s t a c k H i } ( p _ { s t a c k H i } - 1 )$ implements the $l o < h i$ comparison in Line 5 of Algorithm 3, $p _ { s t a c k L o } = = 1$ checks if the stacks are empty in Line 18 of Algorithm 4, and the other observations (all involving $p _ { p i v o t }$ or $p _ { j }$ ) deal with logic in the PARTITION function.
189
+
190
+ Note that the recursion for quicksort is not purely tail recursive and therefore represents a more complex kind of recursion that is harder to learn than in the previous tasks. Also, compared to the bubble pointers in bubble sort, the pointers that perform the comparison for quicksort (the COMPSWAP function) are usually not adjacent to each other, making quicksort less local than bubble sort. In order to compensate for this, $p _ { p i v o t }$ and $p _ { j }$ require special functions (MOVE PIVOT LO and MOVE J LO) to properly set them to $l o$ in Lines 11 and 12 of the PARTITION function in Algorithm 3.
191
+
192
+ # 3.3 PROVABLY PERFECT GENERALIZATION
193
+
194
+ We show that if we incorporate recursion, the learned NPI programs can achieve provably perfect generalization for different tasks. Provably perfect generalization implies the model will behave correctly, given any valid input. In order to claim a proof, we must verify the model produces correct behavior over all base cases and reductions, as described in Section 2.
195
+
196
+ We propose and describe our verification procedure. This procedure verifies that all base cases and reductions are handled properly by the model via explicit tests. Note that recursion helps make this process tractable, because we only need to test a finite number of inputs to show that the model will work correctly on inputs of unbounded complexity. This verification phase only needs to be performed once after training.
197
+
198
+ Formally, verification consists of proving the following theorem:
199
+
200
+ $$
201
+ \forall i \in V , M ( i ) \downdownarrows P ( i )
202
+ $$
203
+
204
+ where $i$ denotes a sequence of step inputs (within one function call), $V$ denotes the set of valid sequences of step inputs, $M$ denotes the neural network model, $P$ denotes the correct program, and $P ( i )$ denotes the next step output from the correct program. The arrow in the theorem refers to evaluation, as in big-step semantics. The theorem states that for the same sequence of step inputs, the model produces the exact same step output as the target program it aims to learn. $M$ , as described in Algorithm 1, processes the sequence of step inputs by using an LSTM.
205
+
206
+ Recursion drastically reduces the number of configurations we need to consider during the verification phase and makes the proof tractable, because it introduces structure that eliminates infinitely long sequences of step inputs that would otherwise need to be considered. For instance, for recursive addition, consider the family $F$ of addition problems $a _ { n } a _ { n - 1 } \dots a _ { 1 } a _ { 0 } + b _ { n } b _ { n - 1 } \dots b _ { 1 } b _ { 0 }$ where no CARRY operations occur. We prove every member of $F$ is added properly, given that subproblems $S = \{ a _ { n } a _ { n - 1 } + b _ { n } b _ { n - 1 } , a _ { n - 1 } { \bar { a } } _ { n - 2 } + b _ { n - 1 } b _ { n - 2 } , \dots , a _ { 1 } a _ { 0 } + b _ { 1 } b _ { 0 } \}$ are added properly.
207
+
208
+ Without using a recursive program, such a proof is not possible, because the non-recursive program runs on an arbitrarily long addition problem that creates correspondingly long sequences of step inputs; in the non-recursive formulation of addition, ADD calls ADD1 a number of times that is dependent on the length of the input. The core LSTM module’s hidden state is preserved over all these ADD1 calls, and it is difficult to interpret with certainty what happens over longer timesteps without concretely evaluating the LSTM with an input of that length. In contrast, each call to the recursive ADD always runs for a fixed number of steps, even on arbitrarily long problems in $F$ , so we can test that it performs correctly on a small, fixed number of step input sequences. This guarantees that the step input sequences considered during verification contain all step input sequences which arise during execution of an unseen problem in $F$ , leading to generalization to any problem in $F$ . Hence, if all subproblems in $S$ are added correctly, we have proven that any member of $F$ will be added correctly, thus eliminating an infinite family of inputs that need to be tested.
209
+
210
+ To perform the verification as described here, it is critical to construct $V$ correctly. If it is too small, then execution of the program on some input might require evaluation of $M ( i )$ on some $i \not \in V$ , and so the behavior of $M ( i )$ might deviate from $P ( i )$ . If it is too large, then the semantics of $P$ might not be well-defined on some elements in $V$ , or the spurious step input sequences may not be reachable from any valid problem input (e.g., an array for quicksort or a DAG for topological sort).
211
+
212
+ To construct this set, by using the reference implementation of each subprogram, we construct a mapping between two sets of environment observations: the first set consists of all observations that can occur at the beginning of a particular subprogram’s invocation, and the second set contains the observations at the end of that subprogram. We can obtain this mapping by first considering the possible observations that can arise at the beginning of the entry function (ADD, BUBBLESORT, TOPOSORT, and QUICKSORT) for some valid program input, and iteratively applying the observation-to-observation mapping implied by the reference implementation’s step output at that point in the execution. If the step output specifies a primitive function call, we need to reason about how it can affect the environment so as to change the observation in the next step input. For non-primitive subprograms, we can update the observation-to-observation mapping currently associated with the subprogram and then apply that mapping to the current set. By iterating with this procedure, and then running $P$ on the input observation set that we obtain for the entry point function, we can obtain $V$ precisely. To make an analogy to MDPs, this procedure is analogous to how value iteration obtains the correct value for each state starting from any initialization.
213
+
214
+ An alternative method is to run $P$ on many different program inputs and then observe step input sequences which occur, to create $V$ . However, to be sure that the generated $V$ is complete (covers all the cases needed), we need to check all pairs of observations seen in adjacent step inputs (in particular, those before and after a primitive function call), in a similar way as if we were constructing $V$ from scratch. Given a precise definition of $P$ , it may be possible to automate the generation of $V$ from $P$ in future work.
215
+
216
+ Note that $V$ should also contain the necessary reductions, which corresponds to making the recursive calls at the correct time, as indicated by $P$ .
217
+
218
+ After finding $V$ , we construct a set of problem inputs which, when executed on $P$ , create exactly the step input sequences which make up $V$ . We call this set of inputs the verification set, $S _ { V }$ .
219
+
220
+ Given a verification set, we can then run the model on the verification set to check if the produced traces and results are correct. If yes, then this indicates that the learned neural program achieves provably perfect generalization.
221
+
222
+ We note that for tasks with very large input domains, such as ones involving MNIST digits or speech samples, the state space of base cases and reduction rules could be prohibitively large, possibly infinite. Consequently, it is infeasible to construct a verification set that covers all cases, and the verification procedure we have described is inadequate. We leave this as future work to devise a verification procedure more appropriate to this setting.
223
+
224
+ # 4 EXPERIMENTS
225
+
226
+ As there is no public implementation of NPI, we implemented a version of it in Keras that is as faithful to the paper as possible. Our experiments use a small number of training examples.
227
+
228
+ Training Setup. The training set for addition contains 200 traces. The maximum problem length in this training set is 3 (e.g., the trace corresponding to the problem $^ { \mathrm { \left. } } 1 0 9 + 1 0 1 ^ { \mathrm { \right. } }$ ).
229
+
230
+ The training set for bubble sort contains 100 traces, with maximum problem length of 2 (e.g., the trace corresponding to the array [3,2]).
231
+
232
+ The training set for topological sort contains 6 traces, with one synthesized from a graph of size 5 and the rest synthesized from graphs of size 7.
233
+
234
+ The training set for quicksort contains 4 traces, synthesized from arrays of length 5.
235
+
236
+ The same set of problems was used to generate the training traces for all formulations of the task, for non-recursive and recursive versions.
237
+
238
+ Table 1: Accuracy on Randomly Generated Problems for Bubble Sort
239
+
240
+ <table><tr><td>Length of Array</td><td>Non-Recursive</td><td>PartiallyRecursive</td><td>FullRecursive</td></tr><tr><td></td><td></td><td></td><td></td></tr><tr><td>23</td><td>100%</td><td>100%</td><td>100%</td></tr><tr><td></td><td>6.7%</td><td>23%</td><td>100%</td></tr><tr><td>4</td><td>10%</td><td>10%</td><td>100%</td></tr><tr><td>8</td><td>0% 0%</td><td>0% 0%</td><td>100% 100%</td></tr><tr><td>20</td><td></td><td></td><td>100%</td></tr><tr><td>90</td><td>0%</td><td>0%</td><td></td></tr></table>
241
+
242
+ We train using the Adam optimizer and use a 2-layer LSTM and task-specific state encoders for the external environments, as described in Reed & de Freitas (2016).
243
+
244
+ 4.1 RESULTS ON GENERALIZATION OF RECURSIVE NEURAL PROGRAMS
245
+
246
+ We now report on generalization for the varying tasks.
247
+
248
+ Grade-School Addition. Both the non-recursive and recursive learned programs generalize on all input lengths we tried, up to 5000 digits. This agrees with the generalization of non-recursive addition in Reed & de Freitas (2016), where they reported generalization up to 3000 digits. However, note that there is no provable guarantee that the non-recursive learned program will generalize to all inputs, whereas we show later that the recursive learned program has a provable guarantee of perfect generalization.
249
+
250
+ In order to demonstrate that recursion can help learn and generalize better, for addition, we trained only on traces for 5 arbitrarily chosen 1-digit addition sum examples. The recursive version can generalize perfectly to long problems constructed from these components (such as the sum $^ { 6 6 } 8 2 2 + 2 3 3 ^ { 3 }$ , where $\because 8 + 2 ^ { , 5 }$ and $\bar { 2 } + 3 \bar { 2 }$ are in the training set), but the non-recursive version fails to sum these long problems properly.
251
+
252
+ Bubble Sort. Table 1 presents results on randomly generated arrays of varying length for the learned non-recursive, partially recursive, and full recursive programs. For each length, we test each program on 30 randomly generated problems. Observe that partially recursive does slightly better than non-recursive for the setting in which the length of the array is 3, and that the fully recursive version is able to sort every array given to it. The non-recursive and partially recursive versions are unable to sort long arrays, beyond length 8.
253
+
254
+ Topological Sort. Both the non-recursive and recursive learned programs generalize on all graphs we tried, up to 120 vertices. As before, the non-recursive learned program lacks a provable guarantee of generalization, whereas we show later that the recursive learned program has one.
255
+
256
+ In order to demonstrate that recursion can help learn and generalize better, we trained a non-recursive and recursive model on just a single execution trace generated from a graph containing 5 nodes3 for the topological sort task. For these models, Table 2 presents results on randomly generated DAGs of varying graph sizes (varying in the number of vertices). For each graph size, we test the learned programs on 30 randomly generated DAGs. The recursive version of topological sort solves all graph instances we tried, from graphs of size 5 through 70. On the other hand, the non-recursive version has low accuracy, beginning from size 5, and fails completely for graphs of size 8 and beyond.
257
+
258
+ Quicksort. Table 3 presents results on randomly generated arrays of varying length for the learned non-recursive and recursive programs. For each length, we test each program on 30 randomly generated problems. Observe that the non-recursive program’s correctness degrades for length 11 and beyond, while the recursive program can sort any given array.
259
+
260
+ Table 2: Accuracy on Randomly Generated Problems for Topological Sort
261
+
262
+ <table><tr><td>NumberofVertices</td><td>Non-Recursive</td><td>Recursive</td></tr><tr><td></td><td></td><td></td></tr><tr><td>5</td><td>6.7%</td><td>100%</td></tr><tr><td>6</td><td>6.7%</td><td>100%</td></tr><tr><td>7</td><td>3.3%</td><td>100%</td></tr><tr><td>8</td><td>0%</td><td>100%</td></tr><tr><td>70</td><td>0%</td><td>100%</td></tr></table>
263
+
264
+ Table 3: Accuracy on Randomly Generated Problems for Quicksort
265
+
266
+ <table><tr><td>LengthofArray</td><td>Non-Recursive</td><td>Recursive</td></tr><tr><td>3</td><td>100%</td><td>100%</td></tr><tr><td>5</td><td>100%</td><td>100%</td></tr><tr><td>7</td><td>100%</td><td>100%</td></tr><tr><td>11</td><td>73.3%</td><td>100%</td></tr><tr><td>15</td><td>60%</td><td>100%</td></tr><tr><td>20</td><td>30%</td><td></td></tr><tr><td>22</td><td>20%</td><td>100%</td></tr><tr><td>25</td><td>3.33%</td><td>100%</td></tr><tr><td>30</td><td>3.33%</td><td>100%</td></tr><tr><td></td><td></td><td>100%</td></tr><tr><td>70</td><td>0%</td><td>100%</td></tr></table>
267
+
268
+ As mentioned in Section 2.1, we hypothesize the non-recursive programs do not generalize well because they have learned spurious dependencies specific to the training set, such as length of the input problems. On the other hand, the recursive programs have learned the true program semantics.
269
+
270
+ # 4.2 VERIFICATION OF PROVABLY PERFECT GENERALIZATION
271
+
272
+ We describe how models trained with recursive traces can be proven to generalize, by using the verification procedure described in Section 3.3. As described in the verification procedure, it is possible to prove our learned recursive program generalizes perfectly by testing on an appropriate set of problem inputs, i.e., the verification set. Recall that this verification procedure cannot be performed for the non-recursive versions, since the propagation of the hidden state in the core LSTM module makes reasoning difficult and so we would need to check an unbounded number of examples.
273
+
274
+ We describe the base cases, reduction rules, and the verification set for each task in Appendix A.6. For each task, given the verification set, we check the traces and results of the learned, to-be-verified neural program (described in Section 4.1; and for bubble sort, Appendix A.6) on the verification set, and ensure they match the traces produced by the true program $P$ . Our results show that for all learned, to-be-verified neural programs, they all produced the same traces as those produced by $P$ on the verification set. Thus, we demonstrate that recursion enables provably perfect generalization for different tasks, including addition, topological sort, quicksort, and a variant of bubble sort.
275
+
276
+ Note that the training set can often be considerably smaller than the verification set, and despite this, the learned model can still pass the entire verification set. Our result shows that the training procedure and the NPI architecture is capable of generalizing from the step input-output pairs seen in the training data to the unseen ones present in the verification set.
277
+
278
+ # 5 CONCLUSION
279
+
280
+ We emphasize that the notion of a neural recursive program has not been presented in the literature before: this is our main contribution. Recursion enables provably perfect generalization. To the best of our knowledge, this is the first time verification has been applied to a neural program, providing provable guarantees about its behavior. We instantiated recursion for the Neural ProgrammerInterpreter by changing the training traces. In future work, we seek to enable more tasks with recursive structure. We also hope to decrease supervision, for example by training with only partial or non-recursive traces, and to develop novel Neural Programming Architectures integrated directly with a notion of recursion.
281
+
282
+ # ACKNOWLEDGMENTS
283
+
284
+ This material is in part based upon work supported by the National Science Foundation under Grant No. TWC-1409915, DARPA under Grant No. FA8750-15-2-0104, and Berkeley Deep Drive. Any opinions, findings, and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of National Science Foundation and DARPA.
285
+
286
+ # REFERENCES
287
+
288
+ Marcin Andrychowicz and Karol Kurach. Learning efficient algorithms with hierarchical attentive memory. CoRR, abs/1602.03218, 2016. URL http://arxiv.org/abs/1602.03218.
289
+
290
+ Alex Graves, Greg Wayne, and Ivo Danihelka. Neural turing machines. CoRR, abs/1410.5401, 2014. URL http://arxiv.org/abs/1410.5401.
291
+
292
+ Alex Graves, Greg Wayne, Malcolm Reynolds, Tim Harley, Ivo Danihelka, Agnieszka GrabskaBarwiska, Sergio Gmez Colmenarejo, Edward Grefenstette, Tiago Ramalho, John Agapiou, Adri Puigdomnech Badia, Karl Moritz Hermann, Yori Zwols, Georg Ostrovski, Adam Cain, Helen King, Christopher Summerfield, Phil Blunsom, Koray Kavukcuoglu, and Demis Hassabis. Hybrid computing using a neural network with dynamic external memory. Nature, 538 (7626):471–476, October 2016. ISSN 0028-0836, 1476-4687. doi: 10.1038/nature20101. URL http://www.nature.com/doifinder/10.1038/nature20101.
293
+
294
+ Lukasz Kaiser and Ilya Sutskever. Neural gpus learn algorithms. CoRR, abs/1511.08228, 2015. URL http://arxiv.org/abs/1511.08228.
295
+
296
+ Karol Kurach, Marcin Andrychowicz, and Ilya Sutskever. Neural random access machines. ERCIM News, 2016(107), 2016. URL http://ercim-news.ercim.eu/en107/special/ neural-random-access-machines.
297
+
298
+ Arvind Neelakantan, Quoc V. Le, and Ilya Sutskever. Neural programmer: Inducing latent programs with gradient descent, 2015.
299
+
300
+ Scott Reed and Nando de Freitas. Neural programmer-interpreters. ICLR, 2016.
301
+
302
+ Oriol Vinyals, Meire Fortunato, and Navdeep Jaitly. Pointer networks. In Advances in Neural Information Processing Systems 28: Annual Conference on Neural Information Processing Systems 2015, December 7-12, 2015, Montreal, Quebec, Canada, pp. 2692–2700, 2015. URL http://papers.nips.cc/paper/5866-pointer-networks.
303
+
304
+ Wojciech Zaremba, Tomas Mikolov, Armand Joulin, and Rob Fergus. Learning simple algorithms from examples. In Proceedings of the 33nd International Conference on Machine Learning, ICML 2016, New York City, NY, USA, June 19-24, 2016, pp. 421–429, 2016. URL http://jmlr. org/proceedings/papers/v48/zaremba16.html.
305
+
306
+ A APPENDIX
307
+
308
+ A.1 PROGRAM SET FOR NON-RECURSIVE TOPOLOGICAL SORT
309
+
310
+ <table><tr><td rowspan=1 colspan=1>Program</td><td rowspan=1 colspan=1>Descriptions</td><td rowspan=1 colspan=1>Calls</td><td rowspan=1 colspan=1>Arguments</td></tr><tr><td rowspan=1 colspan=1>TOPOSORT</td><td rowspan=1 colspan=1>Perform topologicalsort on graph</td><td rowspan=1 colspan=1>TRAVERSE,NEXT_START,WRITE,MOVE</td><td rowspan=1 colspan=1>NONE</td></tr><tr><td rowspan=1 colspan=1>TRAVERSE</td><td rowspan=1 colspan=1>Traverse graph untilstack is empty</td><td rowspan=1 colspan=1>CHECK_CHILD,EX-PLORE</td><td rowspan=1 colspan=1>NONE</td></tr><tr><td rowspan=1 colspan=1>CHECK_CHILD</td><td rowspan=1 colspan=1>Check ifawhitechild exists; if so, setchildList[Uactive] topoint to it</td><td rowspan=1 colspan=1>MOVE</td><td rowspan=1 colspan=1>NONE</td></tr><tr><td rowspan=1 colspan=1>EXPLORE</td><td rowspan=1 colspan=1>Repeatedlytraversesubgraphs until stackis empty</td><td rowspan=1 colspan=1>STACK,CHECK_CHILD,WRITE,MOVE</td><td rowspan=1 colspan=1>NONE</td></tr><tr><td rowspan=1 colspan=1>STACK</td><td rowspan=1 colspan=1>Interactwith stack,either pushing orpopping</td><td rowspan=1 colspan=1>WRITE,MOVE</td><td rowspan=1 colspan=1>PUSH,POP</td></tr><tr><td rowspan=1 colspan=1>NEXT_START</td><td rowspan=1 colspan=1>Move Pstart untilreaching a whitevertex. If a whitevertex is found,setPstart to point to it;this signifies the startof a traversal of anew connected com-ponent.If no whitevertex is found, theentireexecution isterminated</td><td rowspan=1 colspan=1>MOVE</td><td rowspan=1 colspan=1>NONE</td></tr><tr><td rowspan=1 colspan=1>WRITE</td><td rowspan=1 colspan=1>Write a value eitherto environment (e.g.,to color a vertex)or variable (e.g., tochange the value ofUactive)</td><td rowspan=1 colspan=1>NONE</td><td rowspan=1 colspan=1>Described below</td></tr><tr><td rowspan=1 colspan=1>MOVE</td><td rowspan=1 colspan=1>Move a pointer(e.g, Pstart orchildList[vactive])up or down</td><td rowspan=1 colspan=1>NONE</td><td rowspan=1 colspan=1>Described below</td></tr></table>
311
+
312
+ # Argument Sets for WRITE and MOVE.
313
+
314
+ WRITE. The WRITE operation has the following arguments:
315
+
316
+ # ARG 1 (Main Action): COLOR CURR, COLOR NEXT, ACTIVE START, ACTIVE NEIGHB, ACTIVE STACK, SAVE, STACK PUSH, STACK POP, RESULT
317
+
318
+ COLOR CURR colors $v _ { a c t i v e }$ , COLOR NEXT colors Vertex $D A G [ v _ { a c t i v e } ] [ c h i l d L i s t [ v _ { a c t i v e } ] ] ,$ , ACTIVE START writes pstart to $v _ { a c t i v e }$ , ACTIVE NEIGHB writes $D A G [ v _ { a c t i v e } ] [ c h i l d L i s t [ v _ { a c t i v e } ] ]$ to $v _ { a c t i v e }$ , ACTIVE STACK writes $Q _ { s t a c k } ( p _ { s t a c k } )$ to $v _ { a c t i v e }$ , SAVE writes $v _ { a c t i v e }$ to $v _ { s a v e }$ , $S T A C K \_ P U S H$ pushes $v _ { a c t i v e }$ to the top of the stack, $S T A C K \_ P O P$ writes a null value to the top of the stack, and $R E S U L T$ writes $v _ { a c t i v e }$ to $Q _ { r e s u l t } ( p _ { r e s u l t } )$ .
319
+
320
+ ARG 2 (Auxiliary Variable): COLOR GREY, COLOR BLACK
321
+
322
+ COLOR GREY and COLOR BLACK color the given vertex grey and black, respectively.
323
+
324
+ MOVE. The MOVE operation has the following arguments:
325
+
326
+ ARG 1 (Pointer): $p _ { r e s u l t } , p _ { s t a c k } , p _ { s t a r t } , c h i l d L i s t [ v _ { a c t i v e } ] , c h i l d L i s t [ v _ { s a v e } ]$
327
+
328
+ Note that the argument is the identity of the pointer, not what the pointer points to; in other words, ARG 1 can only take one of 5 values.
329
+
330
+ ARG 2 (Increment or Decrement): UP, DOWN
331
+
332
+ # A.2 TRACE-GENERATING FUNCTIONS FOR TOPOLOGICAL SORT
333
+
334
+ # A.2.1 NON-RECURSIVE TRACE-GENERATING FUNCTIONS
335
+
336
+ 1 // Top level topological sort call
337
+ 2 TOPOSORT() {
338
+ 3 while $( Q _ { c o l o r } \big ( p _ { s t a r t } \big )$ is a valid color): // color invalid when all vertices explored
339
+ 4 WRITE(ACTIVE_START)
340
+ 5 WRITE(COLOR_CURR, COLOR_GREY)
341
+ 6 TRAVERSE()
342
+ 7 MOVE(pstart, UP)
343
+ 8 NEXT_START()
344
+ 9 }
345
+ 10
346
+ 11 TRAVERSE() {
347
+ 12 CHECK_CHILD()
348
+ 13 EXPLORE()
349
+ 14 }
350
+ 15
351
+ 16 CHECK_CHILD() {
352
+ 17 while $( Q _ { c o l o r } \big ( D A G \big [ v _ { a c t i v e } \big ] \big [ c h i l d L i s t \big [ v _ { a c t i v e } \big ] \big ] \big )$ is not white and is not invalid): // color invalid when all children explored
353
+ 18 MOVE(childList[vactive], UP)
354
+ 19 }
355
+ 20
356
+ 21 EXPLORE() {
357
+ 22 do
358
+ 23 if (Qcolor(DAG[vactive][childList[vactive]]) is white):
359
+ 24 WRITE(COLOR_NEXT, COLOR_GREY)
360
+ 25 STACK(PUSH)
361
+ 26 WRITE(SAVE)
362
+ 27 WRITE(ACTIVE_NEIGHB)
363
+ 28 MOVE(childList[vsave], UP)
364
+ 29 else:
365
+ 30 WRITE(COLOR_CURR, COLOR_BLACK)
366
+ 31 WRITE(RESULT)
367
+ 32 MOVE(presult, UP)
368
+ 33 if(pstack == 1):
369
+ 34 break
370
+ 35 else:
371
+ 36 STACK(POP)
372
+ 37 CHECK_CHILD()
373
+ 38 while (true)
374
+ 39
375
+ 40
376
+ 41 STACK(op) {
377
+ 42 if (op == PUSH):
378
+ 43 WRITE(STACK_PUSH)
379
+ 44 MOVE(pstack, UP)
380
+ 45
381
+ 46 if (op == POP):
382
+ 47 WRITE(ACTIVE_STACK)
383
+ 48 WRITE(STACK_POP)
384
+ 49 MOVE(pstack, DOWN)
385
+ 50 }
386
+ 51
387
+ 52 NEXT_START() {
388
+ 53 while(Qcolor(pstart) is not white and is not invalid): // color invalid when all vertices explored
389
+ 54 MOVE(pstart, UP)
390
+ 55 }
391
+
392
+ # A.2.2 RECURSIVE TRACE-GENERATING FUNCTIONS
393
+
394
+ # Altered Recursive Functions
395
+
396
+ 1 // Top level topological sort call
397
+ 2 TOPOSORT() {
398
+ 3 if $\scriptstyle : Q _ { c o l o r }$ $_ { p _ { s t a r t } } ,$ is a valid color): // color invalid when all vertices explored
399
+ 4 WRITE(ACTIVE_START)
400
+ 5 WRITE(COLOR_CURR, COLOR_GREY)
401
+ 6 TRAVERSE()
402
+ 7 MOVE(pstart, UP)
403
+ 8 NEXT_START()
404
+ 9 TOPOSORT() // Recursive Call
405
+ 10 }
406
+ 11
407
+ 12 CHECK_CHILD() {
408
+ 13 if $\overline { { ( Q _ { c o l o r } ( D A G [ v _ { a c t i v e } ] [ c h i l d L i s t [ v _ { a c t i v e } ] ] ) } } ) \overline { { { } } }$ is not white and is not invalid): // color invalid when all children explore
409
+ 14 MOVE(childList[vactive], UP)
410
+ 15 CHECK_CHILD() // Recursive Call
411
+ 16 }
412
+ 17
413
+ 18 EXPLORE() {
414
+ 19 if (Qcolor(DAG[vactive][childList[vactive]]) is white):
415
+ 20 WRITE(COLOR_NEXT, COLOR_GREY)
416
+ 21 STACK(PUSH)
417
+ 22 WRITE(SAVE)
418
+ 23 WRITE(ACTIVE_NEIGHB)
419
+ 24 MOVE(childList[vsave], UP)
420
+ 25 else:
421
+ 26 WRITE(COLOR_CURR, COLOR_BLACK)
422
+ 27 WRITE(RESULT)
423
+ 28 MOVE(presult, UP)
424
+ 29 if $( p _ { s t a c k } = = 1$ ):
425
+ 30 return
426
+ 31 else:
427
+ 32 STACK(POP)
428
+ 33 CHECK_CHILD()
429
+ 34 EXPLORE() // Recursive Call
430
+ 35 }
431
+ 36
432
+ 37 NEXT_START() {
433
+ 38 if $( Q _ { c o l o r } \left( p _ { s t a r t } \right)$ is not white and is not invalid): // color invalid when all vertices explored
434
+ 39 MOVE $( p _ { s t a r t }$ , UP)
435
+ 40 NEXT_START() // Recursive Call
436
+ 41 }
437
+
438
+ # Algorithm 4 Iterative Quicksort
439
+
440
+ 1: Initialize an array $A$ to sort and two empty stacks $S _ { l o }$ and $S _ { h i }$ .
441
+ 2: Initialize lo and $h i$ to be 1 and $n$ , where $n$ is the length of $A$ .
442
+ 3:
443
+ 4: function PARTITION $( A , l o , h i )$
444
+ 5: $p i v o t = l o$
445
+ 6: for $j \in [ l o , h i - 1 ] : \mathbf { d o }$
446
+ 7: if $A [ j ] \leq A [ h i ]$ then
447
+ 8: swap A[pivot] with $A [ j ]$
448
+ 9: pivot = pivot + 1
449
+ 10: swap A[pivot] with $A [ h i ]$
450
+ 11: return pivot
451
+ 12:
452
+ 13: function QUICK ${ \mathrm { : } } \operatorname { S o R T } ( A , l o , h i )$
453
+ 14: while $S _ { l o }$ and $S _ { h i }$ are not empty: do
454
+ 15: Pop states off $S _ { l o }$ and $S _ { h i }$ , writing them to $l o$ and $h i$ .
455
+ 16: $\mathsf { p } = \mathsf { P A R T I T I O N } ( A , l o , h i )$
456
+ 17: Push $p + 1$ and $h i$ to $S _ { l o }$ and $S _ { h i }$ .
457
+ 18: Push lo and $p - 1$ to $S _ { l o }$ and $S _ { h i }$ .
458
+
459
+ A.4 PROGRAM SET FOR QUICKSORT
460
+
461
+ <table><tr><td rowspan=1 colspan=1>Program</td><td rowspan=1 colspan=1>Descriptions</td><td rowspan=1 colspan=1>Calls</td><td rowspan=1 colspan=1> Arguments</td></tr><tr><td rowspan=1 colspan=1>QUICKSORT</td><td rowspan=1 colspan=1>Runthequicksortroutine in place forthearrayA,forindices from lo to hi</td><td rowspan=1 colspan=1>Non-Recursive: PAR-TITION, STACK,WRITERecursive: same asnon-recursiveversion,alongwithQUICK-SORT</td><td rowspan=1 colspan=1>Implicitly:arrayA to sort, lo, hi</td></tr><tr><td rowspan=1 colspan=1>PARTITION</td><td rowspan=1 colspan=1>Runsthepartitionfunction. At end,pointer Ppivot ismoved to the pivot</td><td rowspan=1 colspan=1>COMPSWAP_LOOP,MOVE_PIVOT_LO,MOVE_JLO, SWAP</td><td rowspan=1 colspan=1>NONE</td></tr><tr><td rowspan=1 colspan=1>COMPSWAPLOOP</td><td rowspan=1 colspan=1>Runs the FOR loopinside the partitionfunction</td><td rowspan=1 colspan=1>COMPSWAP, MOVE</td><td rowspan=1 colspan=1>NONE</td></tr><tr><td rowspan=1 colspan=1>COMPSWAP</td><td rowspan=1 colspan=1>ComparesA[pivot] ≤ A[j]; ifso,perform a swapand increment Ppivot</td><td rowspan=1 colspan=1>SWAP, MOVE</td><td rowspan=1 colspan=1>NONE</td></tr><tr><td rowspan=1 colspan=1>SET_PIVOTLO</td><td rowspan=1 colspan=1>Sets Ppivot to lo in-dex</td><td rowspan=1 colspan=1>NONE</td><td rowspan=1 colspan=1>NONE</td></tr><tr><td rowspan=1 colspan=1>SETJLO</td><td rowspan=1 colspan=1>Sets pj to lo index</td><td rowspan=1 colspan=1>NONE</td><td rowspan=1 colspan=1>NONE</td></tr><tr><td rowspan=1 colspan=1>SET_J_NULL</td><td rowspan=1 colspan=1>Sets pj to-00</td><td rowspan=1 colspan=1>NONE</td><td rowspan=1 colspan=1>NONE</td></tr><tr><td rowspan=1 colspan=1>STACK</td><td rowspan=1 colspan=1>Pushes lo/hi statesonto stacks Sto andShi according to argument(describedbelow)</td><td rowspan=1 colspan=1>WRITE, MOVE</td><td rowspan=1 colspan=1>Described below</td></tr><tr><td rowspan=1 colspan=1>MOVE</td><td rowspan=1 colspan=1>Movespointerone unit up or down</td><td rowspan=1 colspan=1>NONE</td><td rowspan=1 colspan=1>Described below</td></tr><tr><td rowspan=1 colspan=1>SWAP</td><td rowspan=1 colspan=1>Swapselementsatgiven array indices</td><td rowspan=1 colspan=1>NONE</td><td rowspan=1 colspan=1>Described below</td></tr><tr><td rowspan=1 colspan=1>WRITE</td><td rowspan=1 colspan=1>Write a valueeither to stack(e.g QstackLoorQstackHi) or topointer (e.g tochangethe value ofPhi)</td><td rowspan=1 colspan=1>NONE</td><td rowspan=1 colspan=1>Described below</td></tr></table>
462
+
463
+ Argument Sets for STACK, MOVE, SWAP, WRITE.
464
+
465
+ STACK. The STACK operation has the following arguments:
466
+
467
+ ARG 1 (Operation): STACK PUSH CALL1, STACK PUSH CALL2, STACK POP
468
+
469
+ STACK PUSH CALL1 pushes $l o$ and pivot−1 to $Q _ { s t a c k L o }$ and $Q _ { s t a c k H i }$ . STACK PUSH CALL2 pushes pivot $+ 1$ and $h i$ to $Q _ { s t a c k L o }$ and $Q _ { s t a c k H i }$ . STACK POP pushes $- \infty$ values to $Q _ { s t a c k L o }$ and $Q _ { s t a c k H i }$ .
470
+
471
+ MOVE. The MOVE operation has the following arguments:
472
+
473
+ ARG 1 (Pointer): pstackLo, pstackHi, pj , ppivot
474
+
475
+ Note that the argument is the identity of the pointer, not what the pointer points to; in other words, ARG 1 can only take one of 4 values.
476
+
477
+ ARG 2 (Increment or Decrement): UP, DOWN
478
+
479
+ SWAP. The SWAP operation has the following arguments:
480
+
481
+ ARG 1 (Swap Object 1): ppivot
482
+
483
+ ARG 2 (Swap Object 2): $p _ { h i } , p _ { j }$
484
+
485
+ WRITE. The WRITE operation has the following arguments:
486
+
487
+ ARG 1 (Object to Write): ENV STACK LO, ENV STACK HI, $p _ { h i } , p _ { l o }$
488
+
489
+ ENV STACK LO and ENV STACK HI represent $Q _ { s t a c k L o } ( p _ { s t a c k L o } ) $ and $Q _ { s t a c k H i } ( p _ { s t a c k H i } )$ , re spectively.
490
+
491
+ ARG 2 (Object to Copy): ENV STACK LO PEEK, ENV STACK HI PEEK, $p _ { h i } , p _ { l o } , p _ { p i v o t } - 1$ ppivot + 1, RESET
492
+
493
+ ENV STACK LO PEEK and ENV STACK HI PEEK represent $Q _ { s t a c k L o } ( p _ { s t a c k L o } \mathrm { ~ - ~ } 1 )$ and $Q _ { s t a c k H i } ( p _ { s t a c k H i } - 1 )$ , respectively. RESET represents a $- \infty$ value.
494
+
495
+ Note that the argument is the identity of the pointer, not what the pointer points to; in other words, ARG 1 can only take one of 4 values, and ARG 2 can only take one of 7 values.
496
+
497
+ # A.5 TRACE-GENERATING FUNCTIONS FOR QUICKSORT
498
+
499
+ # A.5.1 NON-RECURSIVE TRACE-GENERATING FUNCTIONS
500
+
501
+ 1 Initialize $p _ { l o }$ to 1 and $p _ { h i } \ t \circ \ n$ (length of array)
502
+ 2 Initialize $p _ { j } ~ \mathsf { t o } ~ - \infty$
503
+ 3
504
+ 4 QUICKSORT() {
505
+ 5 while $( p _ { s t a c k L o } \neq 1 )$ :
506
+ 6 if $( \stackrel { } { Q } _ { s t a c k L o } ^ { \prime \prime } ( \stackrel { \prime } { p } _ { s t a c k L o } - 1 ) < Q _ { s t a c k H i } ( p _ { s t a c k H i } - 1 ) ) :$
507
+ 7 STACK(STACK_POP)
508
+ 8 else:
509
+ 9 WRITE $( \boldsymbol { p } _ { h i }$ , ENV_STACK_HI_PEEK)
510
+ 10 WRITE(plo, ENV_STACK_LO_PEEK)
511
+ 11 STACK(STACK_POP)
512
+ 12 PARTITION()
513
+ 13 STACK(STACK_PUSH_CALL2)
514
+ 14 STACK(STACK_PUSH_CALL1)
515
+ 15 }
516
+ 16
517
+ 17 PARTITION() {
518
+ 18 SET_PIVOT_LO()
519
+ 19 SET_J_LO()
520
+ 20 COMPSWAP_LOOP()
521
+ 24 SWAP(ppivot, phi)
522
+ SET_J_NULL()
523
+ }
524
+ COMPSWAP_LOOP() {
525
+ while $( p _ { j } \neq p _ { h i } )$ :
526
+ COMPSWAP()
527
+ MOVE $( p _ { j }$ , UP)
528
+ }
529
+ 30
530
+ 31 COMPSWAP() {
531
+ 32 if (A[pj ] ≤ A[phi]):
532
+ 33 SWAP(ppivot, pj)
533
+ 34 MOVE(ppivot, UP)
534
+ 35 }
535
+ 36
536
+ 37 STACK(op) {
537
+ 38 if (op == STACK_PUSH_CALL1):
538
+ 39 WRITE(ENV_STACK_LO, plo)
539
+ 40 WRITE(ENV_STACK_HI, ppivot − 1)
540
+ 41 MOVE(pstackLo, UP)
541
+ 42 MOVE(pstackHi, UP)
542
+ 43
543
+ 44 if (op $= =$ STACK_PUSH_CALL2):
544
+ 45 WRITE(ENV_STACK_LO, ppivot $^ { + 1 1 }$ )
545
+ 46 WRITE(ENV_STACK_HI, $p _ { h i }$ )
546
+ 47 MOVE(pstackLo, UP)
547
+ 48 MOVE(pstackHi, UP)
548
+ 49
549
+ 50 if (op $= =$ STACK_POP):
550
+ 51 WRITE(ENV_STACK_LO, RESET)
551
+ 52 WRITE(ENV_STACK_HI, RESET)
552
+ 53 MOVE(pstackLo, DOWN)
553
+ 54 MOVE(pstackHi, DOWN)
554
+ 55 }
555
+
556
+ # A.5.2 RECURSIVE TRACE-GENERATING FUNCTIONS
557
+
558
+ # Altered Recursive Functions
559
+
560
+ Initialize to 1 and $p _ { h i } \ t \circ \ n$ (length of array)
561
+
562
+ 1 $p _ { l o }$
563
+ 2 Initialize $p _ { j }$ to −∞
564
+ 3
565
+ 4 QUIC $\begin{array} { r l } & { \mathrm { \sf { A S O R T } \left( \tau \right) } \quad \mathrm { \sf { \{ } } } \\ & { \mathrm { \sf { ( } } Q _ { s t a c k L o } ( p _ { s t a c k L o } - 1 ) < Q _ { s t a c k H i } ( p _ { s t a c k H i } - 1 ) ) : } \\ & { \mathrm { \sf { 2 } } \mathrm { \sf { A R T I T I O N } \left( \tau \right) } } \end{array}$
566
+ 5 if
567
+ 6
568
+ 7 STACK(STACK_PUSH_CALL2)
569
+ 8 STACK(STACK_PUSH_CALL1)
570
+ 9 WRITE $( p _ { h i }$ , ENV_STACK_HI_PEEK)
571
+ 10 WRITE $( p _ { l o }$ , ENV_STACK_LO_PEEK)
572
+ 11 QUICKSORT() // Recursive Call
573
+ 12 STACK(STACK_POP)
574
+ 13 WRITE $( p _ { h i }$ , ENV_STACK_HI_PEEK)
575
+ 14 WRITE $( p _ { l o }$ , ENV_STACK_LO_PEEK)
576
+ 15 QUICKSORT() // Recursive Call
577
+ 16 STACK(STACK_POP)
578
+ 17 }
579
+ 18
580
+ 19 COMPSWAP_LOOP() {
581
+ 20 if $( p _ { j } \neq p _ { h i } )$ :
582
+ 21 COMPSWAP()
583
+ 22 MOVE $( p _ { j }$ , UP)
584
+ 23 COMPSWAP_LOOP() // Recursive Call
585
+ 24 }
586
+
587
+ A.6 BASE CASES, REDUCTION RULES, AND VERIFICATION SETS
588
+
589
+ In this section, we describe the space of base cases and reduction rules that must be covered for each of the four sample tasks, in order to create the verification set.
590
+
591
+ For addition, we analytically determine the verification set. For tasks other than addition, it is difficult to analytically determine the verification set, so instead, we randomly generate input candidates until they completely cover the base cases and reduction rules.
592
+
593
+ Base Cases and Reduction Rules for Addition. For the recursive formulation of addition, we analytically construct the set of input problems that cover all base cases and reduction rules. We outline how to construct this set.
594
+
595
+ It is sufficient to construct problems where every transition between two adjacent columns is covered. The ADD reduction rule ensures that each call to ADD only covers two adjacent columns, and so the LSTM only ever runs for a fixed number of steps necessary to process these two columns.
596
+
597
+ We construct input problems by splitting into two cases: one case in which the left column contains a null value and another in which the left column does not contain any null values. We then construct problem configurations that span all possible valid environment states (for instance, in order to force the carry bit in a column to be 1, one can add the sum $\cdot _ { 1 + 9 } ,$ in the column to the right).
598
+
599
+ The operations we need to be concerned most about are CARRY and LSHIFT, which induce partial environment states spanning two columns. It is straightforward to deal with all other operations, which do not induce partial environment states.
600
+
601
+ Under the assumption that there are no leading 0’s (except in the case of single digits) and the two numbers to be added have the same number of digits, the verification set for addition contains 20,181 input problems. The assumption of leading 0’s can be easily removed, at the cost of slightly increasing the size of the verification set. We made the assumption of equivalent lengths in order to parametrize the input format with respect to length, but this assumption can be removed as well.
602
+
603
+ Base Cases and Reduction Rules for Bubble Sort. The original version of the bubblesort implementation exposes the values within the array. While this matches the description from Reed & de Freitas (2016), we found that this causes an unnecessary blowup in the size of $V$ and makes it much more difficult to construct the verification set. For purposes of verification, we replace the domain-specific encoder with the following:
604
+
605
+ $$
606
+ \begin{array} { r l } & { f _ { e n c } ( Q , i _ { 1 } , i _ { 2 } , i _ { 3 } , a _ { t } ) = M L P ( [ Q ( 1 , i _ { 1 } ) \leq Q ( 1 , i _ { 2 } ) , 1 \leq i _ { 1 } \leq l e n g t h , 1 \leq i _ { 2 } \leq l e n g t h , } \\ & { ~ i _ { 3 } = = l e n g t h , a _ { t } ( 1 ) , a _ { t } ( 2 ) , a _ { t } ( 3 ) ] ) , } \end{array}
607
+ $$
608
+
609
+ Table 4: Accuracy on Randomly Generated Problems for Variant of Bubble Sort
610
+
611
+ <table><tr><td>Length of Array</td><td>Non-Recursive</td><td>Recursive</td></tr><tr><td></td><td>100%</td><td>100%</td></tr><tr><td>23</td><td>100%</td><td>100%</td></tr><tr><td>4</td><td>100%</td><td>100%</td></tr><tr><td>5</td><td>100%</td><td>100%</td></tr><tr><td>6</td><td>90%</td><td>100%</td></tr><tr><td>7</td><td>86.7%</td><td>100%</td></tr><tr><td>8</td><td>6.7%</td><td>100%</td></tr><tr><td>9</td><td>0%</td><td>100%</td></tr><tr><td>10</td><td>0%</td><td></td></tr><tr><td>12</td><td>0%</td><td>100%</td></tr><tr><td>15</td><td>0%</td><td>100%</td></tr><tr><td></td><td></td><td>100%</td></tr><tr><td>70</td><td>0%</td><td>100%</td></tr></table>
612
+
613
+ which directly exposes which of the two values pointed to is larger. This modification also enables us to sort arrays containing arbitrary comparable elements.
614
+
615
+ By reasoning about the possible set of environment observations created by all valid inputs, we construct $V$ using the procedure described in Section 3.3. Using this modification, we constructed a verification set consisting of one array of size 10.
616
+
617
+ We also report on generalization results for the non-recursive and recursive versions of this variant of bubble sort. Table 4 demonstrates that the accuracy of the non-recursive program degrades sharply when moving from arrays of length 7 to arrays of length 8. This is due to the properties of the training set – we trained on 2 traces synthesized from arrays of length 7 and 1 trace synthesized from an array of length 6. Table 4 also demonstrates that the (verified) recursive program generalizes perfectly.
618
+
619
+ Base Cases and Reduction Rules for Topological Sort. For each function we use to implement the recursive version of topological sort, we need to consider the set of possible environment observation sequences we can create from all valid inputs and test that the learned program produces the correct behavior on each of these inputs. We have three observations: the color of the start node, the color of the active node’s next child to be considered, and whether the stack is empty. Na¨ıvely, we might expect to synthesize and test an input for any sequence created by combining the four possible colors in two variables and another boolean variable for whether the stack is empty (so 32 possible observations at any point), but for various reasons, most of these combinations are impossible to occur at any given point in the execution trace.
620
+
621
+ Through careful reasoning about the possible set of environment observations created by all valid inputs, and how each of the operations in the execution trace affects the environment, we can construct $V$ using the procedure described in Section 3.3. We then construct a verification set of size 73 by ensuring that randomly generated graphs cover the analytically derived $V$ . The model described in the training setup of Section 4 (trained on 6 traces) was verified to be correct via the matching procedure described in Section 4.2.
622
+
623
+ Base Cases and Reduction Rules for Quicksort. As with the others, we apply the procedure described in Section 3.3 to construct $V$ and then empirically create a verification set which covers $V$ . The verification set can be very small, as we found a 10-element array ([8,2,1,2,0,8,5,8,3,7]) is sufficient to cover all of $V$ . We note that an earlier version of quicksort we tried lacked primitive operations to directly move a pointer to another, and therefore needed more functions and observations. As this complexity interfered with determining the base cases and reductions, we changed the algorithm to its current form. Even though the earlier version also generalized just as well in practice, relatively small differences in the formulation of the traces and the environment observations can drastically change the difficulty of verification.
md/train/BkdpaH9ll/BkdpaH9ll.md ADDED
@@ -0,0 +1,273 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # BOOSTING IMAGE CAPTIONING WITH ATTRIBUTES
2
+
3
+ Ting Yao, Yingwei Pan, Yehao Li, Zhaofan Qiu, Tao Mei Microsoft Research Asia {tiyao, v-yipan, v-yehl, v-zhqiu, tmei}@microsoft.com
4
+
5
+ # ABSTRACT
6
+
7
+ Automatically describing an image with a natural language has been an emerging challenge in both fields of computer vision and natural language processing. In this paper, we present Long Short-Term Memory with Attributes (LSTM-A) - a novel architecture that integrates attributes into the successful Convolutional Neural Networks (CNNs) plus Recurrent Neural Networks (RNNs) image captioning framework, by training them in an end-to-end manner. To incorporate attributes, we construct variants of architectures by feeding image representations and attributes into RNNs in different ways to explore the mutual but also fuzzy relationship between them. Extensive experiments are conducted on COCO image captioning dataset and our framework achieves superior results when compared to state-of-the-art deep models. Most remarkably, we obtain METEOR/CIDEr-D of $2 5 . 2 \% / 9 8 . 6 \%$ on testing data of widely used and publicly available splits in (Karpathy & Fei-Fei, 2015) when extracting image representations by GoogleNet and achieve to date top-1 performance on COCO captioning Leaderboard.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Accelerated by tremendous increase in Internet bandwidth and proliferation of sensor-rich mobile devices, image data has been generated, published and spread explosively, becoming an indispensable part of today’s big data. This has encouraged the development of advanced techniques for a broad range of image understanding applications. A fundamental issue that underlies the success of these technological advances is the recognition (Szegedy et al., 2015; Simonyan & Zisserman, 2015; He et al., 2016). Recently, researchers have strived to automatically describe the content of an image with a complete and natural sentence, which has a great potential impact for instance on robotic vision or helping visually impaired people. Nevertheless, this problem is very challenging, as description generation model should capture not only the objects or scenes presented in the image, but also be capable of expressing how the objects/scenes relate to each other in a nature sentence.
12
+
13
+ The main inspiration of recent attempts on this problem (Donahue et al., 2015; Vinyals et al., 2015; Xu et al., 2015; You et al., 2016) are from the advances by using RNNs in machine translation (Sutskever et al., 2014), which is to translate a text from one language (e.g., English) to another (e.g., Chinese). The basic idea is to perform a sequence to sequence learning for translation, where an encoder RNN reads the input sequential sentence, one word at a time till the end of the sentence and then a decoder RNN is exploited to generate the sentence in target language, one word at each time step. Following this philosophy, it is natural to employ a CNN instead of the encoder RNN for image captioning, which is regarded as an image encoder to produce image representations.
14
+
15
+ While encouraging performances are reported, these CNN plus RNN image captioning methods translate directly from image representations to language, without explicitly taking more high-level semantic information from images into account. Furthermore, attributes are properties observed in images with rich semantic cues and have been proved to be effective in visual recognition (Parikh & Grauman, 2011). A valid question is how to incorporate high-level image attributes into CNN plus RNN image captioning architecture as complementary knowledge in addition to image representations. We investigate particularly in this paper the architectures by exploiting the mutual relationship between image representations and attributes for enhancing image description generation. Specifically, to better demonstrate the impact of simultaneously utilizing the two kinds of representations, we devise variants of architectures by feeding them into RNN in different placements and moments, e.g., leveraging only attributes, inserting image representations first and then attributes or vice versa, and inputting image representations/attributes once or at each time step.
16
+
17
+ The main contribution of this work is the proposal of attribute augmented architectures by integrating the attributes into CNN plus RNN image captioning framework, which is a problem not yet fully understood in the literature. By leveraging more knowledge for building richer representations and description models, our work takes a further step forward to enhance image captioning and could have a direct impact of indicating a new direction of vision and language research. More importantly, the utilization of attributes also has a great potential to be an elegant solution of generating openvocabulary sentences, making image captioning system really practical.
18
+
19
+ # 2 RELATED WORK
20
+
21
+ The research on image captioning has proceeded along three different dimensions: template-based methods (Kulkarni et al., 2013; Yang et al., 2011; Mitchell et al., 2012), search-based approaches (Farhadi et al., 2010; Ordonez et al., 2011; Devlin et al., 2015), and language-based models (Donahue et al., 2015; Kiros et al., 2014; Mao et al., 2014; Vinyals et al., 2015; Xu et al., 2015; Wu et al., 2016; You et al., 2016).
22
+
23
+ The first direction, template-based methods, predefine the template for sentence generation which follows some specific rules of language grammar and split sentence into several parts (e.g., subject, verb, and object). With such sentence fragments, many works align each part with image content and then generate the sentence for the image. Obviously, most of them highly depend on the templates of sentence and always generate sentence with syntactical structure. For example, Kulkarni et al. employ Conditional Random Field (CRF) model to predict labeling based on the detected objects, attributes, and prepositions, and then generate sentence with a template by filling in slots with the most likely labeling (Kulkarni et al., 2013). Similar in spirit, Yang et al. utilize Hidden Markov Model (HMM) to select the best objects, scenes, verbs, and prepositions with the highest log-likelihood ratio for template-based sentence generation in (Yang et al., 2011). Furthermore, the traditional simple template is extended to syntactic trees in (Mitchell et al., 2012) which also starts from detecting attributes from image as description anchors and then connecting ordered objects with a syntactically well-formed tree, followed by adding necessary descriptive information.
24
+
25
+ Search-based approaches “generate” sentence for an image by selecting the most semantically similar sentences from sentence pool or directly copying sentences from other visually similar images. This direction indeed can achieve human-level descriptions as all sentences are from existing humangenerated sentences. The need to collect human-generated sentences, however, makes the sentence pool hard to be scaled up. Moreover, the approaches in this dimension cannot generate novel descriptions. For instance, in (Farhadi et al., 2010), an intermediate meaning space based on the triplet of object, action, and scene is proposed to measure the similarity between image and sentence, where the top sentences are regarded as the generated sentences for the target image. Ordonez et al. (Ordonez et al., 2011) search images in a large captioned photo collection by using the combination of object, stuff, people, and scene information and transfer the associated sentences to the query image. Recently, a simple $k$ -nearest neighbor retrieval model is utilized in (Devlin et al., 2015) and the best or consensus caption is selected from the returned candidate captions, which even performs as well as several state-of-the-art language-based models.
26
+
27
+ Different from template-based and search-based models, language-based models aim to learn the probability distribution in the common space of visual content and textual sentence to generate novel sentences with more flexible syntactical structures. In this direction, recent works explore such probability distribution mainly using neural networks for image captioning. For instance, in (Vinyals et al., 2015), Vinyals et al. propose an end-to-end neural networks architecture by utilizing LSTM to generate sentence for an image, which is further incorporated with attention mechanism in (Xu et al., 2015) to automatically focus on salient objects when generating corresponding words. More recently, in (Wu et al., 2016), high-level concepts/attributes are shown to obtain clear improvements on image captioning when injected into existing state-of-the-art RNN-based model and such visual attributes are further utilized as semantic attention in (You et al., 2016) to enhance image captioning.
28
+
29
+ In short, our work in this paper belongs to the language-based models. Different from most of the aforementioned language-based models which mainly focus on sentence generation by solely depending on image representations (Donahue et al., 2015; Kiros et al., 2014; Mao et al., 2014; Vinyals et al., 2015; Xu et al., 2015) or high-level attributes (Wu et al., 2016), our work contributes by studying not only jointly exploiting image representations and attributes for image captioning, but also how the architecture can be better devised by exploring mutual relationship in between. It is also worth noting that (You et al., 2016) also additionally involve attributes for image captioning. Ours is fundamentally different in the way that (You et al., 2016) is as a result of utilizing attributes to model semantic attention to the locally previous words, as opposed to holistically employing attributes as a kind of complementary representations in this work.
30
+
31
+ # 3 BOOSTING IMAGE CAPTIONING WITH ATTRIBUTES
32
+
33
+ In this paper, we devise our CNN plus RNN architectures to generate descriptions for images under the umbrella of additionally incorporating the detected high-level attributes. Specifically, we begin this section by presenting the problem formulation and followed by five variants of our image captioning frameworks with attributes.
34
+
35
+ # 3.1 PROBLEM FORMULATION
36
+
37
+ Suppose we have an image $I$ to be described by a textual sentence $s$ , where $\boldsymbol { S } = \{ w _ { 1 } , w _ { 2 } , . . . , w _ { N _ { s } } \}$ consisting of $N _ { s }$ words. Let $\mathbf { I } \in \mathbb { R } ^ { D _ { v } }$ and $\dot { \mathbf { w } } _ { t } \in \mathbb { R } ^ { D _ { s } }$ denote the $D _ { v }$ -dimensional image representations of the image $I$ and the $D _ { s }$ -dimensional textual features of the $t { \cdot }$ -th word in sentence $s$ , respectively. Furthermore, we have feature vector $\mathbf { A } \in \mathbb { R } ^ { D _ { a } }$ to represent the probability distribution over the high-level attributes for image $I$ . Specifically, we train the attribute detectors by using the weakly-supervised approach of Multiple Instance Learning (MIL) in (Fang et al., 2015) on image captioning benchmarks. For an attribute $w _ { a }$ , one image $I$ is regarded as a positive bag of regions (instances) if $w _ { a }$ exists in image $I$ ’s ground-truth sentences, and negative bag otherwise. By inputting all the bags into a noisy-OR MIL model, the probability of the bag $b _ { I }$ which contains attribute $w _ { a }$ is measured on the probabilities of all the regions in the bag as
38
+
39
+ $$
40
+ \mathrm { P r } _ { I } ^ { w _ { a } } = 1 - \prod _ { r _ { i } \in b _ { I } } ( 1 - p _ { i } ^ { w _ { a } } ) ,
41
+ $$
42
+
43
+ where $p _ { i } ^ { w _ { a } }$ is the probability of the attribute $w _ { a }$ predicted by region $r _ { i }$ and can be calculated through a sigmoid layer after the last convolutional layer in the fully convolutional network. In particular, the dimension of convolutional activations from the last convolutional layer is $x \times x \times h$ and $h$ represents the representation dimension of each region, resulting in $x \times x$ response map which preserves the spatial dependency of the image. Then, a cross entropy loss is calculated based on the probabilities of all the attributes at the top of the whole architecture to optimize MIL model. With the learnt MIL model on image captioning dataset, we treat the final image-level response probabilities of all the attributes as A.
44
+
45
+ Inspired by the recent successes of probabilistic sequence models leveraged in statistical machine translation (Bahdanau et al., 2015; Sutskever et al., 2014), we aim to formulate our image captioning models in an end-to-end fashion based on RNNs which encode the given image and/or its detected attributes into a fixed dimensional vector and then decode it to the target output sentence. Hence, the sentence generation problem we explore here can be formulated by minimizing the following energy loss function as
46
+
47
+ $$
48
+ E ( \mathbf { I } , \mathbf { A } , { \mathcal { S } } ) = - \log \operatorname* { P r } { ( { \mathcal { S } } | \mathbf { I } , \mathbf { A } ) } ,
49
+ $$
50
+
51
+ which is the negative log probability of the correct textual sentence given the image representations and detected attributes.
52
+
53
+ Since the model produces one word in the sentence at each time step, it is natural to apply chain rule to model the joint probability over the sequential words. Thus, the log probability of the sentence is given by the sum of the $\log$ probabilities over the word and can be expressed as
54
+
55
+ $$
56
+ \log \mathrm { P r } \left( \boldsymbol { S } | \mathbf { I } , \mathbf { A } \right) = \sum _ { t = 1 } ^ { N _ { s } } \log \mathrm { P r } \left( \mathbf { w } _ { t } | \mathbf { I } , \mathbf { A } , \mathbf { w } _ { 0 } , \ldots , \mathbf { w } _ { t - 1 } \right) .
57
+ $$
58
+
59
+ By minimizing this loss, the contextual relationship among the words in the sentence can be guaranteed given the image and its detected attributes.
60
+
61
+ ![](images/dc031104b16f9ee568836f3fac6ac9906ea9af1fd3163142c7eef6b54e411b57.jpg)
62
+ Figure 1: Five variants of our LSTM-A framework (better viewed in color).
63
+
64
+ We formulate this task as a variable-length sequence to sequence problem and model the parametric distribution $\operatorname* { P r } \left( \mathbf { w } _ { t } | \mathbf { I } , \mathbf { A } , \mathbf { w } _ { 0 } , \ldots , \mathbf { w } _ { t - 1 } \right)$ in Eq.(3) with Long Short-Term Memory (LSTM), which is a widely used type of RNN. The vector formulas for a LSTM layer forward pass are summarized as below. For time step $t$ , $\mathbf { x } ^ { t }$ and $\mathbf { h } ^ { t }$ are the input and output vector respectively, $\mathbf { T }$ are input weights matrices, $\mathbf { R }$ are recurrent weight matrices and b are bias vectors. Sigmoid $\sigma$ and hyperbolic tangent $\phi$ are element-wise non-linear activation functions. The dot product of two vectors is denoted with $\odot$ . Given inputs $\mathbf { x } ^ { t }$ , $\mathbf { h } ^ { t - 1 }$ and $\mathbf { c } ^ { t - 1 }$ , the LSTM unit updates for time step $t$ are:
65
+
66
+ $$
67
+ \begin{array} { r l } & { \mathbf { g } ^ { t } = \phi ( \mathbf { T } _ { g } \mathbf { x } ^ { t } + \mathbf { R } _ { g } \mathbf { h } ^ { t - 1 } + \mathbf { b } _ { g } ) , \mathbf { i } ^ { t } = \sigma \big ( \mathbf { T } _ { i } \mathbf { x } ^ { t } + \mathbf { R } _ { i } \mathbf { h } ^ { t - 1 } + \mathbf { b } _ { i } \big ) , } \\ & { \mathbf { f } ^ { t } = \sigma \big ( \mathbf { T } _ { f } \mathbf { x } ^ { t } + \mathbf { R } _ { f } \mathbf { h } ^ { t - 1 } + \mathbf { b } _ { f } \big ) , \mathbf { c } ^ { t } = \mathbf { g } ^ { t } \odot \mathbf { i } ^ { t } + \mathbf { c } ^ { t - 1 } \odot \mathbf { f } ^ { t } , } \\ & { \mathbf { o } ^ { t } = \sigma \big ( \mathbf { T } _ { o } \mathbf { x } ^ { t } + \mathbf { R } _ { o } \mathbf { h } ^ { t - 1 } + \mathbf { b } _ { o } \big ) , \mathbf { h } ^ { t } = \phi ( \mathbf { c } ^ { t } ) \odot \mathbf { o } ^ { t } , } \end{array}
68
+ $$
69
+
70
+ where $\mathbf { g } ^ { t } , \mathbf { i } ^ { t } , \mathbf { f } ^ { t } , \mathbf { c } ^ { t } , \mathbf { o } ^ { t }$ , and $\mathbf { h } ^ { t }$ are cell input, input gate, forget gate, cell state, output gate, and cell output of the LSTM, respectively.
71
+
72
+ # 3.2 LONG SHORT-TERM MEMORY WITH ATTRIBUTES
73
+
74
+ Unlike the existing image captioning models in (Donahue et al., 2015; Vinyals et al., 2015) which solely encode image representations for sentence generation, our proposed Long Short-Term Memory with Attributes (LSTM-A) model additionally integrates the detected high-level attributes into LSTM. We devise five variants of LSTM-A for involvement of two design purposes. The first purpose is about where to feed attributes into LSTM and three architectures, i.e., LSTM- $\mathbf { A } _ { 1 }$ (leveraging only attributes), LSTM- $\mathbf { \cdot A } _ { 2 }$ (inserting image representations first) and LSTM- $\mathbf { A } _ { 3 }$ (feeding attributes first), are derived from this view. The second is about when to input attributes or image representations into LSTM and we design LSTM- ${ \bf A } _ { 4 }$ (inputting image representations at each time step) and LSTM- ${ \bf A } _ { 5 }$ (inputting attributes at each time step) for this purpose. An overview of LSTM-A architectures is depicted in Figure 1.
75
+
76
+ # 3.2.1 LSTM- ${ \bf A } _ { 1 }$ (LEVERAGING ONLY ATTRIBUTES)
77
+
78
+ Given the detected attributes, one natural way is to directly inject the attributes as representations at the initial time to inform the LSTM about the high-level attributes. This kind of architecture with only attributes input is named as LSTM- $\mathbf { \delta A } _ { 1 }$ . It is also worth noting that the attributes-based model in (Wu et al., 2016) is similar to LSTM- $\mathbf { A } _ { 1 }$ and can be regarded as one special case of our LSTM-A. Given the attribute representations A and the corresponding sentence $\mathbf { W } \equiv [ \mathbf { w } _ { 0 } , \mathbf { w } _ { 1 } , . . . , \mathbf { w } _ { N _ { s } } ]$ , the LSTM updating procedure in LSTM- $\mathbf { A } _ { 1 }$ is as
79
+
80
+ $$
81
+ \begin{array} { c } { { \mathbf { x } ^ { - 1 } = { \mathbf { T } } _ { a } { \mathbf { A } } , } } \\ { { \mathbf { x } ^ { t } = { \mathbf { T } } _ { s } { \mathbf { w } } _ { t } , t \in \left\{ 0 , \ldots , N _ { s } - 1 \right\} \mathrm { a n d } \mathbf { h } ^ { t } = f \left( { \mathbf { x } } ^ { t } \right) , t \in \left\{ 0 , \ldots , N _ { s } - 1 \right\} , } } \end{array}
82
+ $$
83
+
84
+ where $D _ { e }$ is the dimensionality of LSTM input, $\mathbf { T } _ { a } \in \mathbb { R } ^ { D _ { e } \times D _ { a } }$ and $\mathbf { T } _ { s } \in \mathbb { R } ^ { D _ { e } \times D _ { s } }$ is the transformation matrix for attribute representations and textual features of word, respectively, and $f$ is the updating function within LSTM unit. Please note that for the input sentence $\mathbf { W } \equiv \left[ \mathbf { w } _ { 0 } , \ldots , \mathbf { w } _ { N _ { s } } \right]$ , we take $\mathbf { w } _ { 0 }$ as the start sign word to inform the beginning of sentence and ${ \bf w } _ { N _ { s } }$ as the end sign word which indicates the end of sentence. Both of the special sign words are included in our vocabulary. Most specifically, at the initial time step, the attribute representations are transformed as the input to LSTM, and then in the next steps, word embedding $\mathbf { x } ^ { t }$ will be input into the LSTM along with the previous step’s hidden state $\mathbf { h } ^ { t - 1 }$ . In each time step (except the initial step), we use the LSTM cell output $\mathbf { h } ^ { t }$ to predict the next word. Here a softmax layer is applied after the LSTM layer to produce a probability distribution over all the $D _ { s }$ words in the vocabulary as $\operatorname* { P r } _ { t + 1 } \left( w _ { t + 1 } \right) = \frac { \mathrm { e x p } \biggl \{ \mathbf { T } _ { h } ^ { \left( w _ { t + 1 } \right) } \mathbf { h } ^ { t } \biggr \} } { \underset { w \in \mathcal { W } } { \sum } \mathrm { e x p } \biggl \{ \mathbf { T } _ { h } ^ { \left( w \right) } \mathbf { h } ^ { t } \biggr \} }$ , where $\mathcal { W }$ is the word vocabulary space and $\mathbf { T } _ { h } ^ { \left( w \right) }$ is the parameter matrix in softmax layer.
85
+
86
+ # 3.2.2 LSTM- $\mathbf { A } _ { 2 }$ (INSERTING IMAGE REPRESENTATIONS FIRST)
87
+
88
+ To further leverage both image representations and high-level attributes in the encoding stage of our LSTM-A, we design the second architecture LSTM- $\mathbf { A } _ { 2 }$ by treating both of them as atoms in the input sequence to LSTM. Specifically, at the initial step, the image representations I are firstly transformed into LSTM to inform the LSTM about the image content, followed by the attribute representations A which are encoded into LSTM at the next time step to inform the high-level attributes. Then, LSTM decodes each output word based on previous word $\mathbf { x } ^ { t }$ and previous step’s hidden state $\mathbf { h } ^ { t - 1 }$ , which is similar to the decoding stage in LSTM- $\mathbf { \delta A } _ { 1 }$ . The LSTM updating procedure in LSTM- $\mathbf { \cdot A } _ { 2 }$ is designed as
89
+
90
+ $$
91
+ \begin{array} { r } { \begin{array} { c c } { \mathbf { x } ^ { - 2 } = \mathbf { T } _ { v } \mathbf { I } \mathrm { ~ a n d ~ } \mathbf { x } ^ { - 1 } = \mathbf { T } _ { a } \mathbf { A } , } \\ { \mathbf { x } ^ { t } = \mathbf { T } _ { s } \mathbf { w } _ { t } , t \in \left\{ 0 , \ldots , N _ { s } - 1 \right\} } \end{array} } \end{array}
92
+ $$
93
+
94
+ where $\mathbf { T } _ { v } \in \mathbb { R } ^ { D _ { e } \times D _ { v } }$ is the transformation matrix for image representations.
95
+
96
+ # 3.2.3 LSTM- $\mathbf { A } _ { 3 }$ (FEEDING ATTRIBUTES FIRST)
97
+
98
+ The third design LSTM- $\mathbf { A } _ { 3 }$ is similar to LSTM- $\mathbf { \cdot A } _ { 2 }$ as both designs utilize image representations and high-level attributes to form the input sequence to LSTM in the encoding stage, except that the orders of encoding are different. In LSTM- $\mathbf { \delta A _ { 3 } }$ , the attribute representations are firstly encoded into LSTM and then the image representations are transformed into LSTM at the second time step. The whole LSTM updating procedure in LSTM- $\mathbf { \delta A _ { 3 } }$ is as
99
+
100
+ $$
101
+ \begin{array} { r } { \begin{array} { c c } { \mathbf { x } ^ { - 2 } = \mathbf { T } _ { a } \mathbf { A } } & { \mathrm { a n d } \mathbf { x } ^ { - 1 } = \mathbf { T } _ { v } \mathbf { I } , } \\ { \mathbf { x } ^ { t } = \mathbf { T } _ { s } \mathbf { w } _ { t } , t \in \left\{ 0 , \ldots , N _ { s } - 1 \right\} } & { \mathrm { a n d } \mathbf { h } ^ { t } = f \left( \mathbf { x } ^ { t } \right) , t \in \left\{ 0 , \ldots , N _ { s } - 1 \right\} . } \end{array} } \end{array}
102
+ $$
103
+
104
+ # 3.2.4 LSTM- ${ \bf A } _ { 4 }$ (INPUTTING IMAGE REPRESENTATIONS AT EACH TIME STEP)
105
+
106
+ Different from the former three designed architectures which mainly inject high-level attributes and image representations at the encoding stage of LSTM, we next modify the decoding stage in our LSTM-A by additionally incorporating image representations or high-level attributes. More specifically, in LSTM- ${ \bf \cdot A } _ { 4 }$ , the attribute representations are injected once at the initial step to inform the LSTM about the high-level attributes, and then image representations are fed at each time step as an extra input to LSTM to emphasize the image content frequently among memory cells in LSTM. Hence, the LSTM updating procedure in LSTM- ${ \bf A } _ { 4 }$ is:
107
+
108
+ $$
109
+ \begin{array} { c } { { \mathbf { x } } ^ { - 1 } = { \mathbf { T } } _ { a } { \mathbf { A } } , } \\ { { \mathbf { x } } ^ { t } = { \mathbf { T } } _ { s } { \mathbf { w } } _ { t } + { \mathbf { T } } _ { v } { \mathbf { I } } , t \in \lbrace 0 , \ldots , N _ { s } - 1 \rbrace \quad \mathrm { a n d } \quad { \mathbf { h } } ^ { t } = f \left( { \mathbf { x } } ^ { t } \right) , t \in \lbrace 0 , \ldots , N _ { s } - 1 \rbrace . } \end{array}
110
+ $$
111
+
112
+ # 3.2.5 LSTM- $\mathrm { { A } _ { 5 } }$ (INPUTTING ATTRIBUTES AT EACH TIME STEP)
113
+
114
+ The last design LSTM- ${ \bf A } _ { 5 }$ is similar to LSTM- ${ \bf \cdot A } _ { 4 }$ except that it firstly encodes image representations and then feeds attribute representations as an additional input to LSTM at each step in decoding stage to emphasize the high-level attributes frequently. Accordingly, the LSTM updating procedure in LSTM- $\mathrm { { A } _ { 5 } }$ is as
115
+
116
+ $$
117
+ \begin{array} { c } { { \mathbf { x } ^ { - 1 } = { \mathbf { T } } _ { v } { \mathbf { I } } , } } \\ { { \mathbf { x } ^ { t } = { \mathbf { T } } _ { s } { \mathbf { w } } _ { t } + { \mathbf { T } } _ { a } { \mathbf { A } } , t \in \left\{ 0 , \ldots , N _ { s } - 1 \right\} \mathrm { a n d } \mathbf { h } ^ { t } = f \left( { \mathbf { x } } ^ { t } \right) , t \in \left\{ 0 , \ldots , N _ { s } - 1 \right\} . } } \end{array}
118
+ $$
119
+
120
+ # 4 EXPERIMENTS
121
+
122
+ We conducted our experiments on COCO captioning dataset (COCO) (Lin et al., 2014) and evaluated our approaches for image captioning.
123
+
124
+ # 4.1 DATASET
125
+
126
+ The dataset, COCO, is the most popular benchmark for image captioning, which contains 82,783 training images and 40,504 validation images. There are 5 human-annotated descriptions per image. As the annotations of the official testing set are not publicly available, we follow the widely used settings in prior works (You et al., 2016; Zhou et al., 2016) and take 82,783 images for training, 5,000 for validation and 5,000 for testing.
127
+
128
+ # 4.2 EXPERIMENTAL SETTINGS
129
+
130
+ Data Preprocessing. Following (Karpathy & Fei-Fei, 2015), we convert all the descriptions in training set to lower case and discard rare words which occur less than 5 times, resulting in the final vocabulary with 8,791 unique words in COCO dataset.
131
+
132
+ Features and Parameter Settings. Each word in the sentence is represented as “one-hot” vector (binary index vector in a vocabulary). For image representations, we take the output of 1,024-way $p o o l 5 / 7 \times 7 . s 1$ layer from GoogleNet (Szegedy et al., 2015) pre-trained on Imagenet ILSVRC12 dataset (Russakovsky et al., 2015). For attribute representations, we select 1,000 most common words on COCO as the high-level attributes and train the attribute detectors with MIL model (Fang et al., 2015) purely on the training data of COCO, resulting in the final 1,000-way vector of probabilities of attributes. The dimension of the input and hidden layers in LSTM are both set to 1,024.
133
+
134
+ Implementation Details. We mainly implement our image captioning models based on Caffe (Jia et al., 2014), which is one of widely adopted deep learning frameworks. Specifically, with an initial learning rate 0.01 and mini-batch size set 1,024, the objective value can decrease to $2 5 \%$ of the initial loss and reach a reasonable result after 50,000 iterations (about 123 epochs).
135
+
136
+ Testing Strategies. For sentence generation in testing stage, there are two common strategies. One is to choose the word with maximum probability at each time step and set it as LSTM input for next time step until the end sign word is emitted or the maximum length of sentence is reached. The other strategy is beam search which selects the top- $k$ best sentences at each time step and considers them as the candidates to generate new top- $k$ best sentences at the next time step. We adopt the second strategy and the beam size $k$ is empirically set to 3.
137
+
138
+ Moreover, to avoid model-level overfitting, we utilize ensembling strategy to fuse the prediction results of 5 identical models as previous works (Vinyals et al., 2015; You et al., 2016). Please note that all the 5 identical models are trained with different initializations separately.
139
+
140
+ Evaluation Metrics. For the evaluation of our proposed models, we adopt five metrics: BLEU $@ N$ (Papineni et al., 2002), METEOR (Banerjee & Lavie, 2005), ROUGE-L (Lin, 2004), CIDEr-D (Vedantam et al., 2015) and SPICE (Anderson et al., 2016). All the metrics are computed by using the codes1 released by COCO Evaluation Server (Chen et al., 2015).
141
+
142
+ # 4.3 COMPARED APPROACHES
143
+
144
+ To verify the merit of our LSTM-A models, we compared the following state-of-the-art methods.
145
+
146
+ (1) NIC & LSTM (Vinyals et al., 2015): NIC attempts to directly translate from image pixels to natural language with a single deep neural network. The image representations are only injected into LSTM at the initial time step. We directly extract the results reported in (You et al., 2016) and name this run as NIC. Furthermore, for fair comparison, we also include one run LSTM which is our implementation of NIC.
147
+
148
+ Table 1: Performance of our proposed models and other state-of-the-art methods on COCO, where $\mathbf { B } @ N$ , M, R, C and S are short for BLEU $@ N$ , METEOR, ROUGE-L, CIDEr-D and SPICE scores. All values are reported as percentage $( \% )$ .
149
+
150
+ <table><tr><td rowspan=1 colspan=1>Model</td><td rowspan=1 colspan=1>B@1</td><td rowspan=1 colspan=1>B@2</td><td rowspan=1 colspan=2>B@3</td><td rowspan=1 colspan=2>B@4</td><td rowspan=1 colspan=2>M</td><td rowspan=1 colspan=1>R</td><td rowspan=1 colspan=1>C</td><td rowspan=1 colspan=1>S</td></tr><tr><td rowspan=4 colspan=1>NIC (Vinyals et al., 2015)LRCN (Donahue et al., 2015)HA (Xu et al., 2015)SA (Xu et al., 2015)ATT (You et al., 2016)SC (Zhou et al., 2016)</td><td rowspan=3 colspan=1>66.669.771.8</td><td rowspan=1 colspan=1>45.1</td><td rowspan=1 colspan=2>30.4</td><td rowspan=1 colspan=2>20.3</td><td rowspan=1 colspan=2>122.9</td><td rowspan=3 colspan=1>150.8-</td><td rowspan=4 colspan=1>183.7--195.9</td><td rowspan=4 colspan=1>-15.8-11-</td></tr><tr><td rowspan=2 colspan=1>51.950.4</td><td rowspan=1 colspan=2>38.0</td><td rowspan=2 colspan=2>27.825</td><td rowspan=1 colspan=2>22.9</td></tr><tr><td rowspan=1 colspan=2>35.7</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=2>23</td></tr><tr><td rowspan=1 colspan=1>70.770.972</td><td rowspan=1 colspan=1>49.253.754.6</td><td rowspan=1 colspan=2>34.440.240.4</td><td rowspan=1 colspan=2>24.330.429.8</td><td rowspan=1 colspan=2>23.924.324.5</td><td rowspan=1 colspan=1>---</td></tr><tr><td rowspan=6 colspan=1>LSTM (Vinyals et al., 2015)LSTM-A1LSTM-A2LSTM-A3LSTM-A4LSTM-A5</td><td rowspan=2 colspan=1>68.472.3</td><td rowspan=1 colspan=1>51.2</td><td rowspan=1 colspan=2>38</td><td rowspan=1 colspan=2>28.4</td><td rowspan=1 colspan=2>23.1</td><td rowspan=1 colspan=1>50.7</td><td rowspan=1 colspan=1>84.3</td><td rowspan=1 colspan=1>16</td></tr><tr><td rowspan=2 colspan=1>55.856.4</td><td rowspan=3 colspan=2>4242.742.6</td><td rowspan=3 colspan=2>31.732.232.1</td><td rowspan=1 colspan=2>24.9</td><td rowspan=3 colspan=1>53.353.553.7</td><td rowspan=3 colspan=1>9697.598.4</td><td rowspan=3 colspan=1>17.81818.2</td></tr><tr><td rowspan=1 colspan=1>72.8</td><td rowspan=1 colspan=2>25</td></tr><tr><td rowspan=1 colspan=1>73.1</td><td rowspan=1 colspan=1>56.4</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=2>25.2</td></tr><tr><td rowspan=2 colspan=1>71.173</td><td rowspan=2 colspan=1>54.556.5</td><td rowspan=2 colspan=2>40.942.9</td><td rowspan=1 colspan=1>40.9</td><td rowspan=1 colspan=2>30.6</td><td rowspan=1 colspan=2>24</td><td rowspan=1 colspan=1>52.5</td><td rowspan=1 colspan=1>90.6</td><td rowspan=1 colspan=1>16.8</td></tr><tr><td rowspan=1 colspan=2>32.5</td><td rowspan=1 colspan=2>25.1</td><td rowspan=1 colspan=1>53.8</td><td rowspan=1 colspan=1>98.6</td><td rowspan=1 colspan=1>18.2</td></tr><tr><td rowspan=1 colspan=1>LSTM-A*</td><td rowspan=1 colspan=1>95.7</td><td rowspan=1 colspan=1>82.5</td><td rowspan=1 colspan=2>68.5</td><td rowspan=1 colspan=2>55.9</td><td rowspan=1 colspan=2>34.1</td><td rowspan=1 colspan=1>67.3</td><td rowspan=1 colspan=1>150.5</td><td rowspan=1 colspan=1>26.8</td></tr></table>
151
+
152
+ (2) LRCN (Donahue et al., 2015): LRCN inputs both image representations and previous word into LSTM at each time step for sentence generation.
153
+
154
+ (3) Hard-Attention (HA) & Soft-Attention (SA) (Xu et al., 2015): Spatial attention on convolutional features of an image is incorporated into the encoder-decoder framework through two kinds of mechanisms: 1) “hard” stochastic attention mechanism equivalently by reinforce learning and 2) “soft” deterministic attention mechanism with standard back-propagation.
155
+
156
+ (4) ATT (You et al., 2016): ATT utilizes attributes as semantic attention to combine image representations and attributes in RNN for image captioning.
157
+
158
+ (5) Sentence-Condition (SC) (Zhou et al., 2016): Sentence-condition is proposed most recently and exploits text-conditional semantic attention to generate semantic guidance for sentence generation by conditioning image features on current text content.
159
+
160
+ (6) MSR Captivator (Devlin et al., 2015): MSR Captivator employs both Multimodal Recurrent Neural Network (MRNN) and Maximum Entropy Language Model (MELM) (Fang et al., 2015) for sentence generation. Deep Multimodal Similarity Model (DMSM) (Fang et al., 2015) is further exploited for sentence re-ranking.
161
+
162
+ (7) CaptionBot (Tran et al., 2016): CaptionBot is a publicly image captioning system2 which is mainly built on vision models by using Deep residual networks (ResNets) (He et al., 2016) to detect visual concepts, MELM (Fang et al., 2015) language model for sentence generation and DMSM (Fang et al., 2015) for caption ranking. Entity recognition model for celebrities and landmarks is further incorporated to enrich captions and the confidence scoring model is finally utilized to select the output caption.
163
+
164
+ (8) LSTM-A: LSTM- $\mathbf { \delta A } _ { 1 }$ , LSTM- $\mathbf { A } _ { 2 }$ , LSTM- ${ \bf \delta A } _ { 3 }$ , LSTM- ${ \bf A } _ { 4 }$ , and LSTM- $\mathbf { A } _ { 5 }$ are five variants derived from our proposed LSTM-A framework. In addition, LSTM- $\mathbf { A } ^ { * }$ is an oracle run that inputs groundtruth attributes in the LSTM- $\mathbf { A } _ { 3 }$ architecture.
165
+
166
+ # 4.4 PERFORMANCE COMPARISON
167
+
168
+ Performance on COCO Table 1 shows the performances of different models on COCO image captioning dataset. It is worth noting that the performances of different approaches here are based on different image representations. Specifically, VGG architecture (Simonyan & Zisserman, 2015) is utilized as image feature extractor in the methods of Hard-Attention & Soft-Attention and SentenceCondition, while GoogleNet (Szegedy et al., 2015) is exploited in NIC, LRCN, ATT, LSTM and our LSTM-A. In view that the GoogleNet and VGG features are comparable, we compare directly with results. Overall, the results across eight evaluation metrics consistently indicate that our proposed LSTM-A exhibits better performance than all the state-of-the-art techniques including non-attention models (NIC, LSTM, LRCN) and attention-based methods (Hard-Attention, Soft-Attention, ATT, Sentence-Condition). In particular, the CIDEr-D can achieve $9 8 . 6 \%$ , which is to date the highest performance reported on COCO dataset when extracting image representations by GoogleNet. LSTM- $\mathbf { \delta A } _ { 1 }$ inputting only high-level attributes as representations makes the relative improvement over LSTM which feeds into image representations instead by $1 1 . 6 \%$ , $7 . 8 \%$ , $5 . 1 \%$ , $1 3 . 9 \%$ and $1 1 . 2 5 \%$ in BLEU $\textcircled { a } 4$ , METEOR, ROUGR-L, CIDEr-D and SPICE, respectively. The results basically indicate the advantage of exploiting high-level attributes than image representations for image captioning. Furthermore, by additionally incorporating attributes to LSTM model, LSTM- $\mathbf { A } _ { 2 }$ , $\mathrm { L S T M \mathrm { - } A _ { 3 } }$ and LSTM- $\mathrm { { A } _ { 5 } }$ lead to a performance boost, indicating that image representations and attributes are complementary and thus have mutual reinforcement for image captioning. Similar in spirit, LSTM- ${ \bf \cdot A } _ { 4 }$ improves LRCN by further taking attributes into account. There is a significant performance gap between ATT and LSTM- ${ \bf A } _ { 5 }$ . Though both runs involve the utilization of image representations and attributes, they are fundamentally different in the way that the performance of ATT is as a result of modulating the strength of attention on attributes to the previous words, and LSTM- ${ \bf \cdot A } _ { 5 }$ is by employing attributes as auxiliary knowledge to complement image representations. This somewhat reveals the weakness of semantic attention model, where the prediction errors will accumulate along the generated sequence.
169
+
170
+ Table 2: Leaderboard of the published state-of-the-art image captioning models on the online COCO testing server (http://mscoco.org/dataset/#captions-leaderboard), where $\mathbf { B } @ N$ , M, R, and C are short for BLEU $@ N$ , METEOR, ROUGE-L, and CIDEr-D scores. All values are reported as percentage $( \% )$ .
171
+
172
+ <table><tr><td rowspan=2 colspan=1>Model</td><td rowspan=1 colspan=1>B</td><td rowspan=1 colspan=1>@1</td><td rowspan=1 colspan=1>B</td><td rowspan=1 colspan=1>@2</td><td rowspan=1 colspan=1>B</td><td rowspan=1 colspan=1>@3</td><td rowspan=1 colspan=1>B</td><td rowspan=1 colspan=1>@4</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>M</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>R</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>C</td></tr><tr><td rowspan=1 colspan=1>c5</td><td rowspan=1 colspan=1>c40</td><td rowspan=1 colspan=1>c5</td><td rowspan=1 colspan=1>c40</td><td rowspan=1 colspan=1>c5</td><td rowspan=1 colspan=1>c40</td><td rowspan=1 colspan=1>c5</td><td rowspan=1 colspan=1>c40</td><td rowspan=1 colspan=1>c5</td><td rowspan=1 colspan=1>c40</td><td rowspan=1 colspan=1>c5</td><td rowspan=1 colspan=1>c40</td><td rowspan=1 colspan=1>c5</td><td rowspan=1 colspan=1>c40</td></tr><tr><td rowspan=1 colspan=1>MSM@MSRA(LSTM-A3)</td><td rowspan=1 colspan=1>75.1</td><td rowspan=1 colspan=1>92.6</td><td rowspan=1 colspan=1>58.8</td><td rowspan=1 colspan=1>85.1</td><td rowspan=1 colspan=1>44.9</td><td rowspan=1 colspan=1>75.1</td><td rowspan=1 colspan=1>34.3</td><td rowspan=1 colspan=1>64.6</td><td rowspan=1 colspan=1>26.6</td><td rowspan=1 colspan=1>36.1</td><td rowspan=1 colspan=1>55.2</td><td rowspan=1 colspan=1>70.9</td><td rowspan=1 colspan=1>104.9</td><td rowspan=1 colspan=1>105.3</td></tr><tr><td rowspan=1 colspan=1>ATT (You et al., 2016)</td><td rowspan=1 colspan=1>73.1</td><td rowspan=1 colspan=1>90</td><td rowspan=1 colspan=1>56.5</td><td rowspan=1 colspan=1>81.5</td><td rowspan=1 colspan=1>42.4</td><td rowspan=1 colspan=1>70.9</td><td rowspan=1 colspan=1>31.6</td><td rowspan=1 colspan=1>59.9</td><td rowspan=1 colspan=1>25</td><td rowspan=1 colspan=1>33.5</td><td rowspan=1 colspan=1>53.5</td><td rowspan=1 colspan=1>68.2</td><td rowspan=1 colspan=1>94.3</td><td rowspan=1 colspan=1>95.8</td></tr><tr><td rowspan=1 colspan=1>Google(Vinyals et al.,2015)</td><td rowspan=1 colspan=1>71.3</td><td rowspan=1 colspan=1>89.5</td><td rowspan=1 colspan=1>54.2</td><td rowspan=1 colspan=1>80.2</td><td rowspan=1 colspan=1>40.7</td><td rowspan=1 colspan=1>69.4</td><td rowspan=1 colspan=1>30.9</td><td rowspan=1 colspan=1>58.7</td><td rowspan=1 colspan=1>25.4</td><td rowspan=1 colspan=1>34.6</td><td rowspan=1 colspan=1>53</td><td rowspan=1 colspan=1>68.2</td><td rowspan=1 colspan=1>94.3</td><td rowspan=1 colspan=1>94.6</td></tr></table>
173
+
174
+ Table 3: The user study using two criteria: M1 - percentage of captions generated by different methods that are evaluated as better or equal to human caption and M2 - percentage of captions that pass the Turing Test.
175
+
176
+ <table><tr><td></td><td>Human</td><td>LSTM-A3</td><td>CaptionBot</td><td>LSTM</td><td>LRCN</td></tr><tr><td>M1</td><td>=</td><td>62.8</td><td>58.2</td><td>49.2</td><td>43.9</td></tr><tr><td>M2</td><td>90.1</td><td>72.2</td><td>66.3</td><td>57.3</td><td>55.9</td></tr></table>
177
+
178
+ Compared to LSTM- $\mathbf { \delta A } _ { 1 }$ , LSTM- $\mathbf { \cdot A } _ { 2 }$ which is augmented by integrating image representations performs better, but the performances are lower than LSTM- $\mathbf { \cdot A _ { 3 } }$ . The results indicate that LSTM- $\mathbf { A } _ { 3 }$ , in comparison, benefits from the mechanism of first feeding high-level attributes into LSTM instead of starting from inserting image representations in LSTM- $\mathbf { \cdot A } _ { 2 }$ . The chance that a good start point can be attained and lead to performance gain is better. LSTM- ${ \bf \cdot A } _ { 4 }$ feeding the image representations at each time step yields inferior performances to LSTM- $\mathbf { \cdot A _ { 3 } }$ , which only inputs image representations once. We speculate that this may because the noise in the image can be explicitly accumulated and thus the network overfits more easily. In contrast, the performances of LSTM- ${ \bf A } _ { 5 }$ which feeds attributes at each time step show the improvements on LSTM- $\mathbf { A } _ { 3 }$ . The results demonstrate that the high-level attributes are more accurate and easily translated into human understandable sentence. Among the five proposed LSTM-A architectures, LSTM- ${ \bf \cdot A } _ { 3 }$ achieves the best performances in terms of BLEU $@ 1$ and METEOR, while LSTM- $\mathbf { \cdot A } _ { 5 }$ performs the best in other six evaluation metrics. The performances of the oracle run LSTM- $\mathbf { A } ^ { * }$ could be regarded as the upper bound of employing attributes in our framework and lead to large performance gain against LSTM- $\mathbf { A } _ { 3 }$ . Such an upper bound enables us to obtain more insights on the factor accounting for the success of the current attribute augmented architecture and also provides guidance to future research in this direction. More specifically, the results, on one hand, indicate the advantage and great potential of leveraging attributes for boosting image captioning, and on the other, suggest that more efforts are further required towards mining and representing attributes more effectively.
179
+
180
+ Performance on COCO online testing server We also submitted our best run in terms of METEOR, i.e., LSTM- $\mathbf { A } _ { 3 }$ , to online COCO testing server and evaluated the performance on official testing set. Table 2 shows the performance Leaderboard on official testing image set with 5 reference captions (c5) and 40 reference captions (c40). Please note that here we utilize the outputs of 2,048-way pool5 layer from ResNet-152 as image representations and train the attribute detectors by ResNet-152 in our final submission. Only the latest top-3 performing methods which have been officially published are included in the table. Compared to the top performing methods, our proposed LSTM- ${ \bf \delta A } _ { 3 }$ achieves the best performance across all the evaluation metrics on both c5 and $\mathrm { c 4 0 }$ testing sets, and ranks the first on the Leaderboard.
181
+
182
+ ![](images/10029c54c6ff7d8c68b247dcfb30b19a55d32d6d6ac960d93654edeb851f616f.jpg)
183
+
184
+ ![](images/3142d03039b9add3e9f5494f4a0ff24f3534f8651562db66f2ca32405660417c.jpg)
185
+ Figure 2: Visualization of prediction changes w.r.t. the additional attribute inputs. The attributes are predicted by MIL method in (Fang et al., 2015) and the output sentences are generated by LSTM and LSTM- $\mathbf { A } _ { 3 }$ .
186
+ Figure 3: Sentence examples generated by our five LSTM-A architectures and one ground truth sentence.
187
+
188
+ # 4.5 HUMAN EVALUATION
189
+
190
+ To better understand how satisfactory are the sentences generated from different methods, we also conducted a human study to compare our LSTM- $\mathbf { \delta A _ { 3 } }$ against three approaches, i.e., CaptionBot, LRCN and LSTM. A total number of 12 evaluators (6 females and 6 males) from different education backgrounds, including computer science (4), business (2), linguistics (2) and engineering (4), are invited and a subset of 1,000 images is randomly selected from testing set for the subjective evaluation. The evaluation process is as follows. All the evaluators are organized into two groups. We show the first group all the four sentences generated by each approach plus the five human-annotated sentences and ask them the question: Do the systems produce captions resembling human-generated sentences? In contrast, we show the second group once only one sentence generated by different approach or human annotation and they are asked: Can you determine whether the given sentence has been generated by a system or by a human being? From evaluators’ responses, we calculate two metrics: 1) M1: percentage of captions that are evaluated as better or equal to human caption; 2) M2: percentage of captions that pass the Turing Test. Table 3 lists the result of the user study. Overall, our LSTM- $\mathbf { \cdot A _ { 3 } }$ is clearly the winner for all two criteria. In particular, the percentage achieves $6 2 . 8 \%$ and $7 2 . 2 \%$ in terms of M1 and M2, respectively, making the absolute improvement over the best competitor CaptionBot by $4 . 6 \%$ and $5 . 9 \%$ .
191
+
192
+ # 4.6 QUALITATIVE ANALYSIS
193
+
194
+ Visualization of prediction changes w.r.t. the additional attribute inputs. Figure 2 shows two image examples to illustrate the word prediction changes with respect to the additional attribute inputs. Take the first image as an example, the predicted subject is “a cake” in LSTM model. By additionally incorporating the detected attributes, e.g., “candles” and “birthday,” the output subject in the sentence by our LSTM- ${ \bf \delta A } _ { 3 }$ changes into “a birthday cake with candles,” demonstrating the advantage of the auxiliary attribute inputs.
195
+
196
+ ![](images/722ca6e0a12a39d4fecefda41bd7eb8ff05e5adc3f5eb43cdcd23090a7eee1ac.jpg)
197
+ Figure 4: Attributes and sentences generation results on COCO. The attributes are predicted by MIL method in (Fang et al., 2015) and the output sentences are generated by 1) LSTM, 2) CaptionBot2, 3) our LSTM-A3, and 4) Ground Truth: randomly selected three ground truth sentences.
198
+
199
+ Sentence generation comparison between five LSTM-A architectures. The examples of sentence generated by our five LSTM-A architectures are further illustrated in Figure 3. In general, the sentences generated by LSTM- $\mathbf { A } _ { 3 }$ and LSTM- ${ \bf \cdot A } _ { 5 }$ are very comparable and more accurate than those by LSTM- $\mathbf { A } _ { 1 }$ , LSTM- $\mathbf { A } _ { 2 }$ and LSTM- ${ \bf \cdot A } _ { 4 }$ . For instance, LSTM- $\mathbf { \cdot A _ { 3 } }$ and LSTM- ${ \bf A } _ { 5 }$ produce the sentence of “a bunch of stuffed animals hanging from a ceiling,” which describes the first image very precisely and finely.
200
+
201
+ Sentence generation comparison across different approaches. Figure 4 showcases a few sentence examples generated by different methods, the detected high-level attributes, and humanannotated ground truth sentences. From these exemplar results, it is easy to see that all of these automatic methods can generate somewhat relevant sentences, while our proposed LSTM- $\mathbf { \cdot A _ { 3 } }$ can predict more relevant keywords by jointly exploiting high-level attributes and image representations for image captioning. For example, compared to subject term “a group of people” and “a man” in the sentence generated by LSTM and CaptionBot respectively, “a man and a dog” in our LSTM- $\mathbf { A } _ { 3 }$ is more precise to describe the image content in the first image, since the keyword “dog” is one of the detected attributes and directly injected into LSTM to guide the sentence generation. Similarly, verb term “holding” which is also detected as one high-level attribute presents the fourth image more exactly. Moreover, our LSTM- ${ \bf \delta A } _ { 3 }$ can generate more descriptive sentence by enriching the semantics with high-level attributes. For instance, with the detected adjective “red,” the generated sentence “a red and white plane flying over a body of water” of the fifth image depicts the image content more comprehensive.
202
+
203
+ # 4.7 ANALYSIS OF THE BEAM SIZE $k$
204
+
205
+ In order to analyze the effect of the beam size $k$ in testing stage, we illustrate the performances of our two top performing architectures LSTM- $\mathbf { A } _ { 3 }$ and LSTM- $\mathbf { A } _ { 5 }$ with the beam size in the range of $\{ 1 , 2 , 3 , 4 , 5 \}$ in Figure 5. To make all performances fall into a comparable scale, all scores are normalized by the highest score of each evaluation metric. As shown in Figure 5, we can see that almost all performances in terms of each evaluation metric are like the “ $\wedge$ ” shapes when beam size $k$ varies from 1 to 5. Hence, we set the beam size $k$ as 3 in our experiments, which can achieve the best performance with a relatively small beam size.
206
+
207
+ ![](images/7efd57d7ac5e5fe05250042fdd0a2a212cdf1f602ff2981f2dc5ff17315d56f3.jpg)
208
+ Figure 5: The effect of beam size $k$ on (a) LSTM- $\mathbf { A } _ { 3 }$ and (b) LSTM- $\mathbf { \cdot A } _ { 5 }$ .
209
+
210
+ # 5 DISCUSSIONS AND CONCLUSIONS
211
+
212
+ We have presented Long Short-Term Memory with Attributes (LSTM-A) architectures which explores both image representations and high-level attributes for image captioning. Particularly, we study the problem of augmenting high-level attributes from images to complement image representations for enhancing sentence generation. To verify our claim, we have devised variants of architectures by modifying the placement and moment, where and when to feed into the two kinds of representations. Experiments conducted on COCO image captioning dataset validate our proposal and analysis. Performance improvements are clearly observed when comparing to other captioning techniques and more remarkably, the performance of our LSTM-A to date ranks the first on COCO image captioning Leaderboard.
213
+
214
+ Our future works are as follows. First, more attributes will be learnt from large-scale image benchmarks, e.g., YFCC-100M dataset, and integrated into image captioning. We will further analyze the impact of different number of attributes involved. Second, how to generate free-form and openvocabulary sentences with the learnt attributes is also expected.
215
+
216
+ # REFERENCES
217
+
218
+ Peter Anderson, Basura Fernando, Mark Johnson, and Stephen Gould. Spice: Semantic propositional image caption evaluation. In ECCV, 2016.
219
+ Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. Neural machine translation by jointly learning to align and translate. In ICLR, 2015.
220
+ Satanjeev Banerjee and Alon Lavie. Meteor: An automatic metric for mt evaluation with improved correlation with human judgments. In Proceedings of the ACL workshop on intrinsic and extrinsic evaluation measures for machine translation and/or summarization, 2005.
221
+ Xinlei Chen, Hao Fang, Tsung-Yi Lin, Ramakrishna Vedantam, Saurabh Gupta, Piotr Dollar, and C Lawrence ´ Zitnick. Microsoft COCO captions: Data collection and evaluation server. arXiv preprint arXiv:1504.00325, 2015.
222
+ Jacob Devlin, Hao Cheng, Hao Fang, Saurabh Gupta, Li Deng, Xiaodong He, Geoffrey Zweig, and Margaret Mitchell. Language models for image captioning: The quirks and what works. In ACL, 2015.
223
+ Jeffrey Donahue, Lisa Anne Hendricks, Sergio Guadarrama, Marcus Rohrbach, Subhashini Venugopalan, Kate Saenko, and Trevor Darrell. Long-term recurrent convolutional networks for visual recognition and description. In CVPR, 2015.
224
+ Hao Fang, Saurabh Gupta, Forrest Iandola, Rupesh K Srivastava, Li Deng, Piotr Dollar, Jianfeng Gao, Xi- ´ aodong He, Margaret Mitchell, John C Platt, C. Lawrence Zitnick, and Geoffrey Zweig. From captions to visual concepts and back. In CVPR, 2015.
225
+ Ali Farhadi, Mohsen Hejrati, Mohammad Amin Sadeghi, Peter Young, Cyrus Rashtchian, Julia Hockenmaier, and David Forsyth. Every picture tells a story: Generating sentences from images. In ECCV, 2010.
226
+
227
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In CVPR, 2016.
228
+
229
+ Yangqing Jia, Evan Shelhamer, Jeff Donahue, Sergey Karayev, Jonathan Long, Ross Girshick, Sergio Guadarrama, and Trevor Darrell. Caffe: Convolutional architecture for fast feature embedding. In MM, 2014.
230
+
231
+ Andrej Karpathy and Li Fei-Fei. Deep visual-semantic alignments for generating image descriptions. In CVPR, 2015.
232
+
233
+ Ryan Kiros, Ruslan Salakhutdinov, and Rich Zemel. Multimodal neural language models. In ICML, 2014.
234
+
235
+ Girish Kulkarni, Visruth Premraj, Vicente Ordonez, Sagnik Dhar, Siming Li, Yejin Choi, Alexander C Berg, and Tamara L Berg. Babytalk: Understanding and generating simple image descriptions. IEEE Trans. on PAMI, 2013.
236
+
237
+ Chin-Yew Lin. Rouge: A package for automatic evaluation of summaries. In ACL Workshop, 2004.
238
+
239
+ Tsung-Yi Lin, Michael Maire, Serge Belongie, James Hays, Pietro Perona, Deva Ramanan, Piotr Dollar, and ´ C Lawrence Zitnick. Microsoft coco: Common objects in context. In ECCV, 2014.
240
+
241
+ Junhua Mao, Wei Xu, Yi Yang, Jiang Wang, and Alan L. Yuille. Explain images with multimodal recurrent neural networks. In NIPS Workshop on Deep Learning, 2014.
242
+
243
+ Margaret Mitchell, Xufeng Han, Jesse Dodge, Alyssa Mensch, Amit Goyal, Alex Berg, Kota Yamaguchi, Tamara Berg, Karl Stratos, and Hal Daume III. Midge: Generating image descriptions from computer vision ´ detections. In EACL, 2012.
244
+
245
+ Vicente Ordonez, Girish Kulkarni, and Tamara L Berg. Im2text: Describing images using 1 million captioned photographs. In NIPS, 2011.
246
+
247
+ Kishore Papineni, Salim Roukos, Todd Ward, and Wei-Jing Zhu. Bleu: a method for automatic evaluation of machine translation. In ACL, 2002.
248
+
249
+ Devi Parikh and Kristen Grauman. Relative attributes. In ICCV, 2011.
250
+
251
+ Olga Russakovsky, Jia Deng, Hao Su, Jonathan Krause, Sanjeev Satheesh, Sean Ma, Zhiheng Huang, Andrej Karpathy, Aditya Khosla, Michael Bernstein, Alexander C. Berg, and Li Fei-Fei. ImageNet Large Scale Visual Recognition Challenge. IJCV, 2015.
252
+
253
+ Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. In ICLR, 2015.
254
+
255
+ Ilya Sutskever, Oriol Vinyals, and Quoc V Le. Sequence to sequence learning with neural networks. In NIPS, 2014.
256
+
257
+ Christian Szegedy, Wei Liu, Yangqing Jia, Pierre Sermanet, Scott Reed, Dragomir Anguelov, Dumitru Erhan, Vincent Vanhoucke, and Andrew Rabinovich. Going deeper with convolutions. In CVPR, 2015.
258
+
259
+ Kenneth Tran, Xiaodong He, Lei Zhang, Jian Sun, Cornelia Carapcea, Chris Thrasher, Chris Buehler, and Chris Sienkiewicz. Rich image captioning in the wild. arXiv preprint arXiv:1603.09016, 2016.
260
+
261
+ Ramakrishna Vedantam, C Lawrence Zitnick, and Devi Parikh. Cider: Consensus-based image description evaluation. In CVPR, 2015.
262
+
263
+ Oriol Vinyals, Alexander Toshev, Samy Bengio, and Dumitru Erhan. Show and tell: A neural image caption generator. In CVPR, 2015.
264
+
265
+ Qi Wu, Chunhua Shen, Lingqiao Liu, Anthony Dick, and Anton van den Hengel. What value do explicit high level concepts have in vision to language problems? In CVPR, 2016.
266
+
267
+ Kelvin Xu, Jimmy Ba, Ryan Kiros, Kyunghyun Cho, Aaron Courville, Ruslan Salakhudinov, Rich Zemel, and Yoshua Bengio. Show, attend and tell: Neural image caption generation with visual attention. In ICML, 2015.
268
+
269
+ Yezhou Yang, Ching Lik Teo, Hal Daume III, and Yiannis Aloimonos. Corpus-guided sentence generation of ´ natural images. In EMNLP, 2011.
270
+
271
+ Quanzeng You, Hailin Jin, Zhaowen Wang, Chen Fang, and Jiebo Luo. Image captioning with semantic attention. In CVPR, 2016.
272
+
273
+ Luowei Zhou, Chenliang Xu, Parker Koch, and Jason J Corso. Image caption generation with text-conditional semantic attention. arXiv preprint arXiv:1606.04621, 2016.
md/train/Bke4KsA5FX/Bke4KsA5FX.md ADDED
@@ -0,0 +1,598 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # GENERATIVE CODE MODELING WITH GRAPHS
2
+
3
+ Marc Brockschmidt, Miltiadis Allamanis, Alexander Gaunt Microsoft Research
4
+ Cambridge, UK
5
+ {mabrocks,miallama,algaunt}@microsoft.com
6
+
7
+ Oleksandr Polozov Microsoft Research Redmond, WA, USA polozov@microsoft.com
8
+
9
+ # ABSTRACT
10
+
11
+ Generative models for source code are an interesting structured prediction problem, requiring to reason about both hard syntactic and semantic constraints as well as about natural, likely programs. We present a novel model for this problem that uses a graph to represent the intermediate state of the generated output. Our model generates code by interleaving grammar-driven expansion steps with graph augmentation and neural message passing steps. An experimental evaluation shows that our new model can generate semantically meaningful expressions, outperforming a range of strong baselines.
12
+
13
+ # 1 INTRODUCTION
14
+
15
+ Learning to understand and generate programs is an important building block for procedural artificial intelligence and more intelligent software engineering tools. It is also an interesting task in the research of structured prediction methods: while imbued with formal semantics and strict syntactic rules, natural source code carries aspects of natural languages, since it acts as a means of communicating intent among developers. Early works in the area have shown that approaches from natural language processing can be applied successfully to source code (Hindle et al., 2012), whereas the programming languages community has had successes in focusing exclusively on formal semantics. More recently, methods handling both modalities (i.e., the formal and natural language aspects) have shown successes on important software engineering tasks (Raychev et al., 2015; Bichsel et al., 2016; Allamanis et al., 2018b) and semantic parsing (Yin & Neubig, 2017; Rabinovich et al., 2017).
16
+
17
+ However, current generative models of source code mostly focus on only one of these modalities at a time. For example, program synthesis tools based on enumeration and deduction (Solar-Lezama, 2008; Polozov & Gulwani, 2015; Feser et al., 2015; Feng et al., 2018) are successful at generating programs that satisfy some (usually incomplete) formal specification but are often obviously wrong on manual inspection, as they cannot distinguish unlikely from likely, “natural” programs. On the other hand, learned code models have succeeded in generating realistic-looking programs (Maddison & Tarlow, 2014; Bielik et al., 2016; Parisotto et al., 2017; Rabinovich et al., 2017; Yin & Neubig, 2017). However, these programs often fail to be semantically relevant, for example because variables are not used consistently.
18
+
19
+ In this work, we try to overcome these challenges for generative code models and present a general method for generative models that can incorporate structured information that is deterministically available at generation time. We focus our attention on generating source code and follow the ideas of program graphs (Allamanis et al., 2018b) that have been shown to learn semantically meaningful representations of (pre-existing) programs. To achieve this, we lift grammar-based tree decoder models into the graph setting, where the diverse relationships between various elements of the generated code can be modeled. For this, the syntax tree under generation is augmented with additional edges denoting known relationships (e.g., last use of variables). We then interleave the steps of the generative procedure with neural message passing (Gilmer et al., 2017) to compute more precise representations of the intermediate states of the program generation. This is fundamentally different from sequential generative models of graphs (Li et al., 2018; Samanta et al., 2018), which aim to generate all edges and nodes, whereas our graphs are deterministic augmentations of generated trees.
20
+
21
+ To summarize, we present $a$ ) a general graph-based generative procedure for highly structured objects, incorporating rich structural information; $b$ ) ExprGen, a new code generation task focused on generating small, but semantically complex expressions conditioned on source code context; and $c$ ) a comprehensive experimental evaluation of our generative procedure and a range of baseline methods from the literature.
22
+
23
+ <table><tr><td>Algorithm1 Pseudocode for Expand</td></tr><tr><td>Input: Context c,partial AST a,node v to expand 1:hy ← getRepresentation(c,a, v) 2: rhs ← pickProduction(u,hu) 3:for child node type l ∈ rhs do 4: (a,u)←insertChild(a,l) if l is nonterminal type then</td></tr></table>
24
+
25
+ ![](images/3eefeb5f4fcb3c569ae182457a795a26cc9afb96181aaaa89e9672922a8a7531.jpg)
26
+ Figure 1: Example for ExprGen, target expression to be generated is marked . Taken from BenchmarkDotNet, lightly edited for formatting.
27
+
28
+ # 2 BACKGROUND & TASK
29
+
30
+ The most general form of the code generation task is to produce a (partial) program in a programming language given some context information $c$ . This context information can be natural language (as in, e.g., semantic parsing), input-output examples (e.g., inductive program synthesis), partial program sketches, etc. Early methods generate source code as a sequence of tokens (Hindle et al., 2012; Hellendoorn & Devanbu, 2017) and sometimes fail to produce syntactically correct code. More recent models are sidestepping this issue by using the target language’s grammar to generate abstract syntax trees (ASTs) (Maddison & Tarlow, 2014; Bielik et al., 2016; Parisotto et al., 2017; Yin & Neubig, 2017; Rabinovich et al., 2017), which are syntactically correct by construction.
31
+
32
+ In this work, we follow the AST generation approach. The key idea is to construct the AST $a$ sequentially, by expanding one node at a time using production rules from the underlying programming language grammar. This simplifies the code generation task to a sequence of classification problems, in which an appropriate production rule has to be chosen based on the context information and the partial AST generated so far. In this work, we simplify the problem further — similar to Maddison & Tarlow (2014); Bielik et al. (2016) — by fixing the order of the sequence to always expand the left-most, bottom-most nonterminal node. Alg. 1 illustrates the common structure of AST-generating models. Then, the probability of generating a given AST $a$ given some context $c$ is
33
+
34
+ $$
35
+ p ( a \mid c ) = \prod _ { t } p ( a _ { t } \mid c , a _ { < t } ) ,
36
+ $$
37
+
38
+ where $a _ { t }$ is the production choice at step $t$ and $a _ { < t }$ the partial syntax tree generated before step $t$ .
39
+
40
+ Code Generation as Hole Completion We introduce the ExprGen task of filling in code within a hole of an otherwise existing program. This is similar, but not identical to the auto-completion function in a code editor, as we assume information about the following code as well and aim to generate whole expressions rather than single tokens. The ExprGen task also resembles program sketching (Solar-Lezama, 2008) but we give no other (formal) specification other than the surrounding code. Concretely, we restrict ourselves to expressions that have Boolean, arithmetic or string type, or arrays of such types, excluding expressions of other types or expressions that use project-specific APIs. An example is shown in Fig. 1. We picked this subset because it already has rich semantics that can require reasoning about the interplay of different variables, while it still only relies on few operators and does not require to solve the problem of open vocabularies of full programs, where an unbounded number of methods would need to be considered.
41
+
42
+ In our setting, the context $c$ is the pre-existing code around a hole for which we want to generate an expression. This also includes the set of variables $v _ { 1 } , \ldots , v _ { \ell }$ that are in scope at this point, which can be used to guide the decoding procedure (Maddison & Tarlow, 2014). Note, however, that our method is not restricted to code generation and can be easily extended to all other tasks and domains that can be captured by variations of Alg. 1 (e.g. in NLP).
43
+
44
+ # 3 GRAPH DECODING FOR SOURCE CODE
45
+
46
+ To tackle the code generation task presented in the previous section, we have to make two design choices: (a) we need to find a way to encode the code context $c , v _ { 1 } , \ldots , v _ { \ell }$ and (b) we need to construct a model that can learn $p ( \dot { a } _ { t } \mid c , a _ { < t } )$ well. We do not investigate the question of encoding the context in this paper, and use two existing methods in our experiments in Sect. 5. Both these encoders yield a distributed vector representation for the overall context, representations $h _ { t _ { 1 } } , \ldots , h _ { t _ { T } }$ for all tokens in the context, and separate representations for each of the in-scope variables $v _ { 1 } , \ldots , v _ { \ell }$ summarizing how each variable is used in the context. This information can then be used in the generation process, which is the main contribution of our work and is described in this section.
47
+
48
+ Overview Our decoder model follows the grammar-driven AST generation strategy of prior work as shown in Alg. 1. The core difference is in how we compute the representation of the node to expand. Maddison & Tarlow (2014) construct it entirely from the representation of its parent in the AST using a log-bilinear model. Rabinovich et al. (2017) construct the representation of a node using the parents of the AST node but also found it helpful to take the relationship to the parent node (e.g. “condition of a while”) into account. Yin & Neubig (2017) on the other hand propose to take the last expansion step into account, which may have finished a subtree “to the left”. In practice, these additional relationships are usually encoded by using gated recurrent units with varying input sizes.
49
+
50
+ We propose to generalize and unify these ideas using a graph to structure the flow of information in the model. Concretely, we use a variation of attribute grammars (Knuth, 1967) from compiler theory to derive the structure of this graph. We associate each node in the AST with two fresh nodes representing inherited resp. synthesized information (or attributes). Inherited information is derived from the context and parts of the AST that are already generated, whereas synthesized information can be viewed as a “summary” of a subtree. In classical compiler theory, inherited attributes usually contain information such as declared variables and their types (to allow the compiler to check that only declared variables are used), whereas synthesized attributes carry information about a subtree “to the right” (e.g., which variables have been declared). Traditionally, to implement this, the language grammar has to be extended with explicit rules for deriving and synthesizing attributes.
51
+
52
+ To transfer this idea to the deep learning domain, we represent attributes by distributed vector representations and train neural networks to learn how to compute attributes. Our method for getRepresentation from Alg. 1 thus factors into two parts: a deterministic procedure that turns a partial AST $a _ { < t }$ into a graph by adding additional edges that encode attribute relationships, and a graph neural network that learns from this graph.
53
+
54
+ Notation Formally, we represent programs as graphs where nodes $u , v , \ldots$ are either the AST nodes or their associated attribute nodes, and typed directed edges $\langle u , \tau , v \rangle \in \mathcal { E }$ connect the nodes according to the flow of information in the model. The edge types $\tau$ represent different syntactic or semantic relations in the information flow, discussed in detail below. We write $\mathcal { E } _ { v }$ for the set of incoming edges into $v$ . We also use functions like parent $( a , v )$ and lastSibling $( a , v )$ that look up and return nodes from the AST $a$ (e.g. resp. the parent node of $v$ or the preceding AST sibling of $v$ ).
55
+
56
+ Example Consider the AST of the expression $\mathrm { ~ ~ { ~ i ~ } ~ } - \mathrm { ~ ~ { ~ j ~ } ~ }$ shown in Fig. 2 (annotated with attribute relationships) constructed step by step by our model. The AST derivation using the programming language grammar is indicated by shaded backgrounds, nonterminal nodes are shown as rounded rectangles, and terminal nodes are shown as rectangles. We additionally show the variables given within the context as dashed rectangles at the bottom. First, the root node, Expr, was expanded using the production rule $( 1 ) : \mathtt { E x p r } \Longrightarrow \mathtt { E x p r } \ - \ \mathtt { E x p r }$ . Then, its two nonterminal children were in turn expanded to the set of known variables using the produc
57
+
58
+ # Algorithm 2 Pseudocode for ComputeEdge
59
+
60
+ Input: Partial AST $a$ , node $v$
61
+ 1: Edge set $\mathcal { E } \emptyset$
62
+ 2: if $v$ is inherited then
63
+ 3: $\mathcal { E } \mathcal { E } \cup \{ \langle \mathsf { p a r e n t } ( a , v ) , C h i l d , v \rangle \}$
64
+ 4: if $v$ is terminal node then
65
+ 5: $\mathcal { E } \mathcal { E } \cup \{ \langle | \mathsf { a s t T o k e n } ( a , v ) , N e x t T o k e n , v \rangle \}$
66
+ 6: if $v$ is variable then
67
+ 7: $\mathcal { E } \mathcal { E } \cup \{ \langle | { \mathsf { a s t U s e } } ( a , v ) , N e x t U s e , v \rangle \}$
68
+ 8: if $v$ is not first child then
69
+ 9: $\mathcal { E } \gets \mathcal { E } \cup \{ \langle | { \mathsf { a s t } } \mathsf { S i b } | { \mathsf { i n g } } ( a , v ) , N e x t S i b , v \rangle \}$
70
+ 10: else
71
+ 11: $\mathcal { E } \mathcal { E } \cup \{ \langle u , P a r e n t , v \rangle \mid u \in \mathsf { c h i l d r e n } ( a , v ) \}$
72
+ 12: E ← E ∪ {hinheritedAttr(v), InhToSyn, vi}
73
+ 13: return $\varepsilon$
74
+
75
+ ![](images/3fc653bdb98fab4920239277e9328578a582c0b977eade182f8983bf04276ad3.jpg)
76
+ Figure 2: Example AST with attribute dependencies, shown constructed step by step in the order of generation. Each AST node (labeled by a terminal or non-terminal) has either one or two associated attribute nodes, shown as its left/right parts. The node IDs are highlighted at the corresponding generation step. Edge color and label indicate edge type. Edges are computed using Alg. 2, but are only depicted after use in message passing. Best viewed in color.
77
+
78
+ tion rule $( 2 ) : \mathtt { E x p r } \Longrightarrow \nu$ , choosing i for the first variable and $\dot { ] }$ for the second variable (cf. below for details on picking variables).
79
+
80
+ Attribute nodes are shown overlaying their corresponding AST nodes. For example, the root node is associated with its inherited attributes node 0 and with node 10 for its synthesized attributes. For simplicity, we use the same representation for inherited and synthesized attributes of terminal nodes.
81
+
82
+ Edges in $\mathbf { \delta } \mathbf { \delta } \mathbf { a } _ { < t }$ We discuss the edges used in our neural attribute grammars $( { \mathcal { N A } } { \mathcal { G } } )$ on our example below, and show them in Fig. 2 using different edge drawing styles for different edge types. Once a node is generated, the edges connecting this node can be deterministically added to $a _ { < t }$ (precisely defined in Alg. 2). The list of different edge types used in our model is as follows:
83
+
84
+ Child (red) edges connect an inherited attribute node to the inherited attributes nodes of its children, as seen in the edges from node 0. These are the connections in standard syntaxdriven decoders (Maddison & Tarlow, 2014; Parisotto et al., 2017; Yin & Neubig, 2017; Rabinovich et al., 2017). • Parent (green) edges connect a synthesized attribute node to the synthesized attribute node of its AST parent, as seen in the edges leading to node 10. These are the additional connections used by the R3NN decoder introduced by Parisotto et al. (2017). • NextSib (black) edges connect the synthesized attribute node to the inherited attribute node of its next sibling (e.g. from node 5 to node 6). These allow information about the synthesized attribute nodes from a fully generated subtree to flow to the next subtree. NextUse (orange) edges connect the attribute nodes of a variable (since variables are always terminal nodes, we do not distinguish inherited from synthesized attributes) to their next use. Unlike Allamanis et al. (2018b), we do not perform a dataflow analysis, but instead just follow the lexical order. This can create edges from nodes of variables in the context $c$ (for example, from node 1 to 4 in Fig. 2), or can connect AST leaf nodes that represent multiple uses of the same variable within the generated expressions.
85
+
86
+ • NextToken (blue) edges connect a terminal node (a token) to the next token in the program text, for example between nodes 4 and 6.
87
+
88
+ • InhToSyn edges (not shown in Fig. 2) connect the inherited attributes nodes to its synthesized attribute nodes. This is not strictly adding any information, but we found it to help with training.
89
+
90
+ The panels of Fig. 2 show the timesteps at which the representations of particular attribute nodes are computed and added to the graph. For example, in the second step, the attributes for the terminal token i (node 4) in Fig. 2 are computed from the inherited attributes of its AST parent Expr (node 3), the attributes of the last use of the variable i (node 1), and the node label i. In the third step, this computed attribute is used to compute the synthesized attributes of its AST parent Expr (node 5).
91
+
92
+ Attribute Node Representations To compute the neural attribute representation $\mathbf { h } _ { v }$ of an attribute node $v$ whose corresponding AST node is labeled with $\ell _ { v }$ , we first obtain its incoming edges using Alg. 2 and then use the state update function from Gated Graph Neural Networks (GGNN) (Li et al., 2016). Thus, we take the attribute representations $\mathbf { h } _ { u _ { i } }$ at edge sources $u _ { i }$ , transform them according to the corresponding edge type $t _ { i }$ using a learned function $f _ { t _ { i } }$ , aggregate them (by elementwise summation) and combine them with the learned embedding $\mathsf { e m b } ( \ell _ { v } )$ of the node label $\ell _ { v }$ using a function $g$ :
93
+
94
+ $$
95
+ \mathbf { h } _ { v } = g ( \mathsf { e m b } ( \ell _ { v } ) , \sum _ { \langle u _ { i } , t _ { i } , v \rangle \in \mathcal { E } _ { v } } f _ { t _ { i } } ( \mathbf { h } _ { u _ { i } } ) )
96
+ $$
97
+
98
+ In practice, we use a single linear layer for $f _ { t _ { i } }$ and implement $g$ as a gated recurrent unit (Cho et al., 2014). We compute node representations in such an order that all $\mathbf { h } _ { u _ { i } }$ appearing on the right of (2) are already computed. This is possible as the graphs obtained by repeated application of Alg. 2 are directed acyclic graphs rooted in the inherited attribute node of the root node of the AST. We initialize the representation of the root inherited attribute to the representation returned by the encoder for the context information.
99
+
100
+ Choosing Productions, Variables & Literals We can treat picking production rules as a simple classification problem over all valid production rules, masking out those choices that do not correspond to the currently considered nonterminal. For a nonterminal node $v$ with label $\ell _ { v }$ and inherited attributes $\mathbf { h } _ { v }$ , we thus define
101
+
102
+ Here, $m \ell _ { v }$ is a mask vector whose value is 0 for valid productions $\ell _ { v } \Rightarrow . . .$ and $- \infty$ for all other productions. In practice, we implement $e$ using a linear layer.
103
+
104
+ Similarly, we pick variables from the set of variables V in scope using their representations hvvar (initially the representation obtained from the context, and later the attribute representation of the last node in the graph in which they have been used) by using a pointer network (Vinyals et al., 2015). Concretely, to pick a variable at node $v$ , we use learnable linear function $k$ and define
105
+
106
+ $$
107
+ { \mathsf { a } } ( { \mathcal { V } } , \mathbf { h } _ { v } ) = \underset { v a r \in \mathcal { V } } { \arg \operatorname* { m a x } } P ( v a r \mid \mathbf { h } _ { v } ) = \underset { v a r \in \mathcal { V } } { \arg \operatorname* { m a x } } k ( \mathbf { h } _ { v } , \mathbf { h } _ { v _ { v a r } } ) .
108
+ $$
109
+
110
+ Note that since the model always picks a variable from the set of in-scope variables $\nu$ , this generation model can never predict an unknown or out-of-scope variable.
111
+
112
+ Finally, to generate literals, we combine a small vocabulary $\mathcal { L }$ of common literals observed in the training data and special UNK tokens for each type of literal with another pointer network that can copy one of the tokens $t _ { 1 } \ldots t _ { T }$ from the context. Thus, to pick a literal at node $v$ , we define
113
+
114
+ $$
115
+ \mathsf { t e r a l } ( \mathcal { V } , \mathbf { h } _ { v } ) = \operatorname * { a r g m a x } _ { l i t \in \mathcal { L } \cup \{ t _ { 1 } \ldots t _ { T } \} } P ( l i t \mid \mathbf { h } _ { v } ) .
116
+ $$
117
+
118
+ Note that this is the only operation that may produce an unknown token (i.e. an UNK literal). In practice, we implement this by learning two functions $s _ { \mathcal { L } }$ and $s _ { c }$ , such that $s _ { \mathcal { L } } ( \mathbf { h } _ { v } )$ produces a score for each token from the vocabulary and $s _ { c } ( \mathbf { h } _ { v } , h _ { t _ { i } } )$ computes a score for copying token $t _ { i }$ from the context. By computing a softmax over all resulting values and normalizing it by summing up entries corresponding to the same constant, we can learn to approximate the desired $\dot { P } ( l i t \mid \mathbf { h } _ { v } )$ .
119
+
120
+ Training & Training Objective The different shapes and sizes of generated expressions complicate an efficient training regime. However, note that given a ground truth target tree, we can easily augment it with all additional edges according to Alg. 2. Given that full graph, we can compute a propagation schedule (intuitively, a topological ordering of the nodes in the graph, starting in the root node) that allows to repeatedly apply (2) to obtain representations for all nodes in the graph. By representing a batch of graphs as one large (sparse) graph with many disconnected components, similar to Allamanis et al. (2018b), we can train our graph neural network efficiently. We have released the code for this on https://github.com/Microsoft/graph-based-code-modelling.
121
+
122
+ Our training procedure thus combines an encoder (cf. Sect. 5), whose output is used to initialize the representation of the root and context variable nodes in our augmented syntax graph, the sequential graph propagation procedure described above, and the decoder choice functions (3) and (4). We train the system end-to-end using a maximum likelihood objective without pre-trained components.
123
+
124
+ Additional Improvements We extend (3) with an attention mechanism (Bahdanau et al., 2014; Luong et al., 2015) that uses the state $\mathbf { h } _ { v }$ of the currently expanded node $v$ as a key and the context token representations $h _ { t _ { 1 } } , \ldots , h _ { t _ { T } }$ as memories. Experimentally, we found that extending Eqs. 4, 5 similarly did not improve results, probably due to the fact that they already are highly dependent on the context information.
125
+
126
+ Following Rabinovich et al. (2017), we provide additional information for Child edges. To allow this, we change our setup so that some edge types also require an additional label, which is used when computing the messages sent between different nodes in the graph. Concretely, we extend (2) by considering sets of unlabeled edges ${ \mathcal { E } } _ { v }$ and labeled edges $\mathcal { E } _ { v } ^ { \ell }$ :
127
+
128
+ $$
129
+ \mathbf { h } _ { v } = g ( \mathsf { e m b } ( \ell _ { v } ) , \sum _ { \substack { ( u _ { i } , t _ { i } , v ) \in \mathcal { E } _ { v } } } f _ { t _ { i } } ( \mathbf { h } _ { u _ { i } } ) + \sum _ { \substack { ( u _ { i } , t _ { i } , \ell _ { i } , v ) \in \mathcal { E } _ { v } ^ { \ell } } } f _ { t _ { i } } ( \mathbf { h } _ { u _ { i } } , \mathsf { e m b } _ { e } ( \ell _ { i } ) ) )
130
+ $$
131
+
132
+ Thus for labeled edge types, $f _ { t _ { i } }$ takes two inputs and we additionally introduce a learnable embedding for the edge labels. In our experiments, we found it useful to label Child with tuples consisting of the chosen production and the index of the child, i.e., in Fig. 2, we would label the edge from 0 to 3 with $( 2 , 0 )$ , the edge from 0 to 6 with $( 2 , 1 )$ , etc.
133
+
134
+ Furthermore, we have extended pickProduction to also take the information about available variables into account. Intuitively, this is useful in cases of productions such as $\mathtt { E x p r } \Longrightarrow \mathtt { E x p r . L e n g t h } _ { \mathtt { i n d e m } }$ , which can only be used in a well-typed derivation if an array-typed variable is available. Thus, we extend $e ( \mathbf { h } _ { v } )$ from (3) to additionally take the representation of all variables in scope into account, i.e., $e ( \mathbf { h } _ { v } , r ( \{ \mathbf { h } _ { v _ { v a r } } \mid v a r \in \mathcal { V } \} )$ ), where we have implemented $r$ as a max pooling operation.
135
+
136
+ # 4 RELATED WORK
137
+
138
+ Source code generation has been studied in a wide range of different settings (Allamanis et al., 2018a). We focus on the most closely related works in language modeling here. Early works approach the task by generating code as sequences of tokens (Hindle et al., 2012; Hellendoorn & Devanbu, 2017), whereas newer methods have focused on leveraging the known target grammar and generate code as trees (Maddison & Tarlow, 2014; Bielik et al., 2016; Parisotto et al., 2017; Yin & Neubig, 2017; Rabinovich et al., 2017) (cf. Sect. 2 for an overview). While modern models succeed at generating “natural-looking” programs, they often fail to respect simple semantic rules. For example, variables are often used without initialization or written several times without being read inbetween.
139
+
140
+ Existing tree-based generative models primarily differ in what information they use to decide which expansion rule to use next. Maddison & Tarlow (2014) consider the representation of the immediate parent node, and suggest to consider more information (e.g., nearby tokens). Parisotto et al. (2017) compute a fresh representation of the partial tree at each expansion step using R3NNs (which intuitively perform a leaf-to-root traversal followed by root-to-leaf traversal of the AST). The PHOG model (Bielik et al., 2016) conditions generation steps on the result of learned (decision tree-style) programs, which can do bounded AST traversals to consider nearby tokens and non-terminal nodes. The language also supports a jump to the last node with the same identifier, which can serve as syntactic approximation of data-flow analysis. Rabinovich et al. (2017) only use information about the parent node, but use neural networks specialized to different non-terminals to gain more fine-grained control about the flow of information to different successor nodes. Finally, Amodio et al. (2017) and Yin & Neubig (2017) follow a left-to-right, depth-first expansion strategy, but thread updates to single state (via a gated recurrent unit) through the overall generation procedure, thus giving the pickProduction procedure access to the full generation history as well as the representation of the parent node. Amodio et al. (2017) also suggest the use of attribute grammars, but use them to define a deterministic procedure that collects information throughout the generation process, which is provided as additional feature.
141
+
142
+ As far as we are aware, previous work has not considered a task in which a generative model fills a hole in a program with an expression. Lanuage model-like methods take into account only the lexicographically previous context of code. The task of Raychev et al. (2014) is near to our ExprGen, but instead focuses on filling holes in sequences of API calls. There, the core problem is identifying the correct function to call from a potentially large set of functions, given a sequence context. In contrast, ExprGen requires to handle arbitrary code in the context, and then to build possibly complex expressions from a small set of operators. Allamanis et al. (2018b) consider similar context, but are only picking a single variable from a set of candidates, and thus require no generative modeling.
143
+
144
+ # 5 EVALUATION
145
+
146
+ Dataset We have collected a dataset for our ExprGen task from 593 highly-starred open-source C# projects on GitHub, removing any near-duplicate files, following the work of Lopes et al. (2017). We parsed all $C ^ { \# }$ files and identified all expressions of the fragment that we are considering (i.e., restricted to numeric, Boolean and string types, or arrays of such values; and not using any user-defined functions). We then remove the expression, perform a static analysis to determine the necessary context information and extract a sample. For each sample, we create an abstract syntax tree by coarsening the syntax tree generated by the $C ^ { \# }$ compiler Roslyn. This resulted in 343 974 samples overall with 4.3 $( \pm 3 . 8 ) $ tokens per expression to generate, or alternatively 3.7 $( \pm 3 . 1 )$ production steps. We split the data into four separate sets. A “test-only” dataset is made up from $\mathord { \sim } 1 0 0 \mathrm { k }$ samples generated from 114 projects. The remaining data we split into training-validation-test sets $( 3 : 1 : 1 )$ ), keeping all expressions collected from a single source file within a single fold. Samples from our dataset can be found in the supplementary material. Our decoder uses the grammar made up by 222 production rules observed in the ASTs of the training set, which includes rules such as $\mathtt { E x p r } \Longrightarrow \mathtt { E x p r } + \mathtt { E x p r }$ for binary operations, $\operatorname { E x p r } \Longrightarrow$ Expr.Equals(Expr) for built-in methods, etc.
147
+
148
+ Encoders We consider two models to encode context information. Seq is a two-layer bi-directional recurrent neural network (using a GRU (Cho et al., 2014)) to encode the tokens before and after the “hole” in which we want to generate an expression. Additionally, it computes a representation for each variable var in scope in the context in a similar manner: For each variable var it identifies usages before/after the hole and encodes each of them independently using a second bi-directional two-layer GRU, which processes a window of tokens around each variable usage. It then computes a representation for var by average pooling of the final states of these GRU runs.
149
+
150
+ The second encoder $\mathcal { G }$ is an implementation of the program graph approach introduced by Allamanis et al. (2018b). We follow the transformation used for the Varmisuse task presented in that paper, i.e., the program is transformed into a graph, and the target expression is replaced by a fresh dummy node. We then run a graph neural network for 8 steps to obtain representations for all nodes in the graph, allowing us to read out a representation for the “hole” (from the introduced dummy node) and for all variables in context. The used context information captured by the GNN is a superset of what existing methods (e.g. language models) consider.
151
+
152
+ Baseline Decoders We compare our model to re-implementations of baselines from the literature. As our ExprGen task is new, re-using existing implementations is hard and problematic in comparison. Most recent baseline methods can be approximated by ablations of our model. We experimented with a simple sequence decoder with attention and copying over the input, but found it to be substantially weaker than other models in all regards. Next, we consider T ree, our model restricted to using only Child edges without edge labels. This can be viewed as an evolution of Maddison & Tarlow (2014), with the difference that instead of a log-bilinear network that does not maintain state during the generation, we use a GRU. $\mathcal { A } \mathcal { S } \mathcal { N }$ is similar to abstract syntax networks (Rabinovich et al., 2017) and arises as an extension of the T ree model by adding edge labels on Child that encode the chosen production and the index of the child (corresponding to the “field name” Rabinovich et al. (2017)). Finally, Syn follows the work of Yin & Neubig (2017), but uses a GRU instead of an LSTM. For this, we extend T ree by a new NextExp edge that connects nodes to each other in the expansion sequence of the tree, thus corresponding to the action flow (Yin & Neubig, 2017).
153
+
154
+ Table 1: Evaluation of encoder and decoder combinations on predicting an expression from code context. $\dagger$ : PHOG (Bielik et al., 2016) is only conditioned on the tokens on the left of the expression.
155
+
156
+ <table><tr><td rowspan="2">Model</td><td colspan="4">Test (from seen projects)</td><td colspan="4">Test-only (from unseen projects)</td></tr><tr><td>Perplexity</td><td>Well-Typed</td><td>Acc@1</td><td>Acc@5</td><td>Perplexity</td><td>Well-Typed</td><td>Acc@1</td><td>Acc@5</td></tr><tr><td>PHOGt</td><td>1</td><td>1</td><td>34.8%</td><td>42.9%</td><td>1</td><td>1</td><td>28.0%</td><td>37.3%</td></tr><tr><td>Seq→Seq</td><td>87.48</td><td>32.4%</td><td>21.8%</td><td>28.1%</td><td>130.46</td><td>23.4%</td><td>10.8%</td><td>16.8%</td></tr><tr><td>Seq→NAg</td><td>6.81</td><td>53.2%</td><td>17.7%</td><td>33.7%</td><td>8.38</td><td>40.4%</td><td>8.4%</td><td>15.8%</td></tr><tr><td>g→Seq</td><td>93.31</td><td>40.9%</td><td>27.1%</td><td>34.8%</td><td>28.48</td><td>36.3%</td><td>17.2%</td><td>25.6%</td></tr><tr><td>g→Tree</td><td>4.37</td><td>49.3%</td><td>26.8%</td><td>48.9%</td><td>5.37</td><td>41.2%</td><td>19.9%</td><td>36.8%</td></tr><tr><td>g→ASN</td><td>2.62</td><td>78.7%</td><td>45.7%</td><td>62.0%</td><td>3.03</td><td>74.7%</td><td>32.4%</td><td>48.1%</td></tr><tr><td>g →Syn</td><td>2.71</td><td>84.9%</td><td>50.5%</td><td>66.8%</td><td>3.48</td><td>84.5%</td><td>36.0%</td><td>52.7%</td></tr><tr><td>9 →NAg</td><td>2.56</td><td>86.4%</td><td>52.3%</td><td>69.2%</td><td>3.07</td><td>84.5%</td><td>38.8%</td><td>57.0%</td></tr></table>
157
+
158
+ In all cases, our re-implementations improve on prior work in our variable selection mechanism, which ensures that generated programs only use variables that are defined and in scope. Both Rabinovich et al. (2017) and Yin & Neubig (2017) instead use a copying mechanism from the context. On the other hand, they use RNN modules to generate function names and choose arguments from the context (Yin & Neubig, 2017) and to generate string literals (Rabinovich et al., 2017). Our ExprGen task limits the set of allowed functions and string literals substantially and thus no RNN decoder generating such things is required in our experiments.
159
+
160
+ The authors of the PHOG (Bielik et al., 2016) language model kindly ran experiments on our data for the ExprGen task, to provide baseline results of a non-neural language model. Note, however, that PHOG does not consider the code context to the right of the expression to generate, and does no additional analyses to determine which variable choices are valid. Extending the model to take more context into account and do some analyses to restrict choices would certainly improve its results.
161
+
162
+ # 5.1 QUANTITATIVE EVALUATION
163
+
164
+ Metrics We are interested in the ability of a model to generate valid expressions based on the current code context. To evaluate this, we consider four metrics. As our ExprGen task requires a conditional language model of code, we first consider the per-token perplexity of the model; the lower the perplexity, the better the model fits the real data distribution. We then evaluate how often the generated expression is well-typed (i.e., can be typed in the original code context). We report these metrics for the most likely expression returned by beam search decoding with beam width 5. Finally, we compute how often the ground truth expression was generated (reported for the most likely expression, as well as for the top five expressions). This measure is stricter than semantic equivalence, as an expression $\mathrm { ~ \ j ~ } > \mathrm { ~ \ i ~ }$ will not match the equivalent $\dot { \mathrm { ~ \scriptsize ~ \perp ~ } } < \dot { \mathrm { ~ \scriptsize ~ \jmath ~ } }$ .
165
+
166
+ Results We show the results of our evaluation in Tab. 1. Overall, the graph encoder architecture seems to be best-suited for this task. All models learn to generate syntactically valid code (which is relatively simple in our domain). However, the different encoder models perform very differently on semantic measures such as well-typedness and the retrieval of the ground truth expression. Most of the type errors are due to usage of an “UNK” literal (for example, the $\mathcal { G } \mathcal { N A G }$ model only has $4 \%$ type error when filtering out such unknown literals). The results show a clear trend that correlates better semantic results with the amount of information about the partially generated programs employed by the generative models. Transferring a trained model to unseen projects with a new project-specific vocabulary substantially worsens results, as expected. Overall, our $\mathcal { N A G }$ model, combining and adding additional signal sources, seems to perform best on most measures, and seems to be leastimpacted by the transfer.
167
+
168
+ ![](images/7f8da9108d64d1ed4966bd020899b4a3c18291a176ccea5f3cba1c4bea0b40f3.jpg)
169
+
170
+ Figure 3: Two lightly edited examples from our test set and expressions predicted by different models.
171
+ More examples can be found in the supplementary material.
172
+
173
+ # 5.2 QUALITATIVE EVALUATION
174
+
175
+ As the results in the previous section suggest, the proposed ExprGen task is hard even for the strongest models we evaluated, achieving no more than $50 \%$ accuracy on the top prediction. It is also unsolvable for classical logico-deductive program synthesis systems, as the provided code context does not form a precise specification. However, we do know that most instances of the task are (easily) solvable for professional software developers, and thus believe that machine learning systems can have considerable success on the task.
176
+
177
+ Fig. 3 shows two (abbreviated) samples from our test set, together with the predictions made by the two strongest models we evaluated. In the first example, we can see that the $\mathcal { G } \mathcal { N A G }$ model correctly identifies that the relationship between paramCount and methParamCount is important (as they appear together in the blocked guarded by the expression to generate), and thus generates comparison expressions between the two variables. The $\bar { \mathcal { G } } \mathcal { A } \mathcal { S } \mathcal { N }$ model lacks the ability to recognize that paramCount (or any variable) was already used and thus fails to insert both relevant variables. We found this to be a common failure, often leading to suggestions using only one variable (possibly repeatedly). In the second example, both $\mathcal { G } \mathcal { N A G }$ and $\mathcal { G } S y n$ have learned the common if (var.StartsWith(...)) { var.Substring(num) ... } pattern, but of course fail to produce the correct string literal in the condition. We show results for all of our models for these examples, as well as for as additional examples, in the supplementary material B.
178
+
179
+ # 6 DISCUSSION & CONCLUSIONS
180
+
181
+ We presented a generative code model that leverages known semantics of partially generated programs to direct the generative procedure. The key idea is to augment partial programs to obtain a graph, and then use graph neural networks to compute a precise representation for the partial program. This representation then helps to better guide the remainder of the generative procedure. We have shown that this approach can be used to generate small but semantically interesting expressions from very imprecise context information. The presented model could be useful in program repair scenarios (where repair proposals need to be scored, based on their context) or in the code review setting (where it could highlight very unlikely expressions). We also believe that similar models could have applications in related domains, such as semantic parsing, neural program synthesis and text generation.
182
+
183
+ REFERENCES
184
+ Miltiadis Allamanis, Earl T Barr, Premkumar Devanbu, and Charles Sutton. A survey of machine learning for big code and naturalness. ACM Computing Surveys, 2018a.
185
+ Miltiadis Allamanis, Marc Brockschmidt, and Mahmoud Khademi. Learning to represent programs with graphs. In International Conference on Learning Representations (ICLR), 2018b.
186
+ Matthew Amodio, Swarat Chaudhuri, and Thomas W. Reps. Neural attribute machines for program generation. arXiv preprint arXiv:1705.09231, 2017.
187
+ Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. Neural machine translation by jointly learning to align and translate. In International Conference on Learning Representations (ICLR), 2014.
188
+ Benjamin Bichsel, Veselin Raychev, Petar Tsankov, and Martin Vechev. Statistical deobfuscation of android applications. In Conference on Computer and Communications Security (CCS), 2016.
189
+ Pavol Bielik, Veselin Raychev, and Martin Vechev. PHOG: probabilistic model for code. In International Conference on Machine Learning (ICML), 2016.
190
+ Kyunghyun Cho, Bart van Merriënboer, Dzmitry Bahdanau, and Yoshua Bengio. On the properties of neural machine translation: Encoder–decoder approaches. Syntax, Semantics and Structure in Statistical Translation, 2014.
191
+ Yu Feng, Ruben Martins, Osbert Bastani, and Isil Dillig. Program synthesis using conflict-driven learning. In Programming Languages Design and Implementation (PLDI), 2018.
192
+ John K. Feser, Swarat Chaudhuri, and Isil Dillig. Synthesizing data structure transformations from input-output examples. In Programming Languages Design and Implementation (PLDI), 2015.
193
+ Justin Gilmer, Samuel S. Schoenholz, Patrick F. Riley, Oriol Vinyals, and George E. Dahl. Neural message passing for quantum chemistry. In International Conference on Machine Learning (ICML), 2017.
194
+ Vincent J. Hellendoorn and Premkumar Devanbu. Are deep neural networks the best choice for modeling source code? In Foundations of Software Engineering (FSE), 2017.
195
+ Abram Hindle, Earl T Barr, Zhendong Su, Mark Gabel, and Premkumar Devanbu. On the naturalness of software. In International Conference on Software Engineering (ICSE), 2012.
196
+ Donald E. Knuth. Semantics of context-free languages. Mathemtical Systems Theory, 2(2):127–145, 1967.
197
+ Yujia Li, Daniel Tarlow, Marc Brockschmidt, and Richard Zemel. Gated graph sequence neural networks. In International Conference on Learning Representations (ICLR), 2016.
198
+ Yujia Li, Oriol Vinyals, Chris Dyer, Razvan Pascanu, and Peter Battaglia. Learning deep generative models of graphs. CoRR, abs/1803.03324, 2018.
199
+ Cristina V Lopes, Petr Maj, Pedro Martins, Vaibhav Saini, Di Yang, Jakub Zitny, Hitesh Sajnani, and Jan Vitek. DéjàVu: a map of code duplicates on GitHub. In Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA), 2017.
200
+ Minh-Thang Luong, Hieu Pham, and Christopher D Manning. Effective approaches to attention-based neural machine translation. In Conference on Empirical Methods in Natural Language Processing (EMNLP), 2015.
201
+ Chris J Maddison and Daniel Tarlow. Structured generative models of natural source code. In International Conference on Machine Learning (ICML), 2014.
202
+ Emilio Parisotto, Abdel-rahman Mohamed, Rishabh Singh, Lihong Li, Dengyong Zhou, and Pushmeet Kohli. Neuro-symbolic program synthesis. In International Conference on Learning Representations (ICLR), 2017.
203
+ Oleksandr Polozov and Sumit Gulwani. FlashMeta: a framework for inductive program synthesis. In ObjectOriented Programming, Systems, Languages, and Applications (OOPSLA), 2015.
204
+ Maxim Rabinovich, Mitchell Stern, and Dan Klein. Abstract syntax networks for code generation and semantic parsing. In Annual Meeting of the Association for Computational Linguistics (ACL), 2017.
205
+ Veselin Raychev, Martin Vechev, and Eran Yahav. Code completion with statistical language models. In Programming Languages Design and Implementation (PLDI), 2014.
206
+
207
+ Veselin Raychev, Martin Vechev, and Andreas Krause. Predicting program properties from Big Code. In Principles of Programming Languages (POPL), 2015.
208
+
209
+ Bidisha Samanta, Abir De, Niloy Ganguly, and Manuel Gomez-Rodriguez. Designing random graph models using variational autoencoders with applications to chemical design. CoRR, abs/1802.05283, 2018.
210
+
211
+ Armando Solar-Lezama. Program synthesis by sketching. University of California, Berkeley, 2008.
212
+
213
+ Oriol Vinyals, Meire Fortunato, and Navdeep Jaitly. Pointer networks. In Advances in Neural Information Processing Systems, 2015.
214
+
215
+ Pengcheng Yin and Graham Neubig. A syntactic neural model for general-purpose code generation. In Annual Meeting of the Association for Computational Linguistics (ACL), 2017.
216
+
217
+ # A DATASET SAMPLES
218
+
219
+ Below we list some sample snippets from the training set for our ExprGen task. The highlighted expressions are to be generated.
220
+
221
+ ![](images/9bf5db9920bad5b86b50332389eb940df969b3495053d912b19f20a7d8e883a9.jpg)
222
+ Figure 4: Sample snippet from the Lean project. Formatting has been modified.
223
+
224
+ ![](images/980dced56cb62f9a552fa8e740530c65433016666277bb648b7bd58547c482d2.jpg)
225
+ Figure 5: Sample snippet from the BotBuilder project. Formatting has been modified.
226
+
227
+ ![](images/8bbb8ae37a302b987babedce16151a162516cda62d9ff75fd51d1255764f17bd.jpg)
228
+ Figure 6: Sample snippet from the Chocolatey project. Formatting has been modified.
229
+
230
+ ![](images/b2bfba5da90f7040e05a22ecd4ec9b9f0819e88507bfa8cf6104af735da43053.jpg)
231
+ Figure 7: Sample snippet from the Chocolatey project. Formatting has been modified and the snippet has been abbreviated.
232
+
233
+ ![](images/91f96abf7268b945a328273346f517540d9ad230a9d691f0e6f179c930bd4867.jpg)
234
+ Figure 8: Samples snippet in the CommonMark.NET project. Formatting has been modified.
235
+
236
+ ![](images/738703f100f2b0aff47045141a43ce3e3681f70700445f74d1f751a89469cb84.jpg)
237
+ Figure 9: Sample snippet from the Humanizer project. Formatting has been modified.
238
+
239
+ ![](images/2db9fd72aa16ded0bd99cfe288fafd5956b1e7fa8288ce79f1f68d12c6d55317.jpg)
240
+ Figure 10: Samples snippet from the Nancy project. Formatting has been modified.
241
+
242
+ ![](images/44ef1a3ea4a720565638384851fe1c6b80c3d878dce4cebb30224baa32ea02e3.jpg)
243
+ Figure 11: Sample snippet from the OpenLiveWriter project. Formatting has been modified.
244
+
245
+ ![](images/8bf540add536c256659c5f53525d2a7ab3802f93c71b728b218fbc04de6122a1.jpg)
246
+ Figure 12: Sample snippet from the OpenLiveWriter project. Formatting has been modified.
247
+
248
+ ![](images/e50448d0ec463dabace2f2f08910a5201e4faff679c19cd474f24562676596db.jpg)
249
+ Figure 13: Sample snippet from the OpenLiveWriter project. Formatting has been modified.
250
+
251
+ # B SAMPLE GENERATIONS
252
+
253
+ On the following pages, we list some sample snippets from the test set for our ExprGen task, together with suggestions produced by different models. The highlighted expressions are the ground truth expression that should be generated.
254
+
255
+ # Sample 1
256
+
257
+ if (context.Context $= =$ _MARKUP_CONTEXT_TYPE.CONTEXT_TYPE_Text && !String.IsNullOrEmpty(text)) { idx $=$ originalText.IndexOf(text) if (idx $\scriptstyle = = 0$ ) { // Drop this portion from the expected string originalText $=$ originalText.Substring(text.Length); // Update the current pointer beginDamagePointer.MoveToPointer(currentRange.End); } else if (idx > 0 && originalText.Substring(0, idx) .Replace("\r\n", string.Empty).Length $\scriptstyle = = 0$ ) { // Drop this portion from the expected string originalText $=$ originalText.Substring(text.Length $^ +$ idx); // Update the current pointer beginDamagePointer.MoveToPointer(currentRange.End); } else { return false; }
258
+ }
259
+
260
+ Sample snippet from OpenLiveWriter. The following suggestions were made: $\underline { { S e q } } S e q$ :
261
+
262
+ UNK_TOKEN[i] $( 0 . 6 \% )$ input[inputOffset + 1] $( 0 . 3 \% )$ UNK_TOKEN & UNK_NUM_LITERAL $( 0 . 3 \% )$
263
+
264
+ # $S e q \mathcal { N A G } ;$
265
+
266
+ MarshalUrlSupported.IndexOf(UNK_CHAR_LITERAL) $( 0 . 9 \%$ ) IsEditFieldSelected.IndexOf(UNK_CHAR_LITERAL) $( 0 . 8 \%$ ) marshalUrlSupported.IndexOf(UNK_CHAR_LITERAL) $( 0 . 7 \% )$ )
267
+
268
+ # $\underline { { \mathcal { G } \to S e q } } .$
269
+
270
+ UNK_TOKEN.IndexOf(UNK_CHAR_LITERAL) $( 2 1 . 6 \% )$ UNK_TOKEN.LastIndexOf(UNK_CHAR_LITERAL) $( 1 4 . 9 \% )$ ) UNK_TOKEN.GetHashCode() $( 8 . 1 \% )$
271
+
272
+ # $\mathcal { G } \mathcal { T } r e e .$
273
+
274
+ UNK_CHAR_LITERAL.IndexOf(UNK_CHAR_LITERAL) $( 8 . 1 \% )$ UNK_CHAR_LITERAL.IndexOf(originalText) $( 8 . 1 \%$ ) originalText.IndexOf(UNK_CHAR_LITERAL) $( 8 . 1 \%$ )
275
+
276
+ # $\mathcal { G } \mathcal { A } S \mathcal { N }$
277
+
278
+ originalText.GetHashCode() $( 3 7 . 8 \%$ ) originalText.IndexOf(UNK_CHAR_LITERAL) $( 1 4 . 8 \%$ ) originalText.LastIndexOf(UNK_CHAR_LITERAL) $( 6 . 2 \% )$ )
279
+
280
+ # $\mathcal { G } S y n$
281
+
282
+ text.IndexOf(UNK_CHAR_LITERAL) $( 2 0 . 9 \%$ ) text.LastIndexOf(UNK_CHAR_LITERAL) $( 1 2 . 4 \% )$ ) originalText.IndexOf(UNK_CHAR_LITERAL) $( 1 1 . 6 \%$ )
283
+
284
+ # $\mathcal { G } \mathcal { N A G }$
285
+
286
+ originalText.IndexOf(UNK_CHAR_LITERAL) $( 3 2 . 8 \%$ ) originalText.LastIndexOf(UNK_CHAR_LITERAL) $( 1 2 . 4 \% )$ originalText.IndexOf(text) $( 8 . 7 \% )$
287
+
288
+ # Sample 2
289
+
290
+ caretPos--;
291
+ if (caretPos $< ~ 0$ ) { caretPos $\qquad = \quad 0$ ;
292
+ }
293
+ int len $=$ inputString.Length;
294
+ if (caretPos $> =$ len) { caretPos $=$ len - 1 ;
295
+ }
296
+
297
+ Sample snippet from acat. The following suggestions were made: $s e q \to S e q$ :
298
+
299
+ UNK_TOKEN $^ { + 1 }$ $( 2 . 1 \% )$ )
300
+ UNK_TOKEN+UNK_TOKEN] $( 1 . 8 \% )$
301
+ UNK_TOKEN.IndexOf(UNK_CHAR_LITERAL) $( 1 . 3 \% )$
302
+
303
+ # $S e q \mathcal { N A G }$
304
+
305
+ wordToReplace - 1 (3.2%) insertOrReplaceOffset - 1 $( 2 . 9 \%$ ) inputString - 1 $( 1 . 9 \% )$
306
+
307
+ $\mathcal { G } S e q$ :
308
+ $1 \mathsf { e n } ~ + ~ 1 \left( 3 5 . 6 \% \right)$
309
+ $\mathrm { l e n } \ - \ 1 \left( 1 1 . 3 \% \right)$
310
+ len $> >$ UNK_NUM_LITERAL $( 3 . 5 \% )$ )
311
+
312
+ $$
313
+ \begin{array} { r l } & { \underbrace { \mathcal { G } \to \mathcal { T } r e e } _ { \mathrm { l e n ~ + ~ \ l e n ~ ( 2 4 . 9 \% ) } } } \\ & { \mathrm { l e n ~ - ~ \ l e n ~ ( 1 0 . 7 \% ) } } \\ & { \mathrm { 1 ~ + ~ \ 1 e n ~ ( 3 . 7 \% ) } } \end{array}
314
+ $$
315
+
316
+ $$
317
+ \begin{array} { l } { \underbrace { \mathcal { G } \mathcal { A } S \mathcal { N } } _ { \mathrm { 1 e n ~ + ~ 1 ~ } ( 2 2 . 8 \% ) } \colon } \\ { \mathrm { ~ l e n ~ - ~ 1 ~ } ( 1 0 . 8 \% ) } \\ { \mathrm { ~ l e n ~ + ~ 1 ~ e n ~ } ( 1 0 . 3 \% ) } \end{array}
318
+ $$
319
+
320
+ $$
321
+ \begin{array} { l } { { \underbrace { \mathcal { G } \to S y n } _ { \mathrm { 1 e n ~ + ~ 1 ~ } ( 1 3 . 7 \% ) } } } \\ { { \mathrm { 1 e n ~ - ~ 1 ~ } ( 1 1 . 5 \% ) } } \\ { { \mathrm { 1 e n ~ - ~ 1 } \mathrm { e n } ( 1 1 . 0 \% ) } } \end{array}
322
+ $$
323
+
324
+ # $\mathcal { G } \mathcal { N A G } \mathrm { : }$
325
+
326
+ $1 \mathrm { e n } + + \left( 3 3 . 6 \% \right)$ len-1 $( 2 1 . 9 \% )$ len $^ { + 1 }$ $( 1 4 . 6 \% )$ )
327
+
328
+ # Sample 3
329
+
330
+ public static String URItoPath(String uri) { if (System.Text.RegularExpressions .Regex.IsMatch(uri, "^file:\\\\[a-z,A-Z]:")) { return uri.Substring(6); } if uri.StartsWith(@"file:") { return uri.Substring(5); } return uri;
331
+ }
332
+
333
+ Sample snippet from acat. The following suggestions were made: $s e q \to S e q$ :
334
+
335
+ !UNK_TOKEN $( 1 1 . 1 \% )$ ) UNK_TOKEN $= = \mathrm { ~ 0 ~ } ( 3 . 6 \% )$ UNK_TOKEN $! = \mathrm { ~ 0 ~ } ( 3 . 4 \% )$
336
+
337
+ # $S e q { \mathcal { N A G } } \colon$
338
+
339
+ !uri $( 7 . 6 \% )$ , !MyVideos $( 4 . 7 \% )$ ) !MyDocuments $( 4 . 7 \% )$
340
+
341
+ $\mathcal G S e q \mathrm { : }$ action $= =$ UNK_STRING_LITERAL $( 2 2 . 6 \% )$ ) label $= =$ UNK_STRING_LITERAL $( 1 4 . 8 \%$ ) file.Contains(UNK_STRING_LITERAL) $( 4 . 6 \%$
342
+
343
+ $\mathcal { G } \mathcal { T } r e e .$ :
344
+ $\mathrm { u r i } \ = = \ \mathrm { u r i } \ ( 7 . 4 \% )$
345
+ uri.StartsWith(uri) $( 5 . 5 \% )$ uri.Contains(uri) $( 4 . 3 \% )$ 0
346
+
347
+ # $\mathcal { G } \mathcal { A } S \mathcal { N } \mathrm { : }$
348
+
349
+ uri $= =$ UNK_STRING_LITERAL $( 1 1 . 7 \%$ ) uri.Contains(UNK_STRING_LITERAL) $( 1 1 . 7 \%$ ) uri.StartsWith(UNK_STRING_LITERAL) $( 8 . 3 \% )$
350
+
351
+ # $\mathcal G \to S y n \colon$
352
+
353
+ $\mathrm { { \ u r { \dot { 1 } } } ~ } = =$ UNK_STRING_LITERAL $( 2 6 . 4 \%$ ) $\mathsf { u r i } \ \mathsf { \Omega } = \mathsf { \Omega } ^ { \mathsf { m } \mathsf { n } } \left( 8 . 5 \% \right)$ uri.StartsWith(UNK_STRING_LITERAL) $( 6 . 7 \% )$
354
+
355
+ # $\mathcal { G } \underline { { \mathcal { N A G } } } ;$
356
+
357
+ uri.Contains(UNK_STRING_LITERAL) $( 3 2 . 4 \%$ ) uri.StartsWith(UNK_STRING_LITERAL) $( 2 9 . 2 \% )$ uri.HasValue() $( 7 . 7 \% )$
358
+
359
+ # Sample 4
360
+
361
+ <table><tr><td>startPos = index + 1; int count = endPos - startPos + 1; word = (count &gt; 0)? input.Substring(startPos, count) : String.Empty;</td></tr></table>
362
+
363
+ # Sample snippet from acat. The following suggestions were made: $\underline { { S e q } } S e q$ :
364
+
365
+ UNK_TOKEN.Trim() $( 3 . 4 \% )$ UNK_TOKEN.Replace(UNK_STRING_LITERAL, UNK_STRING_LITERAL) $( 2 . 1 \% )$ UNK_TOKEN.Replace(‘UNK_CHAR‘, ‘UNK_CHAR‘) $( 3 . 4 \% )$
366
+
367
+ # $S e q \mathcal { N A G }$
368
+
369
+ input[index] $( 1 . 4 \% )$ startPos[input] $( 0 . 9 \% )$ input[count] $( 0 . 8 \% )$
370
+
371
+ # $\underline { { \mathcal { G } \to S e q } } :$
372
+
373
+ val.Trim() $( 6 . 6 \% )$ )
374
+ input.Trim() $( 6 . 5 \% )$
375
+ input.Substring(UNK_NUM_LITERAL) $( 4 . 0 \% )$
376
+
377
+ # $\mathcal { G } \mathcal { T } r e e \mathrm { : }$
378
+
379
+ UNK_STRING_LITERAL $^ +$ UNK_STRING_LITERAL $( 8 . 4 \% )$ ) UNK_STRING_LITERAL $^ +$ startPos $( 7 . 8 \%$ ) startPos $^ +$ UNK_STRING_LITERAL $( 7 . 8 \% )$
380
+
381
+ # $\mathcal { G } \mathcal { A } S \mathcal { N }$
382
+
383
+ input.Trim() $( 1 5 . 6 \% )$ ,
384
+ input.Substring(0) $( 6 . 4 \% )$
385
+ input.Replace(UNK_STRING_LITERAL, UNK_STRING_LITERAL) $( 2 . 8 \% )$ )
386
+
387
+ # $\mathcal { G } S y n$
388
+
389
+ input.Trim() $( 7 . 8 \% )$ input.ToLower() $( 6 . 4 \% )$ input $^ +$ UNK_STRING_LITERAL $( 5 . 6 \% )$ ,
390
+
391
+ # $\mathcal { G } \mathcal { N A G } ;$
392
+
393
+ input+StartPos $( 1 1 . 8 \%$ 0
394
+ input+count $( 9 . 5 \% )$
395
+ input.Substring(startPos, endPos - count) $( 6 . 3 \% )$
396
+
397
+ # Sample 5
398
+
399
+ protected virtual void CrawlSite() { while ( !_crawlComplete { RunPreWorkChecks(); if (_scheduler.Count $> ~ 0$ ) { _threadManager.DoWork( () $= >$ ProcessPage(_scheduler.GetNext())); } else if (!_threadManager.HasRunningThreads()) { _crawlComplete $=$ true; else { _logger.DebugFormat("Waiting for links to be scheduled..."); Thread.Sleep(2500); } }
400
+ }
401
+
402
+ Sample snippet from Abot. The following suggestions were made: $s e q \to S e q$ :
403
+
404
+ !UNK_TOKEN $( 9 . 4 \% )$ UNK_TOKEN $> \ 0 \ ( 2 . 6 \% )$ UNK_TOKEN ! $=$ value $( 1 . 3 \% )$
405
+
406
+ # $S e q { \mathcal { N A G } } ;$
407
+
408
+ !_maxPagesToCrawlLimitReachedOrScheduled $( 2 6 . 2 \%$ ) !_crawlCancellationReported $( 2 6 . 0 \% )$ !_crawlStopReported $( 2 1 . 8 \% )$
409
+
410
+ # $\mathcal G \to S e q \mathrm { : }$
411
+
412
+ !UNK_TOKEN $( 5 4 . 9 \% )$ ) !done $( 1 8 . 8 \%$ ) !throwOnError $( 3 . 3 \% )$ )
413
+
414
+ # $\mathcal { G } \mathcal { T } r e e \mathrm { : }$
415
+
416
+ !_crawlCancellationReported $( 2 3 . 6 \%$ ) !_crawlStopReported $( 2 3 . 3 \% )$ !_maxPagesToCrawlLimitReachedOrScheduled $( 1 8 . 9 \% )$
417
+
418
+ # $\mathcal { G } \mathcal { A } S \mathcal { N } ;$
419
+
420
+ !_crawlStopReported $( 2 6 . 6 \%$ ) !_crawlCancellationReported $( 2 6 . 5 \%$ ) !_maxPagesToCrawlLimitReachedOrScheduled $( 2 5 . 8 \%$ )
421
+
422
+ # $\mathcal { G } S y n$
423
+
424
+ !_crawlStopReported $( 1 9 . 6 \%$ ) !_maxPagesToCrawlLimitReachedOrScheduled $( 1 9 . 0 \%$ ) !_crawlCancellationReported $( 1 5 . 7 \% )$ )
425
+
426
+ # $\mathcal { G } \mathcal { N A G }$
427
+
428
+ !_crawlStopReported $( 3 8 . 4 \% )$ !_crawlCancellationReported $( 3 1 . 8 \%$ ) !_maxPagesToCrawlLimitReachedOrScheduled $( 2 7 . 0 \%$ )
429
+
430
+ # Sample 6
431
+
432
+ char character $=$ originalName[i];
433
+ if ( character == ’<’ { ++startTagCount; builder.Append(’‘���);
434
+ } else if (startTagCount $> ~ 0$ ) { if (character $\scriptstyle = = \prime > \prime$ ) { --startTagCount; }
435
+
436
+ Sample snippet from StyleCop. The following suggestions were made: $\underline { { S e q } } S e q \mathrm { . }$ :
437
+
438
+ $\begin{array} { r l } { \mathrm { ~ x ~ } } & { { } = = } \end{array}$ UNK_CHAR_LITERAL $( 5 . 9 \% )$ ) UNK_TOKEN $= = \ 0 \ ( 3 . 3 \% )$ UNK_TOKEN $> \ 0 \ ( 2 . 7 \% )$
439
+
440
+ $\displaystyle \frac { S e q \to \mathcal { N } A \mathcal { G } } { ! \mathrm { ~ i ~ \Gamma ~ \mathrm { ~ \Omega ~ \mathrm { ~ = ~ } ~ 0 ~ } ~ } ( 5 . 1 \% ) } \mathrm { ~ . ~ }$ character $< \mathrm { ~ 0 ~ } ( 2 . 7 \% )$ character $( 2 . 2 \% )$ )
441
+
442
+ # $\underline { { \mathcal { G } \to S e q } } .$
443
+
444
+ character $= =$ UNK_CHAR_LITERAL $( 7 0 . 8 \%$ )
445
+ character $= =$ UNK_CHAR_LITERAL || character $= =$ UNK_CHAR_LITERAL $( 5 . 8 \% )$ )
446
+ character ! $! =$ UNK_CHAR_LITERAL $( 3 . 1 \% )$ )
447
+
448
+ # $\mathcal { G } \mathcal { T } r e e \mathrm { : }$
449
+
450
+ character $= =$ character $( 9 . 9 \%$ ) UNK_CHAR_LITERAL $= =$ character $( 8 . 2 \%$ ) character $= =$ UNK_CHAR_LITERAL $( 8 . 2 \% )$ )
451
+
452
+ # $\mathcal { G } \mathcal { A } S \mathcal { N } \mathrm { : }$
453
+
454
+ character $= =$ UNK_CHAR_LITERAL $( 4 3 . 4 \%$ ) character || character $( 3 . 3 \% )$ character $= =$ UNK_CHAR_LITERAL $= =$ UNK_CHAR_LITERAL $( 3 . 0 \% )$
455
+
456
+ # $\mathcal { G } S y n$
457
+
458
+ character $= =$ UNK_CHAR_LITERAL $( 3 9 . 6 \%$ ) character || character $= =$ UNK_STRING_LITERAL $( 5 . 2 \% )$ 0 character $= =$ UNK_STRING_LITERAL $( 2 . 8 \% )$
459
+
460
+ # $\mathcal { G } \mathcal { N A G } ;$
461
+
462
+ character $= =$ UNK_CHAR_LITERAL $( 7 5 . 5 \%$ ) character $\mathrm { ~ \ -- ~ } \ ^ { \prime } \ ^ { \prime } \ ( 2 . 6 \% )$ character ! $=$ ’UNK_CHAR $( 2 . 5 \% )$
463
+
464
+ # Sample 7
465
+
466
+ public void AllowAccess(string path)
467
+ { if (path $= =$ null) throw new ArgumentNullException("path"); if !path.StartsWith(" /") ) throw new ArgumentException( string.Format( "The path \"{0}\" is not application relative." + " It must start with \"\~/\".", path), "path"); paths.Add(path);
468
+ }
469
+
470
+ Sample snippet from cassette. The following suggestions were made: $S e q S e q$ :
471
+
472
+ UNK_TOKEN $< \mathrm { ~ 0 ~ } ( 1 4 . 6 \% )$ !UNK_TOKEN $( 7 . 5 \% )$ ) UNK_TOKEN $= = \ 0 \ ( 3 . 3 \% )$
473
+
474
+ $\underline { { S e q \mathcal { N A G } } } ;$
475
+ path $= =$ UNK_STRING_LITERAL $( 1 8 . 1 \%$
476
+ path $< = \mathrm { ~ 0 ~ } ( 5 . 6 \% )$
477
+ path $\scriptstyle \mathbf { \mu = } \mathbf { \mu " } \mathbf { \mu " } \left( 4 . 8 \% \right)$ $\underline { { \mathcal { G } \to S e q } } .$
478
+ !UNK_TOKEN $( 4 8 . 0 \%$ )
479
+ !discardNulls $( 6 . 3 \% )$ ) !first $( 2 . 7 \% )$
480
+
481
+ $\mathcal { G } \mathcal { T } r e e \mathrm { : }$ !path $( 6 7 . 4 \% )$ ) path && path $( 8 . 4 \% )$ !!path $( 5 . 5 \% )$
482
+
483
+ $\mathcal { G } \mathcal { A } S \mathcal { N } \mathrm { : }$
484
+ !path $( 9 1 . 5 \%$ )
485
+ !path && !path $( 0 . 9 \%$ )
486
+ !path.Contains(UNK_STRING_LITERAL) $( 0 . 7 \% )$
487
+ $\mathcal { G } S y n \mathrm { : }$ :
488
+ !path $( 8 9 . 6 \%$ )
489
+ !path && !path $( 1 . 5 \% )$ )
490
+ !path.Contains(UNK_STRING_LITERAL) $( 0 . 5 \% )$ )
491
+
492
+ # $\mathcal { G } \underline { { \mathcal { N A G } } } ;$
493
+
494
+ !path $( 4 2 . 9 \% )$
495
+
496
+ !path.StartsWith(UNK_STRING_LITERAL) $( 2 3 . 8 \% )$ !path.Contains(UNK_STRING_LITERAL) $( 5 . 9 \%$ )
497
+
498
+ # Sample 8
499
+
500
+ int methodParamCount $\qquad = \quad 0$ ;
501
+ IEnumerable<IParameterTypeInformation> moduleParameters $=$ Enumerable<IParameterTypeInformation>.Empty;
502
+ if (paramCount $> 0$ ) { IParameterTypeInformation[] moduleParameterArr $=$ this.GetModuleParameterTypeInformations(Dummy.Signature, paramCount); methodParamCount $=$ moduleParameterArr.Length; if (methodParamCount $> ~ 0$ ) moduleParameters $=$ IteratorHelper.GetReadonly(moduleParameterArr);
503
+ }
504
+ IEnumerabl $\beta < \mathrm { I P }$ arameterTypeInformation> moduleVarargsParameters $=$ Enumerable<IParameterTypeInformation>.Empty;
505
+ if ( paramCount > methodParamCount ) { IParameterTypeInformation[] moduleParameterArr $=$ this.GetModuleParameterTypeInformations( Dummy.Signature, paramCount - methodParamCount); if (moduleParameterArr.Length $> 0$ ) moduleVarargsParameters $=$ IteratorHelper.GetReadonly(moduleParameterArr);
506
+ }
507
+
508
+ # Sample snippet from Afterthought. The following suggestions were made: $s e q \to S e q$ :
509
+
510
+ !UNK_TOKEN $( 1 0 . 9 \%$ ) UNK_TOKEN $= =$ UNK_TOKEN $( 4 . 6 \% )$ UNK_TOKEN $= =$ UNK_STRING_LITERAL $( 3 . 3 \% )$
511
+
512
+ $S e q { \mathcal { N A G } } ;$ dummyPinned $! = \mathrm { ~ 0 ~ } ( 2 . 2 \% )$ paramCount $! = \mathrm { ~ 0 ~ } ( 2 . 1 \% )$ dummyPinned $= = \ 0 \ ( 1 . 5 \% )$
513
+
514
+ # $\mathcal G S e q \mathrm { : }$
515
+
516
+ newValue > 0 (9.7%) zeroes $> \mathrm { ~ 0 ~ } ( 9 . 0 \% )$ paramCount $> \mathrm { ~ 0 ~ } ( 6 . 0 \% )$
517
+
518
+ # $\mathcal { G } \mathcal { T } r e e \mathrm { : }$
519
+
520
+ methodParamCount $= =$ methodParamCount $( 3 . 4 \% )$ $0 \quad = =$ methodParamCount $( 2 . 8 \%$ ) methodParamCount $= =$ paramCount $( 2 . 8 \%$ )
521
+
522
+ # $\mathcal { G } \mathcal { A } S \mathcal { N } ;$
523
+
524
+ paramCount $= = \ 0 \ ( 1 2 . 7 \% )$ paramCount $< \mathrm { ~ 0 ~ } ( 1 1 . 5 \% )$ paramCount $> \mathrm { ~ 0 ~ } ( 8 . 0 \% )$
525
+
526
+ # $\mathcal { G } S y n \mathrm { : }$
527
+
528
+ methodParamCount $> \mathrm { ~ 0 ~ } ( 1 0 . 9 \% )$ paramCount $> \mathrm { ~ 0 ~ } ( 7 . 9 \% )$ methodParamCount $! = \mathrm { ~ 0 ~ } ( 5 . 6 \% )$
529
+
530
+ # $\mathcal { G } \underline { { \mathcal { N A G } } } ;$
531
+
532
+ paramCount $>$ methodParamCount $( 3 4 . 4 \%$ ) paramCount $= =$ methodParamCount $( 1 1 . 4 \%$ ) paramCount $<$ methodParamCount $( 1 0 . 0 \%$ )
533
+
534
+ # Sample 9
535
+
536
+ public CodeLocation(int index, int endIndex, int indexOnLine, int endIndexOnLine, int lineNumber, int endLineNumber)
537
+ { Param.RequireGreaterThanOrEqualToZero(index, "index"); Param.RequireGreaterThanOrEqualTo(endIndex, index, "endIndex"); Param.RequireGreaterThanOrEqualToZero(indexOnLine, "indexOnLine"); Param.RequireGreaterThanOrEqualToZero(endIndexOnLine, "endIndexOnLine") Param.RequireGreaterThanZero(lineNumber, "lineNumber"); Param.RequireGreaterThanOrEqualTo(endLineNumber, lineNumber, "endLineNumber"); // If the entire segment is on the same line, // make sure the end index is greater or equal to the start index. if $\mathrm { : | \ l i n e N u m b e r { \ell } = = \ e n d L i n e N u m b e r { \ell } | \ t a m b e r { \ell } | \ t a m b e r { \ell } { \ell } \ l }$ ) { Debug.Assert(endIndexOnLine $> =$ indexOnLine, "The end index must be greater than the start index," $^ +$ " since they are both on the same line."); } this.startPoint $=$ new CodePoint(index, indexOnLine, lineNumber); this.endPoint $=$ new CodePoint(endIndex, endIndexOnLine, endLineNumber);
538
+ }
539
+
540
+ Sample snippet from StyleCop. The following suggestions were made: $\underline { { S e q } } S e q$ :
541
+
542
+ !UNK_TOKEN $( 1 4 . 0 \% )$ ) UNK_TOKEN $= = \ 0 \ ( 4 . 4 \% )$ UNK_TOKEN $> \mathrm { ~ 0 ~ } ( 3 . 5 \% )$
543
+
544
+ # $S e q { \mathcal { N A G } } ;$
545
+
546
+ endIndex $< ~ 0$ $( 3 . 8 \% )$ endIndex $> 0$ $3 . 4 \% )$ endIndex $= = \ 0 \ ( 2 . 2 \% )$
547
+
548
+ # $\mathcal G \to S e q \mathrm { : }$
549
+
550
+ lineNumber $< \mathrm { ~ \ 0 ~ } ( 9 . 4 \% )$ lineNumber $= = \mathrm { ~ 0 ~ ( 7 . 4 \% ) ~ }$ lineNumber $< = \mathrm { ~ 0 ~ } ( 5 . 1 \% )$
551
+
552
+ # $\mathcal { G } \mathcal { T } r e e \mathrm { : }$
553
+
554
+ lineNumber $= =$ lineNumber $( 3 . 4 \% )$ $0 \quad = =$ lineNumber $( 2 . 5 \% )$ , lineNumber $>$ lineNumber $( 2 . 5 \% )$
555
+
556
+ # $\mathcal { G } \mathcal { A } S \mathcal { N } ;$
557
+
558
+ endLineNumber $\scriptstyle = = \ 0 \ ( 9 . 6 \% )$ endLineNumber $< \mathrm { ~ 0 ~ } ( 7 . 9 \% )$ endLineNumber $> \mathrm { ~ 0 ~ } ( 6 . 1 \% )$
559
+
560
+ #
561
+
562
+ $$
563
+ \begin{array} { r l } & { \frac { \mathscr { G } \mathrm { ~ ~ } S y n \mathrm { : } } { \mathrm { 1 i n e N u m b e r ~ \gamma > ~ \gamma _ 0 ~ ( 1 1 . 3 \% ) } } } \\ & { \mathrm { ~ \bot ~ i n e N u m b e r ~ \gamma = = ~ \gamma _ 0 ~ ( 7 . 3 \% ) } } \\ & { \mathrm { ~ \bot ~ i n e N u m b e r ~ \gamma _ l = ~ \gamma _ 0 ~ ( 6 . 7 \% ) } } \end{array}
564
+ $$
565
+
566
+ # $\mathcal { G } \underline { { \mathcal { N A G } } } ;$
567
+
568
+ lineNumber $>$ endLineNumber $( 2 0 . 7 \%$ )lineNumber $<$ endLineNumber $( 1 6 . 5 \%$ )lineNumber $= =$ endLineNumber $( 1 6 . 2 \% )$
569
+
570
+ # Sample 10
571
+
572
+ public static Bitmap RotateImage(Image img, float angleDegrees, bool upsize, bool clip) { // Test for zero rotation and return a clone of the input image if (angleDegrees $\textstyle = = 0 \mathrm { { f } }$ ) return (Bitmap)img.Clone(); // Set up old and new image dimensions, assuming upsizing not wanted // and clipping OK int oldWidth $=$ img.Width; int oldHeight $=$ img.Height; int newWidth $=$ oldWidth; int newHeight $=$ oldHeight; float scaleFactor $\qquad = ~ \perp \pm$ ; // If upsizing wanted or clipping not OK calculate the size of the // resulting bitmap if upsize || !clip { double angleRadians $=$ angleDegrees $\star$ Math.PI / 180d; double cos $=$ Math.Abs(Math.Cos(angleRadians)); double sin $=$ Math.Abs(Math.Sin(angleRadians)); newWidth $=$ (int)Math.Round((oldWidth $\star$ cos) $^ +$ (oldHeight $\star$ sin)); newHeight $=$ (int)Math.Round((oldWidth $\star$ sin) $^ +$ (oldHeight $\star$ cos)); } // If upsizing not wanted and clipping not OK need a scaling factor if (!upsize && !clip) { scaleFactor $=$ Math.Min((float)oldWidth / newWidth, (float)oldHeight / newHeight); newWidth $=$ oldWidth; newHeight $=$ oldHeight; }
573
+
574
+ Sample snippet from ShareX. The following suggestions were made: $\underline { { S e q } } S e q \mathrm { . }$ :
575
+
576
+ UNK_TOKEN $>$ 0 $( 8 . 3 \% )$ !UNK_TOKEN $( 4 . 4 \% )$ UNK_TOKEN $= = \ 0 \ ( 2 . 6 \% )$
577
+
578
+ $S e q { \mathcal { N A G } } ;$ newHeight $> \mathrm { ~ 0 ~ } ( 5 . 1 \% )$ $\beth \mathrm { { 1 i p } } ~ > ~ 0 ~ ( 3 . 2 \% )$ oldWidth $> 0$ $( 2 . 9 \% )$
579
+
580
+ # $\underline { { \mathcal { G } \to S e q } } :$
581
+
582
+ UNK_TOKEN && UNK_TOKEN $( 1 5 . 0 \%$ ) UNK_TOKEN || UNK_TOKEN $( 1 3 . 6 \% )$ ) trustedForDelegation && !appOnly $( 1 2 . 1 \% )$ )
583
+
584
+ # $\mathcal { G } \mathcal { T } r e e .$
585
+
586
+ upsize && upsize $( 2 1 . 5 \% )$ ) upsize && clip $( 1 0 . 9 \%$ ) clip && upsize $( 1 0 . 9 \% )$
587
+
588
+ # $\mathcal { G } \mathcal { A } S \mathcal { N } ;$
589
+
590
+ upsize && clip $( 1 3 . 9 \%$ ) upsize && !clip $( 9 . 8 \% )$ clip && clip $( 9 . 3 \% )$
591
+
592
+ # $\mathcal { G } S y n \mathrm { : }$
593
+
594
+ upsize && !upsize $( 6 . 9 \%$ ) clip && !upsize $( 6 . 3 \% )$ ) upsize || upsize $( 5 . 7 \% )$
595
+
596
+ # $\mathcal { G } \mathcal { N A G } ;$
597
+
598
+ upsize || clip $( 1 9 . 1 \%$ upsize && clip $( 1 8 . 8 \% )$ upsize && ! clip $( 1 2 . 2 \% )$ )
md/train/Bke6vTVYwH/Bke6vTVYwH.md ADDED
@@ -0,0 +1,291 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # GRAPH CONVOLUTIONAL NETWORKS FOR LEARNING WITH FEW CLEAN AND MANY NOISY LABELS
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ In this work we consider the problem of learning a classifier from noisy labels when a few clean labeled examples are given. The structure of clean and noisy data is modeled by a graph per class and Graph Convolutional Networks (GCN) are used to predict class relevance of noisy examples. For each class, the GCN is treated as a binary classifier learning to discriminate clean from noisy examples using a weighted binary cross-entropy loss function, and then the GCN-inferred “clean” probability is exploited as a relevance measure. Each noisy example is weighted by its relevance when learning a classifier for the end task. We evaluate our method on an extended version of a few-shot learning problem, where the few clean examples of novel classes are supplemented with additional noisy data. Experimental results show that our GCN-based cleaning process significantly improves the classification accuracy over not cleaning the noisy data and standard few-shot classification where only few clean examples are used. The proposed GCN-based method outperforms the transductive approach (Douze et al., 2018) that is using the same additional data without labels.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ State-of-the-art deep learning methods require a large amount of manually labeled data. The need for supervision may be reduced by decoupling representation learning from the end task and/or using additional training data that are unlabeled, weakly labeled (with noisy labels), or belong to different domains or classes. Example approaches are transfer learning (Wang & Gupta, 2015), unsupervised representation learning (Wang & Gupta, 2015), semi-supervised learning (Weston et al., 2008), learning from noisy labels (Joulin et al., 2016) and few-shot learning (Snell et al., 2017).
12
+
13
+ Learning from noisy labels allows using large-scale data and labels from the web without human annotation effort. Most work focuses on learning the representation jointly with the end task, assuming there is still a considerable amount of clean labeled data (Patrini et al., 2017; Lee et al., 2018; Li et al., 2017). However, for a number of classes only very few or even no clean labeled examples might be available at the representation learning stage. Few-shot learning limits the labeled data to very few on the end task, while the representation is learned on a large training set of different classes (Hariharan & Girshick, 2017; Snell et al., 2017; Vinyals et al., 2016). Nevertheless, in many situations, more data with noisy labels are available or can be acquired for the end task.
14
+
15
+ One interesting mix of few-shot learning with additional large-scale data is the work of Douze et al. (2018), where labels are propagated from few clean labeled examples to a large-scale collection. This collection is unlabeled and actually contains data of many more classes than the end task. Their method overall improves the classification accuracy, but at an additional computational cost; it is a transductive method, i.e., instead of learning a parametric classifier, the large-scale collection is still necessary at inference.
16
+
17
+ In this work, we learn a classifier from few clean labeled examples and additional weakly labeled data, while the representation is learned on different classes, as in few-shot learning. We assume the class names are known, and we use them to search an existing large collection of images with textual description. The result is a set of images with potentially relevant, but noisy labels. As shown in Figure 1, we clean this data using a graph convolutional network (GCN) (Kipf & Welling, 2017), which learns to predict a class relevance score per image based on the source (clean vs. noisy) of its connections in the graph. Both the clean and the noisy images are then used to learn a classifier, where the noisy examples are weighted by relevance. Unlike most existing work, our method operates independently per class and applies when clean labeled examples are few or even one per class.
18
+
19
+ ![](images/7eed9d45df54f8a4f9857ca30afe31d8710a4404ec6cdacce1d0af912c397be2.jpg)
20
+ Figure 1: Overview of our cleaning approach for 1-shot learning with noisy examples. We use the class name admiral to crawl noisy images from web and create an adjacency graph based on visual similarity. We then assign a relevance score to each noisy example with a graph convolutional network (GCN). Relevance scores are displayed next to the images.
21
+
22
+ We make the following contributions:
23
+
24
+ • We learn a classifier on a large-scale weakly-labeled collection jointly with only few clean labeled examples.
25
+ • To our knowledge, we are the first to use a GCN to clean noisy data: we cast a GCN as a binary classifier learning to discriminate clean from noisy data, and we use its inferred probabilities for the “clean” class as a relevance score per example.
26
+ We apply our method to a few-shot learning benchmark and show significant improvement in accuracy, while outperforming the method by Douze et al. (2018) using the same large-scale collection of data.
27
+
28
+ # 2 RELATED WORK
29
+
30
+ Learning with noisy labels is often concerned with estimating or learning a transition matrix (Natarajan et al., 2013; Patrini et al., 2017; Sukhbaatar et al., 2014) or knowledge graph (Li et al., 2017) between labels and correcting the loss function, which does not apply in our case since the classes in the noisy data are unknown. Most recent work on learning from large-scale weakly-labeled data focuses on learning the representation e.g. by metric learning (Lee et al., 2018; Wang et al., 2018a), bootstrapping (Reed et al., 2015), or distillation (Li et al., 2017). In our case however, since the clean labeled examples are few, we need to keep the representation mostly fixed.
31
+
32
+ Dealing with the noise, e.g. by thresholding (Lee et al., 2018), outlier detection (Wang et al., 2018a) or reweighting (Liu & Tao, 2015), is applicable while the representation is learned, based e.g. on the gradient of the loss (Ren et al., 2018b). In contrast, the relatively-shallow GCN that we propose effectively decouples reweighting from both representation learning and classifier learning. Learning to clean the noisy labels (Veit et al., 2017) typically assumes adequate human verified labels for training, which again is not the case in this work.
33
+
34
+ Few-shot learning. Meta-learning (Vilalta & Drissi, 2002) refers to learning at two levels, where generic knowledge is acquired before adapting to more specific tasks. In few-shot learning, this translates to learning on a set of base classes how to learn from few examples on a distinct set of novel classes without overfitting. For instance, optimization meta-learning (Finn et al., 2017; 2018; Ravi & Larochelle, 2017) amounts to learning a model that is easy to fine-tune in few steps. In our work, we study an extension of few-shot learning where more data are available on novel classes, reducing the risk of overfitting when fine-tuning the model. Metric learning approaches learn how to compare queries for instance to few examples (Vinyals et al., 2016) or to the corresponding class prototypes (Snell et al., 2017). Hariharan & Girshick (2017) and Wang et al. (2018b) learn how to generate novel-class examples, which is not needed when more data are actually available.
35
+
36
+ Gidaris & Komodakis (2018) learn on base classes a simpler cosine similarity-based parametric classifier, or simply cosine classifier, without meta-learning. The same classifier has been introduced independently by Qi et al. (2018), who further fine-tune the network, assuming access to the base class training set. A recent survey (Chen et al., 2019) confirms the superiority of the cosine classifier to previous work including meta-learning (Finn et al., 2017). We use the cosine classifier in this work, both for base and novel classes. All of the above use only the few labeled examples of the novel classes.
37
+
38
+ Making use of unlabeled data has been little explored in few-shot learning until recently. Ren et al. (2018a) introduce a semi-supervised few-shot classification task, where some labels are unknown. Liu et al. (2019) follow the same semi-supervised setup, but use graph-based label propagation (LP) (Zhou et al., 2003a) for classification and consider jointly all test images. These methods assume a meta-learning scenario, where only small-scale data is available at each training episode; arguably, such a small amount of data limits the representation adaptation and generalization to unseen data. Similarly, Rohrbach et al. (2013) use label propagation in a transductive setting, but at a larger scale assuming that all examples come from a set of known classes. Douze et al. (2018) extend to even larger scale, leveraging 100M unlabeled images in a graph without using additional text information. We focus on the latter large-scale scenario using the same 100M dataset. However, we filter by text to obtain noisy labels and follow an inductive approach by training a classifier for novel classes, such that the 100M collection is not needed at inference.
39
+
40
+ Graph neural networks are generalizations of convolutional networks to non-Euclidean spaces (Bronstein et al., 2017). Early spectral methods (Bruna et al., 2014; Henaff et al., 2015) have been succeeded by Chebyshev polynomial approximations (Defferrard et al., 2016), which avoid the high computational cost of computing eigenvectors. Graph convolutional networks (GCN) (Kipf & Welling, 2017) provide a further simplification by a first-order approximation of graph filtering and are applied to semi-supervised (Kipf & Welling, 2017) and subsequently to few-shot learning (Garcia & Bruna, 2018). In Kipf & Welling (2017), the loss function is applied to labeled examples to make predictions on unlabeled ones. Similarly in Garcia & Bruna (2018), GCNs make predictions on novel class examples. Gidaris & Komodakis (2019) use Graph Neural Networks as denoising autoencoders to generate class weights for novel classes. In contrast, we cast GCNs as binary classifiers discriminating clean from noisy examples: we apply a loss function to all examples, and then use the inferred probabilities as a class relevance measure, effectively cleaning the data.
41
+
42
+ Our counter-intuitive objective of treating all noisy examples as negative can be compared to treating each example as a different class in instance-level discrimination (Wu et al., 2018). In fact, our loss function is similar to noise-contrastive estimation (NCE) (Gutmann & Hyvärinen, 2010) used in that work. According to our experiments, our GCN-based classifier outperforms classical LP (Zhou et al., 2003a) used for a similar purpose by Rohrbach et al. (2013).
43
+
44
+ # 3 PROBLEM FORMULATION
45
+
46
+ We consider a space $\mathcal { X }$ of examples. We are given a set $X _ { \mathcal { L } } \subset \mathcal { X }$ of examples, each having a clean (manually verified) label in a set $C _ { \mathcal { L } }$ of classes with $| C _ { \mathcal { L } } | = K _ { \mathcal { L } }$ . For any set $X \subset { \mathcal { X } }$ , we denote by $X ^ { c }$ its subset of examples having a label in class $c$ . We assume that the number $| X _ { \mathcal { L } } ^ { c } |$ of examples labeled in each class $c \in C _ { \mathcal { L } }$ is only $k$ , typically in $\{ 1 , 2 , 5 , 1 0 , 2 0 \}$ . We are also given an additional set $X _ { \mathcal { Z } } ^ { c }$ of examples, each with a set of noisy labels in $C _ { \mathcal { L } }$ . The extended set of examples for class $c$ is now $X _ { \mathcal { E } } ^ { c } = X _ { \mathcal { L } } ^ { c } \cup X _ { \mathcal { Z } } ^ { c }$ . Examples or sets of examples having clean (noisy) labels are referred to as clean (noisy) as well. The goal is to train a classifier, using the additional noisy set in order to improve the accuracy compared to only using the small clean set.
47
+
48
+ We assume that we are given a feature extractor $g _ { \theta } : \mathcal { X } \mathbb { R } ^ { d }$ , mapping an example to a $d .$ -dimensional vector. For instance, when examples are images, the feature extractor is typically a convolutional neural network (CNN) and $\theta$ are the parameters of all layers.
49
+
50
+ In this work, we assume that the noisy set $X z$ is collected via web crawling with examples that are images accompanied with free-form text description and/or user tags originating from community photo collections. To make use of text data, we assume that the names of classes in $C _ { \mathcal { L } }$ are given. An example in $X z$ is given a label in class $c \in C _ { \mathcal { L } }$ if its textual information contains the name of class $c$ ; it may then have none, one or more labels. In this way, we automatically infer labels for $X z$ without human effort, which are however noisy.
51
+
52
+ We perform cleaning by predicting a class relevance measure for each noisy example in $X _ { \mathcal { Z } } ^ { c }$ , independently per class $c \in C _ { \mathcal { L } }$ . To simplify notation, we drop superscript $c$ where possible in this subsection and we denote $X _ { \mathcal { E } } ^ { c }$ by $\left\{ x _ { 1 } , \ldots , x _ { k } , x _ { k + 1 } , \ldots , x _ { N } \right\}$ , where $X _ { \mathcal { L } } ^ { c } ~ = ~ \{ \bar { x _ { 1 } } , \ldots , x _ { k } \}$ and $X _ { \mathcal { Z } } ^ { c } = \{ x _ { k + 1 } , \ldots , x _ { N } \}$ . The features of these examples are similarly represented by matrix $V = [ \ b { \mathrm { v } } _ { 1 } , \ b { \mathrm { ~ . ~ . ~ . ~ } } , \ b { \mathrm { v } } _ { k } , \ b { \mathrm { v } } _ { k + 1 } , \ b { \mathrm { ~ . ~ . ~ . ~ } } , \ b { \mathrm { v } } _ { N } ] \in \mathbb { R } ^ { d \times N }$ , where $\mathbf { v } _ { i } = g _ { \theta } ( x _ { i } )$ for $i = 1 , \ldots , N$ .
53
+
54
+ We construct an affinity matrix $A \in \mathbb { R } ^ { N \times N }$ with elements $a _ { i j } = [ \mathbf { v } _ { i } ^ { \top } \mathbf { v } _ { j } ] _ { + }$ if examples $\mathbf { v } _ { i }$ and $\mathbf { v } _ { j }$ are reciprocal nearest neighbors in $X _ { \mathcal { E } } ^ { c }$ and 0 otherwise. Matrix $A$ has zero diagonal, but self-connections are added and then $A$ is normalized as $\tilde { A } = D ^ { - 1 } ( A + I )$ with $D = \mathrm { d i a g } ( ( A + I ) \mathbf { 1 } )$ being the degree matrix of $A + I$ and 1 the all-ones vector.
55
+
56
+ Graph convolutional networks (GCNs) (Kipf & Welling, 2017) are formed by a sequence of layers. Each layer is a function $f _ { \Theta } : \mathbb { R } ^ { \hat { N } \times N } \times \mathbb { R } ^ { l \times \hat { N } } \mathbb { R } ^ { n \times \hat { N } }$ of the form
57
+
58
+ $$
59
+ f _ { \Theta } ( \tilde { A } , Z ) = h ( \Theta ^ { \top } Z \tilde { A } ) ,
60
+ $$
61
+
62
+ where $Z \in \mathbb { R } ^ { l \times N }$ represents the input features, $\boldsymbol { \Theta } \in \mathbb { R } ^ { l \times n }$ holds the parameters of the layer to be learned, and $h$ is a nonlinear activation function. Function $f _ { \Theta }$ maps $l$ -dimensional input features to $n$ -dimensional output features.
63
+
64
+ In this work we consider a two layer GCN with a scalar output per example. This network is a function $F _ { \Theta } : \mathbb { R } ^ { N \times N } \times \mathbb { R } ^ { d \times N } \bar { \mathbb { R } } ^ { N }$ given by
65
+
66
+ $$
67
+ F _ { \Theta } ( \tilde { A } , V ) = \sigma ( \Theta _ { 2 } ^ { \top } [ \Theta _ { 1 } ^ { \top } V \tilde { A } ] _ { + } \tilde { A } ) ,
68
+ $$
69
+
70
+ where $\Theta = \{ \Theta _ { 1 } , \Theta _ { 2 } \}$ , $\Theta _ { 1 } \in \mathbb { R } ^ { d \times m }$ , $\Theta _ { 2 } \in \mathbb { R } ^ { m \times 1 }$ , $[ \cdot ] _ { + }$ is the positive part or ReLU function (Nair & Hinton, 2010) and $\bar { \sigma ( } x ) = ( 1 + e ^ { - x } ) ^ { - 1 }$ for $x \in \mathbb { R }$ is the sigmoid function. Function $F _ { \Theta }$ performs feature propagation through the affinity matrix in an analogy to classical graph-based propagation methods for classification (Zhou et al., 2003a) or search (Zhou et al., 2003b).
71
+
72
+ The output $F _ { \Theta } ( \tilde { A } , V )$ is a vector of length $N$ , with element $F _ { \Theta } ( { \tilde { A } } , V ) _ { i }$ in $[ 0 , 1 ]$ representing a relevance value of example $x _ { i }$ for class $c$ . To learn the parameters $\Theta$ , we treat the GCN as a binary classifier where target output 1 corresponds to clean examples and 0 to noisy. In particular, we minimize the loss function
73
+
74
+ $$
75
+ L _ { \mathcal { G } } ( V , \tilde { A } ; \Theta ) = - \frac { 1 } { k } \sum _ { i = 1 } ^ { k } \log \left( F _ { \Theta } ( \tilde { A } , V ) _ { i } \right) - \frac { \lambda } { N - k } \sum _ { i = k + 1 } ^ { N } \log \left( 1 - F _ { \Theta } ( \tilde { A } , V ) _ { i } \right) .
76
+ $$
77
+
78
+ This is a binary cross-entropy loss function where noisy examples are given an importance weight $\lambda$ . Given the propagation on the nearest neighbor graph, and depending on the relative importance $\lambda$ of the second term, noisy examples that are strongly connected to clean ones are still expected to receive high class relevance, while noisy examples that are not relevant to the current class are expected to get a class relevance near zero.
79
+
80
+ The impact of parameter $\lambda$ is validated in Section 6, where we show that the fewer the available clean images are (smaller $k$ ) the smaller the importance weight should be. As is standard practice for GCNs in classification (Kipf & Welling, 2017), training is performed in batches of size $N$ , that is the entire set of features.
81
+
82
+ Figure 2 shows examples of clean images, corresponding noisy ones and the predicted relevance. Thanks to the visual similarity to the clean image, we can use relevance to resolve cases of polysemy, e.g. black widow (spider) vs. black widow (superhero), or cases like pineapple vs. pineapple juice.
83
+
84
+ Discussion. Loss function (3) is similar to noise-contrastive estimation (NCE) (Gutmann & Hyvärinen, 2010) as used by Wu et al. (2018) for instance-level discrimination, whereas we discriminate clean from noisy examples. The semi-supervised learning setup of GCNs (Kipf & Welling, 2017) uses a loss function that applies only to the labeled examples, and makes discrete predictions on unlabeled examples. In our case, all examples contribute to the loss but with different importance, while we infer real-valued class relevance for the noisy examples, to be used for subsequent learning.
85
+
86
+ Function $F _ { \Theta }$ in (2) reduces to a Multi-Layer Perceptron (MLP) when the affinity matrix $A$ is zero, in which case all examples are disconnected. Using an MLP to perform cleaning would take each example into account independently of the others, while the GCN considers the collection of examples as a whole. MLP training is performed identically to GCN by minimizing (3). We compare the two alternatives in our experiments.
87
+
88
+ ![](images/d562245fb1728f832564e87b5ff05688b13eb6f98c403180ec263fd140ddad27.jpg)
89
+ Figure 2: Examples of clean images (left) for 1-shot classification, cumulative histogram of the predicted relevance for noisy images (middle), and representative noisy images (right), each having its position in the (descending) ranked list according to relevance and relevance value reported below. Test accuracy without and with additional data using class prototypes (6) is shown next to class names.
90
+
91
+ # 5 LEARNING A CLASSIFIER WITH FEW CLEAN AND MANY NOISY EXAMPLES
92
+
93
+ Our cleaning process applies when the clean labeled examples are few, but assumes a feature extractor $g _ { \theta }$ . That is, representation learning, label cleaning and classifier learning are decoupled. We follow few-shot learning in that we learn the representation by supervised classification on a set of base classes, obtaining $g _ { \theta }$ , and then solving new classification tasks on a distinct set of novel classes. In these new tasks, we assume few clean and many noisy labels as specified in Section 3, perform GCN-based cleaning as described in Section 4, and learn a classifier by weighing examples according to class relevance. Representation and classifier learning are described below.
94
+
95
+ # 5.1 COSINE-SIMILARITY BASED CLASSIFIER
96
+
97
+ We use a cosine-similarity based classifier (Gidaris & Komodakis, 2018; Qi et al., 2018), or cosine classifier for short. Given classes $C$ with $| C | = K$ , each class $c \in C$ is represented by a learnable parameter $\mathbf { w } _ { c } \in \mathbb { R } ^ { d }$ . The prediction of example $x \in \mathcal { X }$ is the class $c$ of maximum cosine similarity $\hat { \mathbf { w } } _ { c } ^ { \top } \hat { g } _ { \boldsymbol { \theta } } ( x ) ^ { 1 }$
98
+
99
+ $$
100
+ \pi _ { \boldsymbol { \theta } , W } ( x ) = \arg \operatorname* { m a x } _ { c } \hat { \mathbf { w } } _ { c } ^ { \top } \hat { g } _ { \boldsymbol { \theta } } ( x ) ,
101
+ $$
102
+
103
+ where $W = [ \mathbf { w } _ { 1 } , \ j . . . , \mathbf { w } _ { K } ] \in \mathbb { R } ^ { d \times K }$ .
104
+
105
+ # 5.2 REPRESENTATION LEARNING: BASE CLASSES
106
+
107
+ We are given a set $X _ { B } \subset { \mathcal { X } }$ of examples, each having a clean label in a set of base classes $C _ { B }$ with $| C _ { B } | = K _ { B }$ . These data are used to learn a feature representation, i.e. a feature extractor $g _ { \theta }$ , by learning a $K _ { B }$ -way base-class classifier for unseen data in $\mathcal { X }$ . The parameters $\theta$ of the feature extractor and $W _ { B }$ of the classifier are jointly learned by minimizing the cross entropy loss
108
+
109
+ $$
110
+ { \cal L } _ { \mathcal B } ( C _ { \mathcal B } , X _ { \mathcal B } ; \boldsymbol { \theta } , W _ { \mathcal B } ) = - \sum _ { c \in C _ { \mathcal B } } \frac { 1 } { | X _ { \mathcal B } ^ { c } | } \sum _ { x \in X _ { \mathcal B } ^ { c } } \log ( \sigma ( s \hat { W } _ { \mathcal B } ^ { \top } \hat { g } _ { \boldsymbol \theta } ( x ) ) _ { c } ) ,
111
+ $$
112
+
113
+ where $\sigma : \mathbb { R } ^ { K } \mathbb { R } ^ { K }$ is the softmax function with $\pmb { \sigma } ( \mathbf { a } ) _ { c } = e ^ { a _ { c } } / \sum _ { j \in C } e ^ { a _ { j } }$ for $\mathbf { a } \in \mathbb { R } ^ { K }$ , $s$ is a learnable scale parameter and $\hat { W } _ { \mathcal { B } } = [ \hat { \mathbf { w } } _ { 1 } , \hdots , \hat { \mathbf { w } } _ { K _ { \mathcal { B } } } ] \in \mathbb { R } ^ { d \times K _ { \mathcal { B } } }$ . Learning and inference are
114
+
115
+ performed on base classes by $L _ { B } ( C _ { B } , X _ { B } ; \theta , W _ { B } )$ (5) and $\pi _ { \boldsymbol { \theta } , W _ { B } }$ (4), respectively. As a result, learned feature extractor parameters $\theta$ are used for base or novel classes, while the classifier parameters $W _ { B }$ can be used for base class or all-class classification, as discussed below.
116
+
117
+ # 5.3 NEW CLASSIFICATION TASKS: NOVEL OR ALL CLASSES
118
+
119
+ Each new task is related to a set of novel classes $C _ { \mathcal { L } }$ , disjoint from $C _ { B }$ . The goal is to learn a $K _ { \mathcal { L } }$ -way novel-class classifier or a $K _ { A }$ -way classifier on all classes $C _ { A } = C _ { B } \cup C _ { \mathcal { L } }$ for unseen data in $\mathcal { X }$ , where $K _ { \mathcal { A } } = K _ { B } + K _ { \mathcal { L } }$ . Unlike the typical few-shot learning task, each novel class contains few clean and many noise examples.
120
+
121
+ Prior to learning classifiers for novel classes, training examples $x _ { i } \in X _ { \mathcal { Z } } ^ { c }$ are weighted by their relevance $r ( x _ { i } )$ to class $c$ . For a noisy example $x _ { i } \in X _ { \mathcal { E } } ^ { c }$ , we define $r ( x _ { i } ) = F _ { \Theta } ( \tilde { A } , V ) _ { i }$ where $F _ { \Theta } ( \tilde { A } , V )$ is the output vector of the GCN, while for a clean example $x _ { i } \in X _ { \mathcal { L } } ^ { c }$ we fix $r ( x _ { i } ) = 1$ Note that optimizing (3) does not guarantee $F _ { \Theta } ( \tilde { A } , V ) _ { i } = 1$ for clean examples $x _ { i } \in X _ { \mathcal { L } } ^ { c }$ . We define $\textstyle r ( X ) = \sum _ { x \in X } r ( x )$ for any set $X \subset { \mathcal { X } }$ .
122
+
123
+ We first assume that we no longer have access to examples of base classes in new classification tasks and consider two different classifiers, class prototypes and cosine-similarity based classifier. Then, this assumption is dropped and the classifier and feature representation are learned jointly by fine-tuning the entire network.
124
+
125
+ Class prototypes. For each novel class $c \in C _ { \mathcal { L } }$ , we define prototype ${ \bf w } _ { c }$ by
126
+
127
+ $$
128
+ \mathbf { w } _ { c } = \frac { 1 } { r ( X _ { \mathcal { E } } ^ { c } ) } \sum _ { x \in X _ { \mathcal { E } } ^ { c } } r ( x ) g _ { \theta } ( x ) .
129
+ $$
130
+
131
+ Prototypes are fixed vectors, not learnable parameters. Collecting them into matrix $\begin{array} { r l } { W _ { \mathcal { L } } } & { { } = } \end{array}$ $[ \mathbf { w } _ { 1 } , \dots , \mathbf { w } _ { K _ { \mathcal { L } } } ] \in \mathbb { R } ^ { d \times K _ { \mathcal { L } } }$ , $K _ { \mathcal { L } }$ -way prediction on novel classes is made by classifier $\pi _ { \boldsymbol { \theta } , W _ { \mathcal { L } } }$ (4), while $K _ { A }$ -way prediction on all (base and novel) classes by $\pi _ { \boldsymbol { \theta } , W _ { A } }$ , where $W _ { \mathcal { A } } = [ W _ { B } , W _ { \mathcal { L } } ]$ and $W _ { B }$ is learned according to $L _ { B } ( C _ { B } , X _ { B } ; \theta , W _ { B } )$ (5) and then kept fixed.
132
+
133
+ Cosine classifier learning. Similarly to Section 5.2, given clean and noisy novel-class examples $X _ { \mathcal { E } }$ , we learn a parametric cosine classifier with parameters $W _ { \mathcal { L } } = [ \mathbf { w } _ { 1 } , \dots , \mathbf { w } _ { K _ { \mathcal { L } } } ] \in \mathbb { R } ^ { d \times K _ { \mathcal { L } } }$ by minimizing the weighted cross entropy loss $L _ { \mathcal { L } } ( C _ { \mathcal { L } } , X _ { \mathcal { E } } ; \theta , W _ { \mathcal { L } } )$ over $W _ { \mathcal { L } }$ , where
134
+
135
+ $$
136
+ L _ { \mathcal { L } } ( C _ { \mathcal { L } } , X _ { \mathcal { E } } ; \theta , W _ { \mathcal { L } } ) = - \sum _ { c \in C _ { \mathcal { L } } } \frac { 1 } { r ( X _ { \mathcal { E } } ^ { c } ) } \sum _ { x \in X _ { \mathcal { E } } ^ { c } } r ( x ) \log ( \sigma ( s \hat { W } _ { \mathcal { L } } ^ { \top } \hat { g } _ { \theta } ( x ) ) _ { c } ) ,
137
+ $$
138
+
139
+ while the parameters $\theta$ of the feature extractor are fixed. The scale parameter $s$ is also fixed to the value obtained during base class learning. Prediction on novel only or all classes is then made as in the previous case.
140
+
141
+ Deep network fine-tuning. We now drop the assumption that base class examples are not accessible and, given all examples $X _ { \mathcal { A } } = X _ { \mathcal { B } } \cup X _ { \mathcal { E } }$ , we jointly learn the parameters $\theta$ of the feature extractor and $W _ { \mathcal { A } } = ( W _ { B } , W _ { \mathcal { L } } )$ of the $K _ { A }$ -way cosine classifier for all classes by minimizing loss function
142
+
143
+ $$
144
+ L _ { A } ( C _ { A } , X _ { A } ; \theta , W _ { A } ) = L _ { B } ( C _ { B } , X _ { B } ; \theta , W _ { B } ) + L _ { \mathcal { L } } ( C _ { \mathcal { L } } , X _ { \mathcal { E } } ; \theta , W _ { \mathcal { L } } ) .
145
+ $$
146
+
147
+ Note that, due to overfitting on the few available examples, such learning is avoided in a few-shot learning setup. In a few cases, it takes the form of fine-tuning including all base class data (Qi et al., 2018), or only lasts for a few iterations when the base class data is not accessible (Finn et al., 2017).
148
+
149
+ # 6 EXPERIMENTS
150
+
151
+ # 6.1 EXPERIMENTAL SETUP
152
+
153
+ Datasets and task setup. We extend the Low-Shot ImageNet benchmark introduced by Hariharan & Girshick (2017) by assuming many noisy examples for novel classes, in addition to the few clean ones. In this benchmark, the 1000 ImageNet classes (Russakovsky et al., 2015) are split into 389 base classes and 611 novel classes. The validation set contains 193 base and 300 novel classes, and the test set the remaining 196 base and 311 novel classes. The standard benchmark includes $k$ -shot classification, i.e. classification on $k$ clean examples per class, which we extend to $k$ clean and many noisy examples per class, with $k \in \{ 1 , 2 , 5 , 1 0 , 2 0 \}$ . Similar to Hariharan & Girshick (2017) we perform 5 tasks, each drawing a subset of $k$ clean examples per class. We report the average top-5 accuracy over the 5 tasks on novel or all classes of the test set.
154
+
155
+ We use the YFCC100M dataset (Thomee et al., 2016) as a source for additional data with noisy labels. It contains approximatively 100M images collected from Flickr. Each image comes with a text description obtained from the user title and caption. We use the text description to obtain images with noisy labels. as discussed in Section 3. This process results in very different numbers of additional examples per class, with a minimum of zero for classes maillot and missile, and a maximum of 620,142 for class church/church building.
156
+
157
+ Representation and classifier learning. In most experiments, we use ResNet-10 (He et al., 2016) as feature extractor as in Gidaris & Komodakis (2018). Classification for novel classes is performed with class prototypes (6), cosine classifier learning (7) or deep network fine-tuning (8). Hyper-parameters such as batch size and number of epochs, are tuned on the validation set. Possible values are 2048, 4096, and 8192 for batchsize and 10, 30 and 50 for number of epochs. The learning rate starts from 0.1 and is reduced to 0.001 at the end of training with cosine annealing (Loshchilov & Hutter, 2017).
158
+
159
+ We handle the imbalance of the noisy set by normalizing by $r ( X _ { c } )$ in (7). Prototypes (6) are used to initialize $W _ { \mathcal { L } }$ of cosine classifier in (7), and the learned $W _ { \mathcal { L } }$ is used to initialize the corresponding part of $W _ { A }$ when fine-tuning the network by (8). In the latter case, we train all layers for 10 epochs with learning rate 0.01. We ignore examples $x _ { i }$ with relevance $r ( x _ { i } ) < 0 . 1$ to reduce the complexity when fine-tuning the network.
160
+
161
+ We also report results with ResNet-50 as feature extractor, using the model trained on base classes by Hariharan & Girshick (2017). Following Douze et al. (2018), we apply PCA to the features to reduce their dimensionality to 256. Base classes are represented by class prototypes (6) in this case.
162
+
163
+ GCN training is performed with Adam optimizer and a learning rate of 0.1 for 100 iterations. We use dropout with probability 0.5. The dimensionality of the input descriptors is $d = 5 1 2$ for ResNet-10 and $d = 2 5 6$ for ResNet-50 (after PCA). Dimensionality of the internal representation in (1) is $m = 1 6$ . The affinity matrix is constructed with reciprocal top-50 nearest neighbors.
164
+
165
+ Baselines. We implement and evaluate several baseline methods. $\beta$ -cleaning assigns $r ( x _ { i } ) = \beta$ to all additional examples. We report results for $\beta = 1 . 0$ (unit relevance score) and $\beta ^ { * }$ , the optimal $\beta$ for all $k$ obtained on the validation set. $M L P$ , discussed in Section 4, learns a nonlinear mapping to assign relevance, but does not propagate over the graph. Label Propagation (LP) (Zhou et al., 2003a) propagates information by a linear operation. It solves the linear system $( I - \alpha D ^ { - 1 / 2 } A D ^ { - 1 / 2 } ) \mathbf { r } _ { c } =$ $\mathbf { y } _ { c }$ (Iscen et al., 2017) for each class $c$ , where $D$ is the degree matrix of $A$ , $\alpha = 0 . 9$ and $\mathbf { y } _ { c } \in \mathbb { R } ^ { N }$ is a $k$ -hot binary vector indicating the labeled examples of class $c$ . Relevance $r ( x _ { i } )$ is then the $i$ -th element $( \mathbf { r } _ { c } ) _ { i }$ of the solution.
166
+
167
+ # 6.2 EXPERIMENTAL RESULTS
168
+
169
+ The impact of importance weight $\lambda$ is measured on the validation set and the best performing value is used on the test set for each value of $k$ . Results are shown in Appendix A. The larger the value of $\lambda$ , the more the loss encourages noisy examples to be classified as negatives. As a consequence, large (small) $\lambda$ results in smaller (larger) relevance, on average, for noisy examples. The optimal $\lambda$ per value of $k$ suggests that the fewer the clean examples the larger the need for additional ones.
170
+
171
+ Comparison with baselines using additional data is presented in Table 1. The use of additional data is mostly harmful for $\beta$ -weighting except for 1 and 2-shot. MLP offers improvements in most cases, implying that it manages to appropriately downweigh irrelevant examples. The consistent improvement of our method compared to MLP, especially large for small $k$ , suggests that it is beneficial to incorporate relations, with the affinity matrix $A$ modeling the structure of the feature space. LP is a classic approach that also uses $A$ but is a linear operation with no parameters, and is inferior to our method. The gain of cleaning ( $\beta = 1$ vs. ours) ranges from $11 \%$ to $20 \%$ .
172
+
173
+ Table 1: Comparison with baselines using noisy examples. We report top-5 accuracy on novel classes with classification by class prototypes (6).
174
+
175
+ <table><tr><td>Method</td><td>k=1</td><td>2</td><td>5</td><td>10</td><td>20</td></tr><tr><td colspan="6">FEW CLEAN EXAMPLES</td></tr><tr><td>Class proto.Gidaris &amp; Komodakis (2018)</td><td>45.3±0.65</td><td>57.1±0.37</td><td>69.3±0.32</td><td>74.8±0.20</td><td>77.8±0.24</td></tr><tr><td colspan="6">FEW CLEAN &amp; MANY NOISY EXAMPLES</td></tr><tr><td>β-weighting,β=1</td><td>56.1±0.06</td><td>56.4±0.08</td><td>57.1±0.05</td><td>57.7±0.08</td><td>58.7±0.06</td></tr><tr><td>β-weighting,β*</td><td>55.6±0.24</td><td>58.3±0.14</td><td>63.4±0.25</td><td>67.5±0.34</td><td>71.0±0.22</td></tr><tr><td>Label Propagation Zhou et al. (2003a)</td><td>62.6±0.35</td><td>67.0±0.41</td><td>74.6±0.30</td><td>76.3±0.23</td><td>77.7±0.18</td></tr><tr><td>MLP</td><td>63.6±0.41</td><td>68.8±0.42</td><td>73.9±0.25</td><td>75.6±0.21</td><td>77.6±0.21</td></tr><tr><td>Ours</td><td>67.8±0.10</td><td>70.9±0.30</td><td>73.7±0.17</td><td>76.1±0.12</td><td>78.2±0.14</td></tr></table>
176
+
177
+ <table><tr><td>METHOD</td><td colspan="4">NoVEL CLASSES</td><td colspan="5">ALL CLASSES</td></tr><tr><td>k=1</td><td>2</td><td>5</td><td>10</td><td>20</td><td>k=1</td><td>2</td><td>5</td><td>10</td><td>20</td></tr><tr><td colspan="10">RESNET-10 -FEW CLEAN EXAMPLES</td></tr><tr><td>Proto.-Nets (Snell et al., 2017)</td><td>39.3</td><td>54.4 66.3</td><td>71.2</td><td>73.9</td><td>49.5</td><td>61.0</td><td>69.7</td><td>72.9</td><td>74.6</td></tr><tr><td>Logistic reg.w/H(Wang et al.,2018b)</td><td>40.7</td><td>50.8 62.0</td><td>69.3</td><td>76.5</td><td>52.2</td><td>59.4</td><td>67.6</td><td>72.8</td><td>76.9</td></tr><tr><td>PMN w/H(Wang et al., 2018b)</td><td>45.8</td><td>57.8 69.0</td><td>74.3</td><td>77.4</td><td>57.6</td><td>64.7</td><td>71.9</td><td>75.2</td><td>77.5</td></tr><tr><td>Class proto.(Gidaris &amp; Komodakis,2018)</td><td></td><td></td><td>45.3±0.6557.1±0.37 69.3±0.32 74.8±0.20 77.8±0.24</td><td></td><td></td><td></td><td></td><td></td><td>57.0±0.3664.7±0.1672.5±0.1875.8±0.1677.4±0.19 58.1±0.4865.2±0.15 72.9±0.25 76.6±0.18 78.8±0.16</td></tr><tr><td colspan="10">Class proto.w/At.(Gidaris&amp; Komodakis,2018) 45.8±0.74 57.4±0.38 69.6±0.27 75.0±0.29 78.2±0.23</td></tr><tr><td></td><td></td><td></td><td>RESNET-1O -FEW CLEAN&amp; MANY NOISY EXAMPLES</td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Ours -class proto.(6) Ours-cosine (7)</td><td></td><td></td><td>67.8±0.10 70.9±0.30 73.7±0.20 76.1±0.16 78.2±0.14</td><td></td><td></td><td></td><td></td><td></td><td>70.3±0.05 72.1±0.18 74.1±0.12 75.6±0.13 76.9±0.09</td></tr><tr><td>Ours - fine-tune (8)</td><td></td><td>73.2±0.14 75.3±0.25 75.6±0.24 78.5±0.32 80.7±0.26 74.6±0.13 76.6±0.26 78.2±0.23 80.9±0.34 82.9±0.20</td><td></td><td></td><td></td><td></td><td></td><td></td><td>71.9±0.0774.0±0.2376.5±0.1678.3±0.2380.2±0.18 76.0±0.1077.3±0.1378.7±0.1980.7±0.2582.2±0.14</td></tr><tr><td colspan="10">RESNET-50 - FEW CLEAN EXAMPLES</td></tr><tr><td>Proto.-Nets (Snell et al., 2017)</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>PMN w/H(Wang et al.,2018b)</td><td>49.6 64.0 54.7 66.8</td><td>74.4 77.4</td><td>78.1 81.4</td><td>80.0 83.8</td><td>61.4 65.7</td><td>71.4 73.5</td><td>78.0 80.2</td><td>80.0 82.8</td><td>81.1 84.5</td></tr><tr><td colspan="10">RESNET-5O-FEW CLEAN&amp;MANYUNLABELED EXAMPLES</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Diffusion (Douze et al., 2018) Diffusion -logistic (Douze et al.,2018)</td><td></td><td></td><td>63.6±0.61 69.5±0.60 75.2±0.40 78.5±0.34 80.8±0.18</td><td></td><td></td><td>=</td><td>-</td><td></td><td></td></tr><tr><td colspan="10">64.0±0.7071.1±0.82 79.7±0.3883.9±0.10 86.3±0.17 RESNET-5O-FEWCLEAN&amp;MANY NOISY EXAMPLES</td></tr><tr><td>Ours - class proto.(6)</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Ours - cosine (7)</td><td></td><td>78.0±0.38 80.2±0.3380.9±0.17 83.7±0.1985.7±0.11</td><td>69.7±0.44 73.7±0.56 77.0±0.20 79.9±0.30 81.9±0.29</td><td></td><td></td><td>77.6±0.26 79.1±0.20 79.9±0.09 82.1±0.22 83.8±0.11</td><td></td><td></td><td>73.8±0.33 76.6±0.36 78.9±0.19 80.8±0.21 82.2±0.14</td></tr><tr><td>Ours - fine-tune (8)</td><td>80.8±0.25 83.0±0.23 83.8±0.39 86.4±0.23 88.5±0.20</td><td></td><td></td><td></td><td></td><td>81.6±0.20 83.2±0.16 84.3±0.23 86.2±0.17 87.8±0.03</td><td></td><td></td><td></td></tr></table>
178
+
179
+ Table 2: Comparison to the state of the art on the Low-shot ImageNet benchmark. We report top-5 accuracy on novel and all classes. We use class prototypes (6), cosine classifier learning (7) and deep network fine-tuning (8) for classification with our GCN-based data addition method.
180
+
181
+ Comparison with the state of the art is presented in Table 2. We significantly improve the performance by using additional data and cleaning compared to a number of different approaches, including the work by Gidaris & Komodakis (2018), which is our starting point. As expected, the gain is more pronounced for small $k$ , reaching more than $20 \%$ improvement for 1-shot novel accuracy.
182
+
183
+ Closest to ours is the work of Douze et al. (2018), who use the same experimental setup and the same additional data, but without filtering by text and using noisy labels. We outperform their approach in all cases, while requiring much less computation: offline, we construct a separate small graph per class rather than a single graph over the entire 100M collection; online, we perform inference by cosine similarity to one prototype per class or a learned classifier rather than iterative diffusion on the entire collection. Note that by ignoring examples that are not given any noisy label, we are only using a tiny fraction of the 100M collection: in particular, only 3,744,994 images for the 311-class test split of the Low-shot ImageNet benchmark. In contrast to Douze et al. (2018), additional data brings improvement even at 20-shot with classifier learning or network fine-tuning. Most importantly, our approach does not require the entire 100M collection at inference.
184
+
185
+ # 7 CONCLUSIONS
186
+
187
+ In this paper we have introduced a new method for assigning class relevance to noisy images obtained by textual queries with class names. Our approach leverages one or a few labeled images per class and relies on a graph convolutional network (GCN) to propagate visual information from the labeled images to the noisy ones. The GCN is a binary classifier discriminating clean from noisy examples using a weighted binary cross-entropy loss function and inferring “clean” probability as a relevance measure for that class. Experimental results show that using noisy images weighted by this relevance measure significantly improves the classification accuracy.
188
+
189
+ # REFERENCES
190
+
191
+ Michael M Bronstein, Joan Bruna, Yann LeCun, Arthur Szlam, and Pierre Vandergheynst. Geometric deep learning: going beyond euclidean data. IEEE Signal Processing Magazine, 34(4):18–42, 2017.
192
+
193
+ Joan Bruna, Wojciech Zaremba, Arthur Szlam, and Yann Lecun. Spectral networks and locally connected networks on graphs. In ICLR, 2014.
194
+
195
+ Wei-Yu Chen, Yen-Cheng Liu, Zsolt Kira, Yu-Chiang Frank Wang, and Jia-Bin Huang. A closer look at few-shot classification. ICLR, 2019.
196
+
197
+ Michaël Defferrard, Xavier Bresson, and Pierre Vandergheynst. Convolutional neural networks on graphs with fast localized spectral filtering. In NeurIPS, 2016.
198
+
199
+ Matthijs Douze, Arthur Szlam, Bharath Hariharan, and Hervé Jégou. Low-shot learning with large-scale diffusion. In CVPR, 2018.
200
+
201
+ Chelsea Finn, Pieter Abbeel, and Sergey Levine. Model-agnostic meta-learning for fast adaptation of deep networks. In ICML, 2017.
202
+
203
+ Chelsea Finn, Kelvin Xu, and Sergey Levine. Probabilistic model-agnostic meta-learning. In NeurIPS, 2018.
204
+
205
+ Victor Garcia and Joan Bruna. Few-shot learning with graph neural networks. In ICLR, 2018.
206
+
207
+ Spyros Gidaris and Nikos Komodakis. Dynamic few-shot visual learning without forgetting. In CVPR, 2018.
208
+
209
+ Spyros Gidaris and Nikos Komodakis. Generating classification weights with gnn denoising autoencoders for few-shot learning. In CVPR, 2019.
210
+
211
+ Michael Gutmann and Aapo Hyvärinen. Noise-contrastive estimation: A new estimation principle for unnormalized statistical models. In International Conference on Artificial Intelligence and Statistics, 2010.
212
+
213
+ Bharath Hariharan and Ross Girshick. Low-shot visual recognition by shrinking and hallucinating features. In CVPR, 2017.
214
+
215
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In CVPR, 2016.
216
+
217
+ Mikael Henaff, Joan Bruna, and Yann LeCun. Deep convolutional networks on graph-structured data. arXiv preprint arXiv:1506.05163, 2015.
218
+
219
+ Ahmet Iscen, Giorgos Tolias, Yannis Avrithis, Teddy Furon, and Ondrej Chum. Efficient diffusion on region manifolds: Recovering small objects with compact cnn representations. In CVPR, 2017.
220
+
221
+ Armand Joulin, Laurens van der Maaten, Allan Jabri, and Nicolas Vasilache. Learning visual features from large weakly supervised data. In ECCV, 2016.
222
+
223
+ Thomas N Kipf and Max Welling. Semi-supervised classification with graph convolutional networks. In ICLR, 2017.
224
+
225
+ Kuang-Huei Lee, Xiaodong He, Lei Zhang, and Linjun Yang. CleanNet: Transfer learning for scalable image classifier training with label noise. In CVPR, 2018.
226
+
227
+ Yuncheng Li, Jianchao Yang, Yale Song, Liangliang Cao, Jiebo Luo, and Li-Jia Li. Learning from noisy labels with distillation. In ICCV, 2017.
228
+
229
+ Tongliang Liu and Dacheng Tao. Classification with noisy labels by importance reweighting. IEEE Trans. PAMI, 38(3), 2015.
230
+
231
+ Yanbin Liu, Juho Lee, Minseop Park, Saehoon Kim, Eunho Yang, Sung Ju Hwang, and Yi Yang. Learning to propagate labels: Transductive propagation network for few-shot learning. In ICLR, 2019.
232
+
233
+ Ilya Loshchilov and Frank Hutter. Sgdr: Stochastic gradient descent with warm restarts. ICLR, 2017.
234
+
235
+ Vinod Nair and Geoffrey E Hinton. Rectified linear units improve restricted boltzmann machines. In ICML, 2010.
236
+
237
+ Nagarajan Natarajan, Inderjit S Dhillon, Pradeep K Ravikumar, and Ambuj Tewari. Learning with noisy labels. In NeurIPS, 2013.
238
+
239
+ Giorgio Patrini, Alessandro Rozza, Aditya Krishna Menon, Richard Nock, and Lizhen Qu. Making deep neural networks robust to label noise: A loss correction approach. In CVPR, 2017.
240
+
241
+ Hang Qi, Matthew Brown, and David G. Lowe. Low-shot learning with imprinted weights. In CVPR, June 2018.
242
+
243
+ Sachin Ravi and Hugo Larochelle. Optimization as a model for few-shot learning. In ICLR, 2017.
244
+
245
+ Scott Reed, Honglak Lee, Dragomir Anguelov, Christian Szegedy, Dumitru Erhan, and Andrew Rabinovich. Training deep neural networks on noisy labels with bootstrapping. ICLR, 2015.
246
+
247
+ Mengye Ren, Sachin Ravi, Eleni Triantafillou, Jake Snell, Kevin Swersky, Josh B. Tenenbaum, Hugo Larochelle, and Richard S. Zemel. Meta-learning for semi-supervised few-shot classification. In ICLR, 2018a.
248
+
249
+ Mengye Ren, Wenyuan Zeng, Bin Yang, and Raquel Urtasun. Learning to reweight examples for robust deep learning. In ICML, 2018b.
250
+
251
+ Marcus Rohrbach, Sandra Ebert, and Bernt Schiele. Transfer learning in a transductive setting. In NeurIPS, 2013.
252
+
253
+ Olga Russakovsky, Jia Deng, Hao Su, Jonathan Krause, Sanjeev Satheesh, Sean Ma, Zhiheng Huang, Andrej Karpathy, Aditya Khosla, Michael Bernstein, et al. Imagenet large scale visual recognition challenge. IJCV, 115(3), 2015.
254
+
255
+ Jake Snell, Kevin Swersky, and Richard Zemel. Prototypical networks for few-shot learning. In NeurIPS, 2017.
256
+
257
+ Sainbayar Sukhbaatar, Joan Bruna, Manohar Paluri, Lubomir Bourdev, and Rob Fergus. Training convolutional networks with noisy labels. arXiv preprint arXiv:1406.2080, 2014.
258
+
259
+ Bart Thomee, David A. Shamma, Gerald Friedland, Benjamin Elizalde, Karl Ni, Douglas Poland, Damian Borth, and Li-Jia Li. Yfcc $1 0 0 \mathrm { m }$ : The new data in multimedia research. Commun. ACM, 59(2), 2016.
260
+
261
+ Andreas Veit, Neil Alldrin, Gal Chechik, Ivan Krasin, Abhinav Gupta, and Serge Belongie. Learning from noisy large-scale datasets with minimal supervision. In CVPR, July 2017.
262
+
263
+ Ricardo Vilalta and Youssef Drissi. A perspective view and survey of meta-learning. Artificial intelligence review, 18(2):77–95, 2002.
264
+
265
+ Oriol Vinyals, Charles Blundell, Tim Lillicrap, Daan Wierstra, et al. Matching networks for one shot learning. In NeurIPS, 2016.
266
+
267
+ Xiaolong Wang and Abhinav Gupta. Unsupervised learning of visual representations using videos. In CVPR, 2015.
268
+
269
+ Yisen Wang, Weiyang Liu, Xingjun Ma, James Bailey, Hongyuan Zha, Le Song, and Shu-Tao Xia. Iterative learning with open-set noisy labels. In CVPR, 2018a.
270
+
271
+ Yu-Xiong Wang, Ross Girshick, Martial Hebert, and Bharath Hariharan. Low-shot learning from imaginary data. In CVPR, 2018b.
272
+
273
+ Jason Weston, Frédéric Ratle, and Ronan Collobert. Deep learning via semi-supervised embedding. In ICML, 2008.
274
+
275
+ Zhirong Wu, Yuanjun Xiong, Stella Yu, and Dahua Lin. Unsupervised feature learning via non-parametric instance-level discrimination. CVPR, 2018.
276
+
277
+ Dengyong Zhou, Olivier Bousquet, Thomas Navin Lal, Jason Weston, and Bernhard Schölkopf. Learning with local and global consistency. In NeurIPS, 2003a.
278
+
279
+ Dengyong Zhou, Jason Weston, Arthur Gretton, Olivier Bousquet, and Bernhard Schölkopf. Ranking on data manifolds. In NeurIPS, 2003b.
280
+
281
+ ![](images/d75584f0f38734e1f60b1588c31cd97d99ef2d5781c2f1c3f7deaf0d2182f12d.jpg)
282
+ Figure 3: (a) Number of additional images per class $c$ sampled from YFCC-100M for all novel classes of Low-Shot ImageNet. (b) Number of classes per group, when $| X _ { \mathcal { Z } } ^ { c } |$ is sampled logarithmically into groups. (c) Accuracy improvement $\Delta$ Acc (difference of accuracy between our method with noisy examples and the baseline without noisy examples) for prototype classifier, for same groups as in (b).
283
+
284
+ # A APPENDIX
285
+
286
+ Noisy data statistics. We present statistics about the noisy examples of novel classes and the improvements of our method per class. Figure 3 (a) shows that the noisy examples for novel classes are long tailed (in log scale). There is a significant number of classes where we end up with less than 1000 extra examples, but we improve nevertheless; see Figure 3 (c). A small exception is 4 very rare classes out of 311, with around 3 additional images per class (leftmost bin in Figure 3 (b) and (c)). Note that in real world applications, one could use more resources like web queries for additional data.
287
+
288
+ Impact of importance weight $\lambda ,$ . We present the impact of $\lambda$ (3) for different values of $k$ in the validation set of the extended Low-shot ImageNet benchmark in Figure 4.
289
+
290
+ ![](images/75723f011baed9f80d3665089fcfcb5e9cf2105defc23b6659f2c9df36dc3084.jpg)
291
+ Figure 4: Impact of $\lambda$ on the validation set of the extended Low-shot ImageNet benchmark with YFCC-100M for noisy examples using class prototypes (6).
md/train/Bke96sC5tm/Bke96sC5tm.md ADDED
@@ -0,0 +1,300 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SOLAR: DEEP STRUCTURED REPRESENTATIONS FOR MODEL-BASED REINFORCEMENT LEARNING
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Model-based reinforcement learning (RL) methods can be broadly categorized as global model methods, which depend on learning models that provide sensible predictions in a wide range of states, or local model methods, which iteratively refit simple models that are used for policy improvement. While predicting future states that will result from the current actions is difficult, local model methods only attempt to understand system dynamics in the neighborhood of the current policy, making it possible to produce local improvements without ever learning to predict accurately far into the future. The main idea in this paper is that we can learn representations that make it easy to retrospectively infer simple dynamics given the data from the current policy, thus enabling local models to be used for policy learning in complex systems. We evaluate our approach against other model-based and model-free RL methods on a suite of robotics tasks, including a manipulation task on a real Sawyer robotic arm directly from camera images.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Model-based reinforcement learning (RL) methods use learned models in a variety of ways, such as planning (Levine & Abbeel, 2014; Deisenroth et al., 2014) and generating synthetic experience (Sutton, 1990). We can categorize model-based algorithms as either global model methods, where models are used for planning and trained to give accurate predictions for a wide range of states, or local model methods, where simple models provide gradient directions that are used for policy improvement. On simple, low-dimensional tasks, model-based approaches have demonstrated remarkable data efficiency, learning policies for systems like cart-pole swing-up with under 30 seconds of experience (Deisenroth et al., 2014; Moldovan et al., 2015). However, for more complex systems, one of the main difficulties in applying model-based methods is model bias: local models will often underfit complex systems, but may still be preferred over global models which tend to overfit in the low-data regime and may be difficult to incorporate into control methods (Deisenroth et al., 2014).
12
+
13
+ Most global model methods use the model to make forward predictions and then backpropagate through those predictions. However, this places a heavy burden on the dynamics model, and forward prediction often suffers from significant drift over longer trajectories. In contrast, local models are typically only used to provide gradient directions for local policy improvement (Levine & Abbeel, 2014), and thus a common choice for local model methods is to use linear models, which can themselves be interpreted as gradients. As illustrated in Figure 1, in our work, we present a method that automatically encourages learning representations where linear models better fit the data. From this, we devise an efficient local model method based on the linear-quadratic regulator (LQR) (Camacho & Bordons, 1997; Todorov & Li, 2005; Levine & Abbeel, 2014) that utilizes linear models for gradient directions for policy improvement. Our motivation is similar to that of Watter et al. (2015); Finn et al. (2016); however, as discussed in section 5, our representation learning method specifically allows us to construct a local model method that performs inference in the latent space in order to improve the policy, rather than focusing on forward prediction and planning.
14
+
15
+ Our main contribution is a representation learning and model-based RL procedure, which we term stochastic optimal control with latent representations (SOLAR), which jointly optimizes a latent representation and model such that inference produces local linear models that provide good gradient directions for policy improvement. We demonstrate empirically in section 6 that SOLAR is able to learn policies directly from raw, high-dimensional observations in several robotic environments including a simulated nonholonomic car, a simulated two degree-of-freedom (DoF) arm, and a real 7-DoF Sawyer arm, all of which are learned directly from image pixels. We compare to existing state-of-the-art RL methods and show that SOLAR, while significantly more data efficient than model-free methods, exhibits superior performance compared to other model-based methods.
16
+
17
+ ![](images/26292365d207757a499029b76f3ed212d27801b63f66de57c24c92b2c62f867d.jpg)
18
+ Figure 1: (a) A pictoral depiction of a trajectory for a one-dimensional system. (b) Global models may be used for prediction or planning forward through time, as depicted in red, but this can suffer from trajectory drift for complex systems. (c) Local linear models are fit to trajectories and do not suffer from drift, but may fit the system poorly for complicated interactions such as contacts, as illustrated by the poor model fit circled in gray. (d) Our method finds an embedding of observed trajectories into a latent space where local linear models produce a better fit.
19
+
20
+ # 2 PRELIMINARIES
21
+
22
+ We first formalize our problem setting as a Markov decision process (MDP) $M = ( S , { \mathcal { A } } , p , C , \rho , T )$ , where the state space $s$ , action space $\mathcal { A }$ , and horizon $T$ are known, but the dynamics function $p ( \mathbf { s } _ { t + 1 } | \mathbf { s } _ { t } , \mathbf { a } _ { t } )$ , cost function ${ \cal C } ( \mathbf { s } _ { t } , \mathbf { a } _ { t } )$ , and initial state distribution $\rho ( \mathbf { s } _ { 0 } )$ are unknown. The goal of reinforcement learning is to optimize a policy $\pi ( \mathbf { a } _ { t } | \mathbf { s } _ { t } )$ to minimize the expected sum of costs $\begin{array} { r } { \eta [ \pi ] = \mathbb { E } _ { \pi , p , \rho } \left[ \sum _ { t = 0 } ^ { T } C ( \mathbf { s } _ { t } , \mathbf { a } _ { t } ) \right] } \end{array}$ under the distribution induced by the initial state distribution, dynamics function, and policy. Model-based methods decompose this problem into policy and model optimization subproblems, and we discuss each subproblem as it relates to our approach.
23
+
24
+ # 2.1 MODEL-BASED POLICY SEARCH
25
+
26
+ Policy search methods directly optimize parameterized policies with respect to $\eta ( \theta ) \triangleq \eta [ \pi _ { \theta } ]$ where the parameters $\theta$ may be, for example, weights in a neural network or matrices for a linear policy. Model-based policy search methods typically build models $\left( { \hat { \rho } } , { \hat { p } } , { \hat { C } } \right)$ of the unknown quantities and compute the gradient of $\begin{array} { r } { \hat { \eta } ( \theta ) \triangleq \mathbb { E } _ { \pi _ { \theta } , \hat { p } , \hat { \rho } } \left[ \sum _ { t = 0 } ^ { T } \hat { C } ( \mathbf { s } _ { t } , \mathbf { a } _ { t } ) \right] } \end{array}$ with this model. One particularly tractable model is the linear-quadratic system (LQS), which models the initial state distribution as Gaussian, the dynamics as time-varying linear-Gaussian (TVLG), and the cost as quadratic, i.e.,
27
+
28
+ $$
29
+ \hat { p } ( { \mathbf s } _ { t + 1 } | { \mathbf s } _ { t } , { \mathbf a } _ { t } ) = \mathcal { N } \left( { \mathbf s } _ { t + 1 } \left| \begin{array} { l } { { \mathbf F } _ { t } \left[ \mathbf { s } _ { t } \right] , \Sigma _ { t } \right) , \quad \hat { C } ( { \mathbf s } _ { t } , { \mathbf a } _ { t } ) = \frac { 1 } { 2 } \left[ \mathbf { \bar { a } } _ { t } \right] ^ { \top } { \mathbf C } \left[ \mathbf { \bar { a } } _ { t } \right] + { \mathbf c } ^ { \top } \left[ \mathbf { \bar { a } } _ { t } \right] . } \end{array} \right.
30
+ $$
31
+
32
+ Any deterministic policy operating in an environment with smooth dynamics can be locally modeled with a time-varying LQS (Boyd & Vandenberghe, 2004), while low-entropy stochastic policies are modeled approximately. This makes the time-varying LQS a reasonable local model for many dynamical systems. Furthermore, the optimal policy at any time step given the model is a linear function of the state and the optimal maximum-entropy policy is linear-Gaussian (Tassa et al., 2012; Levine & Koltun, 2013). As shown in Jacobson & Mayne (1970); Todorov & Li (2005), these optimal policies can be computed in closed form using dynamic programming by computing the first and second derivatives of the Q (cost-to-go) and value functions:
33
+
34
+ $$
35
+ \begin{array} { r l r } & { Q _ { \tilde { { \mathbf { s } } } , t } = { \mathbf { c } } _ { \tilde { { \mathbf { s } } } , t } + { \mathbf { F } } _ { \tilde { { \mathbf { s } } } , t } ^ { \top } V _ { { \mathbf { s } } , t + 1 } , } & { Q _ { \tilde { { \mathbf { s } } } { \mathbf { s } } , t } = { \mathbf { C } } _ { \tilde { { \mathbf { s } } } { \mathbf { s } } , t } + { \mathbf { F } } _ { \tilde { { \mathbf { s } } } { \mathbf { s } } , t } ^ { \top } V _ { { \mathbf { s } } { \mathbf { s } } , t + 1 } { \mathbf { F } } _ { \tilde { { \mathbf { s } } } { \mathbf { s } } , t } , } \\ & { V _ { { \mathbf { s } } , t } = Q _ { { \mathbf { s } } , t } - Q _ { { \mathbf { s } } { \mathbf { a } } , t } Q _ { { \mathbf { a } } { \mathbf { a } } , t } ^ { - 1 } Q _ { { \mathbf { a } } , t } , } & { V _ { { \mathbf { s } } { \mathbf { s } } , t } = Q _ { { \mathbf { s } } { \mathbf { s } } , t } - Q _ { { \mathbf { s } } { \mathbf { a } } , t } Q _ { { \mathbf { a } } { \mathbf { a } } , t } ^ { - 1 } Q _ { { \mathbf { a } } { \mathbf { s } } , t } . } \end{array}
36
+ $$
37
+
38
+ Here, similar to Tassa et al. (2012), we use subscripts to denote derivatives, and we use $\tilde { \mathbf { s } }$ to abbreviate h s a i . Once these values are computed, the optimal maximum-entropy policy is TVLG, i.e.,
39
+
40
+ $$
41
+ \begin{array} { r } { \pi _ { \theta } ( \mathbf { a } _ { t } | \mathbf { s } _ { t } ) = \mathcal { N } \left( \mathbf { K } _ { t } \mathbf { s } _ { t } + \mathbf { k } _ { t } , \mathbf { S } _ { t } \right) \mathrm { , ~ w h e r e } \mathbf { K } _ { t } = - Q _ { \mathbf { a a } , t } ^ { - 1 } Q _ { \mathbf { a s } , t } \mathrm { , ~ } \mathbf { k } _ { t } = - Q _ { \mathbf { a a } , t } ^ { - 1 } Q _ { \mathbf { a } , t } \mathrm { , ~ } \mathbf { S } _ { t } = - Q _ { \mathbf { a a } , t } ^ { - 1 } \mathrm { . } } \end{array}
42
+ $$
43
+
44
+ We refer the reader to Appendix A and Levine & Abbeel (2014) for further details. Prior work assumes access to a compact, low-dimensional state representation (Deisenroth et al., 2014; Levine & Abbeel, 2014; Nagabandi et al., 2018), and as we show in section 6, this precludes these local model methods from operating on complex observations such as images. In subsection 2.2 and section 3, we describe a probabilistic latent variable model and variational inference procedure that, conditioned on a full trajectory of observations, produces local models that can be used for policy improvement, enabling us to utilize this local model method in image-based domains.
45
+
46
+ # 2.2 LEARNING LATENT DYNAMICS MODELS
47
+
48
+ The local model-based method described above requires us to learn both a quadratic cost function as well as a linear dynamical system (LDS). We utilize the Bayesian LDS model, which is given by
49
+
50
+ $$
51
+ \begin{array} { r l } & { \mu _ { \hat { \rho } } , \Sigma _ { \hat { \rho } } \sim \mathcal { N } T \mathcal { W } ( \Psi , \nu , \mu _ { 0 } , \kappa ) , \quad \mathbf { F } _ { t } , \Sigma _ { t } \sim \mathcal { M N T W } ( \Psi , \nu , M _ { 0 } , V ) \mathrm { ~ f o r ~ } t \in [ 0 , \dots , T - 1 ] , } \\ & { \mathbf { s } _ { 0 } \mid \mu _ { \hat { \rho } } , \Sigma _ { \hat { \rho } } \sim \mathcal { N } ( \mu _ { \hat { \rho } } , \Sigma _ { \hat { \rho } } ) , \qquad \mathbf { s } _ { t + 1 } \mid \mathbf { s } _ { t } , \mathbf { a } _ { t } \sim \mathcal { N } \left( \mathbf { F } _ { t } \left[ \mathbf { a } _ { t } \right] , \Sigma _ { t } \right) \mathrm { ~ f o r ~ } t \in [ 0 , \dots , T - 1 ] , } \end{array}
52
+ $$
53
+
54
+ Where $\mathcal { N T } \mathcal { W }$ is the normal-inverse-Wishart distribution and $\mathcal { M N T } \mathcal { W }$ is the matrix normal-inverseWishart (MNIW) distribution. This probabilistic graphical model (PGM) allows for tractable approximate inference, i.e., Bayesian linear regression, and also captures uncertainty in the form of a posterior distribution over the initial state and dynamics. However, for dynamical systems with complex non-linear dynamics, this model still suffers from significant bias.
55
+
56
+ Even when the system is poorly modeled by an LDS in the state space, we might be able to find a latent embedding and model the system as approximately linear in that latent space, which may allow us to find a better-performing policy that operates in the learned latent space. This shifts our problem setting to that of a partially observed MDP, as we do not observe the latent state. In particular, our modeling assumption is that we receive an observation as generated from an underlying unobserved state, and as discussed in section 3, we address this by training a recognition model to infer the latent state. In our experiments in section 6, we provide several observations to our recognition model in order to infer information that cannot be observed from a single observation, such as velocity. We can jointly train an embedding and model using the SVAE framework (Johnson et al., 2016), which allows us to combine arbitrary embedding functions, such as neural networks, with PGMs. The model we build off of is a version of the LDS SVAE presented in Johnson et al. (2016) and is given by
57
+
58
+ $$
59
+ \begin{array} { r l } & { \mu _ { \hat { \rho } } , \Sigma _ { \hat { \rho } } \sim \mathcal { N } \mathcal { D } \mathcal { W } ( \Psi , \nu , \mu _ { 0 } , \kappa ) , \quad \mathbf { F } _ { t } , \Sigma _ { t } \sim \mathcal { M } \mathcal { N } \mathcal { D } ( \Psi , \nu , M _ { 0 } , V ) \mathrm { ~ f o r ~ } t \in [ 0 , \dots , T - 1 ] , } \\ & { \mathbf { z } _ { 0 } \mid \mu _ { \hat { \rho } } , \Sigma _ { \hat { \rho } } \sim \mathcal { N } ( \mu _ { \hat { \rho } } , \Sigma _ { \hat { \rho } } ) , \qquad \mathbf { z } _ { t + 1 } \mid \mathbf { z } _ { t } , \mathbf { a } _ { t } \sim \mathcal { N } \left( \mathbf { F } _ { t } \left[ \mathbf { z } _ { t } \right] , \Sigma _ { t } \right) \mathrm { ~ f o r ~ } t \in [ 0 , \dots , T - 1 ] , } \\ & { \mathbf { s } _ { t } \mid \mathbf { z } _ { t } \sim f _ { \gamma } \left( \mathbf { z } _ { t } \right) \mathrm { ~ f o r ~ } t \in [ 0 , \dots , T ] , } \end{array}
60
+ $$
61
+
62
+ Where $f _ { \gamma } ( \mathbf { z } )$ is an observation model, parameterized by neural network weights $\gamma$ , that outputs a distribution over s, e.g., Gaussian or Bernoulli, depending on the nature of the data. This is very similar to the Bayesian LDS, except we are learning the PGM in the latent space.
63
+
64
+ Though this model does not admit the same efficient approximate inference algorithms when $f _ { \gamma }$ is nonlinear, an efficient variational inference algorithm has previously been derived by Johnson et al. (2016). We describe the relevant aspects of this algorithm in the next section.
65
+
66
+ # 3 LEARNING AND MODELING THE LATENT SPACE
67
+
68
+ In this section, we describe how we extend the LDS SVAE for model-based RL, such that we learn an action-conditioned LQS model in the latent space. This then enables a local model method that can leverage the LQS to infer the dynamics of sampled trajectories. In this way, our model-based RL algorithm circumvents the need for forward prediction, in contrast to model-based RL methods that use model-based rollouts or planning (Nagabandi et al., 2018; Deisenroth et al., 2014). In section 4, we describe how these components are combined into our final method, SOLAR.
69
+
70
+ Our goal with this model is to learn a latent representation of the state and a prior over the dynamics in this latent representation that is suitable for fitting local dynamics models via posterior inference. Specifically, we are interested in the setting where we have access to trajectories of the form $\left[ \mathbf { s } _ { 0 } , \mathbf { a } _ { 0 } , c _ { 0 } , \ldots , \mathbf { s } _ { T - 1 } , \mathbf { a } _ { T - 1 } , c _ { T - 1 } , \mathbf { s } _ { T } \right]$ , sampled from the system using our current policy and set of previous policies. Our aim is to infer local linear dynamics in the neighborhood of these trajectories, and we learn a model that makes this fitting process more accurate for the observed trajectories, thus enabling our local model method to find good directions for policy improvement.
71
+
72
+ ![](images/5a042b5a0c0145f83947a13d9eead8c41c5137ce2fe290837a42157101abe5d9.jpg)
73
+ Figure 2: Left: The LQS graphical model. Distributions for each node are as specified in Equation 2-Equation 4, with additional deterministic nodes for observed costs. Right: The variational family we use for our model learning algorithm, with distributions given in Equation 5.
74
+
75
+ We build upon the variational inference algorithm presented in Johnson et al. (2016), such that we are maximizing, with respect to both the PGM and neural network parameters, the variational lower bound (ELBO) of our observed data. This algorithm requires variational factors of the form
76
+
77
+ $$
78
+ \begin{array} { r } { q ( \mathbf { z } _ { t } \mid \mathbf { s } _ { t } ) = \mathcal { N } \left( e _ { \phi } \left( \mathbf { s } _ { t } \right) \right) , q ( \mathbf { F } _ { t } , \Sigma _ { t } ) = \mathcal { M } \mathcal { N } \mathcal { Z } \mathcal { W } ( \Psi _ { t } ^ { \prime } , \nu _ { t } ^ { \prime } , M _ { 0 t } ^ { \prime } , V _ { t } ^ { \prime } ) \mathrm { ~ f o r ~ } t \in \left[ 0 , \dots , T - 1 \right] . } \end{array}
79
+ $$
80
+
81
+ $e _ { \phi } ( \mathbf { s } )$ is a recognition model, parameterized by neural network weights $\phi$ , that outputs the mean and diagonal covariance of a Gaussian distribution over $\mathbf { z }$ . This recognition model is identical to that used in Kingma & Welling (2014); Rezende et al. (2014); Gao et al. (2016), however, as with prior work in the LDS SVAE, we also have variational factors of the form $q ( \mathbf { F } _ { t } , \Sigma _ { t } )$ , which represent our posterior belief about the system dynamics after observing the collected data. We also model this distribution as MNIW but with updated parameters compared to the prior from Equation 2. Given this, we can formulate the variational lower bound (ELBO) which is given by
82
+
83
+ $$
84
+ \begin{array} { l } { { \displaystyle { \mathcal { L } } = { \mathbb { E } } _ { q } [ \log \frac { p ( \{ \mathbf { F } , \Sigma \} _ { t = 0 } ^ { T - 1 } , \{ \mathbf { s } _ { t } \} _ { t = 0 } ^ { T } , \{ \mathbf { a } _ { t } \} _ { t = 0 } ^ { T - 1 } , \mathbf { z } _ { t } \} _ { t = 0 } ^ { T } ) } { q ( \{ \mathbf { F } _ { t } , \Sigma _ { t } \} _ { t = 0 } ^ { T - 1 } , \{ \mathbf { z } _ { t } \} _ { t = 0 } ^ { T } | \mathbf { s } _ { t } ) | \{ \mathbf { s } _ { t } \} _ { t = 0 } ^ { T } ] } } \ ~ } \\ { { \displaystyle ~ = { \mathbb { E } } _ { q } [ \log ( \prod _ { t = 0 } ^ { T } p _ { \gamma } ( \mathbf { s } _ { t } | \mathbf { z } _ { t } ) ) ] } \ ~ } \\ { { \displaystyle ~ - \sum _ { t = 0 } ^ { T - 1 } \mathrm { K L } ( q ( \mathbf { F } _ { t } , \Sigma _ { t } ) \| p ( \mathbf { F } , \Sigma ) ) - \sum _ { t = 1 } ^ { T } \mathbb { E } _ { q } [ \mathrm { K L } ( q _ { \phi } ( \mathbf { z } _ { t } | \mathbf { s } _ { t } ) \| p ( \mathbf { z } _ { t } | \mathbf { z } _ { t - 1 } , \mathbf { a } _ { t - 1 } , \mathbf { F } _ { t } , \Sigma _ { t } ) ] . } \ } \end{array}
85
+ $$
86
+
87
+ Prior work has shown that, for conjugate exponential models such as the Bayesian LDS, the variational model parameters can be updated using natural gradients, which can be computed in closed form using the variational message passing framework (Winn & Bishop, 2005). Specifically, letting $\lambda$ denote the MNIW parameters of the variational factors on $\{ \mathbf { F } _ { t } , \Sigma _ { t } \} _ { t }$ , the natural gradient update is
88
+
89
+ $$
90
+ \tilde { \nabla } _ { \lambda } \mathcal { L } = \lambda ^ { 0 } + B \mathbb { E } _ { q } \left[ t _ { \mathbf { F } , \Sigma } ( \mathbf { F } , \Sigma ) \right] - \lambda ,
91
+ $$
92
+
93
+ Where $B$ is the number of minibatches in the dataset, $\lambda ^ { 0 }$ is the parameter for the prior distribution $p ( \mathbf { F } , \Sigma )$ , and $t _ { \mathbf { F } , \Sigma } ( \mathbf { F } , \Sigma )$ is the sufficient statistic function for $p ( \mathbf { F } , \Sigma )$ . Thus, we can use this equation to compute the natural gradient update for $\lambda$ , whereas for $\gamma$ and $\phi$ we use stochastic gradient updates on Monte Carlo estimates of the ELBO, specifically using the Adam optimization scheme (Kingma & Ba, 2015). This leads to two simultaneous optimizations for the PGM parameters and the neural network parameters, and their learning rates are treated as separate hyperparameters. We have found $1 0 ^ { - 3 }$ and $1 0 ^ { - 4 }$ to be generally suitable for the natural gradient and Adam updates, respectively.
94
+
95
+ # Algorithm 1 SOLAR
96
+
97
+ <table><tr><td></td><td>1:Hyperparameters: # iterations K,# trajectories N,model training buffer size B</td></tr><tr><td></td><td>(0)</td></tr><tr><td>3:</td><td>for iteration k ∈{1,...,K} do</td></tr><tr><td>4:</td><td>(i) N )=1</td></tr><tr><td>5:</td><td>M(b)← MODELUPDATE(M(k-1), {D(i)}k=k-B) (section 3)</td></tr><tr><td>6:</td><td></td></tr><tr><td>7:</td><td>{F(), (k) )}t ← INFERDYNAMICs(D(k),M(k)) (subsection 4.1) 1 t ,</td></tr><tr><td>8: T0 9:</td><td>←POLICYUPDATE(( (k) (k-1) ,{F(), , end for</td></tr></table>
98
+
99
+ Figure 2 details the graphical model presented in Equation 2-Equation 4 along with the variational family described above. Since we are interested in control and RL, there is the added notion of observed costs from the environment, and there are many ways we could model these additional observations. A natural choice is to model costs as a quadratic function of the latent state and action, such that we arrive at the LQS presented in Equation 1 except in the learned latent space. Specifically, given trajectories of the form $\left[ \mathbf { s } _ { 0 } , \mathbf { a } _ { 0 } , c _ { 0 } , \ldots , \mathbf { s } _ { T - 1 } , \mathbf { a } _ { T - 1 } , c _ { T - 1 } , \mathbf { s } _ { T } \right]$ , we first embed the observations $\left\{ \mathbf { s } _ { t } \right\}$ using the mean of our recognition model $\mu ( e _ { \phi } ( \mathbf { s } ) )$ to obtain a set of latent states $\left\{ { \bf z } _ { t } \right\}$ . We then model our cost samples as $\begin{array} { r } { c _ { t } = \frac { 1 } { 2 } \mathbf { z } _ { t } ^ { \top } \mathbf { L } \mathbf { L } ^ { \top } \mathbf { z } _ { t } + \mathbf { c } ^ { \top } \mathbf { z } _ { t } + \alpha \| \mathbf { a } _ { t } \| _ { 2 } ^ { 2 } + b , } \end{array}$ , where we assume that the action-dependent part of the cost is known and we learn L, c, and $b$ by minimizing the mean-squared error of the observed costs with stochastic gradient descent. $\mathbf { L }$ is a lower-triangular matrix with strictly positive diagonal entries, and thus by constructing our cost matrix as $\mathbf { C } = \mathbf { L } \mathbf { L } ^ { \top }$ we guarantee that the learned cost matrix is positive definite, which improves the conditioning of the policy update.
100
+
101
+ # 4 POLICY LEARNING IN THE LATENT SPACE
102
+
103
+ While we could use a variety of model-based policy learning methods in the learned latent space, the ability to infer local time-varying linear dynamics lends itself naturally to the particular analytic local solution to the policy described in subsection 2.1. This approach yields a policy that is TVLG in the latent space, which in general corresponds to a class of nonlinear policies in the original space formed by the composition of the nonlinear neural network embedding and the TVLG policy.
104
+
105
+ As discussed in the following sections, we can use the PGM in the previous section to formulate local model fitting as probabilistic inference, in order to obtain a dynamics estimate that we can then use to improve the policy. Note that this use of the model is quite different from how dynamics models are typically used in standard model-based RL algorithms: instead of using the model to predict into the future, we only use the model to infer local linear dynamics conditioned on real-world trajectory samples. While local models are not burdened by forward prediction compared to global forward models, the simplicity of linear local models prevents accurate modeling of complex systems, and our method mitigates this through a latent representation that is optimized for local linear model fitting.
106
+
107
+ Our overall algorithm, SOLAR, is presented in algorithm 1. At every iteration, we collect $N$ rollouts from the real world (line 4). Then, we update our model using data from the last $B$ iterations (line 5), we linearize our policy given the updated model (line 6, see Appendix C for details), we perform inference within our model to get the dynamics estimates (line 7), and we update our policy using the rollouts from our current iteration and our updated model (line 8). The following subsections detail the modules of our method that are involved in policy learning and improvement.
108
+
109
+ # 4.1 DYNAMICS INFERENCE UNDER THE MODEL
110
+
111
+ To obtain a TVLG dynamics model, we could directly use linear regression to fit $\mathbf { F } _ { t }$ and $\Sigma _ { t }$ to the observed latent trajectories $\tau = [ \mathbf { z } _ { 0 } , \mathbf { a } _ { 0 } , \ldots , \mathbf { z } _ { T - 1 } , \mathbf { a } _ { T - 1 } , \mathbf { z } _ { T } ]$ . However, this may be poorly conditioned in the low-data regime. Instead, we can perform inference within our model to obtain dynamics estimates for policy improvement. As described in section 3, our model provides us with variational approximations to the posterior over dynamics models, i.e., $\{ q ( \mathbf { F } _ { t } , \Sigma _ { t } ) \} _ { t = 0 } ^ { T - 1 }$ , which are MNIW. We can use these as a prior and condition on the data to obtain new variational posteriors $\{ q ( \mathbf { F } _ { t } , \Sigma _ { t } | \{ \tau \} _ { i = 0 } ^ { N } ) \} _ { t = 0 } ^ { T - 1 }$ , which are also MNIW. Writing the parameters of these posteriors – for which the closed form solutions are given in Appendix $\mathrm { \bf B - }$ as $\{ \Psi _ { t } , M _ { 0 t } , V _ { t } , \nu _ { t } \} _ { t }$ , we compute a maximum a posteriori estimate of the dynamics parameters at time step $t$ as: $\begin{array} { r } { \mathbf { F } _ { t } = M _ { 0 t } , \Sigma _ { t } = \frac { \Psi _ { t } } { \nu _ { t } } } \end{array}$ . This inference procedure corresponds to Bayesian linear regression and can be interpreted as resolving the uncertainty in the global dynamics model conditioned on a real-world rollout. In essence, $\{ q ( \mathbf { F } _ { t } , \Sigma _ { t } ) \} _ { t = 0 } ^ { T - 1 }$ captures uncertainty over the latent system dynamics by acting as a global model over all observed data, but in order to accurately model the system within the local region around the current policy, we condition on trajectories collected from the policy in order to resolve the uncertainty and obtain dynamics estimates $\begin{array} { r } { \{ \mathbf { F } _ { t } , \boldsymbol { \Sigma } _ { t } \} _ { t = 0 } ^ { T - 1 } } \end{array}$ that allow us to improve the policy.
112
+
113
+ # 4.2 POLICY UPDATE
114
+
115
+ As described in subsection 2.1, once we have our TVLG dynamics estimates $\{ \mathbf { F } _ { t } , \Sigma _ { t } \} _ { t }$ and quadratic cost fit $\mathbf { C } , \mathbf { c }$ , we can use dynamic programming on the Q and value functions to compute the optimal policy in closed form. However, doing so is typically undesirable as the resulting policy will overfit to the model and likely will not perform well in the real environment. Since our modeling assumption is not that our model will be globally valid, but rather that our model will be valid close to the data distribution of the previous policy, we utilize a constrained policy update such that our new policy does not drastically change the induced trajectory distribution. Specifically, similar to prior work, we impose a KL-divergence constraint on the policy update such that the shift in the induced trajectory distributions before and after the update, which we denote as $\bar { p } ( \tau )$ and $p ( \tau )$ , respectively, is bounded by a step size $\epsilon$ (Levine & Abbeel, 2014). This leads to a constrained optimization of the form $\operatorname* { m a x } _ { \theta } \ \hat { \eta } ( \theta )$ s.t. $D _ { \mathrm { K L } } ( p ( \tau ) \lVert \bar { p } ( \tau ) ) \leq \epsilon$ . As shown in Levine & Abbeel (2014), this constrained optimization can be solved by augmenting the cost function to penalize the deviation from the previous policy $\pi _ { \bar { \theta } }$ , i.e., $\begin{array} { r } { \tilde { C } ( \mathbf { z } _ { t } , \mathbf { a } _ { t } ) = \frac { 1 } { \lambda } C ( \mathbf { z } _ { t } , \mathbf { a } _ { t } ) - \log \pi _ { \bar { \theta } } ( \mathbf { a } _ { t } | \mathbf { z } _ { t } ) } \end{array}$ . Note that this augmented cost function is still quadratic, since the policy is TVLG, and thus we can still compute the optimal policy under this cost function in closed form using the procedure described in subsection 2.1. $\lambda$ is a dual variable that trades off between optimizing the cost function and staying close in distribution to the previous policy, and the weight of this term can be determined through a dual gradient descent procedure. Combined with the model learning from section 3, we arrive at the SOLAR algorithm.
116
+
117
+ # 5 RELATED WORK
118
+
119
+ Model-based RL methods have achieved significant efficiency benefits compared to model-free RL methods (Chebotar et al., 2017; Nagabandi et al., 2018; Deisenroth et al., 2014). Many of these prior methods learn global models of the system that are then used for planning, generating synthetic experience, or policy search (Atkeson & Schaal, 1997; Peters et al., 2010). These methods require an accurate and reliable model and will typically suffer from modeling bias, hence these models are still limited to short horizon prediction in more complex domains (Mishra et al., 2017; Nagabandi et al., 2018; Gu et al., 2016; V.Feinberg et al., 2018). Another class of model-based methods rely only on local system models to compute the gradient for a policy update (An et al., 1988; Kolter & Ng, 2005; Heess et al., 2015; Levine & Abbeel, 2014; Bansal et al., 2017). These methods do not use models for long-term forward prediction, allowing for the use of simple models that enable policy improvement (Montgomery et al., 2017; Levine et al., 2016). As we show in section 6, modeling bias for prior methods can be severely limiting in systems with complex observations such as images, whereas we are able to learn representations that mitigate the effects of modeling bias.
120
+
121
+ Utilizing representation learning within model-based RL has been studied in a number of previous works (Lesort et al., 2018), including using embeddings for state aggregation (Singh et al., 1994), dimensionality reduction (Nouri & Littman, 2010), self-organizing maps (Smith, 2002), value prediction (Oh et al., 2017), and deep auto-encoders (Lange & Riedmiller, 2010; Finn et al., 2016; Watter et al., 2015; Higgins et al., 2017). Within these works, deep spatial auto-encoders (DSAE) (Finn et al., 2016) and embed to control (E2C) (Watter et al., 2015; Banijamali et al., 2017) are the most closely related to our work in that they consider local model methods combined with representation learning. The key difference in our work is that, rather than using a learning objective for reconstruction and forward prediction, we formulate a Bayesian latent variable model such that inference corresponds to fitting local models within the learned representation. As such, our objective enables local model methods by directly encouraging learning representations where fitting local models accurately explains the observed data. We also do not assume a known cost function, goal state, or access to the underlying system state as in DSAE and E2C, thus SOLAR is applicable even when the underlying states and cost function are unknown.1 We find that our approach tends to produce better results on a number of complex image-based tasks, as we discuss in the next section.
122
+
123
+ ![](images/25f1d947657a301ce0b4d4892e094a9246939062b82252ef0bc5e4f6ba3ce971.jpg)
124
+ Figure 3: (a) Top: Visualizing a trajectory in the car navigation environment, with the target denoted by the black dot, and the corresponding image observation. Bottom: An illustration of the 2-DoF arm environment, with the target denoted by the red dot, and the corresponding image observation. Note that we use sliding windows of past observations when learning both tasks. (b) Top: Illustration of the architecture we use for learning Lego block stacking. Bottom: Example trajectory from our learned policy stacking the yellow Lego block on top of the blue block.
125
+
126
+ # 6 EXPERIMENTS
127
+
128
+ We aim to answer the following questions through our experiments: (1) How does SOLAR compare to state-of-the-art model-free and model-based RL algorithms? (2) How do local and global model methods compare when operating in our learned representations? (3) How much benefit do we derive from our particular representation learning method? To answer (1), we compare SOLAR to trust region policy optimization (TRPO) (Schulman et al., 2015) and proximal policy optimization (PPO) (Schulman et al., 2017), two state-of-the-art model-free methods, and LQR with fitted linear models (LQR-FLM) (Levine & Abbeel, 2014), a state-of-the-art model-based method. To answer (2), we test an ablation of our method where we learn a neural network dynamics model with which we perform model-predictive control (MPC) in the latent space. We refer to this as the “global model ablation”. To answer (3), we replace our LDS SVAE model with a variational auto-encoder (VAE) (Kingma & Welling, 2014; Rezende et al., 2014) and with the robust locally-linear controllable embedding (RCE) model (Banijamali et al., 2017), an improved version of the E2C model (Watter et al., 2015). We refer to these as the “VAE ablation” and “E2C-like ablation”, respectively. We additionally compare to a pixel space model similar to Finn & Levine (2017) that utilizes no representation learning and instead learns both a dynamics and cost model on images in order to run MPC in pixel space. Videos of the learned policies are available on the project website.2
129
+
130
+ # 6.1 EXPERIMENTAL TASKS
131
+
132
+ We set up simulated image-based robotic domains for a 2-dimensional navigation task, a nonholonomic car, and a 2-DoF arm, as shown in Figure 3a. We also learn a block stacking task directly from camera images on a real Sawyer robotic arm, as shown in Figure 3b. Details regarding experimental setup and training hyperparameters are provided in Appendix D.
133
+
134
+ ![](images/205af87a310b6b59e8360822d6d7bb88440a9c67dcec261c082060231afdd956.jpg)
135
+ Figure 4: (a) Our method, the VAE ablation, and the global model ablation consistently solve 2D navigation from images, whereas LQR-FLM and the E2C-like ablation are unable to make progress. The final performance of PPO is plotted as the dashed line, though PPO requires 1000 times more samples than our method to reach this performance. (b) On the car from images, both our method and the global model ablation are able to reach the goal, however, we encode prior information into the global model ablation by biasing the control to select positive actions. The VAE ablation is less consistent across random seeds, and the E2C-like ablation once again is unsuccessful at the task. PPO requires over 25 times more episodes to learn a successful policy. (c) For reacher from images, we perform worse than PPO but need about 40 times fewer episodes to learn, whereas the ablations performs noticeably worse. Here we plot reward, so higher is better.
136
+
137
+ 2D navigation. We consider a 2-dimensional navigation task similar to Watter et al. (2015); Banijamali et al. (2017) except we move the goal every episode rather than fixing it to the bottom right. Observations consist of two 32-by-32 images indicating the positions of the agent and goal.
138
+
139
+ Nonholonomic car. The nonholonomic car starts in the bottom right of the 2-dimensional space and controls its acceleration and steering velocity in order to reach the target in the top left. We use a sliding window of four 64-by-64 images as the observation to capture velocity information.
140
+
141
+ Reacher. We experiment with the reacher environment from OpenAI Gym (Brockman et al., 2016), where a 2-DoF arm has to reach a target denoted by a red dot, which we specify to be in the bottom left. For observations, we directly use 64-by-64-by-3 images of the rendered environment, which provides a top-down view of the reacher and target, and we use a sliding window of four images.
142
+
143
+ Sawyer Lego block stacking. To demonstrate a challenging task in the real world, we use our method to learn Lego block stacking with a real 7-DoF Sawyer robotic arm, as depicted in Figure 3b. The observations used are raw 84-by-84-by-3 images from a camera pointed at the robot, and the controller only receives images as the observation, without joint angles or other information.
144
+
145
+ # 6.2 SIMULATION RESULTS
146
+
147
+ Figure 4 details our results on the simulated image-based experimental domains, where each method is tested on three random seeds and the mean and standard deviation of the performance is reported. For the 2D navigation and car tasks from images, we plot the average final distance to the goal as a function of the number of episodes, so lower is better.3 On the reacher task, we plot the reward function as defined by Gym since this is the standard metric used to evaluate performance on this task, and as shown by the videos on our project website, achieving high Gym reward correlates strongly with solving the task in terms of distance to the goal.
148
+
149
+ On 2D navigation from images, our method, the VAE ablation, and the global model ablation are all able to learn very quickly, converging to high-performing policies within 200 episodes. LQR-FLM struggles to learn the task, likely because the images are too complex for local linear model fitting, and makes no progress at all. In fact, LQR-FLM fails to learn on all of the simulated tasks, and we note that this precludes the guided policy search (GPS) method from solving these tasks (Levine et al., 2016), as GPS uses LQR-FLM as a subroutine. For the sake of clarity in the plots, we omit the
150
+
151
+ LQR-FLM results, which are qualitatively similar to the E2C-like ablation results. PPO eventually learns a successful policy, as indicated by the dashed line depicting this method’s final performance, but this requires roughly three orders of magnitude more samples than our method. We present log-scale plots that illustrate the full learning progress of model-free methods in Appendix E.
152
+
153
+ Despite using code directly from the authors of RCE, we were unable to get the E2C-like ablation to learn a good model for this task, and thus the learned policy does not improve over the initial policy. In fact, we were unable to learn successful policies for any of the simulated tasks, though in Appendix E, we demonstrate that this ablation can learn a more successful policy on the 2D navigation domain used by Watter et al. (2015); Banijamali et al. (2017), where the target is fixed to the bottom right. This highlights the difficulty of the tasks we consider.
154
+
155
+ On the image-based car, our method is able to learn a good policy with about 1500 episodes of experience. The global model ablation is competitive with our method, however, we obtained this result by biasing the mean of the MPC random action selection to be positive, effectively encoding prior information that the car should move forward. We also noticed that, even with more data, the variance of the MPC performance remained higher than the policy learned by our method. These observations indicate that forward prediction using the learned global models may be inaccurate, leading to inconsistent control performance. In contrast, our method does not heavily rely on an accurate model and can achieve consistently good behavior on this task. The VAE ablation is able to solve this task for some random seeds, however this method’s performance is less consistent compared to our method. PPO eventually learns a successful policy for this task that performs better than our method, however it uses over 25 times more data than our method.
156
+
157
+ Finally, on the image-based reacher task, our method achieves worse final policy performance than PPO, though we do so with about 40 times fewer episodes, i.e., we use under 700 episodes whereas PPO uses about 30000. This gain in data efficiency compared to model-free methods is typical of model-based methods, however, SOLAR is able to handle this domain directly from raw image observations, which is challenging for other model-based methods. The VAE ablation also makes progress toward the goal, however, the performance is noticeably worse compared to our method. The global model ablation makes very little improvement over its initial behavior, which is better than the other methods as it learns both a dynamics and cost model from the pretraining data and uses these models right away for planning. This performance drop compared to the previous tasks indicates the difficulty in forward prediction for this domain, coupled with the failure of short-horizon control for this task as greedily minimizing distance to the goal often simply leads to collapsing the arm. As it is also less intuitive to encode prior information into this task compared to biasing the actions in the car domain to drive forward, we could not get this ablation to succeed on this task.
158
+
159
+ # 6.3 REAL ROBOT RESULTS
160
+
161
+ Figure 5 details performance on the Lego block stacking tasks in terms of the average final distance in centimeters to the goal, where we test on three random seeds and report the mean and standard deviation of the performance. We define the goal position of the end effector such that reaching the goal leads to successful stacking of the block. Not only is our method able to solve this task directly from raw, high-dimensional camera images within 200 episodes, corresponding to about half an hour of interaction time, our method is also successful at handling the complex, contact-rich dynamics of block stacking. As seen in the video on our project website, our method learns a policy that can react to slightly different contacts, due to the bottom block shifting between episodes, and is ultimately successful in stacking the block in most episodes.4
162
+
163
+ We compare to the VAE and global model ablations, as these proved to be the most successful and data efficient baselines in simulation. These ablations are competitive with our method for this real world task, though our method still achieves a better final policy that is able to more consistently stack the block. The pixel space model is significantly worse than the other methods that learn a latent representation, and given prior work on pixel space global models (Finn & Levine, 2017), we suspect that this method would need more data in order to learn this task.
164
+
165
+ ![](images/1c85e9802e1f9d613d6def55df0837f8da791042e38df07dfdd9f8a7bea6f2d5.jpg)
166
+ Figure 5: Performance on the real-world Sawyer block stacking task. Our method learns to successfully stack the block in about half an hour of interaction time. The VAE and global model ablations are also competitive on this task, while the pixel space model performs worse.
167
+
168
+ # 7 DISCUSSION AND FUTURE WORK
169
+
170
+ We presented SOLAR, a model-based RL algorithm that is capable of learning policies in a dataefficient manner directly from raw high-dimensional observations. The key insights in SOLAR involve learning latent representations where simple models are more accurate and utilizing PGM structure to infer dynamics from data conditioned on entire real-world trajectories. Our experimental results demonstrate that SOLAR is competitive in sample efficiency, while exhibiting superior final policy performance, compared to other model-based methods. Furthermore, SOLAR is significantly more data-efficient compared to state-of-the-art model-free RL methods.
171
+
172
+ There are several interesting directions for future work. First, the ability to learn representations lends itself naturally to multi-task and transfer settings, where new tasks could potentially be learned much more quickly by starting from a latent embedding that has been learned from previous tasks. We can also in principle share dynamics models, where the PGM we learn from solving previous tasks can be used as a global prior when inferring local dynamics fits for a new task. Second, our model is designed for and tested on continuous action domains as we focus on robotic applications. Extending our model to discrete actions would necessitate some type of continuous relaxation or learned action representation, and we believe that this is another interesting direction for future work.
173
+
174
+ # REFERENCES
175
+
176
+ C. An, C. Atkeson, and J. Hollerbach. Model-Based Control of a Robot Manipulator. MIT Press, 1988.
177
+ C. Atkeson and S. Schaal. Robot learning from demonstration. In ICML, 1997.
178
+ E. Banijamali, R. Shu, M. Ghavamzadeh, H. Bui, and A. Ghodsi. Robust locally-linear controllable embedding. arXiv preprint arXiv:1710.05373, 2017.
179
+ S. Bansal, R. Calandra, T. Xiao, S. Levine, and C. Tomlin. Goal-driven dynamics learning via Bayesian optimization. In CDC, 2017.
180
+ S. Boyd and L. Vandenberghe. Convex Optimization. Cambridge University Press, 2004.
181
+ G. Brockman, V. Cheung, L. Pettersson, J. Schneider, J. Schulman, J. Tang, and W. Zaremba. OpenAI gym. arXiv preprint arXiv:1606.01540, 2016.
182
+ E. Camacho and C. Bordons. Model Predictive Control in the Process Industry. Springer-Verlag New York, Inc., 1997.
183
+ Y. Chebotar, K. Hausman, M. Zhang, G. Sukhatme, S. Schaal, and S. Levine. Combining model-based and model-free updates for trajectory-centric reinforcement learning. In ICML, 2017.
184
+ M. Deisenroth, D. Fox, and C. Rasmussen. Gaussian processes for data-efficient learning in robotics and control. PAMI, 2014.
185
+ C. Finn and S. Levine. Deep visual foresight for planning robot motion. In ICRA, 2017.
186
+ C. Finn, X. Tan, Y. Duan, T. Darrell, S. Levine, and P. Abbeel. Deep spatial autoencoders for visuomotor learning. In ICRA, 2016.
187
+ Y. Gao, E. Archer, L. Paninski, and J. Cunningham. Linear dynamical neural population models through nonlinear embeddings. In NIPS, 2016.
188
+ S. Gu, T. Lillicrap, I. Sutskever, and S. Levine. Continuous deep Q-learning with model-based acceleration. In ICML, 2016.
189
+ N. Heess, G. Wayne, D. Silver, T. Lillicrap, Y. Tassa, and T. Erez. Learning continuous control policies by stochastic value gradients. In NIPS, 2015.
190
+ I. Higgins, A. Pal, A. Rusu, L. Matthey, C. Burgess, A. Pritzel, M. Botvinick, C. Blundell, and A. Lerchner. DARLA: Improving zero-shot transfer in reinforcement learning. In ICML, 2017.
191
+ D. Jacobson and D. Mayne. Differential Dynamic Programming. American Elsevier, 1970.
192
+ M. Johnson, D. Duvenaud, A. Wiltschko, S. Datta, and R. Adams. Composing graphical models with neural networks for structured representations and fast inference. In NIPS, 2016.
193
+ D. Kingma and J. Ba. Adam: A method for stochastic optimization. In ICLR, 2015.
194
+ D. Kingma and M. Welling. Auto-encoding variational Bayes. In ICLR, 2014.
195
+ J. Kolter and A. Ng. Policy search via the signed derivative. In RSS, 2005.
196
+ S. Lange and M. Riedmiller. Deep auto-encoder neural networks in reinforcement learning. In IJCNN, 2010.
197
+ T. Lesort, N. Díaz-Rodríguez, J. Goudou, and D. Filliat. State representation learning for control: An overview. arXiv preprint arXiv:1802.04181, 2018.
198
+ S. Levine and P. Abbeel. Learning neural network policies with guided policy search under unknown dynamics. In NIPS, 2014.
199
+ S. Levine and V. Koltun. Guided policy search. In ICML, 2013.
200
+ S. Levine, C. Finn, T. Darrell, and P. Abbeel. End-to-end training of deep visuomotor policies. JMLR, 2016.
201
+ N. Mishra, I. Mordatch, and P. Abbeel. Prediction and control with temporal segment models. In ICML, 2017.
202
+ T. Moldovan, S. Levine, M. Jordan, and P. Abbeel. Optimism-driven exploration for nonlinear systems. In ICRA, 2015.
203
+ W. Montgomery, A. Ajay, C. Finn, P. Abbeel, and S. Levine. Reset-free guided policy search: Efficient deep reinforcement learning with stohcastic initial states. In ICRA, 2017.
204
+ A. Nagabandi, G. Kahn, R. Fearing, and S. Levine. Neural network dynamics for model-based deep reinforcement learning with model-free fine-tuning. In ICRA, 2018.
205
+ A. Nouri and M. Littman. Dimension reduction and its application to model-based exploration in continuous spaces. Machine Learning, 2010.
206
+ J. Oh, S. Singh, and H. Lee. Value prediction network. In NIPS, 2017.
207
+ J. Peters, K. Mülling, and Y. Altün. Relative entropy policy search. In AAAI, 2010.
208
+ D. Rezende, S. Mohamed, and D. Wierstra. Stochastic backpropagation and approximate inference in deep generative models. In ICML, 2014.
209
+ J. Schulman, S. Levine, P. Moritz, M. Jordan, and P. Abbeel. Trust region policy optimization. In ICML, 2015.
210
+ J. Schulman, F. Wolski, P. Dhariwal, A. Radford, and O. Klimov. Proximal policy optimization algorithms. arXiv preprint arXiv:1707.06347, 2017.
211
+ S. Singh, T. Jaakkola, and M. Jordan. Reinforcement learning with soft state aggregation. In NIPS, 1994.
212
+ A. Smith. Applications of the self-organizing map to reinforcement learning. Neural Networks, 2002.
213
+ R. Sutton. Integrated architectures for learning, planning, and reacting based on approximating dynamic programming. In ICML, 1990.
214
+ Y. Tassa, T. Erez, and E. Todorov. Synthesis and stabilization of complex behaviors. In IROS, 2012.
215
+ E. Todorov and W. Li. A generalized iterative LQG method for locally-optimal feedback control of constrained nonlinear stochastic systems. In ACC, 2005.
216
+ V.Feinberg, A. Wan, I. Stoica, M. Jordan, J. Gonzalez, and S. Levine. Model-based value estimation for efficient model-free reinforcement learning. arXiv preprint arXiv:1803.00101, 2018.
217
+ M. Watter, J. Springenberg, J. Boedecker, and M. Riedmiller. Embed to control: A locally linear latent dynamics model for control from raw images. In NIPS, 2015.
218
+ J. Winn and C. Bishop. Variational message passing. JMLR, 2005.
219
+
220
+ # A POLICY LEARNING DETAILS
221
+
222
+ Given a TVLG dynamics model and quadratic cost approximation, we can approximate our Q and value functions to second order with the following dynamic programming updates, which proceed from the last time step $t = T$ to the first step $t = 1$ :
223
+
224
+ $$
225
+ \begin{array} { r l } & { Q _ { \mathbf { s } , t } = c _ { \mathbf { s } , t } + \mathbf { F } _ { \mathbf { s } , t } ^ { \top } V _ { \mathbf { s } , t + 1 } , \ Q _ { \mathbf { s } \mathbf { s } , t } = c _ { \mathbf { s } \mathbf { s } , t } + \mathbf { F } _ { \mathbf { s } , t } ^ { \top } V _ { \mathbf { s } \mathbf { s } , t + 1 } \mathbf { F } _ { \mathbf { s } , t } , } \\ & { Q _ { \mathbf { a } , t } = c _ { \mathbf { a } , t } + \mathbf { F } _ { \mathbf { a } , t } ^ { \top } V _ { \mathbf { s } , t + 1 } , \ Q _ { \mathbf { a } \mathbf { a } , t } = c _ { \mathbf { a } \mathbf { a } , t } + \mathbf { F } _ { \mathbf { a } , t } ^ { \top } V _ { \mathbf { s } \mathbf { s } , t + 1 } \mathbf { F } _ { \mathbf { a } , t } , } \\ & { \qquad Q _ { \mathbf { s } \mathbf { a } , t } = c _ { \mathbf { s } \mathbf { a } , t } + \mathbf { F } _ { \mathbf { s } , t } ^ { \top } V _ { \mathbf { s } \mathbf { s } , t + 1 } \mathbf { F } _ { \mathbf { a } , t } , } \\ & { \qquad V _ { \mathbf { s } , t } = Q _ { \mathbf { s } , t } - Q _ { \mathbf { s } \mathbf { a } , t } Q _ { \mathbf { a } \mathbf { a } , t } ^ { - 1 } Q _ { \mathbf { a } , t } , } \\ & { \qquad V _ { \mathbf { s } \mathbf { s } , t } = Q _ { \mathbf { s } \mathbf { s } , t } - Q _ { \mathbf { s } \mathbf { a } , t } Q _ { \mathbf { a } \mathbf { a } , t } ^ { - 1 } Q _ { \mathbf { a } \mathbf { s } , t } . } \end{array}
226
+ $$
227
+
228
+ It can be shown (e.g., by Tassa et al. (2012)) that the action $\mathbf { a } _ { t }$ that minimizes the second-order approximation of the Q-function at every time step $t$ is given by
229
+
230
+ $$
231
+ { \bf a } _ { t } = - Q _ { { \bf a } { \bf a } , t } ^ { - 1 } Q _ { { \bf a } { \bf s } , t } { \bf s } _ { t } - Q _ { { \bf a } { \bf a } , t } ^ { - 1 } Q _ { { \bf a } , t } .
232
+ $$
233
+
234
+ This action is a linear function of the state $\mathbf { s } _ { t }$ , thus we can construct an optimal linear policy by setting ${ \bf K } _ { t } = - Q _ { { \bf a a } , t } ^ { - 1 } Q _ { { \bf a s } , t }$ and ${ \bf k } _ { t } = - Q _ { { \bf a a } , t } ^ { - 1 } Q _ { { \bf a } , t }$ . We can also show that the maximum-entropy policy that minimizes the approximate Q-function is given by
235
+
236
+ $$
237
+ \pi ( \mathbf { a } _ { t } | \mathbf { s } _ { t } ) = \mathcal { N } ( \mathbf { K } _ { t } \mathbf { s } _ { t } + \mathbf { k } _ { t } , Q _ { \mathbf { a a } , t } ) .
238
+ $$
239
+
240
+ Furthermore, as in Levine & Abbeel (2014), we can impose a constraint on the total KL-divergence between the old and new trajectory distributions induced by the policies through an augmented cost function $\begin{array} { r } { \bar { c } ( { \mathbf s } _ { t } , \mathbf { a } _ { t } ) = \frac { 1 } { \lambda } c ( { \mathbf s } _ { t } , \mathbf { a } _ { t } ) - \log \pi ^ { ( i - 1 ) } ( { \mathbf a } _ { t } | { \mathbf s } _ { t } ) } \end{array}$ , where solving for $\lambda$ via dual gradient descent can yield an exact solution to a KL-constrained LQR problem.
241
+
242
+ # B DYNAMICS INFERENCE
243
+
244
+ Here we provide the closed form parameter computations for the posteriors of our dynamics given observed trajectories, as described in Section 4.1 of the main paper. Given variational factors from our model of the form
245
+
246
+ $$
247
+ \begin{array} { r } { q ( \mathbf { F } _ { t } , \Sigma _ { t } ) = \mathcal { M N T } \mathcal { W } ( \Psi _ { t } ^ { \prime } , \nu _ { t } ^ { \prime } , M _ { 0 t } ^ { \prime } , V _ { t } ^ { \prime } ) \mathrm { ~ f o r ~ } t \in [ 0 , . . . , T - 1 ] , } \end{array}
248
+ $$
249
+
250
+ n observed trajectories . These posteriors are als $\tau$ to obtain new variational posteriors MNIW, and the parameters of these pos$\{ q ( \mathbf { F } _ { t } , \Sigma _ { t } | \{ \tau \} _ { i = 0 } ^ { N } ) \} _ { t = 0 } ^ { T - 1 }$ teriors can be computed in closed form as
251
+
252
+ $$
253
+ \begin{array} { r l } & { \Psi _ { t } = \Psi _ { t } ^ { \prime } + M _ { 0 t } ^ { \prime } V _ { t } ^ { \prime - 1 } M _ { 0 t } ^ { \prime \top } + \displaystyle \sum _ { i = 1 } ^ { N } \mathbf { z } _ { t + 1 } ^ { ( i ) } \mathbf { z } _ { t + 1 } ^ { ( i ) \top } - M _ { 0 t } V _ { t } ^ { - 1 } M _ { 0 t } ^ { \top } , \qquad \kappa _ { t } = \kappa _ { t } + N , } \\ & { M _ { 0 t } = \left( M _ { 0 t } ^ { \prime } V _ { t } ^ { \prime - 1 } + \displaystyle \sum _ { i = 1 } ^ { N } \mathbf { z } _ { t + 1 } ^ { ( i ) } \left[ \mathbf { z } _ { t } ^ { ( i ) } \right] ^ { \top } \right) V _ { t } , \qquad V _ { t } = \left( V _ { t } ^ { \prime - 1 } + \displaystyle \sum _ { i = 1 } ^ { N } \left[ \mathbf { z } _ { t } ^ { ( i ) } \right] \left[ \mathbf { z } _ { t } ^ { ( i ) } \right] ^ { \top } \right) ^ { - 1 } . } \end{array}
254
+ $$
255
+
256
+ Then, a maximum a posteriori estimate gives us the TVLG dynamics parameters as described in the main paper.
257
+
258
+ # C POLICY LINEARIZATION
259
+
260
+ The policy update described in Section 4.2 of the main paper requires us to compute the KL-divergence between the trajectory distributions before and after the policy update, denoted as $\bar { p } ( \tau )$ and $\dot { p } ( \tau )$ , respectively. We compute with the previous policy, a $\begin{array} { r } { p ( \tau ) = \hat { \rho } ( \mathbf { z } _ { 0 } ) \prod _ { t = 0 } ^ { T - 1 } \pi _ { \boldsymbol { \theta } } ( \mathbf { a } _ { t } | \mathbf { z } _ { t } ) \hat { p } ( \mathbf { z } _ { t + 1 } | \mathbf { z } _ { t } , \mathbf { a } _ { t } ) } \end{array}$ , and analogously for y because the policies $\bar { p } ( \tau )$ dynamics model are TVLG, thus the induced trajectory distributions are also Gaussian. However, this operates under the assumption that $\mathbf { z }$ is fixed, which does not hold since the model update changes the latent representation. Since our overall policy is a combination of the model embedding, given by $e _ { \phi } ( \mathbf { s } )$ , and the TVLG policy $\pi _ { \boldsymbol { \theta } } ( \mathbf { a } _ { t } | \mathbf { z } _ { t } )$ , training $e _ { \phi } ( \mathbf { s } )$ will change the behavior of the policy even if $\pi _ { \boldsymbol { \theta } } ( \mathbf { a } _ { t } | \mathbf { z } _ { t } )$ stays fixed. In some cases, this may lead to a policy with worse performance, and constraining against this policy for the policy update may lead to poor results. In fact, what we want to do is to account for the model update by changing $\pi _ { \boldsymbol { \theta } } ( \mathbf { a } _ { t } | \mathbf { z } _ { t } )$ accordingly, so that the overall policy does not change in its distribution. Thus, using $\left( \mathbf { s } _ { t } , \mathbf { a } _ { t } \right)$ pairs from the previous data collection phase, we embed $\mathbf { z } _ { t } = \mu ( e _ { \phi } ( \mathbf { s } _ { t } ) )$ with our updated model and use linear regression to find the TVLG policy $\tilde { \pi } _ { \boldsymbol { \theta } } ( \mathbf { a } _ { t } | \mathbf { z } _ { t } )$ that best explains the data collected from the policy This is line 6 of the SOLAR algorithm presented in the main paper, and after this, we can perform the policy update constrained against the trajectory distribution induced by $\tilde { \pi } _ { \boldsymbol { \theta } } ( \mathbf { a } _ { t } | \mathbf { z } _ { t } )$ .
261
+
262
+ ![](images/44d897a8277a0076f1e5c3373058af16b1a1e69f206ae263fc99599086bb7d86.jpg)
263
+ Figure 6: (a) An illustration of the 2D navigation task, with the agent depicted as the black dot and the target depicted as the blue dot. (b) We use as observations two 32-by-32 images stacked on top of each other, where the first observation indicates the position of the agent the second observation indicates the position of the target. (c) Visualization of the 4-dimensional latent space for an example random trajectory of the 2D-navigation task. Note that the range of values in the latent space is very narrow, and the bottom two dimensions seemingly capture information about the target which does not move.
264
+
265
+ # D EXPERIMENT SETUP
266
+
267
+ Image-based 2D navigation. Our recognition model architecture for the 2D navigation domain consists of two convolution layers with 2-by-2 filters and 32 channels each, with no pooling layers and ReLU non-linearities, followed by another convolution with 2-by-2 filters and 2 channels. The output of the last convolution layer is fed into a spatial softmax layer (Finn et al., 2016), which then outputs a Gaussian distribution with a fixed diagonal covariance of $1 0 ^ { - 4 }$ for the latent distribution. Our observation model consists of two fully-connected (FC) hidden layers with 256 ReLU activations, and the last layer outputs a categorical distribution over pixels. We initially collect 200 episodes which we use to train our model, and for every subsequent iteration we collect 20 episodes to fine tune our model. The cost function we use is the sum of the $L ^ { 2 }$ -norm squared of the distance to the target and the commanded action, with weights of 1 and 0.001, respectively.
268
+
269
+ Image-based nonholonomic car. The image-based car domain consists of 64-by-64 image observations. We include a window of the 3 previous 64-by-64 images in our observation to preserve velocity information. Our recognition model is a convolutional neural network that operates on each image in the sliding window independently. Its architecture is four convolutional layers with 4-by-4 filters with 4 channels each, and the first two convolution layers are followed by a ReLU non-linearity. The output of the last convolutional layer is fed into three FC ReLU layers of width 2048, 512, and 128, respectively. Our final layer outputs a Gaussian distribution with dimension 8. This leads to a final latent dimension of 32. Our observation model consists of four FC ReLU layers of width 256, 512, 1024, and 2048, respectively, followed by a Bernoulli distribution layer that models the image. Like the recognition model, the observation model only operates on each section of the latent representation corresponding to the image window independently. For this domain, we collect 100 episodes initially to train our model, and we collect 100 episodes per iteration after this. The cost function we use is the sum of the $L ^ { 2 }$ -norm squared of the distance from the center of the car to the target and the commanded action, with weights of 1 and 0.001, respectively.
270
+
271
+ Reacher. The reacher domain consists of 64-by-64-by-3 image observations. Similar to the car, we include a window of the 3 previous 64-by-64-by-3 images in our observation. Our recognition model is a convolutional neural network that again operates on each image in the sliding window independently. Its architecture is three convolutional layers with 2-by-2 filters with 64, 32 and 16 channels respectively. Each layer has a ReLU non-linearity followed by a 2-by-2 max-pooling. The output of the last convolutional layer is fed into an FC ReLU layer of width 200, followed by another FC ReLU layer of width 200. Our final layer outputs a Gaussian distribution with dimension 10, leading to a final latent dimension of 40. Our observation model consists of three FC ReLU layers of width 256, followed by a Bernoulli distribution layer and separately models each image in the sliding window. We collect 200 episodes initially to train our model, and we collect 100 episodes per iteration after this. The cost function we use is the sum of the $L ^ { 2 }$ -norm of the distance from the fingertip to the target and the $L ^ { 2 }$ -norm squared of the commanded action.
272
+
273
+ Sawyer Lego block stacking. The image-based Sawyer block-stacking domain consists of 84-by-84-by-3 image observations. The policy outputs velocities on the end effector in order to control the robot. Our recognition model is a convolutional neural network with the following architecture: a 5-by-5 filter convolutional layer with 16 channels followed by two convolutional layers using 5-by-5 filters with 32 channels each. The first two convolutional layers are followed by ReLU activations and the last by a FC ReLU layer of width 256 leading to a 16 dimensional Gaussian distribution layer. Our observation model consists of a FC ReLU layer of width 128 feeding into three deconvolutional layers, the first with 5-by-5 filters with 32 channels and the last two of 6-by-6 filters with 16 and 3 channels respectively. These are followed by a final Bernoulli distribution layer. For this domain, we collect 50 episodes initially to train our model, 20 episodes per iteration for the first 5 iterations, then 10 episodes per iteration for the remainder. The cost function is the sum of the $L ^ { 1 }$ -norm of a weighted displacement vector between the end-effector and the target in 3D-space (weighted 1, 2, 1 for $x , y , z )$ , the $L ^ { 2 }$ -norm in the same space, and the angle of rotation required to reach a valid wrist orientation, with weights of 1, .1, and .15, respectively.
274
+
275
+ # E ADDITIONAL EXPERIMENTS
276
+
277
+ # E.1 E2C-LIKE ABLATION ON SIMPLIFIED 2D NAVIGATION
278
+
279
+ As mentioned in Section 6, our E2C-like ablation was unable to make progress for the 2D navigation task, though we were able to get more successful results by fixing the position of the goal to the bottom right as is done in the image-based 2D navigation task considered in E2C (Watter et al., 2015) and RCE (Banijamali et al., 2017). Figure 7 details this experiment, which we ran for three random seeds and report the mean and standard deviation of the average final distance to the goal as a function of the number of training episodes. It is clear that the policy is improving, and two of the seeds are able to make substantial progress, though the final seed is less successful and significantly worsens the average performance of the method. This indicates that the latent representation learned through RCE is less suitable for local model fitting, as accurate local model fitting is not explicitly encouraged by their representation learning objective.
280
+
281
+ ![](images/f1ab3c9f4b1d17e8e2bf6573ea5c01e754c2609148f330a2fe45097242f4e023.jpg)
282
+ Figure 7: On 2D navigation with the goal fixed to the bottom right, our E2C-like ablation is able to make progress toward the goal.
283
+
284
+ ![](images/b9dc714596bd5c1cba748d67e3d9241e68198b128d12c698a02bfc4f7f4f1072.jpg)
285
+ Figure 9: (a) Comparison of our method to PPO on the 2D navigation task presented in the paper. Our method uses roughly three orders of magnitude fewer samples to solve the task compared to PPO. (b) On the car from images task, our method achieves slightly worse performance than PPO though with about 25 times fewer samples. (c) Comparison of our method to TRPO and PPO for the reacher task. Our method achieves slightly worse final performance but uses about 40 times fewer samples than these methods.
286
+
287
+ # E.2 MODEL-BASED COMPARISONS ON STATE-BASED NONHOLONOMIC CAR
288
+
289
+ To provide a point of comparison to modelbased RL methods, we consider the car domain where the underlying state is observed. The states for the car domain include the position of the center of mass, orientation, forward and angular velocity of the car, and the position of the target, making for a 9-dimensional system. Since this observation is already quite simple, we use a single linear layer for our recognition and observation models that output Gaussian distributions, and we use the same dimensionality for our latent representation as the state.
290
+
291
+ ![](images/0aedca8cd6354ec9922ecfa9f40de2b63b05982b8d1bf8bc11942c6fe6ae57c7.jpg)
292
+ Figure 8: On the car from states, our method is competitive with LQR-FLM, demonstrating that we maintain the sample efficiency of model-based methods for simple tasks.
293
+
294
+ We plot the performances of our method, LQRFLM (Levine & Abbeel, 2014), and Nagabandi et al. (2018), which we refer to as modelpredictive control with neural networks (MPCNN), again based on the average final distance to the target, in Figure 8. In this setting, our
295
+
296
+ method is competitive with LQR-FLM, learning a policy with similar performance in 200 episodes. MPC-NN performs the best for this task, learning a policy that consistently reaches the target in just 20 episodes, though it is given the true cost function whereas our method and LQR-FLM are not. For this simple setup where modeling bias is not an issue, we expect model-based methods to perform very well and learn efficiently. However, when we make the problem more challenging by using image observations, model-based methods will fail quickly: LQR-FLM is unable to fit complex pixel transitions using local linear models, as shown through the 2D navigation experiment, and MPC-NN has never been used with images, as forward video prediction and defining a cost function on images are both very difficult. We extend MPC-NN to the image-based task, and we term this the “global model ablation” of our method – as shown in the paper, this approach is able to make progress toward the goal, though our method is still significantly better at solving this difficult task.
297
+
298
+ # E.3 FULL PERFORMANCE OF TRPO ON 2D NAVIGATION AND REACHER
299
+
300
+ In Figure 9 we include the plots for the simulated tasks comparing SOLAR, PPO, and TRPO. Note that the $\mathbf { X }$ -axis is on a log scale, i.e., though our method is sometimes worse in final policy performance to PPO and TRPO, we do so with one to three orders of magnitude fewer samples. This demonstrates our method’s sample efficiency compared to model-free methods, while being able to solve complex image-based domains that are difficult for model-based methods.
md/train/BkeOp6EKDH/BkeOp6EKDH.md ADDED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # TRIMAP: LARGE-SCALE DIMENSIONALITY REDUCTION USING TRIPLETS
2
+
3
+ # ABSTRACT
4
+
5
+ We introduce “TriMap”; a dimensionality reduction technique based on triplet constraints that preserves the global accuracy of the data better than the other commonly used methods such as t-SNE, LargeVis, and UMAP. To quantify the global accuracy, we introduce a score which roughly reflects the relative placement of the clusters rather than the individual points. We empirically show the excellent performance of TriMap on a large variety of datasets in terms of the quality of the embedding as well as the runtime. On our performance benchmarks, TriMap easily scales to millions of points without depleting the memory and clearly outperforms t-SNE, LargeVis, and UMAP in terms of runtime.
6
+
7
+ # 1 INTRODUCTION
8
+
9
+ Data visualization based on dimensionality reduction (DR) is a core problem in data analysis and machine learning. The aim of DR is to provide a low-dimensional representation (typically in 2D or 3D) of a given high-dimensional dataset that preserves the overall structure of the data as much as possible. The earlier approaches for DR involve linear methods such as PCA $( | \mathbf { P e a r s o n } | , | 1 9 0 1 | )$ . PCA aims to maintain the second-order statistics of the data by projecting the points into the low dimensional space that preserves the maximum amount of variance among all such projections. As a result, PCA has been shown to be effective in preserving the global structure of the data $\mathrm { ( | \overline { { { S i l v a } } } } |$ & Tenenbaum, 2003). The global structure includes the overall shape of the dataset, placement of the clusters, and existence of potential outliers. Unlike PCA, much of the focus of the more recent non-linear methods including t-SNE (Maaten & Hinton, $\textcircled { 2 0 0 8 }$ , LargeVis $\left( \mathbb { T a n g e t a l . } \right) , \left[ 2 0 1 6 \right)$ and UMAP (McInnes et al., 2018) has been on preserving the local neighborhood structure of each individual point. Similarly, the common performance measures of DR such as trustworthinesscontinuity (Venna & Kaski, 2005), precision-recall (i.e. AUC) $\left( \mathrm { N e n n a ~ e t ~ a l . } \right) \left[ \mathrm { 2 0 1 0 } \right]$ , and nearestneighbor accuracy have also been developed by retaining the same focus on reflecting the local accuracy of the embedding. Thus, there has been a lack of attention on developing methods that focus on preserving the global structure of the data and likewise, practical performance measures to assess the global accuracy.
10
+
11
+ We first introduce the global score, a quantitative measure which reflects the closeness of a given embedding to the PCA embedding (which is optimal by means of preserving the data variance). The purpose of this score is to measure the accuracy of an embedding in reflecting the overall placement of the clusters of points relative to their original representation in high-dimension. By design, PCA yields the highest global score among all the DR methods and high values of global score indicates the efficacy of a DR method in reflecting the global structure.
12
+
13
+ Next, we introduce TriMap, a DR method which focuses on preserving the global structure of the data in the embedding. Pairwise (dis)similarities between points (used by the previous DR methods) seem to be insufficient in capturing the global structure. Instead, TriMap incorporates a higher order of structure to construct the embedding by means of triplets:
14
+
15
+ $$
16
+ ( i , j , k ) \Leftrightarrow p o i n t i s c l o s e r t o p o i n t j t h a n p o i n t k .
17
+ $$
18
+
19
+ The key idea behind TriMap stems from semi-supervised metric learning $\left( \overline { { \mathrm { A m i d e t a l . } } } , \overline { { 2 0 1 6 } } \right)$ : Given an initial low-dimensional representation for the data points, the triplet information from the highdimensional representation of the points is used to enhance the quality of the embedding. Similarly, TriMap is initialized with the low dimensional PCA embedding, and this embedding is then modified using a set of carefully selected triplets from the high-dimensional representation.
20
+
21
+ ![](images/126550d3d027ba058dc4c638816e25f31438dc6863e0896965d53054c49a4bed.jpg)
22
+ Figure 1: 2-D Visualizations of the S-curve dataset: (a) original dataset in 3-D, (b) t-SNE, (c) UMAP, (d) TriMap, and (e) PCA. The values of AUC and global score, for respectively measuring local and global accuracy, are shown in order as a pair (AUC, GS) for each embedding. Despite having higher AUC values, t-SNE and UMAP both fail to reflect the overall shape of the S-curve. On the other hand, TriMap successfully unveils the underlying structure in the original dataset. Note that GS is the only DR performance measure that can reflect this property.
23
+
24
+ With an extensive set of experiments, we show that TriMap produces excellent results on a variety of real-world as well as synthetic datasets. We show that in many cases TriMap outperforms all the competitor non-linear methods by means of global score and provides comparable local accuracy. While being significantly faster than t-SNE, TriMap provides comparable runtime to UMAP and LargeVis while scaling drastically better to larger datasets. On the Character Font Images dataset of ${ \sim } 1 . 7 \mathbf { M }$ points, TriMap calculates the embedding in ${ \sim } 1 . 3$ hours while LargeVis takes more than 3 hours and UMAP exceeds the 12 hours time limit. Our contributions can be summarized as follows:
25
+
26
+ • We introduce a global score to quantify the quality of a low-dimensional embedding in reflecting the global structure of the high-dimensional data such as placement of the clusters rather than the local neighborhood of individual points.
27
+ We introduce TriMap, a fast dimensionality reduction method which provides embeddings of the data that are globally more accurate than other non-linear DR methods such as t-SNE, LargeVis, and UMAP.
28
+ • We provide an efficient implementation1 of TriMap that can easily scale to millions of points on commodity hardware and outperforms the competing methods in terms of runtime. We also perform many large-scale experiments on various datasets to show the efficacy of TriMap in terms of DR performance measures and runtime.
29
+
30
+ # 2 A MEASURE OF GLOBAL ACCURACY
31
+
32
+ Consider the S-curve dataset2 which consists of 5000 points in 3-D uniformly sampled from an S-shaped manifold (Figure 1.(a)). This dataset serves as a paradigmatic problem for evaluating the performance of DR methods. In Figure $\bigstar \bigstar$ we show the results of 2-D embeddings of the S-curve dataset using t-SNE, UMAP, TriMap, and PCA. The top of each graph is labeled by the scoring pair (AUC, GS) where GS stands for global score (introduced below). Note that both t-SNE and UMAP provide higher values of the AUC score and locally preserve the continuity of the manifold. However, they both fail to recover the global structure of the S-curve, which is naturally reflected in the PCA embedding. On the other hand, our TriMap method (formally defined later) successfully recovers the structure of the S-curve by “unveiling” the curved shape of the manifold at both ends. Overall, the 2-D TriMap embedding resembles the original 3-D representation as much as possible. Note also that GS is the only measure that can reflect the global accuracy of the embedding.
33
+
34
+ The previous example indicates that the local measures of DR performance (such as AUC) cannot reflect the global accuracy of a low-dimensional embedding. In fact, the low-granular structure of the data can only be estimated by considering the global statistics of the dataset, as regarded by the PCA method. PCA is a linear DR method that projects the high-dimensional data onto the top- $d$ orthogonal directions having the highest variance. In order to calculate the mapping, PCA only considers the aggregate statistics of the dataset rather than the local information of each individual data point. As a result, PCA is extremely well suited at retaining the global structure of the data, i.e. the overall shape of the dataset, placement of the clusters, and existence of potential outliers.
35
+
36
+ ![](images/90058bdad23fe495c6d48369d44b01219a795fa12a3178643624027d56f79383.jpg)
37
+ Figure 2: The Effect of the weight transformation on the MNIST dataset: (a) no weight transformation, (b) $\gamma = 5 0$ , (c) $\gamma = 5 0 0$ (default), and (d) $\gamma = 5 0 0 0$ . The values of nearest neighbor accuracy and global score are shown as a tuple (NN,GS) on top of each figure. Larger values of $\gamma$ emphasizes more on the local accuracy rather than the global accuracy.
38
+
39
+ However, by focusing on the global structure, PCA loses much of the local information such as the neighborhood structure of each data point.
40
+
41
+ Given a low-dimensional mapping produced by PCA, it is possible to calculate an optimal inverse mapping into the original high-dimensional space by means of minimizing the squared error. The optimal inverse map also corresponds to a linear mapping3. In order to quantify the global accuracy of a DR result, we focus on the accuracy of the embedding in reflecting the global structure of the data similar to PCA. That is, we consider the minimum reconstruction error of the original dataset by means of a linear inverse map. Given $n$ data points $\{ \pmb { x } _ { i } \in \mathbb { R } ^ { m } \} _ { i = 1 } ^ { n }$ , let $\pmb { X } \in \mathbb { R } ^ { m \times \bar { n } }$ denote the high-dimensional data matrix where the $i$ -th column corresponds to $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { i } }$ . Similarly, let $\pmb { Y } \in \mathbb { R } ^ { d \times n }$ denote the matrix of the low-dimensional embedding of the points $\{ \pmb { y } _ { i } \in \mathbb { R } ^ { d } \} _ { i = 1 } ^ { n }$ . Without loss of generality, we assume both $\boldsymbol { X }$ and $\mathbf { Y }$ are centered. We define the Minimum Reconstruction Error $( M R E )$ from the embedding as
42
+
43
+ $$
44
+ \mathcal { E } ( \boldsymbol { Y } | \boldsymbol { X } ) : = \operatorname* { m i n } _ { \boldsymbol { A } \in \mathbb { R } ^ { m \times d } } \| \boldsymbol { X } - \boldsymbol { A } \boldsymbol { Y } \| _ { \mathrm { F } } ^ { 2 } ,
45
+ $$
46
+
47
+ where $\| \cdot \| _ { \mathrm { F } }$ denotes the Frobenius norm4. Note that PCA has the lowest possible MRE among all the DR methods. Thus, in order to obtain a normalized measure of global accuracy of a given embedding $\mathbf { Y }$ for a data $\boldsymbol { X }$ , we define the global score $( G S )$ as
48
+
49
+ $$
50
+ \mathrm { G S } ( Y | X ) : = \exp \Big ( - \frac { \mathcal { E } ( Y | X ) - \mathcal { E } _ { \mathrm { P C A } } } { \mathcal { E } _ { \mathrm { P C A } } } \Big ) \in [ 0 , 1 ] ,
51
+ $$
52
+
53
+ where $\mathcal { E } _ { \mathrm { P C A } } : = \mathcal { E } ( Y _ { \mathrm { P C A } } | X )$ denotes the MRE achieved by the PCA embedding $\mathbf { Y } _ { \mathrm { P C A } }$ on the same dataset $\boldsymbol { X }$ . Note that $\mathrm { \bf G S } ( Y _ { \mathrm { P C A } } | X ) = 1$ and we claim that larger values of GS indicate a higher capacity of a DR method to reflect the global structure of the data, as shown in the experiments.
54
+
55
+ In the remainder of the paper, we use GS as the global measure of performance. Due to the high computational complexity for calculating the trustworthiness-continuity and AUC scores for large data sets, we use nearest-neighbors accuracy as the local measure of performance henceforth.
56
+
57
+ # 3 THE TRIMAP METHOD
58
+
59
+ We now formally introduce the TriMap method. Recall that a triplet consists of three points $( i , j , k )$ where point $i$ is closer to point $j$ than point $k$ . TriMap chooses a subset $\mathcal { T } = \{ ( i , j , \bar { k } ) \}$ of triplets and assigns a weight $\omega _ { i j k } \geq 0$ for each triplet: a higher value of $\omega _ { i j k }$ implies that the pair $( i , k )$ is located much farther than the pair $( i , j )$ . We define the loss of the triplet $( i , j , k )$ as
60
+
61
+ $$
62
+ \ell _ { i j k } : = \omega _ { i j k } \frac { s ( y _ { i } , y _ { k } ) } { s ( y _ { i } , y _ { j } ) + s ( y _ { i } , y _ { k } ) } , \mathrm { ~ w h e r e ~ } s ( y _ { i } , y _ { j } ) = \left( 1 + | y _ { i } - y _ { j } | | ^ { 2 } \right) ^ { - 1 } ,
63
+ $$
64
+
65
+ ![](images/922bb546e53ad0604be26eae945edea542602a5fe252f6a85aabb42a6bfac050.jpg)
66
+ Figure 3: Effect of changing the number of triplets on the quality of the embeddings of the MNIST dataset. We consider $( m , m ^ { \prime } , r ) = c \times ( 2 , 1 , 1 )$ for: (a) $c = 1$ , (b) $c = 2$ , (c) $c = 5$ (default), (d) $c = 1 0$ , and (e) $c = 2 0$ . The values of nearest neighbor accuracy and global score are shown as a tuple (NN,GS) on top of each figure. The quality of embedding does not improve significantly after adding a certain number of triplets.
67
+
68
+ is a similarity function between $\mathbf { \nabla } _ { \mathbf { \boldsymbol { y } } _ { i } }$ and ${ \pmb y } _ { j }$ . The choice of $s$ is motivated by the good performance of Student t-distribution for similarities in low-dimension in the t-SNE method. Note that the loss of the triplet $( i , j , k )$ approaches zero as $\| \pmb { y } _ { i } - \pmb { y } _ { j } \|$ decreases and $\| \pmb { y } _ { i } - \pmb { y } _ { k } \|$ increases.
69
+
70
+ We first develop the weighing scheme for the triplets. To reflect the relative similarities in high-dimension, we define the unnormalized weight of the triplet $( i , j , k )$ as
71
+
72
+ $$
73
+ \tilde { \omega } _ { i j k } = \exp ( d _ { i k } ^ { 2 } - d _ { i j } ^ { 2 } ) \geq 0 ,
74
+ $$
75
+
76
+ in which, $d _ { i j }$ is any distance measure between $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { i } }$ and $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { j } }$ in highdimension. For Euclidean distances, we use the scaling introduced in (Zelnik-Manor & Perona, $\textcircled { 2 0 0 5 }$ ,
77
+
78
+ $$
79
+ d _ { i j } ^ { 2 } = \frac { \lVert \pmb { x } _ { i } - \pmb { x } _ { j } \rVert ^ { 2 } } { \sigma _ { i j } } ,
80
+ $$
81
+
82
+ where $\sigma _ { i j } = \sigma _ { i } \sigma _ { j }$ and $\sigma _ { i }$ is set to the average Euclidean distance between $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { i } }$ and the set of nearest-neighbors of $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { i } }$ from 4-th to 6-th neighbors. This choice of $\sigma _ { i j }$ adaptively adjusts the scaling based on the density of the data.
83
+
84
+ ![](images/ccbf9f3fa2e2973959a501e01799674558f18b1188314acb65e1070afdf301e8.jpg)
85
+ Figure 4: $\gamma$ -scaled logtransformation with different values of $\gamma$ . The value NIL corresponds to no transformation.
86
+
87
+ While the choice of weights $\tilde { \omega } _ { i j k }$ works well in practice, we adjust the weights further by applying a non-linear transformation that emphasizes the smaller weights. Expanding the values of small weights has the effect of placing the nearest-neighbors closer to the point and pushing the remaining points farther away, thus improving the local accuracy (as shown in Figure $\bigtriangledown$ and discussed later). The final value of the weight $\omega _ { i j k }$ is obtained by applying the $\gamma$ -scaled log-transformation (see Figure 4),
88
+
89
+ $$
90
+ \omega _ { i j k } = \zeta _ { \gamma } \big ( \frac { \tilde { \omega } _ { i j k } } { \gamma } + \delta \big ) \quad \mathrm { w h e r e } \zeta _ { \gamma } ( u ) : = \log \big ( 1 + \gamma u \big ) ,
91
+ $$
92
+
93
+ in which $\mathcal { W } = \mathrm { m a x } _ { ( i ^ { \prime } , j ^ { \prime } , k ^ { \prime } ) \in \mathcal { T } } \tilde { \omega } _ { i ^ { \prime } j ^ { \prime } k ^ { \prime } } , ~ \gamma > 0$ is a scaling factor, and $\delta$ is a small constant. We use $\gamma = 5 0 0$ and $\delta = 1 0 ^ { - 4 }$ in all our experiments.
94
+
95
+ To construct the embedding, we consider a small subset of all possible triplets $( i , j , k )$ for which, the closer point $j$ belongs to the set of nearest-neighbors of the point $i$ and the farther point $k$ is among the points that are more distant from $i$ than $j$ , chosen uniformly at random. For each point we consider its $m = 1 0$ nearest neighbors and sample $m ^ { \prime } = 5$ triplets per nearest-neighbor. This yields $m \times m ^ { \prime } = 5 0$ nearest-neighbor triplets per point. In addition, we also add $r = 5$ random triplets $( i , j , k )$ per each point $i$ where $j$ and $k$ are sampled uniformly at random and their order is possibly switched based on their nearness to $i$ . This yields $m \times m ^ { \prime } + r = 5 5$ triplets per point in total. Thus, the overall complexity of the optimization step is linear in number of points $n$ . The computational complexity is dominated by the nearest-neighbor search, which is shared among all the recent methods such as t-SNE, LargeVis, and UMAP. We use ANNOY for the approximate nearest-neighbor search5 which is based on random projection trees.
96
+
97
+ While a random initialization for the embedding also works well in practice, we initialize the embedding to the PCA solution $\mathbf { Y } _ { \mathrm { P C A } }$ (scaled by a small constant value for better convergence). The PCA initialization for TriMap allows faster convergence while preserving much of the global structure discovered by PCA. Note that the other DR methods such as t-SNE are extremely sensitive to the initialization and do not converge well with any initial solution other than small random initialization around the origin.
98
+
99
+ Table 1: Runtime of the methods in hh:mm:ss format on single machine with $2 . 6 \ : \mathrm { G H z }$ Intel Core i5 CPU and 16 GB of memory. We limit the runtime of each method to 12 hours. Also, UMAP runs out of memory on datasets larger than ${ \sim } 4 \mathbf { M }$ points.
100
+
101
+ <table><tr><td>Dataset (size)</td><td>t-SNE</td><td>LargeVis</td><td>UMAP</td><td>TriMap</td><td>Speedup</td></tr><tr><td>COIL-20 (1440)</td><td>00:00:08</td><td>00:05:51</td><td>00:00:04</td><td>00:00:02</td><td>2.00×</td></tr><tr><td>USPS (11K)</td><td>00:02:02</td><td>00:06:12</td><td>00:00:12</td><td>00:00:11</td><td>1.10×</td></tr><tr><td>Epileptic Seizure (11.5K)</td><td>00:03:11</td><td>00:06:17</td><td>00:00:15</td><td>00:00:12</td><td>1.25×</td></tr><tr><td>20 Newsgroup (18K)</td><td>00:05:34</td><td>00:06:57</td><td>00:00:26</td><td>00:00:21</td><td>1.24×</td></tr><tr><td>TabulaMuris (54K)</td><td>00:17:32</td><td>00:09:29</td><td>00:01:12</td><td>00:01:06</td><td>2.00×</td></tr><tr><td>MNIST(70K)</td><td>00:20:38</td><td>00:11:29</td><td>00:01:15</td><td>00:01:23</td><td>0.90×</td></tr><tr><td>FashionMNIST(70K)</td><td>00:19:10</td><td>00:11:04</td><td>00:01:18</td><td>00:01:24</td><td>0.93×</td></tr><tr><td>TVNews (~129K)</td><td>00:38:59</td><td>00:16:26</td><td>00:02:57</td><td>00:02:45</td><td>1.07×</td></tr><tr><td>360+KLyrics (~360K)</td><td>08:50:49</td><td>00:44:16</td><td>00:25:23</td><td>00:13:49</td><td>1.84×</td></tr><tr><td>Covertype(~581K)</td><td>二</td><td>00:44:54</td><td>02:59:41</td><td>00:24:42</td><td>1.82×</td></tr><tr><td>RCV1 (800K)</td><td>二</td><td>01:34:38</td><td>04:55:53</td><td>00:36:59</td><td>2.56×</td></tr><tr><td>Character Font Images (~1.7M)</td><td>二</td><td>03:16:19</td><td>二</td><td>01:17:50</td><td>2.52×</td></tr><tr><td>KDDCup99 (~4.9M)</td><td>二</td><td>二</td><td>二</td><td>04:17:01</td><td>二</td></tr><tr><td>HIGGS (11M)</td><td>1</td><td>1</td><td>1</td><td>10:08:36</td><td>1</td></tr></table>
102
+
103
+ We define the final loss as the sum of the losses of the sampled triplets in $\tau$
104
+
105
+ $$
106
+ \ell _ { \mathrm { T r i M a p } } = \sum _ { ( i , j , k ) \in \mathcal { T } } \ell _ { i j k } .
107
+ $$
108
+
109
+ The loss is minimized using the full-batch gradient descent with momentum using the delta-bar-delta method. In all our experiments, we perform 400 iterations with the value of momentum parameter equal to 0.5 during the first 250 iterations and 0.8 afterwards.
110
+
111
+ Finally, note that there exists connections between TriMap and a number of triplet (aka ordinal) embedding methods such as t-STE (Van Der Maaten & Weinberger, $\boxed { 2 0 1 2 } )$ . The triplet embedding methods have been developed for a different setting where the goal is to find an embedding based on a given pre-specified set of triplets obtained from human evaluators (or some form of implicit feedback). For instance, t-STE maximizes the sum of log of the satisfaction probabilities of the triplets to calculate the embedding. It is worth mentioning that TriMap is a DR method that is designed to sample the informative triplets from the high-dimensional representation of a set of points and assign weights to these triplets to reflect the relative similarities of these points. Although TriMap can also be used for the triplet embedding task, we only focus on the DR results 6.
112
+
113
+ # 3.1 EFFECT OF DIFFERENT PARAMETERS
114
+
115
+ We briefly discuss the effect of different parameters, namely the total number of triplets $| \tau |$ and the $\gamma$ -scaled log-transformation, on the quality of the embedding. TriMap is particularly robust to the number of sampled triplet for constructing the embedding. This can be explained by the high amount of redundancy in the triplets (the triplets $( i , j , k )$ and $\bar { ( } i , j , k ^ { \prime } )$ convey the same information if $k$ and $k ^ { \prime }$ are nearest neighbors and also mapped nearby). In Figure $\textcircled { 3 }$ we consider various values for $m$ , $m ^ { \prime }$ , and $r$ for the MNIST dataset while fixing the remaining parameters. In fact, using large number of triplets can sometimes introduce an overhead and require larger number of iterations to converge.
116
+
117
+ A more important parameter is $\gamma$ which controls the trade-off between the local and global accuracy. Larger values of $\gamma$ increases the relative importance of triplets with smaller weights. This causes the method to focus on the nearest-neighbor points rather than the points that are far away, thus improving the local accuracy. On the other hand, improving the local accuracy can impair the global accuracy. In Figure $^ { 2 , }$ we plot the $\gamma$ -scaled log-transformation for various $\gamma$ values and illustrate the results on MNIST without the log-transformation as well as the results with different $\gamma$ values. For larger values of $\gamma$ the clusters tend to become more compressed and as a result, the nearest-neighbor accuracy is improved. On the other hand, the global score starts to decrease for larger $\gamma$ values.
118
+
119
+ ![](images/2ce1b1fc67b1b7febaf375f4781a2a98d8cfd034c15252995fbc93981b425354.jpg)
120
+ Figure 5: Visualizations of different datasets using t-SNE, UMAP, TriMap, and PCA. Each row corresponds to one dataset and each column represents one method. The values of nearest neighbor accuracy and global score are shown as a pair (NN,GS) on top of each figure.
121
+
122
+ # 4 EXPERIMENTS
123
+
124
+ In this section, we apply TriMap on a set of real-world as well as synthetic datasets and compare the results to t-SNE, LargeVis, UMAP, and PCA methods. The datasets used in our experiments are listed in Table 1 and a short description is given in the appendix. All experiments are conducted on a single machine with $2 . 6 \ : \mathrm { G H z }$ Intel Core i5 CPU and $1 6 \mathrm { \ G B }$ of memory. We limit the runtime of each algorithm to 12 hours. For implementations, we use the default sklearn implementation for t-SNE and the official implementations of LargeVis and UMAP provided by the authors7,8. Due to lack of space, we provide the comparison to the LargeVis results as well additional TriMap results on the larger datasets in the appendix.
125
+
126
+ ![](images/c30bd6f21a0a26542831274847c6c7fa12491842072df61b0d6c9e9ef3c98985.jpg)
127
+ Figure 5: Visualizations of different datasets (continued) using t-SNE, UMAP, TriMap, and PCA. Each row corresponds to one dataset and each column represents one method. The values of nearest neighbor accuracy and global score are shown as a tuple (NN,GS) on top of each figure.
128
+
129
+ In order to have a fair comparison, we use the default parameter values for all methods, including ours $\mathbf { \Phi } _ { m } = 1 0 \mathbf { \Phi } $ , $m ^ { \prime } = 5$ , $r \ = \ 5$ , $\gamma ~ = ~ 5 0 0$ , and 400 iterations). Also to reduce the overhead induced by the dimensionality of the data in the nearest-neighbor search step, we reduce the number of dimensions of the dataset to 100 if necessary, using the PCA method. To evaluate the local performance, we show the nearest-neighbor accuracy of each result. We also show the GS as a measure of global performance. The performance measures are shown on top of each figure as a pair (NN, GS).
130
+
131
+ # 4.1 RUNTIME
132
+
133
+ The runtime of the methods are provided in Table $^ 1$ in the hh:mm:ss format. We limit the runtime of each method to 12 hours. As can be seen from the results, TriMap provides excellent runtime and outperforms all the other methods in most cases. Also, TriMap easily scales to millions of points while the other methods exceed the time limit or run out of memory. For instance, UMAP causes an out of memory error for datasets larger than ${ \sim } 4 \mathbf { M }$ points.
134
+
135
+ # 4.2 VISUALIZATIONS
136
+
137
+ The visualizations of the datasets using TriMap as well as the other competing methods are shown in Figure $5$ and $\bigtriangledown$ For some results, we provide a zoomed in snippet over the main figure to provide a more detailed illustration. Overall, TriMap preserves the underlying global structure of the data better than the other competing methods. This is reflected by the larger GS values for TriMap as well as visually comparing the embeddings to the PCA result. For example, TriMap recovers the continuous structure of the TV news dataset and separates the remaining outliers in the data which are also identified by the PCA method. This can be verified by comparing the placement of an example outlier point, marked with a red $\times$ , by the different methods: TriMap shows this point among other outliers whereas t-SNE and UMAP fail to uncover this information. Also, the global score of TriMap on this dataset is much higher than the other methods. Further discussion is given in the appendix.
138
+
139
+ ![](images/96f7feaeec77ebd9f9917f45d0ce034c8fd693edd822483e4711782fd49320fc.jpg)
140
+ Figure 6: Visualizations of Covertype and RCV1 datasets using UMAP, TriMap, and PCA, and visualizations of the Character Font Images dataset using LargeVis, TriMap, and PCA. The values of nearest neighbor accuracy and global score are shown as a tuple (NN,GS) on top of each figure.
141
+
142
+ # 5 CONCLUSION AND FUTURE WORK
143
+
144
+ TriMap is a fast and efficient method that can be easily applied to large datasets. While TriMap is extremely effective for uncovering the global structure of the data, other methods such as t-SNE can provide additional insight about the local neighborhood of individual points. As a future research direction, we consider using pairwise constraints along with triplet constraints to improve the local accuracy. The current implementation of TriMap utilizes a single core. Parallel implementation of the method that can exploit multiple cores is another future direction. Furthermore, the global accuracy is measured in terms of the global score which is based on the assumption that linear projection obtained by PCA is globally optimal. While our global score can provide insight about the global accuracy of the embedding in many cases, it appears to be ineffective when the data is highly non-linear or contains a large amount of outliers. Developing non-linear and more robust global performance measures could significantly improve the assessment of the DR results and provide guidelines for developing more accurate DR techniques.
145
+
146
+ # REFERENCES
147
+
148
+ Ehsan Amid, Aristides Gionis, and Antti Ukkonen. Semi-supervised kernel metric learning using relative comparisons. arXiv preprint arXiv:1612.00086, 2016.
149
+ Laurens van der Maaten and Geoffrey Hinton. Visualizing data using t-sne. Journal of machine learning research, 9(Nov):2579–2605, 2008.
150
+ Leland McInnes, John Healy, and James Melville. Umap: Uniform manifold approximation and projection for dimension reduction. arXiv preprint arXiv:1802.03426, 2018.
151
+ Karl Pearson. Liii. on lines and planes of closest fit to systems of points in space. The London, Edinburgh, and Dublin Philosophical Magazine and Journal of Science, 2(11):559–572, 1901.
152
+ Vin D Silva and Joshua B Tenenbaum. Global versus local methods in nonlinear dimensionality reduction. In Advances in neural information processing systems, pp. 721–728, 2003.
153
+ Jian Tang, Jingzhou Liu, Ming Zhang, and Qiaozhu Mei. Visualizing large-scale and highdimensional data. In Proceedings of the 25th international conference on world wide web, pp. 287–297. International World Wide Web Conferences Steering Committee, 2016.
154
+ Laurens Van Der Maaten and Kilian Weinberger. Stochastic triplet embedding. In 2012 IEEE International Workshop on Machine Learning for Signal Processing, pp. 1–6. IEEE, 2012.
155
+ Jarkko Venna and Samuel Kaski. Local multidimensional scaling with controlled tradeoff between trustworthiness and continuity. In Proceedings of 5th Workshop on Self-Organizing Maps, pp. 695–702. Citeseer, 2005.
156
+ Jarkko Venna, Jaakko Peltonen, Kristian Nybo, Helena Aidos, and Samuel Kaski. Information retrieval perspective to nonlinear dimensionality reduction for data visualization. Journal of Machine Learning Research, 11(Feb):451–490, 2010.
157
+ Lihi Zelnik-Manor and Pietro Perona. Self-tuning spectral clustering. In Advances in neural information processing systems, pp. 1601–1608, 2005.
158
+
159
+ # A DATASETS
160
+
161
+ The datasets used in the experiments are listed below. All datasets are publicly available online and a download link is provided.
162
+
163
+ • COIL- ${ \bf \nabla } \cdot 2 { \bf 0 } ^ { 9 }$ (1440): gray-scale images of 20 objects in uniformly sampled orientations (5 degrees of rotation, 72 images per object). Each image is pre-processed by having the background removed and cropped into size $1 2 8 \times 1 2 8$ . $\mathbf { U S P S } ^ { 1 0 }$ (11K): images of handwritten digits (0–9) of size $1 6 \times 1 6$ . Epileptic Seizure11 (11.5K): EEG signal recordings of brain activity for seizure recognition. It contains 178-dimensional vectors belonging to 5 categories.
164
+ 20 Newsgroup11 (18K): newsgroup posts categorized into 20 topics. We use a TF-IDF representation of the words in each document as the features.
165
+ Tabula Muris12 $( \sim 5 4 \mathrm { K } )$ : single cell transcriptome data from the mouse from 20 organs.
166
+ • MNIST13 (70K): images of handwritten digits (0–9) of size $2 8 \times 2 8$ .
167
+ • Fashion MNIST14 (70K): gray-scale images of clothing items such as t-shirt, pullover, bag, etc. of size $2 8 \times 2 8$ .
168
+ TV News11 $( \sim 1 2 9 \mathrm { K } )$ : audio-visual features from TV news broadcast categorized into commercial and non-commercial.
169
+ • $\mathbf { 3 6 0 K + }$ Lyrics15 $( \sim 3 6 2 \mathrm { K } )$ : lyrics of songs from 12 different genres. We group similar genres together (metal-rock, R&B-pop, etc.) to form 7 groups. We use the TF-IDF representation of the words in the song as the features. Covertype11 $( \sim 5 8 1 \mathrm { K } )$ : cartographic features for forest cover type prediction.
170
+ • $\mathbf { R C V 1 } ^ { 1 6 }$ (800K): Reuters Corpus Volume I archive of categorized newswire stories. Character Font Images11 $( { \sim } 1 . 7 \mathrm { M } )$ : images of character from scanned and computer generated fonts.
171
+ • $\mathbf { K D D C u p 9 9 } ^ { \mathrm { 1 1 } }$ $( { \sim } 4 . 9 \mathrm { { M } ) }$ : computer network intrusion detection.
172
+ • $\mathbf { H } \mathbf { I } \mathbf { G } \mathbf { G } \mathbf { S } ^ { 1 1 }$ (11M): Higgs bosons recognition from a background process.
173
+
174
+ # B MORE VISUALIZATIONS
175
+
176
+ We compare the results of TriMap to LargeVis in Figure 7 and 8. We also provide more visualizations obtained using TriMap in Figure 9.
177
+
178
+ # C DISCUSSION
179
+
180
+ We briefly discuss the results of TriMap and draw a comparison to the other methods.
181
+
182
+ TriMap generally provides better global accuracy compared to the competing methods. It also successfully maintains the continuity of the underlying manifold. This can be seen from the COIL-20 result where certain clusters are located farther away from the remaining clusters. However, the underlying structure for the main cluster resembles the one provided by the other methods. TriMap also preserves the continuous structure in the Fashion MNIST and the TV News datasets.
183
+
184
+ TriMap is also efficient in uncovering the possible outliers in the data. For instance, PCA reveals a large number of outliers in the Tabula Muris and the $3 6 0 \mathrm { + K }$ Lyrics datasets. These outliers are located far away from the main clusters in the TriMap results. However, the same points are located very close to the remaining points in the t-SNE results.
185
+
186
+ <table><tr><td>http://www.cs.columbia.edu/CAvE/software/softlib/coil-20.php</td></tr><tr><td>https://www.kaggle.com/bistaumanga/usps-dataset</td></tr><tr><td>http://archive.ics.uci.edu/ml/index.php</td></tr><tr><td>https://tabula-muris.ds.czbiohub.org/</td></tr><tr><td>http://yann.lecun.com/exdb/mnist/</td></tr><tr><td>https://github.com/zalandoresearch/fashion-mnist</td></tr><tr><td>https://www.kaggle.com/gyani95/380000-lyrics-from-metrolyrics</td></tr><tr><td>https://scikit-learn.org/0.18/datasets/rcv1.html</td></tr></table>
187
+
188
+ ![](images/1b3d08ee2fd1e362cbb60fdc07451f5e9efbec7336f6557e5cc45d24a6ff6924.jpg)
189
+ Figure 7: Visualizations of different datasets using LargeVis, TriMap, and PCA. Each row corresponds to one dataset and each column represents one method. The values of nearest neighbor accuracy and global score are shown as a pair (NN,GS) on top of each figure.
190
+
191
+ ![](images/02894110afa287f8baca3934fc4118784cc7dec51a228d2a276abdd1c244e9a6.jpg)
192
+ Figure 7: Visualizations of different datasets (continued) using LargeVis, TriMap, and PCA. Each row corresponds to one dataset and each column represents one method. The values of nearest neighbor accuracy and global score are shown as a tuple (NN,GS) on top of each figure.
193
+
194
+ Additionally, both t-SNE and LargeVis tend to form spurious clusters by splitting the underlying connected manifold. This can be seen from the TV News results and the result of LargeVis on the Covertype dataset.
195
+
196
+ Finally, notice that in some cases GS fails to reflect the global accuracy of the embeddings. This can be seen from the low GS values for all methods on the Covertype dataset. GS may become uninformative when there exists a high degree of non-linearity in the data that cannot be reflected using PCA. GS also cannot reflect the accuracy of the embedding in uncovering single outliers. Developing more accurate global measures for these scenarios is a future research direction.
197
+
198
+ ![](images/cf9669f5038690e85b2e3c5971d63271a86fb8c99aa4da0cb5ee4f8f808801dd.jpg)
199
+ Figure 8: Visualizations of Covertype and RCV1 datasets using LargeVis, TriMap, and PCA, and visualizations of the Character Font Images dataset using LargeVis, TriMap, and PCA. The values of nearest neighbor accuracy and global score are shown as a tuple (NN,GS) on top of each figure.
200
+
201
+ ![](images/3861d063bab8a11cd7e97eb87ff420798a417be26fec70be2875a5b800d7374e.jpg)
202
+ Figure 9: Visualizations of KKDCup99 and HIGGS datasets TriMap and PCA. Each row corresponds to one dataset and each column represents one method. The values of nearest neighbor accuracy and global score are shown as a tuple (NN,GS) on top of each figure. TriMap shows more structure for both datasets than PCA. Note that GS is uninformative for the KDDCup99 dataset.
md/train/BkeStsCcKQ/BkeStsCcKQ.md ADDED
@@ -0,0 +1,259 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # CRITICAL LEARNING PERIODS IN DEEP NETWORKS
2
+
3
+ Alessandro Achille ∗ Department of Computer Science University of California, Los Angeles achille@cs.ucla.edu
4
+
5
+ Matteo Rovere ∗
6
+ Ann Romney Center for Neurologic Diseases
7
+ Brigham and Women’s Hospital and Harvard Medical School
8
+ mrovere@bwh.harvard.edu
9
+
10
+ # Stefano Soatto
11
+
12
+ Department of Computer Science University of California, Los Angeles soatto@cs.ucla.edu
13
+
14
+ # ABSTRACT
15
+
16
+ Similar to humans and animals, deep artificial neural networks exhibit critical periods during which a temporary stimulus deficit can impair the development of a skill. The extent of the impairment depends on the onset and length of the deficit window, as in animal models, and on the size of the neural network. Deficits that do not affect low-level statistics, such as vertical flipping of the images, have no lasting effect on performance and can be overcome with further training. To better understand this phenomenon, we use the Fisher Information of the weights to measure the effective connectivity between layers of a network during training. Counterintuitively, information rises rapidly in the early phases of training, and then decreases, preventing redistribution of information resources in a phenomenon we refer to as a loss of “Information Plasticity”. Our analysis suggests that the first few epochs are critical for the creation of strong connections that are optimal relative to the input data distribution. Once such strong connections are created, they do not appear to change during additional training. These findings suggest that the initial learning transient, under-scrutinized compared to asymptotic behavior, plays a key role in determining the outcome of the training process. Our findings, combined with recent theoretical results in the literature, also suggest that forgetting (decrease of information in the weights) is critical to achieving invariance and disentanglement in representation learning. Finally, critical periods are not restricted to biological systems, but can emerge naturally in learning systems, whether biological or artificial, due to fundamental constrains arising from learning dynamics and information processing.
17
+
18
+ # 1 INTRODUCTION
19
+
20
+ Critical periods are time windows of early post-natal development during which sensory deficits can lead to permanent skill impairment (Kandel et al., 2013). Researchers have documented critical periods affecting a range of species and systems, from visual acuity in kittens (Wiesel & Hubel, 1963b; Wiesel, 1982) to song learning in birds (Konishi, 1985). Uncorrected eye defects (e.g., strabismus, cataracts) during the critical period for visual development lead to amblyopia in one in fifty adults.
21
+
22
+ The cause of critical periods is ascribed to the biochemical modulation of windows of neuronal plasticity (Hensch, 2004). In this paper, however, we show that deep neural networks (DNNs), while completely devoid of such regulations, respond to sensory deficits in ways similar to those observed in humans and animal models. This surprising result suggests that critical periods may arise from information processing, rather than biochemical, phenomena.
23
+
24
+ We propose using the information in the weights, measured by an efficient approximation of the Fisher Information, to study critical period phenomena in DNNs. We show that, counterintuitively, the information in the weights does not increase monotonically during training. Instead, a rapid growth in information (“memorization phase”) is followed by a reduction of information (“reorganization” or “forgetting” phase), even as classification performance keeps increasing. This behavior is consistent across different tasks and network architectures. Critical periods are centered in the memorization phase.
25
+
26
+ ![](images/bc9304fdee2c82ef30b5289c45a25326a100eb14cc72ac66532c6b07178c25b9.jpg)
27
+ Figure 1: Final accuracy achieved by a CNN trained with acritical period for this deficit in the ANN: if the blur is not removed within tFigure 1: DNNs exhibit critical periods. (A) Final accuracy achieved by a CNN trained with final performance is sa cataract-like deficit as a function of the training epoch $N$ rely decreased when compared to the baseline (fromat which the deficit is removed (solid Performance is permanently impaired if the deficit is not corrected early enough, regardless of howabsence of a deficit, to more than 18% when the blur is present over 140 epochline). Performance is permanently impaired if the deficit is not corrected early enough, regardless The profile of the curve is also strikingly similar to the one obtained in kittensof how much additional training is performed. As in animal models, critical periods coincide with learning phase during which test accuracy would rapidly increase in the absence of deficits (dashed).from near birth and whose visual acuity upon eye-opening was tested and ploof the deficit window (Mitchell, 1988). Just like in humans and animal mthe early learning phase during which, in the absence of deficits, test accuracy would rapidly inFor comparison, we report acuity for kittens monocularly deprived since birth and tested at theperiods are characteristic of early development), the critical period in the Dcrease (dashed). (B) For comparison, we report acuity for kittens monocularly deprived since birth time of eye-opening (solid), and normal development visual acuity in kittens as a function of agethe initial rapid learning phase. At this stage, the network is quickly learningand tested at the time of eye-opening (solid), and normal visual acuity development (in kittens) (dashed) (Giffin & Mitchell, 1978; Mitchell, 1988).test error plateaus and the longer asymptotic convergence phase begins.as a function of their age (dashed) (Giffin & Mitchell, 1978; Mitchell, 1988). Sensitivity during Sensitivity to deficit. To quantify more accurately the sensitivity of the Alearning: (C) Final test accuracy of a DNN as a function of the onset of a short 40-epoch deficit. throughout its early learning phase, we introduced the deficit in a short constanThe decrease in the final performance can be used to measure the sensitivity to deficits. The most artificial neural networks (ANNs) are only loosely inspired by biological systems (Hassabis et al.,starting at different epochs, and then measured the decrease in the ANN’s fisensitive epochs corresponds to the early rapid learning phase, before the test error (dashed line) 2017). onset of the deficit. We observe that the network’s sensitivity to blurring peakbegins to plateau. Afterwards, the network is largely unaffected by the temporary deficit. (D) This the early rapid learning phase (around 30 epochs), while later deficits produccan be compared with changes in the degree of functional disconnection (normalized numbers of Most studies to date have focused either on the behavior of networks at convergence (Representationsimilar experiment was also performed on kittens by Olson and Freeman, usiV1 monocular cells disconnected from the contralateral eye) as a function of the kittens’ age at the Learning) or on the asymptotic properties of the numerical scheme used to get there (Optimization). onset of a 10-12-day deficit window (Olson & Freeman, 1980). Dashed lines are as in A and B The role of the initial transient, especially itrespectively, up to a re-scaling of the y-axis.
28
+
29
+ 1 We employed this method, instead of a simpler Gaussian blur, since it has a veryOur findings, described in Section 2, indicate that the early transient is critical in determining the the quantification of information loss clearer.final solution of the optimization associated with training an artificial neural network. In particular, the effects of sensory deficits during a critical period cannot be overcome, no matter how much 3additional training is performed. Yet most theoretical studies have focused on the network behavior In animals, sensory deficits introduced during critical periods induce changes in the architectureafter convergence (Representation Learning) or on the asymptotic properties of the optimization of the corresponding areas (Dascheme used for training (SGD).
30
+
31
+ the weights of the network as a proxy to measure its “effective connectivity”, that is, the density ofTo study this early phase, in Section 3, we use the Fisher Information to quantify the effective connections that are effectively used by the network in order to solve the task. Like others before usconnectivity of a network during training, and introduce the notion of Information Plasticity in (Shwartz-Ziv & Tishby, 2017), we observe two distinct phases during the training, first a “learninglearning. Information Plasticity is maximal during the memorization phase, and decreases in the phase” in which the Fisher Information of the weights increases as the network learns from the data,reorganization phase. We show that deficit sensitivity during critical periods correlates strongly followed by a “consolidation”with the effective connectivity.
32
+
33
+ and stabilizes. Sensitivity to critical-period-inducing deficits is maximal exactly when the FisherIn Section 4 we discuss our contribution in relation to previous work. When considered in conjuncInformation peaks.tion with recent results on representation learning (Achille & Soatto, 2018), our findings indicate A layer-wise analysis of the network’s effective connectivity shows that, in the tasks and deficitsthat forgetting (reducing information in the weights) is critical to achieving invariance to nuisance we consider, the hierarchy of low-level and high-level features in the training data is a key aspectvariability as well as independence of the components of the representation, but comes at the price of behind the observed phenomena. In particular, our experiments suggest that the existence of criticalreduced adaptability later in the training. We also hypothesize that the loss of physical connectivity periods in deep neural networks depends on the inability of the network to change its effectivein biology (neural plasticity) could be a consequence, rather than a cause, of the loss of Informaconnectivity pattern in order to process different information (in response to deficit removal). Wetion Plasticity, which depends on how the information is distributed throughout a network during call this phenomenon, which is not mediated by any external factors, a loss of the “Informationthe early stages of learning. These results also shed light on the common practice of pre-training Plasticity” of the network.a model on a task and then fine-tune it for another, one of the most rudimentary forms of transfer learning. Our experiments show that, rather than helpful, pre-training can be detrimental, even if the tasks are similar (e.g., same labels, slightly blurred images).
34
+
35
+ # 3 DEEP ARTIFIC2 EXPERIMENTS
36
+
37
+ A notable example of critical period-inducing deficit, which also commonly affects humans, is am-A notable example of critical period-related deficit, commonly affecting humans, is amblyopia (reblyopia (reduced visual acuity in one eye) caused unilateral cataracts during infancy or childhoodduced visual acuity in one eye) caused by cataracts during infancy or childhood (Taylor et al., 1979;
38
+
39
+ ![](images/00b00d7863e7d524167c46a58eb25a4f054fb0ee18ad8940fe57666f4d3a1680.jpg)
40
+ Figure 2: (Left) High-level perturbations do not induce a critical period. When the deficit only affects high-level features (vertical flip of the image) or the last layer of the CNN (label permutation), the network does not exhibit critical periods (test accuracy remains largely flat). On the other hand, a sensory deprivation-like deficit (image is replaced by random noise) does cause a deficit, but the effect is less severe than in the case of image blur. (Right) Dependence of the critical period profile on the network’s depth. Adding more convolutional layers increases the effect of the deficit during its critical period (shown here is the decrease in test accuracy due to the deficit with respect to the test accuracy reached without deficits).
41
+
42
+ von Noorden, 1981). Even after surgical correction of cataracts, the ability of the patients to regain normal acuity in the affected eye depends both on the duration of the deficit and on its age of onset, with earlier and longer deficits causing more severe effects. In this section, we aim to study the effects of similar deficits in DNNs. To do so, we train a standard All-CNN architecture based on Springenberg et al. (2014) (see Appendix A) to classify objects in small $3 2 \times 3 2$ images from the CIFAR-10 dataset (Krizhevsky & Hinton, 2009). We train with SGD using an exponential annealing schedule for the learning rate. To simulate the effect of cataracts, for the first $t _ { 0 }$ epochs the images in the dataset are downsampled to $8 \times 8$ and then upsampled back to $3 2 \times 3 2$ using bilinear interpolation, in practice blurring the image and destroying small-scale details.1 After that, the training continues for 160 more epochs, giving the network time to converge and ensuring it is exposed to the same number of uncorrupted images as in the control $t _ { 0 } = 0$ ) experiment.
43
+
44
+ DNNs exhibit critical periods: In Figure 1, we plot the final performance of a network affected by the deficit as a function of the epoch $t _ { 0 }$ at which the deficit is corrected. We can readily observe the existence of a critical period: If the blur is not removed within the first 40-60 epochs, the final performance is severely decreased when compared to the baseline (up to a threefold increase in error). The decrease in performance follows trends commonly observed in animals, and may be qualitatively compared, for example, to the loss of visual acuity observed in kittens monocularly deprived from birth as a function of the length of the deficit (Mitchell, 1988).2
45
+
46
+ We can measure more accurately the sensitivity to a blur deficit during learning by introducing the deficit in a short window of constant length (40 epochs), starting at different epochs, and then measure the decrease in the DNN’s final performance compared to the baseline (Figure 1). Doing this, we observe that the sensitivity to the deficit peaks in the central part of the early rapid learning phase (at around 30 epochs), while introducing the deficit later produces little or no effect. A similar experiment performed on kittens, using a window of 10-12 days during which the animals are monocularly deprived, again shows a remarkable similarity between the profiles of the sensitivity curves (Olson & Freeman, 1980).
47
+
48
+ High-level deficits are not associated with a critical period: A natural question is whether any change in the input data distribution will have a corresponding critical period for learning. This is not the case for neuronal networks, which remain plastic enough to adapt to high-level changes in sensory processing (Daw, 2014). For example, it is well-reported that even adult humans can rapidly adapt to certain drastic changes, such as the inversion of the visual field (Stratton, 1896; Kohler, 1964). In Figure 2, we observe that DNNs are also largely unaffected by high-level deficits – such as vertical flipping of the image, or random permutation of the output labels: After deficit correction, the network quickly recovers its baseline performance. This hints at a finer interplay between the structure of the data distribution and the optimization algorithm, resulting in the existence of a critical period.
49
+
50
+ ![](images/660e0e61644dd32c7fc44810bd7f264b523bb08dd7ee31b4bf11198c592fbc9c.jpg)
51
+ Figure 3: Critical periods in different DNN architectures and optimization schemes. (Left) Effect of an image blur deficit in a ResNet architecture trained on CIFAR-10 with learning rate annealing and (Center) in a deep fully-connected network trained on MNIST with a fixed learning rate. Different architectures, using different optimization methods and trained on different datasets, still exhibit qualitatively similar critical period behavior. (Right) Same experiment as in Figure 1, but using a fixed learning rate instead of an annealing scheme. Although the time scale of the critical period is longer, the trends are similar, supporting the notion that critical periods cannot be explained solely in terms of the loss landscape of the optimization. (Bottom Left) Networks trained without weight decay have shorter and sharper critical periods. Gradually increasing the weight decay makes the critical period longer, until the point where it stops training properly. (Bottom Right) Using a different optimization method (Adam) we observe a similar behavior to standard SGD.
52
+
53
+ Sensory deprivation: We now apply to the network a more drastic deficit, where each image is replaced by white noise. Figure 2 shows hows this extreme deficit exhibits a remarkably less severe effect than the one obtained by only blurring images: Training the network with white noise does not provide any information on the natural images, and results in milder effects than those caused by a deficit (e.g., image blur), which instead conveys some information, but leads the network to (incorrectly) learn that no fine structure is present in the images. A similar effect has been observed in animals, where a period of early sensory deprivation (dark-rearing) can lengthen the critical period and thus cause less severe effects than those documented in light-reared animals (Mower, 1991). We refer the reader to Appendix C for a more detailed comparison between sensory deprivation and training on white noise.
54
+
55
+ Architecture, depth, and learning rate annealing: Figure 3 shows that a fully-connected network trained on the MNIST digit classification dataset also shows a critical period for the image blur deficit. Therefore, the convolutional structure is not necessary, nor is the use of natural images. Similarly, a ResNet-18 trained on CIFAR-10 also has a critical period, which is also remarkably sharper than the one found in a standard convolutional network (Figure 1). This is especially interesting, since ResNets allow for easier backpropagation of gradients to the lower layers, thus suggesting that the critical period is not caused by vanishing gradients. However, Figure 2 (Right) shows that the presence of a critical period does indeed depend critically on the depth of the network. In Figure 3, we confirm that a critical period exists even when the network is trained with a constant learning rate, and therefore cannot be explained by an annealed learning rate in later epochs.
56
+
57
+ Optimization method and weight decay: Figure 3 (Bottom Right) shows that when using Adam as the optimization scheme, which renormalizes the gradients using a running mean of their first two moments, we still observe a critical period similar to that of standard SGD. However, changing the hyperparameters of the optimization can change the shape of the critical period: In Figure 3 (Bottom Left) we show that increasing weight decay makes critical periods longer and less sharp. This can be explained as it both slows the convergence of the network, and it limits the ability of higher layers to change to overcome the deficit, thus encouraging lower layers to also learn new features.
58
+
59
+ ![](images/8fd14e4f6cfa6c6727f089276be690cb67054a32edc04eeafeffa56fca6da7f3.jpg)
60
+ Figure 4: Critical periods in DNNs are traced back to changes in the Fisher Information. (Left) Trace of the Fisher Information of the network weights as a function of the training epoch (blue line), showing two distinct phases of training: First, information sharply increases, but once test performance starts to plateau (green line), the information in the weights decreases during a “consolidation” phase. Eventually less information is stored, yet test accuracy improves slightly (green line). The weights’ Fisher Information correlates strongly with the networks sensitivity to critical periods, computed as in Figure 1 using both a window size of 40 and 60, and fitted here to the Fisher Information using a simple exponential fit. (Center) Recalling the connection between FIM ad connectivity, we may compare it to synaptic density during development in the visual cortex of macaques (Rakic et al., 1986). Here too, a rapid increase in connectivity is followed by elimination of synapses (pruning) continuing throughout life. (Right) Effects of critical period-inducing blurring on the Fisher Information: The impaired network uses more information to solve the task, compared to training in the absence of a deficit, since it is forced to memorize the labels case by case.
61
+
62
+ # 3 FISHER INFORMATION ANALYSIS
63
+
64
+ We have established empirically that, in animals and DNNs alike, the initial phases of training are critical to the outcome of the training process. In animals, this strongly relates to changes in the brain architecture of the areas associated with the deficit (Daw, 2014). This is inevitably different in artificial networks, since their connectivity is formally fixed at all times during training. However, not all the connections are equally useful to the network: Consider a network encoding the approximate posterior distribution $p _ { w } ( y | x )$ , parameterized by the weights $w$ , of the task variable $y$ given an input image $x$ . The dependency of the final output from a specific connection can be estimated by perturbing the corresponding weight and looking at the magnitude of the change in the final distribution. Specifically, given a perturbation $w ^ { \prime } = w + \delta w$ of the weights, the discrepancy between the $p _ { w } ( y | x )$ and the perturbed network output $p _ { w ^ { \prime } } ( y | x )$ can be measured by their KullbackLeibler divergence, which, to second-order approximation, is given by:
65
+
66
+ $$
67
+ \begin{array} { r } { \mathbb { E } _ { x } \operatorname { K L } \big ( p _ { w ^ { \prime } } ( y | x ) \| p _ { w } ( y | x ) \big ) = \delta w \cdot F \delta w + o ( \delta w ^ { 2 } ) , } \end{array}
68
+ $$
69
+
70
+ where the expectation over $x$ is computed using the empirical data distribution $\hat { Q } ( x )$ given by the dataset, and
71
+
72
+ $$
73
+ F : = \mathbb { E } _ { x \sim \hat { Q } ( x ) } \mathbb { E } _ { y \sim p _ { w } ( y | x ) } [ \nabla _ { w } \log p _ { w } ( y | x ) \nabla _ { w } \log p _ { w } ( y | x ) ^ { T } ]
74
+ $$
75
+
76
+ is the Fisher Information Matrix (FIM). The FIM can thus be considered a local metric measuring how much the perturbation of a single weight (or a combination of weights) affects the output of the network (Amari $\&$ Nagaoka, 2000). In particular, weights with low Fisher Information can be changed or “pruned” with little effect on the network’s performance. This suggests that the Fisher Information can be used as a measure of the effective connectivity of a DNN, or, more generally, of the “synaptic strength” of a connection (Kirkpatrick et al., 2017). Finally, the FIM is also a semidefinite approximation of the Hessian of the loss function (Martens, 2014) and hence of the curvature of the loss landscape at a particular point $w$ during training, providing an elegant connection between the FIM and the optimization procedure (Amari & Nagaoka, 2000), which we will also employ later.
77
+
78
+ Unfortunately, the full FIM is too large to compute. Rather, we use its trace to measure the global or layer-wise connection strength, which we can compute efficiently using (Appendix A):
79
+
80
+ $$
81
+ \mathrm { t r } ( F ) = \mathbb { E } _ { \boldsymbol { x } \sim \hat { Q } ( \boldsymbol { x } ) } \mathbb { E } _ { \boldsymbol { y } \sim p _ { w } ( \boldsymbol { y } \vert \boldsymbol { x } ) } [ \Vert \nabla _ { w } \log p _ { w } ( \boldsymbol { y } \vert \boldsymbol { x } ) \Vert ^ { 2 } ] .
82
+ $$
83
+
84
+ In order to capture the behavior of the off-diagonal terms, we also tried computing the logdeterminant of the full matrix using the Kronecker-Factorized approximation of Martens & Grosse (2015), but we observed the same qualitative trend as the trace. Since the FIM is a local measure, it is very sensitive to the irregularities of the loss landscape. Therefore, in this section we mainly use ResNets, which have a relatively smooth landscape (Li et al., 2018). For other architectures we use instead a more robust estimator of the FIM based on the injection of noise in the weights (Achille & Soatto, 2018), also described in Appendix A.
85
+
86
+ Two phases of learning: As its name suggests, the FIM can be thought as a measure of the quantity of information about the training data that is contained in the model (Fisher, 1925). Based on this, one would expect the overall strength of the connections to increase monotonically as we acquire information from experience. However, this is not the case: While during an initial phase the network acquires information about the data, which results in a large increase in the strength of the connections, once the performance in the task begins to plateau, the network starts decreasing the overall strength of its connections. However, this does not correspond to a reduction in performance, rather, performance keeps slowly improving. This can be seen as a “forgetting, or “compression” phase, during which redundant connections are eliminated and non-relevant variability in the data is discarded. It is well-established how the elimination (“pruning”) of unnecessary synapses is a fundamental process during learning and brain development (Rakic et al., 1986) (Figure 4, Center); in Figure 4 (Left) an analogous phenomenon is clearly and quantitatively shown for DNNs.
87
+
88
+ Strikingly, these changes in the connection strength are closely related to the sensitivity to criticalperiod-inducing deficits such as image blur, computed using the “sliding window” method as in Figure 1. In Figure 4 we see that the sensitivity closely follows the trend of the FIM. This is remarkable since the FIM is a local quantity computed at a single point during the training of a network in the absence of deficit, while sensitivity during a critical period is computed, using test data, at the end of the impaired network training. Figure 4 (Right) further emphasizes the effect of deficits on the FIM: in the presence of a deficit, the FIM grows and remains substantially higher even after the deficit is removed. This may be attributed to the fact that, when the data are so corrupted that classification is impossible, the network is forced to memorize the labels, therefore increasing the quantity of information needed to perform the same task.
89
+
90
+ Layer-wise effects of deficits: A layer-wise analysis of the FIM sheds further light on how the deficit affects the network. When the network (in this case All-CNN, which has a clearer division among layers than ResNet) is trained without deficits, the most important connections are in the intermediate layers (Figure 5, Left), which can process the input CIFAR-10 image at the most informative intermediate scale. However, if the network is initially trained on blurred data (Figure 5, top right), the strength of the connections is dominated by the top layer (Layer 6). This is to be expected, since the low-level and mid-level structures of the images are destroyed, making the lower layers ineffective. However, if the deficit is removed early in the training (Figure 5, top center), the network manages to “reorganize”, reducing the information contained in the last layer, and, at the same time, increasing the information in the intermediate layers. We refer to these phenomena as changes in “Information Plasticity”. If, however, the data change occurs after the consolidation phase, the network is unable to change its effective connectivity: The connection strength of each layer remains substantially constant. The network has lost its Information Plasticity and is past its critical period.
91
+
92
+ Critical periods as bottleneck crossings: The analysis of the FIM also sheds light on the geometry of the loss function and the learning dynamics. Since the FIM can be interpreted as the local curvature of the residual landscape, Fig. 4 shows that learning entails crossing bottlenecks: In the initial phase the network enters regions of high curvature (high Fisher Information), and once consolidation begins, the curvature decreases, allowing it to cross the bottleneck and enter the valley below. If the statistics change after crossing the bottleneck, the network is trapped. In this interpretation, the early phases of convergence are critical in leading the network towards the “right” final valley. The end of critical periods comes after the network has crossed all bottlenecks (and thus learned the features) and entered a wide valley (region of the weight space with low curvature, or low Fisher Information).
93
+
94
+ ![](images/27672e0cea4143362994d26d892692368ca07dbec1e4ecad3dc5ce7e4237fa85.jpg)
95
+ Figure 5: Normalized quantity of information contained in the weights of each layer as a function of the training epoch. (Top Left) In the absence of deficits, the network relies mostly on the middle layers (3-4-5) to solve the task. (Top Right) In the presence of an image blur deficit until epoch 100, more resources are allocated to the higher layers (6-7) rather than to the middle layers. The blur deficit destroys low- and mid-level features processed by those layers, leaving only the global features of the image, which are processed by the higher layers. Even if the deficit is removed, the middle layers remain underdeveloped. (Top Center) When the deficit is removed at an earlier epoch, the layers can partially reconfigure (notice, e.g., the fast loss of information of layer 6), resulting in less severe long-term consequences. We refer to the redistribution of information and the relative changes in effective connectivity as “Information Plasticity”. (Bottom row) Same plots, but using a vertical flip deficit, which does not induce a critical period. As expected, the quantity of information in the layers is not affected.
96
+
97
+ # 4 DISCUSSION AND RELATED WORK
98
+
99
+ Critical periods have thus far been considered an exclusively biological phenomenon. At the same time, the analysis of DNNs has focused on asymptotic properties and neglected the initial transient behavior. To the best of our knowledge, we are the first to show that artificial neural networks exhibit critical period phenomena, and to highlight the critical role of the transient in determining the asymptotic performance of the network. Inspired by the role of synaptic connectivity in modulating critical periods, we introduce the use of Fisher Information to study this initial phase. We show that the initial sensitivity to deficits closely follows changes in the FIM, both global, as the network first rapidly increases and then decreases the amount of stored information, and layer-wise, as the network “reorganizes” its effective connectivity in order to optimally process information.
100
+
101
+ Our work naturally relates to the extensive literature on critical periods in biology. Despite artificial networks being an extremely reductionist approximation of neuronal networks, they exhibit behaviors that are qualitatively similar to the critical periods observed in human and animal models. Our information analysis shows that the initial rapid memorization phase is followed by a loss of Information Plasticity which, counterintuitively, further improves the performance. On the other hand, when combined with the analysis of Achille & Soatto (2018) this suggests that a “forgetting” phase may be desirable, or even necessary, in order to learn robust, nuisance-invariant representations.
102
+
103
+ The existence of two distinct phases of training has been observed and discussed by Shwartz-Ziv & Tishby (2017), although their analysis builds on the (Shannon) information of the activations, rather than the (Fisher) information in the weights. On a multi-layer perceptron (MLP), Shwartz-Ziv & Tishby (2017) empirically link the two phases to a sudden increase in the gradients’ covariance. It may be tempting to compare these results with our Fisher Information analysis. However, it must be noted that the FIM is computed using the gradients with respect to the model prediction, not to the ground truth label, leading to important qualitative differences. In Figure 6, we show that the covariance and norm of the gradients exhibit no clear trends during training with and without deficits, and, therefore, unlike the FIM, do not correlate with the sensitivity to critical periods. However, a connection between our FIM analysis and the information in the activations can be established based on the work of Achille & Soatto (2018), which shows that the FIM of the weights can be used to bound the information in the activations. In fact, we may intuitively expect that pruning of connections naturally leads to loss of information in the corresponding activations. Thus, our analysis corroborates and expands on some of the claims of Shwartz-Ziv & Tishby (2017), while using an independent framework.
104
+
105
+ Aside from being more closely related to the deficit sensitivity during critical periods, Fisher’s Information also has a number of technical advantages: Its diagonal is simple to estimate, even on modern state-of-the-art architectures and compelling datasets, and it is less sensitive to the choice estimator of mutual information, avoiding some of the common criticisms to the use of information quantities in the analysis of deep learning models. Finally, the FIM allows us to probe fine changes in the effective connectivity across the layers of the network (Figure 5), which are not visible in Shwartz-Ziv & Tishby (2017).
106
+
107
+ A complete analysis of the activations should account not only for the amount of information (both task- and nuisance-related), but also for its accessibility, e.g., how easily task-related information can be extracted by a linear classifier. Following a similar idea, Montavon et al. (2011) aim to study the layer-wise, or “spatial” (but not temporal) evolution of the simplicity of the representation by performing a principal component analysis (PCA) of a radial basis function (RBF) kernel embedding of each layer representation. They show that, on a multi-layer perceptron, task-relevant information increasingly concentrate on the first principal components of the representation’s embedding, implying that they become more easily “accessible” layer after layer, while nuisance information (when it is codified at all) is encoded in the remaining components. In our work we instead focus on the temporal evolution of the weights. However, it’s important to notice that a network with simpler weights (as measured by the FIM) also requires a simpler smooth representation (as measured, e.g., by the RBF embedding) in order to operate properly, since it needs to be resistant to perturbations of the weights. Thus our analysis is wholly compatible with the intuitions of Montavon et al. (2011). It would also be interesting to study the joint spatio-temporal evolution of the network using both frameworks at once.
108
+
109
+ One advantage of focusing on the information of the weights rather than on the activations, or behavior of the network, is to have a readout of the “effective connectivity” during critical periods, which can be compared to similar readouts in animals. In fact, “behavioral” readouts upon deficit removal, both in artificial and neuronal networks, can potentially be confounded by deficit-coping changes at different levels of the visual pathways (Daw, 2014; Knudsen, 2004). On the other hand, deficits in deprived animals are mirrored by abnormalities in the circuitry of the visual pathways, which we characterize in DNNs using the FIM to study its “effective connectivity”, i.e., the connections that are actually employed by the network to solve the task. Sensitivity to critical periods and the trace of the Fisher Information peak at the same epochs, in accord with the evidence that skill development and critical periods in neuronal networks are modulated by changes (generally experience-dependent) in synaptic plasticity (Knudsen, 2004; Hensch, 2004). Our layer-wise analysis of the Fisher Information (Figure 5) also shows that visual deficits reinforce higher layers to the detriment of intermediate layers, leaving low-level layers virtually untouched. If the deficit is removed after the critical period ends, the network is not able to reverse these effects. Although the two systems are radically different, a similar response can be found in the visual pathways of animal models: Lower levels (e.g., retina, lateral geniculate nucleus) and higher-level visual areas (e.g., V2 and post-V2) show little remodeling upon deprivation, while most changes happen in different layers of V1 (Wiesel & Hubel, 1963a; Hendrickson et al., 1987).
110
+
111
+ An insightful interpretation of critical periods in animal models was proposed by Knudsen (2004): The initial connections of neuronal networks are unstable and easily modified (highly plastic), but as more “samples” are observed, they change and reach a more stable configuration which is difficult to modify. Learning can, however, still happen within the newly created connectivity pattern. This is largely compatible with our findings: Sensitivity to critical-period-inducing deficits peaks when connections are remodeled (Figure 4, Left), and different connectivity profiles are observed in networks trained with and without a deficit (Figure 5). Moreover, high-level deficits such as imageflipping and label permutation, which do not require restructuring of the network’s connections in order to be corrected, do not exhibit a critical period.
112
+
113
+ Applying a deficit at the beginning of the training may be compared to the common practice of pretraining, which is generally found to improve the performance of the network. Erhan et al. (2010) study the somewhat related, but now seldom used, practice of layer-wise unsupervised pre-training, and suggest that it may act as a regularizer by moving the weights of the network towards an area of the loss landscape closer to the attractors for good solutions, and that early examples have a stronger effect in steering the network towards particular solutions. Here, we have shown that pre-training on blurred data can have the opposite effect; i.e., it can severely decrease the final performance of the network. However, in our case, interpreting the deficits effect as moving the network close to a bad attractor is difficult to reconcile with the smooth transition observed in the critical periods, since the network would either converge to this attractor, and thus have low accuracy, or escape completely.
114
+
115
+ Instead, we reconcile our experiments with the geometry of the loss function by introducing a different explanation based on the interpretation of the FIM as an approximation of the local curvature. Figure 4 suggests that SGD encounters two different phases during the network training: At first, the network moves towards high-curvature regions of the loss landscape, while in the second phase the curvature decreases and the network eventually converges to a flat minimum (as observed in Keskar et al. (2017)). We can interpret these as the network crossing narrow bottlenecks during its training in order to learn useful features, before eventually entering a flat region of the loss surface once learning is completed and ending up trapped there. When combining this assumption with our deficit sensitivity analysis, we can hypothesize that the critical period occurs precisely upon crossing of this bottleneck. It is also worth noticing how there is evidence that convergence to flat minima (minima with low curvature) in a DNN correlates with a good generalization performance (Hochreiter & Schmidhuber, 1997; Li et al., 2018; Chaudhari et al., 2017; Keskar et al., 2017). Indeed, using this interpretation, Figure 4 (Right) tells us that networks more affected by the deficit converge to sharper minima. However, we have also found that the performance of the network is already mostly determined during the early “sensitive” phase. The final sharpness at convergence may therefore be an epiphenomenon, rather than the cause of good generalization.
116
+
117
+ # 5 CONCLUSION
118
+
119
+ Our goal in this paper is not so much to investigate the human (or animal) brain through artificial networks, as to understand fundamental information processing phenomena, both in their biological or artificial implementations. It is also not our goal to suggest that, since they both exhibit critical periods, DNNs are necessarily a valid model of neurobiological information processing, although recent work has emphasized this aspect. We engage in an “Artificial Neuroscience” exercise in part to address a technological need to develop “explainable” artificial intelligence systems whose behavior can be understood and predicted. While traditionally well-understood mathematical models were used by neuroscientists to study biological phenomena, information processing in modern artificial networks is often just as poorly understood as in biology, so we chose to exploit well-known biological phenomena as probes to study information processing in artificial networks.
120
+
121
+ Conversely, it would also be interesting to explore ways to test whether biological networks prune connections as a consequences of a loss of Information Plasticity, rather than as a cause. The mechanisms underlying network reconfiguration during learning and development might be an evolutionary outcome obtained under the pressure of fundamental information processing phenomena.
122
+
123
+ # ACKNOWLEDGEMENTS
124
+
125
+ We thank the anonymous reviewers for their thoughtful feedback, and for suggesting new experiments and relevant literature. Supported by ONR N00014-17-1-2072, ARO W911NF-17-1-0304, AFOSR FA9550-15-1-0229 and FA8650-11-1-7156.
126
+
127
+ # REFERENCES
128
+
129
+ Alessandro Achille and Stefano Soatto. Emergence of invariance and disentanglement in deep representations. Journal of Machine Learning Research, 19(1):1947–1980, 2018.
130
+
131
+ Shun-ichi Amari and Hiroshi Nagaoka. Methods of information geometry, volume 191 of Translations of Mathematical Monographs. American Mathematical Society and Oxford University Press, 2000.
132
+
133
+ Martin S Banks, Richard N Aslin, and Robert D Letson. Sensitive period for the development of human binocular vision. Science, 190(4215):675–677, 1975.
134
+
135
+ Pratik Chaudhari, Anna Choromanska, Stefano Soatto, Yann LeCun, Carlo Baldassi, Christian Borgs, Jennifer Chayes, Levent Sagun, and Riccardo Zecchina. Entropy-sgd: Biasing gradient descent into wide valleys. In Proceedings of the International Conference on Learning Representations, 2017.
136
+
137
+ Nigel W Daw. Visual Development. Springer, New York, NY, 3rd edition, 2014.
138
+
139
+ Dumitru Erhan, Yoshua Bengio, Aaron Courville, Pierre-Antoine Manzagol, Pascal Vincent, and Samy Bengio. Why does unsupervised pre-training help deep learning? Journal of Machine Learning Research, 11(Feb):625–660, 2010.
140
+
141
+ Ronald Aylmer Fisher. Theory of statistical estimation. In Mathematical Proceedings of the Cambridge Philosophical Society, volume 22, pp. 700–725. Cambridge University Press, 1925.
142
+
143
+ Fred Giffin and Donald E Mitchell. The rate of recovery of vision after early monocular deprivation in kittens. The Journal of Physiology, 274(1):511–537, 1978.
144
+
145
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 770–778, 2016.
146
+
147
+ Anita E Hendrickson, JA Movshon, Howard M Eggers, Martin S Gizzi, RG Boothe, and Lynne Kiorpes. Effects of early unilateral blur on the macaque’s visual system. ii. anatomical observations. Journal of Neuroscience, 7(5):1327–1339, 1987.
148
+
149
+ Takao K Hensch. Critical period regulation. Annuual review of neuroscience, 27:549–579, 2004.
150
+
151
+ Sepp Hochreiter and Jurgen Schmidhuber. Flat minima. ¨ Neural Computation, 9(1):1–42, 1997.
152
+
153
+ Eric R Kandel, James H Schwartz, Thomas M Jessell, Steven A Siegelbaum, and A James Hudspeth. Principles of Neural Science. McGraw-Hill, New York, NY, 5th edition, 2013.
154
+
155
+ 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. In Proceedings of the International Conference on Learning Representations, 2017.
156
+
157
+ Durk P Kingma, Tim Salimans, and Max Welling. Variational dropout and the local reparameterization trick. In Advances in Neural Information Processing Systems, pp. 2575–2583, 2015.
158
+
159
+ James Kirkpatrick, Razvan Pascanu, Neil Rabinowitz, Joel Veness, Guillaume Desjardins, Andrei A Rusu, Kieran Milan, John Quan, Tiago Ramalho, Agnieszka Grabska-Barwinska, et al. Overcoming catastrophic forgetting in neural networks. Proceedings of the national academy of sciences, 114(13):3521–3526, 2017.
160
+
161
+ Eric I Knudsen. Sensitive periods in the development of the brain and behavior. Journal of cognitive neuroscience, 16(8):1412–1425, 2004.
162
+
163
+ Ivo Kohler. The formation and transformation of the perceptual world. Psychological Issues Monographs. International Universities Press, Inc., New York, NY, 1964.
164
+
165
+ Masakazu Konishi. Birdsong: from behavior to neuron. Annual review of neuroscience, 8(1):125– 170, 1985.
166
+
167
+ Alex Krizhevsky and Geoffrey Hinton. Learning multiple layers of features from tiny images. Technical report, University of Toronto, 2009.
168
+
169
+ Hao Li, Zheng Xu, Gavin Taylor, Christoph Studer, and Tom Goldstein. Visualizing the loss landscape of neural nets. In Advances in Neural Information Processing Systems, pp. 6391–6401, 2018.
170
+
171
+ James Martens. New insights and perspectives on the natural gradient method. arXiv preprint arXiv:1412.1193, 2014.
172
+
173
+ James Martens and Roger Grosse. Optimizing neural networks with kronecker-factored approximate curvature. Proceedings of International Conference on Machine Learning, 37:2408–2417, 2015.
174
+ Donald E Mitchell. The extent of visual recovery from early monocular or binocular visual deprivation in kittens. The Journal of physiology, 395(1):639–660, 1988.
175
+ Gregoire Montavon, Mikio L Braun, and Klaus-Robert M ´ uller. Kernel analysis of deep networks.¨ Journal of Machine Learning Research, 12(Sep):2563–2581, 2011.
176
+ George D Mower. The effect of dark rearing on the time course of the critical period in cat visual cortex. Developmental Brain Research, 58(2):151–158, 1991.
177
+ Carl R Olson and Ralph D Freeman. Profile of the sensitive period for monocular deprivation in kittens. Experimental Brain Research, 39(1):17–21, 1980.
178
+ Pasko Rakic, Jean-Pierre Bourgeois, Maryellen F Eckenhoff, Nada Zecevic, and Patricia S Goldman-Rakic. Concurrent overproduction of synapses in diverse regions of the primate cerebral cortex. Science, 232(4747):232–235, 1986.
179
+ Ravid Shwartz-Ziv and Naftali Tishby. Opening the black box of deep neural networks via information. arXiv preprint arXiv:1703.00810, 2017.
180
+ Jost T Springenberg, Alexey Dosovitskiy, Thomas Brox, and Martin Riedmiller. Striving for simplicity: The all convolutional net. arXiv preprint arXiv:1412.6806, 2014.
181
+ George M Stratton. Some preliminary experiments on vision without inversion of the retinal image. Psychological Review, 3(6):611–617, 1896.
182
+ David Taylor et al. Critical period for deprivation amblyopia in children. Transactions of the ophthalmological societies of the United Kingdom, 99(3):432–439, 1979.
183
+ Gunter K von Noorden. New clinical aspects of stimulus deprivation amblyopia. American journal of ophthalmology, 92(3):416–421, 1981.
184
+ Torsten N Wiesel. Postnatal development of the visual cortex and the influence of environment. Nature, 299(5884):583, 1982.
185
+ Torsten N Wiesel and David H Hubel. Single-cell responses in striate cortex of kittens deprived of vision in one eye. Journal of neurophysiology, 26(6):1003–1017, 1963a.
186
+ Torsten N Wiesel and David H Hubel. Effects of visual deprivation on morphology and physiology of cells in the cat’s lateral geniculate body. Journal of neurophysiology, 26(6):978–993, 1963b.
187
+
188
+ # A DETAILS OF THE EXPERIMENTS
189
+
190
+ # A.1 ARCHITECTURES AND TRAINING
191
+
192
+ In all of the experiments, unless otherwise stated, we use the following All-CNN architecture, adapted from Springenberg et al. (2014):
193
+
194
+ conv 96 - conv 96 - conv 192 s2 - conv 192 - conv 192 - conv 192 s2 - conv 192 - conv1 192 - conv1 10 - avg. pooling - softmax where each conv block consists of a $3 \times 3$ convolution, batch normalization and ReLU activations. conv1 denotes a $1 \times 1$ convolution. The network is trained with SGD, with a batch size of 128, learning rate starting from 0.05 and decaying smoothly by a factor of .97 at each epoch. We also use weight decay with coefficient 0.001. In the experiments with a fixed learning rate, we fix the learning rate to 0.001, which we find to allow convergence without excessive overfitting. For the ResNet experiments, we use the ResNet-18 architecture from He et al. (2016) with initial learning rate 0.1, learning rate decay .97 per epoch, and weight decay 0.0005. When training with Adam, we use a learning rate of 0.001 and weight decay 0.0001.
195
+
196
+ When experimenting with varying network depths, we use the following architecture:
197
+
198
+ In order to avoid interferences between the annealing scheme and the architecture, in these experiments we fix the learning rate to 0.001.
199
+
200
+ The Fully Connected network used for the MNIST experiments has hidden layers of size [2500, 2000, 1500, 1000, 500]. All hidden layers use batch normalization followed by ReLU activations. We fix the learning rate to 0.005. Weight decay is not used. We use data augmentation with random translations up to 4 pixels and random horizontal flipping. For MNIST, we pad the images with zeros to bring them to size $3 2 \times 3 2$ .
201
+
202
+ # A.2 APPROXIMATIONS OF THE FISHER INFORMATION MATRIX
203
+
204
+ To compute the trace of the Fisher Information Matrix, we use the following expression derived directly from the definition:
205
+
206
+ $$
207
+ \begin{array} { r l } & { \mathrm { t r } ( F ) = \mathbb { E } _ { x \sim \hat { Q } ( x ) } \mathbb { E } _ { y \sim p _ { w } ( y \vert x ) } [ \mathrm { t r } ( \nabla _ { w } \log p _ { w } ( y \vert x ) \nabla _ { w } \log p _ { w } ( y \vert x ) ^ { T } ) ] } \\ & { \quad \quad \quad = \mathbb { E } _ { x \sim \hat { Q } ( x ) } \mathbb { E } _ { y \sim p _ { w } ( y \vert x ) } [ \Vert \nabla _ { w } \log p _ { w } ( y \vert x ) \Vert ^ { 2 } ] , } \end{array}
208
+ $$
209
+
210
+ where the input image $x$ is sampled from the dataset, while the label $y$ is sampled from the output posterior. Expectations are approximated by Monte-Carlo sampling. Notice, however, that this expression depends only on the local gradients of the loss with respect to the weights at a point $w = w _ { 0 }$ , so it can be noisy when the loss landscape is highly irregular. This is not a problem for ResNets Li et al. (2018), but for other architectures we use instead a different technique, proposed in Achille & Soatto (2018). More in detail, let $L ( w )$ be the standard cross-entropy loss. Given the current weights $w _ { 0 }$ of the network, we find the diagonal matrix $\Sigma$ that minimizes:
211
+
212
+ $$
213
+ L ^ { \prime } = \mathbb { E } _ { w \sim N ( w _ { 0 } , \Sigma ) } [ L ( w ) ] - \beta \log | \Sigma | ,
214
+ $$
215
+
216
+ where $\beta$ is a parameter that controls the smoothness of the approximation. Notice that $L ^ { \prime }$ can be minimized efficiently using the method in Kingma et al. (2015). To see how this relates to the Fisher Information Matrix, assume that $L ( w )$ can be approximated locally in $w _ { 0 }$ as $L ( w ) =$ $L _ { 0 } + a \cdot w + w \cdot H w$ . We can then rewrite $L ^ { \prime }$ as
217
+
218
+ $$
219
+ \begin{array} { r } { L ^ { \prime } = L _ { 0 } + \mathrm { t r } ( \Sigma H ) - \beta \log | \Sigma | . } \end{array}
220
+ $$
221
+
222
+ Taking the derivative with respect to $\Sigma$ , and setting it to zero, we obtain $\Sigma _ { i i } = \beta / H _ { i i }$ . We can then use $\Sigma$ to estimate the trace of the Hessian, and hence of the Fisher information.
223
+
224
+ # A.3 CURVE FITTING
225
+
226
+ Fitting of sensitivity curves and synaptic density profiles from the literature was performed using:
227
+
228
+ $$
229
+ f ( t ) = \mathrm { e } ^ { - ( t - d ) / \tau _ { 1 } } - k \mathrm { e } ^ { - ( t - d ) / \tau _ { 2 } }
230
+ $$
231
+
232
+ as the fitting equation, where $t$ is the age at the time of sampling and $\tau _ { 1 } , \tau _ { 2 } , k$ and $d$ are unconstrained parameters (Banks et al., 1975).
233
+
234
+ The exponential fit of the sensitivity to the Fisher Information trace uses the expression
235
+
236
+ $$
237
+ F ( t ) = a \exp ( c S _ { k } ( t ) ) + b ,
238
+ $$
239
+
240
+ where $a$ , $b$ and $c$ are unconstrained parameters, $F ( t )$ is the Fisher Information trace at epoch $t$ of the training of a network without deficits and $S _ { k }$ is the sensitivity computed using a window of size $k$ . That is, $S _ { k } ( t )$ is the increase in the final test error over a baseline when the network is trained in the presence of a deficit between epochs $t$ and $t + k$ .
241
+
242
+ # B ADDITIONAL PLOTS
243
+
244
+ ![](images/fe0370d7f3e28d3a6eda988bd2abb84484acd8448cfad4dfc312bc5796496c83.jpg)
245
+ Figure 6: Log of the norm of the gradient means (solid line) and standard deviation (dashed line) during training when: (Left) No deficit is present, (Center) A blur deficit is present until epoch 70, and (Right) a deficit is present until the last epoch. Notice that the presence of a deficit does not decrease the magnitude of the gradients propagated to the first layers during the last epochs, rather it seems to increase it, suggesting that vanishing gradients are not the cause of the critical period for the blurring deficit.
246
+
247
+ ![](images/46f616f0a75dddecb77d81235a32ad0b5eba8f68c46b43b45a7fd7c783e9bb20.jpg)
248
+ Figure 7: Same plot as in Figure 5, but for a noise deficit. Unlike with blur, much more resources are allocated to the lower-layers rather than higher-layers. This may explain why it is easier for the network to reconfigure to solve the task after the deficit is removed.
249
+
250
+ ![](images/d0ba0320eb6f0fb9cf03b20dd2ca7b2df008720650c0b49932910d7115a007a3.jpg)
251
+ Figure 8: Visualization of the filters of the first layer of the network used for the experiment in Figure 1. In absence of a deficit, the network learns high-frequency filters, as seen by the fact that many filters are not smooth (first picture). However, when a blurring deficit is present, the network learns only smooth filters corresponding to low-frequencies of the input (third picture). If the deficit is removed after the end of the critical period, the network does not manage to learn high-frequency filters (second picture).
252
+
253
+ # C EXPERIMENTAL DESIGN AND COMPARISON WITH ANIMAL MODELS
254
+
255
+ Critical periods are task- and deficit-specific. The specific task we address is visual acuity, but the performance is necessarily measured through different mechanisms in animals and Artificial Neural Networks. In animals, visual acuity is traditionally measured by testing the ability to discriminate between black-and-white contrast gratings (with varying spatial frequency) and a uniform gray field. The outcome of such tests generally correlates well with the ability of the animal to use the eye to solve other visual tasks relying on acuity. Convolutional Neural Networks, on the other hand, have a very different sensory processing mechanism (based on heavily quantized data), which may trivialize such a test. Rather, we directly measure the performance of the network on an high-level task, specifically image classification, for which CNNs are optimized.
256
+
257
+ We chose to simulate cataracts in our DNN experiments, a deficit which allows us to explore its complex interactions with the structure of the data and the architecture of the network. Unfortunately, while the overall trends of cataract-induced critical periods have been studied and understood in animal models, there is not enough data to confidently regress sensibility curves comparable to those obtained in DNNs. For this reason, in Figure 1 we compare the performance loss in a DNN trained in the presence of a cataract-like deficit with the results obtained from monocularly deprived kittens, which exhibit similar trends and are one of the most common experimental paradigms in the visual neurosciences.
258
+
259
+ Simulating complete visual deprivation in a neural network is not as simple as feeding a constant stimulus: a network presented with a constant blank input will rapidly become trivial and thus unable to train on new data. This is to be expected, since a blank input is a perfectly predictable stimulus and thus the network can quickly learn the (trivial) solution to the task. We instead wanted to model an uninformative stimulus, akin to noise. Moreover, even when the eyes are sutured or maintained in the darkness, there will be background excitation of photoreceptors that is best modeled as noise. To account for this, we simulate sensory deprivation by replacing the input images with a dataset composed of (uninformative) random Gaussian noise. This way the network is trained on solving the highly non-trivial task of memorizing the association between the finitely-many noise patterns and their corresponding labels.
md/train/BkeWw6VFwr/BkeWw6VFwr.md ADDED
The diff for this file is too large to render. See raw diff
 
md/train/BkeaEyBYDB/BkeaEyBYDB.md ADDED
@@ -0,0 +1,234 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # IMPROVING FEDERATED LEARNING PERSONALIZATION VIA MODEL AGNOSTIC META LEARNING
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Federated Learning (FL) refers to learning a high quality global model based on decentralized data storage, without ever copying the raw data. A natural scenario arises with data created on mobile phones by the activity of their users. Given the typical data heterogeneity in such situations, it is natural to ask how can the global model be personalized for every such device, individually. In this work, we point out that the setting of Model Agnostic Meta Learning (MAML), where one optimizes for a fast, gradient-based, few-shot adaptation to a heterogeneous distribution of tasks, has a number of similarities with the objective of personalization for FL. We present FL as a natural source of practical applications for MAML algorithms, and make the following observations. 1) The popular FL algorithm, Federated Averaging (McMahan et al., 2017), can be interpreted as a meta learning algorithm. 2) Careful fine-tuning can yield a global model with higher accuracy, which is at the same time easier to personalize. However, solely optimizing for the global model accuracy yields a weaker personalization result. 3) A model trained using a standard datacenter optimization method is much harder to personalize, compared to one trained using Federated Averaging, supporting the first claim. These results raise new questions for FL, MAML, and broader ML research.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ In recent years, the growth of machine learning applications was driven by aggregation of large amounts of data in a datacenter, where a model can be trained using large scale distributed system (Dean et al., 2012; LeCun et al., 2015). Both the research community and general public are becoming increasingly aware that there is a variety of scenarios where this kind of data collection comes with significant risks, mainly related to notions of privacy and trust.
12
+
13
+ In the presence of user generated data, such as activity on mobile phones, Federated Learning (FL) (McMahan & Ramage, 2017) proposes an alternative approach for training a high quality global model without ever sending raw data to the cloud. The FL system proposed by Google (Bonawitz et al., 2019) selects a sample of available devices and sends them a model to be trained. The devices compute an update to the model based on an optimization procedure with locally available data, and the central system aggregates the updates from different devices. Such iteration is repeated many times until the model has converged. The users’ training data does not leave their devices. The basic FL algorithm, Federated Averaging (FedAvg) (McMahan et al., 2017), has been used in production applications, for instance for next word prediction in mobile keyboard (Hard et al., 2018), which shows that Federated Learning can outperform the best model trained in a datacenter. Successful algorithmic extensions to the central idea include training a differential private model (McMahan et al., 2018), compression (Konecnˇ y et al., 2016b; Caldas et al., 2018a), secure ´ aggregation (Bonawitz et al., 2017), and a smaller number of always-participating nodes (Yang et al., 2019).
14
+
15
+ FL applications generally face non-i.i.d and unbalanced data available to devices, which makes it challenging to ensure good performance across different devices with a FL-trained global model. Theoretical guarantees are only available under restrictive assumptions and for convex objectives, cf. Li et al. (2019b). In this work, we are interested in personalization methods that adapt the model for data available on each device, individually. We refer to a trained global model as the initial model, and the locally adapted model as the personalized model. Existing FL personalization work directly takes a converged initial model and conducts personalization evaluation via gradient descent (Beaufays et al., 2019). However, in this approach, the training and personalization procedures are completely disconnected, which results in potentially suboptimal personalized models.
16
+
17
+ Meta Learning optimizes the performance after adaptation given few-shot adaptation examples on heterogeneous tasks, and has increasing applications in the context of Supervised Learning and Reinforcement Learning. Model Agnostic Meta Learning (MAML) introduced by Finn et al. (2017) is a solely gradient-based Meta Learning algorithm, which runs in two connected stages; metatraining and meta-testing. Meta-training learns a sensitive initial model which can conduct fast adaptation on a range of tasks, and meta-testing adapts the initial model for a particular task.
18
+
19
+ Both tasks for MAML, and clients for FL, are heterogeneous. For each task in MAML and client in FL, existing algorithms use a variant of gradient descent locally, and send an overall update to a coordinator to update the global model. If we present the FL training process as meta-training in the MAML language, and the FL personalization via gradient descent as meta-testing, we show in Section 2 that FedAvg (McMahan et al., 2017) and Reptile (Nichol et al., 2018), two popular FL and MAML algorithms, are very similar to each other; see also Khodak et al. (2019).
20
+
21
+ In order to make FL personalization useful in practice, we propose that the following objectives must all be addressed, simultaneously.
22
+
23
+ (1) Improved Personalized Model – for a large majority of the clients.
24
+ (2) Solid Initial Model – some clients have limited or even no data for personalization.
25
+ (3) Fast Convergence – reach a high quality model in small number of training rounds.
26
+
27
+ Typically, the MAML algorithms only focus on objective (1); that was the original motivation in Finn et al. (2017). Existing FL works usually focus on objectives (2) and (3), and take the personalized performance as secondary. This is largely due to the fact that it was not obvious that getting a solid initial model is feasible or practical if devices are available occasionally and with limited resources.
28
+
29
+ In this work, we study these three objectives jointly, and our main contributions are:
30
+
31
+ • We point out the connection between two widely used FL and MAML algorithms, and interpret existing FL algorithm in the light of existing MAML algorithms.
32
+ We propose a novel modification of FedAvg, with two stages of training and fine-tuning, for optimizing the three above objectives.
33
+ We empirically demonstrate that FedAvg is already a meta learning algorithm, optimizing for personalized performance, as opposed to quality of the global model. Furthermore, we show that the fine tuning stage enables better and more stable personalized performance.
34
+ • We observe that different global models with the same accuracy, can exhibit very different capacity for personalization.
35
+ • We highlight that these results challenge the existing objectives in the FL literature, and motivate new problems for the broader Machine Learning research community.
36
+
37
+ # 2 INTERPRETING FEDAVG AS A META LEARNING ALGORITHM
38
+
39
+ In this section, we highlight the similarities between the FL and MAML algorithms and interpret FedAvg as a linear combination of a naive baseline and a collection of existing MAML methods.
40
+
41
+ Algorithm 1 presents a conceptual algorithm with nested structure (left column), of which the MAML meta-training algorithm, Reptile (middle column), and FL-training algorithm, FedAvg (right column), are particular instances. We assume that $L$ is a loss function common to all of the following arguments. In each iteration, a MAML algorithm trains across a random batch of tasks $\{ T _ { i } \}$ . For each task $T _ { i }$ , it conducts an inner-loop update, and aggregates gradients from each sampled task with an outer-loop update. In each training round, FL uses a random selection of clients $\{ T _ { i } \}$ . For each client $T _ { i }$ and its weight $w _ { i }$ , it runs an optimization procedure for a number of epochs over the local data, and sends the update to the server, which aggregates the updates to form a new global model. If we simplify the setting and assume all clients have the same amount of data, causing the weights $w _ { i }$ to be identical, Reptile and FedAvg in fact become the same algorithms. Several other MAML algorithms (Finn et al., 2017; Antoniou et al., 2018), or other non-MAML/FL methods (Zhang et al., 2019), can also be viewed as instances of the conceptual method in left column of Algorithm 1.
42
+
43
+ <table><tr><td colspan="3">Algorithm1 Connects FL and MAML (left),Reptile Batch Version(middle),and FedAvg (right).</td></tr><tr><td>OuterLoop/Server learning rate α</td><td>Require::Reptile Step K.</td><td>Require:FedAvg Local Epoch E.</td></tr><tr><td>InnerLoop/Client learning rate β</td><td>functionInnerLoop(0,Ti,β)</td><td>function ClientUpdate(0,T,β)</td></tr><tr><td>Initial model parameters θ</td><td>SampleK-shot data Di,k from Ti.</td><td>Split local dataset into batches B</td></tr><tr><td>while not done do</td><td>0=0</td><td>0=θ</td></tr><tr><td>Sample batch of tasks/clients {Ti}</td><td>for each local step ifrom1to Kdo</td><td>for each local epoch i from 1 to E do</td></tr><tr><td>for Sampled task/client Ti do if FL then</td><td>0=0i-βVθL(0,Di,k)</td><td>for batch b ∈Bdo 0=0-βVθL(0,b)</td></tr><tr><td>gi,Wi= ClientUpdate(0,Ti,β)</td><td></td><td>end for</td></tr><tr><td>else if MAML then</td><td>end for</td><td>end for</td></tr><tr><td>gi=InnerLoop(0,T,β)</td><td>Returngi=0-0</td><td>Return gi=0-0</td></tr><tr><td>end if</td><td>end function</td><td>end function</td></tr><tr><td>end for</td><td>Require::Meta Batch Size M.</td><td>Require:Clients per training round M.</td></tr><tr><td>if FL then</td><td>function OuterLoop(0,{gi},α)</td><td>function ServerUpdate(0,{gi,wi},α</td></tr><tr><td>0= ServerUpdate(0,{gi,wi},α)</td><td></td><td></td></tr><tr><td>else if MAML then 0=OuterLoop(0,{gi},α)</td><td></td><td></td></tr><tr><td>end if</td><td>Return 0</td><td>Return 0</td></tr><tr><td>end while</td><td>end function</td><td>end function</td></tr></table>
44
+
45
+ In the following, we rearrange the summands comprising the update formula of FedAvg/Reptile algorithm to reveal the connection with other existing methods – a linear combination of the Federated SGD (FedSGD) (McMahan et al., 2017) and First Order MAML (FOMAML) algorithms (Finn et al., 2017) with different number of steps. For clarity, we assume identical weights $w _ { i }$ in FedAvg.
46
+
47
+ Consider $T$ participating clients and let $\theta$ be parameters of the relevant model. For each client $i$ define its local loss function as $L _ { i } ( \theta )$ , and let $\bar { \boldsymbol { g } } _ { j } ^ { i }$ be the gradient computed in $j ^ { t h }$ iteration during a local gradient-based optimization process.
48
+
49
+ FedSGD was proposed as a naive baseline against which to compare FL algorithms. For each client, it simply takes a single gradient step based on the local data, which is sent back to the server. It is a sensible baseline because it is a variant of what a traditional optimization method would do if we were to collect all the data in a central location, albeit inefficient in the FL setting. That means that FedSGD optimizes the performance of the initial model, as is the usual objective in datacenter training. The local update produced by FedSGD, $g _ { F e d S G D }$ , can be written as
50
+
51
+ $$
52
+ g _ { F e d S G D } = \frac { - \beta } { T } \sum _ { i = 1 } ^ { T } \frac { \partial L _ { i } ( \theta ) } { \partial \theta } = \frac { 1 } { T } \sum _ { i = 1 } ^ { T } g _ { 1 } ^ { i } .
53
+ $$
54
+
55
+ Next, we derive the update of FOMAML in similar terms. Assuming client learning rate $\beta$ , the personalized model of client $i$ , obtained after $K$ -step gradient update is $\theta _ { K } ^ { i } = U _ { K } ^ { i } ( \theta ) = \theta -$ $\begin{array} { r } { \beta \sum _ { j = 1 } ^ { K } g _ { j } ^ { i } = \theta - \beta \sum _ { j = 1 } ^ { K } \frac { \partial L _ { i } ( \theta _ { j } ) } { \partial \theta } } \end{array}$ 1 ∂Li(θj )∂θ . Differentiating the client update formula, we get
56
+
57
+ $$
58
+ \frac { \partial U _ { K } ^ { i } ( \boldsymbol { \theta } ) } { \partial \boldsymbol { \theta } } = I - \beta \frac { \partial \sum _ { j = 1 } ^ { K } g _ { j } ^ { i } } { \partial \boldsymbol { \theta } } = I - \beta \sum _ { j = 1 } ^ { K } \frac { \partial ^ { 2 } L _ { i } ( \theta _ { j } ) } { \partial \theta ^ { 2 } } .
59
+ $$
60
+
61
+ Directly optimizing the current model for the personalized performance after locally adapting $K$ gradient steps, results in the general MAML update proposed by Finn et al. (2017).
62
+
63
+ $$
64
+ g _ { M A M L } = \frac { \partial L _ { M A M L } } { \partial \theta } = \frac { 1 } { T } \sum _ { i = 1 } ^ { T } \frac { \partial L _ { i } ( U _ { K } ^ { i } ( \theta ) ) } { \partial \theta } = \frac { 1 } { T } \sum _ { i = 1 } ^ { T } L _ { i } ^ { \prime } ( U _ { K } ^ { i } ( \theta ) ) ( I - \beta \sum _ { j = 1 } ^ { K } \frac { \partial ^ { 2 } L _ { i } ( \theta _ { j } ) } { \partial \theta ^ { 2 } } ) .
65
+ $$
66
+
67
+ MAML requires to compute 2nd-order gradients, which can be computationally expensive and creates potentially infeasible memory requirements. To avoid computing the 2nd-order term, FOMAML simply ignores it, resulting in a first-order approximation of the objective (Finn et al., 2017). $F O M A M L ( K )$ then uses the $( K + 1 ) ^ { t h }$ gradient as the local update, after $K$ gradient steps.
68
+
69
+ $$
70
+ g _ { F O M A M L } ( K ) = \frac { 1 } { T } \sum _ { i = 1 } ^ { T } L _ { i } ^ { \prime } ( U _ { K } ^ { i } ( \theta ) ) I = \frac { 1 } { T } \sum _ { i = 1 } ^ { T } L _ { i } ^ { \prime } ( \theta _ { K } ^ { i } ) = \frac { 1 } { T } \sum _ { i = 1 } ^ { T } g _ { K + 1 } ^ { i } .
71
+ $$
72
+
73
+ Now we have derived the building blocks of the FedAvg. As presented in Algorithm 1, the update of FedAvg, $g _ { F e d A v g }$ , is the average of client updates, which are the sums of local gradient updates. Rearranging the terms presents its interpretation as a linear combination of the above ideas.
74
+
75
+ $$
76
+ g _ { F e d A v g } = \frac { 1 } { T } \sum _ { i = 1 } ^ { T } \sum _ { j = 1 } ^ { K } g _ { j } ^ { i } = \frac { 1 } { T } \sum _ { i = 1 } ^ { T } g _ { 1 } ^ { i } + \sum _ { j = 1 } ^ { K - 1 } \frac { 1 } { T } \sum _ { i = 1 } ^ { T } g _ { j + 1 } ^ { i } = g _ { F e d S G D } + \sum _ { j = 1 } ^ { K - 1 } g _ { F O M A M L } ( j )
77
+ $$
78
+
79
+ Note that interpolating to special case, $g _ { F e d S G D }$ can be seen as $g _ { F O M A M L } ( 0 ) -$ optimizing the performance after 0 local updates, i.e., the current model. This sheds light onto the existing Federated Averaging algorithm, as the linear combination of algorithms optimizing personalized performance after a range of local updates. Note, however, this does not mean that FedAvg optimizes for the linear combination of the objectives of the respective algorithms. Nevertheless, we show in the following section that using $K = 1$ results in a model hard to personalize, and increasing $K$ significantly improves the personalization performance, up until a certain point where the performance of initial model becomes unstable.
80
+
81
+ # 3 PERSONALIZED FEDAVG
82
+
83
+ In this section, we present Personalized FedAvg algorithm, which is the result of experimental adaptation of the core FedAvg algorithm to improve the three objectives proposed in the introduction.
84
+
85
+ We denote $F e d A v g ( E )$ the Federated Averaging method from Algorithm 1, right, run for $E$ local epochs, weighting the updates proportionally to the amount of data available locally. We denote $R e p t i l e ( K )$ the method from Algorithm 1, middle, run in the FL setting for $K$ local steps, irrespective of the amount of data available locally. Based on a variety of experiments we explored, we propose Personalized FedAvg in Algorithm 2.
86
+
87
+ # Algorithm 2 Personalized FedAvg
88
+
89
+ 1: Run $F e d A v g ( E )$ with momentum SGD as server optimizer and a relatively larger $E$
90
+ 2: Switch to $R e p t i l e ( K )$ with Adam as server optimizer to fine-tune the initial model.
91
+ 3: Conduct personalization with the same client optimizer used during training.
92
+
93
+ In general, FedAvg training with several local epochs ensures reasonably fast convergence in terms of number of communication rounds. Due to complexity of production system, this measure was studied as the proxy for convergence speed of FL algorithms. We find that this method with momentum SGD as the server optimizer already optimizes for the personalized model – objective (1) form the introduction – while the initial model – objective (2) – is relatively unstable. Based on prior work, the recommendation to address this problem would be to decrease $E$ or the local learning rate, stabilizing initial model at the cost of slowing down convergence (McMahan et al., 2017; Wang & Joshi, 2018) – objective (3).
94
+
95
+ We propose a fine-tuning stage using $R e p t i l e ( K )$ with small $K$ and Adam as the server optimizer, to improve the initial model, while preserving and stabilizing the personalized model. We observed that Adam yields better results than other optimizers, see Table 3 in Appendix A.1, and makes the best personalized performance achievable with broader set of hyperparameters, see Figure 2. The subsequent deployment and personalization is conducted using the same client optimizer as used for training, as we observe that this choice yields the best results for FedAvg/Reptile-trained models.
96
+
97
+ Experimental setup. We use the EMNIST-62 dataset as our primary benchmark (Caldas et al., 2018b). It is the original source of the MNIST dataset, which comes with author id, and noticable variations in style, pen width, size, etc., making it a suitable source for simulated FL experiments. The dataset contains 3400 users, each with a train/test data split, with a total of 671, 585 train and 77, 483 test images. We choose the first 2, 500 users as the initial training clients, leaving the remaining 900 clients for evaluation of personalization; these clients are not touched during training. The evaluation metrics are the initial and personalized accuracy, uniformly averaged among all of the FL-personalization clients. This is preferred to a weighted average, as in a production system we care about the future performance on each device, regardless of the amount of data available for personalization. Unless specified otherwise, we use the baseline convolutional model available in TensorFlow Federated (Ingerman & Ostrowski, 2019)1, using SGD with learning rate 0.02 and batch size of 20 as the client optimizer, and SGD with momentum of 0.9 and learning rate 1.0 as the server optimizer. Each experiment was repeated 9 times with random initialization, and the mean and standard deviation of initial and personalized accuracies are reported. We also use the shakespeare dataset for next-character prediction, split in a similar manner with first 500 clients used for training and remaining 215 for evaluation of personalization.
98
+
99
+ # 3.1 CONVERGENCE OF FEDAVG
100
+
101
+ In Figure 1, left, we present the convergence of both initial and personalized model during training using the Federated Averaging algorithm. The results correspond to training with $E$ being 2 and 10, with visualization of the empirical mean and variance observed in the 9 replicas of the experiment. Detailed values about performance after 500 rounds of training, and the number of rounds to reach $8 0 \%$ accuracy, are provided in Table 1. These results provide a number of valuable insights.
102
+
103
+ ![](images/34a567a29801b03e7e7717cf79f30b834aaf7e22d63222415118bc44d874a835.jpg)
104
+ Figure 1: Training Convergence on EMNIST-62 (left) and Shakespeare (right).
105
+
106
+ First, the personalized accuracy converges significantly higher than the initial accuracy. This clearly validates the EMNIST-62 as an interesting simulated dataset to use to study Federated Learning, with significantly non-i.i.d. data available to each client.
107
+
108
+ Second, it provides empirical support to the claim made in Section 2, that Federated Averaging is already a Meta Learning algorithm. The personalized accuracy not only converges faster and higher, but the results are also of much smaller variance than those of the initial accuracy.
109
+
110
+ Third, the personalized accuracy after training with $E = 1 0$ is significantly higher than the personalized accuracy after training with $E = 2$ . This is despite the fact that the gap in the initial accuracy between these two variants is somewhat smaller. Moreover, the variance of personalized accuracy is nearly 3-times smaller for training with $E = 1 0$ , compared to $E = 2$ , despite the variance of the initial accuracy being smaller for the $E = 2$ case. This supports the insight from Equation 5, that Federated Averaging with more gradient steps locally should emphasize the personalized accuracy more, potentially at the cost of initial accuracy.
111
+
112
+ Finally, this challenges the objectives in the existing literature focusing on the setting of Federated Learning. FedAvg was presented as optimizing the performance of a shared, global model, while in fact it might achieve this only as a necessary partial step towards optimizing the personalized performance. We argue that in the presence of non-i.i.d. data available to different clients, the objective of Federated Learning should also be the personalized performance. Consequently, the recommendations that in order to stabilize the convergence, one might decrease the number of local epochs or the local learning rate (McMahan et al., 2017; Wang & Joshi, 2018), are in some scenarios misguided. In this experiment, even though the initial accuracy is very noisy and roughly constant at a suboptimal level, the personalized accuracy keeps increasing.
113
+
114
+ To evaluate the convergence speed more closely, Table 1 measures the accuracies after 500 rounds of training and the average number of communication rounds where the initial and personalized accuracy first time reaches $8 0 \%$ . While Figure 1 shows results using 5 clients per round, the table below also shows the same experiment with 20 clients per round, which in general provides even better and more stable personalized accuracy. The common pattern is that increasing $E$ initially helps, until a certain threshold. From this experiment, $E$ in the range of $5 - 1 0$ seems to be the best.
115
+
116
+ We conduct a similar experiment with the Shakespeare data. The result is in Figure 1, right, but does not provide any interesting insights, as the personalized performance shows only a small positive improvement. We conjecture that this is due to the nature of the objective – even though the data is non-i.i.d., the next-character prediction is mostly focused on a local structure of the language in general, and is similar across all users.2 We thus do not study this problem further in this paper. It is likely that for a next-word prediction task, personalization would make a more significant difference.
117
+
118
+ <table><tr><td>EMNIST-625clients</td><td>Initial Acc</td><td>Personalized Acc</td><td>Epochs to O.8 (init/pers)</td></tr><tr><td>FedAvg E=2 FedAvg E=5</td><td>0.7473(0.0260) 0.8028 (0.0512)</td><td>0.8292 (0.0061) 0.8712 (0.0049)</td><td>310.0/63.6 111.1/33.9</td></tr><tr><td>FedAvg E=10</td><td>0.7879(0.0316)</td><td>0.8820 (0.0023)</td><td>137.5/30.0</td></tr><tr><td>FedAvg E=20</td><td>0.7430(0.0309)</td><td>0.8782 (0.0021)</td><td>152.5/32.2</td></tr><tr><td>EMNIST-62 20 clients</td><td></td><td></td><td></td></tr><tr><td>FedAvg E=2</td><td>0.8403 (0.0173)</td><td>0.8957 (0.0011)</td><td>82.5/50.0</td></tr><tr><td>FedAvg E=5</td><td>0.8471 (0.0084)</td><td>0.9057 (0.0017)</td><td>65.6/31.25</td></tr><tr><td>FedAvg E=10</td><td>0.8480 (0.0036)</td><td>0.9032 (0.0017)</td><td>68.7/25.0</td></tr><tr><td>FedAvg E=20</td><td>0.8391 1(0.0081)</td><td></td><td></td></tr><tr><td></td><td></td><td>0.8953 (0.0022)</td><td>82.1/46.4</td></tr></table>
119
+
120
+ Table 1: EMNIST-62 performance for 5 and 20 clients per communication round.
121
+
122
+ # 3.2 BEHAVIOR OF PERSONALIZATION
123
+
124
+ In this section, we study the ability of models to personalize more closely. In particular, we look at the personalization performance as a function of the number of local epochs spent personalizing, and the effect of both local personalization optimizer and the optimizer used to train the initial model.
125
+
126
+ In Figure 2, left, we study the performance of three different models, personalized using different local optimizers. The models we test here are: one randomly chosen from the models trained with $E = 1 0$ in the previous section, with initial accuracy of $7 4 . 4 1 \%$ . The other two models are the results of fine-tuning that specific model with Reptile(1) and Reptile(10) and Adam as the server optimizer for further 200 communication rounds, again using 5 clients per round. For all three models, we show the results of personalization using Adam with default parameters and using SGD with learning rate of 0.02 and batch size of 100.
127
+
128
+ ![](images/969aa5be44345dcb2f9feba2fa442c5eff39773d19fb8bc40f61b4e924d6a40b.jpg)
129
+ Figure 2: Personalized accuracy as a function of local update epochs. Federated initial models (left), initial models trained by centralizing data and using default Adam optimizer (right).
130
+
131
+ In all three cases, Adam produces reasonable personalized result, but inferior to the result of SGD. We tried SGD with a range of other learning rates, and in all cases we observed this value to work the best. Note that this is the same local optimizer that was used during training and fine tuning, which is similar to the MAML works, where the same algorithm is user for meta-training and meta-testing.
132
+
133
+ The effect of fine-tuning is very encouraging. Using Reptile(10), we get a model with better initial accuracy, which also gets to a slightly improved personalized accuracy. Most importantly, it gets to roughly the same performance for a wide range of local personalization epochs. Such property is of immense value for pracical deployment, as only limited tools for model quality validation can be available on the devices where personalization happens. Using Reptile(1) significantly improves the initial accuracy, but the personalized accuracy actually drops! Even though the Equation 5 suggests that this algorithm should not take into account the personalized performance, it is not clear that such result should be intuitively expected – it does not mean it actively supresses personalization, either, and it is only fine tuning of a model already trained for the personalized performance.
134
+
135
+ We note that this can be seen as an analogous observation to those of Nichol et al. (2018), where Reptile(1) yields a model with clearly inferior personalized performance.
136
+
137
+ Motivated by this somewhat surprising result, we ask the following question: If the training data were available in a central location, and an initial model was trained using standard optimization algorithms, how would the personalization change? We train such “centralized initial model” using Adam with default settings, and evaluate the personalization performance of a model snapshot after 10 and 50 training epochs. These two models have similar initial accuracies as the two models fine tuned with Reptile(10) and Reptile(1), respectively. The results are in Figure 2, right.
138
+
139
+ The main message is that it is significantly harder to personalize these centralized initial models. Using SGD with learning rate of 0.02 is not good – a significantly smaller learning rate is needed to prevent the models from diverging, and then the personalization improvement is relatively small. In this case, using Adam does provide a better result, but still below the fine tuning performance in Figure 2, left. It is worth noting that the personalized performance of this converged model is similar to that of the model we get after fine tuning with Reptile(1), although using different personalization optimizer. At the moment, we are unable to suggest a sound explanation for this similarity.
140
+
141
+ At the start of the Section 3, we recommended using Adam as the server optimizer for fine tuning, and here we only presented such results. We did try different optimizers, and found them to yield worse results with higher variance, especially in terms of the initial accuracy. See Appendix A.1 for more details, where we see that all of the optimizers can deliver higher initial accuracy at the cost of slightly lower personalized accuracy.
142
+
143
+ To strengthen the above observations, we look at the distribution of the initial and personalized accuracies of fine tuned models over multiple experiments. In Figure 3, we look at the same three models as in Figure 2. It is clear that the initial model has a large variance in the initial accuracy, the results are in the range of $1 2 \%$ , but the personalized accuracies are only within the range of $1 \%$ . We chose one model, as indicated by the arrows3, to be fine tuned with $R e p t i l e ( 1 0 )$ and Reptile(1). In both cases, fine tuning results in a more consistent results in both the initial and personalized accuracy. Moreover, the best personalized accuracy with Reptile(1) is worse than the worst personalized accuracy with Reptile(10).
144
+
145
+ ![](images/5ce7f60920b52c80d87f255f96d784cb85f511949cf2bb85390e6cd897779075.jpg)
146
+ Figure 3: Distribution of initial and personalized accuracies of fine tuned models.
147
+
148
+ In Appendix A.2, we look at a similar visualization on a per-client basis for a given model. Studying this distribution is of great importance, as in practical deployment, even a small degradation in a user’s experience might incur disproportionate cost, relative to the benefit of a comparable improvement in the model quality. We do not study this question deeper in this work, though.
149
+
150
+ <table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>Initial Acc</td><td rowspan=1 colspan=1>Personalized Acc</td></tr><tr><td rowspan=1 colspan=1>Reptile(1) Finetuned test clientsReptile(1) Finetuned train clients</td><td rowspan=1 colspan=1>0.8320 (0.0133)0.8577 (0.0019)</td><td rowspan=1 colspan=1>0.8764 (0.0017)0.8927 (0.0015)</td></tr><tr><td rowspan=1 colspan=1>Reptile(1O) Finetuned test clientsReptile(1O) Finetuned train clients</td><td rowspan=1 colspan=1>0.8116 (0.0148)0.8612 (0.0020)</td><td rowspan=1 colspan=1>0.8858 (0.0014)0.9028(0.0009)</td></tr></table>
151
+
152
+ Table 2: Test performance on clients seen and unseen during FL-training
153
+
154
+ Finally, we look at the performance of fine tuned models discussed above on both train and test clients. Table 2 shows that if we only looked at the initial accuracy, basic ML principles would suggest the Reptile(10) models are over-fitting, due to larger gap between the train and test clients. However, the personalized accuracy tells a different story - the gap is roughly the same for both model types, and for both train and test clients, Reptile(10) provides significantly better personalized accuracy, suggesting we need a novel way to predict the generalization of personalized models.
155
+
156
+ # 4 DISCUSSION AND FUTURE WORK
157
+
158
+ It this work, we argue that in the context of Federated Learning, the accuracy of the global model after personalization should be of much greater interest than it has been. Investigation of the topic reveals close similarities between the fields of Federated Learning and Model Agnostic Meta Learning, and raises new questions for these areas, as well as for the broader Machine Learning community.
159
+
160
+ Challenges for Federated Learning. Framing papers in the area of Federated Learning (McMahan et al., 2017; Konecnˇ y et al., 2016a; Li et al., 2019a), formulate the objective as training of a ´ shared global model, based on a decentralized data storage where each node / client has access to a non-i.i.d sample from the overall distribution. The objective is identical to one the broader ML community would optimize for, had all the data been available in a centralized location.
161
+
162
+ We argue that in this setting, the primary objective should be the adaptation to the statistical heterogeneity present at different data nodes, and demonstrate that the popular FL algorithm, Federated Averaging, does in fact optimize the personalized performance, and while doing so, also improves the performance of the global model. Experiments we perform demonstrate that the algorithm used to train the model has major influence on its capacity to personalize. Moreover, solely optimizing the accuracy of the global model tends to have negative impact on its capacity to personalize, which further questions the correctness of the commonly presented objectives of Federated Learning.
163
+
164
+ Challenges for Model Agnostic Meta Learning. The objectives in the Model Agnostic Meta Learning literature are usually only the model performance after adaptation to given task (Finn et al., 2017). In this work, we present the setting of Federated Learning as a good source of practical applications for MAML algorithms. However, to have impact in FL, these methods need to also consider the performance of the initial model,4 as in practice there will be many clients without data available for personalization. In addition, the connectivity constraints in a production deployment emphasize the importance of fast convergence in terms of number of communication rounds. We suggest these objectives become the subject of MAML works, in addition to the performance after adaptation, and to consider the datasets with a natural user/client structure being established for Federated Learning (Caldas et al., 2018b) as the source of experiments for supervised learning.
165
+
166
+ Challenges for broader Machine Learning. The empirical evaluation in this work raises a number of questions of relevance to Machine Learning research in general. In particular, Figure 2 clearly shows that models with similar initial accuracy can have very different capacity to personalize to a task of the same type as it was trained on. This observation raises obvious questions for which we currently cannot provide an answer. How does the training algorithm impact personalization ability of the trained model? Is there something we can measure that will predict the adaptability of the model? Is it something we can directly optimize for, potentially leading to novel optimization methods? These questions can relate to a gap highlighted in Table 2. While the common measures could suggest the global model is overfitting the training data, this is not true of the personalized model.
167
+
168
+ Transfer Learning is another technique for which our result could inspire a novel solution. It is very common for machine learning practitioners to take a trained model from the research community, replace the final layer with a different output class of interest, and retrain for the new task (Oquab et al., 2014). We conjecture that the algorithms proposed in the FL and MAML communities, could yield base models for which this kind of domain adaptation would yield better results.
169
+
170
+ Finally, we believe that a systematic analysis of optimization algorithms of the inner-outer structure presented in Algorithm 1 could provide novel insights into the connections between optimization and generalization. Apart from the FL and MAML algorithms, Zhang et al. (2019) recently proposed a method that can be interpreted as outer optimizer in the general algorithm, which improves the stability of a variety of existing optimization methods used as the inner optimizer.
171
+
172
+ # REFERENCES
173
+
174
+ Antreas Antoniou, Harrison Edwards, and Amos Storkey. How to train your maml. arXiv preprint arXiv:1810.09502, 2018.
175
+
176
+ Francoise Beaufays, Khe Chai Sim, and Petr Zadrazil. An investigation into on-device personalization of end-to-end automatic speech recognition models. In Interspeech, 2019.
177
+
178
+ Keith Bonawitz, Vladimir Ivanov, Ben Kreuter, Antonio Marcedone, H Brendan McMahan, Sarvar Patel, Daniel Ramage, Aaron Segal, and Karn Seth. Practical secure aggregation for privacypreserving machine learning. In Proceedings of the 2017 ACM SIGSAC Conference on Computer and Communications Security, pp. 1175–1191. ACM, 2017.
179
+
180
+ Keith Bonawitz, Hubert Eichner, Wolfgang Grieskamp, Dzmitry Huba, Alex Ingerman, Vladimir Ivanov, Chloe Kiddon, Jakub Kone ´ cnˇ y, Stefano Mazzocchi, H Brendan McMahan, Timon ´ Van Overveldt, David Petrou, Daniel Ramage, and Jason Roselander. Towards federated learning at scale: System design. 2019.
181
+
182
+ Sebastian Caldas, Jakub Konecnˇ y, H Brendan McMahan, and Ameet Talwalkar. Expanding ´ the reach of federated learning by reducing client resource requirements. arXiv preprint arXiv:1812.07210, 2018a.
183
+
184
+ Sebastian Caldas, Peter Wu, Tian Li, Jakub Konecnˇ y, H Brendan McMahan, Virginia Smith, and ´ Ameet Talwalkar. Leaf: A benchmark for federated settings. arXiv preprint arXiv:1812.01097, 2018b.
185
+
186
+ Jeffrey Dean, Greg Corrado, Rajat Monga, Kai Chen, Matthieu Devin, Mark Mao, Marc’aurelio Ranzato, Andrew Senior, Paul Tucker, Ke Yang, et al. Large scale distributed deep networks. In Advances in neural information processing systems, pp. 1223–1231, 2012.
187
+
188
+ Chelsea Finn, Pieter Abbeel, and Sergey Levine. Model-agnostic meta-learning for fast adaptation of deep networks. In Proceedings of the 34th International Conference on Machine LearningVolume 70, pp. 1126–1135. JMLR. org, 2017.
189
+
190
+ Andrew Hard, Kanishka Rao, Rajiv Mathews, Franc¸oise Beaufays, Sean Augenstein, Hubert Eichner, Chloe Kiddon, and Daniel Ramage. Federated learning for mobile keyboard prediction. ´ arXiv preprint arXiv:1811.03604, 2018.
191
+
192
+ Alex Ingerman and Krzys Ostrowski. Introducing tensorflow federated, 2019. URL https://medium.com/tensorflow/ introducing-tensorflow-federated-a4147aa20041.
193
+
194
+ Mikhail Khodak, Maria Florina-Balcan, and Ameet Talwalkar. Adaptive gradient-based metalearning methods. arXiv preprint arXiv:1906.02717, 2019.
195
+
196
+ Jakub Konecnˇ y, H Brendan McMahan, Daniel Ramage, and Peter Richt ´ arik. Federated optimization: ´ Distributed machine learning for on-device intelligence. arXiv preprint arXiv:1610.02527, 2016a.
197
+
198
+ 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, 2016b.
199
+
200
+ Brenden M Lake, Ruslan Salakhutdinov, and Joshua B Tenenbaum. Human-level concept learning through probabilistic program induction. Science, 350(6266):1332–1338, 2015.
201
+
202
+ Yann LeCun, Yoshua Bengio, and Geoffrey Hinton. Deep learning. nature, 521(7553):436, 2015.
203
+
204
+ Tian Li, Anit Kumar Sahu, Ameet Talwalkar, and Virginia Smith. Federated learning: Challenges, methods, and future directions. arXiv preprint arXiv:1908.07873, 2019a.
205
+
206
+ Xiang Li, Kaixuan Huang, Wenhao Yang, Shusen Wang, and Zhihua Zhang. On the convergence of fedavg on non-iid data. arXiv preprint arXiv:1907.02189, 2019b.
207
+
208
+ Brendan McMahan, Eider Moore, Daniel Ramage, Seth Hampson, and Blaise Aguera y Arcas. Communication-efficient learning of deep networks from decentralized data. In Artificial Intelligence and Statistics, pp. 1273–1282, 2017.
209
+ H Brendan McMahan and Daniel Ramage. Federated learning: Collaborative machine learning without centralized training data, 2017. https://ai.googleblog.com/2017/04/ federated-learning-collaborative.html.
210
+ H Brendan McMahan, Daniel Ramage, Kunal Talwar, and Li Zhang. Learning differentially private recurrent language models. In International Conference on Learning Representations, 2018. URL https://openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ BJ0hF1Z0b.
211
+ Alex Nichol, Joshua Achiam, and John Schulman. On first-order meta-learning algorithms. arXiv preprint arXiv:1803.02999, 2018.
212
+ Maxime Oquab, Leon Bottou, Ivan Laptev, and Josef Sivic. Learning and transferring mid-level image representations using convolutional neural networks. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 1717–1724, 2014.
213
+ Jianyu Wang and Gauri Joshi. Adaptive communication strategies to achieve the best error-runtime trade-off in local-update sgd. arXiv preprint arXiv:1810.08313, 2018.
214
+ Qiang Yang, Yang Liu, Tianjian Chen, and Yongxin Tong. Federated machine learning: Concept and applications. ACM Transactions on Intelligent Systems and Technology (TIST), 10(2):12, 2019.
215
+ Michael R Zhang, James Lucas, Geoffrey Hinton, and Jimmy Ba. Lookahead optimizer: k steps forward, 1 step back. arXiv preprint arXiv:1907.08610, 2019.
216
+
217
+ # A APPENDIX
218
+
219
+ This Appendix contains further details referenced from the main body of the paper.
220
+
221
+ # A.1 FINE TUNING OPTIMIZERS
222
+
223
+ Table 3 summarizes the attempts at fine tuning the model user in main body with different server optimizers. We see that comparing the same client optimizers, Adam consistently provides better and more stable results in terms of initial accuracy.
224
+
225
+ Table 3: Fine-tuning Result of EMNIST-62 with different server optimizers.
226
+
227
+ <table><tr><td rowspan=1 colspan=1>EMNIST-62 Model</td><td rowspan=1 colspan=1>Initial Acc</td><td rowspan=1 colspan=1>Pers Acc</td></tr><tr><td rowspan=1 colspan=1>FedAvg E=10 w/o finetuning Momentum(lr=1.0, 0.9)</td><td rowspan=1 colspan=1>0.7441</td><td rowspan=1 colspan=1>0.8842</td></tr><tr><td rowspan=1 colspan=1>Finetune with FedSGD (Reptile(1)) AdamFinetune with Reptile(5) AdamFinetune with Reptile(10) Adam</td><td rowspan=1 colspan=1>0.8320 (0.0133)0.8265 (0.0160)0.8116 (0.0148)</td><td rowspan=1 colspan=1>0.8764 (0.0017)0.8807 (0.0020)0.8858 (0.0014)</td></tr><tr><td rowspan=1 colspan=1>Finetune with Reptile(1) SGD(lr=0.1)Finetune with Reptile(1) Momentum(lr=0.01, 0.9)</td><td rowspan=1 colspan=1>0.8260 (0.0161)0.8279 (0.0119)</td><td rowspan=1 colspan=1>0.8758 (0.0020)0.8745 (0.0014)</td></tr><tr><td rowspan=1 colspan=1>Finetune with Reptile(5) SGD(lr=0.1)Finetune with Reptile(5) Momentum(lr=0.01, 0.9)</td><td rowspan=1 colspan=1>0.8148 (0.0280)0.8005 (0.0329)</td><td rowspan=1 colspan=1>0.8829 (0.0012)0.8828 (0.0015)</td></tr><tr><td rowspan=1 colspan=1>Finetune with Reptile(10) SGD(lr=0.1)Finetune with Reptile(10) Momentum(lr=0.01, 0.9)</td><td rowspan=1 colspan=1>0.8074 (0.0294)0.8140 (0.0246)</td><td rowspan=1 colspan=1>0.8855 (0.0012)0.8860 (0.0009)</td></tr></table>
228
+
229
+ # A.2 PER-CLIENT PERSONALIZATION RESULTS
230
+
231
+ Figure 4 visualizes the distribution of initial and personalized accuracies on a per-client basis. Each dot represents a random sample of the test clients used for personalization experiments. Studying this distribution is of great importance, as in practical deployment, degrading a user’s experience might incur disproportionate cost, compared to the benefit of comparable improvement. Designing methods that robustly identify the clients below the diagonal line and at least revert to the initial model is worth of future investigation.
232
+
233
+ ![](images/e058061422739eadcaabba5da9127c2a526bcbe390deca656d00af85d4051434.jpg)
234
+ Figure 4: Performance for sample of test clients for EMNIST-62 (left) and Shakespeare (right)
md/train/BkedwoC5t7/BkedwoC5t7.md ADDED
@@ -0,0 +1,357 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # FORMAL LIMITATIONS ON THE MEASUREMENT OF MUTUAL INFORMATION
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Motivated by applications to unsupervised learning, we consider the problem of measuring mutual information. Recent analysis has shown that naive kNN estimators of mutual information have serious statistical limitations motivating more refined methods. In this paper we prove that serious statistical limitations are inherent to any measurement method. More specifically, we show that any distributionfree high-confidence lower bound on mutual information cannot be larger than $O ( \ln N )$ where $N$ is the size of the data sample. We also analyze the DonskerVaradhan lower bound on KL divergence in particular and show that, when simple statistical considerations are taken into account, this bound can never produce a high-confidence value larger than $\ln { N }$ . While large high-confidence lower bounds are impossible, in practice one can use estimators without formal guarantees. We suggest expressing mutual information as a difference of entropies and using cross entropy as an entropy estimator. We observe that, although cross entropy is only an upper bound on entropy, cross-entropy estimates converge to the√ true cross entropy at the rate of $1 / \sqrt { N }$ .
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Motivated by maximal mutual information (MMI) predictive coding (McAllester, 2018; Stratos, 2018; Oord et al., 2018), we consider the problem of measuring mutual information. A classical approach to this problem is based on estimating entropies by computing the average log of the distance to the kth nearest neighbor in a sample (Kraskov et al., 2003). It has recently been shown that the classical kNN methods have serious statistical limitations and more refined kNN methods have been proposed (Gao et al., 2014). Here we establish serious statistical limitations on any method of estimating mutual information. More specifically, we show that any distribution-free high-confidence lower bound on mutual information cannot be larger than $O ( \ln N )$ where $N$ is the size of the data sample.
12
+
13
+ Prior to proving the general case, we consider the particular case of the Donsker-Varadhan lower bound on KL divergence (Donsker & Varadhan, 1983; Belghazi et al., 2018). We observe that when simple statistical considerations are taken into account, this bound can never produce a highconfidence value larger than $\ln { N }$ . Similar comments apply to lower bounds based on contrastive estimation. The contrastive estimation lower bound given in Oord et al. (2018) does not establish mutual information of more than $\ln k$ where $k$ is number of negative samples used in the contrastive choice.
14
+
15
+ The difficulties arise in cases where the mutual information $I ( x , y )$ is large. Since $I ( x , y ) =$ $H ( y ) - H ( y | x )$ we are interested in cases where $H ( y )$ is large and $H ( y | x )$ is small. For example consider the mutual information between an English sentence and its French translation. Sampling English and French independently will (almost) never yield two sentences where one is a plausible translation of the other. In this case the DV bound is meaningless and contrastive estimation is trivial. In this example we need a language model for estimating $H ( y )$ and a translation model for estimating $H ( y | x )$ . Language models and translation models are both typically trained with crossentropy loss. Cross-entropy loss can be used as an (upper bound) estimate of entropy and we get an estimate of mutual information as a difference of cross-entropy estimates. Note that the upper-bound guarantee for the cross-entropy estimator yields neither an upper bound nor a lower bound guarantee for a difference of entropies. Similar observations apply to measuring the mutual information for pairs of nearby frames of video or pairs of sound waves for utterances of the same sentence.
16
+
17
+ We are motivated by the problem of maximum mutual information predictive coding (McAllester, 2018; Stratos, 2018; Oord et al., 2018). One can formally define a version of MMI predictive coding by considering a population distribution on pairs $( x , y )$ where we think of $x$ as past raw sensory signals (images or sound waves) and $y$ as a future sensory signal. We consider the problem of learning stochastic coding functions $C _ { x }$ and $C _ { y }$ so as to maximize the mutual information $I ( C _ { x } ( x ) , C _ { y } ( y ) )$ while limiting the entropies $H ( C _ { x } ( x ) )$ and $H ( C _ { y } ( y ) )$ . The intuition is that we want to learn representations $C _ { x } ( x )$ and $C _ { y } ( y )$ that preserve “signal” while removing “noise”. Here signal is simply defined to be a low entropy representation that preserves mutual information with the future. Forms of MMI predictive coding have been independently introduced in (McAllester, 2018) under the name “information-theoretic cotraining” and in (Oord et al., 2018) under the name “contrastive predictive coding”. It is also possible to interpret the local version of DIM (DIM(L)) (Hjelm et al., 2018) as a variant of MMI predictive coding.
18
+
19
+ A closely related framework is the information bottleneck (Tishby et al., 2000). Here one again assumes a population distribution on pairs $( x , y )$ . The objective is to learn a stochastic coding function $C _ { x }$ so as to maximize $I ( C _ { x } ( x ) , y )$ while minimizing $I ( C _ { x } ( x ) , x )$ . Here one does not ask for a coding function on $y$ and one does not limit $H ( C _ { x } ( x ) )$ .
20
+
21
+ Another related framework is INFOMAX (Linsker, 1988; Bell & Sejnowski, 1995; Hjelm et al., 2018). Here we consider a population distribution on a single random variable $x$ . The objective is to learn a stochastic coding function $C _ { x }$ so as to maximize the mutual information $I ( x , C _ { x } ( x ) )$ subject to some constraint or additional objective.
22
+
23
+ As mentioned above, in cases where $I ( C _ { x } ( x ) , C _ { y } ( y ) )$ is large it seems best to train a model of the marginal distribution of $P ( C _ { y } )$ and a model of the conditional distribution $P ( C _ { y } | C _ { x } )$ where both models are trained with cross-entropy loss. Section 5 gives various high confidence upper bounds on cross-entropy loss for learned models. The main point is that, unlike lower bounds on entropy, high-confidence upper bounds on cross-entropy loss can be guaranteed to be close to the true cross entropy.
24
+
25
+ Out theoretical analyses will assume discrete distributions. However, there is no loss of generality in this assumption. Rigorous treatments of probability (measure theory) treat integrals (either Riemann or Lebesgue) as limits of increasingly fine binnings. A continuous density can always be viewed as a limit of discrete distributions. Although our proofs are given for discrete case, all our formal limitations on the measurement of mutual information apply to continuous case as well. See Marsh (2013) for a discussion of continuous information theory. Additional comments on this point are given in section 4.
26
+
27
+ # 2 THE DONSKER-VARADHAN LOWER BOUND
28
+
29
+ Mutual information can be written as a $\mathrm { K L }$ divergence.
30
+
31
+ $$
32
+ I ( X , Y ) = K L ( P _ { X , Y } , P _ { X } P _ { Y } )
33
+ $$
34
+
35
+ Here $P _ { X , Y }$ is a joint distribution on the random variables $X$ and $Y$ and $P _ { X }$ and $P _ { Y }$ are the marginal distributions on $X$ and $Y$ respectively. The DV lower bound applies to KL-divergence generally. To derive the DV bound we start with the following observation for any distributions $P , Q$ , and $G$ on the same support. Our theoretical analyses will assume discrete distributions.
36
+
37
+ $$
38
+ \begin{array} { l l l } { { K L ( P , Q ) } } & { { = } } & { { \displaystyle { E _ { z \sim P } \ \ln \frac { P ( z ) } { { \cal Q } ( z ) } } } } \\ { { } } & { { = } } & { { \displaystyle { E _ { z \sim P } \ \ln \left( \frac { { \cal G } ( z ) } { { \cal Q } ( z ) } \frac { P ( z ) } { { \cal G } ( z ) } \right) } } } \\ { { } } & { { = } } & { { \displaystyle { E _ { z \sim P } \ \ln \frac { { \cal G } ( z ) } { { \cal Q } ( z ) } + K L ( P , G ) } } } \\ { { } } & { { \geq } } & { { \displaystyle { E _ { z \sim P } \ \ln \frac { { \cal G } ( z ) } { { \cal Q } ( z ) } } } } \end{array}
39
+ $$
40
+
41
+ Note that (1) achieves equality for $G ( z ) = P ( z )$ and hence we have
42
+
43
+ $$
44
+ K L ( P , Q ) = \operatorname* { s u p } _ { G } \ E _ { z \in P } \ \ln { \frac { G ( z ) } { Q ( z ) } }
45
+ $$
46
+
47
+ Here we can let $G$ be a parameterized model such that $G ( z )$ can be computed directly. However, we are interested in $K L ( P _ { X , Y } , P _ { X } P _ { Y } )$ where our only access to the distribution $P$ is through sampling. If we draw a pair $( x , y )$ and ignore $y$ we get a sample from $P _ { X }$ . We can similarly sample from $P _ { Y }$ . So we are interested in a KL-divergence $K L ( P , Q )$ where our only access to the distributions $P$ and $Q$ is through sampling. Note that we cannot evaluate (1) by sampling from $P$ because we have no way of computing $Q ( z )$ . But through a change of variables we can convert this to an expression restricted to sampling from $Q$ . More specifically we define $G ( z )$ in terms of an unconstrained function $F ( z )$ as
48
+
49
+ $$
50
+ G ( z ) = \frac { 1 } { Z } Q ( z ) e ^ { F ( z ) } ~ Z = \sum _ { z } Q ( z ) e ^ { F ( z ) } = E _ { z \sim Q } ~ e ^ { F ( z ) }
51
+ $$
52
+
53
+ Substituting (3) into (2) gives
54
+
55
+ $$
56
+ K L ( P , Q ) = \operatorname* { s u p } _ { F } \ E _ { z \sim P } \ F ( z ) - \ln E _ { z \sim Q } \ e ^ { F ( z ) }
57
+ $$
58
+
59
+ Equation (4) is the Donsker-Varadhan lower bound. Applying this to mutual information we get
60
+
61
+ $$
62
+ \begin{array} { l c l } { { I ( X , Y ) } } & { { = } } & { { K L ( P _ { X , Y } , P _ { X } P _ { Y } ) } } \\ { { } } & { { } } & { { } } \\ { { } } & { { = } } & { { \underset { F } { \operatorname* { s u p } } \ E _ { x , y \sim P _ { X , Y } } \ F ( x , y ) - \ln E _ { x \sim P _ { X } , y \sim P _ { Y } } \ e ^ { F ( x , y ) } } } \end{array}
63
+ $$
64
+
65
+ This is the equation underlying the MINE approach to maximizing mutual information (Belghazi et al., 2018). It would seem that we can estimate both terms in (5) through sampling and be able to maximize $I ( X , Y )$ by stochastic gradient ascent on this lower bound.
66
+
67
+ # 3 STATISTICAL LIMITATIONS OF KL-DIVERGENCE LOWER BOUNDS
68
+
69
+ In this section we show that the DV bound (4) cannot be used to measure KL-divergences of more than tens of bits. In fact we will show that no high-confidence distribution-free lower bound on KL divergence can be used for this purpose.
70
+
71
+ As a first observation note that (4) involves $E _ { z \sim Q } ~ e ^ { F ( z ) }$ . This expression has the same form as the moment generating function used in analyzing large deviation probabilities. The utility of expectations of exponentials in large deviation theory is that such expressions can be dominated by extremely rare events (large deviations). The rare events dominating the expectation will never be observed by sampling from $Q$ . It should be noted that the optimal value for $F ( z )$ in (4) is $\ln ( P ( z ) / Q ( z ) )$ in which case the right hand side of (4) simplifies to $K L ( P , Q )$ . But for large KL divergence we will have that $F ( z ) \stackrel { - } { = } \ln ( P ( z ) / Q ( z ) )$ is typically hundreds of bits and this is exactly the case where $E _ { z \sim Q } ~ e ^ { F ( z ) }$ cannot be measured by sampling from $Q$ . If $E _ { z \sim Q } ~ e ^ { F ( z ) }$ is dominated by events that will never occur in sampling from $Q$ then the optimization of $F$ through the use of (4) and sampling from $Q$ cannot possibly lead to a function $F ( z )$ that accurately models the desired function $\ln ( P ( z ) / Q ( z ) )$ .
72
+
73
+ To quantitatively analyze the risk of unseen outlier events we will make use of the following simple lemma where we write $P _ { z \sim Q } ( \Phi [ z ] )$ for the probability over drawing $z$ from $Q$ that the statement $\Phi [ z ]$ holds.
74
+
75
+ Outlier Risk Lemma: For a sample $S ~ \sim ~ Q ^ { N }$ with $N \ \geq \ 2$ , and a property $\Phi [ z ]$ such that $P _ { z \sim Q } ( \Phi [ z ] ) \leq 1 / N$ , the probability over the draw of $S$ that no $z \in S$ satisfies $\Phi [ z ]$ is at least $1 / 4$ .
76
+
77
+ Proof: The probability that $\Phi [ z ]$ is unseen in the sample is at least $( 1 - 1 / N ) ^ { N }$ which is at least $1 / 4$ for $N \geq 2$ and where we have $\begin{array} { r } { \operatorname* { l i m } _ { N \to \infty } ( 1 - 1 / N ) ^ { N ^ { \bullet } } = 1 / e } \end{array}$ . Q.E.D.
78
+
79
+ We can use the outlier risk lemma to perform a quantitative risk analysis of the DV bound (4). We can rewrite (4) as
80
+
81
+ $$
82
+ \begin{array} { r c l } { K L ( P , Q ) } & { \geq } & { { \cal B } ( P , Q , F ) } \\ { { \cal B } ( P , Q , F ) } & { = } & { { \cal E } _ { z \sim P } ~ F ( z ) - \ln { \cal E } _ { z \sim Q } ~ e ^ { F ( z ) } } \end{array}
83
+ $$
84
+
85
+ We can try to estimate $B ( P , Q , G )$ from samples $S _ { P }$ and $S _ { Q }$ , each of size $N$ , from the population distributions $P$ and $Q$ respectively.
86
+
87
+ $$
88
+ \hat { B } ( S _ { P } , S _ { Q } , F ) = \frac { 1 } { N } \sum _ { z \in S _ { P } } F ( z ) - \ln \frac { 1 } { N } \sum _ { z \in S _ { Q } } e ^ { F ( z ) }
89
+ $$
90
+
91
+ While $B ( P , Q , F )$ is a lower bound on $K L ( P , Q )$ , the sample estimate $\hat { B } ( S _ { P } , S _ { Q } , F )$ is not. To get a high confidence lower bound on $K L ( P , Q )$ we have to handle unseen outlier risk. For a fair comparison with our analysis of cross-entropy estimators in section 5, we will limit the outlier risk by bounding $F ( z )$ to the interval $[ 0 , F _ { \mathrm { m a x } } ]$ . The largest possible value of $\hat { B } ( S _ { P } , S _ { q } , F )$ occurs when $F ( z ) = F _ { \operatorname* { m a x } }$ for all $z \in S _ { P }$ and $F ( z ) = 0$ for all $z \in S _ { Q }$ . In this case we get $\hat { B } ( S _ { P } , S _ { Q } , F ) =$ $F _ { \mathrm { m a x } }$ . But by the outlier risk lemma there is still at least a 1/4 probability that
92
+
93
+ $$
94
+ E _ { z \sim Q } ~ e ^ { F ( z ) } \geq \frac { 1 } { N } e ^ { F _ { \mathrm { m a x } } } .
95
+ $$
96
+
97
+ Any high confidence lower bound $\tilde { B } ( S _ { P } , S _ { Q } , F )$ must account for the unseen outlier risk. In particular we must have
98
+
99
+ $$
100
+ \begin{array} { r c l } { \tilde { B } ( S _ { P } , S _ { Q } , F ) } & { \leq } & { F _ { \operatorname* { m a x } } - \ln \frac { e ^ { F _ { \operatorname* { m a x } } } } { N } } \\ & & { } & \\ & { = } & { \ln N } \end{array}
101
+ $$
102
+
103
+ Our negative results can be strengthened by considering the preliminary bound (1) where $G ( z )$ is viewed as a model of $P ( z )$ . We can consider the extreme case of perfect modeling of the population $P$ with a model $G ( z )$ where $G ( z )$ is computable. In this case we have essentially complete access to the distribution $P$ . But even in this setting we have the following negative result.
104
+
105
+ Theorem 1 Let $B$ be any distribution-free high-confidence lower bound on $K L ( P , Q )$ computed with complete knowledge of $P$ but only a sample from $Q$ .
106
+
107
+ More specifically, let $B ( P , S , \delta )$ be any real-valued function of a distribution $P$ , a multiset $S$ , and $a$ confidence parameter $\delta$ such that, for any $P$ , $Q$ and $\delta$ , with probability at least $( 1 - \delta )$ over a draw of $S$ from $Q ^ { N }$ we have
108
+
109
+ $$
110
+ K L ( P , Q ) \ge B ( P , S , \delta ) .
111
+ $$
112
+
113
+ For any such bound, and for $N \geq 2$ , with probability at least $1 - 4 \delta$ over the draw of $S$ from $Q ^ { N }$ we have
114
+
115
+ $$
116
+ B ( P , S , \delta ) \leq \ln { N } .
117
+ $$
118
+
119
+ Proof. Consider distributions $P$ and $Q$ and $N \geq 2$ . Define $\tilde { Q }$ by
120
+
121
+ $$
122
+ \tilde { Q } ( z ) = \left( 1 - \frac { 1 } { N } \right) Q ( z ) + \frac { 1 } { N } P ( z ) .
123
+ $$
124
+
125
+ We now have $K L ( P , { \tilde { Q } } ) \leq \ln N$ . We will prove that from a sample $S \sim Q ^ { N }$ we cannot reliably distinguish between $Q$ and $\tilde { Q }$ .
126
+
127
+ We first note that by applying the high-confidence guarantee of the bound to $\tilde { Q }$ have
128
+
129
+ $$
130
+ P _ { S \sim \tilde { Q } ^ { N } } ( B ( P , S , \delta ) \leq K L ( P , \tilde { Q } ) ) \geq 1 - \delta .
131
+ $$
132
+
133
+ The distribution $\tilde { Q }$ equals the marginal on $z$ of a distribution on pairs $( s , z )$ where $s$ is the value of Bernoulli variable with bias $1 / N$ such that if $s = 1$ then $z$ is drawn from $P$ and otherwise $z$ is drawn
134
+
135
+ from $Q$ . By the outlier risk lemma the probability that all coins are zero is at least 1/4. Conditioned on all coins being zero the distributions $\tilde { Q } ^ { N }$ and $Q ^ { N }$ are the same. Let $\mathrm { P u r e } ( S )$ represent the event that all coins are 0 and let $\operatorname { S m a l l } ( S )$ represent the event that $B ( P , S , \delta ) \leq \ln { N }$ . We now have
136
+
137
+ $$
138
+ \begin{array} { r l } { P _ { S \sim Q ^ { N } } ( \mathrm { S n a l l } ( \mathrm { S } ) ) } & { = \phantom { P } P _ { S \sim \hat { Q } ^ { N } } ( \mathrm { S n a l l } ( S ) ) \mathrm { P u r e } ( S ) ) } \\ { = } & { \frac { P _ { S \sim \hat { Q } ^ { N } } ( \mathrm { P u r e } ( S ) \times \mathrm { S u n a l } ( \mathrm { S } ) ) } { P _ { S \sim \hat { Q } ^ { N } } ( \mathrm { P u r e } ( S ) ) } } \\ { \ge } & { \frac { P _ { S \sim \hat { Q } ^ { N } } ( \mathrm { P u r e } ( S ) ) - P _ { S \sim \hat { Q } ^ { N } } ( \mathrm { - S u n a l l } ( \mathrm { S } ) ) } { P _ { S \sim Q ^ { N } } ( \mathrm { P u r e } ( S ) ) } } \\ { \ge } & { \frac { P _ { S \sim \hat { Q } ^ { N } } ( \mathrm { P u r e } ( S ) ) - \hat { Q } } { P _ { S \sim \hat { Q } ^ { N } } ( \mathrm { P u r e } ( S ) ) } } \\ { = } & { \frac { P _ { S \sim \hat { Q } ^ { N } } ( \mathrm { P u r e } ( S ) ) - \hat { Q } } { P _ { S \sim \hat { Q } ^ { N } } ( \mathrm { P u r e } ( S ) ) } } \\ { = } & { 1 - \frac { \hat { Q } } { P _ { S \sim \hat { Q } ^ { N } } ( \mathrm { P u r e } ( S ) ) } } \\ { \ge } & { 1 - 4 \delta . } \end{array}
139
+ $$
140
+
141
+ # 4 STATISTICAL LIMITATIONS ON ENTROPY LOWER BOUNDS
142
+
143
+ Mutual information is a special case of KL-divergence. It is possible that tighter lower bounds can be given in this special case. In this section we show similar limitations on lower bounding mutual information. We first note that a lower bound on mutual information implies a lower bound on entropy. The mutual information between $X$ and $Y$ cannot be larger than information content of $X$ alone.
144
+
145
+ $$
146
+ I ( X , Y ) = H ( X ) - H ( X | Y ) \leq H ( X )
147
+ $$
148
+
149
+ So a lower bound on $I ( X , Y )$ gives a lower bound on $H ( X )$ . We show that any distribution-free high-confidence lower bound on entropy requires a sample size exponential in the size of the bound.
150
+
151
+ The above argument seems problematic for the case of continuous densities as differential entropy can be negative. However, for the continuous case we have
152
+
153
+ $$
154
+ I ( x , y ) = \operatorname* { s u p } _ { C _ { x } , C _ { y } } I ( C _ { x } ( x ) , C _ { y } ( y ) )
155
+ $$
156
+
157
+ where $C _ { x }$ and $C _ { y }$ range over all maps from the underlying continuous space to discrete sets (all binnings of the continuous space). Hence an $O ( \ln N )$ upper bound on the measurement of mutual information for the discrete case applies to the continuous case as well.
158
+
159
+ The type of a sample $S$ , denoted $\mathcal { T } ( S )$ , is defined to be a function on positive integers (counts) where $\bar { \mathcal { T } } ( S ) ( i )$ is the number of elements of $S$ that occur $i$ times in $S$ . For a sample of $N$ draws we have $\begin{array} { r } { \tilde { N } \stackrel { \cdot } { = } \sum _ { i } i \mathcal { T } ( S ) ( i ) } \end{array}$ . The type $\mathcal { T } ( S )$ contains all information relevant to estimating the actual probability of the items of a given count and of estimating the entropy of the underlying distribution. The problem of estimating distributions and entropies from sample types has been investigated by various authors (McAllester & Schapire, 2000; Orlitsky et al., 2003; Orlitsky & Suresh, 2015; Arora et al., 2018). Here we give the following negative result on lower bounding the entropy of a distribution by sampling.
160
+
161
+ Theorem 2 Let $B$ be any distribution-free high-confidence lower bound on $H ( P )$ computed from a sample type T (S) with S ∼ P N .
162
+
163
+ More specifically, let $B ( \tau , \delta )$ be any real-valued function of a type $\tau$ and a confidence parameter $\delta$ such that for any $P$ , with probability at least $( 1 - \delta )$ over a draw of $S$ from $P ^ { \tilde { N } }$ , we have
164
+
165
+ $$
166
+ H ( P ) \geq B ( { \mathcal { T } } ( S ) , \delta ) .
167
+ $$
168
+
169
+ For any such bound, and for $N \geq 5 0$ and $k \geq 2$ , with probability at least $1 - \delta - 1 . 0 1 / k$ over the draw of $S$ from $P ^ { N }$ we have
170
+
171
+ $$
172
+ B ( { \mathcal { T } } ( S ) , \delta ) \leq \ln 2 k N ^ { 2 } .
173
+ $$
174
+
175
+ Proof: Consider a distribution $P$ and $N \geq 1 0 0$ . If the support of $P$ has fewer than $2 k N ^ { 2 }$ elements then $H ( P ) < \ln 2 k N ^ { 2 }$ and by the premise of the theorem we have that, with probability at least $1 - \delta$ over the draw of $S$ , $B ( { \dot { \mathcal { T } } } ( S ) , { \bar { \delta } } ) \leq H ( P )$ and the theorem follows. If the support of $P$ has at least $2 k N ^ { 2 }$ elements then we sort the support of $P$ into a (possibly infinite) sequence $x _ { 1 } , \ x _ { 2 } , \ x _ { 3 } , . . . .$ so that $P ( x _ { i } ) \geq P ( x _ { i + 1 } )$ . We then define a distribution $\tilde { P }$ on the elements $x _ { 1 }$ $, \ldots , x _ { 2 k N ^ { 2 } }$ by
176
+
177
+ $$
178
+ \tilde { P } ( x _ { i } ) = \left( \begin{array} { l l } { { P ( x _ { i } ) } } & { { \mathrm { f o r } i \leq k N ^ { 2 } } } \\ { { } } & { { } } \\ { { \frac { P ( i > k N ^ { 2 } ) } { k N ^ { 2 } } } } & { { \mathrm { f o r } k N ^ { 2 } < i \leq 2 k N ^ { 2 } } } \end{array} \right)
179
+ $$
180
+
181
+ We will let $\operatorname { S m a l l } ( S )$ denote the event that $B ( \mathcal T ( S ) , \delta ) \le \ln 2 k N ^ { 2 }$ and let ${ \mathrm { P u r e } } ( S )$ abbreviate the event that no element $x _ { i }$ for $i > k N ^ { 2 }$ occurs twice in the sample. Since $\tilde { P }$ has a support of size $2 k N ^ { 2 }$ we have $H ( \tilde { P } ) \leq \ln 2 k N ^ { 2 }$ . Applying the premise of the lemma to $\tilde { P }$ gives
182
+
183
+ $$
184
+ P _ { S \sim \tilde { P } ^ { N } } ( \operatorname { S m a l l } ( S ) ) \geq 1 - \delta
185
+ $$
186
+
187
+ For a type $\tau$ let $P _ { S \sim P ^ { N } } ( \mathcal { T } )$ denote the probability over drawing $S \sim P ^ { N }$ that $\mathcal { T } ( S ) = \mathcal { T }$ . We now have
188
+
189
+ $$
190
+ P _ { S \sim P ^ { N } } ( \mathcal { T } | \mathrm { P u r e } ( S ) ) = P _ { S \sim \tilde { P } ^ { N } } ( \mathcal { T } | \mathrm { P u r e } ( S ) ) .
191
+ $$
192
+
193
+ This gives the following.
194
+
195
+ $$
196
+ \begin{array} { r c l } { P _ { S \sim P ^ { N } } ( \mathrm { S m a l l } ( S ) ) } & { \geq } & { P _ { S \sim P ^ { N } } ( \mathrm { P u r e } ( S ) \wedge \mathrm { S m a l l } ( S ) ) } \\ & { = } & { P _ { S \sim P ^ { N } } ( \mathrm { P u r e } ( S ) ) P _ { S \sim P ^ { N } } ( \mathrm { S m a l l } ( S ) \mid \mathrm { P u r e } ( S ) ) } \\ & { = } & { P _ { S \sim P ^ { N } } ( \mathrm { P u r e } ( S ) ) P _ { S \sim \tilde { P } ^ { N } } ( \mathrm { S m a l l } ( S ) \mid \mathrm { P u r e } ( S ) ) } \\ & { \geq } & { P _ { S \sim P ^ { N } } ( \mathrm { P u r e } ( S ) ) P _ { S \sim \tilde { P } ^ { N } } ( \mathrm { P u r e } ( S ) \wedge \mathrm { S m a l l } ( S ) ) } \end{array}
197
+ $$
198
+
199
+ For $i > k N ^ { 2 }$ we have $\tilde { P } ( x _ { i } ) \leq 1 / ( k N ^ { 2 } )$ which gives
200
+
201
+ $$
202
+ P _ { S \sim \tilde { P } ^ { N } } ( \mathrm { P u r e } ( S ) ) \geq \prod _ { j = 1 } ^ { N - 1 } \left( 1 - \frac { j } { k N ^ { 2 } } \right)
203
+ $$
204
+
205
+ Using $( 1 - P ) \ge e ^ { - 1 . 0 1 \ P }$ for $P \leq 1 / 1 0 0$ we have the following birthday paradox calculation.
206
+
207
+ $$
208
+ \begin{array} { l c l } { { \ln P _ { S \sim \tilde { P } ^ { N } } ( \mathrm { P u r e } ( S ) ) } } & { { \geq } } & { { \displaystyle - \frac { 1 . 0 1 } { k N ^ { 2 } } \sum _ { j = 1 } ^ { N - 1 } j } } \\ { { } } & { { } } & { { } } \\ { { \displaystyle } } & { { = } } & { { \displaystyle - \frac { 1 . 0 1 } { k N ^ { 2 } } \frac { ( N - 1 ) N } { 2 } \ ~ } } \\ { { } } & { { \geq } } & { { \displaystyle - 5 0 5 / k } } \\ { { P _ { S \sim \tilde { P } ^ { N } } ( \mathrm { P u r e } ( S ) ) } } & { { \geq } } & { { \displaystyle e ^ { - . 5 0 5 / k } \geq 1 - . 5 0 5 / k } } \end{array}
209
+ $$
210
+
211
+ Applying the union bound to (7) and (9) gives.
212
+
213
+ $$
214
+ P _ { S \sim \tilde { P } ^ { N } } ( \mathrm { P u r e } ( S ) \wedge \mathrm { S m a l l } ( S ) ) \geq 1 - \delta - . 5 0 5 / k
215
+ $$
216
+
217
+ By a derivation similar to that of (9) we get
218
+
219
+ $$
220
+ P _ { S \sim P ^ { N } } ( \mathrm { P u r e } ( S ) ) \geq 1 - . 5 0 5 / k
221
+ $$
222
+
223
+ Combining (8), (10) and (11) gives
224
+
225
+ $$
226
+ P _ { S \sim P ^ { N } } ( \operatorname { S m a l l } ( S ) ) \geq 1 - \delta - 1 . 0 1 / k
227
+ $$
228
+
229
+ # 5 CROSS ENTROPY AS AN ENTROPY ESTIMATOR
230
+
231
+ Since mutual information can be expressed as a difference of entropies, the problem of measuring mutual information can be reduced to the problem of measuring entropies. In this section we show that, unlike high-confidence distribution-free lower bounds, high-confidence distribution-free upper bounds on entropy can approach the true cross entropy at modest sample sizes even when the true cross entropy is large. More specifically we consider the cross-entropy upper bound.
232
+
233
+ $$
234
+ \begin{array} { l l l } { \displaystyle H ( P ) } & { = } & { \displaystyle { E _ { x \sim P } \ln \frac { 1 } { P ( x ) } } } \\ { \displaystyle } & { = } & { \displaystyle E _ { x \sim P } \ln \left( \frac { 1 } { G ( x ) } \frac { G ( x ) } { P ( x ) } \right) } \\ { \displaystyle } & { = } & { \displaystyle H ( P , G ) - K L ( P , G ) } \\ { \displaystyle } & { \le } & { \displaystyle H ( P , G ) } \end{array}
235
+ $$
236
+
237
+ For $G = P$ we get ${ \cal H } ( P , G ) = { \cal H } ( P )$ and hence we have
238
+
239
+ $$
240
+ H ( P ) = \operatorname* { i n f } _ { G } ~ H ( P , G )
241
+ $$
242
+
243
+ In practice $P$ is a population distribution and $G$ is model of $P$ . For example $P$ might be a population distribution on paragraphs and $G$ might be an autoregressive RNN language model. In practice $G$ will be given by a network with parameters $\Phi$ . In this setting we have the following upper bound entropy estimator.
244
+
245
+ $$
246
+ \hat { H } ( P ) \quad = \quad \underset { \Phi } { \operatorname* { i n f } } H ( P , G _ { \Phi } )
247
+ $$
248
+
249
+ The gap between ${ \hat { H } } ( P )$ and $H ( P )$ depends on the expressive power of the model class.
250
+
251
+ The statistical limitations on distribution-free high-confidence lower bounds on entropy do not arise for cross-entropy upper bounds. For upper bounds we can show that naive sample estimates of the cross-entropy loss produce meaningful (large entropy) results. We first define the cross-entropy estimator from a sample $S$ .
252
+
253
+ $$
254
+ { \hat { H } } ( S , G ) = { \frac { 1 } { | S | } } \sum _ { x \in S } - \ln G ( x )
255
+ $$
256
+
257
+ We can bound the loss of a model $G$ by ensuring a minimum probability $e ^ { - F _ { \operatorname* { m a x } } }$ where $F _ { \mathrm { m a x } }$ is then the maximum possible log loss in the cross-entropy objective. In language modeling a loss bound exists for any model that ultimately backs off to a uniform distribution on characters. Given a loss bound of $F _ { \mathrm { m a x } }$ we have that ${ \hat { H } } ( S , G )$ is just the standard sample mean estimator of an expectation of a bounded variable. In this case we have the following standard confidence interval.
258
+
259
+ Theorem 3 For any population distribution $P$ , and model distribution $G$ with $- l n G ( x )$ bounded to the interval $[ 0 , F _ { \mathrm { m a x } } ]$ , with probability at least $1 - \delta$ over the draw of $S \sim P ^ { N }$ we have
260
+
261
+ $$
262
+ H ( P , G ) \in { \hat { H } } ( S , G ) \pm F _ { \operatorname* { m a x } } { \sqrt { \frac { \ln { \frac { 2 } { \delta } } } { 2 N } } }
263
+ $$
264
+
265
+ It is also possible to give PAC-Bayesian bounds on ${ \cal H } ( P , G _ { \Phi } )$ that take into account the fact that $G _ { \Phi }$ is typically trained so as to minimize the empirical loss on the training data. The PAC-Bayesian bounds apply to“broad basin” losses and loss estimates such as the following.
266
+
267
+ $$
268
+ \begin{array} { r c l } { { { \cal H } _ { \sigma } ( S , G _ { \Phi } ) } } & { { = } } & { { E _ { x \sim P } ~ E _ { \epsilon \sim N ( 0 , \sigma I ) } ~ - \ln ~ G _ { \Phi + \epsilon } ( x ) } } \\ { { \hat { H } _ { \sigma } ( S , G _ { \Phi } ) } } & { { = } } & { { \displaystyle { \frac { 1 } { | S | } \sum _ { x \in S } ~ E _ { \epsilon \sim N ( 0 , \sigma I ) } ~ - \ln ~ G _ { \Phi + \epsilon } ( x ) } } } \end{array}
269
+ $$
270
+
271
+ Under mild smoothness conditions on $G _ { \Phi } ( x )$ as a function of $\Phi$ we have
272
+
273
+ $$
274
+ \begin{array} { r c l } { { \displaystyle \operatorname * { l i m } _ { \sigma \to 0 } ~ H _ { \sigma } ( P , G _ { \Phi } ) } } & { { = } } & { { H ( P , G _ { \Phi } ) } } \\ { { \displaystyle \operatorname * { l i m } _ { \sigma \to 0 } ~ \hat { H } _ { \sigma } ( S , G _ { \Phi } ) } } & { { = } } & { { \hat { H } ( S , G _ { \Phi } ) } } \end{array}
275
+ $$
276
+
277
+ An L2 PAC-Bayesian generalization bound (McAllester (2013)) gives that for any parameterized class of models and any bounded notion of loss, and any $\lambda > 1 / 2$ and $\sigma > 0$ , with probability at least $1 - \delta$ over the draw of $S$ from $P ^ { N }$ we have the following simultaneously for all parameter vectors $\Phi$ .
278
+
279
+ $$
280
+ H _ { \sigma } ( P , G _ { \Phi } ) \leq \frac { 1 } { 1 - \frac { 1 } { 2 \lambda } } \left( \hat { H } _ { \sigma } ( S , G _ { \Phi } ) + \frac { \lambda F _ { \operatorname* { m a x } } } { N } \left( \frac { | | \Phi | | ^ { 2 } } { 2 \sigma ^ { 2 } } + \ln \frac { 1 } { \delta } \right) \right)
281
+ $$
282
+
283
+ It is instructive to set $\lambda = 5$ in which case the bound becomes.
284
+
285
+ $$
286
+ H _ { \sigma } ( P , G _ { \Phi } ) \leq \frac { 1 0 } { 9 } \left( \hat { H } _ { \sigma } ( S , G _ { \Phi } ) + \frac { 5 F _ { \operatorname* { m a x } } } { N } \left( \frac { | | \Phi | | ^ { 2 } } { 2 \sigma ^ { 2 } } + \ln \frac { 1 } { \delta } \right) \right)
287
+ $$
288
+
289
+ While this bound is linear in $1 / N$ , and tighter in practice than square root bounds, note that there is a small residual gap when holding $\lambda$ fixed at 5 while taking $N \to \infty$ . In practice the regularization parameter $\lambda$ can be tuned on holdout data. One point worth noting is the form of the dependence of the regularization coefficient on $F _ { \mathrm { m a x } }$ , $N$ and the basin parameter $\sigma$ .
290
+
291
+ It is also worth noting that the bound can be given in terms of “distance traveled” in parameter space from an initial (random) parameter setting $\Phi _ { 0 }$ .
292
+
293
+ $$
294
+ H _ { \sigma } ( P , G _ { \Phi } ) \leq { \frac { 1 0 } { 9 } } \left( { \hat { H } } _ { \sigma } ( S , G _ { \Phi } ) + { \frac { 5 F _ { \operatorname* { m a x } } } { N } } \left( { \frac { | | \Phi - \Phi _ { 0 } | | ^ { 2 } } { 2 \sigma ^ { 2 } } } + \ln { \frac { 1 } { \delta } } \right) \right)
295
+ $$
296
+
297
+ Evidence is presented in Dziugaite & Roy (2017) that the distance traveled bounds are tighter in practice than traditional L2 generalization bounds.
298
+
299
+ # 6 MMI PREDICTIVE CODING
300
+
301
+ Recall that in MMI predictive coding we assume a population distribution on pairs $( x , y )$ where we think of $x$ as past raw sensory signals (images or sound waves) and $y$ as a future sensory signal. We then consider the problem of learning stochastic coding functions $C _ { x }$ and $C _ { y }$ that maximizes the mutual information $I ( C _ { x } ( x ) , C _ { y } ( y ) )$ while limiting the entropies $H ( C _ { x } ( x ) )$ and $H ( C _ { y } ( y ) )$ . Here we propose representing the mutual information as a difference of entropies.
302
+
303
+ $$
304
+ I ( C _ { x } ( x ) , C _ { y } ( y ) ) = H ( C _ { y } ( y ) ) - H ( C _ { y } ( y ) | C _ { x } ( x ) )
305
+ $$
306
+
307
+ When the coding functions are parameterized by a function $\Psi$ , the above quantities become a function of $\Psi$ . We can then formulate the following nested optimization problem.
308
+
309
+ $$
310
+ \begin{array} { r c l } { \Psi ^ { * } } & { = } & { \underset { \Psi } { \mathrm { a r g m a x } } \ \hat { H } ( C _ { y } ( y ) ; \ \Psi ) - \hat { H } ( C _ { y } ( y ) | C _ { x } ( x ) ; \Psi ) } \\ & & \\ { \hat { H } ( C _ { y } ( y ) ; \ \Psi ) } & { = } & { \underset { \Theta } { \mathrm { i n f } } \ H ( C _ { y } ( y ) , G _ { \Theta } ; \ \Psi ) } \\ { \hat { H } ( C _ { y } ( y ) | C _ { x } ( x ) ; \ \Psi ) } & { = } & { \underset { \Phi } { \mathrm { i n f } } \ H ( C _ { y } ( y ) , G _ { \Phi } | C _ { x } ( x ) ; \ \Psi ) } \end{array}
311
+ $$
312
+
313
+ The above quantities are expectations over the population distribution on pairs $( x , y )$ . In practice we have only a finite sample form the population. But the preceding section presents theoretical evidence that, unlike lower bound estimators, upper bound cross-entropy estimators can meaningfully estimate large entropies from feasible samples.
314
+
315
+ # 7 CONCLUSIONS
316
+
317
+ Maximum mutual information (MMI) predictive coding seems well motivated as a method of unsupervised pretraining of representations that maintain semantic signal while dropping uninformative noise. However, the maximization of mutual information is a difficult training objective. We have given theoretical arguments that representing mutual information as a difference of entropies, and estimating those entropies by minimizing cross-entropy loss, is a more statistically justified approach than maximizing a lower bound on mutual information.
318
+
319
+ Unfortunately cross-entropy upper bounds on entropy fail to provide either upper or lower bounds on mutual information — mutual information is a difference of entropies. We cannot rule out the possible existence of superintelligent models, models beyond current expressive power, that dramatically reduce cross-entropy loss. Lower bounds on entropy can be viewed as proofs of the non-existence of superintelligence. We should not surprised that such proofs are infeasible.
320
+
321
+ # REFERENCES
322
+
323
+ Sanjeev Arora, Andrej Risteski, and Yi Zhang. Do gans learn the distribution? some theory and empirics. ICLR, 2018.
324
+
325
+ Ishmael Belghazi, Sai Rajeswar, Aristide Baratin, R Devon Hjelm, and Aaron Courville. Mine: mutual information neural estimation. arXiv preprint arXiv:1801.04062, 2018.
326
+
327
+ Anthony J Bell and Terrence J Sejnowski. An information-maximization approach to blind separation and blind deconvolution. Neural computation, 7(6):1129–1159, 1995.
328
+
329
+ M. Donsker and S. Varadhan. Asymptotic evaluation of certain markov process expectations for large time, iv. Communications on Pure and Applied Mathematics, 36(2):183–212, 1983.
330
+
331
+ Gintare Karolina Dziugaite and Daniel M. Roy. Computing nonvacuous generalization bounds for deep (stochastic) neural networks with many more parameters than training data. arXiv preprint arXiv:1703.11008, 2017.
332
+
333
+ Shuyang Gao, Greg Ver Steeg, and Aram Galstyan. Efficient estimation of mutual information for strongly dependent variables. arXiv preprint arXiv:1411.2003, 2014.
334
+
335
+ R Devon Hjelm, Alex Fedorov, Samuel Lavoie-Marchildon, Karan Grewal, Adam Trischler, and Yoshua Bengio. Learning deep representations by mutual information estimation and maximization. arXiv preprint arXiv:1808.06670, 2018.
336
+
337
+ Alexander Kraskov, Harald Stoegbaue, and Peter Grassberger. Estimating mutual information. arXiv preprint arXiv:cond-mat/0305641, 2003.
338
+
339
+ Ralph Linsker. Self-organization in a perceptual network. Computer, 21(3):105–117, 1988.
340
+
341
+ Charles Marsh. Introduction to continuous entropy. www.crmarsh.com/static/pdf/Charles Marsh Continuous Entropy.pdf, 2013.
342
+
343
+ David McAllester. A pac-bayesian tutorial with a dropout bound. arXiv preprint arXiv:1307:2118, 2013.
344
+
345
+ David McAllester. Information Theoretic Co-Training. arXiv preprint arXiv:1802.07572, 2018.
346
+
347
+ David McAllester and Robert Schapire. On the convergence rate of good-turing estimators. COLT, 2000.
348
+
349
+ Aaron van den Oord, Yazhe Li, and Oriol Vinyals. Representation learning with contrastive predictive coding. arXiv preprint arXiv:1807.03748, 2018.
350
+
351
+ Alon Orlitsky and Ananda Theertha Suresh. Competitive distribution estimation: Why is goodturing good. NIPS, 2015.
352
+
353
+ Alon Orlitsky, Narayana Santhanam, and Junan Zhang1. Always good turing: Asymptotically optimal probability estimation. Science, 302(5644), 2003.
354
+
355
+ Karl Stratos. Mutual information maximization for simple and accurate part-of-speech induction. arXiv preprint arXiv:1804.07849, 2018.
356
+
357
+ Naftali Tishby, Fernando C Pereira, and William Bialek. The information bottleneck method. arXiv preprint physics/0004057, 2000.
md/train/Bkeeca4Kvr/Bkeeca4Kvr.md ADDED
@@ -0,0 +1,398 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # FEW-SHOT LEARNING ON GRAPHS VIA SUPERCLASSES BASED ON GRAPH SPECTRAL MEASURES
2
+
3
+ Jatin Chauhan, Deepak Nathani, Manohar Kaul
4
+
5
+ Department of Computer Science
6
+ Indian Institute of Technology Hyderabad
7
+ {chauhanjatin100,deepakn1019,manohar.kaul}@gmail.com
8
+
9
+ # ABSTRACT
10
+
11
+ We propose to study the problem of few-shot graph classification in graph neural networks (GNNs) to recognize unseen classes, given limited labeled graph examples. Despite several interesting GNN variants being proposed recently for node and graph classification tasks, when faced with scarce labeled examples in the few-shot setting, these GNNs exhibit significant loss in classification performance. Here, we present an approach where a probability measure is assigned to each graph based on the spectrum of the graph’s normalized Laplacian. This enables us to accordingly cluster the graph base-labels associated with each graph into super-classes, where the $L ^ { p }$ Wasserstein distance serves as our underlying distance metric. Subsequently, a super-graph constructed based on the super-classes is then fed to our proposed GNN framework which exploits the latent inter-class relationships made explicit by the super-graph to achieve better class label separation among the graphs. We conduct exhaustive empirical evaluations of our proposed method and show that it outperforms both the adaptation of state-ofthe-art graph classification methods to few-shot scenario and our naive baseline GNNs. Additionally, we also extend and study the behavior of our method to semi-supervised and active learning scenarios.
12
+
13
+ # 1 INTRODUCTION
14
+
15
+ The need to analyze graph structured data coupled with the ubiquitous nature of graphs (Borgwardt et al., 2005; Duvenaud et al., 2015; Backstrom & Leskovec, 2010; Chau et al., 2011), has given greater impetus to research interest in developing graph neural networks (GNNs) (Defferrard et al., 2016; Kipf & Welling, 2016; Hamilton et al., 2017; Velikovi et al., 2018) for learning tasks on such graphs. The overarching theme in GNNs is for each node’s feature vector to be generated by passing, transforming, and recursively aggregating feature information from a given $k$ -hop neighborhood surrounding the node. However, GNNs still fall short in the ”few-shot” learning setting, where the classifier must generalize well after seeing abundant base-class samples (while training) and very few (or even zero) samples from a novel class (while testing). Given the scarcity and difficulty involved with generation of labeled graph samples, it becomes all the more important to solve the problem of graph classification in the few-shot setting.
16
+
17
+ Limitations and challenges: Recent work by Xu et. al. (Xu et al., 2019) indicated that most recently proposed GNNs were designed based on empirical intuition and heuristic approaches. They studied the representational power of these GNNs and identified that most neighborhood aggregation and graph-pooling schemes had diminished discriminative power. They rectified this problem with the introduction of a novel injective neighborhood aggregation scheme, making it as strong as the Weisfeiler-Lehman (WL) graph isomorphism test (Weisfeiler & Leman, 1968).
18
+
19
+ Nevertheless, the problem posed by extremely scarce novel-class samples in the few-shot setting remains to persist as a formidable challenge, as it requires more rounds of aggregation to affect larger neighborhoods and hence necessitate greater depth in the GNN. However, when it comes to GNNs, experimental studies have shown that an increase in the number of layers results in dramatic performance drops in GNNs (Wu et al., 2019; Li et al., 2018b).
20
+
21
+ Our work: Motivated by the aforementioned observations and challenges, our method does the following. We begin with a once-off preprocessing step. We assign a probability measure to each graph, which we refer to as a graph spectral measure (similar to (Gu et al., 2015)), based on the spectrum of the graph’s normalized Laplacian matrix representation. Given this metric space of graph spectral measures and the underlying distance as the $L ^ { p }$ Wasserstein distance, we compute Wasserstein barycenters (Agueh & Carlier, 2011) for each set of graphs specific to a base class and term these barycenters as prototype graphs. With this set of prototype graphs for each base class label, we cluster the spectral measures associated with each prototype graph in Wasserstein space to create a super-class label.
22
+
23
+ Utilizing this super-class information, we then build a graph of graphs called a super-graph. The intuition behind this is to exploit the non-explicit and latent inter-class relationships between graphs via their spectral measures and use a GNN on this to also introduce a relational inductive bias (Battaglia et al., 2018), which in turn affords us an improved sample complexity and hence better combinatorial generalization given such few samples to begin with.
24
+
25
+ Given, the super-classes and the super-graph, we train our proposed GNN model for few-shot learning on graphs. Our GNN consists of a graph isomorphism network (GIN) Xu et al. (2019) as a feature extractor $F _ { \theta } ( . )$ to generate graph embeddings; on which subsequently acts our classifier $C ( . )$ comprising of two components: (i) $C ^ { s u p }$ : a MLP layer to learn and predict the super class associated to a graph, and (ii) $\Dot { C } ^ { G A T }$ : a graph attention network (GAT) to predict the actual class label of a graph. The overall loss function is a sum of the cross-entropy losses associated with $C ^ { s u p }$ and $C ^ { G A \breve { T } }$ . We follow initialization based strategy (Chen et al., 2019), with a training and fine-tuning phase, so that in the fine-tuning phase, the pre-trained parameters associated with $F _ { \theta } ( . )$ and $C ^ { s u p }$ are frozen, and the few novel labeled graph samples are used to update the weights and attention learned by CGAT .
26
+
27
+ Our contributions: To the best of our knowledge, we are the first to introduce few shot learning on graphs for graph classification. Next, we propose an architecture that makes use of the graph’s spectral measures to generate a set of super-classes and a super-graph to better model the latent relations between classes, followed by our GNN trained using an initialization method. Finally, we conduct extensive experiments to gain insight into our method. For example, in the 20-shot setting on the TRIANGLES dataset, our method shows a substantial improvement of nearly $7 \%$ and $2 0 \%$ over DL-based and unsupervised baselines, respectively.
28
+
29
+ # 2 RELATED WORK
30
+
31
+ Few-shot learning in the computer vision community was first introduced by (Fei-Fei et al., 2006) with the intuition that learning the underlying properties of the base classes given abundant samples can help generalize better to unseen classes with few-labeled samples available. Various learning algorithms have been proposed in the image domain, among which a broad category of initialization based methods aim to learn transferable knowledge from training classes, so that the model can be adapted to unseen classes with limited labeled examples (Finn et al., 2017); (Rusu et al., 2018); (Nichol et al., 2018). Recently proposed and widely accepted Initialization based methods can broadly be classified into: (i) methods that learn good model parameters with limited labeled examples and a small number of gradient update steps (Finn et al., 2017) and (ii) methods that learn an optimizer (Ravi & Larochelle, 2017). We refer the interested reader to Chen et. al. (Chen et al., 2019) for more examples of few-shot learning methods in vision.
32
+
33
+ Graph neural networks (GNNs) were first introduced in (Gori et al., 2005); (Scarselli et al., 2009) as recurrent message passing algorithms. Subsequent work (Bruna et al., 2014); (Henaff et al., 2015) proposed to learn smooth spectral multipliers of the graph Laplacian, but incurred higher computational cost. This computational bottleneck was later resolved (Defferrard et al., 2016); (Kipf & Welling, 2016) by learning polynomials of the graph Laplacian. GNNs are a natural extension to Convolutional neural networks (CNNs) on non-Euclidean data. Recent work (Velikovi et al., 2018) introduced the concept of self-attention in GNNs, which allows each node to provide attention to the enclosing neighborhood resulting in improved learning. We refer the reader to (Bronstein et al., 2016) for detailed information on GNNs.
34
+
35
+ Despite all the success of GNNs, few-shot classification remains an under-addressed problem. Some recent attempts have focused on solving the few-shot learning on graph data where GNNs are either trained via co-training and self-training (Li et al., 2018a), or extended by stacking transposed graph convolutional layers imputing a structural regularizer (Zhang et al., 2019) - however, both these works focus only on the node classification task.
36
+
37
+ To the best of our knowledge, there does not exist any work pertaining few-shot learning on graphs focusing on the graph classification task, thus providing the motivation for this work.
38
+
39
+ Comparison to few-shot learning on images: Few shot learning (FSL) has gained wide-spread traction in the image domain in recent years. However the success of FSL in images is not easily translated to the graph domain for the following reasons: (a) Images are typically represented in Euclidean space and thus can easily be manipulated and handled using well-known metrics like cosine similarity, $L _ { p }$ norms etc. However, graphs come from non-Euclidean domains and exhibit much more complex relationships and interdependency between objects. Furthermore, the notion of a distance between graphs is also not straightforward and requires construction of graph kernels or the use of standard metrics on graph embeddings (Kriege et al., 2019). Additionally, such graph kernels dont capture higher order relations very well. (b) In the FSL setting on images, the number of training samples from various classes is also abundantly more than what is available for graph datasets. The image domain allows training generative models to learn the task distribution and can further be used to generate samples for data augmentation, which act as very good priors. In contrast, graph generative models are still in their infancy and work in very restricted settings. Furthermore, methods like cropping and rotation to improve the models can’t be used for graphs given the permutation invariant nature of graphs. Additionally, removal of any component from the graph can adversely affect its structural properties, such as in biological datasets. (c) The image domain has very well-known regularization methods (e.g. Tikhonov, Lasso) that help generalize much better to novel datasets. Although, they dont bring any extra supervised information and hence cannot fully address the problem of FSL in the image domain. To the best of our knowledge, this is still an open research problem in the image domain. On the other hand, in the graph domain, our work would be a first step towards graph classification in an FSL setting, which would then hopefully pave the path for better FSL graph regularizers. (d) Transfer learning has led to substantial improvements on various image related tasks due to the high degree of transferability of feature extractors. Thus, downstream tasks like few-shot learning can be performed well with high quality feature extractor models, such as Resnet variants trained on Imagenet. Transfer learning, or for that matter even good feature extractors, remains a daunting challenge in the graph domain. For graphs, there neither exists a dataset which can serve as a pivot for high quality feature learning, nor does there exist a Graph NN which can capture the higher order relations between various categories of graphs, thus making this a highly challenging problem.
40
+
41
+ # 3 PRELIMINARIES
42
+
43
+ In this section, we introduce our notation and provide the necessary background for our few-shot learning setup on graphs. We begin by describing the various data sample types, followed by our learning procedure, in order to formally define few-shot learning on graphs. Finally, we define the graph spectral distance between a pair of graphs.
44
+
45
+ Data sample sets: Let $\mathcal { G }$ denote a set of undirected unweighted graphs and $\mathcal { V }$ be the set of associated class labels. We consider two disjoint populations of labeled graphs consisting of i.i.d. graph samples, the set of base class labeled graphs $\mathbf { \bar { { G } } } _ { B } = \{ ( g _ { i } ^ { ( B ) } , y _ { i } ^ { ( B ) } ) \bar \} _ { i = 1 } ^ { n } \}$ and the set of novel class labeled graphs $G _ { N } = \{ ( g _ { i } ^ { ( N ) } , y _ { i } ^ { ( N ) } ) \} _ { i = 1 } ^ { m }$ y(N )i )}mi=1, where g(Bi $g _ { i } ^ { ( B ) } , g _ { i } ^ { ( N ) } \in \mathcal { G } , y _ { i } ^ { ( B ) } \in \mathcal { V } ^ { ( B ) }$ y(B)i ∈ Y (B), and y(Ni $y _ { i } ^ { ( N ) } \in \mathcal { y } ^ { ( N ) }$ . Here, the set of base and novel class labels are denoted by ${ \mathcal { V } } ^ { ( B ) } = \{ 1 , \ldots , K \}$ and $\mathcal { V } ^ { ( N ) } = \{ K + 1 , \ldots , K ^ { \prime } \}$ , respectively, where $K ^ { \prime } > K$ . Both $\mathcal { V } ^ { ( B ) }$ and $\mathcal { V } ^ { ( N ) }$ are disjoint subsets of $\mathcal { V }$ , so, $\mathcal { V } ^ { ( B ) } \cap \mathcal { V } ^ { ( N ) } = \emptyset$ .
46
+
47
+ Note that $m \ll n$ , i.e., there are far fewer novel class labeled graphs compared to the base class labeled ones. Besides $G _ { B }$ and $G _ { N }$ , we consider a set of $t$ unlabeled unseen graphs $\begin{array} { l l } { G _ { U } } & { : = } \end{array}$ $\{ g _ { 1 } ^ { ( U ) } , \ldots , g _ { t } ^ { ( U ) } \mid g _ { i } ^ { ( U ) } \in \pi _ { 1 } ( G _ { N } ) , i = 1 \ldots t \}$ , for testing1.
48
+
49
+ Learning procedure: Inspired by the initialization based methods, we similarly follow a two-stage approach of training followed by fine-tuning.
50
+
51
+ During training, we train a graph feature extractor $F _ { \theta } ( G _ { B } )$ with network parameters $\theta$ followed by a classifier $C ( G _ { B } )$ on graphs from $G _ { B }$ , where the loss function is the standard cross-entropy loss $\mathcal { L } _ { c }$ . In order to better recognize and generalize well on samples from novel classes, in the finetuning phase, the pre-trained feature extractor $F _ { \theta } ( . )$ along with its trained parameters is fixed and the classifier $C ( G _ { N } )$ is trained on the novel class labeled graph samples from $G _ { N }$ , with the same loss $\mathcal { L } _ { c }$ .
52
+
53
+ Now, given the classification of data samples and the two-stage learning method, our problem of few-shot classification on graphs can be defined as follows.
54
+
55
+ Problem definition: Given $n$ base-class labeled graphs from $G _ { B }$ during the training phase and $m$ novel-class labeled graphs from $G _ { N }$ during the fine-tuning phase, where $m \ll n$ , the objective of few-shot graph classification is to classify $t$ unseen test graph samples from $G _ { U }$ . Moreover, if $m = q T$ , where $T = K ^ { \prime } - K$ , i.e., each novel class label appears exactly $q$ times in $G _ { N }$ , then this setting is referred to as the $q$ -shot, $T$ -way learning.
56
+
57
+ Graph spectral distance: Let us consider the graphs in $\mathcal { G }$ . The normalized Laplacian of a graph $g \in { \mathcal { G } }$ is defined as $\Delta _ { g } = I - D ^ { - 1 / 2 } A D ^ { 1 / 2 }$ , where $A$ and $D$ are the adjacency and the degree matrices of graph $g$ , respectively. The set of eigenvalues of $\Delta _ { g }$ given by $\{ \lambda _ { i } \} _ { i = 1 } ^ { | V | }$ is called the spectrum of and is denoted by . It is well known that the spectrum $\sigma ( g )$ of a normalized Laplacian matrix is contained in interval $[ 0 , 2 ]$ . We assign a Dirac mass $\delta _ { \lambda _ { i } }$ concentrated on each $\lambda _ { i } \ \in \ \sigma ( g )$ , thus associating a probability measure to $\sigma ( g )$ supported on $[ 0 , 2 ]$ , called the graph spectral measure $\mu _ { \sigma ( g ) }$ . Furthermore, let $P ( [ 0 , 2 ] )$ be the set of probability measures on interval $[ 0 , 2 ]$ .
58
+
59
+ We now define the $p$ -th Wasserstein distance between probability measures, which we later use to define the spectral distance between a pair of graphs.
60
+
61
+ Definition 1 Let $p \in [ 1 , \infty )$ and let $c : [ 0 , 2 ] \times [ 0 , 2 ] [ 0 , + \infty ]$ be the cost function between the probability measures $\mu , \nu \in P ( [ 0 , 2 ] )$ . Then the $p$ -th Wasserstein distance between measures $\mu$ and $\nu$ is given by
62
+
63
+ $$
64
+ W _ { p } ( \mu , \nu ) = \left( \operatorname* { i n f } _ { \gamma } \int _ { [ 0 , 2 ] \times [ 0 , 2 ] } c ( x , y ) ^ { p } d \gamma \mid \gamma \in \Pi ( \mu , \nu ) \right) ^ { \frac { 1 } { p } }
65
+ $$
66
+
67
+ where $\Pi ( \mu , \nu )$ is the set of transport plans, i.e., the collection of all measures on $[ 0 , 2 ] \times [ 0 , 2 ]$ with marginals $\mu$ and $\nu$ .
68
+
69
+ Given the general definition of the $p$ -th Wasserstein distance between probability measures and the graph spectral measure, we can now define the spectral distance between a pair of graphs in $\mathcal { G }$ .
70
+
71
+ Definition 2 Given two graphs $g , g ^ { \prime } \in \mathcal { G }$ , the spectral distance between them is defined as
72
+
73
+ $$
74
+ W ^ { p } ( g , g ^ { \prime } ) : = W _ { p } \left( \mu _ { \sigma ( g ) } , \mu _ { \sigma ( g ^ { \prime } ) } \right)
75
+ $$
76
+
77
+ In words, $W ^ { p } ( g , g ^ { \prime } )$ is the optimal cost of moving mass from the graph spectral measure of graph $g$ to that of graph $g ^ { \prime }$ , where the cost of moving unit mass is proportional to the $p$ -th power of the difference of real-eigenvalues in interval $[ 0 , 2 ] ^ { 2 }$ .
78
+
79
+ # 4 OUR METHOD
80
+
81
+ We present our proposed approach here. First, given abundant base-class labels, we cluster them into super-classes by computing prototype graphs from each class, followed by clustering the prototype graphs based on their spectral properties. This clustering of prototype graphs induces a natural clustering on their corresponding class labels, resulting in super-classes (as outlined in Section 4.1).
82
+
83
+ ![](images/393d3119a11d19636ddb73ae543b4196b5496b3b1defea32cbff310a102d2d91.jpg)
84
+ Figure 1: The training (left) and fine-tuning (right) stages of our GNN.
85
+
86
+ These super-classes are then used in the creation of a super-graph used further down by our GNN. Note that the creation of super-classes, followed by building a super-graph are a once-off process. The prototype graphs as well as the super-classes for the base classes can be stored in memory for further use.
87
+
88
+ Next, we explain our graph neural network’s architecture which comprises of a feature extractor $F _ { \theta } ( . )$ and a classifier $C ( . )$ , described in Section 4.2. The classifier $C ( . )$ is further subdivided into a classifier $C ^ { s u p }$ that predicts the superclass of a graph feature vector and a graph attention network (GAT) $C ^ { G A T }$ to predict the graph’s class label. Figure 1 illustrates the training and fine-tuning phases of our GNN.
89
+
90
+ # 4.1 COMPUTING SUPER CLASSES
91
+
92
+ In order to exploit inter-class relationships between base-class labels, we cluster them in the following manner. First, we partition the set $G _ { B }$ into class-specific sets $G ^ { ( i ) }$ , for $i = 1 \dots K$ , where $G ^ { ( i ) }$ is the set of graphs with base-class label $i$ . Thus, $\begin{array} { r } { G _ { B } = \bigsqcup _ { i = 1 } ^ { K } G ^ { ( i ) } } \end{array}$ .
93
+
94
+ Then, we compute class prototype graphs for each class-specific set. The class prototype graph for class $i$ represented by $p _ { i }$ is given by
95
+
96
+ $$
97
+ p _ { i } = \operatorname * { a r g m i n } _ { g _ { i } \in \pi _ { 1 } ( G ^ { ( i ) } ) } \frac { 1 } { | G ^ { ( i ) } | } \sum _ { j = 1 } ^ { | G ^ { ( i ) } | } W ^ { p } ( g _ { i } , g _ { j } )
98
+ $$
99
+
100
+ Essentially, the class prototype graph $p _ { i }$ for the $i$ -th class is the graph with the least average spectral distance to the rest of the graphs in the same class. Given these $K$ prototypes, we cluster them using Lloyd’s method (also known as $k$ -means)3.
101
+
102
+ Clustering prototype graphs: Given $K$ unlabeled prototypes $p _ { 1 } , \dotsc , p _ { K } \in \pi _ { 1 } ( G _ { B } )$ and their associated spectral measures $ { \mu } _ { \sigma ( p _ { 1 } ) } , \ldots , { \mu } _ { \sigma ( p _ { K } ) } \in P ( [ 0 , 2 ] )$ . We rename the spectral measures as $s _ { 1 } , \ldots , s _ { K }$ to ease notation. Thus, our goal is to associate these spectral measures to at most $k$ clusters, where $k \geq 1$ is a user defined parameter.
103
+
104
+ The $k$ -means problem finds a $k$ -partition $C = \{ C _ { 1 } , \ldots , C _ { k } \}$ that minimizes the following objective that represents the overall distortion error of the clustering
105
+
106
+ $$
107
+ \underset { C } { \operatorname { a r g m i n } } \sum _ { i = 1 } ^ { k } \sum _ { s _ { i } \in C _ { i } } W _ { p } ( s _ { i } , B ( C _ { i } ) )
108
+ $$
109
+
110
+ where $s _ { i }$ is a prototype graph in cluster $C _ { i }$ and $B ( C _ { i } )$ is the Wasserstein barycenter of the cluster $C _ { i }$ . The barycenter is computed as
111
+
112
+ $$
113
+ B ( C _ { i } ) = \operatorname * { a r g m i n } _ { p \in P ( [ 0 , 2 ] ) } \sum _ { j = 1 } ^ { | C _ { i } | } W _ { p } ( p , s ( i , j ) )
114
+ $$
115
+
116
+ ![](images/0908b6d8353222c6cc3822778fc0d6149a35077983a3938dc8d0e1af7f456d8a.jpg)
117
+ Figure 2: An illustration of our proposed Wasserstein super-class clustering algorithm.
118
+
119
+ where $s ( i , j )$ denotes the $j$ -th spectral measure in the $i$ -th cluster $C _ { i }$ .
120
+
121
+ Lloyd’s algorithm: Given an initial set of Wasserstein barycenters $B ^ { ( 1 ) } ( C _ { 1 } ) , \ldots , B ^ { ( 1 ) } ( C _ { k } )$ of spectral measures at step $t = 1$ , one uses the standard Lloyd’s algorithm to find the solution by alternating between the assignment (Equation 4) and update (Equation 5) steps
122
+
123
+ $$
124
+ \begin{array} { r l } & { \quad C _ { i } ^ { ( t ) } = \left\{ s _ { p } : W _ { p } ( s _ { p } , B ^ { ( t ) } ( C _ { i } ) ) \leq W _ { p } ( s _ { p } , B ^ { ( t ) } ( C _ { j } ) ) , \forall j , 1 \leq j \leq k , 1 \leq p \leq K \right\} } \\ & { \quad C _ { i } ^ { ( t + 1 ) } = B ( C _ { i } ^ { ( t ) } ) } \end{array}
125
+ $$
126
+
127
+ Lloyd’s algorithm is known to converge to a local minimum (except in pathological cases, where it can oscillate between equivalent solutions). The final output is a grouping of the prototype graphs into $k$ groups, which also induces a grouping of the corresponding base classes. We denote these class groups as super-classes and denote the set of super-classes as $y ^ { s u p }$ .
128
+
129
+ # 4.2 OUR GRAPH NEURAL NETWORK
130
+
131
+ Feature extractor: To apply standard neural network architectures for downstream tasks we must embed the graphs in a finite dimensional vector space. We consider graph neural networks (GNNs) that employ the following message-passing architecture
132
+
133
+ $$
134
+ H ^ { ( j ) } = M ( A , H ^ { ( j - 1 ) } , \theta ^ { ( j ) } )
135
+ $$
136
+
137
+ where $H ^ { ( j ) } \in \mathbb { R } ^ { | V | \times d }$ are the node embeddings (i.e., messages) computed after $j$ steps of the GNN and $M$ is the message propagation function which depends on the adjacency matrix of the graph $A$ , the trainable parameters of the $j ^ { t h }$ layer $\theta ^ { ( j ) }$ , and node embeddings $H ^ { ( j - 1 ) }$ generated from the previous step.
138
+
139
+ A recently proposed GNN called the graph isomorphism network (GIN) by $\mathrm { X u }$ et al. (2019) was shown to be stronger than several popular GNN variants like GCN Kipf & Welling (2016) and GraphSAGE Hamilton et al. (2017). What makes GIN so powerful and sets it apart from the other GNN variants is its injective neighborhood aggregation scheme which allows it to be as powerful as the Weisfeiler-Lehman (WL) graph isomorphism test. Motivated by this finding, we chose GIN as our graph feature extractor. The message propagation scheme in GIN is given by
140
+
141
+ $$
142
+ H ^ { ( j ) } = M L P ( ( 1 + \epsilon ) ^ { j } \odot H ^ { ( j - 1 ) } + A ^ { T } H ^ { ( j - 1 ) } )
143
+ $$
144
+
145
+ Here, $\epsilon$ is a layer-wise learnable scalar parameter and $M L P$ represents a multi-layer perceptron with layer-wise non-linearities for more expressive representations. The full GIN model run $R$ iterations of Equation 6 to generate final node embeddings which we represent by $H ^ { ( R ) }$ . As features from earlier iterations can also be helpful in achieving higher discriminative power, embeddings $H ^ { ( j ) }$
146
+
147
+ from all $R$ iterations are concatenated as
148
+
149
+ $$
150
+ H _ { g } = \left\| _ { j = 1 } ^ { R } H ^ { ( j ) } , \right\|
151
+ $$
152
+
153
+ Here, $\begin{array} { r } { H ^ { ( j ) } = \sum _ { v \in V } H _ { v } ^ { ( j ) } } \end{array}$ , where $H _ { i } ^ { ( j ) }$ represents the $i$ -th node’s embedding in the $j$ -th iteration and $\parallel$ denotes a concatenation operator. $H _ { g }$ now contains the graph embedding of a graph $g$ and is passed on to the classifier.
154
+
155
+ Classifier: Here, our objective is to improve the class separation produced by the graph embeddings of the feature extractor $F _ { \theta } ( . )$ and we do this by building a “graph of graph embeddings”, called a super-graph $g ^ { s u p }$ , where each node is a graph feature vector. We then employ our classifier $C ( . )$ on this super-graph to achieve better separation among the graph classes in the embedding space.
156
+
157
+ During training, we first build the super-graph $g ^ { s u p }$ on a batch of base-labeled graphs as a collection of $k$ -NN graphs, where each constituent $k$ -NN graph is built on the graphs belonging to the same super-class. $g ^ { s u p }$ is then passed through a multi-layered graph attention network $C ^ { \forall G A \mathbf { \breve { T } } }$ to learn the associated class probabilities. The features extracted from $F _ { \theta } ( . )$ are passed into the MLP network $C ^ { s u p }$ to learn the associated super-class labels. $C ^ { s u p }$ and $C ^ { \widecheck { G } A T }$ combine to form our classifier $C ( . )$ . The cross-entropy losses associated with $C ^ { s u p }$ and $C ^ { G A T }$ are added to give the overall loss for $C ( . )$ . The intuition behind the construction of $g ^ { s u p }$ to train $C ^ { G A T }$ on was to further improve the existing cluster separation based on graph spectral measures by introducing a relational inductive bias (Battaglia et al., 2018) that is inherent to the GNN CGAT .
158
+
159
+ Recall that we adopt an initialization method (described in 3). In our fine-tuning stage, novel class labeled graphs from $G _ { N }$ are input to the network. The pre-trained parameters learned by the feature extractor $F _ { \theta } ( . )$ are fixed and $C ^ { s u p }$ is used to infer the novel graph’s super-class label, followed by creation of super-graph on the novel graph samples and finally updating the parameters in CGAT through the loss. Finally the evaluation is performed on the samples from the unseen test set $G _ { U }$ .
160
+
161
+ Discussion: We make the assumption that the novel test classes belong to the same set of super-classes from the training graphs. The reason being that the novel class labeled samples are so much fewer than the base class labeled samples, that the resulting super-graph ends up being extremely sparse and deviates a lot from the shape of the super-graph from the base classes; therefore it severely hinders $C ^ { G A T } \mathrm { s }$ ability to effectively aggregate information from the embeddings of the novel class labeled graphs. Instead, we pass the novel graph samples through our trained $C ^ { s u p }$ and infer its super-class label and this works very effectively for us, as is evidenced by our empirical results.
162
+
163
+ # 5 EXPERIMENTAL RESULTS
164
+
165
+ # 5.1 BASELINES AND DATASETS
166
+
167
+ The standard graph classification datasets do not adequately satisfy the requirements for few-shot learning due to the dearth of unique class labels. Hence, we pick four new classification datasets, namely, Letter-High, TRIANGLES, Reddit-12K, and ENZYMES. The details and statistics for these datasets are given in Appendix A.1. As there do not exist any standard state-of-the-art methods for few-shot graph classification, we chose existing baselines for standard graph classification from both supervised and unsupervised methods.
168
+
169
+ For supervised deep learning baselines, we chose - GIN (Xu et al. (2019)), CapsGNN (Xinyi & Chen (2019)), and Diffpool (Lee et al. (2019)). We ran these methods with similar settings as ours, i.e., by partitioning the main model into feature extraction and classifier sub-models to compare them in a fair and informative manner. From the unsupervised category, we consider 4 powerful SOTA methods - AWE (Ivanov & Burnaev (2018)), Graph2Vec (Narayanan et al. (2017)), WeisfeilerLehman subtree Kernel (Shervashidze et al. (2011)), and Graphlet count kernel (Shervashidze et al. (2009)). Since we want to analyze the few-shot classification abilities of these models, we essentially want to find out how well these algorithms can achieve class separation. We use $k$ -NN search on the output embeddings of these algorithms.
170
+
171
+ Table 1: Results for various few-shot scenarios on Letter-High and TRIANGLES datasets. The best results are highlighted in bold while the second best results are underlined.
172
+
173
+ <table><tr><td rowspan="2">Method</td><td colspan="3">Letter-High</td><td colspan="3">TRIANGLES</td></tr><tr><td>5-shot</td><td>10-shot</td><td>20-shot</td><td>5-shot</td><td>10-shot</td><td>20-shot</td></tr><tr><td>WL</td><td>65.27 ± 7.67</td><td>68.39± 4.69</td><td>72.69±3.02</td><td>51.25± 4.02</td><td>53.26 ± 2.95</td><td>57.74 ± 2.88</td></tr><tr><td>Graphlet</td><td>33.76 ± 6.94</td><td>37.59 ± 4.60</td><td>41.11 ± 3.71</td><td>40.17 ± 3.18</td><td>43.76 ± 3.09</td><td>45.90 ±2.65</td></tr><tr><td>AWE</td><td>40.60 ± 3.91</td><td>42.20 ±2.87</td><td>43.12 ± 1.00</td><td>39.36± 3.85</td><td>42.58 ± 3.11</td><td>44.98 ± 1.54</td></tr><tr><td>Graph2Vec</td><td>66.12 ± 5.21</td><td>68.17 ± 4.26</td><td>70.28 ± 2.81</td><td>48.38 ± 3.85</td><td>50.16 ± 4.15</td><td>54.90 ± 3.01</td></tr><tr><td>Diffpool</td><td>58.69 ± 6.39</td><td>61.59 ± 5.21</td><td>64.67 ± 3.21</td><td>64.17 ± 5.87</td><td>67.12 ± 4.29</td><td>73.27 ± 3.29</td></tr><tr><td>CapsGNN</td><td>56.60 ± 7.86</td><td>60.67 ± 5.24</td><td>63.97 ± 3.69</td><td>65.40 ± 6.13</td><td>68.37 ± 3.67</td><td>73.06 ± 3.64</td></tr><tr><td>GIN</td><td>65.83 ± 7.17</td><td>69.16 ± 5.14</td><td>73.28 ± 2.17</td><td>63.80 ± 5.61</td><td>67.30 ± 4.35</td><td>72.55 ± 1.97</td></tr><tr><td>GIN-k-NN</td><td>63.52 ± 7.27</td><td>65.66± 8.69</td><td>67.45± 8.76</td><td>58.34 ± 3.91</td><td>61.55± 3.19</td><td>63.45± 2.76</td></tr><tr><td>OurMethod-GCN</td><td>68.69 ± 6.50</td><td>72.80 ± 4.12</td><td>75.17 ± 3.11</td><td>69.37 ± 4.92</td><td>73.11 ± 3.94</td><td>77.86 ± 2.84</td></tr><tr><td>OurMethod-GAT</td><td>69.91 ± 5.90</td><td>73.28± 3.46</td><td>77.38 ± 1.58</td><td>71.40 ± 4.34</td><td>75.60± 3.67</td><td>80.04 ± 2.20</td></tr></table>
174
+
175
+ Further configuration and implementation details for the baselines can be found in Appendix A.2. We also emphasize the benefit of using a GNN as a classifier by showing the adaptation of our model to semi-supervised fine-tuning (in Appendix A.5) and active learning (in Appendix A.6) settings.
176
+
177
+ # 5.2 FEW-SHOT RESULTS
178
+
179
+ We consider two variants of our model as naive baselines. In the first variant, we replace our GAT classifier with GCN Kipf & Welling (2016). We call this model OurMethod-GCN. This variant is used to justify the choice of GAT over GCN.
180
+
181
+ In the second variant, we replace the entire classifier with the $k$ -NN algorithm over the features extracted from various layers of the feature extractor. We call this variant GIN- $k$ -NN and this is introduced to emphasize the significance of building a super-graph and using a GAT on it as a classifier to exploit the relational inductive bias.
182
+
183
+ The results for all the datasets in various $q$ -shot scenarios, where $q \in \{ 5 , 1 0 , 2 0 \}$ are given in Table 1. We run each model 50 times and report averaged results. In every run, we select a different novel labeled subset $G _ { N }$ for fine-tuning the classifiers of the models. The evaluation for all models is done by randomly selecting a subset of 500 samples from the testing set $G _ { U }$ for Letter-High and TRIANGLES, whereas over 150 for ENZYMES and 300 for Reddit dataset and averaging over 10 such random selections.
184
+
185
+ Table 2: Results for various few-shot scenarios on Reddit- $I 2 K$ and ENZYMES datasets. The best results are highlighted in bold while the second best results are underlined.
186
+
187
+ <table><tr><td rowspan="2">Method</td><td colspan="3">Reddit-12K</td><td colspan="3">ENZYMES</td></tr><tr><td>5-shot</td><td>10-shot</td><td>20-shot</td><td>5-shot</td><td>10-shot</td><td>20-shot</td></tr><tr><td>WL</td><td>40.26± 5.17</td><td>42.57±3.69</td><td>44.41±3.43</td><td>55.78± 4.72</td><td>58.47±3.84</td><td>60.1±3.18</td></tr><tr><td>Graphlet</td><td>33.76 ± 6.94</td><td>37.59 ± 4.60</td><td>41.11 ± 3.71</td><td>53.17 ± 5.92</td><td>55.30 ±3.78</td><td>56.90 ±3.79</td></tr><tr><td>AWE</td><td>30.24± 2.34</td><td>33.44 ±2.04</td><td>36.13 ± 1.89</td><td>43.75 ±1.85</td><td>45.58 ± 2.11</td><td>49.98 ± 1.54</td></tr><tr><td>Graph2Vec</td><td>27.85 ± 4.21</td><td>29.97 ± 3.17</td><td>32.75 ± 2.02</td><td>55.88 ± 4.86</td><td>58.22 ± 4.30</td><td>62.28 ± 4.14</td></tr><tr><td>Diffpool</td><td>35.24 ± 5.69</td><td>37.43 ± 3.94</td><td>39.11 ± 3.52</td><td>45.64 ± 4.56</td><td>49.64 ± 4.23</td><td>54.27 ± 3.94</td></tr><tr><td>CapsGNN</td><td>36.58 ±4.28</td><td>39.16 ± 3.73</td><td>41.27 ± 3.12</td><td>52.67 ± 5.51</td><td>55.31 ± 4.23</td><td>59.34 ± 4.02</td></tr><tr><td>GIN</td><td>40.36 ± 4.69</td><td>43.70 ± 3.98</td><td>46.28 ± 3.49</td><td>55.73 ± 5.80</td><td>58.83 ±5.32</td><td>61.12 ± 4.64</td></tr><tr><td>GIN-k-NN</td><td>41.31± 2.84</td><td>43.58±2.80</td><td>45.12 ± 2.19</td><td>57.24 ± 7.06</td><td>59.34± 5.24</td><td>60.49±3.48</td></tr><tr><td>OurMethod-GCN</td><td>40.77 ± 4.32</td><td>44.28 ± 3.86</td><td>48.67 ± 4.22</td><td>54.34 ± 5.64</td><td>58.16 ± 4.39</td><td>60.86 ± 3.74</td></tr><tr><td>OurMethod-GAT</td><td>41.59 ± 4.12</td><td>45.67± 3.68</td><td>50.34± 2.71</td><td>55.42 ± 5.74</td><td>60.64 ± 3.84</td><td>62.81 ± 3.56</td></tr></table>
188
+
189
+ The results clearly show that our proposed method and its GCN variant (i.e., OurMethod-GCN) outperform the baselines. GIN- $k$ -NN shows significant degradation in results on nearly all the three paradigms for all datasets with exceptions on 5-shot and 10-shot on ENZYMES dataset, thus strongly indicating that the improvements of our method can primarily be attributed to our GNN classifier fed with the super-graph constructed from our proposed method. The improvements in results are higher on TRIANGLES and Reddit datasets in contrast to Letter-High and ENZYMES, which can be attributed to the smaller size of the graphs in Letter-High making it difficult to distinguish based on graph spectra alone, whereas the complex and highly inter-related structure of enzymes makes it difficult for the DL based feature extractors as well as the graph kernel methods to segregate the classes in the feature and graph space respectively. GIN and WL show much better results as compared to other baselines for all the $q$ -shot scenarios, whereas AWE and Graphlet Kernel show significantly low results, unable to capture the properties of the graphs well. The DL baselines apart from GIN on the other hand show improvements on the TRIANGLES dataset performing close to GIN, where the unsupervised methods fails to capture the local node properties, however still perform poorly on other datasets. For the 20-shot scenario on TRIANGLES, our GAT variant shows an improvement of around $7 \%$ over DL baselines and more than $2 0 \%$ when compared to unsupervised methods. The substantial improvements of around $4 \%$ on Reddit dataset shows the superiority of our model for both the variants - GAT and GCN. Furthermore, the $t$ -SNE plots in Figure 3 show a substantial and interesting separation of class labels which strongly indicate that a good feature extractor in conjunction with a GNN perform well as a combination. The t-SNE plots for ENZYMES, Reddit, and Letter-High are shown in figures 4, 5 and 6 respectively.
190
+
191
+ ![](images/c52ff756e9f560ae3e4f1bc969a402fd9e4832578474fe3bc86a8e21779491da.jpg)
192
+ Figure 3: Visualization: t-SNE plots of the computed embeddings of test graphs on 20-shot scenario from OurMethod-GAT (left), GIN (middle) and WL Kernel (right) on TRIANGLES dataset. The embeddings for both our model and GIN are taken from the final layers of the respective models.
193
+
194
+ # 5.3 ABLATION STUDY ON NUMBER OF SUPER-CLASSES
195
+
196
+ Here, we study the behavior of our proposed network model without the super-class classifier $C ^ { s u p }$ . In Table 3 (10 and 20-shot setting), we observe a marked increase with the addition of our classifier which uses the super-class information and the super-graph based on spectral measures to guide $C ^ { G A T }$ towards improving the class separation of the graphs during both the training and fine-tuning stages. Using super-classes help in reducing the sample complexity of the large Hypothesis space and makes tuning of the model parameters easier during fine-tuning stage with less samples and few iterations. Negligible differences are observed on ENZYMES dataset since both the number of training classes as well as test classes are low, thus, the model performs equally well on removing super-classes. This is because of the latent inter-class representations can still be captured between few classes especially during the fine-tuning phase.
197
+
198
+ Table 3: Ablation Study: “No-SC” represents our classifier $C ( . )$ without $C ^ { s u p }$ and “With-SC” represents C(.) with both Csup and CGAT present.
199
+
200
+ <table><tr><td rowspan="2">Dataset</td><td colspan="2">10-shot</td><td colspan="2">20-shot</td></tr><tr><td>No-SC</td><td>With-SC</td><td>No-SC</td><td>With-SC</td></tr><tr><td>Letter-High</td><td>71.13 ± 3.64</td><td>73.61 ± 3.19</td><td>75.23 ± 2.48</td><td>77.42 ± 1.47</td></tr><tr><td>TRIANGLES</td><td>74.03 ± 3.89</td><td>76.49 ± 3.26</td><td>76.89 ± 2.63</td><td>80.14 ± 1.88</td></tr><tr><td>Reddit-12K</td><td>43.76 ± 4.34</td><td>45.35 ± 4.06</td><td>48.19 ± 4.01</td><td>50.36 ± 3.04</td></tr><tr><td>ENZYMES</td><td>59.97 ± 3.98</td><td>59.58 ± 4.32</td><td>62.7 ± 3.63</td><td>62.39 ± 3.48</td></tr></table>
201
+
202
+ # 5.4 SENSITIVITY ANALYSIS OF VARIOUS ATTRIBUTES
203
+
204
+ Our proposed method contains two crucial attributes. We analyze our model by varying: (i) the number of super-classes and (ii) the $k$ -value in super-graph construction. The effect of varying these attributes on model accuracy are shown in Tables 4 and 5, respectively. For TRIANGLES and Letter
205
+
206
+ Table 4: Model analysis over number of super-classes in 20-shot scenario. There is no evaluation for 5 super-classes on ENZYMES since the number of training classes is 4. Default value of parameter $k$ is fixed at 2.
207
+ Dataset
208
+ 20-shot
209
+ Table 5: Model analysis over number of neighbors $( k )$ in super-graph for 20-shot scenario. Default value for the number of super-classes is fixed at 3.
210
+
211
+ <table><tr><td></td><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td></tr><tr><td>Letter-High</td><td>74.43± 2.61</td><td>76.61 ± 1.67</td><td>77.51 ± 1.49</td><td>76.31 ± 1.98</td><td>75.05 ± 2.29</td></tr><tr><td>TRIANGLES</td><td>76.43 ± 2.87</td><td>79.55 ± 1.91</td><td>80.51 ± 1.72</td><td>78.91 ± 2.09</td><td>78.25 ± 2.40</td></tr><tr><td>Reddit-12K</td><td>48.32 ± 4.09</td><td>50.67 ± 2.94</td><td>50.10 ± 3.02</td><td>49.52 ± 4.02</td><td>48.33 ± 4.08</td></tr><tr><td>ENZYMES</td><td>62.34 ± 4.11</td><td>62.13 ± 4.01</td><td>60.16 ± 3.81</td><td>59.34 ± 3.98</td><td></td></tr></table>
212
+
213
+ Dataset
214
+ 20-shot
215
+
216
+ <table><tr><td></td><td>2</td><td></td><td>4</td><td>6</td><td>8</td><td>Heuristic</td></tr><tr><td>Letter-High</td><td>77.33 ± 1.71</td><td></td><td>76.61 ± 1.67</td><td>75.63 ± 2.49</td><td>74.66 ± 2.61</td><td>74.35 ± 2.48</td></tr><tr><td>TRIANGLES</td><td>80.77 ± 1.57</td><td></td><td>79.85 ± 1.59</td><td>79.45 ± 1.97</td><td>78.93 ± 2.04</td><td>79.42 ± 3.16</td></tr><tr><td>Reddit-12K</td><td>50.48 ± 3.02</td><td></td><td>46.37 ± 3.03</td><td>44.12 ± 2.98</td><td>43.88 ± 3.24</td><td>44.82 ± 2.83</td></tr><tr><td>ENZYMES</td><td>62.34 ± 4.11</td><td></td><td>61.42 ± 4.42</td><td>60.23 ± 5.10</td><td>59.67 ± 4.77</td><td>61.07 ± 4.68</td></tr></table>
217
+
218
+ High datasets, as we increase the number of super-classes, we observe the accuracy improving steadily up to 3 super-classes and then dropping from there onwards. For super-classes less than 3, we observe that the $k$ -NN graph does not respect the class boundaries that are already imposed by the graph spectral measures, thus connecting more arbitrary classes. For Reddit we observe the performance is slightly better on using 2 super-classes and for ENZYMES similar performances are observed for both 1 and 2 super-classes as described in the ablation study. On the other hand, increasing the number of super-classes past 3, makes each super-class cluster very sparse with few graph classes within, leading to an underflow of information between the graph classes. The same effect is observed for all datasets.
219
+
220
+ The $k$ -value or the number of neighbors of each node belonging to the same connected component in the super-graph (i.e., belonging to the same super-class) is another salient parameter upon which hinges the information flow (via message passing) between the graphs of the same super-class. We analyze our model with $k$ values in the set $\{ 2 , 4 , 6 , 8 \}$ and a commonly used heuristic method, whereby each graph is connected to $\sqrt { b _ { s } }$ nearest neighboring graphs based on the Euclidean similarity of their feature representations, where $b _ { s }$ is the number of samples in the mini-batch corresponding to super-classes $s$ . We achieve best results with 2-NN graphs per super-class and increasing $k$ beyond it leads to denser graphs with unnecessary connections between classes belonging to the same super-class.
221
+
222
+ # 6 CONCLUSION
223
+
224
+ In this paper, we investigated the problem of few-shot learning on graphs for the graph classification task. We explicitly created a super-graph on the base-labeled graphs and then grouped / clustered their associated class labels into super-classes, based on the graph spectral measures attributed to each graph and the $L ^ { p }$ -Wasserstein distances between them. We found that training our GNN on the super-graph along with the auxiliary super-classes resulted in a marked improvement over stateof-the-art GNNs. A promising future work is to propose new GNN models that break away from current neighborhood aggregation schemes to specifically overcome the obstacle posed by few-shot learning on graphs. Our source-code and dataset splits have been made public in an attempt to attract more attention to the context of few-shot learning on graphs.
225
+
226
+ # REFERENCES
227
+
228
+ Martial Agueh and Guillaume Carlier. Barycenters in the wasserstein space. SIAM J. Math. Analysis, 43(2):904–924, 2011.
229
+
230
+ David Arthur and Sergei Vassilvitskii. K-means $^ { + + }$ : The advantages of careful seeding. In Proceedings of the Eighteenth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA ’07, pp. 1027–1035, 2007.
231
+
232
+ Lars Backstrom and Jure Leskovec. Supervised random walks: Predicting and recommending links in social networks. CoRR, abs/1011.4071, 2010. URL http://arxiv.org/abs/1011. 4071.
233
+
234
+ Peter Battaglia, Jessica Blake Chandler Hamrick, Victor Bapst, Alvaro Sanchez, Vinicius Zambaldi, Mateusz Malinowski, Andrea Tacchetti, David Raposo, Adam Santoro, Ryan Faulkner, Caglar Gulcehre, Francis Song, Andy Ballard, Justin Gilmer, George E. Dahl, Ashish Vaswani, Kelsey Allen, Charles Nash, Victoria Jayne Langston, Chris Dyer, Nicolas Heess, Daan Wierstra, Pushmeet Kohli, Matt Botvinick, Oriol Vinyals, Yujia Li, and Razvan Pascanu. Relational inductive biases, deep learning, and graph networks. arXiv, 2018. URL https: //arxiv.org/pdf/1806.01261.pdf.
235
+
236
+ Karsten M. Borgwardt, Cheng Soon Ong, Stefan Schonauer, S. V. N. Vishwanathan, Alex J. Smola, ¨ and Hans-Peter Kriegel. Protein function prediction via graph kernels. Bioinformatics, 21(1): 47–56, January 2005. ISSN 1367-4803. doi: 10.1093/bioinformatics/bti1007. URL http: //dx.doi.org/10.1093/bioinformatics/bti1007.
237
+
238
+ Michael M. Bronstein, Joan Bruna, Yann LeCun, Arthur Szlam, and Pierre Vandergheynst. Geometric deep learning: going beyond euclidean data. CoRR, abs/1611.08097, 2016. URL http://arxiv.org/abs/1611.08097.
239
+
240
+ Joan Bruna, Wojciech Zaremba, Arthur Szlam, and Yann Lecun. Spectral networks and locally connected networks on graphs. In International Conference on Learning Representations (ICLR2014), CBLS, April 2014, 2014.
241
+
242
+ Duen Horng Chau, Carey Nachenberg, Jeffrey Wilhelm, Adam Wright, and Christos Faloutsos. Polonium: Tera-scale graph mining and inference for malware detection. In SIAM INTERNATIONAL CONFERENCE ON DATA MINING (SDM), pp. 131–142, 2011.
243
+
244
+ Wei-Yu Chen, Yen-Cheng Liu, Zsolt Kira, Yu-Chiang Frank Wang, and Jia-Bin Huang. A closer look at few-shot classification. In International Conference on Learning Representations, 2019. URL https://openreview.net/forum?id $=$ HkxLXnAcFQ.
245
+
246
+ Michael Defferrard, Xavier Bresson, and Pierre Vandergheynst. Convolutional neural networks on ¨ graphs with fast localized spectral filtering. In D. D. Lee, M. Sugiyama, U. V. Luxburg, I. Guyon, and R. Garnett (eds.), Advances in Neural Information Processing Systems 29, pp. 3844–3852. Curran Associates, Inc., 2016.
247
+
248
+ David K Duvenaud, Dougal Maclaurin, Jorge Iparraguirre, Rafael Bombarell, Timothy Hirzel, Alan Aspuru-Guzik, and Ryan P Adams. Convolutional networks on graphs for learning molecular fingerprints. In C. Cortes, N. D. Lawrence, D. D. Lee, M. Sugiyama, and R. Garnett (eds.), Advances in Neural Information Processing Systems 28, pp. 2224–2232. Curran Associates, Inc., 2015.
249
+
250
+ Li Fei-Fei, Rob Fergus, and Pietro Perona. One-shot learning of object categories. IEEE Trans. Pattern Anal. Mach. Intell., 28(4):594–611, April 2006. ISSN 0162-8828. doi: 10.1109/TPAMI. 2006.79. URL https://doi.org/10.1109/TPAMI.2006.79.
251
+
252
+ Chelsea Finn, Pieter Abbeel, and Sergey Levine. Model-agnostic meta-learning for fast adaptation of deep networks. CoRR, abs/1703.03400, 2017. URL http://arxiv.org/abs/1703. 03400.
253
+
254
+ Aude Genevay, Marco Cuturi, Gabriel Peyre, and Francis Bach. Stochastic optimization for large- ´ scale optimal transport. In Advances in Neural Information Processing Systems 29, pp. 3440– 3448. 2016.
255
+
256
+ Marco Gori, Gabriele Monfardini, and Franco Scarselli. A new model for learning in graph domains. In Proceedings. 2005 IEEE International Joint Conference on Neural Networks, 2005., volume 2, pp. 729–734. IEEE, 2005.
257
+
258
+ Jiao Gu, Bobo Hua, and Shiping Liu. Spectral distances on graphs. Discrete Applied Mathematics, 190-191:56 – 74, 2015.
259
+
260
+ William L. Hamilton, Rex Ying, and Jure Leskovec. Inductive representation learning on large graphs. CoRR, abs/1706.02216, 2017. URL http://arxiv.org/abs/1706.02216.
261
+
262
+ Mikael Henaff, Joan Bruna, and Yann LeCun. Deep convolutional networks on graph-structured data. CoRR, abs/1506.05163, 2015. URL http://arxiv.org/abs/1506.05163.
263
+
264
+ Sergey Ivanov and Evgeny Burnaev. Anonymous walk embeddings. In Jennifer Dy and Andreas Krause (eds.), Proceedings of the 35th International Conference on Machine Learning, volume 80 of Proceedings of Machine Learning Research, pp. 2186–2195, Stockholmsmssan, Stockholm Sweden, 10–15 Jul 2018. PMLR. URL http://proceedings.mlr.press/ v80/ivanov18a.html.
265
+
266
+ Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization, 2014. URL http://arxiv.org/abs/1412.6980. cite arxiv:1412.6980Comment: Published as a conference paper at the 3rd International Conference for Learning Representations, San Diego, 2015.
267
+
268
+ Thomas N. Kipf and Max Welling. Semi-supervised classification with graph convolutional networks. CoRR, abs/1609.02907, 2016. URL http://arxiv.org/abs/1609.02907.
269
+
270
+ Nils M. Kriege, Fredrik D. Johansson, and Christopher Morris. A survey on graph kernels. ArXiv, abs/1903.11835, 2019.
271
+
272
+ Junhyun Lee, Inyeop Lee, and Jaewoo Kang. Self-attention graph pooling. In Kamalika Chaudhuri and Ruslan Salakhutdinov (eds.), Proceedings of the 36th International Conference on Machine Learning, volume 97 of Proceedings of Machine Learning Research, pp. 3734–3743, Long Beach, California, USA, 09–15 Jun 2019. PMLR. URL http://proceedings.mlr. press/v97/lee19c.html.
273
+
274
+ Qimai Li, Zhichao Han, and Xiao-Ming Wu. Deeper insights into graph convolutional networks for semi-supervised learning. CoRR, abs/1801.07606, 2018a. URL http://arxiv.org/abs/ 1801.07606.
275
+
276
+ Qimai Li, Zhichao Han, and Xiao-Ming Wu. Deeper insights into graph convolutional networks for semi-supervised learning. In AAAI, 2018b.
277
+
278
+ Annamalai Narayanan, Mahinthan Chandramohan, Rajasekar Venkatesan, Lihui Chen, Yang Liu, and Shantanu Jaiswal. graph2vec: Learning distributed representations of graphs. CoRR, abs/1707.05005, 2017. URL http://arxiv.org/abs/1707.05005.
279
+
280
+ Alex Nichol, Joshua Achiam, and John Schulman. On first-order meta-learning algorithms. CoRR, abs/1803.02999, 2018. URL http://arxiv.org/abs/1803.02999.
281
+
282
+ Sachin Ravi and Hugo Larochelle. Optimization as a model for few-shot learning. In 5th International Conference on Learning Representations, ICLR 2017, Toulon, France, April 24-26, 2017, Conference Track Proceedings. OpenReview.net, 2017. URL https://openreview.net/ forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ rJY0-Kcll.
283
+
284
+ Andrei A. Rusu, Dushyant Rao, Jakub Sygnowski, Oriol Vinyals, Razvan Pascanu, Simon Osindero, and Raia Hadsell. Meta-learning with latent embedding optimization. CoRR, abs/1807.05960, 2018. URL http://arxiv.org/abs/1807.05960.
285
+
286
+ Franco Scarselli, Marco Gori, Ah Chung Tsoi, Markus Hagenbuchner, and Gabriele Monfardini. The graph neural network model. Trans. Neur. Netw., 20(1):61–80, January 2009. ISSN 1045- 9227. doi: 10.1109/TNN.2008.2005605. URL http://dx.doi.org/10.1109/TNN. 2008.2005605.
287
+
288
+ N. Shervashidze, SVN. Vishwanathan, TH. Petri, K. Mehlhorn, and KM. Borgwardt. Efficient graphlet kernels for large graph comparison. In JMLR Workshop and Conference Proceedings Volume 5: AISTATS 2009, pp. 488–495, Cambridge, MA, USA, April 2009. Max-PlanckGesellschaft, MIT Press.
289
+
290
+ Nino Shervashidze, Pascal Schweitzer, Erik Jan van Leeuwen, Kurt Mehlhorn, and Karsten M. Borgwardt. Weisfeiler-lehman graph kernels. J. Mach. Learn. Res., 12:2539–2561, November 2011. ISSN 1532-4435. URL http://dl.acm.org/citation.cfm?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ 1953048. 2078187.
291
+
292
+ Petar Velikovi, Guillem Cucurull, Arantxa Casanova, Adriana Romero, Pietro Li, and Yoshua Bengio. Graph attention networks. In International Conference on Learning Representations, 2018. URL https://openreview.net/forum?id $=$ rJXMpikCZ.
293
+
294
+ B. Yu. Weisfeiler and A. A. Leman. Reduction of a graph to a canonical form and an algebra arising during this reduction. 1968.
295
+
296
+ Zonghan Wu, Shirui Pan, Fengwen Chen, Guodong Long, Chengqi Zhang, and Philip S. Yu. A comprehensive survey on graph neural networks. CoRR, abs/1901.00596, 2019.
297
+
298
+ Zhang Xinyi and Lihui Chen. Capsule graph neural network. In International Conference on Learning Representations, 2019. URL https://openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } }$ Byl8BnRcYm.
299
+
300
+ Keyulu Xu, Weihua Hu, Jure Leskovec, and Stefanie Jegelka. How powerful are graph neural networks? In International Conference on Learning Representations, 2019. URL https: //openreview.net/forum?id $=$ ryGs6iA5Km.
301
+
302
+ Shengzhong Zhang, Ziang Zhou, Zengfeng Huang, and Zhongyu Wei. Few-shot classification on graphs with structural regularized GCNs, 2019. URL https://openreview.net/forum? id=r1znKiAcY7.
303
+
304
+ # A APPENDIX
305
+
306
+ # A.1 DATASET DETAILS
307
+
308
+ We use 4 different datasets namely - Reddit-12K, ENZYMES, Letter-High and TRIANGLES to perform exhaustive empirical evaluation of our model on various real-world datasets varying from small average graph size on Letter-High to large graphs like Reddit-12K. These datasets can be downloaded here 4. The dataset statistics are provided in Table 6, while the split statistics are provided in Table 7
309
+
310
+ Table 6: Dataset Statistics
311
+
312
+ <table><tr><td>DatasetName</td><td># Classes</td><td># Graphs</td><td>Avg # Nodes</td><td>Avg #Edges</td></tr><tr><td>Reddit-12K</td><td></td><td>11929</td><td>391.41</td><td>456.89</td></tr><tr><td>ENZYMES</td><td>11 6</td><td>600</td><td>32.63</td><td>62.14</td></tr><tr><td>Letter-High</td><td>15</td><td>2250</td><td>4.67</td><td>4.50</td></tr><tr><td>TRIANGLES</td><td>10</td><td>45000</td><td>20.85</td><td>35.50</td></tr></table>
313
+
314
+ Dataset Description: Reddit-12K datasets contains 11929 graphs where each graph corresponds to a thread in which each node represents a user and each edge represents that one user has responded to a comment from some other user. There are 11 different types of discussion forums corresponding to each of the 11 classes.
315
+
316
+ ENZYMES is a dataset of protein tertiary structures consisting of 600 enzymes from the BRENDA enzyme database. The dataset contains 6 different graph categories corresponding to each different top-level EC enzyme.
317
+
318
+ TRIANGLES dataset contain 10 different classes where the classes are numbered from 1 to 10 corresponding to the number of triangles/3-cliques in each graph of the dataset.
319
+
320
+ Letter-High dataset contains graphs which represent distorted letter drawings from the english alphabets - $A , E , F , H , I , K , L , M , N , T , V , W , X , Y , Z$ . Each graph is a prototype manual construction of the alphabets.
321
+
322
+ Table 7: Dataset Splits
323
+
324
+ <table><tr><td>Dataset Name</td><td>#Train Classes</td><td>#Test Classes</td><td># Training Graphs</td><td># Validation Graphs</td><td>#Test Graphs</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Reddit-12K</td><td>7</td><td>4</td><td>566</td><td>141</td><td>404</td></tr><tr><td>ENZYMES</td><td>4 11</td><td>2 4</td><td>320 1330</td><td>80 320</td><td>200 600</td></tr><tr><td>Letter-High TRIANGLES</td><td>7</td><td>3</td><td>1126</td><td>271</td><td>603</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td></tr></table>
325
+
326
+ The validation graphs are used to assess model performance on training classes itself to check overfitting as well as for grid-search over hyperparameters. The actual train-testing class splits used for this paper are provided with the code. Since the TRIANGLES dataset has a large number of samples, this makes it infeasible to run many baselines including DL and non-DL methods. Hence, we sample 200 graphs from each class, making the total sample size 2000. Similarly we downsample the number of graphs from 11929 to 1111 (nearly 101 graphs per class). Downsampling is performed for Reddit-12K given extremely large graph sizes which makes the graph kernels as well as some deep learning baselines extremely slow.
327
+
328
+ # A.2 BASELINE DETAILS
329
+
330
+ This section details the implementation of the baseline methods. Since, DL-based methods - GIN, CapsGNN and DIFFPOOL have not been previously run on these datasets, we select the crucial hyper-parameters - such as number of layers heuristically based on the results of standard graph classification datasets on the best performing variants of these models. For these three methods we take the novel layers proposed in the corresponding papers as their feature extractors, while downstream MLP layers are chosen as the classifier. The training and evaluation strategies are similar to our model, i.e., the models are first trained in an end-to-end fashion on the training dataset $G _ { B }$ until convergence with learning rate decay on loss plateau and then the classifier layers are fine-tuned over $G _ { N }$ , keeping the parameters of the feature extractor layers fixed.
331
+
332
+ For the unsupervised models - WL subtree kernel, Graphlet Count kernel, AWE and Graph2Vec, the evaluation is done using $k$ -NN search to assess the clustering quality of these models in our few-shot scenario. We refrain from using high-level classifier models such as SVM or MLPs, since training these classifiers on few-shot regime will not properly assess the abilities of these models to cluster together graphs of similar class labels. We empirically found that using high level classifiers resulted in higher deviations and lower mean accuracies. We choose the hyper-parameters for these models using grid-search, since they are significantly faster and each one of these models have few highly sensitive parameters which affect the model significantly. For these models, we perform a grid search for selection of $k$ in the $k$ -NN algorithm from the set $\{ 1 , 2 , 3 , 4 , 5 \}$ for the 5-shot scenario, of which $k = 1$ was found to perform the best. For higher shot scenario, the search was performed over the set $\{ 1 , 2 , 3 , 4 , 5 , 6 , 7 , \bar { 8 } , 9 , 1 0 \}$ , where we again found $k = 1$ to be the best. The validation set is used to check overfitting and hyper-parameter selection on the baseline methods.
333
+
334
+ # A.3 OUR MODEL DETAILS
335
+
336
+ This section provides the implementation details of our proposed model. Since, our feature extractor model is GIN, we maintain similar parameter settings as recommended by their paper. As mentioned in section 4.2, using embeddings from all iterations of the message passing network helps achieve better discriminative power and improved gradient flow, therefore we employ the same strategy in our feature extractor. The number of super-classes are selected from the set $\{ 1 , 2 , 3 , 4 , 5 \}$ using grid-search. The $k$ -value for construction of super-graph was selected from the set $\{ 2 , 4 , 6 , 8 \}$ . The feature extractor model uses batch-normalization between subsequent message passing layers. We use dropout of 0.5 in the $C ^ { s u p }$ layers. The $C ^ { G A T }$ layers undergo normalization of inputs between subsequent layers along with a dropout of 0.5, however, the normalization mechanism in classifier layers is different from batch-norm. We normalize each feature embedding to have Euclidean norm with value 1. Essentially,
337
+
338
+ $$
339
+ \mathbf { x } _ { i n p u t } ^ { j + 1 } = \frac { \mathbf { x } _ { o u t } ^ { j } } { | | \mathbf { x } _ { o u t } ^ { j } | | _ { 2 } }
340
+ $$
341
+
342
+ where $\mathbf { x } _ { i n p u t } ^ { j + 1 }$ is the input of $j + 1 ^ { t h }$ layer of classifier, $\mathbf { x } _ { o u t } ^ { j }$ is the output of the $j ^ { t h }$ layer. The inputs of the first layer of $C ^ { G A T }$ also undergo the same transformation over the outputs of the feature extractor model. We train our models with Adam (Kingma & Ba (2014)) with an initial learning rate of $1 0 ^ { - 3 }$ for 50 epochs. Each epoch has 10 iterations, where we randomly select a mini-batch from the training data $G _ { B }$ . The fine-tuning stage consists of 20 epochs with 10 iterations per epoch. We use a two-layer MLP over the final attention layer of $C ^ { G A T ^ { \bf 1 } }$ for classification. The attention layers use multi-head attention with 2 heads and leaky ReLU slope of 0.1 . The embeddings from both the attention heads are concatenated. For 20-shot, we set $k$ to 2, number of super-classes to 3 and batch size to 128 on the Letter-High dataset, while $k$ is set to 2 and batch size 64 on Reddit, ENZYMES and TRIANGLES datasets. The number of super-classes for Reddit are set to 2, for ENZYMES it is set to 1 and for TRIANGLES are 3. For ENZYMES, there are negligible differences on using 1 and 2 super-classes as shown in table 4. We used Python Optimal Transport (POT) library 5 for implementation of the $p$ -th Wasserstein distance.
343
+
344
+ ![](images/29fdd17a77c3e8e015beb1724b352f5089f6e6dae91756dba71ded23dab355b7.jpg)
345
+ Figure 4: Visualization: t-SNE plots of the computed embeddings of test graphs on 20-shot scenario from OurMethod-GAT (left), GIN (middle) and WL Kernel (right) on ENZYMES dataset.
346
+
347
+ ![](images/562f5e73ca715f0b27d1079b212c127e5869fabcb2d041d7a1dfb57df4883ff6.jpg)
348
+ Figure 5: Visualization: t-SNE plots of the computed embeddings of test graphs on 20-shot scenario from OurMethod-GAT (left), GIN (middle) and WL Kernel (right) on Reddit dataset.
349
+
350
+ ![](images/5cc4f83d20953c2ca1efcadb37047fc6947a35899155b9dcb5b918db26496726.jpg)
351
+ Figure 6: Visualization: t-SNE plots of the computed embeddings of test graphs on 20-shot scenario from OurMethod-GAT (left), GIN (middle) and WL Kernel (right) on Letter-High dataset.
352
+
353
+ # A.4 SILHOUETTE SCORES
354
+
355
+ To assess the clustering abilities of the models we analyze the silhouette scores of the test embeddings produced by the GAT variant of our method, GIN and WL Kernel. Silhouette coefficient essentially measures the ratio of intra-class versus inter-class distance. The Silhouette Coefficient is calculated using the mean intra-cluster distance (a) and the mean nearest-cluster distance (b) for each sample. The Silhouette Coefficient for a sample is given by $\frac { ( b - a ) } { m a x ( a , b ) }$ ,where $b$ is the distance between a sample and the nearest cluster that the sample is not a part of. The results for mean silhouette coefficient over the test samples averaged over multiple runs are shown in Table 8. We normalize the embeddings before calculating the silhouette coefficient. We can clearly see that our model creates better clusters with low intra-cluster distance as well as high inter-cluster distance. Note that the coefficient value for WL remains the same for all scenarios since it computes fixed embeddings attributed to absence of any DL component.
356
+
357
+ Table 8: Silhouette coefficients of the test classes for the three dominant models - GAT variant of Our Method, GIN and WL. The best scores are highlighted in bold.
358
+
359
+ <table><tr><td rowspan="2">Method</td><td colspan="2">Reddit-12K</td><td colspan="2">ENZYMES</td><td colspan="2">Letter-High</td><td colspan="2">TRIANGLES</td></tr><tr><td>10-shot</td><td>20-shot</td><td>10-shot</td><td>20-shot</td><td>10-shot</td><td>20-shot</td><td>10-shot</td><td>20-shot</td></tr><tr><td>GIN</td><td>-0.0566</td><td>-0.0652</td><td>0.0168</td><td>0.0432</td><td>0.2157</td><td>0.2316</td><td>0.0373</td><td>0.1256</td></tr><tr><td>WLKernel</td><td>-0.0626</td><td>-0.0626</td><td>0.0366</td><td>0.0366</td><td>0.2490</td><td>0.2490</td><td>0.0186</td><td>0.0186</td></tr><tr><td>OurMethod-GAT</td><td>-0.0553</td><td>-0.0559</td><td>0.0296</td><td>0.1172</td><td>0.3494</td><td>0.3787</td><td>0.3824</td><td>0.4508</td></tr></table>
360
+
361
+ Table 9: Semi-supervised fine-tuning results for various $p$ values on 10-shot and 20-shot scenarios, where “No Semi-Sup” represents the fine-tuning stage without additional labeled samples.
362
+
363
+ <table><tr><td rowspan="2">Dataset</td><td colspan="3">10-shot</td><td colspan="3">20-shot</td></tr><tr><td>No Semi-Sup</td><td>25</td><td>50</td><td>No Semi-Sup</td><td>25</td><td>50</td></tr><tr><td>Letter-High</td><td>73.21± 3.19</td><td>74.18 ± 2.58</td><td>74.65 ± 2.16</td><td>76.95 ± 1.79</td><td>77.79 ± 1.52</td><td>78.31 ± 1.11</td></tr><tr><td>TRIANGLES</td><td>75.83 ± 2.97</td><td>76.36± 2.59</td><td>77.8 ± 2.04</td><td>80.09 ±1.78</td><td>81.29 ± 1.98</td><td>81.87 ± 1.45</td></tr><tr><td rowspan="2">Dataset</td><td></td><td>10-shot</td><td></td><td></td><td>20-shot</td><td></td></tr><tr><td>No Semi-Sup</td><td>10</td><td>20</td><td>No Semi-Sup</td><td>10</td><td>20</td></tr><tr><td>Reddit</td><td>45.41± 3.79</td><td>45.88±3.32</td><td>46.01± 2.99</td><td>50.34± 2.77</td><td>50.76±2.52</td><td>51.17 ± 2.21</td></tr><tr><td>ENZYMES</td><td>60.13 ± 3.98</td><td>60.87 ± 3.24</td><td>61.25 ± 3.17</td><td>62.74 ± 3.64</td><td>63.10± 3.47</td><td>63.67 ± 3.18</td></tr></table>
364
+
365
+ # A.5 SEMI-SUPERVISED FINE-TUNING
366
+
367
+ In many real-world learning scenarios, it is quite common to find abundant unlabelled data. Since our model uses a GNN classifier, this makes it possible to use unlabelled data while learning through message passing, where the fine tuning stage of our method is performed in semi-supervised settings.
368
+
369
+ Essentially, while fine tuning the model, i.e., only training the classifier $C ^ { G A T }$ on $G _ { N }$ , we additionally use $p$ more graphs along with $G _ { N }$ , whose labels are unknown. The learning objective for fine tuning stage doesn’t change since the gradients are back-propagated from the labeled samples only. In this setting, each node in the attention classifier can aggregate information from unlabelled samples as well, thus allowing improved learning of the graphs features in $C ^ { G A T }$ . We show the results for $p$ values 25 and 50 on Letter-High and TRIANGLES datasets, whereas for $p$ values 10 and 20 on Reddit and ENZYMES datasets. The results are shown in Table 9. We observe an increase in the accuracy with increase in number of unlabeled samples during fine-tuning phase.
370
+
371
+ # A.6 ADAPTATION TO ACTIVE-LEARNING
372
+
373
+ In this section, we show the adaptation of our model to highly practical active learning scenario. In many real world applications, we might start with few samples per class, however as the number of samples to classify from these classes increase over time, some of these samples can be used by the model to adaptively learn and improve with very less human intervention, since the number of number of samples to be queried for theirs label can always be controlled.
374
+
375
+ To perform active-learning, we first select a random subset of size 100 for Letter-High and TRIANGLES datasets as well as a random subset of size 40 for Reddit and ENZYMES datasets, which we term as $G _ { r a n d o m }$ , then fine tune the model on $G _ { N }$ and further evaluate the model on $G _ { r a n d o m }$ .
376
+
377
+ Table 10: Active Learning Results. The value below each shot represents the number samples $l$ , added to $G _ { N }$ for second fine-tuning step, where “No AL” represents the model evaluation without additional labeled samples.
378
+
379
+ <table><tr><td rowspan="2">Dataset</td><td colspan="3">10-shot</td><td colspan="3">20-shot</td></tr><tr><td>No AL</td><td>15</td><td>25</td><td>No AL</td><td>15</td><td>25</td></tr><tr><td>Letter-High</td><td>73.34± 3.37</td><td>75.03 ± 3.24</td><td>76.89 ± 2.16</td><td>77.06 ± 1.73</td><td>78.44 ± 1.52</td><td>79.28 ± 1.36</td></tr><tr><td>TRIANGLES</td><td>76.02 ± 2.54</td><td>78.44 ± 1.84</td><td>79.91 ± 1.28</td><td>80.27 ±1.84</td><td>81.74 ± 2.03</td><td>82.58 ± 1.57</td></tr><tr><td rowspan="2">Dataset</td><td colspan="3">10-shot</td><td colspan="3">20-shot</td></tr><tr><td>No AL</td><td>10</td><td>20</td><td>No AL</td><td>10</td><td>20</td></tr><tr><td>Reddit</td><td>45.41± 3.79</td><td>46.88±3.14</td><td>47.91± 2.99</td><td>50.43±2.66</td><td>51.76± 2.32</td><td>53.07± 2.21</td></tr><tr><td>ENZYMES</td><td>60.13 ± 3.98</td><td>61.57 ± 3.48</td><td>62.25 ± 3.06</td><td>62.74 ± 3.64</td><td>63.60±3.30</td><td>64.97 ± 3.11</td></tr></table>
380
+
381
+ Thereafter, l relatively important samples are chosen from $G _ { r a n d o m }$ and added to $G _ { N }$ for another step of fine-tuning. There can be multiple strategies for defining relative importance of a sample. For our purpose, we define a sample’s relative importance via its predicted class probability distribution. We sort these samples in increasing order of the difference between their highest and second highest predicted class probabilities and choose the first $l$ samples from this sorted ranking. We call this importance relative, since each sample is evaluated with respect to the set $G _ { N }$ and thus, there is transductive flow of information among the samples, hence defining the relative embeddings in the space. Intuitively speaking, we have chosen the samples lying closer to separation boundary with respect to $G _ { N }$ . The results for various values of $l$ are shown in Table 10. The evaluation is done as mentioned earlier on the unseen set $G _ { U }$ . We observe significant improvement for all the datasets. This shows our model is capable of selecting important samples with respect to the few existing samples and learn actively.
382
+
383
+ # A.7 PERFORMANCE OF MODEL WITH 1 SUPER-CLASS
384
+
385
+ From table 4 in correspondence to tables 1 and 2, one can observe that the results obtained by using only 1 super-class which is equivalent to removing the super-classes are still better in comparison with many GNN and graph kernel baselines. By removing the super-classes and thus forming the super-graph solely based on $\mathbf { k }$ -nearest neighbor heuristic the GAT still learns latent inter class connections via information flow better than the GNNs which use MLP as their classifier. The super graph constructed in such scenario will have arbitrary connections between classes in the beginning, however as the GIN feature extractor learns over time the segregation in the feature space increases leading to better inter as well intra-class connections. Despite this, the performance with superclasses is better as this inductive bias allows the model to initiate with a better alignment in the feature space. The silhouette score comparison for OurMethod-GAT with 1 super-class and with the best performing number of super-classes to GIN and WL clearly indicates the multifold benefits of using GNNs as a classifier via super-graph construction. The t-SNE plots for OurMethod-GAT with only 1 super-class, GIN and WL kernel on the datasets TRIANGLES, Reddit and Letter-High are provided in the figures 7, 8 and 9 respectively.
386
+
387
+ Table 11: Silhouette coefficients of the test classes for three models - GAT variant of Our Method for 1 super-class which is equivalent to not using any super-classes vs the best performing number of super-classes as well as GIN and WL on 20-shot scenario. For GIN and WL both the sub-columns contain the same values as they don’t have any concept of super-classes.
388
+
389
+ <table><tr><td rowspan="2">Method</td><td colspan="2">Reddit-12K</td><td colspan="2">ENZYMES</td><td colspan="2">Letter-High</td><td colspan="2">TRIANGLES</td></tr><tr><td>1-SC</td><td>2-SC</td><td>1-SC</td><td>2-SC</td><td>1-SC</td><td>3-SC</td><td>1-SC</td><td>3-SC</td></tr><tr><td>GIN</td><td>-0.0652</td><td>-0.0652</td><td>0.0432</td><td>0.0432</td><td>0.2316</td><td>0.2316</td><td>0.1256</td><td>0.1256</td></tr><tr><td>WLKernel</td><td>-0.0626</td><td>-0.0626</td><td>0.0366</td><td>0.0366</td><td>0.2490</td><td>0.2490</td><td>0.0186</td><td>0.0186</td></tr><tr><td>OurMethod-GAT</td><td>-0.0593</td><td>-0.0559</td><td>0.1172</td><td>0.0989</td><td>0.3519</td><td>0.3787</td><td>0.3975</td><td>0.4508</td></tr></table>
390
+
391
+ ![](images/1bafd2a3349ea4e2fe9c394cca4ab791a2cd1f65cf071a516bbd1c14891f4fbb.jpg)
392
+ Figure 7: Visualization: t-SNE plots of the computed embeddings of test graphs on 20-shot scenario from OurMethod-GAT with only 1 super-class (left), GIN (middle) and WL Kernel (right) on TRIANGLES dataset.
393
+
394
+ ![](images/2c26d5078ecb3af998cfa6a0df81aaa3205653b35f692f0d5124b1eb6194c0bd.jpg)
395
+ Figure 8: Visualization: t-SNE plots of the computed embeddings of test graphs on 20-shot scenario from OurMethod-GAT with only 1 super-class (left), GIN (middle) and WL Kernel (right) on Reddit dataset.
396
+
397
+ ![](images/6612059db44bda00c40722071d4b3b857b74cec9b39a0f864e9338819d122eed.jpg)
398
+ Figure 9: Visualization: t-SNE plots of the computed embeddings of test graphs on 20-shot scenario from OurMethod-GAT with only 1 super-class (left), GIN (middle) and WL Kernel (right) on LetterHigh dataset.
md/train/Bkepl7cee/Bkepl7cee.md ADDED
@@ -0,0 +1,210 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # PARAMETRIC EXPONENTIAL LINEAR UNIT FOR DEEP CONVOLUTIONAL NEURAL NETWORKS
2
+
3
+ Ludovic Trottier, Philippe Giguere & Brahim Chaib-draa \`
4
+
5
+ Department of Computer Science and Software Engineering
6
+ Laval University, Quebec, Canada
7
+ ludovic.trottier.1@ulaval.ca
8
+ philippe.giguere, brahim.chaib-draa@ift.ulaval.ca
9
+
10
+ # ABSTRACT
11
+
12
+ The activation function is an important component in Convolutional Neural Networks (CNNs). For instance, recent breakthroughs in Deep Learning can be attributed to the Rectified Linear Unit (ReLU). Another recently proposed activation function, the Exponential Linear Unit (ELU), has the supplementary property of reducing bias shift without explicitly centering the values at zero. In this paper, we show that learning a parameterization of ELU improves its performance. We analyzed our proposed Parametric ELU (PELU) in the context of vanishing gradients and provide a gradient-based optimization framework. We conducted several experiments on CIFAR-10/100 and ImageNet with different network architectures, such as NiN, Overfeat, All-CNN and ResNet. Our results show that our PELU has relative error improvements over ELU of $4 . 4 5 \%$ and $5 . 6 8 \%$ on CIFAR-10 and 100, and as much as $7 . 2 8 \%$ with only $0 . 0 0 0 3 \%$ parameter increase on ImageNet. We also observed that $\mathrm { V g g }$ using PELU tended to prefer activations saturating closer to zero, as in ReLU, except at the last layer, which saturated near -2. Finally, other presented results suggest that varying the shape of the activations during training along with the other parameters helps controlling vanishing gradients and bias shift, thus facilitating learning.
13
+
14
+ # 1 INTRODUCTION
15
+
16
+ Over the past few years, Convolutional Neural Networks (CNNs) have become the leading approach in computer vision (Krizhevsky et al., 2012; LeCun et al., 2015; Vinyals et al., 2015; Jaderberg et al., 2015; Ren et al., 2015; Hosang et al., 2016). Through a series of non-linear transformations, CNNs can process high-dimensional input observations into simple low-dimensional concepts. The key principle of CNNs is that features at each layer are composed of features from the layer below. This creates a hierarchical organization of increasingly abstract concepts. Since levels of organization are often seen in complex biological structures, such a hierarchical organization makes CNNs particularly well-adapted for capturing high-level abstractions from real-world observations.
17
+
18
+ The activation function plays a crucial role in learning representative features. Defined as $\operatorname* { m a x } \{ h , 0 \}$ the Rectified Linear Unit (ReLU) is one of the most popular activation function (Nair & Hinton, 2010). It has interesting properties, such as low computational complexity, non-contracting first-order derivative and induces sparse activations, which have been shown to improve performance Krizhevsky et al. (2012). The main drawback of ReLU is its zero derivative for negative arguments. This blocks the back-propagated error signal from the layer above, which may prevent the network from reactivating dead neurons. To overcome this limitation, Leaky ReLU (LReLU) adds a positive slope $a$ to the negative part of ReLU (Maas et al., 2013). Defined as $\operatorname* { m a x } \{ h , 0 \} + a \operatorname* { m i n } \{ h , 0 \}$ , where $a > 0$ LReLU has a non-zero derivative for negative arguments. Unlike ReLU, its parameter $a$ allows a small portion of the back-propagated error signal to pass to the layer below. By using a small enough value $a$ , the network can still output sparse activations while preserving its ability to reactivate dead neurons. In order to avoid specifying by hand the slope parameter $a$ , Parametric ReLU (PReLU) directly learns its value during back-propagation (He et al., 2015b). As the training phase progresses, the network can adjust its weights and biases in conjunction with the slopes $a$ of all its PReLU for potentially learning better features. Indeed, He et al. (2015b) have empirically shown that learning the slope parameter $a$ gives better performance than manually setting it to a pre-defined value.
19
+
20
+ A recently proposed important activation function is the Exponential Linear Unit (ELU). Is is defined as identity for positive arguments and $a ( \exp ( h ) - 1 )$ for negative ones (Clevert et al., 2015). The parameter $a$ can be any positive value, but is usually set to 1. ELU has the interesting property of reducing bias shift, which is defined as the change of a neuron’s mean value due to weight update. If not taken into account, bias shift leads to oscillations and impeded learning (Clevert et al., 2015). Clevert et al. (2015) have shown that either centering the neuron values at zero or using activation functions with negative values can reduce bias shift. Centering the neuron values can be done with the Batch Normalization (BN) method (Ioffe & Szegedy, 2015), while adding negative values can be done with parameterizations such as LReLU or PReLU.
21
+
22
+ Based on the observation that learning a parameterization of ReLU improves performance (He et al., 2015b), we propose the Parametric ELU (PELU) that learns a parameterization of ELU. We define parameters controlling different aspects of the function and propose learning them during back-propagation. Our parameterization preserves differentiability by acting on both the positive and negative parts of the function. Differentiable activation functions usually give better parameter updates during back-propagation (LeCun et al., 2015). PELU also has the same computational complexity as ELU. Since parameters are defined layer-wise instead of per-neurons, the number of added parameters is only $2 L$ , where $L$ is the number of layers. Our experiments on the CIFAR-10/100 and ImageNet datasets have shown that ResNet (Shah et al., 2016), Network in Network (Lin et al., 2013), All-CNN (Springenberg et al., 2015) and Overfeat (Sermanet et al., 2013) with PELU all had better performances than with ELU. We finally show that our PELUs in the CNNs adopt different non-linear behaviors during training, which we believe helps the CNNs learning better features.
23
+
24
+ The rest of the paper is organized as follows. We present related works in section 2 and described our proposed approach in section 3. We detail our experimentations in section 4 and discuss the results in section 5. We conclude the paper in section 6.
25
+
26
+ # 2 RELATED WORK
27
+
28
+ Our proposed PELU activation function is related to other parametric approaches in the literature. The Adaptive Piecewise Linear (APL) unit learns a weighted sum of $S$ parametrized Hinge functions (Agostinelli et al., 2014). One drawback of APL is that the number of points at which the function is non-differentiable increase linearly with $S$ . Moreover, though APL can be either a convex or non-convex function, the rightmost linear function is forced to have unit slope and zero bias. This may be an inappropriate constraint which could affect the representation ability of the CNNs.
29
+
30
+ Another activation function is Maxout, which outputs the maximum over $K$ affine functions for each input neuron (Goodfellow et al., 2013). The main drawback of Maxout is that it multiplies by $K$ the amount of weights to be learned in each layer. For instance, in the context of CNNs, we would apply a max operator over the feature maps of each $K$ convolutional layers. This could become too computationally demanding in cases where the CNNs are very deep. Unlike Maxout, our PELU adds only $2 L$ parameters, where $L$ is the number of layers.
31
+
32
+ Finally, the S-Shaped ReLU (SReLU) imitates the Webner-Fechner law and the Stevens law by learning a combination of three linear functions (Jin et al., 2015). Although this parametric function can be either convex or non-convex, SReLU has two points at which it is non-differentiable. Unlike SReLU, our PELU is fully differentiable, since our parameterization acts on both the positive and negative sides of the function. This in turn improves the back-propagation weight and bias updates.
33
+
34
+ # 3 PARAMETRIC EXPONENTIAL LINEAR UNIT (PELU)
35
+
36
+ In this section, we present our proposed PELU function and analyze it in the context of vanishing gradients. We also elaborate on the gradient descent rules for learning the parameterization.
37
+
38
+ ![](images/a14115a81da84f5d5f9b19b6de167d4ef740e2b936ac8004979f530bd3e4f0b2.jpg)
39
+ Figure 1: Effects of parameters $a , b$ and $c$ : The saturation point decreases when $a$ increases, it saturates faster when $b$ decreases, and the slope of the linear part increases when $c$ increases.
40
+
41
+ # 3.1 DEFINITION
42
+
43
+ The standard Exponential Linear Unit (ELU) is defined as identity for positive arguments and $a ( \exp ( h ) - 1 )$ for negative arguments (Clevert et al., 2015). Although the parameter $a$ can be any positive value, Clevert et al. (2015) proposed using $a = 1$ to have a fully differentiable function. For other values $a \neq 1$ , the function is non-differentiable at $h = 0$ . For this reason, we do not directly learn parameter $a$ during back-propagation. Updating $a$ with the gradient would break differentiability at $h = 0$ , which could imped back-propagation.
44
+
45
+ We start by adding two additional parameters to ELU as follows:
46
+
47
+ $$
48
+ f ( h ) = \left\{ { { c h } \atop { a ( \exp ( { \frac { h } { b } } ) - 1 ) } } \right. \mathrm { ~ i f ~ } h \geq 0 , \quad a , b , c > 0 ,
49
+ $$
50
+
51
+ for which the original ELU can be recovered when $a = b = c = 1$ . As shown in Figure 1, each parameter in (1) controls different aspects of the activation. Parameter $c$ changes the slope of the linear function in the positive quadrant (the larger $c$ , the steeper the slope), parameter $b$ affects the scale of the exponential decay (the larger $b$ , the smaller the decay), while $a$ acts on the saturation point in the negative quadrant (the larger $a$ , the lower the saturation point). We also constrain the parameters to be positive to have a monotonic function. Consequently, reducing the weight magnitude during training always lowers the neuron contribution.
52
+
53
+ Using this parameterization, the network can control its non-linear behavior throughout the course of the training phase. It may increase the slope with $c$ or the decay with $b$ to counter vanishing gradients, and push the mean activation towards zero by lowering the saturation point with $a$ for better managing bias shift. We now look into gradient descent and define update rules for each parameter, so that the network can adjust its behavior as it seems fit. However, a standard gradient update on parameters $a , b , c$ would make the function non-differentiable at $h = 0$ and impair back-propagation. Instead of relying on a projection operator to restore differentiability after each update, we constrain our parameterization by forcing $f$ to stay differentiable at $h = 0$ . We equal the derivatives on both sides of zero, and solve for $c$ :
54
+
55
+ $$
56
+ \left. \frac { \partial c h } { \partial h } \right| _ { h = 0 } = \left. \frac { \partial a ( \exp ( \frac { h } { b } ) - 1 ) } { \partial h } \right| _ { h = 0 }
57
+ $$
58
+
59
+ which gives $\begin{array} { r } { c = \frac { a } { b } } \end{array}$ as solution. Incorporating (2) gives the proposed Parametric ELU (PELU):
60
+
61
+ PELU:
62
+
63
+ $$
64
+ f ( h ) = { \left\{ \begin{array} { l l } { { \frac { a } { b } } h } & { { \mathrm { i f ~ } } h \geq 0 } \\ { a ( \exp ( { \frac { h } { b } } ) - 1 ) } & { { \mathrm { i f ~ } } h < 0 } \end{array} \right. } , \quad a , b > 0
65
+ $$
66
+
67
+ With this parameterization, in addition to changing the saturation point and exponential decay respectively, both $a$ and $b$ adjust the slope of the linear function in the positive part to ensure differentiability at $h = 0$ .
68
+
69
+ # 3.2 ANALYSIS
70
+
71
+ To understand the effect of the proposed parameterization, we now investigate the vanishing gradient for the following simple network, containing one neuron in each of its $L$ layers:
72
+
73
+ $$
74
+ x = h _ { 0 } , \qquad h _ { l } = w _ { l } h _ { l - 1 } , \qquad z _ { l } = f ( h _ { l } ) , \qquad E = \ell ( z _ { L } , y ) \qquad ( 1 \leq l \leq L )
75
+ $$
76
+
77
+ where we have omitted, without loss of generality, the biases for simplicity. In (4), $\ell$ is the loss function between the network prediction $z _ { L }$ and label $y$ , which takes value $E$ at $x$ . In this case, it can be shown using the chain rule of derivation that the derivative of $E$ with respect to any weight $k$ is:
78
+
79
+ $$
80
+ \frac { \partial E } { \partial w _ { k } } = h _ { k - 1 } f ^ { \prime } ( h _ { k } ) \left[ \prod _ { j = k + 1 } ^ { L } f ^ { \prime } ( h _ { j } ) w _ { j } \right] \frac { \partial E } { \partial z _ { L } } ,
81
+ $$
82
+
83
+ where $f ^ { \prime } ( h _ { k } )$ is a shortcut for $\frac { \partial z _ { k } } { \partial h _ { k } }$ . Vanishing gradient happens when the product term inside the bracket has a very small magnitude, which makes $\begin{array} { r } { \frac { \partial E } { \partial w _ { k } } \approx 0 } \end{array}$ . Since the updates are proportional to the gradients, the weights at lower layers converge more slowly than those at higher layers, due to the exponential decrease as $k$ gets smaller (the product has $L - k$ terms). One way the network can fight vanishing gradients is with $f ^ { \prime } ( h _ { j } ) w _ { j } \equiv f ^ { \prime } ( w _ { j } h _ { j - 1 } ) w _ { j } \geq 1$ , so that the magnitude of the product does not tend to zero. Therefore, a natural way to investigate vanishing gradient is by analyzing the interaction between weight $w$ and activation $h$ , after dropping layer index $j$ . Specifically, our goal is to find the range of values $h$ for which $f ^ { \prime } ( w h ) w \geq 1$ . This will indicate how precise the activations $h$ must be to manage vanishing gradients.
84
+
85
+ f , $\begin{array} { r } { w \geq \frac { b } { a } } \end{array}$ and engt $h < 0 ,$ , then valu $\begin{array} { r } { w ^ { * } = \exp ( 1 ) \frac { b } { a } } \end{array}$ aximizes the interval length of h for which. $f ^ { \prime } ( w h ) w \geq 1$ $l ^ { * } = a \exp ( - 1 )$
86
+
87
+ Proof. With our proposed PELU, we have:
88
+
89
+ $$
90
+ f ^ { \prime } ( w h ) w = \left\{ { \begin{array} { l l } { w { \frac { a } { b } } } & { { \mathrm { i f ~ } } h \geq 0 } \\ { w { \frac { a } { b } } \exp ( w h / b ) } & { { \mathrm { i f ~ } } h < 0 } \end{array} } , \quad a , b > 0 \right.
91
+ $$
92
+
93
+ Assuming $\begin{array} { r } { w \geq \frac { b } { a } } \end{array}$ and $h < 0$ , and using the fact that $\begin{array} { r } { w _ { b } ^ { a } \exp ( w h / b ) } \end{array}$ is monotonically increasing, the interval length $l ( w )$ of values $h$ for which $\begin{array} { r } { w { \frac { a } { b } } \exp ( w \bar { h } / b ) \geq 1 } \end{array}$ is given by the magnitude of the zero of $\begin{array} { r } { w { \frac { a } { b } } \exp ( w h / b ) - 1 } \end{array}$ . Solving the derivative equals zero for $h$ gives $\begin{array} { r } { l ( w ) = | \log ( \frac { b } { a } \frac { 1 } { w } ) | ( \frac { b } { w } ) } \end{array}$ . Using the fact that $\begin{array} { r } { w \geq \frac { b } { a } } \end{array}$ , it can be shown that $l ( w )$ is pseudo-concave, so it has a unique optimum. Maximizing $l ( w )$ with respect to $w$ is thus the solution of solving the derivative equals zero, which gives $l ^ { * } = a \exp ( - 1 )$ , at $\begin{array} { r } { w ^ { * } = \exp ( 1 ) \frac { b } { a } } \end{array}$ . □
94
+
95
+ This result shows that in the optimal scenario where $\begin{array} { r } { w = \exp ( 1 ) \frac { b } { a } } \end{array}$ , the length of negative values $h$ for which $f ^ { \prime } ( w h ) w \geq 1$ is no more than $a \exp ( - 1 )$ . Without our proposed parameterization $( a , b = 1 )$ ), dealing with vanishing gradient is mostly possible with positive arguments, which makes the negative ones (useful for bias shift) hurtful for back-propagation. With the proposed parameterization, $a$ can be adjusted to increase the length $a \exp ( - 1 )$ and allow more negative activations $h$ to counter vanishing gradients. The ratio $\textstyle { \frac { b } { a } }$ can also be modified to ensure $\begin{array} { r } { w \geq \frac { b } { a } } \end{array}$ so that $f ^ { \prime } ( w h ) w \ge 1$ for $h > 0$ . Based on this analysis, the proposed parameterization gives more flexibility to the network, and the experiments in Section 4 have shown that the networks do indeed take advantage of it.
96
+
97
+ # 3.3 OPTIMIZATION
98
+
99
+ PELU is trained simultaneously with all the network parameters during back-propagation. Using the chain rule of derivation, the derivative of objective $E$ with respect to $a$ and $b$ for one layer is:
100
+
101
+ $$
102
+ \frac { \partial E } { \partial a } = \sum _ { i } \frac { \partial E } { \partial f ( h _ { i } ) } \frac { \partial f ( h _ { i } ) } { \partial a } , \qquad \frac { \partial E } { \partial b } = \sum _ { i } \frac { \partial E } { \partial f ( h _ { i } ) } \frac { \partial f ( h _ { i } ) } { \partial b } ,
103
+ $$
104
+
105
+ where $i$ sums over all elements of the tensor on which $f$ is applied. The terms $\frac { \partial E } { \partial f ( h _ { i } ) }$ are the gradients propagated from the above layers, while $\frac { \partial f ( h ) } { \partial a }$ and $\frac { \partial f ( h ) } { \partial b }$ are the gradients of $f$ with respect to $a , b$ :
106
+
107
+ $$
108
+ \frac { \partial f ( h ) } { \partial a } = \left\{ \begin{array} { l l } { \frac { h } { b } } & { \mathrm { i f ~ } h \geq 0 } \\ { \exp ( h / b ) - 1 } & { \mathrm { i f ~ } h < 0 } \end{array} , \right. \qquad \frac { \partial f ( h ) } { \partial b } = \left\{ \begin{array} { l l } { - \frac { a h } { b ^ { 2 } } } & { \mathrm { i f ~ } h \geq 0 } \\ { - \frac { a } { b ^ { 2 } } \exp ( h / b ) } & { \mathrm { i f ~ } h < 0 } \end{array} \right. .
109
+ $$
110
+
111
+ To preserve the parameter positivity after the updates, we force them to always be greater than 0.1. The update rules are the following:
112
+
113
+ $$
114
+ \begin{array} { c c } { { \Delta a \mu \Delta a - \alpha \displaystyle \frac { \partial E } { \partial a } } } & { { \quad \quad \quad \Delta b \mu \Delta b - \alpha \displaystyle \frac { \partial E } { \partial b } } } \\ { { a \operatorname* { m a x } \{ a + \Delta a , 0 . 1 \} } } & { { \quad \quad \quad b \operatorname* { m a x } \{ b + \Delta b , 0 . 1 \} } } \end{array}
115
+ $$
116
+
117
+ Table 1: Comparing PELU, ELU and ReLU with SmallNet and ResNet110 on the CIFAR-10 and CIFAR-100 tasks. The results are test error rates (in $\%$ ) averaged over five tries.
118
+
119
+ <table><tr><td rowspan="2"></td><td colspan="2">SmallNet</td><td rowspan="2"></td><td colspan="2">ResNet110</td></tr><tr><td>CIFAR-10</td><td>CIFAR-100</td><td>CIFAR-10</td><td>CIFAR-100</td></tr><tr><td>ReLU</td><td>13.96</td><td>40.51</td><td>ReLU (He et al., 2015a)</td><td>6.42</td><td>27.23</td></tr><tr><td>ELU</td><td>14.81</td><td>39.76</td><td>ELU (Shah et al., 2016)</td><td>5.62</td><td>26.55</td></tr><tr><td>PELU</td><td>13.54</td><td>38.93</td><td>PELU (ours)</td><td>5.37</td><td>25.04</td></tr></table>
120
+
121
+ In (8), $\mu$ is the momentum and $\alpha$ is the learning rate. When specified by the training regimes, we also use a $\ell _ { 2 }$ weight decay regularization on both the weight matrices $W$ and PELU parameters. This is different than PReLU, which did not use weight decay to avoid a shape bias towards ReLU. In our case, weight decay is necessary for $a$ and $b$ , otherwise the network could circumvent it for the W s by adjusting $a$ or $b$ , a behavior that would be hurtful for training.
122
+
123
+ # 4 EXPERIMENTATIONS
124
+
125
+ In this section, we present our experiments in supervised learning on the CIFAR-10/100 and ImageNet tasks. Our goal is to show that, with the same network architecture, parameterizing ELU improves the performance. We also provide results with the ReLU activation function for reference.
126
+
127
+ # 4.1 CIFAR-10/100
128
+
129
+ As first experiment, we performed object classification on the CIFAR-10 and CIFAR-100 datasets $( 6 0 , 0 0 0 3 2 \mathrm { x } 3 2$ colored images, 10 and 100 classes respectively) (Krizhevsky et al., 2012). We trained a residual network (ResNet) with the identity function for the skip connexion and bottleneck residual mappings with shape $( \mathrm { C o n v + A C T } ) \mathrm { x } 2 + \mathrm { C o n v + B N }$ (He et al., 2015a; Shah et al., 2016). The ACT module is either PELU, ELU or $_ { \mathrm { B N + R e L U } }$ . We follow Facebook’s Torch implementation fb.resnet.torch1 for data augmentation and learning rate schedule, so that training is not biased towards PELU to the detriment of the other activations.
130
+
131
+ We also evaluated our proposed PELU on a smaller convolutional network. We refer to this network as SmallNet. It contains three convolutional layers followed by two fully connected layers. The convolutional layers were respectively composed of 32, 64 and $1 2 8 3 \mathrm { x } 3 $ filters with 1x1 stride and 1x1 zero padding, each followed by ACT, $2 \mathbf { x } 2$ max pooling with a stride of $2 \mathbf { x } 2$ and dropout with probability 0.2. The fully connected layers were defined as $2 0 4 8 5 1 2$ , followed by ACT, dropout with probability 0.5, and a final linear layer $5 1 2 1 0$ for CIFAR-10 and $5 1 2 1 0 0$ for CIFAR-100. We performed global pixel-wise mean subtraction, and used horizontal flip as data augmentation.
132
+
133
+ Table 1 presents the test error results $( \mathrm { i n } \% )$ ) of SmallNet and ResNet110 on both tasks, with ELU, ReLU and PELU. For SmallNet, PELU reduced the error of ELU from $1 4 . 8 1 \%$ to $1 3 . 5 4 \%$ on CIFAR10, and from $3 9 . 7 6 \%$ to $3 8 . 9 3 \%$ on CIFAR-100, which corresponds to a relative improvement of $8 . 5 8 \%$ and $2 . 0 9 \%$ respectively. As for ResNet110, PELU reduced the error of ELU from $5 . 6 2 \%$ to $5 . 3 7 \%$ on CIFAR-10, and from $2 6 . 5 5 \%$ to $2 5 . 0 4 \%$ on CIFAR-100, which corresponds to a relative improvement of $4 . 4 5 \%$ and $5 . 6 8 \%$ respectively. These results suggest that parameterizing the ELU activation improves its performance.
134
+
135
+ It is worth noting for ResNet110 that weight decay played an important role in obtaining these performances. Preliminary experiments conducted with a weight decay of 0.0001 showed no significant improvements of PELU over ELU. We observed larger differences between the train and test set error percentages, which indicated possible over-fitting. By increasing the weight decay to 0.001, we obtained the performance improvements shown in Table 1. Importantly, we did not have to increase the weight decay for SmallNet. The PELU, ELU and BN+ReLU SmallNets used the same decay. Although these results suggest that residual networks with PELU activations may be more prone to over-fitting, weight decay can still be used to correctly regularize the ResNets.
136
+
137
+ ![](images/341f5320b118dfaba0ce41ed9adfdf23aa059fa3da81107b317a2f04d66ac8bf.jpg)
138
+ Figure 2: TOP-1 error rate progression $( \mathrm { i n } \% )$ ) of ResNet18, NiN, Overfeat and All-CNN on ImageNet 2012 validation set. NiN and ResNet18 (top row) used training regime #1, while All-CNN and Overfeat (bottom row) used training regime $\# 2$ (see Table 2). PELU has the lowest error rates for all networks. Regime #1 shows a greater performance gap between ELU and PELU than regime #2.
139
+
140
+ # 4.2 IMAGENET
141
+
142
+ We finally tested the proposed PELU on ImageNet 2012 task (ILSVRC2012) using four different network architectures: ResNet18 (Shah et al., 2016), Network in Network (NiN) (Lin et al., 2013), All-CNN (Springenberg et al., 2015) and Overfeat (Sermanet et al., 2013). We used either PELU, ELU or BN+ReLU for the activation module. Due to NiN’s relatively complex architecture, we added BN after each max pooling layer (every three layers) for further reducing vanishing gradients. Each network was trained following Chintala’s Torch implementation imagenet-multiGPU.torch 2 with the training regimes shown in Table 2. Regime #1 starts at a higher learning rate (1e-1) than regime #2 (1e-2), and has a larger learning rate decay of 10 compared to 2 and 5.
143
+
144
+ Figure 2 presents the TOP-1 error rate $( \mathrm { i n } \ \% )$ ) of all four networks on ImageNet 2012 validation dataset. We see from these figures that PELU consistently obtained the lowest error rates for all networks. The best result was obtained with NiN. In this case, PELU improved the error rate from $4 0 . 4 0 \%$ (ELU) to $3 6 . 0 6 \%$ , which corresponds to a relative improvement of $7 . 2 9 \%$ . Importantly, NiN obtained these improvements at little computational cost. It only added 24 additional parameters, i.e. $0 . 0 0 0 3 \%$ increase in the number of parameters. This suggests that PELU acts on the network in a different manner than the weights and biases. Such a low number of parameters cannot significantly increase the expressive power of the network. We would not have seen such a large improvement by adding 24 additional weights to a convolutional layer with the ELU activation.
145
+
146
+ Table 2: ImageNet training regimes.
147
+
148
+ <table><tr><td rowspan="2"></td><td colspan="4">Regime #1 (ResNet18, NiN)</td><td colspan="5">Regime #2 (Overfeat, AlICNN)</td></tr><tr><td>1</td><td>10</td><td>20</td><td>25</td><td>1</td><td>19</td><td>30</td><td>44</td><td>53</td></tr><tr><td>Epoch Learning Rate</td><td>1e-1</td><td>1e-2</td><td>1e-3</td><td>1e-4</td><td>1e-2</td><td>5e-3</td><td>1e-3</td><td>5e-4</td><td>1e-4</td></tr><tr><td>Weight Decay</td><td>5e-4</td><td>5e-4</td><td>0</td><td>0</td><td>5e-4</td><td>5e-4</td><td>0</td><td>0</td><td>0</td></tr></table>
149
+
150
+ Table 3: Effect of parameter configuration using ResNets on CIFAR-10 and CIFAR-100 datasets. These results show that parameter type $( a , \textstyle { \frac { 1 } { b } } )$ achieves the lowest error rate (in $\%$ ) in general.
151
+
152
+ <table><tr><td colspan="3">CIFAR-10</td></tr><tr><td rowspan="2">Depth</td><td colspan="2">Parameter Type</td></tr><tr><td>(a,b) (a,) (,6)</td><td>()</td></tr><tr><td>20</td><td>7.71 7.47</td><td>7.64 7.61</td></tr><tr><td>32</td><td>6.71 6.41</td><td>6.69 6.53</td></tr><tr><td>44</td><td>6.52 5.92</td><td>6.51 6.19</td></tr><tr><td>56</td><td>6.28 5.65</td><td>6.30 5.75</td></tr><tr><td>110</td><td>6.22 5.37</td><td>6.09 5.42</td></tr></table>
153
+
154
+ <table><tr><td colspan="3">CIFAR-100</td></tr><tr><td rowspan="2">Depth</td><td colspan="3">Parameter Type</td></tr><tr><td>(a,b) (a,)</td><td>(1,6) ()</td></tr><tr><td>20</td><td>30.17</td><td>30.16 30.26</td><td>30.55</td></tr><tr><td>32</td><td>28.47</td><td>28.01 28.23</td><td>28.56</td></tr><tr><td>44</td><td>27.70</td><td>27.18 27.24</td><td>27.63</td></tr><tr><td>56</td><td>26.89</td><td>26.33 26.72</td><td>26.40</td></tr><tr><td>110</td><td>25.69</td><td>25.04 25.59</td><td>25.17</td></tr></table>
155
+
156
+ We see from the curves in Figure 2 that the training regime has an interesting effect on the convergence of the networks. The performance of PELU is closer to the performance of ELU for regime #2, while it is significantly better than ELU for regime #2. Although we do not have a clear explanation to why this is the case, we believe that the small initial learning rate of regime #2 affects PELU optimization due to smaller gradient steps. We also see that the error rates of All-CNN and Overfeat with PELU increase by a small amount starting at epoch 44. Since ELU and ReLU do not have this error rate increase, this shows possible over-fitting for PELU. For regime #2, the error rates decrease more steadily and monotonically. Although performing more experiments would improve our understanding, these results suggest that PELU could and should be trained with larger learning rates and decays for obtaining better performance improvements.
157
+
158
+ # 5 DISCUSSION
159
+
160
+ In this section, we elaborate on other parameter configurations and perform a visual evaluation of the parameter progression throughout the training phase.
161
+
162
+ # 5.1 PARAMETER CONFIGURATION
163
+
164
+ The proposed PELU activation function (3) has two parameters $a$ and $b$ , where $a$ is used with a multiplication and $b$ with a division. A priori, any of the four configurations $( a , b ) , ( a , \textstyle { \frac { 1 } { b } } ) , ( \textstyle { \frac { 1 } { a } } , b )$ or $\textstyle { \left( { \frac { 1 } { a } } , { \frac { 1 } { b } } \right) }$ could be used as parameterization. In this section, we show experimentally that PELU with the proposed $( a , \textstyle { \frac { 1 } { b } } )$ configuration is the preferred choice, as it achieves the best overall results.
165
+
166
+ For evaluating the effect of parameter configuration, we trained several CNNs on the CIFAR-10 and CIFAR-100 datasets (Krizhevsky et al., 2012). We used ResNets with a depth varying from 20, 32, 44, 56 to 110. The ResNets had the identity function for the skip connexion and two different residual mappings (He et al., 2015a; Shah et al., 2016). We used a basic block $\mathrm { C o n v + P E L U + C o n v + B N }$ block for depth 20, 32 and 44, and bottleneck block $\mathrm { ( C o n v + P E L U ) } \mathrm { x } 2 + \mathrm { C o n v + B N }$ for depth 56 and 110. We report the averaged error rate achieved over five tries.
167
+
168
+ First, we can see from the results presented in Figure 3 that the error rate reduces as the network gets deeper. This is in conformity with our intuition that deeper networks have more representative capability. Also, we can see that the proposed configuration $( a , \textstyle { \frac { 1 } { b } } )$ obtained the best performance overall. Configuration $( a , \textstyle { \frac { 1 } { b } } )$ obtained $5 . 3 7 \%$ error rate on CIFAR-10 and $2 5 . 0 4 \%$ error rate on CIFAR-100. We believe this improvement is due to weight decay. When using configuration $( a , \textstyle { \frac { 1 } { b } } )$ along with weight decay, pushing parameters $a$ and $b$ towards zero encourages PELU to be similar to ReLU. In this case, the CNN is less penalized for using ReLU and more penalized for using other parametric forms. This may help the CNN to use as much PELUs that look like ReLUs as it needs without incurring a large penalty. The experiments in section 5.2 partly supports our claim. Although the performance improvement of $( a , \textstyle { \frac { 1 } { b } } )$ is relatively small in comparison to the other three configurations, configuration $( a , \textstyle { \frac { 1 } { b } } )$ should be preferred for subsequent experiments.
169
+
170
+ ![](images/76b5821bc57ffe045d22b800f5d58e395a3da157cdd7f77b58096bb6922f6044.jpg)
171
+ Figure 3: PELU parameter progression at layers 2, 7, 10 and 14 of $\mathrm { v g g }$ trained on CIFAR-10. Interestingly, the network adopted different non-linear behaviors throughout the training phase.
172
+
173
+ # 5.2 PARAMETER PROGRESSION
174
+
175
+ We perform a visual evaluation of the non-linear behaviors adopted by a $\mathrm { v g g }$ network during training (Simonyan & Zisserman, 2014). To this effect, we trained a $\mathrm { v g g }$ network with PELU activations on the CIFAR-10 dataset. We performed global pixel-wise mean subtraction, and used horizontal flip as data augmentation. The trained network obtained $6 . 9 5 \%$ and $2 9 . 2 9 \%$ error rate on CIFAR-10 and CIFAR-100 respectively.
176
+
177
+ Figure 3 shows the progression of the slope $\textstyle { \left( { \frac { a } { b } } \right) }$ and the negative of the saturation point (parameter $a$ ) for PELU at layers 2, 7, 10 and 14. We can see different behaviors. In layer 2, the slope quickly increases to a large value (around 6) and slowly decreases to its convergence value. We observe a similar behavior for layer 7, except that the slope increases at a later iteration. Layer 2 increases at about iteration 650 while layer 7 at about iteration 1300. Moreover, in contrast to layer 2 and 7, the slope in layer 10 increases to a smaller value (around 2) and does not decrease after reaching it. Layer 14 also displays a similar behavior, but reaches a much higher value (around 15). We believe that adopting these behaviors helps early during training to disentangle redundant neurons. Since peak activations scatter the inputs more than flat ones, spreading neurons at the lower layers may allow the network to unclutter neurons activating similarly. This may help the higher layers to more easily find relevant features in the data.
178
+
179
+ The saturation point in layer 2, 7 and 10 converges in the same way to a value near zero, while in layer 14 it reaches a value near -2. This is an interesting behavior as using a negative saturation reduces bias shift. In another experiment with $\mathrm { V g g }$ , we tried adding BN at different locations in the network. We saw similar convergence behaviors for the saturation point. It seems that, it this specific case, the network could counter bias shift with only the last layer, and favored sparse activations in the other layers. These results suggest that the network takes advantage of the parameterization by using different non-linear behaviors at different layers.
180
+
181
+ # 6 CONCLUSION
182
+
183
+ The activation function is a key element in Convolutional Neural Networks (CNNs). In this paper, we proposed learning a parameterization of the Exponential Linear Unit (ELU) function. Our analysis of our proposed Parametric ELU (PELU) suggests that CNNs with PELU may have more control over bias shift and vanishing gradients. We performed several supervised learning experiments and showed that networks trained with PELU consistently improved their performance over ELU. Our results suggest that the CNNs take advantage of the added flexibility provided by learning the proper activation shape. As training progresses, we have observed that the CNNs change the parametric form of their PELU both across the layers and across the epochs. In terms of possible implications of our results, parameterizing other activation functions could be worth investigating. Functions like Softplus, Sigmoid or Tanh may prove to be successful in some cases with proper parameterizations. Other interesting avenues for future work include applying PELU to other network architectures, such as recurrent neural networks, and to other tasks, such as object detection
184
+
185
+ # ACKNOWLEDGEMENTS
186
+
187
+ We thankfully acknowledge the support of NVIDIA Corporation for providing the Tesla K80 and K20 GPUs for our experiments.
188
+
189
+ # REFERENCES
190
+
191
+ Forest Agostinelli, Matthew Hoffman, Peter Sadowski, and Pierre Baldi. Learning activation functions to improve deep neural networks. arXiv preprint arXiv:1412.6830, 2014.
192
+ Djork-Arne Clevert, Thomas Unterthiner, and Sepp Hochreiter. Fast and accurate deep network learning by ´ exponential linear units (elus). arXiv preprint arXiv:1511.07289, 2015.
193
+ Ian Goodfellow, David Warde-Farley, Mehdi Mirza, Aaron Courville, and Yoshua Bengio. Maxout networks. In ICML, pp. 1319–1327, 2013.
194
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. arXiv preprint arXiv:1512.03385, 2015a.
195
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Delving deep into rectifiers: Surpassing human-level performance on imagenet classification. In ICCV, pp. 1026–1034, 2015b.
196
+ Jan Hosang, Rodrigo Benenson, Piotr Dollar, and Bernt Schiele. What makes for effective detection proposals? ´ PAMI, 38(4):814–830, 2016.
197
+ Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. In ICML, pp. 448–456, 2015.
198
+ Max Jaderberg, Karen Simonyan, Andrew Zisserman, et al. Spatial transformer networks. In NIPS, pp. 2017–2025, 2015.
199
+ Xiaojie Jin, Chunyan Xu, Jiashi Feng, Yunchao Wei, Junjun Xiong, and Shuicheng Yan. Deep learning with s-shaped rectified linear activation units. arXiv preprint arXiv:1512.07030, 2015.
200
+ Alex Krizhevsky, Ilya Sutskever, and Geoffrey Hinton. Imagenet classification with deep convolutional neural networks. In NIPS, pp. 1097–1105, 2012.
201
+ Yann LeCun, Yoshua Bengio, and Geoffrey Hinton. Deep learning. Nature, 521(7553):436–444, 2015.
202
+ Min Lin, Qiang Chen, and Shuicheng Yan. Network in network. arXiv preprint arXiv:1312.4400, 2013.
203
+ Andrew L Maas, Awni Y Hannun, and Andrew Y Ng. Rectifier nonlinearities improve neural network acoustic models. In ICML Workshop on Deep Learning for Audio, Speech and Language Processing. Citeseer, 2013.
204
+ Vinod Nair and Geoffrey Hinton. Rectified linear units improve restricted boltzmann machines. In ICML, pp. 807–814, 2010.
205
+ Shaoqing Ren, Kaiming He, Ross Girshick, and Jian Sun. Faster r-cnn: Towards real-time object detection with region proposal networks. In NIPS, pp. 91–99, 2015.
206
+ Pierre Sermanet, David Eigen, Xiang Zhang, Michael Mathieu, Rob Fergus, and Yann LeCun. Overfeat: Inte- ¨ grated recognition, localization and detection using convolutional networks. arXiv preprint arXiv:1312.6229, 2013.
207
+ Anish Shah, Eashan Kadam, Hena Shah, and Sameer Shinde. Deep residual networks with exponential linear unit. arXiv preprint arXiv:1604.04112, 2016.
208
+ Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. arXiv preprint arXiv:1409.1556, 2014.
209
+ J Springenberg, Alexey Dosovitskiy, Thomas Brox, and M Riedmiller. Striving for simplicity: The all convolutional net. In ICLR (workshop track), 2015.
210
+ Oriol Vinyals, Alexander Toshev, Samy Bengio, and Dumitru Erhan. Show and tell: A neural image caption generator. In CVPR, pp. 3156–3164, 2015.
md/train/BkeqO7x0-/BkeqO7x0-.md ADDED
@@ -0,0 +1,475 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # UNSUPERVISED CIPHER CRACKING USING DISCRETE GANS
2
+
3
+ Aidan N. Gomez 1,2 aidan@cs.toronto.edu
4
+
5
+ Sicong Huang 1,2 huang@cs.toronto.edu
6
+
7
+ Ivan Zhang 2 ivan@ivanzhang.ca
8
+
9
+ Bryan M. Li 1,2 bryan@bryanli.io
10
+
11
+ Muhammad Osama 1,2 muhammad.osama@mcode.ca
12
+
13
+ Łukasz Kaiser 3 lukaszkaiser@google.com
14
+
15
+ 1 Department of Computer Science, University of Toronto
16
+ 2 FOR.ai
17
+ 3 Google Brain
18
+
19
+ # ABSTRACT
20
+
21
+ This work details CipherGAN, an architecture inspired by CycleGAN used for inferring the underlying cipher mapping given banks of unpaired ciphertext and plaintext. We demonstrate that CipherGAN is capable of cracking language data enciphered using shift and Vigenere ciphers to a high degree of fidelity and for \` vocabularies much larger than previously achieved. We present how CycleGAN can be made compatible with discrete data and train in a stable way. We then prove that the technique used in CipherGAN avoids the common problem of uninformative discrimination associated with GANs applied to discrete data.
22
+
23
+ # 1 INTRODUCTION
24
+
25
+ Humans have been encoding messages for secrecy since before the ancient Greeks, and for the same amount of time, have been fascinated with trying to crack these codes using brute-force, frequency analysis, crib-dragging and even espionage. Simple ciphers have, in the past century, been rendered irrelevant in favor of the more secure encryption schemes enabled by modern computational resources. However, the question of cipher-cracking remains an interesting problem since it requires an intimate understanding of the structure in a language. Nearly all automated cipher cracking techniques have had to rely on a human-in-the-loop; grounding the automated techniques in a human’s preexisting knowledge of language to clean up the errors made by simple algorithms such as frequency analysis. Across a number of domains, the use of hand-crafted features has often been replaced by automatic feature extraction directly from data using end-to-end learning frameworks (Goodfellow et al., 2016). The question to be addressed is as follows:
26
+
27
+ Can a neural network be trained to deduce withheld ciphers from unaligned text, without the supplementation of preexisting human knowledge?
28
+
29
+ The implications for such a general framework would be far-reaching in the field of unsupervised translation, where each language can be treated as an enciphering of the other. The decoding of the Copiale cipher (Knight et al., 2011) stands as an excellent example of the potential for machine learning techniques to decode enciphered texts by treating the problem as language translation. The CycleGAN (Zhu et al., 2017) architecture is extremely general and we demonstrate our adaptation, CipherGAN, is capable of cracking ciphers to an extremely high degree of accuracy. CipherGAN requires little or no modification to be applied to plaintext and ciphertext banks generated by the user’s cipher of choice.
30
+
31
+ In addition to presenting a GAN that can crack ciphers, we contribute the following techniques:
32
+
33
+ • We show how to stabilize CycleGAN training: our CipherGAN achieves good performance in all training runs, compared to approximately $50 \%$ of runs for the original CycleGAN.
34
+ We provide a theoretical description and analysis of the uninformative discrimination problem that impacts GANs applied to discrete data.
35
+ • We introduce a solution to the above problem by operating in the embedding space and show that it works in practice.
36
+
37
+ # 1.1 SHIFT AND VIGENERE \` CIPHERS
38
+
39
+ The shift and Vigenere ciphers are well known historical substitution ciphers. The earliest known \` record of a substitution cipher is believed to have dated back to 58 BCE, when Julius Caesar replaced each letter in a message with the letter that was three places further down the alphabet (Singh, 2000).
40
+
41
+ ![](images/460d7b3f9d39c9ab0d81dac7303d48440815027d54ce29a9743c7db1f3544a48.jpg)
42
+ Figure 1: An example of a right-shift-3 cipher.
43
+
44
+ Using Figure 1, the message “attackatdawn” can be encrypted to “DWWDFNDWGDZQ”. This message can be easily deciphered by the intended recipient (who is aware of the particular shift number used) but looks meaningless to a third party. The shift cipher ensured secure communication between sender and receiver for centuries, until the ninth century polymath Al-Kindi introduced the concept of frequency analysis (Singh, 2000). He suggested that it would be possible to crack a cipher simply by analyzing the individual characters’ frequencies. For instance, in English the most frequently occurring letters are $\cdot _ { e } ,$ $( 1 2 . 7 \% )$ , $\cdot _ { t } ,$ $( 9 . 1 \% )$ and $\cdot _ { a } ,$ $( 8 . 2 \% )$ ; whereas $\mathbf { \dot { q } }$ , $\cdot _ { x } ,$ and $\cdot _ { z } ,$ each have frequency of less than $1 \%$ . Moreover, the code-breaker can also focus on bigrams of repeated letters; ‘ss’, ‘ee’, and ‘oo’ are the most common in English. This structure in language provides an exploit of efficiency to the code-breaker.
45
+
46
+ Polyalphabetic substitution ciphers, including the Vigenere cipher, were introduced to inhibit the \` use of n-gram frequency analysis in determining the cipher mapping. Instead, the encrypter further scrambles the message by using a separate shift cipher for each element of a key that is tiled to match the length of the plaintext. Increasing the key length greatly increases the number of possible combinations and thus prevents against basic frequency analysis. In the mid nineteenth century, Charles Babbage recognized that the length of the used key could be determined by counting the repetitions and spacing of sequences of letters in the cipher (Singh, 2000). Using the determined length, we can then apply frequency analysis on the index of the cipher base. This method makes it possible to break the Vigenere cipher, but is very time consuming and requires strong knowledge of \` the language itself.
47
+
48
+ There is a rich literature of automated shift-cipher cracking techniques (Ramesh et al., 1993; Forsyth & Safavi-Naini, 1993; Hasinoff, 2003; Knight et al., 2006; Verma et al., 2007; Raju et al., 2010; Knight et al., 2011) many of which achieve excellent results which is what one would expect from hand-crafted algorithms targeting specific ciphers and vocabularies. Work on automated cracking of polyalphabetic ciphers (Carroll & Martin, 1986; Toemeh & Arumugam, 2008; Omran et al., 2011) has seen similar success on small vocabularies. It is a difficult matter to compare the results of previous work with our own as their focus ranges from inferring cipher keys (Carroll & Martin, 1986; Ramesh et al., 1993; Omran et al., 2011), to inferring the mappings given limited quantities of ciphertext (determining unicity distance) (Carroll & Martin, 1986; Ramesh et al., 1993; Hasinoff, 2003; Verma et al., 2007), to analyzing the unicity distance required to solve small percentages of the cipher mappings (i.e. $20 \%$ in Carroll & Martin (1986)).
49
+
50
+ In comparison to these past works, we afford ourselves the advantage of an unconstrained corpus of ciphertext, however, we prescribe ourselves the following constraints: our model is not provided any prior knowledge of vocabulary element frequencies; and, no information about the cipher key is provided. Another complexity our work must overcome is our significantly larger vocabulary sizes; all previous work has addressed vocabularies of approximately 26 characters, while our model is capable of solving word-level ciphers with over 200 distinct vocabulary elements. As such, our methodology is notably ‘hands-off’ in comparison to previous work and can be easily applied to different forms of cipher, different underlying data and unsupervised text alignment tasks.
51
+
52
+ # 1.2 GANS AND WASSERSTEIN GANS
53
+
54
+ Generative Adversarial Networks (GANs) are a class of neural network architectures introduced by Goodfellow et al. (2014) as an alternative to optimizing likelihood under a true data distribution. Instead, GANs balance the optimization of a generator network which attempts to produce convincing samples from the data distribution, and a discriminator which is trained to distinguish between samples from the true data distribution and the generator’s synthetic samples. GANs have been shown to produce compelling results in the domain of image generation, but comparatively weak performance in domains using discrete data (discussed in Section 2).
55
+
56
+ The original GAN discriminator objective as introduced in Goodfellow et al. (2014) is:
57
+
58
+ $$
59
+ D ^ { * } = \arg \operatorname* { m a x } _ { D } \mathbb { E } _ { x \sim \mathcal { X } } [ \log D ( x ) ] - \mathbb { E } _ { z \sim \mathcal { Z } } [ \log ( 1 - D ( F ( z ) ) ) ]
60
+ $$
61
+
62
+ Where $F$ is the generator network and $D$ is the discriminator network. This loss is vulnerable to the problem of ‘mode collapse’ where the generative distribution collapses to produce a generating distribution with low diversity. In order to more broadly distribute the mass, the Wasserstein GAN (WGAN) objective (Arjovsky et al., 2017) considers the set of K-Lipschitz discriminator functions $D : X \mathbb { R }$ and minimizes the earth movers (1st Wasserstein) distance. The Lipschitz condition is enforced by clipping discriminators weights to fall within a predefined range.
63
+
64
+ $$
65
+ D ^ { * } = \arg \operatorname* { m a x } _ { \| D \| _ { L } \leq K } \mathbb { E } _ { x \sim \mathcal { X } } [ D ( x ) ] - \mathbb { E } _ { z \sim \mathcal { Z } } [ D ( F ( z ) ) ]
66
+ $$
67
+
68
+ An improved WGAN objective, introduced by Gulrajani et al. (2017), enforced the Lipschitz condition using a Jacobian regularization term instead of the originally proposed weight-clipping solution. This resulted in more stable training, avoiding capacity under-use and exploding gradients, and improved network performance over weight-clipping.
69
+
70
+ $$
71
+ \begin{array} { r l } & { D ^ { * } = \arg \underset { D } { \operatorname* { m a x } } \mathbb { E } _ { x \sim \mathcal { X } } [ D ( x ) ] - \mathbb { E } _ { z \sim \mathcal { Z } } [ D ( F ( z ) ) ] + } \\ & { \qquad \quad \alpha \cdot \mathbb { E } _ { \hat { x } \sim \hat { \mathcal { X } } } [ ( \| \nabla _ { \hat { x } } D ( \hat { x } ) \| _ { 2 } - 1 ) ^ { 2 } ] } \end{array}
72
+ $$
73
+
74
+ Here $\hat { \mathcal X }$ are samples taken along a line between the true data distribution $\mathcal { X }$ and the generator’s data distribution $\mathcal { X } _ { g } \overset { \cdot } { = } \{ F ( z ) | z \sim \bar { \mathcal { Z } } \}$ .
75
+
76
+ # 1.3 CYCLEGAN
77
+
78
+ CycleGAN (Zhu et al., 2017) is a generative adversarial network designed to learn a mapping between two data distributions without supervision. Three separate works (Zhu et al., 2017; Yi et al., 2017; Liu et al., 2017) share many of the core features we describe below, however, for simplicity we will refer to CycleGAN as the basis for our work as it is the most similar to our model. It acts on distributions $\mathcal { X }$ and $\mathcal { V }$ by using two mapping generators: $F : \mathcal { X } \mathcal { Y }$ and $G : \mathcal { V } \to \mathcal { X }$ ; and two discriminators: $D _ { \mathcal { X } } : \mathcal { X } [ 0 , 1 ]$ and $D y : \bar { \mathcal { Y } } \stackrel { \textstyle - } { \to } \bar { [ 0 , 1 ] }$ .
79
+
80
+ CycleGAN optimizes the standard GAN loss ${ \mathcal { L } } _ { \mathrm { G A N } }$ :
81
+
82
+ $$
83
+ { \mathcal { L } } _ { \mathrm { G A N } } ( F , D _ { \mathcal { V } } , \chi , \mathcal { V } ) = \mathbb { E } _ { y \sim \mathcal { V } } [ \log D _ { \mathcal { V } } ( y ) ] + \mathbb { E } _ { x \sim \chi } [ \log ( 1 - D _ { \mathcal { V } } ( F ( x ) ) ) ]
84
+ $$
85
+
86
+ While also considering a reconstruction loss, or ‘cycle’ loss $\mathcal { L } _ { \mathrm { c y c } }$ :
87
+
88
+ $$
89
+ \begin{array} { r } { \mathcal { L } _ { \mathrm { c y c } } ( F , G , \mathcal { X } , \mathcal { Y } ) = \mathbb { E } _ { x \sim \mathcal { X } } [ \| G ( F ( x ) ) - x \| _ { 1 } ] + \mathbb { E } _ { y \sim \mathcal { Y } } [ \| F ( G ( y ) ) - y \| _ { 1 } ] } \end{array}
90
+ $$
91
+
92
+ Taken together the losses are balanced using a hyperparameter $\lambda$ :
93
+
94
+ $$
95
+ \begin{array} { r } { \mathcal { L } ( F , G , D _ { \mathcal { X } } , D _ { \mathcal { Y } } , \mathcal { X } , \mathcal { Y } ) = \mathcal { L } _ { \mathrm { G A N } } ( F , D _ { \mathcal { Y } } , \mathcal { X } , \mathcal { Y } ) + \mathcal { L } _ { \mathrm { G A N } } ( G , D _ { \mathcal { X } } , \mathcal { Y } , \mathcal { X } ) + \lambda \cdot \mathcal { L } _ { \mathrm { c y c } } ( F , G , \mathcal { X } , \mathcal { Y } ) } \end{array}
96
+ $$
97
+
98
+ ![](images/812aeb636c0618e5ae1a7118c5a53c0189743ca4f6c24f4f68b67e47a40cac93.jpg)
99
+ Figure 2: Discriminators trained on the toy example of recognizing the bottom-right corner of a simplex as true data. From left to right the discriminators were regularized using: nothing; WGAN Jacobian norm regularization; and, the relaxed sampling technique.
100
+
101
+ This leads to the training objectives:
102
+
103
+ $$
104
+ \begin{array} { r l } & { F ^ { * } = \arg \underset { F } { \operatorname* { m i n } } \mathcal { L } _ { \mathrm { c y c } } ( F , G , \mathcal { X } , \mathcal { Y } ) + \mathcal { L } _ { \mathrm { G A N } } ( F , D _ { \mathcal { Y } } , \mathcal { X } , \mathcal { Y } ) } \\ & { G ^ { * } = \arg \underset { G } { \operatorname* { m i n } } \mathcal { L } _ { \mathrm { c y c } } ( F , G , \mathcal { X } , \mathcal { Y } ) + \mathcal { L } _ { \mathrm { G A N } } ( G , D _ { \mathcal { X } } , \mathcal { Y } , \mathcal { X } ) } \\ & { D _ { \mathcal { X } } ^ { * } = \arg \underset { D _ { \mathcal { X } } } { \operatorname* { m a x } } \mathcal { L } _ { \mathrm { G A N } } ( G , D _ { \mathcal { X } } , \mathcal { Y } , \mathcal { X } ) } \\ & { D _ { \mathcal { Y } } ^ { * } = \arg \underset { D _ { \mathcal { Y } } } { \operatorname* { m a x } } \mathcal { L } _ { \mathrm { G A N } } ( F , D _ { \mathcal { Y } } , \mathcal { X } , \mathcal { Y } ) } \end{array}
105
+ $$
106
+
107
+ CycleGAN uses $\mathcal { L } _ { \mathrm { c y c } }$ to avoid mode collapse by preserving reconstruction of mapping inputs from outputs. It has demonstrated excellent results in unpaired image translation between two visually similar categories. Our architecture is the first example of this unsupervised learning framework being successfully applied to discrete data such as language.
108
+
109
+ # 2 DISCRETE GANS
110
+
111
+ Applying GANs to discrete data generation is still an open research problem that has seen great interest and development. The primary difficulty with training discrete data generators in a GAN setting is the lack of a gradient through a discrete node in the computation graph. The alternatives to producing discrete outputs - for instance, generators producing a categorical distribution over discrete elements - are prone to uninformative discrimination (described below), in that, the discriminator may use an optimal discrimination criterion that is unrelated to the correctness of the re-discretized generated data. In our example of a continuous distribution over discrete elements, the produced samples all lie within the standard simplex $\Delta ^ { k }$ with dimension $k$ equal to the number of elements in the distribution. In this case, samples from the true data distribution always lie on a vertex $\mathbf { v } _ { i }$ of the simplex, while any sub-optimal generator will produce samples within the simplex’s interior ${ \Delta ^ { k } \backslash \{ \bf { v } _ { 1 } , . . . , \bf { v } _ { k } \} }$ . In this example, a discriminator which performs uninformative discrimination might evaluate a sample’s membership in the vertices of the simplex as an optimal discrimination criterion, which is entirely uninformative of the correctness of re-discretized samples from the generator.
112
+
113
+ A number of solutions to training generators with discrete outputs have been proposed: SeqGAN (Yu et al., 2017) uses the REINFORCE gradient estimate to train the generator; Boundary-seeking GANs (Hjelm et al., 2017) and maximum-likelihood augmented GANs (Che et al., 2017) proposed a gradient approximation with low bias and variance that resembles the REINFORCE (Williams, 1992) estimator. Gumbel-softmax GANs (Kusner & Hernandez-Lobato, 2016) replace discrete variables in ´ the simplex with continuous relaxations called Concrete (Maddison et al., 2016) or Gumbel-softmax (Jang et al., 2016) variables; WGANs (Arjovsky et al., 2017) were suggested as a remedy to the uninformative discrimination problem by ensuring that the discriminator’s rate of change with respect to its input is bound by some constant.
114
+
115
+ Our work utilizes both the Wasserstein GAN (Gulrajani et al., 2017; Arjovsky et al., 2017) and relaxation of discrete random variables (such as Concrete/Gumbel-softmax). It has been noted multiple times in implementations of CycleGAN as well as in the original paper itself that the architecture was sensitive to initialization and requires repeat attempts in order to converge to a satisfactory mapping (Bansal & Rathore, 2017; Sari, 2017). Our architecture suffered the same instability before the WGAN Jacobian norm regularization term was added to the discriminator’s loss. In addition, we found that having the discriminator operate over embedding space instead of directly over softmax vectors produced by our generator has improved performance.
116
+
117
+ Our hypothesis, which is justified by Proposition 1 below, is that the embedding vectors may act as continuous relaxations of discrete random variables as small, noisy updates are applied throughout training; Proposition 1 asserts that by replacing discrete random variables with continuous ones, our discriminator is prevented from arbitrarily approximating a Dirac delta distribution. Figure 2 shows simple discriminators trained on the toy task of identify a single vertex of a simplex as true data; it is clear that a lack of regularization leads to the discriminator collapsing to the vertex of the simplex, leaving approximately zero gradient everywhere; while the Jacobian regularization of Wasserstein GANs leads to the space covered by lines leading from the true data vertex to the generated data having a lower rate of change (note that the gradient is still close to zero in the remaining area of the simplex); and finally, replacing the discrete random variables of the true data with continuous samples about the vertex results in a much more gradual transition, which is desirable since it provides a stronger gradient signal from which to learn.
118
+
119
+ Unique to CycleGAN is the auxiliary cycle loss described in Section 1.3. The effect of this additional objective is the generated samples regularly being forced away from the discriminator’s minimum in favor of a mapping that better-satisfies reconstruction. For instance, it may be the case that the discriminator favors a particular cipher mapping that is not bijective; in this case, the model will receive a strong signal from the cycle loss away from the discriminator’s minimum. In these cases where the model moves against the gradient it receives from the discriminator it may be the case that this region has near zero curvature (as is visually discernible from Figure 2); this is because the WGAN curvature regularization (see Equation 3) has not been applied in this region.
120
+
121
+ ‘Curvature’ here refers to the curvature of the discriminator’s output with respect to its input; this curvature determines the strength of the training signal received by the generator. Low curvature means little information for the generator to improve itself with. This motivates the benefits of having strong curvature globally, as opposed to linearly between the generators samples and the true data. Kodali et al. (2017) proposes regularizing in all directions about the generated samples, which would likely remedy the vanishing gradient in our case as well; for our experiments, the relaxed sampling technique proved effective. It should also be noted that Luc et al. (2016) propose something similar to relaxed sampling whereby they replace the ground-truth discrete tokens with a distribution over the vocabulary that distributes some of the mass across the remaining incorrect tokens.
122
+
123
+ Let us now introduce the definitions needed for the formal presentation of Proposition 1.
124
+
125
+ # Definitions.
126
+
127
+ • (Continuous relaxation of a discrete set). A continuous relaxation of a discrete set $\mathcal { X }$ is a proper, path-connected metric space $\overline { { \mathcal { X } } }$ satisfying $\chi _ { \mathrm { ~ C ~ } } \overline { { \mathcal { X } } }$ .
128
+ • (Rediscretization function). A rediscretization function is an injective function $R : \overline { { \mathcal { X } } } \to \mathcal { X }$ from a continuous relaxation $\overline { { \mathcal { X } } }$ of discrete space $\mathcal { X }$ satisfying $\forall x \in \mathcal { X } , \exists \epsilon > 0$ s.t. $R \equiv$ $x$ on $B _ { \epsilon } [ x ]$ . Note that $R$ defines an equivalence relation in $\overline { { \mathcal { X } } }$ .
129
+ • (Uninformative Discrimination). A discriminator $D _ { \mathcal { X } }$ is said to perform uninformative discrimination under rediscretization function $R$ if: $\exists x \in { \mathcal { X } } , { \bar { x } } \in { \overline { { \mathcal { X } } } }$ s.t. $R ( \bar { x } ) = x$ ) $\wedge$ $( D _ { \mathcal { X } } ( x ) \not \approx D _ { \mathcal { X } } ( \bar { x } ) )$ .
130
+ • (Continuous relaxation of a function). A continuous relaxation of a function over discrete sets $F : \mathcal { X } \mathcal { V }$ is another function $\overline { { F } } : \overline { { \mathcal { X } } } \overline { { \mathcal { Y } } }$ (where $\overline { { \mathcal { X } } } , \overline { { \mathcal { V } } }$ are continuous relaxations of $x , y )$ such that $\overline { F }$ is continuous and ${ \overline { { F } } } ( x ) = F ( x ) , \forall x \in { \mathcal { X } }$ .
131
+
132
+ The following proposition (proved in the Appendix) forms the theoretical basis of the technique.
133
+
134
+ Proposition 1 (Reliable Fooling Via Relaxation).
135
+
136
+ Given:
137
+
138
+ • discrete spaces $\mathcal { X } , \mathcal { y }$ and continuous relaxations $\overline { { \mathcal { X } } } , \overline { { \mathcal { V } } }$ • generators $F : \overline { { \mathcal { X } } } \overline { { \mathcal { V } } } , G : \overline { { \mathcal { V } } } \overline { { \mathcal { X } } }$ bijections satisfying $F = G ^ { - 1 }$ • discrete discriminators $D _ { \mathcal { X } } , D _ { \mathcal { Y } }$ both optimal for fixed $F , G$ • rediscretization functions $R _ { \mathcal { X } } , R _ { \mathcal { Y } }$
139
+
140
+ Suppose: $F$ is approximately volume preserving in a small region about each $x \in \mathcal { X }$ . Consequently the same is true for $G$ about each $y \in \mathcal { V }$ .
141
+
142
+ If: during training, we replace discrete random variables from $\mathcal { X }$ which lie in the continuous metric space $\overline { { \mathcal { X } } }$ with samples from regions about them.
143
+
144
+ Then: the optimal relaxed discriminators $D _ { \overline { { \mathcal { X } } } }$ and $D _ { \overline { { { y } } } }$ have a non-empty region about each $x \in \mathcal { X }$ and $y \in \mathcal { V }$ where they are expected to assign values close to $D _ { \mathcal { X } } ( x )$ and $D _ { \mathcal { Y } } ( y )$ .
145
+
146
+ Figure 3 compares a model trained with embedding vectors versus one with only the softmax outputs. It becomes clear on a harder task, such as Vigenere, that the embeddings vastly outperforms \` softmax in terms of speed of convergence and final accuracy; however we found that the simpler task of a shift cipher showed little difference between embeddings and softmax, suggesting an increase in task complexity increases the benefits provided by the stronger gradient signal of embeddings.
147
+
148
+ # 3 METHOD
149
+
150
+ # 3.1 CIPHERGAN
151
+
152
+ GANs applied to text data have yet to produce truly convincing results (Kawthekar et al.). Previous attempts at discrete sequence generation with GANs have generally utilized a generator outputting a probability distribution over the token space (Gulrajani et al., 2017; Yu et al., 2017; Hjelm et al., 2017). This leads to the discriminator receiving a sequence of discrete random variables from the data distribution, and a sequence of continuous random variables from the generator distribution; making the task of discrimination trivial and uninformative of the underlying data distribution. In order to avoid such a scenario, we perform all discrimination within the embedding space by allowing the generator’s output distribution to define a convex combination of corresponding embeddings. This leads to the following losses:
153
+
154
+ $$
155
+ \begin{array} { r l } & { \mathcal { L } _ { \mathrm { G A N } } ( F , D _ { \mathcal { V } } , \boldsymbol { \chi } , \mathcal { V } ) = \mathbb { E } _ { \boldsymbol { y } \sim \mathcal { V } } [ \log D _ { \mathcal { V } } ( \boldsymbol { y } \cdot \boldsymbol { W } _ { E m b } ^ { \top } ) ] } \\ & { \qquad + \mathbb { E } _ { \boldsymbol { x } \sim \mathcal { X } } [ \log ( 1 - D _ { \mathcal { V } } ( \boldsymbol { F } ( \boldsymbol { x } \cdot \boldsymbol { W } _ { E m b } ^ { \top } ) \cdot \boldsymbol { W } _ { E m b } ^ { \top } ) ) ] } \\ & { \qquad \mathcal { L } _ { \mathrm { c y c } } ( F , G , \boldsymbol { \chi } , \mathcal { V } ) = \mathbb { E } _ { \boldsymbol { x } \sim \mathcal { X } } [ \| G ( F ( \boldsymbol { x } \cdot \boldsymbol { W } _ { E m b } ^ { \top } ) \cdot \boldsymbol { W } _ { E m b } ^ { \top } ) - \boldsymbol { x } \| _ { 1 } ] } \\ & { \qquad + \mathbb { E } _ { \boldsymbol { y } \sim \mathcal { Y } } [ \| F ( G ( \boldsymbol { y } \cdot \boldsymbol { W } _ { E m b } ^ { \top } ) \cdot \boldsymbol { W } _ { E m b } ^ { \top } ) - \boldsymbol { y } \| _ { 1 } ] } \end{array}
156
+ $$
157
+
158
+ We perform an inner product between the embeddings $W _ { E m b }$ and the one-hot vectors in $x$ as well as between the embeddings and the softmax vectors produced by generators $F$ and $G$ . The former is equivalent to a lookup operation over the table of embedding vectors, while the latter is a convex combination between all vectors in the vocabulary. The embeddings $W _ { E m b }$ are trained at each step to minimize $\mathcal { L } _ { \mathrm { c y c } }$ and maximize $\mathcal { L } _ { \mathrm { G A N } }$ , meaning the embeddings are easily mapped from and are easy to discriminate. As was discussed in Section 2, training with the above loss functions was unstable, with approximately three of every four experiments failing to produce compelling results. This is a problem we observed with the original CycleGAN horse-zebra experiment, and one that has been noted by multiple re-implementations online (Bansal & Rathore, 2017; Sari, 2017). We were able to significantly increase the stability by training the discriminator loss along with the Lipschitz conditioning term from the improved Wasserstein GAN (Gulrajani et al., 2017) (see Equation 3 and Fedus et al. (2017)), resulting in the following loss (DualGAN (Yi et al., 2017) opted to use weight-clipping to enforce the Lipschitz condition):
159
+
160
+ $$
161
+ \begin{array} { r l } & { \mathcal { L } _ { \mathrm { G A N } } ( F , D _ { \mathcal { V } } , \boldsymbol { \chi } , \mathcal { V } ) = \mathbb { E } _ { y \sim \mathcal { V } } [ D _ { \mathcal { V } } ( \boldsymbol { y } \cdot \boldsymbol { W } _ { E m b } ^ { \top } ) ] } \\ & { \qquad - \mathbb { E } _ { \boldsymbol { x } \sim \boldsymbol { x } } [ D _ { \mathcal { V } } ( F ( \boldsymbol { x } \cdot \boldsymbol { W } _ { E m b } ^ { \top } ) \cdot \boldsymbol { W } _ { E m b } ^ { \top } ) ] } \\ & { \qquad + \alpha \cdot \mathbb { E } _ { \hat { \boldsymbol { y } } \sim \hat { \mathcal { V } } } [ ( \| \nabla _ { \hat { \boldsymbol { y } } } D _ { \mathcal { V } } ( \hat { \boldsymbol { y } } ) \| _ { 2 } - 1 ) ^ { 2 } ] } \end{array}
162
+ $$
163
+
164
+ As a consequence of Proposition 1, discriminators trained on non-stationary embeddings will be unable to approximate Dirac delta distributions to arbitrary accuracy; implying there are dedicated ‘safe-zones’ about members of $\mathcal { X }$ where the generator can reliably fool the discriminator and uninformative discrimination is prevented.
165
+
166
+ In our experiments, we jointly train the embedding vectors as parameters of the model. The gradient updates applied to these vectors introduces noise between training iterations; we observed that embedding vectors tend to remain in a bounded region after the initial steps of training. We found
167
+
168
+ <table><tr><td>Work</td><td>Ciphertext Length</td><td>Accuracy</td></tr><tr><td>Hasinoff (2003)</td><td>500</td><td>~ 97%</td></tr><tr><td>Forsyth&amp; Safavi-Naini (1993)</td><td>5000</td><td>~ 100%</td></tr><tr><td>Ramesh et al. (1993)</td><td>160</td><td>~ 78.5%</td></tr><tr><td>Verma et al. (2007)</td><td>1000</td><td>~ 87%</td></tr></table>
169
+
170
+ Table 1: Previous results on automated shift cipher cracking with limited ciphertext length.
171
+
172
+ that simply replacing the data with embedding vectors had a similar effect to performing the random sampling described in Proposition 1 (see Figure 3).
173
+
174
+ # 4 EXPERIMENTS
175
+
176
+ # 4.1 DATA
177
+
178
+ Our experiments use plaintext natural language samples from the Brown English text dataset (Francis $\&$ Kucera, 1979). We generate $2 *$ batch size plaintext samples, the first half are fed as the CycleGAN’s $\mathcal { X }$ distribution and the second half is passed through the cipher of choice and fed as the $\mathcal { V }$ distribution.
179
+
180
+ For our natural language plaintext data we used the Brown English-language corpus which consists of over one million words in 57340 sentences. We experiment with both word-level ”Brown-W” and character-level ”Brown- $\mathbf { \vec { C } } ^ { \mathbf { \vec { \mu } } }$ vocabularies. For word-level vocabularies, we control the size of the vocabulary by taking the top $k$ most frequent words and introducing an ‘unknown’ token which we use to replace all words that are not within the taken vocabulary. We demonstrate our method’s ability to scale to large vocabularies using the word-level vocabularies; more modern enciphering techniques rely on large substitution-boxes (S-boxes) with many (often hundreds of) elements.
181
+
182
+ # 4.2 TRAINING
183
+
184
+ As in Zhu et al. (2017) we replace the log-likelihood loss with a squared difference loss which was originally introduced by Mao et al. (2016). The original motivation for this replacement was improved stability in training and avoidance of the vanishing gradients problem. In this work we found the effect on training stability substantial.
185
+
186
+ $$
187
+ \begin{array} { r l } & { \mathcal { L } _ { \mathrm { G A N } } ( F , D y , \mathcal { X } , \mathcal { Y } ) = \mathbb { E } _ { y \sim \mathcal { Y } } [ ( D y ( y \cdot W _ { E m b } ^ { \top } ) ) ^ { 2 } ] } \\ & { \qquad + \mathbb { E } _ { x \sim \mathcal { X } } [ ( 1 - D _ { \mathcal { V } } ( F ( x \cdot W _ { E m b } ^ { \top } ) \cdot W _ { E m b } ^ { \top } ) ) ^ { 2 } ] } \\ & { \qquad + \alpha \cdot \mathbb { E } _ { \hat { y } \sim \hat { \mathcal { Y } } } [ ( 1 - \| \nabla _ { \hat { y } } D y ( \hat { y } ) \| _ { 2 } ) ^ { 2 } ] } \end{array}
188
+ $$
189
+
190
+ Hence, our total loss is:
191
+
192
+ $$
193
+ \begin{array} { r l } { \mathcal { L } _ { \mathrm { T o t a l } } ( F , G , D _ { \mathcal { X } } , D _ { \mathcal { Y } } , \mathcal { X } , \mathcal { Y } ) = \mathcal { L } _ { \mathrm { c y c } } ( F , G , \mathcal { X } , \mathcal { Y } ) } & { } \\ { + \mathcal { L } _ { \mathrm { G A N } } ( F , D _ { \mathcal { V } } , \mathcal { X } , \mathcal { Y } ) } & { } \\ { + \mathcal { L } _ { \mathrm { G A N } } ( G , D _ { \mathcal { X } } , \mathcal { X } , \mathcal { Y } ) } \end{array}
194
+ $$
195
+
196
+ We adapted the convolutional architecture for the generator and discriminator directly from Zhu et al. (2017). We simply replace all two dimensional convolutions with the one dimension variant and reduce the filter sizes in our generators to 1 (pointwise convolutions). Convolutional neural networks have recently been shown to be highly effective on language tasks and can speed up training significantly (Zhang & LeCun, 2015; Kalchbrenner et al., 2016; Yu et al., 2017). Both our generators and discriminators receive a sequence of vectors in embedding space; our generators produce a softmax distribution over the vocabulary, while our discriminator produces a scalar output. For all our experiments we use a cycle loss with regularization coefficient $\lambda = 1$ . In order to be compatible with the WGAN we replace batch normalization (Ioffe & Szegedy, 2015) with layer normalization (Ba et al., 2016). We train using the Adam optmizer (Kingma & Ba, 2014) with batch size 64 and learning rate $2 e - 4$ , $\beta _ { 1 } = 0$ and $\beta _ { 2 } = 0 . 9$ . Our learning rate is exponentially warmed up to $2 e - 4$ over 2500 steps, and held constant thereafter. We use learned embedding vectors with 256 dimensions. The WGAN Lipschitz conditioning parameter was set to $\alpha = 1 0$ as was prescribed in Gulrajani et al. (2017).
197
+
198
+ ![](images/a2e5c03b8e76f7f6e10222d4ba2250b1da9bf6d92b825379601540cad2ec3077.jpg)
199
+ Figure 3: Left: Comparison of different timing techniques for Brown-C Vigenere. Right: Compari- \` son of embedding vs. raw softmax on Brown-W with vocab size of 200.
200
+
201
+ Table 2: Average proportion of characters correctly mapped in a given sequence. The “Freq. Analysis” column is simple frequency analysis applied to the same corpus our model observes. For Vigenere we also show the score if the key were known (note: the key is left unknown to our \` model).
202
+
203
+ <table><tr><td>Data Vocab size</td><td>Brown-W 10</td><td>Brown-W 200</td><td>Brown-C 58</td><td>Freq. Analysis (With Key) 58</td><td>200</td></tr><tr><td>Cipher</td><td colspan="5">Shift/Permutation</td></tr><tr><td>Acc.</td><td>100%</td><td>98.7%</td><td>99.8%</td><td>80.9%</td><td>44.5%</td></tr><tr><td>Cipher</td><td colspan="5">Vigenere (Key: “345&quot;)</td></tr><tr><td>Acc.</td><td>99.7%</td><td>75.7%</td><td>99.0%</td><td>9.6% (78.1%)</td><td>&lt;0.1% (44.3%)</td></tr></table>
204
+
205
+ For the Vigenere cipher, positional information is critical to the network being able to perform the \` mapping. In order to facilitate this we experimented with adding the timing signal described in Vaswani et al. (2017) (”Transformer Timing” in Figure 3) and found that performance increased relative to no explicit timing signal; we found that the best option was concatenating a learned positional embedding vector specific to each position onto the sequence (”Concat Timing” in Figure 3), this dramatically improved performance, however this means that the architecture can not generalize to sequences longer than those in the training set. A potential solution to the issue of generalizing to longer sequences would be making a ’soft’ choice at each position for which positional embedding vector to concatenate using a softmax distribution over a set of embedding vectors larger than the expected key length, however, we leave this to future work.
206
+
207
+ # 4.3 DISCUSSION
208
+
209
+ Table 2 shows that CipherGAN was able to solve shift ciphers to near flawless accuracy, with all three vocabulary sizes being easily decoded by the model. CipherGAN performs extremely well on Vigenere, achieving excellent results on the character-level cipher and strong results on the chal- \` lenging word-level cipher with a vocabulary size of 200. The vocabulary size of 58 for our character level, containing punctuation and special characters, is more than double what has been previously explored. In comparison to the original CycleGAN architecture, we found CipherGAN to be extremely consistent in training and notably insensitive to the random initialization of weights; we attribute this stability to the Jacobian norm regularization term.
210
+
211
+ For both ciphers, the first mappings to be correctly determined were those of the most frequently occurring vocabulary elements, suggesting that the network does indeed perform some form of frequency analysis to distinguish outlier frequencies in the two banks of text. Another interesting observation is that of the mistakes made by the network: the network would frequently confuse punctuation marks with one another, perhaps suggesting that these vocabulary elements’ skip-gram signatures were similar enough to lead to the repeated confusion observed across many training runs.
212
+
213
+ # 5 CONCLUSION
214
+
215
+ CipherGAN is a compelling demonstration of the potential generative adversarial networks hold to act on discrete data to solve difficult tasks that rely on an extremely sensitive and nuanced discrimination criterion. Our work serves to redouble the promise of the CycleGAN architecture for unsupervised alignment tasks for multiple classes of data. CipherGAN presents an algorithm that is both stable and consistent in training, improving upon past implementations of the CycleGAN architecture. Our work theoretically motivates – and empirically confirms – the use of continuous relaxations of discrete variables, not only to facilitate the flow of gradients through discrete nodes, but also to prevent the oft-observed phenomena of uninformative discrimination. CipherGAN is highly general in its structure and can be directly applied to a variety of unsupervised text alignment tasks, without excess burden of adaptation. On the one hand, CipherGAN is an early step towards the goal of unsupervised translation between languages and has shown excellent performance on the simplified task of cipher map inference. On the other hand, the methods we introduce can be used more broadly in the field of text generation with adversarial networks.
216
+
217
+ # ACKNOWLEDGMENTS
218
+
219
+ Our thanks goes to Roger Grosse and Kelvin Shuangjian Zhang for their advice and support throughout. We also thank Otavio Good and Ian Goodfellow for meaningful early discussions and direction; as well as Michal Wiszniewski for his assistance in developing the code upon which the experiments were run. This work was made possible thanks to the AI Grant, which provided generous support throughout.
220
+
221
+ # REFERENCES
222
+
223
+ Martin Arjovsky, Soumith Chintala, and Leon Bottou. Wasserstein gan. ´ arXiv preprint arXiv:1701.07875, 2017.
224
+ Jimmy Lei Ba, Jamie Ryan Kiros, and Geoffrey E Hinton. Layer normalization. arXiv preprint arXiv:1607.06450, 2016.
225
+ Hardik Bansal and Archit Rathore. Understanding and implementing cyclegan in tensorflow. https://hardikbansal.github.io/CycleGANBlog/, 2017.
226
+ John M Carroll and Steve Martin. The automated cryptanalysis of substitution ciphers. Cryptologia, 10(4):193–209, 1986.
227
+ Tong Che, Yanran Li, Ruixiang Zhang, R Devon Hjelm, Wenjie Li, Yangqiu Song, and Yoshua Bengio. Maximum-likelihood augmented discrete generative adversarial networks. arXiv preprint arXiv:1702.07983, 2017.
228
+ William Fedus, Mihaela Rosca, Balaji Lakshminarayanan, Andrew M. Dai, Shakir Mohamed, and Ian Goodfellow. Many paths to equilibrium: Gans do not need to decrease a divergence at every step, 2017.
229
+ William S Forsyth and Reihaneh Safavi-Naini. Automated cryptanalysis of substitution ciphers. Cryptologia, 17(4):407–418, 1993.
230
+ W Nelson Francis and Henry Kucera. Brown corpus manual. Brown University, 2, 1979.
231
+ Ian Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. Generative adversarial nets. In Advances in neural information processing systems, pp. 2672–2680, 2014.
232
+ Ian Goodfellow, Yoshua Bengio, and Aaron Courville. Deep Learning. MIT Press, 2016. http: //www.deeplearningbook.org.
233
+
234
+ Ishaan Gulrajani, Faruk Ahmed, Martin Arjovsky, Vincent Dumoulin, and Aaron Courville. Improved training of wasserstein gans. arXiv preprint arXiv:1704.00028, 2017.
235
+
236
+ Sam Hasinoff. Solving substitution ciphers. Department of Computer Science, University of Toronto, Tech. Rep, 2003.
237
+
238
+ R Devon Hjelm, Athul Paul Jacob, Tong Che, Kyunghyun Cho, and Yoshua Bengio. Boundaryseeking generative adversarial networks. arXiv preprint arXiv:1702.08431, 2017.
239
+
240
+ Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. In International Conference on Machine Learning, pp. 448–456, 2015.
241
+
242
+ Eric Jang, Shixiang Gu, and Ben Poole. Categorical reparameterization with gumbel-softmax. arXiv preprint arXiv:1611.01144, 2016.
243
+
244
+ Nal Kalchbrenner, Lasse Espeholt, Karen Simonyan, Aaron van den Oord, Alex Graves, and Koray Kavukcuoglu. Neural machine translation in linear time. arXiv preprint arXiv:1610.10099, 2016.
245
+
246
+ Prasad Kawthekar, Raunaq Rewari, and Suvrat Bhooshan. Evaluating generative models for text generation.
247
+
248
+ Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. CoRR, abs/1412.6980, 2014. URL http://arxiv.org/abs/1412.6980.
249
+
250
+ Kevin Knight, Anish Nair, Nishit Rathod, and Kenji Yamada. Unsupervised analysis for decipherment problems. In Proceedings of the COLING/ACL on Main conference poster sessions, pp. 499–506. Association for Computational Linguistics, 2006.
251
+
252
+ Kevin Knight, Beata Megyesi, and Christiane Schaefer. The copiale cipher. In ´ Proceedings of the 4th Workshop on Building and Using Comparable Corpora: Comparable Corpora and the Web, pp. 2–9. Association for Computational Linguistics, 2011.
253
+
254
+ Naveen Kodali, Jacob Abernethy, James Hays, and Zsolt Kira. How to train your dragan. arXiv preprint arXiv:1705.07215, 2017.
255
+
256
+ Matt J Kusner and Jose Miguel Hern ´ andez-Lobato. Gans for sequences of discrete elements with ´ the gumbel-softmax distribution. arXiv preprint arXiv:1611.04051, 2016.
257
+
258
+ Ming-Yu Liu, Thomas Breuel, and Jan Kautz. Unsupervised image-to-image translation networks. arXiv preprint arXiv:1703.00848, 2017.
259
+
260
+ Pauline Luc, Camille Couprie, Soumith Chintala, and Jakob Verbeek. Semantic segmentation using adversarial networks. arXiv preprint arXiv:1611.08408, 2016.
261
+
262
+ Chris J Maddison, Andriy Mnih, and Yee Whye Teh. The concrete distribution: A continuous relaxation of discrete random variables. arXiv preprint arXiv:1611.00712, 2016.
263
+
264
+ Xudong Mao, Qing Li, Haoran Xie, Raymond YK Lau, Zhen Wang, and Stephen Paul Smolley. Least squares generative adversarial networks. arXiv preprint ArXiv:1611.04076, 2016.
265
+
266
+ SS Omran, AS Al-Khalid, and DM Al-Saady. A cryptanalytic attack on vigenere cipher using \` genetic algorithm. In Open Systems (ICOS), 2011 IEEE Conference on, pp. 59–64. IEEE, 2011.
267
+
268
+ Bhadri Msvs Raju et al. Decipherment of substitution cipher using enhanced probability distribution. International Journal of Computer Applications, 5(8):34–40, 2010.
269
+
270
+ RS Ramesh, G Athithan, and K Thiruvengadam. An automated approach to solve simple substitution ciphers. Cryptologia, 17(2):202–218, 1993.
271
+
272
+ Eyyb Sari. tensorflow-cyclegan. https://github.com/Eyyub/tensorflow-cyclegan, 2017.
273
+
274
+ Simon Singh. The Code Book: The Science of Secrecy from Ancient Egypt to Quantum Cryptography. Anchor, 2000.
275
+
276
+ Ragheb Toemeh and Subbanagounder Arumugam. Applying genetic algorithms for searching keyspace of polyalphabetic substitution ciphers. International Arab Journal of Information Technology (IAJIT), 5(1), 2008.
277
+
278
+ Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention is all you need. arXiv preprint arXiv:1706.03762, 2017.
279
+
280
+ AK Verma, Mayank Dave, and RC Joshi. Genetic algorithm and tabu search attack on the monoalphabetic substitution cipher i adhoc networks. In Journal of Computer science. Citeseer, 2007.
281
+
282
+ Ronald J Williams. Simple statistical gradient-following algorithms for connectionist reinforcement learning. Machine learning, 8(3-4):229–256, 1992.
283
+
284
+ Zili Yi, Hao Zhang, Ping Tan Gong, et al. Dualgan: Unsupervised dual learning for image-to-image translation. arXiv preprint arXiv:1704.02510, 2017.
285
+
286
+ Lantao Yu, Weinan Zhang, Jun Wang, and Yong Yu. Seqgan: Sequence generative adversarial nets with policy gradient. In AAAI, pp. 2852–2858, 2017.
287
+
288
+ Xiang Zhang and Yann LeCun. Text understanding from scratch. arXiv preprint arXiv:1502.01710, 2015.
289
+
290
+ Jun-Yan Zhu, Taesung Park, Phillip Isola, and Alexei A Efros. Unpaired image-to-image translation using cycle-consistent adversarial networks. arXiv preprint arXiv:1703.10593, 2017.
291
+
292
+ # APPENDIX
293
+
294
+ A ARCHITECTURAL DETAILS
295
+
296
+ For both the generator and discriminator architectures below, we assume the network is provided with a sequence of $N$ tokens denoted data laying in a $K$ -simplex. Therefore data is an $N$ by $K$ matrix.
297
+
298
+ For simplicity we define the following notation:
299
+
300
+ $$
301
+ \begin{array} { r l } & { \mathrm { \mathrm { ~ 5 o n v L a y e r } } _ { f _ { c , f s = 1 , s = 1 } } ( x ) = R e L U ( L a y e r N o r m ( C o n v 1 D _ { f c , f s } ( x ) ) ) } \\ & { \qquad \mathrm { R e s B l o c k } _ { f _ { c , f s = 1 } } ( x ) = R e L U ( L a y e r N o r m ( x + C o n v 1 D _ { f c , f s } ( C o n v 1 D _ { f c , f s } ( x ) ) ) ) } \\ & { \mathrm { C o n v S t a c k } _ { n , f c , f s = 1 } ( x ) = } \\ & { \qquad \mathrm { C o n v L a y e r } _ { 1 , f s } \circ \mathrm { C o n v L a y e r } _ { 2 ^ { 1 } \cdot f c , f s , 2 } \circ \cdot \cdot \circ \mathrm { C o n v L a y e r } _ { 2 ^ { n } \cdot f c , f s , 2 } \circ \mathrm { C o n v L a y e r } _ { f c , f s , 2 } ( x ) } \end{array}
302
+ $$
303
+
304
+ # A.1 GENERATOR
305
+
306
+ We define the following constants:
307
+
308
+ • $f c = 3 2$ : The base ’filter count‘, or number of filters in a convolution layer
309
+ • $f s = 1$ : The ’filter size‘, or width of weight kernel used in convolution layers
310
+ • $v s = 1$ : The ’vocab size‘, or number of elements in the vocabulary
311
+ • $s = 1$ : The stride of the convolution layers
312
+ • $E = 1 0 0$ : The dimensionality of the embedding vectors
313
+ • $T = 1 0 0$ : The dimensionality of the concat timing weights
314
+
315
+ First, we first look up embedding vectors corresponding to the observed tokens. This is performed as a simple inner-product between data and a learning weight matrix of embeddings $W _ { \mathrm { E m b } } ^ { \mathbf { \Upsilon } ^ { \bullet } } \in \mathbb { R } ^ { K \times E }$ :
316
+
317
+ $$
318
+ x = \mathrm { d a t a } \cdot W _ { \mathrm { E m b } }
319
+ $$
320
+
321
+ Next, a timing signal is added using either:
322
+
323
+ • The Transformer method:
324
+
325
+ $$
326
+ \begin{array} { c } { { \mathrm { s i g n a l } _ { n , 2 k } = \sin ( n / 1 e 5 ^ { 2 k / K } ) } } \\ { { \mathrm { s i g n a l } _ { n , 2 k + 1 } = \cos ( n / 1 e 5 ^ { 2 k / K } ) } } \\ { { \mathrm { t i m i n g } ( x ) = x + \mathrm { s i g n a l } } } \end{array}
327
+ $$
328
+
329
+ • The concat method:
330
+
331
+ $$
332
+ \begin{array} { r l } & { W _ { \mathrm { t i m e } } \in \mathbb { R } ^ { N \times T } } \\ & { t = \mathsf { t i m i n g } ( x ) = [ x \| _ { 2 } W _ { \mathrm { t i m e } } ] } \end{array}
333
+ $$
334
+
335
+ Where $W _ { \mathrm { t i m e } }$ are trained parameters and $[ \cdot | | _ { k } \cdot ]$ denotes concatenation along the $k ^ { \mathrm { { t h } } }$ axis.
336
+
337
+ Then the generator is defined as follows:
338
+
339
+ $$
340
+ \begin{array} { r l } & { \phantom { \frac { 1 } { 2 } } a ( x ) = \mathrm { C o n v L a y e r } _ { 4 \cdot f c } ( \mathrm { C o n v L a y e r } _ { 2 \cdot f c , f s } ( \mathrm { C o n v L a y e r } _ { f c } ( x ) ) ) } \\ & { \phantom { \frac { 1 } { 2 } } b ( x ) = \mathrm { R e s B l o c k } _ { 4 \cdot f c } ^ { ( 5 ) } ( x ) } \\ & { \circ \mathrm { u t } ( t ) = \mathrm { S o f t m a x } ( \mathrm { C o n v L a y e r } _ { v s } ( b ( a ( t ) ) ) ) } \end{array}
341
+ $$
342
+
343
+ # A.2 DISCRIMINATOR
344
+
345
+ We define the following constants:
346
+
347
+ • $f c = 3 2$ : The base ’filter count‘, or number of filters in a convolution layer • $f s = 1 5$ : The ’filter size‘, or width of weight kernel used in convolution layers • $n = 5$ : The depth of the convolutional stack
348
+
349
+ Similar to the generator, a timing signal is added first. Leading to the following discriminator:
350
+
351
+ $$
352
+ \mathsf { o u t } ( t ) = \mathbf { C o n v S t a c k } _ { n , f c , f s } ( \mathsf { d r o p o u t } _ { 0 . 5 } ( t ) )
353
+ $$
354
+
355
+ B PROOF OF PROPOSITION 1
356
+
357
+ Proposition 1 (Reliable Fooling Via Relaxation).
358
+
359
+ Given:
360
+
361
+ • discrete spaces $\mathcal { X } , \mathcal { y }$ and continuous relaxations $\overline { { \mathcal { X } } } , \overline { { \mathcal { V } } }$ • generators $F : \overline { { \mathcal { X } } } \overline { { \mathcal { V } } } , G : \overline { { \mathcal { V } } } \overline { { \mathcal { X } } }$ bijections satisfying $F = G ^ { - 1 }$ • discrete discriminators $D _ { \mathcal { X } } , D _ { \mathcal { Y } }$ both optimal for fixed $F , G$ • rediscretization functions $R _ { \mathcal { X } } , R _ { \mathcal { Y } }$
362
+
363
+ Suppose: $F$ is approximately volume preserving in a small region about each $x \in \mathcal { X }$ . Consequently the same is true for $G$ about each $y \in \mathcal { V }$ .
364
+ If: during training, we replace discrete random variables from $\mathcal { X }$ which lie in the continuous metric space $\overline { { \mathcal { X } } }$ with samples from regions about them.
365
+ Then: the optimal relaxed discriminators $D _ { \overline { { \mathcal { X } } } }$ and $D _ { \overline { { { y } } } }$ have a non-empty region about each $x \in \mathcal { X }$ and $y \in \mathcal { V }$ where they are expected to assign values close to $D _ { \mathcal { X } } ( x )$ and $D _ { \mathcal { Y } } ( y )$ .
366
+
367
+ Proof. We’ll prove one side of the CipherGAN as the proof for both sides are similar.
368
+
369
+ Given bijective function between continuous relaxations of $\mathcal { X }$ and $\mathcal { V }$ : $F : ( \overline { { \mathcal { X } } } , d _ { \overline { { \mathcal { X } } } } ) ( \overline { { \mathcal { V } } } , d _ { \overline { { \mathcal { V } } } } )$ , where $\mathcal { X }$ and $\mathcal { V }$ contain finite sequences (length $n$ ) of vectors laying on the vertices of the simplex $\Delta ^ { k }$ , and are supports of data distributions $p _ { \mathscr { X } } , p _ { \mathscr { Y } }$ respectively.
370
+
371
+ Let:
372
+
373
+ • $\overline { { \mathcal { X } } } = \overline { { \mathcal { Y } } } = \underbrace { \Delta ^ { k } \times \cdots \times \Delta ^ { k } } _ { n }$ with $k$ equal to the number of elements in our vocabulary. • the rediscretization function $R _ { { \mathcal { X } } } : { \overline { { { \mathcal { X } } } } } { \mathcal { X } }$ : $R _ { { \mathcal K } } ( \bar { x } ) = \arg \operatorname* { m i n } _ { x \in { \mathcal K } } d _ { \overline { { { \mathcal K } } } } ( \bar { x } , x )$ ; similarly for $R _ { \mathcal { Y } }$ .
374
+
375
+ Now, for each $x \in \mathcal { X }$ consider the infinite set $S _ { x }$ with cardinality of the continuum constructed according to:
376
+
377
+ Equivalently,
378
+
379
+ $$
380
+ S _ { x } = R _ { \chi } ^ { - 1 } ( x ) \cap F ^ { - 1 } ( R _ { \ y } ^ { - 1 } ( F ( x ) ) )
381
+ $$
382
+
383
+ Note. $S _ { x }$ is never of cardinality less than the continuum since the following is implied by the definitions of $R _ { \mathcal { X } }$ , $S _ { x }$ and the fact that $F$ is continuous: $x \in \mathcal { X } \implies x \in S _ { x } \wedge \exists$ closed ball $B _ { \epsilon } [ x ]$ with radius
384
+
385
+ $$
386
+ 0 < \epsilon < \operatorname* { m i n } _ { \substack { z \in \overline { { \mathcal X } } } } d _ { \mathcal X } ( x , z )
387
+ $$
388
+
389
+ So, for each element $x \in \mathcal { X }$ there exists a closed set of points in $\overline { { \mathcal { X } } }$ which are rediscretized, under $R _ { \mathcal { X } }$ , to $x$ . Since $S _ { x }$ is a Borel Set we can sample uniformly from it. Therefore, during training suppose we replace each element of $x \in \mathcal { X }$ with a sample $\bar { x } \sim S _ { x }$ :
390
+
391
+ We begin with the discrete objective:
392
+
393
+ $$
394
+ \sum _ { x \in \mathcal { X } } p _ { \mathcal { X } } ( x ) \log ( D _ { \mathcal { X } } ( x ) ) + p _ { F } ( x ) \log ( 1 - D _ { \mathcal { X } } ( x ) )
395
+ $$
396
+
397
+ As was noted in Goodfellow et al. (2014), this objective is optimized in $D _ { \mathcal { X } } : \mathcal { X } [ 0 , 1 ]$ when:
398
+
399
+ $$
400
+ D _ { \mathcal { X } } = \frac { p _ { \mathcal { X } } } { p _ { \mathcal { X } } + p _ { G } }
401
+ $$
402
+
403
+ which is undesirable as $p _ { \mathcal { X } }$ is a sum of Dirac delta distributions $\begin{array} { r } { p _ { \mathcal { X } } ( x ) = \sum _ { x _ { i } \in \mathcal { X } } \delta _ { x _ { i } } ( x ) } \end{array}$ and lacks a non-zero gradient to train the generator function with. Instead, let us consider a continuous relaxation $D _ { \overline { { \mathcal { X } } } } : \overline { { \mathcal { X } } } [ 0 , 1 ]$ of the discriminator $D _ { \mathcal { X } }$ and observe where it optimizes.
404
+
405
+ Suppose $\forall x \in \mathcal { X } , \exists \epsilon _ { x } \geq 0 , \forall \bar { x } \in S _ { x }$
406
+
407
+ $$
408
+ \left( 1 - \epsilon _ { x } \right) \leq \left| \nabla _ { \bar { x } } F ( \bar { x } ) \right| \leq \left( 1 + \epsilon _ { x } \right)
409
+ $$
410
+
411
+ That is, suppose $F$ is approximately volume preserving within a small region about each $x \in \mathcal { X }$ .
412
+
413
+ Lemma 1. $\forall y \in \mathcal { Y } , G ( S _ { y } ) = S _ { G ( y ) }$
414
+
415
+ Proof of Lemma $^ { l }$ . For all $y \in \mathcal { V }$ with $G ( y ) = x \Leftrightarrow y = F ( x )$ :
416
+
417
+ $$
418
+ \begin{array} { r l } & { G ( S _ { y } ) = G [ R _ { y } ^ { - 1 } ( y ) \cap G ^ { - 1 } ( R _ { \chi } ^ { - 1 } ( G ( y ) ) ) ] } \\ & { \qquad = G ( R _ { y } ^ { - 1 } ( y ) ) \cap G ( G ^ { - 1 } ( R _ { \chi } ^ { - 1 } ( G ( y ) ) ) ) } \\ & { \qquad = G ( R _ { y } ^ { - 1 } ( y ) ) \cap R _ { \chi } ^ { - 1 } ( G ( y ) ) } \\ & { \qquad = F ^ { - 1 } ( R _ { y } ^ { - 1 } ( F ( x ) ) ) \cap R _ { \chi } ^ { - 1 } ( x ) } \\ & { \qquad = S _ { x } = S _ { G ( y ) } } \end{array}
419
+ $$
420
+
421
+ Corollary 1.
422
+
423
+ $$
424
+ \int _ { { \bar { x } } \sim S _ { G ( y ) } } { \frac { 1 } { \left| S _ { G ( y ) } \right| } } d { \bar { x } } = \int _ { { \bar { x } } \sim G ( S _ { y } ) } { \frac { \left| \nabla _ { \bar { x } } F ( { \bar { x } } ) \right| } { \left| S _ { y } \right| } } d { \bar { x } }
425
+ $$
426
+
427
+ Proof of Corollary 1.
428
+
429
+ $$
430
+ \begin{array} { r l } { \displaystyle \int _ { \bar { x } \sim S _ { G ( y ) } } \frac { 1 } { \vert S _ { G ( y ) } \vert } d \bar { x } = 1 = \int _ { \bar { y } \sim S _ { y } } \frac { 1 } { \vert S _ { y } \vert } d \bar { y } } & { { } } \\ { = \displaystyle \int _ { \bar { x } \sim G ( S _ { y } ) } \frac { \vert \nabla _ { \bar { x } } G ^ { - 1 } ( \bar { x } ) \vert } { \vert S _ { y } \vert } d \bar { x } } & { { } } \\ { = \displaystyle \int _ { \bar { x } \sim G ( S _ { y } ) } \frac { \vert \nabla _ { \bar { x } } F ( \bar { x } ) \vert } { \vert S _ { y } \vert } d \bar { x } } & { { } } \end{array}
431
+ $$
432
+
433
+ Corollary 2.
434
+
435
+ $$
436
+ \frac { 1 } { ( 1 - \epsilon _ { x } ) | S _ { G ( y ) } | } \geq \frac { 1 } { | S _ { y } | } \geq \frac { 1 } { ( 1 + \epsilon _ { x } ) | S _ { G ( y ) } | }
437
+ $$
438
+
439
+ Proof of Corollary 2. By Equation 6 and Corollary 1:
440
+
441
+ $$
442
+ \begin{array} { r l } & { \displaystyle \int _ { \bar { x } \sim S _ { G ( y ) } } \frac { 1 - \epsilon _ { x } } { | S _ { y } | } d \bar { x } \le \int _ { \bar { x } \sim S _ { G ( y ) } } \frac { 1 } { | S _ { G ( y ) } | } d \bar { x } \le \int _ { \bar { x } \sim S _ { G ( y ) } } \frac { 1 + \epsilon _ { x } } { | S _ { y } | } d \bar { x } } \\ & { \qquad \implies \frac { 1 - \epsilon _ { x } } { | S _ { y } | } | S _ { G ( y ) } | \le 1 \le \frac { 1 + \epsilon _ { x } } { | S _ { y } | } | S _ { G ( y ) } | } \\ & { \qquad \implies ( 1 - \epsilon _ { x } ) | S _ { G ( y ) } | \le | S _ { y } | \le ( 1 + \epsilon _ { x } ) | S _ { G ( y ) } | } \\ & { \qquad \implies \frac { 1 } { ( 1 - \epsilon _ { x } ) | S _ { G ( y ) } | } \ge \frac { 1 } { | S _ { y } | } \ge \frac { 1 } { ( 1 + \epsilon _ { x } ) | S _ { G ( y ) } | } } \end{array}
443
+ $$
444
+
445
+ Corollary 1 leads to the following:
446
+
447
+ $$
448
+ \begin{array} { r l } & { \mathbb { E } _ { \boldsymbol { x } \in \mathcal { X } } [ \mathbb { E } _ { \bar { \boldsymbol { x } } \in S _ { \boldsymbol { x } } } [ \mathrm { l o g } ( D _ { \overline { { \boldsymbol { x } } } } ( \bar { \boldsymbol { x } } ) ) ] ] + \mathbb { E } _ { \boldsymbol { y } \in \mathcal { Y } } [ \mathbb { E } _ { \bar { \boldsymbol { y } } \in S _ { \boldsymbol { y } } } [ \mathrm { l o g } ( 1 - D _ { \overline { { \mathcal { X } } } } ( G ( \bar { \boldsymbol { y } } ) ) ) ] ] } \\ & { = \displaystyle \sum _ { \boldsymbol { x } \in \mathcal { X } } p _ { \mathcal { X } } ( \boldsymbol { x } ) \int _ { \bar { \boldsymbol { x } } \sim S _ { \boldsymbol { x } } } \frac { 1 } { | S _ { \boldsymbol { x } } | } \log ( D _ { \overline { { \boldsymbol { x } } } } ( \bar { \boldsymbol { x } } ) ) d \bar { x } + \displaystyle \sum _ { \boldsymbol { y } \in \mathcal { Y } } p _ { \mathcal { Y } } ( \boldsymbol { y } ) \int _ { \bar { \boldsymbol { y } } \sim S _ { \boldsymbol { y } } } \frac { 1 } { | S _ { \boldsymbol { y } } | } \log ( 1 - D _ { \overline { { \boldsymbol { x } } } } ( G ( \bar { \boldsymbol { y } } ) ) ) d \bar { y } } \\ & { = \displaystyle \sum _ { \boldsymbol { x } \in \mathcal { X } } p _ { \mathcal { X } } ( \boldsymbol { x } ) \int _ { \bar { \boldsymbol { x } } \sim S _ { \boldsymbol { x } } } \frac { 1 } { | S _ { \boldsymbol { x } } | } \log ( D _ { \overline { { \boldsymbol { x } } } } ( \bar { \boldsymbol { x } } ) ) d \bar { x } + \displaystyle \sum _ { \boldsymbol { y } \in \mathcal { Y } } p _ { \mathcal { Y } } ( \boldsymbol { y } ) \int _ { \bar { \boldsymbol { x } } \sim G ( S _ { \boldsymbol { y } } ) } \frac { | \nabla _ { \bar { x } } F ( \bar { \boldsymbol { x } } ) | } { | S _ { \boldsymbol { y } } | } \log ( 1 - D _ { \overline { { \boldsymbol { x } } } } ( \bar { \boldsymbol { x } } ) ) d \bar { x } } \end{array}
449
+ $$
450
+
451
+ Using Lemma 1 and Corollary 2, we obtain the following lower-bound of Equation 7:
452
+
453
+ $$
454
+ \begin{array} { l } { { \displaystyle \geq \sum _ { x \in \mathcal { X } } p _ { \mathcal X } ( x ) \int _ { \overline { { x } } \sim S _ { \varepsilon } } \frac { 1 } { | S _ { x } | } \log ( D _ { \overline { { \mathcal X } } } ( \bar { x } ) ) d \bar { x } + \displaystyle \sum _ { y \in \mathcal { Y } } p _ { \mathcal Y } ( y ) \int _ { \overline { { x } } \sim G ( S _ { y } ) } \frac { 1 - \epsilon _ { x } } { | S _ { y } | } \log ( 1 - D _ { \overline { { \mathcal X } } } ( \bar { x } ) ) d \bar { x } } \ ~ } \\ { { \displaystyle \geq \sum _ { x \in \mathcal { X } } p _ { \mathcal X } ( x ) \int _ { \bar { x } \sim S _ { x } } \frac { 1 } { | S _ { x } | } \log ( D _ { \overline { { \mathcal X } } } ( \bar { x } ) ) d \bar { x } } \ ~ } \\ { { \displaystyle \qquad + p _ { \mathcal Y } ( F ( x ) ) \int _ { \bar { x } \sim S _ { G ( F ( x ) ) } } \frac { 1 - \epsilon _ { x } } { ( 1 + \epsilon _ { x } ) | S _ { G ( F ( x ) ) } | } \log ( 1 - D _ { \overline { { \mathcal X } } } ( \bar { x } ) ) d \bar { x } } \ ~ } \\ { { \displaystyle = \sum _ { x \in \mathcal { X } } \int _ { \bar { x } \sim S _ { x } } \frac { 1 } { | S _ { x } | } \left[ p _ { \mathcal X } ( x ) \log ( D _ { \overline { { \mathcal X } } } ( \bar { x } ) ) + \frac { 1 - \epsilon _ { x } } { 1 + \epsilon _ { x } } p _ { G } ( x ) \log ( 1 - D _ { \overline { { \mathcal X } } } ( \bar { x } ) ) \right] d \bar { x } } } \end{array}
455
+ $$
456
+
457
+ Which is maximal at:
458
+
459
+ $$
460
+ \begin{array} { c } { { D _ { \overline { { { \mathcal { X } } } } } ( \bar { x } \sim S _ { x } ) = \frac { p _ { \mathcal { X } } } { p _ { \mathcal { X } } + \frac { 1 - \epsilon _ { x } } { 1 + \epsilon _ { x } } p _ { G } } \stackrel { \epsilon _ { x } } { \approx } D _ { \mathcal { X } } } } \\ { { \Longrightarrow \mathbb { E } _ { \bar { x } \sim S _ { x } } [ D _ { \overline { { { \mathcal { X } } } } } ( \bar { x } ) ] \stackrel { \epsilon _ { x } } { \approx } D _ { \mathcal { X } } } } \end{array}
461
+ $$
462
+
463
+ And similarly, we find Equation 7 is upper-bounded by:
464
+
465
+ $$
466
+ \begin{array} { l } { { \displaystyle \leq \sum _ { x \in \mathcal { X } } p _ { \mathcal X } ( x ) \int _ { \overline { { x } } \sim S _ { z } } \frac { 1 } { | S _ { x } | } \log ( D _ { \overline { { \mathcal X } } } ( \bar { x } ) ) d \bar { x } + \displaystyle \sum _ { y \in \mathcal { Y } } p _ { \mathcal Y } ( y ) \int _ { \overline { { x } } \sim G ( S _ { y } ) } \frac { 1 + \epsilon _ { x } } { | S _ { y } | } \log ( 1 - D _ { \overline { { \mathcal X } } } ( \bar { x } ) ) d \bar { x } } } \\ { { \displaystyle \leq \sum _ { x \in \mathcal { X } } p _ { \mathcal X } ( x ) \int _ { \bar { x } \sim S _ { x } } \frac { 1 } { | S _ { x } | } \log ( D _ { \overline { { \mathcal X } } } ( \bar { x } ) ) d \bar { x } } } \\ { { \displaystyle \qquad + p _ { \mathcal Y } ( F ( x ) ) \int _ { \bar { x } \sim S _ { G ( F ( \bar { x } ) ) } } \frac { 1 + \epsilon _ { x } } { ( 1 - \epsilon _ { x } ) | S _ { G ( F ( \bar { x } ) ) } | } \log ( 1 - D _ { \overline { { \mathcal X } } } ( \bar { x } ) ) d \bar { x } } } \\ { { \displaystyle = \sum _ { x \in \mathcal { X } } \int _ { \bar { x } \sim S _ { x } } \frac { 1 } { | S _ { x } | } \left[ p _ { \mathcal X } ( x ) \log ( D _ { \overline { { \mathcal X } } } ( \bar { x } ) ) + \frac { 1 + \epsilon _ { x } } { 1 - \epsilon _ { x } } p _ { G } ( x ) \log ( 1 - D _ { \overline { { \mathcal X } } } ( \bar { x } ) ) \right] d \bar { x } } } \end{array}
467
+ $$
468
+
469
+ Which is maximal in $D _ { \overline { { \mathcal { X } } } }$ at:
470
+
471
+ $$
472
+ \begin{array} { c } { { D _ { \overline { { { \mathcal { X } } } } } ( \bar { x } \sim S _ { x } ) = \frac { p _ { \mathcal { X } } } { p _ { \mathcal { X } } + \frac { 1 + \epsilon _ { x } } { 1 - \epsilon _ { x } } p _ { G } } \stackrel { \epsilon _ { x } } { \approx } D _ { \mathcal { X } } } } \\ { { \Longrightarrow \mathbb { E } _ { \bar { x } \sim S _ { x } } [ D _ { \overline { { { \mathcal { X } } } } } ( \bar { x } ) ] \stackrel { \epsilon _ { x } } { \approx } D _ { \mathcal { X } } } } \end{array}
473
+ $$
474
+
475
+ Hence, asymptotically as $F$ becomes approximately volume-preserving about each discrete $x \in \mathcal { X }$ the bounds maximize to the same loss value in the same class of functions $\mathbb { E } _ { { \bar { x } } \sim S _ { x } } [ D _ { \overline { { \mathcal { X } } } } ( { \bar { x } } ) ] = D _ { \mathcal { X } }$ , application of the squeeze theorem concludes the proof. □
md/train/Bkeuz20cYm/Bkeuz20cYm.md ADDED
@@ -0,0 +1,491 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # DOUBLE NEURAL COUNTERFACTUAL REGRET MINIMIZATION
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Counterfactual Regret Minimization (CRF) is a fundamental and effective technique for solving Imperfect Information Games (IIG). However, the original CRF algorithm only works for discrete state and action spaces, and the resulting strategy is maintained as a tabular representation. Such tabular representation limits the method from being directly applied to large games and continuing to improve from a poor strategy profile. In this paper, we propose a double neural representation for the imperfect information games, where one neural network represents the cumulative regret, and the other represents the average strategy. Furthermore, we adopt the counterfactual regret minimization algorithm to optimize this double neural representation. To make neural learning efficient, we also developed several novel techniques including a robust sampling method, mini-batch Monte Carlo Counterfactual Regret Minimization (MCCFR) and Monte Carlo Counterfactual Regret Minimization Plus $( \mathrm { M C C F R + } )$ ) which may be of independent interests. Experimentally, we demonstrate that the proposed double neural algorithm converges significantly better than the reinforcement learning counterpart.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ In Imperfect Information Games (IIG), a player only has partial access to the knowledge of her opponents before making a decision. This is similar to real-world scenarios, such as trading, traffic routing, and public auction. Thus designing methods for solving IIG is of great economic and societal benefits. Due to the hidden information, a player has to reason under the uncertainty about her opponents’ information, and she also needs to act so as to take advantage of her opponents’ uncertainty about her own information.
12
+
13
+ Nash equilibrium is a typical solution concept for a two-player extensive-form game. Many algorithms have been designed over years to approximately find Nash equilibrium for large games. One of the most effective approaches is CFR (Zinkevich et al., 2007). In this algorithm, the authors proposed to minimize overall counterfactual regret and prove that the average of the strategies in all iterations would converge to a Nash equilibrium. However, the original CFR only works for discrete state and action spaces, and the resulting strategy is maintained as a tabular representation. Such tabular representation limits the method from being directly applied to large games and continuing to improve if starting from a poor strategy profile.
14
+
15
+ To alleviate CFR’s large memory requirement in large games such as heads-up no-limit Texas Hold’em, Moravcik et al. (2017) proposed a seminal approach called DeepStack which uses fully connected neural networks to represent players counterfactual values and obtain a strategy online as requested. However, the strategy is still represented as a tabular form and the quality of this solution depends a lot on the initial quality of the counterfactual network. Furthermore, the counterfactual network is estimated separately, and it is not easy to continue improving both counterfactual network and the tabular strategy profile in an end-to-end optimization framework.
16
+
17
+ Heinrich et al. (2015); Heinrich & Silver (2016) proposed end-to-end fictitious self-play approaches (XFP and NFSP respectively) to learn the approximate Nash equilibrium with deep reinforcement learning. In a fictitious play model, strategies are represented as neural networks and the strategies are updated by selecting the best responses to their opponents’ average strategies. This approach is advantageous in the sense that the approach does not rely on abstracting the game, and in theory, the strategy should continually improve as the algorithm iterates more steps. However, these methods do not explicitly take into account the hidden information in a game, because they are optimized based on the transition memory and the reward of the intermediate node is the utility of the game rather than the counterfactual value which consider the distribution of hidden variables (opponent’s private information). In experiments for games such as Leduc Hold’em, these methods converge slower than tabular based counterfactual regret minimization algorithms. Waugh et al. (2015) used handcraft features of the information sets to estimates the counterfactual regret. However, it need traverse the full game tree which is infeasible in large games.
18
+
19
+ Thus it remains an open question whether the purely neural-based end-to-end approach can achieve comparable performance to tabular based CFR approach. In the paper, we partially resolve this open question by designing a double neural counterfactual regret minimization algorithm which can match the performance of tabular based counterfactual regret minimization algorithm. We employed two neural networks, one for the cumulative regret, and the other for the average strategy. We show that careful algorithm design allows these two networks to track the cumulative regret and average strategy respectively, resulting in a converging neural strategy. Furthermore, in order to improve the convergence of the neural algorithm, we also developed a new sampling technique which has lower variance than the outcome sampling, while being more memory efficient than the external sampling. In experiments with One-card poker and a large Leduc Hold’em containing more than $1 0 ^ { 7 }$ nodes, we showed that the proposed double neural algorithm has a strong generalization and compression ability even though only a small proportion of nodes are visited in each iteration. In addition, this method can converge to comparable results produced by its tabular counterpart while performing much better than deep reinforcement learning method. The current results open up the possibility for a purely neural approach to directly solve large IIG.
20
+
21
+ # 2 BACKGROUND
22
+
23
+ In this section, we will introduce some background on IIG and existing approaches to solve them.
24
+
25
+ # 2.1 REPRESENTATION OF EXTENSIVE-FORM GAME
26
+
27
+ We define the components of an extensive-form game following Osborne & Ariel (1994) (page $2 0 0 \sim 2 0 1$ ). A finite set $N = \{ 0 , 1 , . . . , n - 1 \}$ of players. Define $h _ { i } ^ { v }$ as the hidden variable of player $i$ in IIG, e.g., in poker game $h _ { i } ^ { v }$ refers to the private cards of player $i$ . $H$ refers to a finite set of histories. Each member $h \ = \ ( h _ { i } ^ { v } ) _ { i = 0 , 1 , \ldots , n - 1 } ( a _ { l } ) _ { l = 0 , \ldots , L - 1 } \ = \ h _ { 0 } ^ { v } h _ { 1 } ^ { v } . . . h _ { n - 1 } ^ { v } a _ { 0 } a _ { 1 } . . . a _ { L - 1 }$ of $H$ denotes a possible history (or state), which consists of each player’s hidden variable and $L$ actions taken by players including chance. For player $i , h$ also can be denoted as $h _ { i } ^ { v } h _ { - i } ^ { v } a _ { 0 } a _ { 1 } . . . a _ { L - 1 } .$ , where $h _ { - i } ^ { v }$ refers to the opponent’s hidden variables. The empty sequence $\varnothing$ is a member of $H$ . $h _ { j } \subseteq h$ denotes $h _ { j }$ is a prefix of $h$ , where $h _ { j } = ( h _ { i } ^ { v } ) _ { i = 0 , 1 , \ldots , n - 1 } ( a _ { l } ) _ { l = 1 , \ldots , L ^ { \prime } - 1 }$ and $0 < L ^ { \prime } < L$ . ${ \dot { Z } } \subseteq H$ denotes the terminal histories and any member $z \in Z$ is not a prefix of any other sequences. $A ( h ) = \{ a : h a \in H \}$ is the set of available actions after non-terminal history $h \in H \backslash Z$ . A player function $P$ assigns a member of $N \cup \{ c \}$ to each non-terminal history, where $c$ denotes the chance player id, which usually is -1. $P ( h )$ is the player who takes an action after history $h$ . $\mathcal { T } _ { i }$ of a history $\mathbf { \bar { \{ } } h \mathbf { \bar { \Psi } } \in H : P ( h ) = i \}$ is an information partition of player $i$ . A set $I _ { i } \in \mathcal { T } _ { i }$ is an information set of player $i$ and $I _ { i } ( h )$ refers to information set $I _ { i }$ at state $h$ . Generally, $I _ { i }$ could only remember the information observed by player $i$ including player $i ^ { \prime } s$ hidden variable and public actions. Therefore $I _ { i }$ indicates a sequence in IIG, i.e., $h _ { i } ^ { v } a _ { 0 } a _ { 2 } . . . a _ { L - 1 }$ . For $I _ { i } \in \mathcal { I } _ { i }$ we denote by $A ( I _ { i } )$ the set $A ( h )$ and by $P ( I _ { i } )$ the player $P ( h )$ for any $h \in I _ { i }$ . For each player $i \in N$ a utility function $u _ { i } ( z )$ define the payoff of the terminal state $z$ . A more detailed explanation of these notations and definitions is presented in section B.
28
+
29
+ # 2.2 STRATEGY AND NASH EQUILIBRIUM
30
+
31
+ A strategy profile $\sigma = \{ \sigma _ { i } | \sigma _ { i } \in \Sigma _ { i } , i \in N \}$ is a collection of strategies for all players, where $\Sigma _ { i }$ is the set of all possible strategies for player $i$ . $\sigma _ { - i }$ refers to strategy of all players other than player $i$ . For play $i \in N$ the strategy $\sigma _ { i } ( I _ { i } )$ is a function, which assigns an action distribution over $A ( I _ { i } )$ to information set $I _ { i }$ . $\sigma _ { i } ( a | h )$ denotes the probability of action $a$ taken by player $i \in N \cup \{ c \}$ at state $h$ . In IIG, $\forall h _ { 1 } , h _ { 2 } \ \in \ I _ { i }$ , we have $I _ { i } \stackrel { \cdot } { = } I _ { i } ( h _ { 1 } ) \stackrel { \cdot } { = } I _ { i } ( h _ { 2 } )$ , $\sigma _ { i } ( I _ { i } ) = \sigma _ { i } ( h _ { 1 } ) = \sigma _ { i } ( \tilde { h _ { 2 } } )$ , $\sigma _ { i } ( a | I _ { i } ) = \sigma _ { i } ( a | h _ { 1 } ) = \sigma _ { i } ( a | h _ { 2 } )$ . For iterative method such as CFR, $\sigma ^ { t }$ refers to the strategy profile at $t$ -th iteration. The state reach probability of history $h$ is denoted by $\pi ^ { \sigma } ( h )$ if players take actions according to $\sigma$ . For an empty sequence $\pi ^ { \sigma } ( \emptyset ) = 1$ . The reach probability can be decomposed into $\begin{array} { r } { \pi ^ { \sigma } ( h ) = \dot { \prod } _ { i \in N \cup \{ c \} } \pi _ { i } ^ { \sigma } ( h ) \dot { = } \pi _ { i } ^ { \sigma } \bar { ( h ) } \pi _ { - i } ^ { \sigma } ( h ) } \end{array}$ according to each player’s contribution, where $\pi _ { i } ^ { \sigma } ( h ) =$ $\scriptstyle \prod _ { h ^ { \prime } a \subseteq h , P ( h ^ { \prime } ) = P ( h ) } \sigma _ { i } ( a | h ^ { \prime } )$ and $\begin{array} { r } { \pi _ { - i } ^ { \sigma } ( h ) \ = \ \prod _ { h ^ { \prime } a \subseteq h , P ( h ^ { \prime } ) \neq P ( h ) } \sigma _ { - i } ( a | h ^ { \prime } ) } \end{array}$ . The information set reach probability of $I _ { i }$ is defined as $\begin{array} { r } { \pi ^ { \sigma } ( I _ { i } ) = \sum _ { h \in I _ { i } } \pi ^ { \sigma } ( h ) } \end{array}$ . If $h ^ { \prime } \subseteq h$ , the interval state reach probability from state $h ^ { \prime }$ to $h$ is defined as $\pi ^ { \sigma } ( h ^ { \prime } , h )$ , then we have $\pi ^ { \sigma } ( h ^ { \prime } , h ) = \pi ^ { \sigma } ( h ) / \pi ^ { \sigma } ( h ^ { \prime } )$ $\pi _ { i } ^ { \sigma } ( I _ { i } )$ , $\pi _ { - i } ^ { \sigma } ( I _ { i } )$ , $\pi _ { i } ^ { \sigma } ( h ^ { \prime } , h )$ , and $\pi _ { - i } ^ { \sigma } ( h ^ { \prime } , h )$ are defined similarly.
32
+
33
+ # 2.3 COUNTERFACTUAL REGRET MINIMIZATION
34
+
35
+ In large and zero-sum IIG, CFR is proved to be an efficient method to compute Nash equilibrium (Zinkevich et al., 2007; Brown & Sandholm, 2017). We present some key ideas of this method as follows.
36
+
37
+ Lemma 1: The state reach probability of one player is proportional to posterior probability of the opponent’s hidden variable, $i . e . , p ( h _ { - i } ^ { v } | I _ { i } ) \propto \pi _ { - i } ^ { \sigma } ( h )$ , where $h _ { i } ^ { v }$ and $I _ { i }$ indicate a particular $h$ . (see the proof in section G.1)
38
+
39
+ For player $i$ and strategy profile $\sigma$ , the counterfactual value (CFV) $v _ { i } ^ { \sigma } ( h )$ at state $h$ is define as
40
+
41
+ $$
42
+ v _ { i } ^ { \sigma } ( h ) = \sum _ { h \subseteq z , z \in Z } \pi _ { - i } ^ { \sigma } ( h ) \pi ^ { \sigma } ( h , z ) u _ { i } ( z ) = \sum _ { h \subseteq z , z \in Z } \pi _ { i } ^ { \sigma } ( h , z ) u _ { i } ^ { \prime } ( z ) .
43
+ $$
44
+
45
+ where $u _ { i } ^ { \prime } ( z ) = \pi _ { - i } ^ { \sigma } ( z ) u _ { i } ( z )$ is the expected reward of player $i$ with respective to the approximated posterior distribution of the opponent’s hidden variable. The action counterfactual value of taking action $a$ is $v _ { i } ^ { \sigma } ( a | h ) = v _ { i } ^ { \sigma } ( h a )$ and the regret of taking this action is $r _ { i } ^ { \sigma } ( a | h ) = v _ { i } ^ { \sigma } ( a | h ) - v _ { i } ^ { \sigma } ( h )$ . Similarly, the CFV of information set $I _ { i }$ is $\begin{array} { r } { v _ { i } ^ { \sigma } ( I _ { i } ) \stackrel { } { = } \sum _ { h \in I _ { i } } v _ { i } ^ { \sigma } ( h ) } \end{array}$ and the regret is $r _ { i } ^ { \sigma } ( a | I _ { i } ) =$ $\begin{array} { r l } & { \sum _ { z \in Z , h a \subseteq z , h \in I _ { i } } \pi _ { i } ^ { \sigma } ( h a , z ) u _ { i } ^ { \prime } ( z ) - \sum _ { z \in Z , h \subseteq z , h \in I _ { i } } \pi _ { i } ^ { \sigma } ( h , z ) u _ { i } ^ { \prime } ( z ) } \end{array}$ . Then the cumulative regret of action $a$ after $T$ iterations is
46
+
47
+ $$
48
+ R _ { i } ^ { T } ( a | I _ { i } ) = \sum _ { t = 1 } ^ { T } ( v _ { i } ^ { \sigma ^ { t } } ( a | I _ { i } ) - v _ { i } ^ { \sigma ^ { t } } ( I _ { i } ) ) = R _ { i } ^ { T - 1 } ( a | I _ { i } ) + r _ { i } ^ { \sigma ^ { T } } ( a | I _ { i } ) .
49
+ $$
50
+
51
+ where $R _ { i } ^ { 0 } ( a | I _ { i } ) = 0$ . Define $R _ { i } ^ { T , + } ( a | I _ { i } ) = \operatorname* { m a x } ( R _ { i } ^ { T } ( a | I _ { i } ) , 0 )$ , the current strategy (or behavior strategy) at $T + 1$ iteration will be updated by
52
+
53
+ $$
54
+ \sigma _ { i } ^ { T + 1 } ( a | I _ { i } ) = \left\{ \begin{array} { l l } { \frac { R _ { i } ^ { T , + } ( a | I _ { i } ) } { \sum _ { a \in A ( I _ { i } ) } R _ { i } ^ { T , + } ( a | I _ { i } ) } } & { \mathrm { i f } \sum _ { a \in A ( I _ { i } ) } R _ { i } ^ { T , + } ( a | I _ { i } ) > 0 } \\ { \frac { 1 } { | A ( I _ { i } ) | } } & { \mathrm { o t h e r w i s e } . } \end{array} \right.
55
+ $$
56
+
57
+ The average strategy $\bar { \sigma _ { i } } ^ { T }$ from iteration 1 to $T$ is defined as:
58
+
59
+ $$
60
+ \bar { \sigma _ { i } } ^ { T } ( a | I _ { i } ) = \frac { \sum _ { t = 1 } ^ { T } \pi _ { i } ^ { \sigma ^ { t } } ( I _ { i } ) \sigma _ { i } ^ { t } ( a | I _ { i } ) } { \sum _ { t = 1 } ^ { T } \pi _ { i } ^ { \sigma ^ { t } } ( I _ { i } ) } .
61
+ $$
62
+
63
+ where $\pi _ { i } ^ { \sigma ^ { t } } ( I _ { i } )$ denotes the information set reach probability of $I _ { i }$ at $t$ -th iteration and is used to weight the corresponding current strategy $\sigma _ { i } ^ { t } ( a | I _ { i } )$ . Define $s _ { i } ^ { t } ( a | I _ { i } ) ~ = ~ \pi _ { i } ^ { \sigma ^ { t } } ( I _ { i } ) \sigma _ { i } ^ { t } ( a | I _ { i } )$ as the additional numerator in iteration $t$ , then the cumulative numerator can be defined as
64
+
65
+ $$
66
+ \boldsymbol { S } ^ { T } ( \boldsymbol { a } | I _ { i } ) = \sum _ { t = 1 } ^ { T } \pi _ { i } ^ { \sigma ^ { t } } ( I _ { i } ) \boldsymbol { \sigma } _ { i } ^ { t } ( \boldsymbol { a } | I _ { i } ) = \boldsymbol { S } ^ { T - 1 } ( \boldsymbol { a } | I _ { i } ) + \boldsymbol { s } _ { i } ^ { T } ( \boldsymbol { a } | I _ { i } ) .
67
+ $$
68
+
69
+ where $S ^ { 0 } ( a | I _ { i } ) = 0$ .
70
+
71
+ # 2.4 MONTE CARLO CFR
72
+
73
+ When solving a game, CFR needs to traverse the entire game tree in each iteration, which will prevent it from handling large games with limited memory. To address this challenge, Lanctot et al. (2009) proposed a Monte Carlo CFR to minimize counterfactual regret. Their method can compute an unbiased estimation of counterfactual value and avoid traversing the entire game tree. Since only subsets of all information sets are visited in each iteration, this approach requires less memory than standard CFR.
74
+
75
+ Define $\mathcal { Q } = \{ Q _ { 1 } , Q _ { 2 } , . . . , Q _ { m } \}$ , where $Q _ { j } \in Z$ is a block of sampling terminal histories in each iteration, such that $\mathcal { Q } _ { j }$ spans the set $Z$ . Generally, different $Q _ { j }$ may have an overlap according to the specify sampling schema. Specifically, in the external sampling and outcome sampling, each block $\textstyle \sum _ { j = 1 } ^ { m } q _ { Q _ { j } } = 1$ $Q _ { j } \in \mathcal { Q }$ . Define is a partition of $\begin{array} { r } { q ( z ) = \sum _ { j : z \in Q _ { j } } q _ { Q _ { j } } } \end{array}$ $Z$ . Define $q _ { Q _ { j } }$ j as the probability of considering a particular terminal as the probability of considering block $Q _ { j }$ , where history $z$ . Specifically, vanilla CFR is a special case of MCCFR, where $\mathcal { Q } = \{ Z \}$ only contain one block and $q _ { Q _ { 1 } } = 1$ . In outcome sampling, only one trajectory will be sampled, such that $\forall Q _ { j } \in \mathcal { Q }$ , $| Q _ { j } | = 1$ and $| \mathcal { Q } _ { j } | = | Z |$ . For information set $I _ { i }$ , a sample estimate of counterfactual value is $\begin{array} { r } { \tilde { v } _ { i } ^ { \sigma } ( I _ { i } | Q _ { j } ) = \sum _ { h \in I _ { i } , z \in Q _ { j } , h \subseteq z } \frac { 1 } { q ( z ) } \pi _ { - i } ^ { \sigma } ( z ) \pi _ { i } ^ { \sigma } ( h , z ) u _ { i } ( z ) . } \end{array}$
76
+
77
+ Lemma 2: The sampling counterfactual value in MCCFR is the unbiased estimation of actual counterfactual value in CFR. $E _ { j \sim q _ { Q _ { j } } } [ \tilde { v } _ { i } ^ { \sigma } ( I _ { i } | Q _ { j } ) ] = v _ { i } ^ { \sigma } ( I _ { i } )$ (Lemma 1, Lanctot et al. (2009).)
78
+
79
+ Define $\sigma ^ { r s }$ as sampling strategy profile, where $\sigma _ { i } ^ { r s }$ is the sampling strategy for player $i$ and $\boldsymbol { \sigma } _ { - i } ^ { r s }$ are the sampling strategies for players expect $i$ . Particularly, for both external sampling and outcome sampling proposed by (Lanctot et al., 2009), $\sigma _ { - i } ^ { r s } = \sigma _ { - i }$ . The regret of the sampled action $a \in A ( I _ { i } )$ is defined as
80
+
81
+ $$
82
+ \tilde { r } _ { i } ^ { \sigma } ( ( a | I _ { i } ) | Q _ { j } ) = \sum _ { \substack { z \in Q _ { j } , h a \subseteq z , h \in I _ { i } } } \pi _ { i } ^ { \sigma } ( h a , z ) u _ { i } ^ { r s } ( z ) - \sum _ { \substack { z \in Q _ { j } , h \subseteq z , h \in I _ { i } } } \pi _ { i } ^ { \sigma } ( h , z ) u _ { i } ^ { r s } ( z ) \quad \quad ,
83
+ $$
84
+
85
+ where $\begin{array} { r } { u _ { i } ^ { r s } ( z ) = \frac { u _ { i } ( z ) } { \pi _ { i } ^ { \sigma ^ { r s } } ( z ) } } \end{array}$ is a new utility weighted by $\frac { 1 } { \pi _ { i } ^ { \sigma ^ { r s } } ( z ) }$ . The sample estimate for cumulative regret of action $a$ after $T$ iterations is $\tilde { R } _ { i } ^ { T } ( ( a | I _ { i } ) | Q _ { j } ) = \tilde { R } _ { i } ^ { T - 1 } ( ( a | I _ { i } ) | Q _ { j } ) + \tilde { r } _ { i } ^ { \sigma ^ { T } } ( ( a | I _ { i } ) | Q _ { j } )$ with $\tilde { R } _ { i } ^ { 0 } ( ( a | I _ { i } ) | Q _ { j } ) = 0 .$ .
86
+
87
+ # 3 DOUBLE NEURAL COUNTERFACTUAL REGRET MINIMIZATION
88
+
89
+ ![](images/64147e383af628fd9db0c831bbea06a83794a2efc56494a24ebbd190b9053504.jpg)
90
+ Figure 1: (A) tabular based CRF and (B) our double neural based CRF framework.
91
+
92
+ In this section, we will explain our double neural CFR algorithm, where we employ two neural networks, one for the cumulative regret, and the other for the average strategy. As shown in Figure 1 (A), standard CFR-family methods such as CFR (Zinkevich et al., 2007), outcome-sampling MCCFR, external sampling MCCFR (Lanctot et al., 2009), and $\mathrm { C F R + }$ (Tammelin, 2014) need to use two large tabular-based memories $\mathcal { M } _ { R }$ and $\mathcal { M } _ { S }$ to record the cumulative regret and average strategy for all information sets. Such tabular representation makes these methods difficult to apply to large extensive-form games with limited time and space (Burch, 2017).
93
+
94
+ In contrast, we will use two deep neural networks to compute approximate Nash equilibrium of IIG as shown in Figure 1 (B). Different from NFSP, our method is based on the theory of CFR, where the first network is used to learn the cumulative regret and the other is to learn the cumulative numerator of the average strategy profile. With the help of these two networks, we do not need to use two large tabular-based memories; instead, we rely on the generalization ability of the compact neural network to produce the cumulative regret and the average strategy. In practice, the proposed double neural method can achieve a lower exploitability with fewer iterations than NFSP. In addition, we present experimentally that our double neural CFR can also continually improve after initialization from a poor tabular strategy.
95
+
96
+ # 3.1 OVERALL FRAMEWORK
97
+
98
+ The iterative updates of the CFR algorithm maintain two strategies: the current strategy $\sigma _ { i } ^ { t } ( a | I _ { i } )$ , and the average strategy $\bar { \sigma } _ { i } ^ { t } ( a | I _ { i } )$ for $\forall i \in N , \forall I _ { i } \in \mathbb { Z } _ { i } , \forall a \in A ( \bar { I } _ { i } ) , \forall t \in \{ 1 , \dots , T \}$ . Thus, our two neural networks are designed to maintain these two strategies in iterative fashion. More specifically, • Current strategy. According to Eq. (3), current strategy $\sigma ^ { t + 1 } ( a | I _ { i } )$ is computed by the cumulative regret $R ^ { t } ( a | I _ { i } )$ . We only need to track the numerator in Eq. (3) since the normalization in the denominator can easily be computed when the strategy is used. Given information set $I _ { i }$ and action $a$ , we design a neural network RegretSumNetwork(RSN) $\mathcal { R } ( a , I _ { i } | \theta _ { \mathcal { R } } ^ { t } )$ to learn $R ^ { t } ( a | I _ { i } )$ , where $\theta _ { \mathcal { R } } ^ { t }$ is the parameter in the network at $t$ -th iteration. As shown Figure 1 (b), define memory $\mathcal { M } _ { R } ~ = ~ \{ ( I _ { i } , \tilde { r } _ { i } ^ { \sigma ^ { t } } ( ( a | I _ { i } ) | Q _ { j } ) ) | \forall i ~ \in ~ N , \forall a ~ \in ~$ $A ( I _ { i } ) , h \in I _ { i } , h \subseteq z , z \in Q _ { j } \}$ . Each member of $\mathcal { M } _ { R }$ is the visited information set $I _ { i }$ and the corresponding regret $\tilde { r } _ { i } ^ { \sigma ^ { t } } ( ( a | I _ { i } ) | Q _ { j } )$ , where $Q _ { j }$ is the sampled block in $t$ -th iteration. According to Eq. (2), we can estimate $\mathcal { R } ( a , I _ { i } | \theta _ { \mathcal { R } } ^ { t + 1 } )$ using the following optimization:
99
+
100
+ $$
101
+ \theta _ { \mathcal { R } } ^ { t + 1 } \underset { \theta _ { \mathcal { R } } ^ { t + 1 } } { \mathrm { a r g m i n } } \sum _ { \substack { ( I _ { i } , \tilde { r } _ { i } ^ { \sigma ^ { t } } ( ( a | I _ { i } ) | Q _ { j } ) ) \in \mathcal { M } _ { R } } } ( \mathcal { R } ( a , I _ { i } | \theta _ { \mathcal { R } } ^ { t } ) + \tilde { r } _ { i } ^ { \sigma ^ { t } } ( ( a | I _ { i } ) | Q _ { j } ) - \mathcal { R } ( a , I _ { i } | \theta _ { \mathcal { R } } ^ { t + 1 } ) ) ^ { 2 } .
102
+ $$
103
+
104
+ • Average Strategy. According to Eq. (4), the approximate Nash equilibrium is the weighted average of all previous strategies over $T$ iterations. Similar to the cumulative regret, we employ another deep neural network AvgStrategyNetwork(ASN) to learn the numerator of the average strategy. Define $\mathcal { M } _ { S } = \{ ( I _ { i } , \pi _ { i } ^ { \sigma ^ { t } } ( I _ { i } ) \sigma _ { i } ^ { t } ( a | I _ { i } ) ) | \forall i \in N , \forall a \in A ( I _ { i } ) , h \in$ $I _ { i } , h \subseteq z , z \in Q _ { j } \}$ . Each member of $\mathcal { M } _ { S }$ is the visited information set $I _ { i }$ and the value of $\pi _ { i } ^ { \sigma ^ { t } } ( I _ { i } ) \sigma _ { i } ^ { t } ( a | I _ { i } )$ , where $Q _ { j }$ is the sampled block in $t$ -th iteration. Then the parameter $\theta _ { S } ^ { t + 1 }$ can estimated by the following optimization:
105
+
106
+ $$
107
+ \theta _ { \mathcal { S } } ^ { t + 1 } \underset { \theta _ { \mathcal { S } } ^ { t + 1 } } { \mathrm { a r g m i n } } \sum _ { \substack { ( I _ { i } , s _ { i } ^ { t } ( a | I _ { i } ) ) \in \mathcal { M } _ { \mathcal { S } } } } ( \mathcal { S } ( a , I _ { i } | \theta _ { \mathcal { S } } ^ { t } ) + s _ { i } ^ { t } ( a | I _ { i } ) - \mathcal { S } ( a , I _ { i } | \theta _ { \mathcal { S } } ^ { t + 1 } ) ) ^ { 2 } .
108
+ $$
109
+
110
+ Remark 1: In each iteration, only a small subset of information sets are sampled, which may lead to the neural networks forgetting values for those unobserved information sets. To address this problem, we will use the neural network parameters from the previous iteration as the initialization, which gives an online learning/adaptation flavor to the updates. Furthermore, due to the generalization ability of the neural networks, even samples from a small number of information sets are used to update the new neural networks, the newly updated neural networks can produce very good value for the cumulative regret and the average strategy.
111
+
112
+ Remark 2: As we increase the number of iterations $t$ , the value of $R _ { i } ^ { t } ( a | I _ { i } )$ will become increasingly large, which may make neural network difficult to learn. To address this problem,√ we will normalize the cumulative regret by a factor of $\sqrt { t }$ to make its range more stable. This can be understood from the regret bound of online learning. More specifically, let $\Delta \ =$ $\begin{array} { r } { \operatorname* { m a x } _ { I _ { i } , a , t } | R ^ { t } ( a | I _ { i } ) - R ^ { t - 1 } ( a | I _ { i } ) | , \forall \bar { I _ { i } } \ \in \ \mathcal { Z } , a \ \in \ A ( I _ { i } ) , t \ \in \ \{ 1 , \cdots , T \} } \end{array}$ . We have $\begin{array} { r } { \mathrm { ~ \dot { ~ } ~ } R _ { i } ^ { t } ( a | I _ { i } ) \ \le \ } \end{array}$ $\Delta \sqrt { | A | t }$ according to the Theorem 6 in (Burch, 2017), where $\vert A \vert = \operatorname* { m a x } _ { I _ { i } \in { \mathcal { T } } } \left. A ( I _ { i } ) \right.$ . In practice, we can use the neural network to track $\hat { R } _ { i } ^ { t } ( a | I _ { i } ) = R _ { i } ^ { t } ( a | I _ { i } ) / \sqrt { t }$ , and update it by
113
+
114
+ $$
115
+ \hat { R } _ { i } ^ { t } ( a | I _ { i } ) = \frac { \sqrt { t - 1 } \hat { R } _ { i } ^ { t - 1 } ( a | I _ { i } ) } { \sqrt { t } } + \frac { r _ { i } ^ { \sigma ^ { t } } ( a | I _ { i } ) } { \sqrt { t } } , \mathrm { ~ w h e r e ~ } \hat { R } _ { i } ^ { 0 } ( a | I _ { i } ) = 0 .
116
+ $$
117
+
118
+ Remark 3: The optimization problem for the double neural networks is different from that in DQN (Mnih et al., 2015). In DQN, the Q-value for the greedy action is used in the update, while in our setting, we do not use greedy actions. Algorithm E gives further details on how to optimize the objectives in Eq. (7) and Eq. (8).
119
+
120
+ Relation between CFR, MCCFR and our double neural method. As shown in Figure 1, these three methods are based on the CFR framework. The CFR computes counterfactual value and regret by traversing the entire tree in each iteration, which makes it computationally intensive to be applied to large games directly. MCCFR samples a subset of information sets and will need less computation than CFR in each iteration. However, both CFR and MCCFR need two large tabular memories to save the cumulative regrets and the numerators of the average strategy for all information sets, which prevents these two methods to be used in large games directly. The proposed neural method keeps the benefit of MCCFR yet without the need for two large tabular memories.
121
+
122
+ # 3.2 RECURRENT NEURAL NETWORK REPRESENTATION FOR INFORMATION SET
123
+
124
+ In order to define our $\mathcal { R }$ and $s$ network, we need to represent the information set $I _ { i } ~ \in ~ \mathcal { T }$ in extensive-form games. In such games, players take action in alternating fashion and each player makes a decision according to the observed history. Because the action sequences vary in length, in this paper, we model them with a recurrent neural network and each action in the sequence corresponds to a cell in RNN. This architecture is different from the one in DeepStack (Moravcik et al., 2017), which used a fully connected deep neural network to estimate counterfactual value. Figure 2 (A) provides an illustration of the proposed deep sequential neural network representation for information sets. Besides the vanilla RNN, there are several variants of more expressive RNNs, such as the GRU (Cho et al., 2014) and LSTM (Hochreiter & Schmidhuber, 1997). In our later experiments, we will compare these different neural architectures as well as a fully connected network representation.
125
+
126
+ ![](images/a87aa39619199022149e3da013cad7ccf70e7a8294277e6ea9144e66d377597e.jpg)
127
+ Figure 2: (A) the key architecture of the sequential neural networks. (B) an overview of the novel double neural counterfactual regret minimization method.
128
+
129
+ Furthermore, different position in the sequence may contribute differently to the decision making, we will add an attention mechanism (Desimone & Duncan, 1995; Cho et al., 2015) to the RNN architecture to enhance the representation. For example, the player may need to take a more aggressive strategy after beneficial public cards are revealed. Thus the information, after the public cards are revealed may be more important. In practice, we find that the attention mechanism can help the double neural CFR obtain a better convergence rate. In section D, we will provide more details on neural network architectures.
130
+
131
+ # 3.3 CONTINUAL IMPROVEMENT
132
+
133
+ With the proposed framework of double neural CFR, it is easy to initialize the neural networks from an existing strategy profile based on the tabular representation or neural representation. For information set $I _ { i }$ and action $a$ , in an existing strategy profile, define $R _ { i } ^ { \prime } ( a | I _ { i } )$ as the cumulative regret and $\boldsymbol { S } ^ { ' } ( \boldsymbol { a } | I _ { i } )$ as the cumulative numerator of average strategy. We can clone the cumulative regret for all information sets and actions by optimizing
134
+
135
+ $$
136
+ \theta _ { \mathcal { R } } ^ { * } \underset { \theta _ { \mathcal { R } } } { } \underset { i \in N , I _ { i } \in \mathcal { T } _ { i } , a \in A ( I _ { i } ) } { \sum } \Bigg ( \mathcal { R } ( a , I _ { i } | \theta _ { \mathcal { R } } ) - R ^ { ' } ( a | I _ { i } ) \Bigg ) ^ { 2 } .
137
+ $$
138
+
139
+ Similarly, the parameters $\theta _ { S } ^ { * }$ for cloning the cumulative numerator of average strategy can be optimized in the same way. Based on the learned $\theta _ { \mathcal { R } } ^ { * }$ and $\theta _ { S } ^ { * }$ , we can warm start the double neural networks and continually improve beyond the tabular strategy profile.
140
+
141
+ Remark: In the large extensive game, the initial strategy is obtained from an abstracted game which has a manageable number of information sets. The abstracted game is generated by domain knowledge, such as clustering similar hand strength cards into the same buckets. Once the strategy of this abstract game is solved, it can be clone according to Eq. (10) and improved continuously using our double neural CFR framework.
142
+
143
+ # 3.4 OVERALL ALGORITHM
144
+
145
+ Algorithm 1 provides a summary of the proposed double neural counterfactual regret minimization algorithm. In the first iteration, if the system warm starts from tabular based CFR or MCCFR methods, the techniques in section 3.3 will be used to clone the cumulative regrets and strategy. If there is no warm start initialization, we can start our algorithm by randomly initializing the parameters in RSN and ASN at iteration $ { \boldsymbol { t } } \ = \ 1$ . Then sampling methods will return the counterfactual regret and the numerator of average strategy for the sampled information sets in this iteration, and they will be saved in memories $\mathcal { M } _ { \mathcal { R } }$ and $\mathcal { M } _ { \mathcal { S } }$ respectively. Then these samples will be used by the NeuralAgent algorithm from Algorithm 2 to optimize RSN and ASN. Further details for the sampling methods and the NeuralAgent fitting algorithm will be discussed in the next section.
146
+
147
+ # Algorithm 1: Counterfactual Regret Minimization with Two Deep Neural Networks
148
+
149
+ 1 Function Agent $( T , b )$ :
150
+ 2 For $t = 1$ to $T$ do
151
+ 3 if $t = 1$ and using warm starting then
152
+ 4 initialize $\theta _ { \mathcal { R } } ^ { t }$ and $\theta _ { S } ^ { t }$ from an existing checkpoint
153
+ 5 $t \gets t + 1$ . skip cold starting
154
+ 6 else
155
+ 7 initialize $\theta _ { \mathcal { R } } ^ { t }$ and $\theta _ { S } ^ { t }$ randomly.
156
+ 8 $\dot { \mathcal { M } } _ { \mathcal { R } } , \mathcal { M } _ { S } \gets$ sampling methods for CFV and average strategy. . such as Algorithm3
157
+ 9 sum aggregate the value in $\mathcal { M } _ { R }$ by information set. . according to the Lemma 5 and Equation 12
158
+ 10 remove duplicated records in $\mathcal { M } _ { S }$ .
159
+ 11 $\theta _ { \mathcal { R } } ^ { t } \gets \mathrm { N e u r a l A g e n t } ( \mathcal { R } ( \cdot | \theta _ { \mathcal { R } } ^ { t - 1 } ) , \mathcal { M } _ { R } , \theta _ { \mathcal { R } } ^ { t - 1 } , \beta _ { \mathcal { R } } ^ { * } )$ . update $\boldsymbol { \theta } _ { \mathcal { R } } ^ { t }$ using Algorithm2
160
+ 12 $\mathsf { \Pi } _ { \mathsf { C } } \theta _ { S } ^ { t } \gets \mathrm { N e u r a l A g e n t } ( S ( \cdot | \theta _ { S } ^ { t - 1 } ) , \mathcal { M } _ { S } , \theta _ { S } ^ { t - 1 } , \beta _ { S } ^ { * } )$ . update $\theta _ { S } ^ { t }$ using Algorithm2
161
+ 13 return θtR, θtS
162
+
163
+ # 4 EFFICIENT TRAINING
164
+
165
+ In this section, we will propose two techniques to improve the efficiency of the double neural method. These techniques can also be used separately in other CFR-based methods.
166
+
167
+ # 4.1 ROBUST SAMPLING TECHNIQUES
168
+
169
+ In this paper, we proposed a new robust sampling technique which has lower variance than outcome sampling, while being more memory efficient than the external sampling. In this robust sampling method, the sampling profile is defined as $\sigma ^ { r s ( k ) } = ( \sigma _ { i } ^ { r s ( k ) } , \sigma _ { - i } )$ , where player $i$ will randomly select player actions according to sampling strategy will randomly select one action according $\sigma _ { i } ^ { r s ( k ) } ( I _ { i } )$ y each information set . $I _ { i }$ and other $\sigma _ { - i }$
170
+
171
+ Specifically, if player $i$ randomly selects $m i n ( k , | A ( I _ { i } ) | )$ actions according to discrete uniform distribution uni $f ( 0 , \left| A ( I _ { i } ) \right| )$ at information set $I _ { i }$ , i.e., $\begin{array} { r } { \sigma _ { i } ^ { r s ( k ) } ( a | I _ { i } ) = \frac { m i n ( k , | A ( I _ { i } ) | ) } { | A ( I _ { i } ) | } } \end{array}$ min(k,|A(Ii)|) , then
172
+
173
+ $$
174
+ \pi _ { i } ^ { \sigma ^ { r s ( k ) } } ( I _ { i } ) = \prod _ { \substack { h \in I _ { i } , h ^ { \prime } \subseteq h , h ^ { \prime } a \subseteq h , h ^ { \prime } \in I _ { i } ^ { \prime } } } \frac { m i n ( k , | A ( I _ { i } ^ { \prime } ) | ) } { | A ( I _ { i } ^ { \prime } ) | }
175
+ $$
176
+
177
+ and the weighted utility $u _ { i } ^ { r s ( k ) } ( z )$ will be a constant number in each iteration, which has a low variance. In addition, because the weighted utility no longer requires explicit knowledge of the opponent’s strategy, we can use this sampling method for online regret minimization. For simplicity, $k = m a x$ refers to $k = m a x _ { I _ { i } \in \mathcal { T } } | A ( I _ { i } ) |$ in the following sections.
178
+
179
+ Lemma 3: If $k = m a x$ and $\forall i \in N , \forall I _ { i } \in \mathbb { Z } _ { i } , \forall a \in A ( I _ { i } ) , \sigma _ { i } ^ { r s ( k ) } ( a | I _ { i } ) \sim u n i f ( 0 , | A ( I _ { i } ) | ) .$ , then robust sampling is the same as external sampling.
180
+
181
+ Lemma 4: If $k = 1$ and $\sigma _ { i } ^ { r s ( k ) } = \sigma _ { i }$ , then robust sampling is the same as outcome sampling.
182
+
183
+ Lemma 3 and Lemma 4 provide the relationship between outcome sampling, external sampling, and the proposed robust sampling algorithm. The detailed theoretical analysis are presented in Appendix G.2.
184
+
185
+ # 4.2 MINI-BATCH TECHNIQUES
186
+
187
+ Mini-batch MCCFR: Traditional outcome sampling and external sampling only sample one block in an iteration and provide an unbiased estimator of origin CFV according to Lemma 2. In this paper, we present a mini-batch Monte Carlo technique and randomly sample $b$ blocks in one iteration. Let $Q ^ { j }$ denote a block of terminals sampled according to the scheme in section 4.1 at $j$ −th time, then mini-batch CFV with $b$ mini-batches for information set $I _ { i }$ can be defined as
188
+
189
+ $$
190
+ \tilde { v } _ { i } ^ { \sigma } ( I _ { i } | b ) = \frac { 1 } { b } \sum _ { j = 1 } ^ { b } \left( \sum _ { h \in I _ { i } , z \in Q ^ { j } , h \subseteq z } \frac { \pi _ { - i } ^ { \sigma } ( z ) \pi _ { i } ^ { \sigma } ( h , z ) u _ { i } ( z ) } { q ( z ) } \right) = \sum _ { j = 1 } ^ { b } \frac { \tilde { v } _ { i } ^ { \sigma } ( I _ { i } | Q ^ { j } ) } { b } .
191
+ $$
192
+
193
+ Furthermore, we can show that $\tilde { v } _ { i } ^ { \sigma } ( I _ { i } | b )$ is an unbiased estimator of the counterfactual value of $I _ { i }$ : Lemma 5: $E _ { Q ^ { j } \sim \mathrm { R o b u s t \ : S a m p l i n g } } [ \tilde { v } _ { i } ^ { \sigma } ( I _ { i } | b ) ] = v _ { i } ^ { \sigma } ( I _ { i } )$ . (see the proof in section G.3) Similarly, the cumulative mini-batch regret of action $a$ is
194
+
195
+ $$
196
+ \tilde { R } _ { i } ^ { T } ( ( a | I _ { i } ) | b ) = \tilde { R } _ { i } ^ { T - 1 } ( ( a | I _ { i } ) | b ) + \tilde { v } _ { i } ^ { \sigma ^ { T } } ( ( a | I _ { i } ) | b ) - \tilde { v } _ { i } ^ { \sigma ^ { T } } ( I _ { i } | b )
197
+ $$
198
+
199
+ where $\tilde { R } _ { i } ^ { 0 } ( ( a | I _ { i } ) | b ) = 0$ . In practice, mini-batch technique can sample $b$ blocks in parallel and help MCCFR to converge faster.
200
+
201
+ Mini-Batch $\mathbf { M C C F R + }$ : When optimizing counterfactual regret, $\mathrm { C F R + }$ (Tammelin, 2014) substitutes the regret-matching algorithm (Hart & Mas-Colell, 2000) with regret-matching $^ +$ and can converge faster than CFR. However, Burch (2017) showed that ${ \mathrm { M C C F R } } +$ actually converge slower than MCCFR when mini-batch is not used. In our paper, we derive mini-batch version of MCCFR $^ +$ which updates cumulative mini-batch regret $\tilde { R } ^ { T , + } ( ( a | I _ { i } ) | b )$ up to iteration $T$ by
202
+
203
+ $$
204
+ \begin{array} { r } { \tilde { R } ^ { T , + } ( ( a | I _ { i } ) | b ) = \left\{ \begin{array} { l l } { \big ( \tilde { v } _ { i } ^ { \sigma ^ { T } } ( ( a | I _ { i } ) | b ) - \tilde { v } _ { i } ^ { \sigma ^ { T } } ( I _ { i } | b ) \big ) ^ { + } } & { \mathrm { i f } T = 0 } \\ { \big ( \tilde { R } _ { i } ^ { T - 1 , + } ( ( a | I _ { i } ) | b ) + \tilde { v } _ { i } ^ { \sigma ^ { T } } ( ( a | I _ { i } ) | b ) - \tilde { v } _ { i } ^ { \sigma ^ { T } } ( I _ { i } | b ) \big ) ^ { + } } & { \mathrm { i f } T > 0 } \end{array} \right. , } \end{array}
205
+ $$
206
+
207
+ where $( x ) ^ { + } = m a x ( x , 0 )$ . In practice, we find that mini-batch ${ \mathrm { M C C F R } } +$ converges faster than mini-batch MCCFR when specifying a suitable mini-batch size.
208
+
209
+ # 5 EXPERIMENT
210
+
211
+ The proposed double neural CFR algorithm will be evaluated in the One-Card-Poker game with 5 cards and a large No-Limit Leduc Hold’em (NLLH) with stack size 5, 10, and 15. The largest NLLH in our experiment has over $2 \times 1 0 ^ { 7 }$ states and $3 . 7 \times 1 0 ^ { 6 }$ information sets. We will compare it with tabular CFR and deep reinforcement learning based method such as NFSP. The experiments show that the proposed double neural algorithm can converge to comparable results produced by its tabular counterpart while performing much better than deep reinforcement learning method. With the help of neural networks, our method has a strong generalization ability to converge to an approximate Nash equilibrium by using fewer parameters than the number of information sets. The current results open up the possibility for a purely neural approach to directly solve large IIG. Due to space limit, we present experimental results for One-Card-Poker and the analysis in section C. The hyperparameters and setting about the neural networks can be found in section E.
212
+
213
+ Settings. To simplify the expression, the abbreviations of different methods are defined as follows. XFP refers to the full-width extensive-form fictitious play method. NFSP refers to the reinforcement learning based fictitious self-play method. RS-MCCFR refers to the proposed robust sampling MCCFR. This method with regret matching+ acceleration technique is denoted by $\mathbf { R S - M C C F R + }$ . These methods only containing one neural network are denoted by $\mathbf { R S - M C C F R + - R S N }$ and RS-MCCFR $^ +$ -ASN respectively. RS-MCCFR $^ +$ -RSN-ASN refers to the proposed double neural MCCFR. According to Lemma 3, if $k = m a x$ , ES-MCCFR is the same with RS-MCCFR. More specifically, we investigated the following questions.
214
+
215
+ Is mini-batch sampling helpful? Figure 3(A) presents the convergence curves of the proposed robust sampling method with $k = m a x$ under different mini-batch sizes $\scriptstyle \mathbf { b } = 1$ , 1000, 5000, 10000 respectively). The experimental results show that larger batch sizes generally lead to better strategy profiles. Furthermore, the convergence for $b = 5 0 0 0$ is as good as $b = 1 0 0 0 0$ . Thus in the later experiments, we set the mini-batch size equal to 5000.
216
+
217
+ Is robust sampling helpful? Figure 3 (B) and (C) presents convergence curves for outcome sampling, external sampling $ { k } = \ m a x ,$ ) and the proposed robust sampling method under the different number of sampled actions. The outcome sampling cannot converge to a low exploitability smaller than 0.1 after 1000 iterations The proposed robust sampling algorithm with $k = 1$ , which only samples one trajectory like the outcome sampling, can achieve a better strategy profile after the same number of iterations. With an increasing $k$ , the robust sampling method achieves an even better convergence rate. Experiment results show $k = 3$ and 5 have a similar trend with $k = m a x$ , which demonstrates that the proposed robust sampling achieves similar strategy profile but requires less memory than the external sampling. We choose $k = 3$ for the later experiments in Leduc Hold’em Poker. Figure 3 (C) presents the results in a different way and displays the relation between exploitability and the cumulative number of touched nodes. The robust sampling with small $k$ is just as good as the external sampling while being more memory efficient on the condition that each algorithm touches the same number of nodes.
218
+
219
+ ![](images/4045b089d201f5e8d882ec7c4c42356a8678b0d4fa0cb084a0de16dc2556e69d.jpg)
220
+ Figure 3: Comparison of different CFR-family methods in Leduc Hold’em. (A) Performance of robust sampling with different batch size. (B) Performance of robust sampling with different parameter $k$ by iteration. (C) Performance by the number of touched node.
221
+
222
+ ![](images/ecb77d608bb71a775aaa8e16fe9b03508cfe43ba39750e4fc2967e6a14d3bcaa.jpg)
223
+ Figure 4: Performance of different methods in Leduc Hold’em. (A) comparison of NSFP, XFP and the proposed double neural method. (B) each contribution of RSN and ASN. (C) continue improvement from tabular based CFR and ${ \mathrm { R S - M C C F R + } }$ .
224
+
225
+ How does double neural CRF compare to the tabular counterpart, XFP, and NFSP? To obtain an approximation of Nash equilibrium, Figure 4(A) demonstrates that NFSP needs $1 0 ^ { 6 }$ iterations to reach a 0.06-Nash equilibrium, and requires $2 \times 1 0 ^ { 5 }$ state-action pair samples and $2 \times 1 0 ^ { 6 }$ samples for supervised learning respectively. The XFP needs $1 0 ^ { 3 }$ iterations to obtain the same exploitability, however, this method is the precursor of NFSP and updated by a tabular based full-width fictitious play. Our proposed neural method only needs 200 iterations to achieve the same performance which shows that the proposed double neural algorithm converges significantly better than the reinforcement learning counterpart. In practice, our double neural method can achieve an exploitability of 0.02 after 1000 iterations, which is similar to the tabular method.
226
+
227
+ What is the individual effect of RSN and ASN? Figure 4(B) presents ablation study of the effects of RSN and ASN network respectively. Both MCCFR $^ +$ -RSN and $\mathbf { M C C F R + - A }$ SN, which only employ one neural network, perform only slightly better than the double neural method. All the proposed neural methods can match the performance of the tabular based method.
228
+
229
+ How well does continual improvement work? In practice, we usually want to continually improve our strategy profile from an existing checkpoint (Brown & Sandholm, 2016). In the framework of the proposed neural counterfactual regret minimization algorithm, warm starting is easy and friendly. Firstly, we employ two neural networks to clone the existing tabular based cumulative regret and the numerator of average strategy by optimizing Eq. (10). Then the double neural methods can continually improve the tabular based methods. As shown in Figure 4(C), warm start from either full-width based or sampling based CFR the existing can lead to continual improvements. Specifically, the first 10 iterations are learned by tabular based CFR and ${ \mathrm { R S - M C C F R + } }$ . The remaining iterations are continually improved by the double neural method, where $b = 5 0 0 0 , k =$ max.
230
+
231
+ ![](images/bcf24e34580fd0c6453d666790442ef51eae0b02c9104594e383c44c0dcbf075.jpg)
232
+ Figure 5: Performance analysis from different perspectives: (A) Generalization: by observed nodes. (B) Compression: by embedding size. (C) Large Game: by game size. (D) Architecture: by attention or not.
233
+
234
+ Do the neural networks generalize to unseen information sets? To investigate the generalization ability, we perform the neural CFR with small mini-batch sizes $( \mathtt { b } \mathtt { = } 5 0$ , 100, 500), where only $3 . 0 8 \%$ , $5 . 5 9 \%$ , and $1 3 . 0 6 \%$ information sets are observed in each iteration. In all these settings, the double neural can still converge and arrive at exploitability less than 0.1 within only 1000 iterations (Figure 5(A)).
235
+
236
+ Do the neural networks just memorize but not generalize? One indication that the neural networks are generalizing is that they use much fewer parameters than their tabular counterparts. We experimented with LSTM plus attention networks, and embedding size of 8 and 16 respectively. These architectures contain 1048 and 2608 parameters respectively in NLLH(5), both of which are much less than the tabular memory (more than $1 0 ^ { 4 }$ number here). Note that both these two embedding sizes still leads to a converging strategy profile as shown in Figure 5(B).
237
+
238
+ Does neural method converge in the larger game? Figure 5(C) presents the log-log convergence curve of NLLH with different stack size (5, 10 and 15 respectively). The largest game size contains over $2 \times 1 0 ^ { 7 }$ states and $3 . 7 \times 1 0 ^ { 6 }$ information sets. Let mini-batch size be 500, there are $1 3 . 0 6 \%$ , $2 . 3 9 \%$ and $0 . 5 3 \%$ information sets that are observed respectively in each iteration. Even though only a small subset of nodes are sampled, the double neural method can still converge.
239
+
240
+ Is attention in the neural architecture helpful? Figure 5(D) presents the convergence curves of several different deep neural architectures, such as a fully connected deep neural network(FC), LSTM, LSTM plus attention, original RNN plus attention, and GRU plus attention. The recurrent neural network plus attention helps us obtain better strategies rate than other architectures after hundreds of iterations.
241
+
242
+ # 6 CONCLUSION AND FUTURE WORK
243
+
244
+ In this paper, we present a novel double neural counterfactual regret minimization method to solve large imperfect information game, which has a strong generalization and compression ability and can match the performance of tabular based CFR approach. We also developed a new sampling technique which has lower variance than the outcome sampling, while being more memory efficient than the external sampling. In the future, we plan to explore much more flexible methods and apply the double neural method to larger games, such as No-Limit Texas Hold’em.
245
+
246
+ # REFERENCES
247
+
248
+ Noam Brown and Tuomas Sandholm. Strategy-based warm starting for regret minimization in games. pp. 432–438. AAAI, 2016.
249
+
250
+ Noam Brown and Tuomas Sandholm. Superhuman ai for heads-up no-limit poker: Libratus beats top professionals. Science, pp. eaao1733, 2017.
251
+
252
+ Neil Burch. Time and space: Why imperfect information games are hard. PhD thesis, 2017.
253
+
254
+ Kyunghyun Cho, Bart Van Merrienboer, Caglar Gulcehre, Dzmitry Bahdanau, Fethi Bougares, ¨ Holger Schwenk, and Yoshua Bengio. Learning phrase representations using rnn encoder-decoder for statistical machine translation. arXiv preprint arXiv:1406.1078, 2014.
255
+
256
+ Kyunghyun Cho, Aaron Courville, and Yoshua Bengio. Describing multimedia content using attention-based encoderdecoder networks. arXiv preprint arXiv:1507.01053, 2015.
257
+
258
+ Robert Desimone and John Duncan. Neural mechanisms of selective visual attention. Number 18, pp. 193–222. Annual review of neuroscience, 1995.
259
+
260
+ Geoffrey J. Gordon. No-regret algorithms for structured prediction problems. Number CMU-CALD-05-112. CARNEGIE-MELLON UNIV PITTSBURGH PA SCHOOL OF COMPUTER SCIENCE, 2005.
261
+
262
+ David Harris and Sarah Harris. Digital design and computer architecture (2nd ed.), volume ISBN 978-0-12-394424-5. San Francisco, Calif.: Morgan Kaufmann.
263
+
264
+ Sergiu Hart and Andreu Mas-Colell. A simple adaptive procedure leading to correlated equilibrium. Econometrica, (65(5)):1127–1150, 2000.
265
+
266
+ Johannes Heinrich and David Silver. Deep reinforcement learning from self-play in imperfect-information games. arXiv preprint arXiv:1603.01121, 2016.
267
+
268
+ Johannes Heinrich, Marc Lanctot, and David Silver. Fictitious self-play in extensive-form games. pp. 805–813. International Conference on Machine Learning, 2015.
269
+
270
+ Sepp Hochreiter and Jrgen Schmidhuber. Long short-term memory. Number 8, pp. 1735–1780. Neural computation, 1997.
271
+
272
+ Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
273
+
274
+ Marc Lanctot, Waugh Kevin, Zinkevich Martin, and Michael Bowling. Monte carlo sampling for regret minimization in extensive games. In Advances in neural information processing systems, 2009.
275
+
276
+ Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Andrei A Rusu, Joel Veness, Marc G Bellemare, Alex Graves, Martin Riedmiller, Andreas K Fidjeland, Georg Ostrovski, et al. Human-level control through deep reinforcement learning. Nature, 518(7540):529, 2015.
277
+
278
+ Matej Moravcik, Schmid Martin, Burch Neil, Lis Viliam, Dustin Morrill, Nolan Bard, Trevor Davis, Kevin Waugh, Michael Johanson, and Michael Bowling. Deepstack: Expert-level artificial intelligence in heads-up no-limit poker. Science, (6337):508–513, 2017.
279
+
280
+ Martin J. Osborne and Rubinstein Ariel. A course in game theory, volume 1. MIT Press, 1994.
281
+
282
+ Sebastian Ruder. An overview of gradient descent optimization algorithms. arXiv preprint arXiv:1609.04747, 2017.
283
+
284
+ Finnegan Southey, Michael P. Bowling, Bryce Larson, Carmelo Piccione, Neil Burch, Darse Billings, and Chris Rayner. Bayes’ bluff: Opponent modelling in poker. arXiv preprint arXiv:1207.1411, 2012.
285
+
286
+ Oskari Tammelin. Solving large imperfect information games using cfr+. arXiv preprint, 2014.
287
+
288
+ Kevin Waugh, Dustin Morrill, James Andrew Bagnell, and Michael Bowling. Solving games with functional regret estimation. In AAAI, volume 15, pp. 2138–2144, 2015.
289
+
290
+ Martin Zinkevich, Johanson Michael, Bowling Michael, and Carmelo Piccione. Regret minimization in games with incomplete information. Advances in neural information processing systems, 2007.
291
+
292
+ # APPENDIX A GAME RULES
293
+
294
+ Leduc Hold’em a two-players IIG of poker, which was first introduced in (Southey et al., 2012). In Leduc Hold’em, there is a deck of 6 cards comprising two suits of three ranks. The cards are often denoted by king, queen, and jack. In No-Limit Leduc Hold’em(NLLH), the player may wager any amount of chips up to a maximum of that player’s remaining stack. There is also no limit on the number of raises or bets in each betting round. There are two rounds. In the first betting round, each player is dealt one card from a deck of 6 cards. In the second betting round, a community (or public) card is revealed from a deck of the remaining 4 cards. In this paper, we use NLLH(x) refer to the No-Limit Leduc Hold’em, whose stack size is $x$ .
295
+
296
+ One-Card Poker is a two-players IIG of poker described by (Gordon, 2005). The game rules are defined as follows. Each player is dealt one card from a deck of $X$ cards. The first player can pass or bet, If the first player bet, the second player can call or fold. If the first player pass, the second player can pass or bet. If second player bet, the first player can fold or call. The game ends with two pass, call, fold. The fold player will lose 1 chips. If the game ended with two passes, the player with higher card win 1 chips, If the game end with call, the player with higher card win 2 chips.
297
+
298
+ ![](images/2ba244e9a04f20f8b13b20832920481e8e0cf6e582642b16a83b4de8740b66a5.jpg)
299
+ APPENDIX B DEFINITION OF EXTENSIVE-FORM GAMES
300
+ Figure 6: Illustration of extensive-form game. The left and right denote two different kinds of dealt private cards. We use same color other than gray for each state in the same information set. F, C, P, B refer to fold, call, pass, bet respectively.
301
+
302
+ # B.1 ADDITIONAL DEFINITIONS
303
+
304
+ For player $i$ , the expected game utility $\begin{array} { r } { u _ { i } ^ { \sigma } = \sum _ { z \in Z } \pi ^ { \sigma } ( z ) u _ { i } ( z ) } \end{array}$ of $\sigma$ is the expected payoff of all possible terminal nodes. Given a fixed strategy profile $\sigma _ { - i }$ , any strategy $\sigma _ { i } ^ { * } = \operatorname* { m a x } _ { \sigma _ { i } ^ { \prime } \in \Sigma _ { i } } u _ { i } ^ { ( \sigma _ { i } ^ { \prime } , \sigma _ { - i } ) }$ of player that achieves maximize payoff against $\pi _ { - i } ^ { \sigma }$ is a best response. For two players’ extensive-form games, a Nash equilibrium is a strategy profile $\sigma ^ { * } ~ = ~ ( \sigma _ { 0 } ^ { * } , \sigma _ { 1 } ^ { * } )$ such that each player’s strategy is a best response to the opponent. An $\epsilon$ -Nash equilibrium is an approximation of a Nash equilibrium, whose strategy profile $\sigma ^ { * }$ satisfies: $\forall i \in N$ , $\begin{array} { r } { \bar { u } _ { i } ^ { \sigma _ { i } ^ { * } } + \epsilon \geq \operatorname* { m a x } _ { \sigma _ { i } ^ { \prime } \in \Sigma _ { i } } u _ { i } ^ { ( \sigma _ { i } ^ { \prime } , \sigma _ { - i } ) } } \end{array}$ . Exploitability of a strategy $\sigma _ { i }$ is defined as $\epsilon _ { i } ( \sigma _ { i } ) = u _ { i } ^ { \sigma ^ { * } } - u _ { i } ^ { ( \sigma _ { i } , \sigma _ { - i } ^ { * } ) }$ u(σi,σ∗−i)i . A strategy is unexploitable if $\epsilon _ { i } ( \sigma _ { i } ) = 0$ . In large two player zero-sum games such poker, $u _ { i } ^ { \sigma ^ { * } }$ is intractable to compute. However, if the players alternate their positions, the value of a pair of games is zeros, i.e., $u _ { 0 } ^ { \sigma ^ { * } } + u _ { 1 } ^ { \sigma ^ { * } } = 0$ . We define the exploitability of strategy profile $\sigma$ as $\epsilon ( \bar { \sigma } ) = ( \bar { u _ { 1 } ^ { ( \sigma _ { 0 } , \sigma _ { 1 } ^ { * } ) } } + u _ { 0 } ^ { ( \sigma _ { 0 } ^ { * } , \sigma _ { 1 } ) } ) / 2$
305
+
306
+ # B.2 EXPLANATION BY EXAMPLE
307
+
308
+ To provide a more detailed explanation, Figure 6 presents an illustration of a partial game tree in One-Card Poker. In the first tree, two players are dealt (queen, jack) as shown in the left subtree and (queen, king) as shown in the right subtree. $z _ { i }$ denotes terminal node and $h _ { i }$ denotes non-terminal node. There are 19 distinct nodes, corresponding 9 non-terminal nodes including chance $h _ { 0 }$ and 10 terminal nodes in the left tree. The trajectory from the root to each node is a history of actions. In an extensive-form game, $h _ { i }$ refers to this history. For example, $h _ { 3 }$ consists of actions 0:Q, 1:J and P.
309
+
310
+ $h _ { 7 }$ consists of actions 0:Q, 1:J, P and B. $h _ { 8 }$ consists of actions 0:Q, 1:K, P and B. We have $h _ { 3 } \subseteq h _ { 7 }$ , $A ( h _ { 7 } ) = \{ { \bf P } , { \bf B } \}$ and $P ( h _ { 3 } ) = 1$
311
+
312
+ In IIG, the private card of player 1 is invisible to player 0, therefore $h _ { 7 }$ and $h _ { 8 }$ are actually the same for player 0. We use information set to denote the set of these undistinguished states. Similarly, $h _ { 1 }$ and $h _ { 2 }$ are in the same information set. For the right tree of Figure 6, $h _ { 3 } ^ { \prime }$ and $h _ { 5 } ^ { \prime }$ are in the same information set. $h _ { 4 } ^ { \prime }$ and $h _ { 6 } ^ { \prime }$ are in the same information set.
313
+
314
+ Generally, any $I _ { i } \in \mathcal { Z }$ could only remember the information observed by player $i$ including player $i ^ { \prime } s$ hidden variable and public actions. For example, the information set of $h _ { 7 }$ and $h _ { 8 }$ indicates a sequence of 0:Q, P, and B. Because $h _ { 7 }$ and $h _ { 8 }$ are undistinguished by player 0 in IIG, all the states have a same strategy. For example, $I _ { 0 }$ is the information set of $h _ { 7 }$ and $h _ { 8 }$ , we have $I _ { 0 } = I _ { 0 } ( h _ { 7 } ) =$ $I _ { 0 } ( h _ { 8 } ) , \sigma _ { 0 } ( I _ { 0 } ) = \sigma _ { 0 } ( h _ { 7 } ) = \sigma _ { 0 } ( h _ { 8 } )$ , $\sigma _ { 0 } ( a | I _ { 0 } ) = \sigma _ { 0 } ( a | h _ { 7 } ) = \sigma _ { 0 } ( a | h _ { 8 } )$ .
315
+
316
+ # APPENDIX C ADDITIONAL EXPERIMENT DETAILS
317
+
318
+ # C.1 FEATURE ENCODING OF POKER GAMES
319
+
320
+ The feature is encoded as following. As shown in the figure 2 (A), for a history $h$ and player $P ( h )$ , we use one-hot encoding (Harris & Harris) to represent the observed actions including chance player. For example, the input feature $x _ { l }$ for $l$ -th cell is the concatenation of three one-hot features including the given private cards, the revealed public cards and current action $a$ . Both the private cards and public cards are encoded by one-hot technique, where the value in the existing position is 1 and the others are 0. If there are no public cards, the respective position will be filled with 0. Because the action taking by chance is also a cell in the proposed sequential model. Thus in a No-Limit poker, such as Leduc Hold’em, action $a$ could be any element in $\{$ {fold, cumulative spent $\}$ {public cards} , where cumulative spent denotes the total chips after making a call or raise. The length of the encoding vector of action $a$ is the quantities of public cards plus 2, where cumulative spent is normalized by the stack size.
321
+
322
+ # C.2 ADDITIONAL EXPERIMENT RESULTS
323
+
324
+ ![](images/9f2ed4259ee6c4db9d142fe13cb8344830768ceecd8e45cdf80e7e70412d94ac.jpg)
325
+ Figure 7: Comparison of different CFR-family methods and neural network methods in One-Card-Poker. (A) Comparison of the robust sampling with different mini-batch size. (B) Comparison of the outcome sampling and the robust sampling with different sample actions k. (C) Comparison of tabular based RS-MCCFR $^ +$ and the double neural method.
326
+
327
+ Figure 7 (A) presents the convergence rate for the proposed robust sampling method of different mini-batch size $b = ( 1 , 1 0 0 , 5 0 0 ^ { - } , 1 0 0 0 )$ . The experimental results are similar to Leduc Hold’em poker, larger mini-batch size indicates a better exploitability.
328
+
329
+ Figure 7 (B) demonstrates that the convergence rate for different sampling methods including outcome sampling and robust sampling under $k \ = \ 1 , 2$ . The conclusion is that RS-MCCFR $^ +$ converges significantly faster than ${ \mathrm { O S - M C C F R + } }$ after touching the same number of nodes. Experiment results show that $k = 1$ has a similar trend with $k = 2$ (external sampling). Because only one trajectory is sampled, the proposed RS-MCCFR $^ +$ will require less memory than the external sampling.
330
+
331
+ Figure 7 (C) compares the performance between the tabular method and the double neural method. Experimental results demonstrate that RS-MCCFR $+ \cdot$ -RSN-ASN can achieve an exploitability of less than 0.0004 in One-Card Poker, which matches the performance of the tabular method. For RSN and ASN, we set neural batch size 4, hidden size 32 and learning rate 0.001.
332
+
333
+ # APPENDIX D DETAILS OF RECURRENT NEURAL NETWORK
334
+
335
+ In order to define our $\mathcal { R }$ and $s$ network, we need to represent the information set $I _ { i } ~ \in ~ \mathcal { T }$ in extensive-form games. In such games, players take action in alternating fashion and each player makes a decision according to the observed history. In this paper, we model the behavior sequence as a recurrent neural network and each action in the sequence corresponds to a cell in RNN. Figure 2 (A) provides an illustration of the proposed deep sequential neural network representation for information sets.
336
+
337
+ In standard RNN, the recurrent cell will have a very simple structure, such as a single tanh or sigmoid layer. Hochreiter & Schmidhuber (1997) proposed a long short-term memory method (LSTM) with the gating mechanism, which outperforms the standard version and is capable of learning long-term dependencies. Thus we will use LSTM for the representation. Furthermore, different position in the sequence may contribute differently to the decision making, we will add an attention mechanism (Desimone & Duncan, 1995; Cho et al., 2015) to the LSTM architecture to enhance the representation. For example, the player may need to take a more aggressive strategy after beneficial public cards are revealed. Thus the information, after the public cards are revealed may be more important.
338
+
339
+ More specifically, for $l$ -th cell, define $x _ { l }$ as the input vector (which can be either player or chance actions), $e _ { l }$ as the hidden layer embedding, $\phi _ { * }$ as a general nonlinear function. Each action is represented by a LSTM cell, which has the ability to remove or add information to the cell state with three different gates. Define the notation $\cdot$ as element-wise product. The first forgetting gate layer is defined as $\bar { g _ { l } ^ { f } } = \phi _ { f } ( w ^ { f } [ x _ { l } , e _ { l - 1 } ] )$ , where $[ x _ { l } , e _ { l - 1 } ]$ denotes the concatenation of $x _ { l }$ and $e _ { l - 1 }$ . The second input gate layer decides which values to update and is defined as $g _ { l } ^ { i } = \phi _ { i } ( w ^ { i } [ x _ { l } , e _ { l - 1 } ] )$ . A nonlinear layer output a vector of new candidate values $\tilde { C } _ { l } = \phi _ { c } ( w ^ { l } [ x _ { l } , e _ { l - 1 } ] )$ to decide what can be added to the state. After the forgetting gate and the input gate, the new cell state is updated by $C _ { l } = g _ { l } ^ { f } \cdot C _ { l - 1 } + g _ { l } ^ { i } \cdot \tilde { C } _ { l }$ . The third output gate is defined as $g _ { l } ^ { o } = \phi _ { o } ( w ^ { o } [ x _ { l } , e _ { l - 1 } ] )$ . Finally, the updated hidden embedding is $e _ { l } = g _ { l } ^ { o } \cdot \phi _ { e } ( C _ { l } )$ . As shown in Figure 2 (A), for each LSTM cell $j$ , the vector of attention weight is learned by an attention network. Each member in this vector is a scalar $\alpha _ { j } = \phi _ { a } ( w ^ { a } e _ { j } )$ . The attention embedding of $l$ -th cell is then defined as $\begin{array} { r } { e _ { l } ^ { a } = \sum _ { j = 1 } ^ { l } \alpha _ { j } \cdot e _ { j } } \end{array}$ , which is the summation of the hidden embedding $e _ { j }$ and the learned attention weight $\alpha _ { j }$ . The final output of the network is predicted by a value network, which is defined as
340
+
341
+ $$
342
+ \widetilde { y } _ { l } : = f ( a , I _ { i } | \theta ) = w ^ { y } \phi _ { v } ( e _ { l } ^ { a } ) = w ^ { y } \phi _ { v } \left( \sum _ { j = 1 } ^ { l } \phi _ { a } ( w ^ { a } e _ { j } ) \cdot e _ { j } \right) ,
343
+ $$
344
+
345
+ where $\theta$ is the parameters in the defined sequential neural networks. Specifically, $\phi _ { f } , \phi _ { i } , \phi _ { o }$ are sigmoid functions. $\phi _ { c }$ and $\phi _ { e }$ are hyperbolic tangent functions. $\phi _ { a }$ and $\phi _ { v }$ are rectified linear functions. The proposed RSN and ASN share the same neural architecture, but use different parameters. That is $\mathcal { R } ( a , I _ { i } \vert \theta _ { \mathcal { R } } ^ { t } ) = f ( a , I _ { i } \vert \theta _ { \mathcal { R } } ^ { t } )$ and ${ \cal S } ( a , I _ { i } \vert \theta _ { S } ^ { t } ) = f ( a , I _ { i } \vert \theta _ { S } ^ { t } )$ . $\mathcal { R } ( \cdot , I _ { i } | \theta _ { \mathcal { R } } ^ { t } )$ and $\bar { \boldsymbol { S } } ( \cdot , I _ { i } | \theta _ { S } ^ { t } )$ denote two vectors of inference value for all $a \in A ( I _ { i } )$ .
346
+
347
+ # APPENDIX E NEURAL AGENT FOR OPTIMIZING NEURAL REPRESENTATION
348
+
349
+ Define $\beta _ { e p o c h }$ as training epoch, $\beta _ { l r }$ as learning rate, $\beta _ { l o s s }$ as the criteria for early stopping, $\beta _ { r e }$ as the upper bound for the number of iterations from getting the minimal loss last time, $\theta ^ { t - 1 }$ as the parameter to optimize, $f ( \cdot | \theta ^ { t - 1 } )$ as the neural network, $\mathcal { M }$ as the training sample consisting information set and the corresponding target. To simplify notations, we use $\beta ^ { * }$ to denote the set of hyperparameters in the proposed deep neural networks. $\beta _ { \mathcal { R } } ^ { * }$ and $\beta _ { S } ^ { * }$ refer to the
350
+
351
+ # Algorithm 2: Optimization of Deep Neural Network
352
+
353
+ Function NeuralAgent(f (·|θT −1), M, θT −1, β∗):
354
+
355
+ 2 initialize optimizer, scheduler . gradient descent optimizer and learning rate scheduler
356
+ 3 θT ← θT −1, lbest ← ∞, tbest ← 0 . warm starting from the checkpoint of the last iteration
357
+ 4 For $t = 1$ to βepoch do
358
+ 5 $l o s s \gets [ ]$ . initialize loss as an empty list
359
+ 6 For each training epoch do
360
+ 7 $\{ x ^ { ( i ) } , y ^ { ( i ) } \} _ { i = 1 } ^ { m ^ { - } } \sim \mathcal { M }$ $\begin{array} { r } { b a t c h . l o s s \gets \frac { 1 } { m } \sum _ { i = 1 } ^ { m } ( f ( x ^ { ( i ) } | \theta ^ { T - 1 } ) + y ^ { ( i ) } - f ( x ^ { ( i ) } | \theta ^ { T } ) ) ^ { 2 } } \end{array}$ sampling a mini-batch from $\mathcal { M }$
361
+ 9 back propagation batch loss with learning rate $l r$
362
+ 10 clip gradient of $\theta ^ { T }$ to $[ - \epsilon , \epsilon ] ^ { d }$ . $d$ is the dimension of $\theta ^ { T }$
363
+ 11 optimizer(batch loss)
364
+ 12 $\mathit { l o s s . a p p e n d } ( \mathit { b a t c h \_ l o s s } )$
365
+ 13 $l r \gets s h e d u l e r ( l r )$ . reduce learning rate adaptively when loss has stopped improving
366
+ 14 15 if $a v g ( l o s s ) < \beta _ { l o s s }$ $\theta _ { b e s t } ^ { T } \theta ^ { T }$ theny stopping. . if loss is small enough, using early stopping mechanism.
367
+ 16 else if $\ddot { a v g } ( l o s s ) < l _ { b e s t }$ then
368
+ 17 $l _ { b e s t } = a v g ( l o s s ) , t _ { b e s t } t , \theta _ { b e s t } ^ { T } \theta ^ { T }$
369
+ 18 if $t - t _ { b e s t } > \beta _ { r e }$ then
370
+ 19 lr ← βlr . reset learning rate to escape from potential saddle point or local minima.
371
+ 20 return θT
372
+
373
+ sets of hyperparameters in RSN and ASN respectively. According to our experiments, we find a carefully designed optimization method can help us obtain a relatively higher convergence rate of exploitability. Algorithm 2 presents the details of how to optimize the proposed neural networks.
374
+
375
+ Both $\mathcal { R } ( a , I _ { i } | \theta _ { \mathcal { R } } ^ { t + 1 } )$ and ${ \cal { S } } ( a , I _ { i } | \theta _ { S } ^ { t } )$ are optimized by mini-batch stochastic gradient descent method. In this paper, we use Adam optimizer (Kingma & Ba, 2014) with both momentum and adaptive learning rate. Some other optimizers such as Nadam, RMSprop, Nadam from (Ruder, 2017) are also tried in our experiments, however, they do not achieve better experimental results. In practice, existing optimizers may not return a relatively low enough loss because of potential saddle point or local minima. To obtain a relatively higher accuracy and lower optimization loss, we use a carefully designed scheduler to reduce the learning rate when the loss has stopped decrease. Specifically, the scheduler reads a metrics quantity, e.g, mean squared error, and if no improvement is seen for a number of epochs, the learning rate is reduced by a factor. In addition, we will reset the learning rate in both optimizer and scheduler once loss stops decrease in $\beta _ { r e }$ epochs. Gradient clipping mechanism is used to limit the magnitude of the parameter gradient and make optimizer behave better in the vicinity of steep cliffs. After each epoch, the best parameter will be updated. Early stopping mechanism is used once the lowest loss is less than the specified criteria $\beta _ { l o s s }$ .
376
+
377
+ In experiments, we set the network hyperparameters as follow. For RSN, we set the hyperparameters as follows: neural batch size is 256 and learning rate $\beta _ { l r } = 0 . 0 0 1$ . A scheduler, who will reduce the learning rate based on the number of epochs and the convergence rate of loss, help the neural agent to obtain a high accuracy. The learning rate will be reduced by 0.5 when loss has stopped improving after 10 epochs. The lower bound on the learning rate of all parameters in this scheduler is $1 \bar { 0 } ^ { - 6 }$ . To avoid the algorithm converging to potential local minima or saddle point, we will reset the learning rate to 0.001 and help the optimizer to learn a better performance. $\theta _ { b e s t } ^ { T }$ is the best parameters to achieve the lowest loss after $T$ epochs. If average loss for epoch $t$ is less than the specified criteria $\beta _ { l o s s } { = } 1 0 ^ { - 4 }$ , we will early stop the optimizer. We set $\beta _ { e p o c h } = 2 0 0 0$ and update the optimizer 2000 maximum epochs. For ASN, we set the loss of early stopping criteria as $1 0 ^ { - 5 }$ . The learning rate will be reduced by 0.7 when loss has stopped improving after 15 epochs. Other hyperparameters in ASN are similar to RSN.
378
+
379
+ # APPENDIX F OPTIMIZE COUNTERFACTUAL REGRET MINIMIZATION WITH TWO DEEP NEURAL NETWORKS
380
+
381
+ # Algorithm 3: Mini-Batch RS-MCCFR with Double Neural Networks
382
+
383
+ 1 Function Mini-Batch-MCCFR-NN(t):
384
+ 2 $\mathcal { M } _ { \mathcal { R } } \emptyset$ , $\mathcal { M } _ { \mathcal { S } } \emptyset$
385
+ 3 For all $i = 1$ to $b$ do in parallel then
386
+ 4 $\mathbf { M C C F R - N N } ( t , \emptyset , 0 , 1 , 1 )$
387
+ 5 $\mathbf { M C C F R - N N } ( t , \emptyset , 1 , 1 , 1 )$
388
+ 6 return $\mathcal { M } _ { \mathcal { R } } , \mathcal { M } _ { \mathcal { S } }$
389
+ 7
390
+ 8 Function MCCFR-NN(t, h, i, πi, i πrs(k)):
391
+ 9 $I _ { i } \gets I _ { i } ( h )$ . information set at state h
392
+ 10 if $h \in Z$ then
393
+ 11 return $\frac { u _ { i } ( h ) } { \pi _ { i } ^ { r s ( k ) } }$ . return game payoff
394
+ 12 else if $P ( h ) = - 1$ then
395
+ 13 $a \sim \sigma _ { - i } ( I _ { i } )$ . Sample an action from $\sigma _ { - i } ( h )$
396
+ 14 $\mathbf { r e t u r n ~ M C C F R - N N } ( t , h a , i , \pi _ { i } , \pi _ { i } ^ { r s ( k ) } )$
397
+ 15 else if $P ( h ) = i$ then
398
+ 16 $\hat { R } _ { i } ( \cdot | I _ { i } ) \gets \mathcal { R } ( \cdot , I _ { i } | \theta _ { \mathcal { R } } ^ { t } )$ if $t > 1$ else $\vec { 0 }$ . inference the vector of cumulative regret $\forall a \in A ( I _ { i } )$
399
+ 17 $\sigma _ { i } ( I _ { i } ) \gets$ CalculateStrategy $( \hat { R } _ { i } ( \cdot | I _ { i } ) , I _ { i } )$ . calculate current strategy
400
+ 18 $v _ { i } ( h ) 0 , r _ { i } ( \cdot | I _ { i } ) \vec { 0 } , s _ { i } ( \cdot | I _ { i } ) \vec { 0 }$ . $r _ { i } ( \cdot | I _ { i } )$ and $\phantom { } _ { i } ( \cdot | I _ { i } )$ are two vectors over $A ( I _ { i } )$
401
+ 19 $A ^ { r s ( k ) } ( I _ { i } ) $ sampling $k$ different actions according to $\boldsymbol { \sigma } _ { i } ^ { r s ( k ) }$
402
+ 20 For $a \in A ^ { r s ( k ) } ( I _ { i } )$ do
403
+ 21 $\begin{array} { r l } & { v _ { i } ( a | h ) \xleftarrow { } \mathbf { M C C F R - N N } ( t , h a , i , \pi _ { i } \sigma _ { i } ( a | I _ { i } ) , \pi _ { i } ^ { r s } \sigma _ { i } ^ { r s ( k ) } ( a | I _ { i } ) ) } \\ & { v _ { i } ( h ) \xleftarrow { } v _ { i } ( h ) + v _ { i } ( a | h ) \sigma _ { i } ( a | I _ { i } ) } \end{array}$
404
+ 22 . update counterfactual value
405
+ 23 For $a \in A ^ { r s ( k ) } ( I _ { i } )$ do
406
+ 24 $r _ { i } ( a | I _ { i } ) v _ { i } ( a | h ) - v _ { i } ( h )$ . update cumulative regret
407
+ 25 $s _ { i } ( a | I _ { i } ) \gets \pi _ { i } ^ { \sigma } ( I _ { i } ) \sigma _ { i } ( a | I _ { i } )$ . update average strategy numerator
408
+ 26 Store updated cumulative regret tuple $\left( I _ { i } , r _ { i } ( \cdot | I _ { i } ) \right)$ in $\mathcal { M } _ { \mathcal { R } }$
409
+ 27 Store updated current strategy dictionary $\left( I _ { i } , s _ { i } ( \cdot | I _ { i } ) \right)$ in $\mathcal { M } _ { \mathcal { S } }$
410
+ 28 else
411
+ 29 $\begin{array} { r l } & { \quad \hat { R } _ { - i } ( \cdot | I _ { i } ) \gets \mathcal { R } ( \cdot , I _ { i } | \theta _ { \mathcal { R } } ^ { t } ) \mathrm { ~ i f ~ } t > 1 \mathrm { ~ e l s e ~ } \overrightarrow { 0 } } \\ & { \sigma _ { - i } ( I _ { i } ) \gets \mathrm { C a l c u l a t e S t r a t e g y } ( \hat { R } _ { - i } ( \cdot | I _ { i } ) , I _ { i } ) } \\ & { a \sim \sigma _ { - i } ( I _ { i } ) } \\ & { \mathrm { r e t u r n ~ M C C F R - N N } ( t , h a , i , \pi _ { i } , \pi _ { i } ^ { r s ( k ) } ) } \end{array}$ . inference cumulative regret
412
+ 30 . calculate current strategy
413
+ 31 . Sample an action from $\sigma _ { - i } ( I _ { i } )$
414
+ 32
415
+ 33
416
+ 34 Function CalculateStrategy $( R _ { i } ( \cdot | I _ { i } ) , I _ { i } )$ :
417
+ 35 $\begin{array} { r } { s u m \gets \sum _ { a \in A ( I _ { i } ) } \operatorname* { m a x } ( R _ { i } ( a | I _ { i } ) , 0 ) } \end{array}$
418
+ 36 For $a \in A ( I _ { i } )$ do
419
+ 37 $\begin{array} { r } { \sigma _ { i } ( a | I _ { i } ) = \frac { \operatorname* { m a x } ( R _ { i } ( a | I _ { i } ) , 0 ) } { s u m } } \end{array}$ max(Ri(a|Ii),0) if sum > 0 else $\frac { 1 } { | A ( I _ { i } ) | }$
420
+
421
+ 38 return $\sigma _ { i } ( I _ { i } )$
422
+
423
+ Algorithm 3 presents one application scenario of the proposed double neural method, which is based on the proposed mini-batch robust sampling method. The function MCCFR-NN will traverse the game tree like tabular MCCFR, which starts from the root history $h = \emptyset$ . Define $I _ { i }$ as the information set of $h$ . Suppose that player $i$ will sample $k$ actions according to the robust sampling. Then the function can be defined as follows. (1) If the history is terminal, the function returns the weighted utility. (2) If the history is the chance player, one action $a \in A ( I _ { i } )$ will be sampled according to the strategy $\sigma _ { - i } ( I _ { i } )$ . Then this action will be added to the history, i.e., $h h a$ . (3) If $P ( I _ { i } ) \bar { = } i$ , the current strategy can be updated by the cumulative regret predicted by RSN. Then we sample $k$ actions according the specified sampling strategy profile $\bar { \sigma _ { i } ^ { r s ( k ) } }$ . After a recursive updating, we can obtain the counterfactual value and regret of each action at $I _ { i }$ . For the visited node, their counterfactual regrets and numerators of the corresponding average strategy will be stored in $\mathcal { M } _ { \mathcal { R } }$ and $\mathcal { M } _ { \mathcal { S } }$ respectively. (4) If $P ( I _ { i } )$ is the opponent, only one action will be sampled according the strategy $\sigma _ { - i } ( I _ { i } )$ .
424
+
425
+ The function Mini-Batch-MCCFR-NN presents a mini-batch sampling method, where $b$ blocks will be sampled in parallel. This mini-batch method can help the MCCFR to achieve a more accurate estimation of CFV. The parallel sampling makes this method efficient in practice.
426
+
427
+ # APPENDIX G THEORETICAL ANALYSIS
428
+
429
+ # G.1 REACH PROBABILITY AND POSTERIOR PROBABILITY
430
+
431
+ Lemma 1: The state reach probability of one player is proportional to posterior probability of the opponent’s hidden variable, i.e., $p ( h _ { - i } ^ { v } | I _ { i } ) \propto \bar { \pi _ { - i } ^ { \sigma } } \bar { ( } h )$ .
432
+
433
+ Proof: For player $i$ at information set $I _ { i }$ and fixed $i ^ { \prime } s$ strategy profile $\sigma _ { i }$ , i.e., $\forall h \in I _ { i } , \pi _ { i } ^ { \sigma } ( h )$ is constant. Based on the defination of extensive-form game in Section 2.1, the cominbation of $I _ { i }$ and opponent’s hidden state $h _ { - i } ^ { v }$ can indicate a particular history $h = h _ { i } ^ { v } h _ { - i } ^ { v } a _ { 0 } a _ { 1 } . . . a _ { L - 1 }$ . With Bayes’ Theorem, we can inference the posterior probability of opponent’s private cards with Equation16
434
+
435
+ $$
436
+ \begin{array} { l } { { \displaystyle p ( h _ { - i } ^ { v } | I _ { i } ) = \frac { p ( h _ { - i } ^ { v } , I _ { i } ) } { p ( I _ { i } ) } = \frac { p ( h ) } { p ( I _ { i } ) } \propto p ( h ) } } \\ { { \displaystyle \propto p ( h _ { i } ^ { v } ) p ( h _ { - i } ^ { v } ) \prod _ { l = 1 } ^ { L } \sigma _ { P ( h _ { i } ^ { v } h _ { - i } ^ { v } a _ { 0 } a _ { 1 } \dots a _ { l - 1 } ) } ( a _ { l } | h _ { i } ^ { v } h _ { - i } ^ { v } a _ { 0 } a _ { 1 } \dots a _ { l - 1 } ) } } \\ { { \displaystyle \propto \pi ^ { \sigma } ( h ) = \pi _ { i } ^ { \sigma } ( h ) \pi _ { - i } ^ { \sigma } ( h ) } } \\ { { \displaystyle \propto \pi _ { - i } ^ { \sigma } ( h ) } } \end{array}
437
+ $$
438
+
439
+ # G.2 ROBUST SAMPLING, OUTCOME SAMPLING AND EXTERNAL SAMPLING
440
+
441
+ Lemma 3: If $ { k } = \ m a x _ { I _ { i } \in \mathbb { Z } } | A ( I _ { i } ) |$ and $\forall i ~ \in ~ N , \forall I _ { i } ~ \in ~ \mathbb { Z } _ { i } , \forall a ~ \in ~ A ( I _ { i } ) , \sigma _ { i } ^ { r s ( k ) } ( a | I _ { i } ) ~ \sim$ u $n i f ( 0 , \left| A ( I _ { i } ) \right| )$ , then robust sampling is same with external sampling. (see the proof in section G.2)
442
+
443
+ Lemma 4: If $k = 1$ and $\sigma _ { i } ^ { r s ( k ) } = \sigma _ { i }$ , then robust sampling is same with outcome sampling. (see the proof in section G.2)
444
+
445
+ For robust sampling, given strategy profile $\sigma$ and the sampled block $Q _ { j }$ according to sampling profile $\sigma ^ { r s ( k ) } = ( \sigma _ { i } ^ { r s ( k ) } , \sigma _ { - i } )$ = (σrs(k)i , , then $q ( \boldsymbol { z } ) = \pi _ { i } ^ { \sigma ^ { r s ( k ) } } ( \boldsymbol { z } ) \pi _ { - i } ^ { \sigma } ( \boldsymbol { z } )$ , and the regret of action $a \in A ^ { r s ( k ) } ( I _ { i } )$ is
446
+
447
+ $$
448
+ \begin{array} { l l l } { { \displaystyle { \overline { { { \vartheta } } } _ { i } ^ { \sigma } ( ( a | I _ { i } ) | Q _ { j } ) = \widetilde { v } _ { i } ^ { \sigma } ( ( a | I _ { i } ) | Q _ { j } ) - \widetilde { v } _ { i } ^ { \sigma } ( I _ { i } | Q _ { j } ) } } } \\ { { \displaystyle { = \sum _ { z \in Q _ { j } , h a \Xi z , h \in I _ { i } } \frac { 1 } { q ( z ) } \pi _ { - i } ^ { \sigma } ( z ) \pi _ { i } ^ { \sigma } ( h a , z ) u _ { i } ( z ) - \sum _ { z \in Q _ { j } , h \subseteq z } \frac { 1 } { q ( z ) } \pi _ { - i } ^ { \sigma } ( z ) \pi _ { i } ^ { \sigma } ( h , z ) u _ { i } ( z ) } } } \\ { { \displaystyle { = \sum _ { z \in Q _ { j } , h a \Xi z , h \in I _ { i } } \frac { u _ { i } ( z ) } { \pi _ { i } ^ { \sigma \kappa ( k ) } ( z ) } \pi _ { i } ^ { \sigma } ( h a , z ) - \sum _ { z \in Q _ { j } , h \subseteq z , h \in I _ { i } } \frac { u _ { i } ( z ) } { \pi _ { i } ^ { \sigma \kappa ( k ) } ( z ) } \pi _ { i } ^ { \sigma } ( h , z ) } } } \\ { { \displaystyle { = \sum _ { z \in Q _ { j } , h a \Xi z , h \in I _ { i } } \pi _ { i } ^ { \sigma } ( h a , z ) u _ { i } ^ { \tau s } ( z ) - \sum _ { z \in Q _ { j } , h \subseteq z , h \in I _ { i } } \pi _ { i } ^ { \sigma } ( h , z ) u _ { i } ^ { \tau s } ( z ) } , } } \end{array}
449
+ $$
450
+
451
+ where $\begin{array} { r } { u _ { i } ^ { r s } ( z ) = \frac { u _ { i } ( z ) } { \pi _ { i } ^ { \sigma ^ { r s ( k ) } } ( z ) } } \end{array}$ is the weighted utility according to reach probability $\pi _ { i } ^ { \sigma ^ { r s ( k ) } } ( z )$ . Because the weighted utility no long requires explicit knowledge of the opponent’s strategy, we can use this sampling method for online regret minimization.
452
+
453
+ Generally, if player $i$ randomly selects $m i n ( k , | A ( I _ { i } ) | )$ actions according to discrete uniform distribution $u n i f ( 0 , | A ( I _ { i } ) | )$ at information set $I _ { i }$ , i.e., $\begin{array} { r } { \sigma _ { i } ^ { r s ( k ) } ( a | I _ { i } ) = \frac { m i n ( k , | A ( I _ { i } ) | ) } { | A ( I _ { i } ) | } } \end{array}$ min(k,|A(Ii)|) , then
454
+
455
+ $$
456
+ \pi _ { i } ^ { \sigma ^ { r s ( k ) } } ( I _ { i } ) = \prod _ { \substack { h \in I _ { i } , h ^ { \prime } \subseteq h , h ^ { \prime } a \subseteq h , h ^ { \prime } \in I _ { i } ^ { \prime } } } \frac { m i n ( k , | A ( I _ { i } ^ { \prime } ) | ) } { | A ( I _ { i } ^ { \prime } ) | }
457
+ $$
458
+
459
+ and $u _ { i } ^ { r s } ( z )$ is a constant number when given the sampling profile $\sigma ^ { r s ( k ) }$ .
460
+
461
+ Specifically,
462
+
463
+ • if $k = m a x _ { I _ { i } \in I } | A ( I _ { i } ) |$ , then σrs(k)i (Ii) = 1, urs(k)i (z) = ui(z), and
464
+
465
+ $$
466
+ \tilde { r } _ { i } ^ { \sigma } ( ( a | I _ { i } ) | Q _ { j } ) = \sum _ { z \in Q _ { j } , h \sqsubseteq z , h \in I _ { i } } u _ { i } ( z ) ( \pi _ { i } ^ { \sigma } ( h a , z ) - \pi _ { i } ^ { \sigma } ( h , z ) )
467
+ $$
468
+
469
+ Therefore, robust sampling is same with external sampling when $k = m a x _ { I _ { i } \in I } | A ( I _ { i } ) |$
470
+
471
+ • if $k = 1$ and $\sigma _ { i } ^ { r s ( k ) } = \sigma _ { i }$ , only one history $z$ is sampled in this case,then urs(k)i (z) = $\frac { u _ { i } ( z ) } { \pi _ { i } ^ { \sigma _ { i } } ( z ) }$ , $\exists h \in I _ { i }$ , for $a \in A ^ { r s ( k ) } ( I _ { i } )$
472
+
473
+ $$
474
+ \begin{array} { l } { { \displaystyle \tilde { r } _ { i } ^ { \sigma } ( ( a | I _ { i } ) | Q _ { j } ) = \tilde { r } _ { i } ^ { \sigma } ( ( a | h ) | Q _ { j } ) } } \\ { { \displaystyle = \sum _ { z \in Q _ { j } , h a \subseteq z } \pi _ { i } ^ { \sigma } ( h a , z ) u _ { i } ^ { r s } ( z ) - \sum _ { z \in Q _ { j } , h \subseteq z } \pi _ { i } ^ { \sigma } ( h , z ) u _ { i } ^ { r s } ( z ) } } \\ { { \displaystyle = \frac { ( 1 - \sigma _ { i } ( a | h ) ) u _ { i } ( z ) } { \pi _ { i } ^ { \sigma } ( h a ) } } } \end{array}
475
+ $$
476
+
477
+ For $a \not \in A ^ { r s ( k ) } ( I _ { i } )$ , the regret will be $\tilde { r } _ { i } ^ { \sigma } ( ( a | h ) | j ) = 0 - \tilde { v } _ { i } ^ { \sigma } ( h | j )$ . Therefore, robust sampling is same with outcome sampling when $k = 1$ and $\boldsymbol { \sigma } _ { i } ^ { r s ( k ) } = \boldsymbol { \sigma } _ { i }$
478
+
479
+ • if $k = 1$ , and player $i$ randomly selects one action according to discrete uniform distribution uni $f ( 0 , \left| A ( I _ { i } ) \right| )$ at information set $I _ { i }$ , then $\begin{array} { r } { u _ { i } ^ { r s ( 1 ) } ( z ) = \frac { { u _ { i } } ( z ) } { \pi _ { i } ^ { \sigma ^ { r s ( k ) } } ( z ) } } \end{array}$ is a constant, $\exists h \in I _ { i }$ , for $a \in A ^ { r s ( k ) } ( I _ { i } )$
480
+
481
+ $$
482
+ \begin{array} { l } { { \displaystyle \tilde { r } _ { i } ^ { \sigma } ( ( a | I _ { i } ) | Q _ { j } ) = \sum _ { z \in Q _ { j } , h a \subseteq z , h \in I _ { i } } \pi _ { i } ^ { \sigma } ( h a , z ) u _ { i } ^ { r s } ( z ) - \sum _ { z \in Q _ { j } , h \subseteq z , h \in I _ { i } } \pi _ { i } ^ { \sigma } ( h , z ) u _ { i } ^ { r s } ( z ) } } \\ { { \mathrm { ~ } = ( 1 - \sigma _ { i } ( a | h ) ) \pi _ { i } ^ { \sigma } ( h a , z ) u _ { i } ^ { r s ( 1 ) } ( z ) } } \end{array}
483
+ $$
484
+
485
+ if action $a$ is not sampled at state $h$ , the regret is $\tilde { r } _ { i } ^ { \sigma } ( ( a | h ) | j ) = 0 - \tilde { v } _ { i } ^ { \sigma } ( h | j )$ . Compared to outcome sampling, the robust sampling in that case have a lower variance because of the constant uri $u _ { i } ^ { r s ( 1 ) } ( z )$ .
486
+
487
+ # Proof:
488
+
489
+ $$
490
+ \begin{array} { r l } { E _ { \mathcal { G } \sim \mathrm { m a t s o n a l i z } } [ E _ { i } ^ { \prime } ( \lambda | \delta ) ] } & { = E _ { \mathcal { G } \sim \mathrm { m a t s o n } } [ \Gamma _ { i } ^ { \prime } ( \lambda | \delta ) ] ^ { \epsilon } ( \begin{array} { l } { E _ { i } ^ { \prime } \lambda | \delta | } \\ { 1 } \end{array} ) } \\ & { = E _ { \mathcal { G } \sim \mathrm { m a t s o n } } ( ( \begin{array} { l l l } { E _ { i } ^ { \prime } } & { \sum _ { i = 1 } ^ { \infty } \frac { E _ { i } ^ { \prime } ( \lambda ) \epsilon _ { i } ^ { \prime } ( \delta ) \lambda _ { i } ^ { \prime } \delta ( k _ { i } ) \lambda _ { i } ^ { \prime } \lambda _ { i } ^ { \prime } } } \\ { \sum _ { i = 1 } ^ { \infty } \lambda _ { i } \epsilon _ { i } \epsilon _ { i } \epsilon _ { i } ^ { \prime } \delta ( k _ { i } ) \lambda _ { i } ^ { \prime } } \end{array} ) ) } \\ & { = E _ { \mathcal { F } \sim \mathrm { m a t s o n } } ( ( \begin{array} { l } { 1 } \\ { \delta } \\ { \frac { 1 } { \delta } } \\ { \gamma _ { j } \cdots \epsilon _ { i } ^ { \prime } ( \tau _ { i } ^ { \prime } ( 1 / \Phi ^ { 2 } ) ) } \\ { 1 } \end{array} ) ) } \\ & { = \frac { 1 } { \delta } \frac { 1 } { \delta \alpha _ { 1 } } ( \begin{array} { l } { 1 } \\ { 1 } \end{array} \frac { E _ { i } ^ { \prime } } { \delta ( \frac { E _ { i } ^ { \prime } } { \delta } ) ^ { \epsilon } ( \tau _ { i } \mathcal { G } ) ^ { 2 } } ) } \\ & - \frac { 1 } { \delta } \frac { 1 } { \delta \alpha _ { 1 } } ( \frac { 1 } { \delta } \frac { 1 } { \delta } \frac { E _ { i } ^ { \prime } } \delta ( \frac { E _ { i } ^ { \prime } } { \delta } ) ^ { \epsilon } ( \frac { E _ { i } ^ { \prime } } { \delta } ) ^ { \epsilon } ( \frac { 1 } { \delta } ) ^ { \epsilon } ( \frac { 1 } { \delta } ) ^ { \epsilon } ( \frac { 1 } { \delta } ) ^ { \epsilon } ( \frac { 1 } \end{array}
491
+ $$
md/train/BkevoJSYPB/BkevoJSYPB.md ADDED
@@ -0,0 +1,656 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # DIFFERENTIATION OF BLACKBOX COMBINATORIAL SOLVERS
2
+
3
+ Marin Vlastelica1∗, Anselm Paulus1∗, V´ıt Musil2, Georg Martius1, Michal Rol´ınek1
4
+
5
+ 1 Max-Planck-Institute for Intelligent Systems, Tubingen, Germany ¨
6
+ 2 Universita degli Studi di Firenze, Italy \`
7
+ {marin.vlastelica, anselm.paulus, georg.martius, michal.rolinek}@tuebingen.mpg.de
8
+ vit.musil@unifi.it
9
+
10
+ # ABSTRACT
11
+
12
+ Achieving fusion of deep learning with combinatorial algorithms promises transformative changes to artificial intelligence. One possible approach is to introduce combinatorial building blocks into neural networks. Such end-to-end architectures have the potential to tackle combinatorial problems on raw input data such as ensuring global consistency in multi-object tracking or route planning on maps in robotics. In this work, we present a method that implements an efficient backward pass through blackbox implementations of combinatorial solvers with linear objective functions. We provide both theoretical and experimental backing. In particular, we incorporate the Gurobi MIP solver, Blossom V algorithm, and Dijkstra’s algorithm into architectures that extract suitable features from raw inputs for the traveling salesman problem, the min-cost perfect matching problem and the shortest path problem. The code is available at
13
+
14
+ https://github.com/martius-lab/blackbox-backprop.
15
+
16
+ # 1 INTRODUCTION
17
+
18
+ The toolbox of popular methods in computer science currently sees a split into two major components. On the one hand, there are classical algorithmic techniques from discrete optimization – graph algorithms, SAT-solvers, integer programming solvers – often with heavily optimized implementations and theoretical guarantees on runtime and performance. On the other hand, there is the realm of deep learning allowing data-driven feature extraction as well as the flexible design of end-to-end architectures. The fusion of deep learning with combinatorial optimization is desirable both for foundational reasons – extending the reach of deep learning to data with large combinatorial complexity – and in practical applications. These often occur for example in computer vision problems that require solving a combinatorial sub-task on top of features extracted from raw input such as establishing global consistency in multi-object tracking from a sequence of frames.
19
+
20
+ The fundamental problem with constructing hybrid architectures is differentiability of the combinatorial components. State-of-the-art approaches pursue the following paradigm: introduce suitable approximations or modifications of the objective function or of a baseline algorithm that eventually yield a differentiable computation. The resulting algorithms are often sub-optimal in terms of runtime, performance and optimality guarantees when compared to their unmodified counterparts. While the sources of sub-optimality vary from example to example, there is a common theme: any differentiable algorithm in particular outputs continuous values and as such it solves a relaxation of the original problem. It is well-known in combinatorial optimization theory that even strong and practical convex relaxations induce lower bounds on the approximation ratio for large classes of problems (Raghavendra, 2008; Thapper & Zivn ˇ y´, 2017) which makes them inherently sub-optimal. This inability to incorporate the best implementations of the best algorithms is unsatisfactory.
21
+
22
+ In this paper, we propose a method that, at the cost of one hyperparameter, implements a backward pass for a blackbox implementation of a combinatorial algorithm or a solver that optimizes a linear objective function. This effectively turns the algorithm or solver into a composable building block of neural network architectures, as illustrated in Fig. 1. Suitable problems with linear objective include classical problems such as SHORTEST-PATH, TRAVELING-SALESMAN (TSP), MIN-COSTPERFECT-MATCHING, various cut problems as well as entire frameworks such as integer programs (IP), Markov random fields (MRF) and conditional random fields (CRF).
23
+
24
+ ![](images/d9c8e2dacd0c0eb13bcfff5d9eb2f9ae98c1624ffa536006ff07f824ee59321e.jpg)
25
+ Figure 1: Architecture design enabled by Theorem 1. Blackbox combinatorial solver embedded into a neural network.
26
+
27
+ The main technical challenge boils down to providing an informative gradient of a piecewise constant function. To that end, we are able to heavily leverage the minimization structure of the underlying combinatorial problem and efficiently compute a gradient of a continuous interpolation. While the roots of the method lie in loss-augmented inference, the employed mathematical technique for continuous interpolation is novel. The computational cost of the introduced backward pass matches the cost of the forward pass. In particular, it also amounts to one call to the solver.
28
+
29
+ In experiments, we train architectures that contain unmodified implementations of the following efficient combinatorial algorithms: general-purpose mixed-integer programming solver Gurobi (Gurobi Optimization, 2019), state-of-the-art C implementation of MIN-COST-PERFECTMATCHING algorithm – Blossom V (Kolmogorov, 2009) and Dijkstra’s algorithm (Dijkstra, 1959) for SHORTEST-PATH. We demonstrate that the resulting architectures train without sophisticated tweaks and are able to solve tasks that are beyond the capabilities of conventional neural networks.
30
+
31
+ # 2 RELATED WORK
32
+
33
+ Multiple lines of work lie at the intersection of combinatorial algorithms and deep learning. We primarily distinguish them by their motivation.
34
+
35
+ Motivated by applied problems. Even though computer vision has seen a substantial shift from combinatorial methods to deep learning, some problems still have a strong combinatorial aspect and require hybrid approaches. Examples include multi-object tracking (Schulter et al., 2017), semantic segmentation (Chen et al., 2018), multi-person pose estimation (Pishchulin et al., 2016; Song et al., 2018), stereo matching (Knobelreiter et al. ¨ , 2017) and person re-identification (Ye et al., 2017). The combinatorial algorithms in question are typically Markov random fields (MRF) (Chen et al., 2015), conditional random fields (CRF) (Marin et al., 2019), graph matching (Ye et al., 2017) or integer programming (Schulter et al., 2017). In recent years, a plethora of hybrid end-to-end architectures have been proposed. The techniques used for constructing the backward pass range from employing various relaxations and approximations of the combinatorial problem (Chen et al., 2015; Zheng et al., 2015) over differentiating a fixed number of iterations of an iterative solver (Paschalidou et al., 2018; Tompson et al., 2014; Liu et al., 2015) all the way to relying on the structured SVM framework (Tsochantaridis et al., 2005; Chen et al., 2015).
36
+
37
+ Motivated by “bridging the gap”. Building links between combinatorics and deep learning can also be viewed as a foundational problem; for example, (Battaglia et al., 2018) advocate that “combinatorial generalization must be a top priority for AI”. One such line of work focuses on designing architectures with algorithmic structural prior – for example by mimicking the layout of a Turing machine (Sukhbaatar et al., 2015; Vinyals et al., 2015; Graves et al., 2014; 2016) or by promoting behaviour that resembles message-passing algorithms as it is the case in Graph Neural Networks and related architectures (Scarselli et al., 2009; Li et al., 2016; Battaglia et al., 2018). Another approach is to provide neural network building blocks that are specialized to solve some types of combinatorial problems such as satisfiability (SAT) instances (Wang et al., 2019), mixed integer programs (Ferber et al., 2019), sparse inference (Niculae et al., 2018), or submodular maximization (Tschiatschek et al., 2018). A related mindset of learning inputs to an optimization problem gave rise to the “predict-and-optimize” framework and its variants (Elmachtoub & Grigas, 2017; Demirovic et al., 2019; Mandi et al., 2019). Some works have directly addressed the question of learning combinatorial optimization algorithms such as the TRAVELING-SALESMAN-PROBLEM in (Bello et al., 2017) or its vehicle routing variants (Nazari et al., 2018). A recent approach also learns combinatorial algorithms via a clustering proxy (Wilder et al., 2019).
38
+
39
+ There are also efforts to bridge the gap in the opposite direction; to use deep learning methods to improve state-of-the-art combinatorial solvers, typically by learning (otherwise hand-crafted) heuristics. Some works have again targeted the TRAVELING-SALESMAN-PROBLEM (Kool et al., 2019; Deudon et al., 2018; Bello et al., 2017) as well as other NP-Hard problems (Li et al., 2018). Also, more general solvers received some attention; this includes SAT-solvers (Selsam & Bjørner, 2019; Selsam et al., 2019), integer programming solvers (often with learning branch-and-bound rules) (Khalil et al., 2016; Balcan et al., 2018; Gasse et al., 2019) and SMT-solvers (satisfiability modulo theories)(Balunovic et al., 2018).
40
+
41
+ # 3 METHOD
42
+
43
+ Let us first formalize the notion of a combinatorial solver. We expect the solver to receive continuous input $w \in W \subseteq \mathbb { R } ^ { N }$ (e.g. edge weights of a fixed graph) and return discrete output $y$ from some finite set $Y$ (e.g. all traveling salesman tours on a fixed graph) that minimizes some cost $\mathbf { c } ( w , y )$ (e.g. length of the tour). More precisely, the solver maps
44
+
45
+ $$
46
+ w \mapsto y ( w ) \quad { \mathrm { s u c h ~ t h a t } } \quad y ( w ) = \arg \operatorname* { m i n } _ { y \in Y } \mathbf { \exp } ( w , y ) .
47
+ $$
48
+
49
+ We will restrict ourselves to objective functions $\mathbf { c } ( w , y )$ that are linear , namely $\mathbf { c } ( w , y )$ may be represented as
50
+
51
+ $$
52
+ \mathbf { c } ( w , y ) = w \cdot \phi ( y ) \quad { \mathrm { f o r ~ } } w \in W { \mathrm { ~ a n d ~ } } y \in Y
53
+ $$
54
+
55
+ in which $\phi \colon Y \mathbb { R } ^ { N }$ is an injective representation of $y \in Y$ in $\mathbb { R } ^ { N }$ . For brevity, we omit the mapping $\phi$ and instead treat elements of $Y$ as discrete points in $\mathbb { R } ^ { N }$ .
56
+
57
+ Note that such definition of a solver is still very general as there are no assumptions on the set of constraints or on the structure of the output space $Y$ .
58
+
59
+ Example 1 (Encoding shortest-path problem). If $G = ( V , E )$ is a given graph with vertices $s , t \in V$ , the combinatorial solver for the $( s , t )$ -SHORTEST-PATH would take edge weights $w \in W = \mathbb { R } ^ { | E | }$ as input and produce the shortest path $y ( w )$ represented as $\phi ( y ) \subseteq \{ 0 , 1 \} ^ { | E | }$ an indicator vector of the selected edges. The cost function is then indeed the inner product $\mathbf { c } ( \dot { w } , y ) = w \cdot { \phi } ( y )$ .
60
+
61
+ The task to solve during back-propagation is the following. We receive the gradient $\mathrm { d } L / \mathrm { d } y$ of the global loss $L$ with respect to solver output $y$ at a given point $\hat { y } = y ( \hat { w } )$ . We are expected to return $\mathrm { d } L / \mathrm { d } w$ , the gradient of the loss with respect to solver input $w$ at a point $\hat { w }$ .
62
+
63
+ Since $Y$ is finite, there are only finitely many values of $y ( w )$ . In other words, this function of $w$ is piecewise constant and the gradient is identically zero or does not exist (at points of jumps). This should not come as a surprise; if one does a small perturbation to edge weights of a graph, one usually does not change the optimal TSP tour and on rare occasions alters it drastically. This has an important consequence:
64
+
65
+ The fundamental problem with differentiating through combinatorial solvers is not the lack of differentiability; the gradient exists almost everywhere. However, this gradient is a constant zero and as such is unhelpful for optimization.
66
+
67
+ Accordingly, we will not rely on standard techniques for gradient estimation (see (Mohamed et al., 2019) for a comprehensive survey).
68
+
69
+ ![](images/ccc85f2ab1b95aa0779c74202ea55b1e442adf5cc1b1c62194403e325eb252a6.jpg)
70
+ Figure 2: Continuous interpolation of a piecewise constant function. (a) $f _ { \lambda }$ for a small value of $\lambda$ ; the set $W _ { \mathrm { e q } } ^ { \lambda }$ is still substantial and only two interpolators $g _ { 1 }$ and $g _ { 2 }$ are incomplete. Also, all interpolators are 0-interpolators. (b) $f _ { \lambda }$ for a high value of $\lambda$ ; most interpolators are incomplete and we also encounter a $\delta$ -interpolator $g _ { 3 }$ (between $y _ { 1 }$ and $y _ { 2 }$ ) which attains the value $f ( y _ { 1 } )$ δ-away from the set $P _ { 1 }$ . Despite losing some local structure for high $\lambda$ , the gradient of $f _ { \lambda }$ is still informative.
71
+
72
+ First, we simplify the situation by considering the linearization $f$ of $L$ at the point $\hat { y }$ . Then for
73
+
74
+ $$
75
+ f ( y ) = L ( \hat { y } ) + \frac { \mathrm { d } L } { \mathrm { d } y } ( \hat { y } ) \cdot ( y - \hat { y } ) \quad \mathrm { w e ~ h a v e } \quad \frac { \mathrm { d } f \big ( y ( w ) \big ) } { \mathrm { d } w } = \frac { \mathrm { d } L } { \mathrm { d } w }
76
+ $$
77
+
78
+ and therefore it suffices to focus on differentiating the piecewise constant function $f ( \boldsymbol { y } ( \boldsymbol { w } ) )$
79
+
80
+ If the piecewise constant function at hand was arbitrary, we would be forced to use zero-order gradient estimation techniques such as computing finite differences. These require prohibitively many function evaluations particularly for high-dimensional problems.
81
+
82
+ However, the function $f ( \boldsymbol { y } ( \boldsymbol { w } ) )$ is a result of a minimization process and it is known that for smooth spaces $Y$ there are techniques for such “differentiation through argmin” (Schmidt & Roth, 2014; Samuel & Tappen, 2009; Foo et al., 2008; Domke, 2012; Amos et al., 2017; Amos & Kolter, 2017). It turns out to be possible to build – with different mathematical tools – a viable discrete analogy. In particular, we can efficiently construct a function $f _ { \lambda } ( w )$ , a continuous interpolation of $f ( y ( w ) )$ , whose gradient we return (see Fig. 2). The hyper-parameter $\lambda > 0$ controls the trade-off between “informativeness of the gradient” and “faithfulness to the original function”.
83
+
84
+ Before diving into the formalization, we present the final algorithm as listed in Algo. 1. It is simple to implement and the backward pass indeed only runs the solver once on modified input. Providing the justification, however, is not straightforward, and it is the subject of the rest of the section.
85
+
86
+ <table><tr><td colspan="2">Algorithm1 Forward and Backward Pass</td></tr><tr><td>function FORWARDPASS(ω)</td><td>function BACKWARDPASS( (), λ)</td></tr><tr><td>y := Solver(ω) I y= y(ω)</td><td>load ω and y from forward pass</td></tr><tr><td>save ω and y for backward pass</td><td>w&#x27;:=w+&gt;. 品 (y)</td></tr><tr><td>return y</td><td>Il Calculate perturbed weights</td></tr><tr><td></td><td>yx := Solver(w&#x27;)</td></tr><tr><td></td><td>return Vωfx(ω) := -1[y - yx]</td></tr><tr><td></td><td>ll Gradient of continuous interpolation</td></tr></table>
87
+
88
+ # 3.1 CONSTRUCTION AND PROPERTIES OF $f _ { \lambda }$
89
+
90
+ Before we give the exact definition of the function $f _ { \lambda }$ , we formulate several requirements on it. This will help us understand why $f _ { \lambda } ( w )$ is a reasonable replacement for $f ( \boldsymbol { y } ( \boldsymbol { w } ) )$ and, most importantly, why its gradient captures changes in the values of $f$ .
91
+
92
+ Property A1. For each $\lambda > 0$ , $f _ { \lambda }$ is continuous and piecewise affine.
93
+
94
+ The second property describes the trade-off induced by changing the value of $\lambda$ . For $\lambda > 0$ , we define sets $\dot { W } _ { \mathrm { e q } } ^ { \lambda }$ and $\dot { W } _ { \mathrm { d i f } } ^ { \lambda }$ as the sets where $f ( \boldsymbol { y } ( \boldsymbol { w } ) )$ and $f _ { \lambda } ( w )$ coincide and where they differ, i.e.
95
+
96
+ $$
97
+ W _ { \mathrm { e q } } ^ { \lambda } = \left\{ w \in W : f _ { \lambda } ( w ) = f \bigl ( y ( w ) \bigr ) \right\} \quad \mathrm { a n d } \quad W _ { \mathrm { d i f } } ^ { \lambda } = W \setminus W _ { \mathrm { e q } } ^ { \lambda } .
98
+ $$
99
+
100
+ Property A2. The sets $W _ { \mathrm { d i f } } ^ { \lambda }$ are monotone in $\lambda$ and they vanish as $\lambda 0 ^ { + }$ , i.e.
101
+
102
+ $$
103
+ W _ { \mathrm { d i f } } ^ { \lambda _ { 1 } } \subseteq W _ { \mathrm { d i f } } ^ { \lambda _ { 2 } } \quad \mathrm { f o r } 0 < \lambda _ { 1 } \leq \lambda _ { 2 } \quad \mathrm { a n d } \quad W _ { \mathrm { d i f } } ^ { \lambda } \to \varnothing \quad \mathrm { a s } \ \lambda \to 0 ^ { + } .
104
+ $$
105
+
106
+ In other words, Property A2 tells us that $\lambda$ controls the size of the set where $f _ { \lambda }$ deviates from $f$ and where $f _ { \lambda }$ has meaningful gradient. This behaviour of $f _ { \lambda }$ can be seen in Fig. 2.
107
+
108
+ In the third and final property, we want to capture the interpolation behavior of $f _ { \lambda }$ . For that purpose, we define a $\delta$ -interpolator of $f$ . We say that $g$ , defined on a set $G \subset W$ , is a $\delta$ -interpolator of $f$ between $y _ { 1 }$ and $y _ { 2 } \in Y$ , if
109
+
110
+ • $g$ is non-constant affine function;
111
+ • the image $g ( G )$ is an interval with endpoints $f ( y _ { 1 } )$ and $f ( y _ { 2 } )$ ;
112
+ • $g$ attains the boundary values $f ( y _ { 1 } )$ and $f ( y _ { 2 } )$ at most $\delta$ -far away from where $f ( y ( w ) )$ does. In particular, there is a point $w _ { k } \in G$ for which $g ( w _ { k } ) = f ( y _ { k } )$ and $\mathrm { d i s t } ( w _ { k } , P _ { k } ) \le \delta$ , where $P _ { k } = \{ w \in W : y ( w ) = y _ { k } \}$ , for $k = 1 , 2$ .
113
+
114
+ In the special case of a 0-interpolator $g$ , the graph of $g$ connects (in a topological sense) two components of the graph of $f ( y ( \dot { w } ) )$ . In the general case, $\delta$ measures displacement of the interpolator (see also Fig. 2 for some examples). This displacement on the one hand loosens the connection to $\dot { f } \left( y ( w ) \right)$ but on the other hand allows for less local interpolation which might be desirable.
115
+
116
+ Property A3. The function $f _ { \lambda }$ consists of finitely many (possibly incomplete) $\delta$ -interpolators of $f$ on $\hat { W } _ { \mathrm { d i f } } ^ { \lambda }$ where $\delta \leq C \lambda$ for some fixed $C$ . Equivalently, the displacement is linearly controlled by $\lambda$
117
+
118
+ Intuitively, the consequence of Property A3 is that $f _ { \lambda }$ has reasonable gradients everywhere since it consists of elementary affine interpolators.
119
+
120
+ For defining the function $f _ { \lambda }$ , we need a solution of a perturbed optimization problem
121
+
122
+ $$
123
+ y _ { \lambda } ( w ) = { \underset { y \in Y } { \operatorname { a r g m i n } } } \{ \mathbf { c } ( w , y ) + \lambda f ( y ) \} .
124
+ $$
125
+
126
+ Theorem 1. Let $\lambda > 0$ . The function $f _ { \lambda }$ defined by
127
+
128
+ $$
129
+ f _ { \lambda } ( w ) = f { \big ( } y _ { \lambda } ( w ) { \big ) } - { \frac { 1 } { \lambda } } { \Big [ } \mathbf { c } { \big ( } w , y ( w ) { \big ) } - \mathbf { c } { \big ( } w , y _ { \lambda } ( w ) { \big ) } { \Big ] }
130
+ $$
131
+
132
+ satisfies Properties A1, A2, A3.
133
+
134
+ Let us remark that already the continuity of $f _ { \lambda }$ is not apparent from its definition as the first term $f ( y _ { \lambda } ( w ) )$ is still a piecewise constant function. Proof of this result, along with geometrical description of $f _ { \lambda }$ , can be found in section A.2. Fig. 3 visualizes $f _ { \lambda }$ for different values if $\lambda$ .
135
+
136
+ Now, since $f _ { \lambda }$ is ensured to be differentiable, we have
137
+
138
+ $$
139
+ \nabla f _ { \lambda } ( w ) = - \frac { 1 } { \lambda } \Big [ \frac { \mathrm { d } \mathbf { c } } { \mathrm { d } w } \big ( w , y ( w ) \big ) - \frac { \mathrm { d } \mathbf { c } } { \mathrm { d } w } \big ( w , y _ { \lambda } ( w ) \big ) \Big ] = - \frac { 1 } { \lambda } \big [ y ( w ) - y _ { \lambda } ( w ) \big ] .
140
+ $$
141
+
142
+ The second equality then holds due to (2). We then return $\nabla f _ { \lambda }$ as a loss gradient.
143
+
144
+ Remark 1. The roots of the method we propose lie in loss-augmented inference. In fact, the update rule from (5) (but not the function $f _ { \lambda }$ or any of its properties) was already proposed in a different context in (Hazan et al., 2010; Song et al., 2016) and was later used in (Lorberbom et al., 2018; Mohapatra et al., 2018). The main difference to our work is that only the case of $\lambda 0 ^ { + }$ is recommended and studied, which in our situation computes the correct but uninformative zero gradient. Our analysis implies that larger values of $\lambda$ are not only sound but even preferable. This will be seen in experiments where we use values $\lambda \approx 1 0 - 2 0$ .
145
+
146
+ ![](images/1d726e1211cf775ed97ca541a5a85a081509a5088d2c2cad5b95f8fee7b5c1a1.jpg)
147
+ Figure 3: Example $f _ { \lambda }$ for $w \in \mathbb { R } ^ { 2 }$ and $\lambda = 3 , 1 0 , 2 0$ (left to right). As $\lambda$ changes, the interpolation $f _ { \lambda }$ is less faithful to the piecewise constant $f ( \boldsymbol { y } ( \boldsymbol { w } ) )$ but provides reasonable gradient on a larger set.
148
+
149
+ # 3.2 EFFICIENT COMPUTATION OF $f _ { \lambda }$
150
+
151
+ Computing $y _ { \lambda }$ in (3) is the only potentially expensive part of evaluating (5). However, the linear interplay of the cost function and the gradient trivially gives a resolution.
152
+
153
+ Proposition 1. Let $\hat { w } \in W$ be fixed. If we set $\begin{array} { r } { w ^ { \prime } = \hat { w } + \lambda \frac { \mathrm { d } L } { \mathrm { d } y } ( \hat { y } ) } \end{array}$ , we can compute $y _ { \lambda }$ as
154
+
155
+ $$
156
+ \boldsymbol { y } _ { \lambda } ( \hat { w } ) = \underset { \boldsymbol { y } \in Y } { \arg \operatorname* { m i n } } \mathbf { c } ( w ^ { \prime } , \boldsymbol { y } ) .
157
+ $$
158
+
159
+ In other words, $y _ { \lambda }$ is the output of calling the solver on input $w ^ { \prime }$ .
160
+
161
+ # 4 EXPERIMENTS
162
+
163
+ In this section, we experimentally validate a proof of concept: that architectures containing exact blackbox solvers (with backward pass provided by Algo. 1) can be trained by standard methods.
164
+
165
+ Table 1: Experiments Overview.
166
+
167
+ <table><tr><td>Graph Problem</td><td>Solver</td><td>Solver instance size</td><td>Input format</td></tr><tr><td>Shortest path</td><td>Dijkstra</td><td>up to 900 vertices</td><td>(image) up to 240 × 240</td></tr><tr><td>Min Cost PM</td><td>Blossom V</td><td>up to 1104 edges</td><td>(image) up to 528 × 528</td></tr><tr><td>Traveling Salesman</td><td>Gurobi</td><td>up to 780 edges</td><td>up to 40 images (20 × 40)</td></tr></table>
168
+
169
+ To that end, we solve three synthetic tasks as listed in Tab. 1. These tasks are designed to mimic practical examples from Section 2 and solving them anticipates a two-stage process: 1) extract suitable features from raw input, 2) solve a combinatorial problem over the features. The dimensionalities of input and of intermediate representations also aim to mirror practical problems and are chosen to be prohibitively large for zero-order gradient estimation methods. Guidelines of setting the hyperparameter $\lambda$ are given in section A.1.
170
+
171
+ We include the performance of ResNet18 (He et al., 2016) as a sanity check to demonstrate that the constructed datasets are too complex for standard architectures.
172
+
173
+ Remark 2. The included solvers have very efficient implementations and do not severely impact runtime. All models train in under two hours on a single machine with 1 GPU and no more than 24 utilized CPU cores. Only for the large TSP problems the solver’s runtime dominates.
174
+
175
+ # 4.1 WARCRAFT SHORTEST PATH
176
+
177
+ Problem input and output. The training dataset for problem $\operatorname { S P } ( k )$ consists of 10000 examples of randomly generated images of terrain maps from the Warcraft II tileset (Guyomarch, 2017). The maps have an underlying grid of dimension $k \times k$ where each vertex represents a terrain with a fixed cost that is unknown to the network. The shortest (minimum cost) path between top left and bottom right vertices is encoded as an indicator matrix and serves as a label (see also Fig. 4). We consider datasets $\operatorname { S P } ( k )$ for $k \in \{ 1 2 , 1 8 , 2 4 , 3 0 \}$ . More experimental details are provided in section A.3.
178
+
179
+ ![](images/aebd22f7122a987507b5a5df380f095e06acf0115c5b15b52129729f3f12359a.jpg)
180
+ Figure 4: The $\operatorname { S P } ( k )$ dataset. (a) Each input is a $k \times k$ grid of tiles corresponding to a Warcraft II terrain map, the respective label is a the matrix indicating the shortest path from top left to bottom right. (b) is a different map with correctly predicted shortest path.
181
+
182
+ Architecture. An image of the terrain map is presented to a convolutional neural network which outputs a $k \times k$ grid of vertex costs. These costs are then the input to the Dijkstra algorithm to compute the predicted shortest path for the respective map. The loss used for computing the gradient update is the Hamming distance between the true shortest path and the predicted shortest path.
183
+
184
+ Results. Our method learns to predict the shortest paths with high accuracy and generalization capability, whereas the ResNet18 baseline unsurprisingly fails to generalize already for small grid sizes of $k \_ =$ 12. Since the shortest paths in the maps are often nonunique (i.e. there are multiple shortest paths with the same cost), we report the percentage of shortest path predictions that have optimal cost. The results are summarized in Tab. 2.
185
+
186
+ Table 2: Results for Warcraft shortest path. Reported is the accuracy, i.e. percentage of paths with the optimal costs. Standard deviations are over five restarts.
187
+
188
+ <table><tr><td colspan="3">Embedding Dijkstra</td><td colspan="2">ResNet18</td></tr><tr><td>k</td><td>Train %</td><td>Test %</td><td>Train %</td><td>Test %</td></tr><tr><td>12</td><td>99.7±0.0</td><td>96.0± 0.3</td><td>100.0±0.0</td><td>23.0± 0.3</td></tr><tr><td>18</td><td>98.9 ± 0.2</td><td>94.4 ± 0.2</td><td>99.9 ± 0.0</td><td>0.7 ± 0.3</td></tr><tr><td>24</td><td>97.8 ± 0.2</td><td>94.4±0.6</td><td>100.0± 0.0</td><td>0.0±0.0</td></tr><tr><td>30</td><td>97.4± 0.1</td><td>94.0 ± 0.3</td><td>95.6 ± 0.5</td><td>0.0± 0.0</td></tr></table>
189
+
190
+ # 4.2 GLOBE TRAVELING SALESMAN PROBLEM
191
+
192
+ Problem input and output. The training dataset for problem $\mathrm { T S P } ( k )$ consists of 10000 examples where the input for each example is a $k$ -element subset of fixed 100 country flags and the label is the shortest traveling salesman tour through the capitals of the corresponding countries. The optimal tour is represented by its adjacency matrix (see also Fig. 5). We consider datasets $\mathrm { T S P } ( k )$ for $k \in \{ 5 , 1 0 , 2 0 , 4 0 \}$ .
193
+
194
+ ![](images/93a1371bc47f5fbc55fc3aa8629e790fdbf4bf0356d5477e55579af56987fedd.jpg)
195
+ Figure 5: The $\mathrm { T S P } ( k )$ problem. (a) illustrates the dataset. Each input is a sequence of $k$ flags and the corresponding label is the adjacency matrix of the optimal TSP tour around the corresponding capitals. (b) displays the learned locations of 10 country capitals in southeast Asia and Australia, accurately recovering their true position.
196
+
197
+ Architecture. Each of the $k$ flags is presented to a convolutional network that produces $k$ threedimensional vectors. These vectors are projected onto the unit sphere in $\mathbb { R } ^ { 3 }$ ; a representation of the globe. The TSP solver receives a matrix of pairwise distances of the $k$ computed locations. The loss of the network is the Hamming distance between the true and the predicted TSP adjacency matrix. The architecture is expected to learn the correct representations of the flags (i.e. locations of the respective countries’ capitals on Earth, up to rotations of the sphere). The employed Gurobi solver optimizes a mixed-integer programming formulation of TSP using the cutting plane method (Marchand et al., 2002) for lazy sub-tour elimination.
198
+
199
+ Results. This architecture not only learns to extract the correct TSP tours but also learns the correct representations. Quantitative evidence is presented in Tab. 3, where we see that the learned locations generalize well and lead to correct TSP tours also on the test set and also on somewhat large instances (note that there are $3 9 ! \approx 1 0 ^ { 4 6 }$ admissible TSP tours for $k = 4 0$ ). The baseline architecture
200
+
201
+ Table 3: Results for Globe TSP. Reported is the full tour accuracy. Standard deviations are over five restarts.
202
+
203
+ <table><tr><td></td><td>Embedding TSP Solver</td><td></td><td>ResNet18</td></tr><tr><td>k</td><td>Train %</td><td>Test %</td><td>Train % Test %</td></tr><tr><td>5</td><td>99.8± 0.0</td><td>99.2 ± 0.1</td><td>100.0± 0.0 1.9 ± 0.6</td></tr><tr><td>10</td><td>99.8 ±0.1</td><td>98.7 ± 0.2 99.0± 0.1</td><td>0.0±0.0</td></tr><tr><td>20</td><td>99.1 ± 0.1</td><td>98.4± 0.4 98.8 ± 0.3</td><td>0.0 ± 0.0</td></tr><tr><td>40</td><td>97.4± 0.2</td><td>96.7± 0.4 96.9 ± 0.3</td><td>0.0±0.0</td></tr></table>
204
+
205
+ only memorizes the training set. Additionally, we can extract the suggested locations of world capitals and compare them with reality. To that end, we present Fig. 5b, where the learned locations of 10 capitals in Southeast Asia are displayed.
206
+
207
+ # 4.3 MNIST MIN-COST PERFECT MATCHING
208
+
209
+ Problem input and output. The training dataset for problem $\mathrm { P M } ( k )$ consists of 10000 examples where the input to each example is a set of $k ^ { 2 }$ digits drawn from the MNIST dataset arranged in a $k \times k$ grid. For computing the label, we consider the underlying $k \times k$ grid graph (without diagonal edges) and solve a MIN-COST-PERFECT-MATCHING problem, where edge weights are given simply by reading the two vertex digits as a two-digit number (we read downwards for vertical edges and from left to right for horizontal edges). The optimal perfect matching (i.e. the label) is encoded by an indicator vector for the subset of the selected edges, see example in Fig. 6.
210
+
211
+ Architecture. The grid image is the input of a convolutional neural network which outputs a grid of vertex weights. These weights are transformed into edge weights as described above and given to the solver. The loss function is Hamming distance between solver output and the true label.
212
+
213
+ Results. The architecture containing the solver is capable of good generalizations suggesting that the correct representation is learned. The performance is good even on larger instances and despite the presence of noise in supervision – often there are many optimal matchings. In contrast, the ResNet18 baseline only achieves reasonable performance for the simplest case PM(4). The results are summarized in Tab. 4.
214
+
215
+ Table 4: Results for MNIST Min-cost perfect matching. Reported is the accuracy of predicting an optimal matching. Standard deviations are over five restarts.
216
+
217
+ <table><tr><td></td><td>Embedding Blossom V</td><td></td><td>ResNet18</td></tr><tr><td>k</td><td>Train %</td><td>Test %</td><td>Train % Test %</td></tr><tr><td>4</td><td>99.97 ± 0.01</td><td>98.32 ± 0.24 99.92 ± 0.01</td><td>100.0± 0.0 92.5±0.3 8.3±0.8</td></tr><tr><td>8 16</td><td>99.95 ± 0.04</td><td>99.06± 0.57</td><td>100.0 ± 0.0 100.0± 0.0 0.0±0.0</td></tr><tr><td>24</td><td>99.02 ± 0.84</td><td>92.06 ± 7.97</td><td>96.1 ± 0.5 0.0±0.0</td></tr><tr><td></td><td>95.63 ± 5.49</td><td></td><td></td></tr></table>
218
+
219
+ # 5 DISCUSSION
220
+
221
+ We provide a unified mathematically sound algorithm to embed combinatorial algorithms into neural networks. Its practical implementation is straightforward and training succeeds with standard deep learning techniques. The two main branches of future work are: 1) exploring the potential of newly enabled architectures, 2) addressing standing real-world problems. The latter case requires embedding approximate solvers (that are common in practice). This breaks some of our theoretical guarantees but given their strong empirical performance, the fusion might still work well in practice.
222
+
223
+ ![](images/25ffcca54f0937b5c6910ab99eac7f8e6385ee741c8c778f17c9c7232f8f0c99.jpg)
224
+ Figure 6: Visualization of the PM dataset. (a) shows the case of $\mathrm { P M } ( 4 )$ . Each input is a $4 \times 4$ grid of MNIST digits and the corresponding label is the indicator vector for the edges in the min-cost perfect matching. (b) shows the correct min-cost perfect matching output from the network. The cost of the matching is 348 ( $4 6 + 1 2$ horizontally and $2 7 + 4 5 + 4 0 + 6 7 + 7 8 + 3 3$ vertically).
225
+
226
+ # ACKNOWLEDGEMENT
227
+
228
+ We thank the International Max Planck Research School for Intelligent Systems (IMPRS-IS) for supporting Marin Vlastelica. We acknowledge the support from the German Federal Ministry of Education and Research (BMBF) through the Tbingen AI Center (FKZ: 01IS18039B). Additionally, we would like to thank Paul Swoboda and Alexander Kolesnikov for valuable feedback on an early version of the manuscript.
229
+
230
+ # REFERENCES
231
+
232
+ Google’s or-tools, 2019. URL https://developers.google.com/optimization/.
233
+
234
+ Brandon Amos and J. Zico Kolter. Optnet: Differentiable optimization as a layer in neural networks. arXiv, 1703.00443, 2017. URL http://arxiv.org/abs/1703.00443.
235
+
236
+ Brandon Amos, Lei Xu, and J Zico Kolter. Input convex neural networks. In 34th International Conference on Machine Learning (ICML’17), pp. 146–155. JMLR, 2017.
237
+
238
+ Maria-Florina Balcan, Travis Dick, Tuomas Sandholm, and Ellen Vitercik. Learning to branch. In Jennifer G. Dy and Andreas Krause (eds.), Proceedings of the 35th International Conference on Machine Learning, ICML 2018, Stockholmsmassan, Stockholm, Sweden, July 10-15, 2018 ¨ , volume 80 of Proceedings of Machine Learning Research, pp. 353–362. PMLR, 2018. URL http://proceedings.mlr.press/v80/balcan18a.html.
239
+
240
+ Mislav Balunovic, Pavol Bielik, and Martin Vechev. Learning to solve SMT formulas. In S. Bengio, H. Wallach, H. Larochelle, K. Grauman, N. Cesa-Bianchi, and R. Garnett (eds.), Advances in Neural Information Processing Systems 31, pp. 10317–10328. Curran Associates, Inc., 2018.
241
+
242
+ Peter Battaglia, Jessica Blake Chandler Hamrick, Victor Bapst, Alvaro Sanchez, Vinicius Zambaldi, Mateusz Malinowski, Andrea Tacchetti, David Raposo, Adam Santoro, Ryan Faulkner, Caglar Gulcehre, Francis Song, Andy Ballard, Justin Gilmer, George E. Dahl, Ashish Vaswani, Kelsey Allen, Charles Nash, Victoria Jayne Langston, Chris Dyer, Nicolas Heess, Daan Wierstra, Pushmeet Kohli, Matt Botvinick, Oriol Vinyals, Yujia Li, and Razvan Pascanu. Relational inductive biases, deep learning, and graph networks. arXiv, abs/1806.01261, 2018. URL http://arxiv.org/abs/1806.01261.
243
+
244
+ Irwan Bello, Hieu Pham, Quoc V. Le, Mohammad Norouzi, and Samy Bengio. Neural combinatorial optimization with reinforcement learning. In 5th International Conference on Learning Representations, ICLR 2017, Workshop Track Proceedings, 2017. URL http://openreview.net/forum? id=Bk9mxlSFx.
245
+
246
+ L. Chen, G. Papandreou, I. Kokkinos, K. Murphy, and A. L. Yuille. DeepLab: Semantic image segmentation with deep convolutional nets, atrous convolution, and fully connected CRFs. IEEE Transactions on Pattern Analysis and Machine Intelligence, 40(04):834–848, 2018.
247
+
248
+ Liang-Chieh Chen, Alexander G. Schwing, Alan L. Yuille, and Raquel Urtasun. Learning deep structured models. In Proceedings of the 32nd International Conference on International Conference on Machine Learning, ICML’15, pp. 1785–1794. JMLR, 2015.
249
+
250
+ Emir Demirovic, Peter J. Stuckey, James Bailey, Jeffrey Chan, Christopher Leckie, Kotagiri Ramamohanarao, and Tias Guns. Predict+optimise with ranking objectives: Exhaustively learning linear functions. In Sarit Kraus (ed.), Proceedings of the Twenty-Eighth International Joint Conference on Artificial Intelligence, IJCAI 2019, Macao, China, August 10-16, 2019, pp. 1078–1085. ijcai.org, 2019. doi: 10.24963/ijcai.2019/151. URL https://doi.org/10.24963/ijcai.2019/151.
251
+
252
+ Michel Deudon, Pierre Cournut, Alexandre Lacoste, Yossiri Adulyasak, and Louis-Martin Rousseau. Learning heuristics for the tsp by policy gradient. In Willem-Jan van Hoeve (ed.), Proc. of Intl. Conf. on Integration of Constraint Programming, Artificial Intelligence, and Operations Research, pp. 170–181. Springer, 2018.
253
+
254
+ E. W. Dijkstra. A note on two problems in connexion with graphs. Numer. Math., 1(1):269–271, December 1959. doi: 10.1007/BF01386390.
255
+
256
+ Justin Domke. Generic methods for optimization-based modeling. In Artificial Intelligence and Statistics, pp. 318–326, 2012.
257
+
258
+ Jack Edmonds. Paths, trees, and flowers. Canad. J. Math., 17:449–467, 1965. URL www.cs. berkeley.edu/∼christos/classics/edmonds.ps.
259
+
260
+ Adam N. Elmachtoub and Paul Grigas. Smart ”predict, then optimize”. ArXiv, abs/1710.08005, 2017.
261
+
262
+ Aaron Ferber, Bryan Wilder, Bistra Dilkina, and Milind Tambe. Mipaal: Mixed integer program as a layer. CoRR, abs/1907.05912, 2019. URL http://arxiv.org/abs/1907.05912.
263
+
264
+ Chuan-sheng Foo, Chuong B Do, and Andrew Y Ng. Efficient multiple hyperparameter learning for log-linear models. In Advances in neural information processing systems, pp. 377–384, 2008.
265
+
266
+ Maxime Gasse, Didier Chetelat, Nicola Ferroni, Laurent Charlin, and Andrea Lodi. Exact combina- ´ torial optimization with graph convolutional neural networks. arXiv, abs/1906.01629, 2019. URL http://arxiv.org/abs/1906.01629.
267
+
268
+ John C. Gower and Garmt B. Dijksterhuis. Procrustes problems, volume 30 of Oxford Statistical Science Series. Oxford University Press, Oxford, UK, January 2004.
269
+
270
+ Alex Graves, Greg Wayne, and Ivo Danihelka. Neural turing machines. arXiv, abs/1410.5401, 2014. URL http://arxiv.org/abs/1410.5401.
271
+
272
+ Alex Graves, Greg Wayne, Malcolm Reynolds, Tim Harley, Ivo Danihelka, Agnieszka GrabskaBarwinska, Sergio G ´ omez Colmenarejo, Edward Grefenstette, Tiago Ramalho, John Agapiou, ´ Adria Puigdom \` enech Badia, Karl Moritz Hermann, Yori Zwols, Georg Ostrovski, Adam Cain, \` Helen King, Christopher Summerfield, Phil Blunsom, Koray Kavukcuoglu, and Demis Hassabis. Hybrid computing using a neural network with dynamic external memory. Nature, 538(7626): 471–476, October 2016.
273
+
274
+ LLC Gurobi Optimization. Gurobi optimizer reference manual, 2019. URL http://www.gurobi.com.
275
+
276
+ Jean Guyomarch. Warcraft ii open-source map editor, 2017. URL http://github.com/war2/war2edit.
277
+
278
+ Tamir Hazan, Joseph Keshet, and David A. McAllester. Direct loss minimization for structured prediction. In Advances in Neural Information Processing Systems 23, pp. 1594–1602. Curran Associates, Inc., 2010.
279
+
280
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), June 2016.
281
+
282
+ Elias B. Khalil, Pierre Le Bodic, Le Song, George Nemhauser, and Bistra Dilkina. Learning to branch in mixed integer programming. In Proceedings of the Thirtieth AAAI Conference on Artificial Intelligence, AAAI16, pp. 724731. AAAI Press, 2016.
283
+
284
+ Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization, 2014. cite arxiv:1412.6980Comment: Published as a conference paper at the 3rd International Conference for Learning Representations, San Diego, 2015.
285
+
286
+ Patrick Knobelreiter, Christian Reinbacher, Alexander Shekhovtsov, and Thomas Pock. End-to-end¨ training of hybrid cnn-crf models for stereo. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR’17), July 2017.
287
+
288
+ Vladimir Kolmogorov. Blossom V: a new implementation of a minimum cost perfect matching algorithm. Mathematical Programming Computation, 1(1):43–67, Jul 2009. doi: 10.1007/ s12532-009-0002-8. URL http://pub.ist.ac.at/∼vnk/software.html.
289
+
290
+ Wouter Kool, Herke van Hoof, and Max Welling. Attention, learn to solve routing problems! In International Conference on Learning Representations (ICLR’19), 2019. URL http://openreview. net/forum?id=ByxBFsRqYm.
291
+
292
+ Yujia Li, Richard Zemel, Marc Brockschmidt, and Daniel Tarlow. Gated graph sequence neural networks. In International Conference on Learning Representations (ICLR’16), 2016. URL http://arxiv.org/abs/1511.05493.
293
+
294
+ Zhuwen Li, Qifeng Chen, and Vladlen Koltun. Combinatorial optimization with graph convolutional networks and guided tree search. In Advances in Neural Information Processing Systems, NeurIPS’18, pp. 537–546, USA, 2018. Curran Associates Inc.
295
+
296
+ Ziwei Liu, Xiaoxiao Li, Ping Luo, Chen-Change Loy, and Xiaoou Tang. Semantic image segmentation via deep parsing network. In IEEE International Conference on Computer Vision, ICCV’15, pp. 1377–1385. IEEE Computer Society, 2015. doi: 10.1109/ICCV.2015.162.
297
+
298
+ Guy Lorberbom, Andreea Gane, Tommi S. Jaakkola, and Tamir Hazan. Direct optimization through arg max for discrete variational auto-encoder. arXiv, abs/1806.02867, 2018. URL http://arxiv. org/abs/1806.02867.
299
+
300
+ Jaynta Mandi, Emir Demirovic, Peter J. Stuckey, and Tias Guns. Smart predict-and-optimize for hard combinatorial optimization problems. CoRR, abs/1911.10092, 2019. URL http://arxiv.org/ abs/1911.10092.
301
+
302
+ Hugues Marchand, Alexander Martin, Robert Weismantel, and Laurence Wolsey. Cutting planes in integer and mixed integer programming. Discrete Appl. Math., 123(1-3):397–446, November 2002. doi: 10.1016/S0166-218X(01)00348-1.
303
+
304
+ Dmitrii Marin, Meng Tang, Ismail Ben Ayed, and Yuri Boykov. Beyond gradient descent for regularized segmentation losses. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR’19), June 2019.
305
+
306
+ Shakir Mohamed, Mihaela Rosca, Michael Figurnov, and Andriy Mnih. Monte carlo gradient estimation in machine learning. arXiv, abs/1906.10652, 2019. URL http://arxiv.org/abs/1906.10652.
307
+
308
+ Pritish Mohapatra, Michal Rol´ınek, C.V. Jawahar, Vladimir Kolmogorov, and M. Pawan Kumar. Efficient optimization for rank-based loss functions. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR’18), June 2018.
309
+
310
+ MohammadReza Nazari, Afshin Oroojlooy, Lawrence Snyder, and Martin Takac. Reinforcement learning for solving the vehicle routing problem. In S. Bengio, H. Wallach, H. Larochelle, K. Grauman, N. Cesa-Bianchi, and R. Garnett (eds.), Advances in Neural Information Processing Systems 31, pp. 9839–9849. Curran Associates, Inc., 2018. URL http://papers.nips.cc/paper/ 8190-reinforcement-learning-for-solving-the-vehicle-routing-problem.pdf.
311
+
312
+ Vlad Niculae, Andre Martins, Mathieu Blondel, and Claire Cardie. SparseMAP: Differentiable sparse structured inference. In Jennifer Dy and Andreas Krause (eds.), Proceedings of the 35th International Conference on Machine Learning, volume 80 of Proceedings of Machine Learning Research, pp. 3799–3808, Stockholmsmssan, Stockholm Sweden, 10–15 Jul 2018. PMLR. URL http://proceedings.mlr.press/v80/niculae18a.html.
313
+
314
+ Despoina Paschalidou, Ali Osman Ulusoy, Carolin Schmitt, Luc Gool, and Andreas Geiger. Raynet: Learning volumetric 3d reconstruction with ray potentials. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR’18), 2018.
315
+
316
+ Leonid Pishchulin, Eldar Insafutdinov, Siyu Tang, Bjorn Andres, Mykhaylo Andriluka, Peter Gehler, ¨ and Bernt Schiele. Deepcut: Joint subset partition and labeling for multi person pose estimation. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR’16), pp. 4929–4937. IEEE, 2016.
317
+
318
+ Alec Radford, Luke Metz, and Soumith Chintala. Unsupervised representation learning with deep convolutional generative adversarial networks, 2015. URL http://arxiv.org/abs/1511.06434.
319
+
320
+ Prasad Raghavendra. Optimal algorithms and inapproximability results for every CSP? In Proceedings of the 40th Annual ACM Symposium on Theory of Computing, STOC ’08, pp. 245–254, New York, NY, USA, 2008. ACM. doi: 10.1145/1374376.1374414.
321
+
322
+ Kegan GG Samuel and Marshall F Tappen. Learning optimized map estimates in continuouslyvalued mrf models. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR’09), pp. 477–484, 2009.
323
+
324
+ Franco Scarselli, Marco Gori, Ah Chung Tsoi, Markus Hagenbuchner, and Gabriele Monfardini. The graph neural network model. Trans. Neur. Netw., 20(1):61–80, January 2009. ISSN 1045- 9227. doi: 10.1109/TNN.2008.2005605.
325
+
326
+ Uwe Schmidt and Stefan Roth. Shrinkage fields for effective image restoration. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR’14), pp. 2774–2781, 2014.
327
+
328
+ Samuel Schulter, Paul Vernaza, Wongun Choi, and Manmohan Krishna Chandraker. Deep network flow for multi-object tracking. IEEE Conference on Computer Vision and Pattern Recognition (CVPR’17), pp. 2730–2739, 2017.
329
+
330
+ Daniel Selsam and Nikolaj Bjørner. Guiding high-performance SAT solvers with Unsat-Core predictions. In Mikola´s Janota and In ˇ es Lynce (eds.), ˆ Theory and Applications of Satisfiability Testing – SAT 2019, pp. 336–353. Springer International Publishing, 2019.
331
+
332
+ Daniel Selsam, Matthew Lamm, Benedikt Bunz, Percy Liang, Leonardo de Moura, and David L. ¨ Dill. Learning a SAT solver from single-bit supervision. In International Conference on Learning Representations (ICLR’19), 2019. URL http://openreview.net/forum?id=HJMC iA5tm.
333
+
334
+ Jie Song, Bjoern Andres, Michael Black, Otmar Hilliges, and Siyu Tang. End-to-end learning for graph decomposition. arXiv, 1812.09737, 2018. URL http://arxiv.org/abs/1812.09737.
335
+
336
+ Yang Song, Alexander Schwing, Richard, and Raquel Urtasun. Training deep neural networks via direct loss minimization. In 33rd International Conference on Machine Learning (ICML), volume 48 of Proceedings of Machine Learning Research, pp. 2169–2177. PMLR, 2016.
337
+
338
+ Sainbayar Sukhbaatar, Arthur Szlam, Jason Weston, and Rob Fergus. End-to-end memory networks. In Advances in Neural Information Processing Systems 28 (NIPS), pp. 2440–2448. Curran Associates, Inc., 2015.
339
+
340
+ Johan Thapper and Stanislav Zivn ˇ y. The limits of SDP relaxations for general-valued CSPs. In ´ 32nd Annual ACM/IEEE Symposium on Logic in Computer Science, LICS ’17, pp. 27:1–27:12, Piscataway, NJ, USA, 2017. IEEE Press.
341
+
342
+ Jonathan J Tompson, Arjun Jain, Yann LeCun, and Christoph Bregler. Joint training of a convolutional network and a graphical model for human pose estimation. In Advances in Neural Information Processing Systems 27 (NIPS’14), pp. 1799–1807. Curran Associates, Inc., 2014.
343
+
344
+ Sebastian Tschiatschek, Aytunc Sahin, and Andreas Krause. Differentiable submodular maximization. In Proc. International Joint Conference on Artificial Intelligence (IJCAI), July 2018.
345
+
346
+ Ioannis Tsochantaridis, Thorsten Joachims, Thomas Hofmann, and Yasemin Altun. Large margin methods for structured and interdependent output variables. J. Mach. Learn. Res., 6:1453–1484, 2005.
347
+
348
+ Oriol Vinyals, Meire Fortunato, and Navdeep Jaitly. Pointer networks. In Advances in Neural Information Processing Systems 28 (NIPS’15), pp. 2692–2700. Curran Associates, Inc., 2015.
349
+
350
+ Po-Wei Wang, Priya L. Donti, Bryan Wilder, and Zico Kolter. SATNet: Bridging deep learning and logical reasoning using a differentiable satisfiability solver. arXiv, 1905.12149, 2019. URL http://arxiv.org/abs/1905.12149.
351
+
352
+ Bryan Wilder, Eric Ewing, Bistra Dilkina, and Milind Tambe. End to end learning and optimization on graphs. In H. Wallach, H. Larochelle, A. Beygelzimer, F. d AlcheBuc, E. Fox, and R. Garnett (eds.), Advances in Neural Information Processing Systems 32, pp. 4674–4685. Curran Associates, Inc., 2019. URL http://papers.nips.cc/paper/ 8715-end-to-end-learning-and-optimization-on-graphs.pdf.
353
+
354
+ Mang Ye, Andy J. Ma, Liang Zheng, Jiawei Li, and Pong C. Yuen. Dynamic label graph matching for unsupervised video re-identification. In IEEE International Conference on Computer Vision (ICCV’17). IEEE Computer Society, Oct 2017.
355
+
356
+ Shuai Zheng, Sadeep Jayasumana, Bernardino Romera-Paredes, Vibhav Vineet, Zhizhong Su, Dalong Du, Chang Huang, and Philip H. S. Torr. Conditional random fields as recurrent neural networks. In IEEE International Conference on Computer Vision (ICCV’15), pp. 1529–1537. IEEE Computer Society, 2015.
357
+
358
+ # A APPENDIX
359
+
360
+ # A.1 GUIDELINES FOR SETTING THE VALUES OF $\lambda$ .
361
+
362
+ In practice, $\lambda$ has to be chosen appropriately, but we found its exact choice uncritical (no precise tuning was required). Nevertheless, note that $\lambda$ should cause a noticeable disruption in the optimization problem from equation (3), otherwise it is too likely that $y ( w ) = y _ { \lambda } ( w )$ resulting in a zero gradient. In other words, $\lambda$ should roughly be of the magnitude that brings the two terms in the definition of $w ^ { \prime }$ in Prop. 1 to the same order:
363
+
364
+ $$
365
+ \lambda \approx \frac { \left. w \right. } { \left. \frac { \mathrm { d } L } { \mathrm { d } y } \right. }
366
+ $$
367
+
368
+ where $\langle \cdot \rangle$ stands for the average. This again justifies that $\lambda$ is a true hyperparameter and that there is no reason to expect values around $\lambda \bar { } 0 ^ { \bar { + } }$ .
369
+
370
+ # A.2 PROOFS
371
+
372
+ Proof of Proposition 1. Let us write $L = L ( \hat { y } )$ and $\begin{array} { r } { \nabla L = \frac { \mathrm { d } L } { \mathrm { d } y } ( \hat { y } ) } \end{array}$ , for brevity. Thanks to the linearity of $\mathbf { c }$ and the definition of $f$ , we have
373
+
374
+ $$
375
+ \mathbf { c } ( \hat { w } , y ) + \lambda f ( y ) = \hat { w } y + \lambda \big ( L + \nabla L ( y - \hat { y } ) \big ) = ( \hat { w } + \lambda \nabla L ) y + \lambda L - \lambda \nabla L \hat { y } = \mathbf { c } ( w ^ { \prime } , y ) + \mathbf { c } _ { 0 } ,
376
+ $$
377
+
378
+ where $\mathbf { c } _ { 0 } = \lambda L - \lambda \nabla L \hat { y }$ and $w ^ { \prime } = \hat { w } + \lambda \nabla L$ as desired. The conclusion about the points of minima then follows.
379
+
380
+ Before we prove Theorem 1, we make some preliminary observations. To start with, due to the definition of the solver, we have the fundamental inequality
381
+
382
+ $$
383
+ \mathbf { c } ( w , y ) \geq \mathbf { c } { \big ( } w , y ( w ) { \big ) } \quad { \mathrm { f o r ~ e v e r y ~ } } w \in W { \mathrm { ~ a n d ~ } } y \in Y .
384
+ $$
385
+
386
+ Observation 1. The function $w \mapsto \mathbf { c } \big ( w , y ( w ) \big )$ is continuous and piecewise linear.
387
+
388
+ Proof. Since c’s are linear and distinct, $\mathbf { c } ( w , y ( w ) )$ , as their pointwise minimum, has the desired properties. □
389
+
390
+ Analogous fundamental inequality
391
+
392
+ $\mathbf { c } ( w , y ) + \lambda f ( y ) \geq \mathbf { c } { \big ( } w , y _ { \lambda } ( w ) { \big ) } + \lambda f { \big ( } y _ { \lambda } ( w ) { \big ) } \quad { \mathrm { f o r ~ e } }$ very $w \in W$ and $y \in Y$
393
+
394
+ follows from the definition of the solution to the optimization problem (3).
395
+
396
+ A counterpart of Observation 1 reads as follows.
397
+
398
+ Observation 2. The function $w \mapsto { \bf c } \big ( w , y _ { \lambda } ( w ) \big ) + \lambda f \big ( y _ { \lambda } ( w ) \big )$ is continuous and piecewise affine.
399
+
400
+ Proof. The function under inspection is a pointwise minimum of distinct affine functions $w \mapsto$ $\mathbf { c } ( w , y ) + \lambda f ( y )$ as $y$ ranges $Y$ .
401
+
402
+ As a consequence of above-mentioned fundamental inequalities, we obtain the following two-sided estimates on $f _ { \lambda }$ .
403
+
404
+ Observation 3. The following inequalities hold for $w \in W$
405
+
406
+ $$
407
+ f \bigl ( y _ { \lambda } ( w ) \bigr ) \leq f _ { \lambda } ( w ) \leq f \bigl ( y ( w ) \bigr ) .
408
+ $$
409
+
410
+ Proof. Inequality (6) implies that $\mathbf { c } \big ( w , y ( w ) \big ) - \mathbf { c } \big ( w , y _ { \lambda } ( w ) \big ) \ \leq \ 0$ and the first inequality then follows simply from the definition of $f _ { \lambda }$ . As for the second one, it suffices to apply (7) to $y =$ $y ( w )$ .
411
+
412
+ Now, let us introduce few notions that will be useful later in the proofs. For a fixed $\lambda , W$ partitions into maximal connected sets $P$ on which $y _ { \lambda } ( w )$ is constant (see Fig. 7). We denote this collection of sets by ${ \mathcal { W } } _ { \lambda }$ and set $\mathcal { W } = \mathcal { W } _ { 0 }$ .
413
+
414
+ For $\lambda \in \mathbb { R }$ and $y _ { 1 } \ne y _ { 2 } \in Y$ , we denote
415
+
416
+ $$
417
+ F _ { \lambda } ( y _ { 1 } , y _ { 2 } ) = \big \{ w \in W : c ( w , y _ { 1 } ) + \lambda f ( y _ { 1 } ) = c ( w , y _ { 2 } ) + \lambda f ( y _ { 2 } ) \big \} .
418
+ $$
419
+
420
+ We write $F ( y _ { 1 } , y _ { 2 } ) = F _ { 0 } ( y _ { 1 } , y _ { 2 } )$ , for brevity. For technical reasons, we also allow negative values of $\lambda$ here.
421
+
422
+ (a) The situation for $\lambda \ = \ 0$ . We can see the polytope $P$ on which $y ( w )$ attains $y _ { 1 } \in Y$ . The boundary of $P$ is composed of segments of lines $F ( y _ { 1 } , y _ { k } )$ for $k = 2 , \ldots , 5$ .
423
+
424
+ ![](images/232f340aaca3efe65b2229d5e3ec72dad55d58b162a7c9e17e73c6dadfb41045.jpg)
425
+ (b) The same situation is captured for some relatively small $\lambda > 0$ . Each line $F _ { \lambda } ( y _ { 1 } , y _ { k } )$ is parallel to its corresponding $F ( y _ { 1 } , y _ { k } )$ and encompasses a convex polytope in ${ \mathcal { W } } _ { \lambda }$ .
426
+ Figure 7: The family ${ \mathcal { W } } _ { \lambda }$ of all maximal connected sets $P$ on which $y _ { \lambda }$ is constant.
427
+
428
+ Note, that if $W \ : = \ : \mathbb { R } ^ { N }$ , then $F _ { \lambda }$ is a hyperplane since c’s are linear. In general, $W$ may just be a proper subset of $\mathbb { R } ^ { N }$ and, in that case, $F _ { \lambda }$ is just the restriction of a hyperplane onto $W$ . Consequently, it may happen that $F _ { \lambda } ( y _ { 1 } , y _ { 2 } )$ will be empty for some pair of $y _ { 1 } , y _ { 2 }$ and some $\lambda \in \mathbb { R }$ . To emphasize this fact, we say “hyperplane in $W ^ { \prime \prime }$ . Analogous considerations should be taken into account for all other linear objects. The note “in $W ^ { \prime \prime }$ stands for the intersection of these linear object with the set $W$ .
429
+
430
+ Observation 4. Let $P \in \mathcal { W } _ { \lambda }$ and let $y _ { \lambda } ( w ) = y$ for $w \in P$ . Then $P$ is a convex polytope in $W$ , where the facets consist of parts of finitely many hyperplanes $F _ { \lambda } ( y , y _ { k } )$ in $W$ for some $\{ y _ { k } \} \subset Y$ .
431
+
432
+ Proof. Assume that $W = \mathbb { R } ^ { N }$ . The values of $y _ { \lambda }$ may only change on hyperplanes of the form $F _ { \lambda } ( y , y ^ { \prime } )$ for some $y ^ { \prime } \in Y$ . Then $P$ is an intersection of corresponding half-spaces and therefore $P$ is a convex polytope. If $W$ is a proper subset of $\mathbb { R } ^ { N }$ the claim follows by intersecting all the objects with $W$ . □
433
+
434
+ Observation 5. Let $y _ { 1 } , y _ { 2 } \in Y$ be distinct. If nonempty, the hyperplanes $F ( y _ { 1 } , y _ { 2 } )$ and $F _ { \lambda } ( y _ { 1 } , y _ { 2 } )$ are parallel and their distance is equal to $| \lambda | K ( y _ { 1 } , y _ { 2 } )$ , where
435
+
436
+ $$
437
+ K ( y _ { 1 } , y _ { 2 } ) = { \frac { | f ( y _ { 1 } ) - f ( y _ { 2 } ) | } { \| y _ { 1 } - y _ { 2 } \| } } .
438
+ $$
439
+
440
+ Proof. If we define a function $c ( w ) = \mathbf { c } ( w , y _ { 1 } ) - \mathbf { c } ( w , y _ { 2 } ) = w ( y _ { 1 } - y _ { 2 } )$ and a constant $C =$ $f ( y _ { 2 } ) - f ( y _ { 1 } )$ , then our objects rewrite to
441
+
442
+ $$
443
+ F ( y _ { 1 } , y _ { 2 } ) = \{ w \in W : c ( w ) = 0 \} \quad { \mathrm { a n d } } \quad F _ { \lambda } ( y _ { 1 } , y _ { 2 } ) = \{ w \in W : c ( w ) = \lambda C \} .
444
+ $$
445
+
446
+ Since $c$ is linear, these sets are parallel and $F ( y _ { 1 } , y _ { 2 } )$ intersects the origin. Thus, the required distance is the distance of the hyperplane $F _ { \lambda } ( y _ { 1 } , y _ { 2 } )$ from the origin, which equals to $| \lambda C | / \bar { | | } y _ { 1 } -$ $y _ { 2 } \|$ . □
447
+
448
+ As the set $Y$ is finite, there is a uniform upper bound $K$ on all values of $K ( y _ { 1 } , y _ { 2 } )$ . Namely
449
+
450
+ $$
451
+ K = \operatorname* { m a x } _ { \boldsymbol { y } _ { 1 } , \boldsymbol { y } _ { 2 } \in \boldsymbol { Y } \atop \boldsymbol { y } _ { 1 } \neq \boldsymbol { y } _ { 2 } } K ( \boldsymbol { y } _ { 1 } , \boldsymbol { y } _ { 2 } ) .
452
+ $$
453
+
454
+ # A.2.1 PROOF OF THEOREM 1
455
+
456
+ Proof of Property A1. Now, Property A1 follows, since
457
+
458
+ $$
459
+ f _ { \lambda } ( w ) = { \frac { 1 } { \lambda } } { \Big [ } \mathbf { c } { \big ( } w , y _ { \lambda } ( w ) { \big ) } + \lambda f { \big ( } y _ { \lambda } ( w ) { \big ) } { \Big ] } - { \frac { 1 } { \lambda } } \mathbf { c } { \big ( } w , y ( w ) { \big ) }
460
+ $$
461
+
462
+ and $f _ { \lambda }$ is a difference of continuous and piecewise affine functions.
463
+
464
+ Proof of Property A2. Let $0 < \lambda _ { 1 } \leq \lambda _ { 2 }$ be given. We show that $W _ { \mathsf { e q } } ^ { \lambda _ { 2 } } \subseteq W _ { \mathsf { e q } } ^ { \lambda _ { 1 } }$ which is the same as showing $W _ { \mathrm { d i f } } ^ { \lambda _ { 1 } } \subseteq W _ { \mathrm { d i f } } ^ { \lambda _ { 2 } }$ . Assume that $w \in W _ { \mathrm { e q } } ^ { \lambda _ { 2 } }$ , that is, by the definition of $W _ { \mathrm { e q } } ^ { \lambda _ { 2 } }$ and $f _ { \lambda }$ ,
465
+
466
+ $$
467
+ \mathbf { c } \bigl ( w , y ( w ) \bigr ) + \lambda _ { 2 } f \bigl ( y ( w ) \bigr ) = \mathbf { c } ( w , y _ { 2 } ) + \lambda _ { 2 } f \bigl ( y _ { 2 } \bigr ) ,
468
+ $$
469
+
470
+ in which we denoted $y _ { 2 } = y _ { \lambda _ { 2 } } ( w )$ . Our goal is to show that
471
+
472
+ $$
473
+ \mathbf { c } \bigl ( w , y ( w ) \bigr ) + \lambda _ { 1 } f \bigl ( y ( w ) \bigr ) = \mathbf { c } ( w , y _ { 1 } ) + \lambda _ { 1 } f \bigl ( y _ { 1 } \bigr ) ,
474
+ $$
475
+
476
+ where $y _ { 1 } = y _ { \lambda _ { 1 } } ( w )$ as this equality then guarantees that $w \in W _ { \mathrm { e q } } ^ { \lambda _ { 1 } }$ . Observe that (7) applied to $\lambda = \lambda _ { 1 }$ and $y = y ( w )$ , yields the inequality $\because$ in (10).
477
+
478
+ Let us show the reversed inequality. By Observation 3 applied to $\lambda = \lambda _ { 1 }$ , we have
479
+
480
+ $$
481
+ f ( y ( w ) ) \geq f ( y _ { 1 } ) .
482
+ $$
483
+
484
+ We now use (7) with $\lambda = \lambda _ { 2 }$ and $y = y _ { 1 }$ , followed by equality (9) to obtain
485
+
486
+ $$
487
+ \begin{array} { r l } & { \mathbf c ( w , y _ { 1 } ) + \lambda _ { 1 } f ( y _ { 1 } ) = \mathbf c ( w , y _ { 1 } ) + \lambda _ { 2 } f ( y _ { 1 } ) + ( \lambda _ { 1 } - \lambda _ { 2 } ) f ( y _ { 1 } ) } \\ & { \qquad \geq \mathbf c ( w , y _ { 2 } ) + \lambda _ { 2 } f ( y _ { 2 } ) + ( \lambda _ { 1 } - \lambda _ { 2 } ) f ( y _ { 1 } ) } \\ & { \qquad = \mathbf c ( w , y ( w ) ) + \lambda _ { 2 } f \big ( y ( w ) \big ) + ( \lambda _ { 1 } - \lambda _ { 2 } ) f ( y _ { 1 } ) } \\ & { \qquad = \mathbf c \big ( w , y ( w ) \big ) + \lambda _ { 1 } f \big ( y ( w ) \big ) + ( \lambda _ { 2 } - \lambda _ { 1 } ) \big [ f \big ( y ( w ) \big ) - f ( y _ { 1 } ) \big ] } \\ & { \qquad \geq \mathbf c \big ( w , y ( w ) \big ) + \lambda _ { 1 } f \big ( y ( w ) \big ) } \end{array}
488
+ $$
489
+
490
+ where the last inequality holds due to (11).
491
+
492
+ Next, we have to show that $W _ { \mathrm { d i f } } ^ { \lambda } \to \emptyset$ as $\lambda 0 ^ { + }$ , i.e. that for almost every $w \in W$ , there is a $\lambda > 0$ such that $w \not \in W _ { \mathrm { d i f } } ^ { \lambda }$ . To this end, let $w \in W$ be given. We can assume that $y ( w )$ is a unique solution of solver (1), since two solutions, say $y _ { 1 }$ and $y _ { 2 }$ , coincide only on the hyperplane $F ( y _ { 1 } , y _ { 2 } )$ in $W$ , which is of measure zero. Thus, since $Y$ is finite, the constant
493
+
494
+ $$
495
+ c = \operatorname* { m i n } _ { y \in Y \atop y \neq y ( w ) } \left\{ \mathbf { c } ( w , y ) - \mathbf { c } \big ( w , y ( w ) \big ) \right\}
496
+ $$
497
+
498
+ is positive. Denote
499
+
500
+ $$
501
+ d = \operatorname* { m a x } _ { y \in Y } \{ f { \big ( } y ( w ) { \big ) } - f ( y ) \} .
502
+ $$
503
+
504
+ If $d > 0$ , set $\lambda < c / d$ . Then, for every $y \in Y$ such that $f \left( y ( w ) \right) > f ( y )$ , we have
505
+
506
+ $$
507
+ \lambda < \frac { \mathbf { c } ( w , y ) - \mathbf { c } ( w , y ( w ) ) } { f \big ( y ( w ) \big ) - f ( y ) }
508
+ $$
509
+
510
+ which rewrites
511
+
512
+ $$
513
+ \mathbf { c } \big ( w , y ( w ) \big ) + \lambda f \big ( y ( w ) \big ) < \mathbf { c } ( w , y ) + \lambda f ( y ) .
514
+ $$
515
+
516
+ For the remaining ’s, (13) holds trivially for every $\lambda > 0$ . Therefore, $y ( w )$ is a solution of the minimization problem (3), whence $y _ { \lambda } ( w ) = y ( w )$ . This shows that $w \in W _ { \mathrm { e q } } ^ { \lambda }$ as we wished. If $d = 0$ , then $f \bigl ( y ( w ) \bigr ) \leq f ( y )$ for every $y \in Y$ and (13) follows again. □
517
+
518
+ Proof of Property A3. Let $y _ { 1 } \ne y _ { 2 } \in Y$ be given. We show that on the component of the set
519
+
520
+ $$
521
+ \{ w \in W : y ( w ) = y _ { 1 } \mathrm { a n d } y _ { \lambda } ( w ) = y _ { 2 } \}
522
+ $$
523
+
524
+ the function $f _ { \lambda }$ agrees with a $\delta$ -interpolator, where $\delta \leq C \lambda$ and $C > 0$ is an absolute constant. The claim follows as there are only finitely many sets and their components of the form (14) in $W _ { \mathrm { d i f } } ^ { \lambda }$ .
525
+
526
+ Let us set
527
+
528
+ $$
529
+ h ( w ) = \mathbf { c } ( w , y _ { 1 } ) - \mathbf { c } ( w , y _ { 2 } ) \quad { \mathrm { f o r ~ } } w \in W
530
+ $$
531
+
532
+ and
533
+
534
+ $$
535
+ g ( w ) = f ( y _ { 2 } ) - { \frac { 1 } { \lambda } } h ( w ) .
536
+ $$
537
+
538
+ The condition on c tells us that $h$ is a non-constant affine function. It follows by the definition of $F ( y _ { 1 } , y _ { 2 } )$ and $F _ { \lambda } ( y _ { 1 } , y _ { 2 } )$ that
539
+
540
+ $$
541
+ h ( w ) = 0 \quad { \mathrm { i f ~ a n d ~ o n l y ~ i f } } \quad w \in F ( y _ { 1 } , y _ { 2 } )
542
+ $$
543
+
544
+ and
545
+
546
+ $$
547
+ h ( w ) = \lambda { \big ( } f ( y _ { 2 } ) - f ( y _ { 1 } ) { \big ) } \quad { \mathrm { i f ~ a n d ~ o n l y ~ i f } } \quad w \in F _ { \lambda } ( y _ { 1 } , y _ { 2 } ) .
548
+ $$
549
+
550
+ By Observation 5, the sets $F$ and $F _ { \lambda }$ are parallel hyperplanes. Denote by $G$ the nonempty intersection of their corresponding half-spaces in $W$ . We show that $g$ is a $\delta$ -interpolator of $f$ on $G$ between $y _ { 1 }$ and $y _ { 2 }$ , with $\delta$ being linearly controlled by $\lambda$ .
551
+
552
+ We have already observed that $g$ is the affine function ranging from $f ( y _ { 1 } ) - \mathbf { o n }$ the set $F _ { \lambda } ( y _ { 1 } , y _ { 2 } ) -$ to $f ( y _ { 2 } )$ – on the set $F ( y _ { 1 } , y _ { 2 } )$ . It remains to show that $g$ attains both the values $f ( y _ { 1 } )$ and $f ( y _ { 2 } )$ at most $\delta$ -far from the sets $P _ { 1 }$ and $P _ { 2 }$ , respectively, where $P _ { k } \in \mathcal { W }$ denotes a component of the set $\{ w \in W : y ( w ) = y _ { k } \}$ , $k = 1 , 2$ .
553
+
554
+ Consider $y _ { 1 }$ first. By Observation 4, there are $z _ { 1 } , \dotsc , z _ { \ell } \in Y$ , such that facets of $P _ { 1 }$ are parts of hyperplanes $F ( y _ { 1 } , z _ { 1 } ) , \dots , F ( y _ { 1 } , z _ { \ell } )$ in $W$ . Each of them separates $W$ into two half-spaces, say $W _ { k } ^ { + }$ and $W _ { k } ^ { - }$ , where $W _ { k } ^ { - }$ is the half-space which contains $P _ { 1 }$ and $W _ { k } ^ { + }$ is the other one. Let us denote
555
+
556
+ $$
557
+ c _ { k } ( w ) = \mathbf { c } ( w , y _ { 1 } ) - \mathbf { c } ( w , z _ { k } ) \quad { \mathrm { f o r ~ } } w \in W { \mathrm { ~ a n d ~ } } k = 1 , \ldots , \ell .
558
+ $$
559
+
560
+ Every $c _ { k }$ is a non-zero linear function which is negative on $W _ { k } ^ { - }$ and positive on $W _ { k } ^ { + }$ . By the definition of $y _ { 1 }$ , we have
561
+
562
+ $$
563
+ \begin{array} { r } { \mathbf { c } ( w , y _ { 1 } ) + \lambda f ( y _ { 1 } ) \leq \mathbf { c } ( w , z _ { k } ) + \lambda f ( z _ { k } ) \quad \mathrm { f o r } w \in P _ { 1 } \mathrm { a n d f o r } k = 1 , \dots , \ell , } \end{array}
564
+ $$
565
+
566
+ that is
567
+
568
+ $$
569
+ c _ { k } ( w ) \leq \lambda { \big ( } f ( z _ { k } ) - f ( y _ { 1 } ) { \big ) } \quad { \mathrm { f o r ~ } } w \in P _ { 1 } { \mathrm { ~ a n d ~ f o r ~ } } k = 1 , \ldots , \ell .
570
+ $$
571
+
572
+ (a) The facets of $P _ { 1 }$ consist of parts of hyperplanes $F ( y _ { 1 } , z _ { k } )$ in $W$ . Each facet $F ( y _ { 1 } , z _ { k } )$ has its corresponding shifts $F _ { \lambda }$ and $F _ { - \lambda }$ , from which only one intersects $P$ . The polytope $P _ { 1 } ^ { \lambda }$ is then bounded by those outer shifts.
573
+
574
+ ![](images/0c295faf8067eef2fbe1620db532f98c27c070605735905923b255494d4de8be.jpg)
575
+ (b) The interpolator $g$ attains the value $f ( y _ { 1 } )$ on a part of $F _ { \lambda } ( y _ { 1 } , y _ { 2 } ) - \mathbf { a }$ border of the domain $G$ . The value $f ( y _ { 2 } )$ is attained on a part of $F ( y _ { 1 } , y _ { 2 } )$ – the second border of the strip $G$ .
576
+ Figure 8: The polytopes $P _ { 1 }$ and $P _ { 1 } ^ { \lambda }$ and the interpolator $g$
577
+
578
+ Now, denote
579
+
580
+ $$
581
+ W _ { k } ^ { \lambda } = \big \{ w \in W : c _ { k } ( w ) \leq \lambda \big | f ( z _ { k } ) - f ( y _ { 1 } ) \big | \big \} \quad \mathrm { f o r } \ k = 1 , \dots , \ell .
582
+ $$
583
+
584
+ Each $W _ { k } ^ { \lambda }$ is a half-space in $W$ containing $W _ { k } ^ { - }$ and hence $P _ { 1 }$ . Let us set $\begin{array} { r } { P _ { 1 } ^ { \lambda } = \bigcap _ { k = 1 } ^ { \ell } W _ { k } ^ { \lambda } } \end{array}$ . Clearly, $P _ { 1 } \subseteq P _ { 1 } ^ { \lambda }$ (see Fig. 8). By Observation 5, the distance of the hyperplane $\{ w \in W : c _ { k } ( w ) =$ $\lambda { \big | } f ( z _ { k } ) - f ( y _ { 1 } ) { \big | } \}$ from $P _ { 1 }$ is at most $\lambda K$ , where $K$ is given by (8). Therefore, since all the facets of $P _ { 1 } ^ { \lambda }$ are at most $\lambda K$ far from $P _ { 1 }$ , there is a constant $C$ such that each point of $P _ { 1 } ^ { \lambda }$ is at most $C \lambda$ far from $P _ { 1 }$ .
585
+
586
+ Finally, choose any $w _ { 1 } \in P _ { 1 } ^ { \lambda } \cap F _ { \lambda } ( y _ { 1 } , y _ { 2 } )$ . By (16), we have $g ( w _ { 1 } ) = f ( y _ { 1 } )$ , and by the definition of $P _ { 1 } ^ { \lambda }$ , $w _ { 1 }$ is no farther than $C \lambda$ away from $P _ { 1 }$ .
587
+
588
+ Now, let us treat $y _ { 2 }$ and define the set $P _ { 2 } ^ { \lambda }$ analogous to $P _ { 1 } ^ { \lambda }$ , where each occurrence of $y _ { 1 }$ is replaced by $y _ { 2 }$ . Any $w _ { 2 } \in \mathring { P } _ { 2 } ^ { \lambda } \cap F ( y _ { 1 } , y _ { 2 } )$ has desired properties. Indeed, (15) ensures that $g ( w _ { 2 } ) = f ( y _ { 2 } )$ and $w _ { 2 }$ is at most $C \lambda$ far away from $P _ { 2 }$ . □
589
+
590
+ # A.3 DETAILS OF EXPERIMENTS
591
+
592
+ # A.3.1 WARCRAFT SHORTEST PATH
593
+
594
+ The maps for the dataset have been generated with a custom random generation process by using 142 tiles from the Warcraft II tileset (Guyomarch, 2017). The costs for the different terrain types range from 0.8–9.2. Some example maps of size $1 8 \times 1 8$ are presented in Fig. 9a together with a histogram of the shortest path lengths. We used the first five layers of ResNet18 followed by a max-pooling operation to extract the latent costs for the vertices.
595
+
596
+ Optimization was carried out via Adam optimizer (Kingma & Ba, 2014) with scheduled learning rate drops dividing the learning rate by 10 at epochs 30 and 40. Hyperparameters and model details are listed in Tab. 5
597
+
598
+ Table 5: Experimental setup for Warcraft Shortest Path.
599
+
600
+ <table><tr><td>k</td><td>Optimizer(LR)</td><td>Architecture</td><td>Epochs</td><td>Batch Size</td><td>入</td></tr><tr><td>12,18,24, 30</td><td>Adam(5 × 10-4)</td><td>subset of ResNet18</td><td>50</td><td>70</td><td>20</td></tr></table>
601
+
602
+ ![](images/c4d7d1fad40aeeed7fe8bf5d7996e0f53a046bbf953f327668bd1e20bdbb8a7e.jpg)
603
+ Figure 9: Warcraft SP(18) dataset.
604
+
605
+ # A.3.2 MNIST MIN-COST PERFECT MATCHING
606
+
607
+ The dataset consists of randomly generated grids of MNIST digits that are sampled from a subset of 1000 digits of the full MNIST dataset. We trained a fully convolutional neural network with two convolutional layers followed by a max-pooling operation that outputs a $k \times k$ grid of vertex costs for each example. The vertex costs are transformed into the edge costs via the known cost function and the edge costs are then the inputs to the Blossom $\mathrm { v }$ solver (Edmonds, 1965) as implemented in (Kolmogorov, 2009).
608
+
609
+ Regarding the optimization procedure, we employed the Adam optimizer along with scheduled learning rate drops dividing the learning rate by 10 at epochs 10 and 20, respectively. Other training details are in Tab. 6. Lower batch sizes were used to reduce GPU memory requirements.
610
+
611
+ Table 6: Experimental setup for MNIST Min-cost Perfect Matching.
612
+
613
+ <table><tr><td>k</td><td>Optimizer(LR)</td><td>Architecture [channels,kernel size, stride]</td><td>Epochs</td><td>Batch Size</td><td>入</td></tr><tr><td>4,8</td><td>Adam(10-3)</td><td>[[20,5,1],[20, 5,1]]</td><td>30</td><td>70</td><td>10</td></tr><tr><td>16</td><td>Adam(10-3)</td><td>[[50, 5,1], [50, 5,1]]</td><td>30</td><td>40</td><td>10</td></tr><tr><td>24</td><td>Adam(10-3)</td><td>[50, 5,1], [50, 5,1]]</td><td>30</td><td>30</td><td>10</td></tr></table>
614
+
615
+ # A.3.3 GLOBE TRAVELING SALESMAN PROBLEM
616
+
617
+ For the Globe Traveling Salesman Problem we used a convolutional neural network architecture of three convolutional layers and two fully connected layers. The last layer outputs a vector of dimension $3 k$ containing the $k$ 3-dimensional representations of the respective countries’ capital cities. These representations are projected onto the unit sphere and the matrix of pairwise distances is fed to the TSP solver.
618
+
619
+ The high combinatorial complexity of TSP has negative effects on the loss landscape and results in many local minima and high sensitivity to random restarts. For reducing sensitivity to restarts, we set Adam parameters to $\beta _ { 1 } = 0 . 5$ (as it is done for example in GAN training (Radford et al., 2015)) and $\epsilon = 1 \dot { 0 } ^ { - 3 }$ .
620
+
621
+ The local minima correspond to solving planar TSP as opposed to spherical TSP. For example, if all cities are positioned to almost identical locations, the network can still make progress but it will never have the incentive to spread the cities apart in order to reach the global minimum. To mitigate that, we introduce a repellent force between epochs 15 and 30. In particular, we set
622
+
623
+ $$
624
+ L _ { \mathrm { r e p } } = \underset { i \neq j } { \mathbb { E } } e ^ { - \| x _ { i } - x _ { j } \| }
625
+ $$
626
+
627
+ where $x _ { i } \in \mathbb { R } ^ { 3 }$ for $i = 1 , \ldots , k$ are the positions of the $k$ cities on the unit sphere. The regularization constants $C _ { k }$ were chosen as 2.0, 3.0, 6.0, and 20.0 for $k \in \{ 5 , 1 0 , 2 0 , 4 0 \}$ .
628
+
629
+ For fine-tuning we also introduce scheduled learning rate drops where we divide the learning rate by 10 at epochs 80 and 90.
630
+
631
+ Table 7: Experimental setup for the Globe Traveling Salesman Problem.
632
+
633
+ <table><tr><td rowspan="2">k</td><td rowspan="2">Optimizer(LR)</td><td colspan="2">Architecture [channels,kernel size, stride],</td><td rowspan="2">Epochs</td><td rowspan="2">Batch Size</td><td rowspan="2">入</td></tr><tr><td>linear layer size</td><td></td></tr><tr><td>5,10,20</td><td>Adam(10-4)</td><td>[[20, 4,2], [50,4,2], 500]</td><td></td><td>100</td><td>50</td><td>20</td></tr><tr><td>40</td><td>Adam(5 × 10-5)</td><td>[20,4,2],[50,4,2],500]</td><td></td><td>100</td><td>50</td><td>20</td></tr></table>
634
+
635
+ In Fig. 5b, we compare the true city locations with the ones learned by the hybrid architecture. Due to symmetries of the sphere, the architecture can embed the cities in any rotated or flipped fashion. We resolve this by computing “the most favorable” isometric transformation of the suggested locations. In particular, we solve the orthogonal Procrustes problem (Gower & Dijksterhuis, 2004)
636
+
637
+ $$
638
+ R ^ { * } = \underset { R : R ^ { T } R = I } { \arg \operatorname* { m i n } } \| R X - Y \| ^ { 2 }
639
+ $$
640
+
641
+ where $X$ are the suggested locations, $Y$ the true locations, and $R ^ { * }$ the optimal transformation to apply. We report the resulting offsets in kilometers in Tab. 8.
642
+
643
+ Table 8: Average errors of city placement on the Earth.
644
+
645
+ <table><tr><td>k</td><td>5</td><td>10</td><td>20</td><td>40</td></tr><tr><td>Location offset (km)</td><td>69±11</td><td></td><td>19±511±5</td><td>58±7</td></tr></table>
646
+
647
+ # A.4 TRAVELING SALESMAN WITH AN APPROXIMATE SOLVER
648
+
649
+ Since approximate solvers often appear in practice where the combinatorial instances are too large to be solved exactly in reasonable time, we test our method also in this setup. In particular, we use the approximate solver (OR-Tools (ort, 2019)) for the Globe TSP. We draw two conclusions from the numbers presented below in Tab. 9.
650
+
651
+ (i) The choice of the solver matters. Even if OR-Tools is fed with the ground truth representations (i.e. true locations) it does not achieve perfect results on the test set (see the right column). We expect, that also in practical applications, running a suboptimal solver (e.g. a differentiable relaxation) substantially reduces the maximum attainable performance.
652
+ (ii) The suboptimality of the solver didn’t harm the feature extraction – the point of our method. Indeed, the learned locations yield performance that is close to the upper limit of what the solver allows (compare the middle and the right column).
653
+
654
+ Table 9: Perfect path accuracy for Globe TSP using the approximate solver OR-Tools (ort, 2019). The maximal achievable performance is in the right column, where the solver uses the ground truth city locations.
655
+
656
+ <table><tr><td colspan="3">Embedding OR-tools</td><td>OR-tools on GT locations</td></tr><tr><td>k</td><td>Train %</td><td>Test %</td><td>Test %</td></tr><tr><td>5</td><td>99.8 ±0.0</td><td>99.3 ± 0.1</td><td>100.0</td></tr><tr><td>10</td><td>84.3 ± 0.2</td><td>84.4±0.2</td><td>88.6</td></tr><tr><td>20</td><td>49.2 ±0.2</td><td>48.6± 0.8</td><td>54.4</td></tr><tr><td>40</td><td>14.6 ± 0.1</td><td>15.1 ± 0.3</td><td>15.2</td></tr></table>
md/train/BkewX2C9tX/BkewX2C9tX.md ADDED
@@ -0,0 +1,253 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ANALYZING FEDERATED LEARNING THROUGH AN ADVERSARIAL LENS
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Federated learning distributes model training among a multitude of agents, who, guided by privacy concerns, perform training using their local data but share only model parameter updates, for iterative aggregation at the server. In this work, we explore the threat of model poisoning attacks on federated learning initiated by a single, non-colluding malicious agent where the adversarial objective is to cause the model to mis-classify a set of chosen inputs with high confidence. We explore a number of strategies to carry out this attack, starting with simple boosting of the malicious agent’s update to overcome the effects of other agents’ updates. To increase attack stealth, we propose an alternating minimization strategy, which alternately optimizes for the training loss and the adversarial objective. We follow up by using parameter estimation for the benign agents’ updates to improve on attack success. Finally, we use a suite of interpretability techniques to generate visual explanations of model decisions for both benign and malicious models, and show that the explanations are nearly visually indistinguishable. Our results indicate that even a highly constrained adversary can carry out model poisoning attacks while simultaneously maintaining stealth, thus highlighting the vulnerability of the federated learning setting and the need to develop effective defense strategies.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Federated learning introduced by McMahan et al. (2017) has recently emerged as a popular implementation of distributed stochastic optimization for large-scale deep neural network training. It is formulated as a multi-round strategy in which the training of a neural network model is distributed between multiple agents. In each round, a random subset of agents, with local data and computational resources, is selected for training. The selected agents perform model training and share only the parameter updates with a centralized parameter server, that facilitates aggregation of the updates. Motivated by privacy concerns, the server is designed to have no visibility into an agents’ local data and training process. The aggregation algorithm is agnostic to the data distribution at the agents.
12
+
13
+ In this work, we exploit this lack of transparency in the agent updates, and explore the possibility of a single malicious agent performing a model poisoning attack. The malicious agent’s objective is to cause the jointly trained global model to misclassify a set of chosen inputs with high confidence, i.e., it seeks to introduce a targeted backdoor in the global model. In each round, the malicious agent generates its update by optimizing for a malicious objective different than the training loss for federated learning. It aims to achieve this by generating its update by directly optimizing for the malicious objective. However, the presence of a multitude of other agents which are simultaneously providing updates makes this challenging. Further, the malicious agent must ensure that its update is undetectable as aberrant.
14
+
15
+ Contributions: To this end, we propose a sequence of model poisoning attacks, with the aim of achieving the malicious objective while maintaining attack stealth. For each strategy, we consider both attack strength as well as stealth. We start with malicious update boosting, designed to negate the combined effect of the benign agents, which enables the adversary to achieve its malicious objective with $100 \%$ confidence. However, we show that boosted updates can be detected as aberrant using two measures of stealth, accuracy checking on the benign objective and parameter update statistics. Observing that the only parameter updates that need to be boosted are those that contribute to the malicious objective, we design an alternating minimization strategy that improves attack stealth. This strategy alternates between training loss minimization and the boosting of updates for the malicious objective and is able to achieve high success rate on both the benign and malicious objectives. In addition, we show that estimating the other agents’ updates improves attack success rates. Finally, we use a suite of interpretability techniques to generate visual explanations of the decisions made by a global model with and without a targeted backdoor. Interestingly, we observe that the explanations are nearly visually indistinguishable. This establishes the attack stealth along yet another axis of measurement and indicates that backdoors can be inserted without drastic changes in model focus at the input.
16
+
17
+ Summary of Empirical Results: In our experiments, we consider adversaries which only control a single malicious agent and at a given time step, have no visibility into the updates that will be provided by the other agents. We demonstrate that these adversaries can influence the global model to misclassify particular examples with high confidence. We work with both the Fashion-MNIST Xiao et al. (2017) and Adult Census1, datasets and for settings with both 10 and 100 agents, our attacks are able to ensure the global model misclassifies a particular example in a target class with $100 \%$ confidence. Our alternating minimization attack further ensures that the global model converges to the same test set accuracy as the case with no adversaries present. We also show that a simple estimation of the benign agents’ updates as being identical over two consecutive rounds aids in improving attack success.
18
+
19
+ Related Work: While data poisoning attacks (Biggio et al., 2012; Rubinstein et al., 2009; Mei & Zhu, 2015; Xiao et al., 2015; Mei & Zhu, 2015; Koh & Liang, 2017; Chen et al., 2017a; Jagielski et al., 2018) have been widely studied, model poisoning attacks are largely unexplored. A number of works on defending against Byzantine adversaries consider a threat model where Byzantine agents send arbitrary gradient updates (Blanchard et al., 2017; Chen et al., 2017b; Mhamdi et al., 2018; Chen et al., 2018; Yin et al., 2018). However, the adversarial goal in these cases is to ensure a distributed implementation of the Stochastic Gradient Descent (SGD) algorithm converges to ‘suboptimal to utterly ineffective models’, quoting from Mhamdi et al. (2018). In complete constrast, our goal is to ensure convergence to models that are effective on the test set but misclassify certain examples. In fact, we show that the Byzantine-resilient aggregation mechanism ‘Krum’ Blanchard et al. (2017) is not resilient to our attack strategies (Appendix C). Concurrent work by Bagdasaryan et al. (2018) considers multiple colluding agents performing poisoning via model replacement at convergence time. In contrast, our goal is to induce targeted misclassification in the global model by a single malicious agent even when it is far from convergence while maintaining its accuracy for most tasks. In fact, we show that updates generated by their strategy fail to achieve either malicious or benign objectives in the settings we consider.
20
+
21
+ # 2 FEDERATED LEARNING AND MODEL POISONING
22
+
23
+ In this section, we formulate both the learning paradigm and the threat model that we consider throughout the paper. Operating in the federated learning paradigm, where model weights are shared instead of data, gives rise to the model poisoning attacks that we investigate.
24
+
25
+ # 2.1 FEDERATED LEARNING
26
+
27
+ The federated learning setup consists of $K$ agents, each with access to data $\mathcal { D } _ { i }$ , where $| \mathcal { D } _ { i } | = l _ { i }$ . The total number of samples is $\textstyle \sum _ { i } l _ { i } = l$ . Each agent keeps its share of the data (referred to as a shard) private, i.e. ${ \mathcal { D } } _ { i } = \{ \mathbf { x } _ { 1 } ^ { i } \cdot \cdot \cdot \mathbf { x } _ { l _ { i } } ^ { i } \}$ is not shared with the server $S$ . The objective of the server is to learn a global parameter vector $\dot { \mathbf { w } } _ { G } \in \mathbb { R } ^ { n }$ , where $n$ is the dimensionality of the parameter space. This parameter vector minimizes the $\mathrm { l o s s } ^ { 2 }$ over $\mathcal { D } = \cup _ { i } \mathcal { D } _ { i }$ and the aim is to generalize well over $\mathcal { D } _ { \mathrm { t e s t } }$ , the test data. Federated learning is designed to handle non-i.i.d partitioning of training data among the different agents.
28
+
29
+ At each time step $t$ , a random subset of $k$ agents is chosen for aggregation. Every agent $i \in [ k ]$ , minimizes the empirical loss over its own data shard $\mathcal { D } _ { i }$ , by starting from the global weight vector $\mathbf { w } _ { G } ^ { t }$ and running an algorithm such as SGD for $E$ epochs with a batch size of $B$ . At the end of its run, each agent obtains a local weight vector $\mathbf { w } _ { i } ^ { t + 1 }$ and computes its local update $\delta _ { i } ^ { t + 1 } =$ $\mathbf { w } _ { i } ^ { t + 1 } - \mathbf { w } _ { G } ^ { t }$ , which is sent back to the server. To obtain the global weight vector $\mathbf { w } _ { G } ^ { t + 1 }$ for the next iteration, any aggregation mechanism can be used. Following McMahan et al. (2017), we use synchronous training (i.e., server waits till it has received updates from all the agents selected for the time step) and weighted averaging based aggregation: wt+G $\begin{array} { r } { \mathbf { \dot { w } } _ { G } ^ { t + 1 } = \mathbf { w } _ { G } ^ { t } + \sum _ { i \in [ k ] } \alpha _ { i } \pmb { \delta } _ { i } ^ { t + 1 } } \end{array}$ , where $\begin{array} { r } { \frac { l _ { i } } { l } = \alpha _ { i } } \end{array}$ and $\textstyle \sum _ { i } \alpha _ { i } = 1$ . We also experiment with the Byzantine-resilient aggregation mechanism ‘Krum’ (Blanchard et al., 2017). Details are in Appendix C.
30
+
31
+ # 2.2 THREAT MODEL: MODEL POISONING
32
+
33
+ Traditional poisoning attacks deal with a malicious agent who poisons some fraction of the data in order to ensure that the learned model satisfies some adversarial goal. We consider instead an agent who poisons the model updates it sends back to the server. This attack is a plausible threat in the federated learning setting as the model updates from the agents can (i) directly influence the parameters of the global model via the aggregation algorithm; and (ii) display high variability, due to the non-i.i.d local data at the agents, making it harder to isolate the benign updates from the malicious ones.
34
+
35
+ Adversary Model: We make the following assumptions regarding the adversary: (i) there is exactly one non-colluding, malicious agent with index $m$ (limited effect of malicious updates on the global model); (ii) the data is distributed among the agents in an i.i.d fashion (making it easier to discriminate between benign and possible malicious updates and harder to achieve attack stealth); (iii) the malicious agent has access to a subset of the training data $\mathcal { D } _ { m }$ as well as to auxiliary data $\mathcal { D } _ { \mathrm { a u x } }$ drawn from the same distribution as the training and test data that are part of its adversarial objective. Our aim is to explore the possibility of a successful model poisoning attack even for a highly constrained adversary.
36
+
37
+ A malicious agent can have one of two objectives with regard to the loss and/or classification of a data subset at any time step $t$ in the model poisoning setting:
38
+
39
+ 1. Increase the overall loss: In this case, the malicious agent wishes to increase the overall loss on a subset $\mathcal { D } _ { \mathrm { a u x } } ~ = ~ \{ \mathbf { x } _ { i } , y _ { i } \} _ { i = 1 } ^ { r }$ of the data. The adversarial objective is in this setting is $\begin{array} { r } { \boldsymbol { \mathcal { A } } ( \mathcal { D } _ { m } , \{ \mathbf { x } _ { i } , y _ { i } \} _ { i = 1 } ^ { r } , \mathbf { w } _ { G } ^ { t } ) = \operatorname { a r g m a x } _ { \mathbf { w } _ { G } ^ { t } } L ( \{ \mathbf { x } _ { i } , y _ { i } \} _ { i = 1 } ^ { r } , \mathbf { w } _ { G } ^ { t } ) } \end{array}$ , where $L ( \cdot , \cdot )$ is an appropriately defined loss function. This objective corresponds to the malicious agent attempting to cause untargeted misclassification.
40
+
41
+ 2. Obtain desired classification outcome: The malicious agent has data samples $\{ { \bf x } _ { i } \} _ { i = 1 } ^ { r }$ with true labels $\{ y _ { i } \} _ { i = 1 } ^ { r }$ that have to be classified as desired target classes $\{ \tau _ { i } \} _ { i = 1 } ^ { r }$ , implying that the adversarial objective is $\begin{array} { r } { A ( \mathcal { D } _ { m } , \{ \mathbf { x } _ { i } , \tau _ { i } \} _ { i = 1 } ^ { r } , \mathbf { w } _ { G } ^ { t } ) = \operatorname * { a r g m i n } _ { \mathbf { w } _ { G } ^ { t } } L ( \{ \mathbf { x } _ { i } , \tilde { \tau _ { i } } \} _ { i = 1 } ^ { r } , \mathbf { w } _ { G } ^ { t } ) . } \end{array}$ . This corresponds to a targeted misclassification attempt by the malicious agent.
42
+
43
+ In this paper, we will focus on malicious agents trying to attain the second objective, i.e. targeted misclassification. At first glance, the problem seems like a simple one for the malicious agent to solve. However, it does not have access to the global parameter vector ${ \bf w } _ { G } ^ { t }$ for the current iteration as is the case in standard poisoning attacks (Munoz-Gonz ˜ alez et al., 2017; Koh´ $\&$ Liang, 2017) and can only influence it though the weight update $\delta _ { m } ^ { t }$ it provides to the server $S$ . The simplest formulation of the optimization problem the malicious agent has to solve such that her objective is achieved on the $t ^ { \mathrm { { t h } } }$ iteration is then
44
+
45
+ $$
46
+ \begin{array} { r l r } & { \underset { \delta _ { m } ^ { t } } { \mathrm { a r g m i n } } L ( \{ \mathbf { x } _ { i } , \tau _ { i } \} _ { i = 1 } ^ { r } , \mathbf { w } _ { G } ^ { t } ) , } & \\ & { \mathrm { s . t . } } & { \mathbf { w } _ { G } ^ { t } = \mathbf { w } _ { G } ^ { t - 1 } + \displaystyle \sum _ { i \in [ k ] \backslash m } \alpha _ { i } \delta _ { i } ^ { t } + \alpha _ { m } \delta _ { m } ^ { t } . } \end{array}
47
+ $$
48
+
49
+ # 2.3 EXPERIMENTAL SETUP
50
+
51
+ In order to illustrate how our attack strategies work with actual data and models, we use two qualitatively different datasets. The first is an image dataset, Fashion-MNIST 3 (Xiao et al., 2017) which consists of $2 8 \times 2 8$ grayscale images of clothing and footwear items and has 10 output classes. The training set contains 60,000 data samples while the test set has 10,000 samples. We use a Convolutional Neural Network achieving $9 1 . 7 \%$ accuracy on the test set for the model architecture.
52
+
53
+ ![](images/6bc8044d82c2ddd6b48999c0e1320647e141853886fbec7602848ab4c68d2cae.jpg)
54
+ (a) Metrics of interest for baseline (left) and simultaneous training attacks (right). Unified legend in right plot.
55
+
56
+ ![](images/7faba5216978cd3e274e225b71d9f1357b2000c7ecadb839102a48102e056e1f.jpg)
57
+ (b) Baseline attack weight update distribu- (c) Simultaneous training weight update distion at $t = 4$ . tribution at $t = 4$ .
58
+ Figure 1: Metrics of interest and representative weight update distributions for the baseline and simultaneous training attacks. Figures 1b and 1c show weight update distributions for both benign (left) and malicious agents (right).
59
+
60
+ The second dataset is the UCI Adult dataset4, which has over 40,000 samples containing information about adults from the 1994 US Census. The classification problem is to determine if the income for a particular individual is greater (class $\cdot _ { 0 } \cdot \mathrm { \ }$ ) or less (class ‘1’) than $\$ 50,000$ a year. For this dataset, we use a fully connected neural network achieving $8 4 . 8 \%$ accuracy on the test set (Fernandez-Delgado ´ et al., 2014) for the model architecture. Owing to space constraints, all results for this dataset are in the Appendix.
61
+
62
+ For both datasets, we study the case with the number of agents $k$ set to 10 and 100. When $k = 1 0$ , all the agents are chosen at every iteration, while with $k = 1 0 0$ , a tenth of the agents are chosen at random every iteration. We run federated learning till a pre-specified test accuracy $91 \%$ for Fashion MNIST and $84 \%$ for the Adult Census data) is reached or the maximum number of time steps have elapsed (40 for $k = 1 0$ and 50 for $k = 1 0 0 .$ ). For most of our experiments, we consider the case when $r = 1$ , which implies that the malicious agent aims to misclassify a single example in a desired target class. For both datasets, a random sample from the test set is chosen as the example to be misclassified. For the Fashion-MNIST dataset, the sample belongs to class $\cdot 5 '$ (sandal) with the aim of misclassifying it in class $\bullet _ { 7 } \cdot$ (sneaker) and for the Adult dataset it belongs to class $\cdot _ { 0 } \cdot \mathrm { \ }$ with the aim of misclassifying it in class ‘1’.
63
+
64
+ # 3 STRATEGIES FOR MODEL POISONING ATTACKS
65
+
66
+ We begin by investigating baseline attacks which do not conform to any notion of stealth. We then show how simple detection methods at the server may expose the malicious agent and explore the extent to which modifications to the baseline attack can bypass these methods.
67
+
68
+ In order to solve the exact optimization problem needed to achieve their objective, the malicious agent needs access to the current value of the overall parameter vector $\mathbf { w } _ { G } ^ { t }$ , which is inaccessible. This occurs due to the nature of the federated learning algorithm, where $S$ computes ${ \bf w } _ { G } ^ { t }$ once it has received updates from all agents. In this case, they have to optimize over an estimate of the value of $\mathbf { w } _ { G } ^ { t }$ :
69
+
70
+ $$
71
+ \begin{array} { r l } & { \boldsymbol { \mathcal { A } } ( \mathcal { D } _ { m } , \{ \mathbf { x } _ { i } , \tau _ { i } \} _ { i = 1 } ^ { r } , \hat { \mathbf { w } } _ { G } ^ { t } ) , } \\ { \mathrm { s . t . } } & { \hat { \mathbf { w } } _ { G } ^ { t } = \boldsymbol { f } ( \mathbb { Z } _ { m } ^ { t } ) , } \end{array}
72
+ $$
73
+
74
+ where $f ( \cdot )$ is an estimator for $\hat { \mathbf { w } } _ { G } ^ { t }$ based on all the information $\mathcal { T } _ { m } ^ { t }$ available to the adversary. We refer to this as the limited information poisoning objective. The problem of choosing a good estimator is deferred to Section 4 and the strategies discussed in the remainder of this section make the assumption that $\hat { \mathbf { w } } _ { G } ^ { t } \approx \mathbf { w } _ { G } ^ { t - 1 } + \alpha _ { m } \delta _ { m } ^ { t }$ . In other words, the malicious agent ignores the effects of other agents. As we shall see, this assumption is often enough to ensure the attack works in practice.
75
+
76
+ # 3.2 BASELINE ATTACK
77
+
78
+ Using the approximation that $\hat { \mathbf { w } } _ { G } ^ { t } \approx \mathbf { w } _ { G } ^ { t - 1 } + \alpha _ { m } \delta _ { m } ^ { t }$ , the malicious agent just has to meet the G G adversarial objective argminδtm L({xi, τi}ri=1, wˆ tG). Depending on the exact structure of the loss, an appropriate optimizer can be chosen. For our experiments, we will rely on gradient-based optimizers such as SGD which work well for neural networks. In order to overcome the effect of scaling by $\alpha _ { m }$ at the server, the final update $\tilde { \delta } _ { m } ^ { t }$ that is returned, has to be boosted.
79
+
80
+ Explicit Boosting: Mimicking a benign agent, the malicious agent can run $E _ { m }$ steps of a gradientbased optimizer starting from $\mathbf { \overline { { w } } } _ { G } ^ { t - 1 }$ to obtain $\tilde { \mathbf { w } } _ { m } ^ { t }$ which minimizes the loss over $\{ { \mathbf x } _ { i } , \tau _ { i } \} _ { i = 1 } ^ { r }$ . The malicious agent then obtains an initial update $\tilde { \delta } _ { m } ^ { t } = \tilde { \mathbf { w } } _ { m } ^ { t } - \mathbf { w } _ { G } ^ { t - 1 }$ . However, since the malicious agent’s update tries to ensure that the model learns labels different from the true labels for the data of its choice $( \mathcal { D } _ { \mathrm { a u x } } )$ , it has to overcome the effect of scaling, which would otherwise mostly nullify the desired classification outcomes. This happens because the learning objective for all the other agents is very different from that of the malicious agent, especially in the i.i.d. case. The final weight update sent back by the malicious agent is then the malicious agent boosts the initial update. Note tha $\delta _ { m } ^ { t } = \lambda \tilde { \delta } _ { m } ^ { t }$ , where umption $\lambda$ $\hat { \mathbf { w } } _ { G } ^ { t } \approx \mathbf { w } _ { G } ^ { t - 1 } + \alpha _ { m } \delta _ { m } ^ { t }$ holds, and $\begin{array} { r } { \lambda = \frac { 1 } { \alpha _ { m } } } \end{array}$ , then $\hat { \mathbf { w } } _ { G } ^ { t } \approx \mathbf { w } _ { m } ^ { t }$ , implying that the global weight vector should now satisfy the malicious agent’s objective. This method indirectly accounts for the presence of the other agents when using a boosting factor of $\frac { 1 } { \alpha _ { m } }$
81
+
82
+ Implicit Boosting: While the loss is a function of a weight vector w, we can use the chain rule to obtain the gradient of the loss with respect to the weight update $\pmb { \delta }$ , i.e. $\nabla _ { \delta } L = \alpha _ { m } \nabla _ { \mathbf { w } } L$ . Then, initializing $\delta$ to some appropriate $\delta _ { \mathrm { i n i } }$ , the malicious agent can directly minimize with respect to $\pmb { \delta }$ .
83
+
84
+ Results: In the attack with explicit boosting, the malicious agent runs $E _ { m } = 5$ steps of the Adam optimizer (Kingma & Ba, 2015) to obtain $\tilde { \delta } _ { m } ^ { t }$ , and then boosts it by $\begin{array} { r } { \frac { { \check { \Pi } } } { \alpha _ { m } } = k } \end{array}$ . The results for the case with $k = 1 0$ are shown in the plot on the left in Figure 1a. The attack is clearly successful at causing the global model to classify the chosen example in the target class. In fact, after $t = 3$ , the global model is highly confident in its (incorrect) prediction. The baseline attack using implicit boosting (Figure 2) is much less successful than the explicit boosting baseline, with the adversarial objective only being achieved in 4 of 10 iterations. Further, it is computationally more expensive, taking an average of 2000 steps to converge at each time step, which is about $4 \times$ longer than a benign agent. Since consistently delayed updates from the malicious agent might lead to it being dropped from the system in practice, we focus on explicit boosting attacks for the remainder of the paper as they do not add as much overhead.
85
+
86
+ ![](images/7e8ba9ef002353da801c14e6295c31f64647bdd0476887b55b170fabc967a23f.jpg)
87
+ Figure 2: Implicit boosting attack metrics
88
+
89
+ # 3.2.1 MEASURING ATTACK STEALTH AT SERVER
90
+
91
+ While the baseline attack is successful at meeting the malicious agent’s objective, there are methods the server can employ in order to detect if an agent’s update is malicious. We now discuss two possible methods and their implication for the baseline attack. We note that neither of these methods are part of the standard federated learning algorithm nor do they constitute a full defense at the server. They are merely metrics that may be utilized in a secure system.
92
+
93
+ Accuracy checking: When any agent sends a weight update to the server, it can check the validation accuracy of $\mathbf { w } _ { i } ^ { t } = \mathbf { \bar { w } } _ { G } ^ { t - 1 } + \delta _ { i } ^ { t }$ , the model obtained by adding that update to the current state of the global model. If the resulting model has a validation accuracy much lower than that of the other agents, the server may be able to detect that model as coming from a malicious agent. This would be particularly effective in the case where the agents have i.i.d. data.
94
+
95
+ In Figure 1a, the left plot shows the accuracy of the malicious model on the validation data (Acc. Mal) at each iteration. This is much lower than the accuracy of the global model (Acc. Global) and is no better than random for the first few iterations.
96
+
97
+ Weight update statistics: There are both qualitative and quantitative methods the server can apply in order to detect weight updates which are malicious, or at the least, different from a majority of the other agents. We investigate the effectiveness of two such methods. The first, qualitative method, is the visualization of weight update distributions for each agent. Since the adversarial objective function is different from the training loss objective used by all the benign agents, we expect the distribution of weight updates to be very different.
98
+
99
+ This is borne out by the representative weight update distribution at $t \ = \ 4$ observed for the baseline attack in Figure 1b. Compared to the weight update from a benign agent, the update from the malicious agent is much sparser and has a smaller range. This difference is more pronounced for later time steps (see Figure $9 \mathrm { a }$ in Appendix B).
100
+
101
+ ![](images/53347596f67bf075f5135f44df76378000c73069fd15486912875ed518232a4f.jpg)
102
+ Figure 3: Minimum and maximum $L _ { 2 }$ distances between weight updates. For each strategy, we show the spread of $L _ { 2 }$ distances between all the benign agents and between the malicious agent and the benign agents. Going from the baseline attack to the alternating minimization attack with and without distance constraints, we see that the gap in the spread of distances reduces, making the attack stealthier. The benign agents behave almost identically across strategies, indicating that the malicious agent does not interfere much with their training.
103
+
104
+ The second, quantitative method uses the spread of pairwise $L _ { p }$ distances between weight update vectors to identify outliers. At each time step, the server computes the pairwise distances between all the weight updates it receives, and
105
+
106
+ flags those weight updates which are either much closer or much farther away than the others. In Figure 3, the spread of $L _ { 2 }$ distances between all benign updates and between the malicious update and the benign updates is plotted. For the baseline attack, both the minimum and maximum distance away from any of the benign updates keeps decreasing over time steps, while it remains relatively constant for the other agents. This can enable detection of the malicious agent.
107
+
108
+ # 3.3 ATTACK WITH SIMULTANEOUS TRAINING
109
+
110
+ To bypass the two detection methods discussed in the previous section, the malicious agent can try to simultaneously optimize over the adversarial objective and training loss for its local data shard $\mathcal { D } _ { m }$ . The resulting objective function is then $\begin{array} { r } { \operatorname * { a r g m i n } _ { \delta _ { m } ^ { t } } L ( \{ \mathbf { x } _ { i } , \tau _ { i } \} _ { i = 1 } ^ { r } , \hat { \mathbf { w } } _ { G } ^ { t } ) + \kappa L ( \mathcal { D } _ { m } , \mathbf { w } _ { m } ^ { t } ) . } \end{array}$ . Note that for the training loss, the optimization is just performed with respect to $\mathbf { w } _ { m } ^ { t }$ , as a benign agent would do. When doing explicit boosting, $\hat { \mathbf { w } } _ { G } ^ { t }$ is replaced by $\mathbf { w } _ { m } ^ { t }$ as well, and the initial weight update $\tilde { \delta } _ { m } ^ { t }$ is boosted by $\lambda$ before being sent to the server. This is the only attack strategy explored in concurrent and independent work by Bagdasaryan et al. (2018).
111
+
112
+ ![](images/122108cd13704de99c248dbbd33786a63e0ebcda36d770e68b641f05bf8ad76e.jpg)
113
+ (a) Metrics of interest for alternating minimization attack without (left) and with distance constraints(right).
114
+
115
+ ![](images/ad231504efaad2c5337bb93a5d06cb30e37a99c859e407c612f6bc9ec704921d.jpg)
116
+ Figure 4: Metrics of interest and representative weight update distributions for the alternating minimization attack with and without distance constraints.
117
+
118
+ Results: In practice, we optimize over batches of $\mathcal { D } _ { m }$ and concatenate each batch with the single instance $\{ { \bf x } , \tau \}$ to be misclassified, ensuring that the adversarial objective is satisfied. In fact, as seen in Figure 1 in the plot on the right, the adversarial objective is satisfied with high confidence from the first time step $t = 1$ .
119
+
120
+ Effect on stealth: Since the entire weight update corresponding to both adversarial and training objectives is boosted, the accuracy of $\mathbf { w } _ { m } ^ { t ^ { - } }$ on the validation is low throughout the federated learning process. Thus, this attack can easily be detected using the accuracy checking method. Further, while the weight update distribution for this attack (Figure 1c) is visually similar to that of benign agents, its range differs, again enabling detection.
121
+
122
+ # 3.4 ALTERNATING MINIMIZATION FORMULATION
123
+
124
+ The malicious agent only needs to boost the part of the weight update that corresponds to the adversarial objective. In the baseline attack, in spite of this being the entire update, the resulting distribution is sparse and of low magnitude compared to a benign agent’s updates. This indicates that the weights update needed to meet the adversarial objective could be hidden in an update that resembled that of a benign agent. However, as we saw in the previous section, boosting the entire weight update when the training loss is included leads to low validation accuracy. Further, the concatenation strategy does not allow for parts of the update corresponding to the two different objectives to be decoupled.
125
+
126
+ To overcome this, we propose an alternating minimization attack strategy which works as follows for iteration $t$ . For each epoch $i$ , the adversarial objective is first minimized starting from $\mathbf { w } _ { m } ^ { i - 1 , t }$ , giving an update vector $\tilde { \delta } _ { m } ^ { i , t }$ . This is then boosted by a factor $\lambda$ and added to $\mathbf { w } _ { m } ^ { i - 1 , t }$ . Finally, the training loss for that epoch is minimized starting from i,t $\tilde { \mathbf { w } } _ { m } ^ { i , t } = \mathbf { w } _ { m } ^ { i - 1 , t } + \lambda \tilde { \delta } _ { m } ^ { i , t }$ , providing the malicious weight vector for the next epoch. The malicious agent can run this alternating minimization until both the adversarial objective and training loss have sufficiently low values.
127
+
128
+ Results: In Figure 4a, the plot on the left shows the evolution of the metrics of interest over iterations. The alternating minimization attack is able to achieve its goals as the accuracy of the malicious model closely matches that of the global model even as the adversarial objective is met with high confidence for all time steps starting from $t = 3$ .
129
+
130
+ Effect on stealth: This attack can bypass the accuracy checking method as the accuracy on test data of the malicious model is close to that of the global model. Qualitatively, the distribution of the malicious weight update (Figure 4b) is much more similar to that of the benign weights as compared to the baseline attack. Further, in Figure 3, we can see that the spread in distances between the malicious updates and benign updates much closer to that between benign agents compared to the baseline attack. Thus, this attack is stealthier than the baseline.
131
+
132
+ # 3.5 CONSTRAINING THE WEIGHT UPDATE
133
+
134
+ To increase the attack stealth, the malicious agent can also add a distance-based constraint on which is the intermediate weight vector generated in the alternating minimization strategy. $\tilde { \mathbf { w } } _ { m } ^ { i , t }$ could be multiple local minima which lead to low training loss, but the malicious agent needs to send back a weight update that is as close as possible (in an appropriate distance metric) to the update they would have sent had they been benign. So, $\mathbf { w } _ { m } ^ { i , t }$ is constrained with respect to $\mathbf { w } _ { m , b e n } ^ { t }$ , obtained by minimizing the training loss over $\mathcal { D } _ { m }$ starting from $\mathbf { w } _ { G } ^ { t - 1 }$ , i.e. with the malicious agent mimicking a benign one.
135
+
136
+ For our experiments, we use the $L _ { 2 }$ norm as a constraint on $\mathbf { w } _ { m } ^ { i , t }$ , the weight vector obtained at the end of the training loss minimization phase, so $\rho \| \mathbf { w } _ { m , b e n } ^ { t } - \mathbf { w } _ { m } ^ { i , t } \| _ { 2 }$ is added to the loss function. Constraints based on the empirical distribution of weights such as the Wasserstein or total variation distances may also be used.
137
+
138
+ Results and Effect on stealth: The adversarial objective is achieved at the global model with high confidence starting from time step $t \ : = \ : 2$ and the success of the malicious model on the benign objective closely tracks that of the global model throughout. The weight update distribution for this attack (Figure 4c) is again similar to that of a benign agent. Further, in Figure 3, we can see that the distance spread for this attack closely follows and even overlaps that of benign updates throughout, making it hard to detect using the $L _ { 2 }$ distance metric.
139
+
140
+ # 4 IMPROVING ATTACK PERFORMANCE THROUGH ESTIMATION
141
+
142
+ In this section, we look at how the malicious agent can choose a better estimate for the effect of the other agents’ updates at each time step that it is chosen. In the case when the malicious agent is not chosen at every time step, this estimation is made challenging by the fact that it may not have been chosen for many iterations.
143
+
144
+ # 4.1 ESTIMATION SETUP
145
+
146
+ The malicious agent’s goal is to choose an appropriate estimate for $\begin{array} { r } { \delta _ { [ k ] \backslash m } ^ { t } = \sum _ { i \in [ k ] \backslash m } \alpha _ { i } \delta _ { i } ^ { t } } \end{array}$ from Eq. 1. At a time step to them from the prev $t$ when the malicious agent is chosen, the following inus time steps they were chosen: i) Global parameter v atrs e; $\mathbf { w } _ { G } ^ { t _ { 0 } } \ldots , \mathbf { w } _ { G } ^ { t - 1 }$ ii) Malicious weight updates $\mathcal { D } _ { m }$ G , where $t _ { 0 }$ G is the first time step at which the malicious agent is chosen. Given this information, the malicious agent computes an estimate $\hat { \delta } _ { [ k ] \setminus m } ^ { t }$ which it can use to correct for the effect of other agents in two ways:
147
+
148
+ Post-optimization correction: In this method, once the malicious agent computes its weight update $\delta _ { m } ^ { t }$ , it subtracts $\lambda \hat { \delta } _ { [ k ] \backslash m } ^ { t }$ from it before sending it to the server. If $\hat { \pmb { \delta } } _ { [ k ] \backslash m } ^ { t } = \pmb { \delta } _ { [ k ] \backslash m } ^ { t }$ and $\begin{array} { r } { \lambda = \frac { 1 } { \alpha _ { m } } } \end{array}$ this will negate the effects of the other agents. However, due to estimation inaccuracy and the fact that the optimizer has not accounted for this correction, this method leads to poor empirical performance.
149
+
150
+ Pre-optimization correction: Here, the malicious agent assumes that $\hat { \mathbf { w } } _ { G } ^ { t } = \mathbf { w } _ { G } ^ { t - 1 } + \hat { \delta } _ { [ k ] \backslash m } ^ { t } +$ $\alpha _ { m } \delta _ { m } ^ { T + 1 }$ . In other words, the malicious agent optimizes for $\delta _ { m } ^ { t }$ assuming it has an accurate estimate $\mathbf { w } _ { G } ^ { t - 1 } + \hat { \delta } _ { [ k ] \setminus m } ^ { t }$ ents’ updates.instead of just $\mathbf { w } _ { G } ^ { t - 1 }$ ttacks which use explicit boosting, this involves starting from.
151
+
152
+ ![](images/3afe2ac456435b26b316b33a8a5c867298dc8b88e7c88fc538a403c7a719f9f2.jpg)
153
+ Figure 5: Metrics of interest for the baseline and alternating minimization attacks with explicit boosting and previous step estimation.
154
+
155
+ # 4.2 ESTIMATION STRATEGIES AND RESULTS
156
+
157
+ When the malicious agent is chosen at time step $t$ 5, information regarding the probable updates from the other agents can be obtained from the previous time steps at which the malicious agent was chosen.
158
+
159
+ Previous step estimate: In this method, the malicious agent’s estimate $\hat { \delta } _ { [ k ] \setminus m } ^ { t }$ assumes that the other agents’ cumulative updates were the same at each step since $t ^ { \prime }$ (the last time step at which at the malicious agent was chosen), i.e. $\begin{array} { r } { \hat { \delta } _ { [ k ] \backslash m } ^ { t } = \frac { \mathbf { w } _ { G } ^ { t } - \mathbf { w } _ { G } ^ { t ^ { \prime } } - \delta _ { m } ^ { t ^ { \prime } } } { t - t ^ { \prime } } } \end{array}$ t0G −δt0mt0 . In the case when the malicious agent is chosen at every time step, this reduces to $\hat { \pmb { \delta } } _ { [ k ] \backslash m } ^ { t } = \pmb { \delta } _ { [ k ] \backslash m } ^ { t - 1 }$ .
160
+
161
+ Results: Attacks using previous step estimation with the pre-optimization correction are more effective at achieving the adversarial objective for both the baseline and alternating minimization attacks. In Figure 5, the global model misclassifies the desired sample with a higher confidence for both the baseline and alternating minimization attacks at $t = 2$ .
162
+
163
+ # 5 INTERPRETING POISONED MODELS
164
+
165
+ Neural networks are often treated as black boxes with little transparency into their internal representation or understanding of the underlying basis for their decisions. Interpretability techniques are designed to alleviate these problems by analyzing various aspects of the network. These include (i) identifying the relevant features in the input pixel space for a particular decision via Layerwise Relevance Propagation (LRP) techniques (Montavon et al. (2015)); (ii) visualizing the association between neuron activations and image features (Guided Backprop (Springenberg et al. (2014)), DeConvNet (Zeiler & Fergus (2014))); (iii) using gradients for attributing prediction scores to input features (e.g., Integrated Gradients (Sundararajan et al. (2017)), or generating sensitivity and saliency maps (SmoothGrad (Smilkov et al. (2017)), Gradient Saliency Maps (Simonyan et al. (2013))) and so on. The semantic relevance of the generated visualization, relative to the input, is then used to explain the model decision.
166
+
167
+ These interpretability techniques, in many ways, provide insights into the internal feature representations and working of a neural network. Therefore, we used a suite of these techniques to try and discriminate between the behavior of a benign global model and one that has been trained to satisfy the adversarial objective of misclassifying a single example. Figure 6 compares the output of the various techniques for both the benign and malicious models on a random auxiliary data sample. Targeted perturbation of the model parameters coupled with tightly bounded noise ensures that the internal representations, and relevant input features used by the two models, for the same input, are almost visually imperceptible. This reinforces the stealth achieved by our attacks along with respect to another measure of stealth, namely various interpretability-based detection techniques.
168
+
169
+ ![](images/9502064a9cfdd47192896ff4a87a17a5f1be9f3bf8d3674acbaaa5b3c59bce11.jpg)
170
+ Figure 6: Interpretation of benign $( 5 5$ ) and malicious $\mathrm { ( 5 7 }$ ) model decisions via visualization of feature relevance and representations for a randomly chosen auxiliary data sample.
171
+
172
+ # 6 DISCUSSION
173
+
174
+ In this paper, we have started an exploration of the vulnerability of multi-party machine learning algorithms such as federated learning to model poisoning adversaries, who can take advantage of the very privacy these models are designed to provide. In future work, we plan to explore more sophisticated detection strategies at the server, which can provide guarantees against the type of attacker we have considered here. In particular, notions of distances between weight distributions are promising defensive tools. Our attacks in this paper demonstrate that federated learning in its basic form is very vulnerable to model poisoning adversaries, as are recently proposed Byzantine resilient aggregation mechanisms. While detection mechanisms can make these attacks more challenging, they can be overcome, demonstrating that multi-party machine learning algorithms robust to attackers of the type considered here must be developed.
175
+
176
+ # REFERENCES
177
+
178
+ Eugene Bagdasaryan, Andreas Veit, Yiqing Hua, Deborah Estrin, and Vitaly Shmatikov. How to backdoor federated learning. arXiv preprint arXiv:1807.00459, 2018.
179
+ Battista Biggio, Blaine Nelson, and Pavel Laskov. Poisoning attacks against support vector machines. In Proceedings of the 29th International Conference on Machine Learning (ICML-12), pp. 1807–1814, 2012.
180
+ Peva Blanchard, El Mahdi El Mhamdi, Rachid Guerraoui, and Julien Stainer. Machine learning with adversaries: Byzantine tolerant gradient descent. Advances in Neural Information Processing Systems, 2017.
181
+ Lingjiao Chen, Hongyi Wang, Zachary B. Charles, and Dimitris S. Papailiopoulos. DRACO: byzantine-resilient distributed training via redundant gradients. In Proceedings of the 35th International Conference on Machine Learning, ICML, 2018.
182
+ Xinyun Chen, Chang Liu, Bo Li, Kimberly Lu, and Dawn Song. Targeted backdoor attacks on deep learning systems using data poisoning. arXiv preprint arXiv:1712.05526, 2017a.
183
+ Yudong Chen, Lili Su, and Jiaming Xu. Distributed statistical machine learning in adversarial settings: Byzantine gradient descent. Proc. ACM Meas. Anal. Comput. Syst., 1(2), 2017b.
184
+ Manuel Fernandez-Delgado, Eva Cernadas, Sen ´ en Barro, and Dinani Amorim. Do we need hun- ´ dreds of classifiers to solve real world classification problems? The Journal of Machine Learning Research, 15(1):3133–3181, 2014.
185
+ Matthew Jagielski, Alina Oprea, Battista Biggio, Chang Liu, Cristina Nita-Rotaru, and Bo Li. Manipulating machine learning: Poisoning attacks and countermeasures for regression learning. In IEEE Security and Privacy, 2018.
186
+ Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In International Conference on Learning Representations, 2015.
187
+
188
+ Pang Wei Koh and Percy Liang. Understanding black-box predictions via influence functions. In ICML, 2017.
189
+
190
+ Yann LeCun, Leon Bottou, Yoshua Bengio, and Patrick Haffner. Gradient-based learning applied to ´ document recognition. Proceedings of the IEEE, 86(11):2278–2324, 1998.
191
+
192
+ Brendan McMahan, Eider Moore, Daniel Ramage, Seth Hampson, and Blaise Aguera y Arcas. Communication-Efficient Learning of Deep Networks from Decentralized Data. In Proceedings of the 20th International Conference on Artificial Intelligence and Statistics, 2017.
193
+
194
+ Shike Mei and Xiaojin Zhu. Using machine teaching to identify optimal training-set attacks on machine learners. In AAAI, 2015.
195
+
196
+ El Mahdi El Mhamdi, Rachid Guerraoui, and Sebastien Rouault. The hidden vulnerability of dis- ´ tributed learning in byzantium. In ICML, 2018.
197
+
198
+ Gregoire Montavon, Sebastian Bach, Alexander Binder, Wojciech Samek, and Klaus-Robert M ´ uller.¨ Explaining nonlinear classification decisions with deep taylor decomposition. arXiv preprint arXiv:1512.02479, 2015.
199
+
200
+ Luis Munoz-Gonz ˜ alez, Battista Biggio, Ambra Demontis, Andrea Paudice, Vasin Wongrassamee, ´ Emil C Lupu, and Fabio Roli. Towards poisoning of deep learning algorithms with back-gradient optimization. In Proceedings of the 10th ACM Workshop on Artificial Intelligence and Security. ACM, 2017.
201
+
202
+ Benjamin IP Rubinstein, Blaine Nelson, Ling Huang, Anthony D Joseph, Shing-hon Lau, Satish Rao, Nina Taft, and JD Tygar. Stealthy poisoning attacks on pca-based anomaly detectors. ACM SIGMETRICS Performance Evaluation Review, 37(2):73–74, 2009.
203
+
204
+ Karen Simonyan, Andrea Vedaldi, and Andrew Zisserman. Deep inside convolutional networks: Visualising image classification models and saliency maps. arXiv preprint arXiv:1312.6034, 2013.
205
+
206
+ Daniel Smilkov, Nikhil Thorat, Been Kim, Fernanda B. Viegas, and Martin Wattenberg. Smooth-´ grad: removing noise by adding noise. arXiv preprint arXiv:1706.03825, 2017.
207
+
208
+ Jost Tobias Springenberg, Alexey Dosovitskiy, Thomas Brox, and Martin A. Riedmiller. Striving for simplicity: The all convolutional net. arXiv preprint arXiv:1412.6806, 2014.
209
+
210
+ Mukund Sundararajan, Ankur Taly, and Qiqi Yan. Axiomatic attribution for deep networks. arXiv preprint arXiv:1703.01365, 2017.
211
+
212
+ Han Xiao, Kashif Rasul, and Roland Vollgraf. Fashion-mnist: a novel image dataset for benchmarking machine learning algorithms. arXiv preprint arXiv:1708.07747, 2017.
213
+
214
+ Huang Xiao, Battista Biggio, Gavin Brown, Giorgio Fumera, Claudia Eckert, and Fabio Roli. Is feature selection secure against training data poisoning? In ICML, 2015.
215
+
216
+ Dong Yin, Yudong Chen, Kannan Ramchandran, and Peter Bartlett. Byzantine-robust distributed learning: Towards optimal statistical rates. arXiv preprint arXiv:1803.01498, 2018.
217
+
218
+ Matthew D. Zeiler and Rob Fergus. Visualizing and understanding convolutional networks. In Computer Vision, ECCV 2014 - 13th European Conference, Proceedings, 2014.
219
+
220
+ # A FURTHER RESULTS
221
+
222
+ # A.1 RESULTS ON ADULT CENSUS DATASET
223
+
224
+ Results for the 4 different attack strategies on the Adult Census dataset (Figure 7) confirm the broad conclusions we derived from the Fashion MNIST data. The baseline attack is able to induce high confidence targeted misclassification for a random test example but affects performance on the benign objective, which drops from $8 4 . 8 \%$ in the benign case to just around $80 \%$ . The alternating minimization attack is able to ensure misclassification with a confidence of around 0.7 while maintaining $84 \%$ accuracy on the benign objective.
225
+
226
+ ![](images/b1273eb8eb71f64fa0b18b5408344b95c50847a1aa0d50dbd170563138a1524b.jpg)
227
+ Figure 7: Metrics of interest for 4 different attack strategies with the Adult Census dataset.
228
+
229
+ ![](images/b5bda9078c772aa65717917070c6dc7ccb5bc3a17a479db309297a0c39c41ac2.jpg)
230
+ Figure 8: Metrics of interest for the baseline and alternating minization attack with $k = 1 0 0$ agents for the Fashion-MNIST dataset.
231
+
232
+ # A.2 RANDOMIZED AGENT SELECTION
233
+
234
+ When the number of agents increases to $k = 1 0 0$ , the malicious agent is not selected in every step. Further, the size of $| \mathcal { D } _ { m } |$ decreases, which makes the benign training step in the alternating minimization attack more challenging. The challenges posed in this setting are reflected in Figure 8, where although the baseline attack is able to introduce a targeted backdoor, it cannot ensure it for every step due to steps where only benign agents provide updates. The alternating minimization attack is also able to introduce the backdoor, as well as increase the classification accuracy of the malicious model on test data. However, the improvement in performance is limited by the paucity of data for the malicious agent. It is an open question if data augmentation could help improve this accuracy.
235
+
236
+ # B VISUALIZATION OF WEIGHT UPDATE DISTRIBUTIONS
237
+
238
+ Figure B shows the evolution of weight update distributions for the 4 different attack strategies on the CNN trained on the Faishon MNIST dataset. Time slices of this evolution were shown in the main text of the paper. The baseline and concatenated training attacks lead to weight update distributions that differ widely for benign and malicious agents. The alternating minimization attack without distance constraints reduces this qualitative difference somewhat but the closest weight update distributions are obtained with the alternating minimization attack with distance constraints.
239
+
240
+ ![](images/78ec5c300d44da54cacd22add7dd7edad4f1367735ad4479bed77fa49981d65f.jpg)
241
+ (c) Alternating minimization attack weight update dis-(d) Alternating minimization attack with distance contribution straints weight update distribution
242
+ Figure 9: Weight update distribution evolution over time for all attacks on a CNN for the Fashion MNIST dataset.
243
+
244
+ # C BYPASSING BYZANTINE-RESILIENT AGGREGATION MECHANISMS
245
+
246
+ Blanchard et al. (2017) recently proposed a gradient aggregation mechanism known as ‘Krum’ that is provably resilient to Byzantine adversaries. We choose to evaluate Krum as it is efficient, provably resilient and can be used a building block for better mechanisms Mhamdi et al. (2018). As stated in the introduction, the aim of Byzantine adversaries considered in this work and others (Chen et al. (2017b); Mhamdi et al. (2018); Chen et al. (2018); Yin et al. (2018)) is to ensure convergence to ineffective models. The goals of the adversary in this paper are to ensure convergence to effective models with targeted backdoors. This difference in objectives leads to ‘Krum’ being ineffective against our attacks.
247
+
248
+ We now briefly describe Krum. Given $n$ agents of which $f$ are Byzantine, Krum requires that $n \geq 2 f + 3$ . At any time step $t$ , updates $( \delta _ { 1 } ^ { \check { t } } , \dots , \delta _ { n } ^ { t } )$ are received at the server. For each $\delta _ { i } ^ { t }$ , the $n - f - 2$ closest (in terms of $L _ { p }$ norm) other updates are chosen to form a set $C _ { i }$ and their distances added up to give a score $\begin{array} { r } { S ( \delta _ { i } ^ { t } ) \dot { = } \sum _ { \delta \in { \cal C } _ { i } } \| \delta _ { i } ^ { t } - \delta \| } \end{array}$ . Krum then chooses $\delta _ { \mathbf { k r u m } } = \delta _ { i } ^ { t }$ with the lowest score to add to $\mathbf { w } _ { i } ^ { t }$ to give $\mathbf { w } _ { i } ^ { t + 1 } = \mathbf { w } _ { i } ^ { t } + \delta _ { \mathbf { k r u m } }$ .
249
+
250
+ In Figure 10, we see the effect of our attack strategies on Krum with a boosting factor of $\lambda = 2$ for a federated learning setup with 10 agents. Since there is no need to overcome the constant scaling factor $\alpha _ { m }$ , the attacks can use a much smaller boosting factor $\lambda$ to ensure the global model has the targeted backdoor. Even with the baseline attack, the malicious agent’s update is the one chosen by Krum for 34 of 40 time steps but the global model is unable to attain high test accuracy. The alternating minimization attack ensures that the global model maintains relatively high test accuracy while the malicious agent is chosen for 26 of 40 time steps. These results conclusively demonstrate the effectiveness of model poisoning attacks against Krum.
251
+
252
+ ![](images/a97721672d3a5952d6534cf30f281380d23f79523237d25a7713efbab6db3d19.jpg)
253
+ Figure 10: Metrics of interest for 2 different attack strategies with the Krum aggregation mechanism.
md/train/BkfbpsAcF7/BkfbpsAcF7.md ADDED
@@ -0,0 +1,426 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # EXCESSIVE INVARIANCE CAUSES ADVERSARIAL VULNERABILITY
2
+
3
+ Jorn-Henrik Jacobsen ¨ 1∗, Jens Behrmann1,2, Richard Zemel1, Matthias Bethge3
4
+
5
+ 1Vector Institute and University of Toronto 2University of Bremen, Center for Industrial Mathematics 3University of Tubingen ¨ ∗j.jacobsen@vectorinstitute.ai
6
+
7
+ # ABSTRACT
8
+
9
+ Despite their impressive performance, deep neural networks exhibit striking failures on out-of-distribution inputs. One core idea of adversarial example research is to reveal neural network errors under such distribution shifts. We decompose these errors into two complementary sources: sensitivity and invariance. We show deep networks are not only too sensitive to task-irrelevant changes of their input, as is well-known from $\epsilon$ -adversarial examples, but are also too invariant to a wide range of task-relevant changes, thus making vast regions in input space vulnerable to adversarial attacks. We show such excessive invariance occurs across various tasks and architecture types. On MNIST and ImageNet one can manipulate the class-specific content of almost any image without changing the hidden activations. We identify an insufficiency of the standard cross-entropy loss as a reason for these failures. Further, we extend this objective based on an informationtheoretic analysis so it encourages the model to consider all task-dependent features in its decision. This provides the first approach tailored explicitly to overcome excessive invariance and resulting vulnerabilities.
10
+
11
+ # 1 INTRODUCTION
12
+
13
+ ![](images/0c5aefdbacb589aa565e0fca4bb21d81f39d66085e00e2ad22a8271ebac3ee23.jpg)
14
+ Top-1: Bullfrog Top-2:Acorn Top-3:Garter snake
15
+ Figure 1: All images shown cause a competitive ImageNet-trained network to output the exact same probabilities over all 1000 classes (logits shown above each image). The leftmost image is from the ImageNet validation set; all other images are constructed such that they match the non-class related information of images taken from other classes (for details see section 2.1). The excessive invariance revealed by this set of adversarial examples demonstrates that the logits contain only a small fraction of the information perceptually relevant to humans for discrimination between the classes.
16
+
17
+ Adversarial vulnerability is one of the most iconic failure cases of modern machine learning models (Szegedy et al., 2013) and a prime example of their weakness in out-of-distribution generalization. It is particularly striking that under i.i.d. settings deep networks show superhuman performance on many tasks (LeCun et al., 2015), while tiny targeted shifts of the input distribution can cause them to make unintuitive mistakes. The reason for these failures and how they may be avoided or at least mitigated is an active research area (Schmidt et al., 2018; Gilmer et al., 2018b; Bubeck et al., 2018).
18
+
19
+ So far, the study of adversarial examples has mostly been concerned with the setting of small perturbation, or $\epsilon$ -adversaries (Goodfellow et al., 2015; Madry et al., 2017; Raghunathan et al., 2018).
20
+
21
+ Perturbation-based adversarial examples are appealing because they allow to quantitatively measure notions of adversarial robustness (Brendel et al., 2018). However, recent work argued that the perturbation-based approach is unrealistically restrictive and called for the need of generalizing the concept of adversarial examples to the unrestricted case, including any input crafted to be misinterpreted by the learned model (Song et al., 2018; Brown et al., 2018). Yet, settings beyond $\epsilon$ -robustness are hard to formalize (Gilmer et al., 2018a).
22
+
23
+ We argue here for an alternative, complementary viewpoint on the problem of adversarial examples. Instead of focusing on transformations erroneously crossing the decision-boundary of classifiers, we focus on excessive invariance as a major cause for adversarial vulnerability. To this end, we introduce the concept of invariance-based adversarial examples and show that class-specific content of almost any input can be changed arbitrarily without changing activations of the network, as illustrated in figure 1 for ImageNet. This viewpoint opens up new directions to analyze and control crucial aspects underlying vulnerability to unrestricted adversarial examples.
24
+
25
+ The invariance perspective suggests that adversarial vulnerability is a consequence of narrow learning, yielding classifiers that rely only on few highly predictive features in their decisions. This has also been supported by the observation that deep networks strongly rely on spectral statistical regularities (Jo & Bengio, 2017), or stationary statistics (Gatys et al., 2017) to make their decisions, rather than more abstract features like shape and appearance. We hypothesize that a major reason for this excessive invariance can be understood from an information-theoretic viewpoint of crossentropy, which maximizes a bound on the mutual information between labels and representation, giving no incentive to explain all class-dependent aspects of the input. This may be desirable in some cases, but to achieve truly general understanding of a scene or an object, machine learning models have to learn to successfully separate essence from nuisance and subsequently generalize even under shifted input distributions.
26
+
27
+ Our contributions:
28
+
29
+ • We identify excessive invariance underlying striking failures in deep networks and formalize the connection to adversarial examples. We show invariance-based adversarial examples can be observed across various tasks and types of deep network architectures.
30
+ • We propose an invertible network architecture that gives explicit access to its decision space, enabling class-specific manipulations to images while leaving all dimensions of the representation seen by the final classifier invariant.
31
+ • From an information-theoretic viewpoint, we identify the cross-entropy objective as a major reason for the observed failures. Leveraging invertible networks, we propose an alternative objective that provably reduces excessive invariance and works well in practice.
32
+
33
+ # 2 TWO COMPLEMENTARY APPROACHES TO ADVERSARIAL EXAMPLES
34
+
35
+ In this section, we define pre-images and establish a link to adversarial examples.
36
+
37
+ Definition 1 (Pre-images / Invariance). Let $F : \mathbb { R } ^ { d } \mathbb { R } ^ { C }$ be a neural network, $F = f _ { L } \circ \cdot \cdot \cdot \circ f _ { 1 }$ with layers $f _ { i }$ and let $F _ { i }$ denote the network up to layer i. Further, let $D : \mathbb { R } ^ { d } \{ 1 , \dots , C \}$ be a classifier with $D = \arg \operatorname* { m a x } _ { k = 1 , \ldots , C } s o f t m a x ( F ( x ) ) _ { k }$ . Then, for input $\boldsymbol { x } \in \mathbb { R } ^ { d }$ , we define the following pre-images
38
+
39
+ (i) i-th Layer pre-image: $\{ x ^ { * } \in \mathbb { R } ^ { d } \mid F _ { i } ( x ^ { * } ) = F _ { i } ( x ) \}$ (ii) Logit pre-image: $\{ x ^ { * } \in \mathbb { R } ^ { d } \mid F ( x ^ { * } ) = F ( x ) \}$ (iii) Argmax pre-image: $\{ x ^ { * } \in \mathbb { R } ^ { d } \mid D ( x ^ { * } ) = D ( x ) \}$ , where $( i ) \subset ( i i ) \subset ( i i i )$ by the compositional nature of $D$ . Moreover, the (sub-)network is invariant to perturbations $\Delta x$ which satisfy $x ^ { * } = x + \Delta x$
40
+
41
+ ![](images/c0f0bdabfb8999576b5eacd6bad061d4e004e90bb9a9f87cefb6c26365da9a34.jpg)
42
+ Figure 2: Connection between (1) invariance-based (long pink arrow) and (2) perturbation-based adversarial examples (short orange arrow). Class distributions are shown in green and blue; dashed line is the decision-boundary of a classifier. All adversarial examples can be reached either by crossing the decision-boundary of the classifier via perturbations, or by moving within the pre-image of the classifier to mis-classified regions. The two viewpoints are complementary to one another and highlight that adversarial vulnerability is not only caused by excessive sensitivity to semantically meaningless perturbations, but also by excessive insensitivity to semantically meaningful transformations.
43
+
44
+ Non-trivial pre-images (pre-images containing more elements than input $x$ ) after the $i$ -th layer occur if the chain $f _ { i } \circ \cdots \circ f _ { 1 }$ is not injective, for instance due to subsampling or non-injective activation functions like ReLU (Behrmann et al., 2018a). This accumulated invariance can become problematic if not controlled properly, as we will show in the following.
45
+
46
+ We define perturbation-based adversarial examples by introducing the notion of an oracle (e.g., a human decision-maker or the unknown input-output function considered in learning theory):
47
+
48
+ Definition 2 (Perturbation-based Adversarial Examples). A Perturbation-based adversarial example $x ^ { * } \in \mathbb { R } ^ { d }$ of $x \in \mathbb { R } ^ { d }$ fulfills:
49
+
50
+ (i) Perturbation of decision: $D ( x ^ { * } ) \neq o ( x ^ { * } )$ and $D ( x ) \neq D ( x ^ { * } )$ , where $D : \mathbb { R } ^ { d } \{ 1 , \ldots , C \}$ is the classifier and $o : \mathbb { R } ^ { d } \{ 1 , . . . , C \}$ is the oracle.
51
+
52
+ (ii) Created by adversary: $x ^ { * } \in \mathbb { R } ^ { d }$ is created by an algorithm $\mathcal { A } : \mathbb { R } ^ { d } \mathbb { R } ^ { d }$ with $x \mapsto x ^ { * }$
53
+
54
+ Further, -bounded adversarial ex. $x ^ { * }$ of $x$ fulfill $\| x - x ^ { * } \| < \epsilon , \| \cdot \|$ a norm on $\mathbb { R } ^ { d }$ and $\epsilon > 0$ .
55
+
56
+ Usually, such examples are constructed as $\epsilon$ -bounded adversarial examples (Goodfellow et al., 2015). However, as our goal is to characterize general invariances of the network, we do not restrict ourselves to bounded perturbations.
57
+
58
+ Definition 3 (Invariance-based Adversarial Examples). Let $G$ denote the i-th layer, logits or the classifier (Definition 1) and let $x ^ { * } \neq x$ be in the $G$ pre-image of $x$ and and o an oracle (Definition 2). Then, an invariance-based adversarial example fulfills $o ( x ) \neq o ( x ^ { * } )$ , while $G ( x ) = G ( x ^ { * } )$ (and hence $D ( x ) = D ( x ^ { * } ) ,$ .
59
+
60
+ Intuitively, adversarial perturbations cause the output of the classifier to change while the oracle would still consider the new input $x ^ { * }$ as being from the original class. Hence in the context of $\epsilon$ - bounded perturbations, the classifier is too sensitive to task-irrelevant changes. On the other hand, movements in the pre-image leave the classifier invariant. If those movements induce a change in class as judged by the oracle, we call these invariance-based adversarial examples. In this case, however, the classifier is too insensitive to task-relevant changes. In conclusion, these two modes are complementary to each other, whereas both constitute failure modes of the learned classifier.
61
+
62
+ When not restricting to $\epsilon$ -perturbations, perturbation-based and invariance-based adversarial examples yield the same input $x ^ { * }$ via
63
+
64
+ $$
65
+ \begin{array} { r l } & { x ^ { * } = x _ { 1 } + \Delta x _ { 1 } , \quad D ( x ^ { * } ) \neq D ( x _ { 1 } ) , \quad o ( x ^ { * } ) = o ( x _ { 1 } ) } \\ & { x ^ { * } = x _ { 2 } + \Delta x _ { 2 } , \quad D ( x ^ { * } ) = D ( x _ { 2 } ) , \quad o ( x ^ { * } ) \neq o ( x _ { 2 } ) , } \end{array}
66
+ $$
67
+
68
+ with different reference points $x _ { 1 }$ and $x _ { 2 }$ , see Figure 2. Hence, the key difference is the change of reference, which allows us to approach these failure modes from different directions. To connect these failure modes with an intuitive understanding of variations in the data, we now introduce the notion of invariance to nuisance and semantic variations, see also (Achille & Soatto, 2018).
69
+
70
+ Definition 4 (Semantic/ Nuisance perturbation of an input). Let o be an oracle (Definition 2) and $\boldsymbol { x } \in \mathbb { R } ^ { d }$ . Then, a perturbation $\Delta x$ of an input $\boldsymbol { x } \in \mathbb { R } ^ { d }$ is called semantic, $i f o ( x ) \neq o ( x + \Delta x )$ and nuisance if $o ( x ) = o ( x + \Delta x )$ .
71
+
72
+ For example, such a nuisance perturbation could be a translation or occlusion in image classification. Further in Appendix A, we discuss the synthetic example called Adversarial Spheres from (Gilmer et al., 2018b), where nuisance and semantics can be explicitly formalized as rotation and norm scaling.
73
+
74
+ # 2.1 USING BIJECTIVE NETWORKS TO ANALYZE EXCESSIVE INVARIANCE
75
+
76
+ As invariance-based adversarial examples manifest themselves in changes which do not affect the output of the network $F$ , we need a generic approach that gives us access to the discarded nuisance variability. While feature nuisances are intractable to access for general architectures (see comment after Definition 1), invertible classifiers only remove nuisance variability in their final projection (Jacobsen et al., 2018). For $C < d$ , we denote the classifier as $D : \mathbb { R } ^ { d } \{ 1 , . . . , C \}$ . Our contributions in this section are: (1) Introduce an invertible architecture with a simplified readout structure, allowing to exactly visualize manipulations in the hidden-space, (2) Propose an analytic attack based on this architecture allowing to analyze its decision-making, (3) Reveal striking invariance-based vulnerability in competitive classifiers.
77
+
78
+ Bijective classifiers with simplified readout. We build deep networks that give access to their decision space by removing the final linear mapping onto the class probes in invertible RevNet-classifiers and call these networks fully invertible RevNets. The fully invertible RevNet classifier can be written as $\begin{array} { r l } { D _ { \theta } } & { { } = } \end{array}$ arg $\mathrm { m a x } _ { k = 1 , \ldots , C }$ sof tmax $( F _ { \theta } ( x ) _ { k } )$ , where $F _ { \theta }$ represents the bijective network. We denote $z = F _ { \theta } ( x )$ , $z _ { s } = z _ { 1 , . . . , C }$ as the logits (semantic variables) and $z _ { n } = z _ { C + 1 , \dots , d }$ as the nuisance variables ( $z _ { n }$ is not used for classification). In practice we choose the first C indices of the final $z$ tensor or apply a more sophiscticated DCT scheme (see appendix D) to set the subspace $z _ { s }$ , but other choices work as well. The architecture of the network is similar to iRevNets (Jacobsen et al., 2018) with some additional Glow components like actnorm (Kingma & Dhariwal, 2018), squeezing, dimension splitting and affine block structure (Dinh et al., 2017), see Figure 3 for a graphical description. As all components are common in the bijective network literature, we refer the reader to Appendix D for exact training and architecture details. Due to its simple readout structure, the resulting invertible network allows to qualitatively and quantitatively investigate the task-specific content in nuisance and logit variables. Despite this restriction, we achieve performance on par with commonly-used baselines on MNIST and ImageNet, see Table 1 and Appendix D.
79
+
80
+ ![](images/f78c381fb42ee49eac102ae6637b3dd6749fe9bab74d5ab5f291c5398e0a2c9d.jpg)
81
+ Figure 3: The fully invertible RevNet, a hybrid of Glow and iRevNet with simple readout structure. $z _ { s }$ represents the logits and $z _ { n }$ the nuisance.
82
+
83
+ Table 1: The table shows error rates on the ILSVRC-2012 validation set of our proposed fully invertible RevNet compared to a VGG (Simonyan & Zisserman, 2014) and two ResNet (He et al., 2016) variants, as well as an iRevNet (Jacobsen et al., 2018) with a non-invertible final projection onto the logits. Our proposed fully invertible RevNet performs roughly on par with others.
84
+
85
+ <table><tr><td>% Error</td><td>fi-RevNet48(Ours)</td><td>VGG19</td><td>ResNet18</td><td>ResNet50</td><td>iRevNet300</td></tr><tr><td>ILSVRC2012 Val Top1</td><td>29.50</td><td>28.70</td><td>30.43</td><td>24.70</td><td>26.70</td></tr><tr><td>ILSVRC2012 Val Top5</td><td>11.30</td><td>9.90</td><td>10.80</td><td>7.89</td><td>1</td></tr></table>
86
+
87
+ Analytic attack. To analyze the trained models, we can sample elements from the logit pre-image by computing $x _ { m e t } = \dot { F } ^ { - 1 } ( z _ { s } , \tilde { z } _ { n } )$ , where $z _ { s }$ and $\tilde { z } _ { n }$ are taken from two different inputs. We term this heuristic metameric sampling. The samples would be from the true data distribution if the subspaces would be factorized as $P ( z _ { s } , z _ { n } ) = P ( z _ { s } ) P ( z _ { n } )$ . Experimentally we find that logit metamers are revealing adversarial subspaces and are visually close to natural images on ImageNet.
88
+
89
+ ![](images/312912477085d17d938475783720b40414291d57f774eebbb9a82a2e2680bf15.jpg)
90
+ Figure 4: Left: Decision-boundaries in 2D subspace spanned by two random data points $x _ { 1 } , x _ { 2 }$ . Right: Decision-boundaries in 2D subspace spanned by random datapoint $x$ and metamer $x _ { m e t }$ .
91
+
92
+ Thus, metameric sampling gives us an analytic tool to inspect dependencies between semantic and nuisance variables without the need for expensive and approximate optimization procedures.
93
+
94
+ Attack on adversarial spheres. First, we evaluate our analytic attack on the synthetic spheres dataset, where the task is to classify samples as belonging to one out of two spheres with different radii. We choose the sphere dimensionality to be $d = 1 0 0$ and the radii: $R _ { 1 } = 1$ , $R _ { 2 } = 1 0$ . By training a fully-connected fully invertible RevNet, we obtain $100 \%$ accuracy. After training we visualize the decision-boundaries of the original classifier $D$ and a posthoc trained classifier on $z _ { n }$ (nuisance classifier), see Figure 4. We densely sample points in a 2D subspace, following Gilmer et al. (2018b), to visualize two cases: 1) the decision-boundary on a 2D plane spanned by two randomly chosen data points, 2) the decision-boundary spanned by metameric sample $x _ { m e t }$ and reference point $x$ . In the metameric sample subspace we identify excessive invariance of the classifier. Here, it is possible to move any point from the inner sphere to the outer sphere without changing the classifiers predictions. However, this is not possible for the classifier trained on $z _ { n }$ . Most notably, the visualized failure is not due to a lack of data seen during training, but rather due to excessive invariance of the original classifier $D$ on $z _ { s }$ . Thus, the nuisance classifier on $z _ { n }$ does not exhibit the same adversarial vulnerability in its subspace.
95
+
96
+ ![](images/f5d93067addd2b7eec8ae5acd4eb220e3b2efaa5b441ac7a436dc0c871109964.jpg)
97
+ Figure 5: Each column shows three images belonging together. Top row are source images from which we sample the logits, middle row are logit metamers and bottom row images from which we sample the nuisances. Top row and middle row have the same (approximately for ResNets, exactly for fully invertible RevNets) logit activations. Thus, it is possible to change the image content completely without changing the 10- and 1000-dimensional logit vectors respectively. This highlights a striking failure of classifiers to capture all task-dependent variability.
98
+
99
+ Attack on MNIST and ImageNet. After validating its potential to uncover adversarial subspaces, we apply metameric sampling to fully invertible RevNets trained on MNIST and Imagenet, see Figure 5. The result is striking, as the nuisance variables $z _ { n }$ are dominating the visual appearance of the logit metamers, making it possible to attach any semantic content to any logit activation pattern. Note that the entire 1000-dimensional feature vector containing probabilities over all ImageNet classses remains unchanged by any of the transformations we apply. To show our findings are not a particular property of bijective networks, we attack an ImageNet trained ResNet152 with a gradientbased version of our metameric attack, also known as feature adversaries (Sabour et al., 2016). The attack minimizes the mean squared error between a given set of logits from one image to another image (see appendix B for details). The attack shows the same failures for non-bijective models. This result highlights the general relevance of our finding and poses the question of the origin of this excessive invariance, which we will analyze in the following section.
100
+
101
+ # 3 OVERCOMING INSUFFICIENCY OF CROSSENTROPY-BASED INFORMATION-MAXIMIZATION
102
+
103
+ In this section we identify why the cross-entropy objective does not necessarily encourage to explain all task-dependent variations of the data and propose a way to fix this. As shown in figure 4, the nuisance classifier on $z _ { n }$ uses task-relevant information not captured by the logit classifier $D _ { \theta }$ on $z _ { s }$ (evident by its superior performance in the adversarial subspace).
104
+
105
+ We leverage the simple readout-structure of our invertible network and turn this observation into a formal explanation framework using information theory: Let $( x , y ) \sim \mathcal { D }$ with labels $y \in \{ 0 , 1 \} ^ { C }$ . Then the goal of a classifier can be stated as maximizing the mutual information (Cover & Thomas, 2006) between semantic features $z _ { s }$ (logits) extracted by network $F _ { \theta }$ and labels $y$ , denoted by $I ( y ; z _ { s } )$ .
106
+
107
+ Adversarial distribution shift. As the previously discussed failures required to modify input data from distribution $\mathcal { D }$ , we introduce the concept of an adversarial distribution shift $\mathcal { D } _ { A d v } \neq \mathcal { D }$ to formalize these modifications. Our first assumptions for $\mathcal { D } _ { A d v }$ is $I _ { \mathcal { D } _ { A d v } } ( z _ { n } ; y ) \ \le \ I _ { \mathcal { D } } ( z _ { n } ; y )$ . Intuitively, the nuisance variables $z _ { n }$ of our network do not become more informative about $y$ . Thus, the distribution shift may reduce the predictiveness of features encoded in $z _ { s }$ , but does not introduce or increase the predictive value of variations captured in $z _ { n }$ . Second, we assume $I _ { \mathcal { D } _ { A d v } } ( y ; z _ { s } | z _ { n } ) \leq$ $I _ { \mathcal { D } _ { A d v } } ( y ; z _ { s } )$ , which corresponds to positive or zero interaction information, see e.g. (Ghassami & Kiyavash, 2017). While the information in $z _ { s }$ and $z _ { n }$ can be redundant in this assumption, synergetic effects where conditioning on $z _ { n }$ increase the mutual information between $y$ and $z _ { s }$ are excluded.
108
+
109
+ Bijective networks $F _ { \theta }$ capture all variations by design which translates to information preservation $I ( y ; x ) = I ( y ; F _ { \theta } ( x ) )$ , see (Kraskov et al., 2004). Consider the reformulation
110
+
111
+ $$
112
+ I ( y ; x ) = I ( y ; F _ { \theta } ( x ) ) = I ( y ; z _ { s } , z _ { n } ) = I ( y ; z _ { s } ) + I ( y ; z _ { n } | z _ { s } ) = I ( y ; z _ { n } ) + I ( y ; z _ { s } | z _ { n } )
113
+ $$
114
+
115
+ by the chain rule of mutual information (Cover & Thomas, 2006), where $I ( y ; z _ { n } | z _ { s } )$ denotes the conditional mutual information. Most strikingly, equation 5 offers two ways forward:
116
+
117
+ 1. Direct increase of $I ( y ; z _ { s } )$
118
+ 2. Indirect increase of $I ( y ; z _ { s } | z _ { n } )$ via decreasing $I ( y ; z _ { n } )$ .
119
+
120
+ Usually in a classification task, only $I ( y ; z _ { s } )$ is increased actively via training a classifier. While this approach is sufficient in most cases, expressed via high accuracies on training and test data, it may fail under $\mathcal { D } _ { A d v }$ . This highlights why cross-entropy training may not be sufficient to overcome excessive semantic invariance. However, by leveraging the bijection $F _ { \theta }$ we can minimize the unused information $I ( y ; z _ { n } )$ using the intuition of a nuisance classifier.
121
+
122
+ Definition 5 (Independence cross-entropy loss). Let $F _ { \theta } : \mathbb { R } ^ { d } \mathbb { R } ^ { d }$ a bijective network with parameters $\theta \in \mathbb { R } ^ { p _ { 1 } }$ and $\tilde { F } _ { \theta } ( x ) = s o f t m a x ( F _ { \theta } ( x ) _ { 1 , . . . , C } )$ . Furthermore, let $D _ { \theta _ { n c } } : \mathbb { R } ^ { d - C } [ 0 , 1 ] ^ { C }$ be the nuisance classifier with $\theta _ { n c } \in \mathbb { R } ^ { p _ { 2 } }$ . Then, the independence cross-entropy loss is defined as:
123
+
124
+ $$
125
+ \operatorname* { m i n } _ { \theta } \operatorname* { m m a x } _ { \theta _ { n c } } \mathcal { L } _ { i C E } ( \theta , \theta _ { n c } ) = \underbrace { \sum _ { i = 1 } ^ { C } - y _ { i } \log \tilde { F } _ { \theta } ^ { z _ { s } } ( x ) } _ { = : \mathcal { L } _ { s C E } ( \theta ) } + \underbrace { \sum _ { i = 1 } ^ { C } y _ { i } \log D _ { \theta _ { n c } } ( F _ { \theta } ^ { z _ { n } } ( x ) ) _ { i } } _ { = : \mathcal { L } _ { n C E } ( \theta , \theta _ { n c } ) } .
126
+ $$
127
+
128
+ The underlying principles of the nuisance classification loss $\mathcal { L } _ { n C E }$ can be understood using a variational lower bound on mutual information from Barber $\&$ Agakov (2003). In summary, the minimization is with respect to a lower bound on $I _ { \mathcal { D } } ( y ; z _ { n } )$ , while the maximization aims to tighten the bound (see Lemma 10 in Appendix C). By using these results, we now state the main result under the assumed distribution shift and successful minimization (proof in Appendix C.1):
129
+
130
+ Theorem 6 (Information $I _ { \mathcal { D } _ { A d v } } ( y ; z _ { s } )$ maximal after distribution shift). Let $\mathcal { D } _ { A d v }$ denote the adversarial distribution and $\mathcal { D }$ the training distribution. Assume $I _ { \mathcal { D } } ( y ; z _ { n } ) = 0$ by minimizing $\mathcal { L } _ { i C E }$ and the distribution shift satisfies $I _ { \mathcal { D } _ { A d v } } ( z _ { n } ; y ) \le I _ { \mathcal { D } } ( z _ { n } ; y )$ and $I _ { \mathcal { D } _ { A d v } } ( y ; z _ { s } | z _ { n } ) \le I _ { \mathcal { D } _ { A d v } } ( y ; z _ { s } )$ . Then,
131
+
132
+ $$
133
+ I _ { \mathcal { D } _ { A d v } } ( y ; z _ { s } ) = I _ { \mathcal { D } } ( y ; x ) .
134
+ $$
135
+
136
+ ![](images/73d5fe6f47b49141239978bf86ee7d741b2c00e7f149f70f085c270429adb6af.jpg)
137
+ Figure 6: Left: Mutual information under distribution $\mathcal { D } _ { t r a i n }$ , Right: Effect of distributional shift to $\mathcal { D } _ { A d v }$ . Each case under training with cross-entropy (CE) and independence cross-entropy (iCE). Under distribution $\mathcal { D }$ , the iCE-loss minimizes $I ( y ; z _ { n } )$ (Lemma 10, Appendix C), but has no effect as the CE-loss already maximizes $I ( y ; z _ { s } )$ . However under the shift to $\mathcal { D } _ { A d v }$ , the information $I ( y ; z _ { s } )$ decreases when training only under the CE-loss (orange arrow), while the iCE-loss induces $I ( y ; z _ { n } ) = 0$ and thus leaves $I ( y ; z _ { s } )$ unchanged (Theorem 6).
138
+
139
+ Thus, incorporating the nuisance classifier allows for the discussed indirect increase of $I _ { \mathcal { D } _ { A d v } } ( y ; z _ { s } )$ under an adversarial distribution shift, visualized in Figure 6.
140
+
141
+ To aid stability and further encourage factorization of $z _ { s }$ and $z _ { n }$ in practice, we add a maximum likelihood term to our independence cross-entropy objective as
142
+
143
+ $$
144
+ \operatorname* { m i n } _ { \theta } \operatorname* { m a x } _ { \theta _ { n c } } \mathcal { L } ( \theta , \theta _ { n c } ) = \mathcal { L } _ { i C E } ( \theta , \theta _ { n c } ) - \underbrace { \sum _ { k = 1 } ^ { d - C } \log \big ( p _ { k } ( F _ { \theta } ^ { z _ { n } } ( x ) _ { k } ) | \mathsf { d e t } ( J _ { \theta } ^ { x } ) | \big ) } _ { = : \mathcal { L } _ { M L E _ { n } } ( \theta ) } ,
145
+ $$
146
+
147
+ where $\operatorname* { d e t } ( J _ { \theta } ^ { x } )$ denotes the determinant of the Jacobian of $F _ { \theta } ( x )$ and $p _ { k } \sim \mathcal N ( \beta _ { k } , \gamma _ { k } )$ with $\beta _ { k } , \gamma _ { k }$ learned parameter. The log-determinant can be computed exactly in our model with negligible additional cost. Note, that optimizing $\mathcal { L } _ { M L E _ { n } }$ on the nuisance variables together with $\mathcal { L } _ { s C E }$ amounts to maximum-likelihood under a factorial prior (see Lemma 11 in Appendix C).
148
+
149
+ Just as in GANs the quality of the result relies on a tight bound provided by the nuisance classifier and convergence of the MLE term. Thus, it is important to analyze the success of the objective after training. We do this by applying our metameric sampling attack, but there are also other ways like evaluating a more powerful nuisance classifier after training.
150
+
151
+ # 4 APPLYING INDEPENDENCE CROSS-ENTROPY
152
+
153
+ In this section, we show that our proposed independence cross-entropy loss is effective in reducing invariance-based vulnerability in practice by comparing it to vanilla cross-entropy training in four aspects: (1) error on train and test set, (2) effect under distribution shift, perturbing nuisances via metameric sampling, (3) evaluate accuracy of a classifier on the nuisance variables to quantify the class-specific information in them and (4) on our newly introduced shiftMNIST, an augmented version of MNIST to benchmark adversarial distribution shifts according to Theorem 6.
154
+
155
+ For all experiments we use the same network architecture and settings, the only difference being the two additional loss terms as explained in Definition 5 and equation 6. In terms of test error of the logit classifier, both losses perform approximately on par, whereas the gap between train and test error vanishes for our proposed loss function, indicating less overfitting. For classification errors see Table 2 in appendix D.
156
+
157
+ Robustness under metameric sampling attack. To analyze if our proposed loss indeed leads to independence between $z _ { n }$ and labels $y$ , we attack it with our metameric sampling procedure. As we are only looking on data samples and not on samples from the model (factorized gaussian on nuisances), this attack should reveal if the network learned to trick the objective. In Figure 7 we show interpolations between original images and logit metamers in CE- and iCE-trained fully invertible RevNets. In particular, we are holding the activations $z _ { s }$ constant, while linearly interpolating nuisances $z _ { n }$ down the column. The CE-trained network allows us to transform any image into any class without changing the logits. However, when training with our proposed iCE, the picture changes fundamentally and interpolations in the pre-image only change the style of a digit, but not its semantic content. This shows our loss has the ability to overcome excessive task-related invariance and encourages the model to explain and separate all task-related variability of the input from the nuisances of the task.
158
+
159
+ ![](images/2878ac37ae1f52e0860ae2bbe9863a4363816bf0b1fe4fc1fe72b942ed272dab.jpg)
160
+ Figure 7: Samples $\tilde { x } = F ^ { - 1 } ( z _ { s } , \tilde { z } _ { n } )$ with logit activations $z _ { s }$ taken from original image and $\tilde { z } _ { n }$ obtained by linearly interpolating from the original nuisance $z _ { n }$ (first row) to the nuisance of a target example $z _ { n } ^ { * }$ (last row upper block). The used target example is shown at the bottom. When training with cross-entropy, virtually any image can be turned into any class without changing the logits $z _ { s }$ , illustrating strong vulnerability to invariance-based adversaries. Yet, training with independence cross-entropy solves the problem and interpolations between nuisances $z _ { n }$ and $z _ { n } ^ { * }$ preserve the semantic content of the image.
161
+
162
+ A classifier trained on the nuisance variables of the cross-entropy trained model performs even better than the logit classifier. Yet, a classifier on the nuisances of the independence cross-entropy trained model is performing poorly (Table 2 in appendix D). This indicates little class-specific information in the nuisances $z _ { n }$ , as intended by our objective function. Note also that this inability of the nuisance classifier to decode class-specific information is not due to it being hard to read out from $z _ { n }$ , as this would be revealed by the metameric sampling attack (see Figure 7).
163
+
164
+ ![](images/9878f27952dcfb71dbf48a4f121956a443404c4ecba376079d04801f339ac19e.jpg)
165
+ Figure 8: shiftMNIST experiments. (a): Binary shiftMNIST, where the class is additionally encoded with a location-based binary code on the left border of the image (highlighted with red circles). The shifted adversarial test distribution does not have the binary class encoding. (b): Texture shiftMNIST, where the class is additionally encoded in background texture type. The texture-class coupling is randomized in the shifted adversarial test distribution. Right: Results of CE-trained ResNet, fully invertible RevNet and iCE-trained fully invertible RevNet. The CE-based models build excessive invariance with respect to the digit identity on $\mathcal { D } _ { t r a i n }$ and fail on $\mathcal { D } _ { A d v }$ . Difference denotes the largest improvement between CE-trained and iCE-trained model. The iCE model is more resilient to removing informative features, and reduces the error on $\mathcal { D } _ { A d v }$ up to $38 \%$ .
166
+
167
+ shiftMNIST: Benchmarking adversarial distribution shift. To further test the efficacy of our proposed independence cross-entropy, we introduce a simple, but challenging new dataset termed shiftMNIST to test classifiers under adversarial distribution shifts $\mathcal { D } _ { A d v }$ . The dataset is based on vanilla MNIST, augmented by introducing additional, highly predictive features at train time that are randomized or removed at test time. Randomization or removal ensures that there are no synergy effects between digits and planted features under $\mathcal { D } _ { A d v }$ . This setup allows us to reduce mutual information between category and the newly introduced feature in a targeted manner. (a) Binary shiftMNIST is vanilla MNIST augmented by coding the category for each digit into a single binary pixel scheme. The location of the binary pixel reveals the category of each image unambigiously, while only minimally altering the image’s appearance.
168
+
169
+ At test time, the binary code is not present and the network can not rely on it anymore. (b) Textured shiftMNIST introduces textured backgrounds for each digit category which are patches sampled from the describable texture dataset (Cimpoi et al., 2014).
170
+
171
+ At train time the same type of texture is underlayed each digit of the same category, while texture types across categories differ. At test time, the relationship is broken and texture backgrounds are paired with digits randomly, again minimizing the mutual information between background and label in a targeted manner. See Figure 8 for examples1.
172
+
173
+ It turns out that this task is indeed very hard for standard classifiers and their tendency to become excessively invariant to semantically meaningful features, as predicted by our theoretical analysis. When trained with cross-entropy, ResNets and fi-RevNets make zero errors on the train set, while having error rates of up to $87 \%$ on the shifted test set. This is striking, given that e.g. in binary shiftMNIST, only one single pixel is removed under $\mathcal { D } _ { A d v }$ , leaving the whole image almost unchanged. When applying our independence cross-entropy, the picture changes again. The errors made by the network improve by up to almost $38 \%$ on binary shiftMNIST and around $28 \%$ on textured shiftMNIST. This highlights the effectiveness of our proposed loss function and its ability to minimize catastrophic failure under severe distribution shifts exploiting excessive invariance.
174
+
175
+ # 5 RELATED WORK
176
+
177
+ Adversarial examples. Adversarial examples often include $\epsilon$ -norm restrictions (Szegedy et al., 2013), while (Gilmer et al., 2018a) argue for a broader definition to fully capture the implications for security. The $\epsilon$ -adversarial examples have also been extended to $\epsilon$ -feature adversaries (Sabour et al., 2016), which are equivalent to our approximate metameric sampling attack. Some works (Song et al., 2018; Fawzi et al., 2018) consider unrestricted adversarial examples, which are closely related to invariance-based adversarial vulnerability. The difference to human perception revealed by adversarial examples fundamentally questions which statistics deep networks use to base their decisions (Jo & Bengio, 2017; Tsipras et al., 2019).
178
+
179
+ Relationship between standard and bijective networks. We leverage recent advances in reversible (Gomez et al., 2017) and bijective networks (Jacobsen et al., 2018; Ardizzone et al., 2019; Kingma & Dhariwal, 2018) for our analysis. It has been shown that ResNets and iRevNets behave similarly on various levels of their representation on challenging tasks (Jacobsen et al., 2018) and that iRevNets as well as Glow-type networks are related to ResNets by the choice of dimension splitting applied in their residual blocks (Grathwohl et al., 2019). Perhaps unsurprisingly, given so many similarities, ResNets themselves have been shown to be provably bijective under mild conditions (Behrmann et al., 2018b). Further, excessive invariance of the type we discuss here has been shown to occur in non residual-type architectures as well (Gilmer et al., 2018b; Behrmann et al., 2018a). For instance, it has been observed that up to $60 \%$ of semantically meaningful input dimensions on the adversarial spheres problem are learned to be ignored, while retaining virtually perfect performance (Gilmer et al., 2018b). In summary, there is ample evidence that RevNet-type networks are closely related to ResNets, while providing a principled framework to study widely observed issues related to excessive invariance in deep learning in general and adversarial robustness in particular.
180
+
181
+ Information theory. The information-theoretic view has gained recent interest in machine learning due to the information bottleneck (Tishby & Zaslavsky, 2015; Shwartz-Ziv & Tishby, 2017; Alemi et al., 2017) and usage in generative modelling (Chen et al., 2016; Hjelm et al., 2019). As a consequence, the estimation of mutual information (Barber & Agakov, 2003; Alemi et al., 2018; Achille & Soatto, 2018; Belghazi et al., 2018) has attracted growing attention. The concept of group-wise independence between latent variables goes back to classical independent subspace analysis (Hyvarinen ¨ & Hoyer, 2000) and received attention in learning unbiased representations, e.g. see the Fair Variational Autoencoder (Louizos et al., 2015). Furthermore, extended cross-entropy losses via entropy terms (Pereyra et al., 2017) or minimizing predictability of variables (Schmidhuber, 1991) has been introduced for other applications. Our proposed loss also shows similarity to the GAN loss (Goodfellow et al., 2014). However, in our case there is no notion of real or fake samples, but exploring similarities in the optimization are a promising avenue for future work.
182
+
183
+ # 6 CONCLUSION
184
+
185
+ Failures of deep networks under distribution shift and their difficulty in out-of-distribution generalization are prime examples of the limitations in current machine learning models. The field of adversarial example research aims to close this gap from a robustness point of view. While a lot of work has studied $\epsilon$ -adversarial examples, recent trends extend the efforts towards the unrestricted case. However, adversarial examples with no restriction are hard to formalize beyond testing error. We introduce a reverse view on the problem to: (1) show that a major cause for adversarial vulnerability is excessive invariance to semantically meaningful variations, (2) demonstrate that this issue persists across tasks and architectures; and (3) make the control of invariance tractable via fully-invertible networks.
186
+
187
+ In summary, we demonstrated how a bijective network architecture enables us to identify large adversarial subspaces on multiple datasets like the adversarial spheres, MNIST and ImageNet. Afterwards, we formalized the distribution shifts causing such undesirable behavior via information theory. Using this framework, we find one of the major reasons is the insufficiency of the vanilla cross-entropy loss to learn semantic representations that capture all task-dependent variations in the input. We extend the loss function by components that explicitly encourage a split between semantically meaningful and nuisance features. Finally, we empirically show that this split can remove unwanted invariances by performing a set of targeted invariance-based distribution shift experiments.
188
+
189
+ # 7 ACKNOWLEDGEMENTS
190
+
191
+ We thank Ryota Tomioka for spotting a mistake in the proof for Theorem 6. We thank thank the anonymous reviewers, Ricky Chen, Will Grathwohl and Jesse Bettencourt for helpful comments on the manuscript. We gratefully acknowledge the financial support from the German Science Foundation for the CRC 1233 on ”Robust Vision” and RTG $2 2 2 4 \cdots 3$ : Parameter Identification - Analysis, Algorithms, Applications”
192
+
193
+ # REFERENCES
194
+
195
+ Mart´ın Abadi, Paul Barham, Jianmin Chen, Zhifeng Chen, Andy Davis, Jeffrey Dean, Matthieu Devin, Sanjay Ghemawat, Geoffrey Irving, Michael Isard, et al. Tensorflow: a system for largescale machine learning. In OSDI, volume 16, pp. 265–283, 2016.
196
+
197
+ Alessandro Achille and Stefano Soatto. Emergence of invariance and disentanglement in deep representations. Journal of Machine Learning Research, 18, 2018.
198
+
199
+ Alexander A. Alemi, Ian Fischer, Joshua V. Dillon, and Kevin Murphy. Deep variational information bottleneck. International Conference on Lerning Representations, 2017.
200
+
201
+ Alexander A. Alemi, Ben Poole, Ian Fischer, Joshua V. Dillon, Rif A. Saurous, and Kevin Murphy. An information-theoretic analysis of deep latent-variable models. Proceedings of the 35th International Conference on Machine Learning, 2018.
202
+
203
+ Lynton Ardizzone, Jakob Kruse, Carsten Rother, and Ullrich Kthe. Analyzing inverse problems with invertible neural networks. In International Conference on Learning Representations, 2019.
204
+
205
+ David Barber and Felix Agakov. The im algorithm: A variational approach to information maximization. In Advances in Neural Information Processing Systemss, 2003.
206
+
207
+ Jens Behrmann, Soren Dittmer, Pascal Fernsel, and Peter Maaß. Analysis of invariance and robust- ¨ ness via invertibility of relu-networks. arXiv preprint arXiv:1806.09730, 2018a.
208
+
209
+ Jens Behrmann, David Duvenaud, and Jorn-Henrik Jacobsen. Invertible residual networks. ¨ arXiv preprint arXiv:1811.00995, 2018b.
210
+
211
+ Mohamed Ishmael Belghazi, Aristide Baratin, Sai Rajeshwar, Sherjil Ozair, Yoshua Bengio, Devon Hjelm, and Aaron Courville. Mutual information neural estimation. In Proceedings of the 35th International Conference on Machine Learning, 2018.
212
+
213
+ Wieland Brendel, Jonas Rauber, Alexey Kurakin, Nicolas Papernot, Behar Veliqi, Marcel Salathe,´ Sharada $\mathrm { \bf P }$ Mohanty, and Matthias Bethge. Adversarial vision challenge. arXiv preprint arXiv:1808.01976, 2018.
214
+
215
+ Tom B. Brown, Nicholas Carlini, Chiyuan Zhang, Catherine Olsson, Paul Christiano, and Ian Goodfellow. Unrestricted adversarial examples. arXiv preprint arXiv:1809.08352, 2018.
216
+
217
+ Sebastien Bubeck, Eric Price, and Ilya Razenshteyn. Adversarial examples from computational ´ constraints. arXiv preprint arXiv:1805.10204, 2018.
218
+
219
+ Xi Chen, Yan Duan, Rein Houthooft, John Schulman, Ilya Sutskever, and Pieter Abbeel. Infogan: Interpretable representation learning by information maximizing generative adversarial nets. In Advances in Neural Information Processing Systems. 2016.
220
+
221
+ M. Cimpoi, S. Maji, I. Kokkinos, S. Mohamed, , and A. Vedaldi. Describing textures in the wild. In Proceedings of the IEEE Conf. on Computer Vision and Pattern Recognition (CVPR), 2014.
222
+
223
+ Thomas M. Cover and Joy A. Thomas. Elements of Information Theory (Wiley Series in Telecommunications and Signal Processing). Wiley-Interscience, New York, NY, USA, 2006. ISBN 0471241954.
224
+
225
+ Laurent Dinh, Jascha Sohl-Dickstein, and Samy Bengio. Density estimation using real nvp. International Conference on Learning Representations, 2017.
226
+
227
+ Alhussein Fawzi, Hamza Fawzi, and Omar Fawzi. Adversarial vulnerability for any classifier. In Advances in Neural Information Processing Systems 31. 2018.
228
+
229
+ Leon A Gatys, Alexander S Ecker, and Matthias Bethge. Texture and art with deep neural networks. Current opinion in neurobiology, 46:178–186, 2017.
230
+
231
+ AmirEmad Ghassami and Negar Kiyavash. Interaction information for causal inference: The case of directed triangle. arXiv preprint arXiv:abs/1701.08868, 2017.
232
+
233
+ Justin Gilmer, Ryan P. Adams, Ian Goodfellow, David Andersen, and George E. Dahl. Motivating the rules of the game for adversarial example research. arXiv preprint arXiv:1807.06732, 2018a.
234
+
235
+ Justin Gilmer, Luke Metz, Fartash Faghri, Samuel S Schoenholz, Maithra Raghu, Martin Wattenberg, and Ian Goodfellow. Adversarial spheres. arXiv preprint arXiv:1801.02774, 2018b.
236
+
237
+ Aidan N Gomez, Mengye Ren, Raquel Urtasun, and Roger B Grosse. The reversible residual network: Backpropagation without storing activations. Advances in Neural Information Processing Systems, 2017.
238
+
239
+ Ian Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. Generative adversarial nets. In Advances in Neural Information Processing Systems, pp. 2672–2680, 2014.
240
+
241
+ Ian Goodfellow, Jonathon Shlens, and Christian Szegedy. Explaining and harnessing adversarial examples. International Conference on Learning Representations, 2015.
242
+
243
+ Will Grathwohl, Ricky T. Q. Chen, Jesse Bettencourt, and David Duvenaud. Scalable reversible generative models with free-form continuous dynamics. In International Conference on Learning Representations, 2019.
244
+
245
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 770–778, 2016.
246
+
247
+ Devon Hjelm, Alex Fedorov, Samuel Lavoie-Marchildon, Karan Grewal, Phil Bachman, Adam Trischler, and Yoshua Bengio. Learning deep representations by mutual information estimation and maximization. In International Conference on Learning Representations, 2019.
248
+
249
+ Aapo Hyvarinen and Patrik Hoyer. Emergence of phase-and shift-invariant features by decomposi- ¨ tion of natural images into independent feature subspaces. Neural computation, 12(7):1705–1720, 2000.
250
+
251
+ Jorn-Henrik Jacobsen, Arnold W.M. Smeulders, and Edouard Oyallon. i-revnet: Deep invertible ¨ networks. In International Conference on Learning Representations, 2018.
252
+
253
+ Jason Jo and Yoshua Bengio. Measuring the tendency of cnns to learn surface statistical regularities. arXiv preprint arXiv:1711.11561, 2017.
254
+
255
+ Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
256
+
257
+ Durk P Kingma and Prafulla Dhariwal. Glow: Generative flow with invertible 1x1 convolutions. In Advances in Neural Information Processing Systems 31. 2018.
258
+
259
+ Alexander Kraskov, Harald Stogbauer, and Peter Grassberger. Estimating mutual information. ¨ Physical Review E, 69, 2004.
260
+
261
+ Yann LeCun, Yoshua Bengio, and Geoffrey Hinton. Deep learning. Nature, 521(7553):436–444, 2015.
262
+
263
+ Christos Louizos, Kevin Swersky, Yujia Li, Max Welling, and Richard S. Zemel. The variational fair autoencoder. arXiv preprint arXiv:abs/1511.00830, 2015.
264
+
265
+ Aleksander Madry, Aleksandar Makelov, Ludwig Schmidt, Dimitris Tsipras, and Adrian Vladu. Towards deep learning models resistant to adversarial attacks. International Conference on Learning Representations, 2017.
266
+
267
+ 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.
268
+
269
+ Gabriel Pereyra, George Tucker, Jan Chorowski, Lukasz Kaiser, and Geoffrey E. Hinton. Regularizing neural networks by penalizing confident output distributions. International Conference on Lerning Representations (workshop), 2017.
270
+
271
+ Aditi Raghunathan, Jacob Steinhardt, and Percy Liang. Certified defenses against adversarial examples. International Conference on Learning Representations, 2018.
272
+
273
+ Sara Sabour, Yanshuai Cao, Fartash Faghri, and David J Fleet. Adversarial manipulation of deep representations. International Conference on Learning Representations, 2016.
274
+
275
+ Jurgen Schmidhuber. Learning factorial codes by predictability minimization. Technical report, ¨ Dept. of Comp. Sci., University of Colorado at Boulder, 1991.
276
+
277
+ Ludwig Schmidt, Shibani Santurkar, Dimitris Tsipras, Kunal Talwar, and Aleksander Madry. Adversarially robust generalization requires more data. In Advances in Neural Information Processing Systems 31. 2018.
278
+
279
+ Ravid Shwartz-Ziv and Naftali Tishby. Opening the black box of deep neural networks via information. arXiv preprint arXiv:1703.00810, 2017.
280
+
281
+ Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. arXiv preprint arXiv:1409.1556, 2014.
282
+
283
+ Yang Song, Rui Shu, Nate Kushman, and Stefano Ermon. Constructing unrestricted adversarial examples with generative models. In Advances in Neural Information Processing Systems 31. 2018.
284
+
285
+ Christian Szegedy, Wojciech Zaremba, Ilya Sutskever, Joan Bruna, Dumitru Erhan, Ian Goodfellow, and Rob Fergus. Intriguing properties of neural networks. arXiv preprint arXiv:1312.6199, 2013.
286
+
287
+ Naftali Tishby and Noga Zaslavsky. Deep learning and the information bottleneck principle. In Information Theory Workshop (ITW), 2015 IEEE, pp. 1–5. IEEE, 2015.
288
+
289
+ Dimitris Tsipras, Shibani Santurkar, Logan Engstrom, Alexander Turner, and Aleksander Madry. Robustness may be at odds with accuracy. In International Conference on Learning Representations, 2019.
290
+
291
+ # A SEMANTIC AND NUISANCE VARIATION ON ADVERSARIAL SPHERES
292
+
293
+ Example 7 (Semantic and nuisance on Adversarial Spheres (Gilmer et al., 2018b)). Consider classifying inputs $x$ from two classes given by radii $R _ { 1 }$ or $R _ { 2 }$ . Further, let $( r , \phi )$ denote the spherical coordinates of $x$ . Then, any perturbation $\Delta x _ { \mathrm { { \ell } } }$ , $x ^ { * } = x + \Delta x$ with $r ^ { * } \neq r$ is semantic. On the other hand, $i f r ^ { * } = r$ the perturbation is a nuisance with respect to the task of discriminating two spheres.
294
+
295
+ In this example, the max-margin classifier $\begin{array} { r } { D ( x ) = s i g n \left( \| x \| - \frac { R _ { 1 } + R _ { 2 } } { 2 } \right) } \end{array}$ is invariant to any nuisance perturbation, while being only sensitive to semantic perturbations. In summary, the transform to spherical coordinates allows to linearize semantic and nuisance perturbations. Using this notion, invariance-based adversarial examples can be attributed to perturbations of $x ^ { * } = x + \Delta x$ with following two properties
296
+
297
+ 1. Perturbed sample $x ^ { * }$ stays in the pre-image $\{ x ^ { * } \in \mathbb { R } ^ { d } \mid D ( x ^ { * } ) = D ( x ) \}$ of the classifier
298
+
299
+ 2. Perturbation $\Delta x$ is semantic, as $o ( x ) \neq o ( x + \Delta x )$ .
300
+
301
+ Thus, the failure of the classifier $D$ can be thought of a mis-alignment between its invariance (expressed through the pre-image) and the semantics of the data and task (expressed by the oracle).
302
+
303
+ Example 8 (Mis-aligned classifier on Adversarial Spheres). Consider the classifier
304
+
305
+ $$
306
+ D ( x ) = s i g n \left( \left\| x _ { 1 , \ldots , d - 1 } \right\| - { \frac { R _ { 1 } + R _ { 2 } } { 2 } } \right) ,
307
+ $$
308
+
309
+ which computes the norm of $x$ from its first $d - 1$ cartesian-coordinates. Then, $D$ is invariant to a semantic perturbation with $\Delta r = R _ { 2 } - R _ { 1 }$ if only changes in the last coordinate $x _ { d }$ are made.
310
+
311
+ We empirically evaluate the classifier in equation 7 on the spheres problem (10M/2M samples setting (Gilmer et al., 2018b)) and validate that it can reach perfect classification accuracy. However, by construction, perturbing the invariant dimension $x _ { d } ^ { * } = x _ { d } + \Delta x _ { d }$ allows us to move all samples from the inner sphere to the outer sphere. Thus, the accuracy of the classifier drops to chance level when evaluating its performance under such a distributional shift.
312
+
313
+ To conclude, this underlines how classifiers with optimal performance on finite samples can exhibit non-intuitive failure modes due to excessive invariance with respect to semantic variations.
314
+
315
+ # B APPROXIMATE GRADIENT-BASED METAMERIC SAMPLES
316
+
317
+ We use a standard Imagenet pre-trained Resnet-154 as provided by the torchvision package (Paszke et al., 2017) and choose a logit percept $\mathbf { y } = G ( \mathbf { x } )$ that can be based on any seed image. Then we optimize various images $\tilde { x }$ to be metameric to $\mathbf { x }$ by simply minimizing a mean squared error loss of the form:
318
+
319
+ $$
320
+ \mathcal { L } _ { \mathrm { M S E } } ( G ( x ) , G ( \tilde { x } ) ) = \frac { 1 } { K } \sum _ { k = 1 } ^ { K } ( G ( x ) _ { k } - G ( \tilde { x } ) _ { k } ) ^ { 2 }
321
+ $$
322
+
323
+ in the 1000-dimensional semantic logit space via stochastic gradient descent. We optimize with Adam in Pytorch default settings and a learning rate of 0.01 for 3000 iterations. The optimization thus takes the form of an adversarial attack targeting all logit entries and with no norm restriction on the input distance. Note that our metameric sampling attack in bijective networks is the analytic reverse equivalent of this attack. It leads to the exact solution at the cost of one inverse pass instead of an approximate solution here at the cost of thousands of gradient steps.
324
+
325
+ ![](images/12e7f16bcbe83dd180d562b2e7c487f38ad425681ed46752814169a18d94d312.jpg)
326
+ Figure 9: Here we show a batch of randomly sampled metamers from our ImageNet-trained fully invertible RevNet-48. The quality is generally similar, sometimes colored artifacts appear.
327
+
328
+ # C INFORMATION THEORY
329
+
330
+ Computing mutual information is often intractable as it requires the joint probability $p ( x , y )$ , see (Cover & Thomas, 2006) for an extensive treatment of information theory. However, following variational lower bound can be used for approximation, see (Barber & Agakov, 2003).
331
+
332
+ Lemma 9 (Variational lower bound on mutual information). Let $X , Y$ be random variables with conditional density $p ( y | x )$ . Further, let $q _ { \theta } ( y | x )$ be a variational density depending on parameter $\theta$ . Then, the lower bound
333
+
334
+ $$
335
+ \begin{array} { r l } & { I ( Y ; X ) = h ( Y ) - h ( Y \vert X ) = h ( Y ) + \mathbb { E } _ { X } \mathbb { E } _ { Y \vert X } \log q _ { \theta } ( y \vert x ) + \mathbb { E } _ { X } ( p ( y \vert x ) \parallel q _ { \theta } ( y \vert x ) ) } \\ & { \qquad \ge h ( Y ) + \mathbb { E } _ { X } \mathbb { E } _ { Y \vert X } \log q _ { \theta } ( y \vert x ) } \end{array}
336
+ $$
337
+
338
+ holds with equality if $p ( y | x ) = q _ { \theta } ( y | x )$ .
339
+
340
+ While above lower bound removes the need for the computation of $p ( y | x )$ , estimating the expectation $\mathbb { E } _ { Y \mid X }$ still requires sampling from it. Using this bound, we can now state the effect of the nuisance classifiation loss.
341
+
342
+ Lemma 10 (Effect of nuisance classifier). Define semantics as $z _ { s } = F _ { \theta } ( x ) _ { 1 , . . . , C }$ and nuisances as $z _ { n } = F _ { \theta } ( x ) _ { C + 1 , \dots , d } ,$ , where $( x , y ) \sim \mathcal { D }$ . Then, the nuisance classification loss yields
343
+
344
+ (i) Minimization of lower bound on $I _ { \mathcal { D } } ( y ; z _ { n } )$ : $\theta ^ { * } ~ = ~ \arg \operatorname* { m i n } _ { \theta } \mathcal { L } _ { n C E } ( \theta , \theta _ { n c } ^ { * } )$ minimizes $I _ { \theta _ { n c } ^ { * } } ( y ; z _ { n } )$ , where $I _ { \theta _ { n c } ^ { * } } ( y ; z _ { n } ) \le I _ { \mathcal { D } } ( y ; z _ { n } )$ and $\begin{array} { r } { \theta _ { n c } ^ { * } = \arg \operatorname* { m a x } _ { \theta _ { 2 } } \mathcal { L } _ { n C E } ( \theta , \theta _ { n c } ) } \end{array}$ .
345
+
346
+ (ii) Maximization to tighten bound on $I _ { \mathcal { D } } ( y ; z _ { n } )$ : Under a perfect model of the conditional density, $D _ { \theta _ { n c } ^ { * } } ( z _ { n } ) \stackrel { } { = } p ( y | z _ { n } ) .$ , it holds $I _ { \theta _ { n c } ^ { * } } ( y ; z _ { n } ) = I _ { \mathcal { D } } ( y ; z _ { n } )$ .
347
+
348
+ Proof. To proof above result, we need to draw the connection to the variational lower bound on mutual information from Lemma 9. Let the nuisance classifier $D _ { \theta _ { n c } } ( z _ { n } )$ model the variational posterior $q _ { \theta _ { n c } } ( y | z _ { n } )$ . Then we have the lower bound
349
+
350
+ $$
351
+ I ( y ; z _ { n } ) \geq h ( y ) + \mathbb { E } _ { z _ { n } } \mathbb { E } _ { y | z _ { n } } \log D _ { \theta _ { n c } } ( z _ { n } ) = : I _ { \theta _ { n c } } ( y ; z _ { n } ) .
352
+ $$
353
+
354
+ From Lemma 9 follows, that if $D _ { \theta _ { n c } } ( z _ { n } ) = p ( y | z _ { n } )$ , it holds $I ( y ; z _ { n } ) = I _ { \theta _ { n c } } ( y ; z _ { n } )$ . Hence, the nuisance classifier needs to model the conditional density perfectly.
355
+
356
+ Estimating this bound via Monte Carlo simulation requires sampling from the conditional density $p ( y | z _ { n } )$ . Following (Alemi et al., 2017), we have the Markov property $y x z _ { n }$ as labels $y$ interact with inputs $x$ and representation $z _ { n }$ interacts with inputs $x$ . Hence,
357
+
358
+ $$
359
+ \begin{array} { r l } { { p ( y | z _ { n } ) p ( z _ { n } ) = p ( y , z _ { n } ) } } \\ & { = \int _ { \mathcal X } p ( x , y , z _ { n } ) d x } \\ & { = \int _ { \mathcal X } p ( z _ { n } | x , y ) p ( y | x ) p ( x ) d x } \\ & { = \displaystyle \int _ { \mathcal X } p ( z _ { n } | x ) p ( y | x ) p ( x ) d x } \\ & { = \mathbb E _ { \alpha } [ p ( z _ { n } | x ) p ( y | x ) ] . } \end{array}
360
+ $$
361
+
362
+ Including above and assuming $F _ { \theta } ( x ) = z _ { n }$ to be a deterministic function, we have
363
+
364
+ $$
365
+ \begin{array} { r } { \mathbb { E } _ { z _ { n } } \mathbb { E } _ { y | z _ { n } } \log D _ { \theta _ { n c } } ( z _ { n } ) = \mathbb { E } _ { x } \mathbb { E } _ { y | x } \mathbb { E } _ { z _ { n } | x } \log D _ { \theta _ { n c } } ( z _ { n } ) = \mathbb { E } _ { x } \mathbb { E } _ { y | x } \log D _ { \theta _ { n c } } ( z _ { n } ) . } \end{array}
366
+ $$
367
+
368
+ Lemma 11 (Effect of MLE-term). Define semantics as $z _ { s } = F _ { \theta } ( x ) _ { 1 , . . . , C }$ and nuisances as $z _ { n } =$ $F _ { \theta } ( x ) _ { C + 1 , . . . , d }$ , where $( x , y ) \sim \mathcal { D }$ . Then, the MLE-term in equation $6$ together with cross-entropy on the semantics
369
+
370
+ $$
371
+ \theta ^ { * } = \arg \operatorname* { m i n } _ { \theta } \mathcal { L } _ { s C E } ( \theta ) + \mathcal { L } _ { M L E _ { n } } ( \theta )
372
+ $$
373
+
374
+ minimizes the mutual information $I ( z _ { s } ; z _ { n } )$
375
+
376
+ Proof. Let $\tilde { z } _ { s } = s o f t m a x ( z _ { s } )$ . Then minimizing the loss terms $\mathcal { L } _ { s C E }$ and $ { \mathcal { L } } _ { M L E _ { n } }$ is a maximum likelihood estimation under the factorial prior
377
+
378
+ $$
379
+ \begin{array} { c } { { p ( \tilde { z } _ { s } , z _ { n } ) = p ( \tilde { z } _ { s } ) p ( z _ { n } ) } } \\ { { \ } } \\ { { = C a t ( ( \tilde { z } _ { s } ) _ { 1 } , \ldots , ( \tilde { z } _ { s } ) _ { C } ) \displaystyle \prod _ { k = 1 } ^ { d - C } p _ { k } ( z _ { n } ) _ { k } , } } \end{array}
380
+ $$
381
+
382
+ where $C a t$ is a categorical distribution. As sof tmax is shift-invariant, $s o f t m a x ( x + c ) \ =$ $s o f t m a x ( x )$ , above factorial prior for $\tilde { z } _ { s }$ and $z _ { n }$ yields independence between logits $z _ { s }$ and $z _ { n }$ up to a constant $c$ . Finally note, the log term and summation in $\mathcal { L } _ { M L E _ { n } }$ and $\mathcal { L } _ { C E }$ is re-formulation for computational ease but does not change its minimizer as the logarithm is monotone. □
383
+
384
+ # C.1 PROOF OF THEOREM 6
385
+
386
+ From the assumptions follows $I _ { \mathcal { D } _ { A d v } } ( y ; z _ { n } ) = 0$ . Furthermore, we have the assumption
387
+
388
+ $$
389
+ I _ { \mathcal { D } _ { A d v } } ( y ; z _ { s } | z _ { n } ) \leq I _ { \mathcal { D } _ { A d v } } ( z _ { s } ; y ) ,
390
+ $$
391
+
392
+ excluding synergetic effects in the interaction information (Ghassami & Kiyavash, 2017). By information preservation under homeomorphisms (Kraskov et al., 2004) and the chain rule of mutual information (Cover & Thomas, 2006), we have
393
+
394
+ $$
395
+ \begin{array} { r l } & { I _ { \mathcal { D } _ { A d v } } ( y ; x ) = I _ { \mathcal { D } _ { A d v } } ( y ; z _ { s } , z _ { n } ) } \\ & { \qquad = I _ { \mathcal { D } _ { A d v } } ( y ; z _ { n } ) + I _ { \mathcal { D } _ { A d v } } ( y ; z _ { s } | z _ { n } ) } \\ & { \qquad \leq I _ { \mathcal { D } _ { A d v } } ( y ; z _ { s } ) . } \end{array}
396
+ $$
397
+
398
+ As $z _ { s } = F ( x ) _ { 1 , . . . , C }$ is obtained by the deterministic transform $F$ , by the data processing inequality (Cover & Thomas, 2006) we have the inequality $I _ { \mathcal { D } _ { A d v } } ( y ; x ) \ge I _ { \mathcal { D } _ { A d v } } ( y ; z _ { s } )$ . Thus, the claimed equality must hold.
399
+
400
+ # C.2 MUTUAL INFORMATION BOUNDED
401
+
402
+ Remark 12. Since our goal is to maximize the mutual information $I ( y ; z _ { s } )$ while minimizing $I ( y ; z _ { n } )$ , we need to ensure that this objective is well defined as mutual information can be unbounded from above for continuous random variables. However, due to the data processing inequality (Cover & Thomas, 2006) we have $I ( y ; z _ { n } ) = I ( y ; F _ { \theta } ( x ) ) \le I ( y ; x )$ . Hence, we have a fixed upper bound given by our data $( x , y )$ . Compared to (Belghazi et al., 2018) there is thus no need for gradient clipping or a switch to the bounded Jensen-Shannon divergence as in (Hjelm et al., 2019) is not necessary.
403
+
404
+ # D TRAINING AND ARCHITECTURAL DETAILS
405
+
406
+ All experiments were based on a fully invertible RevNet model with different hyperparameters for each dataset. For the spheres experiment we used Pytorch (Paszke et al., 2017) and for MNIST, as well as Imagenet Tensorflow (Abadi et al., 2016).
407
+
408
+ # D.1 SPHERES EXPERIMENTS
409
+
410
+ The network is a fully connected fully invertible RevNet. It has 4 RevNet-type ReLU bottleneck blocks with additive couplings and uses no batchnorm. We train it via cross-entropy and use the Adam optimizer (Kingma & Ba, 2014) with a learning rate of 0.0001 and otherwise default Pytorch settings. The nuisance classifier is a 3 layer ReLU network with 1000 hidden units per layer.
411
+
412
+ We choose the spheres to be 100-dimensional, with $R _ { 1 } = 1$ and $R _ { 2 } = 1 0$ , train on $5 0 0 \mathrm { k }$ samples for 10 epochs and then validate on another $1 0 0 \mathrm { k }$ holdout set. We achieve $100 \%$ train and validation accuracy for logit and nuisance classifier.
413
+
414
+ # D.2 MNIST EXPERIMENTS
415
+
416
+ We use a convolutional fully invertible RevNet with additional actnorm and invertible 1x1 convolutions between each layer as introduced in Kingma & Dhariwal (2018). The network has 3 stages, after which half of the variables are factored out and an invertible downsampling, or squeezing (Dinh et al., 2017; Jacobsen et al., 2018) is applied. The network has 16 RevNet blocks with batch norm per stage and 128 filters per layer. We also dequantize the inputs as is typically done in flow-based generative models.
417
+
418
+ The network is trained via Adamax (Kingma & Ba, 2014) with a base learning rate of 0.001 for 100 epochs and we multiply the it with a factor of 0.2 every 30 epochs and use a batch size of 64 and l2 weight decay of 1e-4. For training we compare vanilla cross-entropy training with our proposed independence cross-entropy loss. To have a more balanced loss signal, we normalize $\mathcal { L } _ { n C E }$ by the number of input dimensions it receives for the maximization step. The nuisance classifier is a fullyconnected 3 layer ReLU network with 512 units. As data-augmentation we use random shifts of 3 pixels. For classification errors of the different architectures we compare, see Table 2.
419
+
420
+ # D.3 IMAGENET EXPERIMENTS
421
+
422
+ We use a convolutional fully invertible RevNet with 4 stages, 4 RevNet blocks per stage and invertible downsampling after each stage, as well as two invertible downsamplings on the input of the network. The first three stages consist of additive and the last of affine coupling layers. After the final layer we apply an orthogonal 2D DCT type-II to all feature maps and read out the classes in the low-pass components of the transformation. This effectively gives us an invertible global average pooling and makes our network even more similar to ResNets, that always apply global average pooling on their final feature maps. We train the network with momentum SGD for 128 epochs, a batch size of 480 (distributed to 6 GPUs), a base learning rate of 0.1, which is reduced by a factor of 0.1 every 32 epochs. We apply momentum of 0.9 and l2 weight decay of 1e-4.
423
+
424
+ Table 2: Results comparing cross-entropy training (CE) with independence cross-entropy training (iCE) from Definition 5 and two architectures from the literature. The accuracy of the logit classifiers is on par for the CE and iCE networks, but the train error is higher for CE compared to test error, indicating less overfitting for iCE. Further, a classifier independently trained on the nuisance variables is able to reach even smaller error than on the logits for CE, but just $2 7 . 7 0 \%$ error for iCE, indicating that we have successfully removed most of the information of the label from the nuisance variables and fixed the problem of excessive invariance to semantically meaningful variability with no cost in test error.
425
+
426
+ <table><tr><td>MNIST</td><td>SOTA</td><td>LeNet</td><td>CE</td><td>iCE (ours)</td><td>CE</td><td>iCE (ours)</td></tr><tr><td>Readout</td><td>Logit</td><td>Logit</td><td>Logit</td><td>Logit</td><td>Nuisance</td><td>Nuisance</td></tr><tr><td>% Test Error</td><td>0.21</td><td>1.70</td><td>0.39</td><td>0.38</td><td>0.34</td><td>27.70</td></tr><tr><td>% Train Error</td><td>1</td><td>1</td><td>0.00</td><td>0.37</td><td>0.00</td><td>40.21</td></tr></table>
md/train/Bkg0u3Etwr/Bkg0u3Etwr.md ADDED
@@ -0,0 +1,561 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # MAXMIN Q-LEARNING: CONTROLLING THE ESTIMATION BIAS OF Q-LEARNING
2
+
3
+ Qingfeng Lan, Yangchen Pan, Alona Fyshe, Martha White
4
+
5
+ Department of Computing Science
6
+ University of Alberta
7
+ Edmonton, Alberta, Canada
8
+ {qlan3,pan6,alona,whitem}@ualberta.ca
9
+
10
+ # ABSTRACT
11
+
12
+ Q-learning suffers from overestimation bias, because it approximates the maximum action value using the maximum estimated action value. Algorithms have been proposed to reduce overestimation bias, but we lack an understanding of how bias interacts with performance, and the extent to which existing algorithms mitigate bias. In this paper, we 1) highlight that the effect of overestimation bias on learning efficiency is environment-dependent; 2) propose a generalization of Q-learning, called Maxmin $Q$ -learning, which provides a parameter to flexibly control bias; 3) show theoretically that there exists a parameter choice for Maxmin Q-learning that leads to unbiased estimation with a lower approximation variance than Q-learning; and 4) prove the convergence of our algorithm in the tabular case, as well as convergence of several previous Q-learning variants, using a novel Generalized Q-learning framework. We empirically verify that our algorithm better controls estimation bias in toy environments, and that it achieves superior performance on several benchmark problems. 1
13
+
14
+ # 1 INTRODUCTION
15
+
16
+ Q-learning (Watkins, 1989) is one of the most popular reinforcement learning algorithms. One of the reasons for this widespread adoption is the simplicity of the update. On each step, the agent updates its action value estimates towards the observed reward and the estimated value of the maximal action in the next state. This target represents the highest value the agent thinks it could obtain from the current state and action, given the observed reward.
17
+
18
+ Unfortunately, this simple update rule has been shown to suffer from overestimation bias (Thrun & Schwartz, 1993; van Hasselt, 2010). The agent updates with the maximum over action values might be large because an action’s value actually is high, or it can be misleadingly high simply because of the stochasticity or errors in the estimator. With many actions, there is a higher probability that one of the estimates is large simply due to stochasticity and the agent will overestimate the value. This issue is particularly problematic under function approximation, and can significant impede the quality of the learned policy (Thrun & Schwartz, 1993; Szita & Lorincz, 2008; Strehl et al., 2009) ˝ or even lead to failures of Q-learning (Thrun & Schwartz, 1993). More recently, experiments across several domains suggest that this overestimation problem is common (Hado van Hasselt et al., 2016).
19
+
20
+ Double Q-learning (van Hasselt, 2010) is introduced to instead ensure underestimation bias. The idea is to maintain two unbiased independent estimators of the action values. The expected action value of estimator one is selected for the maximal action from estimator two, which is guaranteed not to overestimate the true maximum action value. Double DQN (Hado van Hasselt et al., 2016), the extension of this idea to Q-learning with neural networks, has been shown to significantly improve performance over Q-learning. However, this is not a complete answer to this problem, because trading overestimation bias for underestimation bias is not always desirable, as we show in our experiments.
21
+
22
+ Several other methods have been introduced to reduce overestimation bias, without fully moving towards underestimation. Weighted Double Q-learning (Zhang et al., 2017) uses a weighted combination of the Double Q-learning estimate, which likely has underestimation bias, and the Q-learning estimate, which likely has overestimation bias. Bias-corrected Q-Learning (Lee et al., 2013) reduces the overestimation bias through a bias correction term. Ensemble Q-learning and Averaged Q-learning (Anschel et al., 2017) take averages of multiple action values, to both reduce the overestimation bias and the estimation variance. However, with a finite number of actionvalue functions, the average operation in these two algorithms will never completely remove the overestimation bias, as the average of several overestimation biases is always positive. Further, these strategies do not guide how strongly we should correct for overestimation bias, nor how to determine—or control—the level of bias.
23
+
24
+ The overestimation bias also appears in the actor-critic setting (Fujimoto et al., 2018; Haarnoja et al., 2018). For example, Fujimoto et al. (2018) propose the Twin Delayed Deep Deterministic policy gradient algorithm (TD3) which reduces the overestimation bias by taking the minimum value between two critics. However, they do not provide a rigorous theoretical analysis for the effect of applying the minimum operator. There is also no theoretical guide for choosing the number of estimators such that the overestimation bias can be reduced to 0.
25
+
26
+ In this paper, we study the effects of overestimation and underestimation bias on learning performance, and use them to motivate a generalization of Q-learning called Maxmin Q-learning. Maxmin Q-learning directly mitigates the overestimation bias by using a minimization over multiple action-value estimates. Moreover, it is able to control the estimation bias varying from positive to negative which helps improve learning efficiency as we will show in next sections. We prove that, theoretically, with an appropriate number of action-value estimators, we are able to acquire an unbiased estimator with a lower approximation variance than Q-learning. We empirically verify our claims on several benchmarks. We study the convergence properties of our algorithm within a novel Generalized Q-learning framework, which is suitable for studying several of the recently proposed Q-learning variants. We also combine deep neural networks with Maxmin Q-learning (Maxmin DQN) and demonstrate its effectiveness in several benchmark domains.
27
+
28
+ # 2 PROBLEM SETTING
29
+
30
+ We formalize the problem as a Markov Decision Process (MDP), $( S , { \mathcal { A } } , \mathrm { P } , r , \gamma )$ , where $s$ is the state space, $\mathcal { A }$ is the action space, $\operatorname { P } : S \times A \times S [ 0 , 1 ]$ is the transition probabilities, $r : S \times \mathcal { A } \times \mathcal { S } \mathbb { R }$ is the reward mapping, and $\gamma \in [ 0 , 1 ]$ is the discount factor. At each time step $t$ , the agent observes a state $S _ { t } \in { S }$ and takes an action $A _ { t } \in { \mathcal { A } }$ and then transitions to a new state $S _ { t + 1 } \in S$ according to the transition probabilities $\mathrm { P }$ and receives a scalar reward $R _ { t + 1 } = r ( S _ { t } , A _ { t } , S _ { t + 1 } ) \in \mathbb { R }$ . The goal of the agent is to find a policy $\pi : S \times A \to [ 0 , 1 ]$ that maximizes the expected return starting from some initial state.
31
+
32
+ Q-learning is an off-policy algorithm which attempts to learn the state-action values $Q : { \mathcal { S } } \times { \mathcal { A } } \mathbb { R }$ for the optimal policy. It tries to solve for
33
+
34
+ $$
35
+ Q ^ { * } ( s , a ) = \mathbb { E } \Big [ R _ { t + 1 } + \operatorname* { m a x } _ { a ^ { \prime } \in \mathcal { A } } Q ^ { * } ( S _ { t + 1 } , a ^ { \prime } ) ~ \Big | ~ S _ { t } = s , A _ { t } = a \Big ]
36
+ $$
37
+
38
+ The optimal policy is to act greedily with respect to these action values: from each $s$ select $a$ from arg $\operatorname* { m a x } _ { a \in \mathcal { A } } Q ^ { * } ( s , a )$ . The update rule for an approximation $Q$ for a sampled transition $s _ { t } , a _ { t } , r _ { t + 1 } , s _ { t + 1 }$ is:
39
+
40
+ $$
41
+ Q ( s _ { t } , a _ { t } ) \gets Q ( s _ { t } , a _ { t } ) + \alpha ( Y _ { t } ^ { Q } - Q ( s _ { t } , a _ { t } ) ) \qquad \mathrm { f o r } Y _ { t } ^ { Q } \stackrel { \mathrm { d e f } } { = } r _ { t + 1 } + \gamma \operatorname* { m a x } _ { a ^ { \prime } \in A } Q ( s _ { t + 1 } , a ^ { \prime } )
42
+ $$
43
+
44
+ where $\alpha$ is the step-size. The transition can be generated off-policy, from any behaviour that sufficiently covers the state space. This algorithm is known to converge in the tabular setting (Tsitsiklis, 1994), with some limited results for the function approximation setting (Melo & Ribeiro, 2007).
45
+
46
+ # 3 UNDERSTANDING WHEN OVERESTIMATION BIAS HELPS AND HURTS
47
+
48
+ In this section, we briefly discuss the estimation bias issue, and empirically show that both overestimation and underestimation bias may improve learning performance, depending on the environment. This motivates our Maxmin Q-learning algorithm described in the next section, which allows us to flexibly control the estimation bias and reduce the estimation variance.
49
+
50
+ The overestimation bias occurs since the target $\operatorname* { m a x } _ { a ^ { \prime } \in A } Q ( s _ { t + 1 } , a ^ { \prime } )$ is used in the Q-learning update. Because $Q$ is an approximation, it is probable that the approximation is higher than the true value for one or more of the actions. The maximum over these estimators, then, is likely to be skewed towards an overestimate. For example, even unbiased estimates $Q ( s _ { t + 1 } , a ^ { \prime } )$ for all $a ^ { \prime }$ , will vary due to stochasticity. $Q ( s _ { t + 1 } , a ^ { \prime } ) = Q ^ { * } \bar { ( } s _ { t + 1 } , a ^ { \prime } ) + e _ { a ^ { \prime } }$ , and for some actions, $e _ { a ^ { \prime } }$ will be positive. As a result, $\begin{array} { r } { \mathbb { E } [ \operatorname* { m a x } _ { a ^ { \prime } \in \mathcal { A } } Q ( s _ { t + 1 } , a ^ { \prime } ) ] \geq \operatorname* { m a x } _ { a ^ { \prime } \in \mathcal { A } } \mathbb { E } [ Q ( s _ { t + 1 } , a ^ { \prime } ) ] = \operatorname* { m a x } _ { a ^ { \prime } \in \mathcal { A } } Q ^ { * } ( s _ { t + 1 } , a ^ { \prime } ) } \end{array}$ .
51
+
52
+ This overestimation bias, however, may not always be detrimental. And, further, in some cases, erring towards an underestimation bias can be harmful. Overestimation bias can help encourage exploration for overestimated actions, whereas underestimation bias might discourage exploration. In particular, we expect more overestimation bias in highly stochastic areas of the world; if those highly stochastic areas correspond to high-value regions, then encouraging exploration there might be beneficial. An underestimation bias might actually prevent an agent from learning that a region is high-value. Alternatively, if highly stochastic areas also have low values, overestimation bias might cause an agent to over-explore a low-value region.
53
+
54
+ We show this effect in the simple MDP, shown in Figure 1. The MDP for state $A$ has only two actions: Left and Right. It has a deterministic neutral reward for both the Left action and the Right action. The Left action transitions to state $B$ where there are eight actions transitions to a terminate state with a highly stochastic reward. The mean of this stochastic reward is $\mu$ . By selecting $\mu > 0$ , the stochastic region becomes high-value, and we expect overestimation bias to help and underestimation bias to hurt. By selecting $\mu < 0$ , the stochastic region becomes low-value, and we expect overestimation bias to hurt and underestimation bias to help.
55
+
56
+ ![](images/ca4c487340afccb669552325986a17e66bdc7c3ff00d230e28a3efcf5d8bb92c.jpg)
57
+ Figure 1: A simple episodic MDP, adapted from Figure 6.5 in Sutton & Barto (2018) which is used to highlight the difference between Double Q-learning and $\mathbf { Q }$ -learning. This MDP has two nonterminal states $A$ and $B$ . Every episode starts from $A$ which has two actions: Left and Right. The Right action transitions to a terminal state with reward 0. The Left action transitions to state $B$ with reward 0. From state $B$ , there are 8 actions that all transition to a terminal state with a reward $\mu + \xi$ , where $\xi$ is drawn from a uniform distribution $U ( - 1 , 1 )$ . When $\mu > 0$ , the optimal action in state $A$ is Left; when $\mu < 0$ , it is Right.
58
+
59
+ We test Q-learning, Double Q-learning and our new algorithm Maxmin Q-learning in this environment. Maxmin Q-learning (described fully in the next section) uses $N$ estimates of the action values in the targets. For $N = 1$ , it corresponds to Q-learning; otherwise, it progresses from overestimation bias at $N = 1$ towards underestimation bias with increasing $N$ . In the experiment, we used a discount factor $\gamma = 1$ ; a replay buffer with size 100; an $\epsilon$ -greedy behaviour with $\epsilon = 0 . 1$ ; tabular action-values, initialized with a Gaussian distribution $\mathcal { N } ( 0 , 0 . \mathrm { \bar { 0 } 1 } )$ ; and a step-size of 0.01 for all algorithms.
60
+
61
+ The results in Figure 2 verify our hypotheses for when overestimation and underestimation bias help and hurt. Double Q-learning underestimates too much for $\mu = + 1$ , and converges to a suboptimal policy. Q-learning learns the optimal policy the fastest, though for all values of $N = 2 , 4 , 6 , 8$ , Maxmin Q-learning does progress towards the optimal policy. All methods get to the optimal policy for $\mu = - 1$ , but now Double Q-learning reaches the optimal policy the fastest, and followed by Maxmin Q-learning with larger $N$ .
62
+
63
+ # 4 MAXMIN Q-LEARNING
64
+
65
+ In this section, we develop Maxmin Q-learning, a simple generalization of Q-learning designed to control the estimation bias, as well as reduce the estimation variance of action values. The idea is to maintain $N$ estimates of the action values, $Q ^ { i }$ , and use the minimum of these estimates in the Q-learning target: $\begin{array} { r } { \operatorname* { m a x } _ { a ^ { \prime } } \operatorname* { m i n } _ { i \in \{ 1 , . . . , N \} } Q ^ { i } ( s ^ { \prime } , a ^ { \prime } ) } \end{array}$ . For $N = 1$ , the update is simply Q-learning, and so likely has overestimation bias. As $N$ increase, the overestimation decreases; for some $N > 1$ , this maxmin estimator switches from an overestimate, in expectation, to an underestimate. We characterize the relationship between $N$ and the expected estimation bias below in Theorem 1. Note that Maxmin Q-learning uses a different mechanism to reduce overestimation bias than Double Qlearning; Maxmin Q-learning with $N = 2$ is not Double Q-learning.
66
+
67
+ ![](images/32cd06d6bc51f0cabb929a741695098dce73549ddb5ff0a449855b2ae9b81762.jpg)
68
+ Figure 2: Comparison of three algorithms using the simple MDP in Figure 1 with different values of $\mu$ , and thus different expected rewards. For $\mu = + 0 . 1$ , shown in (a), the optimal $\epsilon$ -greedy policy is to take the Left action with $9 5 \%$ probability. For $\mu = - 0 . 1$ , shown in in (b), the optimal policy is to take the Left action with $5 \%$ probability. The reported distance is the absolute difference between the probability of taking the Left action under the learned policy compared to the optimal $\epsilon$ -greedy policy. All results were averaged over 5, 000 runs.
69
+
70
+ The full algorithm is summarized in Algorithm 1, and is a simple modification of Q-learning with experience replay. We use random subsamples of the observed data for each of the $N$ estimators, to make them nearly independent. To do this training online, we keep a replay buffer. On each step, a random estimator $i$ is chosen and updated using a mini-batch from the buffer. Multiple such updates can be performed on each step, just like in experience replay, meaning multiple estimators can be updated per step using different random mini-batches. In our experiments, to better match DQN, we simply do one update per step. Finally, it is also straightforward to incorporate target networks to get Maxmin DQN, by maintaining a target network for each estimator.
71
+
72
+ We now characterize the relation between the number of action-value functions used in Maxmin Q-learning and the estimation bias of action values. For compactness, we write $Q _ { s a } ^ { i }$ instead of $Q ^ { i } ( s , a )$ . Each $Q _ { s a } ^ { i }$ has random approximation error $e _ { s a } ^ { i }$
73
+
74
+ $$
75
+ Q _ { s a } ^ { i } = Q _ { s a } ^ { * } + e _ { s a } ^ { i } .
76
+ $$
77
+
78
+ We assume that $e _ { s a } ^ { i }$ is a uniform random variable $U ( - \tau , \tau )$ for some $\tau > 0$ . The uniform random assumption was used by Thrun $\&$ Schwartz (1993) to demonstrate bias in Q-learning, and reflects that non-negligible positive and negative $e _ { s a } ^ { i }$ are possible. Notice that for $N$ estimators with $ { n _ { s a } }$ samples, the $\tau$ will be proportional to some function of $n _ { s a } / N$ , because the data will be shared amongst the $N$ estimators. For the general theorem, we use a generic $\tau$ , and in the following corollary provide a specific form for $\tau$ in terms of $N$ and $ { n _ { s a } }$ .
79
+
80
+ Recall that $M$ is the number of actions applicable at state $s ^ { \prime }$ . Define the estimation bias $Z _ { M N }$ for transition $s , a , r , s ^ { \prime }$ to be
81
+
82
+ $$
83
+ \begin{array} { c } { { Z _ { M N } \overset { \mathrm { d e f } } { = } ( r + \gamma \underset { a ^ { \prime } } { \operatorname* { m a x } } Q _ { s ^ { \prime } a ^ { \prime } } ^ { m i n } ) - ( r + \gamma \underset { a ^ { \prime } } { \operatorname* { m a x } } Q _ { s ^ { \prime } a ^ { \prime } } ^ { * } ) } } \\ { { = \gamma ( \underset { a ^ { \prime } } { \operatorname* { m a x } } Q _ { s ^ { \prime } a ^ { \prime } } ^ { m i n } - \underset { a ^ { \prime } } { \operatorname* { m a x } } Q _ { s ^ { \prime } a ^ { \prime } } ^ { * } ) } } \end{array}
84
+ $$
85
+
86
+ # Algorithm 1: Maxmin Q-learning
87
+
88
+ <table><tr><td>Input: step-size α, exploration parameter ε &gt; O, number of action-value functions N Initialize N action-value functions {Q1,..., QN} randomly Initialize empty replay buffer D Observe initial state s</td><td></td></tr><tr><td>while Agent is interacting with the Environment do Qmin(s,a) ← mink∈{1.,.N)} Q𝑘(s,a),∀a ∈ A</td><td></td></tr><tr><td>Choose action a by E-greedy based on Qmin</td><td></td></tr><tr><td></td><td></td></tr><tr><td>Take action a,observe r,s&#x27;</td><td></td></tr><tr><td>Store transition (s,a,r,s&#x27;) in D</td><td></td></tr><tr><td>fori∈Sdo</td><td> Select a subset S from {1,...,N} (e.g.,randomly select one i to update)</td></tr><tr><td>Sample random mini-batch of transitions (s D,aD,rD,s&#x27;D) from D</td><td></td></tr><tr><td>Get update target: YMQ ← rD + γ maxa&#x27;∈A Qmin (s&#x27;D,a&#x27;)</td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td>Update action-value Qi: Qi(sD,aD) ← Qi(sD,aD) + α[YMQ - Qi(sD,aD)]</td></tr><tr><td>end</td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td>s↑s`</td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr></table>
89
+
90
+ where
91
+
92
+ $$
93
+ Q _ { s a } ^ { m i n } \ { \stackrel { \mathrm { d e f } } { = } } \ \operatorname* { m i n } _ { i \in \{ 1 , \dots , N \} } Q _ { s a } ^ { i } = Q _ { s a } ^ { * } + \operatorname* { m i n } _ { i \in \{ 1 , \dots , N \} } e _ { s a } ^ { i }
94
+ $$
95
+
96
+ We now show how the expected esti tion bias $E [ Z _ { M N } ]$ and the variance of $Q _ { s a } ^ { m i n }$ are related to the number of action-value functions $N$ in Maxmin Q-learning.
97
+
98
+ Theorem 1 Under the conditions stated above,
99
+
100
+ (i) the expected estimation bias is
101
+
102
+ $$
103
+ E [ Z _ { M N } ] = \gamma \tau [ 1 - 2 t _ { M N } ] \qquad w h e r e \ t _ { M N } = \frac { M ( M - 1 ) \cdot \cdot \cdot 1 } { ( M + \frac { 1 } { N } ) ( M - 1 + \frac { 1 } { N } ) \cdot \cdot \cdot ( 1 + \frac { 1 } { N } ) } .
104
+ $$
105
+
106
+ ${ \bf \Pi } _ { ( i i ) } ^ { E [ Z _ { M N } ] }$ decreases as $N$ increases: $\begin{array} { r } { E [ Z _ { M , N = 1 } ] = \gamma \tau _ { M + 1 } ^ { M - 1 } } \end{array}$ and $E [ Z _ { M , N \infty } ] = - \gamma \tau$
107
+
108
+ $$
109
+ V a r [ Q _ { s a } ^ { m i n } ] = \frac { 4 N \tau ^ { 2 } } { ( N + 1 ) ^ { 2 } ( N + 2 ) } .
110
+ $$
111
+
112
+ $V a r [ Q _ { s a } ^ { m i n } ]$ decreases as $N$ increases: $V a r [ Q _ { s a } ^ { m i n } ] = { \frac { \tau ^ { 2 } } { 3 } }$ for $N { = } I$ and $V a r [ Q _ { s a } ^ { m i n } ] = 0$ for $N \to \infty$
113
+
114
+ Theorem 1 is a generalization of the first lemma in Thrun $\&$ Schwartz (1993); we provide the proof in Appendix A as well as a visualization of the expected bias for varying $M$ and $N$ . This theorem shows that the average estimation bias $E [ Z _ { M N } ]$ , decreases as $N$ increases. Thus, we can control the bias by changing the number of estimators in Maxmin Q-learning. Specifically, the average estimation bias can be reduced from positive to negative as $N$ increases. Notice that $E [ Z _ { M N } ] = 0$ when $\begin{array} { r } { t _ { M N } = \frac { 1 } { 2 } } \end{array}$ . This suggests that by choosing $N$ such that $\begin{array} { r } { t _ { M N } \approx \frac { 1 } { 2 } } \end{array}$ , we can reduce the bias to near 0.
115
+
116
+ Furthermore, $V a r [ Q _ { s a } ^ { m i n } ]$ decreases as $N$ increases. This indicates that we can control the estimation variance of target action value through $N$ . We show just this in the following Corollary. The subtlety is that with increasing $N$ , each estimator will receive less data. The fair comparison is to compare the variance of a single estimator that uses all of the data, as compared to the maxmin estimator which shares the samples across $N$ estimators. We show that there is an $N$ such that the variance is lower, which arises largely due to the fact that the variance of each estimator decreases linearly in $n$ , but the $\tau$ parameter for each estimator only decreases at a square root rate in the number of samples.
117
+
118
+ Corollary 1 Assuming the $ { n _ { s a } }$ samples are evenly allocated amongst the $N$ estimators, then $\tau =$ $\sqrt { 3 \sigma ^ { 2 } N / n _ { s a } }$ where $\sigma ^ { 2 }$ is the variance of samples for $( s , a )$ and, for $Q _ { s a }$ the estimator that uses all
119
+
120
+ ![](images/deb6d4bf73461c7033cf16d527e2b14def60731b6a644ed8e69774bfcb3c3082.jpg)
121
+ Figure 3: Comparison of four algorithms on Mountain Car under different reward variances. The lines in $( a )$ show the average number of steps taken in the last episode with one standard error. The lines in $( b )$ show the number of steps to reach the goal position during training when the reward variance $\sigma ^ { 2 } = 1 0 $ . All results were averaged across 100 runs, with standard errors. Additional experiments with further elevated $\sigma ^ { 2 }$ can be found in Appendix C.2.
122
+
123
+ $ { n _ { s a } }$ samples for a single estimate,
124
+
125
+ $$
126
+ V a r [ Q _ { s a } ^ { m i n } ] = \frac { 1 2 N ^ { 2 } } { ( N + 1 ) ^ { 2 } ( N + 2 ) } V a r [ Q _ { s a } ] .
127
+ $$
128
+
129
+ Under this uniform random noise assumption, for $N \geq 8 , V a r [ Q _ { s a } ^ { m i n } ] < V a r [ Q _ { s a } ] ,$ .
130
+
131
+ # 5 EXPERIMENTS
132
+
133
+ In this section, we first investigate robustness to reward variance, in a simple environment (Mountain Car) in which we can perform more exhaustive experiments. Then, we investigate performance in seven benchmark environments.
134
+
135
+ Robustness under increasing reward variance in Mountain Car Mountain Car (Sutton & Barto, 2018) is a classic testbed in Reinforcement Learning, where the agent receives a reward of $- 1$ per step with $\gamma = 1$ , until the car reaches the goal position and the episode ends. In our experiment, we modify the rewards to be stochastic with the same mean value: the reward signal is sampled from a Gaussian distribution $\mathcal { N } ( - 1 , \sigma ^ { 2 } )$ on each time step. An agent should learn to reach the goal position in as few steps as possible.
136
+
137
+ The experimental setup is as follows. We trained each algorithm with $1 , 0 0 0$ episodes. The number of steps to reach the goal position in the last training episode was used as the performance measure. The fewer steps, the better performance. All experimental results were averaged over 100 runs. The key algorithm settings included the function approximator, step-sizes, exploration parameter and replay buffer size. All algorithm used $\epsilon$ -greedy with $\epsilon = 0 . 1$ and a buffer size of 100. For each algorithm, the best step-size was chosen from $\{ 0 . 0 0 5 , 0 . 0 1 , 0 . 0 2 , 0 . 0 4 , 0 . 0 8 \}$ , separately for each reward setting. Tile-coding was used to approximate the action-value function, where we used 8 tilings with each tile covering $1 / 8 \mathrm { t h }$ of the bounded distance in each dimension. For Maxmin Q-learning, we randomly chose one action-value function to update at each step.
138
+
139
+ As shown in Figure 3, when the reward variance is small, the performance of Q-learning, Double Qlearning, Averaged Q-learning, and Maxmin Q-learning are comparable. However, as the variance increases, Q-learning, Double Q-learning, and Averaged Q-learning became much less stable than Maxmin Q-learning. In fact, when the variance was very high $( \sigma = 5 0 $ , see Appendix C.2), Qlearning and Averaged Q-learning failed to reach the goal position in $5 , 0 0 0$ steps, and Double Qlearning produced runs $> 4 0 0$ steps, even after many episodes.
140
+
141
+ Results on Benchmark Environments To evaluate Maxmin DQN, we choose seven games from Gym (Brockman et al., 2016), PyGame Learning Environment (PLE) (Tasfi, 2016), and MinAtar (Young & Tian, 2019): Lunarlander, Catcher, Pixelcopter, Asterix, Seaquest, Breakout, and Space Invaders. For games in MinAtar (i.e. Asterix, Seaquest, Breakout, and Space Invaders), we reused the hyper-parameters and settings of neural networks in (Young & Tian, 2019). And the step-size was chosen from $[ 3 * 1 0 ^ { - 3 } , 1 0 ^ { - 3 } , 3 * 1 0 ^ { - 4 } , 1 0 ^ { - 4 } , 3 * 1 0 ^ { - 5 } ]$ . For Lunarlander, Catcher, and Pixelcopter, the neural network was a multi-layer perceptron with hidden layers fixed to [64, 64]. The discount factor was 0.99. The size of the replay buffer was 10, 000. The weights of neural networks were optimized by RMSprop with gradient clip 5. The batch size was 32. The target network was updated every 200 frames. $\epsilon$ -greedy was applied as the exploration strategy with $\epsilon$ decreasing linearly from 1.0 to 0.01 in $1 , 0 0 0$ steps. After 1, 000 steps, $\epsilon$ was fixed to 0.01. For Lunarlander, the best step-size was chosen from $[ 3 * 1 0 ^ { - 3 } , 1 0 ^ { - 3 } , 3 * 1 0 ^ { - 4 } , 1 0 ^ { - 4 } , 3 * 1 0 ^ { - 5 } ] .$ . For Catcher and Pixelcopter, the best step-size was chosen from $[ 1 0 ^ { - 3 } , 3 * 1 0 ^ { - 4 } , 1 0 ^ { - 4 } , 3 * 1 0 ^ { - 5 } , \bar { 1 } 0 ^ { - 5 } ]$ .
142
+
143
+ For both Maxmin DQN and Averaged DQN, the number of target networks $N$ was chosen from $[ 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 ]$ . And we randomly chose one action-value function to update at each step. We first trained each algorithm in a game for certain number of steps. After that, each algorithm was tested by running 100 test episodes with $\epsilon$ -greedy where $\epsilon = 0 . 0 1$ . Results were averaged over 20 runs for each algorithm, with learning curves shown for the best hyper-parameter setting (see Appendix C.3 for the parameter sensitivity curves).
144
+
145
+ We see from Figure 4 that Maxmin DQN performs as well as or better than other algorithms. In environments where final performance is noticeably better—-Pixelcopter, Lunarlander and Asterix—the initial learning is slower. A possible explanation for this is that the Maxmin agent more extensively explored early on, promoting better final performance. We additionally show on Pixelcopter and Asterix that for smaller $N$ , Maxmin DQN learns faster but reaches suboptimal performance—behaving more like Q-learning—and for larger $N$ learns more slowly but reaches better final performance.
146
+
147
+ # 6 CONVERGENCE ANALYSIS OF MAXMIN Q-LEARNING
148
+
149
+ In this section, we show Maxmin Q-learning is convergent in the tabular setting. We do so by providing a more general result for what we call Generalized Q-learning: Q-learning where the bootstrap target uses a function $G$ of $N$ action values. The main condition on $G$ is that it maintains relative maximum values, as stated in Assumption 1. We use this more general result to prove Maxmin Q-learning is convergent, and then discuss how it provides convergence results for $\mathrm { Q }$ - learning, Ensemble Q-learning, Averaged Q-learning and Historical Best Q-learning as special cases.
150
+
151
+ Many variants of Q-learning have been proposed, including Double Q-learning (van Hasselt, 2010), Weighted Double Q-learning (Zhang et al., 2017), Ensemble Q-learning (Anschel et al., 2017), Averaged Q-learning (Anschel et al., 2017), and Historical Best Q-learning (Yu et al., 2018). These algorithms differ in their estimate of the one-step bootstrap target. To encompass all variants, the target action-value of Generalized Q-learning $Y ^ { \hat { G } Q }$ is defined based on action-value estimates from both dimensions:
152
+
153
+ $$
154
+ Y ^ { G Q } = r + \gamma Q _ { s ^ { \prime } } ^ { G Q } ( t - 1 )
155
+ $$
156
+
157
+ where $t$ is the current time step and the action-value function $Q _ { s } ^ { G Q } ( t )$ is a function of $Q _ { s } ^ { 1 } ( t -$ $K ) , \ldots , Q _ { s } ^ { 1 } ( t - 1 ) , \ldots , Q _ { s } ^ { N } ( t - K ) , \ldots , Q _ { s } ^ { N } ( t - 1 )$ :
158
+
159
+ $$
160
+ Q _ { s } ^ { G Q } ( t ) = G \left( \begin{array} { c c c c } { Q _ { s } ^ { 1 } ( t - K ) } & { \ldots } & { Q _ { s } ^ { 1 } ( t - 1 ) } \\ { Q _ { s } ^ { 2 } ( t - K ) } & { \ldots } & { Q _ { s } ^ { 2 } ( t - 1 ) } \\ { \vdots } & { \ddots } & { \vdots } \\ { Q _ { s } ^ { N } ( t - K ) } & { \ldots } & { Q _ { s } ^ { N } ( t - 1 ) } \end{array} \right)
161
+ $$
162
+
163
+ For simplicity, the vector $( Q _ { s a } ^ { G Q } ( t ) ) _ { a \in \mathcal { A } }$ is denoted as $Q _ { s } ^ { G Q } ( t )$ , same for $Q _ { s } ^ { i } ( t )$ . The corresponding update rule is
164
+
165
+ $$
166
+ Q _ { s a } ^ { i } ( t ) \gets Q _ { s a } ^ { i } ( t - 1 ) + \alpha _ { s a } ^ { i } ( t - 1 ) ( Y ^ { G Q } - Q _ { s a } ^ { i } ( t - 1 ) )
167
+ $$
168
+
169
+ For different $G$ functions, Generalized Q-learning reduces to different variants of $\mathrm { Q }$ -learning, including Q-learning itself. For example, Generalized Q-learning can be reduced to Q-learning
170
+
171
+ ![](images/71f37d1688317c1f97afbd2a43669e4ad56ddd90c8a6e94bee8fd1c97333bc3c.jpg)
172
+ Figure 4: Learning curves on the seven benchmark environments. The depicted return is averaged over the last 100 episodes, and the curves are smoothed using an exponential average, to match previous reported results (Young & Tian, 2019). The results were averaged over 20 runs, with the shaded area representing one standard error. Plots $( h )$ and $( i )$ show the performance of Maxmin DQN on Pixelcopter and Asterix, with different $N$ , highlighting that larger $N$ seems to result in slower early learning but better final performance in both environments.
173
+
174
+ simply by setting $K = 1$ , $N = 1$ with $G ( Q _ { s } ) = \operatorname* { m a x } _ { a \in A } Q _ { s a }$ . Double Q-learning can be specified with K = 1, N = 2, and G(Q1s, Q2s) = Q2s,arg maxa0∈A Q1 0 .
175
+
176
+ We first introduce Assumption 1 for function $G$ in Generalized Q-learning, and then state the theorem. The proof can be found in Appendix B.
177
+
178
+ Assumption 1 (Conditions on $G$ ) Let $G : \mathbb { R } ^ { n N K } \mapsto \mathbb { R }$ and $G ( Q ) = q$ where $Q \ = \ ( Q _ { a } ^ { i j } ) \ \in$ $\mathbb { R } ^ { n N K }$ , $a \in { \mathcal { A } }$ and $| { \mathcal { A } } | = n$ $= n , i \in \{ 1 , \ldots , N \} , j \in \{ 0 , \ldots , K - 1 \}$ and $q \in \mathbb { R }$ .
179
+
180
+ (i) If $Q _ { a } ^ { i j } = Q _ { a } ^ { k l } , \forall i , k , \forall j , l$ , and $\forall a$ , then $q = \operatorname* { m a x } _ { a } Q _ { a } ^ { i j }$ . $\begin{array} { r } { ( i i ) ~ \forall Q , Q ^ { \prime } \in \mathbb { R } ^ { n N K } , \mid G ( Q ) - G ( Q ^ { \prime } ) \mid \leq \operatorname* { m a x } _ { a , i , j } \mid Q _ { a } ^ { i j } - Q _ { ~ a } ^ { \prime i j } ~ \mid . } \end{array}$
181
+
182
+ We can verify that Assumption 1 holds for Maxmin Q-learning. Set $K = 1$ and set $N$ to be a positive integer. Let $Q _ { s } = \overline { { ( Q _ { s } ^ { 1 } , \ldots , Q _ { s } ^ { N } ) } }$ and define $\begin{array} { r } { G ^ { M Q } ( Q _ { s } ) ^ { \mathbf { \bar { \alpha } } } = \operatorname* { m a x } _ { a \in A } \operatorname* { m i n } _ { i \in \{ 1 , \dots , N \} } Q _ { s a } ^ { i } } \end{array}$ . It is easy to check that part (i) of Assumption 1 is satisfied. Part (ii) is also satisfied because
183
+
184
+ $$
185
+ \mid G ( Q _ { s } ) - G ( Q _ { s } ^ { \prime } ) \mid \leq \mid \operatorname * { m a x } _ { a } \operatorname * { m i n } _ { i } Q _ { s a } ^ { i } - \operatorname * { m a x } _ { a ^ { \prime } } \operatorname * { m i n } _ { i ^ { \prime } } Q _ { s a ^ { \prime } } ^ { \prime i ^ { \prime } } \mid \leq \operatorname * { m a x } _ { a , i } \mid Q _ { s a } ^ { i } - Q _ { s a } ^ { \prime i } \mid .
186
+ $$
187
+
188
+ Assumption 2 (Conditions on the step-sizes) There exists some (deterministic) constant $C$ such that for every $( s , a ) \in \mathcal { S } \times \mathcal { A } , i \in \{ 1 , . . . , N \}$ , $0 \leq \alpha _ { s a } ^ { i } ( t ) \leq 1$ , and with probability 1,
189
+
190
+ $$
191
+ \sum _ { t = 0 } ^ { \infty } ( \alpha _ { s a } ^ { i } ( t ) ) ^ { 2 } \leq C , \quad \sum _ { t = 0 } ^ { \infty } \alpha _ { s a } ^ { i } ( t ) = \infty
192
+ $$
193
+
194
+ Theorem 2 Assume a finite MDP $( { \boldsymbol { S } } , { \mathcal { A } } , { \boldsymbol { \mathrm { P } } } , { \boldsymbol { R } } )$ and that Assumption $I$ and 2 hold. Then the actionvalue functions in Generalized $Q$ -learning, using the tabular update in Equation (3), will converge to the optimal action-value function with probability 1, in either of the following cases: $( i ) \gamma < 1$ , or $( i i ) \gamma = 1$ , $\forall a \in \mathcal { A } , Q _ { s _ { 1 } a } ^ { i } \big ( t = 0 \big ) = 0$ where $s _ { 1 }$ is an absorbing state and all policies are proper.
195
+
196
+ As shown above, because the function $G$ for Maxmin Q-learning satisfies Assumption 1, then by Theorem 2 it converges. Next, we apply Theorem 2 to Q-learning and its variants, proving the convergence of these algorithms in the tabular case. For Q-learning, set $K = 1$ and $N = 1$ . Let $G ^ { Q } ( Q _ { s } ^ { - } ) = \operatorname* { m a x } _ { a \in A } Q _ { s a } ^ { - }$ . It is straightforward to check that Assumption 1 holds for function $G ^ { Q }$ . For Ensemble Q-learning, set $K = 1$ and set $N$ to be a positive integer. Let $G ^ { E Q } ( ( Q _ { s } ^ { 1 } , \dots , Q _ { s } ^ { N } ) ) =$ $\begin{array} { r } { \operatorname* { m a x } _ { a \in A } \frac { 1 } { N } \sum _ { i = 1 } ^ { N } Q _ { s a } ^ { i } } \end{array}$ . Easy to check that Assumption 1 is satisfied. For Averaged Q-learning, the proof is similar to Ensemble Q-learning except that $N = 1$ and $K$ is a positive integer. For Historical Best Q-learning, set $N = 1$ and $K$ to be a positive integer. We assume that all auxiliary action-value functions are selected from action-value functions at most $K$ updates ago. Define $G ^ { \tilde { H } B Q }$ to be the largest action-value among $Q _ { s a } ( t - 1 ) , \ldots , Q _ { s a } ( t - K )$ for state $s$ . Assumption 1 is satisfied and the convergence is guaranteed.
197
+
198
+ # 7 CONCLUSION
199
+
200
+ Overestimation bias is a byproduct of Q-learning, stemming from the selection of a maximal value to estimate the expected maximal value. In practice, overestimation bias leads to poor performance in a variety of settings. Though multiple Q-learning variants have been proposed, Maxmin Qlearning is the first solution that allows for a flexible control of bias, allowing for overestimation or underestimation determined by the choice of $N$ and the environment. We showed theoretically that we can decrease the estimation bias and the estimation variance by choosing an appropriate number $N$ of action-value functions. We empirically showed that advantages of Maxmin Q-learning, both on toy problems where we investigated the effect of reward noise and on several benchmark environments. Finally, we introduced a new Generalized Q-learning framework which we used to prove the convergence of Maxmin Q-learning as well as several other Q-learning variants that use $N$ action-value estimates.
201
+
202
+ # ACKNOWLEDGMENTS
203
+
204
+ We would like to thank Huizhen Yu and Yi Wan for their valuable feedback and helpful discussion.
205
+
206
+ REFERENCES
207
+ Oron Anschel, Nir Baram, and Nahum Shimkin. Averaged-DQN: Variance Reduction and Stabilization for Deep Reinforcement Learning. In International Conference on Machine Learning, pp. 176–185, 2017.
208
+ Dimitri P Bertsekas and John N Tsitsiklis. Parallel and Distributed Computation: Numerical Methods, volume 23. Prentice hall Englewood Cliffs, NJ, 1989.
209
+ Dimitri P Bertsekas and John N Tsitsiklis. Neuro-dynamic Programming, volume 5. Athena Scientific Belmont, MA, 1996.
210
+ Greg Brockman, Vicki Cheung, Ludwig Pettersson, Jonas Schneider, John Schulman, Jie Tang, and Wojciech Zaremba. OpenAI Gym. arXiv preprint arXiv:1606.01540, 2016.
211
+ Herbert Aron David and Haikady Navada Nagaraja. Order Statistics. Encyclopedia of Statistical Sciences, 2004.
212
+ Scott Fujimoto, Herke Hoof, and David Meger. Addressing function approximation error in actorcritic methods. In International Conference on Machine Learning, pp. 1587–1596, 2018.
213
+ Tuomas Haarnoja, Aurick Zhou, Pieter Abbeel, and Sergey Levine. Soft actor-critic: Offpolicy maximum entropy deep reinforcement learning with a stochastic actor. In International Conference on Machine Learning, pp. 1861–1870, 2018.
214
+ Hado Hado van Hasselt, Arthur Guez, and David Silver. Deep Reinforcement Learning with Double Q-learning. In AAAI Conference on Artificial Intelligence, 2016.
215
+ Donghun Lee, Boris Defourny, and Warren B. Powell. Bias-corrected Q-learning to Control Maxoperator Bias in Q-learning. In IEEE Symposium on Adaptive Dynamic Programming and Reinforcement Learning, pp. 93–99, 2013.
216
+ Francisco S Melo and M Isabel Ribeiro. Q-learning with Linear Function Approximation. In International Conference on Computational Learning Theory, pp. 308–322, 2007.
217
+ Alexander L. Strehl, Lihong Li, and Michael L. Littman. Reinforcement Learning in Finite MDPs: PAC Analysis. Journal of Machine Learning Research, 10(Nov):2413–2444, 2009.
218
+ Richard S Sutton and Andrew G Barto. Reinforcement Learning: An Introduction. MIT Press, second edition, 2018.
219
+ Istvan Szita and Andr ´ as L ´ orincz. The Many Faces of Optimism: A Unifying Approach. In ˝ International Conference on Machine learning, pp. 1048–1055. ACM, 2008.
220
+ Norman Tasfi. Pygame learning environment. https://github.com/ntasfi/ PyGame-Learning-Environment, 2016.
221
+ Sebastian Thrun and Anton Schwartz. Issues in Using Function Approximation for Reinforcement Learning. In Fourth Connectionist Models Summer School, 1993.
222
+ John N Tsitsiklis. Asynchronous Stochastic Approximation and Q-learning. Machine learning, 1994.
223
+ Hado van Hasselt. Double Q-learning. In Advances in Neural Information Processing Systems, pp. 2613–2621, 2010.
224
+ Chris Watkins. Learning from Delayed Rewards. PhD thesis, King’s College, Cambridge, 1989.
225
+ Kenny Young and Tian Tian. MinAtar: An Atari-inspired Testbed for More Efficient Reinforcement Learning Experiments. arXiv preprint arXiv:1903.03176, 2019.
226
+ Wenwu Yu, Rui Wang, Ruiying Li, Jing Gao, and Xiaohui Hu. Historical Best Q-Networks for Deep Reinforcement Learning. In International Conference on Tools with Artificial Intelligence, pp. 6–11, 2018.
227
+ Zongzhang Zhang, Zhiyuan Pan, and Mykel J. Kochenderfer. Weighted Double Q-learning. In International Joint Conference on Artificial Intelligence, pp. 3455–3461, 2017.
228
+
229
+ # A THE PROOF OF THEOREM 1
230
+
231
+ We first present Lemma 1 here as a tool to prove Theorem 1. Note that the first three properties in this lemma are well-known results of order statistics (David & Nagaraja, 2004).
232
+
233
+ Lemma 1 Let $X _ { 1 } , \ldots , X _ { N }$ be $N$ i.i.d. random variables from an absolutely continuous distribution with probability density function $P D F )$ $f ( x )$ and cumulative distribution function $( C D F )$ $F ( x )$ . Denote $\mu \ { \stackrel { \mathrm { d e f } } { = } } \ E [ X _ { i } ]$ and $\sigma ^ { 2 } \ { \stackrel { \mathrm { d e f } } { = } } \ V a r [ X _ { i } ] < + \infty .$ . Set $X _ { 1 : N } \ { \stackrel { \mathrm { d e f } } { = } } \ m i n _ { i \in \{ 1 , . . . , N \} } X _ { i }$ and $X _ { N : N } \ { \stackrel { \mathrm { d e t } } { = } }$ $m a x _ { i \in \{ 1 , . . . , N \} } X _ { i }$ . Denote the PDF and $C D F$ of $X _ { 1 : N }$ as $f _ { 1 : N } ( x )$ and $F _ { 1 : N } ( x )$ , respectively. Similarly, denote the PDF and CDF of $X _ { N : N }$ as $f _ { N : N } ( x )$ and $F _ { N : N } ( x )$ , respectively. We then have
234
+
235
+ (i) (N−1)σ √2n−1 ≤ E[X1:N ] ≤ µ and E[X1:N+1] ≤ E[X1:N ].
236
+ (ii) $F _ { 1 : N } ( x ) = 1 - ( 1 - F ( x ) ) ^ { N } . \ f _ { 1 : N } ( x ) = N f ( x ) ( 1 - F ( x ) ) ^ { N - 1 } .$
237
+ (iii) $F _ { N : N } ( x ) = ( F ( x ) ) ^ { N }$ . $f _ { N : N } ( x ) = N f ( x ) ( F ( x ) ) ^ { N - 1 } .$
238
+ (iv) If X1, . . . , XN ∼ U (−τ, τ ), we have V ar(X1:N ) = 4N τ2(N+1)2(N+2) and $V a r ( X _ { 1 : N + 1 } ) <$ $V a r ( X _ { 1 : N } ) \le V a r ( X _ { 1 : 1 } ) = \sigma ^ { 2 }$ for any positive integer $N$ .
239
+
240
+ # Proof.
241
+
242
+ (i) By the definition of $X _ { 1 : N }$ , we have $X _ { 1 : N + 1 } \le X _ { 1 : N }$ . Thus $E [ X _ { 1 : N + 1 } ] \leq E [ X _ { 1 : N } ]$ . Since $E [ X _ { 1 : 1 } ] = E [ X _ { 1 } ] = \mu$ , $E [ X _ { 1 : N } ] \leq E [ X _ { 1 : 1 } ] = \mu$ . The proof of $\begin{array} { r } { \mu - \frac { ( N - 1 ) \sigma } { \sqrt { 2 N - 1 } } \leq E [ X _ { 1 : N } ] } \end{array}$ can be found in (David & Nagaraja, 2004, Chapter 4 Section 4.2).
243
+
244
+ (ii) We first consider the cdf of $X _ { 1 : N }$ . $F _ { 1 : N } ( x ) : = P ( X _ { 1 : N } \leq x ) = 1 - P ( X _ { 1 : N } > x ) =$ $1 - P ( X _ { 1 } > x , \ldots , X _ { M } > x ) = 1 - P ( X _ { 1 } > x ) \cdots P ( X _ { N } > x ) =$ 1 − (1 − F (x))N . Then the pdf of $X _ { 1 : N }$ is $\begin{array} { r } { f _ { 1 : N } ( x ) : = \frac { d F _ { 1 : N } } { d x } = N f ( x ) ( 1 - F ( x ) ) ^ { N - 1 } } \end{array}$ .
245
+
246
+ (iii) Similar to (ii), we first consider cdf of $X _ { N : N }$ . $F _ { N : N } ( x ) : = P ( X _ { N : N } \leq x ) = P ( X _ { 1 } \leq$ $x , \ldots , X _ { N } \leq x ) = P ( X _ { 1 } \leq x ) \cdot \cdot \cdot P ( X _ { M } \leq x ) = ( { \dot { F } } ( x ) ) ^ { N }$ . Then the pdf of $X _ { N : N }$ is $\begin{array} { r } { f _ { N : N } ( x ) : = \frac { d F _ { N : N } } { d x } = N f ( x ) ( F ( x ) ) ^ { N - 1 } } \end{array}$ .
247
+
248
+ (iv) Since $X _ { 1 , . . . , X _ { N } } \sim U n i f o r m ( - \tau , \tau )$ , we have $\begin{array} { r } { F ( x ) \ = \ \frac { 1 } { 2 } + \ \frac { x } { 2 \tau } } \end{array}$ and $\begin{array} { r } { f ( x ) \ = \ \frac { 1 } { 2 \tau } } \end{array}$ V ar(X1:N ) = E[X1:N 2] − E[X1:N ]2 = 4τ 2( 2(N+1)(N+2) − 1(N+1)2 ) = 4nτ2(N+1)2(N+2) . It is easy to check that $V a r ( X _ { 1 : N + 1 } ) < V a r ( X _ { 1 : N } ) \leq V a r ( X _ { 1 : 1 } ) = \sigma ^ { 2 } \mathrm { ~ f ~ }$ or any positive integer $N$ .
249
+
250
+ Next, we prove Theorem 1.
251
+
252
+ Proof. Let $f ( x )$ and $F ( x )$ be the cdf and pdf of $e _ { s a }$ , respectively. Similarly, Let $f _ { N } ( x )$ and $F _ { N } ( x )$ be the cdf and pdf of $\mathrm { { m i n } } _ { i \in \{ 1 , . . . , N \} } e _ { s a } ^ { i }$ . Since $e _ { s a }$ is sampled from $U n i f o r m ( - \tau , \tau )$ , it is easy to get $\begin{array} { r } { f ( x ) = \frac { 1 } { 2 \tau } } \end{array}$ and $\begin{array} { r } { F ( x ) = \frac { 1 } { 2 } + \frac { x } { 2 \tau } } \end{array}$ . By Lemma 1, we have $f _ { N } ( x ) = N f ( x ) [ 1 - F ( x ) ] ^ { N - 1 } =$ $\begin{array} { r } { \frac { N } { 2 \tau } ( \frac { 1 } { 2 } - \frac { x } { 2 \tau } ) ^ { N - 1 } } \end{array}$ and $\begin{array} { r } { F _ { N } ( x ) = 1 - ( 1 - F ( x ) ) ^ { N } = 1 - ( \frac { 1 } { 2 } - \frac { x } { 2 \tau } ) ^ { N } } \end{array}$ . The expectation of $Z _ { M N }$ is
253
+
254
+ $$
255
+ \begin{array} { r l } { E [ Z _ { M N } ] = \gamma \mathbb { E } [ \operatorname* { m a x } _ { 0 } ^ { \alpha } \frac { W ^ { 2 } w ^ { 2 } } { \alpha ^ { 3 } } - \operatorname* { m a x } \mathcal { Q } _ { s e } ^ { \alpha } \mathcal { Q } _ { s e } ^ { 2 } ] \mathbb { I } } \\ { = \gamma E [ \operatorname* { m a x } _ { 0 } ^ { \alpha } \cdot \operatorname* { m i n } _ { \alpha ^ { 3 } } ^ { \alpha } ] } \\ { = \gamma \int _ { - 1 } ^ { \infty } M r f _ { N } ( x ) P r ( x ) ^ { M - 1 } d x } \\ { = \gamma \int _ { - 1 } ^ { \infty } M r f _ { N } x ^ { \alpha } \Gamma _ { 0 } ^ { 1 } \sum _ { \underline { { \tau } } ^ { \prime } } ^ { \alpha } N ^ { - 1 } \mathbb { I } [ - ( \frac { 1 } { 2 } - \frac { x } { 2 \tau } ) ^ { N } ] ^ { M - 1 } d x } \\ { = \gamma \int _ { - 1 } ^ { \infty } \alpha H [ - ( \frac { 1 } { 2 } - \frac { x } { 2 \tau } ) ^ { N } ] ^ { M } } \\ { = \gamma \tau - \gamma \int _ { - 1 } ^ { \infty } [ 1 - ( \frac { 1 } { 2 } - \frac { x } { 2 \tau } ) ^ { N } ] ^ { M } d x } \\ { = \gamma \tau [ 1 - 2 \int _ { 0 } ^ { 1 } ( 1 - \gamma ^ { N } ) ^ { M } d y ] \quad \scriptstyle ( y = \frac { 1 } { 2 } - \frac { x } { 2 \tau } ) } \end{array}
256
+ $$
257
+
258
+ Let $\begin{array} { r } { t _ { M N } = \int _ { 0 } ^ { 1 } ( 1 - y ^ { N } ) ^ { M } d y } \end{array}$ , so that $E [ Z _ { M N } ] = \gamma \tau [ 1 - 2 t _ { M N } ]$ . Substitute $y$ by $t$ where $t = y ^ { N }$ , then
259
+
260
+ $$
261
+ \begin{array} { l } { { t _ { M N } = \displaystyle \frac { 1 } { N } \int _ { 0 } ^ { 1 } t ^ { \frac { 1 } { N } - 1 } ( 1 - t ) ^ { M } d t } } \\ { { \ } } \\ { { \ } } \\ { { \displaystyle = \frac { 1 } { N } \beta ( \frac { 1 } { N } , M + 1 ) } } \\ { { \ } } \\ { { \displaystyle = \frac { 1 } { N } \frac { \Gamma ( M + 1 ) \Gamma ( \frac { 1 } { N } ) } { \Gamma ( M + \frac { 1 } { N } + 1 ) } } } \\ { { \ } } \\ { { \displaystyle = \frac { \Gamma ( M + 1 ) \Gamma ( 1 + \frac { 1 } { N } ) } { \Gamma ( M + \frac { 1 } { N } + 1 ) } } } \\ { { \ } } \\ { { \displaystyle = \frac { M ( M - 1 ) \cdot \cdot \cdot 1 } { ( M + \frac { 1 } { N } ) ( M - 1 + \frac { 1 } { N } ) \cdot \cdot \cdot ( 1 + \frac { 1 } { N } ) } } } \end{array}
262
+ $$
263
+
264
+ Each term in the denominator decreases as $N$ increases, because $1 / N$ gets smaller. Therefore, tM,N=1 = 1M+1 and $t _ { M , N \to \infty } = 1$ . Using this, we conclude that $E [ Z _ { M N } ]$ decreases as $N$ increases and $\begin{array} { r } { E [ Z _ { M , N = 1 } ] = \gamma \tau _ { M + 1 } ^ { M - 1 } } \end{array}$ and $E [ Z _ { M , N \infty } ] = - \gamma \tau$ .
265
+
266
+ $Q _ { s a } ^ { m i n }$
267
+
268
+ $$
269
+ V a r [ Q _ { s a } ^ { m i n } ] = \frac { 4 N \tau ^ { 2 } } { ( N + 1 ) ^ { 2 } ( N + 2 ) }
270
+ $$
271
+
272
+ $V a r [ Q _ { s a } ^ { m i n } ]$ decreases as $N$ increases. In particular, $\begin{array} { r } { V a r [ Q _ { s a } ^ { m i n } ] = \frac { \tau ^ { 2 } } { 3 } } \end{array}$ for $N = 1$ and $V a r [ Q _ { s a } ^ { m i n } ] =$ 0 for $N \to \infty$ .
273
+
274
+ The bias-variance trade-off of Maxmin Q-learning is illustrated by the empirical results in Figure 5, which support Theorem 1. For each $M$ , $N$ can be selected such that the absolute value of the expected estimation bias is close to 0 according to Theorem 1. As $M$ increases, we can adjust $N$ to reduce both the estimation variance and the estimation bias.
275
+
276
+ Finally, we prove the result of the Corollary.
277
+
278
+ Corollary 1 Assuming the $ { n _ { s a } }$ samples are evenly allocated amongst the $N$ estimators, then $\tau =$ $\sqrt { 3 \sigma ^ { 2 } N / n _ { s a } }$ where $\sigma ^ { 2 }$ is the variance of samples for $( s , a )$ and, for $Q _ { s a }$ the estimator that uses all $ { n _ { s a } }$ samples for a single estimate,
279
+
280
+ $$
281
+ V a r [ Q _ { s a } ^ { m i n } ] = \frac { 1 2 N ^ { 2 } } { ( N + 1 ) ^ { 2 } ( N + 2 ) } V a r [ Q _ { s a } ] .
282
+ $$
283
+
284
+ Under this uniform random noise assumption, for $N \geq 8$ , $V a r [ Q _ { s a } ^ { m i n } ] < V a r [ Q _ { s a } ]$ .
285
+
286
+ ![](images/ca3b169ada49dfa5c1e46a9d1a3e08a6705ef48393e56536072e3eae87ff6b7f.jpg)
287
+ Figure 5: Empirical results of Theorem 1. $M$ is the number of available actions for some state $s$ . $N$ is the number of action-value functions in Maxmin Q-learning. In Figure 5 $( a )$ , we show a heat map of bias control in Maxmin Q-learning. In Figure 5 $( b )$ , we show how the variance ratio of $Q _ { s a } ^ { m i n }$ and $Q _ { s a }$ (i.e. $V a r [ Q _ { s a } ^ { m i n } ] / V a r [ Q _ { s a } ] )$ reduces as increases. For a better comparison, we set $\gamma \tau = 1$ .
288
+
289
+ Proof. Because $Q _ { s a } ^ { i }$ is a sample mean, its variance is $\sigma ^ { 2 } N / n _ { s a }$ where $\sigma ^ { 2 }$ is the variance of samples for $( s , a )$ and its mean is $Q _ { s a } ^ { * }$ (because it is an unbiased sample average). Consequently, $e _ { s a }$ has mean zero and variance $\sigma ^ { 2 } N / n _ { s a }$ . Because $e _ { s a }$ is a uniform random variable which has variance ${ \scriptstyle { \frac { 1 } { 3 } } } \tau ^ { 2 }$ , we know that $\tau = \sqrt { 3 \sigma ^ { 2 } N / n _ { s a } }$ . Plugging this value into the variance formula in Theorem 1, we get that
290
+
291
+ $$
292
+ \begin{array} { c } { { V a r [ Q _ { s a } ^ { m i n } ] = \displaystyle \frac { 4 N \tau ^ { 2 } } { ( N + 1 ) ^ { 2 } ( N + 2 ) } } } \\ { { = \displaystyle \frac { 1 2 N ^ { 2 } \sigma ^ { 2 } / n _ { s a } } { ( N + 1 ) ^ { 2 } ( N + 2 ) } } } \\ { { = \displaystyle \frac { 1 2 N ^ { 2 } } { ( N + 1 ) ^ { 2 } ( N + 2 ) } V a r [ Q _ { s a } ] } } \end{array}
293
+ $$
294
+
295
+ because $V a r [ Q _ { s a } ] = \sigma ^ { 2 } / n _ { s a }$ for the sample average $Q _ { s a }$ that uses all the samples for one estimator.
296
+ Easy to verify that for $N \geq 8$ , $V a r [ Q _ { s a } ^ { m i n } ] < V a r [ Q _ { s a } ]$ .
297
+
298
+ # B THE CONVERGENCE PROOF OF GENERALIZED Q-LEARNING
299
+
300
+ The convergence proof of Generalized Q-learning is based on Tsitsiklis (1994). The key steps to use this result for Generalized Q-learning include showing that the operator is a contraction and verifying the noise conditions. We first show these two steps in Lemma 2 and Lemma 3. We then use these lemmas to make the standard argument for convergence.
301
+
302
+ # B.1 PROBLEM SETTING FOR GENERALIZED Q-LEARNING
303
+
304
+ Consider a Markov decision problem defined on a finite state space $s$ . For every state $s \in S$ , there is a finite set $\mathcal { A }$ of possible actions for state $s$ and a set of non-negative scalars $p _ { s s ^ { \prime } } ( a )$ , $a \in { \mathcal { A } }$ , $s ^ { \prime } \in \mathcal { S }$ , such that $\begin{array} { r } { \sum _ { j \in S } p _ { s s ^ { \prime } } ( a ) = 1 } \end{array}$ for all $a \in { \mathcal { A } }$ . The scalar $p _ { s s ^ { \prime } } ( a )$ is interpreted as the probability of a transition to $s ^ { \prime }$ , given that the current state is $s$ and action $a$ is applied. Furthermore, for every state $s$ and action $a$ , there is a random variable $r _ { s a }$ which represents the reward if action $a$ is applied at state $s$ . We assume that the variance of $r _ { s a }$ is finite for every $s$ and $a \in { \mathcal { A } }$ .
305
+
306
+ A stationary policy is a function $\pi$ defined on $s$ such that $\pi ( s ) \in { \mathcal { A } }$ for all $s \in S$ . Given a stationary policy, we obtain a discrete-time Markov chain $f ^ { \pi } ( t )$ with transition probabilities
307
+
308
+ $$
309
+ \operatorname* { P r } ( f ^ { \pi } ( t + 1 ) = s ^ { \prime } | f ^ { \pi } ( t ) = s ) = p _ { s s ^ { \prime } } ( \pi ( s ) )
310
+ $$
311
+
312
+ Let $\gamma \in [ 0 , 1 ]$ be a discount factor. For any stationary policy $\pi$ and initial state $s$ , the state value $V _ { s } ^ { \pi }$ is defined by
313
+
314
+ $$
315
+ V _ { s } ^ { \pi } = \operatorname* { l i m } _ { T \to \infty } E [ \sum _ { t = 0 } ^ { T } \gamma ^ { t } r _ { f ^ { \pi } ( t ) , \pi ( f ^ { \pi } ( t ) ) } | f ^ { \pi } ( 0 ) = s ]
316
+ $$
317
+
318
+ The optimal state value function $V ^ { * }$ is defined by
319
+
320
+ $$
321
+ V _ { s } ^ { \ast } = \operatorname* { s u p } _ { \pi } V _ { s } ^ { \pi } , \quad s \in S
322
+ $$
323
+
324
+ The Markov decision problem is to evaluate the function $V ^ { * }$ . Once this is done, an optimal policy is easily determined.
325
+
326
+ Markov decision problems are easiest when the discount $\gamma$ is strictly smaller than 1. For the undiscounted case $( \gamma = 1 )$ ), we will assume throughout that there is a reward-free state, say state 1, which is absorbing; that is, $p _ { 1 1 } ( a ) = 1$ and $r _ { 1 u } = 0$ for all $a \in { \mathcal { A } }$ . The objective is then to reach that state at maximum expected reward. We say that a stationary policy is proper if the probability of being at the absorbing state converges to 1 as time converges to infinity; otherwise, we say that the policy is improper.
327
+
328
+ We define the dynamic programming operator $T : \mathbb { R } ^ { | s | } \mapsto \mathbb { R } ^ { | s | }$ , with components $T _ { i }$ , by letting
329
+
330
+ $$
331
+ T _ { s } ( V ) = \operatorname* { m a x } _ { a \in \mathcal { A } } \{ E [ r _ { s a } ] + \gamma \sum _ { s ^ { \prime } \in \mathcal { S } } p _ { s s ^ { \prime } } ( a ) V _ { s ^ { \prime } } \}
332
+ $$
333
+
334
+ It is well known that if $\gamma < 1$ , then $T$ is a contraction with respect to the norm $\| \cdot \| _ { \infty }$ and $V ^ { * }$ is its unique fixed point.
335
+
336
+ For Generalized Q-learning algorithm, assume that there are $N$ estimators of action-values $Q ^ { 1 } , \ldots , Q ^ { N }$ . Let $m$ be the cardinality of $s$ and $n$ be the cardinality of $\mathcal { A }$ . We use a discrete index variable $t$ in order to count iterations. Denote $Q ^ { i j } ( t ) = Q ^ { i } ( t + j )$ . After $t$ iterations, we have a vector $Q ( t ) \in \mathbb { R } ^ { w }$ and $w = m n N K$ , with components $Q _ { s a } ^ { i j } ( t ) , ( s , a ) \in \mathcal { S } \times \mathcal { A } , i \in \{ 1 , \dots , N \}$ , and $j \in \{ 0 , \ldots , K - 1 \}$ .
337
+
338
+ By definition, for $j \in \{ 1 , \dots , K - 1 \}$ , we have
339
+
340
+ $$
341
+ Q _ { s a } ^ { i j } ( t + 1 ) = Q _ { s a } ^ { i , j - 1 } ( t ) .
342
+ $$
343
+
344
+ $j = 0$ , we have $Q _ { s a } ^ { i 0 } = Q _ { s a } ^ { i }$ . And we update according to the formula
345
+
346
+ $$
347
+ Q _ { s a } ^ { i } ( t + 1 ) = Q _ { s a } ^ { i } ( t ) + \alpha _ { s a } ^ { i } ( t ) [ Y ^ { G Q } ( t ) - Q _ { s a } ^ { i } ( t ) ]
348
+ $$
349
+
350
+ where
351
+
352
+ $$
353
+ Y ^ { G Q } ( t ) = r _ { s a } + \gamma Q _ { f ( s , a ) } ^ { G Q } ( t ) .
354
+ $$
355
+
356
+ Here, each $\alpha _ { s a } ^ { i } ( t )$ is a nonnegative step-size coefficient which is set to zero for those $( s , a ) \in \mathcal { S } \times \mathcal { A }$ and $i \in \{ 1 , \ldots , N \}$ for which $Q _ { s a } ^ { i }$ is not to be updated at the current iteration. Furthermore, $r _ { s a }$ is a random sample of the immediate reward if action $a$ is applied at state $s$ . $f ( s , a )$ is a random successor state which is equal to $s ^ { \prime }$ with probability $p _ { s s ^ { \prime } } ( a )$ . Finally, $Q _ { s } ^ { G Q } ( t )$ is defined as
357
+
358
+ $$
359
+ Q _ { s } ^ { G Q } ( t ) = G ( Q _ { s } ( t ) )
360
+ $$
361
+
362
+ where $G$ is a mapping from $\mathbb { R } ^ { n N K }$ to $\mathbb { R }$ . It is understood that all random samples that are drawn in the course of the algorithm are drawn independently.
363
+
364
+ Since for $j \in \{ 1 , \dots , K - 1 \}$ , we just preserve current available action-values, we only focus on the case that $j = 0$ in the sequel. Let $F$ be the mapping from $\mathbb { R } ^ { m n N K }$ into $\mathbb { R } ^ { m n N }$ with components $F _ { s a } ^ { i }$ defined by
365
+
366
+ $$
367
+ F _ { s a } ^ { i } ( Q ) = E [ r _ { s a } ] + \gamma E [ Q _ { f ( s , a ) } ^ { G Q } ]
368
+ $$
369
+
370
+ and note that
371
+
372
+ $$
373
+ E [ Q _ { s } ^ { G Q } ] = \sum _ { s ^ { \prime } \in \cal S } p _ { s s ^ { \prime } } ( a ) Q _ { s ^ { \prime } } ^ { G Q }
374
+ $$
375
+
376
+ If $F _ { s a } ^ { i } ( Q ( t ) ) = Q ( t ) _ { s a } ^ { i }$ , we can do $K$ more updates such that $Q ( t ) _ { a } ^ { i j } = Q ( t ) _ { a } ^ { k l } , \forall i , k \in \{ 1 , \dots , N \}$ , $\forall j , l \in \{ 0 , \ldots , K - 1 \}$ , and $\forall a \in { \mathcal { A } }$ .
377
+
378
+ In view of Equation 13, Equation 10 can be written as
379
+
380
+ $$
381
+ Q _ { s a } ^ { i } ( t + 1 ) = Q _ { s a } ^ { i } ( t ) + \alpha _ { s a } ^ { i } ( t ) [ F _ { s a } ^ { i } ( Q ( t ) ) - Q _ { s a } ^ { i } ( t ) + w _ { s a } ^ { i } ( t ) ]
382
+ $$
383
+
384
+ where
385
+
386
+ $$
387
+ w _ { s a } ^ { i } ( t ) = r _ { s a } - E [ r _ { s a } ] + \gamma ( Q _ { f ( s , a ) } ^ { G Q } ( t ) - E [ Q _ { f ( s , a ) } ^ { G Q } ( t ) | \mathcal { F } ( t ) ] )
388
+ $$
389
+
390
+ and $\mathcal { F } ( t )$ represents the history of the algorithm during the first $t$ iterations. The expectation in the expression $E [ Q _ { f ( s , a ) } ^ { G Q } ( t ) | \mathcal { F } ( t ) ]$ is with respect to $f ( s , a )$ .
391
+
392
+ # B.2 KEY LEMMAS AND THE PROOFS
393
+
394
+ Lemma 2 Assume Assumption 1 holds for function $G$ in Generalized $Q$ -learning. Then we have
395
+
396
+ $$
397
+ E [ w _ { s a } ^ { 2 } ( t ) | \mathcal { F } ( t ) ] \leq V a r ( r _ { s a } ) + \operatorname* { m a x } _ { i \in \{ 1 , \ldots , N \} } \operatorname* { m a x } _ { \tau \leq t } \operatorname* { m a x } _ { ( s , a ) \in S \times \mathcal { A } } \big | Q _ { s a } ^ { i } ( \tau ) \big | ^ { 2 } .
398
+ $$
399
+
400
+ Proof. Under Assumption 1, the conditional variance of $Q _ { f ( s , a ) } ^ { G Q }$ given $\mathcal { F } ( t )$ , is bounded $\begin{array} { r } { \operatorname* { m a x } _ { i \in \{ 1 , \dots , N \} } \operatorname* { m a x } _ { j \in \{ 0 , \dots , K - 1 \} } \operatorname* { m a x } _ { ( s , a ) \in S \times \mathcal { A } } \left| Q _ { s a } ^ { i } ( t - j ) \right| ^ { 2 } } \end{array}$ . We then take the conditional variance of both sides of Equation 16, to obtain
401
+
402
+ $$
403
+ E [ w _ { s a } ^ { 2 } ( t ) | \mathcal { F } ( t ) ] \leq V a r ( r _ { s a } ) + \operatorname* { m a x } _ { i \in \{ 1 , \ldots , N \} } \operatorname* { m a x } _ { \tau \leq t } \operatorname* { m a x } _ { ( s , a ) \in \mathcal { S } \times \mathcal { A } } \left| Q _ { s a } ^ { i } ( \tau ) \right| ^ { 2 }
404
+ $$
405
+
406
+ We have assumed here that $r _ { s a }$ is independent from $f ( s , a )$ . If it is not, the right-hand side in the last inequality must be multiplied by 2, but the conclusion does not change.
407
+
408
+ Lemma 3 $F$ is a contraction mapping, in each of the following cases:
409
+
410
+ (i) $\gamma < 1$ .
411
+ (ii) $\gamma = 1$ and $\forall a \in \mathcal { A } , Q _ { s _ { 1 } a } ^ { i } ( t = 0 ) = 0$ where $s _ { 1 }$ is an absorbing state. All policies are proper.
412
+
413
+ Proof. For discounted problems $( \gamma < 1 )$ ), Equation 13 easily yields $\forall Q , Q ^ { \prime }$ ,
414
+
415
+ $$
416
+ | F _ { s a } ^ { i } ( Q ) - F _ { s a } ^ { i } ( Q ^ { \prime } ) | \leq \gamma \operatorname* { m a x } _ { s \in S } | Q _ { s } ^ { G Q } - Q _ { s } ^ { \prime \ G Q } |
417
+ $$
418
+
419
+ In particular, $F$ is a contraction mapping, with respect to the maximum norm $\| \cdot \| _ { \infty }$ .
420
+
421
+ For undiscounted problems $( \gamma = 1 )$ ), our assumptions on the absorbing state $s _ { 1 }$ imply that the update equation for $Q _ { s _ { 1 } a } ^ { i }$ degenerates to $Q _ { s _ { 1 } a } ^ { i } ( t { + } 1 ) = \stackrel { \textstyle \cdot } { Q } _ { s _ { 1 } a } ^ { i } ( t )$ , for all $t$ . We will be assuming in the sequel, that $Q _ { s _ { 1 } a } ^ { i }$ is initialized at zero. This leads to an equivalent description of the algorithm in which the mappings $F _ { s a } ^ { i }$ of Equation 13 are replaced by mappings $\tilde { F } _ { s a } ^ { i }$ satisfying $\tilde { F } _ { s a } ^ { i } = F _ { s a } ^ { i }$ if $s \neq s _ { 1 }$ and $\tilde { F } _ { s _ { 1 } a } ^ { i } ( Q ) = 0$ for all $a \in { \mathcal { A } }$ , $i \in \{ 1 , \ldots , N \}$ and $Q \in \mathbb { R } ^ { n }$ .
422
+
423
+ Let us consider the special case where every policy is proper. By Proposition 2.2 in the work of (Bertsekas & Tsitsiklis, 1996), there exists a vector $v > 0$ such that $T$ is a contraction with respect to the norm $\| \cdot \| _ { v }$ . In fact, a close examination of the proof of this Proposition 2.2 shows that this proof is easily extended to show that the mapping $\tilde { F }$ (with components $\tilde { F } _ { s a } ^ { i } )$ is a contraction with respect to the norm $\| \cdot \| _ { z }$ , where $z _ { s a } ^ { i } = v _ { s }$ for every $a \in { \mathcal { A } }$ and $i \in \{ 1 , \ldots , N \}$ .
424
+
425
+ In this section, we describe the algorithmic model to be employed and state some assumptions that will be imposed.
426
+
427
+ The algorithm consists of noisy updates of a vector $\boldsymbol { x } ~ \in ~ \mathbb { R } ^ { n }$ , for the purpose of solving a system of equations of the form $F ( x ) = x$ . Here $F$ is assumed to be a mapping from $\mathbb { R } ^ { n }$ into itself. Let $F _ { 1 } , \ldots , F _ { n }$ : $\mathbb { R } ^ { n } \mapsto \mathbb { R }$ be the corresponding component mappings; that is, $F ( x ) =$ $( F _ { 1 } ( x ) , \ldots , F _ { n } ( x ) )$ for all $x \in \mathbb { R } ^ { n }$ .
428
+
429
+ Let $\mathcal { N }$ be the set of non-negative integers. We employ a discrete ”time” variable $t$ , taking values in $\mathcal { N }$ . This variable need not have any relation with real time; rather, it is used to index successive updates. Let $x ( t )$ be the value of the vector $x$ at time $t$ and let $x _ { i } ( t )$ denote its $i$ th component. Let $\hat { T ^ { i } }$ be an infinite subset of $\mathcal { N }$ indicating the set of times at which an update of $x _ { i }$ is performed. We assume that
430
+
431
+ $$
432
+ x _ { i } ( t + 1 ) = x _ { i } ( t ) , \quad t \notin T ^ { i }
433
+ $$
434
+
435
+ Regarding the times that $x _ { i }$ is updated, we postulate an update equation of the form
436
+
437
+ $$
438
+ x _ { i } ( t + 1 ) = x _ { i } ( t ) + \alpha _ { i } ( t ) ( F _ { i } ( x ^ { i } ( t ) ) - x _ { i } ( t ) + w _ { i } ( t ) ) , \quad t \in T ^ { i }
439
+ $$
440
+
441
+ Here, $\alpha ( t )$ is a step-size parameter belonging to $[ 0 , 1 ]$ , $w _ { i } ( t )$ is a noise term, and $x _ { i } ( t )$ is a vector of possibly outdated components of $x$ . In particular, we assume that
442
+
443
+ $$
444
+ x ^ { i } ( t ) = ( x _ { 1 } ( \tau _ { 1 } ^ { i } ( t ) ) , \dots , x _ { n } ( \tau _ { n } ^ { i } ( t ) ) ) , \quad t \in T ^ { i }
445
+ $$
446
+
447
+ where each $\tau _ { j } ^ { i } ( t )$ is an integer satisfying $0 \leq \tau _ { j } ^ { i } ( t ) \leq t$ . If no information is outdated, we have $\tau _ { j } ^ { i } ( t ) = t$ and $x ^ { i } ( t ) = x ( t )$ for all $t$ ; the reader may wish to think primarily of this case. For an interpretation of the general case, see (Bertsekas $\&$ Tsitsiklis, 1989). In order to bring Eqs. 19 and 20 into a unified form, it is convenient to assume that $\alpha _ { i } ( t ) , w _ { i } ( t )$ , and $\tau _ { j } ^ { i } ( t )$ are defined for every $i$ , $j$ , and $t$ , but that $\alpha _ { i } ( t ) = 0$ and $\tau _ { j } ^ { i } ( t ) = t$ for $t \not \in T ^ { i }$ .
448
+
449
+ We will now continue with our assumptions. All variables introduced so far $( x ( t ) , \tau _ { j } ^ { i } ( t ) , \alpha _ { i } ( t ) , w _ { i } ( t ) )$ are viewed as random variables defined on a probability space $( \Omega , { \mathcal { F } } , { \mathcal { P } } )$ and the assumptions deal primarily with the dependencies between these random variables. Our assumptions also involve an increasing sequence $\{ \mathcal { F } ( t ) \} _ { t = 0 } ^ { \infty }$ of subfields of $\mathcal { F }$ . Intuitively, $\mathcal { F } ( t )$ is meant to represent the history of the algorithm up to, and including the point at which the step-sizes $\alpha _ { i } ( t )$ for the tth iteration are selected, but just before the noise term $w _ { i } ( t )$ is generated. Also, the measure-theoretic terminology that ”a random variable $Z$ is $\mathcal { F } ( t )$ -measurable” has the intuitive meaning that $Z$ is completely determined by the history represented by $\mathcal { F } ( t )$ .
450
+
451
+ The first assumption, which is the same as the total asynchronism assumption of Bertsekas & Tsitsiklis (1989), guarantees that even though information can be outdated, any old information is eventually discarded.
452
+
453
+ Assumption 3 For any $i$ and $j$ , $\begin{array} { r } { \operatorname* { l i m } _ { t \infty } \tau _ { j } ^ { i } ( t ) = \infty } \end{array}$ , with probability 1.
454
+
455
+ Our next assumption refers to the statistics of the random variables involved in the algorithm.
456
+
457
+ Assumption 4 Let $\{ \mathcal { F } ( t ) \} _ { t = 0 } ^ { \infty }$ be an increasing sequence of subfields of $\mathcal { F }$ .
458
+
459
+ (i) $x ( 0 )$ is $\mathcal { F } ( 0 )$ -measurable.
460
+
461
+ (ii) For every $i$ and t, $w _ { i } ( t )$ is $\mathcal { F } ( t + 1 )$ -measurable.
462
+
463
+ (iii) For every i, $j$ and $t$ , $\alpha _ { i } ( t )$ and $\tau _ { j } ^ { i } ( t )$ are $\mathcal { F } ( t )$ -measurable.
464
+
465
+ (iv) For every $i$ and $t$ , we have $E [ w _ { i } ( t ) | \mathcal { F } ( t ) ] = 0 .$ .
466
+
467
+ (v) There exist (deterministic) constants $A$ and $B$ such that
468
+
469
+ $$
470
+ E [ w _ { i } ^ { 2 } ( t ) | \mathcal { F } ( t ) ] \leq A + B \operatorname* { m a x } _ { j } \operatorname* { m a x } _ { \tau \leq t } | x _ { j } ( \tau ) | ^ { 2 } , \quad \forall i , t
471
+ $$
472
+
473
+ Assumption 4 allows for the possibility of deciding whether to update a particular component $x _ { i }$ at time $t$ , based on the past history of the process. In this case, the step-size $\alpha _ { i } ( t )$ becomes a random variable. However, part $( i i i )$ of the assumption requires that the choice of the components to be updated must be made without anticipatory knowledge of the noise variables $w _ { i }$ that have not yet been realized.
474
+
475
+ Finally, we introduce a few alternative assumptions on the structure of the iteration mapping $F$ . We first need some notation: if $x , y \in \mathbb { R } ^ { n }$ , the inequality $x \leq y$ is to be interpreted as $x _ { i } \le y _ { i }$ for all $i$ . Furthermore, for any positive vector $v = ( v _ { 1 } , \ldots , v _ { n } )$ , we define a norm $\| \cdot \| _ { v }$ on $\mathbb { R } ^ { n }$ by letting
476
+
477
+ $$
478
+ \| x \| _ { v } = \operatorname* { m a x } _ { i } { \frac { | x _ { i } | } { v _ { i } } } , \quad x \in \mathbb { R } ^ { n }
479
+ $$
480
+
481
+ Notice that in the special case where all components of $v$ are equal to 1, $\| \cdot \| _ { v }$ is the same as the maximum norm $\| \cdot \bar { \| } _ { \infty }$ .
482
+
483
+ Assumption 5 Let $F : \mathbb { R } ^ { n } \mapsto \mathbb { R } ^ { n }$ .
484
+
485
+ (i) The mapping $F$ is monotone; that is, if $x \leq y$ , then $F ( x ) \leq F ( y )$ .
486
+
487
+ (ii) The mapping $F$ is continuous.
488
+
489
+ (iii) The mapping $F$ has a unique fixed point $x ^ { * }$ .
490
+
491
+ (iv) If $e \in \mathbb { R } ^ { n }$ is the vector with all components equal to $1$ , and $r$ is a positive scalar, then
492
+
493
+ $$
494
+ F ( x ) - r e \leq F ( x - r e ) \leq F ( x + r e ) \leq F ( x ) + r e
495
+ $$
496
+
497
+ Assumption 6 There exists a vector $x ^ { * } \in \mathbb { R } ^ { n }$ , a positive vector $v$ , and a scalar $\beta \in [ 0 , 1 )$ , such that
498
+
499
+ $$
500
+ \| F ( x ) - x ^ { * } \| _ { v } \leq \beta \| x - x ^ { * } \| _ { v } , \quad \forall x \in \mathbb { R } ^ { n }
501
+ $$
502
+
503
+ Assumption 7 There exists a positive vector $v$ , a scalar $\beta \in [ 0 , 1 )$ , and a scalar $D$ such that
504
+
505
+ $$
506
+ \| F ( { \boldsymbol { x } } ) \| _ { v } \leq \beta \| { \boldsymbol { x } } \| _ { v } + D , \quad \forall { \boldsymbol { x } } \in \mathbb { R } ^ { n }
507
+ $$
508
+
509
+ Assumption 8 There exists at least one proper stationary policy. Every improper stationary policy yields infinite expected cost for at least one initial state.
510
+
511
+ Theorem 3 Let Assumptions 3, 4, 2, and 7 hold. Then the sequence $x ( t )$ is bounded with probability 1.
512
+
513
+ Theorem 4 Let Assumptions 3, 4, 2, and 5 hold. Furthermore, suppose that $x ( t )$ is bounded with probability 1. Then $x ( t )$ converges to $x ^ { * }$ with probability 1.
514
+
515
+ Theorem 5 Let Assumptions 3, 4, 2, and 6 hold. Then $x ( t )$ converges to $x ^ { * }$ with probability 1.
516
+
517
+ Detailed proofs of Theorems 3, 4, and 5 can be found in the work of Bertsekas & Tsitsiklis (1989).
518
+
519
+ B.4 PROOF OF THEOREM 2
520
+
521
+ We first state Theorem 2 here again and then show the proof.
522
+
523
+ Theorem 2 Assume a finite MDP $( { \boldsymbol { S } } , { \boldsymbol { A } } , { \boldsymbol { P } } , { \boldsymbol { R } } )$ and that Assumption 1 and 2 hold. Then the action-value functions in Generalized $\mathbf { Q }$ -learning, using tabular update in Equation (3), will converge to the optimal action-value function with probability 1, in each of the following cases:
524
+
525
+ (i) $\gamma < 1 .$ .
526
+ (ii) $\gamma = 1$ and $\forall a \in \mathcal { A } , Q _ { s _ { 1 } a } ^ { i } ( t = 0 ) = 0$ where $s _ { 1 }$ is an absorbing state. All policies are proper.
527
+
528
+ Proof. We first check Assumptions 3, 4, 2, and 6 in Section B.3 are satisfied. Then we simply apply Theorem 5 to Generalized Q-learning.
529
+
530
+ Assumption 3 is satisfied in the special case where $\tau _ { j } ^ { i } ( t ) = t$ , which is what was implicitly assumed in Equation 10, but can be also satisfied even if we allow for outdated information.
531
+
532
+ Regarding Assumption 4, parts $( i )$ and $( i i )$ of the assumption are then automatically valid. Part $( i i i )$ is quite natural: in particular, it assumes that the required samples are generated after we decide which components to update during the current iteration. Part $( i v )$ is automatic from Equation 16. Part $( v )$ is satisfied by Lemma 2.
533
+
534
+ Assumption 2 needs to be imposed on the step-sizes employed by the Generalized Q-learning algorithm. This assumption is standard for stochastic approximation algorithms. In particular, it requires that every state-action pair $( s , a )$ is simulated an infinite number of times.
535
+
536
+ By Lemma 3, $F$ is a contraction mapping. Assumption 6 is satisfied.
537
+
538
+ All assumptions required by Theorem 5 are verified, convergence then follows from Theorem 5.
539
+
540
+ # C ADDITIONAL EMPIRICAL RESULTS
541
+
542
+ C.1 MDP RESULTS
543
+
544
+ Comparison of three algorithms using the simple MDP in Figure 1 with different values of $\mu$ is shown in Figure 6. For $\mu = + 0 . 1$ , the learning curves of action value $Q ( A , { \mathrm { L e f t } } )$ are shown in $( a )$ . Here, the true action value $Q ( A , { \mathrm { L e f t } } )$ is $+ 0 . 1$ . For $\mu = - 0 . 1$ , the learning curves of action value $Q ( A , { \mathrm { L e f t } } )$ are shown in $( b )$ . The true action value $Q ( A , { \mathrm { L e f t } } )$ is $- 0 . 1$ . All results were averaged over $5 , 0 0 0$ runs.
545
+
546
+ ![](images/dea17ff8b82f87938225000a81a71acfade9d1ced57ae3cbf6286781751db27d.jpg)
547
+ Figure 6: MDP results
548
+
549
+ # C.2 MOUNTAIN CAR RESULTS
550
+
551
+ Comparison of four algorithms on Mountain Car under different reward settings is shown in Figure 7. All experimental results were averaged over 100 runs. Note that for reward variance $\sigma ^ { 2 } = 5 0$ , both Q-learning and Averaged Q-learning fail to reach the goal position in 5, 000 steps so there are no learning curves shown in Figure 7 $( d )$ for these two algorithms.
552
+
553
+ # C.3 BENCHMARK ENVIRONMENT RESULTS
554
+
555
+ The sensitivity analysis results of seven benchmark environment are shown in Figure 8.
556
+
557
+ ![](images/b402f02767f41385f6b45b16f22aa109da3b6704e330cac033ceb00cfc81fe41.jpg)
558
+ Figure 7: Mountain Car results
559
+
560
+ ![](images/d8b5c7c7575615a14ef93f77f45b771d1ca43cf95e7b7cbbdf8d10718275d51e.jpg)
561
+ Figure 8: Sensitivity analysis
md/train/Bkg2viA5FQ/Bkg2viA5FQ.md ADDED
The diff for this file is too large to render. See raw diff
 
md/train/Bkg3g2R9FX/Bkg3g2R9FX.md ADDED
@@ -0,0 +1,643 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ADAPTIVE GRADIENT METHODS WITH DYNAMIC BOUND OF LEARNING RATE
2
+
3
+ Liangchen Luo†∗, Yuanhao Xiong‡∗, Yan Liu§, $\mathbf { X } \mathbf { u } \mathbf { S } \mathbf { u } \mathbf { n } ^ { \dag \mathparagraph }$ †MOE Key Lab of Computational Linguistics, School of EECS, Peking University ‡College of Information Science and Electronic Engineering, Zhejiang University §Department of Computer Science, University of Southern California ¶Center for Data Science, Beijing Institute of Big Data Research, Peking University †{luolc,xusun}@pku.edu.cn ‡xiongyh@zju.edu.cn §yanliu.cs@usc.edu
4
+
5
+ # ABSTRACT
6
+
7
+ Adaptive optimization methods such as ADAGRAD, RMSPROP and ADAM have been proposed to achieve a rapid training process with an element-wise scaling term on learning rates. Though prevailing, they are observed to generalize poorly compared with SGD or even fail to converge due to unstable and extreme learning rates. Recent work has put forward some algorithms such as AMSGRAD to tackle this issue but they failed to achieve considerable improvement over existing methods. In our paper, we demonstrate that extreme learning rates can lead to poor performance. We provide new variants of ADAM and AMSGRAD, called ADABOUND and AMSBOUND respectively, which employ dynamic bounds on learning rates to achieve a gradual and smooth transition from adaptive methods to SGD and give a theoretical proof of convergence. We further conduct experiments on various popular tasks and models, which is often insufficient in previous work. Experimental results show that new variants can eliminate the generalization gap between adaptive methods and SGD and maintain higher learning speed early in training at the same time. Moreover, they can bring significant improvement over their prototypes, especially on complex deep networks. The implementation of the algorithm can be found at https://github.com/Luolc/AdaBound.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ There has been tremendous progress in first-order optimization algorithms for training deep neural networks. One of the most dominant algorithms is stochastic gradient descent (SGD) (Robbins & Monro, 1951), which performs well across many applications in spite of its simplicity. However, there is a disadvantage of SGD that it scales the gradient uniformly in all directions. This may lead to poor performance as well as limited training speed when the training data are sparse. To address this problem, recent work has proposed a variety of adaptive methods that scale the gradient by square roots of some form of the average of the squared values of past gradients. Examples of such methods include ADAM (Kingma & Lei Ba, 2015), ADAGRAD (Duchi et al., 2011) and RMSPROP (Tieleman & Hinton, 2012). ADAM in particular has become the default algorithm leveraged across many deep learning frameworks due to its rapid training speed (Wilson et al., 2017).
12
+
13
+ Despite their popularity, the generalization ability and out-of-sample behavior of these adaptive methods are likely worse than their non-adaptive counterparts. Adaptive methods often display faster progress in the initial portion of the training, but their performance quickly plateaus on the unseen data (development/test set) (Wilson et al., 2017). Indeed, the optimizer is chosen as SGD (or with momentum) in several recent state-of-the-art works in natural language processing and computer vision (Luo et al., 2019; Wu & He, 2018), wherein these instances SGD does perform better than adaptive methods. Reddi et al. (2018) have recently proposed a variant of ADAM called AMSGRAD, hoping to solve this problem. The authors provide a theoretical guarantee of convergence but only illustrate its better performance on training data. However, the generalization ability of AMSGRAD on unseen data is found to be similar to that of ADAM while a considerable performance gap still exists between AMSGRAD and SGD (Keskar & Socher, 2017; Chen et al., 2018).
14
+
15
+ In this paper, we first conduct an empirical study on ADAM and illustrate that both extremely large and small learning rates exist by the end of training. The results correspond with the perspective pointed out by Wilson et al. (2017) that the lack of generalization performance of adaptive methods may stem from unstable and extreme learning rates. In fact, introducing non-increasing learning rates, the key point in AMSGRAD, may help abate the impact of huge learning rates, while it neglects possible effects of small ones. We further provide an example of a simple convex optimization problem to elucidate how tiny learning rates of adaptive methods can lead to undesirable non-convergence. In such settings, RMSPROP and ADAM provably do not converge to an optimal solution, and furthermore, however large the initial step size $\alpha$ is, it is impossible for ADAM to fight against the scale-down term.
16
+
17
+ Based on the above analysis, we propose new variants of ADAM and AMSGRAD, named ADABOUND and AMSBOUND, which do not suffer from the negative impact of extreme learning rates. We employ dynamic bounds on learning rates in these adaptive methods, where the lower and upper bound are initialized as zero and infinity respectively, and they both smoothly converge to a constant final step size. The new variants can be regarded as adaptive methods at the beginning of training, and they gradually and smoothly transform to SGD (or with momentum) as time step increases. In this framework, we can enjoy a rapid initial training process as well as good final generalization ability. We provide a convergence analysis for the new variants in the convex setting.
18
+
19
+ We finally turn to an empirical study of the proposed methods on various popular tasks and models in computer vision and natural language processing. Experimental results demonstrate that our methods have higher learning speed early in training and in the meantime guarantee strong generalization performance compared to several adaptive and non-adaptive methods. Moreover, they can bring considerable improvement over their prototypes especially on complex deep networks.
20
+
21
+ # 2 NOTATIONS AND PRELIMINARIES
22
+
23
+ Notations Given a vector $\boldsymbol { \theta } \in \mathbb { R } ^ { d }$ we denote its $i$ -th coordinate by $\theta _ { i }$ ; we use $\theta ^ { k }$ to denote elementwise power of $k$ and $\| \theta \|$ to denote its $\ell _ { 2 }$ -norm; for a vector $\theta _ { t }$ in the $t$ -th iteration, the $i$ -th coordinate of $\theta _ { t }$ is denoted as $\theta _ { t , i }$ by adding a subscript $i$ . Given two vectors $v , w \in \mathbb { R } ^ { d }$ , we use ${ \langle v , w \rangle }$ to denote their inner product, $v \odot w$ to denote element-wise product, $v / w$ to denote element-wise division, $\operatorname* { m a x } ( v , w )$ to denote element-wise maximum and $\operatorname* { m i n } ( v , w )$ to denote element-wise minimum. We use $S _ { + } ^ { d }$ to denote the set of all positive definite $d \times d$ matrices. For a vector $a \in \mathbb { R } ^ { d }$ and a positive definite matrix $M \in \mathbb { R } ^ { d \times d }$ , we use $a / M$ to denote $M ^ { - 1 } a$ and $\sqrt { M }$ to denote $M ^ { 1 / 2 }$ . The projection operation $\Pi _ { \mathcal { F } , M } ( y )$ for ${ \cal M } \in { \cal S } _ { + } ^ { d }$ is defined as ar $\begin{array} { r } { \operatorname { g m i n } _ { x \in \mathcal { F } } \| M ^ { 1 / 2 } ( x - y ) \| } \end{array}$ for $\boldsymbol { y } \in \mathbb { R } ^ { d }$ . We say $\mathcal { F }$ has bounded diameter $D _ { \infty }$ if $\| x - y \| _ { \infty } \leq D _ { \infty }$ for all $x , y \in { \mathcal { F } }$ .
24
+
25
+ Online convex programming A flexible framework to analyze iterative optimization methods is the online optimization problem. It can be formulated as a repeated game between a player (the algorithm) and an adversary. At step $t$ , the algorithm chooses an decision $x _ { t } \in \mathcal { F }$ , where $\mathcal { F } \subset \mathbb { R } ^ { d }$ is a convex feasible set. Then the adversary chooses a convex loss function $f _ { t }$ and the algorithm incurs loss $f _ { t } ( x _ { t } )$ . The difference between the total loss $\textstyle \sum _ { t = 1 } ^ { T } f _ { t } ( x _ { t } )$ and its minimum value for a fixed decision is known as the regret, which is represented by $\begin{array} { r } { \dot { R } _ { T } = \sum _ { t = 1 } ^ { T } f _ { t } ( x _ { t } ) - \operatorname* { m i n } _ { x \in \mathcal { F } } \sum _ { t = 1 } ^ { T } f _ { t } ( x ) } \end{array}$ $\mathcal { F }$ has bounded diameter and $\| \nabla f _ { t } ( x ) \| _ { \infty }$ is bounded for all $t \in [ T ]$ and $x \in { \mathcal { F } }$ . We are interested in algorithms with little regret. Formally speaking, our aim is to devise an algorithm that ensures $R _ { T } = o ( T )$ , which implies that on average, the model’s performance converges to the optimal one. It has been pointed out that an online optimization algorithm with vanishing average regret yields a corresponding stochastic optimization algorithm (Cesa-Bianchi et al., 2002). Thus, following Reddi et al. (2018), we use online gradient descent and stochastic gradient descent synonymously.
26
+
27
+ A generic overview of optimization methods We follow Reddi et al. (2018) to provide a generic framework of optimization methods in Algorithm 1 that encapsulates many popular adaptive and non-adaptive methods. This is useful for understanding the properties of different optimization methods. Note that the algorithm is still abstract since the functions $\phi _ { t } : \mathcal { F } ^ { t } \to \mathbb { R } ^ { \hat { d } }$ and √ $\psi _ { t } : $ $\mathcal { F } ^ { d } \mathcal { S } _ { + } ^ { d }$ have not been specified. In this paper, we refer to $\alpha$ as initial step size and $\alpha _ { t } / \sqrt { V _ { t } }$ as
28
+
29
+ # Algorithm 1 Generic framework of optimization methods
30
+
31
+ Input: $x _ { 1 } \in { \mathcal { F } }$ , initial step size $\alpha$ , sequence of functions $\{ \phi _ { t } , \psi _ { t } \} _ { t = 1 } ^ { T }$
32
+
33
+ 1: for $t = 1$ to $T$ do
34
+ 2: $g _ { t } = \nabla f _ { t } ( x _ { t } )$
35
+ 3: $m _ { t } = \phi _ { t } ( g _ { 1 } , \cdot \cdot \cdot , g _ { t } )$ and $V _ { t } = \psi _ { t } ( g _ { 1 } , \cdot \cdot \cdot , g _ { t } )$
36
+ 4: $\alpha _ { t } = \alpha / \sqrt { t }$
37
+ 5: $\hat { x } _ { t + 1 } = x _ { t } - \alpha _ { t } m _ { t } / \sqrt { V _ { t } }$
38
+ 6: $x _ { t + 1 } = \Pi _ { \mathcal { F } , \sqrt { V _ { t } } } ( \hat { x } _ { t + 1 } )$
39
+ 7: end for
40
+
41
+ learning rate of the algorithm. Note that we employ a design of decreasing step size by $\alpha _ { t } = \alpha / \sqrt { t }$ for it is required for theoretical proof of convergence. However such an aggressive decay of step size typically translates into poor empirical performance, while a simple constant step size $\alpha _ { t } =$ $\alpha$ usually works well in practice. For the sake of clarity, we will use the decreasing scheme for theoretical analysis and the constant schemem for empirical study in the rest of the paper.
42
+
43
+ Under such a framework, we can summarize the popular optimization methods in Table 1.1 A few remarks are in order. We can see the scaling term $\psi _ { t }$ is I in SGD(M), while adaptive methods introduce different kinds of averaging of the squared values of past gradients. ADAM and RMSPROP can be seen as variants of ADAGRAD, where the former ones use an exponential moving average as function $\psi _ { t }$ instead of the simple average used in ADAGRAD. In particular, RMSPROP is essentially a special case of ADAM with $\beta _ { 1 } = 0$ . AMSGRAD is not listed in the table as it does not has a simple expression of $\psi _ { t }$ . It can be defined as $\psi _ { t } = \mathrm { d i a g } ( \hat { v } _ { t } )$ where $\hat { v } _ { t }$ is obtained by the following recursion: $v _ { t } = \beta _ { 2 } v _ { t - 1 } + ( 1 - \beta _ { 2 } ) g _ { t } ^ { 2 }$ and $\hat { v } _ { t } = \operatorname* { m a x } ( \hat { v } _ { t - 1 } , v _ { t } )$ with $\hat { v } _ { 0 } = v _ { 0 } = \mathbf { 0 }$ . The definition of $\phi _ { t }$ is same with that of ADAM. In the rest of the paper we will mainly focus on ADAM due to its generality but our arguments also apply to other similar adaptive methods such as RMSPROP and AMSGRAD.
44
+
45
+ Table 1: An overview of popular optimization methods using the generic framework.
46
+
47
+ <table><tr><td></td><td>SGD</td><td>SGDM</td><td>ADAGRAD</td><td>RMSPROP</td><td>ADAM</td></tr><tr><td>t</td><td>gt</td><td>t M</td><td>gt</td><td>gt</td><td>t (1-β1)∑ β -igi</td></tr><tr><td>t</td><td>I</td><td>i=1 I</td><td>t diag(M =1</td><td>(1-β2)diag(∑</td><td>i=1 t (1-β2)diag(∑ -g) =1</td></tr></table>
48
+
49
+ # 3 THE NON-CONVERGENCE CAUSED BY EXTREME LEARNING RATE
50
+
51
+ In this section, we elaborate the primary defect in current adaptive methods with a preliminary experiment and a rigorous proof. As mentioned above, adaptive methods like ADAM are observed to perform worse than SGD. Reddi et al. (2018) proposed AMSGRAD to solve this problem but recent work has pointed out AMSGRAD does not show evident improvement over ADAM (Keskar & Socher, 2017; Chen et al., 2018). Since AMSGRAD is claimed to have a smaller learning rate compared with ADAM, the authors only consider large learning rates as the cause for bad performance of ADAM. However, small ones might be a pitfall as well. Thus, we speculate both extremely large and small learning rates of ADAM are likely to account for its ordinary generalization ability.
52
+
53
+ For corroborating our speculation, we sample learning rates of several weights and biases of ResNet34 on CIFAR-10 using ADAM. Specifically, we randomly select nine $3 \times 3$ convolutional kernels from different layers and the biases in the last linear layer. As parameters of the same layer usually have similar properties, here we only demonstrate learning rates of nine weights sampled from nine kernels respectively and one bias from the last layer by the end of training, and employ a heatmap to visualize them. As shown in Figure 1, we can find that when the model is close to convergence, learning rates are composed of tiny ones less than 0.01 as well as huge ones greater than 1000.
54
+
55
+ ![](images/32040e1d838f547ec69e23fd91ae2c61cdcf8d0f10278c6b6b7a63c0c0c60de9.jpg)
56
+ Figure 1: Learning rates of sampled parameters. Each cell contains a value obtained by conducting a logarithmic operation on the learning rate. The lighter cell stands for the smaller learning rate.
57
+
58
+ The above analysis and observation show that there are indeed learning rates which are too large or too small in the final stage of the training process. AMSGRAD may help abate the impact of huge learning rates, but it neglects the other side of the coin. Insofar, we still have the following two doubts. First, does the tiny learning rate really do harm to the convergence of ADAM? Second, as the learning rate highly depends on the initial step size, can we use a relatively larger initial step size $\alpha$ to get rid of too small learning rates?
59
+
60
+ To answer these questions, we show that undesirable convergence behavior for ADAM and RMSPROP can be caused by extremely small learning rates, and furthermore, in some cases no matter how large the initial step size $\alpha$ is, ADAM will still fail to find the right path and converge to some highly suboptimal points. Consider the following sequence of linear functions for $\mathcal { F } = [ - 1 , 1 ]$ :
61
+
62
+ $$
63
+ f _ { t } ( x ) = { \left\{ \begin{array} { l l } { - x , } & { { \mathrm { f o r ~ } } t { \mathrm { ~ m o d ~ } } C = 1 ; } \\ { 2 x , } & { { \mathrm { f o r ~ } } t { \mathrm { ~ m o d ~ } } C = 2 ; } \\ { 0 , } & { { \mathrm { o t h e r w i s e } } } \end{array} \right. }
64
+ $$
65
+
66
+ where $C \in \mathbb { N }$ satisfies: $5 \beta _ { 2 } ^ { C - 2 } \leq ( 1 - \beta _ { 2 } ) / 2 ( 4 - \beta _ { 2 } )$ . For this function sequence, it is easy to see that the point $x = - 1$ provides the minimum regret. Supposing $\beta _ { 1 } = 0$ , we show that ADAM converges to a highly suboptimal solution of $x \geq 0$ for this setting. Intuitively, the reasoning is as follows. The algorithm obtains a gradient $- 1$ once every $C$ steps, which moves the algorithm in the wrong direction. Then, at the next step it observes a gradient 2. But the larger gradient 2 is unable to counteract the effect to wrong direction since the learning rate at this step is scaled down to a value much less than the previous one, and hence $x$ becomes larger and larger as the time step increases. We formalize this intuition in the result below.
67
+
68
+ Theorem 1. There is an online convex optimization problem where for any initial step size $\alpha$ , ADAM has non-zero average regret i.e., $R _ { T } / T \not \to 0$ as $T \to \infty$ .
69
+
70
+ We relegate all proofs to the appendix. Note that the above example also holds for constant step size $\alpha _ { t } = \alpha$ . Also note that vanilla SGD does not suffer from this problem. There is a wide range of valid choices of initial step size $\alpha$ where the average regret of SGD asymptotically goes to 0, in other words, converges to the optimal solution. This problem can be more obvious in the later stage of a training process in practice when the algorithm gets stuck in some suboptimal points. In such cases, gradients at most steps are close to 0 and the average of the second order momentum may be highly various due to the property of exponential moving average. Therefore, “correct” signals which appear with a relatively low frequency (i.e. gradient 2 every $C$ steps in the above example) may not be able to lead the algorithm to a right path, if they come after some “wrong” signals (i.e. gradient 1 in the example), even though the correct ones have larger absolute value of gradients.
71
+
72
+ One may wonder if using large $\beta _ { 1 }$ helps as we usually use $\beta _ { 1 }$ close to 1 in practice. However, the√ following result shows that for any constant $\beta _ { 1 }$ and $\beta _ { 2 }$ with $\beta _ { 1 } < \sqrt { \beta _ { 2 } }$ , there exists an example where ADAM has non-zero average regret asymptotically regardless of the initial step size $\alpha$ .
73
+
74
+ Theorem 2. For any constant $\beta _ { 1 } , \beta _ { 2 } ~ \in ~ [ 0 , 1 )$ such that $\beta _ { 1 } ~ < ~ \sqrt { \beta _ { 2 } }$ , there is an online convex optimization problem where for any initial step size $\alpha$ , ADAM has non-zero average regret i.e., $R _ { T } / T \not \to 0$ as $T \to \infty$ .
75
+
76
+ Furthermore, a stronger result stands in the easier stochastic optimization setting.
77
+
78
+ Theorem 3. For any constant $\beta _ { 1 } , \beta _ { 2 } \in [ 0 , 1 )$ such that $\beta _ { 1 } < \sqrt { \beta _ { 2 } }$ , there is a stochastic convex optimization problem where for any initial step size $\alpha$ , ADAM does not converge to the optimal solution.
79
+
80
+ Remark. The analysis of ADAM in Kingma & Lei Ba (2015) relies on decreasing $\beta _ { 1 }$ over time, while here we use constant $\beta _ { 1 }$ . Indeed, since the critical parameter is $\beta _ { 2 }$ rather than $\beta _ { 1 }$ in our analysis, it is quite easy to extend our examples to the case using decreasing scheme of $\beta _ { 1 }$ .
81
+
82
+ As mentioned by Reddi et al. (2018), the condition $\beta _ { 1 } < \sqrt { \beta _ { 2 } }$ is benign and is typically satisfied in the parameter settings used in practice. Such condition is also assumed in convergence proof of Kingma & Lei Ba (2015). The above results illustrate the potential bad impact of extreme learning rates and algorithms are unlikely to achieve good generalization ability without solving this problem.
83
+
84
+ # 4 ADAPTIVE MOMENT ESTIMATION WITH DYNAMIC BOUND
85
+
86
+ In this section we develop new variants of optimization methods and provide their convergence analysis. Our aim is to devise a strategy that combines the benefits of adaptive methods, viz. fast initial progress, and the good final generalization properties of SGD. Intuitively, we would like to construct an algorithm that behaves like adaptive methods early in training and like SGD at the end.
87
+
88
+ # Algorithm 2 ADABOUND
89
+
90
+ Input: $x _ { 1 } \in { \mathcal { F } }$ , initial step size $\alpha$ , $\{ \beta _ { 1 t } \} _ { t = 1 } ^ { T } , \beta _ { 2 }$ , lower bound function $\eta _ { l }$ , upper bound function $\eta _ { u }$
91
+ 1: Set $m _ { 0 } = 0$ , $v _ { 0 } = 0$
92
+ 2: for $t = 1$ to $T$ do
93
+ 3: $g _ { t } = \nabla f _ { t } ( x _ { t } )$
94
+ 4: $m _ { t } = \beta _ { 1 t } m _ { t - 1 } + ( 1 - \beta _ { 1 t } ) g _ { t }$
95
+ 5: $v _ { t } = \beta _ { 2 } v _ { t - 1 } + ( 1 - \beta _ { 2 } ) g _ { t } ^ { 2 }$ and $V _ { t } = \mathrm { d i a g } ( v _ { t } )$
96
+ 6: $\hat { \eta } _ { t } = \mathrm { C l i p } ( \alpha / \sqrt { V _ { t } } , \eta _ { l } ( t ) , \eta _ { u } ( t ) )$ and ηt = ˆηt/ t
97
+ 7: $x _ { t + 1 } = \Pi _ { { \mathcal { F } } , \mathrm { d i a g } ( \eta _ { t } ^ { - 1 } ) } ( x _ { t } - \eta _ { t } \odot m _ { t } )$
98
+ 8: end for
99
+
100
+ Inspired by gradient clipping, a popular technique used in practice that clips the gradients larger than a threshold to avoid gradient explosion, we employ clipping on learning rates in ADAM to propose ADABOUND in Algorithm 2. Consider applying the following operation in ADAM
101
+
102
+ $$
103
+ \mathrm { C l i p } ( \alpha / { \sqrt { V _ { t } } } , \eta _ { l } , \eta _ { u } ) ,
104
+ $$
105
+
106
+ which clips the learning rate element-wisely such that the output is constrained to be in $[ \eta _ { l } , \eta _ { u } ]$ . 2 It follows that $\operatorname { S G D } ( \mathbf { M } )$ with $\alpha = \alpha ^ { * }$ can be considered as the case where $\eta _ { l } = \eta _ { u } = \alpha ^ { * }$ . As for ADAM, $\eta _ { l } = 0$ and $\eta _ { u } = \infty$ . Now we can provide the new strategy with the following steps. We employ $\eta _ { l }$ and $\eta _ { u }$ as functions of $t$ instead of constant lower and upper bound, where $\eta _ { l } ( t )$ is a non-decreasing function that starts from 0 as $t = 0$ and converges to $\alpha ^ { * }$ asymptotically; and $\eta _ { u } ( t )$ is a non-increasing function that starts from $\infty$ as $t = 0$ and also converges to $\alpha ^ { * }$ asymptotically. In this setting, ADABOUND behaves just like ADAM at the beginning as the bounds have very little impact on learning rates, and it gradually transforms to SGD(M) as the bounds become more and more restricted. We prove the following key result for ADABOUND.
107
+
108
+ Theorem 4. Let $\{ x _ { t } \}$ and √ $\{ v _ { t } \}$ be the sequences obtained from Algorithm 2, $\beta _ { 1 } = \beta _ { 1 1 }$ , $\beta _ { 1 t } \le \beta _ { 1 }$ for all $t \in [ T ]$ and $\beta _ { 1 } / \sqrt { \beta _ { 2 } } < 1$ . Suppose $\eta _ { l } ( t + 1 ) \geq \eta _ { l } ( t ) > 0$ , $\eta _ { u } ( t + 1 ) \leq \eta _ { u } ( t )$ , $\eta _ { l } ( t ) \alpha ^ { * }$ as $t \to \infty$ , $\eta _ { u } ( t ) \to \alpha ^ { * }$ as $t \to \infty$ , $L _ { \infty } = \eta _ { l } ( 1 )$ and $R _ { \infty } = \eta _ { u } ( 1 )$ . Assume that $\| x - y \| _ { \infty } \leq D _ { \infty }$ for all $x , y \in { \mathcal { F } }$ and $\lVert \nabla f _ { t } ( x ) \rVert \leq G _ { 2 }$ for all $t \in [ T ]$ and $x \in { \mathcal { F } }$ . For $x _ { t }$ generated using the ADABOUND algorithm, we have the following bound on the regret
109
+
110
+ $$
111
+ R _ { T } \le \frac { D _ { \infty } ^ { 2 } \sqrt { T } } { 2 ( 1 - \beta _ { 1 } ) } \sum _ { i = 1 } ^ { d } \hat { \eta } _ { T , i } ^ { - 1 } + \frac { D _ { \infty } ^ { 2 } } { 2 ( 1 - \beta _ { 1 } ) } \sum _ { t = 1 } ^ { T } \sum _ { i = 1 } ^ { d } \beta _ { 1 t } \eta _ { t , i } ^ { - 1 } + ( 2 \sqrt { T } - 1 ) \frac { R _ { \infty } G _ { 2 } ^ { 2 } } { 1 - \beta _ { 1 } } .
112
+ $$
113
+
114
+ The following result falls as an immediate corollary of the above result.
115
+
116
+ Corollary 4.1. Suppose $\beta _ { 1 t } = \beta _ { 1 } \lambda ^ { t - 1 }$ in Theorem $^ { 4 }$ , we have
117
+
118
+ $$
119
+ R _ { T } \le \frac { D _ { \infty } ^ { 2 } \sqrt { T } } { 2 ( 1 - \beta _ { 1 } ) } \sum _ { i = 1 } ^ { d } \hat { \eta } _ { T , i } ^ { - 1 } + \frac { \beta _ { 1 } d D _ { \infty } ^ { 2 } } { 2 ( 1 - \beta _ { 1 } ) ( 1 - \lambda ) ^ { 2 } L _ { \infty } } + ( 2 \sqrt { T } - 1 ) \frac { R _ { \infty } G _ { 2 } ^ { 2 } } { 1 - \beta _ { 1 } } .
120
+ $$
121
+
122
+ It is easy to see that the regret of ADABOUND is upper bounded by $O ( \sqrt { T } )$ . Similar to Reddi et al. (2018), one can use a much more modest momentum decay of $\beta _ { 1 t } = \beta _ { 1 } / t$ and still ensure a regret of $O ( \sqrt { T } )$ . It should be mentioned that one can also incorporate the dynamic bound in AMSGRAD. The resulting algorithm, namely AMSBOUND, also holds a regret of $O ( \sqrt { T } )$ and the proof of convergence is almost same to Theorem 4 (see Appendix F for details). In next section we will see that AMSBOUND has similar performance to ADABOUND in several well-known tasks.
123
+
124
+ We end this section with a comparison to the previous work. For the idea of transforming ADAM to SGD, there is a similar work by Keskar & Socher (2017). The authors propose a measure that uses ADAM at first and switches the algorithm to SGD at some specific step. Compared with their approach, our methods have two advantages. First, whether there exists a fixed turning point to distinguish ADAM and SGD is uncertain. So we address this problem with a continuous transforming procedure rather than a “hard” switch. Second, they introduce an extra hyperparameter to decide the switching time, which is not very easy to fine-tune. As for our methods, the flexible parts introduced are two bound functions. We conduct an empirical study of the impact of different kinds of bound functions. The results are placed in Appendix G for we find that the convergence target $\alpha ^ { * }$ and convergence speed are not very important to the final results. For the sake of clarity, we will use ηl(t) = 0.1− 0.1(1−β2)t+1 and $\begin{array} { r } { \eta _ { u } \dot { ( t ) } = 0 . 1 + \frac { 0 . 1 } { ( 1 - \beta _ { 2 } ) t } } \end{array}$ in the rest of the paper unless otherwise specified.
125
+
126
+ # 5 EXPERIMENTS
127
+
128
+ In this section, we turn to an empirical study of different models to compare new variants with popular optimization methods including SGD(M), ADAGRAD, ADAM, and AMSGRAD. We focus on three tasks: the MNIST image classification task (Lecun et al., 1998), the CIFAR-10 image classification task (Krizhevsky & Hinton, 2009), and the language modeling task on Penn Treebank (Marcus et al., 1993). We choose them due to their broad importance and availability of their architectures for reproducibility. The setup for each task is detailed in Table 2. We run each experiment three times with the specified initialization method from random starting points. A fixed budget on the number of epochs is assigned for training and the decay strategy is introduced in following parts. We choose the settings that achieve the lowest training loss at the end.
129
+
130
+ Table 2: Summaries of the models utilized for our experiments.
131
+
132
+ <table><tr><td>Dataset</td><td>Network Type</td><td>Architecture</td></tr><tr><td>MNIST</td><td>Feedforward</td><td>1-Layer Perceptron</td></tr><tr><td>CIFAR-10</td><td>Deep Convolutional</td><td>DenseNet-121</td></tr><tr><td>CIFAR-10</td><td>Deep Convolutional</td><td>ResNet-34</td></tr><tr><td>Penn Treebank</td><td>Recurrent</td><td>1-Layer LSTM</td></tr><tr><td>Penn Treebank</td><td>Recurrent</td><td>2-Layer LSTM</td></tr><tr><td>Penn Treebank</td><td>Recurrent</td><td>3-Layer LSTM</td></tr></table>
133
+
134
+ # 5.1 HYPERPARAMETER TUNING
135
+
136
+ Optimization hyperparameters can exert great impact on ultimate solutions found by optimization algorithms so here we describe how we tune them. To tune the step size, we follow the method in Wilson et al. (2017). We implement a logarithmically-spaced grid of five step sizes. If the best performing parameter is at one of the extremes of the grid, we will try new grid points so that the best performing parameters are at one of the middle points in the grid. Specifically, we tune over hyperparameters in the following way.
137
+
138
+ SGD(M) For tuning the step size of SGD(M), we first coarsely tune the step size on a logarithmic scale from $\{ 1 0 0 , 1 0 , 1 , 0 . 1 , 0 . 0 1 \}$ and then fine-tune it. Whether the momentum is used depends on the specific model but we set the momentum parameter to default value 0.9 for all our experiments. We find this strategy effective given the vastly different scales of learning rates needed for different modalities. For instance, SGD with $\alpha = 1 0$ performs best for language modeling on PTB but for the ResNet-34 architecture on CIFAR-10, a learning rate of 0.1 for SGD is necessary.
139
+
140
+ ADAGRAD The initial set of step sizes used for ADAGRAD are: $\{ 5 \mathrm { e } { - } 2 , 1 \mathrm { e } { - } 2 , 5 \mathrm { e } { - } 3 , 1 \mathrm { e } { - } 3 , 5 \mathrm { e } { - } 4 \}$ .
141
+ For the initial accumulator value, we choose the recommended value as 0.
142
+
143
+ ADAM & AMSGRAD We employ the same hyperparameters for these two methods. The initial step sizes are chosen from: $\{ 1 \mathrm { e } { - } 2 , 5 \mathrm { e } { - } 3 , 1 \mathrm { e } { - } 3 , 5 \mathrm { e } { - } 4 , 1 \mathrm { e } { - } 4 \}$ . We turn over $\beta _ { 1 }$ values of $\{ 0 . 9 , 0 . 9 9 \}$ and $\beta _ { 2 }$ values of $\{ 0 . 9 9 , 0 . 9 9 9 \}$ . We use for the perturbation value $\epsilon = 1 \mathrm { e } { - } 8$ .
144
+
145
+ ADABOUND & AMSBOUND We directly apply the default hyperparameters for ADAM (a learning rate of 0.001, $\beta _ { 1 } = 0 . 9$ and $\beta _ { 2 } = 0 . 9 9 9 \rangle$ ) in our proposed methods.
146
+
147
+ Note that for other hyperparameters such as batch size, dropout probability, weight decay and so on, we choose them to match the recommendations of the respective base architectures.
148
+
149
+ # 5.2 FEEDFORWARD NEURAL NETWORK
150
+
151
+ We train a simple fully connected neural network with one hidden layer for the multiclass classification problem on MNIST dataset. We run 100 epochs and omit the decay scheme for this experiment.
152
+
153
+ Figure 2 shows the learning curve for each optimization method on both the training and test set. We find that for training, all algorithms can achieve the accuracy approaching $1 0 0 \%$ . For the test part, SGD performs slightly better than adaptive methods ADAM and AMSGRAD. Our two proposed methods, ADABOUND and AMSBOUND, display slight improvement, but compared with their prototypes there are still visible increases in test accuracy.
154
+
155
+ ![](images/0584ba0bdbb32fdc2351c421eeba292e9923b12e982e67448781cbe806852dbc.jpg)
156
+ Figure 2: Training (left) and test accuracy (right) for feedforward neural network on MNIST.
157
+
158
+ # 5.3 CONVOLUTIONAL NEURAL NETWORK
159
+
160
+ Using DenseNet-121 (Huang et al., 2017) and ResNet-34 (He et al., 2016), we then consider the task of image classification on the standard CIFAR-10 dataset. In this experiment, we employ the fixed budget of 200 epochs and reduce the learning rates by 10 after 150 epochs.
161
+
162
+ DenseNet We first run a DenseNet-121 model on CIFAR-10 and our results are shown in Figure 3. We can see that adaptive methods such as ADAGRAD, ADAM and AMSGRAD appear to perform better than the non-adaptive ones early in training. But by epoch 150 when the learning rates are decayed, SGDM begins to outperform those adaptive methods. As for our methods, ADABOUND and AMSBOUND, they converge as fast as adaptive ones and achieve a bit higher accuracy than SGDM on the test set at the end of training. In addition, compared with their prototypes, their performances are enhanced evidently with approximately $2 \%$ improvement in the test accuracy.
163
+
164
+ ResNet Results for this experiment are reported in Figure 3. As is expected, the overall performance of each algorithm on ResNet-34 is similar to that on DenseNet-121. ADABOUND and AMSBOUND even surpass SGDM by $1 \%$ . Despite the relative bad generalization ability of adaptive methods, our proposed methods overcome this drawback by allocating bounds for their learning rates and obtain almost the best accuracy on the test set for both DenseNet and ResNet on CIFAR-10.
165
+
166
+ # 5.4 RECURRENT NEURAL NETWORK
167
+
168
+ Finally, we conduct an experiment on the language modeling task with Long Short-Term Memory (LSTM) network (Hochreiter & Schmidhuber, 1997). From two experiments above, we observe that our methods show much more improvement in deep convolutional neural networks than in perceptrons. Therefore, we suppose that the enhancement is related to the complexity of the architecture and run three models with (L1) 1-layer, (L2) 2-layer and (L3) 3-layer LSTM respectively. We train them on Penn Treebank, running for a fixed budget of 200 epochs. We use perplexity as the metric to evaluate the performance and report results in Figure 4.
169
+
170
+ ![](images/2a3fde6e7f6149b0c2bd6564c64950a5abdfd4b680395f64e1e829a248bc1573.jpg)
171
+ Figure 3: Training and test accuracy for DenseNet-121 and ResNet-34 on CIFAR-10.
172
+
173
+ ![](images/d68749f21dc353c236aca45d2734b855546c1d8a0c9a431e4ca08f8d310d24ae.jpg)
174
+ (c) L3: 3-Layer LSTM
175
+ Figure 4: Perplexity curves on the test set comparing SGD, ADAM, ADABOUND and AMSBOUND for the LSTM with different layers on Penn Treebank.
176
+
177
+ We find that in all models, ADAM has the fastest initial progress but stagnates in worse performance than SGD and our methods. Different from phenomena in previous experiments on the image classification tasks, ADABOUND and AMSBOUND does not display rapid speed at the early training stage but the curves are smoother than that of SGD.
178
+
179
+ Comparing L1, L2 and L3, we can easily notice a distinct difference of the improvement degree. In L1, the simplest model, our methods perform slightly $1 . 1 \%$ better than ADAM while in L3, the most complex model, they show evident improvement over $2 . 8 \%$ in terms of perplexity. It serves as evidence for the relationship between the model’s complexity and the improvement degree.
180
+
181
+ # 5.5 ANALYSIS
182
+
183
+ To investigate the efficacy of our proposed algorithms, we select popular tasks from computer vision and natural language processing. Based on results shown above, it is easy to find that ADAM and AMSGRAD usually perform similarly and the latter does not show much improvement for most cases. Their variants, ADABOUND and AMSBOUND, on the other hand, demonstrate a fast speed of convergence compared with SGD while they also exceed two original methods greatly with respect to test accuracy at the end of training. This phenomenon exactly confirms our view mentioned in Section 3 that both large and small learning rates can influence the convergence.
184
+
185
+ Besides, we implement our experiments on models with different complexities, consisting of a perceptron, two deep convolutional neural networks and a recurrent neural network. The perceptron used on the MNIST is the simplest and our methods perform slightly better than others. As for DenseNet and ResNet, obvious increases in test accuracy can be observed. We attribute this difference to the complexity of the model. Specifically, for deep CNN models, convolutional and fully connected layers play different parts in the task. Also, different convolutional layers are likely to be responsible for different roles (Lee et al., 2009), which may lead to a distinct variation of gradients of parameters. In other words, extreme learning rates (huge or tiny) may appear more frequently in complex models such as ResNet. As our algorithms are proposed to avoid them, the greater enhancement of performance in complex architectures can be explained intuitively. The higher improvement degree on LSTM with more layers on language modeling task also consists with the above analysis.
186
+
187
+ # 6 FUTURE WORK
188
+
189
+ Despite superior results of our methods, there still remain several problems to explore. For example, the improvement on simple models are not very inspiring, we can investigate how to achieve higher improvement on such models. Besides, we only discuss reasons for the weak generalization ability of adaptive methods, however, why SGD usually performs well across diverse applications of machine learning still remains uncertain. Last but not least, applying dynamic bounds on learning rates is only one particular way to conduct gradual transformation from adaptive methods to SGD. There might be other ways such as well-designed decay that can also work, which remains to explore.
190
+
191
+ # 7 CONCLUSION
192
+
193
+ We investigate existing adaptive algorithms and find that extremely large or small learning rates can result in the poor convergence behavior. A rigorous proof of non-convergence for ADAM is provided to demonstrate the above problem.
194
+
195
+ Motivated by the strong generalization ability of SGD, we design a strategy to constrain the learning rates of ADAM and AMSGRAD to avoid a violent oscillation. Our proposed algorithms, ADABOUND and AMSBOUND, which employ dynamic bounds on their learning rates, achieve a smooth transition to SGD. They show the great efficacy on several standard benchmarks while maintaining advantageous properties of adaptive methods such as rapid initial progress and hyperparameter insensitivity.
196
+
197
+ # ACKNOWLEDGMENTS
198
+
199
+ We thank all reviewers for providing the constructive suggestions. We also thank Junyang Lin and Ruixuan Luo for proofreading and doing auxiliary experiments. Xu Sun is the corresponding author of this paper.
200
+
201
+ # REFERENCES
202
+
203
+ Nico Cesa-Bianchi, Alex Conconi, and Claudio Gentile. On the generalization ability of on-line learning algorithms. In Advances in Neural Information Processing Systems 14 (NIPS), pp. 359– 366, 2002.
204
+
205
+ Xiangyi Chen, Sijia Liu, Ruoyu Sun, and Mingyi Hong. On the convergence of a class of Adam-type algorithms for non-convex optimization. CoRR, abs/1808.02941, 2018.
206
+
207
+ John Duchi, Elad Hazan, and Yoram Singer. Adaptive subgradient methods for online learning and stochastic optimization. Journal of Machine Learning Research (JMLR), 12:2121–2159, 2011.
208
+
209
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2016.
210
+
211
+ Sepp Hochreiter and Jurgen Schmidhuber. Long short-term memory. ¨ Neural Comput., 9(8):1735– 1780, 1997.
212
+
213
+ Gao Huang, Zhuang Liu, Laurens van der Maaten, and Kilian Q Weinberger. Densely connected convolutional networks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2017.
214
+
215
+ Nitish Shirish Keskar and Richard Socher. Improving generalization performance by switching from Adam to SGD. CoRR, abs/1712.07628, 2017.
216
+
217
+ Diederik P Kingma and Jimmy Lei Ba. Adam: A method for stochastic optimization. In Proceedings of the 3rd International Conference on Learning Representations (ICLR), 2015.
218
+
219
+ Alex Krizhevsky and Geoffrey Hinton. Learning multiple layers of features from tiny images. Technical report, 2009.
220
+
221
+ Yann Lecun, Leon Bottou, Yoshua Bengio, and Patrick Haffner. Gradient-based learning applied to document recognition. In Proceedings of the IEEE, pp. 2278–2324, 1998.
222
+
223
+ Honglak Lee, Roger Grosse, Rajesh Ranganath, and Andrew $\mathrm { ~ Y ~ N ~ g ~ } _ { }$ . Convolutional deep belief networks for scalable unsupervised learning of hierarchical representations. In Proceedings of the 26th Annual International Conference on Machine Learning (ICML), pp. 609–616, 2009.
224
+
225
+ Liangchen Luo, Wenhao Huang, Qi Zeng, Zaiqing Nie, and Xu Sun. Learning personalized end-toend goal-oriented dialog. In Proceedings of the 33rd AAAI Conference on Artificial Intelligence (AAAI), 2019.
226
+
227
+ Mitchell P. Marcus, Mary Ann Marcinkiewicz, and Beatrice Santorini. Building a large annotated corpus of english: The penn treebank. Comput. Linguist., 19(2):313–330, 1993.
228
+
229
+ H Brendan Mcmahan and Matthew Streeter. Adaptive bound optimization for online convex optimization. In Proceedings of the 23rd Annual Conference On Learning Theory (COLT), pp. 244–256, 2010.
230
+
231
+ Sashank J. Reddi, Stayen Kale, and Sanjiv Kumar. On the convergence of adam and beyond. In Proceedings of the 6th International Conference on Learning Representations (ICLR), 2018.
232
+
233
+ Herbert Robbins and Sutton Monro. A stochastic approximation method. The Annals of Mathematical Statistics, 22(3):400–407, 1951.
234
+
235
+ Tijmen Tieleman and Geoffrey Hinton. RMSprop: Divide the gradient by a running average of its recent magnitude. COURSERA: Neural networks for machine learning, 4(2):26–31, 2012.
236
+
237
+ Ashia C Wilson, Rebecca Roelofs, Mitchell Stern, Nati Srebro, and Benjamin Recht. The marginal value of adaptive gradient methods in machine learning. In Advances in Neural Information Processing Systems 30 (NIPS), pp. 4148–4158, 2017.
238
+
239
+ Yuxin Wu and Kaiming He. Group normalization. In Proceedings of the 15th European Conference on Computer Vision (ECCV), pp. 3–19, 2018.
240
+
241
+ # APPENDIX
242
+
243
+ A AUXILIARY LEMMAS
244
+
245
+ Lemma 1 (Mcmahan & Streeter (2010)). For any $Q \in { \mathcal { S } } _ { + } ^ { d }$ and convex feasible set $\mathcal { F } \subset \mathbb { R } ^ { d }$ , suppose $\begin{array} { r } { u _ { 1 } = \operatorname* { m i n } _ { x \in \mathcal { F } } \| Q ^ { 1 / 2 } ( x - z _ { 1 } ) \| } \end{array}$ and $\begin{array} { r } { u _ { 2 } = \operatorname* { m i n } _ { x \in \mathcal { F } } \| Q ^ { 1 / 2 } ( x - z _ { 2 } ) \| } \end{array}$ then we have $\lVert Q ^ { 1 / 2 } ( u _ { 1 } - u _ { 2 } ) \rVert \leq$ $\lVert Q ^ { 1 / 2 } ( z _ { 1 } - z _ { 2 } ) \rVert$ .
246
+
247
+ Proof. We provide the proof here for completeness. Since $u _ { 1 } = m i n _ { x \in \mathcal { F } } \| Q ^ { 1 / 2 } ( x - z _ { 1 } ) \|$ and $u _ { 2 } = m i n _ { x \in \mathcal { F } } \left| \left| Q ^ { 1 / 2 } ( x - z _ { 2 } ) \right| \right|$ and from the property of projection operator we have the following:
248
+
249
+ $$
250
+ \left. u _ { 1 } - z _ { 1 } , Q ( u _ { 2 } - u _ { 1 } ) \right. \geq 0 \mathrm { ~ a n d ~ } \left. u _ { 2 } - z _ { 2 } , Q ( u _ { 1 } - u _ { 2 } ) \right. \geq 0 .
251
+ $$
252
+
253
+ Combining the above inequalities, we have
254
+
255
+ $$
256
+ \langle z _ { 2 } - z _ { 1 } , Q ( u _ { 2 } - u _ { 1 } ) \rangle \geq \langle u _ { 2 } - u _ { 1 } , Q ( u _ { 2 } - u _ { 1 } ) \rangle .
257
+ $$
258
+
259
+ Also, observe the following:
260
+
261
+ $$
262
+ \langle z _ { 2 } - z _ { 1 } , Q ( u _ { 2 } - u _ { 1 } ) \rangle \leq \frac { 1 } { 2 } \left[ \langle u _ { 2 } - u _ { 1 } , Q ( u _ { 2 } - u _ { 1 } ) \rangle + \langle z _ { 2 } - z _ { 1 } , Q ( z _ { 2 } - z _ { 1 } ) \rangle \right] .
263
+ $$
264
+
265
+ The above inequality can be obtained from the fact that
266
+
267
+ $$
268
+ \langle ( u _ { 2 } - u _ { 1 } ) - ( z _ { 2 } - z _ { 1 } ) , Q ( ( u _ { 2 } - u _ { 1 } ) - ( z _ { 2 } - z _ { 1 } ) ) \rangle \geq 0 \mathrm { ~ a s ~ } Q \in \mathcal { S } _ { + } ^ { d }
269
+ $$
270
+
271
+ and rearranging the terms. Combining the above inequality with Equation (1), we have the required the result. □
272
+
273
+ Lemma 2. Suppose $m _ { t } = \beta _ { 1 } m _ { t - 1 } + ( 1 - \beta _ { 1 } ) g _ { t }$ with $m _ { 0 } = \mathbf { 0 }$ and $0 \leq \beta _ { 1 } < 1$ . We have
274
+
275
+ $$
276
+ \sum _ { t = 1 } ^ { T } \| m _ { t } \| ^ { 2 } \leq \sum _ { t = 1 } ^ { T } \| g _ { t } \| ^ { 2 } .
277
+ $$
278
+
279
+ Proof. If $\beta _ { 1 } = 0$ , the equality directly holds due to $m _ { t } = g _ { t }$ . Otherwise, $0 < \beta _ { 1 } < 1$ . For any $\theta > 0$ we have
280
+
281
+ $$
282
+ \begin{array} { r l } & { \| m _ { t } \| ^ { 2 } = \| \beta _ { 1 } m _ { t - 1 } \| ^ { 2 } + \| ( 1 - \beta _ { 1 } ) g _ { t } \| ^ { 2 } + 2 \langle \beta _ { 1 } m _ { t - 1 } , ( 1 - \beta _ { 1 } ) g _ { t } \rangle } \\ & { \qquad \leq \| \beta _ { 1 } m _ { t - 1 } \| ^ { 2 } + \| ( 1 - \beta _ { 1 } ) g _ { t } \| ^ { 2 } + \theta \| \beta _ { 1 } m _ { t - 1 } \| ^ { 2 } + 1 / \theta \| ( 1 - \beta _ { 1 } ) g _ { t } \| ^ { 2 } } \\ & { \qquad = ( 1 + \theta ) \| \beta _ { 1 } m _ { t - 1 } \| ^ { 2 } + ( 1 + 1 / \theta ) \| ( 1 - \beta _ { 1 } ) g _ { t } \| ^ { 2 } } \end{array}
283
+ $$
284
+
285
+ The inequality follows from Cauchy–Schwarz and Young’s inequality. In particular, let $\theta = 1 / \beta _ { 1 } -$ 1. Then we have
286
+
287
+ $$
288
+ \begin{array} { r } { \| m _ { t } \| ^ { 2 } \leq \beta _ { 1 } \| m _ { t - 1 } \| ^ { 2 } + ( 1 - \beta _ { 1 } ) \| g _ { t } \| ^ { 2 } . } \end{array}
289
+ $$
290
+
291
+ Dividing both sides by $\beta _ { 1 } ^ { t }$ , we get
292
+
293
+ $$
294
+ \frac { \| m _ { t } \| ^ { 2 } } { \beta _ { 1 } ^ { t } } \leq \frac { \| m _ { t - 1 } \| ^ { 2 } } { \beta _ { 1 } ^ { t - 1 } } + \frac { ( 1 - \beta _ { 1 } ) \| g _ { t } \| ^ { 2 } } { \beta _ { 1 } ^ { t } } .
295
+ $$
296
+
297
+ Note that $m _ { 0 } = \mathbf { 0 }$ . Hence,
298
+
299
+ $$
300
+ \frac { \| m _ { t } \| ^ { 2 } } { \beta _ { 1 } ^ { t } } \leq \left( 1 - \beta _ { 1 } \right) \sum _ { i = 1 } ^ { t } \| g _ { i } \| ^ { 2 } \beta _ { 1 } ^ { - i } .
301
+ $$
302
+
303
+ Then multiplying both sides by $\beta _ { 1 } ^ { t }$ we obtain
304
+
305
+ $$
306
+ \| m _ { t } \| ^ { 2 } \leq ( 1 - \beta _ { 1 } ) \sum _ { i = 1 } ^ { t } \| g _ { i } \| ^ { 2 } \beta _ { 1 } ^ { t - i } .
307
+ $$
308
+
309
+ Take the summation of above inequality over $t = 1 , 2 , \cdots , T$ , we have
310
+
311
+ $$
312
+ \begin{array} { l } { \displaystyle \sum _ { t = 1 } ^ { T } \| m _ { t } \| ^ { 2 } \leq ( 1 - \beta _ { 1 } ) \displaystyle \sum _ { t = 1 } ^ { T } \displaystyle \sum _ { i = 1 } ^ { t } \| g _ { i } \| ^ { 2 } \beta _ { 1 } ^ { t - i } } \\ { = ( 1 - \beta _ { 1 } ) \displaystyle \sum _ { i = 1 } ^ { T } \displaystyle \sum _ { t = i } ^ { T } \| g _ { i } \| ^ { 2 } \beta _ { 1 } ^ { t - i } } \\ { \leq \displaystyle \sum _ { t = 1 } ^ { T } \| g _ { t } \| ^ { 2 } . } \end{array}
313
+ $$
314
+
315
+ The second inequality is due to the following fact of geometric series
316
+
317
+ $$
318
+ \sum _ { i = 0 } ^ { N } \beta _ { 1 } ^ { i } \le \sum _ { i = 0 } ^ { \infty } \beta _ { 1 } ^ { i } = \frac { 1 } { 1 - \beta _ { 1 } } , \mathrm { ~ f o r ~ } 0 < \beta _ { 1 } < 1 .
319
+ $$
320
+
321
+ We complete the proof.
322
+
323
+ # B PROOF OF THEOREM 1
324
+
325
+ Proof. First, we rewrite the update of ADAM in Algorithm 1 in the following recursion form:
326
+
327
+ $$
328
+ m _ { t , i } = \beta _ { 1 } m _ { t - 1 , i } + ( 1 - \beta _ { 1 } ) g _ { t , i } \mathrm { ~ a n d ~ } v _ { t , i } = \beta _ { 2 } v _ { t - 1 , i } + ( 1 - \beta _ { 2 } ) g _ { t , i } ^ { 2 }
329
+ $$
330
+
331
+ where $m _ { 0 , i } = 0$ and $v _ { 0 , i } = 0$ for all $i \in [ d ]$ and $\psi _ { t } = \mathrm { d i a g } ( v _ { t } )$ . We consider the setting where $f _ { t }$ are linear functions and $\mathcal { F } = [ - 1 , 1 ]$ . In particular, we define the following function sequence:
332
+
333
+ $$
334
+ f _ { t } ( x ) = { \left\{ \begin{array} { l l } { - x , } & { { \mathrm { f o r ~ } } t { \mathrm { ~ m o d ~ } } C = 1 ; } \\ { 2 x , } & { { \mathrm { f o r ~ } } t { \mathrm { ~ m o d ~ } } C = 2 ; } \\ { 0 , } & { { \mathrm { o t h e r w i s e } } } \end{array} \right. }
335
+ $$
336
+
337
+ where $C \in \mathbb { N }$ satisfies the following:
338
+
339
+ $$
340
+ 5 \beta _ { 2 } ^ { C - 2 } \leq \frac { 1 } { 2 } \cdot \frac { 1 - \beta _ { 2 } } { 4 - \beta _ { 2 } } .
341
+ $$
342
+
343
+ It is not hard to see that the condition hold for large constant $C$ that depends on $\beta _ { 2 }$ .
344
+
345
+ Since the problem is one-dimensional, we drop indices representing coordinates from all quantities in Algorithm 1. For this function sequence, it is easy to see that the point $x = - 1$ provides the minimum regret. Consider the execution of ADAM algorithm for this sequence of functions with $\beta _ { 1 } = 0$ . Note that since gradients of these functions are bounded, $\mathcal { F }$ has bounded $D _ { \infty }$ diameter and $\beta _ { 1 } ^ { 2 } / \beta _ { 2 } < 1$ as $\beta _ { 1 } = 0$ , the conditions on the parameters required for ADAM are satisfied (Kingma & Lei Ba, 2015). The gradients have the following form:
346
+
347
+ $$
348
+ \nabla f _ { i } ( x ) = { \left\{ \begin{array} { l l } { - 1 , } & { { \mathrm { f o r ~ } } i { \mathrm { ~ m o d ~ } } C = 1 ; } \\ { 2 , } & { { \mathrm { f o r ~ } } i { \mathrm { ~ m o d ~ } } C = 2 ; } \\ { 0 , } & { { \mathrm { o t h e r w i s e . } } } \end{array} \right. }
349
+ $$
350
+
351
+ Let $\tau \in \mathbb { N } , \tau > 1$ be such that
352
+
353
+ $$
354
+ \begin{array} { r } { \frac { \alpha } { \sqrt { C t + 1 } } \frac { 1 } { \sqrt { ( 1 - \beta _ { 2 } ) ( \beta _ { 2 } ^ { C } + 4 \beta _ { 2 } ^ { C - 1 } + 1 ) } } \le 1 , } \\ { \frac { \alpha } { \sqrt { C t + 2 } } \frac { 2 } { \sqrt { ( 1 - \beta _ { 2 } ) ( 4 + \beta _ { 2 } ) } } \le 1 , } \end{array}
355
+ $$
356
+
357
+ for all $t \geq \tau$ . We start with the following preliminary result.
358
+
359
+ Lemma 3. For the parameter settings and conditions assumed in Theorem 1, there is a $t ^ { \prime } \geq \tau$ such that $x _ { C t ^ { \prime } + 1 } \geq 0$ .
360
+
361
+ Proof by contradiction. Assume that $x _ { C t + 1 } < 0$ for all $t \geq \tau$ . Firstly, for $t \geq \tau$ , we observe the following inequalities:
362
+
363
+ $$
364
+ \begin{array} { l } { { v _ { C t + 1 } = \beta _ { 2 } v _ { C t } + ( 1 - \beta _ { 2 } ) } } \\ { { \ ~ } } \\ { { \displaystyle ~ = ( 1 - \beta _ { 2 } ) ( 1 + \sum _ { i = 1 } ^ { t } \beta _ { 2 } ^ { C i } + 4 \sum _ { i = 1 } ^ { t } \beta _ { 2 } ^ { C i - 1 } ) } } \\ { { \ ~ } } \\ { { \displaystyle ~ \geq ( 1 - \beta _ { 2 } ) ( \beta _ { 2 } ^ { C } + 4 \beta _ { 2 } ^ { C - 1 } + 1 ) , } } \end{array}
365
+ $$
366
+
367
+ $$
368
+ \begin{array} { l } { \displaystyle v _ { C t + 1 } = \beta _ { 2 } v _ { C t } + ( 1 - \beta _ { 2 } ) } \\ { \displaystyle \qquad = ( 1 - \beta _ { 2 } ) ( \sum _ { i = 1 } ^ { t } \beta _ { 2 } ^ { C i } + 4 \sum _ { i = 1 } ^ { t } \beta _ { 2 } ^ { C i - 1 } ) + ( 1 - \beta _ { 2 } ) } \\ { \displaystyle \qquad \le ( 1 - \beta _ { 2 } ) \frac { \beta _ { 2 } ^ { C } + 4 \beta _ { 2 } ^ { C - 1 } } { 1 - \beta _ { 2 } ^ { C } } + ( 1 - \beta _ { 2 } ) } \\ { \displaystyle \qquad \le 5 \beta _ { 2 } ^ { C - 1 } + ( 1 - \beta _ { 2 } ) < 9 , } \end{array}
369
+ $$
370
+
371
+ $$
372
+ \begin{array} { c l } { { v _ { C t + 2 } = ( 1 - \beta _ { 2 } ) ( \displaystyle \sum _ { i = 0 } ^ { t } \beta _ { 2 } ^ { C i + 1 } + 4 \displaystyle \sum _ { i = 0 } ^ { t } \beta _ { 2 } ^ { C i } ) } } \\ { { = ( 1 - \beta _ { 2 } ) ( 4 + \beta _ { 2 } ) \displaystyle \frac { 1 - \beta _ { 2 } ^ { C t } } { 1 - \beta _ { 2 } ^ { C } } } } \\ { { } } \\ { { \leq 4 + \beta _ { 2 } < 9 . } } \end{array}
373
+ $$
374
+
375
+ From the $( C \tau + 1 )$ -th update of ADAM in Equation (2), we obtain:
376
+
377
+ $$
378
+ \begin{array} { l } { \displaystyle \hat { x } _ { C \tau + 2 } = x _ { C \tau + 1 } + \frac { \alpha } { \sqrt { C \tau + 1 } } \frac { 1 } { \sqrt { v _ { C \tau + 1 } } } } \\ { \displaystyle < \frac { \alpha } { \sqrt { C \tau + 1 } } \frac { 1 } { \sqrt { ( 1 - \beta _ { 2 } ) ( \beta _ { 2 } ^ { C } + 4 \beta _ { 2 } ^ { C - 1 } + 1 ) } } \le 1 . } \end{array}
379
+ $$
380
+
381
+ The first inequality follows from $x _ { C t + 1 } < 0$ and Equation (6). The last inequality follows from Equation (4). Therefore, we have $- 1 \leq x _ { C \tau + 1 } < \hat { x } _ { C \tau + 2 } < 1$ and hence $x _ { C \tau + 2 } = \hat { x } _ { C \tau + 2 }$ . Then after the $( C \tau + 2 )$ -th update, we have:
382
+
383
+ $$
384
+ \begin{array} { r l } & { \hat { x } _ { G \tau + 3 } = x _ { G \tau + 2 } - \frac { \alpha } { \sqrt { C \tau + 2 } } \frac { 2 } { \sqrt { v G _ { \tau + 2 } } } } \\ & { = x _ { C \tau + 1 } + \frac { \alpha } { \sqrt { C \tau + 1 } } \frac { 1 } { \sqrt { v G _ { \tau + 1 } } } - \frac { \alpha } { \sqrt { C \tau + 2 } } \frac { 2 } { \sqrt { v G _ { \tau + 2 } } } } \\ & { \geq x _ { C \tau + 1 } + \frac { 1 } { \sqrt { C \tau + C } } \frac { \alpha \beta _ { 2 } ( v _ { C \tau + 1 } - 4 v _ { C \tau } ) } { \sqrt { v G _ { \tau + 1 } v G _ { \tau + 2 } } \left( \sqrt { v G _ { \tau + 2 } } + 2 \sqrt { v G _ { \tau + 1 } } \right) } } \\ & { \geq x _ { C \tau + 1 } + \frac { 1 } { \sqrt { \tau + 1 } } \frac { \alpha \beta _ { 2 } } { \sqrt { 1 6 } \sqrt { C } } ( v c _ { \tau + 1 } - 4 v _ { C \tau } ) } \\ & { \geq x _ { C \tau + 1 } + \frac { 1 } { \sqrt { \tau + 1 } } \frac { \alpha \beta _ { 2 } ( 1 - \beta _ { 2 } ) } { 1 6 2 \sqrt { C } } } \\ & { = x _ { C \tau + 1 } + \frac { \kappa } { \sqrt { \tau + 1 } } , } \end{array}
385
+ $$
386
+
387
+ where $\kappa = \alpha \beta _ { 2 } ( 1 - \beta _ { 2 } ) / 1 6 2 \sqrt { C }$ is a constant that depends on $\alpha$ , $\beta _ { 2 }$ and $C$ . The first inequality follows from Equation (2). The second inequality follows from Equations (7) and (8). The last
388
+
389
+ inequality is due to the following lower bound:
390
+
391
+ $$
392
+ \begin{array} { r l } { \boldsymbol { v } _ { C \ell + 1 } - 4 \boldsymbol { v } _ { C \xi } = \beta _ { 2 } \boldsymbol { v } _ { C \xi } + ( 1 - \beta _ { 2 } ) - 4 \boldsymbol { v } _ { C \ell } } \\ { = } & { ( 4 - \beta _ { 2 } ) \left[ \frac { 1 - \beta _ { 2 } } { 4 } - \mathcal { D } _ { C \ell } ^ { 2 } \right] } \\ & { = ( 4 - \beta _ { 2 } ) \Bigg [ \frac { 1 - \beta _ { 2 } } { 4 } - ( 1 - \beta _ { 2 } ) ( \sum _ { i = 1 } ^ { \ell } \beta _ { 2 } ^ { C \ell - 1 } + 4 \sum _ { i = 1 } ^ { \ell } \beta _ { 2 } ^ { C \ell - 2 } ) \Bigg ] } \\ & { \ge ( 4 - \beta _ { 2 } ) \Bigg [ \frac { 1 - \beta _ { 2 } } { 4 } - \beta _ { 2 } - ( 1 - \beta _ { 2 } ) ( \sum _ { i = 1 } ^ { \ell } \beta _ { 2 } ^ { C \ell - 1 } + 4 \frac { \beta _ { 2 } ^ { C \ell - 2 } } { 4 } ) \Bigg ] } \\ & { \ge ( 4 - \beta _ { 2 } ) \Bigg [ \frac { 1 - \beta _ { 2 } } { 4 } - \beta _ { 2 } - ( 1 - \beta _ { 2 } ) ( \frac { \beta _ { 2 } ^ { C \ell - 1 } } { 1 - \beta _ { 2 } ^ { C \ell } } + \frac { 4 \beta _ { 2 } ^ { C \ell - 2 } } { 1 - \beta _ { 2 } ^ { C \ell } } ) \Bigg ] } \\ & { \ge ( 4 - \beta _ { 2 } ) \Bigg [ \frac { 1 - \beta _ { 2 } } { 4 } - \beta _ { 2 } ^ { 2 } - 5 \beta _ { 2 } ^ { C \ell - 2 } \Bigg ] } \\ & { \ge ( 4 - \beta _ { 2 } ) \cdot \frac { 1 } { 2 } \cdot \frac { 1 - \beta _ { 2 } } { 4 } - \beta _ { 2 } } \\ & { = \frac { 1 - \beta _ { 2 } } { 2 } , } \end{array}
393
+ $$
394
+
395
+ where the last inequality follows from Equation (3). Therefore, we have $- 1 \le x _ { C \tau + 1 } < \hat { x } _ { C \tau + 3 } <$ $x _ { C \tau + 2 } < 1$ . Furthermore, since gradients $\nabla f _ { i } ( x ) = 0$ when $i$ mod $C \neq 1$ or 2, we have
396
+
397
+ $$
398
+ \begin{array} { c } { { x _ { C \tau + 4 } = \hat { x } _ { C \tau + 3 } = x _ { C \tau + 3 } , } } \\ { { x _ { C \tau + 5 } = \hat { x } _ { C \tau + 4 } = x _ { C \tau + 4 } , } } \\ { { . . . } } \\ { { x _ { C ( \tau + 1 ) + 1 } = \hat { x } _ { C ( \tau + 1 ) + 1 } = x _ { C ( \tau + 1 ) } . } } \end{array}
399
+ $$
400
+
401
+ Then, following Equation (9) we have
402
+
403
+ $$
404
+ x _ { C ( \tau + 1 ) + 1 } - x _ { C \tau + 1 } \geq \frac { \kappa } { \sqrt { \tau + 1 } } .
405
+ $$
406
+
407
+ Similarly, we can subsequently obtain
408
+
409
+ $$
410
+ x _ { C ( \tau + 2 ) + 1 } - x _ { C ( \tau + 1 ) + 1 } \geq \frac { \kappa } { \sqrt { \tau + 2 } } ,
411
+ $$
412
+
413
+ and generally
414
+
415
+ $$
416
+ x _ { C ( t + 1 ) + 1 } - x _ { C t + 1 } \geq \frac { \kappa } { \sqrt { t + 1 } }
417
+ $$
418
+
419
+ for all $t \geq \tau$ . Therefore,
420
+
421
+ $$
422
+ \begin{array} { l } { \displaystyle x _ { C t + 1 } \geq x _ { C \tau + 1 } + \frac \kappa { \sqrt { \tau + 1 } } + \frac \kappa { \sqrt { \tau + 2 } } + \cdot \cdot \cdot + \frac \kappa { \sqrt { t } } } \\ { \displaystyle \geq - 1 + \kappa \sum _ { n = \tau + 1 } ^ { t } \frac 1 { \sqrt { n } } } \\ { \displaystyle \geq - 1 + \kappa \int _ { \tau + 1 } ^ { t + 1 } \frac { \mathrm d x } { \sqrt { x } } } \\ { \displaystyle = - 1 + 2 \kappa ( \sqrt { t + 1 } - \sqrt { \tau + 1 } ) } \end{array}
423
+ $$
424
+
425
+ for $t \geq \tau$ . Let $t ^ { \prime }$ be such that $2 \kappa ( \sqrt { t ^ { \prime } + 1 } - \sqrt { \tau + 1 } ) \geq 1$ , then $x _ { C t ^ { \prime } + 1 } \geq 0$ . This contradicts the assumption that $x _ { C t + 1 } < 0$ for all $t \geq \tau$ . We complete the proof of this lemma.
426
+
427
+ We now return to the proof of Theorem 1. The following analysis focuses on iterations after $C t ^ { \prime } + 1$ such that $x _ { C t ^ { \prime } + 1 } \geq 0$ . Note that any regret before $C t ^ { \prime } + 1$ is just a constant since $t ^ { \prime }$ is independent of $T$ and thus, the average regret is negligible as $T \to \infty$ .
428
+
429
+ Our claim is that, $x _ { k } \geq 0$ for all $k \in \mathbb N$ , $k \geq C t ^ { \prime } + 1$ . To prove this, we resort to the principle of mathematical induction. Suppose for some $t \in \mathbb { N }$ , $t \geq t ^ { \prime }$ , we have $x _ { C t + 1 } \geq 0$ . Our aim is to prove that $x _ { i } \geq 0$ for all $i \in \mathbb { N } \cap [ C t + 2 , C ( t + 1 ) + 1 ]$ .
430
+
431
+ From the $( C t + 1 )$ -th update of ADAM in Equation (2), we obtain:
432
+
433
+ $$
434
+ \hat { x } _ { C t + 2 } = x _ { C t + 1 } + \frac { \alpha } { \sqrt { C t + 1 } } \frac { 1 } { \sqrt { v _ { C t + 1 } } } \geq 0 .
435
+ $$
436
+
437
+ We consider the following two cases:
438
+
439
+ 1. Suppose $\hat { x } _ { C t + 2 } ~ > ~ 1$ , then $x _ { C t + 2 } = \Pi _ { \mathcal { F } } ( \hat { x } _ { C t + 2 } ) = \operatorname* { m i n } \{ \hat { x } _ { C t + 2 } , 1 \} = 1$ (note that in one-dimension, $\Pi _ { \mathcal { F } , \sqrt { V _ { t } } } = \Pi _ { \mathcal { F } }$ is the simple Euclidean projection). After the $( C t + 2 )$ -th update, we have:
440
+
441
+ $$
442
+ \begin{array} { l } { \hat { x } _ { C t + 3 } = x _ { C t + 2 } - \displaystyle \frac { \alpha } { \sqrt { C t + 2 } } \displaystyle \frac { 2 } { \sqrt { v _ { C t + 2 } } } } \\ { \geq 1 - \displaystyle \frac { \alpha } { \sqrt { C t + 2 } } \displaystyle \frac { 2 } { \sqrt { ( 1 - \beta _ { 2 } ) ( 4 + \beta _ { 2 } ) } } \geq 0 . } \end{array}
443
+ $$
444
+
445
+ The last inequality follows from Equation (5). The first inequality follows from
446
+
447
+ $$
448
+ v _ { C t + 2 } = ( 1 - \beta _ { 2 } ) ( \sum _ { i = 0 } ^ { t } \beta _ { 2 } ^ { C i + 1 } + 4 \sum _ { i = 0 } ^ { t } \beta _ { 2 } ^ { C i } ) \geq ( 1 - \beta _ { 2 } ) ( 4 + \beta _ { 2 } ) .
449
+ $$
450
+
451
+ 2. Suppose $\hat { x } _ { C t + 2 } \leq 1$ , then after the $( C t + 2 )$ -th update, similar to Equation (9), we have:
452
+
453
+ $$
454
+ \hat { x } _ { C t + 3 } \geq x _ { C t + 1 } + \frac { \kappa } { \sqrt { t + 1 } } \geq 0 .
455
+ $$
456
+
457
+ In both cases, $\hat { x } _ { C t + 3 } \geq 0$ , which translates to $x _ { C t + 3 } = \hat { x } _ { C t + 3 } \geq 0$ . Furthermore, since gradients $\nabla f _ { i } ( x ) = 0$ when $i$ mod $C \neq 1$ or 2, we have
458
+
459
+ $$
460
+ \begin{array} { l } { x _ { C t + 4 } = \hat { x } _ { C t + 3 } = x _ { C t + 3 } \geq 0 , } \\ { x _ { C t + 5 } = \hat { x } _ { C t + 4 } = x _ { C t + 4 } \geq 0 , } \\ { ~ . ~ . ~ } \end{array}
461
+ $$
462
+
463
+ $$
464
+ x _ { C ( t + 1 ) + 1 } = \hat { x } _ { C ( t + 1 ) + 1 } = x _ { C ( t + 1 ) } \geq 0 .
465
+ $$
466
+
467
+ Therefore, given $x _ { C t ^ { \prime } + 1 } = 0$ , it holds for all $k \in \mathbb { N } , k \geq C t ^ { \prime } + 1$ by the principle of mathematical induction. Thus, we have
468
+
469
+ $$
470
+ \sum _ { i = 1 } ^ { C } f _ { k C + i } ( x _ { k C + i } ) - \sum _ { i = 1 } ^ { C } f _ { k C + i } ( - 1 ) \geq 0 - ( - 1 ) = 1 ,
471
+ $$
472
+
473
+ where $k \in \mathbb N$ , $k \geq t ^ { \prime }$ . Therefore, when $t \geq t ^ { \prime }$ , for every $C$ steps, ADAM suffers a regret of at least 1.
474
+ More specifically, $R _ { T } \geq ( T - t ^ { \prime } ) / C$ . Thus, $R _ { T } / T \not \to 0$ as $T \to \infty$ , which completes the proof.
475
+
476
+ # C PROOF OF THEOREM 2
477
+
478
+ Theorem 2 generalizes the optimization setting used in Theorem 1. We notice that the example proposed by Reddi et al. (2018) in their Appendix B already satisfies the constraints listed in Theorem 2. Here we provide the setting of the example for completeness.
479
+
480
+ Proof. Consider the setting where $f _ { t }$ are linear functions and $\mathcal { F } = [ - 1 , 1 ]$ . In particular, we define the following function sequence:
481
+
482
+ $$
483
+ f _ { t } ( x ) = { \left\{ \begin{array} { l l } { C x , { \mathrm { f o r ~ } } t { \mathrm { ~ m o d ~ } } C = 1 ; } \\ { - x , { \mathrm { ~ o t h e r w i s e , } } } \end{array} \right. }
484
+ $$
485
+
486
+ where $C \in \mathbb { N }$ , $C$ mod $2 = 0$ satisfies the following:
487
+
488
+ $$
489
+ \begin{array} { r l r } & { } & { \left( 1 - \beta _ { 1 } \right) \beta _ { 1 } ^ { C - 1 } C \le 1 - \beta _ { 1 } ^ { C - 1 } , } \\ & { } & { \beta _ { 2 } ^ { ( C - 2 ) / 2 } C ^ { 2 } \le 1 , } \\ & { } & { \displaystyle \frac { 3 \left( 1 - \beta _ { 1 } \right) } { 2 \sqrt { 1 - \beta _ { 2 } } } \left( 1 + \frac { \gamma \left( 1 - \gamma ^ { C - 1 } \right) } { 1 - \gamma } \right) + \frac { \beta _ { 1 } ^ { C / 2 - 1 } } { 1 - \beta _ { 1 } } < \frac { C } { 3 } , } \end{array}
490
+ $$
491
+
492
+ where $\gamma = \beta _ { 1 } / \sqrt { \beta _ { 2 } } < 1$ . It is not hard to see that these conditions hold for large constant $C$ that depends on $\beta _ { 1 }$ and $\beta _ { 2 }$ . According to the proof given by Reddi et al. (2018) in their Appendix B, in such a setting $R _ { T } / T \not \to 0$ as $T \to \infty$ , which completes the proof.
493
+
494
+ # D PROOF OF THEOREM 3
495
+
496
+ The example proposed by Reddi et al. (2018) in their Appendix C already satisfies the constraints listed in Theorem 3. Here we provide the setting of the example for completeness.
497
+
498
+ Proof. Let $\delta$ be an arbitrary small positive constant. Consider the following one dimensional stochastic optimization setting over the domain $[ - 1 , 1 ]$ . At each time step $t$ , the function $f _ { t } ( x )$ is chosen as follows:
499
+
500
+ $$
501
+ f _ { t } ( x ) = \left\{ \begin{array} { l l } { C x , \mathrm { w i t h } \mathrm { p r o b a b i l i t y } p : = \frac { 1 + \delta } { C + 1 } } \\ { - x , \mathrm { w i t h } \mathrm { p r o b a b i l i t y } 1 - p , } \end{array} \right.
502
+ $$
503
+
504
+ where $C$ is a large constant that depends on $\beta _ { 1 }$ , $\beta _ { 2 }$ and $\delta$ . The expected function is $F ( x ) = \delta x$ . Thus the optimal point over $[ - 1 , 1 ]$ is $x ^ { * } = - 1$ . The step taken by ADAM is
505
+
506
+ $$
507
+ \Delta _ { t } = \frac { - \alpha _ { t } \left( \beta _ { 1 } m _ { t - 1 } + \left( 1 - \beta _ { 1 } \right) g _ { t } \right) } { \sqrt { \beta _ { 2 } v _ { t - 1 } + \left( 1 - \beta _ { 2 } \right) g _ { t } ^ { 2 } } } .
508
+ $$
509
+
510
+ According to the proof given by Reddi et al. (2018) in their Appendix $\textrm { C }$ , there exists a large enough $C$ such that $\mathbb { E } [ \Delta _ { t } ] \geq 0$ , which then implies that the ADAM’s step keep drifting away from the optimal solution $x ^ { * } = - 1$ . Note that there is no limitation of the initial step size $\alpha$ by now. Therefore, we complete the proof.
511
+
512
+ # E PROOF OF THEOREM 4
513
+
514
+ Proof. Let $\begin{array} { r } { x ^ { * } = \arg \operatorname* { m i n } _ { x \in \mathcal { F } } \sum _ { t = 1 } ^ { T } f _ { t } ( x ) } \end{array}$ , which exists since $\mathcal { F }$ is closed and convex. We begin with the following observation:
515
+
516
+ $$
517
+ x _ { t + 1 } = \Pi _ { \mathcal { F } , \mathrm { d i a g } ( \eta _ { t } ^ { - 1 } ) } \big ( x _ { t } - \eta _ { t } \odot m _ { t } \big ) = \operatorname* { m i n } _ { x \in \mathcal { F } } \| \eta _ { t } ^ { - 1 / 2 } \odot \big ( x - \big ( x _ { t } - \eta _ { t } \odot m _ { t } \big ) \big ) \| .
518
+ $$
519
+
520
+ Using Lemma 1 with $u _ { 1 } = x _ { t + 1 }$ and $u _ { 2 } = x ^ { * }$ , we have the following:
521
+
522
+ $$
523
+ \begin{array} { r l } & { \| \eta _ { t } ^ { - 1 / 2 } \odot ( x _ { t + 1 } - x ^ { * } ) \| ^ { 2 } \le \| \eta _ { t } ^ { - 1 / 2 } \odot ( x _ { t } - \eta _ { t } \odot m _ { t } - x ^ { * } ) \| ^ { 2 } } \\ & { \qquad = \| \eta _ { t } ^ { - 1 / 2 } \odot ( x _ { t } - x ^ { * } ) \| ^ { 2 } + \| \eta _ { t } ^ { 1 / 2 } \odot m _ { t } \| ^ { 2 } - 2 \langle m _ { t } , x _ { t } - x ^ { * } \rangle } \\ & { \qquad = \| \eta _ { t } ^ { - 1 / 2 } \odot ( x _ { t } - x ^ { * } ) \| ^ { 2 } + \| \eta _ { t } ^ { 1 / 2 } \odot m _ { t } \| ^ { 2 } } \\ & { \qquad - 2 \langle \beta _ { 1 t } m _ { t - 1 } + ( 1 - \beta _ { 1 t } ) g _ { t } , x _ { t } - x ^ { * } \rangle . } \end{array}
524
+ $$
525
+
526
+ Rearranging the above inequality, we have
527
+
528
+ $$
529
+ \begin{array} { l } { \displaystyle \langle g _ { t } , x _ { t } - x ^ { * } \rangle \leq \frac { 1 } { 2 ( 1 - \beta _ { 1 t } ) } \bigg [ \| \eta _ { t } ^ { - 1 / 2 } \odot ( x _ { t } - x ^ { * } ) \| ^ { 2 } - \| \eta _ { t } ^ { - 1 / 2 } \odot ( x _ { t + 1 } - x ^ { * } ) \| ^ { 2 } \bigg ] } \\ { \displaystyle \qquad + \frac { 1 } { 2 ( 1 - \beta _ { 1 t } ) } \| \eta _ { t } ^ { 1 / 2 } \odot m _ { t } \| ^ { 2 } + \frac { \beta _ { 1 t } } { 1 - \beta _ { 1 t } } \langle m _ { t - 1 } , x _ { t } - x ^ { * } \rangle } \\ { \displaystyle \qquad \leq \frac { 1 } { 2 ( 1 - \beta _ { 1 t } ) } \bigg [ \| \eta _ { t } ^ { - 1 / 2 } \odot ( x _ { t } - x ^ { * } ) \| ^ { 2 } - \| \eta _ { t } ^ { - 1 / 2 } \odot ( x _ { t + 1 } - x ^ { * } ) \| ^ { 2 } \bigg ] } \\ { \displaystyle \qquad + \frac { 1 } { 2 ( 1 - \beta _ { 1 t } ) } \| \eta _ { t } ^ { 1 / 2 } \odot m _ { t } \| ^ { 2 } + \frac { \beta _ { 1 t } } { 2 ( 1 - \beta _ { 1 t } ) } \| \eta _ { t } ^ { 1 / 2 } \odot m _ { t - 1 } \| ^ { 2 } } \\ { \displaystyle \qquad + \frac { \beta _ { 1 t } } { 2 ( 1 - \beta _ { 1 t } ) } \| \eta _ { t } ^ { - 1 / 2 } \odot ( x _ { t } - x ^ { * } ) \| ^ { 2 } . } \end{array}
530
+ $$
531
+
532
+ The second inequality follows from simple application of Cauchy–Schwarz and Young’s inequality. We now use the standard approach of bounding the regret at each step using convexity of the functions $\{ f _ { t } \} _ { t = 1 } ^ { T }$ in the following manner:
533
+
534
+ $$
535
+ \begin{array} { r l } & { \displaystyle \sum _ { t = 1 } ^ { T } f _ { t } \left( x _ { t } \right) - f _ { t } \left( x ^ { * } \right) \leq \sum _ { t = 1 } ^ { T } \langle g _ { t } , x _ { t } - x ^ { * } \rangle } \\ & { \leq \displaystyle \sum _ { t = 1 } ^ { T } \left[ \frac { 1 } { 2 ( 1 - \beta _ { 1 t } ) } \left[ \| \eta _ { t } ^ { - 1 / 2 } \odot ( x _ { t } - x ^ { * } ) \| ^ { 2 } - \| \eta _ { t } ^ { - 1 / 2 } \odot ( x _ { t + 1 } - x ^ { * } ) \| ^ { 2 } \right] \right. } \\ & { \quad \quad + \left. \frac { 1 } { 2 ( 1 - \beta _ { 1 t } ) } \| \eta _ { t } ^ { 1 / 2 } \odot m _ { t } \| ^ { 2 } + \frac { \beta _ { 1 t } } { 2 ( 1 - \beta _ { 1 t } ) } \| \eta _ { t } ^ { 1 / 2 } \odot m _ { t - 1 } \| ^ { 2 } \right. } \\ & { \quad \quad \left. + \frac { \beta _ { 1 t } } { 2 ( 1 - \beta _ { 1 t } ) } \| \eta _ { t } ^ { - 1 / 2 } \odot ( x _ { t } - x ^ { * } ) \| ^ { 2 } \right] . } \end{array}
536
+ $$
537
+
538
+ The first inequality is due to the convexity of functions $\{ f _ { t } \} _ { t = 1 } ^ { T }$ . The second inequality follows from the bound in Equation (10). For further bounding this inequality, we need the following intermedia result.
539
+
540
+ Lemma 4. For the parameter settings and conditions assumed in Theorem 4, we have
541
+
542
+ $$
543
+ \sum _ { t = 1 } ^ { T } \bigg [ \frac { 1 } { 2 ( 1 - \beta _ { 1 t } ) } \| \eta _ { t } ^ { 1 / 2 } \odot m _ { t } \| ^ { 2 } + \frac { \beta _ { 1 t } } { 2 ( 1 - \beta _ { 1 t } ) } \| \eta _ { t } ^ { 1 / 2 } \odot m _ { t - 1 } \| ^ { 2 } \bigg ] \le ( 2 \sqrt { T } - 1 ) \frac { R _ { \infty } G _ { 2 } ^ { 2 } } { 1 - \beta _ { 1 } } .
544
+ $$
545
+
546
+ Proof. By definition of $\eta _ { t }$ , we have
547
+
548
+ $$
549
+ L _ { \infty } \leq \sqrt t \| \eta _ { t } \| _ { \infty } \leq R _ { \infty } .
550
+ $$
551
+
552
+ Hence,
553
+
554
+ $$
555
+ \begin{array} { r l } & { \frac { 1 } { \Delta x } = \frac { \sqrt { 2 } } { \frac { \pi } { 1 + \sqrt { 2 } \pi \sqrt { 3 } } } \left[ \frac { 1 } { \frac { \sqrt { 2 } } { \pi } \frac { \sqrt { 3 } } { 1 + \sqrt { 2 } \pi \sqrt { 3 } } } \frac { \sin 2 \pi \sqrt { 3 } } { \sin \pi } \frac { \sin 2 \pi \sqrt { 3 } } { \sin \pi } \frac { \sin 2 \pi \sqrt { 3 } } { \sin \pi } \right] } \\ & { \le \frac { \sqrt { 2 } } { \pi } \left[ \frac { \sqrt { 2 } } { 1 + \sqrt { 2 } \pi \sqrt { 3 } } \frac { \sin 2 \pi \sqrt { 3 } } { \sin \pi } \frac { \sin 2 \pi \sqrt { 3 } } { \sin \pi } \frac { \sin 2 \pi \sqrt { 3 } } { \sin \pi } \frac { \sin 2 \pi \sqrt { 3 } } { \sin \pi } \frac { \sin 2 \pi \sqrt { 3 } } { \sin \pi } \right] } \\ & { \le \frac { \sqrt { 2 } } { \pi } \left[ \frac { \sqrt { 2 } } { \pi } \frac { \sqrt { 3 } } { 1 + \sqrt { 2 } \pi \sqrt { 3 } } \frac { \sin 2 \pi \sqrt { 3 } } { \sin \pi } \frac { \sin 2 \pi \sqrt { 3 } } { \sin \pi } \frac { \sin 2 \pi \sqrt { 3 } } { \sin \pi } \frac { \sin 2 \pi \sqrt { 3 } } { \sin \pi } \frac { \sin 2 \pi \sqrt { 3 } } { \sin \pi } \right] } \\ & { - \frac { \sqrt { 2 } } { \pi } \frac { \sqrt { 3 } } { \pi } \left[ \frac { \sqrt { 2 } } { \pi } \frac { \sin 2 \pi \sqrt { 3 } } { 1 + \sqrt { 2 } \pi \sqrt { 3 } } \frac { \sin 2 \pi \sqrt { 3 } } { \sin \pi } \right] ^ { \frac { \sin 2 } { \pi } } } \\ & { \le \frac { \sqrt { 2 } } { \pi } \frac { \sqrt { 3 } } { 1 + \sqrt { 2 } \pi \sqrt { 3 } } \left[ \frac { \sqrt { 2 } } { \pi } \frac { \sin 2 \pi \sqrt { 3 } } { \sin \pi } \frac { \sin 2 \pi \sqrt { 3 } } { \pi } \right] } \\ & \le \frac { \sqrt { 2 } } { \pi } \frac { \sqrt { 3 } } { \pi } \frac { \sqrt { 3 } } { \pi } \frac { \sqrt { 2 } } { \pi } \frac { \sin 2 \pi \sqrt { 3 } } { \pi } \frac \sqrt { 2 } \end{array}
556
+ $$
557
+
558
+ The second inequality is due to $\beta _ { 1 t } \le \beta _ { 1 } < 1$ . The third inequality follows from Jensen inequality and the fourth inequality follows from Cauchy–Schwarz inequality. The fifth inequality follows from Lemma 2 and $m _ { 0 } = 0$ . The last inequality is due to the following upper bound:
559
+
560
+ $$
561
+ \sum _ { t = 1 } ^ { T } { \frac { 1 } { \sqrt { t } } } \leq 1 + \int _ { t = 1 } ^ { T } { \frac { \mathrm { d } t } { \sqrt { t } } } = 2 { \sqrt { T } } - 1 .
562
+ $$
563
+
564
+ We complete the proof of this lemma.
565
+
566
+ We now return to the proof of Theorem 4. Using the above lemma in Equation (11), we have
567
+
568
+ $$
569
+ \begin{array} { r l } & { \frac { \lambda } { \mu } \int _ { 0 } ^ { \infty } \hat { \rho } ( \mathbf { x } ) - \hat { \rho } ( \mathbf { x } ) e ^ { - \mathbf { x } } \hat { \rho } ( \mathbf { x } ) } \\ & { \quad + \frac { \lambda } { \mu } ( \sum _ { i = 1 } ^ { N } \frac { \hat { \rho } _ { i } } { \rho _ { i } } [ \frac { 1 } { 2 } \hat { \rho } _ { i } ( \hat { \rho } _ { i } ^ { - 1 } \otimes ^ { - 1 } ( \mathbf { x } - \mathbf { x } ^ { * } ) ) ^ { 2 } - | \mathbf { x } | ^ { 2 } ^ { - 1 } \otimes ^ { - 1 } \otimes ^ { - 1 } ( \rho ) \otimes ( \rho _ { i } \otimes \rho _ { i - 1 } - \mathbf { x } ^ { * } ) | \mathbf { x } | ] ) } \\ & { \quad - \frac { \lambda } { \mu } ( \sum _ { i = 1 } ^ { N } \frac { \hat { \rho } _ { i } } { \rho _ { i } } [ \frac { 1 } { 2 } \hat { \rho } _ { i } ( \hat { \rho } _ { i } ^ { - 1 } \otimes ^ { - 1 } ( \mathbf { x } - \mathbf { x } ^ { * } ) ) ^ { 2 } ] ) e ^ { - \mathbf { x } } ( \hat { \rho } _ { i } ^ { - 1 } \otimes ^ { - 1 } ( \rho ) \hat { \rho } _ { i } ( \mathbf { x } - \mathbf { x } ^ { * } ) ) } \\ & { \quad - \frac { \lambda } { \mu } ( \hat { \rho } _ { i } ^ { - 1 } \otimes ^ { - 1 } ( \rho ) \otimes ( \rho _ { i } \otimes \rho _ { i } - \rho _ { i } ^ { * } ) ) \mathbb { I } ) + \hat { \rho } ( \overline { { \mathbf { x } } } ^ { - 1 } ) \frac { \hat { \rho } _ { i } } { \rho _ { i } } [ \hat { \rho } _ { i } ^ { - 1 } \otimes ^ { - 1 } ( \rho ) \otimes ( \rho _ { i } - \rho _ { i } ^ { * } ) ] } \\ & \quad \leq \frac { \lambda } { 2 ( 1 - \delta ) } [ \mathbf { x } ^ { * } ] ^ { \rho } ( \mathbf { x } ^ { - 1 } \otimes ^ { - 1 } ( \mathbf { x } ^ { * } ) ^ { 2 } + \sum _ { i = 1 } ^ { N } [ \ \end{array}
570
+ $$
571
+
572
+ The second inequality use the fact that $\beta _ { 1 t } \le \beta _ { 1 } < 1$ . In order to further simplify the bound in Equation (12), we need to use telescopic sum. We observe that, by definition of $\eta _ { t }$ , we have
573
+
574
+ $$
575
+ \eta _ { t , i } ^ { - 1 } \geq \eta _ { t - 1 , i } ^ { - 1 } .
576
+ $$
577
+
578
+ Using the $D _ { \infty }$ bound on the feasible region and making use of the above property in Equation (12), we have
579
+
580
+ $$
581
+ \begin{array} { r l } & { \displaystyle \sum _ { t = 1 } ^ { T } f _ { t } \left( x _ { t } \right) - f _ { t } \left( x ^ { * } \right) } \\ & { \le \frac { D _ { \infty } ^ { 2 } } { 2 ( 1 - \beta _ { 1 } ) } \left[ \displaystyle \sum _ { i = 1 } ^ { d } \eta _ { 1 , i } ^ { - 1 } + \displaystyle \sum _ { t = 2 } ^ { T } \sum _ { i = 1 } ^ { d } \left[ \eta _ { t , i } ^ { - 1 } - \eta _ { t - 1 , i } ^ { - 1 } \right] + \displaystyle \sum _ { t = 1 } ^ { T } \sum _ { i = 1 } ^ { d } \beta _ { 1 t } \eta _ { t , i } ^ { - 1 } \right] + ( 2 \sqrt { T } - 1 ) \frac { R _ { \infty } G _ { 2 } ^ { 2 } } { 1 - \beta _ { 1 } } } \\ & { = \frac { D _ { \infty } ^ { 2 } \sqrt { T } } { 2 ( 1 - \beta _ { 1 } ) } \displaystyle \sum _ { i = 1 } ^ { d } \hat { \eta } _ { T , i } ^ { - 1 } + \frac { D _ { \infty } ^ { 2 } } { 2 ( 1 - \beta _ { 1 } ) } \displaystyle \sum _ { t = 1 } ^ { T } \sum _ { i = 1 } ^ { d } \beta _ { 1 t } \eta _ { t , i } ^ { - 1 } + ( 2 \sqrt { T } - 1 ) \frac { R _ { \infty } G _ { 2 } ^ { 2 } } { 1 - \beta _ { 1 } } . } \end{array}
582
+ $$
583
+
584
+ The equality follows from simple telescopic sum, which yields the desired result. It is easy to see√ that the regret of ADABOUND is upper bounded by $O ( \sqrt { T } )$ .
585
+
586
+ # F AMSBOUND
587
+
588
+ Theorem 5. Let $\{ x _ { t } \}$ and √ $\{ v _ { t } \}$ be the sequences obtained from Algorithm $^ 3$ , $\beta _ { 1 } = \beta _ { 1 1 }$ , $\beta _ { 1 t } \le \beta _ { 1 }$ for all $t \in [ T ]$ and $\beta _ { 1 } / \sqrt { \beta _ { 2 } } < 1$ . Suppose $\eta _ { l } ( t + 1 ) \geq \eta _ { l } ( t ) > 0$ , $\eta _ { u } ( t + 1 ) \leq \eta _ { u } ( t )$ , $\eta _ { l } ( t ) \alpha ^ { * }$ as $t \to \infty$ , $\mathsf { \bar { \eta } } _ { u } \mathsf { ( } t ) \to \mathsf { \bar { \alpha } } ^ { * }$ as $t \to \infty$ , $L _ { \infty } = \eta _ { l } ( 1 )$ and $R _ { \infty } = \eta _ { u } ( 1 )$ . Assume that $\| x - y \| _ { \infty } \leq D _ { \infty }$ for all $x , y \in { \mathcal { F } }$ and $\lVert \nabla f _ { t } ( x ) \rVert \leq G _ { 2 }$ for all $t \in [ T ]$ and $x \in { \mathcal { F } }$ . For $x _ { t }$ generated using the ADABOUND algorithm, we have the following bound on the regret
589
+
590
+ $$
591
+ R _ { T } \le \frac { D _ { \infty } ^ { 2 } \sqrt { T } } { 2 ( 1 - \beta _ { 1 } ) } \sum _ { i = 1 } ^ { d } \eta _ { T , i } ^ { - 1 } + \frac { D _ { \infty } ^ { 2 } } { 2 ( 1 - \beta _ { 1 } ) } \sum _ { t = 1 } ^ { T } \sum _ { i = 1 } ^ { d } \beta _ { 1 t } \eta _ { t , i } ^ { - 1 } + ( 2 \sqrt { T } - 1 ) \frac { R _ { \infty } G _ { 2 } ^ { 2 } } { 1 - \beta _ { 1 } } .
592
+ $$
593
+
594
+ # Algorithm 3 AMSBOUND
595
+
596
+ Input: $x _ { 1 } \in { \mathcal { F } }$ , initial step size $\alpha$ , $\{ \beta _ { 1 t } \} _ { t = 1 } ^ { T }$ , $\beta _ { 2 }$ , lower bound function $\eta _ { l }$ , upper bound function $\eta _ { u }$
597
+ 1: Set $m _ { 0 } = 0$ , $v _ { 0 } = 0$ and $\hat { v } _ { 0 } = 0$
598
+ 2: for $t = 1$ to $T$ do
599
+ 3: $g _ { t } = \nabla f _ { t } ( x _ { t } )$
600
+ 4: $m _ { t } = \beta _ { 1 t } m _ { t - 1 } + ( 1 - \beta _ { 1 t } ) g _ { t }$
601
+ 5: $v _ { t } = \beta _ { 2 } v _ { t - 1 } + ( 1 - \beta _ { 2 } ) g _ { t } ^ { 2 }$
602
+ 6: $\hat { v } _ { t } = \operatorname* { m a x } ( \hat { v } _ { t - 1 } , v _ { t } )$ and $\bar { V } _ { t } = \mathrm { d i a g } ( \hat { v } _ { t } )$
603
+ 7: $\eta = \mathrm { C l i p } ( \alpha / \sqrt { V _ { t } } , \eta _ { l } ( t ) , \eta _ { u } ( t ) )$ and $\eta _ { t } = \eta / \sqrt { t }$
604
+ 8: $x _ { t + 1 } = \Pi _ { { \mathcal { F } } , \mathrm { d i a g } ( \eta _ { t } ^ { - 1 } ) } ( x _ { t } - \eta _ { t } \odot m _ { t } )$
605
+ 9: end for
606
+
607
+ The regret of AMSBOUND has the same upper bound with that of ADABOUND.3
608
+
609
+ # G EMPIRICAL STUDY ON BOUND FUNCTIONS
610
+
611
+ Here we provide an empirical study on different kinds of bound functions. We consider the following two key factors of the bound function: convergence speed and convergence target. The former one affects how “fast” our algorithms transform from adaptive methods to SGD(M), while the latter one reflects the final step size of SGD(M). In particular, we consider the following bound functions:
612
+
613
+ $$
614
+ \begin{array} { c } { \displaystyle \eta _ { l } ( t ) = ( 1 - \frac { 1 } { ( 1 - \beta ) t + 1 } ) \alpha ^ { * } , } \\ { \displaystyle \eta _ { u } ( t ) = ( 1 + \frac { 1 } { ( 1 - \beta ) t } ) \alpha ^ { * } , } \end{array}
615
+ $$
616
+
617
+ where the above functions will converge to $\alpha ^ { * }$ and the larger $\beta$ results in lower convergence speed.
618
+
619
+ ![](images/fd913405154d3d6fea87de5736ea4f9c5327650983df6026600d6d603412a4d4.jpg)
620
+ Figure 5: Test accuracy of ADABOUND with different $\beta$ using ResNet-34 on CIFAR-10.
621
+
622
+ We first investigate the impact of convergence speed. We conduct an experiment of ADABOUND on CIFAR-10 dataset with the ResNet-34 model, where $\beta$ is chosen in $\{ 1 ^ { \dot { \mathbf { \theta } } } - \textstyle { \frac { 1 } { 1 0 } } , 1 - \textstyle { \frac { 1 } { 5 0 } } , 1 - \textstyle { \frac { 1 } { 1 0 0 } } , 1 -$ $\textstyle { \frac { 1 } { 5 0 0 } } , 1 - { \frac { 1 } { 1 0 0 0 } } \}$ and $\alpha ^ { * }$ is chosen from $\{ 1 , 0 . 1 \}$ . The results are shown in Figure 5. We can see that for a specific $\alpha ^ { * }$ , the performances with different $\beta$ are almost the same . It indicates that the convergence speed of bound functions does not affect the final result to some extent. We find a $\beta$ in $[ \beta _ { 1 } , \beta _ { 2 } ]$ usually contributes to a strong performance across all models.
623
+
624
+ Next, we investigate the impact of convergence target and the results are displayed in Figure 6. We test SGDM and ADABOUND with different $\alpha$ (or $\alpha ^ { * }$ ) with the ResNet-34 model, where $\alpha$ (or $\alpha ^ { * }$ ) is chosen in $\{ 1 , 0 . 1 , 0 . 0 3 , 0 . 0 1 , 0 . 0 0 3 , 0 . 0 0 1 \}$ and $\beta = 0 . 9 9$ . The results show that SGDM is very sensitive to the hyperparameter. The best value of the step size for SGDM is 0.1 and it has large performance gaps compared with other settings. In contrast, ADABOUND has stable performance in different final step sizes, which illustrates that it is not sensitive to the convergence target.
625
+
626
+ ![](images/a8f943f1d111c9d1a19bedd4725a87c23b8411ee849aed06f7c4e5c2a1976add.jpg)
627
+ Figure 6: Test accuracy of SGDM/ADABOUND with different $\alpha / \alpha ^ { * }$ using ResNet-34 on CIFAR-10. The result of SGDM with $\alpha = 1$ is not shown above as its performance is too poor (lower than $7 0 \%$ to be plotted together with other results in a single figure.
628
+
629
+ ![](images/8cd9086262f7c281d311d620718da0c67bf67164b5b9b78d7dabaee4070624c8.jpg)
630
+ Figure 7: Comparison of test accuracy between SGDM and ADABOUND with different $\alpha / \alpha ^ { * }$ .
631
+
632
+ We further directly compare the performance between SGDM and ADABOUND with each $\alpha$ (or $\alpha ^ { * }$ ). The results are shown in Figure 7. We can see that ADABOUND outperforms SGDM for all the step sizes. Since the form of bound functions has minor impact on the performance of ADABOUND, it is likely to beat SGDM even without carefully tuning the hyperparameters.
633
+
634
+ To summarize, the form of bound functions does not much influence the final performance of the methods. In other words, ADABOUND is not sensitive to its hyperparameters. Moreover, it can achieve a higher or similar performance to SGDM even if it is not carefully fine-tuned. Therefore, we can expect a better performance by using ADABOUND regardless of the choice of bound functions.
635
+
636
+ # H EMPIRICAL STUDY ON THE EVOLUTION OF LEARNING RATES OVER TIME
637
+
638
+ Here we provide an empirical study on the evolution of learning rates of ADABOUND over time. We conduct an experiment using ResNet-34 model on CIFAR-10 dataset with the same settings in Section 5. We randomly choose two layers in the network. For each layer, the learning rates of its parameters are recorded at each time step. We pick the min/median/max values of the learning rates in each layer and plot them against epochs in Figure 8.
639
+
640
+ We can see that the learning rates increase rapidly in the early stage of training, then after a few epochs its max/median values gradually decrease over time, and finally converge to the final step size. The increasing at the beginning is due to the property of the exponential moving average of $\phi _ { t }$ of ADAM, while the gradually decreasing indicates the transition from ADAM to SGD.
641
+
642
+ ![](images/9fd8543c4d8ab97a00033e4a7fea352d4350e597f50cff932891e619995bb13a.jpg)
643
+ Figure 8: The evolution of learning rates over time in two randomly chosen layers.
md/train/Bkg6RiCqY7/Bkg6RiCqY7.md ADDED
@@ -0,0 +1,342 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # DECOUPLED WEIGHT DECAY REGULARIZATION
2
+
3
+ Ilya Loshchilov & Frank Hutter
4
+
5
+ University of Freiburg
6
+ Freiburg, Germany,
7
+ ilya.loshchilov@gmail.com, fh@cs.uni-freiburg.de
8
+
9
+ # ABSTRACT
10
+
11
+ $\mathrm { L _ { 2 } }$ regularization and weight decay regularization are equivalent for standard stochastic gradient descent (when rescaled by the learning rate), but as we demonstrate this is not the case for adaptive gradient algorithms, such as Adam. While common implementations of these algorithms employ $\mathrm { L _ { 2 } }$ regularization (often calling it “weight decay” in what may be misleading due to the inequivalence we expose), we propose a simple modification to recover the original formulation of weight decay regularization by decoupling the weight decay from the optimization steps taken w.r.t. the loss function. We provide empirical evidence that our proposed modification (i) decouples the optimal choice of weight decay factor from the setting of the learning rate for both standard SGD and Adam and (ii) substantially improves Adam’s generalization performance, allowing it to compete with SGD with momentum on image classification datasets (on which it was previously typically outperformed by the latter). Our proposed decoupled weight decay has already been adopted by many researchers, and the community has implemented it in TensorFlow and PyTorch; the complete source code for our experiments is available at https://github.com/loshchil/AdamW-and-SGDW
12
+
13
+ # 1 INTRODUCTION
14
+
15
+ Adaptive gradient methods, such as AdaGrad (Duchi et al., 2011), RMSProp (Tieleman & Hinton, 2012), Adam (Kingma & Ba, 2014) and most recently AMSGrad (Reddi et al., 2018) have become a default method of choice for training feed-forward and recurrent neural networks (Xu et al., 2015; Radford et al., 2015). Nevertheless, state-of-the-art results for popular image classification datasets, such as CIFAR-10 and CIFAR-100 Krizhevsky (2009), are still obtained by applying SGD with momentum (Gastaldi, 2017; Cubuk et al., 2018). Furthermore, Wilson et al. (2017) suggested that adaptive gradient methods do not generalize as well as SGD with momentum when tested on a diverse set of deep learning tasks, such as image classification, character-level language modeling and constituency parsing. Different hypotheses about the origins of this worse generalization have been investigated, such as the presence of sharp local minima (Keskar et al., 2016; Dinh et al., 2017) and inherent problems of adaptive gradient methods (Wilson et al., 2017). In this paper, we investigate whether it is better to use $\mathrm { L _ { 2 } }$ regularization or weight decay regularization to train deep neural networks with SGD and Adam. We show that a major factor of the poor generalization of the most popular adaptive gradient method, Adam, is due to the fact that $\mathrm { L _ { 2 } }$ regularization is not nearly as effective for it as for SGD. Specifically, our analysis of Adam leads to the following observations:
16
+
17
+ $\mathbf { L } _ { 2 }$ regularization and weight decay are not identical. Contrary to a belief which seems popular among some practitioners, the two techniques are not equivalent. For SGD, they can be made equivalent by a reparameterization of the weight decay factor based on the learning rate; this is not the case for Adam. In particular, when combined with adaptive gradients, $\mathrm { L _ { 2 } }$ regularization leads to weights with large parameter and/or gradient amplitudes being regularized less than they would be when using weight decay.
18
+
19
+ $\mathbf { L } _ { 2 }$ regularization is not effective in Adam. One possible explanation why Adam and other adaptive gradient methods might be outperformed by SGD with momentum is that common deep learning libraries only implement $\mathrm { L _ { 2 } }$ regularization, not the original weight decay. Therefore, on tasks/datasets where the use of $\mathrm { L _ { 2 } }$ regularization is beneficial for SGD (e.g., on many popular image classification datasets), Adam leads to worse results than SGD with momentum (for which $\mathrm { L _ { 2 } }$ regularization behaves as expected).
20
+
21
+ Weight decay is equally effective in both SGD and Adam. For SGD, it is equivalent to $\mathrm { L _ { 2 } }$ regularization, while for Adam it is not.
22
+
23
+ Optimal weight decay depends on the total number of batch passes/weight updates. Our empirical analysis of SGD and Adam suggests that the larger the runtime/number of batch passes to be performed, the smaller the optimal weight decay. This effect tends to be neglected because hyperparameters are often tuned for a fixed number of training epochs. As a result, the values of the weight decay found to perform best for short runs do not generalize to much longer runs.
24
+
25
+ The main contribution of this paper is to improve regularization in Adam by decoupling the weight decay from the gradient-based update. In a comprehensive analysis, we show that Adam generalizes substantially better with decoupled weight decay than with $\mathrm { L _ { 2 } }$ regularization, achieving $15 \%$ relative improvement in test error (see Figures 2 and 3); this holds true for various image recognition datasets (CIFAR-10 and ImageNet32x32), training budgets (ranging from 100 to 1800 epochs), and learning rate schedules (fixed, drop-step, and cosine annealing; see Figure 1). We demonstrate that our decoupled weight decay renders the optimal settings of the learning rate and the weight decay factor much more independent, thereby easing hyperparameter optimization (see Figure 2).
26
+
27
+ The main motivation of this paper is to improve Adam to make it competitive w.r.t. SGD with momentum even for those problems where it did not use to be competitive. We hope that as a result, practitioners do not need to switch between Adam and SGD anymore, which in turn should reduce the common issue of selecting dataset/task-specific training algorithms and their hyperparameters.
28
+
29
+ 2 DECOUPLING THE WEIGHT DECAY FROM THE GRADIENT-BASED UPDATE
30
+
31
+ In the weight decay described by Hanson & Pratt (1988), the weights $\pmb \theta$ decay exponentially as
32
+
33
+ $$
34
+ \pmb { \theta } _ { t + 1 } = ( 1 - \lambda ) \pmb { \theta } _ { t } - \alpha \nabla f _ { t } ( \pmb { \theta } _ { t } ) ,
35
+ $$
36
+
37
+ where $\lambda$ defines the rate of the weight decay per step and $\nabla f _ { t } ( \pmb { \theta } _ { t } )$ is the $t$ -th batch gradient to be multiplied by a learning rate $\alpha$ . For standard SGD, it is equivalent to standard $\mathrm { L _ { 2 } }$ regularization:
38
+
39
+ Proposition 1 (Weight decay ${ \bf \tau } = { \bf L } _ { 2 }$ reg for standard SGD). Standard SGD with base learning rate $\alpha$ executes the same steps on batch loss functions $f _ { t } ( \pmb \theta )$ with weight decay $\lambda$ (defined in Equation $I$ ) as it executes without weight decay on $\begin{array} { r } { f _ { t } ^ { r e g } ( { \pmb { \theta } } ) = f _ { t } ( { \pmb { \theta } } ) + \frac { \lambda ^ { \prime } } { 2 } \left\| { \pmb { \theta } } \right\| _ { 2 } ^ { 2 } } \end{array}$ , with $\begin{array} { r } { \lambda ^ { \prime } = \frac { \lambda } { \alpha } } \end{array}$ .
40
+
41
+ The proofs of this well-known fact, as well as our other propositions, are given in the Appendix A.
42
+
43
+ Due to this equivalence, $\mathrm { L _ { 2 } }$ regularization is very frequently referred to as weight decay, including in popular deep learning libraries. However, as we will demonstrate later in this section, this equivalence does not hold for adaptive gradient methods. One fact that is often overlooked already for the simple case of SGD is that in order for the equivalence to hold, the $\mathrm { L _ { 2 } }$ regularizer $\lambda ^ { \prime }$ has to be set to $\frac { \lambda } { \underset { \mathbf { x } } { \alpha } }$ , i.e., if there ie learning rate n overall best weight decay value . In order to decouple the effects $\lambda$ , the best value of these two hyperp $\lambda ^ { \prime }$ is tightly coupled withmeters, we advocate to $\alpha$ decouple the weight decay step as proposed by Hanson & Pratt (1988) (Equation 1).
44
+
45
+ Looking first at the case of SGD, we propose to decay the weights simultaneously with the update of $\theta _ { t }$ based on gradient information in Line 9 of Algorithm 1. This yields our proposed variant of SGD with momentum using decoupled weight decay (SGDW). This simple modification explicitly decouples $\lambda$ and $\alpha$ (although some problem-dependent implicit coupling may of course remain as for any two hyperparameters). In order to account for a possible scheduling of both $\alpha$ and $\lambda$ , we introduce a scaling factor $\eta _ { t }$ delivered by a user-defined procedure SetScheduleMultiplier $( t )$ .
46
+
47
+ Now, let’s turn to adaptive gradient algorithms like the popular optimizer Adam Kingma & Ba (2014), which scale gradients by their historic magnitudes. Intuitively, when Adam is run on a loss function $f$ plus $\mathrm { L _ { 2 } }$ regularization, weights that tend to have large gradients in $f$ do not get regularized as much as they would with decoupled weight decay, since the gradient of the regularizer gets scaled along with the gradient of $f$ . This leads to an inequivalence of $\mathrm { L _ { 2 } }$ and decoupled weight decay regularization for adaptive gradient algorithms:
48
+
49
+ <table><tr><td>Algorithm 1 SGD with L2 regularization</td><td></td><td>SGD with decoupled weight decay (SGDW) both</td></tr><tr><td>with momentum</td><td colspan="2"></td></tr></table>
50
+
51
+ 1: given initial learning rate $\alpha \in \mathbb { R }$ , momentum factor $\beta _ { 1 } \in \mathbb { R }$ , weight decay/L2 regularization factor $\overline { { \lambda \in \mathbb { R } } }$
52
+ 2: initialize time step $t 0$ , parameter vector $\pmb { \theta } _ { t = 0 } ~ \in ~ \mathbb { R } ^ { n }$ , first moment vector $\pmb { m } _ { t = 0 } \gets \pmb { \theta }$ , schedule
53
+ multiplier $\eta _ { t = 0 } \in \mathbb { R }$
54
+ 3: repeat
55
+ 4: $t \gets t + 1$
56
+ 5: $\nabla f _ { t } \big ( \pmb { \theta } _ { t - 1 } \big ) \gets \mathrm { S e l e c t B a t c h } \big ( \pmb { \theta } _ { t - 1 } \big )$ . select batch and return the corresponding gradient
57
+ 6: $\pmb { g } _ { t } \gets \nabla f _ { t } ( \pmb { \theta } _ { t - 1 } ) \ + \lambda \pmb { \theta } _ { t - 1 }$
58
+ 7: ηt ← SetScheduleMultiplier(t) . can be fixed, decay, be used for warm restarts
59
+ 8: ${ \pmb { m } } _ { t } \gets \beta _ { 1 } { \pmb { m } } _ { t - 1 } + \eta _ { t } \alpha { \pmb { g } } _ { t }$
60
+ 9: $\pmb { \theta } _ { t } \gets \pmb { \theta } _ { t - 1 } - \pmb { m } _ { t } - \eta _ { t } \lambda \pmb { \theta } _ { t - 1 }$
61
+ 10: until stopping criterion is met
62
+ 11: return optimized parameters ${ \pmb \theta } _ { t }$
63
+ 1: given $\alpha = 0 . 0 0 1 , \beta _ { 1 } = 0 . 9 , \beta _ { 2 } = 0 . 9 9 9 , \epsilon = 1 0 ^ { - 8 } , \lambda \in \mathbb { R }$
64
+ 2: initialize time step $t \gets 0$ , parameter vector $\pmb { \theta } _ { t = 0 } \in \mathbb { R } ^ { n }$ , first moment vector $\pmb { m } _ { t = 0 } \pmb { \theta }$ , second moment
65
+ vector $\pmb { \nu } _ { t = 0 } \pmb { \theta }$ , schedule multiplier $\eta _ { t = 0 } \in \mathbb { R }$
66
+ 3: repeat
67
+ 4: $t \gets t + 1$
68
+ 5: $\nabla f _ { t } ( { \mathbf { \dot { \theta } } } _ { t - 1 } ^ { \phantom { \dagger } } ) \gets \mathrm { S e l e c t B a t c h } ( { \mathbf { \theta } } _ { t - 1 } )$ . select batch and return the corresponding gradient
69
+ 6: $\pmb { \mathscr { g } } _ { t } \gets \nabla f _ { t } ( \pmb { \theta } _ { t - 1 } ) \ + \lambda \pmb { \theta } _ { t - 1 }$
70
+ 7: $\pmb { m } _ { t } \gets \beta _ { 1 } \pmb { m } _ { t - 1 } + ( 1 - \beta _ { 1 } ) \pmb { g } _ { t }$ . here and below all operations are element-wise
71
+ 8: $\pmb { \nu } _ { t } \gets \beta _ { 2 } \pmb { \nu } _ { t - 1 } + ( 1 - \beta _ { 2 } ) \pmb { g } _ { t } ^ { 2 }$
72
+ 9: $\hat { { \pmb { m } } } _ { t } \gets { \pmb { m } } _ { t } / ( 1 - \beta _ { 1 } ^ { t } )$ . $\beta _ { 1 }$ is taken to the power of $t$
73
+ 10: ˆvt ← vt/(1 − βt2) . $\beta _ { 2 }$ is taken to the power of $t$
74
+ 11: $\eta _ { t } \gets$ SetScheduleMultiplier(t) . can be fixed, decay, or also be used for warm restarts
75
+ 12: θt ← θt−1 − ηt αmˆ t/( ˆvt + ) +λθt−1
76
+ 13: until stopping criterion is met
77
+
78
+ <table><tr><td>Algorithm 2 Adam with L2 regularization</td><td>and</td></tr></table>
79
+
80
+ 14: return optimized parameters ${ \pmb \theta } _ { t }$
81
+
82
+ Proposition 2 (Weight decay $\neq \mathrm { L } _ { 2 }$ reg for adaptive gradients). Let $O$ denote an optimizer that has iterates $\pmb { \theta } _ { t + 1 } \pmb { \theta } _ { t } - \alpha \mathbf { M } _ { t } \nabla f _ { t } ( \pmb { \theta } _ { t } )$ when run on batch loss function $f _ { t } ( \pmb \theta )$ without weight decay, and $\pmb { \theta } _ { t + 1 } \gets ( 1 - \lambda ) \pmb { \theta } _ { t } - \alpha \mathbf { M } _ { t } \nabla f _ { t } ( \pmb { \theta } _ { t } )$ when run on $f _ { t } ( \pmb \theta )$ with weight decay, respectively, with $\mathbf { M } _ { t } \neq k \mathbf { I }$ (where $k \in \mathbb { R } ,$ ). Then, for $O$ there exists no $L _ { 2 }$ coefficient $\lambda ^ { \prime }$ such that running $O$ on batch loss $\begin{array} { r } { f _ { t } ^ { r e g } ( { \pmb \theta } ) = f _ { t } ( { \pmb \theta } ) + \frac { \lambda ^ { \prime } } { 2 } \left. { \pmb \theta } \right. _ { 2 } ^ { 2 } } \end{array}$ without weight decay is equivalent to running $O$ on $f _ { t } ( \pmb \theta )$ with decay $\lambda \in \mathbb { R } ^ { + }$ .
83
+
84
+ We decouple weight decay and loss-based gradient updates in Adam as shown in line 12 of Algorithm 2; this gives rise to our variant of Adam with decoupled weight decay (AdamW).
85
+
86
+ Having shown that $\mathrm { L _ { 2 } }$ regularization and weight decay regularization differ for adaptive gradient algorithms raises the question of how they differ and how to interpret their effects. Their equivalence for standard SGD remains very helpful for intuition: both mechanisms push weights closer to zero, at the same rate. However, for adaptive gradient algorithms they differ: with $\mathrm { L _ { 2 } }$ regularization, the sums of the gradient of the loss function and the gradient of the regularizer (i.e., the $\mathrm { L _ { 2 } }$ norm of the weights) are adapted, whereas with weight decay, only the gradients of the loss function are adapted (with the weight decay step separated from the adaptive gradient mechanism). With $\mathrm { L _ { 2 } }$ regularization both types of gradients are normalized by their typical (summed) magnitudes, and therefore weights $x$ with large typical gradient magnitude $s$ are regularized by a smaller relative amount than other weights. In contrast, weight decay regularizes all weights with the same rate $\lambda$ , effectively regularizing weights $x$ with large $s$ more than standard $\mathrm { L _ { 2 } }$ regularization does. We demonstrate this formally for a simple special case of adaptive gradient algorithm with a fixed preconditioner:
87
+
88
+ Proposition 3 (Weight decay $=$ scale-adjusted $L _ { 2 }$ reg for adaptive gradient algorithm with fixed preconditioner). Let $O$ denote an algorithm with the same characteristics as in Proposition 2, and using a fixed preconditioner matrix ${ \bf \bar { \cal M } } _ { t } = d i a g ( s ) ^ { - 1 }$ (with $s _ { i } > 0$ for all $i _ { , }$ ). Then, $O$ with base learning rate $\alpha$ executes the same steps on batch loss functions $f _ { t } ( \pmb \theta )$ with weight decay $\lambda$ as it executes without weight decay on the scale-adjusted regularized batch loss
89
+
90
+ $$
91
+ f _ { t } ^ { s r e g } ( \pmb { \theta } ) = f _ { t } ( \pmb { \theta } ) + \frac { \lambda ^ { \prime } } { 2 \alpha } \left\| \pmb { \theta } \odot \sqrt { \pmb { s } } \right\| _ { 2 } ^ { 2 } ,
92
+ $$
93
+
94
+ where $\odot$ and $\sqrt { \cdot }$ denote element-wise multiplication and square root, respectively, and $\begin{array} { r } { \lambda ^ { \prime } = \frac { \lambda } { \alpha } } \end{array}$
95
+
96
+ # 3 JUSTIFICATION OF DECOUPLED WEIGHT DECAY VIA A VIEW OF ADAPTIVE GRADIENT METHODS AS BAYESIAN FILTERING
97
+
98
+ We now discuss a justification of decoupled weight decay in the framework of Bayesian filtering for a unified theory of adaptive gradient algorithms due to Aitchison (2018). After we posted a preliminary version of our current paper on arXiv, Aitchison noted that his theory “gives us a theoretical framework in which we can understand the superiority of this weight decay over $L _ { 2 }$ regularization, because it is weight decay, rather than $L _ { 2 }$ regularization that emerges through the straightforward application of Bayesian filtering.”(Aitchison, 2018). While full credit for this theory goes to Aitchison, we summarize it here to shed some light on why weight decay may be favored over $L _ { 2 }$ regularization.
99
+
100
+ Aitchison (2018) views stochastic optimization of $n$ parameters $x _ { 1 } , \ldots , x _ { n }$ as a Bayesian filtering problem with the goal of inferring a distribution over the optimal values of each of the parameters $x _ { i }$ given the current values of the other parameters $\pmb \theta _ { - i } ( t )$ at time step $t$ . When the other parameters do not change this is an optimization problem, but when they do change it becomes one of “tracking” the optimizer using Bayesian filtering as follows. One is given a probability distribution $\bar { P ( \pmb \theta _ { t } ) } \ |$ $y _ { 1 : t } )$ of the optimizer at time step $t$ that takes into account the data $\scriptstyle { \boldsymbol { y } } _ { 1 : t }$ from the first $t$ mini batches, a state transition prior $P ( \pmb \theta _ { t + 1 } \mid \pmb \theta _ { t } )$ reflecting a (small) data-independent change in this distribution from one step to the next, and a likelihood $\mathbf { \bar { \ u } } _ { P ( \pmb { y } _ { t + 1 } \mid \mathbf { \theta } _ { t + 1 } ) }$ derived from the mini batch at step $t + 1$ . The posterior distribution $P ( \pmb { \theta } _ { t + 1 } \mid \mathbf { y } _ { 1 : t + 1 } )$ of the optimizer at time step $t + 1$ can then be computed (as usual in Bayesian filtering) by marginalizing over $\theta _ { t }$ to obtain the onestep ahead predictions $P ( \pmb { \theta } _ { t + 1 } \mid \pmb { y } _ { 1 : t } )$ and then applying Bayes’ rule to incorporate the likelihood $\textstyle P ( \mathbf { \bar { y } } _ { t + 1 } \mid \theta _ { t + 1 } )$ . Aitchison (2018) assumes a Gaussian state transition distribution $P ( \pmb \theta _ { t + 1 } \mid \pmb \theta _ { t } )$ and an approximate conjugate likelihood $\textstyle P ( \pmb { y } _ { t + 1 } \mid \pmb { \theta } _ { t + 1 } )$ , leading to the following closed-form update of the filtering distribution’s mean:
101
+
102
+ $$
103
+ \begin{array} { r } { \pmb { \mu } _ { p o s t } = \pmb { \mu } _ { p r i o r } + \pmb { \Sigma } _ { p o s t } \times \pmb { g } , } \end{array}
104
+ $$
105
+
106
+ where $\textbf { { g } }$ is the gradient of the log likelihood of the mini batch at time $t$ . This result implies a preconditioner of the gradients that is given by the posterior uncertainty $\Sigma _ { p o s t }$ of the filtering distribution: updates are larger for parameters we are more uncertain about and smaller for parameters we are more certain about. Aitchison (2018) goes on to show that popular adaptive gradient methods, such as Adam and RMSprop, as well as Kronecker-factorized methods are special cases of this framework.
107
+
108
+ Decoupled weight decay very naturally fits into this unified framework can express weight decay as part of the state-transition distribution: Aitchison (2018) assumes a slow change of the optimizer according to the following Gaussian:
109
+
110
+ $$
111
+ P ( \pmb \theta _ { t + 1 } \mid \pmb \theta _ { t } ) = N ( ( \pmb I - \pmb A ) \pmb \theta _ { t } , \pmb Q ) ,
112
+ $$
113
+
114
+ where $Q$ is the covariance of Gaussian perturbations of the weights, and $\pmb { A }$ is a regularizer to avoid values growing unboundedly over time. When instantiated as $A = \lambda \times I$ , this regularizer $\pmb { A }$ plays exactly the role of decoupled weight decay as described in Equation 1, since this leads to multiplying the current mean estimate $\theta _ { t }$ by $( 1 - \lambda )$ at each step. Notably, this regularization is also directly applied to the prior and does not depend on the uncertainty in each of the parameters (which would be required for $L _ { 2 }$ regularization).
115
+
116
+ ![](images/cdc01f838cc870b7893f2bd8b1b4fdadd1d0ed078db65ddff2d8aef49b319780.jpg)
117
+ Figure 1: Adam performs better with decoupled weight decay (bottom row, AdamW) than with $L _ { 2 }$ regularization (top row, Adam). We show the final test error of a $2 6 ~ 2 \mathrm { x } 6 4 \mathrm { d }$ ResNet on CIFAR-10 after 100 epochs of training with fixed learning rate (left column), step-drop learning rate (with drops at epoch indexes 30, 60 and 80, middle column) and cosine annealing (right column). AdamW leads to a more separable hyperparameter search space, especially when a learning rate schedule, such as step-drop and cosine annealing is applied. Cosine annealing yields clearly superior results.
118
+
119
+ # 4 EXPERIMENTAL VALIDATION
120
+
121
+ We now evaluate the performance of decoupled weight decay under various training budgets and learning rate schedules. Our experimental setup follows that of Gastaldi (2017), who proposed, in addition to $\mathrm { L _ { 2 } }$ regularization, to apply the new Shake-Shake regularization to a 3-branch residual DNN that allowed to achieve new state-of-the-art results of $2 . 8 6 \%$ on the CIFAR-10 dataset (Krizhevsky, 2009). We always used a batch size of 128. The regular data augmentation procedure used for the CIFAR datasets was applied. We used the same model/source code based on fb.resnet.torch 1. The base networks are a $2 6 ~ 2 \mathrm { x } 6 4 \mathrm { d }$ ResNet (i.e. the network has a depth of 26, 2 residual branches and the first residual block has a width of 64) and a $2 6 2 \mathrm { x } 9 6 \mathrm { d }$ ResNet with $1 1 . 6 \mathbf { M }$ and $2 5 . 6 \mathbf { M }$ parameters, respectively. For a detailed description of the network and the Shake-Shake method, we refer the interested reader to Gastaldi (2017). We also perform experiments on the ImageNet32x32 dataset (Chrabaszcz et al., 2017), a downsampled version of the original ImageNet dataset with 1.2 million $3 2 \times 3 2$ pixels images.
122
+
123
+ # 4.1 EVALUATING DECOUPLED WEIGHT DECAY WITH DIFFERENT LEARNING RATE SCHEDULES
124
+
125
+ In our first experiment, we compare Adam with $L _ { 2 }$ regularization to Adam with decoupled weight decay (AdamW), using three different learning rate schedules: a fixed learning rate, a drop-step schedule, and a cosine annealing schedule (Loshchilov & Hutter, 2016). For each learning rate schedule and weight decay variant, we trained a 2x64d ResNet for 100 epochs, using different settings of the initial learning rate $\alpha$ and the weight decay factor $\lambda$ . Figure 1 shows that decoupled weight decay outperforms $L _ { 2 }$ regularization for all learning rate schedules, with larger differences for better learning rate schedules. We also note that decoupled weight decay leads to a more separable hyperparameter search space, especially when a learning rate schedule, such as step-drop and cosine annealing is applied. The figure also shows that cosine annealing clearly outperforms the other learning rate schedules; we thus used cosine annealing for the remainder of the experiments.
126
+
127
+ ![](images/912ae7b475cea2253f76582036e0793936fecf71a117beab28917bbc8e28d712.jpg)
128
+ Figure 2: The Top-1 test error of a 26 2x64d ResNet on CIFAR-10 measured after 100 epochs. The proposed SGDW and AdamW (right column) have a more separable hyperparameter space.
129
+
130
+ ![](images/ebfc9d3556d4d95c8aaba3765fe521f34e36b21c331fc769c98b81b49d5fe39f.jpg)
131
+ Figure 3: Learning curves (top row) and generalization results (bottom row) obtained by a 26 $2 \mathrm { x } 9 6 \mathrm { d }$ ResNet trained with Adam and AdamW on CIFAR-10. See text for details. SuppFigure 4 in the Appendix shows the same qualitative results for ImageNet $3 2 \mathbf { x } 3 2$ .
132
+
133
+ 4.2 DECOUPLING THE WEIGHT DECAY AND INITIAL LEARNING RATE PARAMETERS
134
+
135
+ In order to verify our hypothesis about the coupling of $\alpha$ and $\lambda$ , in Figure 2 we compare the performance of $\mathrm { L _ { 2 } }$ regularization vs. decoupled weight decay in SGD (SGD vs. SGDW, top row) and in Adam (Adam vs. AdamW, bottom row). In SGD (Figure 2, top left), $\mathrm { L _ { 2 } }$ regularization is not decoupled from the learning rate (the common way as described in Algorithm 1), and the figure clearly shows that the basin of best hyperparameter settings (depicted by color and top-10 hyperparameter settings by black circles) is not aligned with the $\mathbf { X }$ -axis or y-axis but lies on the diagonal. This suggests that the two hyperparameters are interdependent and need to be changed simultaneously, while only changing one of them might substantially worsen results. Consider, e.g., the setting at the top left black circle $( \alpha = 1 / 2$ , $\lambda \overset { - } { = } 1 / 8 * 0 . 0 0 1 )$ ; only changing either $\alpha$ or $\lambda$ by itself would worsen results, while changing both of them could still yield clear improvements. We note that this coupling of initial learning rate and $\mathrm { L _ { 2 } }$ regularization factor might have contributed to SGD’s reputation of being very sensitive to its hyperparameter settings.
136
+
137
+ In contrast, the results for SGD with decoupled weight decay (SGDW) in Figure 2 (top right) show that weight decay and initial learning rate are decoupled. The proposed approach renders the two hyperparameters more separable: even if the learning rate is not well tuned yet (e.g., consider the value of 1/1024 in Figure 2, top right), leaving it fixed and only optimizing the weight decay factor would yield a good value (of $1 / 4 ^ { * } 0 . 0 0 1$ ). This is not the case for SGD with $\mathrm { L _ { 2 } }$ regularization (see Figure 2, top left).
138
+
139
+ The results for Adam with $\mathrm { L _ { 2 } }$ regularization are given in Figure 2 (bottom left). Adam’s best hyperparameter settings performed clearly worse than SGD’s best ones (compare Figure 2, top left). While both methods used $\mathrm { L _ { 2 } }$ regularization, Adam did not benefit from it at all: its best results obtained for non-zero $\mathrm { L _ { 2 } }$ regularization factors were comparable to the best ones obtained without the $\mathrm { L _ { 2 } }$ regularization, i.e., when $\lambda = 0$ . Similarly to the original SGD, the shape of the hyperparameter landscape suggests that the two hyperparameters are coupled.
140
+
141
+ In contrast, the results for our new variant of Adam with decoupled weight decay (AdamW) in Figure 2 (bottom right) show that AdamW largely decouples weight decay and learning rate. The results for the best hyperparameter settings were substantially better than the best ones of Adam with $\mathrm { L _ { 2 } }$ regularization and rivaled those of SGD and SGDW.
142
+
143
+ In summary, the results in Figure 2 support our hypothesis that the weight decay and learning rate hyperparameters can be decoupled, and that this in turn simplifies the problem of hyperparameter tuning in SGD and improves Adam’s performance to be competitive w.r.t. SGD with momentum.
144
+
145
+ # 4.3 BETTER GENERALIZATION OF ADAMW
146
+
147
+ While the previous experiment suggested that the basin of optimal hyperparameters of AdamW is broader and deeper than the one of Adam, we next investigated the results for much longer runs of 1800 epochs to compare the generalization capabilities of AdamW and Adam.
148
+
149
+ We fixed the initial learning rate to 0.001 which represents both the default learning rate for Adam and the one which showed reasonably good results in our experiments. Figure 3 shows the results for 12 settings of the $\mathrm { L _ { 2 } }$ regularization of Adam and 7 settings of the normalized weight decay of AdamW (the normalized weight decay represents a rescaling formally defined in the Appendix B.1, it amounts to a multiplicative factor which depends on the number of bath passes). Interestingly, while the dynamics of the learning curves of Adam and AdamW often coincided for the first half of the training run, AdamW often led to lower training loss and test errors (see Figure 3 top left and top right, respectively). Importantly, the use of weight decay in Adam did not yield as good results as in AdamW (see also Figure 3, bottom left). Next, we investigated whether AdamW’s better results were only due to better convergence or due to better generalization. The results in Figure 3 (bottom right) for the best settings of Adam and AdamW suggest that AdamW did not only yield better training loss but also yielded better generalization performance for similar training loss values. The results on ImageNet32x32 (see SuppFigure 4 in the Appendix) lead to the same conclusion of substantially improved generalization performance.
150
+
151
+ ![](images/601a579961d1f5b8ba84aa32ca7fd5710ad12c354741ccbf24164731e477145b.jpg)
152
+ Figure 4: Top-1 test error on CIFAR-10 (left) and Top-5 test error on ImageNet32x32 (right). For a better resolution and with training loss curves, see SuppFigure 5 and SuppFigure 6 in the supplementary material.
153
+
154
+ # 4.4 ADAMWR WITH WARM RESTARTS FOR BETTER ANYTIME PERFORMANCE
155
+
156
+ In order to improve anytime performance of SGDW and AdamW we extended them with warm restarts of (Loshchilov & Hutter, 2016) to obtain SGDWR and AdamWR, respectively (see section B.2 in the Appendix). As Figure 4 shows, AdamWR greatly sped up AdamW on CIFAR-10 and ImageNet32x32, up to a factor of 10 (see the results at the first restart). For the default learning rate of 0.001, AdamW achieved $1 5 \%$ relative improvement in test errors compared to Adam both on CIFAR-10 (also see Figure 3) and ImageNet $3 2 x 3 2$ (also see SuppFigure 5). AdamWR achieved the same improved results but with a much better anytime performance. These improvements closed most of the gap between Adam and SGDWR on CIFAR-10 and yielded comparable performance on ImageNet32x32.
157
+
158
+ # 4.5 USE OF ADAMW ON OTHER DATASETS AND ARCHITECTURES
159
+
160
+ Several other research groups have already successfully applied AdamW in citable works. For example, Wang et al. (2018) used AdamW to train a novel architecture for face detection on the standard WIDER FACE dataset (Yang et al., 2016), obtaining almost 10x faster predictions than the previous state of the art algorithms while achieving comparable performance. Volker et al. (2018) employed ¨ AdamW with cosine annealing to train convolutional neural networks to classify and characterize error-related brain signals measured from intracranial electroencephalography (EEG) recordings. While their paper does not provide a comparison to Adam, they kindly provided us with a direct comparison of the two on their best-performing problem-specific network architecture Deep4Net and a variant of ResNet. AdamW with the same hyperparameter setting as Adam yielded higher test set accuracy on Deep4Net $7 3 . 6 8 \%$ versus $7 1 . 3 7 \%$ ) and statistically significantly higher test set accuracy on ResNet $( 7 2 . 0 4 \%$ versus $6 1 . 3 4 \%$ . Radford et al. (2018) employed AdamW to train Transformer (Vaswani et al., 2017) architectures to obtain new state-of-the-art results on a wide range of benchmarks for natural language understanding. Zhang et al. (2018) compared $\mathrm { L _ { 2 } }$ regularization vs. weight decay for SGD, Adam and the Kronecker-Factored Approximate Curvature (K-FAC) optimizer (Martens & Grosse, 2015) on the CIFAR datasets with ResNet and VGG architectures, reporting that decoupled weight decay consistently outperformed $\mathrm { L _ { 2 } }$ regularization in cases where they differ.
161
+
162
+ # 5 CONCLUSION AND FUTURE WORK
163
+
164
+ Following suggestions that adaptive gradient methods such as Adam might lead to worse generalization than SGD with momentum (Wilson et al., 2017), we identified and exposed the inequivalence of $\mathrm { L _ { 2 } }$ regularization and weight decay for Adam. We empirically showed that our version of Adam with decoupled weight decay yields substantially better generalization performance than the common implementation of Adam with $\mathrm { L _ { 2 } }$ regularization. We also proposed to use warm restarts for Adam to improve its anytime performance.
165
+
166
+ Our results obtained on image classification datasets must be verified on a wider range of tasks, especially ones where the use of regularization is expected to be important. It would be interesting to integrate our findings on weight decay into other methods which attempt to improve Adam, e.g, normalized direction-preserving Adam (Zhang et al., 2017). While we focused our experimental analysis on Adam, we believe that similar results also hold for other adaptive gradient methods, such as AdaGrad (Duchi et al., 2011) and AMSGrad (Reddi et al., 2018).
167
+
168
+ # 6 ACKNOWLEDGMENTS
169
+
170
+ This work was supported by the European Research Council (ERC) under the European Union’s Horizon 2020 research and innovation programme under grant no. 716721, by the German Research Foundation (DFG), under the BrainLinksBrainTools Cluster of Excellence (grant number EXC 1086) and through grant no. INST 37/935-1 FUGG, and by the German state of BadenWurttemberg through bwHPC. We thank Patryk Chrabaszcz for helping running experiments with ¨ ImageNet32x32. We thank Matthias Feurer and Robin Schirrmeister for providing valuable feedback on this paper in several iterations. We thank Martin Volker, Robin Schirrmeister, and Tonio ¨ Ball for providing us with a comparison of AdamW and Adam on their EEG data.
171
+
172
+ Finally, we thank the following members of the deep learning community for implementing decoupled weight decay in various deep learning libraries:
173
+
174
+ • Jingwei Zhang, Lei Tai, Robin Schirrmeister, and Kashif Rasul for their implementations in PyTorch (see https://github.com/pytorch/pytorch/pull/4429)
175
+ • Phil Jund for his implementation in TensorFlow described at https://www.tensorflow.org/api_docs/python/tf/contrib/opt/ DecoupledWeightDecayExtension Sylvain Gugger, Anand Saha, Jeremy Howard and other members of fast.ai for their implementation available at https://github.com/sgugger/Adam-experiments Guillaume Lambard for his implementation in Keras available at https://github. com/GLambard/AdamW_Keras
176
+ • Yagami Lin for his implementation in Caffe available at https://github.com/ Yagami123/Caffe-AdamW-AdamWR
177
+
178
+ # REFERENCES
179
+
180
+ Laurence Aitchison. A unified theory of adaptive stochastic gradient descent as Bayesian filtering. arXiv:1507.02030, 2018.
181
+
182
+ Patryk Chrabaszcz, Ilya Loshchilov, and Frank Hutter. A downsampled variant of ImageNet as an alternative to the CIFAR datasets. arXiv:1707.08819, 2017.
183
+
184
+ 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.
185
+
186
+ Laurent Dinh, Razvan Pascanu, Samy Bengio, and Yoshua Bengio. Sharp minima can generalize for deep nets. arXiv:1703.04933, 2017.
187
+
188
+ John Duchi, Elad Hazan, and Yoram Singer. Adaptive subgradient methods for online learning and stochastic optimization. The Journal of Machine Learning Research, 12:2121–2159, 2011.
189
+
190
+ Xavier Gastaldi. Shake-Shake regularization. arXiv preprint arXiv:1705.07485, 2017.
191
+
192
+ Stephen Jose Hanson and Lorien Y Pratt. Comparing biases for minimal network construction with ´ back-propagation. In Proceedings of the 1st International Conference on Neural Information Processing Systems, pp. 177–185, 1988.
193
+
194
+ Gao Huang, Yixuan Li, Geoff Pleiss, Zhuang Liu, John E Hopcroft, and Kilian Q Weinberger. Snapshot ensembles: Train 1, get m for free. arXiv:1704.00109, 2017.
195
+
196
+ 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. arXiv:1609.04836, 2016.
197
+
198
+ Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv:1412.6980, 2014.
199
+
200
+ Alex Krizhevsky. Learning multiple layers of features from tiny images. 2009.
201
+
202
+ Hao Li, Zheng Xu, Gavin Taylor, and Tom Goldstein. Visualizing the loss landscape of neural nets. arXiv preprint arXiv:1712.09913, 2017.
203
+
204
+ Ilya Loshchilov and Frank Hutter. SGDR: stochastic gradient descent with warm restarts. arXiv:1608.03983, 2016.
205
+
206
+ James Martens and Roger Grosse. Optimizing neural networks with kronecker-factored approximate curvature. In International conference on machine learning, pp. 2408–2417, 2015.
207
+
208
+ Alec Radford, Luke Metz, and Soumith Chintala. Unsupervised representation learning with deep convolutional generative adversarial networks. arXiv:1511.06434, 2015.
209
+
210
+ Alec Radford, Karthik Narasimhan, Tim Salimans, and Ilya Sutskever. Improving language understanding by generative pre-training. URL https://s3-us-west-2. amazonaws. com/openaiassets/research-covers/language-unsupervised/language understanding paper. pdf, 2018.
211
+
212
+ Sashank J. Reddi, Satyen Kale, and Sanjiv Kumar. On the convergence of adam and beyond. Inter national Conference on Learning Representations, 2018.
213
+
214
+ Leslie N Smith. Cyclical learning rates for training neural networks. arXiv:1506.01186v3, 2016.
215
+
216
+ Tijmen Tieleman and Geoffrey Hinton. Lecture 6.5-rmsprop: Divide the gradient by a running average of its recent magnitude. COURSERA: Neural networks for machine learning, 4(2):26– 31, 2012.
217
+
218
+ Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. In Advances in Neural Information Processing Systems, pp. 5998–6008, 2017.
219
+
220
+ Martin Volker, Ji ¨ ˇr´ı Hammer, Robin T Schirrmeister, Joos Behncke, Lukas DJ Fiederer, Andreas Schulze-Bonhage, Petr Marusic, Wolfram Burgard, and Tonio Ball. Intracranial error detection ˇ via deep learning. arXiv preprint arXiv:1805.01667, 2018.
221
+
222
+ Jianfeng Wang, Ye Yuan, Gang Yu, and Sun Jian. Sface: An efficient network for face detection in large scale variations. arXiv preprint arXiv:1804.06559, 2018.
223
+
224
+ Ashia C Wilson, Rebecca Roelofs, Mitchell Stern, Nathan Srebro, and Benjamin Recht. The marginal value of adaptive gradient methods in machine learning. arXiv:1705.08292, 2017.
225
+
226
+ Kelvin Xu, Jimmy Ba, Ryan Kiros, Kyunghyun Cho, Aaron Courville, Ruslan Salakhudinov, Rich Zemel, and Yoshua Bengio. Show, attend and tell: Neural image caption generation with visual attention. In International Conference on Machine Learning, pp. 2048–2057, 2015.
227
+
228
+ Shuo Yang, Ping Luo, Chen-Change Loy, and Xiaoou Tang. Wider face: A face detection benchmark. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 5525–5533, 2016.
229
+
230
+ Guodong Zhang, Chaoqi Wang, Bowen Xu, and Roger Grosse. Three mechanisms of weight decay regularization. arXiv preprint arXiv:1810.12281, 2018.
231
+
232
+ Zijun Zhang, Lin Ma, Zongpeng Li, and Chuan Wu. Normalized direction-preserving adam. arXiv:1709.04546, 2017.
233
+
234
+ Barret Zoph, Vijay Vasudevan, Jonathon Shlens, and Quoc V. Le. Learning transferable architectures for scalable image recognition. In arXiv:1707.07012 [cs.CV], 2017.
235
+
236
+ # Appendix
237
+
238
+ A FORMAL ANALYSIS OF WEIGHT DECAY VS $\mathrm { L _ { 2 } }$ REGULARIZATION
239
+
240
+ # Proof of Proposition 1
241
+
242
+ The proof for this well-known fact is straight-forward. SGD without weight decay has the following iterates on $\begin{array} { r } { f _ { t } ^ { \mathrm { r e g } } ( { \pmb \theta } ) = f _ { t } ( { \pmb \theta } ) + \frac { \lambda ^ { \prime } } { 2 } \left\| { \pmb \theta } \right\| _ { 2 } ^ { 2 } } \end{array}$ :
243
+
244
+ $$
245
+ \pmb { \theta } _ { t + 1 } \pmb { \theta } _ { t } - \alpha \nabla f _ { t } ^ { \mathrm { r e g } } ( \pmb { \theta } _ { t } ) = \pmb { \theta } _ { t } - \alpha \nabla f _ { t } ( \pmb { \theta } _ { t } ) - \alpha \lambda ^ { \prime } \pmb { \theta } _ { t } .
246
+ $$
247
+
248
+ SGD with weight decay has the following iterates on $f _ { t } ( \pmb \theta )$ :
249
+
250
+ $$
251
+ \pmb { \theta } _ { t + 1 } ( 1 - \lambda ) \pmb { \theta } _ { t } - \alpha \nabla f _ { t } ( \pmb { \theta } _ { t } ) .
252
+ $$
253
+
254
+ These iterates are identical since $\begin{array} { r } { \lambda ^ { \prime } = \frac { \lambda } { \alpha } } \end{array}$
255
+
256
+ # Proof of Proposition 2
257
+
258
+ Similarly to the Proof of Proposition 1, the iterates of $O$ without weight decay on $f _ { t } ^ { \mathrm { r e g } } ( { \pmb \theta } ) = f _ { t } ( { \pmb \theta } ) +$ $\begin{array} { r } { \frac { 1 } { 2 } \lambda ^ { \prime } \left. \pmb { \theta } \right. _ { 2 } ^ { 2 } } \end{array}$ and $O$ with weight decay $\lambda$ on $f _ { t }$ are, respectively:
259
+
260
+ $$
261
+ \begin{array} { l l l } { \pmb { \theta } _ { t + 1 } } & { } & { \pmb { \theta } _ { t } - \alpha \lambda ^ { \prime } \mathbf { M } _ { t } \pmb { \theta } _ { t } - \alpha \mathbf { M } _ { t } \nabla f _ { t } ( \pmb { \theta } _ { t } ) . } \\ { \pmb { \theta } _ { t + 1 } } & { } & { ( 1 - \lambda ) \pmb { \theta } _ { t } - \alpha \mathbf { M } _ { t } \nabla f _ { t } ( \pmb { \theta } _ { t } ) . } \end{array}
262
+ $$
263
+
264
+ The equality of these iterates for all $\theta _ { t }$ would imply $\lambda \pmb { \theta } _ { t } = \alpha \lambda ^ { \prime } \mathbf { M } _ { t } \pmb { \theta } _ { t }$ . This can only hold for all $\theta _ { t }$ if $\mathbf { M } _ { t } = k \mathbf { I }$ , with $k \in \mathbb { R }$ , which is not the case for $O$ . Therefore, no $\mathrm { L _ { 2 } }$ regularizer $\lambda ^ { \prime } \left\| \pmb { \theta } \right\| _ { 2 } ^ { 2 }$ exists that makes the iterates equivalent. □
265
+
266
+ # Proof of Proposition 3
267
+
268
+ $O$ without weight decay has the following iterates on $\begin{array} { r } { f _ { t } ^ { \mathrm { s r e g } } ( \pmb { \theta } ) = f _ { t } ( \pmb { \theta } ) + \frac { \lambda ^ { \prime } } { 2 } \left\| \pmb { \theta } \odot \sqrt { s } \right\| _ { 2 } ^ { 2 } ; } \end{array}$
269
+
270
+ $$
271
+ \begin{array} { r c l } { \pmb { \theta } _ { t + 1 } } & { } & { \pmb { \theta } _ { t } - \alpha \nabla f _ { t } ^ { \mathrm { s r e g } } ( \pmb { \theta } _ { t } ) / s } \\ & { = } & { \pmb { \theta } _ { t } - \alpha \nabla f _ { t } ( \pmb { \theta } _ { t } ) / s - \alpha \lambda ^ { \prime } \pmb { \theta } _ { t } \odot s / s } \\ & { = } & { \pmb { \theta } _ { t } - \alpha \nabla f _ { t } ( \pmb { \theta } _ { t } ) / s - \alpha \lambda ^ { \prime } \pmb { \theta } _ { t } , } \end{array}
272
+ $$
273
+
274
+ where the division by $\pmb { S }$ is element-wise. $O$ with weight decay has the following iterates on $f _ { t } ( \pmb \theta )$ :
275
+
276
+ $$
277
+ \begin{array} { r l r } { \pmb { \theta } _ { t + 1 } } & { } & { ( 1 - \lambda ) \pmb { \theta } _ { t } - \alpha \nabla f ( \pmb { \theta } _ { t } ) / s } \\ & { = } & { \pmb { \theta } _ { t } - \alpha \nabla f ( \pmb { \theta } _ { t } ) / s - \lambda \pmb { \theta } _ { t } , } \end{array}
278
+ $$
279
+
280
+ These iterates are identical since $\begin{array} { r } { \lambda ^ { \prime } = \frac { \lambda } { \alpha } } \end{array}$ .
281
+
282
+ # B ADDITIONAL PRACTICAL IMPROVEMENTS OF ADAM
283
+
284
+ Having discussed decoupled weight decay for improving Adam’s generalization, in this section we introduce two additional components to improve Adam’s performance in practice.
285
+
286
+ # B.1 NORMALIZED WEIGHT DECAY
287
+
288
+ Our preliminary experiments showed that different weight decay factors are optimal for different computational budgets (defined in terms of the number of batch passes). Relatedly, Li et al. (2017) demonstrated that a smaller batch size (for the same total number of epochs) leads to the shrinking effect of weight decay being more pronounced. Here, we propose to reduce this dependence by normalizing the values of weight decay. Specifically, we replace the hyperparameter $\lambda$ by a new (more robust) normalized weight decay hyperparameter $\lambda _ { n o r m }$ , and use this to set $\lambda$ as $\begin{array} { r } { \lambda = \lambda _ { n o r m } \sqrt { \frac { b } { B T } } } \end{array}$ , where $b$ is the batch size, $B$ is the total number of training points and $T$ is the total number of epochs.2 Thus, $\lambda _ { n o r m }$ can be interpreted as the weight decay used if only one batch pass is allowed. We emphasize that our choice of normalization is merely one possibility informed by few experiments; a more lasting conclusion we draw is that using some normalization can substantially improve results.
289
+
290
+ # B.2 ADAM WITH COSINE ANNEALING AND WARM RESTARTS
291
+
292
+ We now apply cosine annealing and warm restarts to Adam, following the recent work of Loshchilov & Hutter (2016). There, the authors proposed Stochastic Gradient Descent with Warm Restarts (SGDR) to improve anytime performance of SGD by quickly cooling down the learning rate according to a cosine schedule and periodically increasing it. SGDR has been successfully adopted to lead to new state-of-the-art results for popular image classification benchmarks (Huang et al., 2017; Gastaldi, 2017; Zoph et al., 2017), and we therefore tried extending it to Adam. However, while our initial version of Adam with warm restarts had better anytime performance than Adam, it was not competitive with SGD with warm restarts, precisely because $\mathrm { L _ { 2 } }$ regularization was not working as well as in SGD. Now, having fixed this issue by means of the original weight decay regularization (Section 2) and also having introduced normalized weight decay (Section B.1), the original work on cosine annealing and warm restarts by Loshchilov & Hutter (2016) directly carries over to Adam.
293
+
294
+ In the interest of keeping the presentation self-contained, we briefly describe how SGDR schedules the change of the effective learning rate in order to accelerate the training of DNNs. Here, we decouple the initial learning rate $\alpha$ and its multiplier $\eta _ { t }$ used to obtain the actual learning rate at iteration $t$ (see, e.g., line 8 in Algorithm 1). In SGDR, we simulate a new warm-started run/restart of SGD once $T _ { i }$ epochs are performed, where $i$ is the index of the run. Importantly, the restarts are not performed from scratch but emulated by increasing $\eta _ { t }$ while the old value of $\theta _ { t }$ is used as an initial solution. The amount by which $\eta _ { t }$ is increased controls to which extent the previously acquired information (e.g., momentum) is used. Within the $i$ -th run, the value of $\eta _ { t }$ decays according to a cosine annealing (Loshchilov & Hutter, 2016) learning rate for each batch as follows:
295
+
296
+ $$
297
+ \eta _ { t } = \eta _ { m i n } ^ { ( i ) } + 0 . 5 ( \eta _ { m a x } ^ { ( i ) } - \eta _ { m i n } ^ { ( i ) } ) ( 1 + \cos ( \pi T _ { c u r } / T _ { i } ) ) ,
298
+ $$
299
+
300
+ where η min and $\eta _ { m a x } ^ { ( i ) }$ are ranges for the multiplier and $T _ { c u r }$ accounts for how many epochs have been performed since the last restart. $T _ { c u r }$ is updated at each batch iteration $t$ and is thus not constrained to integer values. Adjusting (e.g., decreasing) $\eta _ { m i n } ^ { ( i ) }$ and $\eta _ { m a x } ^ { ( i ) }$ at every $i$ -th restart (see also Smith (2016)) could potentially improve performance, but we do not consider that option here because it would involve additional hyperparameters. For $\eta _ { m a x } ^ { ( i ) } = 1$ = 1 and η(i)min $\eta _ { m i n } ^ { ( i ) } = 0$ , one can simplify Eq. (14) to
301
+
302
+ $$
303
+ \eta _ { t } = 0 . 5 + 0 . 5 \cos ( \pi T _ { c u r } / T _ { i } ) .
304
+ $$
305
+
306
+ In order to achieve good anytime performance, one can start with an initially small $T _ { i }$ (e.g., from $1 \%$ to $10 \%$ of the expected total budget) and multiply it by a factor of $T _ { m u l t }$ (e.g., $T _ { m u l t } = 2$ ) at every restart. The $( i + 1 )$ -th restart is triggered when $T _ { c u r } = T _ { i }$ by setting $T _ { c u r }$ to 0. An example setting of the schedule multiplier is given in C.
307
+
308
+ Our proposed AdamWR algorithm represents AdamW (see Algorithm 2) with $\eta _ { t }$ following Eq. (15) and $\lambda$ computed at each iteration using normalized weight decay described in the previous section. We note that normalized weight decay allowed us to use a constant parameter setting across short and long runs performed within AdamWR and SGDWR (SGDW with warm restarts).
309
+
310
+ # C AN EXAMPLE SETTING OF THE SCHEDULE MULTIPLIER
311
+
312
+ An example schedule of the schedule multiplier $\eta _ { t }$ is given in SuppFigure 1 for $T _ { i = 0 } = 1 0 0$ and $T _ { m u l t } = 2$ . After the initial 100 epochs the learning rate will reach 0 because $\eta _ { t = 1 0 0 } = 0$ . Then, since $T _ { c u r } = T _ { i = 0 }$ , we restart by resetting $T _ { c u r } = 0$ , causing the multiplier $\eta _ { t }$ to be reset to 1 due to Eq. (15). This multiplier will then decrease again from 1 to 0, but now over the course of 200 epochs because $T _ { i = 1 } = T _ { i = 0 } T _ { m u l t } = 2 0 0$ . Solutions obtained right before the restarts, when $\eta _ { t } = 0$ (e.g., at epoch indexes 100, 300, 700 and 1500 as shown in SuppFigure 1) are recommended by the optimizer as the solutions, with more recent solutions prioritized.
313
+
314
+ # D ADDITIONAL RESULTS
315
+
316
+ We investigated whether the use of much longer runs (1800 epochs) of “standard Adam” (Adam with $\mathrm { L _ { 2 } }$ regularization and a fixed learning rate) makes the use of cosine annealing unnecessary.
317
+
318
+ ![](images/05aeac11b243ee1c9b6ee060aff58ac2592760fb64cd2d49c797565303ec0f23.jpg)
319
+ SuppFigure 1: An example schedule of the learning rate multiplier as a function of epoch index. The first run is scheduled to converge at epoch $T _ { i = 0 } ~ = ~ 1 0 0$ , then the budget for the next run is doubled as $T _ { i = 1 } = T _ { i = 0 } T _ { m u l t } = 2 0 0$ , etc.
320
+
321
+ SuppFigure 2 shows the results of standard Adam for a 4 by 4 logarithmic grid of hyperparameter settings (the coarseness of the grid is due to the high computational expense of runs for 1800 epochs). Even after taking the low resolution of the grid into account, the results appear to be at best comparable to the ones obtained with AdamW with 18 times less epochs and a smaller network (see SuppFigure 3, top row, middle). These results are not very surprising given Figure 2 in the main paper (which demonstrates the effectiveness of AdamW) and SuppFigure 1 (which demonstrates the necessity to use some learning rate schedule such as cosine annealing).
322
+
323
+ Our experimental results with Adam and SGD suggested that the total runtime in terms of the number of epochs affect the basin of optimal hyperparameters (see SuppFigure 3). More specifically, the greater the total number of epochs the smaller the values of the weight decay should be. SuppFigure 4 shows that our remedy for this problem, the normalized weight decay defined in Eq. (15), simplifies hyperparameter selection because the optimal values observed for short runs are similar to the ones for much longer runs. We used our initial experiments on CIFAR-10 to suggest the square root normalization we proposed in Eq. (15) and double-checked that this is not a coincidence on the ImageNet32x32 dataset (Chrabaszcz et al., 2017), a downsampled version of the original ImageNet dataset with 1.2 million $3 2 \times 3 2$ pixels images, where an epoch is 24 times longer than on CIFAR-10. This experiment also supported the square root scaling: the best values of the normalized weight decay observed on CIFAR-10 represented nearly optimal values for ImageNet32x32 (see SuppFigure 3). In contrast, had we used the same raw weight decay values $\lambda$ for ImageNet32x32 as for CIFAR10 and for the same number of epochs, without the proposed normalization, $\lambda$ would have been roughly 5 times too large for ImageNe $3 2 x 3 2$ , leading to much worse performance. The optimal normalized weight decay values were also very similar (e.g., $\lambda _ { n o r m } = 0 . 0 2 5$ and $\lambda _ { n o r m } = 0 . 0 5 )$ ) across SGDW and AdamW.
324
+
325
+ SuppFigure 4 is the equivalent of Figure 3 in the main paper, but for ImageNet32x32 instead of for CIFAR-10. The qualitative results are identical: weight decay leads to better training loss (crossentropy) than $\mathrm { L _ { 2 } }$ regularization, and to an even greater improvement of test error.
326
+
327
+ SuppFigure 5 and SuppFigure 6 are the equivalents of Figure 4 in the main paper but supplemented with training loss curves in its bottom row. The results show that Adam and its variants with decoupled weight decay converge faster (in terms of training loss) on CIFAR-10 than the corresponding SGD variants (the difference for ImageNet32x32 is small). As is discussed in the main paper, when the same values of training loss are considered, AdamW demonstrates better values of test error than Adam. Interestingly, SuppFigure 5 and SuppFigure 6 show that restart variants AdamWR and SGDWR also demonstrate better generalization than AdamW and SGDW, respectively.
328
+
329
+ ![](images/d61e04f283fa31f4651067bc40c835a7e0d1c6120984b5b1ce501d36ef00cee2.jpg)
330
+ SuppFigure 2: Performance of “standard Adam”: Adam with $\mathrm { L _ { 2 } }$ regularization and a fixed learning rate. We show the final test error of a $2 6 ~ 2 \mathrm { x } 9 6 \mathrm { d }$ ResNet on CIFAR-10 after 1800 epochs of the original Adam for different settings of learning rate and weight decay used for $\mathrm { L _ { 2 } }$ regularization.
331
+
332
+ ![](images/dd04a2ab90cfc312d3ac98c8dc68782db24031d7719e24db29f24240372c8b49.jpg)
333
+ SuppFigure 3: Effect of normalized weight decay. We show the final test Top-1 error on CIFAR10 (first two rows for AdamW without and with normalized weight decay) and Top-5 error on ImageNet32x32 (last two rows for AdamW and SGDW, both with normalized weight decay) of a $2 6 2 \mathrm { x } 6 4 \mathrm { d }$ ResNet after different numbers of epochs (see columns). While the optimal settings of the raw weight decay change significantly for different runtime budgets (see the first row), the values of the normalized weight decay remain very similar for different budgets (see the second row) and different datasets (here, CIFAR-10 and ImageNet32x32), and even across AdamW and SGDW.
334
+
335
+ ![](images/cae7758f0603d244c6a3533a4e7895f997ffe6ec31c9bfd389ed44477fe94759.jpg)
336
+ SuppFigure 4: Learning curves (top row) and generalization results (Top-5 errors in bottom row) obtained by a $2 6 2 \mathrm { x } 9 6 \mathrm { d }$ ResNet trained with Adam and AdamW on ImageNet32x32.
337
+
338
+ ![](images/5ab029b7e35779e3bea2ccd6ef38c9aa1439a43f3f4434a679a70961745062d0.jpg)
339
+ SuppFigure 5: Test error curves (top row) and training loss curves (bottom row) for CIFAR-10.
340
+
341
+ ![](images/1eca1bdf2cf4c17312faab960a100d5dd1708b424add1e9f49f170d4725df754.jpg)
342
+ SuppFigure 6: Test error curves (top row) and training loss curves (bottom row) for ImageNet32x32.
md/train/BkgBvsC9FQ/BkgBvsC9FQ.md ADDED
@@ -0,0 +1,275 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # DIALOGWAE: MULTIMODAL RESPONSE GENERATION WITH CONDITIONAL WASSERSTEIN AUTO-ENCODER
2
+
3
+ Xiaodong $\mathbf { G u } ^ { 1 , 3 }$ , Kyunghyun $\mathbf { C h 0 ^ { 2 , 4 } }$ , Jung-Woo $\mathbf { H } \mathbf { a } ^ { 3 }$ , Sunghun $\mathbf { K i m ^ { 1 , 3 } }$
4
+ 1Hong Kong University of Science and Technology,
5
+ 2New York Universidy, 3Clova AI Research, NAVER, 4CIFAR Azrieli Global Scholar
6
+ 1guxiaodong1987@126.com, hunkim@cse.ust.hk
7
+ 2kyunghyun.cho@nyu.edu, 3jungwoo.ha@navercorp.com
8
+
9
+ # ABSTRACT
10
+
11
+ Variational autoencoders (VAEs) have shown a promise in data-driven conversation modeling. However, most VAE conversation models match the approximate posterior distribution over the latent variables to a simple prior such as standard normal distribution, thereby restricting the generated responses to a relatively simple (e.g., unimodal) scope. In this paper, we propose DialogWAE, a conditional Wasserstein autoencoder (WAE) specially designed for dialogue modeling. Unlike VAEs that impose a simple distribution over the latent variables, DialogWAE models the distribution of data by training a GAN within the latent variable space. Specifically, our model samples from the prior and posterior distributions over the latent variables by transforming context-dependent random noise using neural networks and minimizes the Wasserstein distance between the two distributions. We further develop a Gaussian mixture prior network to enrich the latent space. Experiments on two popular datasets show that DialogWAE outperforms the state-of-the-art approaches in generating more coherent, informative and diverse responses.
12
+
13
+ # 1 INTRODUCTION
14
+
15
+ Neural response generation has been a long interest of natural language research. Most of the recent approaches to data-driven conversation modeling primarily build upon sequence-to-sequence learning (Cho et al., 2014; Sutskever et al., 2014). Previous research has demonstrated that sequenceto-sequence conversation models often suffer from the safe response problem and fail to generate meaningful, diverse on-topic responses (Li et al., 2015; Sato et al., 2017). Conditional variational autoencoders (CVAE) have shown promising results in addressing the safe response issue (Zhao et al., 2017; Shen et al., 2018). CVAE generates the response conditioned on a latent variable - representing topics, tones and situations of the response - and approximate the posterior distribution over latent variables using a neural network. The latent variable captures variabilities in the dialogue and thus generates more diverse responses. However, previous studies have shown that VAE models tend to suffer from the posterior collapse problem, where the decoder learns to ignore the latent variable and degrades to a vanilla RNN (Shen et al., 2018; Park et al., 2018; Bowman et al., 2015). Furthermore, they match the approximate posterior distribution over the latent variables to a simple prior such as standard normal distribution, thereby restricting the generated responses to a relatively simple (e.g., unimodal) scope (Goyal et al., 2017).
16
+
17
+ A number of studies have sought GAN-based approaches (Goodfellow et al., 2014; Li et al., 2017a; Xu et al., 2017) which directly model the distribution of the responses. However, adversarial training over discrete tokens has been known to be difficult due to the non-differentiability. Li et al. (2017a) proposed a hybrid model of GAN and reinforcement learning (RL) where the score predicted by a discriminator is used as a reward to train the generator. However, training with REINFORCE has been observed to be unstable due to the high variance of the gradient estimate (Shen et al., 2017). Xu et al. (2017) make the GAN model differentiable with an approximate word embedding layer. However, their model only injects variability at the word level, thus limited to represent high-level response variabilities such as topics and situations.
18
+
19
+ In this paper, we propose DialogWAE, a novel variant of GAN for neural conversation modeling. Unlike VAE conversation models that impose a simple distribution over latent variables, DialogWAE models the data distribution by training a GAN within the latent variable space. Specifically, it samples from the prior and posterior distributions over the latent variables by transforming contextdependent random noise with neural networks, and minimizes the Wasserstein distance (Arjovsky et al., 2017) between the prior and the approximate posterior distributions. Furthermore, our model takes into account a multimodal1 nature of responses by using a Gaussian mixture prior network. Adversarial training with the Gaussian mixture prior network enables DialogWAE to capture a richer latent space, yielding more coherent, informative and diverse responses.
20
+
21
+ Our main contributions are two-fold: (1) A novel GAN-based model for neural dialogue modeling, which employs GAN to generate samples of latent variables. (2) A Gaussian mixture prior network to sample random noise from a multimodal prior distribution. To the best of our knowledge, the proposed DialogWAE is the first GAN conversation model that exploits multimodal latent structures.
22
+
23
+ We evaluate our model on two benchmark datasets, SwitchBoard (Godfrey and Holliman, 1997) and DailyDialog (Li et al., 2017b). The results demonstrate that our model substantially outperforms the state-of-the-art methods in terms of BLEU, word embedding similarity, and distinct. Furthermore, we highlight how the GAN architecture with a Gaussian mixture prior network facilitates the generation of more diverse and informative responses.
24
+
25
+ # 2 RELATED WORK
26
+
27
+ Encoder-decoder variants To address the “safe response” problem of the naive encoder-decoder conversation model, a number of variants have been proposed. Li et al. (2015) proposed a diversitypromoting objective function to encourage more various responses. Sato et al. (2017) propose to incorporate various types of situations behind conversations when encoding utterances and decoding their responses, respectively. Xing et al. (2017) incorporate topic information into the sequence-tosequence framework to generate informative and interesting responses. Our work is different from the aforementioned studies, as it does not rely on extra information such as situations and topics.
28
+
29
+ VAE conversation models The variational autoencoder (VAE) (Kingma and Welling, 2014) is among the most popular frameworks for dialogue modeling (Zhao et al., 2017; Shen et al., 2018; Park et al., 2018). Serban et al. (2017) propose VHRED, a hierarchical latent variable sequenceto-sequence model that explicitly models multiple levels of variability in the responses. A main challenge for the VAE conversation models is the so-called “posterior collapse”. To alleviate the problem, Zhao et al. (2017) introduce an auxiliary bag-of-words loss to the decoder. They further incorporate extra dialogue information such as dialogue acts and speaker profiles. Shen et al. (2018) propose a collaborative CVAE model which samples the latent variable by transforming a Gaussian noise using neural networks and matches the prior and posterior distributions of the Gaussian noise with KL divergence. Park et al. (2018) propose a variational hierarchical conversation RNN (VHCR) which incorporates a hierarchical structure to latent variables. DialogWAE addresses the limitation of VAE conversation models by using a GAN architecture in the latent space.
30
+
31
+ GAN conversation models Although GAN/CGAN has shown great success in image generation, adapting it to natural dialog generators is a non-trivial task. This is due to the non-differentiable nature of natural language tokens (Shen et al., 2017; Xu et al., 2017). Li et al. (2017a) address this problem by combining GAN with Reinforcement Learning (RL) where the discriminator predicts a reward to optimize the generator. However, training with REINFORCE can be unstable due to the high variance of the sampled gradient (Shen et al., 2017). Xu et al. (2017) make the sequenceto-sequence GAN differentiable by directly multiplying the word probabilities obtained from the decoder to the corresponding word vectors, yielding an approximately vectorized representation of the target sequence. However, their approach injects diversity in the word level rather than the level of the whole responses. DialogWAE differs from exiting GAN conversation models in that it shapes the distribution of responses in a high level latent space rather than direct tokens and does not rely on RL where the gradient variances are large.
32
+
33
+ # 3 PROPOSED APPROACH
34
+
35
+ # 3.1 PROBLEM STATEMENT
36
+
37
+ Let $d { = } [ u _ { 1 } , . . . , u _ { k } ]$ denote a dialogue of $k$ utterances where $u _ { i } { = } [ w _ { 1 } , . . . , w _ { | u _ { i } | } ]$ represents an utterance and $w _ { n }$ denotes the $n$ -th word in $u _ { i }$ . Let $c { = } [ u _ { 1 } , . . . , u _ { k - 1 } ]$ denote a dialogue context, the $k$ -1 historical utterances, and $x { = } u _ { k }$ be a response which means the next utterance. Our goal is to estimate the conditional distribution $p _ { \theta } ( x | c )$ .
38
+
39
+ As $x$ and $c$ are sequences of discrete tokens, it is non-trivial to find a direct coupling between them. Instead, we introduce a continuous latent variable $z$ that represents the high-level representation of the response. The response generation can be viewed as a two-step procedure, where a latent variable $z$ is sampled from a distribution $p _ { \theta } ( z | c )$ on a latent space $\mathcal { Z }$ , and then the response $x$ is decoded from $z$ with $p _ { \theta } ( x | z , c )$ . Under this model, the likelihood of a response is
40
+
41
+ $$
42
+ p _ { \theta } ( x | c ) = \int _ { z } p ( x | c , z ) p ( z | c ) d _ { z } .
43
+ $$
44
+
45
+ The exact log-probability is difficult to compute since it is intractable to marginalize out $z$ . Therefore, we approximate the posterior distribution of $z$ as $q _ { \phi } ( z | x , c )$ which can be computed by a neural network named recognition network. Using this approximate posterior, we can instead compute the evidence lower bound (ELBO):
46
+
47
+ $$
48
+ \begin{array} { r l } & { \log p _ { \theta } ( x \vert c ) = \log \displaystyle \int _ { z } p ( x \vert c , z ) p ( z \vert c ) d z } \\ & { \quad \ge \ell ( x , c ) = { \mathbf E } _ { z \sim q _ { \phi } ( z \vert x , c ) } [ \log p _ { \psi } ( x \vert c , z ) ] - { \mathrm { K L } } ( q _ { \phi } ( z \vert x , c ) \vert \vert p ( z \vert c ) ) , } \end{array}
49
+ $$
50
+
51
+ where $p ( z | c )$ represents the prior distribution of $z$ given $c$ and can be modeled with a neural network named prior network.
52
+
53
+ # 3.2 CONDITIONAL WASSERSTEIN AUTO-ENCODERS FOR DIALOGUE MODELING
54
+
55
+ The conventional VAE conversation models assume that the latent variable $z$ follows a simple prior distribution such as the normal distribution. However, the latent space of real responses is more complicated and difficult to be estimated with such a simple distribution. This often leads to the posterior collapse problem (Shen et al., 2018).
56
+
57
+ Inspired by GAN and the adversarial auto-encoder (AAE) (Makhzani et al., 2015; Tolstikhin et al., 2017; Zhao et al., 2018), we model the distribution of $z$ by training a GAN within the latent space. We sample from the prior and posterior over the latent variables by transforming random noise $\epsilon$ using neural networks. Specifically, the prior sample $\tilde { z } \sim p _ { \theta } ( z | c )$ is generated by a generator $G$ from context-dependent random noise $\tilde { \epsilon }$ , while the approximate posterior sample $z \sim q _ { \phi } ( z | c , x )$ is generated by a generator $Q$ from context-dependent random noise $\epsilon$ . Both ˜ and $\epsilon$ are drawn from a normal distribution whose mean and covariance matrix (assumed diagonal) are computed from $c$ with feed-forward neural networks, prior network and recognition network, respectively:
58
+
59
+ $$
60
+ \tilde { z } = G _ { \theta } ( \tilde { \epsilon } ) , ~ \tilde { \epsilon } \sim \mathcal { N } ( \epsilon ; \tilde { \mu } , \tilde { \sigma } ^ { 2 } I ) , ~ \left[ \operatorname* { l i p } _ { \log \tilde { \sigma } ^ { 2 } } \right] = \tilde { W } f _ { \theta } ( c ) + \tilde { b }
61
+ $$
62
+
63
+ $$
64
+ z = Q _ { \phi } ( \epsilon ) , \epsilon \sim \mathcal { N } ( \epsilon ; \mu , \sigma ^ { 2 } I ) , \left[ \underset { \log \sigma ^ { 2 } } { \mu } \right] = W g _ { \phi } ( \left[ \underset { c } { x } \right] ) + b ,
65
+ $$
66
+
67
+ where $f _ { \theta } ( \cdot )$ and $g _ { \phi } ( \cdot )$ are feed-forward neural networks. Our goal is to minimize the divergence between $p _ { \theta } ( z | c )$ and $\scriptstyle q _ { \phi } ( z | x , c )$ while maximizing the log-probability of a reconstructed response from $z$ . We thus solve the following problem:
68
+
69
+ $$
70
+ \operatorname* { m i n } _ { \theta , \phi , \psi } - E _ { q _ { \phi } ( z | x , c ) } \log p _ { \psi } ( x | z , c ) + W ( q _ { \phi } ( z | x , c ) | | p _ { \theta } ( z | c ) ) ,
71
+ $$
72
+
73
+ where $p _ { \theta } ( z | c )$ and $q _ { \phi } ( z | x , c )$ are neural networks implementing Equations 3 and 4, respectively. $p _ { \psi } ( x | z , c )$ is a decoder. $\mathbf { W } ( \cdot | | \cdot )$ represents the Wasserstein distance between these two distributions (Arjovsky et al., 2017). We choose the Wasserstein distance as the divergence since the WGAN has been shown to produce good results in text generation (Zhao et al., 2018).
74
+
75
+ ![](images/4fb66034806b2cbe66f2cd7927adc2ee539bf63d96c6f57df759244e4e91bd99.jpg)
76
+ Figure 1: Architecture of DialogWAE
77
+
78
+ Figure 1 illustrates an overview of our model. The utterance encoder (RNN) transforms each utterance (including the response $x$ ) in the dialogue into a real-valued vector. For the $i$ -th utterance in the context, the context encoder (RNN) takes as input the concatenation of its encoding vector and the conversation floor (1 if the utterance is from the speaker of the response, otherwise 0) and computes its hidden state ${ h _ { i } ^ { c t x } }$ . The final hidden state of the context encoder is used as the context representation.
79
+
80
+ At generation time, the model draws a random noise ˜ from the prior network (PriNet) which transforms $c$ through a feed-forward network followed by two matrix multiplications which result in the mean and diagonal covariance, respectively. Then, the generator G generates a sample of latent variable $\tilde { z }$ from the noise through a feed-forward network. The decoder RNN decodes the generated $\tilde { z }$ into a response.
81
+
82
+ At training time, the model infers the posterior distribution of the latent variable conditioned on the context $c$ and the response $x$ . The recognition network (RecNet) takes as input the concatenation of both $x$ and $c$ and transforms them through a feed-forward network followed by two matrix multiplications which define the normal mean and diagonal covariance, respectively. A Gaussian noise $\epsilon$ is drawn from the recognition network with the re-parametrization trick. Then, the generator $\mathrm { Q }$ transforms the Gaussian noise $\epsilon$ into a sample of latent variable $z$ through a feed-forward network. The response decoder (RNN) computes the reconstruction loss:
83
+
84
+ $$
85
+ \mathcal { L } _ { r e c } = - E _ { z = Q ( \epsilon ) , \epsilon \sim \mathrm { R e c N e t } ( x , c ) } \log p _ { \psi } ( x | c , z )
86
+ $$
87
+
88
+ We match the approximate posterior with the prior distributions of $z$ by introducing an adversarial discriminator $\mathbf { D }$ which tells apart the prior samples from posterior samples. D is implemented as a feed-forward neural network which takes as input the concatenation of $z$ and $c$ and outputs a real value. We train $\mathbf { D }$ by minimizing the discriminator loss:
89
+
90
+ $$
91
+ \mathcal { L } _ { d i s c } = E _ { \epsilon \sim \mathrm { R e c N e t } ( x , c ) } [ D ( Q ( \epsilon ) , c ) ] - E _ { \tilde { \epsilon } \sim \mathrm { P r i N e t } ( c ) } [ D ( G ( \tilde { \epsilon } ) , c ) ]
92
+ $$
93
+
94
+ 3.3 MULTIMODAL RESPONSE GENERATION WITH A GAUSSIAN MIXTURE PRIOR NETWORK
95
+
96
+ It is a usual practice for the prior distribution in the AAE architecture to be a normal distribution. However, responses often have a multimodal nature reflecting many equally possible situations (Sato et al., 2017), topics and sentiments. A random noise with normal distribution could restrict the generator to output a latent space with a single dominant mode due to the unimodal nature of Gaussian distribution. Consequently, the generated responses could follow simple prototypes.
97
+
98
+ To capture multiple modes in the probability distribution over the latent variable, we further propose to use a distribution that explicitly defines more than one mode. Each time, the noise to generate the latent variable is selected from one of the modes. To achieve so, we make the prior network to capture a mixture of Gaussian distributions, namely, $\mathrm { G M M } ( \{ \pi _ { k } , \mu _ { k } , \sigma _ { k } ^ { 2 } I \} _ { k = 1 } ^ { K } )$ , where $\pi _ { k } , \mu _ { k }$ and $\sigma _ { k }$ are parameters of the -th component. This allows it to learn a multimodal manifold in the latent variable space in a two-step generation process – first choosing a component $k$ with $\pi _ { k }$ , and then sampling Gaussian noise within the selected component:
99
+
100
+ $$
101
+ p ( \epsilon | c ) = \sum _ { k = 1 } ^ { K } v _ { k } \mathcal { N } ( \epsilon ; \mu _ { k } , \sigma _ { k } ^ { 2 } I ) ,
102
+ $$
103
+
104
+ <table><tr><td></td><td>Algorithm 1: DialogWAE Training (UEnc: utterance encoder; CEnc: context encoder; RecNet: recognition network; PriNet: prior network; Dec: decoder) K=3, ncritic=5 in all experiments</td></tr><tr><td></td><td>Initialize {0UEnc,0CEnc,0PriNet,RecNet,0Q,0G,0D,0Dec}</td></tr><tr><td></td><td>2 while not convergence do</td></tr><tr><td>3</td><td>Initialize D</td></tr><tr><td>4</td><td>while D has unsampled batches do</td></tr><tr><td>5</td><td> Sample a mini-batch of N instances {(xn,Cn)}N=1 from D</td></tr><tr><td>6</td><td>Get the representations of context and response xn=UEnc(xn), Cn=CEnc(Cn)</td></tr><tr><td>7</td><td>Sample ∈n from RecNet(xn,Cn) according to Equation 4</td></tr><tr><td>8</td><td>Sample én from PriNet(Cn,K) according to Equation 8-10</td></tr><tr><td>9</td><td>Generate zn=Q(∈n), ≥n=G(én)</td></tr><tr><td>10</td><td>Update {0Q,0G,0PriNet, 0RecNet} by gradient ascent on discriminator loss</td></tr><tr><td>11</td><td></td></tr><tr><td>12 13</td><td>for i∈ {1,.. ,ncritic} do Repeat 5-9</td></tr><tr><td>14</td><td>Update θD by gradient descent on the discriminator loss Ldisc with gradient penalty</td></tr><tr><td>15</td><td>end</td></tr><tr><td>16</td><td>Update {0UEnc,0cEnc, 0RecNet, 0Q,0Dec} by gradient descent on the reconstruction loss</td></tr><tr><td>17</td><td></td></tr><tr><td>18</td><td>end</td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td>19 end</td><td></td></tr></table>
105
+
106
+ where $v _ { k } \in \Delta ^ { K - 1 }$ is a component indicator with class probabilities $\pi _ { 1 } , \cdots , \pi _ { K }$ ; $\pi _ { k }$ is the mixture coefficient of the $k$ -th component of the GMM. They are computed as
107
+
108
+ $$
109
+ \pi _ { k } = { \frac { \exp ( e _ { k } ) } { \sum _ { i = 1 } ^ { K } \exp ( e _ { i } ) } } , { \mathrm { ~ w h e r e ~ } } \left[ \begin{array} { c } { { e _ { k } } } \\ { { \mu _ { k } } } \\ { { \log \sigma _ { k } ^ { 2 } } } \end{array} \right] = W _ { k } f _ { \theta } ( c ) + b _ { k }
110
+ $$
111
+
112
+ Instead of exact sampling, we use Gumbel-Softmax re-parametrization (Kusner and Hernandez- ´ Lobato, 2016) to sample an instance of $v$ :
113
+
114
+ $$
115
+ v _ { k } = \frac { \exp ( ( e _ { k } + g _ { k } ) / \tau ) } { \sum _ { i = 1 } ^ { K } \exp ( ( e _ { i } + g _ { i } ) / \tau ) } ,
116
+ $$
117
+
118
+ where $g _ { i }$ is a Gumbel noise computed as
119
+
120
+ $$
121
+ g _ { i } = - \mathrm { l o g } ( - \mathrm { l o g } ( u _ { i } ) ) , u _ { i } \sim U ( 0 , 1 )
122
+ $$
123
+
124
+ and $\tau { \in } [ 0 , 1 ]$ is the softmax temperature which is set to 0.1 in all experiments.
125
+
126
+ We refer to this framework as DialogWAE-GMP. A comparison of performance with different numbers of prior components will be shown in Section 5.1.
127
+
128
+ # 3.4 TRAINING
129
+
130
+ Our model is trained epochwise until a convergence is reached. In each epoch, we train the model iteratively by alternating two phases − an AE phase during which the reconstruction loss of decoded responses is minimized, and a GAN phase which minimizes the Wasserstein distance between the prior and approximate posterior distributions over the latent variables. The detailed procedures are presented in Algorithm 1
131
+
132
+ # 4 EXPERIMENTAL SETUP
133
+
134
+ Datasets We evaluate our model on two dialogue datasets, Dailydialog (Li et al., 2017b) and Switchboard (Godfrey and Holliman, 1997), which have been widely used in recent studies (Shen et al., 2018; Zhao et al., 2017). Dailydialog has 13,118 daily conversations for a English learner in a daily life. Switchboard contains 2,400 two-way telephone conversations under 70 specified topics. The datasets are separated into training, validation, and test sets with the same ratios as in the baseline papers, that is, 2316:60:62 for Switchboard (Zhao et al., 2017) and 10:1:1 for Dailydialog (Shen et al., 2018), respectively.
135
+
136
+ Metrics To measure the performance of DialogWAE, we adopted several standard metrics widely used in existing studies: BLEU (Papineni et al., 2002), BOW Embedding (Liu et al., 2016) and distinct (Li et al., 2015). In particular, BLEU measures how much a generated response contains $n$ -gram overlaps with the reference. We compute BLEU scores for $\mathrm { n } { < } 4$ using smoothing techniques (smoothing $7 ) ^ { \frac { 1 } { 2 } }$ (Chen and Cherry, 2014). For each test context, we sample 10 responses from the models and compute their BLEU scores. We define $n$ -gram precision and $n$ -gram recall as the average and the maximum score respectively (Zhao et al., 2017).
137
+
138
+ BOW embedding metric is the cosine similarity of bag-of-words embeddings between the hypothesis and the reference. We use three metrics to compute the word embedding similarity: 1. Greedy: greedily matching words in two utterances based on the cosine similarities between their embeddings, and to average the obtained scores (Rus and Lintean, 2012). 2. Average: cosine similarity between the averaged word embeddings in the two utterances (Mitchell and Lapata, 2008). 3. Extrema: cosine similarity between the largest extreme values among the word embeddings in the two utterances (Forgues et al., 2014). We use Glove vectors (Pennington et al., 2014) as the embeddings which will be discussed later in this section. For each test context, we report the maximum BOW embedding score among the 10 sampled responses.
139
+
140
+ Distinct computes the diversity of the generated responses. dist- $n$ is defined as the ratio of unique $n$ -grams $_ { ( \mathrm { n } = 1 , 2 ) }$ over all $n$ -grams in the generated responses. As we sample multiple responses for each test context, we evaluate diversities for both within and among the sampled responses. We define intra-dist as the average of distinct values within each sampled response and inter-dist as the distinct value among all sampled responses.
141
+
142
+ Baselines We compare the performance of DialogWAE with seven recently-proposed baselines for dialogue modeling: (i) HRED: a generalized sequence-to-sequence model with hierarchical RNN encoder (Serban et al., 2016), (ii) SeqGAN: a GAN based model for sequence generation (Li et al., 2017a), (iii) CVAE: a conditional VAE model with KL-annealing (Zhao et al., 2017), (iv) CVAEBOW: a conditional VAE model with a BOW loss (Zhao et al., 2017), (v) CVAE-CO: a collaborative conditional VAE model (Shen et al., 2018), (vi) VHRED: a hierarchical VAE model (Serban et al., 2017), and (vii) VHCR: a hierarchical VAE model with conversation modeling (Park et al., 2018).
143
+
144
+ Training and Evaluation Details We use the gated recurrent units (GRU) (Cho et al., 2014) for the RNN encoders and decoders. The utterance encoder is a bidirectional GRU with 300 hidden units in each direction. The context encoder and decoder are both GRUs with 300 hidden units. The prior and the recognition networks are both 2-layer feed-forward networks of size 200 with tanh non-linearity. The generators $Q$ and $G$ as well as the discriminator $D$ are 3-layer feed-forward networks with ReLU non-linearity (Nair and Hinton, 2010) and hidden sizes of 200, 200 and 400, respectively. The dimension of a latent variable $z$ is set to 200. The initial weights for all fully connected layers are sampled from a uniform distribution [-0.02, 0.02]. The gradient penalty is used when training $D$ (Gulrajani et al., 2017) and its hyper-parameter $\lambda$ is set to 10. We set the vocabulary size to 10,000 and define all the out-of-vocabulary words to a special token <unk>. The word embedding size is 200 and initialized with Glove vectors pre-trained on Twitter (Pennington et al., 2014). The size of context window is set to 10 with a maximum utterance length of 40. We sample responses with greedy decoding so that the randomness entirely come from the latent variables. The baselines were implemented with the same set of hyper-parameters. All the models are implemented with Pytorch $0 . 4 . { \dot { 0 } } ^ { 3 }$ , and fine-tuned with NAVER Smart Machine Learning (NSML) platform (Sung et al., 2017; Kim et al., 2018).
145
+
146
+ The models are trained with mini-batches containing 32 examples each in an end-to-end manner. In the AE phase, the models are trained by SGD with an initial learning rate of 1.0 and gradient clipping at 1 (Pascanu et al., 2013). We decay the learning rate by $40 \%$ every 10th epoch. In the GAN phase, the models are updated using RMSprop (Tieleman and Hinton) with fixed learning rates of $5 \times 1 0 ^ { - 5 }$ and $1 \times 1 0 ^ { - 5 }$ for the generator and the discriminator, respectively. We tune the hyper-parameters on the validation set and measure the performance on the test set.
147
+
148
+ Table 1: Performance comparison on the SwitchBoard dataset (P: n-gram precision, R: n-gram recall, A: Average, E: Extrema, G: Greedy, L: average length)
149
+
150
+ <table><tr><td rowspan="2">Model</td><td colspan="2">BLEU</td><td colspan="2">BOWEmbedding</td><td colspan="2">intra-dist</td><td rowspan="2">L</td></tr><tr><td>R P</td><td>F1</td><td>A E</td><td>G</td><td>dist-1 dist-2</td><td>inter-dist dist-1 dist-2</td></tr><tr><td>HRED</td><td>0.262 0.262</td><td>0.262</td><td>0.820 0.537 0.832</td><td></td><td>0.813 0.452</td><td>0.081 0.045</td><td>12.1</td></tr><tr><td>SeqGAN</td><td>0.282 0.282</td><td>0.282</td><td>0.817 0.515</td><td>0.748</td><td>0.705 0.521</td><td>0.070 0.052</td><td>17.2</td></tr><tr><td>CVAE</td><td>0.295 0.258</td><td>0.275</td><td>0.836 0.572</td><td>0.846</td><td>0.803 0.415</td><td>0.112 0.102</td><td>12.4</td></tr><tr><td>CVAE-BOW</td><td>0.298 0.272</td><td>0.284</td><td>0.828 0.555</td><td>0.840</td><td>0.819 0.493</td><td>0.107 0.099</td><td>12.5</td></tr><tr><td>CVAE-CO</td><td>0.299 0.269</td><td>0.283</td><td>0.839 0.557</td><td>0.855</td><td>0.863 0.581</td><td>0.111 0.110</td><td>10.3</td></tr><tr><td>VHRED</td><td>0.253 0.231</td><td>0.242</td><td>0.810 0.531</td><td>0.844</td><td>0.881 0.522</td><td>0.110 0.092</td><td>8.74</td></tr><tr><td>VHCR</td><td>0.276 0.234</td><td>0.254</td><td>0.826 0.546</td><td>0.851</td><td>0.877 0.536</td><td>0.130 0.131</td><td>9.29</td></tr><tr><td>DialogWAE</td><td>0.394 0.254</td><td>0.309</td><td>0.897 0.627</td><td>0.887</td><td>0.713 0.651</td><td>0.245 0.413</td><td>15.5</td></tr><tr><td>DialogWAE-GMP</td><td>0.420 0.258</td><td>0.319</td><td>0.9250.661</td><td>0.894</td><td>0.713 0.671</td><td>0.333 0.555</td><td>15.2</td></tr></table>
151
+
152
+ Table 2: Performance comparison on the DailyDialog dataset (P: n-gram precision, R: n-gram recall, A: Average, E: Extrema, G: Greedy, L: average response length)
153
+
154
+ <table><tr><td rowspan="2">Model</td><td colspan="2">BLEU</td><td colspan="2">BOW Embedding</td><td colspan="2">intra-dist</td><td rowspan="2">L</td></tr><tr><td>R P</td><td>F1 A</td><td>E G</td><td>dist-1 dist-2</td><td>inter-dist dist-1</td><td>dist-2</td></tr><tr><td>HRED</td><td>0.232 0.232</td><td>0.232</td><td>0.915 0.511</td><td>0.798</td><td>0.935 0.969</td><td>0.093 0.097</td><td>10.1</td></tr><tr><td>SeqGAN</td><td>0.270 0.270</td><td>0.270</td><td>0.907 0.495</td><td>0.774</td><td>0.747 0.806</td><td>0.075 0.081</td><td>15.1</td></tr><tr><td>CVAE</td><td>0.265 0.222</td><td>0.242 0.923</td><td>0.543</td><td>0.811</td><td>0.938 0.973</td><td>0.177 0.222</td><td>10.0</td></tr><tr><td>CVAE-BOW</td><td>0.256 0.224</td><td>0.239</td><td>0.923 0.540</td><td>0.812</td><td>0.947 0.976</td><td>0.165 0.206</td><td>9.8</td></tr><tr><td>CVAE-CO</td><td>0.259 0.244</td><td>0.251</td><td>0.914 0.530</td><td>0.818</td><td>0.821 0.911</td><td>0.106 0.126</td><td>11.2</td></tr><tr><td>VHRED</td><td>0.271 0.260</td><td>0.265</td><td>0.892 0.507</td><td>0.786</td><td>0.633 0.771</td><td>0.071 0.089</td><td>12.7</td></tr><tr><td>VHCR</td><td>0.289 0.266</td><td>0.277</td><td>0.925 0.525</td><td>0.798</td><td>0.768 0.814</td><td>0.105 0.129</td><td>16.9</td></tr><tr><td>DialogWAE</td><td>0.341 0.278</td><td>0.306</td><td>0.948 0.578</td><td>0.846</td><td>0.830 0.940</td><td>0.327 0.583</td><td>18.5</td></tr><tr><td>DialogWAE-GMP</td><td>0.372 0.286 0.323</td><td></td><td>0.952 0.591 0.853</td><td></td><td>0.754 0.892</td><td>0.313 0.597</td><td>24.1</td></tr></table>
155
+
156
+ # 5 EXPERIMENTAL RESULTS
157
+
158
+ # 5.1 QUANTITATIVE ANALYSIS
159
+
160
+ Tables 1 and 2 show the performance of DialogWAE and baselines on the two datasets. DialogWAE outperforms the baselines in the majority of the experiments. In terms of BLEU scores, DialogWAE (with a Gaussian mixture prior network) generates more relevant responses, with the average recall of $4 2 . 0 \%$ and $3 7 . 2 \%$ on both of the datasets. These are significantly higher than those of the CVAE baselines ( $2 9 . 9 \%$ and $2 6 . 5 \%$ ). We observe a similar trend to the BOW embedding metrics.
161
+
162
+ DialogWAE generates more diverse responses than the baselines do. The inter-dist scores are significantly higher than those of the baseline models. This indicates the sampled responses contain more distinct $n$ -grams. DialogWAE does not show better intra-distinct scores. We conjecture that this is due to the relatively long responses generated by the DialogWAE as shown in the last columns of both tables. It is highly unlikely for there to be many repeated $n$ -grams in a short response.
163
+
164
+ We further investigate the effects of the number of prior components $( K )$ . Figure 2 shows the performance of DialogWAE-GMP with respect to the number of prior components $K$ . We vary $K$ from 1 to 9. As shown in the results, in most cases, the performance increases with $K$ and decreases once $K$ reaches a certain threshold, for example, three. The optimal $K$ on both of the datasets was around 3. We attribute this degradation to training difficulty of a mixture density network and the lack of appropriate regularization, which is left for future investigation.
165
+
166
+ # 5.2 QUALITATIVE ANALYSIS
167
+
168
+ Table 3 presents examples of responses generated by the models on the DailyDialog dataset. Due to the space limitation, we report the results of CVAE-CO and DialogWAE-GMP, which are the representative models among the baselines and the proposed models. For each context in the test set, we show three samples of generated responses from each model. As we expected, DialogWAE generates more coherent and diverse responses that cover multiple plausible aspects. Furthermore, we notice that the generated response is long and exhibits informative content. By contrast, the responses generated by the baseline model exhibit relatively limited variations. Although the responses show some variants in contents, most of them share a similar prefix such as “how much”.
169
+
170
+ ![](images/1f89235d673c841fb2611566db116173d9318ab96369d951b19f5a4158862a2f.jpg)
171
+ Figure 2: Performance with respect to the number of prior components
172
+
173
+ Table 3: Examples of context-response pairs for the neural network models. eou indicates a change of turn. ‘Eg.i’ means the $_ { i }$ -th example.
174
+
175
+ <table><tr><td rowspan=2 colspan=2>Context</td><td rowspan=1 colspan=4>Examples of Generated Responses</td></tr><tr><td rowspan=1 colspan=3>CVAE-CO</td><td rowspan=1 colspan=1>DialogWAE-GMP</td></tr><tr><td rowspan=1 colspan=2>thank your for callingworld airline.what canI do for you?_eou_</td><td rowspan=1 colspan=3>Eg.1: i&#x27;m afraid i can&#x27;t find it.Eg.2:what&#x27;s the matter?Eg.3:hi, this is my first time.</td><td rowspan=1 colspan=1>Eg.1: i&#x27;d like to make a reservation for you, pleaseEg.2: do you know where i can get to get?Eg.3:can you tell me the way to the station?</td></tr><tr><td rowspan=1 colspan=2>how much is the rent?_eou_ the rent is$1500 per month.</td><td rowspan=1 colspan=3>Eg.1: how much is the rent?Eg.2: how much is the rent?Eg.3:what is the difference?</td><td rowspan=1 colspan=1>Eg.1: no problem. i&#x27;ll take it.Eg.2: this one is $1.50.50,000 yuan per month.Eg.3: that sounds like a good idea.</td></tr><tr><td rowspan=2 colspan=2>guess who i saw just now?_eou_who?_eou_john smith._eou_ thatbad egg who took the lowroad since he was a boy.</td><td rowspan=2 colspan=3>Eg.1: yes, he is.Eg.2: yes,he isEg.3:yes, he is.</td><td rowspan=2 colspan=1>Eg.1: it is my favorite.Eg.2: no, but i didn&#x27;t think he was able toget married. i had no idea to get her.Eg.3: this is not, but it&#x27;s not that bad.it&#x27;s just a litte bit,but it&#x27;s not too bad.</td></tr><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=2>Eg.2:</td></tr></table>
176
+
177
+ We further investigate the interpretability of Gaussian components in the prior network, that is, what each Gaussian model has captured before generation. We pick a dialogue context “I’d like to invite you to dinner tonight, do you have time?” which is also used in (Shen et al., 2018) for analysis and generate five responses for each Gaussian component. As shown in Table 4, different
178
+
179
+ Table 4: Examples of generated responses for each Gaussian component. ‘Eg.i’ means the $_ { i }$ -th example.
180
+
181
+ <table><tr><td rowspan=1 colspan=1>Context</td><td rowspan=1 colspan=3>I would like to invite you to dinner tonight, do you have time?</td></tr><tr><td rowspan=2 colspan=1>Replies</td><td rowspan=1 colspan=1>Component 1</td><td rowspan=1 colspan=1>Component 2</td><td rowspan=1 colspan=1>Component 3</td></tr><tr><td rowspan=1 colspan=1>Eg.1:Yes,I&#x27;d like to go withyou.Eg.2: My pleasure.Eg.3:OK, thanks.Eg.4: I don&#x27;t know what to doEg.5: Sure. I&#x27;d like to go out</td><td rowspan=1 colspan=1>Eg.1:I&#x27;m not sure.Eg.2: I&#x27;m not sure. What’s theproblem?Eg.3: I&#x27;m sorry to hear that.What&#x27;s the problem?Eg.4: It&#x27;s very kind of you, too.Eg.5: I have no idea. You have to</td><td rowspan=1 colspan=1>Eg.1: Of course I&#x27;m not sure.What&#x27;s the problem?Eg.2: No,I don’t want to go.Eg.3: I want to go to bed, butI&#x27;m not sure.Eg.4: Of course not. you.Eg.5: Do you want to go?</td></tr></table>
182
+
183
+ Gaussian models generate different types of responses: component 1 expresses a strong will, while component 2 expresses some uncertainty, and component 3 generates strong negative responses. The overlap between components is marginal (around 1/5). The results indicate that the Gaussian mixture prior network can successfully capture the multimodal distribution of the responses.
184
+
185
+ To validate the previous results, we further conduct a human evaluation with Amazon Mechanical Turk. We randomly selected 50 dialogues from the test set of DailyDialog. For each dialogue context, we generated 10 responses from each of the four models. Responses for each context were inspected by 5 participants who were asked to choose the model which performs the best in regarding to coherence, diversity and informative while being blind to the underlying algorithms. The average percentages that each model was selected as the best to a specific criterion are shown in Table 5.
186
+
187
+ Table 5: Human judgments for models trained on the Dailydialog dataset
188
+
189
+ <table><tr><td>Model</td><td>Coherence</td><td>Diversity</td><td>Informative</td></tr><tr><td>CVAE-CO</td><td>14.4%</td><td>19.2%</td><td>24.8%</td></tr><tr><td>VHCR</td><td>26.8%</td><td>22.4%</td><td>20.4%</td></tr><tr><td>DialogWAE</td><td>27.6%</td><td>29.2%</td><td>25.6%</td></tr><tr><td>DialogWAE-GMP</td><td>31.6%</td><td>29.2%</td><td>29.6%</td></tr></table>
190
+
191
+ The proposed approach clearly outperforms the current state of the art, CVAE-CO and VHCR, by a large margin in terms of all three metrics. This improvement is especially clear when the Gaussian mixture prior was used.
192
+
193
+ # 6 CONCLUSION
194
+
195
+ In this paper, we introduced a new approach, named DialogWAE, for dialogue modeling. Different from existing VAE models which impose a simple prior distribution over the latent variables, DialogWAE samples the prior and posterior samples of latent variables by transforming contextdependent Gaussian noise using neural networks, and minimizes the Wasserstein distance between the prior and posterior distributions. Furthermore, we enhance the model with a Gaussian mixture prior network to enrich the latent space. Experiments on two widely used datasets show that our model outperforms state-of-the-art VAE models and generates more coherent, informative and diverse responses.
196
+
197
+ # ACKNOWLEDGMENTS
198
+
199
+ This work was supported by the Creative Industrial Technology Development Program (10053249) funded by the Ministry of Trade, Industry and Energy (MOTIE, Korea).
200
+
201
+ # REFERENCES
202
+
203
+ Martin Arjovsky, Soumith Chintala, and Leon Bottou. Wasserstein GAN. ´ arXiv preprint arXiv:1701.07875, 2017.
204
+
205
+ Samuel R Bowman, Gabor Angeli, Christopher Potts, and Christopher D Manning. A large annotated corpus for learning natural language inference. In Proceedings of the 2015 Conference on Empirical Methods in Natural Language Processing, pages 632–642, 2015.
206
+
207
+ Boxing Chen and Colin Cherry. A systematic comparison of smoothing techniques for sentencelevel BLEU. In Proceedings of the Ninth Workshop on Statistical Machine Translation, pages 362–367, 2014.
208
+
209
+ Kyunghyun Cho, Bart Van Merrienboer, C¸ alar G ¨ ulc¸ehre, Dzmitry Bahdanau, Fethi Bougares, Hol- ¨ ger Schwenk, and Yoshua Bengio. Learning phrase representations using RNN Encoder–Decoder for statistical machine translation. In Proceedings of the 2014 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 1724–1734, Doha, Qatar, October 2014. Association for Computational Linguistics.
210
+
211
+ Gabriel Forgues, Joelle Pineau, Jean-Marie Larcheveque, and R ˆ eal Tremblay. Bootstrapping dia- ´ log systems with word embeddings. In NIPS, modern machine learning and natural language processing workshop, volume 2, 2014.
212
+
213
+ John J Godfrey and Edward Holliman. Switchboard-1 release 2. Linguistic Data Consortium, Philadelphia, 926:927, 1997.
214
+
215
+ Ian Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. Generative adversarial nets. In Advances in neural information processing systems, pages 2672–2680, 2014.
216
+
217
+ Prasoon Goyal, Zhiting Hu, Xiaodan Liang, Chenyu Wang, and Eric P Xing. Nonparametric variational auto-encoders for hierarchical representation learning. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 5094–5102, 2017.
218
+
219
+ Ishaan Gulrajani, Faruk Ahmed, Martin Arjovsky, Vincent Dumoulin, and Aaron C Courville. Improved training of wasserstein GANs. In Advances in Neural Information Processing Systems, pages 5769–5779, 2017.
220
+
221
+ Hanjoo Kim, Minkyu Kim, Dongjoo Seo, Jinwoong Kim, Heungseok Park, Soeun Park, Hyunwoo Jo, KyungHyun Kim, Youngil Yang, Youngkwan Kim, et al. Nsml: Meet the mlaas platform with a real-world case study. arXiv preprint arXiv:1810.09957, 2018.
222
+
223
+ Diederik P Kingma and Max Welling. Auto-encoding variational bayes. In International Conference Learning Representations (ICLR), 2014.
224
+
225
+ Matt J Kusner and Jose Miguel Hern ´ andez-Lobato. GANs for sequences of discrete elements with´ the gumbel-softmax distribution. arXiv preprint arXiv:1611.04051, 2016.
226
+
227
+ Jiwei Li, Michel Galley, Chris Brockett, Jianfeng Gao, and Bill Dolan. A diversity-promoting objective function for neural conversation models. arXiv preprint arXiv:1510.03055, 2015.
228
+
229
+ Jiwei Li, Will Monroe, Tianlin Shi, Alan Ritter, and Dan Jurafsky. Adversarial learning for neural dialogue generation. arXiv preprint arXiv:1701.06547, 2017.
230
+
231
+ Yanran Li, Hui Su, Xiaoyu Shen, Wenjie Li, Ziqiang Cao, and Shuzi Niu. DailyDialog: A manually labelled multi-turn dialogue dataset. In Proceedings of the Eighth International Joint Conference on Natural Language Processing (Volume 1: Long Papers), volume 1, pages 986–995, 2017.
232
+
233
+ Chia-Wei Liu, Ryan Lowe, Iulian V Serban, Michael Noseworthy, Laurent Charlin, and Joelle Pineau. How not to evaluate your dialogue system: An empirical study of unsupervised evaluation metrics for dialogue response generation. arXiv preprint arXiv:1603.08023, 2016.
234
+
235
+ Alireza Makhzani, Jonathon Shlens, Navdeep Jaitly, Ian Goodfellow, and Brendan Frey. Adversarial autoencoders. arXiv preprint arXiv:1511.05644, 2015.
236
+
237
+ Jeff Mitchell and Mirella Lapata. Vector-based models of semantic composition. proceedings of ACL-08: HLT, pages 236–244, 2008.
238
+
239
+ Vinod Nair and Geoffrey E Hinton. Rectified linear units improve restricted boltzmann machines. In Proceedings of the 27th international conference on machine learning (ICML-10), pages 807– 814, 2010.
240
+
241
+ Kishore Papineni, Salim Roukos, Todd Ward, and Wei-Jing Zhu. BLEU: a method for automatic evaluation of machine translation. In Proceedings of the 40th annual meeting on association for computational linguistics, pages 311–318. Association for Computational Linguistics, 2002.
242
+
243
+ Yookoon Park, Jaemin Cho, and Gunhee Kim. A hierarchical latent structure for variational conversation modeling. arXiv preprint arXiv:1804.03424, 2018.
244
+
245
+ Razvan Pascanu, Tomas Mikolov, and Yoshua Bengio. On the difficulty of training recurrent neural networks. In International Conference on Machine Learning, pages 1310–1318, 2013.
246
+
247
+ Jeffrey Pennington, Richard Socher, and Christopher Manning. Glove: Global vectors for word representation. In Proceedings of the 2014 conference on empirical methods in natural language processing (EMNLP), pages 1532–1543, 2014.
248
+
249
+ Vasile Rus and Mihai Lintean. A comparison of greedy and optimal assessment of natural language student input using word-to-word similarity metrics. In Proceedings of the Seventh Workshop on Building Educational Applications Using NLP, pages 157–162. Association for Computational Linguistics, 2012.
250
+
251
+ Shoetsu Sato, Naoki Yoshinaga, Masashi Toyoda, and Masaru Kitsuregawa. Modeling situations in neural chat bots. In Proceedings of ACL 2017, Student Research Workshop, pages 120–127, 2017.
252
+
253
+ Iulian Vlad Serban, Alessandro Sordoni, Yoshua Bengio, Aaron C Courville, and Joelle Pineau. Building end-to-end dialogue systems using generative hierarchical neural network models. In AAAI, volume 16, pages 3776–3784, 2016.
254
+
255
+ Iulian Vlad Serban, Alessandro Sordoni, Ryan Lowe, Laurent Charlin, Joelle Pineau, Aaron C Courville, and Yoshua Bengio. A hierarchical latent variable encoder-decoder model for generating dialogues. In AAAI, pages 3295–3301, 2017.
256
+
257
+ Tianxiao Shen, Tao Lei, Regina Barzilay, and Tommi Jaakkola. Style transfer from non-parallel text by cross-alignment. In Advances in Neural Information Processing Systems, pages 6833–6844, 2017.
258
+
259
+ Xiaoyu Shen, Hui Su, Shuzi Niu, and Vera Demberg. Improving variational encoder-decoders in dialogue generation. arXiv preprint arXiv:1802.02032, 2018.
260
+
261
+ Nako Sung, Minkyu Kim, Hyunwoo Jo, Youngil Yang, Jingwoong Kim, Leonard Lausen, Youngkwan Kim, Gayoung Lee, Donghyun Kwak, Jung-Woo Ha, et al. Nsml: A machine learning platform that enables you to focus on your models. arXiv preprint arXiv:1712.05902, 2017.
262
+
263
+ Ilya Sutskever, Oriol Vinyals, and Quoc VV Le. Sequence to sequence learning with neural networks. In Advances in neural information processing systems, pages 3104–3112, 2014.
264
+
265
+ T Tieleman and G Hinton. Divide the gradient by a running average of its recent magnitude. COURSERA: Neural networks for machine learning. Technical report, Technical Report. Available online: https://zh. coursera. org/learn/neuralnetworks/lecture/YQHki/rmsprop-divide-thegradient-by-a-running-average-of-its-recent-magnitude (accessed on 21 April 2017).
266
+
267
+ Ilya Tolstikhin, Olivier Bousquet, Sylvain Gelly, and Bernhard Schoelkopf. Wasserstein autoencoders. arXiv preprint arXiv:1711.01558, 2017.
268
+
269
+ Chen Xing, Wei Wu, Yu Wu, Jie Liu, Yalou Huang, Ming Zhou, and Wei-Ying Ma. Topic aware neural response generation. In AAAI, volume 17, pages 3351–3357, 2017.
270
+
271
+ Zhen Xu, Bingquan Liu, Baoxun Wang, SUN Chengjie, Xiaolong Wang, Zhuoran Wang, and Chao Qi. Neural response generation via GAN with an approximate embedding layer. In Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing, pages 617–626, 2017.
272
+
273
+ Tiancheng Zhao, Ran Zhao, and Maxine Eskenazi. Learning discourse-level diversity for neural dialog models using conditional variational autoencoders. arXiv preprint arXiv:1703.10960, 2017.
274
+
275
+ Junbo Zhao, Yoon Kim, Kelly Zhang, Alexander M. Rush, and Yann LeCun. Adversarially regularized autoencoders. In Proceedings of the Thirty-fifth International Conference on Machine Learning, ICML 2018, 2018.
md/train/BkgMbCVFvr/BkgMbCVFvr.md ADDED
@@ -0,0 +1,226 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # PRETRAINING BOOSTS OUT-OF-DOMAIN ROBUSTNESS FOR POSE ESTIMATION
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Deep neural networks are highly effective tools for human and animal pose estimation. However, robustness to out-of-domain data remains a challenge. Here, we probe the transfer and generalization ability for pose estimation with two architecture classes (MobileNetV2s and ResNets) pretrained on ImageNet. We generated a novel dataset of 30 horses that allowed for both within-domain and outof-domain (unseen horse) testing. We find that pretraining on ImageNet strongly improves out-of-domain performance. Moreover, we show that for both pretrained and networks trained from scratch, better ImageNet-performing architectures perform better for pose estimation, with a substantial improvement on out-of-domain data when pretrained. Collectively, our results demonstrate that transfer learning is particularly beneficial for out-of-domain robustness.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Pose estimation is an important tool for understanding behavior, as it belies analysis of movement kinematics, action recognition, and ethology (Mason & Lott, 1976; Heinroth & Heinroth, 1966; Ijspeert, 2014; Anderson & Perona, 2014). Pose estimation on humans has reached remarkable capabilities due to innovations in both algorithms (Insafutdinov et al., 2017; Cao et al., 2017; He et al., 2017; Alp Guler et al., 2018; Xiao et al., 2018; Kreiss et al., 2019; Sun et al., 2019) and large- ¨ scale datasets (Lin et al., 2014; Andriluka et al., 2014; 2018). However, it is a challenging problem due to small joints, occlusions, clothing, and changes in background and scene statistics. Thus, many networks suffer when applied to out-of-domain data, i.e. images that are sufficiently different from the training set. For instance, they fail on very articulated human movements like skiing, or other ‘rare poses’, if not in the training set (Rhodin et al., 2018; Dang et al., 2019). Moreover, animal pose estimation has additional challenges. Not all animals share the same keypoints, therefore a universal “animal pose detector” is not feasible. Even building animal-specific networks would require a lot of data, due to the large variability in body shapes, colors, and the number of species as well as breeds of a type of animal. Therefore, the question of how one can robustly learn from limited annotated datasets is of particular importance, and animal pose estimation datasets allow for generalization to be systematically tested (Novotny et al., 2017).
12
+
13
+ How can robustness be achieved? Transfer learning, or the transferability of pretrained features from one task to another, is a powerful approach that has been well studied in computer vision (Donahue et al., 2014; Yosinski et al., 2014; Kummerer et al., 2016; Huh et al., 2016; He et al., 2018). It ¨ has been shown to improve performance on some human pose estimation tasks (Mehta et al., 2016; Mueller et al., 2017; Xiao et al., 2018; Insafutdinov et al., 2017), yet is not universally used in the top-performing networks on the human 2D/3D pose estimation benchmarks (Doersch & Zisserman, 2019). For keypoint detection, He et al. recently showed that pretraining on ImageNet did not result in overall performance improvements if randomly initialized models were allowed to train for much longer than usual, therefore suggesting that (given enough task-data) the main benefit of transfer learning is shorter training time, rather than performance (He et al., 2018). However, it has not been tested whether pretraining on ImageNet offers advantages in robustness, for instance as measured by any performance advantage on out-of-domain data.
14
+
15
+ We address this by building a new pose estimation task of 8, 114 labeled video frames from 30 Thoroughbred horses. We focus on horses as their diversity readily allows us to assess out-of-domain generalization, i.e. the ability to generalize to the different, unseen horses in different contexts. We created a task, called Horse-10, that uses only 10 horses for the test/train splits, and uses the other 20 horses to test out-of-domain performance (Figure 1). The data will be made available at TBA.
16
+
17
+ ![](images/731b3da0ff1d973cbbd2dd09e04b1a4db5c69e291dc8e2f188eb729b8f3a4d9e.jpg)
18
+ Figure 1: Horse Dataset: Example frames for each young Thoroughbred horse in the dataset. In each video the horse walks from left to right. The videos vary in horse color, the appearance of sunlight and shadow, and relative horse size as well as background. This makes the data set ideal for tests in robustness and generalization. To illustrate the horse-10 task we arranged the horses according to one split: the ten leftmost horses were used for train/test within-domain, and the rest are the out-of-domain held out horses.
19
+
20
+ Here we report two key insights: (1) higher ImageNet performance leads to better generalization for both within domain and on out-of-domain data for pose estimation but with a stronger effect on out-of-domain data (see Figure 2B); (2) transfer learning improves robustness again most strongly for out-of-domain data, and yields up to 3 times more accurate results than training from scratch (see Figure 4D,E). Thus, while it has been previously shown that training from scratch can match performance on in-domain data for sufficiently large amount of training data and training times (He et al., 2018), we show it clearly cannot match performance of pretrained networks on out-of-domain data (see Figure 5). Collectively, this sheds a new light on the inductive biases of “better ImageNet architectures” for visual tasks to be particularly beneficial for robustness, even beyond within domain data accuracy, on out-of-domain datasets.
21
+
22
+ # 2 RESULTS
23
+
24
+ To test within and out-of-domain performance we created a new dataset of 30 different walking horses (Thoroughbreds that are led by different humans), resulting in a dataset of 8, 114 images with 22 labeled body parts each. Horses have various coat colors and the “in-the-wild” aspect of the collected data at various Thoroughbred yearling sales and farms added additional complexity. The sunlight variation between each video added to the complexity of the learning challenge, as well as the handlers often wearing horse-leg-colored clothing. Some horses were in direct sunlight while others had the light behind them, and others were walking into and out of shadows, which was particularly problematic with a dataset dominated by dark colored coats (Figure 1). Thus, this dataset is ideal for testing robustness and out-of-sample generalization.
25
+
26
+ # .1 IMAGENET ACCURACY PREDICTS ANIMAL POSE ESTIMATION ACCURAC
27
+
28
+ To probe the role of different ImageNet pretrained architectures, we compared four variants of MobileNetV2 with varying expansion ratios, as the width multiplier parameterizes ImageNet performance over a wide range (see Methods), and two variants of ResNets (50 and 101 layers deep). We utilized a ‘simple’ yet competitive pose estimation architecture (Insafutdinov et al., 2016; Mathis et al., 2018) embedded in DeepLabCut, a toolbox for data-set generation, training, and evaluation (see Methods). The architectures then consisted of either MobileNetV2s (Sandler et al., 2018) or ResNets (He et al., 2016), where a single deconvolution layer is connected to the final convolutional layer to predict poses via body-part specific scoremaps as well as location refinement maps (Insafutdinov et al., 2016; Mathis et al., 2018). We created 3 splits containing 10 random horses each, and then varied the amount of training data from these 10 horses (referred to as Horse-10, see Methods). As the horses could vary dramatically in size across frames, due to the “in-the-wild” variation in distance from the camera, we used a normalized pixel error; i.e. we normalized the raw pixel errors by the eye-to-nose distance and report the fraction within this distance (Figure 2A). In total, we found that all pretrained-ImageNet networks showed great performance on Horse-10 within domain (Figures 2B, 7).
29
+
30
+ ![](images/37dbe0a7484a17b0998b14c94a78330aff9713a534eb2eb2a061d91f3f65a14c.jpg)
31
+ Figure 2: Transfer Learning boosts performance, especially on out-of-domain data. A: Illustration of the normalized error metric. B: Normalized Error vs. Network performance as ranked by the Top $1 \%$ accuracy on ImageNet (order by increasing ImageNet performance: MobileNetV2- 0.35, MobileNetV2-0.5, MobileNetV2-0.75, MobileNetV2-1, ResNet-50, ResNet-101). The pose estimation performance is for $5 0 \%$ training set fraction. The faint lines indicate data for the three splits. LEFT: Test data is in red, train is blue. RIGHT: additionally, pink is out-of-domain data; dashed lines indicate networks trained from scratch. Better ImageNet networks perform better on Horse-10; this relationship is even stronger for out-of-domain data. C: Example frames with human annotated body parts vs. predicted body parts for MobileNetV2-0.35 and ResNet-50 architectures with ImageNet pretraining on out-of-domain horses. D: Normalized Error vs. Training Set Fraction of Horse-10. For reference, $5 \%$ training data is $\approx 1 6 0$ frames. Darker to light red shades are test results for pretrained networks on within-domain data. Shades of pink show the test on out-ofdomain data (order according to ImageNet performance: ResNet-101, ResNet-50, MobileNetV2-1, MobileNetV2-0.75, MobileNetV2-0.5, MobileNetV2-0.35). E: Same as C but for training from scratch. F: Same as D but for training from scratch. All lines are averages of 3 splits (see Methods).
32
+
33
+ ![](images/cdee02af92618fdfa301fa2dc6b55c19164b90da666c1f9fcdb8d8ed46d53cc3.jpg)
34
+ Figure 3: Fraction of correctly identified bodyparts improves with transfer learning A: Percent Correct Keypoint (PCK) vs. Training Set Fraction shows high performance for all pretrained networks on Horse-10. B: Same as A, but training from scratch. The performance drops strongly, especially for out-of-domain data C: Performance gain when using transfer learning. All lines are averages of 3 splits, individual splits are shown as faint lines.
35
+
36
+ To further assess the errors we computed the percent correct keypoints (PCK; defined as within $3 0 \%$ of the distance from nose-to-eye, see Methods) and found that performance was nearly $9 7 \%$ for ResNets (with at least $2 0 \%$ training data) and only fell to $\approx 9 3 \%$ on MobileNetV2-based models (Figure 8A). Even with very small datasets $( 5 \%$ , i.e. around 160 training images) performance was $8 0 \%$ to $8 5 \%$ on MobileNetV2 and ResNets, respectively (Figure 8A).
37
+
38
+ Next, we directly compare the ImageNet performance to their respective performance on this pose estimation task. We find Top- $. 1 \%$ accuracy on ImageNet, correlates with pose estimation error (linear fit: slope $- 0 . 3 3 \%$ , $R ^ { 2 } = 0 . 9 5$ , $p = 0 . 0 0 1$ ; Figures 2B). This linear relationship is consistent with a recently reported correlation of ImageNet accuracy and performance for various object recognition tasks (Kornblith et al., 2019).
39
+
40
+ # 2.2 USING PRETRAINED-IMAGENET NETWORKS SIGNIFICANTLY BOOSTS OUT-OF-DOMAIN PERFORMANCE
41
+
42
+ The larger challenge is posed by the out-of-domain horses, rather than on different frames for same horses as used for training. Thus, we evaluated the performance of the networks that had been trained for various fractions of the training data and found that both MobileNetV2s and ResNets were robust (Figures 2B-D).
43
+
44
+ Most strikingly, on out-of-domain horses, the relationship between ImageNet performance and performance on Horse-10 was even stronger. This can be quantified by comparing the linear regression slope for out-of-domain test data: $- 1 . 6 \%$ pose-estimation improvement per percentage point of ImageNet performance, $R ^ { 2 } = 0 . 9 5$ , $p = 0 . 0 0 0 8$ vs. within-domain test data $- 0 . 3 3 \%$ , $\mathbf { \dot { \mathit { R } } ^ { 2 } } = 0 . 9 5$ , $p = 0 . 0 0 1 0$ (Figures 2B-F). In other words, less powerful models (MobileNetV2s) seem to overfit more on the training data. We mused that this improved generalization could be a consequence of the
45
+
46
+ ![](images/8f33e51f7b9bd2de920f8f721f4d4c16429c4e28057f84bbe0e423fd377e3f25.jpg)
47
+ Figure 4: Up to a 3X gain with transfer learning on out-of-domain data. A: Transfer learning gain vs. architectures with $5 0 \%$ of the data used for training (comparing pretrained networks to from-scratch from Figure 2B). B: Same as in A, but for varying levels of input data (5 to $90 \%$ ), light to dark, respectively. All lines are averages of 3 splits.
48
+
49
+ ImageNet pretraining or the architectures themselves. Thus, we trained the different architectures only on the task itself.
50
+
51
+ # 2.3 TASK-BASED TRAINING FROM SCRATCH
52
+
53
+ To assess the impact of ImageNet pretraining we also trained all architectures from scratch. Thereby we could directly test if the increased slope for out-of-domain performance across networks was merely a result of more powerful network architectures.
54
+
55
+ When training from scratch directly on the task for the same amount of iterations (see Methods), we found that all networks performed well on within domain data, given enough training data. The ResNets once again showed an advantage over the MobileNetV2 variants. All the networks performed worse on within domain compared to pretrained-ImageNet networks, and strikingly $2 X$ worse on out-of-domain data (Figures 2E,F).
56
+
57
+ The PCK for all networks as a fraction of the training set size also reflected this decrease in performance compared to pretraining (Figures 8A-C). For example, while PCK with pretrained ResNet network was nearly $\bar { 9 } 7 \%$ (with $2 0 \%$ of the training data), without pretraining this falls to around $8 0 \%$ . Out-of-domain performance drops substantially (pretrained vs. randomized initial weights; comparing Figure 8B to Figure 8C).
58
+
59
+ Without pretraining we find that the Top- $. 1 \%$ accuracy on ImageNet ranking of models only weakly correlates with pose estimation error (linear fit: slope $- 0 . 2 6 \%$ , $R ^ { 2 } = 0 . 5 3$ , $p = 0 . 1 6 6$ ; Figures 2B and 9B). On out-of-domain horses the slope was similar (slope $- 0 . 2 1 \%$ , $\bar { R ^ { 2 } } = 0 . 5 4 , p = 0 . 0 9 8 )$ , unlike when training from pretrained checkpoints. Taken together, our results suggests that ImageNet pretraining significantly boosts generalization (vs. just being a feature of the architectures themselves).
60
+
61
+ Next we quantified the amount of performance gain across all networks (with vs. without pretraining). We found an up to $2 X$ gain in performance (increase in PCK) with transfer learning (Figure 3A-C). Remarkably, for both ResNets and MobileNetV2s, pretraining on ImageNet boosts within domain and out-of-domain reduction in pixel-errors (Figure 4A,B), with the largest gains on out-of-domain data - with $9 0 \%$ of the training data there was a gain of up to a $3 X$ (Figure 4B).
62
+
63
+ # 2.4 FROM SCRATCH NETWORKS CANNOT MATCH THE PERFORMANCE OF PRETRAINED-IMAGENET NETWORKS ON OUT-OF-DOMAIN DATA
64
+
65
+ He et al. (2018) recently showed that training ResNets directly on COCO data for object detection, instance segmentation and key point detection, catches-up with pretrained network accuracy when training for $6 X$ more iterations as typical training schedules. However, due to the nature of the task, they did not test this relationship on out-of-domain data. Given that we see the largest gains of transfer learning on out-of-domain data, we asked if the randomly initialized networks could also catch-up on that metric.
66
+
67
+ ![](images/ae95a8dc6012eef8cac60ff784ba8dab4c6b71c305e2420b63cca8bebb009bb2.jpg)
68
+ Figure 5: Training randomly initialized networks longer cannot rescue out-of-domain performance. A: Normalized error vs. training iterations for ResNet 50 using $5 \%$ of the training data. Training from scratch for 600, 000 iterations does not match the performance of pretrained condition after 100, 000 iterations. Out-of-domain testing does not approach pretrained levels of performance. Faint, dashed lines are backwards projecting from lowest from scratch performance to aid in visualization. B: Same as A but using $50 \%$ of the training data. Test errors when training from scratch closely match the transfer learning performance after many iterations. Crucially, out-of-domain testing does not approach performance for pretrained network.
69
+
70
+ For all the network analysis so far, we trained for 100, 000 iterations (as the loss had relatively flattened), therefore we trained $6 X$ longer to see if test/training errors would decrease. Indeed, consistent with He et al. 2018, we found that randomly initialized networks could closely match the performance of pretrained networks, given enough data and time (Figure 5A, B); for smaller datasets $( 5 \%$ training data), this was not the case (Figure 5A), again suggesting that pretrained-networks offer an advantage for small datasets, which is particularly important for applications in biology (Mathis et al., 2018).
71
+
72
+ Crucially, and most strikingly, for out-of-domain data this was not the case: the from-scratch trained networks never caught up (and indeed plateaued early; Figure 5A, B). Thus, transfer learning offers multiple advantages. Not only does pretraining networks on ImageNet allow for using smaller datasets and shorter training time, it also significantly improves robustness.
73
+
74
+ # 3 DISCUSSION
75
+
76
+ Here we report two key findings: (1) pretrained-ImageNet networks offer an advantage: shorter training times, less data requirements, and robustness on out-of-domain data, and (2) networks that have higher ImageNet performance lead to better generalization, especially on out-of-domain data. Recently, it was shown that for many object recognition datasets the transfer ability is improved when fine-tuning architectures with better ImageNet performance (Kornblith et al., 2019; Huh et al., 2016). In fact, Kornblith et al. (2019) find high correlation between between ImageNet and transfer accuracy for other recognition tasks $( r > 0 . 9 5 )$ ). In contrast to the exhaustive study by Kornblith et al., we only focused on two architecture types: ResNets (He et al., 2016) and MobileNetV2s (Sandler et al., 2018). However, we vary parameters of those networks to also span a broad range of ImageNet accuracies. Consistent with Kornblith et al, we find that ImageNet accuracy is weakly correlated with performance on pose estimation when trained from scratch $R ^ { 2 } = 0 . 5 \dot { 3 }$ ), and strongly when fine-tuning $R ^ { 2 } = 0 . 9 5 )$ . We also find that “better” ImageNet networks transfer better. Moreover, we show that transfer learning significantly improves performance on out-of-domain data.
77
+
78
+ ![](images/0c86f831246d9acabf504ef5ee319c5f340f85fe9ad114ffa2ede2ceaabc8e10.jpg)
79
+ Figure 6: Summary of Findings: We present a new horse dataset for testing within and out-ofdomain performance for pose estimation. We tested two classes of models, MobileNetV2s and ResNets, which span a wide range of performance on ImageNet. We find that networks that perform better on ImageNet are better for pose estimation. We also find that pretrained-ImageNet models strongly improve out-of-domain robustness.
80
+
81
+ # 3.1 TRANSFER LEARNING
82
+
83
+ We show that for both within and out-of-domain pose estimation tasks, transfer learning improves performance. Most notably, transfer learning boosts out-of-domain generalization, improving up to $3 X$ compared to networks without pretraining, and even when training for much longer, as suggested in He et al. (2018), this gap cannot be closed.
84
+
85
+ Another important insight is that for small amounts of data, pretrained networks offer a large advantage (Figures 4 & 5). Corroborating He et al. (2018) we find that given enough training data, training from scratch, with purely task-driven training can match the performance of of transfer learning; however, we also found that for out-of-domain data, pretraining helps significantly, boosting performance up to 3 times (Figure 4).
86
+
87
+ # 3.2 ON THE IMPORTANCE OF DATA
88
+
89
+ Looking forward, this suggests that collecting annotations of task data (instead of pretraining data) is more useful. We think that benchmarks with different contexts, like Horse-10, are important to improve pose estimation algorithms for biological applications (i.e. for small-scale lab-based experiments). A future goal will be to limit, or remove, training altogether. However, in order to create networks that generalize across laboratories and setups, transfer learning will be important for robustness. Yet, more work needs to be done to close the gap between within domain and outof-domain generalization.
90
+
91
+ What is the limit of transfer learning? Would ever larger data sets give better generalization? Interestingly, it appears to strongly depend on what task the network was pretrained on. Recent work by Mahajan et al. (2018) showed that pretraining for large-scale hashtag predictions on Instagram data (3.5 billion images) improves classification, while at the same time possibly harming localization performance for tasks like object detection, instance segmentation, and keypoint detection. This highlights the importance of the task, rather then the sheer size as a crucial factor. Further corroborating this insight, Li et al. showed that pretraining on large-scale object detection task can improve performance for tasks that require fine, spatial information like segmentation (Li et al., 2019). Thus, one interesting future direction to boost robustness could be to utilize networks pretrained on OpenImages, which contains bounding boxes for 15 million instances and close to 2 million images (Kuznetsova et al., 2018).
92
+
93
+ # 3.3 MOBILENETV2 FOR FAST POSE ESTIMATION
94
+
95
+ Here, we introduce using MobileNetV2 variants for animal pose estimation that can achieve high accuracy but with $2 . 5 X$ the speed as a ResNet backbone (Figure 10), making pretrained-MobileNetV2 an excellent option for real-time applications in the wild (on mobile-phones) and in the laboratory.
96
+
97
+ If an end-user utilizes small training sets, ResNets offer an advantage, yet MobileNetV2s are significantly faster (Figure 10) and performs reasonably well, within domain; i.e. to match the ResNet-101 performance with $1 0 \%$ of the training set one needs about $5 0 \%$ for the best MobileNetV2. Potentially, the few pixels lost in accuracy is worth the significant speed improvement (twice as fast) for high-throughput experiments and for real-time applications. MobileNetV2 can run batch inference of $( > 2 , 5 0 0 F P S )$ on a GPU. Using MobileNetV2 also has other advantages: one, MobileNetV2 has low memory demands, and even runs on mobile phones, as the name suggests; two: on CPUs one gets even more speed improvements (Figure 10).
98
+
99
+ What are the trade-offs? With more data for training the MobileNetV2 match the performance of ResNets trained with less labeling data (Figure 2B). However, the ResNets still perform best with matched amounts of data. Thus, to close this gap “Student-Teacher networks” could be used. For example, one could build a larger and more robust ResNet-101 network, then run inference to generate a larger dataset to train the MobileNetV2 variant for fast inference on within domain data.
100
+
101
+ # 4 CONCLUSIONS
102
+
103
+ We found a significant advantage of using pretrained networks for out-of-domain robustness. While there is still a gap to close, we believe this work demonstrates that transfer learning approaches are powerful to build robust architectures. We also demonstrate that ImageNet performance correlates with animal pose estimation accuracy on a challenging “in-the-wild” new horse dataset (Figure 6). Moreover, we aim to add a new variant of networks to the open-source DeepLabCut project, MobileNetV2s, that pave the way for fast and accurate pose estimation. Collectively, our work highlights that pretrained networks require less training data, and allow for faster training, and boost robustness, especially for out-of-domain data.
104
+
105
+ # 5 METHODS
106
+
107
+ # 5.1 HORSE DATASET
108
+
109
+ Here we developed a novel horse data set comprising 30 different horses captured for $4 - 1 0$ seconds with a GoPro camera (Resolution: $1 9 2 0 \times 1 0 8 0$ , Frame Rate: 60 FPS), which we call Horse-30. We used the DeepLabCut2.0 toolbox (Nath et al., 2019) for labeling. We downsampled the frames by a factor of $1 5 \%$ to speed-up the benchmarking process ( $2 8 8 \times 1 6 2$ pixels; one video was downsampled to $3 0 \%$ ).
110
+
111
+ Using previously established anatomical landmarks for equine biomechanical evaluation (Magnusson & Thafvellin, 1990; Anderson & McIlwraith, 2004), the following 22 body parts were labeled by an expert in Thoroughbred horses [BR] across 8, 114 frames: Nose, Eye, Nearknee, Nearfrontfetlock, Nearfrontfoot, Offknee, Offfrontfetlock, Offfrontfoot, Shoulder, Midshoulder, Elbow, Girth, Wither, Nearhindhock, Nearhindfetlock, Nearhindfoot, Hip, Stifle, Offhindhock, Offhindfetlock, Offhindfoot, Ischium.
112
+
113
+ We created 3 splits that contain 10 randomly selected training horses each (referred to as Horse-10). For each training set we took a subset of $5 \%$ $\approx 1 6 0$ frames), $1 0 \%$ $\approx 3 0 0$ frames), $2 0 \%$ $\approx 5 6 0$ frames), $5 0 \%$ $\approx 1 4 7 0$ frames), and $9 0 \%$ $\approx 2 5 8 0$ frames) of the frames for training, and then evaluated the performance on the training, test, and unseen (“out-of-domain”) horses (i.e. the other horses that are in Horse-30, but were not in the given split of Horse-10). As metric we used mean average Euclidean error, which is computed by comparing the inferred poses for each body parts against the human prediction as well as percent correct key-point (PCK) values; i.e. what fraction of machine-applied points fall within a specific range of human-labeled ground-truth labels; although we use a matching threshold of $3 0 \%$ of the head segment length (nose to eye for horse, which was computed by taking the median for all annotated images per horse) rather than $5 0 \%$ as for MPII pose (Andriluka et al., 2014).
114
+
115
+ # 5.2 NETWORK VARIANTS
116
+
117
+ For this study we utilized a recently introduced an animal pose estimation toolbox called DeepLabCut (Mathis et al., 2018; Mathis & Warren, 2018; Nath et al., 2019). The TensorFlow-based network architectures could be easily exchanged while keeping data loading, training, and evaluation consistent.
118
+
119
+ DeepLabCut (Mathis et al., 2018; Nath et al., 2019) is built on a subset of the deep feature detectors in DeeperCut (Insafutdinov et al., 2016). The feature detectors in DeepLabCut consist of residual networks (ResNets) (He et al., 2016) followed by deconvolutional layers to predict pose scoremaps and location refinement maps, which can then be used for predicting the pose while also proving a confidence score (Insafutdinov et al., 2016; Mathis et al., 2018). We utilize an output stride of 16 for the ResNets (achieved by atrous convolution) and then upsample the filter banks with deconvolutions by a factor of two to predict the heatmaps and location-refinement at 1/8th of the original image size scale. This gives a good balance of feature-map size and accuracy. However, the ratio can, of course, be changed and this affects speed, while still being relatively robust (Insafutdinov et al., 2016).
120
+
121
+ Here we also introduce a MobileNetV2 architecture that could be used within DeepLabCut (Sandler et al., 2018). MobileNetV2 utilizes depth-wise separable convolutions, inverted residual bottlenecks to significantly decrease the number of operations and memory needed while retaining high accuracy for ImageNet, object detection and image segmentation accuracy (Sandler et al., 2018). We configured the output-stride as 16 (by changing the (otherwise) last stride 2 convolution to stride 1). We utilized four variants of MobileNetV2 with different expansion ratios (0.35, 0.5, 0.75 and 1) as this ratio modulates the ImageNet accuracy from $6 0 . 3 \%$ to $7 1 . 8 \%$ , and pretrained models on ImageNet are available from TensorFlow (Abadi et al., 2016).
122
+
123
+ # 5.3 NETWORK TRAINING PARAMETERS
124
+
125
+ Most training parameters used here are consistent with the ones reported in DeepLabCut-2.0. (Nath et al., 2019). The training loss is defined as the cross entropy loss for the scoremaps and the location refinement error via a Huber loss with weight 0.05; it is minimized via stochastic gradient descent with batch size 1 (Insafutdinov et al., 2016; Mathis et al., 2018). We use the following training schedule: 0.005 for the first $1 0 k$ iterations then 0.02 onwards. For training from scratch, we had to start with a lower learning rate to avoid divergence of the loss and used $\bar { 1 } 0 ^ { - 6 }$ for the first 5, 000 steps, then $1 0 ^ { - 4 }$ for the next $2 0 k$ , followed by 0.02. We always trained for $1 0 0 k$ iterations, unless noted. When training up to $6 0 0 k$ iterations, we changed to 0.002 after $4 3 0 k$ iterations (as it is default for DeepLabCut).
126
+
127
+ # Speed Benchmarking
128
+
129
+ Using an example from the horse dataset we evaluated one video with 11, 178 frames at resolutions $5 1 2 \times 5 1 2$ , $2 5 6 \times 2 5 6$ and $1 2 8 \times 1 2 8$ . We used batch sizes: $[ 1 , 2 , 4 , 1 6 , 3 2 , 1 2 8 , 2 5 6 , 5 1 2 ]$ , and ran all models for all 3 (training set shuffles) trained with $5 0 \%$ of the data in a pseudo random order on an NVIDIA Titan RTX. For the benchmarking on a CPU we used shortened videos with merely 728 frames; the CPU was an Intel Xeon CPU E5-2603 v4 $@$ 1.70GHz with 6 cores. We also changed the inference code from its numpy implementation (Mathis & Warren, 2018) to TensorFlow, which brings a $2 - 1 0 \%$ gain in speed.
130
+
131
+ # REFERENCES
132
+
133
+ Mart´ın Abadi, Paul Barham, Jianmin Chen, Zhifeng Chen, Andy Davis, Jeffrey Dean, Matthieu Devin, Sanjay Ghemawat, Geoffrey Irving, Michael Isard, et al. Tensorflow: a system for largescale machine learning. In OSDI, volume 16, pp. 265–283, 2016.
134
+ Rıza Alp Guler, Natalia Neverova, and Iasonas Kokkinos. Densepose: Dense human pose estimation ¨ in the wild. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 7297–7306, 2018.
135
+ D. J. Anderson and P. Perona. Toward a science of computational ethology. Neuron, 84(1):18–31, Oct 2014. URL https://doi.org/10.1016/j.neuron.2014.09.005.
136
+ TM Anderson and CW McIlwraith. Longitudinal development of equine conformation from weanling to age 3 years in the thoroughbred. Equine veterinary journal, 36(7):563–570, 2004.
137
+
138
+ Mykhaylo Andriluka, Leonid Pishchulin, Peter Gehler, and Bernt Schiele. 2d human pose estimation: New benchmark and state of the art analysis. In Proceedings of the IEEE Conference on computer Vision and Pattern Recognition, pp. 3686–3693, 2014. URL http: //ieeexplore.ieee.org/document/6909866/.
139
+
140
+ Mykhaylo Andriluka, Umar Iqbal, Eldar Insafutdinov, Leonid Pishchulin, Anton Milan, Juergen Gall, and Bernt Schiele. Posetrack: A benchmark for human pose estimation and tracking. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 5167– 5176, 2018.
141
+
142
+ Zhe Cao, Tomas Simon, Shih-En Wei, and Yaser Sheikh. Realtime multi-person 2d pose estimation using part affinity fields. In CVPR, 2017.
143
+
144
+ Qi Dang, Jianqin Yin, Bin Wang, and Wenqing Zheng. Deep learning based 2d human pose estimation: A survey. Tsinghua Science and Technology, 24(6):663–676, Dec 2019. ISSN 1007-0214. doi: 10.26599/TST.2018.9010100.
145
+
146
+ Carl Doersch and Andrew Zisserman. Sim2real transfer learning for 3d pose estimation: motion to the rescue. CoRR, abs/1907.02499, 2019. URL http://arxiv.org/abs/1907.02499.
147
+
148
+ Jeff Donahue, Yangqing Jia, Oriol Vinyals, Judy Hoffman, Ning Zhang, Eric Tzeng, and Trevor Darrell. DeCaf: A deep convolutional activation feature for generic visual recognition. In International conference on machine learning, pp. 647–655, 2014. URL https://arxiv.org/ abs/1310.1531.
149
+
150
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 770–778, 2016. URL https://arxiv.org/abs/1512.03385.
151
+
152
+ Kaiming He, Georgia Gkioxari, Piotr Dollar, and Ross Girshick. Mask r-cnn. In ´ Proceedings of the IEEE international conference on computer vision, pp. 2961–2969, 2017.
153
+
154
+ Kaiming He, Ross Girshick, and Piotr Dollar. Rethinking imagenet pre-training. ´ arXiv preprint arXiv:1811.08883, 2018.
155
+
156
+ Oskar Heinroth and Magdalena Wiebe Heinroth. Die Vogel Mitteleuropas: in allen Lebens-und ¨ Entwicklungsstufen photographisch aufgenommen und in ihrem Seelenleben bei der Aufzucht vom Ei ab beobachtet, volume 1. Edition Leipzig, 1966.
157
+
158
+ Minyoung Huh, Pulkit Agrawal, and Alexei A Efros. What makes imagenet good for transfer learning? arXiv preprint arXiv:1608.08614, 2016.
159
+
160
+ Auke J Ijspeert. Biorobotics: Using robots to emulate and investigate agile locomotion. science, 346(6206):196–203, 2014.
161
+
162
+ Eldar Insafutdinov, Leonid Pishchulin, Bjoern Andres, Mykhaylo Andriluka, and Bernt Schiele. DeeperCut: A deeper, stronger, and faster multi-person pose estimation model. In European Conference on Computer Vision, pp. 34–50. Springer, 2016. URL https://arxiv.org/ abs/1605.03170.
163
+
164
+ Eldar Insafutdinov, Mykhaylo Andriluka, Leonid Pishchulin, Siyu Tang, Evgeny Levinkov, Bjoern Andres, and Bernt Schiele. Arttrack: Articulated multi-person tracking in the wild. In CVPR’17, 2017. URL http://arxiv.org/abs/1612.01465.
165
+
166
+ Simon Kornblith, Jonathon Shlens, and Quoc V Le. Do better imagenet models transfer better? In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 2661– 2671, 2019.
167
+
168
+ Sven Kreiss, Lorenzo Bertoni, and Alexandre Alahi. Pifpaf: Composite fields for human pose estimation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 11977–11986, 2019.
169
+
170
+ Matthias Kummerer, Thomas SA Wallis, and Matthias Bethge. Deepgaze ii: Reading fixations ¨ from deep features trained on object recognition. arXiv preprint arXiv:1610.01563, 2016. URL https://arxiv.org/abs/1610.01563.
171
+
172
+ Alina Kuznetsova, Hassan Rom, Neil Alldrin, Jasper Uijlings, Ivan Krasin, Jordi Pont-Tuset, Shahab Kamali, Stefan Popov, Matteo Malloci, Tom Duerig, et al. The open images dataset v4: Unified image classification, object detection, and visual relationship detection at scale. arXiv preprint arXiv:1811.00982, 2018.
173
+
174
+ Hengduo Li, Bharat Singh, Mahyar Najibi, Zuxuan Wu, and Larry S Davis. An analysis of pretraining on object detection. arXiv preprint arXiv:1904.05871, 2019.
175
+
176
+ Tsung-Yi Lin, Michael Maire, Serge Belongie, James Hays, Pietro Perona, Deva Ramanan, Piotr Dollar, and C Lawrence Zitnick. Microsoft coco: Common objects in context. In ´ European conference on computer vision, pp. 740–755. Springer, 2014.
177
+
178
+ Lars-Erik Magnusson and B Thafvellin. Studies on the conformation and related traits of standardbred trotters in sweden. Journal of Animal Physiology and Animal Nutrition (Germany, FR), 1990.
179
+
180
+ Dhruv Mahajan, Ross Girshick, Vignesh Ramanathan, Kaiming He, Manohar Paluri, Yixuan Li, Ashwin Bharambe, and Laurens van der Maaten. Exploring the limits of weakly supervised pretraining. In Proceedings of the European Conference on Computer Vision (ECCV), pp. 181– 196, 2018.
181
+
182
+ William A Mason and Dale F Lott. Ethology and comparative psychology. Annual Review of Psychology, 27(1):129–154, 1976.
183
+
184
+ A Mathis, P Mamidanna, KM Cury, T Abe, VN Murthy, MW Mathis, and M Bethge. Deeplabcut: markerless pose estimation of user-defined body parts with deep learning. Nature Neuroscience, 21(9):1281–1289, 2018.
185
+
186
+ Alexander Mathis and Richard A. Warren. On the inference speed and video-compression robustness of deeplabcut. BioRxiv, 2018. doi: 10.1101/457242. URL https://doi.org/10.1101/ 457242.
187
+
188
+ Dushyant Mehta, Helge Rhodin, Dan Casas, Oleksandr Sotnychenko, Weipeng Xu, and Christian Theobalt. Monocular 3d human pose estimation using transfer learning and improved cnn supervision. ArXiv, abs/1611.09813, 2016.
189
+
190
+ Franziska Mueller, Florian Bernard, Oleksandr Sotnychenko, Dushyant Mehta, Srinath Sridhar, Dan Casas, and Christian Theobalt. Ganerated hands for real-time 3d hand tracking from monocular RGB. CoRR, abs/1712.01057, 2017. URL http://arxiv.org/abs/1712.01057.
191
+
192
+ Tanmay Nath, Alexander Mathis, An Chi Chen, Amir Patel, Matthias Bethge, and Mackenzie Weygandt Mathis. Using deeplabcut for 3d markerless pose estimation across species and behaviors. Nature Protocols, 14:2152–2176, 2019.
193
+
194
+ David Novotny, Diane Larlus, and Andrea Vedaldi. Anchornet: A weakly supervised network to learn geometry-sensitive features for semantic matching. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 5277–5286, 2017.
195
+
196
+ Helge Rhodin, Jorg Sp ¨ orri, Isinsu Katircioglu, Victor Constantin, Fr ¨ ed´ eric Meyer, Erich M ´ uller, ¨ Mathieu Salzmann, and Pascal Fua. Learning monocular 3d human pose estimation from multiview images. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 8437–8446, 2018.
197
+
198
+ Mark Sandler, Andrew Howard, Menglong Zhu, Andrey Zhmoginov, and Liang-Chieh Chen. Mobilenetv2: Inverted residuals and linear bottlenecks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 4510–4520, 2018.
199
+
200
+ Ke Sun, Bin Xiao, Dong Liu, and Jingdong Wang. Deep high-resolution representation learning for human pose estimation. arXiv preprint arXiv:1902.09212, 2019.
201
+
202
+ Bin Xiao, Haiping Wu, and Yichen Wei. Simple baselines for human pose estimation and tracking. CoRR, abs/1804.06208, 2018. URL http://arxiv.org/abs/1804.06208.
203
+
204
+ Jason Yosinski, Jeff Clune, Yoshua Bengio, and Hod Lipson. How transferable are features in deep neural networks? In Advances in neural information processing systems, pp. 3320–3328, 2014.
205
+
206
+ A APPENDIX
207
+
208
+ ![](images/8d746d88abc55d3007e9333e4c5b828444df5c75efe3706d696735fa3c13d361.jpg)
209
+ Figure 7: Example frames with human and pretrained network annotations. Here we show the smallest networks, namely ResNet-50 and the ultra-lightweight MobileNetV2-0.35, trained for 100, 000 iterations. Top Left set: example training images. Top Right: within domain test image results. Bottom: out-of-domain horses. Examples illustrate the challenges: varying coat colors, size changes, background, human legs, various postures, background horses, and partially occluded horses while they walk in and out of the video frames.
210
+
211
+ ![](images/24e621bdebdbc97f555e240f2bc8947c5539271b8087c3720855e3e1118cc175.jpg)
212
+ Figure 8: Transfer Learning boosts accuracy (PCK). A: Percent Correct Keypoint (PCK) vs. Training Set Fraction shows high performance for all networks on Horse-10. Darker to light red shades are test results for pretrained networks: ResNet-101, ResNet-50, MobileNetV2-1, MobileNetV2-0.75, MobileNetV2-0.5, MobileNetV2-0.35. Darker to lighter blue is for training, the same ordering as in test. All lines are averages of 3 splits (see Methods). B: Same as in A, plus the out-of-domain data (pink is for out-of-domain data on 20 unseen horses). C: Same as in B, but without pretraining on ImageNet.
213
+
214
+ ![](images/594b9db788576f6a1c41b43223914f86854e6594adee1824a2ecc8ab8b0267f6.jpg)
215
+ Figure 9: Test and training performance when training from scratch.) A: Normalized Error vs. Training Set Fraction of Horse-10. $5 \%$ is $\approx ~ 1 6 0$ frames. Darker to light red shades are test results for ResNet-101, ResNet-50, MobileNetV2-1, MobileNetV2-0.75, MobileNetV2-0.5, MobileNetV2-0.35. Darker to lighter blue is for training, same ordering as in test. B: Normalized Error vs. Network performance as ranked by the Top $1 \%$ accuracy on ImageNet, but here on Horse-10; namely, MobileNetV2-0.35, MobileNetV2-0.5, MobileNetV2-.75, MobileNetV2-1, ResNet-50, ResNet-101. Test data is in red, train is blue. This data is for $5 0 \%$ training set fraction.
216
+
217
+ ![](images/ebfa3d0655a6d7c01d6622dcbabfe43f362ebab95773f43f4ec130a3f9180b70.jpg)
218
+ Figure 10: Speed Benchmarking for ResNets and MobileNetV2s: Inference speed for videos of different dimensions for all the architectures. A-C: FPS vs. batchsize, with video frame sizes as stated in the title. Three splits are shown for each network. MobileNetV2 gives a more than 2X speed improvement (over ResNet-50) for offline processing and about $4 0 \%$ for batchsize $^ { \cdot = 1 }$ on a Titan RTX GPU. On CPU we found even larger gains.
219
+
220
+ Table 1: Batch size 1 (FPS): Mean inference speed for batchsize $^ { = 1 }$ and batchsize ${ } = 2 5 6$ (Table 2) for there different video frame sizes on a Titan RTX GPU. Video was $\approx 1 1$ , 000 frames long of a horse, with 22 bodyparts to be identified. See Methods for further details.
221
+
222
+ <table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>128x128</td><td rowspan=1 colspan=1>256x256</td><td rowspan=1 colspan=1>512x512</td></tr><tr><td rowspan=1 colspan=1>MobileNetV2-0.35</td><td rowspan=1 colspan=1>195</td><td rowspan=1 colspan=1>132</td><td rowspan=1 colspan=1>65</td></tr><tr><td rowspan=1 colspan=1>MobileNetV2-0.50</td><td rowspan=1 colspan=1>185</td><td rowspan=1 colspan=1>131</td><td rowspan=1 colspan=1>61</td></tr><tr><td rowspan=1 colspan=1>MobileNetV2-0.75</td><td rowspan=1 colspan=1>185</td><td rowspan=1 colspan=1>129</td><td rowspan=1 colspan=1>55</td></tr><tr><td rowspan=1 colspan=1>MobileNetV2-1</td><td rowspan=1 colspan=1>190</td><td rowspan=1 colspan=1>132</td><td rowspan=1 colspan=1>53</td></tr><tr><td rowspan=1 colspan=1>ResNet-50</td><td rowspan=1 colspan=1>146</td><td rowspan=1 colspan=1>99</td><td rowspan=1 colspan=1>45</td></tr><tr><td rowspan=1 colspan=1>ResNet-101</td><td rowspan=1 colspan=1>93</td><td rowspan=1 colspan=1>69</td><td rowspan=1 colspan=1>34</td></tr></table>
223
+
224
+ Table 2: Batch size 256 (FPS)
225
+
226
+ <table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>128x128</td><td rowspan=1 colspan=1>256x256</td><td rowspan=1 colspan=1>512x512</td></tr><tr><td rowspan=1 colspan=1>MobileNetV2-0.35</td><td rowspan=1 colspan=1>2557</td><td rowspan=1 colspan=1>784</td><td rowspan=1 colspan=1>176</td></tr><tr><td rowspan=1 colspan=1>MobileNetV2-0.50</td><td rowspan=1 colspan=1>2338</td><td rowspan=1 colspan=1>711</td><td rowspan=1 colspan=1>161</td></tr><tr><td rowspan=1 colspan=1>MobileNetV2-0.75</td><td rowspan=1 colspan=1>2008</td><td rowspan=1 colspan=1>568</td><td rowspan=1 colspan=1>128</td></tr><tr><td rowspan=1 colspan=1>MobileNetV2-1</td><td rowspan=1 colspan=1>1834</td><td rowspan=1 colspan=1>523</td><td rowspan=1 colspan=1>118</td></tr><tr><td rowspan=1 colspan=1>ResNet-50</td><td rowspan=1 colspan=1>1208</td><td rowspan=1 colspan=1>339</td><td rowspan=1 colspan=1>84</td></tr><tr><td rowspan=1 colspan=1>ResNet-101</td><td rowspan=1 colspan=1>902</td><td rowspan=1 colspan=1>249</td><td rowspan=1 colspan=1>62</td></tr></table>
md/train/BkgNqkHFPr/BkgNqkHFPr.md ADDED
@@ -0,0 +1,375 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ENHANCED CONVOLUTIONAL NEURAL KERNELS
2
+
3
+ # Anonymous authors
4
+
5
+ Paper under double-blind review
6
+
7
+ # ABSTRACT
8
+
9
+ Recent research shows that for training with $\ell _ { 2 }$ loss, convolutional neural networks (CNNs) whose width (number of channels in convolutional layers) goes to infinity correspond to regression with respect to the CNN Gaussian Process kernel (CNN-GP) (Novak et al., 2019) if only the last layer is trained, and correspond to regression with respect to the Convolutional Neural Tangent Kernel (CNTK) if all layers are trained. An exact algorithm to compute CNTK (Arora et al., 2019) yielded the finding that classification accuracy of CNTK on CIFAR-10 is within $6 { - } 7 \%$ of that of the corresponding CNN architecture (best figure being around $78 \%$ which is interesting performance for a fixed kernel.
10
+
11
+ Here we show how to significantly enhance the performance of these kernels using two ideas. (1) Modifying the kernel using a new operation called Local Average Pooling (LAP) which preserves efficient computability of the kernel and inherits the spirit of standard data augmentation using pixel shifts. Earlier papers were unable to incorporate naive data augmentation because of the quadratic training cost of kernel regression. This idea is inspired by Global Average Pooling (GAP), which we show for CNN-GP and CNTK is equivalent to full translation data augmentation. (2) Representing the input image using a pre-processing technique proposed by Coates et al. (2011), which uses a single convolutional layer composed of random image patches.
12
+
13
+ On CIFAR-10, the resulting kernel, CNN-GP with LAP and horizontal flip data augmentation, achieves $8 9 \%$ accuracy, matching the performance of AlexNet (Krizhevsky et al., 2012) , and outperforms the best previous classifier that is not a trained neural network (Mairal, 2016). Similar improvements are obtained for Fashion-MNIST.
14
+
15
+ # 1 INTRODUCTION
16
+
17
+ Recent research shows that for training with $\ell _ { 2 }$ loss, convolutional neural networks (CNNs) whose width (number of channels in convolutional layers) goes to infinity, correspond to regression with respect to the CNN Gaussian Process kernel (CNN-GP) if only the last layer is trained (Novak et al., 2019; Garriga-Alonso et al., 2019), and correspond to regression with respect to the Convolutional Neural Tangent Kernel (CNTK) if all layers are trained (Jacot et al., 2018; Allen-Zhu et al., 2018; Du et al., 2019b; Arora et al., 2019). Novak et al. (2019); Garriga-Alonso et al. (2019) also implemented CNN-GP and tested its empirical performance. An efficient exact algorithm was given (Arora et al., 2019) to compute CNTK for CNN architectures, as well as those that include a Global Average Pooling (GAP) layer (defined below). This is a fixed kernel that inherits some benefits of CNNs, including exploitation of locality via convolution, as well as multiple layers of processing. For CIFAR-10, incorporating GAP into the kernel improves classification accuracy by up to $1 0 \%$ compared to pure convolutional CNTK.
18
+
19
+ While this performance is encouraging for a fixed kernel, the best accuracy is still under $7 8 \%$ , which is disappointing even compared to AlexNet. One hope for improving the accuracy further is to somehow capture modern innovations such as batch normalization, data augmentation, residual layers, etc. in CNTK. The current paper shows how to incorporate simple data augmentation. Specifically, the idea of creating new training images from existing images using pixel translation and flips, while assuming that these operations should not change the label. Since deep learning uses stochastic gradient descent (SGD), it is trivial to do such data augmentation on the fly. However, it’s unclear how to efficiently incorporate data augmentation in kernel regression, since training time is quadratic in the number of training images.
20
+
21
+ Thus somehow data augmentation has to be incorporated into the computation of the kernel itself. The main observation here is that the above-mentioned algorithm for computing CNTK involves a dynamic programming whose recursion depth is equal to the depth of the corresponding finite CNN. It is possible to impose symmetry constraints at any desired layer during this computation. In this viewpoint, it can be shown that prediction using CNTK/CNN-GP with GAP is equivalent to prediction using CNTK/CNN-GP without GAP but with full translation data augmentation with wraparound at the boundary. The translation invariance property implicitly assumed in data augmentation is exactly equivalent to an imposed symmetry constraint in the computation of the CNTK which in turn is derived from the pooling layer in the CNN. See Section 4 for more details.
22
+
23
+ Thus GAP corresponds to full translation data augmentation scheme, but in practice such data augmentation creates unrealistic images (cf. Figure 2) and training on them can harm performance. However, the idea of incorporating symmetry in the dynamic programming leads to a variant we call Local Average Pooling (LAP). This implicitly is like data augmentation where image labels are assumed to be invariant to small translation, say by a few pixels. Interestingly, LAP corresponds to a average pooling layer for CNNs, named box filtering (Szeliski, 2010).
24
+
25
+ Experimentally, we find LAP significantly enhances the performance as discussed below.
26
+
27
+ • In extensive experiments on CIFAR-10 and Fashion-MNIST, we find LAP consistently improves performance of CNN-GP and CNTK. In particular, we find CNN-GP with LAP achieves $8 1 \%$ on CIFAR-10 dataset, outperforming the best previous kernel predictor by $3 \%$ .
28
+ • When using the technique proposed by Coates et al. (2011), which uses randomly sampled patches from training data as filters to do pre-processing,2 CNN-GP with LAP and horizontal flip data augmentation achieves $8 9 \%$ accuracy on CIFAR-10, matching the performance of AlexNet (Krizhevsky et al., 2012) and is the strongest classifier that is not a trained neural network.3 We also test performance of CNNs with an extra layer corresponding to LAP and observe that it improves the performance on certain architectures.
29
+
30
+ # 2 RELATED WORK
31
+
32
+ Data augmentation has long been known to improve the performance of neural network and kernel methods (Sietsma & Dow, 1991; Scholkopf et al.¨ , 1996). Theoretical study of data augmentation dates back to Chapelle et al. (2001). Recently, Dao et al. (2018) proposed a theoretical framework for understanding data augmentation and showed data augmentation with a kernel classifier can have feature averaging and variance regularization effects. More recently, Chen et al. (2019) quantitatively shows in certain settings, data augmentation provably improves the classifier performance. For more comprehensive discussion on data augmentation and its properties, we refer readers to Dao et al. (2018); Chen et al. (2019) and references therein.
33
+
34
+ CNN-GP and CNTK correspond to infinitely wide CNN with different training strategies (only training the top layer or training all layers jointly). The correspondence between infinite neural networks and kernel machines was first noted by Neal (1996). More recently, this was extended to deep and convolutional neural networks (Lee et al., 2018; Matthews et al., 2018; Novak et al., 2019; Garriga-Alonso et al., 2019). These kernels correspond to infinitely wide neural networks where only the last layer is trained. A recent line of work studied overparameterized neural networks where all layers are trained (Allen-Zhu et al., 2018; Du et al., 2019b; 2018; Li & Liang, 2018; Zou et al., 2018). Their proofs imply the gradient kernel is close to a fixed kernel which only depends the training data and neural network architecture. These kernels thus correspond to infinitely wide neural networks where are all layers are trained. Jacot et al. (2018) named this kernel, neural tangent kernel (NTK). Arora et al. (2019) formally proved infinitely wide neural net predictor trained by gradient descent is equivalent to NTK predictor. Recently, NTKs induced by various neural network architectures are derived and shown to achieve strong empirical performance (Arora et al., 2019; Yang, 2019; Du et al., 2019a).
35
+
36
+ Global Average Pooling (GAP) was first proposed in Lin et al. (2013) and is common in modern CNN design (Springenberg et al., 2014; He et al., 2016; Huang et al., 2017). However, current theoretical understanding on GAP is still rather limited. It has been conjectured in Lin et al. (2013) that GAP reduces the number of parameters in the last fully-connected layer and thus avoids overfitting, and that GAP is more robust to spatial translations of the input since it sums out the spatial information. In this work, we study GAP from the CNN-GP and CNTK perspective, and draw an interesting connection between GAP and data augmentation.
37
+
38
+ Here we are interested in methods that are not trained neural networks. If the features are predefined before seeing the data, Oyallon & Mallat (2015) proposed the scattering network which achieves $\cdot$ classification accuracy on CIFAR-10. If one uses unsupervised learning methods to extract features, the method proposed in Coates et al. (2011) is one of the best-performing approaches on CIFAR-10 preceding modern CNNs. To our knowledge, the best result via unsupervised learning method in this line is by Mairal (2016), who used the convolutional kernel network to achieve $\cdot$ accuracy on CIFAR-10. In this work we combine CNTK with LAP and the idea in Coates et al. (2011) to achieve the best performance for classifiers that are not trained neural networks.
39
+
40
+ # 3 PRELIMINARIES
41
+
42
+ # 3.1 NOTATION
43
+
44
+ We use bold-faced letters for vectors, matrices and tensors. For a vector $\textbf { \em a }$ , let $[ \pmb { a } ] _ { i }$ be its $i$ -th entry; for a matrix $\pmb { A }$ , let $[ A ] _ { i , j }$ be its $( i , j )$ -th entry; for an order 4 tensor $_ { \mathbf { T } }$ , let $[ \bar { \pmb { T } } ] _ { i j , i ^ { \prime } j ^ { \prime } }$ be its $( i , j , i ^ { \prime } , j ^ { \prime } )$ -th entry. For a symmetric tensor, wet let $\begin{array} { r } { \mathrm { t r } \left( \pmb { T } \right) = \sum _ { i , j } \pmb { T } _ { i j , i j } } \end{array}$ . For an order $d$ tensor $\pmb { T } \in \mathbb { R } ^ { C _ { 1 } \times C _ { 2 } \times . . . \times C _ { d } }$ and an integer $\alpha \in [ C _ { d } ]$ , we use $\pmb { T } _ { ( \alpha ) } \in \mathbb { R } ^ { C _ { 1 } \times C _ { 2 } \times . . . \times C _ { d - 1 } }$ to denote the order $d - 1$ tensor formed by fixing the coordinate of the last dimension of $_ { \mathbf { T } }$ to be $\alpha$ .
45
+
46
+ # 3.2 CNN, CNN-GP AND CNTK
47
+
48
+ In this section we give formal definitions of CNN, CNN-GP and CNTK that we study in this paper. Throughout the paper, we let $P$ be the width and $Q$ be the height of the image. We use $q \in \mathbb { Z } _ { + }$ to denote the filter size. In practice, $q = 1 , 3 , 5$ or 7.
49
+
50
+ Padding Schemes. In the definition of CNN, CNTK and CNN-GP, we may use different padding schemes. Let $\pmb { x } \in \mathbb { R } ^ { P \times Q }$ be an matrix. For a given index pair $( i , j )$ with $i \leq 0$ , $i \geq P + 1$ , $j \le 0$ or $j \geq Q + 1$ , different padding schemes define different value for $[ \pmb { x } ] _ { i , j }$ . For circular padding, we define $[ \pmb { x } ] _ { i , j }$ to be $[ { \pmb x } ] _ { i \mathrm { ~ m o d ~ } P , j \mathrm { ~ m o d ~ } G }$ . For zero padding, we simply define $[ \pmb { x } ] _ { i , j }$ to be 0. Note the difference between circular padding and zero padding occurs only on the boundary of images. We will prove our theoretical results for the circular padding scheme to avoid boundary effects.
51
+
52
+ CNN. Now we describe CNN with and without GAP. For any input image $_ { \textbf { \em x } }$ , after $L$ intermediate layers, we obtain $\pmb { x } ^ { ( L ) } \in \mathbb { R } ^ { P \times Q \times C ^ { ( L ) } }$ where $C ^ { ( L ) }$ is the number of channels of the last layer. See Section A for the definition of $\pmb { x } ^ { ( L ) }$ . For the output, there are two choices: with and without GAP.
53
+
54
+ • Without GAP: the final output is defined as f(θ, x) = PC(L)α=1 $\begin{array} { r } { f ( \pmb { \theta } , \pmb { x } ) = \sum _ { \alpha = 1 } ^ { C ^ { ( L ) } } \left. \pmb { W } _ { ( \alpha ) } ^ { ( L + 1 ) } , \pmb { x } _ { ( \alpha ) } ^ { ( L ) } \right. } \end{array}$ where $\pmb { x } _ { ( \alpha ) } ^ { ( L ) } \in$ $\mathbb { R } ^ { P \times Q }$ , and ${ W _ { ( \alpha ) } ^ { ( L + 1 ) } } \in \mathbb { R } ^ { P \times Q }$ is the weight of the last fully-connected layer. • With GAP: the final output is defined as f (θ, x) = 1P Q PC α=1 $\begin{array} { r } { f ( \pmb { \theta } , \pmb { x } ) = \frac { 1 } { P Q } \sum _ { \alpha = 1 } ^ { C ^ { ( L ) } } \pmb { W } _ { ( \alpha ) } ^ { ( L + 1 ) } { \cdot } \sum _ { ( i , j ) \in [ P ] \times [ Q ] } \left[ \pmb { x } _ { ( \alpha ) } ^ { ( L ) } \right] _ { i , j } } \end{array}$ where W (L+1) ${ W _ { ( \alpha ) } ^ { ( L + 1 ) } \in \mathbb { R } }$ is the weight of the last fully-connected layer.
55
+
56
+ CNN-GP and CNTK. Now we describe CNN-GP and CNTK. Let ${ \boldsymbol { x } } , { \boldsymbol { x } } ^ { \prime }$ be two input images. We denote the $L$ -th layer’s CNN-GP kernel as $\Sigma ^ { ( L ) } \left( \pmb { x } , \pmb { x } ^ { \prime } \right) \in \mathbb { R } ^ { [ P ] \times [ Q ] \times [ P ] \times [ Q ] }$ and the $L$ -th layer’s CNTK kernel as ${ \bf \dot { \Theta } } ^ { ( L ) } \left( { \bf x } , { \bf x } ^ { \prime } \right) \in \mathbb { R } ^ { \left[ P \right] \times \left[ Q \right] \times \left[ P \right] \times \left[ \dot { Q } \right] }$ . See Section A for the precise definitions of $\pmb { \Sigma } ^ { ( L ) } \left( \pmb { x } , \pmb { x } ^ { \prime } \right)$ and $\Theta ^ { ( L ) } \left( \pmb { x } , \pmb { x } ^ { \prime } \right)$ . For the output kernel value, again, there are two choices, without GAP (equivalent to using a fully-connected layer) or with GAP.
57
+
58
+ • Without GAP: the output of CNN-GP is $\Sigma _ { \mathsf { F C } } \left( \mathbf { { x } } , \mathbf { { x } } ^ { \prime } \right) = \mathrm { { \ t r } } \left( \Sigma ^ { ( L ) } ( \mathbf { { x } } , \mathbf { { x } } ^ { \prime } ) \right)$ and the output of CNTK is $\Theta _ { \mathsf { F C } } \left( \pmb { x } , \pmb { x } ^ { \prime } \right) = \mathrm { t r } \left( \Theta ^ { ( L ) } ( \pmb { x } , \pmb { x } ^ { \prime } ) \right)$ . • With $\begin{array} { r l } & { \mathrm { W i t h } \qquad \mathsf { G A P : } \qquad \mathrm { t h e } \qquad \mathrm { o u t p u t } \qquad \mathrm { o f } \qquad \mathsf { C N N - G P } \qquad \mathrm { i s } \qquad \Sigma _ { \mathsf { G A P } } \left( x , x ^ { \prime } \right) } \\ & { \frac { 1 } { P ^ { 2 } Q ^ { 2 } } \sum _ { i , j , i ^ { \prime } , j ^ { \prime } \in [ P ] \times [ Q ] \times [ Q ] } \left[ \mathbf { \Sigma } \mathbf { { C } } ^ { ( L ) } \left( x , x ^ { \prime } \right) \right] _ { i , j , i ^ { \prime } , j ^ { \prime } } , \quad \mathrm { a n d } \quad \mathrm { t h e } \qquad \mathrm { o u t p u t } \quad \mathrm { o f } \quad \mathsf { C N T K } \quad \mathrm { i s } } \\ & { \Theta _ { \mathsf { G A P } } \left( x , x ^ { \prime } \right) = \frac { 1 } { P ^ { 2 } Q ^ { 2 } } \sum _ { i , j ^ { \prime } , i ^ { \prime } , j ^ { \prime } \in [ P ] \times [ Q ] \times [ P ] \times [ Q ] } \left[ \mathbf { \Sigma } \mathbf { { C } } ^ { ( L ) } \left( x , x ^ { \prime } \right) \right] _ { i , j , i ^ { \prime } , j ^ { \prime } } . } \end{array}$
59
+
60
+ Kernel Prediction. Lastly, we recall the formula for kernel regression. For simplicity, throughout the paper,with data me all ke, define ble. Giwhere ${ \bf K } \left( { \pmb x } , { \pmb x } ^ { \prime } \right)$ and a dataset . The predic $( X , y )$ $\{ ( x _ { i } , y _ { i } ) \} _ { i = 1 } ^ { N }$ ${ \bf K } _ { \bf X } \in \mathbb { R } ^ { N \times N }$ $[ \mathbf { K } _ { \mathbf { X } } ] _ { i , j } = \mathbf { K } ( \pmb { x } _ { i } , \pmb { x } _ { j } )$ unseen data $\mathbf { x } ^ { \prime }$ is $\begin{array} { r } { \sum _ { i = 1 } ^ { N } \alpha _ { i } \mathbf { K } ( \pmb { x } ^ { \prime } , \pmb { x } _ { i } ) } \end{array}$ , where $\pmb { \alpha } = \mathbf { K } _ { \mathbf { X } } ^ { - 1 } \pmb { y }$ .
61
+
62
+ # 3.3 DATA AUGMENTATION SCHEMES
63
+
64
+ In this paper we consider two types of data augmentation schemes: translation and horizontal flip.
65
+
66
+ Translation. Given $( i , j ) \in [ P ] \times [ Q ]$ , we define the translation operator $\mathcal { T } _ { i j } : \mathbb { R } ^ { P \times Q \times C } $ $\mathbb { R } ^ { P \times Q \times C }$ : for an image $\pmb { x } \in \mathbb { R } ^ { P \times Q \times C }$ , $\left[ \mathcal { T } _ { i j } \left( \pmb { x } \right) \right] _ { i ^ { \prime } , j ^ { \prime } , c } = \left[ \pmb { x } \right] _ { i ^ { \prime } + i , j ^ { \prime } + j , c }$ for $( i ^ { \prime } , j ^ { \prime } , c ) \in [ P ] \times [ Q ] \times$ $[ C ]$ . Here the precise definition of $[ { \pmb x } ] _ { i ^ { \prime } + i , j ^ { \prime } + j , c }$ depends on the padding scheme. Given a dataset $D = \{ ( x _ { i } , y _ { i } ) \} _ { i = 1 } ^ { N }$ , the full translation data augmentation scheme creates a new dataset $D _ { \mathcal { T } } =$ $\{ ( \mathcal T _ { i j } ( x _ { i } ) , y _ { i } ) \} _ { ( i , j , n ) \in [ P ] \times [ Q ] \times [ N ] }$ and training is performed on $D _ { \mathcal { T } }$ .
67
+
68
+ eratfor $\mathcal { F } : \mathbb { R } ^ { P \times Q \times C } \mathbb { R } ^ { P \times Q \times C }$ : for an imen a dataset $\pmb { x } ~ \in ~ \mathbb { R } ^ { P \times Q \times C }$ $[ \mathcal { F } ( \pmb { x } ) ] _ { i , j , c } = [ \pmb { x } ] _ { P + 1 - i , j , c }$ $( i , j , c ) \in [ P ] \times [ Q ] \times [ C ]$ $D = \{ ( x _ { i } , y _ { i } ) \} _ { i = 1 } ^ { N }$ the horizontal flip augmentation scheme creates a new dataset of the form $D _ { \mathcal { F } } = \{ \left( \mathcal { F } \left( \mathbf { x } _ { i } \right) , y _ { i } \right) \} _ { i = 1 } ^ { N }$ and training is performed on $D _ { \mathcal { F } } \cup D$ .
69
+
70
+ # 4 EQUIVALENCE BETWEEN AUGMENTED KERNEL AND DATA AUGMENTATION
71
+
72
+ In this section, we demonstrate the equivalence between using data augmentation and using a augmented kernel. To formally discuss the equivalence, we use group theory to describe translation and horizontal flip operators. We provide the definition of group in Section B for completeness.
73
+
74
+ It is easy to verify that $\{ \mathcal { F } , \mathcal { Z } \}$ , $\{ \mathcal T _ { i , j } \} _ { ( i , j ) \in [ P ] \times [ Q ] }$ , $\{ \mathcal { T } _ { i , j } \circ \mathcal { F } \} _ { ( i , j ) \in [ P ] \times [ Q ] } \cup \{ \mathcal { T } _ { i , j } \} _ { ( i , j ) \in [ P ] \times [ Q ] }$ are groups, where $\mathcal { T }$ is the identity map. From now on, given a dataset $\left( \mathbf { X } , \pmb { y } \right)$ with data $\{ ( x _ { i } , y _ { i } ) \} _ { i = 1 } ^ { N }$ and a group $\mathcal { G }$ , the augmented dataset $\left( \mathbf { X } _ { \mathcal { G } } , \mathbf { y } _ { \mathcal { G } } \right)$ is defined to be $\{ g ( \pmb { x } _ { i } ) , y _ { i } \} _ { g \in \mathscr { G } , i \in [ N ] }$ . Fo r kernel prediction for unseen data $\mathbf { x } ^ { \prime }$ on the augmented dataset, we have the following formula: $\begin{array} { r } { \sum _ { i \in [ N ] , g \in \mathcal { G } } \widetilde { \alpha } _ { i , g } \mathbf { K } ( \pmb { x } ^ { \prime } , g ( \pmb { x } _ { i } ) ) } \end{array}$ , where $\widetilde { \pmb { \alpha } } = \mathbf { K } _ { \mathbf { X } _ { \mathcal { G } } } ^ { - 1 } \pmb { y } _ { \mathcal { G } }$ .
75
+
76
+ To proceed, we define the concept of augmented kernel. Let $\mathcal { G }$ be a finite group. Define the augmented kernel $\mathbf { K } ^ { \mathcal { G } }$ as $\mathbf { K } ^ { \mathcal { G } } ( \pmb { x } , \pmb { x } ^ { \prime } ) \overset { \cdot } { = } \mathbb { E } _ { \pmb { g } \in \mathcal { G } } \mathbb { \bar { E } } _ { \pmb { g } ^ { \prime } \in \mathcal { G } } \mathbf { K } ( \pmb { g } ( \pmb { x } ) , \pmb { g } ^ { \prime } ( \pmb { x } ^ { \prime } ) )$ where ${ \boldsymbol { x } } , { \boldsymbol { x } } ^ { \prime }$ are two inputs images. A key observation is that for CNTK and CNN-GP, when circular padding and GAP is adopted, these are actually the augmented kernels with the group $\mathcal { G } = \{ \mathcal { T } _ { i , j } \} _ { ( i , j ) \in [ P ] \times [ Q ] }$ . Formally, we have $\begin{array} { r } { \Sigma _ { \mathsf { G A P } } \left( \pmb { x } , \pmb { x } ^ { \prime } \right) = \frac { 1 } { P Q } \pmb { \Sigma } _ { \mathsf { F C } } ^ { \mathcal { G } } \left( \pmb { x } , \pmb { x } ^ { \prime } \right) } \end{array}$ and $\begin{array} { r } { \Theta _ { \mathsf { G A P } } \left( \pmb { x } , \pmb { x } ^ { \prime } \right) = \frac { 1 } { P Q } \Theta _ { \mathsf { F C } } ^ { \mathcal { G } } \left( \pmb { x } , \pmb { x } ^ { \prime } \right) } \end{array}$ . The proof for these two equations is just by checking the formula of these kernels and using definition of circular padding. By similar proof, one can observe the following invariance property of $\Sigma _ { \mathsf { G A P } } , \Sigma _ { \mathsf { F C } } , \Theta _ { \mathsf { G A P } }$ and $\Theta _ { \mathsf { F C } }$ , under all groups mentioned above, including $\{ \mathcal { F } , \mathcal { Z } \}$ and $\{ \mathcal { T } _ { i , j } \} _ { ( i , j ) \in [ P ] \times [ Q ] }$ .
77
+
78
+ Definition 4.1. A kernel $\mathbf { K }$ is invariant under a group $\mathcal { G }$ if and only if for any $g \in \mathcal G$ $\mathbf { K } ( g ( \pmb { x } ) , g ( \pmb { x } ^ { \prime } ) ) = \mathbf { K } ( \pmb { x } , \pmb { x } ^ { \prime } )$ .
79
+
80
+ Now the following theorem formally states the equivalence between using an augmented kernel on the dataset and using the kernel on the augmented dataset.
81
+
82
+ Theorem 4.1. Given a group $\mathcal { G }$ and a kernel $\mathbf { K }$ such that $\mathbf { K }$ is invariant under $\mathcal { G }$ , then the prediction nted kernel . Namely, f $\mathbf { K } ^ { \mathcal { G } }$ wny $\left( \mathbf { X } , \pmb { y } \right)$ $\mathbf { K }$ $\left( \mathbf { X } _ { \mathcal { G } } , \mathbf { y } _ { \mathcal { G } } \right)$ $\pmb { x } ^ { \prime } \in \mathbb { R } ^ { P \times Q \times C }$ $\begin{array} { r } { \sum _ { i = 1 } ^ { N } \alpha _ { i } \mathbf { K } ^ { \mathcal { G } } ( \pmb { x } ^ { \prime } , \pmb { x } _ { i } ) = \sum _ { i \in [ N ] , g \in \mathcal { G } } \widetilde { \alpha } _ { i , g } \mathbf { K } ( \pmb { x } ^ { \prime } , g ( \pmb { x } _ { i } ) ) } \end{array}$ where $\pmb { \alpha } = \left( \mathbf { K } _ { \mathbf { X } } ^ { \mathcal { G } } \right) ^ { - 1 } \pmb { y } , \tilde { \pmb { \alpha } } = \left( \mathbf { K } _ { \mathbf { X } _ { \mathcal { G } } } \right) ^ { - 1 } \pmb { y } \mathcal { G } .$ .
83
+
84
+ The proof is deferred to Appendix B. Two corollaries are directly followed.
85
+
86
+ Corollary 4.1. For $\mathcal { G } = \{ \mathcal { T } _ { i , j } \} _ { ( i , j ) \in [ P ] \times [ Q ] }$ , for any given dataset $D$ , the prediction of $\Sigma _ { G A P }$ (or $\Theta _ { G A P } )$ with dataset $D$ is equal to the prediction of $\Sigma _ { F C } ( o r \Theta _ { F C } )$ with augmented dataset ${ \cal D } \tau$ . Corollary 4.2. For $\mathcal { G } = \{ \bar { \mathcal { F } } , \mathcal { Z } \}$ , for any given dataset $D$ , the prediction of $\Sigma _ { G A P } ^ { \mathcal { G } }$ (or $\Theta _ { G A P } ^ { g } )$ with dataset $D$ is equal to the prediction of $\Sigma _ { G A P }$ (or $\Theta _ { G A P , }$ ) with augmented dataset $D _ { \mathcal { F } } \cup D$ .
87
+
88
+ Now we discuss implications of Theorem 4.1 and its corollaries. Naively applying data augmentation, with full translation on CNTK or CNN-GP for example, one needs to create a $P ^ { 2 } Q ^ { 2 }$ times larger kernel matrix since there are $P Q$ translation operators, which is often computationally infeasible. Instead, we can directly use the augmented kernel $\scriptstyle \sum _ { \mathsf { G A P } }$ or $\Theta _ { \mathsf { G A P } }$ for the case of full translation on CNTK or CNN-GP) for prediction, for which one only needs to create a kernel matrix that is as large as the original one. For horizontal flip, although the augmentation kernel is not as conveniently computed as full translation, Corollary 4.2 still provides a more efficient method for computing kernel value and solving kernel regression, since the augmented dataset is twice as large as the original dataset.
89
+
90
+ # 5 LOCAL AVERAGE POOLING
91
+
92
+ In this section, we introduce a new operation called Local Average Pooling (LAP). As discussed in the introduction, full translation data augmentation can create unrealistic images. A natural idea is to do local translation data augmentation, i.e., restricting the distance of translation. More specifically, we only allow translation operations $\mathcal { T } _ { \Delta _ { i } , \Delta _ { j } }$ (cf. Section 3.3) for $( \Delta _ { i } , \Delta _ { j } ) \in [ - c , c ] \times [ - c , c ]$ where $c$ is a parameter to control the amount of allowed translation. With a proper choice of the parameter $c$ , translation data augmentation will not create unrealistic images (cf. Figure 2). However, naive local translation data augmentation is computationally infeasible for kernel methods, even for moderate choice of $c$ . To remedy this issue, in this section we introduce LAP, which is inspired by the connection between full translation data augmentation and GAP on CNN-GP and CNTK. Here, for simplicity, we assume $P = Q$ and derive the formula only for CNTK. Our formula can be generalized to CNN-GP in a straightforward manner.
93
+
94
+ Recall that for two given images $_ { \textbf { \em x } }$ and $\mathbf { x } ^ { \prime }$ , without GAP, the formula for output of CNTK is $\operatorname { t r } \left( \Theta ( \pmb { x } , \pmb { x } ^ { \prime } ) \right)$ . With GAP, the formula for output of CNTK is $\begin{array} { r } { \frac { 1 } { P ^ { 4 } } \sum _ { i , j , i ^ { \prime } , j ^ { \prime } \in [ P ] ^ { 4 } } \big [ \Theta \left( \pmb { x } , \pmb { x } ^ { \prime } \right) \big ] _ { i , j , i ^ { \prime } , j ^ { \prime } } } \end{array}$ . With circular padding, the formula can be rewritten as $\begin{array} { r } { \frac { 1 } { P ^ { 2 } } \mathbb { E } _ { \Delta _ { i } , \Delta _ { i } ^ { \prime } , \Delta _ { j } , \Delta _ { j } , \Delta _ { j } ^ { \prime } \sim [ P ] ^ { 4 } } \sum _ { i , j \in [ P ] \times [ P ] } \left[ \Theta \left( \pmb { x } , \pmb { x } ^ { \prime } \right) \right] _ { i + \Delta _ { i } , j + \Delta _ { j } , i + \Delta _ { i } ^ { \prime } , j + \Delta _ { j } ^ { \prime } } } \end{array}$ , which is again equal to $\begin{array} { r } { \frac { 1 } { P ^ { 2 } } \mathbb { E } _ { \Delta _ { i } , \Delta _ { i } ^ { \prime } , \Delta _ { j } , \Delta _ { j } ^ { \prime } \sim [ P ] ^ { 4 } } \mathrm { t r } \Big ( \Theta \left( \mathcal { T } _ { \Delta _ { i } , \Delta _ { j } } ( \pmb { x } ) , \mathcal { T } _ { \Delta _ { i } ^ { \prime } , \Delta _ { j } ^ { \prime } } ( \pmb { x } ^ { \prime } ) \right) \Big ) . \mathrm { \ b w } } \end{array}$ e ignore the $1 / P ^ { 2 }$ scaling factor since it plays no role in kernel regression.
95
+
96
+ Now we consider restricted translation operations $\mathcal { T } _ { \Delta _ { i } , \Delta _ { j } }$ with $( \Delta _ { i } , \Delta _ { j } ) \in [ - c , c ] \times [ - c , c ]$ and derive the formula for LAP. Assuming circular padding, we have
97
+
98
+ $$
99
+ \begin{array} { r l } & { \quad \mathbb { E } _ { \Delta _ { i } , \Delta _ { i } ^ { \prime } , \Delta _ { j } , \Delta _ { j } ^ { \prime } \sim [ - c , c ] ^ { 4 } } \mathrm { t r } \left( \Theta \left( { \mathcal T } _ { \Delta _ { i } , \Delta _ { j } } ( x ) , { \mathcal T } _ { \Delta _ { i } ^ { \prime } , \Delta _ { j } ^ { \prime } } ( x ^ { \prime } ) \right) \right) } \\ & { = \frac { 1 } { ( 2 c + 1 ) ^ { 4 } } \sum _ { \Delta _ { i } , \Delta _ { i } ^ { \prime } , \Delta _ { j } , \Delta _ { j } ^ { \prime } \in [ - c , c ] ^ { 4 } } \sum _ { i , j \in [ P ] ^ { 2 } } \left[ \Theta ( x , x ^ { \prime } ) \right] _ { i + \Delta _ { i } , j + \Delta _ { j } , i + \Delta _ { i } ^ { \prime } , j + \Delta _ { j } ^ { \prime } } . } \end{array}
100
+ $$
101
+
102
+ Now we have derived the formula for LAP which is given in Equation 1. Notice that the formula in Equation 1 is a well-defined quantity for all padding schemes. In particular, assuming zero padding, when $c = P$ , LAP is equivalent to GAP. When $c = 0$ , LAP is equivalent to no pooling layer. Another advantage of LAP is that it does not incur significant additional computational cost, since the formula in Equation 1 can be rewritten as $\begin{array} { r } { \sum _ { i , j , i ^ { \prime } , j ^ { \prime } \in [ P ] ^ { 4 } } [ \pmb { w } ] _ { i , j , i ^ { \prime } , j ^ { \prime } } \cdot \left[ \Theta ( \pmb { x } , \pmb { x } ^ { \prime } ) \right] _ { i , j , i ^ { \prime } , j ^ { \prime } } } \end{array}$ where each entry in the weight tensor $\pmb { w }$ can be calculated in $O ( 1 )$ time.
103
+
104
+ Note that the GAP operation in CNN-GP and CNTK corresponds to the GAP layer in CNNs. Here we observe the following box filtering layer that corresponds to LAP in CNNs. Box filtering layer (BF) is a function RP ×Q → RP ×Q such that [BF(x)]i,j = 1(2c+1)2 P∆i,∆j∈[−c,c]2 xi+∆i,j+∆j . This is in fact a standard average pooling layer but with stride 1 and pooling size $2 c + 1$ . We prove the equivalence between LAP and box filtering layer in Appendix C. In Section 6.3, we test BF on CNNs to verify its effectiveness.
105
+
106
+ # 6 EXPERIMENTS
107
+
108
+ In this section we present our empirical findings on CIFAR-10 (Krizhevsky, 2009) and FashionMNIST (Xiao et al., 2017). The detailed experimental setup is reported in Appendix D. When reporting test accuracies, the best result on the test set is in boldface and the result that corresponds to the hyper-parameter chosen by cross-validation is underlined.
109
+
110
+ # 6.1 ABLATION STUDY ON CIFAR-10 AND FASHION-MNIST
111
+
112
+ We perform experiments to study the effect of different values of the $c$ parameter in LAP and horizontal flip data argumentation on CNTK and CNN-GP. For experiments in this section we set the bias term in CNTK and CNN-GP to be $\beta = 0$ (cf. Section A). We use the same architecture for CNTK and CNN-GP as in Arora et al. (2019). I.e., we stack multiple convolutional layers before the final pooling layer. We use $d$ to denote the number of convolutions layers, and in our experiments we set $d$ to be 5, 8, 11 or 14, to study the effect of depth on CNTK and CNN-GP. For CIFAR-10, we set the $c$ parameter in LAP to be $0 , 4 , \ldots , 3 2$ , while for Fashion-MNIST we set the $c$ parameter in LAP to be $0 , 4 , \ldots , 2 8$ . Notice that when $c = 3 2$ for CIFAR-10 or $c = 2 8$ for Fashion-MNIST, LAP is equivalent to GAP, and when $c = 0$ , LAP is equivalent to no pooling layer. Results on CIFAR-10 are reported in Tables 1 and 3. Due to space constraint, results on Fashion-MNIST are reported in Tables 5 and 6 in Appendix E. In each table, for each combination of $c$ and $d$ , the first number is the test accuracy without horizontal flip data augmentation (in percentage), and the second number (in parentheses) is the test accuracy with horizontal flip data augmentation. To perform cross-validation to choose the hyper-parameters, we use the last 10000 samples in the training set of CIFAR-10 and Fashion-MNIST as the validation set and the rest samples as the training set. We then use the full training set to report the test accuracy. To perform cross-validation, we choose $\cdot$ , $d$ , CNN or CNN-GP, and whether or not to adopt horizontal flip based on the validation accuracy (shown in Appendix F). With cross-validation, the resulting accuracy is $8 2 . 0 9 \%$ on CIFAR-10 and $9 4 . 0 7 \%$ on Fashion-MNIST.
113
+
114
+ We made the following observations regarding our experimental results.
115
+
116
+ • LAP with a proper choice of the parameter $c$ significantly improves the performance of CNTK and CNN-GP. On CIFAR-10, the best-performing value of $c$ is $c = 1 2$ or 16, while on FashionMNIST the best-performing value of $c$ is $c = 4$ . We suspect this difference is due to the nature of the two datasets: CIFAR-10 contains real-life images and thus allow more translation, while Fashion-MNIST contains images with centered clothes and thus allow less translation. For both datasets, the best-performing value of $c$ is consistent across all settings (depth, CNTK or CNNGP) that we have considered. Horizontal flip data augmentation is less effective on Fashion-MNIST than on CIFAR-10. There are two possible explanations for this phenomenon. First, most images in Fashion-MNIST are nearly horizontally symmetric (e.g., T-shirts and bags). Second, CNTK and CNN-GP have already achieved a relatively high accuracy on Fashion-MNIST, and thus it is reasonable for horizontal flip data augmentation to be less effective on this dataset.
117
+ • Finally, for CNTK, when $c = 0$ (no pooling layer) and $c = 3 2$ (GAP) our reported test accuracies are close to those in Arora et al. (2019) on CIFAR-10. For CNN-GP, when $c = 0$ (no pooling layer) our reported test accuracies are close to those in Novak et al. (2019) on CIFAR-10 and Fashion-MNIST. This suggests that we have reproduced previous reported results.
118
+
119
+ # 6.2 IMPROVING PERFORMANCE ON CIFAR-10 USING RANDOM PATCHES LAYER
120
+
121
+ Finally, we explore another interesting question: what is the best performance achievable via a method that is not a trained neural network? To further improve the performance, we combine CNTK and CNN-GP with LAP, together with the unsupervised learning approach developed in Coates et al. (2011). Here we use the variant implemented in Recht et al. (2019). More specifically, we first sample 2048 random image patches with size $5 \times 5$ from all training images. Then for the sampled images patches, we subtract the mean of the patches, then normalize them to have unit norm, and finally perform ZCA transformation to the resulting patches. We use the resulting patches as 2048 filters of a convolutional layer with kernel size 5, stride 1 and no dilation or padding. For an input image $_ { \textbf { \em x } }$ , we use $\mathtt { c o n v } ( { \pmb x } )$ to denote the output of the convolutional layer. As in the implementation in Recht et al. (2019), we use ReLU( $\mathsf { c o n v } ( \pmb { x } ) - \beta _ { \mathrm { f e a t u r e } } )$ and $\mathrm { R e L } \dot { \mathrm { U } } ( - \mathrm { c o n v } ( { \pmb x } ) - \bar { \beta } _ { \mathrm { f e a t u r e } } )$ as the input feature for CNTK and CNN-GP. Here we fix $\beta _ { \mathrm { f e a t u r e } } = 1$ as in Recht et al. (2019) and the bias term $\beta$ in CNTK and CNN-GP to be $\beta = 1$ . To make the output kernel value invariant under horizontal flip (cf. Defintion 4.1), for each image patch, we horizontally flipped it and add the flipped patch into the convolutional layer as a new filter. Thus, for an input CIFAR-10 image of size $3 2 \times 3 2$ , the dimension of the output feature is $8 1 9 2 \times 2 8 \times 2 8$ . To isolate the effect of randomness in the choices of the image patches, we fix the random seed to be 0 throughout the experiment. In this experiment, we set the value of the $c$ parameter in LAP to be $4 , 8 , 1 2 , \ldots , 2 0$ to avoid small and large values of $c$ . The results are reported in Tables 2 and 4. Similar to the experiments in Section 6.1, again we set the hyper-parameters by cross-validation, and the resulting accuracy is $8 8 . 9 1 \%$ . See Appendix $\mathrm { F }$ for the validation accuracy for different hyper-parameters.
122
+
123
+ Table 1: Test accuracy of CNTK on CIFAR-10.
124
+
125
+ <table><tr><td>d C</td><td>5</td><td>8</td><td>11</td><td></td><td>14</td></tr><tr><td>0</td><td>66.55 (69.87)</td><td>66.27 (69.87)</td><td>65.85 (69.37)</td><td></td><td>65.47 (68.90)</td></tr><tr><td>4</td><td>77.06 (79.08)</td><td>77.14 (78.96)</td><td>77.06 (78.98)</td><td></td><td>76.52 (78.74)</td></tr><tr><td>8</td><td>79.24 (80.95)</td><td>79.25 (81.03)</td><td>78.98 (80.94)</td><td></td><td>78.65 (80.35)</td></tr><tr><td>12</td><td>80.11 (81.34)</td><td>79.79 (81.28)</td><td>79.29 (81.14)</td><td></td><td>79.13 (80.91)</td></tr><tr><td>16</td><td>79.80 (81.21)</td><td>79.71 (81.40)</td><td>79.74 (81.09)</td><td></td><td>79.42 (81.00)</td></tr><tr><td>20</td><td>79.24 (80.67)</td><td>79.27 (80.88)</td><td>79.30 (80.76)</td><td></td><td>78.92 (80.39)</td></tr><tr><td></td><td>78.07 (79.88)</td><td>78.16 (79.79)</td><td>78.14 (80.06)</td><td></td><td>77.87 (80.07)</td></tr><tr><td>28</td><td>76.91 (78.69)</td><td>77.33 (79.20)</td><td>77.65 (79.56)</td><td></td><td>77.65 (79.74)</td></tr><tr><td>32</td><td>76.79 (78.53)</td><td>77.39 (79.13)</td><td>77.63 (79.51)</td><td></td><td>77.63 (79.74)</td></tr></table>
126
+
127
+ Table 2: Test accuracy of random patches layer $^ +$ CNTK on CIFAR-10.
128
+
129
+ <table><tr><td>d C</td><td colspan="2">5</td><td>8</td><td colspan="2">11</td><td colspan="2">14</td></tr><tr><td>4</td><td>84.63</td><td>(86.64) (</td><td>84.07 (86.23)</td><td></td><td>83.29 (85.53)</td><td></td><td>82.57 (84.81)</td></tr><tr><td>8</td><td>86.36(</td><td>(88.32)</td><td>85.80 (87.81)</td><td></td><td>85.01 (87.08)</td><td></td><td>84.57 (86.53)</td></tr><tr><td>12</td><td>86.74(</td><td>(88.35)</td><td>86.20 (87.90)</td><td></td><td>85.60 (87.36)</td><td></td><td>84.95 (86.99)</td></tr><tr><td>16</td><td></td><td>86.77 (88.36)</td><td>86.17 (87.85)</td><td></td><td>85.60 (87.44)</td><td></td><td>84.92 (86.98)</td></tr><tr><td>20</td><td>86.17(8</td><td>(87.77)</td><td>85.71 (87.50)</td><td></td><td>85.14 (87.07)</td><td></td><td>84.59 (86.84)</td></tr></table>
130
+
131
+ From our experimental results, it is evident that combining CNTK or CNN-GP with additional feature extractor can significantly improve upon the performance of using solely CNTK or CNNGP, and that of using solely the feature extractor Coates et al. (2011). Previously, it has been reported in Recht et al. (2019) that using solely the feature extractor Coates et al. (2011) (together with appropriate pooling layer) can only achieve a test accuracy of $8 4 . 2 \%$ using 256, 000 image patches, or $8 3 . 3 \%$ using 32, 000 image patches. Even with the help of horizontal data augmentation, the feature extractor Coates et al. (2011) can only achieve a test accuracy of $8 5 . 6 \%$ using 256, $\ 0 0 0$ image patches, or $8 5 . 0 \%$ using 32, 000 image patches. Here we use significantly less image patches (only 2048) but achieve a much better performance, with the help of CNTK and CNN-GP. In particular, we achieve a performance of $8 8 . 9 1 \%$ on CIFAR-10, matching the performance of AlexNet on the same dataset. In the setting reported in Coates et al. (2011), increasing the number of sampled image patches will further improve the performance. Here we also conjecture that in our setting, further increasing the number of sampled image patches can improve the performance and get close to modern CNNs. However, due the limitation on computational resources, we leave exploring the effect of number of sampled image patches as a future research direction.
132
+
133
+ # 6.3 EXPERIMENTS ON CNN WITH BOX FILTERING LAYER
134
+
135
+ In Figure 1, we verify the effectiveness of BF on a 10-layer CNN (with Batch Normalization) on CIFAR-10. The setting of this experiment is reported in Appendix G. Our network structure has no pooling layer except for the BF layer before the last fully-connected layer. The fully-connected layer is fixed during the training. Our experiment illustrates that even with a fixed last FC layer, using
136
+
137
+ Table 3: Test accuracy of CNN-GP on CIFAR-10.
138
+
139
+ <table><tr><td>d C</td><td>5</td><td>8</td><td>11</td><td></td><td>14</td></tr><tr><td>0</td><td>63.53 (67.90)</td><td>65.54 (69.43)</td><td>66.42 (70.30)</td><td></td><td>66.81 (70.48)</td></tr><tr><td>4</td><td>76.35 (78.79)</td><td>77.03 (79.30)</td><td>77.39 (79.52)</td><td></td><td>77.35 (79.65)</td></tr><tr><td>8</td><td>79.48 (81.32)</td><td>79.82 (81.49)</td><td>79.76 (81.71)</td><td></td><td>79.69 (81.53)</td></tr><tr><td>12</td><td>80.40 (82.13)</td><td>80.64 (82.09)</td><td>80.58 (82.06)</td><td></td><td>80.32 (81.95)</td></tr><tr><td>16</td><td>80.36 (81.73)</td><td>80.78 (82.20)</td><td>80.59 (82.06)</td><td></td><td>80.41 (81.83)</td></tr><tr><td>20</td><td>79.87 (81.50)</td><td>80.15( 5 (81.33)</td><td>79.87 (81.46)</td><td></td><td>79.98 (81.35)</td></tr><tr><td>24</td><td>78.60 (79.98)</td><td>78.91 (80.48)</td><td>79.22 (80.53)</td><td></td><td>78.94 (80.46)</td></tr><tr><td>28</td><td>77.18 (78.84)</td><td>78.03 (79.86)</td><td>78.45 (79.87)</td><td></td><td>78.48 (80.07)</td></tr><tr><td>32</td><td>77.00 (78.49)</td><td>77.85 (79.65)</td><td>78.49 (80.04)</td><td></td><td>78.45 (80.01)</td></tr></table>
140
+
141
+ Table 4: Test accuracy of random patches layer $^ +$ CNN-GP on CIFAR-10.
142
+
143
+ <table><tr><td rowspan=1 colspan=1>dC</td><td rowspan=1 colspan=5>5 8 11 14</td></tr><tr><td rowspan=4 colspan=1>481216</td><td rowspan=1 colspan=1>85.49(87.32)</td><td rowspan=1 colspan=1>85.37(87.22)</td><td rowspan=1 colspan=1>85.16(87.11)</td><td rowspan=1 colspan=1>84.79(86.81)</td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1>87.07 (88.64)</td><td rowspan=1 colspan=1>86.82(88.68)</td><td rowspan=1 colspan=1>86.53(88.40)</td><td rowspan=2 colspan=2>86.39 (88.15)86.62 (88.29)</td></tr><tr><td rowspan=2 colspan=1>87.23(88.91)87.28 (88.90)</td><td rowspan=1 colspan=1>87.12(88.92)</td><td rowspan=1 colspan=1>86.87(88.66)</td></tr><tr><td rowspan=1 colspan=1>87.11(88.66)</td><td rowspan=1 colspan=1>86.92(88.61)</td><td rowspan=2 colspan=2>86.74 (88.24)86.26 (87.84)</td></tr><tr><td rowspan=1 colspan=1>20</td><td rowspan=1 colspan=1>86.81 (88.26)</td><td rowspan=1 colspan=1>86.77(88.24)</td><td rowspan=1 colspan=1>86.61(88.14)</td></tr></table>
144
+
145
+ GAP could improve the performance of CNN. Our experiments also show that BF with appropriate choice of $c$ achieves better performance than GAP.
146
+
147
+ ![](images/320c235c4f1c90a590cb573560ef0fe6fc15d2b3b0c2ecdb55ed2f125f502004.jpg)
148
+ Figure 1: Test accuracy of 10-layer CNN with various values for the $c$ parameter in BF.
149
+
150
+ # 7 CONCLUSION
151
+
152
+ In this paper, inspired by the connection between full translation data augmentation and GAP, we derive a new operation, LAP, on CNTK and CNN-GP, which consistently improves the performance on image classification tasks. Combining CNN-GP with LAP and the pre-processing technique proposed by Coates et al. (2011), the resulting kernel achieves $89 \%$ accuracy on CIFAR-10, matching the performance of AlexNet and is the strongest classifier that is not a trained neural network.
153
+
154
+ Here we list a few future research directions. Is it possible to develop analogs of CNTK or CNNGP incorporating modern techniques such as batch norm and residual layers, to further improve the performance? Moreover, it is an interesting direction to study other components in modern CNNs through the lens of CNTK and CNN-GP.
155
+
156
+ # REFERENCES
157
+
158
+ Zeyuan Allen-Zhu, Yuanzhi Li, and Zhao Song. A convergence theory for deep learning via overparameterization. arXiv preprint arXiv:1811.03962, 2018.
159
+
160
+ Sanjeev Arora, Simon S Du, Wei Hu, Zhiyuan Li, Ruslan Salakhutdinov, and Ruosong Wang. On exact computation with an infinitely wide neural net. arXiv preprint arXiv:1904.11955, 2019.
161
+
162
+ Olivier Chapelle, Jason Weston, Leon Bottou, and Vladimir Vapnik. Vicinal risk minimization. In ´ Advances in neural information processing systems, pp. 416–422, 2001.
163
+
164
+ Shuxiao Chen, Edgar Dobriban, and Jane H Lee. Invariance reduces variance: Understanding data augmentation in deep learning and beyond. arXiv preprint arXiv:1907.10905, 2019.
165
+
166
+ Adam Coates, Andrew Ng, and Honglak Lee. An analysis of single-layer networks in unsupervised feature learning. In Proceedings of the fourteenth international conference on artificial intelligence and statistics, pp. 215–223, 2011.
167
+
168
+ Tri Dao, Albert Gu, Alexander J Ratner, Virginia Smith, Christopher De Sa, and Christopher Re. A ´ kernel theory of modern data augmentation. arXiv preprint arXiv:1803.06084, 2018.
169
+
170
+ Simon S Du, Jason D Lee, Haochuan Li, Liwei Wang, and Xiyu Zhai. Gradient descent finds global minima of deep neural networks. arXiv preprint arXiv:1811.03804, 2018.
171
+
172
+ Simon S. Du, Kangcheng Hou, Barnabas P ´ oczos, Ruslan Salakhutdinov, Ruosong Wang, and Keyulu ´ Xu. Graph neural tangent kernel: Fusing graph neural networks with graph kernels. ArXiv, abs/1905.13192, 2019a.
173
+
174
+ Simon S. Du, Xiyu Zhai, Barnabas Poczos, and Aarti Singh. Gradient descent provably optimizes over-parameterized neural networks. In International Conference on Learning Representations, 2019b.
175
+
176
+ Adria Garriga-Alonso, Carl Edward Rasmussen, and Laurence Aitchison. Deep convolutional net- \` works as shallow gaussian processes. In International Conference on Learning Representations, 2019. URL https://openreview.net/forum?id=Bklfsi0cKm.
177
+
178
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 770–778, 2016.
179
+
180
+ Gao Huang, Zhuang Liu, Laurens Van Der Maaten, and Kilian Q Weinberger. Densely connected convolutional networks. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 4700–4708, 2017.
181
+
182
+ Arthur Jacot, Franck Gabriel, and Clement Hongler. Neural tangent kernel: Convergence and gen- ´ eralization in neural networks. arXiv preprint arXiv:1806.07572, 2018.
183
+
184
+ Alex Krizhevsky. Learning multiple layers of features from tiny images. 2009.
185
+
186
+ Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton. Imagenet classification with deep convolutional neural networks. In Advances in neural information processing systems, pp. 1097–1105, 2012.
187
+
188
+ Jaehoon Lee, Jascha Sohl-dickstein, Jeffrey Pennington, Roman Novak, Sam Schoenholz, and Yasaman Bahri. Deep neural networks as gaussian processes. In International Conference on Learning Representations, 2018. URL https://openreview.net/forum?id= B1EA-M-0Z.
189
+
190
+ Yuanzhi Li and Yingyu Liang. Learning overparameterized neural networks via stochastic gradient descent on structured data. arXiv preprint arXiv:1808.01204, 2018.
191
+
192
+ Min Lin, Qiang Chen, and Shuicheng Yan. Network in network. arXiv preprint arXiv:1312.4400, 2013.
193
+
194
+ Julien Mairal. End-to-end kernel learning with supervised convolutional kernel networks. In Advances in neural information processing systems, pp. 1399–1407, 2016.
195
+
196
+ Alexander G de G Matthews, Mark Rowland, Jiri Hron, Richard E Turner, and Zoubin Ghahramani. Gaussian process behaviour in wide deep neural networks. arXiv preprint arXiv:1804.11271, 2018.
197
+
198
+ Radford M Neal. Priors for infinite networks. In Bayesian Learning for Neural Networks, pp. 29–53. Springer, 1996.
199
+
200
+ Roman Novak, Lechao Xiao, Yasaman Bahri, Jaehoon Lee, Greg Yang, Daniel A. Abolafia, Jeffrey Pennington, and Jascha Sohl-dickstein. Bayesian deep convolutional networks with many channels are gaussian processes. In International Conference on Learning Representations, 2019. URL https://openreview.net/forum?id $\bar { }$ B1g30j0qF7.
201
+
202
+ Edouard Oyallon and Stephane Mallat. Deep roto-translation scattering for object classification. ´ In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 2865– 2873, 2015.
203
+
204
+ Benjamin Recht, Rebecca Roelofs, Ludwig Schmidt, and Vaishaal Shankar. Do imagenet classifiers generalize to imagenet? arXiv preprint arXiv:1902.10811, 2019.
205
+
206
+ Bernhard Scholkopf, Chris Burges, and Vladimir Vapnik. Incorporating invariances in support vec- ¨ tor learning machines. In International Conference on Artificial Neural Networks, pp. 47–52. Springer, 1996.
207
+
208
+ Jocelyn Sietsma and Robert JF Dow. Creating artificial neural networks that generalize. Neural networks, 4(1):67–79, 1991.
209
+
210
+ Jost Tobias Springenberg, Alexey Dosovitskiy, Thomas Brox, and Martin Riedmiller. Striving for simplicity: The all convolutional net. arXiv preprint arXiv:1412.6806, 2014.
211
+
212
+ Richard Szeliski. Computer vision: algorithms and applications. Springer Science & Business Media, 2010.
213
+
214
+ Han Xiao, Kashif Rasul, and Roland Vollgraf. Fashion-mnist: a novel image dataset for benchmarking machine learning algorithms, 2017.
215
+
216
+ Greg Yang. Scaling limits of wide neural networks with weight sharing: Gaussian process behavior, gradient independence, and neural tangent kernel derivation. arXiv preprint arXiv:1902.04760, 2019.
217
+
218
+ Difan Zou, Yuan Cao, Dongruo Zhou, and Quanquan Gu. Stochastic gradient descent optimizes over-parameterized deep ReLU networks. arXiv preprint arXiv:1811.08888, 2018.
219
+
220
+ # A FORMAL DEFINITIONS OF CNN-GP AND CNTK
221
+
222
+ We add some additional notations. Let $\pmb { I }$ be the identity matrix, and $[ n ] = \{ 1 , 2 , \dots , n \}$ . Let $e _ { i }$ be an indicator vector with $i$ -th entry being 1 and other entries being 0, and let 1 denote the all-one vector. We use $\odot$ to denote the pointwise product and $\otimes$ to denote the tensor product. We use $\mathrm { d i a g ( \cdot ) }$ to transform a vector to a diagonal matrix. We use $\sigma \left( \cdot \right)$ to denote the activation function, such as the rectified linear unit (ReLU) function: $\sigma \left( z \right) = \operatorname* { m a x } \{ z , 0 \}$ , and $\dot { \sigma } \left( \cdot \right)$ to denote the derivative of $\sigma \left( \cdot \right)$ . We set $c _ { \sigma } = 2$ . Denote by $\scriptstyle { \mathcal { N } } ( \mu , \Sigma )$ the Gaussian distribution with mean $\pmb { \mu }$ and covariance $\pmb { \Sigma }$ .
223
+
224
+ Equation equation 2 shows patch $[ { \pmb w } * { \pmb x } ] _ { i j }$ depends on $\begin{array} { r } { [ { \pmb x } ] _ { i - \frac { q - 1 } { 2 } : i + \frac { q - 1 } { 2 } , j - \frac { q - 1 } { 2 } : j + \frac { q - 1 } { 2 } } } \end{array}$ . For $( i , j , i ^ { \prime } , j ^ { \prime } ) \in [ P ] \times [ Q ] \times [ P ] \times [ Q ]$ , define
225
+
226
+ $$
227
+ \begin{array} { r } { \mathfrak { I } _ { i j , i ^ { \prime } j ^ { \prime } } = \{ ( i + a , j + b , i ^ { \prime } + a ^ { \prime } , j ^ { \prime } + b ^ { \prime } ) \in [ P ] \times [ Q ] \times [ P ] \times [ Q ] | - ( q - 1 ) / 2 \le a , b , a ^ { \prime } , b ^ { \prime } \le ( q - 1 ) \} , } \end{array}
228
+ $$
229
+
230
+ Now we define the convolution operation. For a convolutional filter $\pmb { w } \in \mathbb { R } ^ { q \times q }$ and an image $\pmb { x } \in \mathbb { R } ^ { P \times Q }$ , the convolution operator is defined as
231
+
232
+ $$
233
+ [ { \pmb w } * { \pmb x } ] _ { i j } = \sum _ { a = - \frac { \eta - 1 } { 2 } } ^ { \frac { q - 1 } { 2 } } \sum _ { b = - \frac { \eta - 1 } { 2 } } ^ { \frac { q - 1 } { 2 } } [ { \pmb w } ] _ { a + \frac { q + 1 } { 2 } , b + \frac { q + 1 } { 2 } } [ { \pmb x } ] _ { a + i , b + j } \mathrm { ~ f o r ~ } i \in [ P ] , j \in [ Q ] .
234
+ $$
235
+
236
+ Now we formally define CNN.
237
+
238
+ • Let $\pmb { x } ^ { ( 0 ) } = \pmb { x } \in \mathbb { R } ^ { P \times Q \times C ^ { ( 0 ) } }$ be the input image where $C ^ { ( 0 ) }$ is the initial number of channels. • For $h = 1 , \ldots , L , \beta = 1 , \ldots , C ^ { ( h ) }$ , the intermediate outputs are defined as
239
+
240
+ $$
241
+ \tilde { \mathbf { x } } _ { ( \beta ) } ^ { ( h ) } = \sum _ { \alpha = 1 } ^ { C ^ { ( h - 1 ) } } W _ { ( \alpha ) , ( \beta ) } ^ { ( h ) } * \mathbf { x } _ { ( \alpha ) } ^ { ( h - 1 ) } + \gamma \cdot b _ { ( \beta ) } , \quad \mathbf { x } _ { ( \beta ) } ^ { ( h ) } = \sqrt { \frac { c _ { \sigma } } { C ^ { ( h ) } \times q \times q } \sigma } \left( \tilde { \mathbf { x } } _ { ( \beta ) } ^ { ( h ) } \right)
242
+ $$
243
+
244
+ where each W (h) $W _ { ( \alpha ) , ( \beta ) } ^ { ( h ) } \in \mathbb { R } ^ { q \times q }$ is a filter with Gaussian initialization and $b _ { ( \beta ) }$ is a bias term with Gaussian initialization scaled by $\gamma$ .
245
+
246
+ # CNN-GP and CNTK
247
+
248
+ • For $\alpha = 1 , \dots , C ^ { ( 0 ) } , ( i , j , i ^ { \prime } , j ^ { \prime } ) \in [ P ] \times [ Q ] \times [ P ] \times [ Q ]$ , define
249
+
250
+ $$
251
+ \Big [ \Sigma ^ { ( 0 ) } ( { \pmb x } , { \pmb x } ^ { \prime } ) \Big ] _ { i j , i ^ { \prime } j ^ { \prime } } = \frac { 1 } { q ^ { 2 } } \sum _ { \alpha = 1 } ^ { C ^ { ( 0 ) } } \mathrm { t r } \left( \Big [ { \pmb K } _ { ( \alpha ) } ^ { ( 0 ) } ( { \pmb x } , { \pmb x } ^ { \prime } ) \Big ] _ { \mathscr D _ { i j , i ^ { \prime } j ^ { \prime } } } \right) + \beta ^ { 2 } .
252
+ $$
253
+
254
+ • For $h \in [ L ]$ , – For $( i , \dot { j } , i ^ { \prime } , j ^ { \prime } ) \in [ P ] \times [ Q ] \times [ P ] \times [ Q ]$ , define
255
+
256
+ $$
257
+ \begin{array} { r } { \pmb { \Lambda } _ { i j , i ^ { \prime } j ^ { \prime } } ^ { ( h ) } ( \pmb { x } , \pmb { x } ^ { \prime } ) = \left( \begin{array} { c c } { \left[ \pmb { \Sigma } ^ { ( h - 1 ) } ( \pmb { x } , \pmb { x } ) \right] _ { i j , i j } } & { \left[ \pmb { \Sigma } ^ { ( h - 1 ) } ( \pmb { x } , \pmb { x } ^ { \prime } ) \right] _ { i j , i ^ { \prime } j ^ { \prime } } } \\ { \left[ \pmb { \Sigma } ^ { ( h - 1 ) } \left( \pmb { x } ^ { \prime } , \pmb { x } \right) \right] _ { i ^ { \prime } j ^ { \prime } , i j } } & { \left[ \pmb { \Sigma } ^ { ( h - 1 ) } \left( \pmb { x } ^ { \prime } , \pmb { x } ^ { \prime } \right) \right] _ { i ^ { \prime } j ^ { \prime } , i ^ { \prime } j ^ { \prime } } } \end{array} \right) \in \mathbb { R } ^ { 2 \times 2 } . } \end{array}
258
+ $$
259
+
260
+ – Define ${ \pmb K } ^ { ( h ) } ( { \pmb x } , { \pmb x } ^ { \prime } ) , \dot { \pmb K } ^ { ( h ) } ( { \pmb x } , { \pmb x } ^ { \prime } ) \in \mathbb { R } ^ { P \times Q \times P \times Q }$ , for $( i , j , i ^ { \prime } , j ^ { \prime } ) \in [ P ] \times [ Q ] \times [ P ] \times [ Q ]$
261
+
262
+ $$
263
+ \begin{array} { r l } & { \left[ { K ^ { \left( h \right) } } ( { \pmb x } , { \pmb x } ^ { \prime } ) \right] _ { i j , i ^ { \prime } j ^ { \prime } } = c _ { \sigma } \cdot \underset { ( u , v ) \sim \mathcal { N } \left( \mathbf { 0 } , \Lambda _ { i j , i ^ { \prime } j ^ { \prime } } ^ { \left( h \right) } \left( \pmb x , { \pmb x } ^ { \prime } \right) \right) } { \mathbb { E } } \left[ \cdot \sigma \left( u \right) \sigma \left( v \right) \right] , } \\ & { \left[ \dot { \pmb K } ^ { ( h ) } ( { \pmb x } , { \pmb x } ^ { \prime } ) \right] _ { i j , i ^ { \prime } j ^ { \prime } } = c _ { \sigma } \cdot \underset { ( u , v ) \sim \mathcal { N } \left( \mathbf { 0 } , \Lambda _ { i j , i ^ { \prime } j ^ { \prime } } ^ { \left( h \right) } \left( \pmb x , { \pmb x } ^ { \prime } \right) \right) } { \mathbb { E } } \left[ \dot { \sigma } \left( u \right) \dot { \sigma } \left( v \right) \right] . } \end{array}
264
+ $$
265
+
266
+ – Define $\Sigma ^ { ( h ) } ( { \pmb x } , { \pmb x } ^ { \prime } ) \in \mathbb { R } ^ { P \times Q \times P \times Q }$ , for $( i , j , i ^ { \prime } , j ^ { \prime } ) \in [ P ] \times [ Q ] \times [ P ] \times [ Q ]$
267
+
268
+ $$
269
+ \left[ \Sigma ^ { ( h ) } ( \pmb { x } , \pmb { x } ^ { \prime } ) \right] _ { i j , i ^ { \prime } j ^ { \prime } } = \frac { 1 } { q ^ { 2 } } \mathrm { t r } \left( \left[ \pmb { K } ^ { ( h ) } ( \pmb { x } , \pmb { x } ^ { \prime } ) \right] _ { D _ { i j , i ^ { \prime } j ^ { \prime } } } \right) + \beta ^ { 2 } .
270
+ $$
271
+
272
+ Note that $\Sigma ( { \pmb x } , { \pmb x } ^ { \prime } )$ and $\dot { \Sigma } ( { \pmb x } , { \pmb x } ^ { \prime } )$ share similar structures as their NTK counterparts (Jacot et al., 2018). The only difference is that we have one more step, taking the trace over patches. This step represents the convolution operation in the corresponding CNN. Next, we can use a recursion to compute the final kernel value.
273
+
274
+ 1. First, we define ${ \Theta } ^ { ( 0 ) } ( x , x ^ { \prime } ) = \Sigma ^ { ( 0 ) } ( x , x ^ { \prime } )$ .
275
+ 2. For $h = 1 , \ldots , L$ and $( i , j , i ^ { \prime } , j ^ { \prime } ) \in [ P ] \times [ Q ] \times [ P ] \times [ Q ]$ , we define
276
+
277
+ $$
278
+ \left[ \Theta ^ { ( h ) } ( \pmb { x } , \pmb { x } ^ { \prime } ) \right] _ { i j , i ^ { \prime } j ^ { \prime } } = \frac { 1 } { q ^ { 2 } } \mathrm { t r } \left( \left[ \dot { \pmb { K } } ^ { ( h ) } ( \pmb { x } , \pmb { x } ^ { \prime } ) \odot \Theta ^ { ( h - 1 ) } ( \pmb { x } , \pmb { x } ^ { \prime } ) + \pmb { K } ^ { ( h ) } ( \pmb { x } , \pmb { x } ^ { \prime } ) \right] _ { D _ { i j , i ^ { \prime } j ^ { \prime } } } \right) + \beta ^ { 2 } .
279
+ $$
280
+
281
+ # B ADDITIONAL DEFINITION AND PROOF FOR SECTION 4
282
+
283
+ Definition B.1 (Group). $( { \mathcal { G } } , \circ )$ is $a$ group, if and only if
284
+
285
+ 1. each element $g \in { \mathcal { G } }$ is a operator: $\mathbb { R } ^ { P \times Q \times C } \mathbb { R } ^ { P \times Q \times C }$ ;
286
+ 2 $\ : \ : \forall g _ { 1 } , g _ { 2 } \in \mathcal { G } , g _ { 1 } \circ g _ { 2 } \in \mathcal { G } \ :$ , where $( g _ { 1 } \circ g _ { 2 } ) ( { \pmb x } )$ is defined as $g _ { 1 } ( g _ { 2 } ( { \pmb x } ) )$ .
287
+ 3. $\forall g _ { 1 } , g _ { 2 } , g _ { 3 } \in \mathcal { G } , ( g _ { 1 } \circ g _ { 2 } ) \circ g _ { 3 } = g _ { 1 } \circ ( g _ { 2 } \circ g _ { 3 } ) .$ .
288
+ 4. $\exists e \in { \mathcal { G } }$ , such that $\forall g \in { \mathcal { G } }$ , $e \circ g = g \circ e = g$ .
289
+ 5. $\forall g _ { 1 } \in { \mathcal { G } }$ , $\exists g _ { 2 } \in { \mathcal { G } }$ , such that $g _ { 1 } \circ g _ { 2 } = g _ { 2 } \circ g _ { 1 } = e$ . We denote $g _ { 2 }$ as the inverse of $g _ { 1 }$ , namely,
290
+ $g _ { 1 } ^ { - 1 }$ .
291
+
292
+ Proof of Theorem 4.1. Since we assume $\mathbf { K } _ { \mathbf { X } } ^ { \mathcal { G } }$ and $\mathbf { K } _ { \mathbf { X } _ { \mathcal { G } } }$ are invertible, both $_ { \pmb { \alpha } }$ and $\widetilde { \alpha }$ are uniquely defined. Now we claim $\widetilde { \pmb { \alpha } } _ { g } = \{ \widetilde { \alpha } _ { i , g } \} _ { i \in [ N ] } \in \mathbb { R } ^ { N }$ is equal to $\frac { \pmb { \alpha } } { | \mathscr { G } | }$ for all $g \in { \mathcal { G } }$ .
293
+
294
+ By the invariance of $\mathbf { K }$ under $\mathcal { G }$ , for all $j \in [ N ]$ and $g ^ { \prime } \in \mathcal G$ ,
295
+
296
+ $$
297
+ \begin{array} { l } { { \displaystyle \sum _ { i \in [ N ] , g \in { \mathcal G } } \frac { \alpha _ { i } } { | { \mathcal G } | } \mathbf K ( g ^ { \prime } ( { \mathbf x } _ { j } ) , g ( { \mathbf x } _ { i } ) ) = \sum _ { i \in [ N ] , g \in { \mathcal G } } \frac { \alpha _ { i } } { | { \mathcal G } | } \mathbf K ( ( g ^ { - 1 } \circ g ^ { \prime } ) ( { \mathbf x } _ { j } ) , { \mathbf x } _ { i } ) } } \\ { ~ = \sum _ { i \in [ N ] } \alpha _ { i } \mathbb E _ { g \in { \mathcal G } } \mathbf K ( g ( { \mathbf x } _ { j } ) , { \mathbf x } _ { i } ) } \\ { ~ = \sum _ { i \in [ N ] } \alpha _ { i } \mathbf K ^ { { \mathcal G } } ( { \mathbf x } _ { j } , { \mathbf x } _ { i } ) } \\ { ~ = y _ { j } . } \end{array}
298
+ $$
299
+
300
+ Note that $\widetilde { \pmb { \alpha } }$ is defined as the unique solution of $\mathbf { K } _ { \mathbf { X } _ { \mathcal { G } } } \tilde { \pmb { \alpha } } = \pmb { y } _ { \mathcal { G } }$ , the claim has been verified.
301
+
302
+ Similarly, we have
303
+
304
+ $$
305
+ \sum _ { i \in [ N ] , g \in \mathcal { G } } \frac { \alpha _ { i } } { | \mathcal { G } | } \mathbf { K } ( \pmb { x } ^ { \prime } , g ( \pmb { x } _ { i } ) ) = \sum _ { i \in [ N ] } \alpha _ { i } \mathbb { E } _ { g \in \mathcal { G } } \mathbf { K } ( g ^ { - 1 } ( \pmb { x } ^ { \prime } ) , \pmb { x } _ { i } ) = \sum _ { i \in [ N ] } \alpha _ { i } \mathbf { K } ^ { \mathcal { G } } ( \pmb { x } ^ { \prime } , \pmb { x } _ { i } ) .
306
+ $$
307
+
308
+ # C EQUIVALENCE BETWEEN LAP AND BOX FILTERING LAYER.
309
+
310
+ For a CNN with a box filtering layer before the final fully-connected layer, the final output is defined $\begin{array} { r } { f ( \pmb { \theta } , \pmb { x } ) = \sum _ { \alpha = 1 } ^ { C ^ { ( L ) } } \Big \langle \pmb { W } _ { ( \alpha ) } ^ { ( L + 1 ) } , \mathsf { B F } \left( \pmb { W } _ { ( \alpha ) } ^ { ( L ) } \right) } \end{array}$ x(L)(α) E, where x(L)(α) $\pmb { x } _ { ( \alpha ) } ^ { ( L ) } \in \mathbb { R } ^ { P \times Q }$ , and ${ W _ { ( \alpha ) } ^ { ( L + 1 ) } } \in \mathbb { R } ^ { P \times Q }$ is the weight of the last fully-connected layer.
311
+
312
+ Now we establish the equivalence between BF and LAP on CNTK. The equivalence on CNNGP can be derived similarly. Let $\Theta _ { \mathsf { B F } } \left( \pmb { x } , \pmb { x } ^ { \prime } \right) \ \in \ \mathbb { R } ^ { [ P ] \times [ Q ] \times [ P ] \times [ Q ] }$ be the CNTK kernel of BF $\left( \pmb { x } _ { ( \alpha ) } ^ { ( L ) } \right)$ . Since BF is just a linear operation, we have
313
+
314
+ $$
315
+ \left[ \Theta _ { \mathsf { B F } } \left( \pmb { x } , \pmb { x } ^ { \prime } \right) \right] _ { i , j , i ^ { \prime } , j ^ { \prime } } = \frac { 1 } { \left( 2 c + 1 \right) ^ { 4 } } \sum _ { \Delta _ { i } , \Delta _ { j } , \Delta _ { i ^ { \prime } } ^ { \prime } , \Delta _ { j ^ { \prime } } ^ { \prime } \in [ - c , c ] ^ { 4 } } \left[ \Theta ^ { \left( L \right) } \left( \pmb { x } , \pmb { x } ^ { \prime } \right) \right] _ { i + \Delta _ { i } , j + \Delta _ { j } , i ^ { \prime } + \Delta _ { i } ^ { \prime } , j ^ { \prime } + \Delta _ { j } ^ { \prime } } .
316
+ $$
317
+
318
+ By the formula of the output kernel value for CNTK without GAP, we obtain
319
+
320
+ $$
321
+ \mathrm { t r } \left( \Theta _ { \mathsf { B F } } \left( \pmb { x } , \pmb { x } ^ { \prime } \right) \right) = \frac { 1 } { \left( 2 c + 1 \right) ^ { 4 } } \sum _ { \Delta _ { i } , \Delta _ { i } ^ { \prime } , \Delta _ { j } , \Delta _ { j } ^ { \prime } \in [ - c , c ] ^ { 4 } } \sum _ { \substack { i , j \in [ P ] \times [ Q ] } } [ \Theta ( \pmb { x } , \pmb { x } ^ { \prime } ) ] _ { i + \Delta _ { i } , j + \Delta _ { j } , i + \Delta _ { i } ^ { \prime } , j + \Delta _ { j } ^ { \prime } } .
322
+ $$
323
+
324
+ ![](images/1bbc9f757c12c5aed515820a88529545a710a5495ef9d4f4d35c646a539fd9a7.jpg)
325
+ Figure 2: Randomly sampled images with full translation data augmentation and local translation data augmentation from CIFAR-10. Full translation data augmentation can create unrealistic images that harm the performance whereas local translation data augmentation creates more realistic images.
326
+
327
+ D EXPERIMENTAL SETUP IN SECTION 6
328
+
329
+ For both CIFAR-10 and Fashion-MNIST we use the full training set and report the test accuracy on the full test set. Throughout this section we only consider $3 \times 3$ convolutional filters with stride 1 and no dilation. In the convolutional layers in CNTK and CNN-GP, we use zero padding with pad size 1 to ensure the input of each layer has the same size. We use zero padding for LAP throughout the experiment. We perform standard preprocessing (mean subtraction and standard deviation division) for all images.
330
+
331
+ In all experiments, we perform kernel ridge regression to utilize the calculated kernel values4. We normalize the kernel matrices so that all diagonal entries are ones. Equivalently, we ensure all features have unit norm in RKHS. Since the resulting kernel matrices are usually ill-conditioned, we set the regularization term $\lambda = 5 \times 1 0 ^ { - 5 }$ , to make inverting kernel matrices numerically stable. We use one-hot encodings of the labels as regression targets. We use scipy.linalg.solve to solve the corresponding kernel ridge regression problem.
332
+
333
+ The kernel value of CNTK and CNN-GP are calculated using the CuPy package. We write native CUDA codes to speed up the calculation of the kernel values. All experiments are performed on Amazon Web Services (AWS), using (possibly multiple) NVIDIA Tesla V100 GPUs. For efficiency considerations, all kernel values are computed with 32-bit precision.
334
+
335
+ One unique advantage of the dynamic programming algorithm for calculating CNTK and CNNGP is that we do not need repeat experiments for, say, different values of $c$ in LAP and different depths. With our highly-optimized native CUDA codes, we spend roughly 1,000 GPU hours on calculating all kernel values for each dataset.
336
+
337
+ # E TEST ACCURACY OF CNTK AND CNN-GP ON FASHION-MNIST
338
+
339
+ Table 5: Test accuracy of CNTK on Fashion-MNIST.
340
+
341
+ <table><tr><td>d C</td><td colspan="3">5 8</td><td colspan="2">11</td></tr><tr><td>0</td><td>92.25 (92.56)</td><td>92.22</td><td>(92.51) 92.11</td><td>(92.29)</td><td>91.76 (92.17)</td></tr><tr><td>4</td><td>93.76 (94.07)</td><td>93.69 (93.86)</td><td>93.55</td><td>(93.74)</td><td>93.37 (93.58)</td></tr><tr><td>8</td><td>93.72 (93.96)</td><td>93.67 (93.78)</td><td>93.50</td><td>(93.58)</td><td>93.32 (93.51)</td></tr><tr><td>12</td><td>93.59 (93.80)</td><td>93.58 (93.70)</td><td>93.35</td><td>(93.44)</td><td>93.21 (93.40)</td></tr><tr><td>16</td><td>93.50 (93.62)</td><td>93.42 (93.63)</td><td>93.27</td><td>(93.40)</td><td>93.10 (93.25)</td></tr><tr><td>20</td><td>93.10 (93.34)</td><td>93.17 (93.49)</td><td></td><td>93.20 (93.34)</td><td>92.99 (93.18)</td></tr><tr><td>24</td><td>92.77 (93.04)</td><td>93.07 (93.44)</td><td>93.11 (</td><td>(93.31)</td><td>93.02 (93.21)</td></tr><tr><td>28</td><td>92.80 (92.98)</td><td>93.08 (93.42)</td><td>93.12(</td><td>(93.28)</td><td>92.97 (93.19)</td></tr></table>
342
+
343
+ <table><tr><td>d C</td><td>5</td><td>8</td><td>11</td><td>14</td><td></td></tr><tr><td>0</td><td>91.47 (91.81)</td><td>91.96( (92.37)</td><td>92.09( (92.60)</td><td>92.22</td><td>(92.72)</td></tr><tr><td>4</td><td>93.44 (93.60)</td><td>93.59 (93.79)</td><td>93.63 (93.76)</td><td></td><td>93.59 (93.64)</td></tr><tr><td>8</td><td>93.26 (93.16)</td><td>93.41 (93.51)</td><td>93.31 (93.52)</td><td></td><td>93.39 (93.46)</td></tr><tr><td>12</td><td>92.83 3(92.94)</td><td>93.07 (93.20)</td><td>93.11 (93.15)</td><td></td><td>92.94 (93.09)</td></tr><tr><td>16</td><td>92.46 (92.51)</td><td>92.58 (92.83)</td><td>92.64( (92.92)</td><td></td><td>92.68 (93.07)</td></tr><tr><td>20</td><td>91.83 (91.72)</td><td>92.35 (92.42)</td><td>92.49 (92.79)</td><td></td><td>92.51 (92.69)</td></tr><tr><td>24</td><td>91.15 (91.40)</td><td>92.10 (92.18)</td><td>92.29 (92.60)</td><td></td><td>92.41 (92.77)</td></tr><tr><td>28</td><td>91.30 (91.37)</td><td>92.03 (92.27)</td><td>92.41( (92.79)</td><td></td><td>92.41 (92.74)</td></tr></table>
344
+
345
+ Table 6: Test accuracy of CNN-GP on Fashion-MNIST.
346
+
347
+ # F VALIDATION ACCURACY OF CNTK AND CNN-GP ON CIFAR-10 AND FASHION-MNIST
348
+
349
+ <table><tr><td>d C</td><td colspan="2">5</td><td colspan="2">8</td><td colspan="2">11</td><td colspan="2">14</td></tr><tr><td>0</td><td>64.26</td><td>(68.42)</td><td>64.47 (68.23)</td><td></td><td>63.94 (67.80)</td><td></td><td></td><td>63.29 (67.00)</td></tr><tr><td>4</td><td></td><td>75.97 (78.87)</td><td>75.89 (78.99)</td><td></td><td>75.65 (78.56)</td><td></td><td></td><td>75.40 (78.19)</td></tr><tr><td>8</td><td></td><td>77.93 (80.65)</td><td>77.90 (80.69)</td><td></td><td>77.65 (80.41)</td><td></td><td></td><td>76.92 (79.94)</td></tr><tr><td>12</td><td></td><td>78.51 (80.73)</td><td></td><td>78.47 (80.85)</td><td>78.18 (80.57)</td><td></td><td>77.71 (80.19)</td><td></td></tr><tr><td>16</td><td></td><td>78.47 (80.39)</td><td></td><td>78.69 (80.56)</td><td>78.34 (80.17)</td><td></td><td></td><td>77.74 (79.97)</td></tr><tr><td>20</td><td></td><td>77.86 (79.69)</td><td>77.81 (79.81)</td><td></td><td>77.38 (79.55)</td><td></td><td></td><td>76.88 (79.46)</td></tr><tr><td>24</td><td></td><td>76.59 (78.12)</td><td>76.80 (78.63)</td><td></td><td>76.44 (78.79)</td><td></td><td></td><td>76.18 (78.73)</td></tr><tr><td>28</td><td></td><td>75.44 (77.08)</td><td>76.15 (78.20)</td><td></td><td></td><td>76.10 (78.30)</td><td></td><td>75.95 (78.37)</td></tr><tr><td>32</td><td></td><td>75.33 (76.99)</td><td></td><td>76.04 (78.09)</td><td></td><td>76.08 (78.27)</td><td></td><td>75.99 (78.32)</td></tr></table>
350
+
351
+ Table 7: Validation accuracy of CNTK on CIFAR-10.
352
+
353
+ <table><tr><td>d C</td><td>5</td><td>8</td><td>11</td><td></td><td>14</td></tr><tr><td>0</td><td>62.49 (66.63)</td><td>64.25 (68.20)</td><td>64.94 (69.01)</td><td></td><td>65.35 (69.29)</td></tr><tr><td>4</td><td>75.31 (78.59)</td><td>76.05 (79.20)</td><td>76.05 (79.17)</td><td></td><td>76.20 (79.09)</td></tr><tr><td>8</td><td>78.17 (81.02)</td><td>78.53 (81.29)</td><td>78.36 (81.20)</td><td></td><td>78.05 (80.98)</td></tr><tr><td>12</td><td>79.19 (81.38)</td><td>79.08 (81.66)</td><td>79.13 (81.52)</td><td></td><td>78.90 (81.10)</td></tr><tr><td>16</td><td>79.26 (81.18)</td><td>79.24 (81.37)</td><td>78.85 (81.33)</td><td></td><td>78.82 (80.84)</td></tr><tr><td>20</td><td>78.72 (80.61)</td><td>78.72 (80.85)</td><td>78.45 (80.60)</td><td></td><td>78.08 (80.22)</td></tr><tr><td></td><td>77.31 (79.01)</td><td>77.59 (79.49)</td><td>77.41 (79.56)</td><td></td><td>77.26 (79.38)</td></tr><tr><td>28</td><td>76.01 (77.60)</td><td>76.60 (78.32)</td><td>76.57 (78.76)</td><td></td><td>76.86 (79.01)</td></tr><tr><td>32</td><td>75.72 (77.54)</td><td>76.42 (78.47)</td><td>76.56 (78.94)</td><td></td><td>76.63 (78.87)</td></tr></table>
354
+
355
+ Table 8: Validation accuracy of CNN-GP on CIFAR-10.
356
+
357
+ <table><tr><td>d C</td><td colspan="2">5</td><td colspan="2">8</td><td colspan="2">14</td></tr><tr><td>4</td><td>83.89 (85.76)</td><td>83.13</td><td>(85.40)</td><td>82.62 (84.95)</td><td></td><td>82.02 (84.43)</td></tr><tr><td>8</td><td>85.52 (87.59)</td><td>84.88</td><td>(87.12)</td><td>84.30 (86.69)</td><td></td><td>83.84 (86.10)</td></tr><tr><td>12</td><td>85.71 (87.85)</td><td>85.32</td><td>(87.42)</td><td>84.81 (87.02)</td><td></td><td>84.26 (86.58)</td></tr><tr><td>16</td><td>85.68 (87.76)</td><td>85.19(</td><td>(87.30)</td><td>84.71 (86.83)</td><td></td><td>84.47 (86.40)</td></tr><tr><td>20</td><td>85.26 (87.11)</td><td>84.91</td><td>(86.67)</td><td>84.44 1(86.40)</td><td></td><td>84.09 (86.17)</td></tr></table>
358
+
359
+ Table 9: Validation accuracy of additional feature extractor $^ +$ CNTK on CIFAR-10.
360
+
361
+ <table><tr><td>d C</td><td>5</td><td>8</td><td>11</td><td>14</td></tr><tr><td>4</td><td>84.03 (86.16)</td><td>84.21 (86.38)</td><td>84.15 (86.33)</td><td>83.98 (86.04)</td></tr><tr><td>8</td><td>85.85 (87.94)</td><td>85.87 (88.03)</td><td>85.70 (87.87)</td><td>85.49 (87.62)</td></tr><tr><td>12</td><td>86.37 (88.33)</td><td>86.38 (88.25)</td><td>86.06 (88.12)</td><td>85.69 (87.82)</td></tr><tr><td>16</td><td>86.06 (88.27)</td><td>86.21 (88.05)</td><td>86.01 (87.87)</td><td>85.58 (87.74)</td></tr><tr><td>20</td><td>85.73 3(87.71)</td><td>85.79 (87.60)</td><td>85.73 (87.54)</td><td>85.27 (87.21)</td></tr></table>
362
+
363
+ Table 10: Validation accuracy of additional feature extractor $^ +$ CNN-GP on CIFAR-10.
364
+
365
+ <table><tr><td>d C</td><td>5</td><td>8</td><td>11</td><td></td><td>14</td></tr><tr><td>0</td><td>92.07 (92.30)</td><td>92.08 (92.21)</td><td>91.79 (91.99)</td><td></td><td>91.51 (91.72)</td></tr><tr><td>4</td><td>93.84 (93.96)</td><td>93.82 (93.83)</td><td>93.58 (93.74)</td><td></td><td>93.40 (93.57)</td></tr><tr><td>8</td><td>93.82 (93.96)</td><td>93.80 (93.77)</td><td>93.56 (93.71)</td><td></td><td>93.37 (93.57)</td></tr><tr><td>12</td><td>93.71 (93.83)</td><td>93.60 (93.72)</td><td>93.45</td><td>(93.58)</td><td>93.41 (93.45)</td></tr><tr><td>16</td><td>93.59 (93.73)</td><td>93.39 (93.63)</td><td>93.34 (93.53)</td><td></td><td>93.21 (93.45)</td></tr><tr><td>20</td><td>93.24 (93.44)</td><td>93.29 (93.42)</td><td>93.26 (93.30)</td><td></td><td>93.19 (93.31)</td></tr><tr><td>24</td><td>93.16 (93.28)</td><td>93.21 (93.39)</td><td>93.30 (93.32)</td><td></td><td>93.22 (93.32)</td></tr><tr><td>28</td><td>93.11 (93.23)</td><td>93.21 (93.33)</td><td>93.29 ( (93.29)</td><td></td><td>93.28 (93.31)</td></tr></table>
366
+
367
+ Table 11: Validation accuracy of CNTK on Fashion-MNIST.
368
+
369
+ <table><tr><td>d C</td><td colspan="2">5</td><td colspan="2">8</td><td colspan="2">14</td></tr><tr><td>0</td><td>91.13 (91.43)</td><td>91.57</td><td>(91.77)</td><td>91.85 (91.92)</td><td></td><td>91.94 (92.08)</td></tr><tr><td>4</td><td>93.44 (93.55)</td><td></td><td>93.57 (93.54)</td><td>93.69 (93.68)</td><td></td><td>93.58 (93.64)</td></tr><tr><td>8</td><td>93.57 (93.67)</td><td></td><td>93.51 (93.68)</td><td>93.52 (93.72)</td><td></td><td>93.44 (93.58)</td></tr><tr><td>12</td><td>93.15( (93.36)</td><td></td><td>93.49 (93.59)</td><td>93.25 (93.52)</td><td></td><td>93.23 (93.44)</td></tr><tr><td>16</td><td>92.83 (92.84)</td><td></td><td>93.01 (93.19)</td><td>93.01 (93.27)</td><td></td><td>92.95 (93.18)</td></tr><tr><td>20</td><td>92.29 (92.45)</td><td></td><td>92.60 (92.82)</td><td>92.60 (92.93)</td><td></td><td>92.78 (93.10)</td></tr><tr><td>24</td><td>91.76 (92.04)</td><td></td><td>92.28 (92.63)</td><td>92.57 (92.86)</td><td></td><td>92.58 (92.78)</td></tr><tr><td>28</td><td>91.79 (92.00)</td><td></td><td>92.32 (92.56)</td><td>92.56 (92.77)</td><td></td><td>92.70 (93.00)</td></tr></table>
370
+
371
+ Table 12: Validation accuracy of CNN-GP on Fashion-MNIST.
372
+
373
+ # G SETTING OF THE EXPERIMENT IN SECTION 6.3
374
+
375
+ The total number of training epochs is 80, and the learning rate is 0.1 initially, decayed by 10 at epoch 40 and 60 respectively. The momentum is 0.9 and the weight decay factor is 0.0005. In Figure 1, the blue line reports the average test accuracy of the last 10 epochs, while the red line reports the best test accuracy of the total 80 epochs. Each experiment is repeated for 3 times. We use circular padding for both convolutional layers and the BF layer. The last data point with largest $x$ -coordinate reported in Figure 1 corresponds to GAP.
md/train/BkgRe1SFDS/BkgRe1SFDS.md ADDED
@@ -0,0 +1,440 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # LEARNING WORLD GRAPH DECOMPOSITIONS TO ACCELERATE REINFORCEMENT LEARNING
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Efficiently learning to solve tasks in complex environments is a key challenge for reinforcement learning (RL) agents. We propose to decompose a complex environment using a task-agnostic world graphs, an abstraction that accelerates learning by enabling agents to focus exploration on a subspace of the environment. The nodes of a world graph are important waypoint states and edges represent feasible traversals between them. Our framework has two learning phases: 1) identifying world graph nodes and edges by training a binary recurrent variational autoencoder (VAE) on trajectory data and 2) a hierarchical RL framework that leverages structural and connectivity knowledge from the learned world graph to bias exploration towards task-relevant waypoints and regions. We thoroughly evaluate our approach on a suite of challenging maze tasks and show that using world graphs significantly accelerates RL, achieving higher reward and faster learning.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Many real-world applications, e.g., self-driving cars and in-home robotics, require an autonomous agent to execute different tasks within a single environment that features, e.g. high-dimensional state space, complex world dynamics or structured layouts. In these settings, model-free reinforcement learning (RL) agents often struggle to learn efficiently, requiring a large amount of experience collections to converge to optimal behaviors. Intuitively, an agent could learn more efficiently by focusing its exploration in task-relevant regions, if it has knowledge of the high-level structure of the environment.
12
+
13
+ We propose a method to 1) learn and 2) use an environment decomposition in the form of a world graph, a task-agnostic abstraction. World graph nodes are waypoint states, a set of salient states that can summarize agent trajectories and provide meaningful starting points for efficient exploration (Chatzigiorgaki & Skodras, 2009; Jayaraman et al., 2018; Ghosh et al., 2018). The directed and weighted world graph edges characterize feasible traversals among the waypoints. To leverage the world graph, we model hierarchical RL (HRL) agents where a high-level policy chooses a waypoint state as a goal to guide exploration towards task-relevant regions, and a low-level policy strives to reach the chosen goals.
14
+
15
+ Our framework consists of two phases. In the task-agnostic phase, we obtain world graphs by training a recurrent variational auto-encoder (VAE) (Chung et al., 2015; Gregor et al., 2015; Kingma & Welling, 2013) with binary latent variables (Nalisnick & Smyth, 2016) over trajectories collected using a random walk policy (Ha & Schmidhuber, 2018) and a curiosity-driven goal-conditioned policy (Ghosh et al., 2018; Nair et al., 2018). World graph nodes are states that are most frequently selected by the binary latent variables, while edges are inferred from empirical transition statistics between neighboring waypoints. In the task-specific phase, taking advantage of the learned world graph for structured exploration, we efficiently train an HRL model (Taylor & Stone, 2009).
16
+
17
+ In summary, our main contributions are:
18
+
19
+ • A task-agnostic unsupervised approach to learn world graphs, using a recurrent VAE with binary latent variables and a curiosity-driven goal-conditioned policy. • An HRL scheme for the task-specific phase that features multi-goal selection (Wide-thenNarrow) and navigation via world graph traversal.
20
+
21
+ ![](images/87e8c713c76547993153ec99d35d40aae11b5121b86240dad4d5ac65a6d03b12.jpg)
22
+ Figure 1: Top Left: overall pipeline of our 2-phase framework. Top Right (world graph discovery): a subgraph exemplifies traversal between waypoint states (in blue), see Section 3 for more details. Bottom (Hierarhical $R L$ ): an example rollout from our proposed HRL policy with Wide-then-Narrow Manager instructions and world graph traversals, solving a challenging Door-Key task, see Section 4 for more details.
23
+
24
+ • Empirical evaluations on multiple tasks in complex 2D grid worlds to validate that our framework produces descriptive world graphs and significantly improves both sample efficiency and final performance on these tasks over baselines, especially thanks to transfer learning from the unsupervised phase and world graph traversal.
25
+
26
+ # 2 RELATED WORK
27
+
28
+ An understanding of the environment and its dynamics is essential for effective planning and control in model-based RL. For example, a robotics agent often locates or navigates by interpreting a map (Lowry et al., 2015; Thrun, 1998; Angeli et al., 2008). Our exploration strategy draws inspiration from active localization, where robots are actively guided to investigate unfamiliar regions (Fox et al., 1998; Li et al., 2016). Besides mapping, recent works (Azar et al., 2019; Ha & Schmidhuber, 2018; Guo et al., 2018) learn to represent the world with generative latent states (Tian & Gong, 2017; Haarnoja et al., 2018; Racanière et al., 2017). If the latent dynamics are also extrapolated, the latent states can assist planning (Mnih et al., 2016a; Hafner et al., 2018) or model-based RL (Gregor & Besse, 2018; Kaiser et al., 2019).
29
+
30
+ While also aiming to model the world, we approach this as abstracting both the structure and dynamics of the environment in a graph representation, where nodes are states from the environment and edges encode actionable efficient transitions between nodes. Existing works (Metzen, 2013; Mannor et al., 2004; Eysenbach et al., 2019; Entezari et al., 2010) have shown benefits of such graph abstractions but typically select nodes only subject to a good coverage the observed state space. Instead, we identify a parsimonious subset of states that can summarize trajectories and provide more useful intermediate landmarks, i.e. waypoints, for navigating complex environments.
31
+
32
+ Our method for estimating waypoint states can be viewed as performing automatic (sub)goal discovery. Subgoal and subpolicy learning are two major approaches to identify a set of temporally-extended actions, “skills”, that allow agents to efficiently learn to solve complex tasks. Subpolicy learning identifies policies useful to solve RL tasks, such as option-based methods (Daniel et al., 2016; Bacon et al., 2017) and subtask segmentations (Pertsch et al., 2019; Kipf et al., 2018). Subgoal learning, on the other hand, identifies “important states” to reach ( ¸Sim¸sek et al., 2005).
33
+
34
+ Previous works consider various definitions of “important” states: frequently visited states during successful task completions (Digney, 1998; McGovern & Barto, 2001), states introducing the most novel information (Goyal et al., 2019), bottleneck states connecting densely-populated regions (Chen et al., 2007; ¸Sim¸sek et al., 2005), or environment-specific heuristics (Ecoffet et al., 2019). Our work draws intuition from unsupervised temporal segmentation (Chatzigiorgaki & Skodras, 2009; Jayaraman et al., 2018) and imitation learning (Abbeel & $\mathrm { N g }$ , 2004; Hussein et al., 2017). We define “important” states (waypoints) as the most critical states in recovering action sequences generated by some agent, which indicates that these states contain the richest information about the executed policy (Azar et al., 2019).
35
+
36
+ ![](images/0b8b33e4d41c1c614e19d9ac24f4cdb5614a9211348b71ee40716b3df882e83c.jpg)
37
+ Figure 2: Our recurrent latent model with differentiable binary latent units to identify waypoint states. A prior network (left) learns the state-conditioned prior in Beta distribution, $p _ { \psi } ( z _ { t } | s _ { t } ) { = } \mathrm { B e t a } ( \alpha _ { t } , \beta _ { t } )$ . An inference encoder learns an approximate posterior in HardKuma distribution inferred from the state-action sequence input, $q _ { \phi } ( z _ { t } | \mathbf { a } , z ) { = } \mathrm { H a r d } \hat { \mathrm { K } } \mathrm { u m a } ( \tilde { \alpha _ { t } } , \mathbf { \hat { 1 } } )$ . A generation network $p _ { \theta }$ reconstructs $\textbf { \em a }$ from $\{ s _ { t } | z _ { t } = 1 \}$ .
38
+
39
+ # 3 LEARNING WORLD GRAPHS
40
+
41
+ We propose a method for learning a world graph $\mathcal { G } _ { w }$ , a task-agnostic abstraction of an environment that captures its high-level structure and dynamics. In this work, the primary use of world graphs is to accelerate reinforcement learning of downstream tasks. The nodes of $\mathcal { G } _ { w }$ , denoted by a set of waypoints states $s _ { p } \in \mathcal { V } _ { p }$ , are generically “important” for accomplishing tasks within the environment, and therefore useful as starting points for exploration. Our method identifies such waypoint states from interactions with the environment. In addition, we embed feasible transitions between nearby waypoint states as the edges of $\mathcal { G } _ { w }$ .
42
+
43
+ In this work, we define important states in the context of learning $\mathcal { G } _ { w }$ (see Section 2 for alternative definitions). That is, we wish to discover a small set of states that, when used as world graph nodes, concisely summarize the structure and dynamics of the environment. Below, we describe 1) how to collect state-action trajectories and an unsupervised learning objective to identify world graph nodes, and 2) how the graph’s edges (i.e., how to transition between nodes) are formed from trajectories.
44
+
45
+ # 3.1 WAYPOINT STATE IDENTIFICATION
46
+
47
+ The structure and dynamics of an environment are implicit in the state-action trajectories observed during exploration. To identify world graph nodes from such data, we train a recurrent variational autoencoder (VAE) that, given a sequence of state-action pairs, identifies a subset of the states in the sequence from which the full action sequence can be reconstructed (Figure 2). In particular, the VAE infers binary latent variables that controls whether each state in the sequence is used by the generative decoder, i.e., whether a state is “important” or not.
48
+
49
+ Binary Latent VAE The VAE consists of an inference, a generative and a prior network. These are structured as follows: the input to the inference network $q _ { \phi }$ is a trajectory of state-action pairs observed from the environment ${ \tau } = \{ ( s _ { t } , a _ { t } ) \} _ { t = 0 } ^ { T }$ , with ${ \pmb s } = \{ { \boldsymbol s } _ { t } \} _ { t = 0 } ^ { T }$ and $\pmb { a } { = } \{ a _ { t } \} _ { t = 0 } ^ { T }$ denoting the state and action sequences respectively. The output of the inference network is the approximated posterior over a sequence ${ z } = \{ z _ { t } \} _ { t = 0 } ^ { \bar { T } }$ of binary latent variables, denoted as $\varphi _ { \phi } ( \boldsymbol { z } | \boldsymbol { a } , \boldsymbol { s } )$ . The generative network $p _ { \theta }$ computes a distribution over the full action sequence $\textbf { \em a }$ using the masked state sequence, where $s _ { t }$ is masked if $z _ { t } { = } 0$ (we fix $z _ { 0 } { = } z _ { T } { = } 1$ during training), denoted as $p _ { \theta } ( { \pmb a } | { \pmb s } , z )$ .
50
+
51
+ Finally, a state-conditioned $p _ { \psi } ( z _ { t } | s _ { t } )$ given by the prior network $p _ { \psi }$ for each $s _ { t }$ encodes the empirical average probability that state $s _ { t }$ is activated for reconstruction. This choice encourages inference to select within a consistent subset of states for use in action reconstruction. In particular, the waypoint states $\nu _ { p }$ are chosen as the states with the largest prior means and during training, once every few iterations, $\nu _ { p }$ is updated based on the current prior network.
52
+
53
+ <table><tr><td>Algorithm 1: Identifying waypoint states Vp and learning a goal-conditioned policy g Result: Waypoint states Vp and a goal-conditioned policy π g</td></tr><tr><td>Initialize network parameters for the recurrent variational inference model V Initialize network parameters for the goal-conditioned policy g Initialize Vp with the initial position of the agent,i.e.Vp = {so = (1,1)}</td></tr><tr><td>while VAE reconstruction error has not converged do</td></tr><tr><td>forn←1toNdo Sample random waypoint sp ∈ Vp</td></tr><tr><td>Navigate agent to sp and perform T-step rollout using a randow walk policy: T𝑛 ←{(s0= Sp,ao),.,(sT,ar)}</td></tr><tr><td>gn←ST Navigate agent to Sp and perform T-step rollout using Tg with goal gn:</td></tr><tr><td>Tπ ←{(s= Sp,ao),.,(sT,ar)}at~πg(-st,9n) Re-label πg rewards with action reconstruction error as curiosity bonus:</td></tr><tr><td>rπ←{1st+1=n-λ·p(at|s,z)}=0</td></tr><tr><td>end</td></tr><tr><td>Perform policy gradient update of πg using T&quot; and rπ</td></tr><tr><td>Update V using T and T</td></tr><tr><td>Update Vp as set of states with largest prior mean αs αs+βs</td></tr></table>
54
+
55
+ Objective Formally, we optimize the VAE using the following evidence lower bound (ELBO):
56
+
57
+ $$
58
+ \mathrm { E L B O } = \mathbb { E } _ { q _ { \phi } ( z | a , s ) } \left[ \log p _ { \theta } ( a | s , z ) \right] - D _ { \mathrm { K L } } \left( q _ { \phi } ( z | a , s ) | p _ { \psi } ( z | s ) \right) .
59
+ $$
60
+
61
+ To ensure differentiablity, we apply a continuous relaxation over the discrete $z _ { t }$ . We use the Beta distribution $p _ { \psi } ( z _ { t } ) = \mathrm { B e t a } ( \alpha _ { t } , \beta _ { t } )$ for the prior and the Hard Kumaraswamy distribution $q _ { \psi } ( z _ { t } | { a } , { z } ) = \mathrm { H a r d K u m a } ( \tilde { \alpha } _ { t } , \tilde { \beta } _ { t } )$ for the approximate posterior, which resembles the Beta distribution but is outside the exponential family (Bastings et al., 2019). This choice allows us to sample 0s and 1s without sacrificing differentiability, accomplished via the stretch-and-rectify procedure (Bastings et al., 2019; Louizos et al., 2017) and the reparametrization trick (Kingma & Welling, 2013). Lastly, to prevent the trivial solution of using all states for reconstruction, we use a secondary objective $\mathcal { L } _ { 0 }$ to regularize the $L _ { 0 }$ norm of $_ z$ at a targeted value $\mu _ { 0 }$ (Louizos et al., 2017; Bastings et al., 2019), the desired number of selected states out of $T$ steps, e.g. for when $T = 2 5$ , we set $\mu _ { 0 } = 5$ , meaning ideally 5 out of 25 states are activated for action reconstruction. Another term $\mathcal { L } _ { T }$ to encourage temporal separation between selected states by targeting the number of $0 / 1$ switches among $_ z$ at $2 \mu _ { 0 }$ :
62
+
63
+ $$
64
+ \mathcal { L } _ { 0 } = \Big | \Big | \mathbb { E } _ { q _ { \phi } ( z | s , a ) } [ \| z \| _ { 0 } ] - \mu _ { 0 } \Big | \Big | ^ { 2 } , \quad \mathcal { L } _ { T } = \Bigg | \Bigg | \mathbb { E } _ { q _ { \phi } ( z | s , a ) } \left[ \sum _ { t = 0 } ^ { T } \mathbb { 1 } [ z _ { t } \neq z _ { t + 1 } ] \right] - 2 \mu _ { 0 } \Bigg | \Bigg | ^ { 2 } .
65
+ $$
66
+
67
+ See Appendix A for details on training the VAE with binary $z _ { t }$ , including integration of the Hard Kumaraswamy distribution and how to regularize the statistics of $_ z$ .
68
+
69
+ # 3.2 EXPLORATION FOR WORLD GRAPH DISCOVERY
70
+
71
+ Naturally, the latent structure learned by the VAE depends on the trajectories used to train it. Hence, collecting a rich set of trajectories is crucial. Here, we propose a strategy to bootstrap a useful set of trajectories by alternately exploring the environment based on the current iteration’s $\nu _ { p }$ and updating the VAE and $\nu _ { p }$ , repeating this cycle until the action reconstruction accuracy plateaus (Algorithm 1).
72
+
73
+ During exploration, we use action replay to navigate the agent to a state drawn from the current iteration’s $\nu _ { p }$ . Although resetting via action replay assumes our underneath environment to be deterministic, in cases where this resetting strategy is infeasible, it may be modified so long as to allow the exploration starting points to expand as the agent discovers more of its environment. For each such starting point, we collect two rollouts. In the first rollout, we perform a random walk to explore the nearby region. In the second rollout, we perform actions using a goal-conditioned policy $\pi _ { g }$ (GCP), setting the final state reached by the random walk as the goal. Both rollouts are used for trianing the VAE and the latter is also used for training $\pi _ { g }$ .
74
+
75
+ ![](images/0c4516ced121df0c03431d831806e1817ee32a043d24758d20a0950c4f69de1d.jpg)
76
+ Figure 3: Left: a standard Feudal Network. Right: using Wide-then-Narrow goals. The Manager first outputs a waypoint state as the wide goal $g ^ { w }$ , then attends to a closer-up area around $g ^ { w }$ to narrow down the final goal $g ^ { n }$ .
77
+
78
+ GCP provides a venue to integrate intrinsic motivation, such as curiosity (Burda et al., 2018; Achiam & Sastry, 2017; Pathak et al., 2017; Azar et al., 2019) to generate more diverse rollouts. Specifically, we use the action reconstruction error of the VAE as an intrinsic reward signal when training $\pi _ { g }$ . This choice of curioisty also prevents the VAE from collapsing to the simple behaviors of a vanilla $\pi _ { g }$ .
79
+
80
+ # 3.3 EDGE FORMATION
81
+
82
+ The final stage is to construct the edges of $\mathcal { G } _ { w }$ , which should ideally capture the environment dynamics, i.e. how to transition between waypoint states. Once VAE training is complete and $\nu _ { p }$ is fixed, we collect random walk rollouts from each of the waypoints $s _ { p } \in \mathcal { V } _ { p }$ to estimate the underlying adjacency matrix (Biggs, 1993). More precisely, we claim a directed edge $s _ { p } \to s _ { q }$ if there exists a random walk trajectory from $s _ { p }$ to $s _ { q }$ that does not intersect a third waypoint. We also consider paths taken by $\pi _ { g }$ (starting at $s _ { p }$ and setting $s _ { q }$ as the goal) and keep the shortest observed path from $s _ { p }$ to $s _ { q }$ as a world graph edge transition. We use the action sequence length of the edge transition between adjacent waypoints as the weight of the edge. As shown experimentally, a key benefit of our approach is the ability to plan over $\mathcal { G } _ { w }$ . To navigate from one waypoint to another, we can use dynamic programming (Sutton, 1998; Feng et al., 2004) to output the optimal traversal of the graph.
83
+
84
+ # 4 ACCELERATING REINFORCEMENT LEARNING WITH WORLD GRAPHS
85
+
86
+ World graphs present a high-level, task-agnostic abstraction of the environment through waypoints and feasible transition routes between them. A key example of world graph applications for taskspecific RL is structured exploration: instead of exploring the entire environment, RL agents can use world graphs to quickly identify task-relevant regions and bias low-level exploration to these regions. Our framework to leverage world graphs for structured exploration consists of two parts:
87
+
88
+ 1. Hierarchical RL wherein the high-level policy selects subgoals from $\nu _ { p }$ .
89
+ 2. Traversals using world graph edges.
90
+
91
+ # 4.1 HIERARCHICAL RL OVER WORLD GRAPHS
92
+
93
+ Formally, an RL agent learning to solve a task is formulated as a Markov Decision Process: at time $t$ , the agent is in a state $s _ { t }$ , executes an action $a _ { t }$ via a policy $\pi ( a _ { t } | s _ { t } )$ and receives a rewards $r _ { t }$ . The agent’s goal is to maximize its cumulative expected return $\begin{array} { r } { R = \mathbb { E } _ { ( s _ { t } , a _ { t } ) \sim \pi , p , p _ { 0 } } \left[ \sum _ { t \geq 0 } \gamma ^ { t } r _ { t } \right] } \end{array}$ , where $p ( s _ { t + 1 } | s _ { t } , a _ { t } ) , p _ { 0 } ( s _ { 0 } )$ are the transition and initial state distributions.
94
+
95
+ To incorporate world graphs with RL, we use a hierarchical approach based on the Feudal Network (FN) (Dayan $\&$ Hinton, 1993; Vezhnevets et al., 2017), depicted in Figure 3. A standard FN
96
+
97
+ # Task Description
98
+
99
+ Task MultiGoal
100
+
101
+ # Environment Characteristics
102
+
103
+ Balls are located randomly, dense reward.
104
+
105
+ # MultiGoal-Sparse
106
+
107
+ Collect randomly spawned balls, each ball gives $+ 1$ reward. To end an episode, the agent has to exit at a designated point. Agents receive a single reward $r \leq 1$ proportional to the number of balls collected upon exiting.
108
+
109
+ MultiGoalStochastic Door-Key
110
+
111
+ Balls are located randomly, sparse reward.
112
+
113
+ Spawn lava blocks at random locations each time step that immediately terminates the episode if stepped on. Agent has to pick up a key to open a door (reward $+ 1 \AA$ and reach the exit point on the other side (reward $+ 1$ ).
114
+
115
+ Stochastic environment. Multiple objects: lava and balls are randomly located, dense reward.
116
+ Walls, door and key are located randomly. Agents have additional actions: pick and toggle.
117
+
118
+ Table 1: An overview of tasks used to evaluate the benefit of using world graphs. Visualizations can be found in Appendix D.
119
+
120
+ decomposes the policy of the agent into two separate policies that receive distinct streams of reward: a high-level policy (“Manager”) learns to propose subgoals; a low-level policy (“Worker”) receives subgoals from the Manager as inputs and is rewarded for taking actions in the environment that reach the subgoals. The Manager receives the environment reward defined by the task and therefore must learn to emit subgoals that lead to task completion. The Manager and Worker do not share weights and operate at different temporal resolutions: the Manager only outputs a new subgoal if either the Worker reaches the chosen one or a subgoal horizon $c$ is exceeded.
121
+
122
+ For all our experiments, policies are trained using advantage actor-critic (A2C), an on-policy RL algorithm (Wu & Tian, 2016; Pane et al., 2016; Mnih et al., 2016b). To ease optimization, the feature extraction layers of the Manager and Worker that encode $s _ { t }$ are initialized with the corresponding layers from $\pi _ { g }$ , the GCP learned during world graph discovery phase. More details are in Appendix B.
123
+
124
+ # 4.2 WIDE-THEN-NARROW GOALS AND WORLD GRAPHS
125
+
126
+ To incorporate the world graph, we introduce a Manager policy that factorizes subgoal selection as follows: a wide policy $\pi ^ { w } ( g _ { t } ^ { w } | s _ { t } )$ selects a waypoint state as the wide goal $g ^ { w } \in \mathcal { V } _ { p }$ , and a narrow policy $\pi ^ { n } ( g _ { t } ^ { n } | s _ { t } , g _ { t } ^ { w } )$ selects a state within a local neighborhood of $g _ { t } ^ { w }$ , i.e. its $\epsilon$ -net (Mahadevan $\&$ Maggioni, 2007), as the narrow goal $g ^ { n } \in \{ s : \mathcal { D } ( s , \bar { g } _ { t } ^ { w } ) \leq \epsilon \}$ . The Worker policy $\pi ^ { \mathrm { w o r k e r } } ( a _ { t } | s _ { t } , g _ { t } ^ { n } , g _ { t } ^ { \bar { w } } )$ chooses the action taken by the agent given the current state and the wide and narrow goals from the Manager. A visual illustration is in Figure 4 and training details in Appendix C.2.
127
+
128
+ # 4.3 WORLD GRAPH TRAVERSAL
129
+
130
+ The wide-then-narrow subgoal format simplifies the search space for the Manager policy. Using waypoints as wide goals also makes it possible to leverage the edges of the world graph for planning and executing the planned traversals. This process breaks down as follows:
131
+
132
+ 1. When to Traverse: When the agent encounters a waypoint state $s _ { t } \in \mathcal V _ { p }$ , a “traversal” is initiated if $s _ { t }$ has a feasible connection in $\mathcal { G } _ { w }$ to the active wide goal $g _ { t } ^ { w }$ . 2. Planning: Upon triggering a traversal, the optimal traversal route from the initiating state to $g _ { t } ^ { w }$ is estimated from the $\mathcal { G } _ { w }$ edge weights using classic dynamic programming planning (Sutton, 1998; Feng et al., 2004). This yields a sequence of intermediate waypoint states. 3. Execution: Execution of graph traversals depends on the nature of the environment. If deterministic, the agent simply follows the action sequences given by the edges of the traversal. Otherwise, the agent uses the pretrained $\mathbf { G C P } \pi _ { g }$ to sequentially reach each of the intermediate waypoint states along the traversal (we fine-tune $\pi _ { g }$ in parallel where applicable). If the agent fails to reach the next waypoint state within a certain time limit, it stops its current pursuit and a new $( g ^ { w } , g ^ { n } )$ pair is received from the Manager.
133
+
134
+ World graph traversal allows the Manager to assign task-relevant wide goals $g ^ { w }$ that can be far away from the agent yet still reachable, which consequentially accelerates learning by focusing exploration around the task-relevant region near $g ^ { w }$ .
135
+
136
+ # 5 EXPERIMENTAL VALIDATION
137
+
138
+ We now assess each component of our framework on a set of challenging 2D grid worlds. Our ablation studies demonstrate the following benefits of our framework:
139
+
140
+ Table 2: On a variety of tasks and environment setups, we evaluate RL models trained with GCP $\pi _ { g }$ initialization, with $\mathcal { G } _ { w }$ world graph travresal, and with both. All models on the right are equipped with WN. Left are baselines for additional comparison. We report final rewards for MultiGoal tasks and success rates for Door-Key are reported. If no result reported, the agent failed to solve the task.
141
+
142
+ <table><tr><td rowspan="2">Task</td><td rowspan="2">Size</td><td rowspan="2">A2C</td><td rowspan="2">FN+πg init</td><td colspan="3">Ours</td></tr><tr><td>+πg-init</td><td>+ 9w-traversal</td><td>+πg-init+Gw-traversal</td></tr><tr><td rowspan="3">MultiGoal</td><td>Small</td><td>2.04±0.05</td><td>2.93±0.74</td><td>5.25±0.13</td><td>3.92±0.22</td><td>5.05±0.03</td></tr><tr><td>Medium</td><td>=</td><td>=</td><td>5.15±0.11</td><td>2.56±0.09</td><td>3.00±0.90</td></tr><tr><td>Larger</td><td>=</td><td>=</td><td>-</td><td>2.18±0.12</td><td>2.72±0.59</td></tr><tr><td rowspan="3">MultiGoal-Sparse</td><td>Small</td><td>=</td><td>=</td><td>0.39±0.09</td><td>0.24±0.04</td><td>0.42±0.07</td></tr><tr><td>Medium</td><td></td><td></td><td></td><td>0.20±0.04</td><td>0.25±0.03</td></tr><tr><td>Larger</td><td></td><td></td><td></td><td>0.16±0.22</td><td>0.26±0.11</td></tr><tr><td rowspan="3">MultiGoal-Stochastic</td><td>Small</td><td>1.38±1.20</td><td>1.93±0.16</td><td>3.06±0.31</td><td></td><td>2.92±0.45</td></tr><tr><td>Medium</td><td></td><td>=</td><td>2.99±0.12</td><td>2.42±0.24</td><td>2.64±0.14</td></tr><tr><td>Larger</td><td>=</td><td></td><td>=</td><td>=</td><td>0.60±0.12</td></tr><tr><td rowspan="3">Door-Key</td><td>Small</td><td></td><td>=</td><td>0.99±0.00</td><td>0.37±0.15</td><td>0.92±0.02</td></tr><tr><td>Medium</td><td></td><td></td><td>0.56±0.02</td><td></td><td>0.76±0.06</td></tr><tr><td>Larger</td><td></td><td></td><td>=</td><td></td><td>0.26±0.19</td></tr></table>
143
+
144
+ Table 3: Comparing learned $\nu _ { p }$ versus random $\mathcal { V } _ { \mathrm { r a n d } }$ as wide subgoals on large mazes, all trained with $\pi _ { g }$ initialization and graph traversal. $\nu _ { p }$ generally is superior in terms of performance and consistency. We report final rewards for MultiGoal tasks and success rates for Door-Key are reported.
145
+
146
+ <table><tr><td>Waypoint type</td><td>MultiGoal</td><td>MultiGoal-Sparse</td><td>MultiGoal-Stochastic</td><td>Door-Key</td></tr><tr><td>Learned</td><td>2.72±0.59</td><td>0.26±0.11</td><td>0.60±0.12</td><td>0.26±0.19</td></tr><tr><td>Random</td><td>2.30±0.49</td><td>0.19±0.11</td><td>0.41±0.25</td><td>0.27±0.40</td></tr></table>
147
+
148
+ • It improves sample efficiency and performance over the baseline HRL model. • It benefits tasks varying in envirionment scale, task type, reward structure, and stochasticity. • The identified waypoints provide superior world representations for solving downstream tasks, as compared to graphs using randomly selected states as nodes.
149
+
150
+ Implementation details, snippets of the tasks and mazes are in Appendix C-D.
151
+
152
+ # 5.1 ABLATION STUDIES ON 2D GRID WORLDS
153
+
154
+ For our ablation studies, we construct 2D grid worlds of increasing sizes (small, medium and large) along with challenging tasks with different reward structures, levels of stochasticity and logic (summarized in Table 1). In all tasks, every action taken by the agent receives a negative reward penalty. We follow a rigorous evaluation protocol (Wu et al., 2017; Ostrovski et al., 2017; Henderson et al., 2018): each experiment is repeated with 3 training seeds. 10 additional validation seeds are used to pick the model with the best reward performance. This model is then tested on 100 testing seeds. We report mean reward and standard deviation.
155
+
156
+ We ablate each of the following components in our framework and compare against non-hierarchical (A2C) and hierarchical baselines (FN):
157
+
158
+ 1. initializing the feature extraction layers of the Manager and Worker from $\pi _ { g }$ ,
159
+ 2. applying Wide-then-Narrow Manager (WN) goal instruction, and
160
+ 3. allowing the Worker to traverse along $\mathcal { G } _ { w }$ .
161
+
162
+ Results are shown in Table 2. In sum, each component improves performance over the baselines.
163
+
164
+ Wide and narrow goals Using two goal types is a highly effective way to structure the Manager instructions and enables the Worker to differentiate the transition and local task-solving phases. We note that for small MultiGoal, agents do not benefit much from $\mathcal { G } _ { w }$ traversal: it can rely solely on the guidance from WN goals to master both phases. However with increasing maze size, the Worker struggles to master traversals on its own and thus fails solving the tasks.
165
+
166
+ World Graph Traversal As conjectured in Section 4.3, the performance gain of our framework can be explained by the larger range and more targeted exploration strategy. In addition, the Worker does not have to learn long distance transitions with the aid of $\mathcal { G } _ { w }$ traversals. Figure 4 confirms that $\mathcal { G } _ { w }$ traversal speeds up convergence and its effect becomes more evident with larger mazes. Note that the graph learning stage only need 2.4K iterations to converge. Even when taking these additional environment interactions into account, $\mathcal { G } _ { w }$ traversal still exhibits superior sample efficiency, not to mention that the graph is shared among all tasks. Moreover, solving Door-Key involves a complex combination of sub-tasks: find and pick up the key, reach and open the door and finally exit. With limited reward feedback, this is particularly difficult to learn. The ability to traverse along $\mathcal { G } _ { w }$ enables longer-horizon planning on top of the waypoints, thanks to which the agents boost the success rate on medium Door-Key from $0 . 5 6 { \pm } 0 . 0 2$ to $0 . 7 5 { \pm } 0 . 0 6 $ .
167
+
168
+ ![](images/eeccd173a66cc7f083254caca6b3d6fe078ddac17830e5c24ef8e6d8706c4b0b.jpg)
169
+ Figure 4: Validation performance during training (mean and standard-deviation of reward, 3 seeds) for MultiGoal. Left: Comparing $\nu _ { p }$ and $\mathcal { V } _ { \mathrm { r a n d } }$ , with or without traversal, all models use WN and $\pi _ { g }$ initialization. We see that 1) traversal speeds up convergence, 2) $\mathcal { V } _ { \mathrm { r a n d } }$ gives higher variance and slightly worse performance than $\nu _ { p }$ . Right: comparing with or without $\pi _ { g }$ initialization on $\nu _ { p }$ , all models use WN. We see that initializing the task-specific phase with the task-agnostic goal-conditioned policy significantly boosts learning.
170
+
171
+ Benefits of Learned Waypoints To highlight the benefit of establishing the waypoints learned by the VAE as nodes for $\mathcal { G } _ { w }$ , we compare against results using a $\mathcal { G } _ { w }$ constructed around randomly selected states $( \nu _ { \mathrm { r a n d } } )$ . The edges of the random-node graph are formed in the same way as described in Section 3.3 and its feature extractor is also initialized from $\pi _ { g }$ . Although granting knowledge acquired during the unsupervised phase to $\mathcal { V } _ { \mathrm { r a n d } }$ is unfair to $\nu _ { p }$ , deploying both initialization and traversal while only varying $\mathcal { V } _ { \mathrm { r a n d } }$ and $\nu _ { p }$ isolates the effect from the nodes to the best extent. The comparative results (in Table 3, learning curves for MultiGoal in Figure 4) suggest $\nu _ { p }$ generally outperforms $\mathcal { V } _ { \mathrm { r a n d } }$ . Door-Key is the only task in which the two matches. However, $\mathcal { V } _ { \mathrm { r a n d } }$ exhibits a large variance, implying that certain sets of random states can be suitable for this task, but using learned waypoints gives strong performance more consistently.
172
+
173
+ Initialization with GCP Initializing the weights of the Worker and Manager feature extractors from $\pi _ { g }$ (learned during the task-agnostic phase) consistently benefits learning.In fact, we observe that models starting from scratch fail on almost all tasks within the maximal number of training iterations, unless coupled with $\mathcal { G } _ { w }$ traversal, which is still inferior to using $\pi _ { g }$ -initialization. Particularly, for the small MultiGoal-Stochastic environment, there is a high chance that a lava square blocks traversal; therefore, without the environment knowledge from $\pi _ { g }$ transferred by weight initialization, the interference created by the episode-terminating lava prevents the agent from learning the task.
174
+
175
+ # 6 CONCLUSION
176
+
177
+ We have shown that world graphs are powerful environment abstractions, which, in particular, are capable of accelerating reinforcement learning. Future works may extend their applications to more challenging RL setups, such as real-world multi-task learning and navigation. It is also interesting to generalize the proposed framework to learn dynamic world graphs for evolving environments, and applying world graphs to multi-agent problems, where agents become part of the world graphs of other agents.
178
+
179
+ # REFERENCES
180
+
181
+ Pieter Abbeel and Andrew $\mathrm { ~ Y ~ N ~ g ~ }$ . Apprenticeship learning via inverse reinforcement learning. In Proceedings of the twenty-first international conference on Machine learning, pp. 1. ACM, 2004.
182
+
183
+ Joshua Achiam and Shankar Sastry. Surprise-based intrinsic motivation for deep reinforcement learning. arXiv preprint arXiv:1703.01732, 2017.
184
+
185
+ Adrien Angeli, David Filliat, Stéphane Doncieux, and Jean-Arcady Meyer. A fast and incremental method for loop-closure detection using bags of visual words. IEEE Transactions on Robotics, pp. 1027–1037, 2008.
186
+
187
+ Mohammad Gheshlaghi Azar, Biala Piot, Bernardo Avila Pires, Jean-Bastien Gril, Florent Altche, and Remi Munos. World discovery model. arXiv, 2019.
188
+
189
+ Pierre-Luc Bacon, Jean Harb, and Doina Precup. The option-critic architecture. In Thirty-First AAAI Conference on Artificial Intelligence, 2017.
190
+
191
+ André Barreto, Will Dabney, Rémi Munos, Jonathan J Hunt, Tom Schaul, Hado P van Hasselt, and David Silver. Successor features for transfer in reinforcement learning. In Advances in neural information processing systems, pp. 4055–4065, 2017.
192
+
193
+ Joost Bastings, Wilker Aziz, and Ivan Titov. Interpretable neural predictions with differentiable binary variables. In Proceedings of the 2019 Conference of the Association for Computational Linguistics, Volume 1 (Long Papers). Association for Computational Linguistics, 2019.
194
+
195
+ Dimitri P Bertsekas. Nonlinear Programming. 1999.
196
+
197
+ Norman Biggs. Algebraic Graph Theory. 1993.
198
+
199
+ Yuri Burda, Harri Edwards, Deepak Pathak, Amos Storkey, Trevor Darrell, and Alexei A Efros. Large-scale study of curiosity-driven learning. arXiv preprint arXiv:1808.04355, 2018.
200
+
201
+ Maria Chatzigiorgaki and Athanassios N Skodras. Real-time keyframe extraction towards video content identification. In 2009 16th International conference on digital signal processing, pp. 1–6. IEEE, 2009.
202
+
203
+ Fei Chen, Yang Gao, Shifu Chen, and Zhenduo Ma. Connect-based subgoal discovery for options in hierarchical reinforcement learning. In Third International Conference on Natural Computation (ICNC 2007), volume 4, pp. 698–702. IEEE, 2007.
204
+
205
+ Junyoung Chung, Kyle Kastner, Laurent Dinh, Kratarth Goel, Aaron C Courville, and Yoshua Bengio. A recurrent latent variable model for sequential data. In Advances in neural information processing systems, pp. 2980–2988, 2015.
206
+
207
+ John D Co-Reyes, YuXuan Liu, Abhishek Gupta, Benjamin Eysenbach, Pieter Abbeel, and Sergey Levine. Self-consistent trajectory autoencoder: Hierarchical reinforcement learning with trajectory embeddings. arXiv preprint arXiv:1806.02813, 2018.
208
+
209
+ Christian Daniel, Herke Van Hoof, Jan Peters, and Gerhard Neumann. Probabilistic inference for determining options in reinforcement learning. Machine Learning, 104(2-3):337–357, 2016.
210
+
211
+ Peter Dayan and Geoffrey E Hinton. Feudal reinforcement learning. In Advances in neural information processing systems, pp. 271–278, 1993.
212
+
213
+ Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. Bert: Pre-training of deep bidirectional transformers for language understanding. arXiv, 2018.
214
+
215
+ Bruce L Digney. Learning hierarchical control structures for multiple tasks and changing environments. 1998.
216
+
217
+ Jeff Donahue, Yangqing Jia, Oriol Vinyals, Judy Hoffman, Ning Zhang, Eric Tzeng, and Trevor Darrell. Decaf: A deep convolutional activation feature for generic visual recognition. In International conference on machine learning, pp. 647–655, 2014.
218
+
219
+ Adrien Ecoffet, Joost Huizinga, Joel Lehman, Kenneth O Stanley, and Jeff Clune. Go-explore: a new approach for hard-exploration problems. arXiv preprint arXiv:1901.10995, 2019.
220
+
221
+ Negin Entezari, Mohammad Ebrahim Shiri, and Parham Moradi. A local graph clustering algorithm for discovering subgoals in reinforcement learning. In International Conference on Future Generation Communication and Networking, pp. 41–50. Springer, 2010.
222
+
223
+ Benjamin Eysenbach, Ruslan Salakhutdinov, and Sergey Levine. Search on the replay buffer: Bridging planning and reinforcement learning. arXiv preprint arXiv:1903.00606, 2019.
224
+
225
+ Zhengzhu Feng, Richard Dearden, Nicolas Meuleau, and Richard Washington. Dynamic programming for structured continuous markov decision problems. In Proceedings of the 20th conference on Uncertainty in artificial intelligence, pp. 154–161. AUAI Press, 2004.
226
+
227
+ Dieter Fox, Wolfram Burgard, and Sebastian Thrun. Active markov localization for mobile robots. Robotics and Autonomous Systems, 25(3-4):195–207, 1998.
228
+
229
+ Dibya Ghosh, Abhishek Gupta, and Sergey Levine. Learning actionable representations with goalconditioned policies. arXiv preprint arXiv:1811.07819, 2018.
230
+
231
+ Anirudh Goyal, Riashat Islam, Daniel Strouse, Zafarali Ahmed, Matthew Botvinick, Hugo Larochelle, Sergey Levine, and Yoshua Bengio. Infobot: Transfer and exploration via the information bottleneck. arXiv preprint arXiv:1901.10902, 2019.
232
+
233
+ Karol Gregor and Frederic Besse. Temporal difference variational auto-encoder. arXiv preprint arXiv:1806.03107, 2018.
234
+
235
+ Karol Gregor, Ivo Danihelka, Alex Graves, Danilo Jimenez Rezende, and Daan Wierstra. Draw: A recurrent neural network for image generation. In ICML, 2015.
236
+
237
+ Zhaohan Daniel Guo, Mohammad Gheshlaghi Azar, Bilal Piot, Bernardo A Pires, Toby Pohlen, and Rémi Munos. Neural predictive belief representations. arXiv preprint arXiv:1811.06407, 2018.
238
+
239
+ David Ha and Jürgen Schmidhuber. World models. arXiv preprint arXiv:1803.10122, 2018.
240
+
241
+ Tuomas Haarnoja, Kristian Hartikainen, Pieter Abbeel, and Sergey Levine. Latent space policies for hierarchical reinforcement learning. arXiv preprint arXiv:1804.02808, 2018.
242
+
243
+ Danijar Hafner, Timothy Lillicrap, Ian Fischer, Ruben Villegas, David Ha, Honglak Lee, and James Davidson. Learning latent dynamics for planning from pixels. arXiv preprint arXiv:1811.04551, 2018.
244
+
245
+ Peter Henderson, Riashat Islam, Philip Bachman, Joelle Pineau, Doina Precup, and David Meger. Deep reinforcement learning that matters. In Thirty-Second AAAI Conference on Artificial Intelligence, 2018.
246
+
247
+ Irina Higgins, Loic Matthey, Arka Pal, Christopher Burgess, Xavier Glorot, Matthew Botvinick, Shakir Mohamed, and Alexander Lerchner. beta-vae: Learning basic visual concepts with a constrained variational framework. In ICLR), 2017.
248
+
249
+ Ahmed Hussein, Mohamed Medhat Gaber, Eyad Elyan, and Chrisina Jayne. Imitation learning: A survey of learning methods. ACM Computing Surveys (CSUR), 50(2):21, 2017.
250
+
251
+ Dinesh Jayaraman, Frederik Ebert, Alexei A Efros, and Sergey Levine. Time-agnostic prediction: Predicting predictable video frames. arXiv preprint arXiv:1808.07784, 2018.
252
+
253
+ Lukasz Kaiser, Mohammad Babaeizadeh, Piotr Milos, Blazej Osinski, Roy H Campbell, Konrad Czechowski, Dumitru Erhan, Chelsea Finn, Piotr Kozakowski, Sergey Levine, et al. Model-based reinforcement learning for atari. arXiv preprint arXiv:1903.00374, 2019.
254
+
255
+ Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
256
+
257
+ Diederik P Kingma and Max Welling. Auto-encoding variational bayes. In ICLR, 2013.
258
+
259
+ Thomas Kipf, Yujia Li, Hanjun Dai, Vinicius Zambaldi, Edward Grefenstette, Pushmeet Kohli, and Peter Battaglia. Compositional imitation learning: Explaining and executing one task at a time. arXiv preprint arXiv:1812.01483, 2018.
260
+
261
+ Quoc V Le, Navdeep Jaitly, and Geoffrey E Hinton. A simple way to initialize recurrent networks of rectified linear units. arXiv preprint arXiv:1504.00941, 2015.
262
+
263
+ Alberto Quattrini Li, Marios Xanthidis, Jason M O’Kane, and Ioannis Rekleitis. Active localization with dynamic obstacles. In 2016 IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS), pp. 1902–1909. IEEE, 2016.
264
+
265
+ Christos Louizos, Max Welling, and Diederik P Kingma. Learning sparse neural networks through l_0 regularization. arXiv preprint arXiv:1712.01312, 2017.
266
+
267
+ Stephanie Lowry, Niko Sünderhauf, Paul Newman, John J Leonard, David Cox, Peter Corke, and Michael J Milford. Visual place recognition: A survey. IEEE Transactions on Robotics, 32(1): 1–19, 2015.
268
+
269
+ Chris J Maddison, Andriy Mnih, and Yee Whye Teh. The concrete distribution: A continuous relaxation of discrete random variables. arXiv preprint arXiv:1611.00712, 2016.
270
+
271
+ Sridhar Mahadevan and Mauro Maggioni. Proto-value functions: A laplacian framework for learning representation and control in markov decision processes. Journal of Machine Learning Research, 8(Oct):2169–2231, 2007.
272
+
273
+ Shie Mannor, Ishai Menache, Amit Hoze, and Uri Klein. Dynamic abstraction in reinforcement learning via clustering. In Proceedings of the twenty-first international conference on Machine learning, pp. 71. ACM, 2004.
274
+
275
+ Amy McGovern and Andrew G Barto. Automatic discovery of subgoals in reinforcement learning using diverse density. 2001.
276
+
277
+ Jan Hendrik Metzen. Learning graph-based representations for continuous reinforcement learning domains. In Joint European Conference on Machine Learning and Knowledge Discovery in Databases, pp. 81–96. Springer, 2013.
278
+
279
+ Dmytro Mishkin and Jiri Matas. All you need is a good init. arXiv preprint arXiv:1511.06422, 2015.
280
+
281
+ Volodymyr Mnih, John Agapiou, Simon Osindero, Alex Graves, Oriol Vinyals, Koray Kavukcuoglu, et al. Strategic attentive writer for learning macro-actions. arXiv preprint arXiv:1606.04695, 2016a.
282
+
283
+ Volodymyr Mnih, Adria Puigdomenech Badia, Mehdi Mirza, Alex Graves, Timothy Lillicrap, Tim Harley, David Silver, and Koray Kavukcuoglu. Asynchronous methods for deep reinforcement learning. In International Conference on Machine Learning, pp. 1928–1937, 2016b.
284
+
285
+ Ashvin V Nair, Vitchyr Pong, Murtaza Dalal, Shikhar Bahl, Steven Lin, and Sergey Levine. Visual reinforcement learning with imagined goals. In Advances in Neural Information Processing Systems, pp. 9191–9200, 2018.
286
+
287
+ Eric Nalisnick and Padhraic Smyth. Stick-breaking variational autoencoders. arXiv preprint arXiv:1605.06197, 2016.
288
+
289
+ Georg Ostrovski, Marc G Bellemare, Aaron van den Oord, and Rémi Munos. Count-based exploration with neural density models. ICML, 2017.
290
+
291
+ Yudha P Pane, Subramanya P Nageshrao, and Robert Babuška. Actor-critic reinforcement learning for tracking control in robotics. In Decision and Control (CDC), 2016 IEEE 55th Conference on, pp. 5819–5826. IEEE, 2016.
292
+
293
+ Deepak Pathak, Pulkit Agrawal, Alexei A Efros, and Trevor Darrell. Curiosity-driven exploration by self-supervised prediction. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition Workshops, pp. 16–17, 2017.
294
+
295
+ Karl Pertsch, Oleh Rybkin, Jingyun Yang, Kost Derpanis, Joseph Lim, Kostas Daniilidis, and Andrew Jeable. Keyin: Discovering subgoal structure with keyframe-based video prediction. arXiv, 2019.
296
+
297
+ Sébastien Racanière, Théophane Weber, David Reichert, Lars Buesing, Arthur Guez, Danilo Jimenez Rezende, Adria Puigdomenech Badia, Oriol Vinyals, Nicolas Heess, Yujia Li, et al. Imaginationaugmented agents for deep reinforcement learning. In Advances in neural information processing systems, pp. 5690–5701, 2017.
298
+
299
+ Alec Radford, Jeff Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. Language models are unsupervised multitask learners. 2019.
300
+
301
+ Danilo Jimenez Rezende, Shakir Mohamed, and Daan Wierstra. Stochastic backpropagation and approximate inference in deep generative models. In ICML, 2014.
302
+
303
+ Olga Russakovsky, Jia Deng, Hao Su, Jonathan Krause, Sanjeev Satheesh, Sean Ma, Zhiheng Huang, Andrej Karpathy, Aditya Khosla, Michael Bernstein, et al. Imagenet large scale visual recognition challenge. International journal of computer vision, 115(3):211–252, 2015.
304
+
305
+ Wenling Shang, Herk van Hoof, and Max Welling. Stochastic activation actor-critic methods. In ECML-PKDD, 2019.
306
+
307
+ Özgür ¸Sim¸sek, Alicia P Wolfe, and Andrew G Barto. Identifying useful subgoals in reinforcement learning by local graph partitioning. In Proceedings of the 22nd international conference on Machine learning, pp. 816–823. ACM, 2005.
308
+
309
+ Richard S Sutton. Introduction to reinforcement learning, volume 135. 1998.
310
+
311
+ Matthew E Taylor and Peter Stone. Transfer learning for reinforcement learning domains: A survey. Journal of Machine Learning Research, 10(Jul):1633–1685, 2009.
312
+
313
+ Sebastian Thrun. Learning metric-topological maps for indoor mobile robot navigation. Artificial Intelligence, 99(1):21–71, 1998.
314
+
315
+ Yuandong Tian and Qucheng Gong. Latent forward model for real-time strategy game planning with incomplete information. In NIPS Symposium, 2017.
316
+
317
+ Alexander Sasha Vezhnevets, Simon Osindero, Tom Schaul, Nicolas Heess, Max Jaderberg, David Silver, and Koray Kavukcuoglu. Feudal networks for hierarchical reinforcement learning. In Proceedings of the 34th International Conference on Machine Learning-Volume 70, pp. 3540–3549. JMLR. org, 2017.
318
+
319
+ Yuhuai Wu, Elman Mansimov, Roger B Grosse, Shun Liao, and Jimmy Ba. Scalable trust-region method for deep reinforcement learning using kronecker-factored approximation. In NIPS, 2017.
320
+
321
+ Yuxin Wu and Yuandong Tian. Training agent for first-person shooter game with actor-critic curriculum learning. 2016.
322
+
323
+ # A RECURRENT VAE WITH DIFFERENTIABLE BINARY LATENT VARIABLES
324
+
325
+ As illustrated in the main text, the main objective for the recurrent VAE is the following evidence lower bound with derivation:
326
+
327
+ $$
328
+ \begin{array} { r l } & { \log p ( a | s ) = \log \int p ( a | s , z ) d z } \\ & { \qquad = \log \int p ( a | s , z ) p ( z | s ) \frac { q ( z | a , s ) } { q ( z | a , s ) } d z } \\ & { \qquad = \log \int p ( a | s , z ) \frac { p ( z | s ) } { q ( z | a , s ) } q ( z | a , s ) d z } \\ & { \qquad \geq \mathbb { E } _ { q ( z | a , s ) } [ \log p ( a | s , z ) - \log \frac { q ( z | a , s ) } { p ( z | s ) } ] } \\ & { \qquad = \mathbb { E } _ { q ( z | a , s ) } [ \log p ( a | s , z ) ] - D _ { \mathrm { K L } } ( q ( z | a , s ) | | p ( z | s ) ) } \end{array}
329
+ $$
330
+
331
+ The inference network $q _ { \psi }$ takes in the trajectories of state-action pairs $\tau$ and at each time step approximates the posterior of the corresponding latent variable $z _ { t }$ . The prior network $p _ { \psi }$ takes the state $s _ { t }$ at each time step and outputs the state-conditioned prior $p _ { \psi } ( s _ { t } )$ . We choose Beta as the prior distribution and the Hard Kuma as the approximated posterior to relax the discrete latent variables to continuous surrogates.
332
+
333
+ The Kuma distribution $\mathrm { K u m a } ( \alpha , \beta )$ highly resembles the Beta Distribution in shape but does not come from the exponential family. Similar to Beta, the Kuma distribution also ranges from bimodal (when $\alpha \approx \beta )$ to unimodal $( \alpha / \beta \to 0$ or $\alpha / \beta \to \infty )$ ). Also, when $\alpha = 1$ or $\beta = 1$ , $\operatorname { K u m a } ( \alpha , \beta ) = \operatorname { B e t a } ( \alpha , \beta )$ . We observe empirically better performance when we fix $\beta = 1$ for the Kuma approximated posterior. One major advantage of the Kuma distribution is its simple Cumulative Distribution Function (CDF):
334
+
335
+ $$
336
+ F _ { \mathrm { K u m a } } ( x , \alpha , \beta ) = ( 1 - ( 1 - x ^ { \alpha } ) ) ^ { \beta } .
337
+ $$
338
+
339
+ It is therefore amendable to the reparametrization trick (Kingma & Welling, 2013; Rezende et al., 2014; Maddison et al., 2016) by sampling from uniform distribution $u \sim \mathcal { U } ( 0 , 1 )$ :
340
+
341
+ $$
342
+ z = F _ { \mathrm { K u m a } } ^ { - 1 } ( u ; \alpha , \beta ) \sim \mathrm { K u m a } ( \alpha , \beta ) .
343
+ $$
344
+
345
+ Lastly, the KL-divergence between the Kuma and Beta distributions can be approximated in closed form (Nalisnick & Smyth, 2016):
346
+
347
+ $$
348
+ \begin{array} { l } { \displaystyle { { \cal D } _ { \mathrm { K L } } ( \mathrm { K u m a } ( a , b ) | \mathrm { B e t a } ( \alpha , \beta ) ) = \frac { a - \alpha } { a } \left( - \gamma - \Psi ( b ) - \frac { 1 } { b } \right) } } \\ { \displaystyle { \phantom { \frac { b - a } { b - a } ( \mathrm { K u m a } ( a , b ) + \log \mathrm { B e t a } ( \alpha , \beta ) - \frac { b - 1 } { b } + ( \beta - 1 ) b \sum _ { m = 1 } ^ { \infty } \frac { 1 } { m + a b } \mathrm { B e t a } \left( \frac { m } { a } , b \right) , } } } \end{array}
349
+ $$
350
+
351
+ where $\Psi$ is the Digamma function, $\gamma$ the Euler constant, and the approximation uses the first few terms of the Taylor series expansion. We take the first 5 terms here.
352
+
353
+ Next, we make the Kuma distribution “hard” by following the steps in Bastings et al. (2019). First stretch the support to $( r = 0 - \epsilon _ { 1 } , l = 1 + \epsilon _ { 2 }$ ), $\epsilon _ { 1 } , \epsilon _ { 2 } > 0$ , and the resulting CDF distribution takes the form:
354
+
355
+ $$
356
+ F _ { S } ( z ) = F _ { \mathrm { K u m a } } \left( { \frac { z - l } { r - l } } ; \alpha , \beta \right) .
357
+ $$
358
+
359
+ Then, the non-eligible probabilities for 0’s and 1’s are attained by rectifying all samples below 0 to 0 and above 1 to 1, and other value as it is, that is
360
+
361
+ $$
362
+ P ( z = 0 ) = F _ { \mathrm { K u m a } } \left( \frac { - l } { r - l } ; \alpha , \beta \right) , \quad P ( z = 1 ) = 1 - F _ { \mathrm { K u m a } } \left( \frac { 1 - l } { r - l } ; \alpha , \beta \right) .
363
+ $$
364
+
365
+ Lastly, we impose two additional regularization terms ${ \mathcal { L } } _ { \prime }$ and $\mathcal { L } _ { T }$ on the approximated posteriors. As described in the main text, ${ \mathcal { L } } _ { \prime }$ prevents the model from selecting all states to reconstruct $\{ a _ { t } \} _ { 0 } ^ { T - 1 }$ by restraining the expected $L _ { 0 }$ norm of $z = \left( z _ { 1 } \cdot \cdot \cdot z _ { T - 1 } \right)$ to approximately be at a targeted value $\mu _ { 0 }$ (Louizos et al., 2017; Bastings et al., 2019). In other words, this objective adds the constraint that there should be $\mu _ { 0 }$ of activated $z _ { t } = 1$ given a sequence of length $T$ . The other term $\mathcal { L } _ { T }$ encourages temporally isolated activation of $z _ { t }$ , meaning the number of transition between 0 and 1 among $z _ { t }$ ’s should roughly be $2 \mu _ { 0 }$ . Note that both expectations in Equation 2 have closed forms for HardKuma.
366
+
367
+ $$
368
+ \begin{array} { l } { \displaystyle \mathcal { L } _ { 0 } = \left\| \mathbb { E } _ { q ( \boldsymbol { z } | \boldsymbol { s } , \boldsymbol { a } ) } \left[ \left\| \boldsymbol { z } \right\| _ { 0 } \right] - \mu _ { 0 } \right\| ^ { 2 } , \mathrm { w h e r e } } \\ { \displaystyle \mathbb { E } _ { q ( \boldsymbol { z } | \boldsymbol { s } , \boldsymbol { a } ) } \left[ \left\| \boldsymbol { z } \right\| _ { 0 } \right] = \sum _ { t = 1 } ^ { T } \mathbb { E } _ { q ( \boldsymbol { z } _ { t } | \boldsymbol { s } , \boldsymbol { a } ) } \left[ \mathbb { 1 } _ { \boldsymbol { z } _ { t } \neq 0 } \right] } \\ { \displaystyle \qquad = \sum _ { t = 1 } ^ { T } 1 - p \left( \boldsymbol { z } _ { t } = 0 \right) = \sum _ { t = 1 } ^ { T } 1 - F _ { \mathrm { K u m a } } \left( \frac { - l } { r - l } ; \alpha _ { t } , \beta _ { t } \right) , } \end{array}
369
+ $$
370
+
371
+ $$
372
+ \mathbb { E } _ { q ( z | s , a ) } [ \sum _ { t = 1 } ^ { T - 1 } \mathbb { 1 } _ { z _ { t } \neq z _ { t + 1 } } ] = \sum _ { t = 1 } ^ { T - 1 } p \left( z _ { t } = 0 \right) \left( 1 - p \left( z _ { t + 1 } = 0 \right) \right) + \left( 1 - p \left( z _ { t } = 0 \right) \right) p \left( z _ { t + 1 } = 0 \right) .
373
+ $$
374
+
375
+ Lagrangian Relaxation. The overall optimization objective consists of action sequence reconstruction, KL-divergence between the posterior and prior, $\mathcal { L } _ { 0 }$ and $\mathcal { L } _ { T }$ (Equation 12). We tune the objective weights $\lambda _ { i }$ using Lagrangian relaxation (Higgins et al., 2017; Bastings et al., 2019; Bertsekas, 1999), treating $\lambda _ { i }$ ’s as learnable parameters and performing alternative optimization between $\lambda _ { i }$ ’s and the model parameters. We observe that as long as their initialization is within a reasonable range, $\lambda _ { i }$ ’s converge to a local optimum:
376
+
377
+ $$
378
+ \operatorname* { m a x } _ { \{ \lambda _ { 1 } , 2 , 3 \} } \operatorname* { m i n } _ { \substack { \left\{ \theta , \phi , \psi \right\} } } - \mathbb { E } _ { q _ { \psi } ( z | a , s ) } \left[ \log p _ { \theta } ( a | s , z ) \right] + \lambda _ { 1 } D _ { \mathrm { K L } } \left( q _ { \phi } ( z | a , s ) | p _ { \psi } ( z | s ) \right) + \lambda _ { 2 } \mathcal { L } _ { 0 } + \lambda _ { 3 } \mathcal { L } _ { T } .
379
+ $$
380
+
381
+ We observe this approach to produce efficient and stable mini-batch training.
382
+
383
+ # B GOAL-CONDITIONED POLICY INITIALIZATION FOR HRL
384
+
385
+ Optimizing composite neural networks like HRL (Co-Reyes et al., 2018) is sensitive to weight initialization (Mishkin & Matas, 2015; Le et al., 2015), due to its complexity and lack of clear supervision at various levels. Therefore, taking inspiration from prevailing pre-training procedures in computer vision (Russakovsky et al., 2015; Donahue et al., 2014) and NLP (Devlin et al., 2018; Radford et al., 2019), we take advantage of the weights learned by $\pi _ { g }$ during world graph discovery when initializing the Worker and Manager policies for downstream HRL, as $\pi _ { g }$ has already implicitly embodied much environment dynamics information.
386
+
387
+ More specifically, we extract the weights of the feature extractor, i.e. the state encoder, and use them as the initial weights for the state encoders of the HRL policies. Our empirical results demonstrate that such weight initialization consistently improves performance and validates the value of skill/knowledge transfer from GCP (Taylor & Stone, 2009; Barreto et al., 2017).
388
+
389
+ # C ADDITIONAL IMPLEMENTATION DETAILS
390
+
391
+ Model code folder including all architecture details is shared in comment.
392
+
393
+ # C.1 HYPERPARAMETERS FOR VAE TRAINING
394
+
395
+ Our models are optimized with Adam (Kingma & Ba, 2014) using mini-batches of size 128, thus spawning 128 asynchronous agents to explore. We use an initial learning rate of 0.0001, with $\bar { \epsilon } = 0 . 0 0 \bar { 1 } , \beta _ { 1 } = \bar { 0 } . 9 , \beta _ { 2 } = 0 . 9 9 \bar { 9 }$ ; gradients are clipped to 40 for inference and generation nets. For HardKuma, we set $l = - 0 . 1$ and $r = 1 . 1$ . The maximum sequence length for BiLSTM is 25. The total number of training iterations is 3600 and model usually converges around 2400 iterations. We train the prior, inference, and generation networks end-to-end.
396
+
397
+ We initialize $\lambda _ { i }$ ’s (see Lagrangian Relaxation) to be $\lambda _ { 1 } = 0 . 0 1$ (KL-divergence), $\begin{array} { r } { , \lambda _ { 2 } = 0 . 0 6 ( \mathcal { L } _ { 0 } ) . } \end{array}$ $\lambda _ { 3 } = 0 . 0 2 ( \mathcal { L } _ { T } )$ . After each update of the latent model, we update $\lambda _ { i }$ ’s, whose initial learning rate is 0.0005, by maximizing the original objective in a similar way as using Lagrangian Multiplier. At the end of optimization, $\lambda _ { i }$ ’s converge to locally optimal values. For example, with the medium maze, $\lambda _ { 1 } = 0 . 0 6 7$ for the KL-term, $\lambda _ { 2 } = 0 . 0 7 0$ for the $\mathcal { L } _ { 0 }$ and $\lambda _ { 3 } = 0 . 0 5 1$ for the $\mathcal { L } _ { T }$ term. The total number of waypoints $| \nu _ { p } |$ is set to be $2 0 \%$ of the size of the full state space.
398
+
399
+ # C.2 TRAINING HRL MODELS
400
+
401
+ The procedure of the Manager and the Worker in sending/receiving orders using either traversal paths among $\nu _ { p }$ from replay buffer for deterministic environments or with $\pi _ { g }$ for stochastic ones follows:
402
+
403
+ 1. The Manager gives a wide-narrow subgoal pair $( g _ { w } , g _ { n } )$ .
404
+ 2. The agent takes action based on the Worker policy $\pi ^ { \omega }$ conditioned on $( g _ { w } , g _ { n } )$ and reaches a new state $s ^ { \prime }$ . If $s ^ { \prime } \in \mathcal { V } _ { p }$ , $g _ { w }$ has not yet met, and there exists a valid path basing on the edge paths from the world graph $s ^ { \prime } \to g _ { w }$ , agent then either follows replay actions or $\pi _ { g }$ to reach $g _ { w }$ . If $\pi _ { g }$ still does not reach desired destination in a certain steps, then stop the agent wherever it stands; also $\pi _ { g }$ can be finetuned here.
405
+ 3. The Worker receives positive reward for reaching $g _ { w }$ for the first time.
406
+ 4. If agent reaches $g _ { n }$ , the Worker also receives positive rewards and terminates this horizon.
407
+ 5. The Worker receives negative for every action taken except for during traversal; the Manager receives negative reward for every action taken including traversal.
408
+ 6. When either $g _ { n }$ is reached or the maximum time step for this horizon is met, the Manager renews its subgoal pair.
409
+
410
+ The training of the Worker policy $\pi ^ { \omega }$ follows the same A2C algorithm as $\pi _ { g }$
411
+
412
+ The training of the Manager policy $\pi ^ { m }$ also follows a similar procedure but as it operates at a lower temporal resolution, its value function regresses against the $t _ { m }$ -step discounted reward where $t _ { m }$ covers all actions and rewards generated from the Worker.
413
+
414
+ When using the Wide-then-Narrow instruction, the policy gradient for the Manager policy $\pi _ { m }$ becomes:
415
+
416
+ $\begin{array} { r } { \boldsymbol { \mathbb { E } } _ { ( s _ { t } , a _ { t } ) \sim \pi , p , p _ { 0 } } \left[ A _ { m , t } \nabla \log \left( \pi ^ { \omega } \left( g _ { w , t } | s _ { t } \right) \pi ^ { n } \left( g _ { n , t } | s _ { t } , g _ { w , t } , s _ { w , t } \right) \right) \right] + \nabla \left[ \mathcal { H } \left( \pi ^ { \omega } \right) + \mathcal { H } \left( \pi ^ { n } ( \cdot | g _ { w , t } ) \right) \right] , } \end{array}$ where $A _ { m , t }$ is the Manager’s advantage at time $t$ . Also, for Manager, as the size of the action space scales linearly with $| S |$ , the exact entropy for the $\pi ^ { m }$ can easily become intractable. Essentially there are $O$ $^ { \prime } \left( | \mathcal { V } | \times \left( N ^ { 2 } \right) \right)$ possible actions. To calculate the entropy exactly, all of them has to be summed, making it easily computationally intractable:
417
+
418
+ $$
419
+ \mathcal { H } = \sum _ { w \in \mathcal { V } } \sum _ { w _ { n } \in s _ { w } } \pi ^ { n } ( w _ { n } | s _ { w } , s _ { t } ) \pi ^ { \omega } ( w | s _ { t } ) \log { \nabla \pi ^ { n } ( w _ { n } | s _ { w } , s _ { t } ) \pi ^ { \omega } ( w | s _ { t } ) } .
420
+ $$
421
+
422
+ Thus in practice we resort to an effective alternative $\mathcal { H } \left( \pi ^ { \omega } \right) + \mathcal { H } \left( \pi ^ { n } ( \cdot | g _ { w , t } ) \right)$ .
423
+
424
+ Psuedo-code for Manager training is in Algorithm 2.
425
+
426
+ # C.3 HYPERPARAMETERS FOR HRL
427
+
428
+ For training the HRL policies, we inherit most hyperparameters from those used when training $\pi _ { g }$ , as the Manager and the Worker both share similar architectures with $\pi _ { g }$ . The hyperparameters used when training $\pi _ { g }$ follow those from Shang et al. (2019). Because the tasks used in HRL experiments are more difficult than the generic goal-reaching task, we set the maximal number of training iterations to 100K abd training is stopped early if model performance reaches a plateau. The rollout steps for each iteration is 60. Hyperparameters specific to HRL are the horizon $c = 2 0$ and the size of the Manager’s local attention range (that is, the neighborhood around $g ^ { w }$ within which $g ^ { n }$ is selected), which are $N = 5$ for small and medium mazes, and $N = 7$ for the large maze.
429
+
430
+ Algorithm 2: Training of $\pi ^ { m }$ for HRL models
431
+
432
+ <table><tr><td>Clear gradients dθ ←O; while t &lt;= tmax or episode not terminated do Simulate under current policy πm,t-1, πω,t-1; if the Worker has met the previous subgoal or exceeded the horizon c then</td><td>Reset the set of time steps where πm,t omits a new subgoal Sm = {} and tm = 0.;</td></tr><tr><td colspan="2">Sample a new subgoal gm,t from πm,t; end</td></tr><tr><td>Zm,t = fLsTM(CNN(sm,t,sv),hm,tm),Vm,t = fu(zm,t),Tt = fp(2m,t) ;</td><td></td></tr><tr><td>Sm= SmU {tm} and tm =t;</td><td></td></tr><tr><td></td><td></td></tr><tr><td colspan="2">O, if terminal</td></tr><tr><td>Vtmax+1, otherwise</td><td></td></tr><tr><td>for t = tmax,...1 do R←rt+γR;</td><td></td></tr><tr><td>if t ∈ Sm then</td><td></td></tr><tr><td>Am,t ←R-Vm,t;</td><td></td></tr><tr><td></td><td></td></tr><tr><td>Accumulate gradients from value loss: dθ ← d0 + 入</td><td></td></tr><tr><td></td><td></td></tr><tr><td>Accumulate policy gradients with entropy regularization:</td><td>80</td></tr><tr><td></td><td></td></tr><tr><td>d0 ← d0+ VlogTm,t(gm,t)Am,t + βVH(πm,t);</td><td></td></tr><tr><td></td><td></td></tr><tr><td>end</td><td></td></tr><tr><td>end</td><td></td></tr></table>
433
+
434
+ # D 2D GRID WORLD VISUALIZATIONS
435
+
436
+ ![](images/e873103b674e3b139b1dde9c9a9cc1ebfed8b9e0f0f4150e66c98c1ba56795b4.jpg)
437
+ Figure 5: Visualization of the 2D grid environments in our experiments, along with the learned waypoints in blue.
438
+
439
+ ![](images/86812f5f54acb2108da0bc58155e8700f4575fcfaa3ed83f6a9417d89e4ae0b7.jpg)
440
+ Figure 6: Visualization of tasks in our experiments.
md/train/BkgStySKPB/BkgStySKPB.md ADDED
@@ -0,0 +1,480 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # CONTRASTIVE MULTIVIEW CODING
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Humans view the world through many sensory channels, e.g., the long-wavelength light channel, viewed by the left eye, or the high-frequency vibrations channel, heard by the right ear. Each view is noisy and incomplete, but important factors, such as physics, geometry, and semantics, tend to be shared between all views (e.g., a “dog” can be seen, heard, and felt). We hypothesize that a powerful representation is one that models view-invariant factors. Based on this hypothesis, we investigate a contrastive coding scheme, in which a representation is learned that aims to maximize mutual information between different views but is otherwise compact. Our approach scales to any number of views, and is view-agnostic. The resulting learned representations perform above the state of the art for downstream tasks such as object classification, compared to formulations based on predictive learning or single view reconstruction, and improve as more views are added. On the Imagenet linear readoff benchmark, we achieve $6 8 . 4 \%$ top-1 accuracy.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ A foundational idea in coding theory is to learn compressed representations that nonetheless can be used to reconstruct the raw data. This idea shows up in contemporary representation learning in the form of autoencoders (Salakhutdinov & Hinton, 2009) and generative models (Kingma & Welling, 2013; Goodfellow et al., 2014), which try to represent a data point or distribution as losslessly as possible. Yet lossless representation might not be what we really want, and indeed it is trivial to achieve – the raw data itself is a lossless representation. What we might instead prefer is to keep the “good” information (signal) and throw away the rest (noise). How can we identify what information is signal and what is noise?
12
+
13
+ To an autoencoder, or a max likelihood generative model, a bit is a bit. No one bit is better than any other. Our conjecture in this paper is that some bits are in fact better than others. Some bits code important properties like semantics, physics, and geometry, while others code attributes that we might consider less important, like incidental lighting conditions or thermal noise in a camera’s sensor.
14
+
15
+ We hypothesize that the good bits are the ones that are shared between multiple views of the world, for example between multiple sensory modalities like vision, sound, and touch. Under this perspective “presence of dog” is good information, since dogs can be seen, heard, and felt, but “camera pose” is bad information, since a camera’s pose has little or no effect on the acoustic and tactile properties of the imaged scene. There is significant evidence in the cognitive science and neuroscience literature that such cross-view representations are encoded by the brain (e.g., Smith & Gasser (2005); Den Ouden et al. (2012); Hohwy (2013)).
16
+
17
+ Our goal is therefore to learn representations that capture information shared between multiple sensory views but that are otherwise compact (i.e. throw away the bad information). To do so, we employ contrastive learning, where we learn a feature embedding such that views of the same scene map to nearby points while views of different scenes map to far apart points. In particular, we adapt the recently proposed method of Contrastive Predictive Coding (CPC) (Oord et al., 2018), except we simplify it – removing the recurrent network – and generalize it – showing how to apply it to arbitrary collections of views, rather than just to temporal predictions. In reference to CPC, we term our method Contrastive Multiview Coding (CMC). The contrastive objective in our formulation, as in CPC, can be understood as attempting to maximize the mutual information between the representations of each view.
18
+
19
+ We intentionally leave “good bits” only loosely defined and treat its definition as an empirical question. Ultimately, the proof is in the pudding: we consider a representation to be good if it makes subsequent problem solving easy, on tasks of human interest. For example, a useful representation of images might be a feature space in which it is easy to learn to recognize objects. We therefore evaluate our method by testing if the learned representations transfer well to standard semantic recognition tasks. On several benchmark tasks, our method achieves state of the art results, compared to other methods for self-supervised representation learning. We additionally find that the quality of the representation improves as a function of the number of views used for training. Finally, we compare the contrastive formulation of multiview learning to the recently popular approach of cross-view prediction, and find that in head-to-head comparisons, the contrastive approach learns stronger representations.
20
+
21
+ ![](images/c430fa54720a0c32bf2c04806ac9ce4c491210a4bc635d3e46b2ed3e0c8a09af.jpg)
22
+ Figure 1: (a) Given a pair of sensory views, a deep representation is learnt by bringing views of the same scene together in embedding space, while pushing views of different scenes apart. Here we show an example of learning from the luminance channel (L) of an image and the ab-color channel. The strawberry’s L and ab channels embed to nearby points whereas the ab channel of a different image (a photo of blueberries) embeds to a far away point. (b) Example of a 4-view dataset (NYU RGBD (Nathan Silberman & Fergus, 2012)) and its learned representation. Dotted lines represent the contrastive objective. The encodings for each view may be concatenated to form the full representation of a scene.
23
+
24
+ The core ideas that we build on: contrastive learning, mutual information maximization, and deep representation learning, are not new and have been explored in the literature on representation and multiview learning (Li et al., 2018; Xu et al., 2013; Arora et al., 2019). Our main contribution is to set up a framework to extend these ideas to any number of views, and to empirically study the factors that lead to success in this framework. A review of the related literature is given at the end of the paper, in Section 4. Fig. 1 gives a pictorial overview of our framework for the different learning tasks we consider in this paper, to learn representations across datasets with different sets of views. Our main contributions are:
25
+
26
+ • We apply contrastive learning to the multiview setting, attemping to maximize mutual information between representations of different views of the same scene (e.g., between different image channels, or different modalities). Our approach yields representations that outperform the state-of-the-art in self-supervised learning in head-to-head comparisons. For example, in the ImageNet linear readoff evaluation, we achieve $6 8 . 4 \%$ top-1 accuracy, which is slightly above the state of the art concurrent work Bachman et al. (2019). We show that the contrastive objective is superior to cross-view prediction.
27
+ We extend the framework to learn from more than two views, and show that the quality of the learned representation improves as number of views increase.
28
+ We conduct controlled experiments to measure the effect of mutual information on representation quality.
29
+
30
+ # 2 METHOD
31
+
32
+ Our goal is to learn representations that capture information shared between multiple sensory views without human supervision. We start by reviewing previous predictive learning (or reconstructionbased learning) methods, and then elaborate on contrastive learning within two views. We show connections to mutual information maximization and extend it to scenarios including more than two views. We consider a collection of $M$ views of the data, denoted as $V _ { 1 } , \dots , V _ { M }$ . For each view $V _ { i }$ , we denote $v _ { i }$ as a random variable representing samples following $v _ { i } \sim \mathcal { P } ( V _ { i } )$ .
33
+
34
+ ![](images/1d71ecefe136cc8c5d7f183a04b4b7c426f446671d4ab5f674cf5f0b00898d49.jpg)
35
+ Figure 2: Predictive Learning vs Contrastive Learning. Cross-view prediction (Top) learns latent representations that predict one view from another, with loss measured in the output space. Common prediction losses, such as the $\mathcal { L } _ { 1 }$ and $\mathcal { L } _ { 2 }$ norms, are unstructured, in the sense that they penalize each output dimension independently, perhaps leading to representations that do not capture all the shared information between the views. In contrastive learning (Bottom), representations are learnt by contrasting congruent and incongruent views, with loss measured in representation space. The red dotted outlines show where the loss function is applied.
36
+
37
+ # 2.1 PREDICTIVE LEARNING
38
+
39
+ Let $V _ { 1 }$ and $V _ { 2 }$ represent two views of a dataset. For instance, $V _ { 1 }$ might be the luminance of a particular image and $V _ { 2 }$ the chrominance. We define the predictive learning setup as a deep nonlinear transformation from $v _ { 1 }$ to $v _ { 2 }$ through latent variables $z$ , as shown in Fig. 2. Formally, $z = f ( v _ { 1 } )$ and $\hat { v _ { 2 } } = g ( z )$ , where $f$ and $g$ represent the encoder and decoder respectively and $\hat { v _ { 2 } }$ is the prediction of $v _ { 2 }$ given $v _ { 1 }$ . The parameters of the encoder and decoder models are then trained using an objective function that tries to bring $\hat { v _ { 2 } }$ “close to” $v _ { 2 }$ . Simple examples of such an objective include the $\mathcal { L } _ { 1 }$ or $\mathcal { L } _ { 2 }$ loss functions. Note that these objectives assume independence between each pixel or element of $v _ { 2 }$ given $v _ { 1 }$ , i.e., $p ( v _ { 2 } | v _ { 1 } ) = \Pi _ { i } p ( \bar { v } _ { 2 i } | v _ { 1 } )$ , thereby reducing their ability to model correlations or complex structure. The predictive approach has been extensively used in representation learning, for example, colorization (Zhang et al., 2016; 2017) and predicting sound from vision (Owens et al., 2016).
40
+
41
+ # 2.2 CONTRASTIVE LEARNING WITH TWO VIEWS
42
+
43
+ The idea behind contrastive learning is to learn an embedding that separates (contrasts) samples from two different distributions. Given a dataset of $V _ { 1 }$ and $V _ { 2 }$ that consists of a collection of samples $\{ v _ { 1 } ^ { i } , v _ { 2 } ^ { i } \} _ { i = 1 } ^ { N }$ , we consider contrasting congruent and incongruent pairs, i.e. samples from the joint distribution $x \sim p ( v _ { 1 } , v _ { 2 } )$ or $x = \{ v _ { 1 } ^ { \overline { { i } } } , v _ { 2 } ^ { i } \}$ , which we call positives, versus samples from the product of marginals, $y \sim p ( v _ { 1 } ) p ( v _ { 2 } )$ or $y = \{ v _ { 1 } ^ { i } , v _ { 2 } ^ { j } \}$ , which we call negatives.
44
+
45
+ We learn a “critic” $h _ { \theta } ( \cdot )$ that is high for positives and low for negatives. Similar to recent setups for contrastive learning (Oord et al., 2018; Gutmann & Hyvarinen ¨ , 2010; Mnih & Kavukcuoglu, 2013), we train this function to correctly select a single positive sample $x$ out of a set $S = \{ x , y _ { 1 } , y _ { 2 } , . . . , y _ { k } \}$ that contains $k$ negative samples:
46
+
47
+ $$
48
+ \mathcal { L } _ { c o n t r a s t } = - \mathop { \mathbb { E } } _ { S } \left[ \log \frac { h _ { \theta } ( x ) } { h _ { \theta } ( x ) + \sum _ { i = 1 } ^ { k } h _ { \theta } ( y _ { i } ) } \right]
49
+ $$
50
+
51
+ To construct $S$ , we simply fix one view and enumerate positives and negatives from the other view, allowing us to rewrite the objective as:
52
+
53
+ $$
54
+ \mathcal { L } _ { c o n t r a s t } ^ { V _ { 1 } , V _ { 2 } } = - \underset { \{ v _ { 1 } ^ { 1 } , v _ { 2 } ^ { 1 } , . . . , v _ { 2 } ^ { k + 1 } \} } { \mathbb { E } } \left[ \log \frac { h _ { \theta } ( \{ v _ { 1 } ^ { 1 } , v _ { 2 } ^ { 1 } \} ) } { \sum _ { j = 1 } ^ { k + 1 } h _ { \theta } ( \{ v _ { 1 } ^ { 1 } , v _ { 2 } ^ { j } \} ) } \right]
55
+ $$
56
+
57
+ where $k$ is the number of negative samples $v _ { 2 } ^ { j }$ for a given sample $v _ { 1 } ^ { 1 }$ . In practice, $k$ can be extremely large, and so directly minimizing Eq. 2 is infeasible. In Section 2.4, we show an approximation based on Noise Contrastive Estimation (Gutmann $\&$ Hyvarinen ¨ , 2010) that allows for tractable computation.
58
+
59
+ ![](images/bb153de172cd03660c2788678dfe4f08b2717f8a9dae4f42e7e119b8bded5655.jpg)
60
+ Figure 3: Graphical models and information diagrams (inf) associated with the core view and full graph paradigms, for the case of 4 views, which gives a total of 6 learning objectives. The numbers within the regions show how much “weight” the total loss places on each partition of information (i.e. how many of the 6 objectives that partition contributes to). A region with no number corresponds to 0 weight. For example, in the full graph case, the mutual information between all 4 views is considered in all 6 objectives, and hence is marked with the number 6.
61
+
62
+ Implementing the critic We implement the critic $h _ { \theta } ( \cdot )$ as a neural network. To extract compact latent representations of $v _ { 1 }$ and $v _ { 2 }$ , we employ two encoders $f _ { \theta _ { 1 } } ( \cdot )$ and $f _ { \theta _ { 2 } } ( \cdot )$ with parameters $\theta _ { 1 }$ and $\theta _ { 2 }$ respectively. The latent representions are extracted as $z _ { 1 } = f _ { \theta _ { 1 } } ( v _ { 1 } )$ , $z _ { 2 } = f _ { \theta _ { 2 } } ( v _ { 2 } )$ . On top of these features, the score is computed as the exponential of a bivariate function of $z _ { 1 }$ and $z _ { 2 }$ , e.g., a bilinear function parameterized by $W _ { 1 2 }$ :
63
+
64
+ $$
65
+ h _ { \boldsymbol { \theta } } \big ( \{ v _ { 1 } , v _ { 2 } \} \big ) = e ^ { f _ { \boldsymbol { \theta } _ { 1 } } ( v _ { 1 } ) ^ { T } W _ { 1 2 } f _ { \boldsymbol { \theta } _ { 2 } } ( v _ { 2 } ) }
66
+ $$
67
+
68
+ Loss LV1,V2contra in Eq. 2 trenchoring at view . We $V _ { 1 }$ as anchor and enumerates over them up as our two-view loss: $V _ { 2 }$ . Symmetrically, we can get $\mathcal { L } _ { c o n t r a s t } ^ { V _ { 2 } , V _ { 1 } }$ $V _ { 2 }$
69
+
70
+ $$
71
+ \mathcal { L } ( V _ { 1 } , V _ { 2 } ) = \mathcal { L } _ { c o n t r a s t } ^ { V _ { 1 } , V _ { 2 } } + \mathcal { L } _ { c o n t r a s t } ^ { V _ { 2 } , V _ { 1 } }
72
+ $$
73
+
74
+ After the contrastive learning phase, we use the representation $z _ { 1 } , z _ { 2 }$ , or the concatenation of both, $[ z _ { 1 } , z _ { 2 } ]$ , depending on our paradigm. This process is visualized in Fig. 1.
75
+
76
+ Connecting to mutual information The optimal critic $h _ { \theta } ^ { * }$ is proportional to the density ratio between the joint distribution $p ( z _ { 1 } , z _ { 2 } )$ and the product of marginals $p ( z _ { 1 } ) p ( z _ { 2 } )$ (proof provided in Sec. C.1):
77
+
78
+ $$
79
+ h _ { \theta } ^ { \ast } ( \{ v _ { 1 } , v _ { 2 } \} ) ~ \propto ~ \frac { p ( z _ { 1 } , z _ { 2 } ) } { p ( z _ { 1 } ) p ( z _ { 2 } ) } \propto \frac { p ( z _ { 1 } | z _ { 2 } ) } { p ( z _ { 1 } ) }
80
+ $$
81
+
82
+ This quantity is the pointwise mutual information, and its expectation, in Eq. 2, yields an estimator related to mutual information. A formal proof is given by Oord et al. (2018); Poole et al. (2019), which we recapitulate in Section C, showing that:
83
+
84
+ $$
85
+ I ( z _ { i } ; z _ { j } ) \geq \log ( k ) - \mathcal { L } _ { c o n t r a s t }
86
+ $$
87
+
88
+ where, as above, $k$ is the number of negative pairs in sample set $S$ . Hence minimizing the objective $\mathcal { L }$ maximizes the lower bound on the mutual information $I ( z _ { i } ; z _ { j } )$ , which is bounded above by $I ( v _ { i } ; v _ { j } )$ by the data processing inequality. The dependency on $k$ also suggests that using more negative samples can lead to an improved representation; we show that this is indeed the case in Section A.1.2. We note that recent work (McAllester & Statos, 2018) shows that the bound in Eq. 6 can be very weak; and finding better estimators of mutual information is an important open problem.
89
+
90
+ # 2.3 CONTRASTIVE LEARNING WITH MORE THAN TWO VIEWS
91
+
92
+ We present more general formulations of Eq. 2 that can handle any number of views. We call them the “core view” and “full graph” paradigms, which offer different tradeoffs between efficiency and effectiveness. These formulations are visualized in Fig. 3.
93
+
94
+ Suppose we have a collection of $M$ views $V _ { 1 } , \dots , V _ { M }$ . The “core view” formulation sets apart one view that we want to optimize over, say $V _ { 1 }$ , and builds pair-wise representations between $V _ { 1 }$ and each
95
+
96
+ other view $V _ { j } , j > 1$ , by optimizing the sum of a set of pair-wise objectives:
97
+
98
+ $$
99
+ \mathcal { L } _ { C } = \sum _ { j = 2 } ^ { M } \mathcal { L } ( V _ { 1 } , V _ { j } )
100
+ $$
101
+
102
+ A second, more general formulation is the “full graph” where we consider all pairs $( i , j ) , i \neq j$ , and build $\binom { n } { 2 }$ relationships in all. By involving all pairs, the objective function that we optimize is:
103
+
104
+ $$
105
+ \mathcal { L } _ { F } = \sum _ { 1 \leq i < j \leq M } \mathcal { L } ( V _ { i } , V _ { j } )
106
+ $$
107
+
108
+ Both these formulations have the effect that information is prioritized in proportion to the number of views that share that information. This can be seen in the information diagrams visualized in Fig. 3. The number in each partition of the diagram indicates how many of the pairwise objectives, ${ \bar { \mathcal { L } } } ( V _ { i } , V _ { j } )$ , that partition contributes to. Under both the core view and full graph objectives, a factor, like “presence of $\mathrm { d o g } ^ { \mathrm { , , } }$ , that is common to all views will be preferred over a factor that affects fewer views, such as “depth sensor noise”.
109
+
110
+ The computational cost of the bivariate score function in the full graph formulation is combinatorial in the number of views. However, it is clear from Fig. 3 that this enables the full graph formulation to capture more information between different views, which may prove useful for downstream tasks. For example, the mutual information between $V _ { 2 }$ and $V _ { 3 }$ or $V _ { 2 }$ and $V _ { 4 }$ is completely ignored in the core view paradigm (as shown by a 0 count in the information diagram).
111
+
112
+ # 2.4 APPROXIMATING THE SOFTMAX DISTRIBUTION WITH NOISE-CONTRASTIVE ESTIMATION
113
+
114
+ Better representations using computing the full softmax $\mathcal { L } _ { c o n t r a s t } ^ { V _ { 1 } , V _ { 2 } }$ in Eq. 2 are learnt by using mhibitively expensive for large y negative samples. However,. We alleviate computational $N$ load by using Noise-Contrastive Estimation (NCE) (Gutmann & Hyvarinen ¨ , 2010) to approximate the full softmax in Eqn. 2, as has also been used in Mnih & Kavukcuoglu (2013)1.
115
+
116
+ Given an anchor $v _ { 1 } ^ { i }$ from $V _ { 1 }$ , the probablity that an atom $v _ { 2 } \in \{ v _ { 2 } ^ { j } | j = 1 , 2 , . . . , N \}$ from $V _ { 2 }$ is the best match of $v _ { 1 } ^ { i }$ , using the score $h _ { \theta }$ is given by:
117
+
118
+ $$
119
+ p ( v _ { 2 } | v _ { 1 } ^ { i } ) = \frac { h _ { \theta } ( \{ v _ { 1 } ^ { i } , v _ { 2 } \} ) } { \sum _ { j = 1 } ^ { N } h _ { \theta } ( \{ v _ { 1 } ^ { i } , v _ { 2 } ^ { j } \} ) }
120
+ $$
121
+
122
+ where the normalization factor $\begin{array} { r } { Z = \sum _ { j = 1 } ^ { N } h _ { \theta } ( \{ v _ { 1 } ^ { i } , v _ { 2 } ^ { j } \} ) } \end{array}$ is expensive to compute for large $N$ . Here we use $h _ { \theta } ( \{ v _ { 1 } , v _ { 2 } \} ) = \exp ( f _ { \theta _ { 1 } } ( v _ { 1 } ) ^ { T } \dot { W } _ { 1 2 } f _ { \theta _ { 2 } } ( v _ { 2 } ) / \tau )$ , where $\tau$ modulates the distribution.
123
+
124
+ Noise-Contrastive Estimation (Gutmann & Hyvarinen ¨ , 2010) (NCE) is an effective way to estimate unnormalized statistical models. NCE fits a density model $p$ to data distributed as (unknown) distribution $p _ { d }$ , by using a binary classifier to distinguish it from noise samples distributed as $p _ { n }$ . To learn $p ( v _ { 2 } | v _ { 1 } ^ { i } )$ , we use a binary classifier, which treats $v _ { 2 }$ as the data sample when given $v _ { 1 } ^ { i }$ . The noise distribution $p _ { n } ( \cdot | v _ { 1 } ^ { i } )$ we choose here is a uniform distribution over all atoms from $V _ { 2 }$ , i.e., $p _ { n } ( \cdot | v _ { 1 } ^ { i } ) = 1 / N$ . If we sample $m$ noise samples to pair with each data sample, the posterior probability that a given atom $v _ { 2 }$ comes from the data distribution is:
125
+
126
+ $$
127
+ P ( D = 1 | v _ { 2 } ; v _ { 1 } ^ { i } ) = \frac { p _ { d } ( v _ { 2 } | v _ { 1 } ^ { i } ) } { p _ { d } ( v _ { 2 } | v _ { 1 } ^ { i } ) + m p _ { n } ( v _ { 2 } | v _ { 1 } ^ { i } ) }
128
+ $$
129
+
130
+ and we estimate this probability by replacing $p _ { d } ( v _ { 2 } | v _ { 1 } ^ { i } )$ with our unnormalized model distribution $h _ { \theta } ( v _ { 1 } ^ { i } , v _ { 2 } )$ . Minimizing the negative log-posterior probability of correct labels $D$ over data and noise samples yields our final objective, which is the NCE-based approximation of Eq. 2 $\hat { p }$ is the empirical data distribution):
131
+
132
+ $$
133
+ L _ { N C E } = - \underset { v _ { 1 } ^ { + } \sim \hat { p } ( v _ { 1 } ) } { \mathbb { E } } \{ \underset { v _ { 2 } \sim \hat { p } ( \cdot \vert v _ { 1 } ^ { i } ) } { \mathbb { E } } \left[ \log ( P ( D = 1 \vert v _ { 2 } ; v _ { 1 } ^ { i } ) ) \right] + m \underset { v _ { 2 } \sim p _ { n } ( \cdot \vert v _ { 1 } ^ { i } ) } { \mathbb { E } } \left[ \log ( P ( D = 0 \vert v _ { 2 } ; v _ { 1 } ^ { i } ) ) \right] \}
134
+ $$
135
+
136
+ Memory bank. Following Wu et al. (2018), we maintain a memory bank to store latent features for each training sample. Therefore, we can efficiently retrieve $m$ noise samples from the memory bank to pair with each positive sample without recomputing their features. The memory bank is dynamically updated with features computed on the fly.
137
+
138
+ An alternative to the NCE based approximation above, is to simply do $m { + 1 }$ way softmax classification with $m$ noise samples retrieved from the memory bank. We note that CPC (Oord et al., 2018) and Deep InfoMax (Hjelm et al., 2019) use this $m + 1$ way softmax classification as their ultimate contrastive loss rather than the NCE-based contrastive loss in Eq. 11 (but note that CPC refers to the $m + 1$ approximation as also “based on NCE”). Empirically we have found that the $m + 1 \AA$ -way softmax classification approach performed worse than our NCE-based approximation, given the same number of noise samples.
139
+
140
+ # 3 EXPERIMENTS
141
+
142
+ We extensively evaluate Contrastive Multiview Coding (CMC) on a number of datasets and tasks. We evaluate on two established image representation learning benchmarks: Imagenet and STL-10 (See A.1.1). We further validate our framework on video representation learning tasks (See A.2), where we use image and optical flow modalities, as the two views that are jointly learned. The last set of experiments extends our CMC framework to more than two views and provides empirical evidence of it’s effectiveness.
143
+
144
+ # 3.1 BENCHMARKING CMC ON IMAGENET
145
+
146
+ Following Zhang et al. (2016), we evaluate task generalization of the learned representation by training 1000-way linear classifiers on top of different layers.
147
+
148
+ Setup. Given a dataset of RGB images, we convert them to the Lab image color space, and split each image into $L$ and ab channels, as originally proposed in SplitBrain autoencoders (Zhang et al., 2017). During contrastive learning, L and ab from the same image are treated as the positive pair, and ab channels from other randomly selected images are treated as a negative pair (for a given L). Each split represents a view of the orginal image and is passed through a separate encoder. As in SplitBrain, we design these two encoders by evenly splitting a given deep network, such as AlexNet (Krizhevsky et al., 2012), into sub-networks across the channel dimension. By concatenating representations layer-wise from these two encoders, we achieve the final representation of an input image. As proposed by previous literature (Oord et al., 2018; Hjelm et al., 2019; Arora et al., 2019), the quality of such a representation is evaluated by freezing the weights of encoder and training linear or non-linear classifiers on top of each layer.
149
+
150
+ To compare with other methods, we adopt standard AlexNet and split it into two encoders. Because of splitting, each layer only connects to half of the neurons in the previous layer, and therefore the number of parameters in our model halves. We remove local response layer and add batch normalization to each layer. For the memory-based CMC model, we adopt ideas from Wu et al. (2018) for computing and storing a memory. We retrieve 4096 negative pairs from the memory bank to contrast each positive pair. The training details are present in Sec. D.2.
151
+
152
+ Table 1 shows the results of comparing the CMC against other models, both predictive and contrastive. Our CMC is the best among all these methods; futhermore CMC tends to perform better at higher convolutional layers, similar to another contrasting-based model Inst-Dis (Wu et al., 2018).
153
+
154
+ CMC with ResNets. We verify the scalability of CMC with larger networks such as ResNets He et al. (2016). Here we do not split ResNets, rather we use ResNet-50, ResNet-101 or ResNet-50 x2 to encoder each of the two views $L$ and $a b$ ). The results are shown in Table 2, where ResNet-50, ResNet-101, and ResNet- $5 0 ~ \mathrm { x } 2$ achieve $6 4 . 1 \%$ , $6 5 . 0 \%$ , and $6 8 . 4 \%$ top-1 accuracies, respectively. To our best knowledge, $6 8 . 4 \%$ on ImageNet is the highest published accuracy ever achieved by self-supervsied/unsupervised methods (We note that a concurrent work AMDIM Bachman et al. (2019) achieves similar results).
155
+
156
+ Table 1: Top-1 classification accuracy on 1000 classes of ImageNet Deng et al. (2009) with single crop. We compare our CMC method with other unsupervised representation learning approaches by training 1000-way logistic regression classifiers on top of the feature maps of each layer, as proposed by Zhang et al. (2016). Methods marked with † only have half the number of parameters compared to others, because of splitting.
157
+
158
+ <table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>ImageNet Classification Accuracy</td></tr><tr><td rowspan=1 colspan=1>Method</td><td rowspan=1 colspan=1>conv1 conv2 conv3 conv4 conv5</td></tr><tr><td rowspan=1 colspan=1>ImageNet-Labels</td><td rowspan=1 colspan=1>19.3 36.3 44.2 48.3 50.5</td></tr><tr><td rowspan=2 colspan=1>RandomData-Init (Krahenbuhl et al., 2015)</td><td rowspan=1 colspan=1>11.6 17.1 16.9 16.3 14.1</td></tr><tr><td rowspan=1 colspan=1>17.5 23.0 24.5 23.2 20.6</td></tr><tr><td rowspan=10 colspan=1>Context (Doersch et al., 2015)Colorization (Zhang et al., 2016)Jigsaw (Noroozi &amp; Favaro,2016)BiGAN (Donahue et al., 2017)SplitBraint (Zhang et al., 2017)Counting (Noroozi et al., 2017)Inst-Dis (Wu et al., 2018)RotNet (Gidaris et al., 2018)DeepCluster (Caron et al.,2018)AET (Zhang et al., 2019)</td><td rowspan=1 colspan=1>16.2 23.3 30.2 31.7 29.6</td></tr><tr><td rowspan=1 colspan=1>13.1 24.8 31.0 32.6 31.8</td></tr><tr><td rowspan=1 colspan=1>19.2 30.1 34.7 33.9 28.3</td></tr><tr><td rowspan=1 colspan=1>17.7 24.5 31.0 29.9 28.0</td></tr><tr><td rowspan=1 colspan=1>17.7 29.3 35.4 35.2 32.8</td></tr><tr><td rowspan=1 colspan=1>18.0 30.6 34.3 32.5 25.7</td></tr><tr><td rowspan=1 colspan=1>16.8 26.5 31.8 34.1 35.6</td></tr><tr><td rowspan=1 colspan=1>18.8 31.7 38.7 38.2 36.5</td></tr><tr><td rowspan=1 colspan=1>12.9 29.2 38.2 39.8 36.1</td></tr><tr><td rowspan=1 colspan=1>19.3 32.8 40.6 39.7 37.7</td></tr><tr><td rowspan=1 colspan=1>CMC</td><td rowspan=1 colspan=1>18.4 33.5 38.1 40.4 42.6</td></tr></table>
159
+
160
+ Table 2: Single crop top-1 classification accuracy on ImageNet. We evaluate CMC with ResNet-50, ResNet-101, or ResNet- ${ 5 0 } \mathrm { x } 2 { }$ as encoder for each of the two views $L$ and $a b$ ).
161
+
162
+ <table><tr><td>Accuracy (%)</td><td>ResNet-50</td><td>ResNet-101</td><td>ResNet-50 x2</td></tr><tr><td>Top-1</td><td>64.1</td><td>65.0</td><td>68.4</td></tr></table>
163
+
164
+ # 3.2 DOES REPRESENTATION QUALITY IMPROVE AS NUMBER OF VIEWS INCREASES?
165
+
166
+ We further extend our CMC learning framework to multiview scenarios. We experiment on the NYU-Depth-V2 (Nathan Silberman & Fergus, 2012) dataset which consists of 1449 labeled images. We focus more on understanding the behavior and effectiveness of CMC rather than competing with the current state-of-the-arts. The views we consider are: luminance (L channel), chrominance (ab channel), depth, surface normal (Eigen & Fergus, 2015), and semantic labels.
167
+
168
+ Setup. To extract features from each view, we use a neural network with 5 convolutional layers, and 1 fully connected layer. As the size of the dataset is relatively small, we adopt the sub-patch based contrastive objective (see B) to increase the number of negative pairs. Patches with a size of $1 2 8 \times 1 2 8$ are randomly cropped from the original images for contrastive learning (from images of size $4 8 0 \times 6 4 0 ^ { \cdot }$ ). For downstream tasks, we discard the fully connected layers and evaluate using the convolutional layers as a representation.
169
+
170
+ To measure the quality of the learned representation, we consider the task of predicting semantic labels from the representation of $L$ . We follow the core view paradigm and use $L$ are the core view, thus learning a set of representations on $L$ by contrasting different views with $L$ . A UNet style architecture (Ronneberger et al., 2015) is utilized to perform the segmentation task. Contrastive training is performed on the above architecture that is equivalent of the UNet’s encoder. After contrastive training is completed, we initialize the encoder weights of the UNet from the $L$ encoder (which are equivalent architectures) and keep them frozen. Only the decoder is trained during this finetuning stage.
171
+
172
+ Since we use the patch-based contrastive loss, in the 1 view setting case, CMC coincides with DIM (Hjelm et al., 2019). The 2-4 view cases contrast L with ab, and then sequentially add depth and surface normals. The semantic labeling results are measured by mean IoU over all classes and pixel accuracy, shown in Fig. 4. We see that the performance steadily improves as new views are added. We have tested different orders of adding the views, and they all follow a similar pattern.
173
+
174
+ We also compare CMC with two baselines. First, we randomly initialize and freeze the encoder, and we call this the Random baseline; it serves as a lower bound on the quality since the representation is just a random projection. Rather than freezing the randomly initialized encoder, we could train it jointly with the decoder. This end-to-end Supervised baseline serves as an upper bound. The results are presented in Table 3, which shows our CMC produces high quality feature maps even though it’s unaware of the downstream task.
175
+
176
+ <table><tr><td></td><td>Pixel Accuracy (%)</td><td>mIoU (%)</td></tr><tr><td>Random</td><td>45.5</td><td>21.4</td></tr><tr><td>CMC (core-view)</td><td>57.1</td><td>34.1</td></tr><tr><td>CMC (full-graph)</td><td>57.0</td><td>34.4</td></tr><tr><td>Supervised</td><td>57.8</td><td>35.9</td></tr></table>
177
+
178
+ ![](images/f0a8c78a5d8dcbb4886abf3a078be33de389fcfcff7c219288cb6370db479b53.jpg)
179
+ Figure 4: We show the Intersection over Union (IoU) (left) and Pixel Accuracy (right) for the NYU-Depth-V2 dataset, as CMC is trained with increasingly more views from 1 to 4. As more views are added, both these metrics steadily increase. The views are (in order of inclusion): L, ab, depth and surface normals.
180
+ Table 3: Results on the task of predicting semantic labels from L channel representation which is learnt using the patch-based contrastive loss and all 4 views. We compare CMC with Random and Supervised baselines, which serve as lower and upper bounds respectively. Th core-view paradigm refers to Fig. 3(a), and full-view Fig. 3(b).
181
+ Table 4: We compare predictive learning with contrastive learning by evaluating the learned encoder on unseen dataset and task. The contrastive learning framework consistently outperforms predictive learning.
182
+
183
+ # 3.3 PREDICTIVE LEARNING VS. CONTRASTIVE LEARNING
184
+
185
+ While experiments in section 3.1 show that contrastive learning outperforms predictive learning (Zhang et al., 2017) in the context of Lab color space, it’s unclear whether such an advantage is due to the natural inductive bias of the task itself. To further understand this, we go beyond chrominance (ab), and try to answer this question when geometry or semantic labels are present.
186
+
187
+ We consider three view pairs on the NYU-Depth dataset: (1) L and depth, (2) L and surface normals, and (3) L and segmentation map. For each of them, we train two identical encoders for L, one using contrastive learning and the other with predictive learning. We then evaluate the representation quality by training a linear classifier on top of these encoders on the STL-10 dataset.
188
+
189
+ <table><tr><td></td><td colspan="2">Accuracy on STL-10 (%)</td></tr><tr><td>Views</td><td>Predictive</td><td>Contrastive</td></tr><tr><td>L, Depth L, Normal L, Seg. Map</td><td>55.5 58.4 57.7</td><td>58.3 60.1 59.2</td></tr><tr><td>Random Supervised</td><td colspan="2">25.2 65.1</td></tr></table>
190
+
191
+ The comparison results are shown in Table 4, which shows that contrastive learning consistently outperforms predictive learning in this scenario where both the task and the dataset are unknown. We also include “random” and “supervised” baselines similar to that in previous sections. Though in the unsupervised stage we only use 1.3K images from a dataset much different from the target dataset STL-10, the object recognition accuracy is close to the supervised method, which uses an end-to-end deep network directly trained on STL-10.
192
+
193
+ Given two views $V _ { 1 }$ and $V _ { 2 }$ of the data, the predictive learning approach approximately models $p ( v _ { 2 } | v _ { 1 } )$ . Furthermore, losses used typically for predictive learning, such as pixel-wise reconstruction losses usually impose an independence assumption on the modeling: $p ( \bar { v _ { 2 } } | v _ { 1 } ) \approx \Pi _ { i } p ( v _ { 2 i } | v _ { 1 } )$ . On the other hand, the contrastive learning approach by construction does not assume conditional independence across dimensions of $v _ { 2 }$ . In addition, the use of random jittering and cropping between views allows the contrastive learning approach to benefit from spatial co-occurrence (contrasting in space) in addition to contrasting across views. We conjecture that these are two reasons for the superior performance of contrastive learning approaches over predictive learning.
194
+
195
+ ![](images/24df0326ebab21d46e12729bcbb3d6d65ffcc61db5fb8a35954d3e682e32ed3b.jpg)
196
+ Figure 5: How does mutual information between views relate to representation quality? (Left) Classification accuracy against estimated MI between channels of different color spaces; (Right) Classification accuracy vs estimated MI between patches at different distances (distance in pixels is denoted next to each data point). MI estimated using MINE (Belghazi et al., 2018).
197
+
198
+ # 3.4 HOW DOES MUTUAL INFORMATION AFFECT REPRESENTATION QUALITY?
199
+
200
+ Given a fixed set of views, CMC aims to maximize the mutual information between representations of these views. We have found that maximizing information in this way indeed results in strong representations, but it would be incorrect to infer that information maximization (infomax) is the key to good representation learning. In fact, this paper argues for precisely the opposite idea: that cross-view representation learning is effective because it results in a kind of information minimization, discarding nuisance factors that are not shared between the views.
201
+
202
+ The resolution to this apparent dilemma is that we want to maximize the “good” information – the signal – in our representations, while minimizing the “bad” information – the noise. The idea behind CMC is that this can be achieved by doing infomax learning on two views that share signal but have independent noise. This suggests a “Goldilocks principle”: a good collection of views is one that shares some information but not too much. Here we test this hypothesis on two domains: learning representations on images with different colorspaces forming the two views; and learning representations on pairs of patches extracted from an image, separated by varying spatial distance.
203
+
204
+ In patch experiments we randomly crop two RGB patches of size $6 4 \mathrm { x } 6 4$ from the same image as two views. Their relative position is fixed. Namely, the two patches always starts at position $( x , y )$ and $( x + d , y + d )$ with $( x , y )$ being randomly sampled. While varying the distance $d$ , we start from 64 to avoid overlapping. There is a possible bias that with an image of relatively small size (e.g., $5 1 2 \mathrm { x } 5 1 2 ,$ ), a large $d$ (e.g., 384) will always push these two patches around boundary. To minimize this bias, we use high resolution images (e.g. $2 k$ ) from DIV2K (Agustsson & Timofte, 2017) dataset.
205
+
206
+ Fig. 5 shows the results of these experiments. The left plot shows the result of learning representations on different colorspaces (splitting each colorspace into two views, such as (L, ab), (R, GB) etc). We then use the MINE estimator Belghazi et al. (2018) to estimate the mutual information between the views. We measure representation quality by training a linear classifier on the learned representations on the STL-10 dataset Coates et al. (2011). The plots clearly show that using colorspaces with minimal mutual information give the best downstream accuracy (For the outlier HSV in this plot, we conjecture the representation quality is harmed by the periodicity of H. Note that the H in HED is not periodic.). On the other hand, the story is more nuanced for representations learned between patches at different offsets from each other (Fig. 5, right). Here we see that views with too little or too much MI perform worse; a sweet spot in the middle exists which gives the best representation. That there exists such a sweet spot should be expected. If two views share no information, then, in principle, there is no incentive for CMC to learn anything. If two views share all their information, no nuisances are discarded and we arrive back at something akin to an autoencoder or generative model, that simply tries to represent all the bits in the multiview data.
207
+
208
+ These experiments demonstrate that the relationship between mutual information and representation quality is meaningful but not direct. Selecting optimal views, which just share relevant signal, may be a fruitful direction for future research.
209
+
210
+ # 4 RELATED WORK
211
+
212
+ Unsupervised representation learning is about learning transformations of the data that make subsequent problem solving easier (Bengio et al., 2013). This field has a long history, starting with classical methods with well established algorithms, such as principal components analysis (PCA (Jolliffe, 2011)) and independent components analysis (ICA (Hyvarinen et al. ¨ , 2004)). These methods tend to learn representations that focus on low-level variations in the data, which are not very useful from the perspective of downstream tasks such as object recognition.
213
+
214
+ Representations better suited to such tasks have been learnt using deep neural networks, starting with seminal techniques such as Boltzmann machines (Smolensky, 1986; Salakhutdinov & Hinton, 2009), autoencoders (Hinton & Salakhutdinov, 2006), variational autoencoders (Kingma & Welling, 2013), generative adversarial networks (Goodfellow et al., 2014) and autoregressive models (Oord et al., 2016). Numerous other works exist, for a review see (Bengio et al., 2013). A powerful family of models for unsupervised representations are collected under the umbrella of “self-supervised” learning (Sa, 2004; Zhang et al., 2017; 2016; Isola et al., 2015; Wang & Gupta, 2015; Pathak et al., 2016; Zhang et al., 2019). In these models, an input $X$ to the model is transformed into an output $\hat { X }$ , which is supposed to be close to another signal $Y$ , which itself is related to $X$ in some meaningful way. Examples of such $X / Y$ pairs are: luminance and chrominance color channels of an image (Zhang et al., 2017), patches from a single image (Oord et al., 2018), modalities such as vision and sound (Owens et al., 2016) or the frames of a video (Wang & Gupta, 2015). Clearly, such examples are numerous in the world, and provides us with nearly infinite amounts of training data: this is one of the appeals of this paradigm. Time contrastive networks (Sermanet et al., 2017) use a triplet loss framework to learn representations from aligned video sequences of the same scene, taken by different video cameras. Closely related to self-supervised learning is the idea of multi-view learning, which is a general term involving many different approaches such as co-training (Blum & Mitchell, 1998), multi-kernel learning (Cortes et al., 2009) and metric learning (Bellet et al., 2012; Zhuang et al., 2019); for comprehensive surveys please see (Xu et al., 2013; Li et al., 2018). Nearly all existing works have dealt with one or two views such as video or image/sound. However, in many situations, many more views are available to provide training signals for any representation.
215
+
216
+ The objective functions used to train deep learning based representations in many of the above methods are either reconstruction-based loss functions such as Euclidean losses in different norms e.g. (Isola et al., 2017), adversarial loss functions (Goodfellow et al., 2014) that learn the loss in addition to the representation, or contrastive losses e.g. (Gutmann & Hyvarinen ¨ , 2010; Hjelm et al., 2019; Oord et al., 2018; Arora et al., 2019; Henaff et al. ´ , 2019) that take advantage of the co-occurence of multiple views. Another recently introduced novel objective function is instance discrimination (Wu et al., 2018). In this work, we compare the two most commonly used objectives: predictive and contrastive. The prior works most similar to our own (and inspirational to us) are Contrastive Predictive Coding (CPC) (Oord et al., 2018) and Deep InfoMax (Henaff et al. ´ , 2019). These two methods, like ours, learn representations by contrasting between congruent and incongruent representations of a scene, and are motivated as forms of infomax learning. CPC learns from two views – the past and future – and is applicable to sequential data. Deep Infomax (Hjelm et al., 2019) considers the two views to be the input to a neural network and its output. These two methods share the same mathematical objective, but differ in the definition of the views. Our technical method is also highly related, but differs in the following ways: we extend the objective to the case of more than two views; and we use a loss function which more closely follows the original method of noise contrastive estimation (Gutmann & Hyvarinen ¨ , 2010) (See details in Section 2.4). Although CPC, Deep InfoMax, and the present paper are all very similar at the mathematical level, they each explore a different set of view definitions, architectures, and application settings, and each contributes its own unique empirical investigation of this paradigm of representation learning.
217
+
218
+ # REFERENCES
219
+
220
+ Information Diagram - Wikipedia. https://en.wikipedia.org/wiki/Information_ diagram. 4
221
+
222
+ Eirikur Agustsson and Radu Timofte. Ntire 2017 challenge on single image super-resolution: Dataset and study. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition Workshops, pp. 126–135, 2017. 9
223
+
224
+ Sanjeev Arora, Hrishikesh Khandeparkar, Mikhail Khodak, Orestis Plevrakis, and Nikunj Saunshi. A theoretical analysis of contrastive unsupervised representation learning. arXiv preprint arXiv:1902.09229, 2019. 2, 6, 10, 14
225
+
226
+ Philip Bachman, R Devon Hjelm, and William Buchwalter. Learning representations by maximizing mutual information across views. arXiv preprint arXiv:1906.00910, 2019. 2, 6
227
+
228
+ Mohamed Ishmael Belghazi, Aristide Baratin, Sai Rajeswar, Sherjil Ozair, Yoshua Bengio, Aaron Courville, and R Devon Hjelm. Mine: mutual information neural estimation. arXiv preprint arXiv:1801.04062, 2018. 9
229
+
230
+ Aurelien Bellet, Amaury Habrard, and Marc Sebban. Similarity learning for provably accurate sparse ´ linear classification. arXiv preprint arXiv:1206.6476, 2012. 10
231
+
232
+ Yoshua Bengio, Aaron Courville, and Pascal Vincent. Representation learning: A review and new perspectives. IEEE transactions on pattern analysis and machine intelligence, 35(8):1798–1828, 2013. 10
233
+
234
+ Avrim Blum and Tom Mitchell. Combining labeled and unlabeled data with co-training. In Proceedings of the eleventh annual conference on Computational learning theory, pp. 92–100. ACM, 1998. 10
235
+
236
+ Piotr Bojanowski and Armand Joulin. Unsupervised learning by predicting noise. In Proceedings of the 34th International Conference on Machine Learning-Volume 70, pp. 517–526. JMLR. org, 2017. 16
237
+
238
+ Uta Buchler, Biagio Brattoli, and Bjorn Ommer. Improving spatiotemporal self-supervision by deep reinforcement learning. In Proceedings of the European Conference on Computer Vision (ECCV), pp. 770–786, 2018. 17, 21
239
+
240
+ Mathilde Caron, Piotr Bojanowski, Armand Joulin, and Matthijs Douze. Deep clustering for unsupervised learning of visual features. In Proceedings of the European Conference on Computer Vision (ECCV), pp. 132–149, 2018. 7
241
+
242
+ Adam Coates, Andrew Ng, and Honglak Lee. An analysis of single-layer networks in unsupervised feature learning. In Proceedings of the fourteenth international conference on artificial intelligence and statistics, pp. 215–223, 2011. 9, 15
243
+
244
+ Corinna Cortes, Mehryar Mohri, and Afshin Rostamizadeh. Learning non-linear combinations of kernels. In Advances in neural information processing systems, pp. 396–404, 2009. 10
245
+
246
+ Hanneke EM Den Ouden, Peter Kok, and Floris P De Lange. How prediction errors shape perception, attention, and motivation. Frontiers in psychology, 3:548, 2012. 1
247
+
248
+ Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. 2009. 7, 15
249
+
250
+ Carl Doersch, Abhinav Gupta, and Alexei A Efros. Unsupervised visual representation learning by context prediction. In Proceedings of the IEEE International Conference on Computer Vision, pp. 1422–1430, 2015. 7
251
+
252
+ Jeff Donahue, Philipp Krahenb ¨ uhl, and Trevor Darrell. Adversarial feature learning. In ¨ International Conference on Learning Representations, 2017. 7, 16
253
+
254
+ David Eigen and Rob Fergus. Predicting depth, surface normals and semantic labels with a common multi-scale convolutional architecture. In Proceedings of the IEEE international conference on computer vision, 2015. 7
255
+
256
+ Chuang Gan, Boqing Gong, Kun Liu, Hao Su, and Leonidas J Guibas. Geometry guided convolutional neural networks for self-supervised video representation learning. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 5589–5597, 2018. 17
257
+
258
+ Spyros Gidaris, Praveer Singh, and Nikos Komodakis. Unsupervised representation learning by predicting image rotations. arXiv preprint arXiv:1803.07728, 2018. 7
259
+
260
+ Melvyn A Goodale and A David Milner. Separate visual pathways for perception and action. Trends in neurosciences, 1992. 16
261
+
262
+ Ian Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. Generative adversarial nets. In Advances in neural information processing systems, pp. 2672–2680, 2014. 1, 10
263
+
264
+ Michael Gutmann and Aapo Hyvarinen. Noise-contrastive estimation: A new estimation principle ¨ for unnormalized statistical models. In Proceedings of the Thirteenth International Conference on Artificial Intelligence and Statistics, pp. 297–304, 2010. 3, 5, 10
265
+
266
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 770–778, 2016. 6
267
+
268
+ Olivier J Henaff, Ali Razavi, Carl Doersch, SM Eslami, and Aaron van den Oord. Data-efficient´ image recognition with contrastive predictive coding. arXiv preprint arXiv:1905.09272, 2019. 10
269
+
270
+ Geoffrey E Hinton and Ruslan R Salakhutdinov. Reducing the dimensionality of data with neural networks. science, 313(5786):504–507, 2006. 10
271
+
272
+ R Devon Hjelm, Alex Fedorov, Samuel Lavoie-Marchildon, Karan Grewal, Adam Trischler, and Yoshua Bengio. Learning deep representations by mutual information estimation and maximization. In International Conference on Learning Representations, 2019. 6, 7, 10, 14, 15, 16, 17, 18, 19
273
+
274
+ Jakob Hohwy. The predictive mind. Oxford University Press, 2013. 1
275
+
276
+ Aapo Hyvarinen, Juha Karhunen, and Erkki Oja. ¨ Independent component analysis, volume 46. John Wiley & Sons, 2004. 10
277
+
278
+ Phillip Isola, Daniel Zoran, Dilip Krishnan, and Edward H Adelson. Learning visual groups from co-occurrences in space and time. arXiv preprint arXiv:1511.06811, 2015. 10
279
+
280
+ Phillip Isola, Jun-Yan Zhu, Tinghui Zhou, and Alexei A Efros. Image-to-image translation with conditional adversarial networks. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 1125–1134, 2017. 10
281
+
282
+ Ian Jolliffe. Principal component analysis. Springer, 2011. 10
283
+
284
+ Diederik P Kingma and Max Welling. Auto-encoding variational bayes. arXiv preprint arXiv:1312.6114, 2013. 1, 10
285
+
286
+ Philipp Krahenb ¨ uhl, Carl Doersch, Jeff Donahue, and Trevor Darrell. Data-dependent initializations ¨ of convolutional neural networks. arXiv preprint arXiv:1511.06856, 2015. 7
287
+
288
+ Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton. Imagenet classification with deep convolutional neural networks. In Advances in neural information processing systems, pp. 1097–1105, 2012. 6, 14, 16, 20
289
+
290
+ Hsin-Ying Lee, Jia-Bin Huang, Maneesh Singh, and Ming-Hsuan Yang. Unsupervised representation learning by sorting sequences. In Proceedings of the IEEE International Conference on Computer Vision, pp. 667–676, 2017. 17, 21
291
+
292
+ Yingming Li, Ming Yang, and Zhongfei Mark Zhang. A survey of multi-view representation learning. IEEE Transactions on Knowledge and Data Engineering, 2018. 2, 10
293
+
294
+ Sungbin Lim, Ildoo Kim, Taesup Kim, Chiheon Kim, and Sungwoong Kim. Fast autoaugment. arXiv preprint arXiv:1905.00397, 2019. 20
295
+
296
+ Zelun Luo, Boya Peng, De-An Huang, Alexandre Alahi, and Li Fei-Fei. Unsupervised learning of long-term motion dynamics for videos. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 2203–2212, 2017. 17
297
+
298
+ David McAllester and Karl Statos. Formal limitations on the measurement of mutual information. arXiv preprint arXiv:1811.04251, 2018. 4
299
+
300
+ Ishan Misra, C Lawrence Zitnick, and Martial Hebert. Shuffle and learn: unsupervised learning using temporal order verification. In European Conference on Computer Vision, pp. 527–544. Springer, 2016. 17, 21
301
+
302
+ Andriy Mnih and Koray Kavukcuoglu. Learning word embeddings efficiently with noise-contrastive estimation. In Advances in neural information processing systems, pp. 2265–2273, 2013. 3, 5
303
+
304
+ Hossein Mobahi, Ronan Collobert, and Jason Weston. Deep learning from temporal coherence in video. In Proceedings of the 26th Annual International Conference on Machine Learning, pp. 737–744. ACM, 2009. 17
305
+
306
+ Pushmeet Kohli Nathan Silberman, Derek Hoiem and Rob Fergus. Indoor segmentation and support inference from rgbd images. In ECCV, 2012. 2, 7
307
+
308
+ Mehdi Noroozi and Paolo Favaro. Unsupervised learning of visual representations by solving jigsaw puzzles. In European Conference on Computer Vision, pp. 69–84. Springer, 2016. 7
309
+
310
+ Mehdi Noroozi, Hamed Pirsiavash, and Paolo Favaro. Representation learning by learning to count. In Proceedings of the IEEE International Conference on Computer Vision, pp. 5898–5906, 2017. 7
311
+
312
+ Aaron van den Oord, Nal Kalchbrenner, and Koray Kavukcuoglu. Pixel recurrent neural networks. arXiv preprint arXiv:1601.06759, 2016. 10
313
+
314
+ Aaron van den Oord, Yazhe Li, and Oriol Vinyals. Representation learning with contrastive predictive coding. arXiv preprint arXiv:1807.03748, 2018. 1, 3, 4, 5, 6, 10, 14, 15, 16, 18, 19
315
+
316
+ Andrew Owens, Phillip Isola, Josh McDermott, Antonio Torralba, Edward H Adelson, and William T Freeman. Visually indicated sounds. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 2405–2413, 2016. 3, 10
317
+
318
+ Deepak Pathak, Philipp Krahenbuhl, Jeff Donahue, Trevor Darrell, and Alexei A Efros. Context encoders: Feature learning by inpainting. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 2536–2544, 2016. 10
319
+
320
+ Ben Poole, Sherjil Ozair, Aaron van den Oord, Alexander A Alemi, and George Tucker. On variational bounds of mutual information. arXiv preprint arXiv:1905.06922, 2019. 4
321
+
322
+ Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In International Conference on Medical image computing and computerassisted intervention, pp. 234–241. Springer, 2015. 7
323
+
324
+ Virginia Sa. Sensory modality segregation. In Advances in neural information processing systems, pp. 913–920, 2004. 10
325
+
326
+ Ruslan Salakhutdinov and Geoffrey Hinton. Deep boltzmann machines. In Artificial intelligence and statistics, pp. 448–455, 2009. 1, 10
327
+
328
+ Nawid Sayed, Biagio Brattoli, and Bjorn Ommer. Cross and learn: Cross-modal self-supervision.¨ arXiv preprint arXiv:1811.03879, 2018. 17, 21
329
+
330
+ Gerald E Schneider. Two visual systems. Science, 1969. 16
331
+
332
+ Pierre Sermanet, Corey Lynch, Yevgen Chebotar, Jasmine Hsu, Eric Jang, Stefan Schaal, and Sergey Levine. Time-contrastive networks: Self-supervised learning from pixels. 2017. 10
333
+
334
+ Karen Simonyan and Andrew Zisserman. Two-stream convolutional networks for action recognition in videos. In Advances in neural information processing systems, pp. 568–576, 2014. 16
335
+
336
+ Linda Smith and Michael Gasser. The development of embodied cognition: Six lessons from babies. Artificial life, 11(1-2):13–29, 2005. 1
337
+
338
+ Paul Smolensky. Information processing in dynamical systems: Foundations of harmony theory. Technical report, Colorado Univ at Boulder Dept of Computer Science, 1986. 10
339
+
340
+ Khurram Soomro, Amir Roshan Zamir, and Mubarak Shah. Ucf101: A dataset of 101 human actions classes from videos in the wild. arXiv preprint arXiv:1212.0402, 2012. 16
341
+
342
+ Carl Vondrick, Hamed Pirsiavash, and Antonio Torralba. Generating videos with scene dynamics. In Advances In Neural Information Processing Systems, pp. 613–621, 2016. 17
343
+
344
+ Xiaolong Wang and Abhinav Gupta. Unsupervised learning of visual representations using videos. In Proceedings of the IEEE International Conference on Computer Vision, pp. 2794–2802, 2015. 10
345
+
346
+ Zhirong Wu, Yuanjun Xiong, Stella X Yu, and Dahua Lin. Unsupervised feature learning via nonparametric instance discrimination. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 3733–3742, 2018. 6, 7, 10, 19
347
+
348
+ Chang Xu, Dacheng Tao, and Chao Xu. A survey on multi-view learning. arXiv preprint arXiv:1304.5634, 2013. 2, 10
349
+
350
+ Christopher Zach, Thomas Pock, and Horst Bischof. A duality based approach for realtime tv-l 1 optical flow. In Joint pattern recognition symposium, pp. 214–223. Springer, 2007. 16
351
+
352
+ Liheng Zhang, Guo-Jun Qi, Liqiang Wang, and Jiebo Luo. Aet vs. aed: Unsupervised representation learning by auto-encoding transformations rather than data. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 2547–2555, 2019. 7, 10
353
+
354
+ Richard Zhang, Phillip Isola, and Alexei A Efros. Colorful image colorization. In European conference on computer vision, pp. 649–666. Springer, 2016. 3, 6, 7, 10
355
+
356
+ Richard Zhang, Phillip Isola, and Alexei A Efros. Split-brain autoencoders: Unsupervised learning by cross-channel prediction. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 1058–1067, 2017. 3, 6, 7, 8, 10, 14, 15, 16
357
+
358
+ Chengxu Zhuang, Alex Lin Zhai, and Daniel Yamins. Local aggregation for unsupervised learning of visual embeddings. arXiv preprint arXiv:1903.12355, 2019. 10
359
+
360
+ # A ADDITIONAL EXPERIMENTS
361
+
362
+ # A.1 CMC ON IMAGES
363
+
364
+ Given a dataset of RGB images, we convert them to the Lab image color space, and split each image into $L$ and $a b$ channels, as originally proposed in SplitBrain autoencoders (Zhang et al., 2017). During contrastive learning, L and ab from the same image are treated as the positive pair, and ab channels from other randomly selected images are treated as a negative pair (for a given L). Each split represents a view of the orginal image and is passed through a seprate encoder. This corresponds to the “full graph” model of Eq. 8 with L and ab channels as the two views. As in SplitBrain, we design these two encoders by evenly splitting a given deep network, such as AlexNet (Krizhevsky et al., 2012), into sub-networks across the channel dimension. By concatenating representations layer-wise from these two encoders, we achieve the final representation of an input image. As proposed by previous literature (Oord et al., 2018; Hjelm et al., 2019; Arora et al., 2019), the quality of such a representation is evaluated by freezing the weights of encoder and training linear or non-linear classifiers on top of each layer.
365
+
366
+ # A.1.1 STL-10
367
+
368
+ STL-10 (Coates et al., 2011) is an image recognition dataset designed for developing unsupervised or self-supervised learning algorithms. It consists of 100000 unlabeled training $9 6 \times 9 6$ RGB image samples and 500 labeled samples for each of the 10 classes.
369
+
370
+ Setup. We adopt the same data augmentation strategy and network architecture as those in DIM (Hjelm et al., 2019). A variant of AlexNet takes as input $6 4 \times 6 4$ images, which are randomly cropped and horizontally flipped from the original $9 6 \times 9 6$ size images. For a fair comparison with DIM, we also train our model in a patch-based contrastive fashion during unsupervised pretraining. With the weights of the pre-trained encoder frozen, a two-layer fully connected network with 200 hidden units is trained on top of different layers for 100 epochs to perform 10-way classification. We also investigated the strided crop strategy of CPC (Oord et al., 2018). Fixed sized overlapping patches of size $1 6 \times 1 6$ with an overlap of 8 pixels are cropped and fed into the network separately. This ensures that features of one patch contain minimal information from neighbouring patches; and increases the available number of negative pairs for the contrastive loss. Additionally, we include NCE-based contrastive training and linear classifier evaluation.
371
+
372
+ Comparison. We compare CMC with the state of the art unsupervised methods in Table 5. Three columns are shown: the conv5 and fc7 columns use respectively these layers of AlexNet as the encoder (again remembering that we split across channels for L and ab views). For these two columns we can compare against the all methods except CPC, since CPC does not report these numbers in their paper (Hjelm et al., 2019). In the Strided Crop setup, we only compare against the approaches that use contrastive learning, DIM and CPC, since this method was only used by those works. We note that in Table 5 for all the methods except SplitBrain, we report numbers are shown in the original paper. For SplitBrain, we reimplemented their model faithfully and report numbers based on our reimplementation (we verified the accuracy of our SplitBrain code by the fact that we get very similar results with our reimpementation as in the original paper (Zhang et al., 2017) for ImageNet experiments, see below).
373
+
374
+ The family of contrastive learning methods, such as DIM, CPC, and CMC, achieve higher classification accuracy than other methods such as SplitBrain that use predictive learning; or BiGAN that use adversarial learning. CMC significantly outperforms DIM and CPC in all cases. We hypothesize that this outperformance results from the modeling of cross-view mutual information, where view-specific noisy details are discarded. Another head-to-head comparison happens between CMC and SplitBrain, both of which modeling images as seprated $\mathrm { L }$ and ab streams; we achieve a nearly $8 \%$ absolute improvement for conv5 and $1 \bar { 7 } \%$ improvement for fc5. Finally, we notice that the predictive learning methods suffer from a big drop in performance when the encoding layer is switched from conv5 to fc7. On the other hand, the contrastive learning approaches are much more stable across layers, suggesting that the mutual information maximization paradigm learns more semantically meaningful representations shared by the different views. From a practical perspective, this is a significant advantage as the selection of specific layers should ideally not change downstream performance by too much.
375
+
376
+ In this experiments we used AlexNet as backbone. Switching to more powerful networks such as ResNets is likely to further improve the representation quality.
377
+
378
+ # A.1.2 IMAGENET
379
+
380
+ ImageNet (Deng et al., 2009) consists of 1000 image classes and is frequently considered as a testbed for unsupervised representation learning algorithms.
381
+
382
+ Effect of the number of negative samples. We investigate the relationship between the number of negative pairs $m$ in NCE-based loss and the downstream classification accuracy on a randomly chosen subset of 100 classes of Imagenet (the same set of classes is used for any number of negative pairs). We train a 100-way linear classifier using CMC pre-trained features with varying number of negative pairs, starting from 64 pairs upto 8192 (in multiples of 2). Fig. 6 shows that the accuracy of the resulting classifier steadily increases but saturates at around $6 0 . { \bar { 3 } } \%$ with $m = 4 0 9 6$ samples. AlexNet is used in this study.
383
+
384
+ <table><tr><td rowspan=1 colspan=1>Method</td><td rowspan=1 colspan=1>classifier</td><td rowspan=1 colspan=1>conv5 fc7</td><td rowspan=1 colspan=1>Strided Crop</td></tr><tr><td rowspan=1 colspan=1>AENAT (Bojanowski &amp; Joulin, 2017)BiGAN (Donahue et al., 2017)SplitBraint (Zhang et al., 2017)</td><td rowspan=1 colspan=1>MLP</td><td rowspan=1 colspan=1>62.19 55.7864.32 61.4371.53 67.1872.35 63.15</td><td rowspan=1 colspan=1>--</td></tr><tr><td rowspan=1 colspan=1>DIM (Hjelm et al., 2019)CPC (Oord et al., 2018)</td><td rowspan=1 colspan=1>MLP</td><td rowspan=1 colspan=1>72.57 70.00- -</td><td rowspan=1 colspan=1>78.2177.81</td></tr><tr><td rowspan=1 colspan=1>CMC+(Patch)CMC+ (Patch)CMC+(NCE)CMC+(NCE)</td><td rowspan=1 colspan=1>LinearMLPLinearMLP</td><td rowspan=1 colspan=1>76.65 79.2580.14 80.1183.28 86.6684.64 86.88</td><td rowspan=1 colspan=1>82.5883.43--</td></tr><tr><td rowspan=1 colspan=1>Supervised</td><td rowspan=1 colspan=3>68.70</td></tr></table>
385
+
386
+ ![](images/b07c045585ce5a17a33bf165d12d05a57188c07fe931c18816160f8d8f8a1442.jpg)
387
+ Table 5: Classification accuracies on STL-10 by using a two layer MLP as classifier for evaluating the representations learned by a small AlexNet. For all methods we compare against, we include the numbers that are reported in the DIM (Hjelm et al., 2019) paper, except for SplitBrain, which is our reimplementation. Methods marked with † have half the number of parameters because of splitting.
388
+ Figure 6: We plot the number of negative examples $m$ in NCE-based contrastive loss against the accuracy for 100 randomly chosen classes of Imagenet 100. It is seen that the accuracy steadily increases with $m$ .
389
+
390
+ # A.2 CMC ON VIDEOS
391
+
392
+ We apply CMC on videos by drawing insight from the two-streams hypothesis (Schneider, 1969; Goodale & Milner, 1992), which posits that human visual cortex consists of two distinct processing streams: the ventral stream, which performs object recognition, and the dorsal stream, which processes motion. In our formulation, given an image $i _ { t }$ that is a frame centered at time $t$ , the ventral stream associates it with a neighbouring frame $i _ { t + k }$ , while the dorsal stream connects it to optical flow $f _ { t }$ centered at $t$ . Therefore, we extract $i _ { t }$ , $i _ { t + k }$ and $f _ { t }$ from two modalities as three views of a video; for optical flow we use the TV-L1 algorithm (Zach et al., 2007). Two separate contrastive learning objectives are built within the ventral stream $( i _ { t } , i _ { t + k } )$ and within the dorsal stream $( i _ { t } , f _ { t } )$ . For the ventral stream, the negative sample for $i _ { t }$ is chosen as a random frame from another randomly chosen video; for the dorsal stream, the negative sample for $i _ { t }$ is chosen as the flow corresponding to a random frame in another randomly chosen video.
393
+
394
+ Pre-training. We train CMC on UCF101 (Soomro et al., 2012) and use two CaffeNets (Krizhevsky et al., 2012) for extracting features from images and optical flows, respectively. In our implementation, $f _ { t }$ represents 10 continuous flow frames centered at $t$ . We use batch size of 128 and contrast each positive pair with 127 negative pairs. CMC is trained with Adam for 300 epochs, with an initial learning rate of 0.001 which is decayed by a factor of 5 after 200 and 250 epochs.
395
+
396
+ Action recognition. We apply the learn representation to the task of action recognition. The spatial network from (Simonyan & Zisserman, 2014) is a well-established paradigm for evaluating pre-trained RGB network on action recognition task. We follow the same spirit and evaluate the transferability of our RGB CaffeNet on UCF101 and HMDB51 datasets. We initialize the action recognition CaffeNet up to conv5 using the weights from the pre-trained RGB CaffeNet. The averaged accuracy over three splits is present in Table 6. Unifying both ventral and dorsal streams during pre-training produces higher accuracy for downstream recognition than using only single stream. Increasing the number of views of the data from 2 to 3 (using both streams instead of one) provides a boost for UCF-101. Furthermore, on UCF-101, we outperform all other methods; and on HMDB-51, CMC is second-best in performance.
397
+
398
+ Table 6: Test accuracy $( \% )$ on UCF-101 which evaluates task transferability and on HMDB-51 which evaluates task and dataset transferability. Most methods either use single RGB view or additional optical flow view, while VGAN explores sound as the second view. \* indicates different network architecture.
399
+
400
+ <table><tr><td rowspan=1 colspan=1>Method</td><td rowspan=1 colspan=1>#ofViews UCF-101 HMDB-51</td></tr><tr><td rowspan=1 colspan=1>RandomImageNet</td><td rowspan=1 colspan=1>1 48.2 19.51 67.7 28.0</td></tr><tr><td rowspan=1 colspan=1>VGAN* (Vondrick et al.,2016)LT-Motion* (Luo et al., 2017)</td><td rowspan=1 colspan=1>2 52.1 -2 53.0 -</td></tr><tr><td rowspan=6 colspan=1>TempCoh (Mobahi et al., 2009)Shuffle and Learn (Misra et al., 2016)Geometry (Gan et al., 2018)OPN (Lee et al., 2017)ST Order (Buchler et al., 2018)Cross and Learn (Sayed et al., 2018)</td><td rowspan=1 colspan=1>1 45.4 15.9</td></tr><tr><td rowspan=1 colspan=1>1 50.2 18.1</td></tr><tr><td rowspan=1 colspan=1>2 55.1 23.3</td></tr><tr><td rowspan=1 colspan=1>1 56.3 22.1</td></tr><tr><td rowspan=1 colspan=1>1 58.6 25.0</td></tr><tr><td rowspan=1 colspan=1>2 58.7 27.2</td></tr><tr><td rowspan=3 colspan=1>CMC (V)CMC (D)CMC (V+D)</td><td rowspan=1 colspan=1>2 55.3 -</td></tr><tr><td rowspan=1 colspan=1>2 57.1 1</td></tr><tr><td rowspan=1 colspan=1>3 59.1 26.7</td></tr></table>
401
+
402
+ Table 7: Performance on the task of using single view $v$ to predict the semantic labels, where $v$ can be L, ab, depth or surface normal. Our CMC framework improves the quality of unsupervised representations towards that of supervised ones, for all of views investigated. This uses the full-graph paradigm Fig. ??(b).
403
+
404
+ <table><tr><td></td><td>Metric (%)</td><td>L ab</td><td>Depth</td><td>Normal</td></tr><tr><td>Random</td><td>mIoU pix. acc.</td><td>21.4 15.6 45.5 37.7</td><td>30.1 51.1</td><td>29.5 50.5</td></tr><tr><td>CMC</td><td>mIoU pix. acc.</td><td>34.4 26.1 57.0 49.6</td><td>39.2 59.4</td><td>37.8 57.8</td></tr><tr><td>Supervised</td><td>mIoU pix. acc.</td><td>35.9 29.6 57.8 52.6</td><td>41.0 59.1</td><td>41.5 59.6</td></tr></table>
405
+
406
+ # A.3 IS CMC IMPROVING ALL VIEWS?
407
+
408
+ A desirable unsupervised representation learning algorithm operating on multiple views or modalities should improve the quality of representations for all views. We therefore investigate our CMC framwork beyond L channel. To treat all views fairly, we train these encoders following the full graph paradigm, where each view is contrasted with all other views.
409
+
410
+ We evaluate the representation of each view $v$ by predicting the semantic labels from only the representation of $v$ , where $v$ is $\mathrm { L }$ , ab, depth or surface normals. This uses the full-graph paradigm. As in the previous section, we compare CMC with Random and Supervised baselines. As shown in Table 7, the performance of the representations learned by CMC using full-graph significantly outperforms that of randomly projected representations, and approaches the performance of the fully supervised representations. Furthermore, the full-graph representation provides a good representation learnt for all views, showing the importance of capturing different types of mutual information across views.
411
+
412
+ # B CONTRASTING SUB-PATCHES
413
+
414
+ Instead of contrasting features from the last layer, patch-based method (Hjelm et al., 2019) contrasts feature from the last layer with features from previous layers, hence increasing the number of negative pairs. For instance, we use features from the last layer of $f _ { \theta _ { 1 } }$ to contrast with feature points from feature maps produced by the first several conv layers of $f _ { \boldsymbol { \theta _ { 2 } } }$ . This is equivalent to contrast between global patch from one view with local patches from the other view. In this fashion, we directly perform $m + 1$ way softmax classification, the same as (Oord et al., 2018; Hjelm et al., 2019) for a fair comparison in Sec. A.1.1.
415
+
416
+ Such patch-based contrastive loss is computed within each mini-batch and does not require a memory bank. Therefore, deploying it in parallel training schemes is easy and flexible. However, patch-based contrastive loss usually yields suboptimal results compared to NCE-based contrastive loss, according to our experiments.
417
+
418
+ # C PROOFS
419
+
420
+ We prove that: (a) the optimal score function $h _ { \theta } ^ { \ast } ( \{ v _ { 1 } , v _ { 2 } \} )$ is proportional to density ratio between the joint distribution $p ( v _ { 1 } , v _ { 2 } )$ and product of marginals $p ( v _ { 1 } ) p ( v _ { 2 } )$ , as shown in Eq. 5; (b) Minimizing the contrastive loss $\mathcal { L } _ { c o n t r a s t }$ maxmizes a lower bound on the mutual information between two views, as shown in Eq. 6
421
+
422
+ We will use the most generBut we note that replacing of cowith loss is s $\mathcal { L } _ { c o n t r a s t }$ shown in Eq. 1 for our derivation.ward. The overall proof follows a $\mathcal { L } _ { c o n t r a s t }$ $\mathcal { L } _ { c o n t r a s t } ^ { V _ { 1 } , V _ { 2 } }$
423
+ similar derivation introduced in (Oord et al., 2018).
424
+
425
+ # C.1 SCORE FUNCTION AS DENSITY RATIO ESTIMATOR
426
+
427
+ We first show that the optimal score function $h _ { \theta } ^ { \ast } ( \{ v _ { 1 } , v _ { 2 } \} )$ that minimizes Eq. 1 is proportional to the density ratio between joint distribution and product of marginals, shown as Eq. 5. For notation convenience, we denote $p ( v _ { 1 } , v _ { 2 } )$ as data distribution $p _ { d } ( \cdot )$ and $p ( v _ { 1 } ) p ( v _ { 2 } )$ as noise distribution $p _ { n } ( \cdot )$ . The loss in Eq. 1 is indeed a cross-entropy loss of classifying the correct positive pair out from the given set $S$ . Without loss of generality, we assume the first pair $( v _ { 1 } ^ { 0 } , v _ { 2 } ^ { 0 } )$ in $S$ is positive or congruent and all others $( v _ { 1 } ^ { i } , v _ { 2 } ^ { i } ) , i = \bar { 1 } , 2 , . . . , k$ are negative or incongruent. The optimal probability for the loss, $p ( p o s = \dot { 0 } | \bar { S } )$ , should depict the fact that $( v _ { 1 } ^ { 0 } , v _ { 2 } ^ { 0 } )$ comes from the data distribution $p _ { d } ( \cdot )$ while all other pairs come from the noise distribution $p _ { n } ( \cdot )$ . Therefore,
428
+
429
+ $$
430
+ \begin{array} { r c l } { p ( p o s = 0 | S ) } & { = } & { \frac { p _ { d } ( v _ { 1 } ^ { 0 } , v _ { 2 } ^ { 0 } ) \prod _ { i = 1 } ^ { k } p _ { n } ( v _ { 1 } ^ { i } , v _ { 2 } ^ { i } ) } { \sum _ { j = 0 } ^ { k } p _ { d } ( v _ { 1 } ^ { j } , v _ { 2 } ^ { j } ) \prod _ { i \neq j } p _ { n } ( v _ { 1 } ^ { i } , v _ { 2 } ^ { i } ) } } \\ & { = } & { \frac { p ( v _ { 1 } ^ { 0 } , v _ { 2 } ^ { 0 } ) \prod _ { i = 1 } ^ { k } p ( v _ { 1 } ^ { i } ) p ( v _ { 2 } ^ { i } ) } { \sum _ { j = 0 } ^ { k } p ( v _ { 1 } ^ { j } , v _ { 2 } ^ { j } ) \prod _ { i \neq j } p ( v _ { 1 } ^ { i } ) p ( v _ { 2 } ^ { i } ) } } \\ & { = } & { \frac { p ( v _ { 1 } ^ { 0 } , v _ { 2 } ^ { 0 } ) } { \sum _ { j = 0 } ^ { k } \frac { p ( v _ { 1 } ^ { 0 } ) p ( v _ { 2 } ^ { 0 } ) } { p ( v _ { 1 } ^ { 0 } ) p ( v _ { 2 } ^ { k } ) } } } \end{array}
431
+ $$
432
+
433
+ where we plug in the definition of $p _ { d } ( \cdot )$ and $p _ { n } ( \cdot )$ , and divide $\textstyle \prod _ { i = 0 } ^ { k } p ( v _ { 1 } ^ { i } ) p ( v _ { 2 } ^ { 2 } )$ for both the numerator and denominator. By comparing above equation with the loss function in Eq. 1, we can see that the optimal score function $h _ { \theta } ^ { \ast } ( \{ v _ { 1 } , v _ { 2 } \} )$ is proportional to the density ratio $\displaystyle \frac { p ( \boldsymbol { v } _ { 1 } , \boldsymbol { v } _ { 2 } ) } { p ( \boldsymbol { v } _ { 1 } ) p ( \boldsymbol { v } _ { 2 } ) }$ . The above derivation is agnostic to which layer the score function starts from, e.g., $h$ can be defined on either the raw input $( v _ { 1 } , v _ { 2 } )$ or the latent representation $( z _ { 1 } , z _ { 2 } )$ . As we care more about the property of the latent representation, for the following derivation we will use $h _ { W _ { 1 2 } } ^ { * } ( \{ z _ { 1 } , z _ { 2 } \} )$ , which is proportional to $\frac { p ( z _ { 1 } , z _ { 2 } ) } { p ( z _ { 1 } ) p ( z _ { 2 } ) }$
434
+ .
435
+
436
+ # C.2 MAXIMIZING LOWER BOUND ON MI
437
+
438
+ Now we substitute the score function in Eq. 1 with the above density ratio, and the optimal loss objective $\mathcal { L } _ { c o n t r a s t } ^ { o p t }$ becomes:
439
+
440
+ $$
441
+ \begin{array} { r l } { C _ { \mathrm { e x c a n s e s , \alpha } } ^ { ( * ) } } & { = - \frac { \alpha _ { 0 } ^ { 2 } \log [ \alpha _ { 1 } ^ { 2 } ( \frac { \alpha _ { 1 } ^ { 2 } \alpha _ { 2 } ^ { 2 } \sigma _ { 2 } ^ { 2 } } { \sigma _ { 1 } ^ { 2 } \sigma _ { 2 } ^ { 2 } } ) ] } { \sigma _ { 1 } ^ { 2 } } } \\ & { = - \frac { \alpha _ { 0 } ^ { 2 } \log [ \alpha _ { 1 } ^ { 2 } ( \frac { \gamma _ { 1 } ^ { 2 } \sigma _ { 2 } ^ { 2 } \sigma _ { 1 } ^ { 2 } } { \sigma _ { 1 } ^ { 2 } \sigma _ { 2 } ^ { 2 } } ) ] } { \sigma _ { 1 } ^ { 2 } } } \\ & { = \ \frac { \gamma _ { 1 } ^ { 2 } \log [ \alpha _ { 1 } ^ { 2 } - \frac { \gamma _ { 1 } ^ { 2 } \sigma _ { 1 } ^ { 2 } \sigma _ { 1 } ^ { 2 } } { \sigma _ { 1 } ^ { 2 } \sigma _ { 2 } ^ { 2 } } ] } { \sigma _ { 1 } ^ { 2 } \sigma _ { 2 } ^ { 2 } } } \\ & { = \ \frac { \gamma _ { 2 } ^ { 2 } \log [ 1 + \frac { \gamma _ { 1 } ^ { 2 } \sigma _ { 1 } ^ { 2 } \sigma _ { 1 } ^ { 2 } \sigma _ { 1 } ^ { 2 } } { \sigma _ { 1 } ^ { 2 } \sigma _ { 2 } ^ { 2 } } ] } { \sigma _ { 1 } ^ { 2 } \sigma _ { 1 } ^ { 2 } } \frac { \gamma _ { 1 } ^ { 2 } ( \frac { \alpha _ { 1 } ^ { 2 } \sigma _ { 2 } ^ { 2 } \sigma _ { 1 } ^ { 2 } } { \sigma _ { 1 } ^ { 2 } \sigma _ { 2 } ^ { 2 } } ) } { \sigma _ { 1 } ^ { 2 } \sigma _ { 2 } ^ { 2 } } } \\ & \stackrel { ( * ) } { = } \ \frac { \gamma _ { 2 } ^ { 2 } \operatorname { m a x } [ 1 + \frac { \gamma _ { 1 } ^ { 2 } \sigma _ { 1 } ^ { 2 } \sigma _ { 1 } ^ { 2 } } { \sigma _ { 1 } ^ { 2 } \sigma _ { 1 } ^ { 2 } \sigma _ { 1 } ^ { 2 } } ] } \\ & = \ \frac \gamma _ { 1 } ^ { 2 } \operatorname { m a x } [ \alpha _ { 1 } ^ \end{array}
442
+ $$
443
+
444
+ herefore, for any two views increases, the approximatio $V _ { i }$ and tep b $V _ { j }$ , we have omes mor $I ( z _ { i } ; z _ { j } ) \geq \log ( k ) - \mathcal { L } _ { c o n t r a s t } ^ { o p t } ( V _ { i } , V _ { j } )$ $k$ $k$ $\overset { \cdot } { \mathcal { L } } _ { k } ( V _ { i } , V _ { j } )$ maximizes the lower bound on the mutual information $I ( z _ { i } ; z _ { j } )$ . We should note that increasing $k$ to infinity does not always lead to a higher lower bound. While $\log ( k )$ increases with a larger $k$ , the optimization problem becomes harder and $\mathcal { L } _ { k } ( V _ { i } , V _ { j } )$ also increases.
445
+
446
+ # D IMPLEMENTATION DETAILS
447
+
448
+ # D.1 STL-10
449
+
450
+ For a fair comparison with DIM (Hjelm et al., 2019) and CPC (Oord et al., 2018), we adopt the same architecture as that used in DIM and split it into two encoders, each shown as in Table 8. For the implementation of the score function, we adopt similar “encoder-and-dot-product” strategy, which is tantamount to a bilinear model.
451
+
452
+ In the patch-based contrastive learning stage, we use Adam optimizer with an initial learning rate of 0.001, $\beta _ { 1 } = 0 . 5$ , $\beta _ { 2 } = 0 . 9 9 9$ . We train for a total of 200 epochs with learning rate decayed by 0.2 after 120 and 160 epochs. In the non-linear classifier evaluation stage, we use the same optimizer setting. For the NCE-based contrastive learning stage, we train for 320 epochs with the learning rate initialized as 0.03 and further decayed by 10 for every 40 epochs after the first 200 epochs. The temperature $\tau$ is set as 0.1. In general, $\dot { \tau } \in [ \dot { 0 } . 0 5 , 0 . 2 ]$ works reasonably well.
453
+
454
+ # D.2 IMAGENET
455
+
456
+ For patch-based contrastive loss, we use the same optimizer setting as in Sec. D.1 except that the learning rate is initialized as 0.01.
457
+
458
+ For NCE-basd contrastive loss in both full ImageNet and ImageNet100 experiments present in Sec. A.1.2, the encoder architecture used for either $\mathrm { L }$ or ab channels is shown in Table 9. In the unsupervised learning stage of AlexNet, we use SGD to train the network for a total of 400 epochs. The temperature $\tau$ is set as 0.07 by following previous work (Wu et al., 2018). The learning rate is initialized as 0.03 with a decay of 10 for every 50 epochs after the first 250 epochs. Weight decay is
459
+
460
+ Table 8: The variant of AlexNet architecture used in our CMC for STL-10 (only half is present here due to splitting). $\mathbf { X }$ spatial resolution of layer, C number of channels in layer; K conv or pool kernel size; S computation stride; $\mathbf { P }$ padding; \* channel size is dependent on the input source, e.g. 1 for L channel and 2 for ab channel.
461
+
462
+ <table><tr><td colspan="6">Half of AlexNet(Krizhevsky et al., 2012) for STL-10</td></tr><tr><td>Layer</td><td>X</td><td>C</td><td>K</td><td>S</td><td>P</td></tr><tr><td>data</td><td>64</td><td>*</td><td>1</td><td>1</td><td>1</td></tr><tr><td>conv1</td><td>64</td><td>48</td><td>3</td><td>1</td><td>1</td></tr><tr><td>pool1</td><td>31</td><td>48</td><td>3</td><td>2</td><td>0</td></tr><tr><td>conv2</td><td>31</td><td>96</td><td>3</td><td>1</td><td>1</td></tr><tr><td>pool2</td><td>15</td><td>96</td><td>3</td><td>2</td><td>0</td></tr><tr><td>conv3</td><td>15</td><td>192</td><td>3</td><td>1</td><td>1</td></tr><tr><td>conv4</td><td>15</td><td>192</td><td>3</td><td>1</td><td>1</td></tr><tr><td>conv5</td><td>15</td><td>96</td><td>3</td><td>1</td><td>1</td></tr><tr><td>pool5</td><td>7</td><td>96</td><td>3</td><td>2</td><td>0</td></tr><tr><td>fc6</td><td>1</td><td>2048</td><td>7</td><td>1</td><td>0</td></tr><tr><td>fc7</td><td>1</td><td>2048</td><td>1</td><td>1</td><td>0</td></tr><tr><td>fc8</td><td>1</td><td>64</td><td>1</td><td>1</td><td>0</td></tr></table>
463
+
464
+ set as $1 0 ^ { - 4 }$ and momentum is kept as 0.9. For the linear classification stage, we train for 160 epochs.
465
+ The learning rate is initialized as 0.1 and decayed by 0.2 every 20 epochs after the first 100 epochs.
466
+ We set weight decay as 0 and momentum as 0.9.
467
+
468
+ For ResNets in CMC stage, there are three differences. First, we use larger learning rate, that is, we set a base learning rate of 0.03 for every 128 images and then roughly scale it up with the batch size. Specifically, we train: (1) ResNet-50 with $b s z = 2 8 0$ and $l r = 0 . 0 8$ ; (2) ResNet-101 with $b s z = 2 0 0$ and $l r = 0 . 0 5$ ; (3) ResNet- $5 0 ~ \mathrm { x } 2 $ with $b s z = 1 5 6$ and $l r = 0 . 0 4$ . Second, we only train for 280 epochs with learning rate decayed at 160, 200, and 240 epochs. Third, we used Fast Autoaugment (Lim et al., 2019) as data augmentation. In the linear evaluation stage, we train for 100 epochs. The learning rate is initialized as 30 for ResNet-50 and ResNet-101, and 50 for ResNet-50 $_ { \mathbf { X } 2 }$ . It is decayed by 0.2 every 15 epochs after the first 60 epochs. We set weight decay as 0 and momentum as 0.9.
469
+
470
+ <table><tr><td colspan="6">Half of AlexNet(Krizhevsky et al., 2012) for ImageNet</td></tr><tr><td>Layer</td><td>X</td><td>C</td><td>K</td><td>S</td><td>P</td></tr><tr><td>data</td><td>224</td><td>*</td><td>1</td><td>1</td><td>1</td></tr><tr><td>conv1</td><td>55</td><td>48</td><td>11</td><td>4</td><td>2</td></tr><tr><td>pool1</td><td>27</td><td>48</td><td>3</td><td>2</td><td>0</td></tr><tr><td>conv2</td><td>27</td><td>128</td><td>5</td><td>1</td><td>2</td></tr><tr><td>pool2</td><td>13</td><td>128</td><td>3</td><td>2</td><td>0</td></tr><tr><td>conv3</td><td>13</td><td>192</td><td>3</td><td>1</td><td>1</td></tr><tr><td>conv4</td><td>13</td><td>192</td><td>3</td><td>1</td><td>1</td></tr><tr><td>conv5</td><td>13</td><td>128</td><td>3</td><td>1</td><td>1</td></tr><tr><td>pool5</td><td>6</td><td>128</td><td>3</td><td>2</td><td>0</td></tr><tr><td>fc6</td><td>1</td><td>2048</td><td>6</td><td>1</td><td>0</td></tr><tr><td>fc7</td><td>1</td><td>2048</td><td>1</td><td>1</td><td>0</td></tr><tr><td>fc8</td><td>1</td><td>128</td><td>1</td><td>1</td><td>0</td></tr></table>
471
+
472
+ # D.3 UCF101 AND HMDB51
473
+
474
+ Following previous work (Misra et al., 2016; Lee et al., 2017; Sayed et al., 2018; Buchler et al., 2018), we use CaffeNet for the video experiments. We tailor the network and use features from the fc6 layer for contrastive learning. Dropout of 0.5 is used to alleviate overfitting.
475
+
476
+ # D.4 NYU DEPTH-V2
477
+
478
+ While experimenting with different views on NYU Depth-V2 dataset, we encode the features from patches with a size of $1 2 8 \times 1 2 8$ . The detailed architecture is shown in Table 10. In the unsupervised training stage, we use Adam optimizer with an initial learning rate of 0.001, $\beta _ { 1 } = 0 . 5$ , $\beta _ { 2 } = 0 . 9 9 9$ . We train for a total of 3000 epochs with learning rate decayed by 0.2 after 2000, 2400, and 2800 epochs. For the downstream semantic segmentation task, we use the same optimizer setting but train for fewer epochs. We only train 200 epochs for CMC pre-trained models, and train 1000 epochs for the Random and Supervised baselines until convergence. For the classification task evaluated on STL-10, we use the same optimizer setting as in Sec. D.1 to report numbers in Table 2.
479
+
480
+ <table><tr><td colspan="5">Encoder Architecture on NYU</td></tr><tr><td>Layer</td><td>X</td><td>C</td><td>K</td><td>S P</td></tr><tr><td>data</td><td>128</td><td>*</td><td>1</td><td></td></tr><tr><td>conv1</td><td>64</td><td>64</td><td>8 2</td><td>3</td></tr><tr><td>pool1</td><td>32</td><td>64</td><td>2 2</td><td>0</td></tr><tr><td>conv2</td><td>16</td><td>128</td><td>4 2</td><td>1</td></tr><tr><td>conv3</td><td>8</td><td>256</td><td>4 2</td><td>1</td></tr><tr><td>conv4</td><td>8</td><td>256</td><td>3 1</td><td>1</td></tr><tr><td>conv5</td><td>4</td><td>512</td><td>4 2</td><td></td></tr><tr><td>fc6</td><td>1</td><td>512</td><td>4</td><td>0</td></tr><tr><td>fc7</td><td>1</td><td>256</td><td>1 1</td><td>0</td></tr></table>
md/train/BkgWHnR5tm/BkgWHnR5tm.md ADDED
@@ -0,0 +1,462 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # NEURAL GRAPH EVOLUTION: TOWARDS EFFICIENT AUTOMATIC ROBOT DESIGN
2
+
3
+ Tingwu Wang1,2∗, Yuhao Zhou1,2∗, Sanja Fidler1,2,3 & Jimmy $\mathbf { B a } ^ { 1 , 2 }$
4
+
5
+ 1 Department of Computer Science, University of Toronto
6
+ 2 Vector Institute
7
+ 3 NVIDIA
8
+ {tingwuwang,henryzhou,fidler,jba}@cs.toronto.e
9
+
10
+ # ABSTRACT
11
+
12
+ Despite the recent successes in robotic locomotion control, the design of robots, i.e., the design of their body structure, still heavily relies on human engineering. Automatic robot design has been a long studied subject, however, progress has been slow due to large combinatorial search space and the difficulty to efficiently evaluate the candidate structures. Note that one needs to both, search over many possible body structures, and choose among them based on how the robot with that structure performs in an environment. The latter means training an optimal controller given a candidate structure, which in itself is costly to obtain. In this paper, we propose Neural Graph Evolution (NGE), which performs evolutionary search in graph space, by iteratively evolving graph structures using simple mutation primitives. Key to our approach is to parameterize the control policies with graph neural networks, which allows us to transfer skills from previously evaluated designs during the graph search. This significantly reduces evaluation cost of new candidates and makes the search process orders of magnitude more efficient than that of past work. In addition, NGE applies Graph Mutation with Uncertainty (GM-UC) by incorporating model uncertainty, which reduces the search space by balancing exploration and exploitation. We show that NGE significantly outperforms previous methods in terms of convergence rate and final performance. As shown in experiments, NGE is the first algorithm that can automatically discover kinematically preferred robotic graph structures, such as a fish with two symmetric flat side-fins and a tail, or a cheetah with athletic front and back legs. NGE is extremely efficient, it finds plausible robotic structures within a day on a single 64 CPU-core Amazon EC2 machine.
13
+
14
+ # 1 INTRODUCTION
15
+
16
+ The goal of robot design is to find an optimal body structure and its means of locomotion to best achieve a given objective in an environment. Robot design often relies on careful human-engineering and expert knowledge. The field of automatic robot design aims to search for these structures automatically. This has been a long-studied subject, however, with limited success. There are two major challenges: 1) the search space of all possible designs is large and combinatorial, and 2) the evaluation of each design requires learning or testing a separate optimal controller that is often expensive to obtain.
17
+
18
+ In (Sims, 1994), the authors evolved creatures with 3D-blocks. Recently, soft robots have been studied in (Joachimczak et al., 2014), which were evolved by adding small cells connected to the old ones. In (Cheney et al., 2014), the 3D voxels were treated as the minimum element of the robot. Most evolutionary robots (Duff et al., 2001; Neri, 2010) require heavy engineering of the initial structures, evolving rules and careful human-guidance. Due to the combinatorial nature of the problem, evolutionary, genetic or random structure search have been the de facto algorithms of automatic robot design in the pioneering works (Sims, 1994; Steels, 1993; Mitchell & Forrest, 1994; Langton, 1997; Lee, 1998; Taylor, 2017; Calandra et al., 2016). In terms of the underlying algorithm, most of these works have a similar population-based optimization loop to the one used in (Sims, 1994). None of these algorithms are able to evolve kinematically reasonable structures, as a result of large search space and the inefficient evaluation of candidates.
19
+
20
+ Similar in vein to automatic robot design, automatic neural architecture search also faces a large combinatorial search space and difficulty in evaluation. There have been several approaches to tackle these problems. Bayesian optimization approaches (Snoek et al., 2012) primarily focus on fine-tuning the number of hidden units and layers from a predefined set. Reinforcement learning (Zoph & Le, 2016) and genetic algorithms (Liu et al., 2017) are studied to evolve recurrent neural networks (RNNs) and convolutional neural networks (CNNs) from scratch in order to maximize the validation accuracy. These approaches are computationally expensive because a large number of candidate networks have to be trained from grounds up. (Pham et al., 2018) and (Stanley & Miikkulainen, 2002) propose weight sharing among all possible candidates in the search space to effectively amortize the inner loop training time and thus speed up the architecture search. A typical neural architecture search on ImageNet (Krizhevsky et al., 2012) takes 1.5 days using 200 GPUs (Liu et al., 2017).
21
+
22
+ In this paper, we propose an efficient search method for automatic robot design, Neural Graph Evolution (NGE), that co-evolves both, the robot design and the control policy. Unlike the recent reinforcement learning work, where the control policies are learnt on specific robots carefully designed by human experts (Mnih et al., 2013; Bansal et al., 2017; Heess et al., 2017), NGE aims to adapt the robot design along with policy learning to maximize the agent’s performance. NGE formulates automatic robot design as a graph search problem. It uses a graph as the main backbone of rich design representation and graph neural networks (GNN) as the controller. This is key in order to achieve efficiency of candidate structure evaluation during evolutionary graph search. Similar to previous algorithms like (Sims, 1994), NGE iteratively evolves new graphs and removes graphs based on the performance guided by the learnt GNN controller. The specific contributions of this paper are as follows:
23
+
24
+ • We formulate the automatic robot design as a graph search problem.
25
+ • We utilize graph neural networks (GNNs) to share the weights between the controllers, which greatly reduces the computation time needed to evaluate each new robot design.
26
+ • To balance exploration and exploitation during the search, we developed a mutation scheme that incorporates model uncertainty of the graphs.
27
+
28
+ We show that NGE automatically discovers robot designs that are comparable to the ones designed by human experts in MuJoCo (Todorov et al., 2012), while random graph search or naive evolutionary structure search (Sims, 1994) fail to discover meaningful results on these tasks.
29
+
30
+ # 2 BACKGROUND
31
+
32
+ # 2.1 REINFORCEMENT LEARNING
33
+
34
+ In reinforcement learning (RL), the problem is usually formulated as a Markov Decision Process (MDP). The infinite-horizon discounted MDP consists of a tuple of $( S , { \mathcal { A } } , \gamma , P , R )$ , respectively the state space, action space, discount factor, transition function, and reward function. The objective of the agent is to maximize the total expected reward $\begin{array} { r } { J ( \theta ) = \mathbb { E } _ { \pi } \left[ \sum _ { t = 0 } ^ { \infty } \gamma ^ { t } r ( s _ { t } , a _ { t } ) \right] } \end{array}$ , where the state transition follows the distribution $\bar { P ( } s _ { t + 1 } | s _ { t } , a _ { t } )$ . Here, $s _ { t }$ and $a _ { t }$ denotes the state and action at time step $t$ , and $r ( s _ { t } , a _ { t } )$ is the reward function. In this paper, to evaluate each robot structure, we use PPO to train RL agents (Schulman et al., 2017; Heess et al., 2017). PPO uses a neural network parameterized as $\pi _ { \boldsymbol { \theta } } ( a _ { t } | \boldsymbol { s } _ { t } )$ to represent the policy, and adds a penalty for the KL-divergence between the new and old policy to prevent over-optimistic updates. PPO optimizes the following surrogate objective function instead:
35
+
36
+ $$
37
+ J _ { \mathrm { P P O } } ( \theta ) = \mathbb { E } _ { \pi _ { \theta } } \left[ \sum _ { t = 0 } ^ { \infty } A ^ { t } ( s _ { t } , a _ { t } ) r ^ { t } ( s _ { t } , a _ { t } ) \right] - \beta \operatorname { K L } \left[ \pi _ { \theta } ( : | s _ { t } ) | \pi _ { \theta _ { o l d } } ( : | s _ { t } ) \right] .
38
+ $$
39
+
40
+ We denote the estimate of the expected total reward given the current state-action pair, the value and the advantage functions, as $Q ^ { t } ( s _ { t } , a _ { t } )$ , $V ( s _ { t } )$ and $A ^ { t } ( s _ { t } , a _ { t } )$ respectively. PPO solves the problem by iteratively generating samples and optimizing $J _ { \mathrm { P P O } }$ (Schulman et al., 2017).
41
+
42
+ ![](images/2e9d715889591cf252e6b0c04ff94ec1f8941b9176793190fb0966ecbd604957.jpg)
43
+ Figure 1: In NGE, several mutation operations are allowed. By using Policy Sharing, child species reuse weights from parents, even if the graphs are different. The same color indicates shared and reused weights. For better visualization, we only plot the sharing of propagation model (yellow curves).
44
+
45
+ # 2.2 GRAPH NEURAL NETWORK
46
+
47
+ Graph Neural Networks (GNNs) are suitable for processing data in the form of graph (Bruna et al., 2014; Defferrard et al., 2016; Li et al., 2015; Kipf & Welling, 2017; Duvenaud et al., 2015; Henaff et al., 2015). Recently, the use of GNNs in locomotion control has greatly increased the transferability of controllers (Wang et al., 2018). A GNN operates on a graph whose nodes and edges are denoted respectively as $u \in V$ and $e \in E$ . We consider the following GNN, where at timestep $t$ each node in GNN receives an input feature and is supposed to produce an output at a node level.
48
+
49
+ Input Model: The input feature for node $u$ is denoted as $x _ { u } ^ { t }$ . $x _ { u } ^ { t }$ is a vector of size $d$ , where $d$ is the size of features. In most cases, $x _ { u } ^ { t }$ is produced by the output of an embedding function used to encode information about $u$ into $d$ -dimensional space.
50
+
51
+ Propagation Model: Within each timestep $t$ , the GNN performs $\tau$ internal propagations, so that each node has global (neighbourhood) information. In each propagation, every node communicates with its neighbours, and updates its hidden state by absorbing the input feature and message. We denote the hidden state at the internal propagation step $\tau$ $( \tau \leq \tau )$ as $h _ { u } ^ { t , \tau }$ . Note that $h _ { u } ^ { t , 0 }$ is usually initialized as $h _ { u } ^ { t - 1 , T }$ , i.e., the final hidden state in the previous time step. $\cdot _ { h ^ { 0 , 0 } }$ is usually initialized to zeros. The message that $u$ sends to its neighbors is computed as
52
+
53
+ $$
54
+ m _ { u } ^ { t , \tau } = M ( h _ { u } ^ { t , \tau - 1 } ) ,
55
+ $$
56
+
57
+ where $M$ is the message function. To compute the updated $h _ { u } ^ { t , \tau }$ , we use the following equations:
58
+
59
+ $$
60
+ r _ { u } ^ { t , \tau } = R ( \{ m _ { v } ^ { t , \tau } | \forall v \in \mathcal { N } _ { G } ( u ) \} ) , h _ { u } ^ { t , \tau } = U ( h _ { u } ^ { t , \tau - 1 } , ( r _ { u } ^ { t , \tau } ; x _ { u } ^ { t } ) )
61
+ $$
62
+
63
+ where $R$ and $U$ are the message aggregation function and the update function respectively, and $\mathcal { N } _ { G } ( u )$ denotes the neighbors of $u$ .
64
+
65
+ Output Model: Output function $F$ takes input the node’s hidden states after the last internal propagation. The node-level output for node $u$ is therefore defined as $\mu _ { u } ^ { t } = F ( h _ { u } ^ { t , T } )$ .
66
+
67
+ Functions $M , R , U , F$ in GNNs can be trainable neural networks or linear functions. For details of GNN controllers, we refer readers to (Wang et al., 2018).
68
+
69
+ # 3 NEURAL GRAPH EVOLUTION
70
+
71
+ In robotics design, every component, including the robot arms, finger and foot, can be regarded as a node. The connections between the components can be represented as edges. In locomotion control, the robotic simulators like MuJoCo (Todorov et al., 2012) use an XML file to record the graph of the robot. As we can see, robot design is naturally represented by a graph. To better illustrate Neural Graph Evolution (NGE), we first introduce the terminology and summarize the algorithm.
72
+
73
+ Graph and Species. We use an undirected graph $\mathcal { G } = ( V , E , A )$ to represent each robotic design. $V$ and $E$ are the collection of physical body nodes and edges in the graph, respectively. The mapping
74
+
75
+ # Algorithm 1 Neural Graph Evolution
76
+
77
+ <table><tr><td>1: Initialize generation P°←{(0,G)}1</td><td></td></tr><tr><td>2:while Evolving jth generation do</td><td>Evolution outer loop</td></tr><tr><td>3: for ith species (0²,G) ∈ Pj do</td><td> Species fitness inner loop</td></tr><tr><td>4: 0j+1←Update(0)</td><td>Train policy network</td></tr><tr><td>5: S←s(0+1,G)</td><td>Evaluate fitness</td></tr><tr><td>6: end for</td><td></td></tr><tr><td>7: pj+1←Pj\{(0k,Sk) ∈Pj,∀k ∈ argminx({Si})}.</td><td>Remove worst K species</td></tr><tr><td>P ←{(0h,9h =M(Gh,p)), whereGh,p ~ Uniform(Pj+1)}h=1 8:</td><td>Mutate from survivors</td></tr><tr><td>9: pj+1 √ pj+1 U{(0k,9k) ∈P, ∀k ∈ argmaxx({ξp(Gh)})}. 10: end while</td><td>Pruning</td></tr></table>
78
+
79
+ $A : V \Lambda$ maps the node $u \in V$ to its structural attributes $A ( u ) \in \Lambda$ , where $\Lambda$ is the attributes space. For example, the fish in Figure 1 consists of a set of ellipsoid nodes, and vector $A ( u )$ describes the configurations of each ellipsoid. The controller is a policy network parameterized by weights $\theta$ The tuple formed by the graph and the policy is defined as a species, denoted as $\Omega = ( \mathcal { G } , \theta )$ .
80
+
81
+ Generation and Policy Sharing. In the $j$ -th iteration, NGE evaluates a pool of species called a generation, denoted as $P ^ { j } = \{ ( \mathcal { G } _ { i } ^ { j } , \theta _ { i } ^ { j } ) , \forall i = 1 , 2 , . . . , \mathcal { N } \}$ , where $\mathcal { N }$ is the size of the generation. In NGE, the search space includes not only the graph space, but also the weight or parameter space of the policy network. For better efficiency of NGE, we design a process called Policy Sharing (PS), where weights are reused from parent to child species. The details of PS is described in Section 3.4.
82
+
83
+ Our model can be summarized as follows. NGE performs population-based optimization by iterating among mutation, evaluation and selection. The objective and performance metric of NGE are introduced in Section 3.1. In NGE, we randomly initialize the generation with $\mathcal { N }$ species. For each generation, NGE trains each species and evaluates their fitness separately, the policy of which is described in Section 3.2. During the selection, we eliminate $\kappa$ species with the worst fitness. To mutate $\kappa$ new species from surviving species, we develop a novel mutation scheme called Graph Mutation with Uncertainty (GM-UC), described in Section 3.3, and efficiently inherit policies from the parent species by Policy Sharing, described in Section 3.4. Our method is outlined in Algorithm 1.
84
+
85
+ # 3.1 AMORTIZED FITNESS AND OBJECTIVE FUNCTION
86
+
87
+ Fitness represents the performance of a given $\mathcal { G }$ using the optimal controller parameterized with $\theta ^ { * } ( { \mathcal { G } } )$ . However, $\overleftarrow { \theta ^ { * } } ( \mathcal G )$ is impractical or impossible to obtain for the following reasons. First, each design is computationally expensive to evaluate. To evaluate one graph, the controller needs to be trained and tested. Model-free (MF) algorithms could take more than one million in-game timesteps to train a simple 6-degree-of-freedom cheetah (Schulman et al., 2017), while model-based (MB) controllers usually require much more execution time, without the guarantee of having higher performance than MF controllers (Tassa et al., 2012; Nagabandi et al., 2017; Drews et al., 2017; Chua et al., 2018). Second, the search in robotic graph space can easily get stuck in local-optima. In robotic design, local-optima are difficult to detect as it is hard to tell whether the controller has converged or has reached a temporary optimization plateau. Learning the controllers is a computation bottleneck in optimization.
88
+
89
+ In population-based robot graph search, spending more computation resources on evaluating each species means that fewer different species can be explored. In our work, we enable transferablity between different topologies of NGE (described in Section 3.2 and 3.4). This allows us to introduce amortized fitness (AF) as the objective function across generations for NGE. AF is defined in the following equation as,
90
+
91
+ $$
92
+ \xi ( \mathcal { G } , \boldsymbol { \theta } ) = \mathbb { E } _ { \pi _ { \boldsymbol { \theta } } , \mathcal { G } } \left[ \sum _ { t = 0 } ^ { \infty } \gamma ^ { t } r ( s _ { t } , a _ { t } ) \right] .
93
+ $$
94
+
95
+ In NGE, the mutated species continues the optimization by initializing the parameters with the parameters inherited from its parent species. In past work (Sims, 1994), species in one generation are trained separately for a fixed number of updates, which is biased and potentially undertrained or
96
+
97
+ overtrained. In next generations, new species have to discard old controllers if the graph topology is different, which might waste valuable computation resources.
98
+
99
+ # 3.2 POLICY REPRESENTATION
100
+
101
+ Given a species with graph $\mathcal { G }$ , we train the parameters $\theta$ of policy network $\pi _ { \theta } ( a ^ { t } | s ^ { t } )$ using reinforcement learning. Similar to (Wang et al., 2018), we use a GNN as the policy network of the controller. A graphical representation of our model is shown in Figure 1. We follow notation in Section 2.2.
102
+
103
+ For the input model, we parse the input state vector $s ^ { t }$ obtained from the environment into a graph, where each node $u \in V$ fetches the corresponding observation $o ( u , t )$ from $s ^ { t }$ , and extracts the feature $x _ { u } ^ { O , t }$ with an embedding function $\Phi$ . We also encode the attribute information $A ( u )$ into $x _ { u } ^ { A }$ with an embedding function denoted as $\zeta$ . The input feature $x _ { u } ^ { t }$ is thus calculated as:
104
+
105
+ $$
106
+ \begin{array} { r } { x _ { u } ^ { O , t } = \Phi ( o ( u , t ) ) , ~ x _ { u } ^ { A } = \zeta ( A ( u ) ) , } \\ { x _ { u } ^ { t } = [ x _ { u } ^ { O , t } ; x _ { u } ^ { A } ] , ~ } \end{array}
107
+ $$
108
+
109
+ where $[ . ]$ denotes concatenation. We use $\theta _ { \Phi } , \theta _ { \zeta }$ to denote the weights of embedding functions.
110
+
111
+ The propagation model is described in Section 2.2. We recap the propagation model here briefly: Initial hidden state for node $u$ is denoted as $h _ { u } ^ { t , 0 }$ , which are initialized from hidden states from the last timestep $h _ { u } ^ { t - 1 , T }$ or simply zeros. $\tau$ internal propagation steps are performed for each timestep, during each step (denoted as $\tau \leq \tau \}$ ) of which, every node sends messages to its neighboring nodes, and aggregates the received messages. $h _ { u } ^ { t , \tau + 1 }$ is calculated by an update function that takes in $h _ { u } ^ { t , \tau }$ , node input feature $x _ { u } ^ { t }$ and aggregated message $m _ { u } ^ { t , \tau }$ . We use summation as the aggregation function and a GRU (Chung et al., 2014) as the update function.
112
+
113
+ For the output model, we define the collection of controller nodes as $\mathcal { F }$ , and define Gaussian distributions on each node’s controller as follows:
114
+
115
+ $$
116
+ \begin{array} { r } { \forall u \in \mathcal { F } , ~ \mu _ { u } ^ { t } = F _ { \mu } ( h _ { u } ^ { t , T } ) , } \\ { \sigma _ { u } ^ { t } = F _ { \sigma } ( h _ { u } ^ { t , T } ) , } \end{array}
117
+ $$
118
+
119
+ where $\mu _ { u }$ and $\sigma _ { u }$ are the mean and the standard deviation of the action distribution. The weights of output function are denoted as $\theta _ { F }$ . By combining all the actions produced by each node controller, we have the policy distribution of the agent:
120
+
121
+ $$
122
+ \pi ( a ^ { t } | s ^ { t } ) = \prod _ { u \in \mathcal { F } } \pi _ { u } ( a _ { u } ^ { t } | s ^ { t } ) = \prod _ { u \in \mathcal { F } } \frac { 1 } { \sqrt { 2 \pi ( \sigma _ { u } ^ { t } ) ^ { 2 } } } \mathrm { e x p } \left( \frac { ( a _ { u } ^ { t } - \mu _ { u } ^ { t } ) ^ { 2 } } { 2 ( \sigma _ { u } ^ { t } ) ^ { 2 } } \right)
123
+ $$
124
+
125
+ We optimize $\pi ( \boldsymbol { a } ^ { t } | \boldsymbol { s } ^ { t } )$ with PPO, the details of which are provided in Appendix A.
126
+
127
+ # 3.3 GRAPH MUTATION WITH UNCERTAINTY
128
+
129
+ Between generations, the graphs evolve from parents to children. We allow the following basic operations as the mutation primitives on the parent’s graph $\mathcal { G }$ :
130
+
131
+ $\mathcal { M } _ { 1 }$ , Add-Node: In the $\mathcal { M } _ { 1 }$ (Add-Node) operation, the growing of a new body part is done by sampling a node $v \in V$ from the parent, and append a new node $u$ to it. We randomly initialize $u$ ’s attributes from an uniform distribution in the attribute space.
132
+
133
+ $\mathcal { M } _ { 2 }$ , Add-Graph: The $\mathcal { M } _ { 2 }$ (Add-Graph) operation allows for faster evolution by reusing the subtrees in the graph with good functionality. We sample a sub-graph or leaf node $\bar { \mathcal { G } } ^ { \prime } = ( \bar { V ^ { \prime } } , E ^ { \prime } , A ^ { \prime } )$ from the current graph, and a placement node $u \in V ( { \mathcal { G } } )$ to which to append $\mathcal { G } ^ { \prime }$ . We randomly mirror the attributes of the root node in $\mathcal { G } ^ { \prime }$ to incorporate a symmetry prior.
134
+
135
+ $\mathcal { M } _ { 3 }$ , Del-Graph: The process of removing body parts is defined as $\mathcal { M } _ { 3 }$ (Del-Graph) operation. In this operation, a sub-graph $\mathcal { G } ^ { \prime }$ from $\mathcal { G }$ is sampled and removed from $\mathcal { G }$ .
136
+
137
+ $\mathcal { M } _ { 4 }$ , Pert-Graph: In the $\mathcal { M } _ { 4 }$ (Pert-Graph) operation, we randomly sample a sub-graph $\mathcal { G } ^ { \prime }$ and recursively perturb the parameter of each node $u \in V ( \mathcal { G } ^ { \prime } )$ by adding Gaussian noise to $A ( u )$ .
138
+
139
+ We visualize a pair of example fish in Figure 1. The fish in the top-right is mutated from the fish in the top-left by applying $\mathcal { M } _ { 1 }$ . The new node (2) is colored magenta in the figure. To mutate each new candidate graph, we sample the operation $\mathcal { M }$ and apply $\mathcal { M }$ on $\mathcal { G }$ as
140
+
141
+ $$
142
+ \mathcal { G } ^ { \prime } = \mathcal { M } ( \mathcal { G } ) , \mathrm { w h e r e } \mathcal { M } \in \{ \mathcal { M } _ { l } , l = 1 , 2 , 3 , 4 \} , \ : \mathrm { P } ( \mathcal { M } = \mathcal { M } _ { l } ) = p _ { m } ^ { l } .
143
+ $$
144
+
145
+ $p _ { m } ^ { l }$ is the probability of sampling each operation with $\begin{array} { r } { \sum _ { l } p _ { m } ^ { l } = 1 } \end{array}$
146
+
147
+ To facilitate evolution, we want to avoid wasting computation resources on species with low expected fitness, while encouraging NGE to test species with high uncertainty. We again employ a GNN to predict the fitness of the graph $\mathcal { G }$ , denoted as $\xi _ { P } ( \mathcal G )$ . The weights of this GNN are denoted as $\psi$ . In particular, we predict the AF score with a similar propagation model as our policy network, but the observation feature is only $x _ { u } ^ { A }$ , i.e., the embedding of the attributes. The output model is a graph-level output (as opposed to node-level used in our policy), regressing to the score $\xi$ . After each generation, we train the regression model using the L2 loss.
148
+
149
+ However, pruning the species greedily may easily overfit the model to the existing species since there is no modeling of uncertainty. We thus propose Graph Mutation with Uncertainty (GM-UC) based on Thompson Sampling to balance between exploration and exploitation. We denote the dataset of past species and their AF score as $\mathcal { D }$ . GM-UC selects the best graph candidates by considering the posterior distribution of the surrogate $P \left( \psi | \mathcal { D } \right)$ :
150
+
151
+ $$
152
+ \mathcal { G } ^ { * } = \arg \operatorname* { m a x } _ { \mathcal { G } } \mathbb { E } _ { P \left( \psi \left| \mathcal { D } \right. \right]} \left[ \xi _ { P } \left( \mathcal { G } \right| \psi \right) .
153
+ $$
154
+
155
+ Instead of sampling the full model with $\widetilde { \psi } \sim P \left( \psi | \mathcal { D } \right)$ , we follow Gal & Ghahramani (2016) and perform dropout during inference, which can be viewed as an approximate sampling from the model posterior. At the end of each generation, we randomly mutate ${ \mathcal { C } } \geq { \mathcal { N } }$ new species from surviving species. We then sample a single dropout mask for the surrogate model and only keep $\mathcal { N }$ species with highest $\xi _ { P }$ . The details of GM-UC are given in Appendix F.
156
+
157
+ # 3.4 RAPID ADAPTATION USING POLICY SHARING
158
+
159
+ To leverage the transferability of GNNs across different graphs, we propose Policy Sharing (PS) to reuse old weights from parent species. The weights of a species in NGE are as follows:
160
+
161
+ $$
162
+ \theta _ { G } = ( \theta _ { \Phi } , \theta _ { \zeta } , \theta _ { M } , \theta _ { U } , \theta _ { F } ) ,
163
+ $$
164
+
165
+ where $\theta _ { \Phi } , \theta _ { \zeta } , \theta _ { M } , \theta _ { U } , \theta _ { F }$ are the weights for the models we defined earlier in Section 3.2 and 2.2. Since our policy network is based on GNNs, as we can see from Figure 1, model weights of different graphs share the same cardinality (shape). A different graph will only alter the paths of message propagation. With PS, new species are provided with a strong weight initialization, and the evolution will less likely be dominated by species that are more ancient in the genealogy tree.
166
+
167
+ Previous approaches including naive evolutionary structure search (ESS-Sims) (Sims, 1994) or random graph search (RGS) utilize human-engineered one-layer neural network or a fully connected network, which cannot reuse controllers once the graph structure is changed, as the parameter space for $\theta$ might be different. And even when the parameters happen to be of the same shape, transfer learning with unstructured policy controllers is still hardly successful (Rajeswaran et al., 2017). We denote the old species in generation $j$ , and its mutated species with different topologies as $( \theta _ { B } ^ { j } , \mathcal { G } )$ , $( \theta _ { B } ^ { j + 1 } , \mathcal { G } ^ { \prime } )$ in baseline algorithm ESS-Sims and RGS, and $( \theta _ { G } ^ { j } , \mathcal { G } )$ , $( \theta _ { G } ^ { j + 1 } , \mathcal { G } ^ { \prime } )$ for NGE. We also denote the network initialization scheme for fully-connected networks as $\boldsymbol { B }$ . We show the parameter reuse between generations in Table 1.
168
+
169
+ <table><tr><td rowspan=1 colspan=1>Algorithm</td><td rowspan=1 colspan=1>Mutation</td><td rowspan=1 colspan=1>Parameter Space</td><td rowspan=1 colspan=1>Policy Initialization</td></tr><tr><td rowspan=1 colspan=1>ESS-Sims, RGSNGE</td><td rowspan=1 colspan=1>g→g&#x27;g→g&#x27;</td><td rowspan=1 colspan=1>{0B(9)}n {0B(S&#x27;)}=0{0G(9)}={0G(S&#x27;)}</td><td rowspan=1 colspan=1>B(&#x27;),, 0 not reused01</td></tr></table>
170
+
171
+ Table 1: Parameter reuse between species and its mutated children if the topologies are different.
172
+
173
+ ![](images/38bc5764a077404c9112cc83437462191878af34cc741069550675015886ee62.jpg)
174
+ Figure 2: The performance of the graph search for RGS, ES and NGE. The figures on are the example creatures obtained from each of the method. The graph structure next to the figure are the corresponding graph structure. We included the original species for reference.
175
+
176
+ # 4 EXPERIMENTS
177
+
178
+ In this section, we demonstrate the effectiveness of NGE on various evolution tasks. In particular, we evaluate both, the most challenging problem of searching for the optimal body structure from scratch in Section 4.1, and also show a simpler yet useful problem where we aim to optimize humanengineered species in Section 4.2 using NGE. We also provide an ablation study on GM-UC in Section 4.3, and an ablation study on computational cost or generation size in Section 4.4.
179
+
180
+ Our experiments are simulated with MuJoCo. We design the following environments to test the algorithms. Fish Env: In the fish environment, graph consists of ellipsoids. The reward is the swimming-speed along the $y$ -direction. We denote the reference human-engineered graph (Tassa et al., 2018) as $\mathcal { G } _ { F }$ . Walker Env: We also define a 2D environment walker constructed by cylinders, where the goal is to move along $x$ -direction as fast as possible. We denote the reference humanengineered walker as $\mathcal { G } _ { W }$ and cheetah as $\mathcal { G } _ { C }$ (Tassa et al., 2018). To validate the effectiveness of NGE, baselines including previous approaches are compared. We do a grid search on the hyper-parameters as summarized in Appendix E, and show the averaged curve of each method. The baselines are introduced as follows:
181
+
182
+ ESS-Sims: This method was proposed in (Sims, 1994), and applied in (Cheney et al., 2014; Taylor, 2017), which has been the most classical and successful algorithm in automatic robotic design. In the original paper, the author uses evolutionary strategy to train a human-engineered one layer neural network, and randomly perturbs the graph after each generation. With the recent progress of robotics and reinforcement learning, we replace the network with a 3-layer Multilayer perceptron and train it with PPO instead of evolutionary strategy.
183
+
184
+ ESS-Sims-AF: In the original ESS-Sims, amortized fitness is not used. Although amortized fitness could not be fully applied, it could be applied among species with the same topology. We name this variant as ESS-Sims-AF.
185
+
186
+ ESS-GM-UC: ESS-GM-UC is a variant of ESS-Sims-AF, which combines GM-UC. The goal is to explore how GM-UC affects the performance without the use of a structured model like GNN.
187
+
188
+ ESS-BodyShare: We also want to answer the question of whether GNN is indeed needed. We use both an unstructured models like MLP, as well as a structured model by removing the message propagation model.
189
+
190
+ RGS: In the Random Graph Search (RGS) baseline, a large amount of graphs are generated randomly.
191
+ RGS focuses on exploiting given structures, and does not utilize evolution to generate new graphs.
192
+
193
+ # 4.1 EVOLUTION TOPOLOGY SEARCH
194
+
195
+ In this experiment, the task is to evolve the graph and the controller from scratch. For both fish and walker, species are initialized as random $( { \mathcal { G } } , \theta )$ . Computation cost is often a concern among structure search problems. In our comparison results, for fairness, we allocate the same computation budget to all methods, which is approximately 12 hours on a $\mathtt { E C 2 \ m 4 . 1 6 \times 1 a r g e }$ cluster with 64 cores for one session. A grid search over the hyper-parameters is performed (details in Appendix E). The averaged curves from different runs are shown in Figure 2. In both fish and walker environments, NGE is the best model. We find RGS is not able to efficiently search the space of $\mathcal { G }$ even after evaluating 12, 800 different graphs. The performance of ESS-Sims grows faster for the earlier generations, but is significantly worse than our method in the end. The use of AF and GM-UC on ESS-Sims can improve the performance by a large margin, which indicates that the sub-modules in NGE are effective. By looking at the generated species, ESS-Sims and its variants overfit to local species that dominate the rest of generations. The results of ESS-BodyShare indicates that, the use of structured graph models without message passing might be insufficient in environments that require global features, for example, walker.
196
+
197
+ ![](images/5e50d9c050c8d569952dde06bce8d1d51e7eca8d9b2cb77d12af4f9fb2cac2e7.jpg)
198
+ Figure 3: The genealogy tree generated using NGE for fish. The number next to the node is the reward (the averaged speed of the fish). For better visualization, we down-sample genealogy sub-chain of the winning species. NGE agents gradually grow symmetrical side-fins.
199
+
200
+ ![](images/9b433e8161c629493c0b84edc2c426bbe01e6993718cae2b5d395a7a563768e0.jpg)
201
+ Figure 4: Fine-tuning results on different creatures compared with baseline where structure is fixed. The figures included the species looking from 2 different angles.
202
+
203
+ To better understand the evolution process, we visualize the genealogy tree of fish using our model in Figure 3. Our fish species gradually generates three fins with preferred $\{ A ( u ) \}$ , with two side-fins symmetrical about the fish torso, and one tail-fin lying in the middle line. We obtain similar results for walker, as shown in Appendix C. To the best of our knowledge, our algorithm is the first to automatically discover kinematically plausible robotic graph structures.
204
+
205
+ # 4.2 FINE-TUNING SPECIES
206
+
207
+ Evolving every species from scratch is costly in practice. For many locomotion control tasks, we already have a decent human-engineered robot as a starting point. In the fine-tuning task, we verify the ability of NGE to improve upon the human-engineered design. We showcase both, unconstrained experiments with NGE where the graph $( V , E , A )$ is fine-tuned, and constrained fine-tuning experiments where the topology of the graph is preserved and only the node attributes $\{ A ( u ) \}$ are fine-tuned. In the baseline models, the graph $( V , E , A )$ is fixed, and only the controllers are trained. We can see in Figure 4 that when given the same wall-clock time, it is better to co-evolve the attributes and controllers with NGE than only training the controllers.
208
+
209
+ The figure shows that with NGE, the cheetah gradually transforms the forefoot into a claw, the 3D-fish rotates the pose of the side-fins and tail, and the 2D-walker evolves bigger feet. In general, unconstrained fine-tuning with NGE leads to better performance, but not necessarily preserves the initial structures.
210
+
211
+ ![](images/5fbb41d8252c34ce241a6c560a063ef4faa5d6f1f740b48a07d2a82c2d37c501.jpg)
212
+ Figure 5: Results of ablation study, NGE without uncertainty results and rapid evolution during experiments.
213
+
214
+ # 4.3 GREEDY SEARCH V.S. EXPLORATION UNDER UNCERTAINTY
215
+
216
+ We also investigate the performance of NGE with and without Graph Mutation with Uncertainty, whose hyper-parameters are summarized in Appendix E. In Figure 5a, we applied GM-UC to the evolution graph search task. The final performance of the GM-UC outperforms the baseline on both fish and walker environments. The proposed GM-UC is able to better explore the graph space, showcasing its importance.
217
+
218
+ # 4.4 COMPUTATION COST AND GENERATION SIZE
219
+
220
+ We also investigate how the generation size $\mathcal { N }$ affect the final performance of NGE. We note that as we increase the generation size and the computing resources, NGE achieves marginal improvement on the simple Fish task. A NGE session with 16-core m5.4xlarge $\$ 0.768$ per Hr) AWS machine can achieve almost the same performance with 64-core m4.16xlarge $\$ 3.20$ per Hr) in Fish environment in the same wall-clock time. However, we do notice that there is a trade off between computational resources and performance for the more difficult task. In general, NGE is effective even when the computing resources are limited and it significantly outperforms RGS and ES by using only a small generation size of 16.
221
+
222
+ # 5 DISCUSSION
223
+
224
+ In this paper, we introduced NGE, an efficient graph search algorithm for automatic robot design that co-evolves the robot design graph and its controllers. NGE greatly reduces evaluation cost by transferring the learned GNN-based control policy from previous generations, and better explores the search space by incorporating model uncertainties. Our experiments show that the search over the robotic body structures is challenging, where both random graph search and evolutionary strategy fail to discover meaning robot designs. NGE significantly outperforms the naive approaches in both the final performance and computation time by an order of magnitude, and is the first algorithm that can discovers graphs similar to carefully hand-engineered design. We believe this work is an important step towards automated robot design, and may show itself useful to other graph search problems.
225
+
226
+ Acknowledgements Partially supported by Samsung and NSERC. We also thank NVIDIA for their donation of GPUs.
227
+
228
+ # REFERENCES
229
+
230
+ Trapit Bansal, Jakub Pachocki, Szymon Sidor, Ilya Sutskever, and Igor Mordatch. Emergent complexity via multi-agent competition. arXiv preprint arXiv:1710.03748, 2017.
231
+
232
+ Joan Bruna, Wojciech Zaremba, Arthur Szlam, and Yann LeCun. Spectral networks and locally connected networks on graphs. ICLR, 2014.
233
+
234
+ Roberto Calandra, André Seyfarth, Jan Peters, and Marc Peter Deisenroth. Bayesian optimization for learning gaits under uncertainty. Annals of Mathematics and Artificial Intelligence, 76(1-2):5–23, 2016.
235
+
236
+ Nick Cheney, Robert MacCurdy, Jeff Clune, and Hod Lipson. Unshackling evolution: Evolving soft robots with multiple materials and a powerful generative encoding. ACM SIGEVOlution, 7(1): 11–23, 2014.
237
+
238
+ Kurtland Chua, Roberto Calandra, Rowan McAllister, and Sergey Levine. Deep reinforcement learning in a handful of trials using probabilistic dynamics models. arXiv preprint arXiv:1805.12114, 2018.
239
+
240
+ Junyoung Chung, Caglar Gulcehre, KyungHyun Cho, and Yoshua Bengio. Empirical evaluation of gated recurrent neural networks on sequence modeling. arXiv preprint arXiv:1412.3555, 2014.
241
+
242
+ Michaël Defferrard, Xavier Bresson, and Pierre Vandergheynst. Convolutional neural networks on graphs with fast localized spectral filtering. In NIPS, 2016.
243
+
244
+ Paul Drews, Grady Williams, Brian Goldfain, Evangelos A Theodorou, and James M Rehg. Aggressive deep driving: Combining convolutional neural networks and model predictive control. In Conference on Robot Learning, pp. 133–142, 2017.
245
+
246
+ David Duff, Mark Yim, and Kimon Roufas. Evolution of polybot: A modular reconfigurable robot. In Proc. of the Harmonic Drive Intl. Symposium, Nagano, Japan, 2001.
247
+
248
+ David K Duvenaud, Dougal Maclaurin, Jorge Iparraguirre, Rafael Bombarell, Timothy Hirzel, Alán Aspuru-Guzik, and Ryan P Adams. Convolutional networks on graphs for learning molecular fingerprints. In NIPS, 2015.
249
+
250
+ Yarin Gal and Zoubin Ghahramani. Dropout as a bayesian approximation: Representing model uncertainty in deep learning. In international conference on machine learning, pp. 1050–1059, 2016.
251
+
252
+ Nicolas Heess, Srinivasan Sriram, Jay Lemmon, Josh Merel, Greg Wayne, Yuval Tassa, Tom Erez, Ziyu Wang, Ali Eslami, Martin Riedmiller, et al. Emergence of locomotion behaviours in rich environments. arXiv preprint arXiv:1707.02286, 2017.
253
+
254
+ Mikael Henaff, Joan Bruna, and Yann LeCun. Deep convolutional networks on graph-structured data. arXiv preprint arXiv:1506.05163, 2015.
255
+
256
+ Michał Joachimczak, Reiji Suzuki, and Takaya Arita. Fine grained artificial development for bodycontroller coevolution of soft-bodied animats. Artificial life, 14:239–246, 2014.
257
+
258
+ Thomas N Kipf and Max Welling. Semi-supervised classification with graph convolutional networks. ICLR, 2017.
259
+
260
+ Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton. Imagenet classification with deep convolutional neural networks. In Advances in neural information processing systems, pp. 1097–1105, 2012.
261
+
262
+ Christopher G Langton. Artificial life: An overview. Mit Press, 1997.
263
+
264
+ Wei-Po Lee. An evolutionary system for automatic robot design. In Systems, Man, and Cybernetics, 1998. 1998 IEEE International Conference on, volume 4, pp. 3477–3482. IEEE, 1998.
265
+
266
+ Yujia Li, Daniel Tarlow, Marc Brockschmidt, and Richard Zemel. Gated graph sequence neural networks. arXiv preprint arXiv:1511.05493, 2015.
267
+
268
+ Hanxiao Liu, Karen Simonyan, Oriol Vinyals, Chrisantha Fernando, and Koray Kavukcuoglu. Hierarchical representations for efficient architecture search. arXiv preprint arXiv:1711.00436, 2017.
269
+
270
+ Melanie Mitchell and Stephanie Forrest. Genetic algorithms and artificial life. Artificial life, 1(3): 267–289, 1994.
271
+
272
+ Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Alex Graves, Ioannis Antonoglou, Daan Wierstra, and Martin Riedmiller. Playing atari with deep reinforcement learning. arXiv preprint arXiv:1312.5602, 2013.
273
+
274
+ Volodymyr Mnih, Adria Puigdomenech Badia, Mehdi Mirza, Alex Graves, Timothy Lillicrap, Tim Harley, David Silver, and Koray Kavukcuoglu. Asynchronous methods for deep reinforcement learning. In International Conference on Machine Learning, pp. 1928–1937, 2016.
275
+
276
+ Anusha Nagabandi, Gregory Kahn, Ronald S Fearing, and Sergey Levine. Neural network dynamics for model-based deep reinforcement learning with model-free fine-tuning. arXiv preprint arXiv:1708.02596, 2017.
277
+
278
+ Ferrante Neri. Memetic compact differential evolution for cartesian robot control. IEEE Computational Intelligence Magazine, 5(2):54–65, 2010.
279
+
280
+ Hieu Pham, Melody Y Guan, Barret Zoph, Quoc V Le, and Jeff Dean. Efficient neural architecture search via parameter sharing. arXiv preprint arXiv:1802.03268, 2018.
281
+
282
+ Aravind Rajeswaran, Kendall Lowrey, Emanuel V Todorov, and Sham M Kakade. Towards generalization and simplicity in continuous control. In Advances in Neural Information Processing Systems, pp. 6553–6564, 2017.
283
+
284
+ John Schulman, Filip Wolski, Prafulla Dhariwal, Alec Radford, and Oleg Klimov. Proximal policy optimization algorithms. arXiv preprint arXiv:1707.06347, 2017.
285
+
286
+ Karl Sims. Evolving virtual creatures. In Proceedings of the 21st annual conference on Computer graphics and interactive techniques, pp. 15–22. ACM, 1994.
287
+
288
+ Jasper Snoek, Hugo Larochelle, and Ryan P Adams. Practical bayesian optimization of machine learning algorithms. In Advances in neural information processing systems, pp. 2951–2959, 2012.
289
+
290
+ Kenneth O Stanley and Risto Miikkulainen. Evolving neural networks through augmenting topologies. Evolutionary computation, 10(2):99–127, 2002.
291
+
292
+ Luc Steels. The artificial life roots of artificial intelligence. Artificial life, 1(1_2):75–110, 1993.
293
+
294
+ Yuval Tassa, Tom Erez, and Emanuel Todorov. Synthesis and stabilization of complex behaviors through online trajectory optimization. In Intelligent Robots and Systems (IROS), 2012 IEEE/RSJ International Conference on, pp. 4906–4913. IEEE, 2012.
295
+
296
+ Yuval Tassa, Yotam Doron, Alistair Muldal, Tom Erez, Yazhe Li, Diego de Las Casas, David Budden, Abbas Abdolmaleki, Josh Merel, Andrew Lefrancq, et al. Deepmind control suite. arXiv preprint arXiv:1801.00690, 2018.
297
+
298
+ Tim Taylor. Evolution in virtual worlds. arXiv preprint arXiv:1710.06055, 2017.
299
+
300
+ Emanuel Todorov, Tom Erez, and Yuval Tassa. Mujoco: A physics engine for model-based control. In Intelligent Robots and Systems (IROS), 2012 IEEE/RSJ International Conference on, pp. 5026– 5033. IEEE, 2012.
301
+
302
+ Li Wan, Matthew Zeiler, Sixin Zhang, Yann Le Cun, and Rob Fergus. Regularization of neural networks using dropconnect. In International Conference on Machine Learning, pp. 1058–1066, 2013.
303
+
304
+ Tingwu Wang, Renjie Liao, Jimmy Ba, and Sanja Fidler. Nervenet: Learning structured policy with graph neural networks. In ICLR, 2018.
305
+
306
+ Barret Zoph and Quoc V Le. Neural architecture search with reinforcement learning. arXiv preprint arXiv:1611.01578, 2016.
307
+
308
+ ![](images/b5211ae0f5290b26b5598c34119199588fefd60fcfea62b58bcedd35e02f549a.jpg)
309
+ Figure 6: In this figure, we show the computation graph of NerveNet+ $^ +$ . At each timestep, every node in the graph updates its hidden state by absorbing the messages as well as the input feature. The output function takes the hidden states as input and outputs the controller (or policy) of the agent.
310
+
311
+ # A DETAILS OF NERVENET $^ { + + }$
312
+
313
+ Similar to NerveNet, we parse the agent into a graph, where each node in the graph corresponds to the physical body part of the agents. For example, the fish in Figure 1 can be parsed into a graph of five nodes, namely the torso (0), left-fin (1), right-fin (2), and tail-fin bodies (3, 4). By replacing MLP with NerveNet, the learnt policy has much better performance in terms of robustness and the transfer learning ability. We here propose minor but effective modifications to Wang et al. (2018), and refer to this model as NerveNet++.
314
+
315
+ In the original NerveNet, at every timestep, several propagation steps need to be performed such that every node is able to receive global information before producing the control signal. This is time and memory consuming, with the minimum number of propagation steps constrained by the depth of the graph.
316
+
317
+ Since the episode of each game usually lasts for several hundred timesteps, it is computationally expensive and ineffective to build the full back-propagation graph. Inspired by Mnih et al. (2016), we employ the truncated graph back-propagation to optimize the policy. NerveNet+ $^ { \cdot + }$ is suitable for an evolutionary search or population-based optimization, as it brings speed-up in wall-clock time, and decreases the amount of memory usage.
318
+
319
+ Therefore in NerveNe $^ { + + }$ , we propose a propagation model with the memory state, where each node updates its hidden state by absorbing the input feature and a message with time. The number of propagation steps is no longer constrained by the depth of the graph, and in back-propagation, we save memory and time consumption with truncated computation graph.
320
+
321
+ The computational performance evaluation is provided in Appendix B. NerveNet+ $^ +$ model is trained by the PPO algorithm Schulman et al. (2017); Heess et al. (2017),
322
+
323
+ # B OPTIMIZATION WITH TRUNCATED BACKPROPAGATION
324
+
325
+ During training, the agent generates the rollout data by sampling from the distribution $a _ { t } \sim \pi ( a _ { t } | s _ { t } )$ and stores the training data of $\mathcal { D } = \{ a ^ { t } , s ^ { t } , \{ h _ { u } ^ { t , \tau = 0 } \} \}$ . To train the reinforcement learning agents with memory, the original training objective is
326
+
327
+ $$
328
+ J ( \theta ) = \mathbb { E } _ { \pi } \left[ \sum _ { t = 0 } ^ { \infty } \gamma ^ { t } r ( s ^ { t } , a ^ { t } , \{ h _ { u } ^ { t , \tau = 0 } \} ) \right] ,
329
+ $$
330
+
331
+ where we denote the whole update model as $H$ and
332
+
333
+ $$
334
+ h _ { u } ^ { t + 1 , \tau = 0 } = H ( \{ h _ { v } ^ { t , \tau = 0 } \} , s ^ { t } , a ^ { t } ) .
335
+ $$
336
+
337
+ ![](images/0cf94e39d660ebd29877df92792868564f3a09bea210994b1c774e00bd3db98f.jpg)
338
+ Figure 7: In these two figures, we show that to reach similar performance, NerveNet+ $^ +$ took shorter time comparing to original NerveNet.
339
+
340
+ The memory state $h _ { u } ^ { t + 1 , \tau }$ depends on the previous actions, observations, and states. Therefore, the full back-propagation graph will be the same length as the episode length, which is very computationally intensive. The intuition from the authors in Mnih et al. (2016) is that, for the RL agents, the dependency of the agents on timesteps that are far-away from the current timestep is limited. Thus, negligible accuracy of the gradient estimator will be lost if we truncate the back-propagation graph. We define a back-propagation length $\Gamma$ , and optimize the following objective function instead:
341
+
342
+ $$
343
+ \begin{array} { r l } & { \quad J _ { T } ( \theta ) = \mathbb E _ { \pi } \left[ \displaystyle \sum _ { t = 0 } ^ { \infty } \displaystyle \sum _ { \kappa = 0 } ^ { \Gamma - 1 } \gamma ^ { t + \kappa } r ( s _ { t + \kappa } , a _ { t + \kappa } , \{ h _ { u } ^ { t , \tau = 0 } \} ) \right] , \ : \mathrm { w h e r e } } \\ & { \quad h _ { u } ^ { t + \kappa , \tau = 0 } = \left\{ \begin{array} { l l } { H ( \{ h _ { v } ^ { t + \kappa - 1 , \tau = 0 } , \forall v \} , s _ { t + \kappa - 1 } , a _ { t + \kappa - 1 } ) \quad } & { \kappa \neq 0 , } \\ { h _ { u } ^ { t , \tau = 0 } \in \mathcal D \quad } & { \kappa = 0 , } \end{array} \right. } \end{array}
344
+ $$
345
+
346
+ Essentially this optimization means that we only back-propagate up to $\Gamma$ timesteps, namely at the places where $\kappa = 0$ , we treat the hidden state as input to the network and stop the gradient. To optimize the objective function, we follow same optimization procedure as in Wang et al. (2018), which is a variant of PPO Schulman et al. (2017), where a surrogate loss $J _ { \mathrm { p p o } } ( \theta )$ is optimized. We refer the readers to these papers for algorithm details.
347
+
348
+ # C FULL NGE RESULTS
349
+
350
+ Similar to the fish genealogy tree, in Fig. 8, the simple initial walking agent evolves into a cheetah-like structure, and is able to run with high speed. We also show the species generated by NGE, ESS-Sims (ESS-Sims-AF to be more specific, which has the best performance among all ESS-Sims variants.) and RGS.
351
+
352
+ # D RESETTING CONTROLLER FOR FAIR COMPETITION
353
+
354
+ Although amortized fitness is a better estimation of the ground-truth fitness, it is still biased. Species that appear earlier in the experiment will be trained for more updates if it survives. Indeed, intuitively, it is possible that in real nature, species that appear earlier on will dominate the generation by number, and new species are eliminated even if the new species has better fitness. Therefore, we design the experiment where we reset the weights for all species $\theta = ( \theta _ { \Phi } , \theta _ { \zeta } , \theta _ { M } , \theta _ { U } , \theta _ { F } )$ randomly. By doing this, we are forcing the species to compete fairly. From Fig 10, we notice that this method helps exploration, which leads to a higher reward in the end. However, it usually takes a longer time for the algorithm to converge. Therefore for the graph search task in Fig 2, we do not include the results with the controller-resetting.
355
+
356
+ ![](images/716e206836792ddab9d1fc8348ce669faab16f2ec614d74faee62e59a8209062.jpg)
357
+ Figure 8: Our walker species gradually grows two foot-like structures from randomly initialized body graph.
358
+
359
+ ![](images/a406d83d3adcc19b5eac6dc93df042348580e2442eae8c5093c0f282310809d3.jpg)
360
+ Figure 9: We present qualitative comparison between the three algorithms in the figure. Specifically, the aligned comparison between our method and naive baseline are the representative creatures at the same generation (using same computation resources). Our algorithm notably display stronger dominance in terms of its structure as well as reward.
361
+
362
+ ![](images/c1838debebc25ca3af12e8c06a8bc188ee90c8eab19018442aa7d90a55637911.jpg)
363
+ Figure 10: The results of resetting controller scheme and baselines.
364
+
365
+ # E HYPER-PARAMETERS SEARCHED
366
+
367
+ All methods are given equal amount of computation budget. To be more specific, the number of total timesteps generated by all species for all generations is the same for all methods. For example, if we use 10 training epochs in one generation, each of the epoch with 2000 sampled timesteps, then the computation budget allows NGE to evolve for 200 generations, where each generation has a species size of 64. For NGE, RGS, ESS-Sims-AF models in Fig 11, we run a grid search over the hyper-parameters recorded in Table 2, and Table 3, and plot the curve with the best results respectively.
368
+
369
+ ![](images/e98cbe174974ebb813c4abfefabd4eabdc5fbc42014ba545dd6b2894fb925637.jpg)
370
+ Figure 11: The results of the graph search
371
+
372
+ Since the number of generations for the RGS baseline can be regarded as 1, its curve is plotted with the number of updates normalized by the computation resource as $\mathbf { X }$ -axis.
373
+
374
+ Here we show the detail figures of six baselines, which are: RGS-20, RGS-100, RGS-200, and ESS-Sims-AF-20, ESS-Sims-AF-100, ESS-Sims-AF-200. The number attached to the baseline names indicates the number of inner-loop policy training epochs. In the case of RGS-20, where more than 12800 different graphs are searched over, the average reward is still very low. Increasing the number of inner-loop training of species to 100 and 200 does not help the final performance significantly.
375
+
376
+ To test the performance with and without GM-UC, we use 64-core clusters (generations of size 64).
377
+ Here, the hyper-parameters are chosen to be the first value available in Table 2 and Table 3.
378
+
379
+ Table 2: Hyperparameter grid search options.
380
+
381
+ <table><tr><td>Items</td><td>Value Tried</td></tr><tr><td>Number of Iteration Per Update Number of Species per Generation Elimination Rate Discrete Socket Timesteps per Updates</td><td>10,20,100,200 16,32,64,100 0.15, 0.20, 0.3 Yes, True 2000,4000,6000</td></tr><tr><td>Target KL Learning Rate Schedule Number of Maximum Generation</td><td>0.01 Adaptive</td></tr><tr><td>Prob of Add-Node,Add-Graph Prob of Pert-Graph Prob of Del-Graph</td><td>400 0.15</td></tr></table>
382
+
383
+ # F MODEL BASED SEARCH USING THOMPSON SAMPLING
384
+
385
+ Thompson Sampling is a simple heuristic search strategy that is typically applied to the multi-armed bandit problem. The main idea is to select an action proportional to the probability of the action being optimal. When applied to the graph search problem, Thompson Sampling allows the search to balance the trade-off between exploration and exploitation by maximizing the expected fitness under the posterior distribution of the surrogate model.
386
+
387
+ Table 3: Hyperparameters grid search options for NGE.
388
+
389
+ <table><tr><td>Items</td><td>Value Tried</td></tr><tr><td>Allow Graph-Add</td><td>True, False</td></tr><tr><td>Graph Mutation with Uncertainty</td><td>True,False</td></tr><tr><td>Pruning Temperature</td><td>0.01, 0.1, 1</td></tr><tr><td>Network Structure</td><td>NerveNet,NerveNet++</td></tr><tr><td>Number Candidates before Pruning</td><td>200,400</td></tr></table>
390
+
391
+ Formally, Thompson Sampling selects the best graph candidates at each round according to the expected estimated fitness $\xi _ { P }$ using a surrogate model. The expectation is taken under the posterior distribution of the surrogate $P$ (model|data):
392
+
393
+ $$
394
+ \mathcal { G } ^ { * } = \arg \operatorname* { m a x } _ { \mathcal { G } } \mathbb { E } _ { P ( \mathrm { m o d e l } | \mathrm { d a t a } ) } \left[ \xi _ { P } \left( \mathcal { G } | \mathrm { m o d e l } \right) \right] .
395
+ $$
396
+
397
+ # F.1 SURROGATE MODEL ON GRAPHS.
398
+
399
+ Here we consider a graph neural network (GNN) surrogate model to predict the average fitness of a graph as a Gaussian distribution, namely $\boldsymbol { P } \left( f ( \boldsymbol { \mathcal { G } } ) \right) \ \stackrel { \sim } { \sim } \mathcal { N } \left( \xi _ { P } ( \boldsymbol { \mathcal { G } } ) , \stackrel { \sim } { \sigma } ^ { 2 } ( \boldsymbol { \mathcal { G } } ) \right)$ . We use a simple architecture that predicts the mean of the Gaussian from the last hidden layer activations, $h _ { W } ( { \mathcal { G } } ) \in$ $\mathbb { R } ^ { D }$ , of the GNN, where $W$ are the weights in the GNN up to the last hidden layer.
400
+
401
+ Greedy search. We denoted the size of dataset as $N$ . The GNN weights are trained to predict the average fitness of the graph as a standard regression task:
402
+
403
+ $$
404
+ \operatorname* { m i n } _ { W , W _ { o u t } } \frac { \beta } { 2 } \sum _ { n = 1 } ^ { N } \left( \xi ( \mathcal { G } _ { n } ) - \xi _ { P } ( \mathcal { G } _ { n } ) \right) ^ { 2 } , \quad \mathrm { w h e r e } \quad \xi _ { P } ( \mathcal { G } _ { n } ) = W _ { o u t } ^ { T } h _ { W } ( \mathcal { G } _ { n } )
405
+ $$
406
+
407
+ # Algorithm 2 Greedy Search
408
+
409
+ 1: Initialize generation $\mathcal { P } ^ { 0 }$
410
+ 2: for $j <$ maximum generations do
411
+ 3: Collect the $( \xi _ { i } ^ { k } , \mathcal { G } _ { i } ^ { k } )$ from previous $k \leq j$ generations . Update dataset
412
+ 4: Train $W$ and $W _ { o u t }$ on $\{ ( \xi _ { i } ^ { k } , \mathcal { G } _ { i } ^ { k } ) \} _ { n = 1 } ^ { N }$ . Train GM-UC
413
+ 5: Propose $\mathcal { C }$ new graph $\{ \mathcal { G } _ { i } \} _ { i = 1 } ^ { \mathcal { C } }$ , ${ \mathcal { C } } > > M$ . $\triangleright$ Propose new candidates
414
+ 6: Rank $\{ \xi _ { P } ( \mathcal { G } _ { i } | W , W _ { o u t } ) \} _ { i = 1 } ^ { \mathcal { C } }$ on the proposals and pick the top $\kappa$ . Prune candidates
415
+ 7: Update generation $\mathcal { P } ^ { j }$
416
+ 8: for $m < \mathcal N$ do $\triangleright$ Train and evaluate each species
417
+ 9: for $k <$ maximum parameter updates do
418
+ 10: Train policy πGm
419
+ 11: end for
420
+ 12: Evaluate the fitness $\xi ( \mathcal { G } _ { m } , \theta _ { m } )$
421
+ 13: end for
422
+ 14: end for
423
+
424
+ Thompson Sampling In practice, Thompson Sampling is very similar to the previous greedy search algorithm. Instead of picking the top action according to the best model parameters, at each generation, it draws a sample of the model and takes a greedy action under the sampled model.
425
+
426
+ Approximating Thompson Sampling using Dropout Performing dropout during inference can be viewed as an approximately sampling from the model posterior. At each generation, we will sample a single dropout mask for the surrogate model and rank all the proposed graphs accordingly.
427
+
428
+ # Algorithm 3 Thompson Sampling using Bayesian Neural Networks
429
+
430
+ 1: Initialize generation P0
431
+ 2: for $j <$ maximum generations do
432
+ 3: Collect the $( \xi _ { i } ^ { k } , \mathcal { G } _ { i } ^ { k } )$ from previous $k \leq j$ generations . Update dataset
433
+ 4: Train $W$ and $W _ { o u t }$ on $\{ ( \xi _ { i } ^ { k } , \mathcal { G } _ { i } ^ { k } ) \} _ { n = 1 } ^ { N }$ . Train GM-UC
434
+ 5: Propose $\mathcal { C }$ new graph $\{ \mathcal { G } _ { i } \} _ { i = 1 } ^ { \mathcal { C } } , \mathcal { C } > > M$ . . Propose new candidates
435
+ 6: Sample a model from the posterior of the weights.
436
+ 7: e.g. $\widetilde { W } , \widetilde { W } _ { o u t } \sim P \left( W , W _ { o u t } | D \right) \approx \mathcal { N } \left( [ W , W _ { o u t } ] , [ W , W _ { o u t } ] \right)$
437
+ 8: (similar to DropConnect Wan et al. (2013))
438
+ 9: Rank $\{ \xi _ { P } ( \mathcal { G } _ { i } | \widetilde { W } , \widetilde { W } _ { o u t } ) \} _ { i = 1 } ^ { \mathcal { C } }$ on the proposals and pick the top $\kappa$
439
+ 10: for $m < \mathcal N$ do $\triangleright$ Train and evaluate each species
440
+ 11: for $k <$ maximum parameter updates do
441
+ 12: Train policy πGm
442
+ 13: end for
443
+ 14: Evaluate the fitness $\xi ( \mathcal { G } _ { m } , \theta _ { m } )$
444
+ 15: end for
445
+ 16: end for
446
+
447
+ # Algorithm 4 Thompson Sampling with Dropout
448
+
449
+ 1: Initialize generation $\mathcal { P } ^ { 0 }$
450
+ 2: for $j <$ maximum generations do
451
+ 3: Collect the $( \xi _ { i } ^ { k } , \mathcal { G } _ { i } ^ { k } )$ from previous $k \leq j$ generations $\triangleright$ Update dataset
452
+ 4: Train $W$ and $W _ { o u t }$ on $\{ { \mathcal G } _ { n } , \xi ( { \mathcal G } _ { n } ) \} _ { n = 1 } ^ { N }$ using dropout rate 0.5 on the inputs of the fc layers.
453
+ 5: Propose $\mathcal { C }$ new graph $\{ \mathcal { G } _ { i } \} _ { i = 1 } ^ { \mathcal { C } } , \mathcal { C } > > M$ . . Propose new candidates
454
+ 6: Sample a dropout mask $\mathrm { m } _ { i }$ for the hidden units
455
+ 7: Rank $\{ \xi _ { P } ( \mathcal { G } _ { i } \bar { | } W , W _ { o u t } , \mathbf { m } _ { i } ) \} _ { i = 1 } ^ { J }$ on the proposals and pick the top $\kappa$
456
+ 8: for $m < \mathcal N$ do $\triangleright$ Train and evaluate each species
457
+ 9: for $k <$ maximum parameter updates do
458
+ 10: Train policy πGm
459
+ 11: end for
460
+ 12: Evaluate the fitness $\xi ( \mathcal { G } _ { m } , \theta _ { m } )$
461
+ 13: end for
462
+ 14: end for
md/train/BkgXT24tDS/BkgXT24tDS.md ADDED
@@ -0,0 +1,337 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ADDITIVE POWERS-OF-TWO QUANTIZATION:AN EFFICIENT NON-UNIFORM DISCRETIZATION FORNEURAL NETWORKS
2
+
3
+ Yuhang Li †∗, $\mathbf { X i n ~ D o n g ^ { \delta * } }$ , Wei Wang †
4
+ †National University of Singapore, §Harvard University
5
+ loafyuhang@gmail.com, xindong@g.harvard.edu, wangwei@comp.nus.edu.sg
6
+
7
+ # ABSTRACT
8
+
9
+ We propose Additive Powers-of-Two (APoT) quantization, an efficient nonuniform quantization scheme for the bell-shaped and long-tailed distribution of weights and activations in neural networks. By constraining all quantization levels as the sum of Powers-of-Two terms, APoT quantization enjoys high computational efficiency and a good match with the distribution of weights. A simple reparameterization of the clipping function is applied to generate a better-defined gradient for learning the clipping threshold. Moreover, weight normalization is presented to refine the distribution of weights to make the training more stable and consistent. Experimental results show that our proposed method outperforms state-of-the-art methods, and is even competitive with the full-precision models, demonstrating the effectiveness of our proposed APoT quantization. For example, our 4-bit quantized ResNet-50 on ImageNet achieves $7 6 . 6 \%$ top-1 accuracy without bells and whistles; meanwhile, our model is capable to decrease $22 \%$ computational cost compared with the uniformly quantized counterpart. 1
10
+
11
+ # 1 INTRODUCTION
12
+
13
+ Deep Neural Networks (DNNs) have made a significant improvement for various real-world applications. However, the huge memory and computational cost impede the mass deployment of DNNs, e.g., on resource-constrained devices. To reduce memory footprint and computational burden, several model compression methods such as quantization (Zhou et al., 2016), pruning (Han et al., 2015) and low-rank decomposition (Denil et al., 2013) have been widely explored.
14
+
15
+ In this paper, we focus on the neural network quantization for efficient inference. Two operations are involved in the quantization process, namely clipping and projection. The clipping operation sets a full precision number to the range boundary if it is outside of the range; the projection operation maps each number (after clipping) into a predefined quantization level (a fixed number). We can see that both operations incur information loss. A good quantization method should resolve the two following questions/challenges, which correspond to two contradictions respectively.
16
+
17
+ How to determine the optimal clipping threshold to balance clipping range and projection resolution? The resolution indicates the interval between two quantization levels; the smaller the interval, the higher the resolution. The first contradiction is that given a fixed number of bits to represent weights, the range and resolution are inversely proportional. For example, a larger range can clip fewer weights; however, the resolution becomes lower and thus damage the projection. Note that slipshod clipping of outliers can jeopardize the network a lot (Zhao et al., 2019) although they may only take $1 \%$ of all weights in one layer. Previous works have tried either pre-defined (Cai et al., 2017; Zhou et al., 2016) or trainable (Choi et al., 2018b) clipping thresholds, but how to find the optimal threshold during training automatically is still not resolved.
18
+
19
+ How to design quantization levels with consideration for both the computational efficiency and the distribution of weights? Most of the existing quantization approaches (Cai et al., 2017; Gong et al., 2019) use uniform quantization although non-uniform quantization can usually achieve better accuracy (Zhu et al., 2016). The reason is that projection against uniform quantization levels are much more hardware-friendly (Zhou et al., 2016). However, empirical study (Han et al., 2015) has shown that weights in a layer of DNN follow a bell-shaped and long-tailed distribution instead of a uniform distribution (as shown in the right figure). In other words, a fair percentage of weights concentrate around the mean (peak area); and a few weights are of relatively high magnitude and out of the quantization range (called outliers). Such distribution also exists in activations (Miyashita et al., 2016). The second contradiction is: considering the bell-shaped distribution of weight, it is well-motivated to assign higher resolution (i.e. smaller quantization interval) around the mean; however, such non-uniform quantization levels will introduce high computational overhead. Powers-of-Two quantization levels (Miyashita et al., 2016; Zhou et al., 2017) are then proposed because of its cheap multiplication implemented by shift operations on hardware, and super high resolution around the mean. However, the vanilla powers-of-two quantization method only increases the resolution near the mean and ignores other regions at all when the bit-width is increased. Consequently, it assigns inordinate quantization levels for a tiny range around the mean. To this end, we propose additive Powers-of-Two (APoT) quantization to resolve these two contradictions, our contribution can be listed as follows:
20
+
21
+ ![](images/ac3ca25c85bb9d61445f20df0c9161b4ffa7e70781fbe8ea4ef4c47a284f6eb9.jpg)
22
+ Figure 1: Density of weights in ResNet-18
23
+
24
+ 1. We introduce the APoT quantization scheme for the weights and activations of DNNs. APoT is a non-uniform quantization scheme, in which the quantization levels is a sum of several PoT terms and can adapt well to the bell-shaped distribution of weights. APoT quantization enjoys an approximate $2 \times$ multiplication speed-up compared with uniform quantization on both generic and specific hardware. 2. We propose a Reparameterized Clipping Function (RCF) that can compute a more accurate gradient for the clipping threshold and thus facilitate the optimization of the clipping threshold. We also introduce weight normalization for neural network quantization. Normalized weights in the forward pass are more stable and consistent for clipping and projection. 3. Experimental results show that our proposed method outperforms state-of-the-art methods, and is even competitive with the full-precision implementation with higher computational efficiency. Specifically, our 4-bit quantized ResNet-50 on ImageNet achieve $7 6 . 6 \%$ Top-1 and $9 3 . 1 \%$ Top-5 accuracy. Compared with uniform quantization, our method can decrease $22 \%$ computational cost, demonstrating the proposed algorithm is hardware-friendly.
25
+
26
+ # 2 METHODOLOGY
27
+
28
+ # 2.1 PRELIMINARIES
29
+
30
+ Suppose kernels in a convolutional layer are represented by a 4D tensor $\mathcal { W } \in \mathbb { R } ^ { C _ { o u t } \times C _ { i n } \times K \times K }$ , where $C _ { o u t }$ and $C _ { i n }$ are the number of output and input channels respectively, and $K$ is the kernel size. We denote the quantization of the weights as
31
+
32
+ $$
33
+ \begin{array} { r } { \hat { \mathcal { W } } = \Pi _ { \mathcal { Q } ( \alpha , b ) } \lfloor \mathcal { W } , \alpha \rceil , } \end{array}
34
+ $$
35
+
36
+ where $\alpha$ is the clipping threshold and the clipping function $[ \cdot , \alpha ]$ clips weights into $[ - \alpha , \alpha ]$ . After clipping, each element of $\mathcal { W }$ is projected by $\Pi ( \cdot )$ onto the quantization levels. We denote $\mathcal { Q } ( \alpha , b )$ for a set of quantization levels, where $b$ is the bit-width. For uniform quantization, the quantization levels are defined as
37
+
38
+ $$
39
+ \mathcal { Q } ^ { u } ( \alpha , b ) = \alpha \times \{ 0 , \frac { \pm 1 } { 2 ^ { b - 1 } - 1 } , \frac { \pm 2 } { 2 ^ { b - 1 } - 1 } , \frac { \pm 3 } { 2 ^ { b - 1 } - 1 } , \ldots , \pm 1 \} .
40
+ $$
41
+
42
+ For every floating-point number, uniform quantization maps it to a $b$ -bit fixed-point representation (quantization levels) in $\mathcal { Q } ^ { u } ( \alpha , b )$ . Note that $\alpha$ is stored separately as a full-precision floating-point number for each whole $\mathcal { W }$ . Convolution is done against the quantization levels first and the results are then multiplied by $\alpha$ . Arithmetical computation, e.g., convolution, can be implemented using low-precision fixed point operations on hardware, which are substantially cheaper than their floating-point contradictory (Goldberg, 1991). Nevertheless, uniform quantization does not match the distribution of weights (and activations), which is typically bell-shaped (Han et al., 2015). A straightforward solution is to assign more quantization levels (higher resolution) for the peak of the distribution and fewer levels (lower resolution) for the tails. However, it is difficult to implement the arithmetical operations for the non-uniform quantization levels efficiently.
43
+
44
+ ![](images/c73baa7a1cd6bb5846b071beac43506a8cd785aea78c61ec29270271ff274fee.jpg)
45
+ Figure 2: Quantization of unsigned data to 3-bit or 4-bit $( \alpha = 1 . 0 $ ) using three different quantization levels. APoT quantization has a more reasonable resolution assignment and it does not suffer from the rigid resolution.
46
+
47
+ # 2.2 ADDITIVE POWERS-OF-TWO QUANTIZATION
48
+
49
+ To solve the contradiction between non-uniform resolution and hardware efficiency, Powers-ofTwo (PoT) quantization (Miyashita et al., 2016; Zhou et al., 2017) is proposed by constraining quantization levels to be powers-of-two values or zero, i.e.,
50
+
51
+ $$
52
+ \begin{array} { r } { \underline { { Q } } ^ { p } ( \alpha , b ) = \alpha \times \{ 0 , \pm 2 ^ { - 2 ^ { b - 1 } + 1 } , \pm 2 ^ { - 2 ^ { b - 1 } + 2 } , . . . , \pm 2 ^ { - 1 } , \pm 1 \} . } \end{array}
53
+ $$
54
+
55
+ Apparently, as a non-uniform quantizer, PoT has a higher resolution for the value range with denser weights because of its exponential property. Furthermore, multiplication between a Powers-of-two number $2 ^ { x }$ and the other operand $r$ can be implemented by bit-wise shift instead of bulky digital multipliers, i.e.,
56
+
57
+ $$
58
+ 2 ^ { x } r = { \left\{ \begin{array} { l l } { r } & { { \mathrm { ~ i f ~ } } x = 0 } \\ { r < < x } & { { \mathrm { ~ i f ~ } } x > 0 , } \\ { r > > x } & { { \mathrm { ~ i f ~ } } x < 0 } \end{array} \right. }
59
+ $$
60
+
61
+ where $> >$ denotes the right shift operation and is computationally cheap, which only takes 1 clock cycle in modern CPU architectures.
62
+
63
+ However, we find that PoT quantization does not benefit from more bits. Assume $\alpha$ is 1, as shown in Equation (3), when we increase the bit-width from b to b + 1, the interval [−2−2b−1+1, 2−2b−1+1] will be split into $2 ^ { b - 1 } - 1$ sub-intervals, whereas all other intervals remain unchanged. In other words, by increasing the bit-width, the resolution will increase only for $[ - 2 ^ { - 2 ^ { b - 1 } + 1 } , 2 ^ { - 2 ^ { b - 1 } + 1 } ]$ . We refer this phenomenon as the rigid resolution of PoT quantization. Take $\mathcal { Q } ^ { p } ( 1 , 5 )$ as an example, the two smallest positive levels are $2 ^ { - 1 5 }$ and $2 ^ { - 1 4 }$ , which is excessively fine-grained. In contrast, the two largest levels are $2 ^ { - 1 }$ and $2 ^ { 0 }$ , whose interval is large enough to incur high projection error for weights between $[ 2 ^ { - 1 } , 2 ^ { 0 } ]$ , e.g., 0.75. The rigid resolution is demonstrated in Figure 2(b). When we change from from 3-bit to 4-bit, all new quantization levels concentrate around 0 and thus cannot increase the model’s expressiveness effectively.
64
+
65
+ ![](images/b463f44038b337fd8ebc5c453fd6d8c77e25551f39f417fe6b886196dc7ef5d3.jpg)
66
+ Figure 3: Hardware accelerator with different quantization schemes. When $k$ increase, weights usually has less PoT terms, thus accelerates the computation.
67
+
68
+ To tackle the rigid resolution problem, we propose Additive Powers-of-Two (APoT) quantization. Without loss of generality, in this section, we only consider unsigned numbers for simplicity2. In APoT quantization, each level is the sum of n PoT terms as shown below,
69
+
70
+ $$
71
+ \mathcal { Q } ^ { a } ( \alpha , k n ) = \gamma \times \{ \sum _ { i = 0 } ^ { n - 1 } p _ { i } \} \mathrm { w h e r e } p _ { i } \in \{ 0 , \frac { 1 } { 2 ^ { i } } , \frac { 1 } { 2 ^ { i + n } } , . . . , \frac { 1 } { 2 ^ { i + ( 2 ^ { k } - 2 ) n } } \} ,
72
+ $$
73
+
74
+ where $\gamma$ is a scaling coefficient to make sure the maximum level in ${ \mathcal { Q } } ^ { a }$ is $\alpha , \ k$ is called the base bit-width, which is the bit-width for each additive term, and $n$ is the number of additive terms. When the bit-width $b$ and the base bit-width $k$ is set, $n$ can be calculated by $\begin{array} { r } { n = { \frac { b } { k } } } \end{array}$ . There are $2 ^ { k n } = 2 ^ { b }$ $b$ which provides a higher resolution for the non-uniform levels.
75
+
76
+ We use $b \ = \ 4$ and $k \ = \ 2$ as an example to illustrate how APoT resolves the rigid resolution problem. For this example, we have $p _ { 0 } \in \{ 0 , 2 ^ { 0 } , 2 ^ { - 2 } , 2 ^ { - 4 } \}$ , $p _ { 1 } \in \{ 0 , 2 ^ { - 1 } , 2 ^ { - 3 } , 2 ^ { - 5 } \} ,$ $\gamma = 2 \alpha / 3$ , and ${ \mathcal { Q } } ^ { a } ( \alpha , k n ) = \{ \gamma \times ( p _ { 0 } + p _ { 1 } ) \}$ for all $( 2 ^ { b } = 1 6 )$ combinations of $p _ { 0 }$ and $p _ { 1 }$ . First, we can see the smallest positive quantization level in $\mathcal { Q } ^ { a } ( 1 , 4 )$ is $2 ^ { - 4 } / 3$ . Compared with the original PoT levels, APoT allocates quantization levels prudently for the central area. Second, APoT generates 3 new quantization levels between $2 ^ { 0 }$ and $\bar { 2 } ^ { - 1 }$ , to properly increase the resolution. In Figure 2, the second row compares the 3 quantization methods using 4 bits for range [0, 1]. APoT quantization has a reasonable distribution of quantization levels, with more levels in the peak area (near 0) and relatively higher resolution than the vanilla PoT quantization at the tail (near 1).
77
+
78
+ Relation to other quantization schemes. On the one hand, the fixed-point number representations used in the uniform quantization is a special case of APoT. When $k ~ = ~ 1$ in Equation (5), the quantization levels is a sum of $b$ PoT terms or 0. In the fixed-point representations, each bit indicates one specific choice of the additive terms. On the other hand, when $k = b$ , there is only one PoT term and $\bar { \mathcal { Q } } ^ { a } ( \alpha , b )$ becomes $\mathcal { Q } ^ { p } ( \alpha , b )$ , i.e., PoT quantization. We can conclude that when $k$ decreases, APoT levels are decomposed into more PoT terms, and the distribution of levels becomes more uniform. Our experiments use $k = 2$ , which is an intermediate choice between the uniform case $k = 1 ,$ ) and the vanilla PoT case $k = b$ ).
79
+
80
+ Computation. Multiplication for fixed-point numbers can be implemented by shifting the multiplicand (i.e., the activations) and adding the partial product. The $n$ in Equation (5) denotes the Since number of additive PoT terms in the multiplier (weights), and control the speed of computation. $\begin{array} { r } { n = \frac { b } { k } } \end{array}$ , either decreasing $b$ or increasing $k$ can accelerate the multiplication. Compared with uniform quantization $k = 1 ,$ ), our method $k = 2$ ) is approximately $2 \times$ faster in multiplication. As for the full precision $\alpha$ , it is a coefficient for all weights in a layer and can be multiplied only once after the multiply-accumulate operation is finished. Figure 3 shows the hardware accelerator, the weights buffer takes $k$ -bit as a PoT term and shift-adds the activations.
81
+
82
+ Generalizing to $2 n + 1$ bits. When $k = 2$ , APoT quantization can only leverages $2 n$ -bit width for quantization. To deal with $2 n + 1$ -bit quantization, we choose to add $n + 1$ PoT terms, one of which only contains 2 levels. The formulation is given by
83
+
84
+ $$
85
+ \mathcal { Q } ^ { a } ( \alpha , 2 n + 1 ) = \gamma \times \ \{ \sum _ { i = 0 } ^ { n - 1 } p _ { i } + \tilde { p } \} \ \mathrm { w h e r e } \ p _ { i } \in \{ 0 , \frac { 1 } { 2 ^ { i } } , \frac { 1 } { 2 ^ { i + n } } , \frac { 1 } { 2 ^ { i + 2 n + 1 } } \} , \ \tilde { p } \in \{ 0 , \frac { 1 } { 2 ^ { i + 2 n } } \} .
86
+ $$
87
+
88
+ Take 3-bit APoT quantization as an example, every level is a sum of one $p _ { 0 }$ and one $\tilde { p }$ , where $p _ { 0 } \in \{ 0 , 2 ^ { - 1 } , 2 ^ { - 2 } , \bar { 2 } ^ { - 4 } \}$ and $\tilde { p } \in \{ 0 , 2 ^ { - 3 } \}$ . The forward function is plotted in Figure 2(c).
89
+
90
+ # 2.3 REPARAMETERIZED CLIPPING FUNCTION
91
+
92
+ Besides the projection operation, the clipping operation $[ \mathcal { W } , \alpha ]$ is also important for quantization. $\alpha$ is a threshold that determines the value range of weights in a quantized layer. Tuning the clipping threshold $\alpha$ is a key challenge because of the long-tail distribution of the weights. Particularly, if $\alpha$ is too large (e.g., the maximum absolute value of $\mathcal { W }$ ), $\mathcal { Q } ( \alpha , b )$ would have a wide range and then the projection will lead to large error as a result of insufficient resolution for the weights in the central area; if $\alpha$ is too small, more outliers will be clipped slipshodly. Considering the distribution of weights can be complex and differs across layers and training steps, a static clipping threshold $\alpha$ for all layers is not optimal.
93
+
94
+ To jointly optimize the clipping threshold $\alpha$ and weights via SGD during training, Choi et al. (2018b) apply the Straight-Through Estimator (STE) (Bengio et al., 2013) to do the backward propagation for the projection operation. According to STE, the gradient to $\alpha$ is computed by $\begin{array} { r } { \frac { \partial \hat { \mathcal { W } } } { \partial \alpha } \approx \frac { \partial \lfloor \mathcal { W } , \alpha \rceil } { \partial \alpha } = } \end{array}$ $\mathrm { s i g n } ( { \mathscr W } )$ when $| \mathcal { W } | > \alpha$ otherwise 0, where the weights outside of the range cannot contribute to the gradients, which results in inaccurate gradient approximation. To provide a refined gradient for the clipping threshold, we design a Reparameterized Clipping Function (RCF) as
95
+
96
+ $$
97
+ \hat { \mathcal { W } } = \alpha \Pi _ { \mathcal { Q } ( 1 , b ) } \big [ \frac { \mathcal { W } } { \alpha } , 1 \big ] .
98
+ $$
99
+
100
+ Instead of directly clipping them to $[ - \alpha , \alpha ]$ , RCF outputs a constant clipping range and re-scales weights back after the projection, which is mathematically equivalent to Equation (1) during forward. In backpropagation, STE is adopted for the projection operation and the gradients of $\alpha$ are calculated by
101
+
102
+ $$
103
+ \frac { \partial \hat { \mathcal { W } } } { \partial \alpha } = \left\{ \begin{array} { l l } { \mathrm { s i g n } ( \mathcal { W } ) } & { \mathrm { i f ~ } | \mathcal { W } | > \alpha } \\ { \displaystyle \Pi _ { \mathcal { Q } ( 1 , b ) } \frac { \mathcal { W } } { \alpha } - \frac { \mathcal { W } } { \alpha } } & { \mathrm { i f ~ } | \mathcal { W } | \leq \alpha } \end{array} \right.
104
+ $$
105
+
106
+ The detail derivation of the gradients is shown in Appendix A. Compared with the normal clipping function, RCF provides more accurate gradient signals for the optimization because both weights inside $( | \mathcal { W } | \leq \alpha )$ and out of $( | \mathcal { W } | > \alpha )$ the range can contribute to the gradient for the clipping threshold. Particularly, the outliers are responsible for the clipping, and the weights in $[ - \alpha , \alpha ]$ are for projection. Therefore, the update of $\alpha$ considers both clipping and projection, and tries to find a balance between them. In experiments, we observe that the clipping threshold will become universally smaller when the bit-width is reduced to guarantee sufficient resolution, which further validates the efficaciousness of the gradient in RCF.
107
+
108
+ # 2.4 WEIGHT NORMALIZATION
109
+
110
+ In practice, we find that learning $\alpha$ for weights is quite arduous because the distribution of weights is pretty steep and changes frequently during training. As a result, jointly training the clipping threshold and weights parameters is hard to converge. Inspired by the crucial role of batch normalization (BN) (Ioffe $\&$ Szegedy, 2015) in activation quantization (Cai et al., 2017), we propose weight normalization (WN) to refine the distribution of weights with zero mean and unit variance,
111
+
112
+ $$
113
+ \tilde { \mathcal { W } } = \frac { \mathcal { W } - \mu } { \sigma + \epsilon } , \mathrm { w h e r e } \mu = \frac { 1 } { I } \sum _ { i = 1 } ^ { I } \mathcal { W } _ { i } , \sigma = \sqrt { \frac { 1 } { I } \sum _ { i = 1 } ^ { I } ( \mathcal { W } _ { i } - \mu ) ^ { 2 } } ,
114
+ $$
115
+
116
+ where $\epsilon$ is a small number (typically $1 0 ^ { - 5 }$ ) for numerical stability, and $I$ denotes the number of weights in one layer. Note that quantization of weights is applied right after this normalization.
117
+
118
+ ![](images/296afd41c25721ce18c2a3fba33b7a7c5e0585187412215ff4824d4f0da40e1f.jpg)
119
+ Figure 4: The evolution of clipping ratio of the first three layers in ResNet-20. (a) demonstrates clipping ratio is too sensitive to threshold to hurt its optimization without weights normalization. (b) shows that weights distribution after normalization is relatively more stable during training.
120
+
121
+ # Algorithm 1 Forward and backward procedure for an APoT quantized convolutional layer
122
+
123
+ Input: input activations $\mathcal { X } _ { i n }$ , the full precision weight tensor $\mathcal { W }$ , the clipping threshold for weights and activations $\alpha _ { \mathcal { W } }$ , $\alpha _ { \mathcal { X } }$ , the bit-width $b$ of quantized tensor.
124
+
125
+ Output: the output activations $\mathcal { X } _ { o u t }$
126
+
127
+ 1: Normalize weights $\mathcal { W }$ to $\tilde { \mathcal W }$
128
+ 2: Apply RCF and APoT quantization to the normalized weights $\begin{array} { r } { \hat { \mathcal { W } } = \alpha \nu \Pi _ { \mathcal { Q } ^ { a } ( 1 , b ) } \big \lfloor \frac { \tilde { \mathcal { W } } } { \alpha _ { \mathcal { W } } } , 1 \big \rceil } \end{array}$
129
+ 3: Apply RCF and APoT quantization to the activations $\begin{array} { r } { \hat { \mathcal { X } _ { i n } } = \alpha _ { \mathcal { X } } \Pi _ { \mathcal { Q } ^ { a } ( 1 , b ) } \lfloor \frac { \mathcal { X } _ { i n } } { \alpha _ { \mathcal { X } } } , 1 \rceil } \end{array}$
130
+ 4: Compute the output activations $\mathcal { X } _ { o u t } = C o n \nu ( \hat { \mathcal { W } } , \hat { \mathcal { X } _ { i n } } )$
131
+ 5: Compute the loss $\mathcal { L }$ and the gradients $\frac { \partial \mathcal { L } } { \partial \mathcal { X } _ { o u t } }$ ,
132
+ 6: Compute the gradients of convolution $\frac { \partial \mathcal { L } } { \partial \hat { \mathcal { X } } _ { i n } }$ $\textstyle \frac { \partial { \mathcal { L } } } { \partial { \hat { \mathcal { W } } } }$
133
+ 7: Compute the gradients for clipping threshold $\frac { \partial \mathcal { L } } { \partial \alpha \ w }$ , $\frac { \partial \mathcal { L } } { \partial \alpha \boldsymbol { x } }$ based on Equation (8)
134
+ 8: Compute the gradients to the full precision weights $\begin{array} { r } { \frac { \partial \mathcal { L } } { \partial \mathcal { W } } = \frac { \partial \mathcal { L } } { \partial \hat { \mathcal { W } } } \frac { \partial \hat { \mathcal { W } } } { \partial \tilde { \mathcal { W } } } \frac { \partial \tilde { \mathcal { W } } } { \partial \mathcal { W } } } \end{array}$
135
+ 9: Update $\mathcal { W }$ , $\alpha _ { \mathcal { W } }$ , $\alpha _ { \mathcal { X } }$ with learning rate $\eta _ { \mathcal { W } } , \eta _ { \alpha _ { \mathcal { W } } } , \eta _ { \alpha _ { \mathcal { X } } }$
136
+
137
+ Normalization is important to provide a relatively consistent and stable input distribution to both clipping and projection functions for smoother optimization of $\alpha$ over different layers and iterations during training. Besides, making the mean of weights to be zero can reap the benefits of the symmetric design of the quantization levels.
138
+
139
+ Here, we conduct a case study of ResNet-20 on CIFAR10 to illustrate how normalization for weights can help quantization. For a certain layer (at a certain training step) in ResNet-18, We firstly fix the weights, and let $\alpha$ go from 0 to max $| \mathcal { W } |$ to plot the curve of the clipping ratio (i.e. the proportion of clipped weights). As shown in Figure 4a, the change of clipping ratio is much smoother after quantization. As a result, the optimization of $\alpha$ will be significantly smoother. In addition, normalization also makes the distribution of weights quite more consistent over training iterations. We fix the value of $\alpha$ , and visualize clipping ratio over training iterations in Figure 4b. After normalization, the same $\alpha$ will result in almost the same clipping ratio, which improves the consistency of optimization goal for $\alpha$ . More experimental analysis demonstrating the effectiveness of the normalization on weights can be found in Appendix B.
140
+
141
+ # 2.5 TRAINING AND DEPLOYING
142
+
143
+ We adopt APoT quantization for both weights and activations. Notwithstanding the effect in activations is not conspicuous, we adopt APoT quantization for consistency. During backpropagation, we use STE when computing the gradients of weights, i.e. $\begin{array} { r } { \frac { \partial \hat { \mathcal { W } } } { \partial \tilde { \mathcal { W } } } = 1 } \end{array}$ . The detailed training procedure is shown in Algorithm 1.
144
+
145
+ To save memory cost during inference, we discard the full precision weights $\mathcal { W }$ and only store the quantized weights $\hat { \mathcal W }$ . Compared with other uniform quantization methods, APoT quantization is more efficient and effective during inference.
146
+
147
+ # 3 RELATED WORKS
148
+
149
+ Non-Uniform Quantization. Several methods are proposed for the non-uniform distribution of weights. LQ-Nets(Zhang et al., 2018) learns quantization levels based on the quantization error minimization (QEM) algorithm. Distillation (Polino et al., 2018) optimizes the quantization levels directly to minimize the task loss which reflects the behavior of their teacher network. These methods use finite floating-point numbers to quantize weights (and activations), bringing extra computation overhead compared with linear quantization. Logarithmic quantizers (Zhou et al., 2017; Miyashita et al., 2016) leverage powers-of-2 values to accelerate the computation by shift operations; however, they suffer from the rigid resolution problem.
150
+
151
+ Jointly Training. Many works have explored to optimize the quantization parameters (e.g., $\alpha$ ) and the weights parameters simultaneously. Zhu et al. (2016) learns positive and negative scaling coefficients respectively. LQ-Nets jointly train these parameters to minimize the quantization error. QIL (Jung et al., 2019) introduces a learnable transformer to change the quantization intervals and optimize them based on the task loss. PACT (Choi et al., 2018b) parameterizes the clipping threshold in activations and optimize it through gradient descent. However, in PACT, the gradient of $\alpha$ is not accurate, which only includes the contribution from outliers and ignores the contribution from other weights.
152
+
153
+ Weight Normalization. Previous works on weight normalization mainly focus on addressing the limitations of BatchNorm (Ioffe & Szegedy, 2015). Salimans & Kingma (2016); Hoffer et al. (2018) decouple direction from magnitude to accelerate the training procedure. Weight Standardization (Qiao et al., 2019) normalizes weights to zero mean and unit variance during the forward pass. However, there is limited literature that studies the normalization of weights for neural network quantization. (Zhu et al., 2016) uses feature-scaling to normalize weights by dividing the maximum absolute value. Weight Normalization based Quantization (Cai & Li, 2019) also uses this feature scaling and derive the gradient to eliminate the outliers in the weights tensor.
154
+
155
+ # 4 EXPERIMENT
156
+
157
+ In this section, we validate our proposed method on ImageNet-ILSVRC2012 (Russakovsky et al., 2015) and CIFAR10 (Krizhevsky et al., 2009). We also conduct ablation study for each component of our algorithm.
158
+
159
+ # 4.1 EVALUATION ON IMAGENET
160
+
161
+ We compare our methods with several strong baselines on ResNet architectures (He et al., 2016), including ABC-Net (Lin et al., 2017), DoReFa-Net (Zhou et al., 2016), PACT (Choi et al., 2018b), LQ-Net (Zhang et al., 2018), DSQ (Gong et al., 2019), QIL (Jung et al., 2019). Both weights and activations of the networks are quantized for comparisons. All the state-of-the-art methods use full precision (32 bits) for the first and the last layer, which incur more memory cost. In our implementation, we employ 8-bit quantization for them to balance the accuracy drop and the hardware overhead.
162
+
163
+ For our proposed APoT quantization algorithm, four configurations of the bit-width, i.e., 2,3,4, and 5 ( $k = 2$ and $n = 1$ or 2 in Equation (5) and (6)) are tested, where one bit is used for the sign of the weights but not for activations. Note that for the 2-bit symmetric weight quantization method, $\mathcal { Q } ( \alpha , 2 )$ can only be $\{ \pm \alpha , 0 \}$ , therefore only RCF and WN are used in this setting. To obtain a reasonable initialization, we follow Lin et al. (2017); Jung et al. (2019) to initialize our model. Specifically, the 5-bit quantized model is initialized from the pre-trained full precision one3, while the 4-bit network is initialized from the trained 5-bit model. We compare the accuracy, memory cost, and the fixed point operations under different bit-width. To compare the operations with different bit-width, we use the bit-op computation scheme introduced in Zhou et al. (2016) where the multiplication between a $m$ -bit and a $l$ -bit uniform quantized number costs $m l$ binary operation. We define one FixOP as one operation between an 8-bit weight and an 8-bit activation which takes 64 binary operations if uniform quantization scheme is applied. In APoT scheme, the multiplication between a $m$ -bit activation and a $l = k n$ -bit weight only needs mn shift-adds operations, i.e., $\frac { n \times m } { 6 4 }$ FixOPs. More details of the implementation are in the Appendix C.2.
164
+
165
+ Table 1: Comparison of accuracy performance as well as hardware performance of ResNets (He et al., 2016) on ImageNet with existing methods.
166
+
167
+ <table><tr><td rowspan="3">METHOD</td><td rowspan="2">PRECISION (W/A)</td><td colspan="2">ACCURACY(%)</td><td rowspan="2">MODEL SIZE</td><td rowspan="3">FIXOPS</td><td rowspan="2">PRECISION</td><td colspan="2">ACCURACY(%)</td><td rowspan="3">MODEL SIZE</td><td rowspan="3">FIXOPS</td></tr><tr><td>ToP-1</td><td>TOP-5</td><td>(W/A)</td><td>TOP-1 TOP-5</td></tr><tr><td>FP.(RES18)</td><td>32/32</td><td>70.2</td><td>89.4</td><td>46.8MB</td><td>1.82G</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>ABC-NETS</td><td>5/5</td><td>65.0</td><td>85.9</td><td>8.72 MB</td><td>781M</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>DoREFA-NET</td><td>5/5</td><td>68.4</td><td>88.3</td><td>8.72MB</td><td>781M</td><td>4/4</td><td>68.1</td><td>88.1</td><td>7.39MB</td><td>542M</td></tr><tr><td>PACT</td><td>5/5</td><td>69.8</td><td>89.3</td><td>8.72MB</td><td>781M</td><td>4/4</td><td>69.2</td><td>89.0</td><td>7.39 MB</td><td>542M</td></tr><tr><td>LQ-NET</td><td></td><td></td><td></td><td></td><td></td><td>4/4</td><td>69.3</td><td>88.8</td><td>7.39MB</td><td>542M</td></tr><tr><td>DSQ</td><td></td><td></td><td></td><td></td><td></td><td>4/4</td><td>69.6</td><td></td><td>7.39 MB</td><td>542M</td></tr><tr><td>QIL</td><td>5/5</td><td>70.4</td><td>=</td><td>8.72MB</td><td>781M</td><td>4/4</td><td>70.1</td><td>=</td><td>7.39MB</td><td>542M</td></tr><tr><td>APoT (OURS)</td><td>5/5</td><td>70.9</td><td>89.7</td><td>7.22 MB</td><td>616M</td><td>4/4</td><td>70.7</td><td>89.6</td><td>5.89 MB</td><td>437M</td></tr><tr><td>ABC-NETS</td><td>3/3</td><td>61.0</td><td>83.2</td><td>6.06MB</td><td>357M</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>DoREFA-NET</td><td>3/3</td><td>67.5</td><td>87.6</td><td>6.06MB</td><td>357M</td><td>2/2</td><td>62.6</td><td>84.6</td><td>4.73MB</td><td>225M</td></tr><tr><td>PACT</td><td>3/3</td><td>68.1</td><td>88.2</td><td>6.06MB</td><td>357M</td><td>2/2</td><td>64.4</td><td>85.6</td><td>4.73 MB</td><td>225M</td></tr><tr><td>LQ-NET</td><td>3/3</td><td>68.2</td><td>87.9</td><td>6.06MB</td><td>357M</td><td>2/2</td><td>64.9</td><td>85.9</td><td>4.73MB</td><td>225M</td></tr><tr><td>DSQ</td><td>3/3</td><td>68.7</td><td>-</td><td>6.06MB</td><td>357M</td><td>2/2</td><td>65.2</td><td>-</td><td>4.73MB</td><td>225M</td></tr><tr><td>QIL</td><td>3/3</td><td>69.2</td><td>-</td><td>6.06MB</td><td>357M</td><td>2/2</td><td>65.7</td><td>-</td><td>4.73MB</td><td>225M</td></tr><tr><td>PACT+SAWB</td><td></td><td></td><td></td><td></td><td></td><td>2/2</td><td>67.0</td><td></td><td>5.36MB</td><td>243M</td></tr><tr><td>APOT (OURS)</td><td>3/3</td><td>69.9</td><td>89.2</td><td>4.56MB</td><td>298M</td><td>2/2</td><td>67.3</td><td>87.5</td><td>3.23MB</td><td>198M</td></tr><tr><td>FP.(RES34)</td><td>32/32</td><td>73.7</td><td>91.3</td><td>83.2MB</td><td>3.68G</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>ABC-NETS</td><td>5/5</td><td>68.4</td><td>88.2</td><td>14.8MB</td><td>1.50G</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>DSQ</td><td></td><td></td><td></td><td></td><td></td><td>4/4</td><td>72.8</td><td></td><td>12.3MB</td><td>1.00G</td></tr><tr><td>QIL</td><td>5/5</td><td>73.7</td><td>-</td><td>14.8MB</td><td>1.50G</td><td>4/4</td><td>73.7</td><td>=</td><td>12.3MB</td><td>1.00G</td></tr><tr><td>APOT(OURS)</td><td>5/5</td><td>73.9</td><td>91.6</td><td>13.3 MB</td><td>1.15G</td><td>4/4</td><td>73.8</td><td>91.6</td><td>10.8 MB</td><td>784M</td></tr><tr><td>ABC-NETS</td><td>3/3</td><td>66.4</td><td>87.4</td><td>9.73MB</td><td>618M</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>LQ-NET</td><td>3/3</td><td>71.9</td><td>90.2</td><td>9.73MB</td><td>618M</td><td>2/2</td><td>69.8</td><td>89.1</td><td>7.20 MB</td><td>340M</td></tr><tr><td>DSQ</td><td>3/3</td><td>72.5</td><td>-</td><td>9.73MB</td><td>618M</td><td>2/2</td><td>70.0</td><td>1</td><td>7.20MB</td><td>340M</td></tr><tr><td>QIL</td><td>3/3</td><td>73.1</td><td>-</td><td>9.73MB</td><td>618M</td><td>2/2</td><td>70.6</td><td>-</td><td>7.20MB</td><td>340M</td></tr><tr><td>APOT(OURS)</td><td>3/3</td><td>73.4</td><td>91.1</td><td>8.23MB</td><td>493M</td><td>2/2</td><td>70.9</td><td>89.7</td><td>5.70MB</td><td>285M</td></tr><tr><td>FP.(RES50)</td><td>32/32</td><td>76.4</td><td>93.1</td><td>97.5MB</td><td>4.14G</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>ABC-NETS</td><td>5/5</td><td>70.1</td><td>89.7</td><td>22.2MB</td><td>1.67G</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>DOREFA-NET</td><td>5/5</td><td>71.4</td><td>93.3</td><td>22.2MB</td><td>1.67G</td><td>4/4</td><td>71.4</td><td>89.8</td><td>19.4MB</td><td>1.11G</td></tr><tr><td>LQ-NET</td><td></td><td></td><td></td><td></td><td></td><td>4/4</td><td>75.1</td><td>92.4</td><td>19.4MB</td><td>1.11G</td></tr><tr><td>PACT</td><td>5/5</td><td>76.7</td><td>93.3</td><td>22.2MB</td><td>1.67G</td><td>4/4</td><td>76.5</td><td>93.3</td><td>19.4 MB</td><td>1.11G</td></tr><tr><td>APOT (OURS)</td><td>5/5</td><td>76.7</td><td>93.3</td><td>16.3MB</td><td>1.28G</td><td>4/4</td><td>76.6</td><td>93.1</td><td>13.6MB</td><td>866M</td></tr><tr><td>DoREFA-NET</td><td>3/3</td><td>69.9</td><td>89.2</td><td>16.6 MB</td><td>680M</td><td>2/2</td><td>67.1</td><td>87.3</td><td>13.8MB</td><td>370M</td></tr><tr><td>PACT</td><td>3/3</td><td>75.3</td><td>92.6</td><td>16.6MB</td><td>680M</td><td>2/2</td><td>72.2</td><td>90.5</td><td>13.8MB</td><td>370M</td></tr><tr><td>LQ-NET PACT+SAWB</td><td>3/3</td><td>74.2</td><td>91.6</td><td>16.6MB</td><td>680M</td><td>2/2 2/2</td><td>71.5 74.2</td><td>90.3</td><td>13.8MB 23.7MB</td><td>370M 707M</td></table>
168
+
169
+ Overall results are shown in Table 1. The results of DoReFa-Net are taken from Choi et al. (2018b), and the other results are quoted from the original papers. It can be observed that our 5-bit quantized network achieves even higher accuracy than the full precision baselines ( $0 . 7 \%$ Top-1 improvement on ResNet-18 and $0 . 2 \%$ Top-1 improvement on ResNet-34 and ResNet-50), which means quantization may serve the purpose of regularization. Along with the accuracy performance, our APoT quantization can achieve better hardware performance on model size and inference speed. For full precision models, the number in the column of FixOPs indicates FLOPs.
170
+
171
+ 4-bit and 3-bit quantized networks are also preserving (or approaching) the full-precision accuracy except for the 3-bit quantized ResNet-18 and ResNet-34, which only drops $0 . 5 \%$ and $0 . 3 \%$ accuracy respectively. When $b$ is further reduced to 2, our model still outperforms the baselines, which demonstrates the effectiveness of RCF and WN. Note that Choi et al. (2018a) use a full precision shortcut in the model, reaching higher accuracy on ResNet-50 however suffering from the hardware performance. In specific, the different precision between the main path and the residual path may result in greater latency in a pipelined implementation.
172
+
173
+ # 4.2 EVALUATION ON CIFAR10
174
+
175
+ We quantize ResNet-20 and ResNet-56 (He et al., 2016) on CIFAR10 for evaluation. We adopt progressive initialization and choose the quantization bit as 2, 3 and 4. More implementations can be found in the Appendix C.2.
176
+
177
+ Table 2: Accuracy comparison of ResNet architectures on CIFAR10
178
+
179
+ <table><tr><td rowspan="2">MODELS METHODS</td><td rowspan="2"></td><td colspan="3">ACCURACY(%)</td></tr><tr><td>2 BITS</td><td>3 BITS</td><td>4 BITS</td></tr><tr><td rowspan="5">REsNET-20 (FP: 91.6)</td><td>DOREFA-NET (ZHOU ET AL.,2016)</td><td>88.2</td><td>89.9</td><td>90.5</td></tr><tr><td>PACT(CHOI ET AL., 2018B)</td><td>89.7</td><td>91.1</td><td>91.7</td></tr><tr><td>LQ-NET (ZHANG ET AL.,2018)</td><td>90.2</td><td>91.6</td><td>-</td></tr><tr><td>PACT+SAWB+FPSC(CHOI ET AL.,2018A)</td><td>90.5</td><td>-</td><td>=</td></tr><tr><td>APOT QUANTIZATION(OURS)</td><td>91.0</td><td>92.2</td><td>92.3</td></tr><tr><td rowspan="2">REsNET-56 (FP: 93.2)</td><td>PACT+SAWB+FPSC (CHOI ET AL., 2018A)</td><td>92.5</td><td>=</td><td>1</td></tr><tr><td>APOTQUANTIZATION (OURS)</td><td>92.9</td><td>93.9</td><td>94.0</td></tr></table>
180
+
181
+ Table. 2 summarizes the accuracy of our APoT in comparison with baselines. For 3-bit and 4-bit models, APoT quantization has reached comparable results with the full precision baselines. It is worthwhile to note that all state-of-the-arts methods in the table use 4 levels to quantize weights into 2-bit. Our model only employs ternary weights for 2-bit representation and still outstrips existing quantization methods.
182
+
183
+ # 4.3 ABLATION STUDY
184
+
185
+ Table 3: Comparison of quantizer, weight normalization and RCF of ResNet-18 on ImageNet.
186
+
187
+ <table><tr><td>METHOD</td><td>PRECISION</td><td>WN</td><td>RCF</td><td>Acc.-1</td><td>RCF</td><td>Acc.-1</td><td>MODEL SIZE</td><td>FIxOPS</td></tr><tr><td>FULL PREC.</td><td>32/32</td><td>:</td><td>-</td><td>70.2</td><td>-</td><td>70.2</td><td>46.8 MB</td><td>1.82G</td></tr><tr><td>APoT</td><td>5/5</td><td></td><td></td><td>70.9</td><td>X</td><td>70.0</td><td>7.22 MB</td><td>616M</td></tr><tr><td>PoT</td><td>5/5</td><td></td><td></td><td>70.3</td><td>X</td><td>68.9</td><td>7.22 MB</td><td>582M</td></tr><tr><td>UNIFORM</td><td>5/5</td><td>&lt;&lt;&gt;</td><td></td><td>70.7</td><td>×</td><td>69.4</td><td>7.22 MB</td><td>781M</td></tr><tr><td>LLOYD</td><td>5/5</td><td>√</td><td>&lt;&lt;&lt;√</td><td>70.9</td><td>X</td><td>70.2</td><td>7.22 MB</td><td>1.81G</td></tr><tr><td>APoT</td><td>3/3</td><td></td><td></td><td>69.9</td><td>X</td><td>68.5</td><td>4.56 MB</td><td>298M</td></tr><tr><td>UNIFORM</td><td>3/3</td><td></td><td></td><td>69.4</td><td>×</td><td>67.8</td><td>4.56 MB</td><td>357M</td></tr><tr><td>LLOYD</td><td>3/3</td><td>/&lt;√</td><td>/&lt;&gt;</td><td>70.0</td><td>X</td><td>69.0</td><td>4.56 MB</td><td>1.81G</td></tr><tr><td>APoT</td><td>3/3</td><td></td><td>√</td><td>2.0</td><td>×</td><td>68.5</td><td>4.56 MB</td><td>198M</td></tr></table>
188
+
189
+ The proposed algorithm consists of three techniques, APoT quantization levels to fit the bell-shaped distribution, RCF to learn the clipping threshold and WN to avoid the perturbation of the distribution of weights during training. In this section, we conduct an ablation study for these three techniques. We compare the APoT quantizer, the vanilla PoT quantizer, uniform quantizer and a non-uniform quantizer using Lloyd algorithm (Cai et al., 2017) to quantize the weights. And we either apply RCF to learn the optimal clipping range or do not clip any weights (i.e. $\alpha = \operatorname* { m a x } | \mathcal { W } | )$ . Weight Normalization is also adopted or discarded to justify the effectiveness of these techniques.
190
+
191
+ Table 3 summarizes the results of ResNet-18 using different techniques. Quantizer using Lloyd achieves the highest accuracy, however, the irregular non-uniform quantized weights cannot utilize the fixed point arithmetic to accelerate the inference time. APoT quantization attends to the distribution of weights, which reaches the same accuracy in 5-bit and only decreases $0 . 2 \%$ accuracy in 3-bit quantization compared with Lloyd, and shares a better tradeoff between task performance and hardware performance. We also observe that the vanilla PoT quantization suffers from the rigid resolution, and has the lowest accuracy in the 5-bit model.
192
+
193
+ Clipping range also matters in quantization, the comparison in Table 3 shows that a proper clipping range can help improve the robustness of the network. Especially when the network is quantized to 3-bit, the accuracy will drop significantly because of the quantization interval increases. Applying RCF to learn the optimal clipping range could improve at most $1 . 6 \%$ accuracy. As we mentioned before, normalization of weight is important to learn the clipping range, and the network diverges if RCF is applied without WN. We refer to the Appendix B for more details of weight normalization during training.
194
+
195
+ # 5 CONCLUSION
196
+
197
+ In this paper, we have introduced the additive powers-of-two (APoT) quantization algorithm for quantizing weights and activations in neural networks, which typically exhibit a bell-shaped and long-tailed distribution. Each quantization level of APoT is the sum of a set of powers-of-two terms, bringing roughly 2x speed-up in multiplication compared with uniform quantization. The distribution of the quantization levels matches that of the weights and activations better than existing quantization schemes. In addition, we propose to reparameterize the clipping function and normalize the weights to get a more stable and better-defined gradient for optimizing the clipping threshold. We reach state-of-the-art accuracy on ImageNet and CIFAR10 dataset compared to uniform or PoT quantization.
198
+
199
+ # ACKNOWLEDGEMENT
200
+
201
+ This work is supported by National University of Singapore FY2017 SUG Grant, and Singapore Ministry of Education Academic Research Fund Tier 3 under MOEs official grant number MOE2017-T3-1-007.
202
+
203
+ # REFERENCES
204
+
205
+ Yoshua Bengio, Nicholas Leonard, and Aaron Courville. Estimating or propagating gradients ´ through stochastic neurons for conditional computation. arXiv preprint arXiv:1308.3432, 2013.
206
+
207
+ Wen-Pu Cai and Wu-Jun Li. Weight normalization based quantization for deep neural network compression. arXiv preprint arXiv:1907.00593, 2019.
208
+
209
+ Zhaowei Cai, Xiaodong He, Jian Sun, and Nuno Vasconcelos. Deep learning with low precision by half-wave gaussian quantization. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 5918–5926, 2017.
210
+
211
+ Jungwook Choi, Pierce I-Jen Chuang, Zhuo Wang, Swagath Venkataramani, Vijayalakshmi Srinivasan, and Kailash Gopalakrishnan. Bridging the accuracy gap for 2-bit quantized neural networks (qnn). arXiv preprint arXiv:1807.06964, 2018a.
212
+
213
+ Jungwook Choi, Zhuo Wang, Swagath Venkataramani, Pierce I-Jen Chuang, Vijayalakshmi Srinivasan, and Kailash Gopalakrishnan. Pact: Parameterized clipping activation for quantized neural networks. arXiv preprint arXiv:1805.06085, 2018b.
214
+
215
+ Misha Denil, Babak Shakibi, Laurent Dinh, Marc’Aurelio Ranzato, and Nando De Freitas. Predicting parameters in deep learning. In Advances in neural information processing systems, pp. 2148–2156, 2013.
216
+
217
+ Steven K. Esser, Jeffrey L. McKinstry, Deepika Bablani, Rathinakumar Appuswamy, and Dharmendra S. Modha. Learned step size quantization. In International Conference on Learning Representations, 2020. URL https://openreview.net/forum?id $\equiv$ rkgO66VKDS.
218
+
219
+ David Goldberg. What every computer scientist should know about floating-point arithmetic. ACM Computing Surveys (CSUR), 23(1):5–48, 1991.
220
+
221
+ Ruihao Gong, Xianglong Liu, Shenghu Jiang, Tianxiang Li, Peng Hu, Jiazhen Lin, Fengwei Yu, and Junjie Yan. Differentiable soft quantization: Bridging full-precision and low-bit neural networks. arXiv preprint arXiv:1908.05033, 2019.
222
+
223
+ Song Han, Huizi Mao, and William J Dally. Deep compression: Compressing deep neural networks with pruning, trained quantization and huffman coding. arXiv preprint arXiv:1510.00149, 2015.
224
+
225
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 770–778, 2016.
226
+
227
+ Elad Hoffer, Ron Banner, Itay Golan, and Daniel Soudry. Norm matters: efficient and accurate normalization schemes in deep networks. In Advances in Neural Information Processing Systems, pp. 2160–2170, 2018.
228
+
229
+ Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. arXiv preprint arXiv:1502.03167, 2015.
230
+
231
+ Sangil Jung, Changyong Son, Seohyung Lee, Jinwoo Son, Jae-Joon Han, Youngjun Kwak, Sung Ju Hwang, and Changkyu Choi. Learning to quantize deep networks by optimizing quantization intervals with task loss. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 4350–4359, 2019.
232
+
233
+ Alex Krizhevsky, Geoffrey Hinton, et al. Learning multiple layers of features from tiny images. Technical report, Citeseer, 2009.
234
+
235
+ Xiaofan Lin, Cong Zhao, and Wei Pan. Towards accurate binary convolutional neural network. In Advances in Neural Information Processing Systems, pp. 345–353, 2017.
236
+
237
+ Daisuke Miyashita, Edward H Lee, and Boris Murmann. Convolutional neural networks using logarithmic data representation. arXiv preprint arXiv:1603.01025, 2016.
238
+
239
+ Antonio Polino, Razvan Pascanu, and Dan Alistarh. Model compression via distillation and quantization. arXiv preprint arXiv:1802.05668, 2018.
240
+
241
+ Siyuan Qiao, Huiyu Wang, Chenxi Liu, Wei Shen, and Alan Yuille. Weight standardization. arXiv preprint arXiv:1903.10520, 2019.
242
+
243
+ Olga Russakovsky, Jia Deng, Hao Su, Jonathan Krause, Sanjeev Satheesh, Sean Ma, Zhiheng Huang, Andrej Karpathy, Aditya Khosla, Michael Bernstein, et al. Imagenet large scale visual recognition challenge. International journal of computer vision, 115(3):211–252, 2015.
244
+
245
+ Tim Salimans and Durk P Kingma. Weight normalization: A simple reparameterization to accelerate training of deep neural networks. In Advances in Neural Information Processing Systems, pp. 901–909, 2016.
246
+
247
+ Dongqing Zhang, Jiaolong Yang, Dongqiangzi Ye, and Gang Hua. Lq-nets: Learned quantization for highly accurate and compact deep neural networks. In Proceedings of the European Conference on Computer Vision (ECCV), pp. 365–382, 2018.
248
+
249
+ Ritchie Zhao, Yuwei Hu, Jordan Dotzel, Chris De Sa, and Zhiru Zhang. Improving neural network quantization without retraining using outlier channel splitting. In International Conference on Machine Learning, pp. 7543–7552, 2019.
250
+
251
+ Aojun Zhou, Anbang Yao, Yiwen Guo, Lin Xu, and Yurong Chen. Incremental network quantization: Towards lossless cnns with low-precision weights. arXiv preprint arXiv:1702.03044, 2017.
252
+
253
+ 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.
254
+
255
+ Chenzhuo Zhu, Song Han, Huizi Mao, and William J Dally. Trained ternary quantization. arXiv preprint arXiv:1612.01064, 2016.
256
+
257
+ # APPENDICES
258
+
259
+ # A GRADIENT DERIVATION
260
+
261
+ In this section, we derive the gradient estimation of PACT (Choi et al., 2018b) along with our proposed Reparameterized Clipping Function and show the distinction of these two estimation.
262
+
263
+ # A.1 PACT
264
+
265
+ Equation (1) shows the forward of PACT. In backpropagation, PACT applies the Straight-Through Estimator for the projection operation. In particular, the STE assumes that
266
+
267
+ $$
268
+ { \frac { \partial \Pi _ { \mathcal { Q } } X } { \partial X } } = 1 ,
269
+ $$
270
+
271
+ which means the variable before and after projection are treated the same in backpropagation. Therefore, the gradients of $\alpha$ in PACT is computed by:
272
+
273
+ $$
274
+ \frac { \partial \hat { W } } { \partial \alpha } = \frac { \partial \Pi _ { Q ( \alpha , b ) } \lfloor \mathcal { W } , \alpha \rfloor } { \partial \lfloor \mathcal { W } , \alpha \rfloor } \frac { \partial \lfloor \mathcal { W } , \alpha \rceil } { \partial \alpha } = \left\{ \begin{array} { l l } { \mathrm { s i g n } ( \mathcal { W } ) } & { \mathrm { i f } \left| \mathcal { W } \right| > \alpha } \\ { 0 } & { \mathrm { i f } \left| \mathcal { W } \right| \le \alpha } \end{array} , \right.
275
+ $$
276
+
277
+ where the first term is computed by STE and the second term is because the clip operation $[ \cdot , \alpha ]$ returns $\mathrm { s i g n } ( \cdot ) \alpha$ when $| \cdot | > \alpha$ . In this gradient estimation, the effect of $\alpha$ in the levels set $\mathcal { Q } ( \alpha , b )$ is ignored by the STE, leading to an inaccurate approximation.
278
+
279
+ # A.2 RCF
280
+
281
+ To avoid the elimination of STE, we reparameterize the clipping function so that the output clipping range before projection is settled and the range is re-scaled after the projection. We can define a general formation of RCF by
282
+
283
+ $$
284
+ \hat { \mathcal { W } } = \frac { \alpha } { c } \Pi _ { \mathcal { Q } ( c , b ) } \lfloor \frac { c } { \alpha } \mathcal { W } , c \rceil ,
285
+ $$
286
+
287
+ where $c > 0$ is a constant. This function clips the weights to $[ - c , c ]$ before projection and re-scaled to $[ - \alpha , \alpha ]$ after projection. Thus, the backpropagation is given by:
288
+
289
+ $$
290
+ \begin{array}{c} \begin{array} { l } { \displaystyle \frac { \partial \hat { \mathcal { W } } } { \partial \alpha } = \frac { \partial \alpha } { \partial \alpha } \times \frac 1 c \Pi _ { \mathcal { Q } ( c , b ) } \lfloor \frac c \alpha \mathcal { W } , c \rfloor + \displaystyle \frac { \partial \Pi _ { \mathcal { Q } ( c , b ) } \lfloor \frac c \alpha \mathcal { W } , c \rfloor } { \partial \lfloor \frac c \alpha \mathcal { W } , c \rfloor } \frac { \partial \lfloor \frac c \alpha \mathcal { W } , c \rfloor } { \partial \alpha } \times \frac \alpha c } \\ { = \displaystyle \left\{ \frac 1 c \times \mathrm { s i g n } ( \frac \alpha \mathcal { W } ) \times c + \frac \alpha c \times 0 \quad \right.} & { \mathrm { i f } | \mathcal { W } | > \alpha } \\ { \displaystyle \frac 1 c \Pi _ { \mathcal { Q } ( c , b ) } \frac { c } { \alpha } \mathcal { W } + \frac \alpha c \times ( - \frac { c } { \alpha ^ { 2 } } ) \mathcal { W } \quad \mathrm { i f } | \mathcal { W } | \le \alpha } \\ { = \displaystyle \left\{ \mathrm { s i g n } ( \frac \alpha \mathcal { W } ) \qquad \quad } & { \mathrm { i f } | \mathcal { W } | > \alpha \right. } \\ { \displaystyle \frac 1 c \Pi _ { \mathcal { Q } ( c , b ) } \frac { c } \alpha \mathcal { W } - \frac { 1 } { \alpha } \mathcal { W } \quad \mathrm { i f } | \mathcal { W } | \le \alpha } \end{array} . \end{array}
291
+ $$
292
+
293
+ Since the levels set $\mathcal { Q }$ is not parameterized by $\alpha$ , the gradients will flow to two parts in RCF: the re-scale coefficient and the scale in clipping function. The constant $c$ here do not impact the gradient estimation, therefore we choose 1 for simplicity in the implementation. Note that in uniform quantization scheme, this function is equivalent to the Learned Step Size Quantization (Esser et al., 2020), where the setp size is the same for all levels while RCF provides a more general formation for any levels set $\mathcal { Q }$ .
294
+
295
+ # B HOW DOES NORMALIZATION HELP QUANTIZATION
296
+
297
+ In this section, we show some experimental results to illustrate the effect of our weights normalization in quantization neural networks.
298
+
299
+ ![](images/d4f25614e44cf9c0581acb53bb10a413457c9bcdcdb956236f69dfb285cb7194.jpg)
300
+ Figure 5: When weights are normalized the distribution of weights are more stable. The dashed line shows the mean value of weights.
301
+
302
+ # B.1 WEIGHTS DISTRIBUTION
303
+
304
+ We visualize the density distribution of weights before normalization $\mathcal { W }$ and after normalization $\tilde { \mathcal W }$ during training to demonstrate its effectiveness.
305
+
306
+ Figure 5a demonstrates the density distribution of the fifth layer of the 5-bit quantized ResNet-18, from which we can see that the density of the unnormalized weights could be extensive high $( > 8 )$ in the centered area. Such distribution indicates that even a tiny change of clipping threshold would bring a significant effect on clipping when $\alpha$ is small, as shown in Figure 4a. , which means a small learning rate for $\alpha$ is needed. However, if the learning rate is too small, the change of $\alpha$ cannot follow the change of weights distribution because weights are also updated according to Figure 5a. Thus it is unfavorable to train the clipping threshold for unnormalized weights, while Figure 5b shows that the normalized weights can have a stable distribution. Furthermore, the dashed line in the figure indicates $\mathcal { W }$ usually do not have zero mean, which may not utilize the symmetric design of quantization levels.
307
+
308
+ # B.2 TRAINING BEHAVIOR
309
+
310
+ The above experiments use normalization during training to compare the distribution of weights. In this section, we compare the training of quantization neural networks with and without normalization to investigate the real effect of WN. Here, we train a 3-bit quantized (full precision for activations) ResNet-20 from scratch, and compare the results under different learning rate for $\alpha$ . The results are shown in Table 4, from which we can find that if weights are normalized during training, the network can converge to descent performances and is robust to the learning rate of clipping threshold. However, if the weights are not normalized, the network would diverge if the learning rate for $\alpha$ is too high. Even if the learning rate is set to a lower value, the network does not outperform the normalized one. Based on the training behaviors, the learning rate for clipping threshold without WN in QNNs need a careful choice.
311
+
312
+ Table 4: Accuracy comparison of 3-bit quantized ResNet-20 on CIFAR10.
313
+
314
+ ![](images/d2162a50a836907d469220f34e80810a93f268b39dcf0ad70382113424671738.jpg)
315
+ Figure 6: A summary of projection error and clipping error in different layers.
316
+
317
+ # C EXPERIMENTAL DETAILS
318
+
319
+ # C.1 REVISITING QUANTIZATION ERROR
320
+
321
+ Typically, quantization error $( \Delta )$ is defined as the mean squared error between weights $\tilde { \mathcal W }$ and $\hat { \mathcal W }$ before and after quantization respectively, defined as $\Delta = \mathbb { E } [ \tilde { \mathcal { W } } - \hat { \mathcal { W } } ] ^ { 2 }$ . This quantization error is composed of two errors, the clipping error $\Delta _ { c l i p }$ produced by $\lfloor \cdot , \alpha \rceil$ and the projection error $\Delta _ { p r o j }$ produced by $\Pi _ { \mathfrak { Q } }$ . I.e.
322
+
323
+ $$
324
+ \Delta = \Delta _ { c l i p } + \Delta _ { p r o j } = \frac { 1 } { I } \sum _ { | \tilde { \mathcal { W } } _ { i } | > \alpha } \left( | \tilde { \mathcal { W } } _ { i } | - \alpha \right) ^ { 2 } + \frac { 1 } { I } \sum _ { | \tilde { \mathcal { W } } _ { i } | \leq \alpha } ( \tilde { \mathcal { W } } _ { i } - \hat { \mathcal { W } } _ { i } ) ^ { 2 } .
325
+ $$
326
+
327
+ Previous methods (Zhang et al., 2018; Cai et al., 2017) seek to minimize the quantization error to obtain the optimal clipping threshold (i.e. $\begin{array} { r } { \alpha = \arg \operatorname* { m i n } _ { \alpha } ( \Delta _ { c l i p } + \Delta _ { p r o j } ) ) } \end{array}$ , while RCF is directly optimized by the final training loss to balance projection error and clipping error. We compare the Quantization Error Minimization (QEM) method with our RCF on the quantized ResNet-18 model. Figure 6 gives an overview of the clipping error and projection error using RCF or QEM.
328
+
329
+ For the 5-bit quantized model, RCF has a much higher quantization error. The projection error obtained by RCF is lower than QEM and QEM significantly reduces the clipping error. Therefore, we can infer that projection error has a higher priority in RCF. When quantizing to 3-bit, the clipping error in RCF still exceeds QEM except for the first quantized layer. This means RCF can identify whether the projection is more important than the clipping over different layers and bit-width. Generally, the insight behind is that simply minimizing the quantization error may not be the best choice and it is more direct to optimize threshold with respect to training loss.
330
+
331
+ # C.2 IMPLEMENTATIONS DETAILS
332
+
333
+ The ImageNet dataset consists of 1.2M training and 50K validation images. We use a standard data preprocess in the original paper (He et al., 2016). For training images, they are randomly cropped and resized to $2 2 4 \times 2 2 4$ . Validation images are center-cropped to the same size. We use the Pytorch official code 4 to construct ResNets, and they are initialized from the released pre-trained model. We use stochastic gradient descent (SGD) with the momentum of 0.9 to optimize both weight parameters and the clipping threshold simultaneously. Batch size is set to 1024 and the learning rate starts from 0.1 with a decay factor of 0.1 at epoch 30,60,80,100. The network is trained up to 120 epochs and weight decay is set to $1 0 ^ { - 4 }$ for 3-bit quantized models or higher and $2 \times 1 0 ^ { - 5 }$ for 2-bit model.
334
+
335
+ The CIFAR10 dataset contains 50K training and 10K test images with $3 2 \times 3 2$ pixels. The ResNet architectures for CIFAR10 (He et al., 2016) contains a convolutional layer followed by 3 residual blocks and a final FC layer. We train full precision ResNet-20 and ResNet-56 firstly and use them as initialization for quantized models. All networks were trained for 200 epochs with a mini-batch size of 128. SGD with momentum of 0.9 was adopted to optimize the parameters. Learning rate started at 0.04 and was scaled by 0.1 at epoch 80,120. Weight decay was set to $1 0 ^ { - 4 }$ .
336
+
337
+ For clipping threshold $\alpha$ , we set 8.0 for activations and 3.0 for weights as initial value when training a 5-bit quantized model. The learning rate of $\alpha$ is set to 0.01 and 0.03 for weights and activations, respectively. During practice, we found that the learning rate of $\alpha$ merely does not influence network performance. Different from PACT (Choi et al., 2018b), the update of $\alpha$ in our works already consider the projection error, so we do not require a relatively large L2-regularization. In practice, the network works fine when the weight decay for $\alpha$ is set to $\mathrm { \bar { 1 0 } } ^ { - 5 }$ and may increase to $1 0 ^ { - 4 }$ when bit-width is reduced.
md/train/BkgYPREtPr/BkgYPREtPr.md ADDED
@@ -0,0 +1,398 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Symplectic Recurrent Neural Networks
2
+
3
+ Zhengdao Chen $^ { a , c }$ , Jianyu Zhang $^ { ^ { b , c } }$ , Martin Arjovsky $^ a$ , Léon Bottou $c , a$
4
+
5
+ $^ { a }$ New York University, New York, USA $^ { b }$ Tianjin University, Tianjin, China $_ c$ Facebook AI Research, New York, USA
6
+
7
+ # Abstract
8
+
9
+ We propose Symplectic Recurrent Neural Networks (SRNNs) as learning algorithms that capture the dynamics of physical systems from observed trajectories. An SRNN models the Hamiltonian function of the system by a neural network and furthermore leverages symplectic integration, multiplestep training and initial state optimization to address the challenging numerical issues associated with Hamiltonian systems. We show SRNNs succeed reliably on complex and noisy Hamiltonian systems. We also show how to augment the SRNN integration scheme in order to handle stiff dynamical systems such as bouncing billiards.
10
+
11
+ # 1 Introduction
12
+
13
+ Can machines learn physical laws from data? A recent paper (Greydanus et al., 2019), Hamiltonian Neural Networks (HNN), proposes to do so representing the Hamiltonian function $H ( q , p )$ as a multilayer neural network. The partial derivatives of this network are then trained to match the time derivatives $\dot { p }$ and $\dot { q }$ observed along the trajectories in state space.
14
+
15
+ The ordinary differential equations (ODEs) that express Hamiltonian dynamics are famous for both their mathematical elegance and their challenges to numerical integration techniques. Except maybe for the simplest Hamiltonian systems, discretization errors and measurement noise lead to quickly diverging trajectories. In other words, Hamiltonian systems can often be stiff, a concept that usually refers to differential equations where we have to take very small time-steps of integration so that the numerical solution remain stable (Lambert, 1991). A plethora of numerical integration methods, symplectic integrators, have been developed to respect the conserved quantities in Hamiltonian systems, thereby usually being more stable and structure-preserving than non-symplectic ones (Hairer et al., 2002). For example, the simplest symplectic integrator is the well-known leapfrog method, also known as the Stömer-Verlet integrator (Leimkuhler and Reich, 2005). However, even the best integrators remain severely challenged by phenomena as intuitive as a mechanical rebound or a slingshot effect, which are more severe forms of stiffness. Such numerical issues are almost doomed to conflict with the inherently approximate nature of a learning algorithm.
16
+
17
+ In the first part of this paper, we propose Symplectic Recurrent Neural Networks (SRNNs), where $( i )$ the partial derivatives of the neural-network-parametrized Hamiltonian are integrated with the leapfrog integrator and where $( i i )$ the loss is back-propagated through the ODE integration over multiple time steps. We find that in the presence of observation noise, SRNN are far more usable than HNNs. Further improvements are achieved by simultaneously optimizing the initial state and the Hamiltionian network, presenting an interesting contrast to previous literature on the hardness of general initial state optimization (Peifer and Timmer, 2007). The optimization can be motivated from a maximum likelihood estimation perspective, and we provide heuristic arguments for why the initial state optimization is likely convex given the symplecticness of the system. Furthermore, experiments in the three-body problem show that the SRNN-trained Hamiltonian compensates for discretization errors and can even outperform numerically solving the ODE using the true Hamiltonian and the same time-step size. This could be of particular interest to researchers who study the application of machine learning to numerically solving differential equations.
18
+
19
+ The second part of this paper focuses on perfect rebound as an example of the more severe form of stiffness. When a point mass rebounds without loss of energy on a perfectly rigid obstacle, the motion of the point mass is changed in ways that can be interpreted as an infinite force applied during an infinitesimal time. The precise timing of this event affects the trajectory of the point mass in ways that essentially make it impossible to merely simulate the Hamiltonian system on a predefined grid of time points. In order to address such events in learning, we augment the leapfrog integrator used in our SRNN with an additional trainable operator that models the rebound events and relates their occurrence to visual hints. Training such an augmented SRNN on observed trajectories not only learns the point mass dynamics but also learns the visual appearance of the obstacles.
20
+
21
+ # 2 Related work
22
+
23
+ Learning physics with neural networks A popular category of methods attempts to replicate the intuitive ways in which humans perceive simple physical interactions, identifying objects and learning how they relate to each other (Battaglia et al., 2016; Chang et al., 2016). Since such methods cannot be used for more general physical systems, another category of methods seeks to learn which differential equations govern the evolution of a physical system on the basis of observed trajectories. Brunton et al. (2016) assemble a small number of predefined primitives in order to find an algebraically simple solution. Lutter et al. (2019) use a neural network to model the Lagrangian function of a robotic system. Most closely related to ours, Greydanus et al. (2019) use a neural network to learn the Hamiltonian of the dynamical system in such a way that its partial derivatives match the time derivatives of the position and momentum variables, which are both assumed to be observed. Although the authors show success on a simple pendulum system, this approach does not perform well on a more complex system such as a three-body problem.
24
+
25
+ ODE-based learning and recurrent neural networks (RNNs) To learn an ODE that underlies some observed time series data, Chen et al. (2018a) proposes to solve a neuralnetwork-parameterized ODE numerically and minimize the distance between the generated time series with the observed data. To save memory, they propose to use the adjoint ODE instead of back-propagating through the ODE solver. Using stability analysis of ODEs, Chang et al. (2019) propose the AntisymmetricRNN with better trainability. Niu et al. (2019) establish a correspondence between RNNs and ODEs, and propose an RNN architecture inspired by a universal quantum computation scheme.
26
+
27
+ Summary of our main contributions: In this paper, we propose SRNN, which • learns Hamiltonian dynamics directly from position and momentum time series • performs well on noisy and complex systems such as a spring-chain system and a three-body system, and is compatible with initial state optimzation • is augmented to handle perfect rebound, an example of very stiff Hamiltonian dynamics
28
+
29
+ # 3 Framework
30
+
31
+ # 3.1 Hamiltonian systems
32
+
33
+ A Hamiltonian system of dimension $d$ is described by two vectors $p , q \in \mathbb { R } ^ { d }$ . Typically, they correspond to the momentum and position variables, respectively. The evolution of the system is determined by the Hamiltonian function $H : ( p , q , t ) \in \mathbb { R } ^ { 2 d + 1 } \mapsto H ( p , q , t ) \in \mathbb { R }$ through a system of ordinary differential equations called Hamilton’s equations,
34
+
35
+ $$
36
+ \dot { p } = - \frac { \partial H } { \partial q } \ , \qquad \dot { q } = + \frac { \partial H } { \partial p } \ ,
37
+ $$
38
+
39
+ where we use the dot notation to compactly represent derivatives with respect to the time variable $t$ . We are focusing in this work on Hamiltonians that are conservative,1 that is, they do not depend on the time variable $t$ , and separable,2 that is, they can be written as a
40
+
41
+ sum $H ( p , q ) = K ( p ) + V ( q )$ . In this case, (1) becomes
42
+
43
+ $$
44
+ \dot { p } = - V ^ { \prime } ( q ) , \dot { q } = K ^ { \prime } ( p )
45
+ $$
46
+
47
+ With a proper choice of the $p$ and $q$ variables, the evolution of essentially all physical systems can be described with the Hamiltonian framework. In other words, Hamilton’s equations restrict the vast space of dynamical systems to the considerably smaller space of dynamical systems that are physically plausible.
48
+
49
+ Therefore, instead of modeling the dynamics of a physical system with a neural network $f _ { \boldsymbol { \theta } } ( \boldsymbol { p } , \boldsymbol { q } )$ whose outputs are interpreted as estimates of the time derivatives $\dot { p }$ and $\dot { q }$ , we can also use a neural network $H _ { \boldsymbol \theta } ( p , q ) = K _ { \boldsymbol \theta _ { 1 } } ( p ) + V _ { \boldsymbol \theta _ { 2 } } ( q )$ with $\theta = \lfloor \theta _ { 1 } , \theta _ { 2 } \rfloor$ , whose partial derivatives $- V _ { \theta _ { 2 } } ^ { \prime } ( q )$ and $K _ { \theta _ { 1 } } ^ { \prime } ( p )$ are interpreted as the time derivatives $\dot { p }$ and $\dot { q }$ . We refer to the former as ODE neural networks (O-NET) and the latter approach as Hamiltonian neural networks (H-NET). In order to define a complete learning system, we need to explain how to determine the parameter $\theta$ of the neural networks on the basis of observed discrete trajectories. For instance, Greydanus et al. (2019) trains H-NET in a fully supervised manner using the observed tuples $( p , q , \dot { p } , \dot { q } )$ .
50
+
51
+ # 3.2 From ODEs to discrete trajectories
52
+
53
+ A numerical integrator (or ODE solver) approximates the true solution of an ODE of the form $\dot { z } = f ( z , t )$ at discrete time steps $t _ { 0 } , t _ { 1 } . . . t _ { T }$ . For instance, the simplest integrator, Euler’s integrator, starts from the initial state $z _ { \mathrm { 0 } }$ at time $t _ { 0 }$ and estimates the function $z ( t )$ at uniformly spaced time points $t _ { n } = t _ { 0 } + n \Delta t$ with the recursive expression
54
+
55
+ $$
56
+ z _ { n + 1 } = z _ { n } + \Delta t f ( z _ { n } , t _ { n } )
57
+ $$
58
+
59
+ In stiff ODE systems, however, using Euler’s method could easily lead to unstable solutions unless the time-step is chosen to be very small (Lambert, 1991). The development of efficient and accurate numerical integrators is the object of considerable research (Hairer et al., 2008; Hairer and Wanner, 2013). Symplectic integrators3 are particularly attractive for the integration of Hamilton’s equations (Leimkuhler and Reich, 2005). They are able to preserve quadratic invariants, and therefore usually have desired stability properties as well as being structure-preserving (McLachlan et al., 2004), even for certain non-Hamiltonian systems (Chen et al., 2018b). A simple and widely-used symplectic integrator is the leapfrog integrator. When the Hamiltonian is conservative and separable (2), it computes successive estimates $( p _ { n } , q _ { n } )$ with
60
+
61
+ $$
62
+ \begin{array} { r l } & { p _ { n + 1 / 2 } = p _ { n } - \frac { 1 } { 2 } \Delta t V ^ { \prime } ( q _ { n } ) } \\ & { ~ q _ { n + 1 } = q _ { n } + \Delta t K ^ { \prime } ( p _ { n + 1 / 2 } ) } \\ & { ~ p _ { n + 1 } = p _ { n + 1 / 2 } - \frac { 1 } { 2 } \Delta t V ^ { \prime } ( q _ { n + 1 } ) } \end{array}
63
+ $$
64
+
65
+ Repeatedly executing update equations (4) is called the leapfrog algorithm, which is as computationally efficient as Euler’s method yet considerably more accurate when the ODE belongs to a Hamiltonian system (Leimkuhler and Reich, 2005).
66
+
67
+ # 3.3 Learning ODEs from discrete trajectories
68
+
69
+ Following Chen et al. (2018a), let the right hand side of the ODE be a parametric function $f _ { \theta } ( z , t )$ and let $z _ { 0 } \dots z _ { T }$ be an observed trajectory measured at uniformly spaced time points $t _ { 0 } \ldots t _ { T }$ . We can estimate the parameter $\theta$ that best represents the dynamics of the observed trajectory by minimizing the mean squared error $\begin{array} { r } { \sum _ { i = 1 } ^ { T ^ { \prime } } \| z _ { i } - \hat { z } _ { i } ( \theta ) \| _ { 2 } } \end{array}$ between the observed trajectory $\{ z _ { i } \} _ { i = 0 } ^ { I }$ and the trajectory $\{ \hat { z } _ { i } ( \theta ) \} _ { i = 0 } ^ { T }$ generated with our integrator of choice,
70
+
71
+ $$
72
+ \{ \hat { z } _ { i } ( \theta ) \} _ { i = 0 } ^ { T } = I n t e g r a t o r ( z _ { 0 } , f _ { \theta } , \{ t _ { i } \} _ { i = 0 } ^ { T } ) ~ .
73
+ $$
74
+
75
+ For instance, this minimization can be achieved using stochastic gradient descent after back-propagating through the steps of our numerical integration algorithm of choice and then through each call to the functions $f _ { \theta }$ . This can be done when $f _ { \theta } ( z )$ is a neural network (O-NET), or is the concatenation $[ - V _ { \theta _ { 2 } } ^ { \prime } ( q ) , K _ { \theta _ { 1 } } ^ { \prime } ( p ) ]$ of the partial derivatives of an H-NET
76
+
77
+ $H _ { \boldsymbol \theta } ( p , q ) = K _ { \boldsymbol \theta _ { 1 } } ( p ) + V _ { \boldsymbol \theta _ { 2 } } ( q )$ , where the partial derivatives can be expressed using the same parameters $\theta$ as the Hamiltonian $H _ { \theta } ( p , q )$ , for instance using automatic differentiation. We can then predict trajectories at testing time using the trained $f _ { \theta ^ { \ast } }$ and initial state $z _ { 0 } ^ { \mathrm { t e s t } }$ ,
78
+
79
+ $$
80
+ \left\{ \hat { z } _ { i } ^ { \mathrm { t e s t } } \right\} _ { i = 0 } ^ { T ^ { \mathrm { t e s t } } } = I n t e g r a t o r ( z _ { 0 } ^ { \mathrm { t e s t } } , f _ { \theta ^ { * } } , \left\{ t _ { i } \right\} _ { i = 0 } ^ { T ^ { \mathrm { t e s t } } } ) \ .
81
+ $$
82
+
83
+ Note that neither the integrator, nor the number of steps, nor the step size, need to be the same at training and testing.
84
+
85
+ # 3.4 Symplectic Recurrent Neural Network
86
+
87
+ This framework provides a number of nearly orthogonal design options for the construction of algorithms that model dynamical systems using trajectories:
88
+
89
+ • The time derivative model could be an O-NET or H-NET. The training integrator can be any explicit integrators. In our experiments, we only focus on Euler’s integrator and the leapfrog integrator. The training trajectories can consist of a single step, $T { = } 1$ , or multiple steps, $T > 1$ . We refer to the first case as single-step and the second case as multi-step or recurrent training, because back-propagating through multiple steps of the training integrator is comparable to back-propagating through time in recurrent networks.
90
+ • The testing integrator can also be chosen freely and can use a different time-step size as it does not involve back-propagation.
91
+
92
+ In order to save space while describing the possibly different integrators used for training and testing, we use the labels “E-E”, “E-L”, and “L-L”, where the first letter tells which integrator was used for training —“E” for Euler and “L” for leapfrog— and the second letter indicates which integrator was used as testing time. For instance, with our terminology, the HNN model of Greydanus et al. (2019) is a “single-step E-E H-NET” with the additional subtlety that they supervise the training with actual derivatives instead of relying on finite differences between successive steps of the observed trajectories.
93
+
94
+ A Symplectic Recurrent Neural Network (SRNN) is a recurrent H-NET that relies on a symplectic integrator for both training and testing, such as, for instance, a "recurrent L-L H-NET". As shown in the rest of this paper, SRNNs are far more usable and robust than the alternatives, especially when the Hamiltonian gets complex and the data gets noisy. We believe that SRNNs may also have other potential benefits: because leapfrog preserves volumes in the state space (Hairer et al., 2002), we conjecture that vanishing and exploding gradients’ issues in backpropagating through entire state sequences are ameliorated (Arjovsky et al., 2015). Finally, because the leapfrog integrator is reversible in time, there is no need to store states during the forward pass as they can be recomputed exactly during the backward pass. We leave studying these other computational and optimization benefits as a topic of future work.
95
+
96
+ # 4 SRNN can learn complex and noisy Hamiltonian dynamics
97
+
98
+ As an example of a complex Hamiltonian system, we first present experiments performed on the spring-chain system: a chain of 20 masses with neighbors connected via springs. Each of the two masses on the ends are connected to fixed ground via another spring. The chain can be assumed to lay horizontally and the masses move vertically but no gravity is assumed. The 20 masses and the 21 spring constants are chosen randomly and independently. The training data consist of 1000 trajectories of the same chain, each of which starts from a random initial state of positions and momenta of the masses and is 10-time-step long (including the initial state). We thus take $T = 9$ when performing recurrent training. When performing single-step training, each training trajectory of length 10 is instead considered as 9 consecutive trajectories of length 2. In this way, 1000 sample trajectories of length 10 ( $T$ =9) are turned into 9000 sample trajectories of length 2 ( $T { = } 1$ ), allowing for a fair comparison between single-step training and recurrent training. During testing, the trained model is given 32 random initial states in order to predict 32 trajectories of length 100. Detailed experiment setups and model architectures are provided in Appendix A.1, and a PyTorch implementation can be found at https://github.com/zhengdao-chen/SRNN.git.
99
+
100
+ ![](images/9b538b538f589912be7bd4e31d61df851eaba2304128f8d044ea9a3e9b6b14d1.jpg)
101
+ Figure 1: Testing results in the noiseless case by single-step methods. Left: Prediction error of each method over time, measured by the L2 distance between the true and predicted positions of the 20 masses. Right: Each curve represents the position of one of the masses (number 5) as a function of time predicted by the three single-step-trained H-NET models. Plots of the other masses’ positions are provided in Appendix D.1.
102
+
103
+ # 4.1 Going symplectic - rescuing HNN with the leapfrog integrator
104
+
105
+ First, we consider the noiseless case, where the training data consist of exact values of the positions $( q )$ and momenta (p) of the masses on the chain at each discrete time point. As shown in figure 1, the prediction of a single-step E-E H-NET deviates from the ground truth quickly and is unable to capture the periodic motion. By comparison, a single-step E-E ONET yields predictions that is qualitatively reasonable. This shows that using Hamiltonian models without paying attention to the integration scheme may not be a good idea.
106
+
107
+ We then replace Euler’s integrator used during testing by a leapfrog integrator, yielding a Single-step E-L H-NET. Figure 1 shows that this helps the H-NET produce predictions that remain stable and periodic over a longer period of time. Since the training process remains the same, this implies that part of the instability and degeneration of H-NET’s predictions comes from the nature of Euler’s integrator rather than the lack of proper training.
108
+
109
+ In contrast, using a leapfrog integrator for both training and testing substantially improve the performance, as also shown again in figure 1. This improvement shows the importance of consistency between the integrators used in training and predicting modes. This can be understood with the concept of modified equations (Hairer, 1994): when we use a numerical integrator to solve an ODE, the numerical solution usually does not strictly follow the original equation due to discretization, but can be regarded as a solution to a modified version of the original equation that depends on the integrator and the time-step size. Therefore, training and testing with the same numerical integrator and time-step size could allow the system to learn a modified Hamiltonian that corrects some of the errors caused by the discretization scheme.
110
+
111
+ # 4.2 Going recurrent - using multi-step training when noise is present
112
+
113
+ Since noise is prevalent in real-world observations, we also test our models on noisy trajectories. Independent and identically distributed Gaussian noise is added to both the position and the momentum variables at each time step. Applying the single-step methods described above yield considerably worse predictions, as shown in Figure 2 (left).
114
+
115
+ This phenomenon can be controlled by training on multiple steps, effectively arriving at a type of recurrent neural network: if noise is added independently at each time-step, then having data from multiple consecutive time steps may allow us to discern the actual noiseless trajectory, analogous to performing linear regression on multiple (more than 2) noisy data points. As we see in Figure 2 (left), recurrent training consistently improves the predictions except for E-E H-NET. The best performing model is the SRNN (recurrent L-L H-Net) which improves substantially over the single-step L-L H-NET. Interestingly, the recurrent E-E H-NET does not improve over the single-step E-E H-NET, which means that recurrent training does not help if one uses a naïve integrator.
116
+
117
+ # 4.3 Initial state optimization (ISO)
118
+
119
+ However, one issue remains to be addressed: in the framework that we have adopted so far, the initial states $p _ { 0 }$ and $q _ { 0 }$ are treated as the actual initial states from which the system begins to evolve despite the added noise in observation. With noise added to the observation of $p _ { 0 }$ and $q _ { 0 }$ , our dynamical models will start from these noisy states and remain biased as we advance in time in both the training and the testing mode.
120
+
121
+ ![](images/eee0d8f6c04f4bfdbfb00b4d5eeb875bdcd1f04d436115517315983e6d9cad88.jpg)
122
+ Figure 2: Prediction error of all methods in the noisy case measured by L2 distance, presented in two plots due to the large number of methods. Included in the left plot are the single-step-trained methods, recurrently trained methods, vanilla RNN and LSTM. Included in the right plot are the (same) recurrently trained methods, the recurrently trained methods with initial state optimization (ISO), as well as vanilla RNN and LSTM with ISO.
123
+
124
+ ![](images/30befd7f3e22c1057a74b4852ef1e47cad7607a2e215fa16b4a2ed2f0248acd7.jpg)
125
+ Figure 3: Predictions made by three methods in the noisy case. The Y-axis corresponds to the position of one of the masses (number 5) on the chain.
126
+
127
+ To mitigate this issue, we propose to introduce two new parameter vectors for each sample, $\hat { p } _ { 0 }$ and $\hat { q } _ { 0 }$ , interpreted as our estimate of the actual initial states, and we let our dynamical models evolve starting from them instead of the observed $p _ { 0 }$ and $q _ { 0 }$ . Treating $\hat { p } _ { 0 }$ and $\hat { q } _ { 0 }$ as parameters, we can optimize them based on the loss function while fixing the model’s parameters, a process that we call initial state optimization (ISO). When the model is good enough, we hope that this will guide us towards the true initial states without observation noise. In Appendix B, we motivate the use of ISO from the perspective of maximum likelihood inference. In actual training, we first train the neural network parameters for 100 epochs as usual, and starting from the 101st, after every epoch we perform ISO with the L-BFGS-B algorithm (Zhu et al., 1997) on the $\hat { p } _ { 0 }$ and $\hat { q } _ { 0 }$ parameters for every training trajectory. At testing time, the model is given the noisy values of $p$ and $q$ for the first 10 time steps and must complete the trajectory for the next 200 steps. These 10 initial time steps allow us to perform the same L-BFGS-B optimization to determine the initial state $\hat { p } _ { 0 }$ before advancing in time to predict the entire trajectory.
128
+
129
+ As seen in Figure 2 (right), SRNN-ISO (i.e. SRNN equipped with ISO) clearly yields the best prediction among all the methods. Figure 3 shows the predictions of HNN, SRNN and SRNN-ISO on one test sample, and we clearly see the qualitative improvements thanks to recurrent training and ISO. O-NET also benefits from ISO while vanilla RNN and LSTM do not seem to, likely because the initial state optimization only works when we already have a reasonable model of the system. In Appendix C, we give a heuristic argument for the convexity of ISO, which helps to explain the success of using L-BFGS-B for ISO.
130
+
131
+ In summary, we have proposed three extensions to learning complex and noisy dynamics with H-NET and demonstrated the improvements they lead to: a) using the leapfrog integrator instead of Euler’s integrator; b) using recurrent instead of single-step training; and c)
132
+
133
+ Table 1: Testing results of predicting the dynamics of the spring-chain system by methods based on fixed $p _ { 0 }$ , $q _ { 0 }$ (i.e., not optimizing $p _ { 0 }$ , $q _ { 0 }$ as parameters). The error is defined as the discrepancy between the (noisy) ground truth and the predictions at each time step averaged over the first 200 time steps, where the discrepancy is measured by the L2 distance between the true and predicted positions of the 20 masses in the chain, both of which considered as 20-dimensional vectors. The mean and standard deviation are computed based on 32 testing samples, each starting from a random configuration of the chain.
134
+
135
+ Table 2: Testing results of predicting the dynamics of the spring-chain system by methods that optimize on $p _ { 0 }$ and $q _ { 0 }$ starting from their observed (noisy) values using L-BFGS-B, as explained in the text. The definition of the errors is the same as in the above table.
136
+
137
+ <table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>Model</td><td rowspan=1 colspan=1>Integrator (tr)</td><td rowspan=1 colspan=1>Integrator(te)</td><td rowspan=1 colspan=1>Error mean</td><td rowspan=1 colspan=1>Error std</td></tr><tr><td rowspan=6 colspan=1>single-step</td><td rowspan=3 colspan=1>O-NET</td><td rowspan=1 colspan=1>Euler</td><td rowspan=1 colspan=1>Euler</td><td rowspan=1 colspan=1>6.93</td><td rowspan=1 colspan=1>1.22</td></tr><tr><td rowspan=1 colspan=1>Euler</td><td rowspan=1 colspan=1>Leapfrog</td><td rowspan=1 colspan=1>5.87</td><td rowspan=1 colspan=1>1.04</td></tr><tr><td rowspan=1 colspan=1>Leapfrog</td><td rowspan=1 colspan=1>Leapfrog</td><td rowspan=1 colspan=1>7.28</td><td rowspan=1 colspan=1>1.48</td></tr><tr><td rowspan=3 colspan=1>H-NET</td><td rowspan=1 colspan=1>Euler</td><td rowspan=1 colspan=1>Euler</td><td rowspan=1 colspan=1>7.24</td><td rowspan=1 colspan=1>0.64</td></tr><tr><td rowspan=1 colspan=1>Euler</td><td rowspan=1 colspan=1>Leapfrog</td><td rowspan=1 colspan=1>3.32</td><td rowspan=1 colspan=1>0.89</td></tr><tr><td rowspan=1 colspan=1>Leapfrog</td><td rowspan=1 colspan=1>Leapfrog</td><td rowspan=1 colspan=1>3.36</td><td rowspan=1 colspan=1>0.67</td></tr><tr><td rowspan=8 colspan=1>recurrent</td><td rowspan=3 colspan=1>O-NET</td><td rowspan=1 colspan=1>Euler</td><td rowspan=1 colspan=1>Euler</td><td rowspan=1 colspan=1>2.88</td><td rowspan=1 colspan=1>0.45</td></tr><tr><td rowspan=1 colspan=1>Euler</td><td rowspan=1 colspan=1>Leapfrog</td><td rowspan=1 colspan=1>4.12</td><td rowspan=1 colspan=1>0.41</td></tr><tr><td rowspan=1 colspan=1>Leapfrog</td><td rowspan=1 colspan=1>Leapfrog</td><td rowspan=1 colspan=1>3.34</td><td rowspan=1 colspan=1>0.86</td></tr><tr><td rowspan=3 colspan=1>H-NET</td><td rowspan=1 colspan=1>Euler</td><td rowspan=1 colspan=1>Euler</td><td rowspan=1 colspan=1>7.58</td><td rowspan=1 colspan=1>0.63</td></tr><tr><td rowspan=1 colspan=1>Euler</td><td rowspan=1 colspan=1>Leapfrog</td><td rowspan=1 colspan=1>5.26</td><td rowspan=1 colspan=1>0.63</td></tr><tr><td rowspan=1 colspan=1>Leapfrog</td><td rowspan=1 colspan=1>Leapfrog</td><td rowspan=1 colspan=1>2.37</td><td rowspan=1 colspan=1>0.87</td></tr><tr><td rowspan=1 colspan=1>Vanilla RNN</td><td rowspan=1 colspan=1>N/A</td><td rowspan=1 colspan=1>N/A</td><td rowspan=1 colspan=1>4.80</td><td rowspan=1 colspan=1>0.82</td></tr><tr><td rowspan=1 colspan=1>LSTM</td><td rowspan=1 colspan=1>N/A</td><td rowspan=1 colspan=1>N/A</td><td rowspan=1 colspan=1>5.95</td><td rowspan=1 colspan=1>1.05</td></tr></table>
138
+
139
+ <table><tr><td rowspan=1 colspan=1>Model</td><td rowspan=1 colspan=1>Integrator (tr)</td><td rowspan=1 colspan=1>Integrator (te)</td><td rowspan=1 colspan=1>Error mean</td><td rowspan=1 colspan=1>Error std</td></tr><tr><td rowspan=3 colspan=1>O-NET</td><td rowspan=1 colspan=1>Euler</td><td rowspan=1 colspan=1>Euler</td><td rowspan=1 colspan=1>2.13</td><td rowspan=1 colspan=1>0.37</td></tr><tr><td rowspan=1 colspan=1>Euler</td><td rowspan=1 colspan=1>Leapfrog</td><td rowspan=1 colspan=1>3.59</td><td rowspan=1 colspan=1>0.50</td></tr><tr><td rowspan=1 colspan=1>Leapfrog</td><td rowspan=1 colspan=1>Leapfrog</td><td rowspan=1 colspan=1>2.27</td><td rowspan=1 colspan=1>0.60</td></tr><tr><td rowspan=3 colspan=1>H-NET</td><td rowspan=1 colspan=1>Euler</td><td rowspan=1 colspan=1>Euler</td><td rowspan=1 colspan=1>6.26</td><td rowspan=1 colspan=1>0.60</td></tr><tr><td rowspan=1 colspan=1>Euler</td><td rowspan=1 colspan=1>Leapfrog</td><td rowspan=1 colspan=1>3.00</td><td rowspan=1 colspan=1>0.63</td></tr><tr><td rowspan=1 colspan=1>Leapfrog</td><td rowspan=1 colspan=1>Leapfrog</td><td rowspan=1 colspan=1>1.45</td><td rowspan=1 colspan=1>0.32</td></tr><tr><td rowspan=1 colspan=1>Vanilla RNN</td><td rowspan=1 colspan=1>N/A</td><td rowspan=1 colspan=1>N/A</td><td rowspan=1 colspan=1>4.72</td><td rowspan=1 colspan=1>0.94</td></tr><tr><td rowspan=1 colspan=1>LSTM</td><td rowspan=1 colspan=1>N/A</td><td rowspan=1 colspan=1>N/A</td><td rowspan=1 colspan=1>5.81</td><td rowspan=1 colspan=1>0.98</td></tr></table>
140
+
141
+ optimizing the initial states of each trajectory as parameters when data are noisy. Thorough comparisons of test errors are given in Tables 1 and 2, where we highlight that the SRNN (recurrent L-L H-NET) models achieve the lowest errors.
142
+
143
+ # 5 SRNN can learn the dynamics of a three-body system
144
+
145
+ Next, we test SRNN with the three-body system, which is a well-known example of a chaotic system, meaning that a small difference in the initial condition could lead to drastically different evolution trajectories, even without noise added. As a result, even when the exact equations are known, simulating it with different time-step sizes could also lead to qualitatively different solutions. Moreover, Greydanus et al. (2019) mentions that HNN does not outperform a baseline method using O-NET in learning the three-body system’s evolution. Here, we test our SRNN together with other baselines on the noiseless three-body system with the same configurations as Greydanus et al. (2019). The detailed experimental setup and model architectures are provided in Appendix A.2.
146
+
147
+ As we see in Table 3, the best-performing model is SRNN and the second-best is the singlestep L-L H-NET. Interestingly, and perhaps counter-intuitively, they even outperform the baseline method of simulating the correct equation with the same time-step size. How is this possible? In short, our explanation is that the error introduced by numerical discretization could be learned and therefore compensated for by the models we train. More concretely, once again using the concept of modified equations mentioned in Section 4.1, we argue that the ODE-based learning models, including both H-NET and O-NET models, could learn not
148
+
149
+ Table 3: Prediction error results for the three-body system with time-step $\Delta t = 1$ . The last row corresponds to numerically solving the correct underlying equations using the leapfrog integrator with time-step $\Delta t = 1$ . The other rows correspond to the different learning-based methods, same as in the spring-chain experiments.
150
+
151
+ <table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>Model</td><td rowspan=1 colspan=1>Integrator (tr)</td><td rowspan=1 colspan=1>Integrator (te)</td><td rowspan=1 colspan=1>Error mean</td><td rowspan=1 colspan=1>Error std</td></tr><tr><td rowspan=6 colspan=1>single-step</td><td rowspan=3 colspan=1>O-NET</td><td rowspan=1 colspan=1>Euler</td><td rowspan=1 colspan=1>Euler</td><td rowspan=1 colspan=1>0.65</td><td rowspan=1 colspan=1>0.16</td></tr><tr><td rowspan=1 colspan=1>Euler</td><td rowspan=1 colspan=1>Leapfrog</td><td rowspan=1 colspan=1>1.36</td><td rowspan=1 colspan=1>0.18</td></tr><tr><td rowspan=1 colspan=1>Leapfrog</td><td rowspan=1 colspan=1>Leapfrog</td><td rowspan=1 colspan=1>1.33</td><td rowspan=1 colspan=1>0.20</td></tr><tr><td rowspan=3 colspan=1>H-NET</td><td rowspan=1 colspan=1>Euler</td><td rowspan=1 colspan=1>Euler</td><td rowspan=1 colspan=1>1.64</td><td rowspan=1 colspan=1>0.25</td></tr><tr><td rowspan=1 colspan=1>Euler</td><td rowspan=1 colspan=1>Leapfrog</td><td rowspan=1 colspan=1>0.88</td><td rowspan=1 colspan=1>0.33</td></tr><tr><td rowspan=1 colspan=1>Leapfrog</td><td rowspan=1 colspan=1>Leapfrog</td><td rowspan=1 colspan=1>0.35</td><td rowspan=1 colspan=1>0.09</td></tr><tr><td rowspan=6 colspan=1>recurrent</td><td rowspan=3 colspan=1>O-NET</td><td rowspan=1 colspan=1>Euler</td><td rowspan=1 colspan=1>Euler</td><td rowspan=1 colspan=1>0.51</td><td rowspan=1 colspan=1>0.11</td></tr><tr><td rowspan=1 colspan=1>Euler</td><td rowspan=1 colspan=1>Leapfrog</td><td rowspan=1 colspan=1>1.27</td><td rowspan=1 colspan=1>0.18</td></tr><tr><td rowspan=1 colspan=1>Leapfrog</td><td rowspan=1 colspan=1>Leapfrog</td><td rowspan=1 colspan=1>0.49</td><td rowspan=1 colspan=1>0.10</td></tr><tr><td rowspan=3 colspan=1>H-NET</td><td rowspan=1 colspan=1>Euler</td><td rowspan=1 colspan=1>Euler</td><td rowspan=1 colspan=1>0.79</td><td rowspan=1 colspan=1>0.17</td></tr><tr><td rowspan=1 colspan=1>Euler</td><td rowspan=1 colspan=1>Leapfrog</td><td rowspan=1 colspan=1>1.76</td><td rowspan=1 colspan=1>0.62</td></tr><tr><td rowspan=1 colspan=1>Leapfrog</td><td rowspan=1 colspan=1>Leapfrog</td><td rowspan=1 colspan=1>0.26</td><td rowspan=1 colspan=1>0.07</td></tr><tr><td rowspan=1 colspan=1>simulation</td><td rowspan=1 colspan=1>true eqns.</td><td rowspan=1 colspan=1>(no training)</td><td rowspan=1 colspan=1>Leapfrog</td><td rowspan=1 colspan=1>0.47</td><td rowspan=1 colspan=1>0.18</td></tr></table>
152
+
153
+ the correct underlying equation, but rather the equation whose modified equation associated with our choice of numerical integrator and time-step size is the original equation. Hence, when the time-step size is large and the error of numerical discretization is not negligible, it is possible that the learned equation could yield better predictions than the correct one.
154
+
155
+ In addition, we also see that the recurrently trained models outperform the corresponding single-step-trained models. Plots of the predicted trajectories are provided in Appendix E.
156
+
157
+ # 6 Learning perfect rebound with an augmented SRNN
158
+
159
+ We focus in this section on the perfect rebound problem as a prototypical example of stiff ODE in a physical system. We consider a heavy billiard, subject to gravitational forces pointing downwards, and bouncing around a two-dimensional square domain delimited by impenetrable walls. Whenever it hits a wall, the billiard rebounds without loss of energy, by reversing the component of its momentum orthogonal to the wall surface. Microscopically, when the billiard hits the wall, the atomic structure deformation produces strong electromagnetic forces that reverse the momentum during a very brief timescale. Simulating this microscopic phenomenon with a Hamiltonian ODE would not only be computationally expensive, but also require a detailed knowledge of the atomic structures of the billiard and the walls. The perfect rebound is a macroscopic approximation that treats the billiard as a point mass and the rebound as an event with zero duration infinite forces. Although this approximation is convenient for high-school level derivations, the singularity makes it hard to simulate using Hamiltonian dynamics.
160
+
161
+ We propose to approach this problem by augmenting each time step of a leapfrog-based SRNN with an additional operation that models a possible rebound event,
162
+
163
+ $$
164
+ p _ { t } ^ { p o s t } p _ { t } ^ { p r e } - 2 ( p _ { t } ^ { p r e } \cdot n ) n ~ ,
165
+ $$
166
+
167
+ where $p _ { t } ^ { p r e }$ is the pre-rebound momentum vector and $p _ { t } ^ { p o s t }$ is the post-rebound momentum vector. When the vector $n$ is zero, this operation does not change the momentum in any way. When $n$ is a unit vector orthogonal to a wall, this operation computes the momentum reversal that is characteristic of a perfect rebound. Vectors $n$ of smaller length could also be used to model energy dissipation in manner that is reminiscent of the famous LSTM forget gate (Hochreiter and Schmidhuber, 1997).
168
+
169
+ Because the billiard trajectory depends on the exact timing of the rebound event, we also need a scalar $\alpha \in \lfloor 0 , 1 \rfloor$ that precisely places the rebound event at time $t + \alpha \Delta t$ between the successive time steps $t$ and $t + \Delta t$ . The augmented leapfrog schema then becomes
170
+
171
+ $$
172
+ [ p _ { t + \alpha \Delta t } ^ { p r e } , q _ { t + \alpha \Delta t } ^ { p r e } ] \gets \{ \frac { l e a p f r o g } { \alpha \Delta t } \left[ p _ { t } , q _ { t } \right]
173
+ $$
174
+
175
+ $$
176
+ p _ { t + \alpha \Delta t } ^ { p o s t } = p _ { t + \alpha \Delta t } ^ { p r e } - 2 ( p _ { t + \alpha \Delta t } ^ { p r e } \cdot n ) n
177
+ $$
178
+
179
+ ![](images/83b5660a973c4dc436d8959be4cf1868b47997b26d7f9f5e681925629384c6b3.jpg)
180
+ Figure 4: Actual versus predicted trajectories of the heavy billiard with perfect rebound. The predictions are obtained by an SRNN plus the rebound module described in section 6.
181
+
182
+ $$
183
+ \left[ p _ { t + \Delta t } , q _ { t + \Delta t } \right] \underset { ( 1 - \alpha ) \Delta t } { \xleftarrow { l e a p f r o g } } \left[ p _ { t + \alpha \Delta t } ^ { p o s t } , q _ { t + \alpha \Delta t } ^ { p o s t } \right]
184
+ $$
185
+
186
+ where equations (6) and (8) represent ordinary leapfrog updates (4) for time steps of respective durations $\alpha \Delta t$ and $( 1 - \alpha ) \Delta t$ . More precisely, we first compute a tentative position $\ddot { q } _ { t + \Delta t }$ and momentum $\tilde { p } _ { t + \Delta t }$ assuming no rebound,
187
+
188
+ $$
189
+ \left[ \tilde { p } _ { t + \Delta t } , \tilde { q } _ { t + \alpha \Delta t } \right] \underbrace { l e a p f r o g } _ { \Delta t } \left[ p _ { t } , q _ { t } \right] ,
190
+ $$
191
+
192
+ then compute both $n$ and $\alpha$ as parametric functions of the tentative position $\tilde { q } _ { t + \Delta t }$ as well as the current position $q _ { t }$ , and finally apply the forward model (6–8). Note that the final state is equal to the tentative state when no rebound occurs, that is, when $n = 0$ .
193
+
194
+ Directly modeling $n$ and $\alpha$ with a neural network taking $\ddot { q } _ { t + \Delta t }$ as the input would be very inefficient because we would need to train with a lot of rebound events to precisely reveal the location of the walls. We chose instead to use visual cues in the form of a background image representing the walls. We model $n$ as the product of a direction vector $n$ and a magnitude $\gamma \in \left[ 0 , 1 \right]$ , and we want the latter to take value close to 1 when perfect rebound actually occurs between $t$ and $t + \Delta t$ and close to 0 otherwise. Both $n$ and $\alpha$ are modeled as MLPs that take as input two 10x10 neighborhoods of the background image, centered at positions $q _ { t }$ and $\ddot { q } _ { t + \Delta t }$ , respectively. In contrast, $\gamma$ is modeled as an MLP that takes as input a smaller $2 \mathrm { x } 2$ neighborhood centered at $\tilde { q } _ { t + \Delta t }$ and is trained with an additional regularization term $\| \gamma \| _ { 1 }$ in order to switch the rebound module off when it is not needed.
195
+
196
+ Training is achieved by back-propagating through the successive copies of the augmented leapfrog scheme, through the models of $n$ , $\alpha$ , and $\gamma$ , and also through the computation of the tentative $\ddot { p } _ { t + \Delta t }$ and $\ddot { q } _ { t + \Delta t }$ . We use 5000 training trajectories of length 10 starting from a randomly-sampled initial positions and velocities. Similarly, we use 32 testing trajectories of length 60. Detailed exprimental setup is included in Appendix A.3. Figure 5 plots some predicted and actual testing trajectories. Appendix F compares these results with the inferior results obtained with several baseline methods, including SRNN without the rebound module, and SRNN with a rebound module that does not learn $\alpha$ . One limitation of our method, however, results from the assumption that there is at most one rebound event per time step. Although this assumption fails when the billiard rebounds twice near a corner, as shown in the bottom right plot in Figure 5, our method still outperforms the baseline methods even in this case.
197
+
198
+ # 7 Conclusion
199
+
200
+ We propose the Symplectic Recurrent Neural Network, which learns the dynamics of Hamiltonian systems from data. Thanks to symplectic integration, multi-step training and initial state optimization, it outperforms previous methods in predicting the evolution of complex and noisy Hamiltonian systems, such as the spring-chain and the three-body systems. It can even outperform simulating with the exact equations, likely by learning to compensate for numerical discretization error. We further augment it to learn perfect rebound from data, opening up the possibility to handle stiff systems using ODE-based learning algorithms.
201
+
202
+ # Acknowledgments
203
+
204
+ The authors acknowledge stimulating discussions with Dan Roberts, Marylou Gabrié, Anna Klimovskaia, Yann Ollivier and Joan Bruna.
205
+
206
+ # References
207
+
208
+ Arjovsky, M., Shah, A., and Bengio, Y. (2015). Unitary evolution recurrent neural networks. CoRR, abs/1511.06464.
209
+
210
+ Battaglia, P. W., Pascanu, R., Lai, M., Rezende, D. J., and Kavukcuoglu, K. (2016). Interaction networks for learning about objects, relations and physics. CoRR, abs/1612.00222.
211
+
212
+ Brunton, S. L., Proctor, J. L., and Kutz, J. N. (2016). Discovering governing equations from data by sparse identification of nonlinear dynamical systems. Proceedings of the National Academy of Sciences, 113(15):3932–3937.
213
+
214
+ Chang, B., Chen, M., Haber, E., and Chi, E. H. (2019). AntisymmetricRNN: A dynamical system view on recurrent neural networks. In International Conference on Learning Representations.
215
+
216
+ Chang, M. B., Ullman, T., Torralba, A., and Tenenbaum, J. B. (2016). A compositional object-based approach to learning physical dynamics. CoRR, abs/1612.00341.
217
+
218
+ Chen, T. Q., Rubanova, Y., Bettencourt, J., and Duvenaud, D. K. (2018a). Neural ordinary differential equations. In Bengio, S., Wallach, H., Larochelle, H., Grauman, K., CesaBianchi, N., and Garnett, R., editors, Advances in Neural Information Processing Systems 31, pages 6571–6583. Curran Associates, Inc.
219
+
220
+ Chen, Z., Raman, B., and Stern, A. (2018b). Structure-preserving numerical integrators for hodgkin-huxley-type systems.
221
+
222
+ Greydanus, S., Dzamba, M., and Yosinski, J. (2019). Hamiltonian neural networks. arXiv preprint arXiv:1906.01563.
223
+
224
+ Hairer, E. (1994). Backward analysis of numerical integrators and symplectic methods. Annals of Numerical Mathematics, 1:107–132. ID: unige:12640.
225
+
226
+ Hairer, E., Lubich, C., and Wanner, G. (2002). Geometric Numerical Integration: StructurePreserving Algorithms for Ordinary Differential Equations. Springer series in computational mathematics. Springer.
227
+
228
+ Hairer, E., Nørsett, S. P., and Wanner, G. (2008). Solving Ordinary Differential Equations I: Nonstiff Problems. Springer Series in Computational Mathematics. Springer Berlin Heidelberg.
229
+
230
+ Hairer, E. and Wanner, G. (2013). Solving Ordinary Differential Equations II: Stiff and Differential - Algebraic Problems. Springer Series in Computational Mathematics. Springer Berlin Heidelberg.
231
+
232
+ Hochreiter, S. and Schmidhuber, J. (1997). Long short-term memory. Neural Computation, 9(8):1735–1780.
233
+
234
+ Kingma, D. P. and Ba, J. (2014). Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980.
235
+
236
+ Lambert, J. D. (1991). Numerical Methods for Ordinary Differential Systems: The Initial Value Problem. John Wiley & Sons, Inc., New York, NY, USA.
237
+ Leimkuhler, B. and Reich, S. (2005). Simulating Hamiltonian Dynamics. Cambridge Monographs on Applied and Computational Mathematics. Cambridge University Press.
238
+ Lutter, M., Ritter, C., and Peters, J. (2019). Deep lagrangian networks: Using physics as model prior for deep learning. In International Conference on Learning Representations.
239
+ McLachlan, R. I., Perlmutter, M., and Quispel, G. R. W. (2004). On the nonlinear stability of symplectic integrators. BIT Numerical Mathematics, 44(1):99–117.
240
+ Niu, M. Y., Horesh, L., and Chuang, I. (2019). Recurrent neural networks in the eye of differential equations. arXiv preprint arXiv:1904.12933.
241
+ Peifer, M. and Timmer, J. (2007). Parameter estimation in ordinary differential equations for biochemical processes using the method of multiple shooting. The Institution of Engineering and Technology, Systems Biology.
242
+ Stapor, P., Fröhlich, F., and Hasenauer, J. (2018). Optimization and profile calculation of ODE models using second order adjoint sensitivity analysis. Bioinformatics, 34(13):i151– i159.
243
+ Tao, M. (2016). Explicit symplectic approximation of nonseparable hamiltonians: Algorithm and long time performance. Phys. Rev. E, 94:043303.
244
+ Zhu, C., Byrd, R. H., Lu, P., and Nocedal, J. (1997). Algorithm 778: L-bfgs-b: Fortran subroutines for large-scale bound-constrained optimization. ACM Trans. Math. Softw., 23(4):550–560.
245
+
246
+ # A Experiment setup
247
+
248
+ # A.1 The spring-chain experiment
249
+
250
+ We set $\Delta t = 0 . 1$ . The ground truth trajectories in both training and testing are simulated by the leapfrog integrator using $\Delta t ^ { \prime } = 0 . 0 0 1$ and coarsened into time-grids of 0.1 with a factor of 100, since simulating with a much smaller time-step leads to much more accurate solution, which we will treat as the ground truth solution.
251
+
252
+ The O-NET that represents $f _ { \theta } ( p , q )$ is a one-hidden-layer MLP with 40 input units, 2048 hidden units and 40 output units. The H-NET that represents $H _ { \boldsymbol \theta } ( p , q ) = K _ { \boldsymbol \theta _ { 1 } } ( p ) + V _ { \boldsymbol \theta _ { 2 } } ( q )$ consists of two one-hidden-layer MLPs, one for $K _ { \theta _ { 1 } }$ and the other for $V _ { \theta _ { 2 } }$ . Each of the MLPs have 20 input units, 2048 hidden units and 1 output unit. The vanilla RNN and LSTM models also have hidden states of size 2048. Implemented in PyTorch, the models are trained over 1000 epochs with the Adam optimizer (Kingma and Ba, 2014) with initial learning rate 0.001 and using the ReduceLROnPlateau scheduler $^ 4$ with patience 15 and factor 0.7.
253
+
254
+ # A.2 The three-body experiment
255
+
256
+ The ground truth trajectories are simulated by SciPy’s solve_ivp adaptive solver $^ { 5 }$ with method RK45. We coarse-grain the simulated ground truth trajectories into time-steps of $\Delta t = 1$ , so that the models developed in section 4 are numerically integrated with time-step $\Delta t = 1$ in both training and testing. We intentionally set the time-step to be relatively large, so that it becomes interesting to compare these models with a baseline method of simulating the true equations with time-step $\Delta t = 1$ . In addition, the training data consist of 100 sample trajectories of length 10 $\cdot \Delta t = 1 0$ , which are then turned into 900 trajectories of length 2 and 600 trajectories of length 5, respectively for single-step and recurrent training, in the same way as for the spring-chain experiments above.
257
+
258
+ The O-NET that represents $f _ { \boldsymbol { \theta } } ( \boldsymbol { p } , \boldsymbol { q } )$ is a three-hidden-layer MLP with 12 input units, 512 hidden units in each hidden layer and 12 output units. The H-NET that represents $H _ { \boldsymbol \theta } ( p , q ) = K _ { \boldsymbol \theta _ { 1 } } ( p ) + V _ { \boldsymbol \theta _ { 2 } } ( q )$ consists of two three-hidden-layer MLPs, one for $K _ { \theta _ { 1 } }$ and the other for $V _ { \theta _ { 2 } }$ . Each of the MLPs have 6 input units, 512 hidden units in each hidden layer and 1 output unit. The vanilla RNN and LSTM models also have hidden states of size 512. Implemented in PyTorch, the models are trained over 1000 epochs with the Adam optimizer with initial learning rate 0.0003 and using the ReduceLROnPlateau scheduler with patience 15 and factor 0.7.
259
+
260
+ # A.3 The heavy billiard experiment
261
+
262
+ The full image has size 128x128 pixels. The thickness of the wall is 12 pixels on each of the four sides, which leaves the free space of size 104x104 pixels in the middle for the billiard to move within. The billiard has size 3x3 pixels.
263
+
264
+ The O-NET that represents $f _ { \boldsymbol { \theta } } ( \boldsymbol { p } , \boldsymbol { q } )$ is a one-hidden-layer MLP with 4 input units, 32 hidden units and 4 output units. The H-NET that represents $H _ { \boldsymbol \theta } ( p , q ) = K _ { \boldsymbol \theta _ { 1 } } ( p ) + V _ { \boldsymbol \theta _ { 2 } } ( q )$ consists of two one-hidden-layer MLPs, one for $K _ { \theta _ { 1 } }$ and the other for $V _ { \theta _ { 2 } }$ . Each of the MLPs have 2 input units, 32 hidden units and 1 output unit. The vanilla RNN model also has hidden states of size 32. For the rebound module, $n$ is computed as the normalized output of a two-hidden-layer MLP, with 200 input units, 128 units in the first hidden layer, 32 units in the second hidden layer and 2 output units. $\alpha$ is also computed using a two-hiddenlayer MLP, sharing the first hidden layer units with the MLP for $n$ , and having 32 units in the second hidden layer and 1 output unit. $\gamma$ is computed by passing through sigmoid the output of a two-hidden-layer MLP, with 4 input units, 16 units in each hidden layer and 1 output unit. All of the activation functions are tanh except for the hidden-to-output activation in the MLP for $\alpha$ , where ReLU is used. Implemented in PyTorch, the models are trained over 1500 epochs with the Adam optimizer with initial learning rate 0.005 and using the ExponentialLR scheduler6 with decay factor 0.99 until the learning rate reaches 0.0001. We set $\Delta t = 0 . 1$ , and use 5000 trajectories of length $1 0 \cdot \Delta t = 1$ as training data, and 32 trajectories of length $6 0 \cdot \Delta t = 6$ as testing data.
265
+
266
+ # B The Maximum Likelihood Estimation perspective
267
+
268
+ In the presence of noise, we can interpret the learning problem described in section 3.3 above from the perspective of maximum likelihood inference, which also provides justification for treating the initial states as trainable parameters. We define models as follow:
269
+
270
+ $$
271
+ \begin{array} { c } { { \hat { z } _ { i } ( \theta ) = I n t e g r a t o r ( \hat { z } _ { 0 } = z _ { 0 } , f _ { \theta } , \{ t _ { i } \} _ { i = 0 } ^ { T } ) } } \\ { { q ( z _ { i } ; \theta ) = \displaystyle \frac { 1 } { \sqrt { ( 2 \pi ) ^ { d } \sigma ^ { 2 d } } } e ^ { - \| z _ { i } - \hat { z } _ { i } ( \theta ) \| _ { 2 } ^ { 2 } / ( 2 \sigma ^ { 2 } ) } } } \\ { { P ( \{ z _ { i } \} _ { i = 1 } ^ { n } | \theta ) = \displaystyle \prod _ { i = 1 } ^ { n } q ( z _ { i } ; \theta ) = \displaystyle \frac { 1 } { ( \sqrt { 2 \pi \sigma ^ { 2 } } ) ^ { n d } } \displaystyle \prod _ { i = 1 } ^ { n } e ^ { - \| z _ { i } - \hat { z } _ { i } ( \theta ) \| _ { 2 } ^ { 2 } / ( 2 \sigma ^ { 2 } ) } , } } \end{array}
272
+ $$
273
+
274
+ and $\mathcal { L } ( \boldsymbol { \theta } | \{ z _ { i } \} _ { i = 1 } ^ { n } ) = P ( \{ z _ { i } \} _ { i = 1 } ^ { n } | \boldsymbol { \theta } )$ is the likelihood function given the time-series data $\{ z _ { i } \} _ { i = 1 } ^ { n }$ Note that this model assumes independence between $z _ { i }$ and $z _ { j }$ for $i \neq j$ once $\theta$ is fixed.
275
+
276
+ If we are to perform maximum likelihood inference, we arrive at the following:
277
+
278
+ $$
279
+ \operatorname* { m a x } _ { \theta } : \ \log \mathcal { L } ( \theta | \{ z _ { i } \} _ { i = 1 } ^ { n } ) = - \frac { n d } 2 \log \bigl ( 2 \pi \sigma ^ { 2 } \bigr ) - \frac { 1 } { 2 \sigma ^ { 2 } } \sum _ { i = 1 } ^ { n } \| z _ { i } - \hat { z } _ { i } ( \theta ) \| _ { 2 } ^ { 2 } ,
280
+ $$
281
+
282
+ which is equivalent to
283
+
284
+ $$
285
+ \operatorname* { m i n } _ { \theta } \ \sum _ { i = 1 } ^ { n } \| z _ { i } - \hat { z } _ { i } ( \theta ) \| _ { 2 } ^ { 2 }
286
+ $$
287
+
288
+ This provides a motivation for using the $L ^ { 2 }$ loss, as we did in the experiments.
289
+
290
+ So far, we consider $\theta$ as the only parameter of the model defined by equations 10, and therefore the only argument of the likelihood function, while $\hat { z } _ { 0 }$ is fixed to be the observed initial state $z _ { 0 }$ . As a generalization, we can consider a strictly larger family of models by allowing $z _ { 0 }$ to vary as well. In this way, we treat both $\theta$ and $z _ { 0 }$ as the parameters in the model and therefore arguments of the likelihood function that we optimize on. In other words, the model becomes
291
+
292
+ $$
293
+ \begin{array} { l } { \displaystyle \hat { z } _ { i } ( \theta , \hat { z } _ { 0 } ) = { I n t e g r a t o r ( \hat { z } _ { 0 } , f _ { \theta } , \{ t _ { i } \} _ { i = 0 } ^ { T } ) } } \\ { \displaystyle q ( z _ { i } ; \theta , \hat { z } _ { 0 } ) = \frac { 1 } { \sqrt { ( 2 \pi ) ^ { d } \sigma ^ { 2 d } } } e ^ { - { \| z _ { i } - \hat { z } _ { i } ( \theta , \hat { z } _ { 0 } ) \| _ { 2 } ^ { 2 } } / { ( 2 \sigma ^ { 2 } ) } } } \\ { \displaystyle P ( \{ z _ { i } \} _ { i = 1 } ^ { n } | \theta , \hat { z } _ { 0 } ) = \prod _ { i = 1 } ^ { n } q ( z _ { i } ; \theta ) = \frac { 1 } { ( \sqrt { 2 \pi \sigma ^ { 2 } } ) ^ { n d } } \prod _ { i = 1 } ^ { n } e ^ { - { \| z _ { i } - \hat { z } _ { i } ( \theta ) \| _ { 2 } ^ { 2 } } / { ( 2 \sigma ^ { 2 } ) } } , } \end{array}
294
+ $$
295
+
296
+ and the optimization problem becomes
297
+
298
+ $$
299
+ \operatorname* { m i n } _ { \theta , \hat { z } _ { 0 } } ~ \sum _ { i = 1 } ^ { n } \| z _ { i } - \hat { z } _ { i } ( \theta , \hat { z } _ { 0 } ) \| _ { 2 } ^ { 2 } ,
300
+ $$
301
+
302
+ which justifies optimizing over the initial states $p _ { 0 }$ , $q _ { 0 }$ in addition to the neural network parameters $\theta$ as described in the previous section.
303
+
304
+ Such an interpretation is similar to approaches for parameter estimation in the literature of inverse problems and systems biology, though in those cases the parameters of interest appear directly in ODEs instead of via neural networks (Peifer and Timmer, 2007; Stapor et al., 2018). In particular, jointly optimizing the parameters in the model as well as the initial value is called the initial value approach. However, despite the success we demonstrate in section 4.2, two difficulties of this approach have been pointed out: 1) The optimization could converge to local minima; 2) The numerical solution of the ODE can be unstable (Peifer and Timmer, 2007). As explained in section 4.1, using HNN together with the leapfrog integrator mitigates the second issue. But what about the first issue? In particular, even if we assume that the optimization of the neural network can work “magically” well and do not suffer from bag local minima, what about optimizing the initial value $\hat { z } _ { 0 }$ ?
305
+
306
+ # C Symplecticness and initial-state-optimization convexity
307
+
308
+ The success of optimizing on the initial state of the system in addition to the recurrent H-NET and O-NET models as described in section 4.2 raises the following question: If we already have a relatively well-trained H-NET or O-NET, is the optimization on the initial values convex? We formalize the question below and provide a heuristic answer.
309
+
310
+ $f$ or sin $\begin{array} { r } { \frac { d z } { d t } = f ( z ) } \end{array}$ we restrict our attendoes not depend on $t$ on to autonomous ODEs, which means that the function. Assuming existence and uniqueness of solutions, there exists a function that maps each initial state from $\hat { z } _ { 0 }$ for time $t$ , $\phi _ { t } ( \hat { z } _ { 0 } )$ . This function is usually called the flow map. Flow maps have also been defined for numerical solutions of ODEs, by letting $\phi _ { t } ( \hat { z } _ { 0 } ) = I n t e g r a t o r ( z _ { 0 } , f , \{ t _ { i } \} _ { i = 0 } ^ { T } )$ with $t _ { 0 } = 0$ . We can extend this definition to all the trainable models we have considered, including the models based on O-NET and H-NET by defining $\phi _ { t } ( \hat { z } _ { 0 } )$ to be the state of the system after letting the system evolve from initial state $\hat { z } _ { 0 }$ for time $t$ , for suitable choices of $t$ . For example, for O-NET, we have $\phi _ { t } ( \hat { z } _ { 0 } ) = I n t e g r a t o r ( z _ { 0 } , f _ { \theta } , \{ t _ { i } \} _ { i = 0 } ^ { T } )$ .
311
+
312
+ Suppose we impose an L2 loss on $\phi _ { t } ( \hat { z } _ { 0 } )$ , $e _ { t } ( \hat { z } _ { 0 } ) = \| \phi _ { t } ( \hat { z } _ { 0 } ) - z _ { t } \| _ { 2 } ^ { 2 }$ , where $z _ { t }$ corresponds to the observed data at time $t$ . The question is, is $e _ { t } ( z )$ a (perhaps locally) convex function of $z$ , for what functions and numerical integrators? To understand convexity, we compute the gradient and the Hessian as follow.
313
+
314
+ $$
315
+ \frac { \partial } { \partial z } e _ { t } ( z ) = 2 ( \phi _ { t } ( z ) - z _ { t } ) ^ { \mathsf { T } } \cdot F _ { t } ( z )
316
+ $$
317
+
318
+ $$
319
+ \frac { \partial ^ { 2 } } { \partial z ^ { 2 } } e _ { t } ( z ) = 2 ( \phi _ { t } ( z ) - z _ { t } ) \cdot ^ { ( 3 ) } G _ { t } ( z ) + F _ { t } ( z ) ^ { \top } \cdot F _ { t } ( z ) ,
320
+ $$
321
+
322
+ where $F _ { t } ( z )$ is the Jacobian matrix of the flow map, defined as $\begin{array} { r } { F _ { t } ( z ) _ { i j } = \frac { \partial } { \partial z _ { j } } ( \phi _ { t } ( z ) _ { i } ) } \end{array}$ , and $G _ { t } ( z )$ is a third-order tensor contains the second order derivatives of the flow map, defined $\begin{array} { r } { G _ { t } ( z ) _ { i j k } = \frac { \partial ^ { 2 } } { \partial z _ { i } z _ { j } } ( \phi _ { t } ( z ) _ { k } ) } \end{array}$ ∂ 2 . We use ·(3) to denote the dot product in the third dimension.
323
+
324
+ $F _ { t } ( z ) ^ { \mathsf { T } } \cdot F _ { t } ( z )$ is symmetric positive semidefinite for any matrix $F _ { t } ( z )$ . If $\phi _ { t }$ corresponds to either the exact flow map of a Hamiltonian system or the flow of a symplectic integrator, such as the leapfrog integrator, applied to a Hamiltonian system, then $F _ { t } ( z )$ is a symplectic matrix, implying that $\operatorname* { d e t } ( F _ { t } ( z ) ) = 1$ . Hence, $\mathrm { d e t } ( F _ { t } ( z ) ^ { \mathsf { T } } \cdot F _ { t } ( z ) ) = 1$ , which further implies that $F _ { t } ( z ) ^ { \mathsf { T } } \cdot F _ { t } ( z )$ is a positive definite matrix. Therefore, non-rigorously, when $\lVert \phi _ { t } ( z ) - z _ { t } \rVert _ { 2 }$ is small and so the first term on the right hand side of equation 16 is negligible compared to the least eigenvalue of $F _ { t } ( z ) ^ { \mathsf { T } } \cdot F _ { t } ( z )$ , the entire Hessian matrix ∂2∂z2 et(z) is also positive definite, implying strong convexity of the optimization problem.
325
+
326
+ If $\phi _ { t }$ is the exact flow map, then $\| \phi _ { t } ( z ) - z _ { t } \|$ being small means that noise in the data is small. If $\phi _ { t }$ is the flow map of a learned model, then it means that we have a model close to the true underlying system in addition to not having too much noise in the data. Translating back to the learning problem, we see that, heuristically, when the model we use is close to symplectic, which is likely if the underlying system is a Hamiltonian system, and trained to be close enough to the true underlying system, and the noise in the data is small enough, then the optimization problem on the initial state is strongly convex.
327
+
328
+ # D Additional plots of the spring-chain experiments D.1 Noiseless data (section 4.1)
329
+
330
+ ![](images/8699677295953d1b33056a30bb781e87e8c5814e60712547ba6548c7cd1a6c22.jpg)
331
+ Figure 5: Extension of Figure 1 to 10 masses on the chain (1st being the closest to one end, and $1 0 \mathrm { t h }$ being in the center).
332
+
333
+ # D.2 Noisy data (section 4.2)
334
+
335
+ ![](images/e8c24983c3fed7cf6a51524359b7491dbc3fe35a3d656cc0408f581fb320a6a0.jpg)
336
+ Figure 6: Single-step E-E O-NET
337
+
338
+ ![](images/f62e89bb33fe289a5f0df489810eb6209ccf44ce6fa9a5ef14f8343c4eac118a.jpg)
339
+ Figure 7: Single-step E-E H-NET
340
+
341
+ ![](images/1d5eaa40baa0a9adb3bdfa97f37c5c61623ab810e84ef379d09259709df9b0e4.jpg)
342
+ Figure 8: Single-step L-L O-NET
343
+
344
+ ![](images/bb84020d14394637248edf3dde128a9af425810b173e863d12de5f7badcf873f.jpg)
345
+ Figure 9: Single-step L-L H-NET
346
+
347
+ ![](images/7674f229951c2cac24c31140a8aaae74f4f711ada20d1e1d4b4ad44b0f8351dd.jpg)
348
+ Figure 10: Recurrent E-E O-NET
349
+
350
+ ![](images/b984b2d7fc940f0c081de21685e85cab62c13266e79dfd784038cb20f8d48b4d.jpg)
351
+ Figure 11: Recurrent E-E H-NET
352
+
353
+ ![](images/d79ed8533c2414feaafacaffc61ee1cf39bf13c3bc22d69b657dfa347093f1b7.jpg)
354
+ Figure 12: Recurrent L-L O-NET
355
+
356
+ ![](images/9a21ffa9e2d59c98ed0251c75ddf083c188ef56ae61e6a4c1d5a34cc6c2f612a.jpg)
357
+ Figure 13: (SRNN) Recurrent L-L H-NET
358
+
359
+ ![](images/7d83acaa24389edd2280bbbaeec81b83c93918316c7c749434afef3ec1fa4a2e.jpg)
360
+ Figure 14: Recurrent E-E O-NET w/ ISO
361
+
362
+ ![](images/fc0f82d6f9d40437eaf549fc69e6d2a6e9f2529c8359d7eabe5e2d8357b51354.jpg)
363
+ Figure 15: Recurrent E-E H-NET w/ ISO
364
+
365
+ ![](images/58eef280515505d2d2a197f0815c1b5e745e524840a019420424404c881865fc.jpg)
366
+ Figure 16: Recurrent L-L O-NET w/ ISO
367
+
368
+ ![](images/d01575285c4fe0dbbb50cf80c42081c9b34cbce99ee011dfeae65ad2b7853cac.jpg)
369
+ Figure 17: (SRNN-ISO) Recurrent L-L H-NET w/ ISO
370
+
371
+ ![](images/244d9eb4162103278e38ebcf9f6c3fae6a695441df234562e62e061229592d61.jpg)
372
+ Figure 18: Vanilla RNN
373
+
374
+ ![](images/ba13579af38b65d9adb43b36d245df8956ec780539b558ba49a9813db37afa1a.jpg)
375
+ Figure 19: LSTM
376
+
377
+ In each of the plots below, the three dashdot curves represent the ground truth trajectories of the three masses, and the three sequences of dots are the predictions made by each method.
378
+
379
+ ![](images/d97e59307a592699aa87a2c136a20f8f58f31165ceb40016c1a9bfa840d010cb.jpg)
380
+ Figure 20: Actual versus predicted trajectories of the three-body system by the various single-step-trained methods.
381
+
382
+ ![](images/7b7bb98223bf60995a9561b0de16df794c5e546d0f725610f8929d8788c2820f.jpg)
383
+ Figure 21: Actual versus predicted trajectories of the three-body system by the various recurrently trained methods.
384
+
385
+ ![](images/8e9d95c519606a34e4b13b0a5a508d99139fce19b7ab0939cd5f87effadb965c.jpg)
386
+ Figure 22: Actual trajectory versus the trajectory simulated by the leapfrog integrator with time-step 1 (left) and 0.1 (right).
387
+
388
+ ![](images/f4acf6f3d7bffc814663fb6df875bd940961e319078f2fc2fe7d07ac0fe6a8c2.jpg)
389
+ Figure 23: SRNN with a rebound module that does not learn $\alpha$ (and effectively treats $\alpha = 1$ ).
390
+
391
+ ![](images/6ec24284f2451ad19209823b16df140fe83f04db57f66c66e7e98db402039766.jpg)
392
+ Figure 24: SRNN without the rebound module.
393
+
394
+ ![](images/69faf379f7b86e81a31ac7cde5d9a6d26b838717c5ed192578fa109d9039f679.jpg)
395
+ Figure 25: Recurrent L-L O-NET with the rebound module.
396
+
397
+ ![](images/d8edef04ebcaf8356a642dab32e6e9738edbcd86e2f6c04891aa9dd60b00e959.jpg)
398
+ Figure 26: Vanilla RNN.
md/train/Bkgk624KDB/Bkgk624KDB.md ADDED
@@ -0,0 +1,310 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # LEARNING EFFECTIVE EXPLORATION STRATEGIES FOR CONTEXTUAL BANDITS
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ In contextual bandits, an algorithm must choose actions given observed contexts, learning from a reward signal that is observed only for the action chosen. This leads to an exploration/exploitation trade-off: the algorithm must balance taking actions it already believes are good with taking new actions to potentially discover better choices. We develop a meta-learning algorithm, MELˆ EE´ , that learns an exploration policy based on simulated, synthetic contextual bandit tasks. MELˆ EE´ uses imitation learning against these simulations to train an exploration policy that can be applied to true contextual bandit tasks at test time. We evaluate on both a natural contextual bandit problem derived from a learning to rank dataset as well as hundreds of simulated contextual bandit problems derived from classification tasks. MELˆ EE´ outperforms seven strong baselines on most of these datasets by leveraging a rich feature representation for learning an exploration strategy.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ In a contextual bandit problem, an agent attempts to optimize its behavior over a sequence of rounds based on limited feedback (Kaelbling, 1994; Auer, 2003; Langford & Zhang, 2008). In each round, the agent chooses an action based on a context (features) for that round, and observes a reward for that action but no others $( \ S 2 )$ . Contextual bandit problems arise in many real-world settings like online recommendations and personalized medicine. As in reinforcement learning, the agent must learn to balance exploitation (taking actions that, based on past experience, it believes will lead to high instantaneous reward) and exploration (trying actions that it knows less about).
12
+
13
+ In this paper, we present a meta-learning approach to automatically learn a good exploration mechanism from data. To achieve this, we use synthetic supervised learning data sets on which we can simulate contextual bandit tasks in an offline setting. Based on these simulations, our algorithm, MELˆ EE´ (MEta LEarner for Exploration)1, learns a good heuristic exploration strategy that should ideally generalize to future contextual bandit problems. MELˆ EE´ contrasts with more classical approaches to exploration (like $\epsilon$ -greedy or LinUCB; see $\ S 6$ ), in which exploration strategies are constructed by expert algorithm designers. These approaches often achieve provably good exploration strategies in the worst case, but are potentially overly pessimistic and are sometimes computationally intractable.
14
+
15
+ At training time (§ 3.2), MELˆ EE´ simulates many contextual bandit problems from fully labeled synthetic data. Using this data, in each round, MELˆ EE´ is able to counterfactually simulate what would happen under all possible action choices. We can then use this information to compute regret estimates for each action, which can be optimized using the AggreVaTe imitation learning algorithm (Ross & Bagnell, 2014). Our imitation learning strategy mirrors that of the meta-learning approach of Bachman et al. (2017) in the active learning setting. We present a simplified, stylized analysis of the behavior of MELˆ EE´ to ensure that our cost function encourages good behavior $( \ S 4 )$ . Empirically, we use MELˆ EE´ to train an exploration policy on only synthetic datasets and evaluate this policy on both a contextual bandit task based on a natural learning to rank dataset as well as three hundred simulated contextual bandit tasks (§5.2). We compare the trained policy to a number of alternative exploration algorithms, and show the efficacy of our approach (§5.3).
16
+
17
+ # 2 PRELIMINARIES: CONTEXTUAL BANDITS AND POLICY OPTIMIZATION
18
+
19
+ Contextual bandits is a model of interaction in which an agent chooses actions (based on contexts) and receives immediate rewards for that action alone. For example, in a simplified news personalization setting, at each time step $t$ , a user arrives and the system must choose a news article to display to them. Each possible news article corresponds to an action $a$ , and the user corresponds to a context $x _ { t }$ . After the system chooses an article $a _ { t }$ to display, it can observe, for instance, the amount of time that the user spends reading that article, which it can use as a reward $r _ { t } ( a _ { t } )$ .
20
+
21
+ Formally, we largely follow the setup and notation of Agarwal et al. (2014). Let $\mathcal { X }$ be an input space of contexts (users) and $[ K ] = \bar { \{ 1 , \dots , K \} }$ be a finite action space (articles). We consider the statistical setting in which there exists a fixed but unknown distribution $\mathcal { D }$ over pairs $( x , r ) \in$ $\mathcal { X } \times [ 0 , 1 ] ^ { K }$ , where $\pmb { r }$ is a vector of rewards (for convenience, we assume all rewards are bounded in $[ 0 , 1 ] )$ . In this setting, the world operates iteratively over rounds $t = 1 , 2 , \ldots .$ Each round $t$ :
22
+
23
+ 1. The world draws $( x _ { t } , r _ { t } ) \sim \mathcal { D }$ and reveals context $x _ { t }$ .
24
+ 2. The agent (randomly) chooses action $a _ { t } \in [ K ]$ based on $x _ { t }$ , and observes reward $r _ { t } ( a _ { t } )$ .
25
+
26
+ The goal of an algorithm is to maximize the cumulative sum of rewards over time. Typically the primary quantity considered is the average regret of a sequence of actions $a _ { 1 } , \dots , a _ { T }$ to the behavior of the best possible function in a prespecified class $\mathcal { F }$ :
27
+
28
+ $$
29
+ \lambda ( a _ { 1 } , \ldots , a _ { T } ) = \operatorname* { m a x } _ { f \in { \mathcal { F } } } { \frac { 1 } { T } } \sum _ { t = 1 } ^ { T } \left[ r _ { t } ( f ( x _ { t } ) ) - r _ { t } ( a _ { t } ) \right]
30
+ $$
31
+
32
+ An agent is call no-regret if its average regret is zero in the limit of large $T$
33
+
34
+ To produce a good agent for interacting with the world, we assume access to a function class $\mathcal { F }$ and to an oracle policy optimizer for that function class. For example, $\mathcal { F }$ may be a set of single layer neural networks mapping user features $x \in \mathcal { X }$ to predicted rewards for actions $a \in [ K ]$ . Formally, the observable record of interaction resulting from round $t$ is the tuple $( x _ { t } , a _ { t } , r _ { t } ( \bar { a } _ { t } ) , p _ { t } ( a _ { t } ) ) \ \in$ $\mathcal { X } { \times } [ K ] { \times } [ 0 , 1 ] { \times } [ 0 , 1 ]$ , where $p _ { t } ( a _ { t } )$ is the probability that the agent chose action $a _ { t }$ , and the full history of interaction is $h _ { t } = \langle ( x _ { i } , a _ { i } , r _ { i } ( a _ { i } ) , p _ { i } ( a _ { i } ) ) \rangle _ { i = 1 } ^ { t }$ . The oracle policy optimizer, POLOPT, takes as input a history of user interactions and outputs an $f \in { \mathcal { F } }$ with low expected regret.
35
+
36
+ A standard example of a policy optimizer is to combine inverse propensity scaling (IPS) with a regression algorithm (Dudik et al., 2011). Here, given a history $h$ , each tuple $( x , a , r , p )$ in that history is mapped to a multiple-output regression example. The input for this regression example is the same $x$ ; the output is a vector of $K$ costs, all of which are zero except the $a ^ { \mathrm { { t h } } }$ component, which takes value $r / p$ . This mapping is done for all tuples in the history, and a supervised learning algorithm on the function class $\mathcal { F }$ is used to produce a low-regret regressor $f$ . This is the function returned by the policy optimizer. IPS, and other estimators that have lower-variance than IPS (such as the doubly-robust estimator), have the property of being unbiased. In experiments, we use the direct method (Dudik et al., 2011) largely for its simplicity, however, MELˆ EE´ is agnostic to the type of the estimator used by the policy optimizer.
37
+
38
+ # 3 APPROACH: LEARNING AND EFFECTIVE EXPLORATION STRATEGY
39
+
40
+ In order to have an effective approach to the contextual bandit problem, one must be able to both optimize a policy based on historic data and make decisions about how to explore. The exploration/exploitation dilemma is fundamentally about long-term payoffs: is it worth trying something potentially suboptimal now in order to learn how to behave better in the future? A particularly simple and effective form of exploration is $\epsilon$ -greedy: given a function $f$ output by POLOPT, act according to $f ( x )$ with probability $( 1 - \epsilon )$ and act uniformly at random with probability . Intuitively, one would hope to improve on such a strategy by taking more (any!) information into account; for instance, basing the probability of exploration on $f$ ’s uncertainty. In this section, we describe MELˆ EE´ , first by describing how it operates at test time when applied to a new contextual bandit problem (§3.1), and then by describing how to train it using synthetic simulated contextual bandit problems $( \ S 3 . 2 )$ .
41
+
42
+ # 3.1 TEST TIME BEHAVIOR OF MELˆ EE´
43
+
44
+ Our goal in this paper is to learn how to explore from experience. The training procedure for MELˆ EE´ will use offline supervised learning problems to learn an exploration policy $\pi$ , which takes two inputs: a function $f \in { \mathcal { F } }$ and a context $x$ , and outputs an action. In our example, $f$ will be the output of the policy optimizer on all historic data, and $x$ will be the current user. This is used to produce an agent which interacts with the world, maintaining an initially empty history buffer $h$ , as:
45
+
46
+ 1. The world draws $( x _ { t } , r _ { t } ) \sim \mathcal { D }$ and reveals context $x _ { t }$ .
47
+ 2. The agent computes $f _ { t } \gets \mathrm { P O L O P T } ( h )$ and a greedy action $\tilde { a } _ { t } = \pi ( f _ { t } , x _ { t } )$ .
48
+ 3. The agent plays $a _ { t } = \tilde { a } _ { t }$ with probability $( 1 - \mu )$ , and $a _ { t }$ uniformly at random otherwise.
49
+ 4. The agent observes $r _ { t } ( a _ { t } )$ and appends $( x _ { t } , a _ { t } , r _ { t } ( a _ { t } ) , p _ { t } )$ to the history $h$ , where $\begin{array} { r l } { p _ { t } } & { { } = } \end{array}$
50
+ $\mu / K$ if $a _ { t } \neq \tilde { a } _ { t }$ ; and $p _ { t } = 1 - \mu + \mu / K$ if $a _ { t } = \tilde { a } _ { t }$ .
51
+
52
+ Here, $f _ { t }$ is the function optimized on the historical data, and $\pi$ uses it and $x _ { t }$ to choose an action. Intuitively, $\pi$ might choose to use the prediction $f _ { t } ( x _ { t } )$ most of the time, unless $f _ { t }$ is quite uncertain on this example, in which case $\pi$ might choose to return the second (or third) most likely action according to $f _ { t }$ . The agent then performs a small amount of additional $\mu$ -greedy-style exploration: most of the time it acts according to $\pi$ but occasionally it explores some more. In practice $( \ S 5 )$ , we find that setting $\mu = 0$ is optimal in aggregate, but non-zero $\mu$ is necessary for our theory $( \ S 4 )$ .
53
+
54
+ Importantly, we wish to train $\pi$ using one set of tasks (for which we have fully supervised data on which to run simulations) and apply it to wholly different tasks (for which we only have bandit feedback). To achieve this, we allow $\pi$ to depend representationally on $f _ { t }$ in arbitrary ways: for instance, it might use features that capture $f _ { t }$ ’s uncertainty on the current example (see $\ S 5 . 1$ for details). We additionally allow $\pi$ to depend in a task-independent manner on the history (for instance, which actions have not yet been tried): it can use features of the actions, rewards and probabilities in the history but not depend directly on the contexts $x$ . This is to ensure that $\pi$ only learns to explore and not also to solve the underlying task-dependent classification problem. Because $\pi$ needs to learn to be task independent, we found that if $f _ { t }$ ’s predictions were uncalibrated, it was very difficult for $\pi$ to generalize well to unseen tasks. Therefore, we additionally allow $\pi$ to depend on a very small amount of fully labeled data from the task at hand, which we use to allow $\pi$ to calibrate $f _ { t }$ ’s predictions. In our experiments we use only 30 fully labeled examples, but alternative approaches to calibrating $f _ { t }$ that do not require this data would be preferable.
55
+
56
+ # 3.2 TRAINING MELˆ EE BY ´ IMITATION LEARNING
57
+
58
+ The meta-learning challenge is: how do we learn a good exploration policy $\pi 2$ We assume we have access to fully labeled data on which we can train $\pi$ ; this data must include context/reward pairs, but where the reward for all actions is known. This is a weak assumption: in practice, we use purely synthetic data as this training data; one could alternatively use any fully labeled classification dataset (Beygelzimer & Langford, 2009). Under this assumption about the data, it is natural to think of $\pi$ ’s behavior as a sequential decision making problem in a simulated setting, for which a natural class of learning algorithms to consider are imitation learning algorithms (Daume et al., 2009; Ross ´ et al., 2011; Ross & Bagnell, 2014; Chang et al., 2015).2
59
+
60
+ Informally, at training time, MELˆ EE´ will treat one of these synthetic datasets as if it were a contextual bandit dataset. At each time step $t$ , it will compute $f _ { t }$ by running POLOPT on the historical data, and then ask: for each action, what would the long time reward look like if I were to take this action. Because the training data for MELˆ EE´ is fully labeled, this can be evaluated for each possible action, and a policy $\pi$ can be learned to maximize these rewards. More formally, in imitation learning, we assume training-time access to an expert, $\pi ^ { \star }$ , whose behavior we wish to learn to imitate at test-time. From this, we can define an optimal reference policy $\pi ^ { \star }$ , which effectively “cheats” at training time by looking at the true labels. The learning problem is then to estimate $\pi$ to have as similar behavior to $\pi ^ { \star }$ as possible, but without access to those labels.
61
+
62
+ The imitation learning algorithm we use is AggreVaTe (Ross & Bagnell, 2014) (closely related to DAgger (Ross et al., 2011)), and is instantiated for the contextual bandits meta-learning problem in Alg 1. AggreVaTe learns to choose actions to minimize the cost-to-go of the expert rather than the
63
+
64
+ 1: for round $n = 1 , 2 , \dots , N \cdot$ do 2: initialize meta-dataset $D = \{ \}$ , choose $S$ at random from $\{ S _ { m } \}$ , and set history $h _ { 0 } = \left\{ \begin{array} { r l r } \end{array} \right\}$ 3: partition and permute $S$ randomly into train $T r$ and validation Val where $| V a l | = N _ { V a l }$ 4: for round $t = 1 , 2 , \dots , | T r |$ do 5: let $( x _ { t } , r _ { t } ) = T r _ { t }$ 6: 7: for each action optimize $\begin{array} { r } { f _ { t , a } = \mathrm { P o L O P T } ( \mathcal { F } , h _ { t - 1 } \oplus ( x _ { t } , a , r _ { t } ( a ) , 1 - \frac { K - 1 } { K } \mu ) ) } \end{array}$ $a = 1 , \ldots , K$ do on augmented history 8: roll-out: estimate $\hat { c } _ { a }$ , the cost-to-go of $a$ , using $r _ { t } ( a )$ and a roll-out policy $\pi ^ { \mathrm { { o u t } } }$ on $f _ { t , a }$ 9: end for 10: compute $f _ { t } = \mathrm { P o L O P T } ( \mathcal { F } , h _ { t - 1 } )$ 11: aggregate $D \gets D \oplus ( \Phi ( f _ { t } , x _ { t } , h _ { t - 1 } , V a l ) , \langle \hat { c } _ { 1 } , \dots , \hat { c } _ { K } \rangle )$ 12: roll-in: $\begin{array} { r } { a _ { t } \sim \frac { \mu } { K } \mathbf { 1 } _ { K } + ( 1 - \mu ) \pi _ { n - 1 } ( f _ { t } , x _ { t } ) } \end{array}$ with probability $p _ { t }$ , where 1 is the ones-vector 13: append history $h _ { t } \gets h _ { t - 1 } \oplus ( x _ { t } , a _ { t } , r _ { t } ( a _ { t } ) , p _ { t } )$ 14: end for 15: update $\pi _ { n } = \operatorname { L E A R N } ( D )$ 16: end for 17: return $\{ \pi _ { n } \} _ { n = 1 } ^ { N }$
65
+
66
+ zero-one classification loss of mimicking its actions. On the first iteration AggreVaTe collects data by observing the expert perform the task, and in each trajectory, at time $t$ , explores an action $a$ in state $s$ , and observes the cost-to-go $Q$ of the expert after performing this action.
67
+
68
+ Following the AggreVaTe template, MELˆ EE´ operates in an iterative fashion, starting with an arbitrary $\pi$ and improving it through interaction with an expert. Over $N$ rounds, MELˆ EE´ selects random training sets and simulates the test-time behavior on that training set. The core functionality is to generate a number of states $( f _ { t } , x _ { t } )$ on which to train $\pi$ , and to use the supervised data to estimate the value of every action from those states. MELˆ EE´ achieves this by sampling a random supervised training set and setting aside some validation data from it (line 3). It then simulates a contextual bandit problem on this training data; at each time step $t$ , it tries all actions and “pretends” like they were appended to the current history (line 7) on which it trains a new policy and evaluates it’s roll-out value (line 8). This yields, for each $t$ , a new training example for $\pi$ , which is added to $\pi$ ’s training set (line 11); the features for this example are features of the classifier based on true history (line 10) (and possibly statistics of the history itself), with a label that gives, for each action, the corresponding cost-to-go of that action (the $c _ { a } s$ computed in line 8). MELˆ EE´ then must commit to a roll-in action to actually take; it chooses this according to a roll-in policy (line 12). MELˆ EE´ has no explicit “exploitation policy”, exploitation happens when $\pi$ chooses the same action as $f _ { t }$ , while exploration happens when it chooses a different action. In learning to explore, MELˆ EE´ simultaneously learns when to exploit.
69
+
70
+ Roll-in actions. The distribution over states visited by MELˆ EE´ depends on the actions taken, and in general it is good to have that distribution match what is seen at test time. This distribution is determined by a roll-in policy (line 12), controlled in MELˆ EE´ by exploration parameter $\mu \in [ 0 , 1 ]$ . As $\mu \to 1$ , the roll-in policy approaches a uniform random policy; as $\mu \to 0$ , the roll-in policy becomes deterministic. When the roll-in policy does not explore, it acts according to $\pi ( f _ { t } , . )$ .
71
+
72
+ Roll-out values. The ideal value to assign to an action (from the perspective of the imitation learning procedure) is that total reward (or advantage) that would be achieved in the long run if we took this action and then behaved according to our final learned policy. Unfortunately, during training, we do not yet know the final learned policy. Thus, a surrogate roll-out policy $\pi ^ { \mathrm { { o u t } } }$ is used instead. A convenient, and often computationally efficient alternative, is to evaluate the value assuming all future actions were taken by the expert (Langford & Zadrozny, 2005; Daume et al., ´ 2009; Ross & Bagnell, 2014). In our setting, at any time step $t$ , the expert has access to the fully supervised reward vector $\mathbf { } _ { \mathbf { } } ^ { \mathbf { } } \mathbf { \Delta } \mathbf { r } _ { t }$ for the context $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { t } }$ . When estimating the roll-out value for an action $a$ , the expert will return the true reward value for this action $r _ { t } ( a )$ and we use this as our estimate for the roll-out value.
73
+
74
+ # 4 THEORETICAL GUARANTEES
75
+
76
+ We analyze MELˆ EE´ , showing that the no-regret property of AGGREVATE can be leveraged in our meta-learning setting for learning contextual bandit exploration. In particular, we first relate the regret of the learner in line 15 to the overall regret of $\pi$ . This will show that, $i f$ the underlying classifier improves sufficiently quickly, MELˆ EE´ will achieve sublinear regret. We then show that for a specific choice of underlying classifier (BANDITRON), this is achieved. MELˆ EE´ is an instantiation of AGGREVATE (Ross & Bagnell, 2014); as such, it inherits AGGREVATE’s regret guarantees.
77
+
78
+ Theorem 1 $\mathbf { T h m } 2 . 2$ of Ross $\pmb { \& }$ Bagnell (2014), adapted) After $N$ rounds, $i f$ LEARN (line 15) is no-regret algorithm, then as $N \infty$ , with probability 1, it holds that $J ( \bar { \pi } ) ~ \leq ~ J ( \pi ^ { \star } ) +$ $2 T \sqrt { K \hat { \epsilon } _ { c l a s s } ( T ) }$ , where $J ( \cdot )$ is the reward of the exploration policy, $\bar { \pi }$ is the average policy returned, and $\hat { \epsilon } _ { c l a s s } ( T )$ is the average regression regret for each $\pi _ { n }$ accurately predicting $\hat { c } _ { i }$ , where
79
+
80
+ $$
81
+ \hat { \epsilon } _ { c l a s s } ( T ) = \operatorname* { m i n } _ { \pi \in \Pi } \frac { 1 } { N } \hat { \mathbb { E } } _ { t \sim U ( T ) , s \sim d _ { \pi _ { i } } ^ { t } } \sum _ { i = 1 } ^ { N } \Big [ Q _ { T - t + 1 } ^ { \star } ( s , \pi ) - \operatorname* { m i n } _ { a } Q _ { T - t + 1 } ^ { \star } ( s , a ) \Big ]
82
+ $$
83
+
84
+ is the empirical minimum expected cost-sensitive classification regret achieved by policies in the class $\Pi$ on all the data over the $N$ iterations of training when compared to the Bayes optimal regressor, for $U ( T )$ the uniform distribution over $\{ 1 , \ldots , T \}$ , $d _ { \pi } ^ { t }$ the distribution of states at time $t$ induced by executing policy $\pi$ , and $Q ^ { \star }$ the cost-to-go of the imitation learning expert.
85
+
86
+ Thus, achieving low regret at the problem of learning $\pi$ on the training data it observes (“ $D$ ” in MELˆ EE´ ), i.e. $\hat { \epsilon } _ { c l a s s } ( T )$ is small, translates into low regret in the contextual-bandit setting. At first glance this bound looks like it may scale linearly with $T$ . However, the bound in Theorem 1 is dependent on $\hat { \epsilon } _ { c l a s s } ( T )$ . Note however, that $s$ is a combination of the context vector $x _ { t }$ and the classification function $f _ { t }$ . As $T \to \infty$ , one would hope that $f _ { t }$ improves significantly and $\hat { \epsilon } _ { c l a s s } ( T )$ decays quickly. Thus, sublinear regret may still be achievable when $f$ learns sufficiently quickly as a function of $T$ . For instance, if $f$ is optimizing a strongly convex loss function, online gradient descent achieves a regret guarantee of $O \big ( \frac { \log T } { T } \big )$ (Hazan et al., 2016, Theorem 3.3), potentially leading to a regret for MELˆ EE´ of $O ( \sqrt { ( \log T ) / T } )$ .
87
+
88
+ The above statement is informal (it does not take into account the interaction between learning $f$ and $\pi$ ). However, we can show a specific concrete example: we analyze MELˆ EE´ ’s test-time behavior when the underlying learning algorithm is BANDITRON. BANDITRON is a variant of the multiclass Perceptron that operates under bandit feedback. Details of this analysis (and proofs, which directly follow the original BANDITRON analysis) are given in Appendix A; here we state the main result. Let $\gamma _ { t } = \mathrm { P r } \big [ \bar { r } _ { t } ( \pi ( f _ { t } , x _ { t } ) = 1 ) | x _ { t } | \big ] - \mathrm { P r } \big [ r _ { t } ( \bar { f } _ { t } ( x _ { t } ) ) = \hat { 1 } \big | x _ { t } \big ]$ be the edge of $\pi ( f _ { t } , . )$ over $f$ , and $\begin{array} { r } { \Gamma = \frac { 1 } { T } \sum _ { t = 1 } ^ { T } \mathbb { E } \frac { 1 } { 1 + K \gamma _ { t } } } \end{array}$ be an overall measure of the edge. For instance if $\pi$ simply returns $f$ ’s prediction, then all $\gamma _ { t } = 0$ and $\Gamma = 1$ . We can then show the following:
89
+
90
+ Theorem 2 Assume that for the sequence of examples, $( x _ { 1 } , pmb { r } _ { 1 } ) , ( x _ { 2 } , \pmb { r } _ { 2 } ) , \dots , ( x _ { T } , \pmb { r } _ { T } )$ , we have, for all $t _ { : }$ , $| | x _ { t } | | \leq 1$ . Let $W ^ { \star }$ be any matrix, let $L$ be the cumulative hinge-loss of $W ^ { \star }$ , let $\mu$ be a uniform exploration probability, and let $D = 2 \left| \left| W ^ { \star } \right| \right| _ { F } ^ { 2 }$ be the complexity of $W ^ { \star }$ . Assume that $\mathbb { E } \gamma _ { t } \geq 0$ for all $t$ . Then the number of mistakes $M$ made by MELˆ EE´ with BANDITRON as POLOPT satisfies:
91
+
92
+ $$
93
+ \mathbb { E } M \leq L + K \mu T + 3 \operatorname* { m a x } \left\{ D \Gamma / \mu , \sqrt { D T K \Gamma \mu } \right\} + \sqrt { D L \Gamma / \mu }
94
+ $$
95
+
96
+ where the expectation is taken with respect to the randomness of the algorithm.
97
+
98
+ Note that under the assumption $\mathbb { E } \gamma _ { t } \geq 0$ for all $t$ , we have $\Gamma \leq 1$ . The analysis gives the same mistake bound for BANDITRON but with the factor of $\Gamma$ , hence this result improves upon the BANDITRON analysis only when $\Gamma < 1$ (in the realizable setting, the number of mistakes is analogous to the regret). This result is highly stylized and the assumption that $\mathbb { E } \gamma _ { t } \geq 0$ is overly strong. This assumption ensures that $\pi$ never decreases the probability of a “correct” action. It does, however, help us understand the behavior of MELˆ EE´ , qualitatively: First, the quantity that matters in Theorem 2, $\mathbb { E } _ { t } { \gamma } _ { t }$ is (in the $_ { 0 / 1 }$ loss case) exactly what MELˆ EE´ is optimizing: the expected improvement for choosing an action against $f _ { t }$ ’s recommendation. Second, the benefit of using $\pi$ within BANDITRON is a local benefit: because $\pi$ is trained with expert rollouts, as discussed in $\ S 4$ , the primary improvement in the analysis is to ensure that $\pi$ does a better job predicting (in a single step) than $f _ { t }$ does. An obvious open question is whether it is possible to base the analysis on the regret of $\pi$ (rather than its error) and whether it is possible to extend beyond the BANDITRON.
99
+
100
+ # 5 EXPERIMENTAL SETUP AND RESULTS
101
+
102
+ Using a collection of synthetically generated classification problems, we train an exploration policy $\pi$ using MELˆ EE´ (Alg 1). This exploration policy learns to explore on the basis of calibrated probabilistic predictions from $f$ together with a predefined set of exploration features $( \ S 5 . 1 )$ . Once $\pi$ is learned and fixed, we follow the test-time behavior described in $\ S 3 . 1$ to evaluate $\pi$ on a set of contextual bandit problems. We evaluate MELˆ EE´ on a natural learning to rank task $( \ S 5 . 3 . 1 )$ . To ensure that the performance of MELˆ EE´ generalizes beyond this single learning to rank task, we additionally perform thorough evaluation on 300 “simulated” contextual bandit problems, derived from standard classification tasks (§5.3.2).
103
+
104
+ In all cases, the underlying classifier $f$ is a linear model trained with a policy optimizer that runs stochastic gradient descent (details are in $\ S \mathbf { A } . 2 )$ . We seek to answer two questions experimentally: (1) How does MELˆ EE´ compare empirically to alternative (expert designed) exploration strategies? (2) How important are the additional features used by MELˆ EE´ in comparison to using calibrated probability predictions from $f$ as features?
105
+
106
+ # 5.1 TRAINING DETAILS FOR THE EXPLORATION POLICY
107
+
108
+ Exploration Features. In our experiments, the exploration policy is trained based on features $\Phi$ (Alg 1, line 11). These features are allowed to depend on the current classifier $f _ { t }$ , and on any part of the history except the inputs $x _ { t }$ in order to maintain task independence. We additionally ensure that its features are independent of the dimensionality of the inputs, so that $\pi$ can generalize to datasets of arbitrary dimensions. The specific features we use are listed below; these are largely inspired by Konyushkova et al. (2017) but adapted and augmented to our setting.
109
+
110
+ The features of $f _ { t }$ that we use are: a) predicted probability $p ( a _ { t } | f _ { t } , \pmb { x } _ { t } )$ , we use a softmax over the predicted rewards from $f _ { t }$ to convert them to probabilities; b) entropy of the predicted probability distribution; c) a one-hot encoding for the predicted action $f _ { t } ( \pmb { x } _ { t } )$ . The features of $h _ { t - 1 }$ that we use are: a) current time step $t ; { \bf b } )$ normalized counts for all previous actions predicted so far; c) average observed rewards for each action; d) empirical variance of the observed rewards for each action in the history. In our experiments, we found that it is essential to calibrate the predicted probabilities of the classifier $f _ { t }$ . We use a very small held-out dataset, of size 30, to achieve this. We use Platt’s scaling (Platt, 1999; Lin et al., 2007) method to calibrate the predicted probabilities. Platt’s scaling works by fitting a logistic regression model to the classifier’s predicted scores.
111
+
112
+ Training Datasets. In our experiments, we follow Konyushkova et al. (2017) (and also Peters et al. (2014), in a different setting) and train the exploration policy $\pi$ only on synthetic data. This is possible because the exploration policy $\pi$ never makes use of $x$ explicitly and instead only accesses it via $f _ { t }$ ’s behavior on it. We generate datasets with uniformly distributed class conditional distributions. The datasets are always two-dimensional. Details are in $\ S \mathrm { A } . 1$ .
113
+
114
+ # 5.2 EVALUATION METHODOLOGY
115
+
116
+ For evaluation, we use progressive validation (Blum et al., 1999), which is exactly computing the reward of the algorithm. Specifically, to evaluate the performance of an exploration algorithm $\mathcal { A }$ on a dataset $S$ of size $n$ , we compute the progressive validation return $\begin{array} { r } { G ( \mathcal { A } ) = \frac { 1 } { n } \sum _ { t = 1 } ^ { n } r _ { t } ( a _ { t } ) } \end{array}$ as the average reward up to $n$ , where $a _ { t }$ is the action chosen by the algorithm $\mathcal { A }$ and $r _ { t }$ is the true reward.
117
+
118
+ Because our evaluation is over 300 datasets, we report aggregate results in two forms. The simpler one is Win/Loss Statistics: We compare two exploration methods on a given dataset by counting the number of statistically significant wins and losses. An exploration algorithm $\mathcal { A }$ wins over another algorithm $\boldsymbol { B }$ if the progressive validation return $G ( { \mathcal { A } } )$ is statistically significantly larger than $B$ ’s return $G ( B )$ at the 0.01 level using a paired sample t-test. We also report cumulative distributions of rewards for each algorithm, following Zhang et al. (2019). In particular, for a given relative reward value $( x \in [ 0 , 1 ] )$ , the corresponding CDF value for a given algorithm is the fraction of datasets on which this algorithm achieved reward at least $x$ . We compute relative reward by Min
119
+
120
+ Max normalization: linearly transforming reward $y$ to $\begin{array} { r } { y ^ { \prime } = \frac { y - \mathrm { m i n } } { \mathrm { m a x - m i n } } } \end{array}$ , where min & max are the minimum & maximum rewards among all exploration algorithms.
121
+
122
+ In our experiments, we compare to the following baseline exploration methods, keeping the policy optimization method fixed (details in $\ S \mathbf { A . 4 } )$ ): $\epsilon$ -greedy (Sutton, 1996); $\epsilon$ -decreasing (Sutton & Barto, 1998); EG $\epsilon$ -greedy (Li et al., 2010b); $\tau$ -first. We additionally compare to three state-of-the-art exploration methods: LinUCB (Li et al., 2010a); Cover (Agarwal et al., 2014); and its variant Cover-NU (Bietti et al., 2018). We select the best hyperparameters following Bietti et al. (2018).
123
+
124
+ # 5.3 EXPERIMENTAL RESULTS
125
+
126
+ # 5.3.1 LEARNING TO RANK
127
+
128
+ We evaluate MELˆ EE´ on a natural learning to rank dataset. The dataset we consider is the Microsoft Learning to Rank dataset, variant MSLR-10K from Qin & Liu (2013) 3. The dataset consists of feature vectors extracted from query-url pairs along with relevance judgment labels. The relevance judgments are obtained from a retired labeling set of a commercial web search engine (Microsoft Bing), which take 5 values from 0 (irrelevant) to 4 (perfectly relevant) and we drop the queries not labelled as any of the two extremes. In our experiments, we limit the number of labels to the two extremes: 0 and 4. A query-url pair is represented by a 136-dimensional feature vector. The dataset is highly imbalanced as the number of irrelevant queries is much larger than the number of relevant ones. To address this, we sample the number of irrelevant queries to match that of the relevant ones. To avoid correlations between the observed query-url pairs, we group the queries by the query ID, and sample a single query from each group. We convert relevance scores to losses with 0 indicating a perfectly relevant document, and 1 an irrelevant one.
129
+
130
+ Figure 1 shows the evaluation results on a subset of the MSLR-10K dataset. Since the performance is closely matched between the different exploration algorithms, we repeat the experiment 16 times with randomly shuffled permutations of the MSLR-10K dataset. Figure 1 (left) shows the learning curve of the trained policy $\pi$ as well as the baselines. Here, we see that MELˆ EE´ quickly achieves high reward, after about 100 examples the two strongest baselines catch up. By 200 examples all approaches have asymptoted. We exclude LinUCB from these runs because the required matrix inversions made it too computationally expensive.4 Figure 1 shows statistically-significant win/loss differences for each of the algorithms, across these 16 shuffles. Each row/column entry shows the number of times the row algorithm won against the column, minus the number of losses. MELˆ EE´ is the only algorithm that always wins more than it loses against other algorithms, and outperforms the nearest competition ( $\epsilon$ -decreasing) by 3 points.
131
+
132
+ # 5.3.2 SIMULATED CONTEXTUAL BANDIT TASKS
133
+
134
+ We additionally perform an exhaustive evaluation on simulated contextual bandit tasks to ensure that the performance of MELˆ EE´ generalizes beyond learning to rank. Following Bietti et al. (2018), we use a collection of 300 binary classification datasets from openml.org for evaluation; the precise list and download instructions is in $\ S \mathbf { A } . 3$ . These datasets cover a variety of different domains including text $\&$ image processing, medical, and sensory data. We convert classification datasets into cost-sensitive classification problems by using a $0 / 1$ encoding. Given these fully supervised cost-sensitive multi-class datasets, we simulate the contextual bandit setting by only revealing the reward for the selected actions.
135
+
136
+ In Figure 2 (left), we show a representative learning curve. Here, we see that as more data becomes available, all the approaches improve (except $\tau$ -first, which has ceased to learn after $2 \%$ of the data). MELˆ EE´ , in particular, is able to very quickly achieve near-optimal performance (in around 40 examples) in comparison to the best baseline which takes at least 200. In Figure 2 (right), we show the CDFs for the different algorithms. To help read this, at $x = 1 . 0$ , MELˆ EE´ has a relative reward at least 1.0 on more than $40 \%$ of datasets, while $\epsilon$ -decreasing and $\epsilon$ -greedy achieve this on about $30 \%$ of datasets. We find that the two strongest baselines are $\epsilon$ -decreasing and $\epsilon$ -greedy (better when reward differences are small, toward the left of the graph). The two curves for $\epsilon$ -decreasing and $\epsilon$ - greedy coincide. This happens because the exploration probability $\epsilon _ { 0 }$ for $\epsilon$ -decreasing decays rapidly approaching zero with a rate of $\textstyle { \frac { 1 } { t } }$ , where $t$ is the index of the current round. MELˆ EE´ outperforms the baselines in the “large reward” regimes (right of graph) but under-performs $\epsilon$ -decreasing and $\epsilon$ -greedy in low reward regimes (left of graph).
137
+
138
+ ![](images/b1788988d738da0efcd31535810491c3b39d1eba306ed5431107fee49afac2b5.jpg)
139
+ Figure 1: Results for the Learning to Rank task. (Left) Learning curve on the MSLR-10K dataset: $\mathbf { X }$ -axis shows the number of queries observed, and y-axis shows the progressive reward. (Right) Win/Loss counts for all pairs of algorithms over 16 random shuffles for the MSLR-10K dataset.
140
+
141
+ ![](images/6888bb6073c77103de6a8010443f100180a1163ae34fbd197c0760f993ad28e5.jpg)
142
+ Figure 2: Behavior of MELˆ EE´ in comparison to baseline and state-of-the-art exploration algorithms.
143
+
144
+ In Figure 3, we show statistically-significant win/loss differences for each of the algorithms. Here, each (row, column) entry shows the number of times the row algorithm won against the column, minus the number of losses. MELˆ EE´ is the only algorithm that always wins more than it loses against other algorithms, and outperforms the nearest competition ( $\epsilon$ -decreasing) by 23 points.
145
+
146
+ To understand more directly how MELˆ EE´ compares to $\epsilon$ -decreasing, in the left plot of Figure 4, we show a scatter plot of rewards achieved by MELˆ EE´ $\mathbf { \dot { X } }$ -axis) and $\epsilon$ -decreasing (y-axis) on each of the 300 datasets, with statistically significant differences highlighted in red and insignificant differences in blue. Points below the diagonal line correspond to better performance by MELˆ EE´ (147 datasets)
147
+
148
+ ![](images/2e5f7991d2955d71f4a06f822d4d7174981f8622bdddcce1efae21f30ba0af0b.jpg)
149
+ Figure 3: Win/Loss counts for all pairs of algorithms (columns match the rows).
150
+
151
+ ![](images/f000364f695f671698bcf02790d820913e704e54048dceca345b44fcdbac3291.jpg)
152
+ Figure 4: Scatterplots comparing MELˆ EE´ to the best baseline and to a variant with fewer features.
153
+
154
+ and points above to $\epsilon$ -decreasing (124 datasets). The remaining 29 had no statistically significant difference.
155
+
156
+ Finally, we consider the effect that the additional features have on MELˆ EE´ ’s performance. In particular, we consider a version of MELˆ EE´ with all features (this is the version used in all other experiments) with an ablated version that only has access to the (calibrated) probabilities of each action from the underlying classifier $f$ . The comparison is shown as a scatter plot in Figure 4 (right). Here, we can see that the full feature set does provide lift over just the calibrated probabilities, with a win-minus-loss improvement of 24 by adding additional features from which to learn to explore.
157
+
158
+ # 6 RELATED WORK AND DISCUSSION
159
+
160
+ The field of meta-learning is based on the idea of replacing hand-engineered learning heuristics with heuristics learned from data. One of the most relevant settings for meta-learning to ours is active learning, in which one aims to learn a decision function to decide which examples, from a pool of unlabeled examples, should be labeled. Past approaches to meta-learning for active learning include reinforcement learning-based strategies (Woodward & Finn, 2017; Fang et al., 2017), imitation learning-based strategies (Bachman et al., 2017), and batch supervised learning-based strategies (Konyushkova et al., 2017). Similar approaches have been used to learn heuristics for optimization (Li & Malik, 2016; Andrychowicz et al., 2016), multiarm (non-contextual) bandits Maes et al. (2012), and neural architecture search (Zoph & Le, 2016), recently mostly based on (deep) reinforcement learning. While meta-learning for contextual bandits is most similar to meta-learning for active learning, there is a fundamental difference that makes it significantly more challenging: in active learning, the goal is to select as few examples as you can to learn, so by definition the horizon is short; in contextual bandits, learning to explore is fundamentally a long-horizon problem, because what matters is not immediate reward but long term learning.
161
+
162
+ In reinforcement learning, Gupta et al. (2018) investigated the task of meta-learning an exploration strategy for a distribution of related tasks by learning a latent exploration space. Similarly, Xu et al. (2018) proposed a teacher-student approach for learning to do exploration in off-policy reinforcement learning. While these approaches are effective if the distribution of tasks is very similar and the state space is shared among different tasks, they fail to generalize when the tasks are different. Our approach targets an easier problem than exploration in full reinforcement learning environments, and can generalize well across a wide range of different tasks with completely unrelated features spaces.
163
+
164
+ There has also been a substantial amount of work on constructing “good” exploration policies, in problems of varying complexity: traditional bandit settings (Karnin & Anava, 2016), contextual bandits (Fraud et al., 2016) and reinforcement learning (Osband et al., 2016). In both bandit settings, most of this work has focused on the learning theory aspect of exploration: what exploration distributions guarantee that learning will succeed (with high probability)? MELˆ EE´ , lacks such guarantees: in particular, if the data distribution of the observed contexts $( \phi ( f _ { t } ) )$ in some test problem differs substantially from that on which MELˆ EE´ was trained, we can say nothing about the quality of the learned exploration. Nevertheless, despite fairly substantial distribution mismatch (synthetic real-world), MELˆ EE´ works well in practice, and our stylized theory $( \ S 4 )$ suggests that there may be an interesting avenue for developing strong theoretical results for contextual bandit learning with learned exploration policies, and perhaps other meta-learning problems.
165
+
166
+ In conclusion, we presented MELˆ EE´ , a meta-learning algorithm for learning exploration policies in the contextual bandit setting. MELˆ EE´ enjoys no-regret guarantees, and empirically it outperforms alternative exploration algorithm in most settings. One limitation of MELˆ EE´ is the computational resources required during the offline training phase on the synthetic datasets. In the future, we will work on improving the computational efficiency for MELˆ EE´ in the offline training phase and scale the experimental analysis to problems with larger number of classes.
167
+
168
+ # REFERENCES
169
+
170
+ Alekh Agarwal, Daniel Hsu, Satyen Kale, John Langford, Lihong Li, and Robert E. Schapire. Taming the monster: A fast and simple algorithm for contextual bandits. In In Proceedings of the 31st International Conference on Machine Learning (ICML-14, pp. 1638–1646, 2014.
171
+ Marcin Andrychowicz, Misha Denil, Sergio Gomez, Matthew W Hoffman, David Pfau, Tom Schaul, and Nando de Freitas. Learning to learn by gradient descent by gradient descent. In Advances in Neural Information Processing Systems, pp. 3981–3989, 2016.
172
+ Peter Auer. Using confidence bounds for exploitation-exploration trade-offs. The Journal of Machine Learning Research, 3:397–422, 2003.
173
+ Philip Bachman, Alessandro Sordoni, and Adam Trischler. Learning algorithms for active learning. In ICML, 2017.
174
+ Alina Beygelzimer and John Langford. The offset tree for learning with partial labels. In Proceedings of the 15th ACM SIGKDD international conference on Knowledge discovery and data mining, pp. 129–138. ACM, 2009.
175
+ Alberto Bietti, Alekh Agarwal, and John Langford. A Contextual Bandit Bake-off. working paper or preprint, May 2018.
176
+ Avrim Blum, Adam Kalai, and John Langford. Beating the hold-out: Bounds for k-fold and progressive cross-validation. In Proceedings of the twelfth annual conference on Computational learning theory, pp. 203–208. ACM, 1999.
177
+ Leo Breiman. Random forests. Mach. Learn., 45(1):5–32, October 2001. ISSN 0885-6125. doi: 10.1023/A:1010933404324.
178
+
179
+ Kai-Wei Chang, Akshay Krishnamurthy, Alekh Agarwal, Hal Daume, III, and John Langford. ´ Learning to search better than your teacher. In Proceedings of the 32Nd International Conference on International Conference on Machine Learning - Volume 37, ICML, pp. 2058–2066. JMLR.org, 2015.
180
+
181
+ Hal Daume, III, John Langford, and Daniel Marcu. Search-based structured prediction. ´ Machine Learning, 75(3):297–325, Jun 2009. ISSN 1573-0565. doi: 10.1007/s10994-009-5106-x.
182
+
183
+ Miroslav Dudik, Daniel Hsu, Satyen Kale, Nikos Karampatziakis, John Langford, Lev Reyzin, and Tong Zhang. Efficient optimal learning for contextual bandits. arXiv preprint arXiv:1106.2369, 2011.
184
+
185
+ Meng Fang, Yuan Li, and Trevor Cohn. Learning how to active learn: A deep reinforcement learning approach. In EMNLP, 2017.
186
+
187
+ Raphal Fraud, Robin Allesiardo, Tanguy Urvoy, and Fabrice Clrot. Random forest for the contextual bandit problem. In Arthur Gretton and Christian C. Robert (eds.), Proceedings of the 19th International Conference on Artificial Intelligence and Statistics, volume 51 of Proceedings of Machine Learning Research, pp. 93–101, Cadiz, Spain, 09–11 May 2016. PMLR.
188
+
189
+ Abhishek Gupta, Russell Mendonca, YuXuan Liu, Pieter Abbeel, and Sergey Levine. Metareinforcement learning of structured exploration strategies. arXiv preprint arXiv:1802.07245, 2018.
190
+
191
+ Elad Hazan et al. Introduction to online convex optimization. Foundations and Trends $\textsuperscript { \textregistered }$ in Optimization, 2(3-4):157–325, 2016.
192
+
193
+ Leslie Pack Kaelbling. Associative reinforcement learning: Functions ink-dnf. Machine Learning, 15(3):279–298, 1994.
194
+
195
+ Sham M. Kakade, Shai Shalev-Shwart, and Ambuj Tewari. Efficient bandit algorithms for online multiclass prediction. In ICML, 2008.
196
+
197
+ Zohar S Karnin and Oren Anava. Multi-armed bandits: Competing with optimal sequences. In D. D. Lee, M. Sugiyama, U. V. Luxburg, I. Guyon, and R. Garnett (eds.), Advances in Neural Information Processing Systems 29, pp. 199–207. Curran Associates, Inc., 2016.
198
+
199
+ Ksenia Konyushkova, Raphael Sznitman, and Pascal Fua. Learning active learning from data. In Advances in Neural Information Processing Systems, 2017.
200
+
201
+ John Langford and Bianca Zadrozny. Relating reinforcement learning performance to classification performance. In Proceedings of the 22nd international conference on Machine learning, pp. 473–480. ACM, 2005.
202
+
203
+ John Langford and Tong Zhang. The epoch-greedy algorithm for multi-armed bandits with side information. In Advances in Neural Information Processing Systems 20, pp. 817–824. Curran Associates, Inc., 2008.
204
+
205
+ Ke Li and Jitendra Malik. Learning to optimize. arXiv preprint arXiv:1606.01885, 2016.
206
+
207
+ Lihong Li, Wei Chu, John Langford, and Robert E. Schapire. A contextual-bandit approach to personalized news article recommendation. In Proceedings of the 19th International Conference on World Wide Web, WWW ’10, pp. 661–670, New York, NY, USA, 2010a. ACM. ISBN 978-1- 60558-799-8. doi: 10.1145/1772690.1772758.
208
+
209
+ Wei Li, Xuerui Wang, Ruofei Zhang, Ying Cui, Jianchang Mao, and Rong Jin. Exploitation and exploration in a performance based contextual advertising system. In Proceedings of the 16th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, KDD ’10, pp. 27–36, New York, NY, USA, 2010b. ACM.
210
+
211
+ Hsuan-Tien Lin, Chih-Jen Lin, and Ruby C. Weng. A note on platt’s probabilistic outputs for support vector machines. Machine Learning, 68(3):267–276, Oct 2007. ISSN 1573-0565. doi: 10.1007/s10994-007-5018-6.
212
+
213
+ Francis Maes, Louis Wehenkel, and Damien Ernst. Meta-learning of exploration/exploitation strategies: The multi-armed bandit case. In International Conference on Agents and Artificial Intelligence, pp. 100–115. Springer, 2012.
214
+
215
+ Ian Osband, Charles Blundell, Alexander Pritzel, and Benjamin Van Roy. Deep exploration via bootstrapped dqn. In D. D. Lee, M. Sugiyama, U. V. Luxburg, I. Guyon, and R. Garnett (eds.), Advances in Neural Information Processing Systems 29, pp. 4026–4034. Curran Associates, Inc., 2016.
216
+
217
+ F. Pedregosa, G. Varoquaux, A. Gramfort, V. Michel, B. Thirion, O. Grisel, M. Blondel, P. Prettenhofer, R. Weiss, V. Dubourg, J. Vanderplas, A. Passos, D. Cournapeau, M. Brucher, M. Perrot, and E. Duchesnay. Scikit-learn: Machine learning in Python. Journal of Machine Learning Research, 12:2825–2830, 2011.
218
+
219
+ Jonas Peters, Joris M Mooij, Dominik Janzing, and Bernhard Scholkopf. Causal discovery with ¨ continuous additive noise models. The Journal of Machine Learning Research, 15(1):2009–2053, 2014.
220
+
221
+ John C. Platt. Probabilistic outputs for support vector machines and comparisons to regularized likelihood methods. In ADVANCES IN LARGE MARGIN CLASSIFIERS, pp. 61–74. MIT Press, 1999.
222
+
223
+ Tao Qin and Tie-Yan Liu. Introducing LETOR 4.0 datasets. CoRR, abs/1306.2597, 2013. URL http://arxiv.org/abs/1306.2597.
224
+
225
+ Stephane Ross and J Andrew Bagnell. Reinforcement and imitation learning via interactive no-regret ´ learning. arXiv preprint arXiv:1406.5979, 2014.
226
+
227
+ Stephane Ross, Geoffrey Gordon, and J Andrew Bagnell. A reduction of imitation learning and ´ structured prediction to no-regret online learning. In Proceedings of the Fourteenth International Conference on Artificial Intelligence and Statistics, volume 15 of Proceedings of Machine Learning Research, pp. 627–635, Fort Lauderdale, FL, USA, 11–13 Apr 2011. PMLR.
228
+
229
+ Richard S Sutton. Generalization in reinforcement learning: Successful examples using sparse coarse coding. In Advances in neural information processing systems, pp. 1038–1044, 1996.
230
+
231
+ Richard S. Sutton and Andrew G. Barto. Introduction to Reinforcement Learning. MIT Press, Cambridge, MA, USA, 1st edition, 1998. ISBN 0262193981.
232
+
233
+ Mark Woodward and Chelsea Finn. Active one-shot learning. arXiv preprint arXiv:1702.06559, 2017.
234
+
235
+ Tianbing Xu, Qiang Liu, Liang Zhao, Wei Xu, and Jian Peng. Learning to explore with meta-policy gradient. arXiv preprint arXiv:1803.05044, 2018.
236
+
237
+ Chicheng Zhang, Alekh Agarwal, Hal Daume, III, John Langford, and Sahand N Negahban. Warm- ´ starting contextual bandits: Robustly combining supervised and bandit feedback. In ICML, 2019.
238
+
239
+ Barret Zoph and Quoc V Le. Neural architecture search with reinforcement learning. arXiv preprint arXiv:1611.01578, 2016.
240
+
241
+ # Supplementary Material For: Learning Effective Exploration Strategies for Contextual Bandits
242
+
243
+ A STYLIZED TEST-TIME ANALYSIS FOR BANDITRON: DETAILS
244
+
245
+ The BANDITRONMELˆ EE´ algorithm is specified in $\mathrm { A l g } 2$ . The is exactly the same as the typical test time behavior, except it uses a BANDITRON-type strategy for learning the underlying classifier $f$ in the place of POLOPT. POLICYELIMINATIONMETA takes as arguments: $\pi$ (the learned exploration policy) and $\mu \in ( 0 , 1 / ( 2 K ) )$ an added uniform exploration parameter. The BANDITRON learns a linear multi-class classifier parameterized by a weight matrix of size $K { \times } D$ , where $D$ is the input dimensionality. The BANDITRON assumes a pure multi-class setting in which the reward for one (“correct”) action is 1 and the reward for all other actions is zero.
246
+
247
+ At each round $t$ , a prediction $\hat { a } _ { t }$ is made according to $f _ { t }$ (summarized by $W ^ { t }$ ). We then define an exploration distribution that “most of the time” acts according to $\pi ( f _ { t } , . )$ , but smooths each action with $\mu$ probability. The chosen action $a _ { t }$ is sampled from this distribution and a binary reward is observed. The weights of the BANDITRON are updated according to the BANDITRON update rule using $\tilde { U } ^ { t }$ .
248
+
249
+ # Algorithm 2 BANDITRONMELˆ EE´ $( g , \mu )$
250
+
251
+ 1: initialize $W ^ { 1 } = \mathbf { 0 } \in \mathbb { R } ^ { K \times D }$
252
+ 2: for rounds $t = 1 \dots T$ : do
253
+ 3: observe $\boldsymbol { x } _ { t } \in \mathbb { R } ^ { D }$
254
+ 4: compute $\begin{array} { r } { \hat { a } _ { t } = f _ { t } ( x _ { t } ) = \mathrm { a r g m a x } _ { k \in K } \left( W ^ { t } x _ { t } \right) _ { k } } \end{array}$
255
+ 5: define $Q ^ { \mu } ( a ) = \mu + ( 1 - K \mu ) { \bf 1 } [ a = \pi ( W ^ { t } , x _ { t } ) ]$
256
+ 6: sample $a _ { t } \sim Q ^ { \mu }$
257
+ 7: observe reward $r _ { t } ( a _ { t } ) \in \{ 0 , 1 \}$
258
+ 8: d $\tilde { U } ^ { t } \in \mathbb { R } ^ { K \times D }$
259
+ $\begin{array} { r } { \tilde { U } _ { a , \cdot } ^ { t } = x _ { t } \left( \frac { \mathbf { 1 } [ r _ { t } ( a _ { t } ) = 1 ] \mathbf { 1 } [ a _ { t } = a ] } { Q ^ { \mu } ( a ) } - \mathbf { 1 } [ \hat { a } _ { t } = a ] \right) } \end{array}$
260
+ 9: update $W ^ { t + 1 } = W ^ { t } + \tilde { U } ^ { t }$
261
+
262
+ The only difference between BANDITRONMELˆ EE´ and the original BANDITRON is the introduction of $\pi$ in the sampling distribution. The original algorithm achieves the following mistake bound shown below, which depends on the notion of multi-class hinge-loss. In particular, the hinge-loss of $W$ on $( x , r )$ is $\ell ( W , ( x , \pmb { r } ) ) = \mathrm { m a x } _ { a \neq a ^ { \star } }$ max $\left\{ 0 , 1 - ( W x ) _ { a ^ { \star } } + ( W x ) _ { a } ^ { \top } \right\}$ , where $a ^ { \star }$ is the $a$ for which $r ( a ) = 1$ . The overall hinge-loss $L$ is the sum of $\ell$ over the sequence of examples.
263
+
264
+ Theorem 3 (Thm. 1 and Corr. 2 of Kakade et al. (2008)) Assume that for the sequence of examples, $( x _ { 1 } , r _ { 1 } ) , ( x _ { 2 } , r _ { 2 } ) , \ldots , ( x _ { T } , \pmb { r } _ { T } )$ , we have, for all $t _ { : }$ , $| | x _ { t } | | \leq 1$ . Let $W ^ { \star }$ be any matrix, let $L$ be the cumulative hinge-loss of $W ^ { \star }$ , and let $D = 2 \left| \left| W ^ { \star } \right| \right| _ { F } ^ { 2 }$ be the complexity of $W ^ { \star }$ . The number of mistakes $M$ made by the BANDITRON satisfies
265
+
266
+ $$
267
+ { \mathbb { E } } M \leq L + K \mu T + 3 \operatorname* { m a x } \left\{ { \frac { D } { \mu } } , { \sqrt { D T K \mu } } \right\} + { \sqrt { D L / \mu } }
268
+ $$
269
+
270
+ where the expectation is taken with respect to the randomness of the algorithm. Furthermore, in a low noise setting (there exists $W ^ { \star }$ with fixed complexity √ $d$ and loss $\bar { L ( \mathbf { \Omega } \leq \cal { O } ( \sqrt { \cal { D } K T } ) ) }$ , then by setting $\mu = \sqrt { D / ( T K ) }$ , we obtain $\mathbb { E } M \le O ( \sqrt { K D T } )$ .
271
+
272
+ We can prove an analogous result for BANDITRONMELˆ EE´ . The key quantity that will control how much $\pi$ improves the execution of BANDITRONMELˆ EE´ is how much $\pi$ improves on $f _ { t }$ when $f _ { t }$ is $\pi ( f _ { t } , . )$ In p over $f$ ticul, and $\begin{array} { r } { \Gamma = \frac { 1 } { T } \sum _ { t = 1 } ^ { T } \mathbb { E } \frac { 1 } { 1 + K \gamma _ { t } } } \end{array}$ $\gamma _ { t } = \operatorname* { P r } [ r _ { t } ( \pi ( f _ { t } , x _ { t } ) = 1 ) | x _ { t } ] - \operatorname* { P r } [ r _ { t } ( f _ { t } ( x _ { t } ) ) = 1 | x _ { t } ]$ $\pi$ e the edge ofdoes nothing, then all $\gamma _ { t } = 0$ $\Gamma = 1 .$ .) Given this quantity, we can prove the following Theorem 2.
273
+
274
+ Proof: [sketch] The proof is a small modification of the original proof of Theorem 3. The only change is that in the original proof, the following bound is used: $\mathbb { E } _ { t } | | \bar { \tilde { U } } ^ { t } | | ^ { 2 } / | | x _ { t } | | ^ { 2 } = 1 + 1 / \mu \le 2 / \mu$
275
+
276
+ We use, instead: Et||U˜ t||2/||xt||2 ≤ 1 + Et 1µ+γt 2Et 11+γtµ . The rest of the proof goes through identically.
277
+
278
+ # A.1 DETAILS OF SYNTHETIC DATASETS
279
+
280
+ We generate datasets with uniformly distributed class conditional distributions. We generate 2D datasets by first sampling a random variable representing the Bayes classification error. The Bayes error is sampled uniformly from the interval 0.0 to 0.5. Next, we generate a balanced dataset where the data for each class lies within a unit rectangle and sampled uniformly. We overlap the sampling rectangular regions to generate a dataset with the desired Bayes error selected in the first step.
281
+
282
+ # A.2 IMPLEMENTATION DETAILS
283
+
284
+ Our implementation is based on scikit-learn (Pedregosa et al., 2011). We fix the training time exploration parameter $\mu$ to 0.1. We train the exploration policy $\pi$ on 82 synthetic datasets each of size 3000 with uniform class conditional distributions, a total of $2 4 6 k$ samples (§A.1). We train $\pi$ using a linear classifier Breiman (2001) and set the hyper-parameters for the learning rate, and data scaling methods using three-fold cross-validation on the whole meta-training dataset. For the classifier class $\mathcal { F }$ , we use a linear model trained with stochastic gradient descent. We standardize all features to zero mean and unit variance, or scale the features to lie between zero and one. To select between the two scaling methods, and tune the classifier’s learning rate, we use three-fold cross-validation on a small fully supervised training set of size 30 samples. The same set is used to calibrate the predicted probabilities of $f _ { t }$ .
285
+
286
+ # A.3 LIST OF DATASETS
287
+
288
+ The datasets we used can be accessed at https://www.openml.org/d/<id>. The list of (id, size) pairs below shows the (id for the datasets we used and the dataset size in number of examples:
289
+
290
+ (46,100) (716, 100) (726, 100) (754, 100) (762, 100) (768, 100) (775, 100) (783, 100) (789, 100) (808, 100) (812, 100) (828, 100) (829, 100) (850, 100) (865, 100) (868, 100) (875, 100) (876, 100) (878, 100) (916, 100) (922, 100) (932, 100) (1473, 100) (965, 101) (1064, 101) (956, 106) (1061, 107) (771, 108) (736, 111) (448, 120) (782, 120) (1455, 120) (1059, 121) (1441, 123) (714, 125) (867, 130) (924, 130) (1075, 130) (1141, 130) (885, 131) (444, 132) (921, 132) (974, 132) (719, 137) (1013, 138) (1151, 138) (784, 140) (1045, 145) (1066, 145) (1125, 146) (902, 147) (1006, 148) (969, 150) (955, 151) (1026, 155) (745, 159) (756, 159) (1085, 159) (1054, 161) (748, 163) (747, 167) (973, 178) (463, 180) (801, 185) (1164, 185) (788, 186) (1154, 187) (941, 189) (1131, 193) (753, 194) (1012, 194) (1155, 195) (1488, 195) (446, 200) (721, 200) (1124, 201) (1132, 203) (40, 208) (733, 209) (796, 209) (996, 214) (1005, 214) (895, 222) (1412, 226) (820, 235) (851, 240) (464, 250) (730, 250) (732, 250) (744, 250) (746, 250) (763, 250) (769, 250) (773, 250) (776, 250) (793, 250) (794, 250) (830, 250) (832, 250) (834, 250) (863, 250) (873, 250) (877, 250) (911, 250) (918, 250) (933, 250) (935, 250) (1136, 250) (778, 252) (1442, 253) (1449, 253) (1159, 259) (450, 264) (811, 264) (336, 267) (1152, 267) (53, 270) (1073, 274) (1156, 275) (880, 284) (1121, 294) (43, 306) (818, 310) (915, 315) (1157, 321) (1162, 322) (925, 323) (1140, 324) (1144, 329) (1011, 336) (1147, 337) (1133, 347) (337, 349) (59, 351) (1135, 355) (1143, 363) (1048, 369) (860, 380) (1129, 384) (1163, 386) (900, 400) (906, 400) (907, 400) (908, 400) (909, 400) (1025, 400) (1071, 403) (1123, 405) (1160, 410) (1126, 412) (1122, 413) (1127, 421) (764, 450) (1065, 458) (1149, 458) (1498, 462) (724, 468) (814, 468) (1148, 468) (1150, 470) (765, 475) (767, 475) (1153, 484) (742, 500) (749, 500) (750, 500) (766, 500) (779, 500) (792, 500) (805, 500) (824, 500) (838, 500) (855, 500) (869, 500) (870, 500) (879, 500) (884, 500) (886, 500) (888, 500) (896, 500) (920, 500) (926, 500) (936, 500) (937, 500) (943, 500) (987, 500) (1470, 500) (825, 506) (853, 506) (872, 506) (717, 508) (1063, 522) (954, 531) (1467, 540) (1165, 542) (1137, 546) (335, 554) (333, 556) (947, 559) (949, 559) (950, 559) (951, 559) (826, 576) (1004, 600) (334, 601) (1158, 604) (770, 625) (997, 625) (1145, 630) (1443, 661) (774, 662) (795, 662) (827, 662) (931, 662) (292, 690) (1451, 705) (1464, 748) (37, 768) (1014, 797) (970, 841) (994, 846) (841, 950) (50, 958) (1016, 990) (31, 1000) (715, 1000) (718, 1000) (723, 1000) (740, 1000) (743, 1000) (751, 1000) (797, 1000) (799, 1000) (806, 1000) (813, 1000) (837, 1000) (845, 1000) (849, 1000) (866, 1000) (903, 1000) (904, 1000) (910, 1000) (912, 1000) (913, 1000) (917, 1000) (741, 1024) (1444, 1043) (1453, 1077)
291
+
292
+ (1068, 1109) (934, 1156) (1049, 1458) (1454, 1458) (983, 1473) (1128, 1545) (1130, 1545) (1138, 1545) (1139, 1545) (1142, 1545) (1146, 1545) (1161, 1545) (1166, 1545) (1050, 1563) (991, 1728) (962, 2000) (971, 2000) (978, 2000) (995, 2000) (1020, 2000) (1022, 2000) (914, 2001) (1067, 2109) (772, 2178) (948, 2178) (958, 2310) (312, 2407) (1487, 2534) (737, 3107) (953, 3190) (3, 3196) (1038, 3468) (871, 3848) (728, 4052) (720, 4177) (1043, 4562) (44, 4601) (979, 5000) (1460, 5300) (1489, 5404) (1021, 5473) (1069, 5589) (980, 5620) (847, 6574) (1116, 6598) (803, 7129) (1496, 7400) (725, 8192) (735, 8192) (752, 8192) (761, 8192) (807, 8192)
293
+
294
+ # A.4 BASELINE EXPLORATION ALGORITHMS
295
+
296
+ Our experiments aim to determine how MELˆ EE´ compares to other standard exploration strategies. In particular, we compare to:
297
+
298
+ $\epsilon$ -greedy: With probability $\epsilon$ , explore uniformly at random; with probability $1 - \epsilon$ act greedily according to $f _ { t }$ (Sutton, 1996). Experimentally, we found $\epsilon = 0$ optimal on average, consistent with the results of Bietti et al. (2018).
299
+
300
+ $\epsilon$ -decreasing: selects a random action with probabilities $\epsilon _ { i }$ , where $\epsilon _ { i } = \epsilon _ { 0 } / t , \epsilon _ { 0 } \in ] 0 , 1 ]$ and $t$ is the index of the current round. In our experiments we set $\epsilon _ { 0 } = 0 . 1$ . (Sutton & Barto, 1998)
301
+
302
+ Exponentiated Gradient $\epsilon$ -greedy: maintains a set of candidate values for $\epsilon$ -greedy exploration. At each iteration, it runs a sampling procedure to select a new $\epsilon$ from a finite set of candidates. The probabilities associated with the candidates are initialized uniformly and updated with the Exponentiated Gradient (EG) algorithm. Following Li et al. (2010b), we use the candidate set $\{ \epsilon _ { i } = 0 . 0 5 { \times } i + 0 . 0 1 , i = 1 , \cdot \cdot \cdot , 1 0 \}$ for $\epsilon$ .
303
+
304
+ LinUCB: Maintains confidence bounds for reward payoffs and selects actions with the highest confidence bound. It is impractical to run “as is” due to high-dimensional matrix inversions. We use diagonal approximation to the covariance when the dimensions exceeds 150. (Li et al., 2010a) $\tau$ -first: Explore uniformly on the first $\tau$ fraction of the data; after that, act greedily.
305
+
306
+ Cover: Maintains a uniform distribution over a fixed number of policies. The policies are used to approximate a covering distribution over policies that are good for both exploration and exploitation (Agarwal et al., 2014).
307
+
308
+ Cover Non-Uniform: similar to Cover, but reduces the level of exploration of Cover to be more competitive with the Greedy method. Cover-Nu doesn’t add extra exploration beyond the actions chose by the covering policies (Bietti et al., 2018).
309
+
310
+ In all cases, we select the best hyperparameters for each exploration algorithm following Bietti et al. (2018). These hyperparameters are: the choice of $\epsilon$ in $\epsilon$ -greedy, $\tau$ in $\tau$ -first, the number of bags, and the tolerance $\psi$ for Cover and Cover-NU. We set $\epsilon = 0 . 0$ , $\tau = 0 . 0 2$ , bag size $= 1 6$ , and $\psi = 0 . 1$ .
md/train/BkglSTNFDB/BkglSTNFDB.md ADDED
@@ -0,0 +1,683 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Q-LEARNING WITH UCB EXPLORATION IS SAMPLE EFFICIENT FOR INFINITE-HORIZON MDP
2
+
3
+ Kefan Dong\*, Yuanhao Wang∗
4
+ Institute for Interdisciplinary Information Sciences, Tsinghua University
5
+ {dkf16,yuanhao-16}@mails.tsinghua.edu.
6
+ Xiaoyu Chen
7
+ Key Laboratory of Machine Perception, MOE, School of EECS,
8
+ Peking University
9
+ cxy30@pku.edu.cn
10
+ Liwei Wang
11
+ Key Laboratory of Machine Perception, MOE, School of EECS
12
+ Center for Data Science, Peking University
13
+ wanglw@cis.pku.edu.cn
14
+
15
+ # ABSTRACT
16
+
17
+ A fundamental question in reinforcement learning is whether model-free algorithms are sample efficient. Recently, Jin et al. (2018) proposed a Q-learning algorithm with UCB exploration policy, and proved it has nearly optimal regret bound for finite-horizon episodic MDP. In this paper, we adapt Q-learning with UCB-exploration bonus to infinite-horizon MDP with discounted rewards without accessing a generative model. We show that the sample complexity of exploration of our algorithm is bounded by $\begin{array} { r } { \tilde { O } \big ( \frac { S A } { \epsilon ^ { 2 } ( 1 - \gamma ) ^ { 7 } } \big ) } \end{array}$ . This improves the previously best known result of $\begin{array} { r } { \tilde { O } \big ( \frac { S A } { \epsilon ^ { 4 } ( 1 - \gamma ) ^ { 8 } } \big ) } \end{array}$ in this setting achieved by delayed Q-learning (Strehl et al., 2006), and matches the lower bound in terms of $\epsilon$ as well as and up to logarithmic factors.
18
+
19
+ # 1 INTRODUCTION
20
+
21
+ The goal of reinforcement learning (RL) is to construct efficient algorithms that learn and plan in sequential decision making tasks when the underlying system dynamics are unknown. A typical model in RL is Markov Decision Process (MDP). At each time step, the environment is in a state $s$ . The agent takes an action $a$ , obtain a reward $r$ , and then the environment transits to another state. In reinforcement learning, the transition probability distribution is unknown. The algorithm needs to learn the transition dynamics of MDP, while aiming to maximize the cumulative reward. This poses the exploration-exploitation dilemma: whether to act to gain new information (explore) or to act consistently with past experience to maximize reward (exploit).
22
+
23
+ Theoretical analyses of reinforcement learning fall into two broad categories: those assuming a simulator (a.k.a. generative model), and those without a simulator. In the first category, the algorithm is allowed to query the outcome of any state action pair from an oracle. The emphasis is on the number of calls needed to estimate the $Q$ value or to output a near-optimal policy. There has been extensive research in literature following this line of research, the majority of which focuses on discounted infinite horizon MDPs (Azar et al., 2011; Even-Dar & Mansour, 2003; Sidford et al., 2018b). The current results have achieved near-optimal time and sample complexities (Sidford et al., 2018b;a).
24
+
25
+ Without a simulator, there is a dichotomy between finite-horizon and infinite-horizon settings. In finite-horizon settings, there are straightforward definitions for both regret and sample complexity; the latter is defined as the number of samples needed before the policy becomes near optimal. In this setting, extensive research in the past decade (Jin et al., 2018; Azar et al., 2017; Jaksch et al., 2010; Dann et al., 2017) has achieved great progress, and established nearly-tight bounds for both regret and sample complexity.
26
+
27
+ The infinite-horizon setting is a very different matter. First of all, the performance measure cannot be a straightforward extension of the sample complexity defined above (See Strehl & Littman (2008) for detailed discussion). Instead, the measure of sample efficiency we adopt is the so-called sample complexity of exploration (Kakade et al., 2003), which is also a widely-accepted definition. This measure counts the number of times that the algorithm “makes mistakes” along the whole trajectory. See also (Strehl & Littman, 2008) for further discussions regarding this issue.
28
+
29
+ Several model based algorithms have been proposed for infinite horizon MDP, for example Rmax (Brafman & Tennenholtz, 2003), MoRmax (Szita & Szepesvári, 2010) and UCRL- $\gamma$ (Lattimore & Hutter, 2012). It is noteworthy that there still exists a considerable gap between the state-of-the-art algorithm and the theoretical lower bound (Lattimore & Hutter, 2012) regarding $1 / ( 1 - \gamma )$ factor.
30
+
31
+ Though model-based algorithms have been proved to be sample efficient in various MDP settings, most state-of-the-art RL algorithms are developed in the model-free paradigm (Schulman et al., 2015; Mnih et al., 2013; 2016). Model-free algorithms are more flexible and require less space, which have achieved remarkable performance on benchmarks such as Atari games and simulated robot control problems.
32
+
33
+ For infinite horizon MDPs without access to simulator, the best model-free algorithm has a sample complexity of exploration $\begin{array} { r } { \tilde { \mathcal { O } } \big ( \frac { S A } { \epsilon ^ { 4 } ( 1 - \gamma ) ^ { 8 } } \big ) } \end{array}$ , achieved by delayed Q-learning (Strehl et al., 2006). The authors provide a novel strategy of argument when proving the upper bound for the sample complexity of exploration, namely identifying a sufficient condition for optimality, and then bound the number of times that this condition is violated.
34
+
35
+ However, the results of Delayed Q-learning still leave a quadratic gap in $1 / \epsilon$ from the best-known lower bound. This is partly because the updates in Q-value are made in an over-conservative way. In fact, the loose sample complexity bound is a result of delayed Q-learning algorithm itself, as well as the mathematical artifact in their analysis. To illustrate this, we construct a hard instance showing that Delayed Q-learning incurs $\Omega ( 1 / \epsilon ^ { 3 } )$ sample complexity. This observation, as well as the success of the Q-learning with UCB algorithm (Jin et al., 2018) in proving a regret bound in finite-horizon settings, motivates us to incorporate a UCB-like exploration term into our algorithm.
36
+
37
+ In this work, we propose a Q-learning algorithm with UCB exploration policy. We show the sample complexity of exploration bound of our algorithm is $\begin{array} { r } { \tilde { \mathcal { O } } \big ( \frac { S A } { \epsilon ^ { 2 } ( 1 - \gamma ) ^ { 7 } } \big ) } \end{array}$ . This strictly improves the previous best known result due to Delayed Q-learning. It also matches the lower bound in the dependence on $\epsilon$ , $S$ and $A$ up to logarithmic factors.
38
+
39
+ We point out here that the infinite-horizon setting cannot be solved by reducing to finite-horizon setting. There are key technical differences between these two settings: the definition of sample complexity of exploration, time-invariant policies and the error propagation structure in Q-learning. In particular, the analysis techniques developed in (Jin et al., 2018) do not directly apply here. We refer the readers to Section 3.2 for detailed explanations and a concrete example.
40
+
41
+ The rest of the paper is organized as follows. After introducing the notation used in the paper in Section 2, we describe our infinite Q-learning with UCB algorithm in Section 3. We then state our main theoretical results, which are in the form of PAC sample complexity bounds. In Section 4 we present some interesting properties beyond sample complexity bound. Finally, we conclude the paper in Section 5.
42
+
43
+ # 2 PRELIMINARY
44
+
45
+ We consider a Markov Decision Process defined by a five tuple $\langle S , \mathcal { A } , p , r , \gamma \rangle$ , where $s$ is the state space, $\mathcal { A }$ is the action space, $p ( s ^ { \prime } | s , a )$ is the transition function, $r : S \times \mathcal { A } [ 0 , 1 ]$ is the deterministic reward function, and $0 \leq \gamma < 1$ is the discount factor for rewards. Let $S = | S |$ and $A = | { \mathcal { A } } |$ denote the number of states and the number of actions respectively.
46
+
47
+ Starting from a state $s _ { 1 }$ , the agent interacts with the environment for infinite number of time steps. At each time step, the agent observes state $s _ { t } \in S$ , picks action $a _ { t } \in \mathcal A$ , and receives reward $r _ { t }$ ; the system then transits to next state $s _ { t + 1 }$ .
48
+
49
+ Using the notations in Strehl et al. (2006), a policy $\pi _ { t }$ refers to the non-stationary control policy of the algorithm since step $t$ . We use $V ^ { \pi _ { t } } ( s )$ to denote the value function under policy $\pi _ { t }$ , which is defined as $\begin{array} { r } { V ^ { \pi _ { t } } ( s ) = \mathbb { E } \bigl [ \sum _ { i = 1 } ^ { \infty } \gamma ^ { i - 1 } r ( s _ { i } , \pi _ { t + i - 1 } ( s _ { i } ) ) | s _ { 1 } = s \bigr ] } \end{array}$ . We also use $V ^ { * } ( s ) = \operatorname* { s u p } _ { \pi } V ^ { \pi } ( s )$ to denote the value function of the optimal policy. Accordingly, we define $\begin{array} { r } { \mathbb { E } [ \sum _ { i = 2 } ^ { \infty } \gamma ^ { i - 1 } r ( s _ { i } , \pi _ { t + i - 1 } ( s _ { i } ) ) | s _ { 1 } = \stackrel { \cdot } { s } , a _ { 1 } = \stackrel { \cdot } { a } ] } \end{array}$ as the $\mathrm { Q }$ function under policy $Q ^ { \pi _ { t } } ( s , a ) = r ( s , a ) +$ $\pi _ { t }$ ; $Q ^ { * } ( s , a )$ is the Q function under optimal policy $\pi ^ { * }$ .
50
+
51
+ We use the sample complexity of exploration defined in Kakade et al. (2003) to measure the learning efficiency of our algorithm. This sample complexity definition has been widely used in previous works Strehl et al. (2006); Lattimore & Hutter (2012); Strehl $\&$ Littman (2008).
52
+
53
+ Definition 1. Sample complexity of Exploration of an algorithm $\mathcal { A L G }$ is defined as the number of time steps t such that the non-stationary policy $\pi _ { t }$ at time $t$ is not $\epsilon$ -optimal for current state $s _ { t }$ , i.e. $\dot { V } ^ { \pi _ { t } } \left( s _ { t } \right) \dot { < } V ^ { * } \left( s _ { t } \right) - \epsilon .$ .
54
+
55
+ Roughly speaking, this measure counts the number of mistakes along the whole trajectory. We use the following definition of PAC-MDP Strehl et al. (2006).
56
+
57
+ Definition 2. An algorithm $\mathcal { A L G }$ is said to be PAC-MDP (Probably Approximately Correct in Markov Decision Processes) $i f ,$ for any  and $\delta$ , the sample complexity of $\mathcal { A L G }$ is less than some polynomial in the relevant quantities $( S , A , 1 / \epsilon , 1 / \delta , 1 / ( 1 - \gamma ) )$ , with probability at least $1 - \delta$ .
58
+
59
+ Finally, recall that Bellman equation is defined as the following:
60
+
61
+ $$
62
+ \left\{ \begin{array} { l l } { V ^ { \pi _ { t } } ( s ) = Q ^ { \pi _ { t } } \left( s , \pi _ { t } ( s ) \right) } \\ { Q ^ { \pi _ { t } } ( s , a ) : = \left( r _ { t } + \gamma \mathbb { P } V ^ { \pi _ { t + 1 } } \right) ( s , a ) , } \end{array} \right. \quad \left\{ \begin{array} { l l } { V ^ { * } ( s ) = Q ^ { * } \left( s , \pi ^ { * } ( s ) \right) } \\ { Q ^ { * } ( s , a ) : = \left( r _ { t } + \gamma \mathbb { P } V ^ { * } \right) ( s , a ) , } \end{array} \right.
63
+ $$
64
+
65
+ which is frequently used in our analysis. Here we denote $\left[ \mathbb { P } V ^ { \pi _ { t } } \right] ( s , a ) : = \mathbb { E } _ { s ^ { \prime } \sim p ( \cdot \vert s , a ) } V ^ { \pi _ { t + 1 } } ( s ^ { \prime } ) .$
66
+
67
+ # 3 MAIN RESULTS
68
+
69
+ In this section, we present the UCB Q-learning algorithm and the sample complexity bound.
70
+
71
+ # 3.1 ALGORITHM
72
+
73
+ # Algorithm 1 Infinite Q-learning with UCB
74
+
75
+ Parameters: , γ, δ Initializ $\begin{array} { r l } & { \textnormal { \texttt { e } } Q ( s , a ) , \hat { Q } ( s , a ) \gets \frac { 1 } { 1 - \gamma } , N ( s , a ) \gets 0 , \epsilon _ { 1 } \gets \frac { \epsilon } { 2 4 R M \ln \frac { 1 } { 1 - \gamma } } , H \gets \frac { \ln 1 / ( ( 1 - \gamma ) \epsilon _ { 1 } ) } { \ln 1 / \gamma } . } \\ & { \cdot ( k ) = \ln ( S A ( k + 1 ) ( k + 2 ) / \delta ) , \alpha _ { k } = \frac { H + 1 } { H + k } . } \end{array}$ Define for $t = 1 , 2 , \dots \mathbf { d o }$
76
+ 5: Take action $a _ { t } \gets \arg \operatorname* { m a x } _ { a ^ { \prime } } \hat { Q } ( s _ { t } , a ^ { \prime } )$ Receive reward rt and transit to st+1 $\begin{array} { r l r } & { N ( s _ { t } , a _ { t } ) \gets N ( s _ { t } , a _ { t } ) + 1 } & \\ & { N ( s _ { t } , a _ { t } ) \gets N ( s _ { t } , a _ { t } ) + 1 } & \\ & { k \gets N ( s _ { t } , a _ { t } ) , b _ { k } \gets \frac { c _ { 2 } } { 1 - \gamma } \sqrt { \frac { H ( k ) } { k } } } & \\ & { \hat { V } ( s _ { t + 1 } ) \gets \operatorname* { m a x } _ { a \in A } \hat { Q } ( s _ { t + 1 } , a ) } & \\ & { Q ( s _ { t } , a _ { t } ) \gets ( 1 - \alpha _ { k } ) Q ( s _ { t } , a _ { t } ) + \alpha _ { k } \left[ r ( s _ { t } , a _ { t } ) + b _ { k } + \gamma \hat { V } ( s _ { t + 1 } ) \right] } \\ & { \hat { Q } ( s _ { t } , a _ { t } ) \gets \operatorname* { m i n } ( \hat { Q } ( s _ { t } , a _ { t } ) , Q ( s _ { t } , a _ { t } ) ) } & \end{array}$ t and can be set to $4 { \sqrt { 2 } }$
77
+ 10: end for
78
+
79
+ Here $c _ { 2 } = 4 \sqrt { 2 }$ is a constant. $\begin{array} { r } { R = \lceil \ln \frac { 3 } { \epsilon ( 1 - \gamma ) } / ( 1 - \gamma ) \rceil } \end{array}$ , while the choice of $M$ can be found in Section. 3.3. ${ \cal { \left( M = 0 \left( \ln 1 / ( 1 - \gamma ) \epsilon \right) \right) } }$ ). The learning rate is defined as $\alpha _ { k } = ( H + 1 ) / ( H + k )$ . $H$ is chosen as $\frac { \ln { 1 } / ( ( 1 - \gamma ) \epsilon _ { 1 } ) } { \ln { 1 } / \gamma }$ , which satisfies $H \leq \frac { \ln 1 / ( ( 1 - \gamma ) \epsilon _ { 1 } ) } { 1 - \gamma }$ .
80
+
81
+ Our UCB Q-learning algorithm (Algorithm 1) maintains an optimistic estimation of action value function $Q ( s , a )$ and its historical minimum value $\hat { Q } ( s , a )$ . $N _ { t } ( s , a )$ denotes the number of times that $( s , a )$ is experienced before time step $t$ ; $\tau ( s , a , k )$ denotes the time step $t$ at which $( s _ { t } , a _ { t } ) = ( s , a )$ for the $k$ -th time; if this state-action pair is not visited that many times, $\tau ( s , a , k ) = \infty$ . $Q _ { t } ( s , a )$ and $\hat { Q } _ { t } ( s , a )$ denotes the $Q$ and $\hat { Q }$ value of $( s , a )$ that the algorithm maintains when arriving at $s _ { t }$ respectively.
82
+
83
+ # 3.2 SAMPLE COMPLEXITY OF EXPLORATION
84
+
85
+ Our main result is the following sample complexity of exploration bound.
86
+
87
+ Theorem 1. For any $\epsilon > 0$ , $\delta > 0 , 1 / 2 < \gamma < 1$ , with probability $1 - \delta$ , the sample complexity of exploration (i.e., the number of time steps t such that $\pi _ { t }$ is not $\epsilon$ -optimal at $s _ { t . }$ ) of Algorithm 1 is at most
88
+
89
+ $$
90
+ \tilde { \mathcal { O } } \left( \frac { S A \ln { 1 / \delta } } { \epsilon ^ { 2 } \left( 1 - \gamma \right) ^ { 7 } } \right) ,
91
+ $$
92
+
93
+ where $\tilde { \mathcal { O } }$ suppresses logarithmic factors of $1 / \epsilon , 1 / ( 1 - \gamma )$ and $S A$ .
94
+
95
+ We first point out the obstacles for proving the theorem and reasons why the techniques in Jin et al.
96
+ (2018) do not directly apply here. We then give a high level description of the ideas of our approach.
97
+
98
+ One important issue is caused by the difference in the definition of sample complexity for finite and infinite horizon MDP. In finite horizon settings, sample complexity (and regret) is determined in the first $T$ timesteps, and only measures the performance at the initial state $s _ { 1 }$ (i.e. $( V ^ { * } - V ^ { \pi } ) ( s _ { 1 } ) )$ . However, in the infinite horizon setting, the agent may enter under-explored regions at any time period, and sample complexity of exploration characterizes the performance at all states the agent enters.
99
+
100
+ The following example clearly illustrates the key difference between infinite-horizon and finitehorizon. Consider an MDP with a starting state $s _ { 1 }$ where the probability of leaving $s _ { 1 }$ is $o ( T ^ { - 1 } )$ . In this case, with high probability, it would take more than $T$ timesteps to leave $s _ { 1 }$ . Hence, guarantees about the learning in the first $T$ timesteps or about the performance at $s _ { 1 }$ imply almost nothing about the number of mistakes the algorithm would make in the rest of the MDP (i.e. the sample complexity of exploration of the algorithm). As a result, the analysis for finite horizon MDPs cannot be directly applied to infinite horizon setting.
101
+
102
+ This calls for techniques for counting mistakes along the entire trajectory, such as those employed by Strehl et al. (2006). In particular, we need to establish convenient sufficient conditions for being $\epsilon$ -optimal at timestep $t$ and state $s _ { t }$ , i.e. $V ^ { \ast } ( s _ { t } ) - V ^ { \pi _ { t } } ( s _ { t } ) \leq \epsilon$ . Then, bounding the number of violations of such conditions gives a bound on sample complexity.
103
+
104
+ Another technical reason why the proof in Jin et al. (2018) cannot be directly applied to our problem is the following: In finite horizon settings, Jin et al. (2018) decomposed the learning error at episode $k$ and time $h$ as errors from a set of consecutive episodes before $k$ at time $h + 1$ using a clever design of learning rate. However, in the infinite horizon setting, this property does not hold. Suppose at time $t$ the agent is at state $s _ { t }$ and takes action $a _ { t }$ . Then the learning error at $t$ only depends on those previous time steps such that the agent encountered the same state as $s _ { t }$ and took the same action as $a _ { t }$ . Thus the learning error at time $t$ cannot be decomposed as errors from a set of consecutive time steps before $t$ , but errors from a set of non-consecutive time steps without any structure. Therefore, we have to control the sum of learning errors over an unstructured set of time steps. This makes the analysis more challenging.
105
+
106
+ Now we give a brief road map of the proof of Theorem 1. Our first goal is to establish a sufficient condition so that $\pi _ { t }$ learned at step $t$ is $\epsilon$ -optimal for state $s _ { t }$ . As an intermediate step we show that a sufficient condition for $V ^ { * } ( s _ { t } ) - V ^ { \pi _ { t } } ( s _ { t } ) \leq \epsilon$ is that $V ^ { \ast } ( s _ { t ^ { \prime } } ) - Q ^ { \ast } ( s _ { t ^ { \prime } } , a _ { t ^ { \prime } } )$ is small for a few time steps $t ^ { \prime }$ within an interval $[ t , t + R ]$ for a carefully chosen $R$ (Condition 1). Then we show the desired sufficient condition (Condition 2) implies Condition 1. We then bound the total number of bad time steps on which $V ^ { * } ( s _ { t } ) - Q ^ { * } ( s _ { t } , a _ { t } )$ is large for the whole MDP; this implies a bound on the number of violations of Condition 2. This in turn relies on a key technical lemma (Lemma 2).
107
+
108
+ The remaining part of this section is organized as follows. We establish the sufficient condition for $\epsilon$ -optimality in Section 3.3. The key lemma is presented in Section 3.4. Finally we prove Theorem 1 in Section 3.5.
109
+
110
+ # 3.3 SUFFICIENT CONDITION FOR $\epsilon$ -OPTIMALITY
111
+
112
+ In this section, we establish a sufficient condition (Condition 2) for $\epsilon$ -optimality at time step $t$ .
113
+
114
+ For a fixed $s _ { t }$ , let TRAJ $( R )$ be the set of length- $R$ trajectories starting from $s _ { t }$ . Our goal is to give a sufficient condition so that $\pi _ { t }$ , the policy learned at step $t$ , is $\epsilon$ -optimal. For any $\epsilon _ { 2 } > 0$ , define $\begin{array} { r } { R : = \lceil \ln \frac { 1 } { \epsilon _ { 2 } ( 1 - \gamma ) } / ( 1 - \gamma ) \rceil } \end{array}$ . Denote $V ^ { * } ( s _ { t } ) - Q ^ { * } ( s _ { t } , a _ { t } )$ by $\Delta _ { t }$ . We have
115
+
116
+ $$
117
+ \begin{array} { r l } & { \quad V ^ { * } ( s _ { t } ) - V ^ { \pi } ( s _ { t } ) } \\ & { = V ^ { * } ( s _ { t } ) - Q ^ { * } ( s _ { t } , a _ { t } ) + Q ^ { * } ( s _ { t } , a _ { t } ) - V ^ { \pi } ( s _ { t } ) } \\ & { = V ^ { * } ( s _ { t } ) - Q ^ { * } ( s _ { t } , a _ { t } ) + \gamma \mathbb { P } ( V ^ { * } - V ^ { \pi } ) ( s _ { t } , \pi _ { t } ( s _ { t } ) ) } \\ & { = V ^ { * } ( s _ { t } ) - Q ^ { * } ( s _ { t } , a _ { t } ) + \gamma \sum _ { s + 1 } ^ { \infty } p ( s _ { t + 1 } | s _ { t } , \pi _ { t } ( s _ { t } ) ) \cdot [ V ^ { * } ( s _ { t + 1 } ) - Q ^ { * } ( s _ { t + 1 } , a _ { t + 1 } ) ] + } \\ & { \quad \Big . \Big . \Big . \Big . \Big . \Big . } \\ & { \quad \quad \Big . \gamma _ { s + 1 , s ^ { * } + 2 } \mathrm { ~ } p ( s _ { t + 2 } | s _ { t + 1 } , \pi _ { t + 1 } ( s _ { t + 1 } ) ) \cdot p ( s _ { t + 1 } | s _ { t } , \pi _ { t } ( s _ { t } ) ) \big [ V ^ { * } ( s _ { t + 2 } ) - Q ^ { * } ( s _ { t + 2 } , a _ { t + 2 } ) \Big ] } \\ & { \quad \quad \cdot \dots } \\ & { \le \epsilon _ { 2 } + \displaystyle \sum _ { s ^ { \prime } = s ^ { \prime } } p ( t r a _ { t } ) \cdot [ \frac { n - 1 } { \lambda _ { 2 } } \gamma ^ { 2 } \Delta _ { t + 2 } ] , } \\ & { \quad \quad \pi _ { s \lambda ^ { ( 2 ) } ( L ) } ^ { R , a } } \end{array}
118
+ $$
119
+
120
+ where the last inequality holds because $\frac { \gamma ^ { R } } { 1 - \gamma } \leq \epsilon _ { 2 }$ , which follows from the definition of $R$
121
+
122
+ For any fixed trajectory of length $R$ starting from $s _ { t }$ , consider the sequence $\left( \Delta _ { t ^ { \prime } } \right) _ { t \leq t ^ { \prime } < t + R }$ . Let $X _ { t } ^ { ( i ) }$ be the $i$ -th largest item of $\left( \Delta _ { t ^ { \prime } } \right) _ { t \leq t ^ { \prime } < t + R }$ . Rearranging Eq. (1), we obtain
123
+
124
+ $$
125
+ V ^ { \ast } ( s _ { t } ) - V ^ { \pi _ { t } } ( s _ { t } ) \leq \epsilon _ { 2 } + E _ { t r a j } \left[ \sum _ { i = 1 } ^ { R } \gamma ^ { i - 1 } X _ { t } ^ { ( i ) } \right] .
126
+ $$
127
+
128
+ We first prove that Condition 1 implies $\epsilon$ -optimality at time step $t$ when $\epsilon _ { 2 } = \epsilon / 3$
129
+
130
+ Condition 1. Let $\begin{array} { r } { \xi _ { i } : = \frac { 1 } { 2 ^ { i + 2 } } \epsilon _ { 2 } \left( \ln \frac { 1 } { 1 - \gamma } \right) ^ { - 1 } } \end{array}$ . For all $0 \leq i \leq \lfloor \log _ { 2 } R \rfloor$
131
+
132
+ $$
133
+ E [ X _ { t } ^ { ( 2 ^ { i } ) } ] \leq \xi _ { i } .
134
+ $$
135
+
136
+ Claim 1. If Condition $^ { l }$ is satisfied at time step $t$ , the policy $\pi _ { t }$ is $\epsilon$ -optimal at state $s _ { t }$ , i.e. $V ^ { \ast } ( s _ { t } ) -$
137
+ $V ^ { \pi _ { t } } ( s _ { t } ) \leq \epsilon$ .
138
+
139
+ Proof. Note that $E [ X _ { t } ^ { ( 2 ^ { \lfloor \log _ { 2 } i \rfloor } ) } ]$ t. Eq. (3) implies that for $X _ { t } ^ { ( i ) }$ is monotonically decreasing with respect to $1 / 2 < \gamma < 1$ , $i$ . Therefore, $E [ X _ { t } ^ { ( i ) } ] \ \leq$
140
+
141
+ $$
142
+ \begin{array} { r l } & { E \left[ \displaystyle \sum _ { i = 1 } ^ { R } \gamma ^ { i - 1 } X _ { t } ^ { ( i ) } \right] = \displaystyle \sum _ { i = 1 } ^ { R } \gamma ^ { i - 1 } E [ X _ { t } ^ { ( i ) } ] \leq \displaystyle \sum _ { i = 1 } ^ { R } \gamma ^ { i - 1 } E [ X _ { t } ^ { ( 2 ^ { \lfloor \log _ { 2 } i \rfloor } ) } ] } \\ & { \leq \displaystyle \sum _ { i = 1 } ^ { R } \gamma ^ { i - 1 } 2 ^ { - \lfloor \log _ { 2 } i \rfloor - 2 } \epsilon _ { 2 } \left( \ln \frac { 1 } { 1 - \gamma } \right) ^ { - 1 } \leq \displaystyle \sum _ { i = 1 } ^ { R } \frac { \gamma ^ { i - 1 } } { i } \epsilon _ { 2 } \left( \ln \frac { 1 } { 1 - \gamma } \right) ^ { - 1 } \leq 2 \epsilon _ { 2 } , } \end{array}
143
+ $$
144
+
145
+ where the last inequality follows from the fact that $\begin{array} { r } { \sum _ { i = 1 } ^ { \infty } \frac { \gamma ^ { i - 1 } } { i } = \frac { 1 } { \gamma } \ln \frac { 1 } { 1 - \gamma } } \end{array}$ and $\gamma > 1 / 2$
146
+
147
+ Combining with Eq. 2, we have, $\begin{array} { r } { V ^ { \ast } ( s _ { t } ) - V ^ { \pi _ { t } } ( s _ { t } ) \leq \epsilon _ { 2 } + E \left[ \sum _ { i = 1 } ^ { R } \gamma ^ { i - 1 } X _ { t } ^ { ( i ) } \right] \leq 3 \epsilon _ { 2 } = \epsilon . } \end{array}$
148
+
149
+ Next we show that given $i , t$ , Condition 2 implies Eq. (3).
150
+
151
+ Condition 2. Define $L = \lfloor \log _ { 2 } R \rfloor$ . Let $\begin{array} { r } { M = \operatorname* { m a x } \left\{ \lceil 2 \log _ { 2 } \frac { 1 } { \xi _ { L } ( 1 - \gamma ) } \rceil , 1 0 \right\} } \end{array}$ , and $\begin{array} { r } { \eta _ { j } = \frac { \xi _ { i } } { M } \cdot 2 ^ { j - 1 } } \end{array}$ .
152
+ For all $\begin{array} { r } { \because j \le M , \eta _ { j } \operatorname* { P r } [ X _ { t } ^ { ( 2 ^ { i } ) } > \eta _ { j - 1 } ] \le \frac { \xi _ { i } } { M } , } \end{array}$ .
153
+
154
+ Claim 2. Given i, t, Eq. (3) holds if Condition 2 is satisfied.
155
+
156
+ Proof. The reason behind the choice of $M$ is to ensure that $\eta _ { M } > 1 / ( 1 - \gamma )$ 1. It follows that, assuming Condition 2 holds, for $1 \leq j \leq M$ ,
157
+
158
+ $$
159
+ E \left[ { X _ { t } ^ { ( 2 ^ { i } ) } } \right] = \int _ { 0 } ^ { 1 / ( 1 - \gamma ) } \operatorname* { P r } \left[ { X _ { t } ^ { ( 2 ^ { i } ) } } > x \right] d x \le \eta _ { 1 } + \sum _ { j = 2 } ^ { M } \eta _ { j } \operatorname* { P r } [ { X _ { t } ^ { ( 2 ^ { i } ) } } > \eta _ { j - 1 } ] \le \xi _ { i } .
160
+ $$
161
+
162
+ Therefore, if a time step $t$ is not $\epsilon _ { 2 }$ -optimal, there exists $0 \leq i < \lfloor \log _ { 2 } R \rfloor$ and $2 \leq j \leq M$ such that
163
+
164
+ $$
165
+ \eta _ { j } \mathrm { P r } [ X _ { t } ^ { ( 2 ^ { i } ) } > \eta _ { j - 1 } ] > \frac { \xi _ { i } } { M } .
166
+ $$
167
+
168
+ Now, the sample complexity can be bounded by the number of $( t , i , j )$ pairs that Eq. (4) is violated. Following the approach of Strehl et al. (2006), for a fixed $( i , j )$ -pair, instead of directly counting the number of time steps $t$ such that $\begin{array} { r } { \operatorname* { P r } [ X _ { t } ^ { ( 2 ^ { i } ) } > \eta _ { j - 1 } ] > \frac { \xi _ { i } } { M \eta _ { j } } } \end{array}$ , we count the number of time steps that $X _ { t } ^ { ( 2 ^ { i } ) } > \eta _ { j - 1 }$ . Lemma 1 provides an upper bound of the number of such $t$ .
169
+
170
+ # 3.4 KEY LEMMAS
171
+
172
+ In this section, we present two key lemmas. Lemma 1 bounds the number of sub-optimal actions, which in turn, bounds the sample complexity of our algorithm. Lemma 2 bounds the weighted sum of learning error, i.e. $( \hat { Q } _ { t } - Q ^ { * } ) ( s , a )$ , with the sum and maximum of weights. Then, we show that Lemma 1 follows from Lemma 2.
173
+
174
+ Lemma 1. For fixed $t$ and $\eta > 0$ , let ${ B } _ { \eta } ^ { ( t ) }$ be the event that $\begin{array} { r } { V ^ { * } ( s _ { t } ) - Q ^ { * } ( s _ { t } , a _ { t } ) > \frac { \eta } { 1 - \gamma } } \end{array}$ in step t. If $\eta > 2 \epsilon _ { 1 }$ , then with probability at least $1 - \delta / 2$ ,
175
+
176
+ $$
177
+ \sum _ { t = 1 } ^ { t = \infty } I \left[ B _ { \eta } ^ { ( t ) } \right] \leq \frac { S A \ln S A \ln 1 / \delta } { \eta ^ { 2 } ( 1 - \gamma ) ^ { 3 } } \cdot p o l y l o g \left( \frac { 1 } { \epsilon _ { 1 } } , \frac { 1 } { 1 - \gamma } \right) ,
178
+ $$
179
+
180
+ where $I [ \cdot ]$ is the indicator function.
181
+
182
+ Before presenting Lemma 2, we define a class of sequence that occurs in the proof.
183
+
184
+ Definition 3. A sequence $( w _ { t } ) _ { t \geq 1 }$ is said to be a $( C , w )$ -sequence for $C , w > 0$ , $i f 0 \le w _ { t } \le w$ for all $t \geq 1$ , and $\begin{array} { r } { \sum _ { t \geq 1 } w _ { t } \leq C } \end{array}$ .
185
+
186
+ Lemma 2. For every $( C , w )$ -sequence $( w _ { t } ) _ { t \geq 1 }$ , with probability $1 - \delta / 2$ , the following holds:
187
+
188
+ $$
189
+ \sum _ { t \ge 1 } w _ { t } ( \hat { Q } _ { t } - Q ^ { * } ) ( s _ { t } , a _ { t } ) \le \frac { C \epsilon _ { 1 } } { 1 - \gamma } + \mathcal { O } \left( \frac { \sqrt { w S A C \ell ( C ) } } { ( 1 - \gamma ) ^ { 2 . 5 } } + \frac { w S A \ln C } { ( 1 - \gamma ) ^ { 3 } } \ln \frac { 1 } { ( 1 - \gamma ) \epsilon _ { 1 } } \right) .
190
+ $$
191
+
192
+ $\begin{array} { r } { \ell ( C ) = \iota ( C ) \ln { \frac { 1 } { ( 1 - \gamma ) \epsilon _ { 1 } } } } \end{array}$
193
+
194
+ Proof of Lemma 2 is quite technical, and is therefore deferred to supplementary materials.
195
+
196
+ Now, we briefly explain how to prove Lemma 1 with Lemma 2. (Full proof can be found in supplementary materials.) Note that since $\hat { Q } _ { t } \geq Q ^ { * }$ and $a _ { t } = \arg \operatorname* { m a x } _ { a } \hat { Q } _ { t } ( s _ { t } , a )$ ,
197
+
198
+ $$
199
+ V ^ { * } ( s _ { t } ) - Q ^ { * } ( s _ { t } , a _ { t } ) \leq \hat { Q } _ { t } ( s _ { t } , a _ { t } ) - Q ^ { * } ( s _ { t } , a _ { t } ) .
200
+ $$
201
+
202
+ We now consider a set $J = \{ t : \ V ^ { * } ( s _ { t } ) - Q ^ { * } ( s _ { t } , a _ { t } ) > \eta ( 1 - \gamma ) ^ { - 1 } \}$ , and consider the $( | J | , 1 )$ - weight sequence defined by $w _ { t } ~ = ~ I \left[ t \in J \right]$ . We can now apply Lemma 2 to weighted sum $\begin{array} { r } { \sum _ { t \geq 1 } \dot { w } _ { t } \left[ \bar { V } ^ { \ast } ( s _ { t } ) - Q ^ { \ast } ( s _ { t } , \dot { a } _ { t } ) \right] , } \end{array}$ . On the one hand, this quantity is obviously at least $| J | \bar { \eta ( 1 - \gamma ) } ^ { - 1 }$ . On the other hand, by lemma 2, it is upper bounded by the weighted sum of $( \hat { Q } - Q ^ { * } ) ( s _ { t } , a _ { t } )$ . Thus we get
203
+
204
+ $$
205
+ | J | \eta ( 1 - \gamma ) ^ { - 1 } \leq \frac { C \epsilon _ { 1 } } { 1 - \gamma } + \mathcal { O } \left( \frac { \sqrt { S A | J | \ell ( | J | ) } } { ( 1 - \gamma ) ^ { 2 . 5 } } + \frac { w S A \ln | J | } { ( 1 - \gamma ) ^ { 3 } } \ln \frac { 1 } { ( 1 - \gamma ) \epsilon _ { 1 } } \right) .
206
+ $$
207
+
208
+ Now focus on the dependence on $| J |$ . The left-hand-side has linear dependence on $| J |$ , whereas the left-hand-side has a $\tilde { \mathcal { O } } \left( \sqrt { | J | } \right)$ dependence. This allows us to solve out an upper bound on $| J |$ with quadratic dependence on $1 / \eta$ .
209
+
210
+ # 3.5 PROOF FOR THEOREM 1
211
+
212
+ We prove the theorem by stitching Lemma 1 and Condition 2.
213
+
214
+ Proof. (Proof for Theorem 1)
215
+
216
+ By lemma 1, for any $2 \leq j \leq M , \sum _ { t = 1 } ^ { \infty } I \left[ V ^ { * } ( s _ { t } ) - Q ^ { * } ( s _ { t } , a _ { t } ) > \eta _ { j - 1 } \right] \leq C$ , where $C = \frac { S A \ln S A \ln 1 / \delta } { \eta _ { j - 1 } ^ { 2 } ( 1 - \gamma ) ^ { 5 } } \cdot \tilde { P } .$
217
+
218
+ Here $\tilde { P }$ is a shorthand for polylog $\begin{array} { r } { \left( \frac { 1 } { \epsilon _ { 1 } } , \frac { 1 } { 1 - \gamma } \right) } \end{array}$
219
+
220
+ Let $A _ { t } = I [ X _ { t } ^ { ( 2 ^ { i } ) } \geq \eta _ { j - 1 } ]$ be a Bernoulli random variable, and $\{ \mathcal { F } _ { t } \} _ { t \ge 1 }$ be the filtration generated by random variables $\bar { \{ ( s _ { \tau } , a _ { \tau } ) : 1 \leq \tau \leq t \} }$ . Since $A _ { t }$ is $\mathcal { F } _ { t + R }$ −measurable, for any $0 \leq k < R$ , $\{ \dot { A } _ { k + t R } - E [ A _ { k + t R } \ | \ \mathcal { F } _ { k + t R } ] \} _ { t \geq 0 }$ is a martingale difference sequence. For now, consider a fixed $0 \leq k < R$ . By Azuma-Hoeffiding inequality, after $\begin{array} { r } { T = \mathcal { O } \left( \frac { C } { 2 ^ { i } } \cdot \frac { M \eta _ { j } } { \xi _ { i } } \ln ( R M L ) \right) } \end{array}$ · M ηjξ ln(RM L) time steps (if it happens that many times) with
221
+
222
+ $$
223
+ \operatorname* { P r } \left[ X _ { k + t R } ^ { ( 2 ^ { i } ) } \geq \eta _ { j - 1 } \right] = \mathbb { E } [ A _ { k + t R } ] > \frac { \xi _ { i } } { M \eta _ { j } } ,
224
+ $$
225
+
226
+ we have $\textstyle \sum _ { t } A _ { k + t R } \geq C / 2 ^ { i }$ with probability at least $1 - \delta / ( 2 M R L )$ .
227
+
228
+ On the other hand, if $A _ { k + t R }$ happens, within $[ k + t R , k + t R + R - 1 ]$ , there must be at least $2 ^ { i }$ time steps at which $V ^ { * } ( s _ { t } ) - Q ^ { * } ( s _ { t } , a _ { t } ) > ^ { \mathsf { ^ { * } } } \eta _ { j - 1 }$ . The latter event happens at most $C$ times, and the $[ k + t R , k + t R + R - 1 ]$ are disjoint. Tppens at most erefore, times f $\textstyle \sum _ { t = 0 } ^ { \infty } A _ { k + t R } \leq C / 2 ^ { i }$ . This suggests that a union bound on $T$ $i$ $j$ $0 \leq k < R$ , we can show that with probability $1 - \delta / ( 2 M L )$ , there are at most $R T$ time steps where $\mathrm { P r } \left[ X _ { t } ^ { ( 2 ^ { i } ) } \geq \eta _ { j - 1 } \right] > \xi _ { i } / ( M \eta _ { j } )$ . Thus, the number of sub-optimal steps is bounded by,
229
+
230
+ $$
231
+ \begin{array} { r l r } { { \sum _ { t = 1 } ^ { \ell - 1 } I [ V ^ { * } ( s _ { t } ) - V ^ { \pi _ { t } } ( s _ { t } ) > \epsilon ] } } \\ & { \leq \sum _ { t = 1 } ^ { \infty } \sum _ { i = 0 } ^ { L } \sum _ { j = 2 } ^ { M } I [ \eta _ { j } \operatorname* { P r } [ X _ { t } ^ { ( 2 ^ { i } ) } > \eta _ { j - 1 } ] > \frac { \xi _ { i } } { M } ] = \sum _ { i = 0 } ^ { L } \sum _ { j = 2 } ^ { M } \sum _ { t = 1 } ^ { \infty } I [ \operatorname* { P r } [ X _ { t } ^ { ( 2 ^ { i } ) } > \eta _ { j - 1 } ] > \frac { \xi _ { i } } { \eta _ { j } M } ] } \\ & { \leq \sum _ { i = 0 } ^ { L } \sum _ { j = 2 } ^ { M } \frac { S A M R \ln 1 / \delta \ln S A } { \eta _ { j } \xi _ { i } \cdot 2 ^ { i } ( 1 - \gamma ) ^ { 5 } } \tilde { P } \leq \sum _ { i = 0 } ^ { L } \frac { S A \cdot 2 ^ { i + 4 } \ln S A \ln 1 / \delta } { \epsilon _ { 2 } ^ { 2 } ( 1 - \gamma ) ^ { 6 } } \tilde { P } \mathrm { ( B y ~ d e f i n i t i o n ~ o f } \xi _ { i } \mathrm { ~ a n d } \eta _ { j } ) } \\ & { \leq \frac { S A R \ln S A \ln 1 / \delta } { \epsilon _ { 2 } ^ { 2 } ( 1 - \gamma ) ^ { 6 } } \tilde { P } \leq \frac { S A \ln S A \ln 1 / \delta } { \epsilon _ { 2 } ^ { 2 } ( 1 - \gamma ) ^ { 7 } } \tilde { P } . } & { \mathrm { ( B y ~ d e f i n i t i o n ~ o f } \hbar ) } \end{array}
232
+ $$
233
+
234
+ It should be stressed that throughout the lines, $\tilde { P }$ is a shorthand for an asymptotic expression, instead of an exact value. Our final choice of 2 and 1 are 2 = 3 , and 1 = 24RM ln . It is not hard 1−γ to see that $\ln 1 / \epsilon _ { 1 } = \mathrm { p o l y } ( \ln \textstyle \frac { 1 } { \epsilon } , \ln \frac { 1 } { 1 - \gamma } )$ . This immediately implies that with probability $1 - \delta$ , the number of time steps such that $\left( V ^ { * } - \dot { V } ^ { \pi } \right) \left( s _ { t } \right) > \epsilon$ is
235
+
236
+ $$
237
+ \tilde { \mathcal { O } } \left( \frac { S A \ln 1 / \delta } { \epsilon ^ { 2 } ( 1 - \gamma ) ^ { 7 } } \right) ,
238
+ $$
239
+
240
+ where hidden factors are $\begin{array} { r } { \operatorname { p o l y } ( \ln { \frac { 1 } { \epsilon } } , \ln { \frac { 1 } { 1 - \gamma } } , \ln S A ) } \end{array}$ .
241
+
242
+ # 4 DISCUSSION
243
+
244
+ In this section, we discuss the implication of our results, and present some interesting properties of our algorithm beyond its sample complexity bound.
245
+
246
+ # 4.1 COMPARISON WITH PREVIOUS RESULTS
247
+
248
+ Lower bound To the best of our knowledge, the current best lower bound for worst-case sample complexity is  SA2(1−γ)3 ln 1/δ due to Lattimore & Hutter (2012). The gap between our results and this lower bound lies only in the dependence on $1 / ( 1 - \gamma )$ and logarithmic terms of $\mathrm { { } } ^ { \mathrm { { 3 } } A , 1 / ( 1 - \gamma ) }$ and $1 / \epsilon$ .
249
+
250
+ Model-free algorithms Previously, the best sample complexity bound for a model-free algorithm is $\begin{array} { r } { \tilde { \mathcal O } \left( \frac { S A } { \epsilon ^ { 4 } ( 1 - \gamma ) ^ { 8 } } \right) } \end{array}$ (suppressing all logarithmic terms), achieved by Delayed Q-learning Strehl et al. (2006). Our results improve this upper bound by a factor of $\frac { 1 } { \epsilon ^ { 2 } ( 1 - \gamma ) }$ , and closes the quadratic gap in $1 / \epsilon$ between Delayed Q-learning’s result and the lower bound. In fact, the following theorem shows that UCB Q-learning can indeed outperform Delayed Q-learning.
251
+
252
+ Theorem 2. There exists a family of MDPs with constant $S$ and $A$ , in which with probability $1 - \delta$ , Delayed $Q$ -learning incurs sample complexity of exploration of $\Omega \left( \frac { \epsilon ^ { - 3 } } { \ln ( 1 / \delta ) } \right)$ , assuming that $\ln ( 1 / \delta ) < \epsilon ^ { - 2 }$ .
253
+
254
+ The construction of this hard MDP family is given in the supplementary material.
255
+
256
+ Model-based algorithms For model-based algorithms, better sample complexity results in infinite horizon settings have been claimed Szita & Szepesvári (2010). To the best of our knowledge, the best published result without further restrictions on MDPs is $\begin{array} { r } { \tilde { \mathcal O } \left( \frac { S A } { \epsilon ^ { 2 } ( 1 - \gamma ) ^ { 6 } } \right) } \end{array}$ claimed by Szita & Szepesvári (2010), which is $( 1 - \gamma )$ smaller than our upper bound. From the space complexity point of view, our algorithm is much more memory-efficient. Our algorithm stores $O ( S A )$ values, whereas the algorithm in Szita & Szepesvári (2010) needs $\Omega ( S ^ { 2 } A )$ memory to store the transition model.
257
+
258
+ # 4.2 EXTENSION TO OTHER SETTINGS
259
+
260
+ Due to length limits, detailed discussion in this section is deferred to supplementary materials.
261
+
262
+ Finite horizon MDP The sample complexity of exploration bounds of UCB Q-learning implies $\tilde { \mathcal { O } } \left( \epsilon ^ { - 2 } \right)$ PAC sample complexity and a $\bar { \mathcal { O } } \left( T ^ { 1 / 2 } \right)$ regret bound in finite horizon MDPs. That is, our algorithm implies a PAC algorithm for finite horizon MDPs. We are not aware of reductions of the opposite direction (from finite horizon sample complexity to infinite horizon sample complexity of exploration).
263
+
264
+ Regret The reason why our results can imply an $\tilde { \mathcal { O } } ( { \sqrt { T } } )$ regret is that, after choosing $\epsilon _ { 1 }$ , it follows from the argument of Theorem 1 that with probability $1 - \delta$ , for all $\epsilon _ { 2 } > \tilde { \mathcal { O } } ( \epsilon _ { 1 } / ( 1 - \gamma ) )$ , the number of $\epsilon _ { 2 }$ -suboptimal steps is bounded by
265
+
266
+ $$
267
+ \mathcal { O } \left( \frac { S A \ln S A \ln 1 / \delta } { \epsilon _ { 2 } ^ { 2 } ( 1 - \gamma ) ^ { 7 } } \mathrm { p o l y l o g } \left( \frac { 1 } { \epsilon _ { 1 } } , \frac { 1 } { 1 - \gamma } \right) \right) .
268
+ $$
269
+
270
+ In contrast, Delayed Q-learning Strehl et al. (2006) can only give an upper bound on $\epsilon _ { 1 }$ -suboptimal steps after setting parameter $\epsilon _ { 1 }$ .
271
+
272
+ # 5 CONCLUSION
273
+
274
+ Infinite-horizon MDP with discounted reward is a setting that is arguably more difficult than other popular settings, such as finite-horizon MDP. Previously, the best samby model-free reinforcement learning algorithms in this setting is $\tilde { \cal O } \big ( { \textstyle \frac { S A } { \epsilon ^ { 4 } ( 1 - \gamma _ { _ { - } } ) ^ { 8 } } } \big )$ y bound achieved, due to Delayed Q-learning Strehl et al. (2006). In this paper, we propose a variant of Q-learning that incorporates upper confidence bound, and show that it has a sample complexity of $\begin{array} { r } { \tilde { \mathcal { O } } \big ( \frac { S A } { \epsilon ^ { 2 } ( 1 - \gamma ) ^ { 7 } } \big ) } \end{array}$ . This matches the best lower bound except in dependence on $1 / ( 1 - \gamma )$ and logarithmic factors.
275
+
276
+ # 6 ACKNOWLEDGEMENTS
277
+
278
+ The authors thank Chi Jin and Chongjie Zhang for helpful discussions. This work is supported by National Basic Research Program of China (973 Program) (grant no. 2015CB352502), NSFC (61573026), BJNSF (L172037) and Beijing Acedemy of Artificial Intelligence.
279
+
280
+ # REFERENCES
281
+
282
+ Mohammad Gheshlaghi Azar, Remi Munos, Mohammad Ghavamzadeh, and Hilbert Kappen. Speedy q-learning. In Advances in neural information processing systems, 2011.
283
+
284
+ Mohammad Gheshlaghi Azar, Ian Osband, and Rémi Munos. Minimax regret bounds for reinforcement learning. arXiv preprint arXiv:1703.05449, 2017.
285
+
286
+ Ronen I. Brafman and Moshe Tennenholtz. R-max - a general polynomial time algorithm for near-optimal reinforcement learning. J. Mach. Learn. Res., 3:213–231, March 2003. ISSN 1532-4435. doi: 10.1162/153244303765208377. URL https://doi.org/10.1162/ 153244303765208377.
287
+
288
+ Christoph Dann, Tor Lattimore, and Emma Brunskill. Unifying pac and regret: Uniform pac bounds for episodic reinforcement learning. In Advances in Neural Information Processing Systems, pp. 5713–5723, 2017.
289
+
290
+ Eyal Even-Dar and Yishay Mansour. Learning rates for q-learning. Journal of Machine Learning Research, 5(Dec):1–25, 2003.
291
+
292
+ Thomas Jaksch, Ronald Ortner, and Peter Auer. Near-optimal regret bounds for reinforcement learning. Journal of Machine Learning Research, 11(Apr):1563–1600, 2010.
293
+
294
+ Chi Jin, Zeyuan Allen-Zhu, Sebastien Bubeck, and Michael I Jordan. Is q-learning provably efficient? In Advances in Neural Information Processing Systems, pp. 4864–4874, 2018.
295
+
296
+ Sham Machandranath Kakade et al. On the sample complexity of reinforcement learning. PhD thesis, University of London London, England, 2003.
297
+
298
+ Tor Lattimore and Marcus Hutter. Pac bounds for discounted mdps. In International Conference on Algorithmic Learning Theory, pp. 320–334. Springer, 2012.
299
+
300
+ Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Alex Graves, Ioannis Antonoglou, Daan Wierstra, and Martin Riedmiller. Playing atari with deep reinforcement learning. arXiv preprint arXiv:1312.5602, 2013.
301
+
302
+ Volodymyr Mnih, Adria Puigdomenech Badia, Mehdi Mirza, Alex Graves, Timothy Lillicrap, Tim Harley, David Silver, and Koray Kavukcuoglu. Asynchronous methods for deep reinforcement learning. In International conference on machine learning, pp. 1928–1937, 2016.
303
+
304
+ John Schulman, Sergey Levine, Pieter Abbeel, Michael Jordan, and Philipp Moritz. Trust region policy optimization. In International Conference on Machine Learning, pp. 1889–1897, 2015.
305
+
306
+ Aaron Sidford, Mengdi Wang, Xian Wu, Lin Yang, and Yinyu Ye. Near-optimal time and sample complexities for solving markov decision processes with a generative model. In Advances in Neural Information Processing Systems, pp. 5186–5196, 2018a.
307
+
308
+ Aaron Sidford, Mengdi Wang, Xian Wu, and Yinyu Ye. Variance reduced value iteration and faster algorithms for solving markov decision processes. In Proceedings of the Twenty-Ninth Annual ACM-SIAM Symposium on Discrete Algorithms, pp. 770–787. Society for Industrial and Applied Mathematics, 2018b.
309
+
310
+ Alexander L Strehl and Michael L Littman. An analysis of model-based interval estimation for markov decision processes. Journal of Computer and System Sciences, 74(8):1309–1331, 2008.
311
+
312
+ Alexander L Strehl, Lihong Li, Eric Wiewiora, John Langford, and Michael L Littman. Pac modelfree reinforcement learning. In Proceedings of the 23rd international conference on Machine learning, pp. 881–888. ACM, 2006.
313
+
314
+ István Szita and Csaba Szepesvári. Model-based reinforcement learning with nearly tight exploration complexity bounds. In Proceedings of the 27th International Conference on Machine Learning (ICML-10), pp. 1031–1038, 2010.
315
+
316
+ # A PROOF OF LEMMA 1
317
+
318
+ Lemma 1. For fixed t and $\eta > 0$ , let $B _ { \eta } ^ { ( t ) }$ be the event that $\begin{array} { r } { V ^ { * } ( s _ { t } ) - Q ^ { * } ( s _ { t } , a _ { t } ) > \frac { \eta } { 1 - \gamma } } \end{array}$ in step t. If $\eta > 2 \epsilon _ { 1 }$ , then with probability at least $1 - \delta / 2$ ,
319
+
320
+ $$
321
+ \sum _ { t = 1 } ^ { t = \infty } I \left[ B _ { \eta } ^ { ( t ) } \right] \leq \frac { S A \ln S A \ln 1 / \delta } { \eta ^ { 2 } ( 1 - \gamma ) ^ { 3 } } \cdot p o l y l o g \left( \frac { 1 } { \epsilon _ { 1 } } , \frac { 1 } { 1 - \gamma } \right) ,
322
+ $$
323
+
324
+ where $I [ \cdot ]$ is the indicator function.
325
+
326
+ Proof. When $\eta > 1$ the lemma holds trivially. Now consider the case that $\eta \leq 1$ .
327
+
328
+ Let $\begin{array} { r } { I = \{ t \colon V ^ { * } ( s _ { t } ) - Q ^ { * } ( s _ { t } , a _ { t } ) > \frac { \eta } { 1 - \gamma } \} } \end{array}$ . By lemma 2, with probability $1 - \delta$
329
+
330
+ $$
331
+ \begin{array} { r l } & { \frac { \eta | I | } { 1 - \gamma } \leq \displaystyle \sum _ { t \in I } \left( V ^ { * } ( s _ { t } ) - Q ^ { * } ( s _ { t } , a _ { t } ) \right) \leq \displaystyle \sum _ { t \in I } \left[ \left( \hat { Q } _ { t } - Q ^ { * } \right) ( s _ { t } , a _ { t } ) \right] } \\ & { \qquad \leq \displaystyle \frac { | I | \epsilon _ { 1 } } { 1 - \gamma } + \mathcal { O } \left( \frac { 1 } { ( 1 - \gamma ) ^ { 5 / 2 } } \sqrt { S A | I | \ell | ( I | ) } + \frac { S A } { ( 1 - \gamma ) ^ { 3 } } \ln | I | \ln \frac { 1 } { \epsilon _ { 1 } ( 1 - \gamma ) } \right) } \\ & { \qquad \leq \displaystyle \frac { | I | \epsilon _ { 1 } } { 1 - \gamma } + \mathcal { O } \left( \ln \frac { 1 } { \epsilon _ { 1 } ( 1 - \gamma ) } \cdot \left( \frac { \sqrt { S A | I | \ln \frac { S A | I | } { \delta } } } { ( 1 - \gamma ) ^ { 5 / 2 } } + \frac { S A \ln | I | } { ( 1 - \gamma ) ^ { 3 } } \right) \right) } \\ & { \qquad \leq \displaystyle \frac { | I | \epsilon _ { 1 } } { 1 - \gamma } + \mathcal { O } \left( \sqrt { \ln \frac { 1 } { \delta } } \ln \frac { 1 } { \epsilon _ { 1 } ( 1 - \gamma ) } \cdot \left( \frac { \sqrt { S A | I | \ln S A | I | } } { ( 1 - \gamma ) ^ { 5 / 2 } } + \frac { S A \ln | I | } { ( 1 - \gamma ) ^ { 3 } } \right) \right) } \end{array}
332
+ $$
333
+
334
+ Suppose that $\begin{array} { r } { | I | = \frac { S A k ^ { 2 } } { \eta ^ { 2 } ( 1 - \gamma ) ^ { 3 } } \ln S A } \end{array}$ , for some $k > 1$ . Then it follows that for some constant $C _ { 1 }$ ,
335
+
336
+ $$
337
+ \begin{array} { r l } & { \frac { \eta | I | } { 1 - \gamma } = \cfrac { k ^ { 2 } S A \ln S A } { ( 1 - \gamma ) ^ { 4 } \eta } \leq 2 \cfrac { ( \eta - \epsilon _ { 1 } ) | I | } { 1 - \gamma } } \\ & { \qquad \leq C _ { 1 } \sqrt { \ln \frac { 1 } { \delta } } \ln \cfrac { 1 } { \epsilon _ { 1 } ( 1 - \gamma ) } \left( \cfrac { \sqrt { S A | I | \ln \left( S A | I | \right) } } { ( 1 - \gamma ) ^ { 5 / 2 } } + \cfrac { S A \ln | I | } { ( 1 - \gamma ) ^ { 3 } } \right) } \\ & { \qquad \leq C _ { 1 } \sqrt { \ln \frac { 1 } { \delta } } \ln \cfrac { 1 } { \epsilon _ { 1 } ( 1 - \gamma ) } \left( \cfrac { S A k } { \eta ( 1 - \gamma ) ^ { 4 } } \sqrt { \ln S A \cdot ( \ln S A + \ln | I | ) } + \cfrac { S A \ln | I | } { ( 1 - \gamma ) ^ { 3 } } \right) . } \end{array}
338
+ $$
339
+
340
+ Therefore
341
+
342
+ $$
343
+ \begin{array} { r l } & { k ^ { 2 } \ln ( S A ) \le C _ { 1 } \sqrt { \ln \displaystyle \frac { 1 } { \delta } } \ln \frac { 1 } { \epsilon _ { 1 } ( 1 - \gamma ) } \left( k \left( \ln S A + \ln | I | \right) + \eta ( 1 - \gamma ) \ln | I | \right) } \\ & { \qquad \le k C _ { 1 } \sqrt { \ln \displaystyle \frac { 1 } { \delta } } \ln \frac { 1 } { \epsilon _ { 1 } ( 1 - \gamma ) } \cdot \left( \ln S A + 2 \ln | I | \right) } \\ & { \qquad \le k C _ { 1 } \sqrt { \ln \displaystyle \frac { 1 } { \delta } } \ln \frac { 1 } { \epsilon _ { 1 } ( 1 - \gamma ) } \cdot \left( 3 \ln S A + 4 \ln k + 6 \ln \frac { 1 } { \eta ( 1 - \gamma ) } \right) } \\ & { \qquad \le 6 k C _ { 1 } \sqrt { \ln \displaystyle \frac { 1 } { \delta } } \ln ^ { 2 } \frac { 1 } { \epsilon _ { 1 } ( 1 - \gamma ) } \left( \ln S A + \ln \epsilon k \right) . } \end{array}
344
+ $$
345
+
346
+ Let $\begin{array} { r } { C ^ { \prime } = \operatorname* { m a x } \lbrace 2 , 6 C _ { 1 } \sqrt { \ln \frac { 1 } { \delta } } \ln ^ { 2 } \frac { 1 } { \epsilon _ { 1 } ( 1 - \gamma ) } \rbrace } \end{array}$ . Then
347
+
348
+ $$
349
+ k \leq C ^ { \prime } ( 2 + \ln k ) .
350
+ $$
351
+
352
+ If $k \geq 1 0 C ^ { \prime } \ln C ^ { \prime }$ , then
353
+
354
+ $$
355
+ \begin{array} { c } { k - C ^ { \prime } \left( 2 + \ln k \right) \geq 8 C ^ { \prime } \ln C ^ { \prime } - ( 2 + \ln 1 0 ) C ^ { \prime } } \\ { \geq 4 C ^ { \prime } \left( 2 \ln C ^ { \prime } - 4 \right) \geq 0 , } \end{array}
356
+ $$
357
+
358
+ which means violation of (9). Therefore, since $C ^ { \prime } \geq 2$
359
+
360
+ $$
361
+ k \leq 1 0 C ^ { \prime } \ln C ^ { \prime } \leq 3 6 0 C _ { 1 } ^ { 2 } \operatorname* { m a x } \{ \ln ^ { 4 } { \frac { 1 } { \epsilon _ { 1 } ( 1 - \gamma ) } } , 2 0 \ln 2 \} .
362
+ $$
363
+
364
+ It immediately follows that
365
+
366
+ $$
367
+ \begin{array} { r l r } { { \vert I \vert = \frac { S A k ^ { 2 } } { \eta ^ { 2 } ( 1 - \gamma ) ^ { 3 } } \ln S A } } \\ & { \leq \frac { S A \ln S A } { \eta ^ { 2 } ( 1 - \gamma ) ^ { 5 } } \cdot \ln \frac { 1 } { \delta } \cdot \mathcal { O } ( \ln ^ { 8 } \frac { 1 } { \epsilon _ { 1 } ( 1 - \gamma ) } ) . } \end{array}
368
+ $$
369
+
370
+ # B PROOF OF LEMMA 2
371
+
372
+ Lemma 2. For every $( C , w )$ -sequence $( w _ { t } ) _ { t \geq 1 }$ , with probability $1 - \delta / 2$ , the following holds:
373
+
374
+ $$
375
+ \sum _ { t \ge 1 } w _ { t } ( \hat { Q } _ { t } - Q ^ { * } ) ( s _ { t } , a _ { t } ) \le \frac { C \epsilon _ { 1 } } { 1 - \gamma } + \mathcal { O } \left( \frac { \sqrt { w S A C \ell ( C ) } } { ( 1 - \gamma ) ^ { 2 . 5 } } + \frac { w S A \ln C } { ( 1 - \gamma ) ^ { 3 } } \ln \frac { 1 } { ( 1 - \gamma ) \epsilon _ { 1 } } \right) .
376
+ $$
377
+
378
+ where $\begin{array} { r } { \ell ( C ) = \iota ( C ) \ln { \frac { 1 } { ( 1 - \gamma ) \epsilon _ { 1 } } } } \end{array}$ is a log-factor.
379
+
380
+ Fact 1. (1) The following statement holds throughout the algorithm,
381
+
382
+ $$
383
+ \hat { Q } _ { p + 1 } ( s , a ) \leq Q _ { p + 1 } ( s , a ) .
384
+ $$
385
+
386
+ (2) For any $p$ , there exists $p ^ { \prime } \leq p$ such that
387
+
388
+ $$
389
+ { \hat { Q } } _ { p + 1 } ( s , a ) \geq Q _ { p ^ { \prime } + 1 } ( s , a ) .
390
+ $$
391
+
392
+ Proof. Both properties are results of the update rule at line 11 of Algorithm 1.
393
+
394
+ Before proving lemma 2, we will prove two auxiliary lemmas.
395
+
396
+ Lemma 3. The following properties hold for $\alpha _ { t } ^ { i }$ :
397
+
398
+ 1. $\begin{array} { r } { \sqrt { \frac { 1 } { t } } \leq \sum _ { i = 1 } ^ { t } \alpha _ { t } ^ { i } \sqrt { \frac { 1 } { i } } \leq 2 \sqrt { \frac { 1 } { t } } } \end{array}$ for every $t \geq 1 , c > 0$ .
399
+
400
+ 2. $\begin{array} { r } { \operatorname* { m a x } _ { i \in [ t ] } \alpha _ { t } ^ { i } \leq \frac { 2 H } { t } } \end{array}$ and $\begin{array} { r } { \sum _ { i = 1 } ^ { t } ( \alpha _ { t } ^ { i } ) ^ { 2 } \le \frac { 2 H } { t } } \end{array}$ for every $t \geq 1$
401
+
402
+ 3. $\textstyle \sum _ { t = i } ^ { \infty } \alpha _ { t } ^ { i } = 1 + 1 / H$ , for every $i \geq 1$
403
+
404
+ Proof. Recall that
405
+
406
+ $$
407
+ \alpha _ { t } = \frac { H + 1 } { H + t } , \quad \alpha _ { t } ^ { 0 } = \prod _ { j = 1 } ^ { t } ( 1 - \alpha _ { j } ) , \quad \alpha _ { t } ^ { i } = \alpha _ { i } \prod _ { j = i + 1 } ^ { t } ( 1 - \alpha _ { j } ) .
408
+ $$
409
+
410
+ Properties 1-3 are proven by Jin et al. (2018). Now we prove the last property.
411
+
412
+ On the one hand,
413
+
414
+ $$
415
+ \sum _ { i = 1 } ^ { t } \alpha _ { t } ^ { i } \sqrt { \frac { \iota ( i ) } { i } } \leq \sum _ { i = 1 } ^ { t } \alpha _ { t } ^ { i } \sqrt { \frac { \iota ( t ) } { i } } \leq 2 \sqrt { \frac { \iota ( t ) } { t } } ,
416
+ $$
417
+
418
+ where the last inequality follows from property 1.
419
+
420
+ The left-hand side is proven by induction on $t$ . For the base case, when $t = 1 , \alpha _ { t } ^ { t } = 1$ . For $t \geq 2$ , we have $\alpha _ { t } ^ { i } = ( 1 - \alpha _ { t } ) \dot { \alpha _ { t - 1 } ^ { i } }$ for $1 \leq i \leq t - 1$ . It follows that
421
+
422
+ $$
423
+ \sum _ { i = 1 } ^ { t } \alpha _ { t } ^ { i } \sqrt { \frac { \iota ( i ) } { i } } = \alpha _ { t } \sqrt { \frac { \iota ( t ) } { t } } + ( 1 - \alpha _ { t } ) \sum _ { i = 1 } ^ { t - 1 } \alpha _ { t - 1 } ^ { i } \sqrt { \frac { \iota ( i ) } { i } } \geq \alpha _ { t } \sqrt { \frac { \iota ( t ) } { t } } + ( 1 - \alpha _ { t } ) \sqrt { \frac { \iota ( t - 1 ) } { t - 1 } } .
424
+ $$
425
+
426
+ Since function $f ( t ) = \iota ( t ) / t$ is monotonically decreasing for $t \geq 1 , c \geq 1$ , we have
427
+
428
+ $$
429
+ \alpha _ { t } \sqrt { \frac { \iota ( t ) } { t } } + ( 1 - \alpha _ { t } ) \sqrt { \frac { \iota ( t - 1 ) } { t - 1 } } \geq \alpha _ { t } \sqrt { \frac { \iota ( t ) } { t } } + ( 1 - \alpha _ { t } ) \sqrt { \frac { \iota ( t ) } { t } } \geq \sqrt { \frac { \iota ( t ) } { t } } .
430
+ $$
431
+
432
+ Lemma 4. With probability at least $1 - \delta / 2$ , for all $p \geq 0$ and $( s , a )$ -pair,
433
+
434
+ $$
435
+ \begin{array} { r l } & { 0 \le ( Q _ { p } - Q ^ { * } ) ( s , a ) \le \displaystyle \frac { \alpha _ { t } ^ { 0 } } { 1 - \gamma } + \displaystyle \sum _ { i = 1 } ^ { t } \gamma \alpha _ { t } ^ { i } ( { \hat { V } } _ { t _ { i } } - V ^ { * } ) ( s _ { t _ { i } + 1 } ) + \beta _ { t } , } \\ & { 0 \le ( { \hat { Q } } _ { p } - Q ^ { * } ) ( s , a ) , } \end{array}
436
+ $$
437
+
438
+ where $t = N _ { p } ( s , a ) , t _ { i } = \tau ( s , a , i )$ and $\beta _ { t } = c _ { 3 } \sqrt { H \iota ( t ) / ( ( 1 - \gamma ) ^ { 2 } t ) }$ .
439
+
440
+ Proof. Recall that
441
+
442
+ $$
443
+ \alpha _ { t } ^ { 0 } = \prod _ { j = 1 } ^ { t } ( 1 - \alpha _ { j } ) , \quad \alpha _ { t } ^ { i } = \alpha _ { i } \prod _ { j = i + 1 } ^ { t } ( 1 - \alpha _ { j } ) .
444
+ $$
445
+
446
+ From the update rule, it can be seen that our algorithm maintains the following $Q ( s , a )$ :
447
+
448
+ $$
449
+ Q _ { p } ( s , a ) = \alpha _ { t } ^ { 0 } \frac { 1 } { 1 - \gamma } + \sum _ { i = 1 } ^ { t } \alpha _ { t } ^ { i } \left[ r ( s , a ) + b _ { i } + \gamma \hat { V } _ { t _ { i } } ( s _ { t _ { i } + 1 } ) \right] .
450
+ $$
451
+
452
+ Bellman optimality equation gives:
453
+
454
+ $$
455
+ Q ^ { * } ( s , a ) = r ( s , a ) + \gamma \mathbb { P } V ^ { * } ( s , a ) = \alpha _ { t } ^ { 0 } Q ^ { * } ( s , a ) + \sum _ { i = 1 } ^ { t } \alpha _ { t } ^ { i } \left[ r ( s , a ) + \gamma \mathbb { P } V ^ { * } ( s , a ) \right] .
456
+ $$
457
+
458
+ Subtracting the two equations gives
459
+
460
+ $$
461
+ Q _ { p } - Q ^ { * } ) ( s , a ) = \alpha _ { t } ^ { 0 } ( \frac { 1 } { 1 - \gamma } - Q ^ { * } ( s , a ) ) + \sum _ { i = 1 } ^ { t } \alpha _ { t } ^ { i } \left[ b _ { i } + \gamma \left( V _ { t _ { i } } - V ^ { * } \right) \left( s _ { t _ { i } + 1 } \right) + \gamma \left( V ^ { * } \left( s _ { t _ { i } + 1 } \right) - \mathbb { P } V ^ { * } \right) \right] ,
462
+ $$
463
+
464
+ The identity above holds for arbitrary $p , s$ and $a$ . Now fix $s \in S$ , $a \in A$ and $p \in \mathbb N$ . Let $t = N _ { p } ( s , a )$ , $t _ { i } = \tau ( s , a , i )$ . The $t = 0$ case is trivial; we assume $t \geq 1$ below. Now consider an arbitrary fixed $k$ . Define
465
+
466
+ $$
467
+ \Delta _ { i } = \left( \alpha _ { k } ^ { i } \cdot I [ t _ { i } < \infty ] \cdot \left( \mathbb { P } V ^ { * } - \mathbb { \hat { P } } _ { t _ { i } } V ^ { * } \right) ( s , a ) \right)
468
+ $$
469
+
470
+ Let $F _ { i }$ be the $\sigma$ -Field generated by random variables $( s _ { 1 } , a _ { 1 } , . . . , s _ { t _ { i } } , a _ { t _ { i } } )$ . It can be seen that $\mathbb { E } \left[ \Delta _ { i } | F _ { i } \right] = 0$ , while $\Delta _ { i }$ is measurable in $F _ { i + 1 }$ . Also, since $\textstyle 0 \leq V ^ { \ast } ( s , { \bar { a } } ) \leq { \frac { 1 } { 1 - \gamma } }$ , $\begin{array} { r } { | \Delta _ { i } | \le \frac { 2 } { 1 - \gamma } } \end{array}$ . Therefore, $\Delta _ { i }$ is a martingale difference sequence; by the Azuma-Hoeffding inequality,
471
+
472
+ $$
473
+ \mathrm { P r } \left[ \left| \sum _ { i = 1 } ^ { k } \Delta _ { i } \right| > \eta \right] \leq 2 \exp \left\{ - \frac { \eta ^ { 2 } } { 8 \left( 1 - \gamma \right) ^ { - 2 } \sum _ { i = 1 } ^ { k } ( \alpha _ { k } ^ { i } ) ^ { 2 } } \right\} .
474
+ $$
475
+
476
+ By choosing $\eta$ , we can show that with probability $1 - \delta / \left[ S A ( k + 1 ) ( k + 2 ) \right]$ ,
477
+
478
+ $$
479
+ \left| \sum _ { i = 1 } ^ { k } \Delta _ { i } \right| \leq \frac { 2 \sqrt { 2 } } { 1 - \gamma } \cdot \sqrt { \sum _ { i = 1 } ^ { k } ( \alpha _ { k } ^ { i } ) ^ { 2 } \cdot \ln \frac { 2 ( k + 1 ) ( k + 2 ) S A } { \delta } } \leq \frac { c _ { 2 } } { 1 - \gamma } \sqrt { \frac { H \iota ( k ) } { k } } .
480
+ $$
481
+
482
+ Here $c _ { 2 } = 4 \sqrt { 2 }$ , $\begin{array} { r } { \iota ( k ) = \ln { \frac { ( k + 1 ) ( k + 2 ) S A } { \delta } } } \end{array}$ . By a union bound for all $k$ , this holds for arbitrary $k > 0$ arbitrary $s \in S , a \in A$ simultaneously with probability
483
+
484
+ $$
485
+ 1 - \sum _ { s ^ { \prime } \in S , a ^ { \prime } \in A } \sum _ { k = 1 } ^ { \infty } \frac { \delta } { 2 S A ( k + 1 ) ( k + 2 ) } = 1 - \frac { \delta } { 2 } .
486
+ $$
487
+
488
+ Therefore, we conclude that (16) holds for the random variable $t = N _ { p } ( s , a )$ and for all $p$ , with probability $1 - \delta / 2$ as well.
489
+
490
+ Proof of the right hand side of (13): We also know that $\begin{array} { r } { ( b _ { k } = \frac { c _ { 2 } } { 1 - \gamma } \sqrt { \frac { H \iota ( k ) } { k } } ) } \end{array}$
491
+
492
+ $$
493
+ \frac { c _ { 2 } } { 1 - \gamma } \sqrt { \frac { H \iota ( k ) } { k } } \leq \sum _ { i = 1 } ^ { k } \alpha _ { k } ^ { i } b _ { i } \leq \frac { 2 c _ { 2 } } { 1 - \gamma } \sqrt { \frac { H \iota ( k ) } { k } } .
494
+ $$
495
+
496
+ It is implied by (16) that
497
+
498
+ $$
499
+ \begin{array} { r l } & { ( Q _ { p } - Q ^ { * } ) ( s , a ) \leq \displaystyle \frac { \alpha _ { t } ^ { 0 } } { 1 - \gamma } + \gamma \left| \displaystyle \sum _ { i = 1 } ^ { t } \Delta _ { i } \right| + \displaystyle \sum _ { i = 1 } ^ { t } \alpha _ { t } ^ { i } \left[ \gamma ( \hat { V } _ { t _ { i } } - V ^ { * } ) ( x _ { t _ { i } + 1 } ) + b _ { i } \right] } \\ & { \qquad \leq \displaystyle \frac { \alpha _ { t } ^ { 0 } } { 1 - \gamma } + \displaystyle \frac { 3 c _ { 2 } } { 1 - \gamma } \sqrt { \frac { H \iota ( t ) } { t } } + \displaystyle \sum _ { i = 1 } ^ { t } \gamma \alpha _ { t } ^ { i } ( \hat { V } ^ { t _ { i } } - V ^ { * } ) ( x _ { t _ { i } + 1 } ) } \end{array}
500
+ $$
501
+
502
+ $$
503
+ \leq \frac { \alpha _ { t } ^ { 0 } } { 1 - \gamma } + \sum _ { i = 1 } ^ { t } \gamma \alpha _ { t } ^ { i } ( { \hat { V } } ^ { t _ { i } } - V ^ { * } ) ( x _ { t _ { i } + 1 } ) + \beta _ { t } .
504
+ $$
505
+
506
+ Note that $\beta _ { t } = c _ { 3 } ( 1 - \gamma ) ^ { - 1 } \sqrt { H \iota ( t ) / t }$ ; $c _ { 3 } = 3 c _ { 2 } = 1 2 { \sqrt { 2 } } .$ .
507
+
508
+ Proof of the left hand side of (13): Now, we assume that event that (16) holds. We assert that $Q _ { p } \geq Q ^ { * }$ for all $( s , a )$ and $p \leq p ^ { \prime }$ . This assertion is obviously true when $p ^ { \prime } = 0$ . Then
509
+
510
+ $$
511
+ \begin{array} { c l } { ( Q _ { p } - Q ^ { * } ) ( s , a ) \geq - \gamma \displaystyle \left| \displaystyle \sum _ { i = 1 } ^ { t } \Delta _ { i } \right| + \displaystyle \sum _ { i = 1 } ^ { t } \alpha _ { t } ^ { i } \left[ \gamma ( \hat { V } _ { t _ { i } } - V ^ { * } ) ( x _ { t _ { i } + 1 } ) + b _ { i } \right] } \\ { \geq \displaystyle \sum _ { i = 1 } ^ { t } \alpha _ { t } ^ { i } b _ { i } - \gamma \displaystyle \left| \displaystyle \sum _ { i = 1 } ^ { t } \Delta _ { i } \right| \geq 0 . } \end{array}
512
+ $$
513
+
514
+ Therefore the assertion holds for $p ^ { \prime } + 1$ as well. By induction, it holds for all $p$ .
515
+
516
+ We now see that (13) holds for probability $1 - \delta / 2$ for all $p , s , a$ . Since $\hat { Q } _ { p } ( s , a )$ is always greater than $Q _ { p ^ { \prime } } ( s , a )$ for some $p ^ { \prime } \leq p$ , we know that $\hat { Q } _ { p } ( s , a ) \geq Q _ { p ^ { \prime } } ( s , a ) \geq Q ^ { * } ( s , a )$ , thus proving (14).
517
+
518
+ We now give a proof for lemma 2. Recall the definition for a $( C , w )$ -sequence. A sequence $( w _ { t } ) _ { t \geq 1 }$ is said to be a $( C , w )$ -sequence for $C , w > 0$ , if $0 \leq w _ { t } \leq w$ for all $t \geq 1$ , and $\textstyle \sum _ { t \geq 1 } w _ { t } \leq C$ .
519
+
520
+ Proof. Let $n _ { t } = N _ { t } ( s _ { t } , a _ { t } )$ for simplicity; we have
521
+
522
+ $$
523
+ \begin{array} { r l } { { \sum _ { t \geq 1 } w _ { t } ( \hat { Q } _ { t } - Q ^ { * } ) ( s _ { t } , a _ { t } ) } } \\ & { \leq \sum _ { t \geq 1 } w _ { t } ( Q _ { t } - Q ^ { * } ) ( s _ { t } , a _ { t } ) } \\ & { \leq \sum _ { t \geq 1 } w _ { t } [ \cfrac { \alpha _ { n _ { t } } ^ { 0 } } { 1 - \gamma } + \beta _ { n _ { t } } + \gamma \sum _ { i = 1 } ^ { n _ { t } } \alpha _ { n _ { t } } ^ { i } ( \hat { V } _ { \tau ( s _ { t } , a _ { t } , i ) } - V ^ { * } ) ( s _ { \tau ( s _ { t } , a _ { t } , i ) + 1 } ) ] } \end{array}
524
+ $$
525
+
526
+ The last inequality is due to lemma 4. Note that $\alpha _ { n _ { t } } ^ { 0 } = \mathbb { I } [ n _ { t } = 0 ]$ , the first term in the summation can be bounded by,
527
+
528
+ $$
529
+ \sum _ { t \geq 1 } w _ { t } \frac { \alpha _ { n _ { t } } ^ { 0 } } { 1 - \gamma } \leq \frac { S A w } { 1 - \gamma } .
530
+ $$
531
+
532
+ For the second term, define $u ( s , a ) = \operatorname* { s u p } _ { t } N _ { t } ( s , a )$ .2 It follows that,
533
+
534
+ $$
535
+ \begin{array} { l } { \displaystyle \sum _ { t \geq 1 } w _ { t } \beta _ { n _ { t } } = \sum _ { s , o } ^ { u ( s , o ) } w _ { \tau ( s , a , i ) } \beta _ { i } } \\ { \displaystyle \qquad \leq \sum _ { s , a } ( 1 - \gamma ) ^ { - 1 } c _ { 3 } \sum _ { i = 1 } ^ { C _ { s , a } / w } \sqrt { \frac { H \iota ( i ) } { i } } w } \\ { \displaystyle \qquad \leq 2 \sum _ { s , a } ( 1 - \gamma ) ^ { - 1 } c _ { 3 } \sqrt { \iota ( C ) H C _ { s , a } w } } \\ { \displaystyle \qquad \leq 2 c _ { 3 } ( 1 - \gamma ) ^ { - 1 } \sqrt { w S A H C \iota ( C ) } . } \end{array}
536
+ $$
537
+
538
+ Where $\begin{array} { r } { C _ { s , a } = \sum _ { t \geq 1 , ( s _ { t } , a _ { t } ) = ( s , a ) } w _ { t } } \end{array}$ . Inequality (19) follows from rearrangement inequality, since $\iota ( x ) / x$ is monotonically decreasing. Inequality (21) follows from Jensen’s inequality.
539
+
540
+ For the third term of the summation, we have
541
+
542
+ $$
543
+ \begin{array} { c } { { \displaystyle \sum _ { t \ge 1 } w _ { t } \sum _ { i = 1 } ^ { n _ { t } } \alpha _ { n _ { t } } ^ { i } \left( \hat { V } _ { \tau ( s _ { t } , a _ { t } , i ) } - V ^ { * } \right) \left( s _ { \tau ( s _ { t } , a _ { t } , i ) + 1 } \right) } } \\ { { \displaystyle \le \sum _ { t ^ { \prime } \ge 1 } \left( \hat { V } _ { t ^ { \prime } } - V ^ { * } \right) \left( s _ { t ^ { \prime } + 1 } \right) \left( \sum _ { t = t ^ { \prime } + 1 } ^ { \infty } \alpha _ { n _ { t } } ^ { n _ { t ^ { \prime } } } w _ { t } \right) . } } \end{array}
544
+ $$
545
+
546
+ Define
547
+
548
+ $$
549
+ w _ { t ^ { \prime } + 1 } ^ { \prime } = \left( \sum _ { \stackrel { t = t ^ { \prime } + 1 } { ( s _ { t } , a _ { t } ) = ( s _ { t } ^ { \prime } , a _ { t } ^ { \prime } ) } } ^ { \infty } \alpha _ { n _ { t } } ^ { n _ { t ^ { \prime } } } w _ { t } \right) .
550
+ $$
551
+
552
+ We claim that $w _ { t + 1 } ^ { \prime }$ is a $\textstyle ( C , ( 1 + { \frac { 1 } { H } } ) w )$ -sequence. We now prove this claim. By lemma 3, for any $t ^ { \prime } \geq 0$ ,
553
+
554
+ $$
555
+ w _ { t ^ { \prime } + 1 } ^ { \prime } \leq w \sum _ { j = n _ { t ^ { \prime } } } ^ { \infty } \alpha _ { j } ^ { n _ { t ^ { \prime } } } = ( 1 + 1 / H ) w .
556
+ $$
557
+
558
+ By $\textstyle \sum _ { j = 0 } ^ { i } \alpha _ { i } ^ { j } = 1$ , we have $\begin{array} { r } { \sum _ { t ^ { \prime } \geq 1 } w _ { t ^ { \prime } + 1 } ^ { \prime } \leq \sum _ { t \geq 1 } w _ { t } \leq C . } \end{array}$ . This proves the assertion. It follows from (22) that
559
+
560
+ $$
561
+ \begin{array} { r l } & { \quad \underset { t \geq 1 } { \sum \sigma } u _ { t + 1 } ^ { \prime } \left( \hat { V } _ { t } - V ^ { * } \right) \left( s _ { t + 1 } \right) } \\ & { = \underset { t \geq 1 } { \sum \sigma } u _ { t + 1 } ^ { \prime } \left( \hat { V } _ { t + 1 } - V ^ { * } \right) \left( s _ { t + 1 } \right) + \underset { t \geq 1 } { \sum \sigma } u _ { t + 1 } ^ { \prime } \left( \hat { V } _ { t } - \hat { V } _ { t + 1 } \right) \left( s _ { t + 1 } \right) } \\ & { \quad \leq \underset { t \geq 1 } { \sum \sigma } u _ { t + 1 } ^ { \prime } \left( \hat { V } _ { t + 1 } - V ^ { * } \right) \left( s _ { t + 1 } \right) + \underset { t \geq 1 } { \sum \sigma } u _ { t + 1 } ^ { \prime } \left( 2 \alpha _ { n _ { t } + 1 } \frac { 1 } { 1 - \gamma } \right) } \\ & { \quad \leq \underset { t \geq 1 } { \sum \sigma } w _ { t + 1 } ^ { \prime } \left( \hat { V } _ { t + 1 } - V ^ { * } \right) \left( s _ { t + 1 } \right) + \mathcal { O } \left( \frac { w S A H } { 1 - \gamma } \ln { C } \right) } \\ & { \quad \leq \underset { t \geq 1 } { \sum \sigma } w _ { t + 1 } ^ { \prime } \left( \hat { Q } _ { t + 1 } - Q ^ { * } \right) \left( s _ { t + 1 } , a _ { t + 1 } \right) + \mathcal { O } \left( \frac { w S A H } { 1 - \gamma } \ln { C } \right) } \end{array}
562
+ $$
563
+
564
+ Inequality (25) comes from the update rule of our algorithm. Inequality (26) comes from the fact that $\dot { \alpha } _ { t } = ( H + 1 ) / ( H + t ) \overset { \cdot } { \leq } H / t$ and Jensen’s Inequality. More specifically, let $C _ { s , a } ^ { \prime } =$ $\scriptstyle \sum _ { t \geq 1 , ( s _ { t } , a _ { t } = s , a } w _ { t + 1 } ^ { \prime }$ , $w ^ { \prime } = w ( 1 + 1 / H )$ . Then
565
+
566
+ $$
567
+ \sum _ { t \geq 1 } w _ { t + 1 } ^ { \prime } \alpha _ { n _ { t } + 1 } \leq \sum _ { s , a } \sum _ { n = 1 } ^ { C _ { s , a } ^ { \prime } / w ^ { \prime } } w ^ { \prime } \frac { H } { n } \leq \sum _ { s , a } H w ^ { \prime } \ln ( C _ { s , a } ^ { \prime } / w ) \leq 2 S A H w \ln C .
568
+ $$
569
+
570
+ Putting (18), (21) and (27) together, we have,
571
+
572
+ $$
573
+ \begin{array} { r l } & { \displaystyle \sum _ { t \geq 1 } w _ { t } ( \hat { Q } _ { t } - Q ^ { * } ) ( s _ { t } , a _ { t } ) } \\ & { \leq 2 c _ { 3 } \frac { \sqrt { w S A H C \iota ( C ) } } { 1 - \gamma } + \mathcal { O } \left( \frac { w S A H } { 1 - \gamma } \ln C \right) + \gamma \displaystyle \sum _ { t \geq 1 } w _ { t + 1 } ^ { \prime } \left( \hat { Q } _ { t + 1 } - Q ^ { * } \right) ( s _ { t + 1 } , a _ { t + 1 } ) . } \end{array}
574
+ $$
575
+
576
+ Observe that the third term is another weighted sum with the same form as (17). Therefore, we can unroll this term repetitively with changing weight sequences.Suppose that our original weight sequence is also denoted by $\{ \bar { w _ { t } ^ { ( 0 ) } } \} _ { t \ge 1 }$ , while $\{ w _ { t } ^ { ( k ) } \} _ { t \ge 1 }$ denotes the weight sequence after unrolling for $k$ times. Let $w ^ { ( k ) }$ be $w \cdot \left( 1 + 1 / H \right) ^ { k }$ . Then we can see that $\{ w _ { t } ^ { ( k ) } \} _ { t \ge 1 }$ is a $( C , w ^ { ( k ) } )$ -sequence. Suppose that we unroll for $H$ times. Then
577
+
578
+ $$
579
+ \begin{array} { r l } & { \displaystyle \sum _ { t \geq 1 } w _ { t } ( \hat { Q } _ { t } - Q ^ { * } ) ( s _ { t } , a _ { t } ) } \\ & { \leq 2 c _ { 3 } \frac { \sqrt { w ^ { ( H ) } S A H C \iota ( C ) } } { ( 1 - \gamma ) ^ { 2 } } + \mathcal { O } \left( \frac { w ^ { ( H ) } S A H } { ( 1 - \gamma ) ^ { 2 } } \ln C \right) + \gamma ^ { H } \displaystyle \sum _ { t \geq 1 } w _ { t } ^ { ( H ) } \left( \hat { Q } _ { t } - Q ^ { * } \right) ( s _ { t } , a _ { t } ) } \\ & { \leq 2 c _ { 3 } \frac { \sqrt { w ^ { ( H ) } S A H C \iota ( C ) } } { ( 1 - \gamma ) ^ { 2 } } + \mathcal { O } \left( \frac { w ^ { ( H ) } S A H } { ( 1 - \gamma ) ^ { 2 } } \ln C \right) + \gamma ^ { H } \frac { C } { 1 - \gamma } . } \end{array}
580
+ $$
581
+
582
+ We set $\begin{array} { r } { H = \frac { \ln 1 / ( ( 1 - \gamma ) \epsilon _ { 1 } ) } { \ln 1 / \gamma } \leq \frac { \ln 1 / ( ( 1 - \gamma ) \epsilon _ { 1 } ) } { 1 - \gamma } , } \end{array}$ . It follows that $w ^ { ( H ) } = ( 1 + 1 / H ) ^ { H } w ^ { ( 0 ) } \leq e w ^ { ( 0 ) }$ , and that γH C1−γ $\gamma ^ { H } \frac { C } { 1 - \gamma } \leq C \epsilon _ { 1 }$ . Also, let $\ell ( C ) = \iota ( C ) \ln ( ( 1 - \gamma ) ^ { - 1 } \epsilon _ { 1 } ^ { - 1 } )$ . Therefore,
583
+
584
+ $$
585
+ \sum _ { t \geq 1 } w _ { t } ( \hat { Q } _ { t } - Q ^ { * } ) ( s _ { t } , a _ { t } ) \leq \frac { C \epsilon _ { 1 } } { 1 - \gamma } + \mathcal { O } \left( \frac { \sqrt { w S A C \ell ( C ) } } { ( 1 - \gamma ) ^ { 2 . 5 } } + \frac { w S A } { ( 1 - \gamma ) ^ { 3 } } \ln C \ln \frac { 1 } { ( 1 - \gamma ) \epsilon _ { 1 } } \right) .
586
+ $$
587
+
588
+ # C EXTENSION TO OTHER SETTINGS
589
+
590
+ First we define a mapping from a finite horizon MDP to an infinite horizon MDP so that our algorithm can be applied. For an arbitrary finite horizon MDP $\mathcal { M } = ( S , A , H , r _ { h } ( s _ { \perp } a ) , p _ { h } ( s ^ { \prime } \mid s , a ) )$ where $H$ is the length of episode, the corresponding infinite horizon MDP $\mathcal { M } = ( S , A , \gamma , \bar { r } ( \bar { s } , \bar { a } ) , \bar { p } ( \bar { s } ^ { \prime } \mid \bar { s } , \bar { a } ) )$ is defined as,
591
+
592
+ $\begin{array} { l } { { \bullet \ { \bar { S } } = S \times H , { \bar { A } } = A ; } } \\ { { \bullet \ \gamma = ( 1 - 1 / H ) ; } } \end{array}$ • for a state $s$ at step $h$ , let $\bar { s } _ { s , h }$ be the corresponding state. For any action $a$ and next state $s ^ { \prime }$ , define $\bar { r } ( \bar { s } _ { s , h } , a ) = \gamma ^ { H - h + 1 } r _ { h } ( s , a )$ and $\bar { p } ( \bar { s } _ { s ^ { \prime } , h + 1 } \mid \bar { s } _ { s , h } , a ) = p _ { h } ( s ^ { \prime } \mid s , h )$ . And for $h = H$ , set $\bar { r } ( \bar { s } _ { s , h } , a ) = 0$ and $\bar { p } ( \bar { s } _ { s ^ { \prime } , 1 } \mid \bar { s } _ { s , h } , a ) = I [ s ^ { \prime } = s _ { 1 } ]$ for a fixed starting state $s _ { 1 }$ .
593
+
594
+ Let $\bar { V } _ { t }$ be the value function in $\bar { \mathcal { M } }$ at time $t$ and $V _ { h } ^ { k }$ the value function in $\mathcal { M }$ at episode $k$ , step $h$ . It follows that $\begin{array} { r } { \bar { V } ^ { \ast } ( \bar { s } _ { s _ { 1 } , 1 } ) = \frac { \gamma ^ { H } } { 1 - \gamma ^ { H } } V _ { 1 } ^ { \ast } ( s _ { 1 } ) } \end{array}$ . And the policy mapping is defined as $\pi _ { h } ( s ) = \bar { \pi } ( \bar { s } _ { s , h } )$ for policy $\bar { \pi }$ in $\bar { \mathcal { M } }$ . Value functions in MDP $\mathcal { M }$ and $\bar { \mathcal { M } }$ are closely related in a sense that, any $\epsilon$ -optimal policy $\bar { \pi }$ of $\bar { \mathcal { M } }$ corresponding to an $( \epsilon / \gamma ^ { H } )$ -optimal policy $\pi$ in $\mathcal { M }$ (see section C.1 for proof). Note that here $\gamma ^ { H } = ( 1 - \dot { 1 } / H ) ^ { \tilde { H } } = \mathcal { O } ( \dot { 1 } )$ is a constant.
595
+
596
+ For any visited a $\epsilon > 0$ g our algorithm on times, and at most $\bar { M }$ for of $\tilde { \mathcal O } \big ( \frac { 3 S A H ^ { 9 } } { \epsilon ^ { 2 } } \big )$ tt me steps, the starting state -optimal. If we select the p $s _ { 1 }$ iscy $\tilde { \mathcal O } \big ( { \textstyle { \frac { 3 S A H ^ { 8 } } { \epsilon ^ { 2 } } } } \big )$ $1 / 3$ $\epsilon$ uniformly randomly from the policy $\pi ^ { t H + 1 }$ for $0 \leq t < T / H$ , with probability at least $2 / 3$ we can get an $\epsilon$ -optimal policy. Therefore the PAC sample complexity is $\tilde { \mathcal { O } } \left( \epsilon ^ { - 2 } \right)$ after hiding $S , A , H$ terms.
597
+
598
+ On the other hand, we want to show that for any $K$ episodes,
599
+
600
+ $$
601
+ \mathrm { R e g r e t } ( T ) = \sum _ { k = 1 } ^ { T / H } \left[ V ^ { * } ( s _ { 1 } ) - V _ { 1 } ^ { k } ( s _ { 1 } ) \right] \propto T ^ { 1 / 2 } .
602
+ $$
603
+
604
+ The reason why our algorithm can have a better reduction from regret to PAC is that, after choosing $\epsilon _ { 1 }$ , it follows from the argument of theorem 1 that for all $\epsilon _ { 2 } > \tilde { \mathcal { O } } ( \epsilon _ { 1 } / ( 1 - \gamma ) )$ , the number of $\epsilon _ { 2 }$ -suboptimal steps is bounded by
605
+
606
+ $$
607
+ \mathcal { O } \left( \frac { S A \ln S A \ln 1 / \delta } { \epsilon _ { 2 } ^ { 2 } ( 1 - \gamma ) ^ { 7 } } \mathrm { p o l y l o g } \left( \frac { 1 } { \epsilon _ { 1 } } , \frac { 1 } { 1 - \gamma } \right) \right)
608
+ $$
609
+
610
+ with probability $1 - \delta$ . In contrast, delayed Q-learning can only give an upper bound on $\epsilon _ { 1 }$ -suboptimal steps after setting parameter $\epsilon _ { 1 }$ .
611
+
612
+ Formally, let $X _ { k } = V ^ { \ast } ( s _ { 1 } ) - V _ { 1 } ^ { k } ( s _ { 1 } )$ be the regret of $k$ -th episode. For any $T$ , set $\epsilon = \sqrt { S A / T }$ and $\epsilon _ { 2 } = \tilde { \mathcal { O } } ( \epsilon _ { 1 } / ( 1 - \gamma ) )$ . Let $\begin{array} { r } { M = \lceil \log _ { 2 } \frac { 1 } { \epsilon _ { 2 } ( 1 - \gamma ) } \rceil } \end{array}$ . It follows that,
613
+
614
+ $$
615
+ \begin{array} { r l r } { { \operatorname { R e g r e t } ( T ) \le T \epsilon _ { 2 } + \sum _ { i = 1 } ^ { M } ( | k : \{ X _ { k } \ge \epsilon _ { 2 } \cdot 2 ^ { i - 1 } \} | ) \epsilon _ { 2 } \cdot 2 ^ { i } } } \\ & { } & \\ & { } & { \le \tilde { \mathcal { O } } ( T \epsilon _ { 2 } + \sum _ { i = 1 } ^ { M } \frac { S A \ln 1 / \delta } { \epsilon _ { 2 } \cdot 2 ^ { i - 2 } } ) } \\ & { } & { \le \tilde { \mathcal { O } } ( \sqrt { S A T } \ln 1 / \delta ) } \end{array}
616
+ $$
617
+
618
+ with probability $1 - \delta$ . Note that the $\tilde { \mathcal { O } }$ notation hides the poly $( 1 / ( 1 - \gamma ) , \log { 1 / \epsilon _ { 1 } } )$ which is, by our reduction, poly $( H , \log T , \log S , \log A )$ .
619
+
620
+ # C.1 CONNECTION BETWEEN VALUE FUNCTIONS
621
+
622
+ Recall that our MDP mapping from $\begin{array} { r c l } { \mathcal { M } } & { = } & { ( S , A , H , r _ { h } ( s , a ) , p _ { h } ( s ^ { \prime } \mathrm { ~ ~ \chi ~ } | \mathrm { ~ ~ \chi ~ } s , a ) ) } \end{array}$ to $\begin{array} { r l } { \bar { \mathcal { M } } } & { { } = } \end{array}$ $( \bar { S } , \bar { A } , \gamma , \bar { r } ( \bar { s } , \bar { a } ) , \bar { p } ( \bar { s } ^ { \prime } \mid \bar { s } , \bar { a } ) )$ is defined as,
623
+
624
+ • $\bar { S } = S \times H , \bar { A } = A$ ;
625
+ • $\gamma = ( 1 - 1 / H )$ ;
626
+ • for a state $s$ at step $h$ , let $\bar { s } _ { s , h }$ be the corresponding state. For any action $a$ and next state $s ^ { \prime }$ , define $\bar { r } ( \bar { s } _ { s , h } , a ) = \gamma ^ { H - h + 1 } r _ { h } ( s , a )$ and $\bar { p } ( \bar { s } _ { s ^ { \prime } , h + 1 } \mid \bar { s } _ { s , h } , a ) = p _ { h } ( s , h )$ . And for $h = H$ , set $\bar { r } ( \bar { s } _ { s , h } , a ) = 0$ and $\bar { p } ( \bar { s } _ { s ^ { \prime } , 1 } \mid \bar { s } _ { s , h } , a ) = I [ s ^ { \prime } = s _ { 1 } ]$ for a fixed starting state $s _ { 1 }$ .
627
+
628
+ For a trajectory $\left\{ { \left( { \bar { s } } _ { s _ { 1 } , 1 } , { \bar { a } } _ { 1 } \right) } , { \left( { \bar { s } } _ { s _ { 2 } , 2 } , { \bar { a } } _ { 2 } \right) } , \cdot \cdot \cdot \right\}$ in $\bar { \mathcal { M } }$ , let $\{ ( s _ { 1 } , a _ { 1 } ) , ( s _ { 2 } , a _ { 2 } ) , \cdot \cdot \cdot \}$ be the corresponding trajectory in $\mathcal { M }$ . Note that $\mathcal { M }$ has a unique fixed starting state $s _ { 1 }$ , which means that $s _ { t H + 1 } = s _ { 1 }$ for all $t \geq 0$ . Denote the corresponding policy of $\bar { \pi } ^ { t }$ as $\pi ^ { t }$ (may be non-stationary), then we have
629
+
630
+ $$
631
+ \begin{array} { r l } & { \bar { \gamma } ^ { \pi ^ { t } } ( \bar { s } _ { s _ { 1 } , 1 } ) = \mathbb { E } \left[ \bar { r } ( \bar { s } _ { s _ { 1 } , 1 } , \bar { a } _ { 1 } ) + \gamma \bar { r } ( \bar { s } _ { s _ { 2 } , 2 } , \bar { a } _ { 2 } ) + \cdot \cdot \cdot + \gamma ^ { H - 1 } \bar { r } ( \bar { s } _ { s _ { H - 1 } , H - 1 } , \bar { a } _ { H - 1 } ) + \gamma ^ { H } \bar { V } ^ { \pi _ { t + H - 1 } } ( \bar { s } _ { s _ { H + 1 } , 1 } ) \right] } \\ & { \phantom { \frac { 1 } { 1 } } = \gamma ^ { H } \mathbb { E } \left[ r _ { 1 } ( s _ { 1 } , a _ { 1 } ) + r _ { 2 } ( s _ { 2 } , a _ { 2 } ) + \cdot \cdot \cdot + r _ { H - 1 } ( s _ { H - 1 } , a _ { H - 1 } ) + \bar { V } ^ { \pi _ { t + H } } ( \bar { s } _ { s _ { H + 1 } , 1 } ) \right] } \\ & { \phantom { \frac { 1 } { 1 } } = \gamma ^ { H } V ^ { \pi ^ { t } } ( s _ { 1 } ) + \gamma ^ { H } \bar { V } ^ { \pi + H } ( \bar { s } _ { s _ { 1 } , 1 } ) . } \end{array}
632
+ $$
633
+
634
+ Then for a stationary policy $\bar { \pi }$ , we can conclude $\begin{array} { r } { \bar { V } ^ { \bar { \pi } } ( \bar { s } _ { s _ { 1 } , 1 } ) = \frac { \gamma ^ { H } } { 1 - \gamma ^ { H } } V ^ { \pi } ( s _ { 1 } ) } \end{array}$ . Since the optimal policy $\bar { \pi } ^ { * }$ is stationary, we have $\begin{array} { r } { \bar { V } ^ { \ast } ( \bar { s } _ { s _ { 1 } , 1 } ) = \frac { \gamma ^ { H } } { 1 - \gamma ^ { H } } V ^ { \ast } ( s _ { 1 } ) } \end{array}$ .
635
+
636
+ By definition, $\bar { \pi }$ is $\epsilon$ -optimal at time step $t$ means that
637
+
638
+ $$
639
+ \begin{array} { r } { \bar { V } ^ { \bar { \pi } ^ { t } } ( \bar { s } _ { s _ { 1 } , 1 } ) \geq \bar { V } ^ { * } ( \bar { s } _ { s _ { 1 } , 1 } ) - \epsilon . } \end{array}
640
+ $$
641
+
642
+ It follows that
643
+
644
+ $$
645
+ \gamma ^ { H } V ^ { \pi ^ { t } } ( s _ { 1 } ) + \gamma ^ { H } \bar { V } ^ { \pi _ { t + H } } ( \bar { s } _ { s _ { 1 } , 1 } ) = \bar { V } ^ { \bar { \pi } } ( \bar { s } _ { s _ { 1 } , 1 } ) \geq \bar { V } ^ { * } ( \bar { s } _ { s _ { 1 } , 1 } ) - \epsilon ,
646
+ $$
647
+
648
+ hence
649
+
650
+ $$
651
+ ^ { H } V ^ { \pi ^ { \varepsilon } } ( s _ { 1 } ) \geq ( 1 - \gamma ^ { H } ) \bar { V } ^ { * } ( \bar { s } _ { s _ { 1 } , 1 } ) + \gamma ^ { H } ( \bar { V } ^ { * } ( \bar { s } _ { s _ { 1 } , 1 } ) - \bar { V } ^ { \pi _ { t + H } } ( \bar { s } _ { s _ { 1 } , 1 } ) ) - \epsilon \geq ( 1 - \gamma ^ { H } ) \bar { V } ^ { * } ( \bar { s } _ { s _ { 1 } , 1 } ) - \epsilon .
652
+ $$
653
+
654
+ Therefore we have
655
+
656
+ $$
657
+ { V ^ { \pi } } ^ { t } ( s _ { 1 } ) \ge \frac { 1 - \gamma ^ { H } } { \gamma ^ { H } } \bar { V } ^ { * } ( \bar { s } _ { s 1 , 1 } ) - \epsilon / \gamma ^ { H } = V ^ { * } ( s _ { 1 } ) - \epsilon / \gamma ^ { H } ,
658
+ $$
659
+
660
+ which means that $\pi ^ { t }$ is an $( \epsilon / \gamma ^ { H } )$ -optimal policy.
661
+
662
+ # D A HARD INSTANCE FOR DELAYED Q-LEARNING
663
+
664
+ In this section, we prove Theorem 2 regarding the performance of Delayed Q-learning.
665
+
666
+ Theorem 2. There exists a family of MDPs with constant $S$ and $A$ , in which with probability $1 - \delta$ , Delayed $Q$ -learning incurs sample complexity of exploration of $\Omega \left( \frac { \epsilon ^ { - 3 } } { \ln ( 1 / \delta ) } \right)$ , assuming that $\ln ( 1 / \delta ) < \epsilon ^ { - 2 }$ .
667
+
668
+ ![](images/d5ea7466679255528080a8e623d46ab5efe02c60983c67939e2c04d8974b3167.jpg)
669
+ Figure 1: The MDP family. Actions are denoted by arrows. Actions with red color have reward 1, and reward 0 otherwise.
670
+
671
+ Proof. For each $0 < \epsilon < \frac { 1 } { 1 0 }$ , consider the following MDP (see also Fig. 1): state space is ${ \boldsymbol { s } } =$ $\{ a , b , c \}$ while action set is $\overset { \vartriangle } { \mathcal { A } } = \{ \ v { x } , \ v { y } \}$ ; transition probabilities are $P ( b | a , y ) = 1 - 1 0 \epsilon$ , $P ( c | a , y ) =$ 10, $P ( b | a , x ) = 1$ , $P ( a | b , \cdot ) = P ( a | c , \cdot ) = 1$ . Rewards are all 1, except $R ( c , \cdot ) = 0$ .
672
+
673
+ Assume that Delayed Q-learning is called for this MDP starting from state $a$ , with discount $\begin{array} { r } { \gamma > \frac { 1 } { 2 } } \end{array}$ and precision set as $\epsilon$ . Denote the $Q$ value maintained by the algorithm by $\hat { Q }$ . Without loss of generality, assume that the initial tie-breaking favors action $y$ when comparing $\hat { Q } ( a , x )$ and $\hat { Q } ( a , y )$ . In that case, unless $\hat { Q } ( a , y )$ is updated, the agent will always choose $y$ in state $a$ . Since $Q ( a , x ) - Q ( a , y ) = 1 0 \epsilon \gamma > \epsilon$ for any policy, choosing $y$ at state $a$ implies that the timestep is not $\epsilon$ -optimal. In other words, sample complexity for exploration is at least the number of times the agent visits $a$ before the first update of $\hat { Q } ( a , y )$ .
674
+
675
+ In the Delayed Q-learning algorithm, $\hat { Q } ( \cdot , \cdot )$ are initialized to $1 / ( 1 - \gamma )$ . Therefore, $\hat { Q } ( a , y )$ could only be updated if max $\hat { Q } ( c , \cdot )$ is updated (and becomes smaller than $1 / ( 1 - \gamma ) )$ . According to the algorithm, this can only happen if $c$ is visited $\begin{array} { r } { m = \Omega \left( \frac { 1 } { \epsilon ^ { 2 } } \right) } \end{array}$ times.
676
+
677
+ However, each time the agent visits $a$ , there is less than $1 0 \epsilon$ probability of transiting to $c$ . Let $t _ { 0 } = m / ( 1 0 \epsilon C )$ , where $\begin{array} { r } { C ^ { ' } = 3 \ln \frac { 1 } { \delta } + 1 } \end{array}$ . $\delta$ is chosen such that $C \leq m$ . In the first $2 t _ { 0 }$ timesteps, $a$ will be visited $t _ { 0 }$ times. By Chernoff’s bound, with probability $1 - \delta$ , state $c$ will be visited less than $m$ times. In that case, $\hat { Q } ( a , y )$ will not be updated in the first $2 t _ { 0 }$ timesteps. Therefore, with probability $1 - \delta$ , sample complexity of exploration is at least
678
+
679
+ $$
680
+ t _ { 0 } = \Omega \left( { \frac { 1 } { \epsilon ^ { 3 } \left( \ln { 1 / \delta } \right) } } \right) .
681
+ $$
682
+
683
+ When $\ln ( 1 / \delta ) < \epsilon ^ { - 2 }$ , it can be seen that $\begin{array} { r } { C = 3 \ln \frac { 1 } { \delta } + 1 < \frac { 4 } { \epsilon ^ { 2 } } < m } \end{array}$
md/train/BkgnhTEtDS/BkgnhTEtDS.md ADDED
@@ -0,0 +1,381 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # FEATURE INTERACTION INTERPRETABILITY: A CASE FOR EXPLAINING AD-RECOMMENDATION SYSTEMS VIA NEURAL INTERACTION DETECTION
2
+
3
+ Michael Tsang1, Dehua Cheng2, Hanpeng $\mathbf { L i u } ^ { 1 }$ , Xue Feng2, Eric Zhou2, and Yan Liu1
4
+
5
+ 1Department of Computer Science, University of Southern California {tsangm,hanpengl,yanliu.cs}@usc.edu 2Facebook AI {dehuacheng,xfeng,hanningz}@fb.com
6
+
7
+ # ABSTRACT
8
+
9
+ Recommendation is a prevalent application of machine learning that affects many users; therefore, it is important for recommender models to be accurate and interpretable. In this work, we propose a method to both interpret and augment the predictions of black-box recommender systems. In particular, we propose to interpret feature interactions from a source recommender model and explicitly encode these interactions in a target recommender model, where both source and target models are black-boxes. By not assuming the structure of the recommender system, our approach can be used in general settings. In our experiments, we focus on a prominent use of machine learning recommendation: ad-click prediction. We found that our interaction interpretations are both informative and predictive, e.g., significantly outperforming existing recommender models. What’s more, the same approach to interpret interactions can provide new insights into domains even beyond recommendation, such as text and image classification.
10
+
11
+ # 1 INTRODUCTION
12
+
13
+ Despite their impact on users, state-of-the-art recommender systems are becoming increasingly inscrutable. For example, the models that predict if a user will click on an online advertisement are often based on function approximators that contain complex components in order to achieve optimal recommendation accuracy. The complex components come in the form of modules for better learning relationships among features, such as interactions between user and ad features (Cheng et al., 2016; Guo et al., 2017; Wang et al., 2017; Lian et al., 2018; Song et al., 2018). Although efforts have been made to understand the feature relationships, there is still no method that can interpret the feature interactions learned by a generic recommender system, nor is there a strong commercial incentive to do so.
14
+
15
+ In this work, we identify and leverage feature interactions that represent how a recommender system generally behaves. We propose a novel approach, Global Interaction Detection and Encoding for Recommendation (GLIDER), which detects feature interactions that span globally across multiple data-instances from a source recommender model, then explicitly encodes the interactions in a target recommender model, both of which can be black-boxes. GLIDER achieves this by first utilizing our ongoing work on Neural Interaction Detection (NID) (Tsang et al., 2017) with a data-instance perturbation method called LIME (Ribeiro et al., 2016) over a batch of data samples. GLIDER then explicitly encodes the collected global interactions into a target model via sparse feature crossing.
16
+
17
+ In our experiments on ad-click recommendation, we found that the interpretations generated by GLIDER are illuminating, and the detected global interactions can significantly improve the target model’s prediction performance. Because our interaction interpretation method is very general, we also show that the interpretations are informative in other domains: text, image, graph, and dna modeling.
18
+
19
+ ![](images/4466c0e81da8a74a15b634b7bf739e402759928deaf08519a126b360b7d8e755.jpg)
20
+ Figure 1: A simplified overview of GLIDER. $\textcircled{1}$ GLIDER utilizes Neural Interaction Detection and LIME together to interpret feature interactions learned by a source black-box model at a data instance, denoted by the large green plus sign. $\textcircled{2}$ GLIDER identifies interactions that consistently appear over multiple data samples, then explicitly encodes these interactions in a target black-box recommender model $f _ { r e c }$ .
21
+
22
+ Our contributions are as follows:
23
+
24
+ 1. We propose feature interaction interpretations of general prediction models via interaction detection.
25
+ 2. Based on this approach, we propose GLIDER to detect and explicitly encode global feature interactions in black-box recommender systems. This process is a form of automatic feature engineering.
26
+ 3. Through experiments, we demonstrate the overall interpretability of detected feature interactions on a variety of domains and show that the interactions can be leveraged to improve recommendation accuracy.
27
+
28
+ # 2 NOTATIONS AND BACKGROUND
29
+
30
+ Notations: Vectors are represented by boldface lowercase letters, such as $\mathbf { x }$ or $\mathbf { z }$ . The $i$ -th entry of a vector $\mathbf { x }$ is denoted by $x _ { i }$ . For a set $s$ , its cardinality is denoted by $| S |$ .
31
+
32
+ Let $d$ be the number of features in a dataset. An interaction, $\mathcal { T }$ , is a subset of feature indices: ${ \mathcal { T } } \subseteq \{ 1 , 2 , \ldots , d \}$ , where $| \mathcal { T } |$ is always $\geq 2$ . A higher-order interaction always has $| \mathcal { T } | \geq 3$ . For a vector $\mathbf { x } \in \mathbb { R } ^ { d }$ , let $\mathbf { x } _ { \mathcal { I } } \in \mathbb { R } ^ { | \mathcal { I } | }$ be restricted to the dimensions of $\mathbf { x }$ specified by $\mathcal { T }$ .
33
+
34
+ Let a black-box model be $f ( \cdot ) : \mathbb { R } ^ { p } \mathbb { R }$ . A black-box recommender model uses tabular feature types, as discussed later in this section. In classification tasks, we assume $f$ is a class logit. $p$ and $d$ may be different depending on feature transformations.
35
+
36
+ Feature Interactions: By definition, a model $f$ learns a statistical (non-additive) feature interaction $\mathcal { T }$ if and only if $f$ cannot be decomposed into a sum of $| \mathcal { T } |$ arbitrary subfunctions $f _ { i }$ , each excluding a corresponding interaction variable (Friedman et al., 2008; Sorokina et al., 2008; Tsang et al., 2017), i.e., $\begin{array} { r } { f ( \mathbf { x } ) \neq \bar { \sum } _ { i \in \mathcal { T } } f _ { i } ( \mathbf { x } _ { \{ 1 , 2 , \ldots , d \} \backslash i } ) } \end{array}$ .
37
+
38
+ For example, a multiplication between two features, $x _ { 1 }$ and $x _ { 2 }$ , is a feature interaction because it cannot be represented as an addition of univariate functions, i.e., $x _ { 1 } x _ { 2 } \neq f _ { 1 } ( x _ { 2 } ) + f _ { 2 } ( x _ { 1 } )$ .
39
+
40
+ Recommendation Systems: A recommender system, $f _ { r e c } ( \cdot )$ , is a model of two feature types: dense numerical features and sparse categorical features. Since the one-hot encoding of categorical feature $x _ { c }$ can be high-dimensional, it is commonly represented in a low-dimensional embedding $\scriptstyle \mathbf { e } _ { c } \ =$ $o n e \mathbf { \mathcal { - } } h o t ( x _ { c } ) \mathbf { V } _ { c }$ via embedding matrix $\mathbf { V } _ { c }$ .
41
+
42
+ # 3 FEATURE INTERACTIONS IN BLACK-BOX MODELS
43
+
44
+ We start by explaining how to obtain a data-instance level (local) interpretation of feature interactions by utilizing interaction detection on feature perturbations.
45
+
46
+ # 3.1 FEATURE PERTURBATION AND INFERENCE
47
+
48
+ Given a data instance $\mathbf { x } \in \mathbb { R } ^ { p }$ , LIME proposed to perturb the data instance by sampling a separate binary representation $\tilde { \mathbf { x } } \in \{ 0 , 1 \} ^ { d }$ of the same data instance. Let $\xi : \{ 0 , 1 \} ^ { d } \overset { \cdot } { } \mathbb { R } ^ { p }$ be the map from the binary representation to the perturbed data instance. Starting from a binary vector of all ones that map to the original features values in the data instance, LIME uniformly samples the number of random features to switch to 0 or the “off” state. In the data instance, “off” could correspond to a 0 embedding vector for categorical features or mean value over a batch for numerical features. It is possible for $d < p$ by grouping features in the data instance to correspond to single binary features in $\tilde { \bf x }$ . An important step is getting black-box predictions of the perturbed data instances to create a dataset with binary inputs and prediction targets: $\mathcal { D } = \{ ( \tilde { \mathbf { x } } _ { i } , y _ { i } ) ~ | ~ y _ { i } = f ( \xi ( \tilde { \mathbf { x } } _ { i } ) ) , \tilde { \mathbf { x } } _ { i } \in \{ 0 , 1 \} ^ { d } \}$ . Though we use LIME’s approach, the next section is agnostic to the instance perturbation method.
49
+
50
+ # 3.2 FEATURE INTERACTION DETECTION
51
+
52
+ Feature interaction detection is concerned with identifying feature interactions in a dataset (Bien et al., 2013; Purushotham et al., 2014; Lou et al., 2013; Friedman et al., 2008). Typically, proper interaction detection requires a pre-processing step to remove correlated features that adversely affect detection performance (Sorokina et al., 2008). As long as features in dataset $\mathcal { D }$ are generated in an uncorrelated fashion, e.g., through random sampling, we can directly use $\mathcal { D }$ to detect feature interactions from black-box model $f$ at data instance x.
53
+
54
+ # 3.2.1 NEURAL INTERACTION DETECTION
55
+
56
+ $f$ can be an arbitrary function and can generate highly nonlinear targets in $\mathcal { D }$ , so we focus on detecting interactions that could have generic forms. In light of this, we leverage our method, Neural Interaction Detection (NID) (Tsang et al., 2017), which accurately and efficiently detects generic non-additive and arbitrary-order statistical feature interactions. NID detects these interactions by training a lasso-regularized multilayer perceptron (MLP) on a dataset, then identifying the features that have high-magnitude weights to common hidden units. NID is efficient by greedily testing the top-interaction candidates of every order at each of $h$ first-layer hidden units, enabling arbitraryorder interaction detection in $O ( h d )$ tests within one MLP.
57
+
58
+ # 3.2.2 GRADIENT-BASED NEURAL INTERACTION DETECTION
59
+
60
+ Besides the non-additive definition of statistical interaction, a gradient definition also exists based on mixed partial derivatives (Friedman et al., 2008), i.e., a function $F ( \cdot )$ exhibits statistical interaction $\mathcal { T }$ among features $z _ { i }$ indexed by $i _ { 1 } , i _ { 2 } , \dotsc , i _ { | \mathcal { T } | } \in \mathcal { T }$ if
61
+
62
+ $$
63
+ E _ { \mathbf { z } } \left[ \frac { \partial ^ { | \mathcal { T } | } F ( \mathbf { z } ) } { \partial z _ { i _ { 1 } } \partial z _ { i _ { 2 } } \dots \partial z _ { i _ { | \mathcal { T } | } } } \right] ^ { 2 } > 0 .
64
+ $$
65
+
66
+ The advantage of this definition is that it allows exact interaction detection from model gradients (Ai & Norton, 2003); however, this definition contains a computationally expensive expectation, and typical neural networks with ReLU activation functions do not permit mixed partial derivatives. For the task of local interpretation, we only examine a single data instance $\mathbf { x }$ , which avoids the expectation. We turn $F$ into an MLP $g ( \cdot )$ with smooth, infinitely-differentiable activation functions such as softplus, which closely follows ReLU (Glorot et al., 2011). We then train the MLP with the same purpose as $\ S 3 . 2 . 1$ to faithfully capture interactions in perturbation dataset $\mathcal { D }$ . Given these conditions, we define an alternate gradient-based neural interaction detector (GradientNID) as:
67
+
68
+ $$
69
+ \omega ( \mathcal { T } ) = \left( \frac { \partial ^ { | \mathcal { T } | } g ( \tilde { \mathbf { x } } ) } { \partial \tilde { x } _ { i _ { 1 } } \partial \tilde { x } _ { i _ { 2 } } \hdots \partial \tilde { x } _ { i _ { | \mathcal { T } | } } } \right) ^ { 2 } ,
70
+ $$
71
+
72
+ where $\omega$ is the strength of the interaction $\mathcal { T }$ , $\tilde { \mathbf { x } }$ is the representation of $\mathbf { x }$ , and the MLP $g$ is trained on $\mathcal { D }$ . While GradientNID exactly detects interactions from the explainer MLP, it needs to compute interaction strengths $\omega$ for feature combinations that grow exponentially in number as $| \mathcal { T } |$ increases. We recommend restricting GradientNID to low-order interactions.
73
+
74
+ Algorithm 1 Global Interaction Detection in GLIDER
75
+
76
+ <table><tr><td>Input: dataset B, recommender model frec Output: G = {(Ii,ci)}: global interactions Ii and their counts ci over the dataset</td></tr><tr><td>1:G ← initialize occurrence dictionary for global interactions</td></tr><tr><td>2:for each data sample x within dataset B do</td></tr><tr><td>3: S ← MADEX(frec, X)</td></tr><tr><td>4: G ← increment the occurrence count of Ij ∈ S, ∀j = 1,2,...,|S|</td></tr><tr><td>5: sort G by most frequently occurring interactions</td></tr><tr><td>6:[optional prune subset interactions in G within a target number of interactions K</td></tr></table>
77
+
78
+ # 3.3 SCOPE
79
+
80
+ Based on $\ S 3 . 1$ and $\ S 3 . 2$ , we define a function, $\mathtt { M A D E X } ( f , \mathbf { x } )$ , that takes as inputs black-box $f$ and data instance $\mathbf { x }$ , and outputs ${ \cal { S } } = \{ { \cal { T } } _ { i } \} _ { i = 1 } ^ { k }$ , a set of top- $k$ detected feature interactions. MADEX stands for “Model-Agnostic Dependency Explainer”.
81
+
82
+ In some cases, it is necessary to identify a $k$ threshold. Because of the importance of speed for local interpretations, we simply use a linear regression with additional multiplicative terms to approximate the gains given by interactions in $s$ , where $k$ starts at 0 and is incremented until the linear model’s predictions stop improving.
83
+
84
+ # 4 GLIDER: GLOBAL INTERACTION DETECTION AND ENCODING FOR RECOMMENDATION
85
+
86
+ We now discuss the different components of GLIDER: detecting global interactions in $\ S 4 . 1$ , then encoding these interactions in recommender systems in $\ S 4 . 2$ . Recommender systems are interesting because they have pervasive application in real-world systems, and their features are often very sparse. By sparse features, we mean features with many categories, e.g., millions of user IDs. The sparsity makes interaction detection challenging especially when applied directly on raw data because the one-hot encoding of sparse features creates an extremely large space of potential feature combinations (Fan et al., 2015).
87
+
88
+ # 4.1 GLOBAL INTERACTION DETECTION
89
+
90
+ In this section, we explain the first step of GLIDER. As defined in $\ S 3 . 3$ , MADEX takes as input a blackbox model $f$ and data instance $\mathbf { x }$ . In the context of this section, MADEX inputs a source recommender system $f _ { r e c }$ and data instance $\mathbf { x } = [ x _ { 1 } , x _ { 2 } , \ldots , x _ { p } ]$ . $x _ { i }$ is the $i$ -th feature field and is either a dense or sparse feature. $p$ is both the total number of feature fields and the number of perturbation variables $( p = d )$ ). We define global interaction detection as repeatedly running MADEX over a batch of data instances, then counting the occurrences of the same detected interactions, shown in Algorithm 1. The occurrence counts are not only a useful way to rank global interaction detections, but also a sanity check to rule out the chance that the detected feature combinations are random selections.
91
+
92
+ One potential concern with Alg. 1 is that it could be slow depending on the speed of MADEX. In our experiments, the entire process took less than one hour when run in parallel over a batch of 1000 samples with $\sim 4 0$ features on a 32-CPU server with 2 GPUs. This algorithm only needs to be run once to obtain the summary of global interactions.
93
+
94
+ # 4.2 TRUNCATED FEATURE CROSSES
95
+
96
+ The global interaction $\mathcal { T } _ { i }$ , outputted by Alg. 1, is used to create a synthetic feature $x _ { \mathcal { T } _ { i } }$ for a target recommender system. The synthetic feature $x _ { \mathcal { T } _ { i } }$ is created by explicitly crossing sparse features indexed in $\mathcal { T } _ { i }$ . If interaction $\mathcal { T } _ { i }$ involves dense features, we bucketize the dense features before crossing them. The synthetic feature is sometimes called a cross feature (Wang et al., 2017; Luo et al., 2019) or conjunction feature (Rosales et al., 2012; Chapelle et al., 2015).
97
+
98
+ In this context, a cross feature is an $n$ -ary Cartesian product among $n$ sparse features. If we denote $\mathcal { X } _ { 1 } , \mathcal { X } _ { 2 } , \ldots , \mathcal { X } _ { n }$ as the set of IDs for each respective feature $x _ { 1 } , x _ { 2 } , \ldots , x _ { n }$ , then their cross feature $x _ { \{ 1 , . . . , n \} }$ takes on all possible values in
99
+
100
+ $$
101
+ \mathcal { X } _ { 1 } \times \dots \times \mathcal { X } _ { n } = \{ ( x _ { 1 } , \dots , x _ { n } ) ~ | ~ x _ { i } \in \mathcal { X } _ { i } , \forall i = 1 , \dots , n \}
102
+ $$
103
+
104
+ Accordingly, the cardinality of this cross feature is $\left| { \mathcal { X } } _ { 1 } \right| \times \cdots \times \left| { \mathcal { X } } _ { n } \right|$ and can be extremely large, yet many combinations of values in the cross feature are likely unseen in the training data. Therefore, we generate a truncated form of the cross feature with only seen combinations of values, $\mathbf { x } _ { \mathcal { T } } ^ { ( j ) }$ , where $j$ is a sample index in the training data, and $\mathbf { x } _ { \mathcal { T } } ^ { ( j ) }$ is represented as a sparse ID in the cross feature $x \tau$ . We further reduce the cardinality by requiring the same cross feature ID to occur more than times in a batch of samples, or set to a default ID otherwise. These truncation steps significantly reduce the embedding sizes of each cross feature while maintaining their representation power. Once cross features $\{ x _ { \mathbb { Z } _ { i } } \bar \} _ { i }$ are included in a target recommender system, it can be trained as per usual.
105
+
106
+ # 4.3 MODEL DISTILLATION VS. ENHANCEMENT
107
+
108
+ There are dual perspectives of GLIDER: as a method for model distillation or model enhancement. If a strong source model is used to detect global interactions which are then encoded in more resourceconstrained target models, then GLIDER adopts a teacher-student type distillation process. If interaction encoding augments the same model where the interactions were detected from, then GLIDER tries to enhance the model’s ability to represent the interactions.
109
+
110
+ # 5 RELATED WORKS
111
+
112
+ Interaction Interpretations: A variety of methods exist to detect feature interactions learned in specific models but not black-box models. For example, RuleFit (Friedman et al., 2008), Additive Groves (Sorokina et al., 2008), and Tree-Shap (Lundberg et al., 2018) detect interactions specifically in trees; likewise PaD2 (Gevrey et al., 2006) and NID (Tsang et al., 2017) detect interactions in multilayer perceptrons. Some methods have attempted to interpret feature groups in black-box models, such as Anchors (Ribeiro et al., 2018), Agglomerative Contextual Decomposition (Singh et al., 2019), and Context-Aware methods (Singla et al., 2019); however, these methods were not intended to identify feature interactions.
113
+
114
+ Explicit Interaction Representation: There are increasingly methods for explicitly representing interactions in models. Cheng et al. (2016), Guo et al. (2017), Wang et al. (2017), and Lian et al. (2018) directly incorporate multiplicative cross terms in neural network architectures and Song et al. (2018) use attention as an interaction module, all of which are intended to improve the neural network’s function approximation. This line of work found that predictive performance can improve with dedicated interaction modeling. Luo et al. (2019) followed up by proposing feature sets from data then explicitly encoding them via feature crossing, but this method’s proposals are limited by beam search. Our work approaches this problem from a model interpretation standpoint.
115
+
116
+ Black-Box Local vs. Global Interpretations: Data-instance level local interpretation methods are more flexible at explaining general black-box models; however, global interpretations, which cover multiple data instances, have become increasingly desirable to summarize model behavior. Locally Interpretable Model-Agnostic Explanations (LIME) (Ribeiro et al., 2016) and Integrated Gradients (Sundararajan et al., 2017) are some of the most used methods to locally interpret any classifier and neural predictor respectively. There are some methods for global black-box interpretations, such as shuffle-based feature importance (Fisher et al., 2018), submodular pick (Ribeiro et al., 2016), and visual concept extraction (Kim et al., 2018). Our work offers a new tooling option.
117
+
118
+ # 6 EXPERIMENTS
119
+
120
+ # 6.1 SETUP
121
+
122
+ In our experiments, we study interaction interpretation and encoding on real-world data. The hyperparameters in MADEX are as follows. For all experiments, our perturbation datasets $\mathcal { D }$ contain 5000 training samples and 500 samples for each validation and testing. Our usage of NID or GradientNID as the interaction detector (§3.2) depends on the experimental setting. For all experiments that only examine single data instances, we use GradientNID for its exactness and pairwise interaction detection; otherwise, we use NID for its higher-order interaction detection. The MLPs for NID and GradientNID have architectures of 256-128-64 first-to-last hidden layer sizes, and they are trained with learning rate of $\mathrm { 1 e - 2 }$ , batchsize of 100, and the ADAM optimizer. NID uses ReLU activations and an $\ell _ { 1 }$ regularization of $\lambda _ { 1 } = 1 \mathrm { e } { - 4 }$ , whereas GradientNID uses softplus activations and a structural regularizer as MLP+linear regression, which we found offers strong test performance. In general, models are trained with early stopping on validation sets.
123
+
124
+ For LIME perturbations, we need to establish what a binary 0 maps to via $\xi$ in the raw data instance (§3.1). In domains involving embeddings, i.e., sparse features and word embeddings, the 0 (“off”) state is the zeroed embedding vector. For dense features, it is the mean feature value over a batch; for images, the mean superpixel RGB of the image. For our DNA experiment, we use a random nucleotide other than the original one. These settings correspond to what is used in literature (Ribeiro et al., 2016; 2018). In our graph experiment, the nodes within the neighborhood of a test node are perturbed, where each node is zeroed during perturbation.
125
+
126
+ # 6.2 EXPERIMENTS ON CTR RECOMMENDATION
127
+
128
+ In this section, we provide experiments with GLIDER on models trained for clickthrough-rate (CTR) prediction. The recommender models we study include commonly reported baselines, which all use neural networks: Wide&Deep (Cheng et al., 2016), DeepFM (Guo et al., 2017), Deep&Cross (Wang et al., 2017), xDeepFM (Lian et al., 2018), and AutoInt (Song et al., 2018).
129
+
130
+ Table 1: CTR dataset statistics
131
+
132
+ <table><tr><td>Dataset</td><td>#Samples</td><td>#Features</td><td>Total # Sparse IDs</td></tr><tr><td>Criteo</td><td>45,840,617</td><td>39</td><td>998,960</td></tr><tr><td>Avazu</td><td>40,428,967</td><td>23</td><td>1,544,428</td></tr></table>
133
+
134
+ AutoInt is the reported state-of-the-art in academic literature, so we use the model settings and data splits provided by AutoInt’s official public repository1. For all other recommender models, we use public implementations2 with the same original architectures reported in literature, set all embedding sizes to 16, and tune the learning rate and optimizer to reach or surpass the test logloss reported by the AutoInt paper (on AutoInt’s data splits). From tuning, we use the Adagrad optimizer (Duchi et al., 2011) with learning rate of 0.01. All models use early stopping on validation sets.
135
+
136
+ The datasets we use are benchmark CTR datasets with the largest number of features: Criteo3 and Avazu4, whose data statistics are shown in Table 1. Criteo and Avazu both contain $4 0 +$ millions of user records on clicking ads, with Criteo being the primary benchmark in CTR research (Cheng et al., 2016; Guo et al., 2017; Wang et al., 2017; Lian et al., 2018; Song et al., 2018; Luo et al., 2019).
137
+
138
+ # 6.2.1 GLOBAL INTERACTION DETECTION
139
+
140
+ ![](images/21fd470750d5dc6388234135b644ab855f21967212499be6c4e6a14e1650b3c7.jpg)
141
+ Figure 2: Occurrence counts (Total: 1000) vs. rank of detected interactions from AutoInt on Criteo and Avazu datasets. \* indicates a higher-order interaction (details in
142
+
143
+ For each dataset, we train a source AutoInt model, $f _ { r e c }$ , then run global interaction detection via Algorithm 1 on a batch of 1000 samples from the validation set. A full global detection experiment finishes in less than one hour when run in parallel on either Criteo or Avazu datasets in a 32-CPU Intel Xeon E5-2640 v2 $\textcircled { a } \ 2 . 0 0 \mathrm { G H z }$ server with 2 Nvidia 1080 Ti GPUs. The detection results across datasets are shown in Figure 2 Appendix G). as plots of detection counts versus rank. Because the Avazu dataset contains non-anonymized features, we directly show its top-10 detected global interactions in Table 2a.
144
+
145
+ Table 2: Understanding feature interactions: top global feature interactions for (a) an ad targeting system via Algorithm 1 and (b) a text sentiment analyzer via $\ S 6 . 3 . 2$ (later). The tables are juxtaposed to assist in understanding feature interactions, i.e., nuanced changes among interacting variables lead to significant changes in prediction probabilities. The prediction outcomes are ad-clicks by users for (a) and text sentiment for (b).
146
+ (a) Explanation of an ad targeting system
147
+
148
+ <table><tr><td>Count (Total:1000)</td><td>Interaction</td></tr><tr><td>525</td><td>{device_ip,hour}</td></tr><tr><td>235</td><td>{device_id,device_ip,hour}</td></tr><tr><td>217</td><td>{device_id,app-id}</td></tr><tr><td>203</td><td>{device_ip,device_model, hour}</td></tr><tr><td>194</td><td>{site_id, site_domain}</td></tr><tr><td>190</td><td>{site_id, hour}</td></tr><tr><td>187</td><td>{device_ip,site_id,hour}</td></tr><tr><td>183</td><td>{site_id,site_domain,hour}</td></tr><tr><td>179</td><td>{device_id,hour}</td></tr><tr><td>179</td><td>{device_id,device_ip,device_model,hour}</td></tr></table>
149
+
150
+ (b) Explanation of a sentiment analyzer
151
+
152
+ <table><tr><td>Count (Total:40)</td><td>Interaction (ordered)</td></tr><tr><td>36</td><td>never, fails</td></tr><tr><td>30</td><td>suspend,disbelief</td></tr><tr><td>30</td><td>too, bad</td></tr><tr><td>29</td><td>very, funny</td></tr><tr><td>29</td><td>neither, nor</td></tr><tr><td>28</td><td>not, miss</td></tr><tr><td>27</td><td>recent, memory</td></tr><tr><td>27</td><td>not, good</td></tr><tr><td>26</td><td>no,denying</td></tr><tr><td>25</td><td>not, bad</td></tr></table>
153
+
154
+ From Figure 2, we see that the same interactions are detected very frequently across data instances, and many of the interactions are higher-order interactions. The interaction counts are very significant. For example, any top-1 occurrence count $> 2 5$ is significant for the Criteo dataset $( p < 0 . 0 5 ) $ , and likewise $> 7 1$ for the Avazu dataset, assuming a conservative search space of only up to 3-way interactions ( $| \mathcal { I } | \le 3 )$ . Our top-1 occurrence counts are 691 $\left( \gg 2 5 \right)$ ) for Criteo and 525 $( \gg 7 1 )$ ) for Avazu.
155
+
156
+ In Table 2a, the top-interactions are explainable. For example, the interaction between “device ip” and “hour” (in UTC time) makes sense because users - here identified by IP addresses - have ad-click behaviors dependent on their time zones. This is a general theme with many of the top-interactions5. As another example, the interaction between “device id” and “app id” makes sense because ads are targeted to users based on the app they’re in.
157
+
158
+ # 6.2.2 INTERACTION ENCODING
159
+
160
+ Based on our results from the previous section $( \ S 6 . 2 . 1 )$ , we turn our attention to explicitly encoding the detected global interactions in target baseline models via truncated feature crosses (detailed in $\ S 4 . 2 )$ . In order to generate valid cross feature IDs, we bucketize dense features into a maximum of 100 bins before crossing them and require that final cross feature IDs occur more than $T = 1 0 0$ times over a training batch of one million samples.
161
+
162
+ We take AutoInt’s top- $K$ global interactions on each dataset from $\ S 6 . 2 . 1$ with subset interactions excluded (Algorithm 1, line 6) and encode the interactions in each baseline model including AutoInt itself. $K$ is tuned on valiation sets, and model hyperparameters are the same between a baseline and one with encoded interactions. We set $K = 4 0$ for Criteo and $K = 1 0$ for Avazu.
163
+
164
+ In Table 3, we found that GLIDER often obtains significant gains in performance based on standard deviation, and GLIDER often reaches or exceeds a desired 0.001 improvement for the Criteo dataset (Cheng et al., 2016; Guo et al., 2017; Wang et al., 2017; Song et al., 2018). The improvements are especially visible with DeepFM on Criteo. We show how this model’s test performance varies with different $K$ in Figure 3. All performance gains are obtained at limited cost of extra model parameters (Table 4) thanks to the truncations applied to our cross features. To avoid extra parameters entirely, we recommend feature selection on the new and existing features.
165
+
166
+ One one hand, the evidence that AutoInt’s detected interactions can improve other baselines’ performance suggests the viability of interaction distillation. On the other hand, evidence that AutoInt’s performance on Criteo can improve using its own detected interactions suggests that AutoInt may benefit from learning interactions more explicitly. In either model distillation or enhancement settings, we found that GLIDER performs especially well on industry production models trained on large private datasets with thousands of features.
167
+
168
+ Table 3: Test prediction performance by encoding top- $K$ global interactions in baseline recommender systems on the Criteo and Avazu datasets (5 trials). $K$ are 40 and 10 for Criteo and Avazu respectively. $^ { 6 6 } +$ GLIDER” means the inclusion of detected global interactions to corresponding baselines. The “Setting” column is labeled relative to the source of detected interactions: AutoInt. \* scores by Song et al. (2018).
169
+
170
+ <table><tr><td rowspan="2">Setting</td><td rowspan="2">Model</td><td colspan="2">Criteo</td><td colspan="2">Avazu</td></tr><tr><td>AUC</td><td>logloss</td><td>AUC</td><td>logloss</td></tr><tr><td rowspan="7">Distillation</td><td>Wide&amp;Deep +GLIDER</td><td>0.8069 ± 5e-4</td><td>0.4446 ± 4e-4</td><td>0.7794± 3e-4</td><td>0.3804 ± 2e-4</td></tr><tr><td>DeepFM</td><td>0.8080±3e-4 0.8079 ± 3e-4</td><td>0.4436 ± 3e-4 0.4436± 2e-4</td><td>0.7795 ± 1e-4 0.7792 ± 3e-4</td><td>0.3802 ± 9e-5 0.3804±9e-5</td></tr><tr><td>+ GLIDER</td><td>0.8097± 2e-4</td><td>0.4420±2e-4</td><td>0.7795 ± 2e-4</td><td>0.3802 ± 2e-4</td></tr><tr><td>Deep&amp;Cross</td><td>0.8076 ± 2e-4</td><td>0.4438± 2e-4</td><td>0.7791 ± 2e-4</td><td>0.3805± 1e-4</td></tr><tr><td>+ GLIDER</td><td>0.8086±3e-4</td><td>0.4428± 2e-4</td><td>0.7792 ± 2e-4</td><td>0.3803 ± 9e-5</td></tr><tr><td>xDeepFM</td><td>0.8084± 2e-4</td><td>0.4433 ± 2e-4</td><td>0.7785± 3e-4</td><td>0.3808 ± 2e-4</td></tr><tr><td>+ GLIDER</td><td>0.8097±3e-4</td><td>0.4421± 3e-4</td><td>0.7787 ± 4e-4</td><td>0.3806± 1e-4</td></tr><tr><td rowspan="2">Enhancement</td><td>AutoInt *</td><td>0.8083</td><td>0.4434</td><td>0.7774</td><td></td></tr><tr><td></td><td></td><td></td><td></td><td>0.3811</td></tr><tr><td></td><td>+ GLIDER</td><td>0.8090±2e-4</td><td>0.4426± 2e-4</td><td>0.7773 ± 1e-4</td><td>0.3811 ± 5e-5</td></tr></table>
171
+
172
+ Table 4: # parameters of the models in Table 3. M denotes million.
173
+
174
+ <table><tr><td>Model</td><td>Criteo</td><td>Avazu</td></tr><tr><td>Wide&amp;Deep</td><td>18.1M</td><td>27.3M</td></tr><tr><td>+ GLIDER</td><td>19.3M (+6.8%)</td><td>27.6M (+1.0%)</td></tr><tr><td>DeepFM + GLIDER</td><td>17.5M</td><td>26.7M</td></tr><tr><td></td><td>18.3M (+4.8%)</td><td>26.9M(+0.6%)</td></tr><tr><td>Deep&amp;Cross + GLIDER</td><td>17.5M 18.7M (+6.9%)</td><td>26.1M 26.4M (+1.0%)</td></tr><tr><td>xDeepFM</td><td></td><td></td></tr><tr><td>+ GLIDER</td><td>18.5M 21.7M(+17.2%)</td><td>27.6M 28.3M (+2.5%)</td></tr><tr><td></td><td></td><td></td></tr><tr><td>AutoInt</td><td>16.4M</td><td>25.1M</td></tr><tr><td>+ GLIDER</td><td>17.3M (+5.1%)</td><td>25.2M(+0.6%)</td></tr></table>
175
+
176
+ ![](images/b6ae74e4f4ccf7c978df8ac6ef414f4d23615cdc387f916b8944875db9cde694.jpg)
177
+ Figure 3: Test logloss vs. $K$ of DeepFM on the Criteo dataset (5 trials).
178
+
179
+ # 6.3 INTERPRETATIONS ON OTHER DOMAINS
180
+
181
+ Since the proposed interaction interpretations are not entirely limited to recommender systems, we demonstrate interpretations on more general black-box models. Specifically, we experiment with the function MADEX $( \cdot )$ defined in $\ S 3 . 3$ , which inputs a black-box $f$ , data-instance x, and outputs a set of top- $k$ interactions. The models we use are trained on very different tasks, i.e., ResNet152: an image classifier pretrained on ImageNet ‘14 (Russakovsky et al., 2015; He et al., 2016), Sentiment-LSTM: a 2-layer bi-directional long short-term memory network (LSTM) trained on the Stanford Sentiment Treebank (SST) (Socher et al., 2013; Tai et al., 2015), DNA-CNN: a 2-layer 1D convolutional neural network (CNN) trained on MYC-DNA binding data6 (Mordelet et al., 2013; Yang et al., 2013; Alipanahi et al., 2015; Zeng et al., 2016; Wang et al., 2018; Barrett et al., 2012), and GCN: a 3-layer Graph Convolutional Network trained on the Cora dataset (Kipf & Welling, 2016; Sen et al., 2008). In order to make informative comparisons to the linear LIME baseline, we use LIME’s sample weighting strategy and kernel size (0.25) in this section. We first provide quantitative validation for the detected interactions of all four models in $\ S 6 . 3 . 1$ , followed by qualitative results for ResNet152, Sentiment-LSTM, and DNA-CNN in $\ S 6 . 3 . 2$ .
182
+
183
+ # 6.3.1 QUANTITATIVE
184
+
185
+ To quantitatively validate our interaction interpretations of general black-box models, we measure the local explanation fidelity of the interactions via prediction performance. As suggested in $\ S 3 . 3$ and $\ S 4 . 2$ , encoding feature interactions is a way to increase a model’s function representation, but this also means that prediction performance gains over simpler first-order models (e.g., linear regression) is a way to test the significance of the detected interactions. In this section, we use neural network function approximators for each top-interaction from the ranking $\{ \mathcal { T } _ { i } \}$ given by MADEX’s interaction detector (in this case NID). Similar to the $k$ -thresholding description in $\ S 3 . 3$ , we start at $k = 0$ , which is a linear regression, then increment $k$ with added MLPs for each $\mathcal { T } _ { i }$ among $\{ \mathcal { T } _ { i } \} _ { i = 1 } ^ { k }$ until validation performance stops improving, denoted at $k = L$ . The MLPs all have architectures of 64-32-16 first-to-last hidden layer sizes and use the binary perturbation dataset $\mathcal { D }$ (from $\ S 3 . 1 \rrangle$ .
186
+
187
+ Table 5: Prediction performance (mean-squared error; lower is better) with $( k > 0 )$ ) and without $( k \ = \ 0$ ) interactions for random data instances in the test sets of respective black-box models. $k = L$ corresponds to the interaction at a rank threshold. $2 \le k < L$ are excluded because not all instances have 2 or more interactions. Only results with detected interactions are shown. At least $9 4 \%$ $\left( \geq 1 8 8 \right)$ of the data instances had interactions across 5 trials for each model and score statistic.
188
+
189
+ <table><tr><td></td><td>k</td><td>DNA-CNN</td><td>Sentiment-LSTM</td><td>ResNet152</td><td>GCN</td></tr><tr><td>linear LIME</td><td>0</td><td>10e-3±le-3</td><td>8.0e-2±6e-3</td><td>1.9 ±0.1</td><td>7.1e3±7e2</td></tr><tr><td>MADEX (ours)</td><td>1</td><td>8e-3±2e-3</td><td>3.8e-2±6e-3</td><td>1.7 ± 0.1</td><td>5.7e3± 7e2</td></tr><tr><td>MADEX (ours)</td><td>L</td><td>5.0e-3±8e-4</td><td>0.4e-2±3e-3</td><td>0.9± 0.2</td><td>2e3±1e3</td></tr></table>
190
+
191
+ Test prediction performances are shown in Table 5 for $k \in \{ 0 , 1 , L \}$ . The average number of features of $\mathcal { D }$ among the black-box models ranges from 18 to 112. Our quantitative validation shows that adding feature interactions for DNA-CNN, SentimentLSTM, and ResNet152, and adding node interactions for GCN result in significant performance gains when averaged over 40 randomly selected data instances in the test set.
192
+
193
+ # 6.3.2 QUALITATIVE
194
+
195
+ For our qualitative analysis, we provide interaction interpretations via MADEX $( \cdot )$ of ResNet152, SentimentLSTM, and DNA-CNN on test samples. The interpretations are given by $\stackrel { \cdot } { S } = \{ { \cal T } _ { i } \} _ { i = 1 } ^ { k }$ , a set of $k$ detected interactions, which are shown in Figure 4 for ResNet152 and SentimentLSTM. For reference, we also show the top “main effects” by LIME’s original linear regression, which select the top-5 features that attribute towards the predicted class7.
196
+
197
+ In Figure 4a, the “interaction” columns show selected features from MADEX’s interactions between Quickshift superpixels (Vedaldi & Soatto, 2008; Ribeiro et al., 2016). To reduce the number of interactions per image, we merged interactions that have overlap coefficient $\geq ~ 0 . 5$ (Vijaymeena & Kavitha, 2016). From (a) ResNet152 interpretations
198
+
199
+ ![](images/97d9eca2b0f1db7ba92c2bdb92769a97a14f536e83b59ce74445caa04f4a5590.jpg)
200
+ top prediction: trolleybus, trolley coach, trackless trolley
201
+ Figure 4: Qualitative examples (more in Appendix D & E)
202
+
203
+ <table><tr><td rowspan="2">Original sentence</td><td rowspan="2">Predi- ction</td><td rowspan="2">Main effects</td><td colspan="2">Interactions (ours)</td></tr><tr><td>I</td><td>I</td></tr><tr><td>It never fails to engage us.</td><td>pos.</td><td>never, us</td><td>never, fails</td><td></td></tr><tr><td>The movie makes absolutely no sense.</td><td>neg.</td><td>no, sense</td><td>absolutely, no</td><td>no, sense</td></tr><tr><td>The central story lacks punch.</td><td>neg.</td><td>lacks</td><td>story, lacks</td><td>lacks, punch</td></tr></table>
204
+
205
+ the figure, we see that the interactions form a single region or multiple regions of the image. They also tend to be complementary to LIME’s main effects and are sometimes more informative. For example, the interpretations of the “shark” classification show that interaction detection finds the shark fin whereas main effects do not. Interpretations of Sentiment-LSTM are shown in Figure 4b, excluding common stop words (Appendix C). We again see the value of MADEX’s interactions, which show salient combinations of words, such as “never, fails”, “absolutely, no”, and “lacks, punch”.
206
+
207
+ In our experiments on DNA-CNN, we consistently detected the interaction between “CACGTG” nucleotides, which form a canonical DNA sequence (Staiger et al., 1989). The interaction was detected $9 7 . 3 \%$ out of 187 CACGTG appearances in the test set.
208
+
209
+ In order to run consistency experiments now on Sentiment-LSTM, word interactions need to be detected consistently across different sentences, which na¨ıvely would require an exorbitant amount of sentences. Instead, we initially collect interaction candidates by running MADEX over all sentences in the SST test set, then select the word interactions that appear multiple times. We assume that word interactions are ordered but not necessarily adjacent or positionally bound, e.g., (not, good) $\ne ( \mathrm { g o o d }$ , not), but their exact positions don’t matter. We use the larger IMDB dataset (Maas et al., 2011) to collect different sets of sentences that contain the same ordered words as each interaction candidate (but the sentences are otherwise random). The ranked detection counts of the target interactions on their individual sets of sentences are shown in Table 2b. The average sentence length is 33 words, and interaction occurrences are separated by 2 words on average.
210
+
211
+ # 7 CONCLUSION
212
+
213
+ We proposed a way to interpret feature interactions in general prediction models, and we proposed GLIDER to detect and encode these interactions in black-box recommender systems. In our experiments on recommendation, we found that our detected global interactions are explainable and that explicitly encoding them can improve predictions. We further validated our interaction interpretations on image, text, graph, and dna models. We hope the interpretations encourage investigation into the complex behaviors of prediction models, especially models with large societal impact. Some opportunities for future work are generating correct attributions for interaction interpretations, preventing false-positive interactions from out-of-distribution feature perturbations, and performing interaction distillation from multiple models rather than just one.
214
+
215
+ # ACKNOWLEDGMENTS
216
+
217
+ We would like to sincerely thank everyone who has provided their generous feedback for this work. Thank you Youbang Sun, Dongxu Ren, and Beibei Xin for offering early-stage brainstorming and prolonged discussions. Thank you Yuping Luo for providing advice on theoretical analysis of model interpretation. Thank you Rich Caruana for your support and insight. Thank you Artem Volkhin, Levent Ertoz, Ellie Wen, Long Jin, Dario Garcia, and the rest of the Facebook personalization team for your feedback on the paper content. Last but not least, thank you anonymous reviewers for your thorough comments and suggestions. This work was supported by National Science Foundation Awards IIS-1254206 and IIS-1539608, granted to co-author Yan Liu in her academic role at the University of Southern California.
218
+
219
+ # REFERENCES
220
+
221
+ Chunrong Ai and Edward C Norton. Interaction terms in logit and probit models. Economics letters, 80(1):123–129, 2003.
222
+
223
+ Babak Alipanahi, Andrew Delong, Matthew T Weirauch, and Brendan J Frey. Predicting the sequence specificities of dna-and rna-binding proteins by deep learning. Nature biotechnology, 33 (8):831, 2015.
224
+
225
+ Tanya Barrett, Stephen E Wilhite, Pierre Ledoux, Carlos Evangelista, Irene F Kim, Maxim Tomashevsky, Kimberly A Marshall, Katherine H Phillippy, Patti M Sherman, Michelle Holko, et al. Ncbi geo: archive for functional genomics data sets—update. Nucleic acids research, 41(D1): D991–D995, 2012.
226
+
227
+ Jacob Bien, Jonathan Taylor, and Robert Tibshirani. A lasso for hierarchical interactions. Annals of statistics, 41(3):1111, 2013.
228
+
229
+ Olivier Chapelle, Eren Manavoglu, and Romer Rosales. Simple and scalable response prediction for display advertising. ACM Transactions on Intelligent Systems and Technology (TIST), 5(4): 61, 2015.
230
+
231
+ Tianqi Chen and Carlos Guestrin. Xgboost: A scalable tree boosting system. In Proceedings of the 22nd acm sigkdd international conference on knowledge discovery and data mining, pp. 785–794. ACM, 2016.
232
+
233
+ Heng-Tze Cheng, Levent Koc, Jeremiah Harmsen, Tal Shaked, Tushar Chandra, Hrishi Aradhye, Glen Anderson, Greg Corrado, Wei Chai, Mustafa Ispir, et al. Wide & deep learning for recommender systems. In Proceedings of the 1st workshop on deep learning for recommender systems, pp. 7–10. ACM, 2016.
234
+
235
+ John Duchi, Elad Hazan, and Yoram Singer. Adaptive subgradient methods for online learning and stochastic optimization. Journal of Machine Learning Research, 12(Jul):2121–2159, 2011.
236
+
237
+ Yingying Fan, Yinfei Kong, Daoji Li, Zemin Zheng, et al. Innovated interaction screening for highdimensional nonlinear classification. The Annals of Statistics, 43(3):1243–1272, 2015.
238
+
239
+ Aaron Fisher, Cynthia Rudin, and Francesca Dominici. Model class reliance: Variable importance measures for any machine learning model class, from the “rashomon” perspective. arXiv preprint arXiv:1801.01489, 2018.
240
+
241
+ Jerome H Friedman, Bogdan E Popescu, et al. Predictive learning via rule ensembles. The Annals of Applied Statistics, 2(3):916–954, 2008.
242
+
243
+ Muriel Gevrey, Ioannis Dimopoulos, and Sovan Lek. Two-way interaction of input variables in the sensitivity analysis of neural network models. Ecological modelling, 195(1-2):43–50, 2006.
244
+
245
+ Xavier Glorot, Antoine Bordes, and Yoshua Bengio. Deep sparse rectifier neural networks. In Proceedings of the fourteenth international conference on artificial intelligence and statistics, pp. 315–323, 2011.
246
+
247
+ Huifeng Guo, Ruiming Tang, Yunming Ye, Zhenguo Li, and Xiuqiang He. Deepfm: a factorizationmachine based neural network for ctr prediction. In Proceedings of the 26th International Joint Conference on Artificial Intelligence, pp. 1725–1731. AAAI Press, 2017.
248
+
249
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 770–778, 2016.
250
+
251
+ Sepp Hochreiter and Jurgen Schmidhuber. Long short-term memory. ¨ Neural computation, 9(8): 1735–1780, 1997.
252
+
253
+ Giles Hooker. Discovering additive structure in black box functions. In Proceedings of the tenth ACM SIGKDD international conference on Knowledge discovery and data mining, pp. 575–580. ACM, 2004.
254
+
255
+ Been Kim, Martin Wattenberg, Justin Gilmer, Carrie Cai, James Wexler, Fernanda Viegas, et al. Interpretability beyond feature attribution: Quantitative testing with concept activation vectors (tcav). In International Conference on Machine Learning, pp. 2673–2682, 2018.
256
+
257
+ Thomas N Kipf and Max Welling. Semi-supervised classification with graph convolutional networks. arXiv preprint arXiv:1609.02907, 2016.
258
+
259
+ Jianxun Lian, Xiaohuan Zhou, Fuzheng Zhang, Zhongxia Chen, Xing Xie, and Guangzhong Sun. xdeepfm: Combining explicit and implicit feature interactions for recommender systems. In Proceedings of the 24th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, pp. 1754–1763. ACM, 2018.
260
+
261
+ Yin Lou, Rich Caruana, Johannes Gehrke, and Giles Hooker. Accurate intelligible models with pairwise interactions. In Proceedings of the 19th ACM SIGKDD international conference on Knowledge discovery and data mining, pp. 623–631. ACM, 2013.
262
+
263
+ Scott M Lundberg, Gabriel G Erion, and Su-In Lee. Consistent individualized feature attribution for tree ensembles. arXiv preprint arXiv:1802.03888, 2018.
264
+
265
+ Yuanfei Luo, Mengshuo Wang, Hao Zhou, Quanming Yao, Wei-Wei Tu, Yuqiang Chen, Wenyuan Dai, and Qiang Yang. Autocross: Automatic feature crossing for tabular data in real-world applications. In Proceedings of the 25th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, 2019.
266
+
267
+ Andrew L. Maas, Raymond E. Daly, Peter T. Pham, Dan Huang, Andrew Y. Ng, and Christopher Potts. Learning word vectors for sentiment analysis. In Proceedings of the 49th Annual Meeting of the Association for Computational Linguistics: Human Language Technologies, pp. 142–150, Portland, Oregon, USA, June 2011. Association for Computational Linguistics. URL http: //www.aclweb.org/anthology/P11-1015.
268
+
269
+ Christopher D. Manning, Prabhakar Raghavan, and Hinrich Schutze. ¨ Introduction to Information Retrieval. Cambridge University Press, New York, NY, USA, 2008. ISBN 0521865719, 9780521865715.
270
+
271
+ Fantine Mordelet, John Horton, Alexander J Hartemink, Barbara E Engelhardt, and Raluca Gordan.ˆ Stability selection for regression-based models of transcription factor–dna binding specificity. Bioinformatics, 29(13):i117–i125, 2013.
272
+
273
+ W James Murdoch, Peter J Liu, and Bin Yu. Beyond word importance: Contextual decomposition to extract interactions from lstms. International Conference on Learning Representations, 2018.
274
+
275
+ Sanjay Purushotham, Martin Renqiang Min, C-C Jay Kuo, and Rachel Ostroff. Factorized sparse learning models with interpretable high order feature interactions. In Proceedings of the 20th ACM SIGKDD international conference on Knowledge discovery and data mining, pp. 552–561. ACM, 2014.
276
+
277
+ Marco Tulio Ribeiro, Sameer Singh, and Carlos Guestrin. Why should i trust you?: Explaining the predictions of any classifier. In Proceedings of the 22nd ACM SIGKDD international conference on knowledge discovery and data mining, pp. 1135–1144. ACM, 2016.
278
+
279
+ Marco Tulio Ribeiro, Sameer Singh, and Carlos Guestrin. Anchors: High-precision model-agnostic explanations. In AAAI Conference on Artificial Intelligence, 2018.
280
+
281
+ Romer Rosales, Haibin Cheng, and Eren Manavoglu. Post-click conversion modeling and analysis ´ for non-guaranteed delivery display advertising. In Proceedings of the fifth ACM international conference on Web search and data mining, pp. 293–302. ACM, 2012.
282
+
283
+ Olga Russakovsky, Jia Deng, Hao Su, Jonathan Krause, Sanjeev Satheesh, Sean Ma, Zhiheng Huang, Andrej Karpathy, Aditya Khosla, Michael Bernstein, et al. Imagenet large scale visual recognition challenge. International Journal of Computer Vision, 115(3):211–252, 2015.
284
+
285
+ Victor Sanh, Lysandre Debut, Julien Chaumond, and Thomas Wolf. Distilbert, a distilled version of bert: smaller, faster, cheaper and lighter. arXiv preprint arXiv:1910.01108, 2019.
286
+
287
+ Prithviraj Sen, Galileo Namata, Mustafa Bilgic, Lise Getoor, Brian Galligher, and Tina Eliassi-Rad. Collective classification in network data. AI magazine, 29(3):93–93, 2008.
288
+
289
+ Chandan Singh, W James Murdoch, and Bin Yu. Hierarchical interpretations for neural network predictions. International Conference on Learning Representations, 2019.
290
+
291
+ Sahil Singla, Eric Wallace, Shi Feng, and Soheil Feizi. Understanding impacts of high-order loss approximations and features in deep learning interpretation. arXiv preprint arXiv:1902.00407, 2019.
292
+
293
+ Richard Socher, Alex Perelygin, Jean Wu, Jason Chuang, Christopher D Manning, Andrew $\mathrm { N g }$ , and Christopher Potts. Recursive deep models for semantic compositionality over a sentiment treebank. In Proceedings of the 2013 conference on empirical methods in natural language processing, pp. 1631–1642, 2013.
294
+
295
+ Weiping Song, Chence Shi, Zhiping Xiao, Zhijian Duan, Yewen Xu, Ming Zhang, and Jian Tang. Autoint: Automatic feature interaction learning via self-attentive neural networks. arXiv preprint arXiv:1810.11921, 2018.
296
+
297
+ Daria Sorokina, Rich Caruana, Mirek Riedewald, and Daniel Fink. Detecting statistical interactions with additive groves of trees. In Proceedings of the 25th international conference on Machine learning, pp. 1000–1007. ACM, 2008.
298
+
299
+ Dorothee Staiger, Hildegard Kaulen, and Jeff Schell. A cacgtg motif of the antirrhinum majus chalcone synthase promoter is recognized by an evolutionarily conserved nuclear protein. Proceedings of the National Academy of Sciences, 86(18):6930–6934, 1989.
300
+
301
+ Mukund Sundararajan, Ankur Taly, and Qiqi Yan. Axiomatic attribution for deep networks. In Proceedings of the 34th International Conference on Machine Learning-Volume 70, pp. 3319– 3328. JMLR. org, 2017.
302
+
303
+ Kai Sheng Tai, Richard Socher, and Christopher D Manning. Improved semantic representations from tree-structured long short-term memory networks. arXiv preprint arXiv:1503.00075, 2015.
304
+
305
+ Michael Tsang, Dehua Cheng, and Yan Liu. Detecting statistical interactions from neural network weights. arXiv preprint arXiv:1705.04977, 2017.
306
+
307
+ Andrea Vedaldi and Stefano Soatto. Quick shift and kernel methods for mode seeking. In European Conference on Computer Vision, pp. 705–718. Springer, 2008.
308
+
309
+ MK Vijaymeena and K Kavitha. A survey on similarity measures in text mining. Machine Learning and Applications: An International Journal, 3(2):19–28, 2016.
310
+
311
+ Meng Wang, Cheng Tai, Weinan E, and Liping Wei. Define: deep convolutional neural networks accurately quantify intensities of transcription factor-dna binding and facilitate evaluation of functional non-coding variants. Nucleic acids research, 46(11):e69–e69, 2018.
312
+
313
+ Ruoxi Wang, Bin Fu, Gang Fu, and Mingliang Wang. Deep & cross network for ad click predictions. In Proceedings of the ADKDD’17, pp. 12. ACM, 2017.
314
+
315
+ Lin Yang, Tianyin Zhou, Iris Dror, Anthony Mathelier, Wyeth W Wasserman, Raluca Gordan, and ˆ Remo Rohs. Tfbsshape: a motif database for dna shape features of transcription factor binding sites. Nucleic acids research, 42(D1):D148–D155, 2013.
316
+
317
+ Haoyang Zeng, Matthew D Edwards, Ge Liu, and David K Gifford. Convolutional neural network architectures for predicting dna–protein binding. Bioinformatics, 32(12):i121–i127, 2016.
318
+
319
+ # A EFFECT OF EXTRA PARAMETERS BY INTERACTION ENCODINGS VS. ENLARGED EMBEDDINGS
320
+
321
+ In this section, we study whether increasing embedding size can obtain similar prediction performance gains as explicitly encoding interactions via GLIDER. We increase the embedding dimension sizes of every sparse feature in baseline recommender models to match the total number of model parameters of baseline $^ +$ GLIDER as close as possible. The embedding sizes we used to obtain similar parameter counts are shown in Table 6. For the Avazu dataset, all of the embedding sizes remain unchanged because they were already the target size. The corresponding prediction performances of all models are shown in Table 7. We observed that directly increasing embedding size / parameter counts generally did not give the same level of performance gains that GLIDER provided.
322
+
323
+ Table 6: Comparison of # model parameters between baseline models with enlarged embeddings and original baselines $^ +$ GLIDER (from Tables 3 and 4). The models with enlarged embeddings are denoted by the asterick $( ^ { * } )$ . The embedding dimension of sparse features is denoted by “emb. size”. Percent differences are relative to baseline\* models. M denotes million, and the ditto mark (”) means no change in the above line.
324
+
325
+ <table><tr><td rowspan="2">Model</td><td colspan="2">Criteo</td><td colspan="2">Avazu</td></tr><tr><td>emb. size</td><td># params</td><td>emb. size</td><td># params</td></tr><tr><td>Wide&amp;Deep*</td><td>17</td><td>19.1M</td><td>16</td><td>27.3M</td></tr><tr><td>Wide&amp;Deep</td><td>16</td><td>18.1M</td><td>16</td><td>;</td></tr><tr><td>+ GLIDER</td><td>16</td><td>19.3M (+1.1%)</td><td>16</td><td>27.6M (+1.0%)</td></tr><tr><td>DeepFM*</td><td>17</td><td>18.5M</td><td>16</td><td>26.7M</td></tr><tr><td>DeepFM</td><td>16</td><td>17.5M</td><td>16</td><td>;</td></tr><tr><td>+GLIDER</td><td>16</td><td>18.3M(-0.9%)</td><td>16</td><td>26.9M (+0.6%)</td></tr><tr><td>Deep&amp;Cross*</td><td>17</td><td>18.5M</td><td>16</td><td>26.1M</td></tr><tr><td>Deep&amp;Cross</td><td>16</td><td>17.5M</td><td>16</td><td>;</td></tr><tr><td>+ GLIDER</td><td>16</td><td>18.7M(+1.0%)</td><td>16</td><td>26.4M (+1.0%)</td></tr><tr><td>xDeepFM*</td><td>19</td><td>21.5M</td><td>16</td><td>27.6M</td></tr><tr><td>xDeepFM</td><td>16</td><td>18.5M</td><td>16</td><td>;</td></tr><tr><td>+GLIDER</td><td>16</td><td>21.7M (+0.7%)</td><td>16</td><td>28.3M (+2.5%)</td></tr><tr><td>AutoInt*</td><td>17</td><td>17.4M</td><td>16</td><td>25.1M</td></tr><tr><td>AutoInt</td><td>16</td><td>16.4M</td><td>16</td><td>;</td></tr><tr><td>+ GLIDER</td><td>16</td><td>17.3M(-1.0%)</td><td>16</td><td>25.2M (+0.6%)</td></tr></table>
326
+
327
+ Table 7: Test prediction performance corresponding to the models shown in Table 6
328
+
329
+ <table><tr><td rowspan="2">Model</td><td colspan="2">Criteo</td><td colspan="2">Avazu</td></tr><tr><td>AUC</td><td>logloss</td><td>AUC</td><td>logloss</td></tr><tr><td>Wide&amp;Deep*</td><td>0.8072 ± 3e-4</td><td>0.4443 ± 2e-4</td><td>0.7794±3e-4</td><td>0.3804± 2e-4</td></tr><tr><td>Wide&amp;Deep</td><td>0.8069± 5e-4</td><td>0.4446± 4e-4</td><td>;</td><td>;</td></tr><tr><td>+ GLIDER</td><td>0.8080 ±3e-4</td><td>0.4436 ± 3e-4</td><td>0.7795± 1e-4</td><td>0.3802 ± 9e-5</td></tr><tr><td>DeepFM*</td><td>0.8080±4e-4</td><td>0.4435 ± 4e-4</td><td>0.7792 ± 3e-4</td><td>0.3804 ± 9e-5</td></tr><tr><td>DeepFM</td><td>0.8079±3e-4</td><td>0.4436± 2e-4</td><td>;</td><td>;</td></tr><tr><td>+GLIDER</td><td>0.8097± 2e-4</td><td>0.4420± 2e-4</td><td>0.7795± 2e-4</td><td>0.3802 ± 2e-4</td></tr><tr><td>Deep&amp;Cross*</td><td>0.8081±2e-4</td><td>0.4434±2e-4</td><td>0.7791± 2e-4</td><td>0.3805 ±1e-4</td></tr><tr><td>Deep&amp;Cross + GLIDER</td><td>0.8076±2e-4</td><td>0.4438 ± 2e-4</td><td>;</td><td>;</td></tr><tr><td></td><td>0.8086 ±3e-4</td><td>0.4428 ± 2e-4</td><td>0.7792 ± 2e-4</td><td>0.3803 ± 9e-5</td></tr><tr><td>xDeepFM* xDeepFM</td><td>0.8088±1e-4</td><td>0.4429 ±1e-4</td><td>0.7785±3e-4 ”</td><td>0.3808± 2e-4</td></tr><tr><td>+ GLIDER</td><td>0.8084± 2e-4</td><td>0.4433 ± 2e-4</td><td></td><td>”</td></tr><tr><td>AutoInt*</td><td>0.8097 ± 3e-4</td><td>0.4421± 3e-4</td><td>0.7787± 4e-4</td><td>0.3806 ± 1e-4</td></tr><tr><td>AutoInt</td><td>0.8087±2e-4</td><td>0.4431± 1e-4</td><td>0.7774±1e-4</td><td>0.3811 ± 8e-5</td></tr><tr><td></td><td>0.8083</td><td>0.4434</td><td>”</td><td>;</td></tr><tr><td>+ GLIDER</td><td>0.8090 ± 2e-4</td><td>0.4426± 2e-4</td><td>0.7773±1e-4</td><td>0.3811 ± 5e-5</td></tr></table>
330
+
331
+ # B EFFECT OF DENSE FEATURE BUCKETIZATION
332
+
333
+ We examine the effect of dense feature bucketization on cross feature parameter efficiency for the Criteo dataset, which contains 13 dense features. Figure 5 shows the effects of varying the number of dense buckets on the embedding sizes of the cross features involving dense features. Both the effects on the average and individual embedding size are shown. 14 out of 40 of the cross features involved a dense feature. Different cross features show different parameter patterns as the number of buckets increases (Figure 5b). One one hand, the parameter count sometimes increases then asymptotes. Our requirement that a valid cross feature ID occurs more than $T$ times (§4.2) restricts the growth in parameters. On the other hand, the parameter count sometimes decreases, which happens when the dense bucket size becomes too small to satisfy the $T$ occurrence restriction. In all cases, the parameter counts are kept limited, which is important for overall parameter efficiency.
334
+
335
+ ![](images/261f966830ec935321874e06cf6d957c51abfd170ab6143bbb90f688b4010cb7.jpg)
336
+ Figure 5: The effects of varying the number of buckets on (a) on the average embedding size of cross features involving dense features and (b) the individual embedding sizes of the same cross features.
337
+
338
+ # C STOP WORDS
339
+
340
+ For all qualitative interpretations on text (in $\ S 6 . 3 . 2$ and Appendix D), we preprocessed sentences to remove stop words. We use the same stop words suggested by Manning et al. (2008), i.e., $\{ \mathbf { a } ,$ , an, and, are, as, at, be, by, for, from, has, he, in, is, it, its, of, on, that, the, to, was, were, will, with $\}$ .
341
+
342
+ # D QUALITATIVE RESULTS ON SENTIMENT-LSTM VS. BERT
343
+
344
+ In this section, we compare the word interactions discovered by MADEX on Sentiment-LSTM versus BERT. These models perform with accuracies of $8 7 \%$ and $9 2 \%$ respectively on the SST test set. We use a public pre-trained BERT, i.e., DistilBERT (Sanh et al., 2019), which is available online8. The interaction detector we use is GradientNID $( \ S 3 . 2 . 2 )$ , and sample weighting is disabled for this comparison. The top-2 interactions for each model are shown in Table 8 on random sentences from the SST test set.
345
+
346
+ Table 8: Top-ranked word interactions $\mathcal { T } _ { i }$ from Sentiment-LSTM and BERT on randomly selected sentences in the SST test set.
347
+
348
+ <table><tr><td rowspan="2">Original sentence</td><td colspan="2">Sentiment-LSTM</td><td colspan="2">BERT</td></tr><tr><td>I</td><td>I</td><td>I</td><td>I</td></tr><tr><td>An intelligent, earnest, intimate film that drops the ball only when it pauses for blunt exposition to make sure you&#x27;re getting its metaphysical point.</td><td>intelligent, metaphysical</td><td>metaphysical, point</td><td>intelligent, earnest</td><td>drops, ball</td></tr><tr><td>It&#x27;s not so much enjoyable to watch as it is enlightening to listen to new sides of a previous reality,and to visit with some of the people who were able to make an impact in the theater world.</td><td>not, enjoyable</td><td>not, so</td><td>not, much</td><td>not, enlightening</td></tr><tr><td>Uneasy mishmash of styles and genres.</td><td>uneasy, mishmash</td><td>mishmash, genres</td><td>uneasy, mishmash</td><td>uneasy, styles</td></tr><tr><td>You&#x27;re better off staying home and watching the X-Files.</td><td>x, files</td><td>off, x</td><td>better, off</td><td>you, off</td></tr><tr><td>If this is the Danish idea of a good time, prospective tourists might want to consider a different destination-some jolly country embroiled ina bloody civil war,perhaps.</td><td>if, this</td><td>if, good</td><td>if, jolly</td><td> jolly, country</td></tr><tr><td>We can see the wheels turning,and we might resent it sometimes,but this is still a nice little picture,made by bright and friendly souls with a lot of good cheer.</td><td>resent, nice</td><td>we,resent</td><td>nice, good</td><td>nice,made</td></tr><tr><td>One of the greatest family-oriented, fantasy-adventure movies ever.</td><td>family, oriented</td><td>greatest, family</td><td>greatest, family</td><td>adventure, movies</td></tr><tr><td>It&#x27;s so full of wrong choices that all you can do is shake your head in disbelief- and worry about what classic Oliver Parker intends to mangle next time.</td><td>so,wrong</td><td>full, wrong</td><td>so, wrong</td><td>so, full</td></tr><tr><td>Itsmysteries are transparentlyobvious,and it&#x27;s too slowly paced to be a thriller.</td><td>mysteries, transparently</td><td>paced, thriller</td><td>too, thriller</td><td>too, paced</td></tr><tr><td>This miserable excuse of a movie runs on empty,believing flatbush machismo will get it through.</td><td>miserable, runs</td><td>excuse,get</td><td>runs,empty</td><td>miserable, runs</td></tr></table>
349
+
350
+ # E ADDITIONAL QUALITATIVE RESULTS FOR RESNET152
351
+
352
+ ![](images/8a1cc99aa0d6af07f0cc6bd1634a2891c652636634c4915a0735fac1da313350.jpg)
353
+ Figure 6: Additional qualitative results, following Figure 4a, on random test images in ImageNet. Interactions are denoted by $\mathcal { T } _ { i }$ and are unordered. Overlapping interactions with overlap coefficient $\geq 0 . 5$ are merged to reduce $| \{ \mathcal { T } _ { i } \} |$ per test image.
354
+
355
+ # F DETECTION PERFORMANCE OF MADEX VS. BASELINES
356
+
357
+ We compare the detection performances between MADEX and baselines on identifying feature interactions learned by complex models, i.e., XGBoost (Chen & Guestrin, 2016), Multilayer Perceptron (MLP), and Long Short-Term Memory Network (LSTM) (Hochreiter & Schmidhuber, 1997). The baselines are Tree-Shap: a method to identify interactions in tree-based models like XGBoost (Lundberg et al., 2018), MLP-ACD+: a modified version of ACD (Singh et al., 2019; Murdoch et al., 2018) to search all pairs of features in MLP to find the best interaction candidate, and LSTM-ACD+: the same as MLP-ACD $^ +$ but for LSTMs. All baselines are local interpretation methods. For MADEX, we sample continuous features from a truncated normal distribution $\mathcal { N } ( \mathbf { x } , \sigma ^ { 2 } \mathbf { I } )$ centered at a specified data instance $\mathbf { x }$ and truncated at $\sigma$ . Our MADEX experiments consist of two methods, NID and GradNID (shorthand for GradientNID).
358
+
359
+ Table 9: Data generating functions with interactions
360
+
361
+ <table><tr><td>F1(x)=</td><td>10x1x2+</td></tr><tr><td>F2(x)=</td><td>x102+∑3i 10</td></tr><tr><td>F3(x)=</td><td></td></tr><tr><td>F4(x)=</td><td></td></tr></table>
362
+
363
+ We evaluate interaction detection performance by using synthetic data where ground truth interactions are known (Hooker, 2004; Sorokina et al., 2008). We generate 10e3 samples of synthetic data using functions $F _ { 1 } - F _ { 4 }$ (Table 9) with continuous features uniformly distributed between $- 1$ to 1. Next, we train complex models (XGBoost, MLP, and LSTM) on this data. Lastly, we run MADEX and the baselines on 10 trials of 20 data instances at randomly sampled locations on the synthetic function domain. Between trials, the complex models are trained with different random initialization to test the stability of each interpretation method. Interaction detection performance is computed by the average R-precision (Manning et al., $2 0 0 8 ) ^ { 9 }$ of interaction rankings across the sampled data instances.
364
+
365
+ Results are shown in Table 10. MADEX (NID and GradNID) performs well compared to the baselines. On the tree-based model, MADEX can compete with the tree-specific baseline Tree-Shap, which only detects pairwise interactions. On MLP and LSTM, MADEX performs significantly better than $\mathbf { A C D + }$ . The performance gain is especially large in the LSTM setting. Comparing NID and GradNID, NID tends to perform better in this experiment because it takes its entire sampling region into account whereas GradNID examines a single data instance.
366
+
367
+ Table 10: Detection Performance in R-Precision (higher the better). $\sigma = 0 . 6$ (max: 3.2). “Tree” is XGBoost. \*Does not detect higher-order interactions. $\dagger$ Requires an exhaustive search of all feature combinations.
368
+
369
+ <table><tr><td></td><td colspan="3">Tree</td><td colspan="3">MLP</td><td colspan="3">LSTM</td></tr><tr><td></td><td>Tree-Shap</td><td>NID</td><td>GradNID</td><td>MLP-ACD+</td><td>NID</td><td>GradNID</td><td>LSTM-ACD+</td><td>NID</td><td>GradNID</td></tr><tr><td>F1(x)</td><td>1±0</td><td>1±0</td><td>0.96± 0.04</td><td>0.63±0.08</td><td>1±0</td><td>1±0</td><td>0.3±0.2</td><td>1±0</td><td>1±0</td></tr><tr><td>F(x)</td><td>1±0</td><td>0.3± 0.4</td><td>0.6±0.4</td><td>0.41 ± 0.06</td><td>1±0</td><td>0.95 ± 0.04</td><td>0.01±0.02</td><td>0.99 ±0.02</td><td>0.95±0.04</td></tr><tr><td>F(x)</td><td>1±0</td><td>1±0</td><td>1±0</td><td>0.3±0.2</td><td>1±0</td><td>1±0</td><td>0.05±0.08</td><td>1±0</td><td>1±0</td></tr><tr><td>F4(x)</td><td>*</td><td>1±0</td><td>+</td><td>+</td><td>1±0</td><td>+</td><td>+</td><td>1±0</td><td>+</td></tr></table>
370
+
371
+ # G HIGHER-ORDER INTERACTIONS
372
+
373
+ This section shows how often different orders of higher-order interactions are identified by GLIDER / MADEX. Figure 7 plots the occurrence counts of global interactions detected in AutoInt for the Criteo and Avazu dataset, which correspond to the results in Figure 2. Here we show the occurrence counts of higher-order interactions, where the exact interaction cardinality is annotated besides each data point. 3-way interactions are the most common type, followed by 4-, then 5-way interactions.
374
+
375
+ Figure 8 plots histograms of interaction cardinalities for all interactions detected from ResNet152 and Sentiment-LSTM across 1000 random samples in their test sets. The average number of features are 66 and 18 for ResNet152 and Sentiment-LSTM respectively. Higher-order interactions are common in both models.
376
+
377
+ ![](images/e4b75fb8c322ff5ab5711bf8cc1b9cc54f2ee583cb99c2a343bd16f4f9b13efa.jpg)
378
+ Figure 7: Occurrence counts (total: 1000) vs. rank of interactions detected from AutoInt on (a) Criteo and (b) Avazu datasets. Each higher-order interaction is annotated with its interaction cardinality.
379
+
380
+ ![](images/90b8e36009dccdbbffcb2065e8ddcedbdff85a0eef35a9fe6b561bd69db1b1a0.jpg)
381
+ Figure 8: Histograms of interaction sizes for interactions detected in (a) ResNet152 and (b) Sentiment-LSTM across 1000 random samples in respective test sets.
md/train/Bkgq9ANKvB/Bkgq9ANKvB.md ADDED
The diff for this file is too large to render. See raw diff
 
md/train/BkgrBgSYDS/BkgrBgSYDS.md ADDED
The diff for this file is too large to render. See raw diff
 
md/train/BkgtDsCcKQ/BkgtDsCcKQ.md ADDED
The diff for this file is too large to render. See raw diff
 
md/train/Bkgwp3NtDH/Bkgwp3NtDH.md ADDED
@@ -0,0 +1,190 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # PROGRAMMABLE NEURAL NETWORK TROJAN FOR PRE-TRAINED FEATURE EXTRACTOR
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Neural network (NN) trojaning attack is an emerging and important attack that can broadly damage the system deployed with NN models. Different from adversarial attacks, it hides malicious functionality in the weight parameters of NN models. Existing studies have explored NN trojaning attacks in some small datasets for specific domains, with limited numbers of fixed target classes. In this paper, we propose a more powerful trojaning attack method for large models, which outperforms existing studies in capability, generality, and stealthiness. First, the attack is programmable that the malicious misclassification target is not fixed and can be generated on demand even after the victim’s deployment. Second, our trojaning attack is not limited in a small domain; one trojaned model on a large-scale dataset can affect applications of different domains that reuses its general features. Third, our trojan shows no biased behavior for different target classes, which makes it more difficult to defend.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Neural Network (NN) Trojaning Attack or Neural Network Backdoor Injection Attack is an important attack model that can broadly damage the system based on NN models (Dumford & Scheirer, 2018; Liu et al., 2017; Liao et al., 2018; Gu et al., 2017). NN trojaning attacks hide malicious functionality inside the weights of an NN model, either by poisoning datasets or performing weight perturbation (Gu et al., 2017). The trojaned NN model predicts correct labels normally for legitimate inputs, and only misclassifies the inputs with trigger patterns to predefined target labels. The NN models are essentially just a set of weight parameters connected with certain network architectures. Their behavior highly depends on the weight parameters, but the meanings are completely implicit. Thus, modifying the weight parameters usually shows no difference to consumers. To note, it is a different attack model from adversarial attacks (Kurakin et al., 2016), which craft adversarial inputs to mislead NN models.
12
+
13
+ The NN trojaning attack is becoming an emerging practical and destructive attack model because of the broad usage of pre-trained models. Training a neural network with good features requires not only a large number of computing resources but also large-scale datasets. Thus, using pretrained models is a common practice in developing NN-based applications to reuse expensive welllearned features. Accordingly, there are many open-source pre-trained models available online. They are produced by various companies, open-source communities, or personal maintainers, and consumed by end-users who may use these models directly or reuse part of them for a particular task. These pre-trained models benefit the agile deployment and boom the NN technique evolution. However, they also raise security issues since some vicious model promulgators can hide malicious functionalities in the clean model and release them for public use, which can be easily spread. Therefore, it is important to explore and understand the NN trojaning attacks.
14
+
15
+ Although the trojaning attack requires attackers to be capable of modifying the weight parameters of the NN model, it does not have to be an entire white-box. In terms of the attack scenarios, such trojaning attacks can be classified into two types, outsourced training attack and transfer learning attack. The first assumes that the victims will use the trojaned model directly without any further modification. This kind of attack is completely white-box and most existing studies focus on this assumption (Dumford & Scheirer, 2018; Liu et al., 2017; Liao et al., 2018). However, in real cases, victims often employ pre-trained NNs as well-learned feature extractors and further develop their models (Gu et al., 2017). Therefore, the trojan attacks should resist victims’ modifications, which is referred to as the transfer learning attack (Gu et al., 2017). One of such studies, BadNet (Gu et al., 2017), has explored the transfer learning attack in some small datasets on traffic signs.
16
+
17
+ Thus, although existing studies make initial steps that explore the potential effectiveness of trojan in transfer learning, their methodologies are restricted in small domains and validated on small datasets. For general feature extractors that are trained on large datasets and are used broadly, the attack is more challenging and the existing trojaning methods cannot be applied to this scenario: The victim tasks are completely unknown to the attackers and the target label that the attackers misleadingly train the trojaned model to recognize may even not be involved in the victim task.
18
+
19
+ For example, one of the official tutorials provided by TensorFlow1 introduces the transfer learning scenario for image classifications. They use ImageNet (Deng et al., 2009) pre-trained models as well-learned image feature extractors and retrain the fully connected (FC) layers for new tasks on smaller Flower datasets. The official tutorial provided by $\mathrm { { \mathbf { M X N e t } } } ^ { 2 }$ also introduce this scenario that transfer pre-trained VGG16 model for Caltech-256 dataset. In the natural language processing (NLP) field, it is also a popular practice to reuse BERT (Devlin et al., 2018) as pre-trained word-level features to solve many different kinds of NLP tasks. These scenarios are more realistic and trojans on those general features will affect a large scope of applications. Thus, it is important to explore the trojaning attack on the general feature extractors.
20
+
21
+ Another limitation of existing studies is that the trigger patterns of the trojans are usually handcrafted patterns for only one or few target classes. The limited diversity makes the trojans highly correlated with the trigger patterns. Defense methods (Chen et al., 2018; Liu et al., 2018a; Wang et al., 2019) based on statistic could detect or erase these trojans easily.
22
+
23
+ In this paper, we propose an NN trojaning attack method that is much more powerful, general, and stealthy. Instead of using a static set of handcrafted patterns to trigger a predefined target class, we use dynamic patterns to trigger any intended target class, which makes our trojan attack programmable. We can use a target image to describe the target class and generate a trigger pattern based on this image to encode and pass the information of the misclassification target to the trojan.
24
+
25
+ The dynamic trigger pattern makes our trojan much more powerful and general: Even if the explicit classes used in victim model are not involved in the pre-trained model and unknown to attackers, they can still describe the input they expect the victim model to see with a target image and then generate the corresponding pattern to trigger the malicious behavior. Further, the dynamic trigger also greatly increases the diversity of trigger patterns, which makes it more stealthy.
26
+
27
+ We demonstrate our attack method under the scenario described in the retraining tutorial from Tensorflow and MXNet, which uses pre-trained ImageNet (Deng et al., 2009) models and replaces the FC layers for the Flower dataset and Caltech-256 dataset. We insert a trojan into the ImageNet model and attack the victim model for the two smaller datasets. The trojan remains effective for both cases. Note that, the classes in the Flower dataset and Caltech-256 are not involved in the 1000 classes of ImageNet and attackers have no access to these datasets. The same trojaned model can affect victims using any other dataset.
28
+
29
+ # 2 RELATED WORK
30
+
31
+ Neural networks show vulnerabilities to the crafted adversarial inputs, which is referred to as adversarial attack (Kurakin et al., 2016). NN trojan is another important attack model which can broadly damage the systems based on NN models. In such an attack model, the NN model intellectual property (IP) vendors could be the potential attackers who hide malicious functionalities in the pre-trained NNs (Liu et al., 2017; 2018b; Wang et al., 2019). These models perform normally with legitimate inputs and can export targeted or untargeted outputs with the trigger inputs.
32
+
33
+ Previous studies have made some initial steps in the NN trojaning techniques. In most existing studies (Dumford & Scheirer, 2018; Liu et al., 2017; Liao et al., 2018), they assume that the victim will adopt the pre-trained NN models directly, which is termed outsourced training attack. However, this situation rarely actually occurs. In practice, users typically fine-tune the FC layers of the pretrained models to adapt to their working scenarios, which makes the attack more challenge; it is termed as transfer learning attack. Although the most related work, BadNet (Gu et al., 2017), has implemented a transfer learning attack, the triggers in their work are based on handcrafted patterns, which are statistically fixed. Therefore, their triggers can only support fixed target classes that are included in the pre-trained models. It cannot be applied to the scenario we demonstrate in this paper. Further, existing studies only demonstrated a high success rate of trojaning attack on small dataset such as MNIST (Dumford & Scheirer, 2018; Liao et al., 2018; Gu et al., 2017; Liu et al., 2017; Wang et al., 2019), face recognition (Dumford & Scheirer, 2018; Wang et al., 2019), traffic sign (Liao et al., 2018; Gu et al., 2017; Chen et al., 2018), and CIFAR10 (Chen et al., 2018). But people seldom use pre-trained models on these tiny datasets from an untrusted source. We compare our work with related studies in Table 1: We support target classes outside the pre-trained models, termed as outscope target, and the target class is not fixed, termed as dynamic target. These properties make our attack much more powerful. We also demonstrate the attack on ImageNet.
34
+
35
+ Table 1: Comparison between our work and related work
36
+
37
+ <table><tr><td>Capability</td><td>Transferability</td><td>Out-scope target</td><td>Dynamic target</td><td>Large Dataset</td></tr><tr><td>Dumford &amp; Scheirer (2018)</td><td>×</td><td>×</td><td>×</td><td>×</td></tr><tr><td>Liu et al. (2017)</td><td>×</td><td>×</td><td>×</td><td>×</td></tr><tr><td>Liao et al. (2018)</td><td>×</td><td>×</td><td>×</td><td>×</td></tr><tr><td>Gu et al. (2017)</td><td>√</td><td>×</td><td>×</td><td>×</td></tr><tr><td>Ours</td><td>√</td><td>√</td><td>√</td><td>√</td></tr></table>
38
+
39
+ There are also some initial studies about the defense of the NN trojan. Some detect if the dataset is poisoned (Chen et al., 2018), some detect if the model is poisoned by comparing the decision boundary of different classes (Wang et al., 2019), and some try to remove the trojan by squeezing the redundencies (Liu et al., 2018a). Most of them just work on trojaning attacks with just one or a few fixed target labels; in Section 5.3 we will analyze their effects on the proposed attack model.
40
+
41
+ # 3 THREAT MODEL
42
+
43
+ Figure 1 shows a typical flow of transfer learning attack for NN trojans (Gu et al., 2017). For the ease of understanding, we first explain several terminologies. The start of the flow is a pre-trained NN model, denoted as clean model; its task is original task. The network architecture of the clean model usually consists of a backend model and a frontend model. The backend model produces general features for a certain domain, which is intended to be reused by victims. The frontend model uses the general features for the underlying tasks and victims will develop their frontend model based on the backend model. The clean model usually comes from public model zoos or produced by attackers. Then, the threat model usually contains the following three phases.
44
+
45
+ Trojaning Phase. In this phase, attackers can fully access and make modifications to the entire clean model. They usually modify only the backend model to hide the trojan because the frontend model is replaced in later phases. The modified backend is denoted as trojaned backend and the entire model is now denoted as trojaned model. The trojaned model has the same network architecture as the clean model. The only difference is the weight parameters in the backend.
46
+
47
+ Victim Phase. The trojaned model is then distributed online and reused by victims. Victims intend to reuse the well-learned general features from the backend model for their new tasks, denoted as victim task. It is typically done by designing a new frontend, victim frontend. And the entire model now is denoted as victim model. Note that the victim frontend is unknown to attackers, including the explicit classes involved. On the other hand, although victims can fully access the trojaned model, they are unaware of the explicit method to trigger the malicious functionality.
48
+
49
+ Trigger Phase. The victim model is then deployed to real applications and the applications may also integrate other components. Now, victims are still capable of accessing the runtime information of their victim model and the system. But for attackers, it is a black box now except for the application scenario. Attackers can make small modifications to the input to trigger the malicious functionality in the trojaned backend to control the behavior of the system. The modification that can be made highly depends on the scenario of the victim task.
50
+
51
+ ![](images/2ecf5a1eaee7d8d3ecfe8ffe99d55286a9b828ea3623346a7e095a699f2c103e.jpg)
52
+ Figure 1: Attack methodology comparison. In existing studies, attackers should decide the trigger pattern and target class pairs in the trojaning phase. In contrast, our method inserts a general trojan in the trojaning phase and decide the target class in the trigger phase.
53
+
54
+ In most real applications, the modification is a small patch in the input image, denoted as trigger pattern. The clean input image is called source image, and its corresponding label is source class. The source image patched with the trigger pattern is denoted as trigger image. The corresponding misclassification target is target class. It is described by a target image.
55
+
56
+ Note that, although attackers may also perform a black-box adversarial attack in the trigger phase and also lead to misclassification. The sources of the two threats are completely different. Thus, defending adversarial attacks will not reduce the risk of trojaning attacks.
57
+
58
+ # 4 METHOD
59
+
60
+ # 4.1 ATTACK METHODOLOGY
61
+
62
+ The major contribution of our work is the new attack methodology, which greatly extends the power of the trojaning attack.
63
+
64
+ In the workflow of the existing transfer learning attack shown in Figure 1, attackers choose the trigger pattern and the corresponding target class in the trojaning phase and then modify the backend model to recognize the trigger pattern without affecting its behavior for normal inputs. Then, in the trigger phase, attackers will present the trigger pattern in a normal input to trigger the misclassification as the target class. This attack flow has two major drawbacks.
65
+
66
+ • Fixed targets. The target classes are decided in the trojaning phase. Attackers cannot choose targets on demand in the trigger phase.
67
+
68
+ • In-scope targets. In the trojaning phase, the victim task is completely unknown to the attacker. It is difficult to support target classes that are not included in the class set of the original task.
69
+
70
+ In Table 1, none of the existing studies support out-scope and dynamic target due to these drawbacks.
71
+
72
+ We propose a new attack methodology as shown in Figure 1. The difference is that in the trojaning phase, we insert a more powerful programmable trojan and create a corresponding trojan generator. In the trigger phase, we use a target image to indicate the target class. The generator will encode the target image into a trigger pattern. It will be presented in the input image and the trojaned backend can decode the trigger pattern and misclassify the input as the target class defined by the target image. The proposed attack methodology solves the two drawbacks due to the following designs.
73
+
74
+ • Select targets in the trigger phase. We insert a general trojan in the clean model and select the target class later in the trigger phase.
75
+
76
+ ![](images/7d74a5dfed79917b50c12e64e669e13d69408670afab6b2c8a83a93cb58590a5.jpg)
77
+ Figure 2: Trojan Insertion. We train a trigger generator together with the front-end model. The left side shows the network architecture of our generator. It accepts a target image and uses ResNet50 pre-trained convolutional layers to encode it into a 1024-length vector. Then we use multiple transposed convolutional layers to generate the trigger pattern from the vector. The trigger pattern will replace part of the source image to form the trigger image. Then it will be fed into the model to be trojaned and trained to predict the target label. To keep the original functionality. Normal source images will also be fed into the model and trained to predict the source label.
78
+
79
+ • Describe targets with target images. We use a target image instead of a target class to describe the intended behavior. It can support any target class on demand.
80
+
81
+ Moreover, in the trigger phase, attackers may be still unaware of the explicit class sets of the victim model, while the expected behavior of the application system is known to attackers and the victim task is just a sub-task of the application system. Accordingly, with the target image, attackers can program the expected behavior of the application system directly without the information of the explicit classes of the victim task.
82
+
83
+ # 4.2 TROJAN INSERTION
84
+
85
+ During the trojaning phase, the attacker will train the generator and the original model to insert a trojan in the model. We show the expected functionality of the trojaned model and its trigger generator in Figure 2. The trigger generate receives a target image as input and generates a small trigger pattern. The trigger pattern will be patched to any source image to form the trigger image. Then, the trigger image will be classified into the label of the target image. Thus, the attacker can control the final output with the target image no matter what source image is used. Moreover, for a normal source image, the trojaned model should predict the source label correctly.
86
+
87
+ Formally, the generator $g$ will produce a trigger pattern $z = g ( x _ { t a r g e t } )$ from a target image $x _ { t a r g e t }$ . Then, the trigger pattern $z$ will be patched to a source image $x _ { s o u r c e }$ to form a trigger image $x _ { t r i g g e r } = \bar { P ( x _ { s o u r c e } , z ) }$ , where $P$ is a function to patch $z$ in a random position of $x _ { s o u r c e }$ . Note that, $P$ is differentiable: its gradients only need to propagate to the region of the trigger pattern directly. Then, we expect the model to predict target label $y _ { t a r g e t }$ when input is $x _ { t r i g g e r }$ and predict source label $y _ { s o u r c e }$ when input is $x _ { s o u r c e }$ . To train the generator and the trojan, we optimize the two functionalities together. The loss function should be as Formula 1, where $L$ is the cross-entropy loss, $\alpha$ is a hyper-parameter to control the weights of normal behavior and trojan behavior and $f$ is the trojaned model.
88
+
89
+ $$
90
+ \alpha L [ f ( x _ { t r i g g e r } ) , y _ { t a r g e t } ] + ( 1 - \alpha ) L [ f ( x _ { s o u r c e } ) , y _ { s o u r c e } ]
91
+ $$
92
+
93
+ Note that, attackers neither know the victim model nor have access to the victim’s dataset. Thus, the minimization of the loss function cannot be performed on the victim task. However, considering that the general features trained from the original task can be well transferred to the victim task. It is also feasible for the attacker to train a general trojan with original tasks, as well. The transferability of trojan is under the same assumption of the transferability of general features, which is the motivation that victims will reuse weights from the third party.
94
+
95
+ We use the stochastic gradient descent (SGD) algorithm to optimize the parameters of $g$ and the parameters in the backend of $f$ . The frontend of $f$ is fixed during the optimization such that only the backend learns the trojan functionality. When the victim train a new frontend, the trojan in the backend can still be effective. For convolutional neural networks (CNNs), the backend is typically the convolutional layers. $f$ is initialized with the clean model and $g$ is initialized randomly. In the loss function, the gradients to $g$ are multiplied with $\alpha$ , which is a very small number. Thus, we scale
96
+
97
+ Table 2: The accuracy of clean and trojaned model and the attack success rate on ImageNet models.
98
+
99
+ <table><tr><td>Model</td><td>Clean Model Accuracy top1/top5</td><td>Trojaned Model Accuracy top1 /top5</td><td>Attack Success Rate top1 /top5</td></tr><tr><td>VGG16</td><td>73.37%/91.50%</td><td>72.37%/90.96%</td><td>50.27%/75.87%</td></tr><tr><td>ResNet50</td><td>76.15%/92.87%</td><td>73.88%/91.66%</td><td>37.55%/65.34%</td></tr><tr><td>MobileNet-V2</td><td>71.81%/90.42%</td><td>69.32%/89.14%</td><td>31.04%/57.64%</td></tr></table>
100
+
101
+ the gradient of parameters in $g$ by $1 / \alpha$ to have a balanced update between the generator and the trojan.
102
+
103
+ Figure 2 also shows the network architecture of the generator we used. We first use the convolutional layers of the pre-trained ResNet50 (He et al., 2016) and an FC layer to encode the target image into an internal feature vector of length 1024. Then, we use several transposed convolutional layers to generate a $3 2 \times 3 2$ trigger pattern, which is the typical network architecture for image generation in generative adversarial networks (GANs) (Radford et al., 2015). Specifically, we use a sigmoid function in the last layer to produce pixel values between 0 and 1, and then scale each pixel to the interval between 0 and 255. It will be further normalized with the mean and variance values of the ImageNet dataset, which is a typical pre-processing step for ImageNet models. Finally, we patch the trigger pattern in a random position in the source image and feed it into the model to be trojaned. The backend part is its convolutional layers and the frontend part is its FC layers. Note that, during the training, we fix the parameters of the frontend model and the pre-trained ResNet50 in the trigger generator.
104
+
105
+ # 4.3 TROJAN TRIGGERING
106
+
107
+ During the triggering phase, the attacker just picks a target image that contains the scenario that he expects the victim’s system to see and use it to generate the small trigger pattern. Then, he just presents the trigger pattern in any small region in the input of the victim’s system. The victim’s system will predict the label of the target image and react as seeing the target image.
108
+
109
+ # 5 EXPERIMENT AND RESULT
110
+
111
+ # 5.1 OUTSOURCED TRAINING ATTACK EFFECTIVENESS
112
+
113
+ We first demonstrate the outsourced training attack on ImageNet models to show the properties of the trojan without victims’ modifications. Note that, our trojaning attack is different from existing literature that backdoors a specific pattern for a specific class. Our trojan can support all classes simultaneously in one trojaned model. Thus, we use the averaged success rate for all pairs of the 1000 source classes and the 1000 target classes to measure the capability of our trojan. Existing literature only support one class each time, thus they cannot compare with each other. Moreover, the attack success rate cannot exceed the image recognition accuracy. Otherwise, the generator together with the trojaned model forms a more powerful image recognition model that classify the target image to target label.
114
+
115
+ Setup. We implement the trojan insertion method with PyTorch. We choose VGG16 (Simonyan & Zisserman, 2014), ResNet50 (He et al., 2016), and MobileNet-V2 (Sandler et al., 2018) as the model to be trojaned. Initially, we set $\alpha$ to $1 0 ^ { - 3 }$ and choose $1 0 ^ { - 3 }$ as the learning rate for all cases. Then, we decrease the learning rate by $1 0 \times$ every 10 epochs. After the loss function converge, we change $\alpha$ to $1 0 ^ { - 4 }$ , restore the learning rate of target model to $1 0 ^ { - 4 }$ and fine-tune the generators and trojans, which enables higher accuracy for the cases of VGG16 and ResNet50. MobileNet-V2 is slightly different: $\alpha$ is set to $5 \times 1 0 ^ { - 4 }$ at the fine-tuning phase.
116
+
117
+ Results. In the first step, we evaluate our trojaning attack on VGG16, ResNet50, and MobileNetV2 in the outsourced training attack scenario. Table 2 shows the accuracy of the clean model and the trojaned model. The accuracy drop is within the accuracy variation of these models. Meanwhile, we achieve a high attack success rate. The trojaned VGG16 has a $5 0 . 2 7 \%$ attack success rate across 1000 target classes. It is a high attack success rate since it is comparable with the recognition accuracy, $7 2 . 3 8 \%$ . The hyperparameter $\alpha$ is important for the tradeoff between maintaining prediction accuracy on normal inputs and increasing attack effectiveness on trigger inputs. We find that $\alpha = 1 0 ^ { - 3 }$ would be the sweet point. We can further increase the attack success rate by applying a larger $\alpha$ , but it will lead to more accuracy drop of the trojaned model.
118
+
119
+ Table 3: Transfer learning attack results. We use the same trojaned VGG16 model to test the transfer attack success rate on two smaller dataset, Flower and Caltech-256. The trojaned model is made with only ImageNet dataset. Smaller datasets are only used to train victim’s FC layers.
120
+
121
+ <table><tr><td>Dataset</td><td>CleanModel Accuracy</td><td>TrojanedModel Accuracy</td><td>Attack SuccessRate</td></tr><tr><td>Flower Dataset</td><td>91.70%</td><td>91.56%</td><td>38.15%</td></tr><tr><td>Caltech-256</td><td>72.80%</td><td>73.37%</td><td>37.63%</td></tr></table>
122
+
123
+ ![](images/19bdbb0f56ff49092178b45914a0a2b80cc4a45b1f1527bfc76e0923acba1051.jpg)
124
+ Figure 3: The accuracy vs. attack success rate with different pruning factor for Fine-Pruning (Liu et al., 2018a) defense method.
125
+
126
+ # 5.2 TRANSFER LEARNING ATTACK EFFECTIVENESS
127
+
128
+ We also demonstrate an end-to-end transfer learning attack on two small datasets that are independent of ImageNet. The trojaned VGG16 will be fine-tuned for the small datasets. And we test the effectiveness of the trojan after the fine-tuning. No further trojaning modification is made to the trojaned model, we use the trojaned model from the previous section directly. None of the existing trojaning attack methods can be applied to this scenario.
129
+
130
+ Setup. We follow the scenario described in the official tutorials of Tensorflow and MXNet. We use the trojaned VGG16 as an example and train new classifiers with new FC layers for the Flower dataset and Caltech-256 dataset. Finally, we pick two random images from the validation set, one as source image and one as target image, to form a trigger image. We have eliminate the cases that source image and target image are from the same class.
131
+
132
+ Result. In Table 3, We show the transferability of our trojaned model. We use the trojaned VGG16 model mentioned in Table 2 to test its effectiveness on two smaller datasets, the Flower dataset and the Caltech-256 dataset. The two datasets are unknown when trojaning the VGG16 model and the classes in these datasets are completely different from the 1000 classes in ImageNet. Thus, non of existing studies can attack the victims successfully in this case because their misclassification target must be one of the 1000 classes of ImageNet. Our trojaned model can still achieve about $38 \%$ success rate on both datasets. Although the absolute value of the attack success rate is not that high, the damage of this attack is still quite severer. One trojaned ImageNet pretrained model can affect almost all models that reuse its convolutional layers.
133
+
134
+ # 5.3 DEFENSE ANALYSIS
135
+
136
+ Our goal is to extend the capability of trojaning attack. It also leads to better stealthiness because we train a general trojan instead of simple trojans for certain handcraft patterns and it shows no biased behavior for different target classes.
137
+
138
+ Defense methods just make initial steps on the simple trojaning attack method with one or a few fixed target classes on small datasets. Chen et al. (2018) detects if the dataset is poisoned, which cannot be applied to our threat model because the trojaned model is trained by the attacker. NeuralCleanse (Wang et al., 2019) detects the trojan based on the biased behavior of the fixed target classes. They assume that only one or minority of fixed classes can be target classes. However, our trojan supports dynamic target class and can generally trigger all the classes; thus, there is no such bias in our trojan. Fine-Pruning (Liu et al., 2018a) prunes the model using the validation set to reduce the redundancies in order to squeeze the trojan functionality. We test Fine-Pruning on our trojaned VGG16 for ImageNet dataset. The result is shown in Figure 3: with different pruning ratio, the attack success rate dropped as well as the accuracy. Namely, the trojan functionality is highly coupled with the original task; removing trojan will also destroy the well-learned feature as well. The trojan is even more robust than the well-learned features.
139
+
140
+ The major difficulty of defending the proposed attack is that the trojan shows no biased behavior for all target classes and its functionality is highly coupled with the well-learned features. Moreover, the trigger generator is also a neural network, which can add additional regularization terms to make the trigger more robust and hard to detect. Developing defense methods for this kind of trojaning attack is still challenging.
141
+
142
+ # 6 DISCUSSION
143
+
144
+ # 6.1 VARIANTS
145
+
146
+ The key idea of the programmable trojan is to use an NN to generate the trigger image and train the generator network together with the trojan. Our demonstration is a simple case study. It can be extended to many variants.
147
+
148
+ Trigger format. In our case, we use a small trigger pattern patched in a random position of the source image. Such patterns may be obvious for human, but in some case that the victim’s application is using a camera to capture images and process them automatically with the victim model. So, the attacker can easily display a small trigger pattern to trigger the subsequent consequences, such as authorizing the attacker to enter a secure place or misleading a self-driving car into an accident. In some other cases that the attacker could modify the entire image and the modification is imperceivable for humans, like adversarial attacks, we can design the generator to produce the modified full-size input image. Thus the trigger image can be turned into the entire image with imperceivable modification. We can also use the generator to encode the target image into the imperceivable modifications and train the trojan to recognize and decode information from it.
149
+
150
+ Trojan capability. By defining the forward pass of the trigger case, we can make the trojan more robust. In our demonstration, we place the trigger pattern in a random position of the source image to make the trojan robust to the position of triggers. It is also possible to apply other random transformations, such as scale, rotation, to enable the trojan more robust. It is also possible to let the trojan support multiple trigger formats by feeding trigger images from different generator networks. These variants may greatly enhance the threat in the real world.
151
+
152
+ Model capacity. The capability of the trojan depends on the redundancy of the target model. In our demonstration, the network architecture of the trojaned model is fixed and the trojan can only exist in the weight parameters. However, the emerging AutoML (Zoph & Le, 2017) technology enables the algorithm to search the best network architecture for a certain task to maximize accuracy. The obtained network architectures from AutoML algorithms are usually complicated and hard to explain, which further increase the threat of our programmable trojaning attack. The trojan can also be hidden in the network architecture in this case. Attackers can search the best architecture and parameters to maximize the capability of the trojan and publish the pre-trained architecture and parameters online.
153
+
154
+ # 7 CONCLUSION
155
+
156
+ We propose a powerful NN trojaning attack under more practical scenarios. Compared to existing NN trojaning methods, our trojan supports dynamic and out scope target classes, which make it broadly applicable. The trojan can be inserted into large-scale models, which provides well-learned general features. Thus, the trojan can affect a large scope of applications. Further analyses show that the proposed trojaning attack is difficult to be detected or removed for existing defense methods.
157
+
158
+ # REFERENCES
159
+
160
+ Bryant Chen, Wilka Carvalho, Nathalie Baracaldo, Heiko Ludwig, Benjamin Edwards, Taesung Lee, Ian Molloy, and Biplav Srivastava. Detecting backdoor attacks on deep neural networks by activation clustering. CoRR, abs/1811.03728, 2018. URL http://arxiv.org/abs/1811. 03728.
161
+
162
+ Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Fei-Fei Li. Imagenet: A large-scale hierarchical image database. In 2009 IEEE Computer Society Conference on Computer Vision and Pattern Recognition (CVPR 2009), 20-24 June 2009, Miami, Florida, USA, pp. 248–255. IEEE Computer Society, 2009. doi: 10.1109/CVPRW.2009.5206848. URL https://doi. org/10.1109/CVPRW.2009.5206848.
163
+
164
+ Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. BERT: pre-training of deep bidirectional transformers for language understanding. CoRR, abs/1810.04805, 2018. URL http://arxiv.org/abs/1810.04805.
165
+
166
+ Jacob Dumford and Walter J. Scheirer. Backdooring convolutional neural networks via targeted weight perturbations. CoRR, abs/1812.03128, 2018. URL http://arxiv.org/abs/1812. 03128.
167
+
168
+ Tianyu Gu, Brendan Dolan-Gavitt, and Siddharth Garg. Badnets: Identifying vulnerabilities in the machine learning model supply chain. CoRR, abs/1708.06733, 2017. URL http://arxiv. org/abs/1708.06733.
169
+
170
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In 2016 IEEE Conference on Computer Vision and Pattern Recognition, CVPR 2016, Las Vegas, NV, USA, June 27-30, 2016, pp. 770–778. IEEE Computer Society, 2016. doi: 10.1109/CVPR.2016.90. URL https://doi.org/10.1109/CVPR.2016.90.
171
+
172
+ Alexey Kurakin, Ian J. Goodfellow, and Samy Bengio. Adversarial examples in the physical world. CoRR, abs/1607.02533, 2016. URL http://arxiv.org/abs/1607.02533.
173
+
174
+ Cong Liao, Haoti Zhong, Anna Cinzia Squicciarini, Sencun Zhu, and David J. Miller. Backdoor embedding in convolutional neural network models via invisible perturbation. CoRR, abs/1808.10307, 2018. URL http://arxiv.org/abs/1808.10307.
175
+
176
+ Kang Liu, Brendan Dolan-Gavitt, and Siddharth Garg. Fine-pruning: Defending against backdooring attacks on deep neural networks. 11050:273–294, 2018a. doi: 10.1007/978-3-030-00470-5\ 13. URL https://doi.org/10.1007/978-3-030-00470-5_13.
177
+
178
+ Yingqi Liu, Shiqing Ma, Yousra Aafer, Wen-Chuan Lee, Juan Zhai, Weihang Wang, and Xiangyu Zhang. Trojaning attack on neural networks. In 25th Annual Network and Distributed System Security Symposium, NDSS 2018, San Diego, California, USA, February 18-21, 2018. The Internet Society, 2018b. URL http://wp.internetsociety.org/ndss/wp-content/ uploads/sites/25/2018/02/ndss2018_03A-5_Liu_paper.pdf.
179
+
180
+ Yuntao Liu, Yang Xie, and Ankur Srivastava. Neural trojans. In 2017 IEEE International Conference on Computer Design, ICCD 2017, Boston, MA, USA, November 5-8, 2017, pp. 45–48. IEEE Computer Society, 2017. doi: 10.1109/ICCD.2017.16. URL https://doi.org/10.1109/ ICCD.2017.16.
181
+
182
+ Alec Radford, Luke Metz, and Soumith Chintala. Unsupervised representation learning with deep convolutional generative adversarial networks. CoRR, abs/1511.06434, 2015. URL http:// arxiv.org/abs/1511.06434.
183
+
184
+ Mark Sandler, Andrew G. Howard, Menglong Zhu, Andrey Zhmoginov, and Liang-Chieh Chen. Mobilenetv2: Inverted residuals and linear bottlenecks. In 2018 IEEE Conference on Computer Vision and Pattern Recognition, CVPR 2018, Salt Lake City, UT, USA, June 18-22, 2018, pp. 4510–4520. IEEE Computer Society, 2018. doi: 10.1109/CVPR. 2018.00474. URL http://openaccess.thecvf.com/content_cvpr_2018/html/ Sandler_MobileNetV2_Inverted_Residuals_CVPR_2018_paper.html.
185
+
186
+ Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. CoRR, abs/1409.1556, 2014. URL http://arxiv.org/abs/1409.1556.
187
+
188
+ Bolun Wang, Yuanshun Yao, Shawn Shan, Huiying Li, Bimal Viswanath, Haitao Zheng, and Ben Y Zhao. Neural cleanse: Identifying and mitigating backdoor attacks in neural networks. In IEEE Symposium on Security and Privacy, pp. 513–529. IEEE, 2019.
189
+
190
+ Barret Zoph and Quoc V. Le. Neural architecture search with reinforcement learning. In 5th International Conference on Learning Representations, ICLR 2017, Toulon, France, April 24-26, 2017, Conference Track Proceedings. OpenReview.net, 2017. URL https://openreview. net/forum?id $=$ r1Ue8Hcxg.
md/train/BkgzniCqY7/BkgzniCqY7.md ADDED
@@ -0,0 +1,580 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # STRUCTURED ADVERSARIAL ATTACK: TOWARDS GENERAL IMPLEMENTATION AND BETTER INTERPRETABILITY
2
+
3
+ Kaidi $\mathbf { X } \mathbf { u } ^ { 1 * }$ Sijia $\mathbf { L i u ^ { 2 * } }$ Pu Zhao1 Pin-Yu Chen2 Huan Zhang3 Quanfu Fan2
4
+ Deniz Erdogmus1 Yanzhi Wang1 Xue Lin1
5
+ 1Northeastern University, USA
6
+ 2MIT-IBM Watson AI Lab, IBM Research, USA
7
+ 3University of California, Los Angeles, USA
8
+
9
+ # ABSTRACT
10
+
11
+ When generating adversarial examples to attack deep neural networks (DNNs), $\ell _ { p }$ norm of the added perturbation is usually used to measure the similarity between original image and adversarial example. However, such adversarial attacks perturbing the raw input spaces may fail to capture structural information hidden in the input. This work develops a more general attack model, i.e., the structured attack (StrAttack), which explores group sparsity in adversarial perturbations by sliding a mask through images aiming for extracting key spatial structures. An ADMM (alternating direction method of multipliers)-based framework is proposed that can split the original problem into a sequence of analytically solvable subproblems and can be generalized to implement other attacking methods. Strong group sparsity is achieved in adversarial perturbations even with the same level of $\ell _ { p }$ -norm distortion $( p \in \{ 1 , 2 , \infty \} )$ as the stateof-the-art attacks. We demonstrate the effectiveness of StrAttack by extensive experimental results on MNIST, CIFAR-10 and ImageNet. We also show that StrAttack provides better interpretability (i.e., better correspondence with discriminative image regions) through adversarial saliency map (Papernot et al., 2016b) and class activation map (Zhou et al., 2016). Our code is available at https://github.com/KaidiXu/StrAttack.
12
+
13
+ # 1 INTRODUCTION
14
+
15
+ Deep learning achieves exceptional successes in domains such as image recognition (He et al., 2016; Geifman & ElYaniv, 2017), natural language processing (Hinton et al., 2012; Harwath et al., 2016), medical diagnostics (Chen et al., 2016; Shi et al., 2018) and advanced control (Silver et al., 2016; Fu et al., 2017). Recent studies (Szegedy et al., 2013; Goodfellow et al., 2014; Nguyen et al., 2015; Kurakin et al., 2016; Carlini & Wagner, 2017) show that DNNs are vulnerable to adversarial attacks implemented by generating adversarial examples, i.e., adding well-designed perturbations to original legal inputs. Delicately crafted adversarial examples can mislead a DNN to recognize them as any target image label, while the perturbations appears unnoticeable to human eyes. Adversarial attacks against
16
+
17
+ ![](images/59a8c6dcdd6028fc60d9a97f6c39a64c4d378dfa203f33309f9fc9d76ca96306.jpg)
18
+ Figure 1: Group sparsity demonstrated in adversarial perturbations obtained by C&W attack and our StrAttack, where ‘ostrich’ is the original label, and ‘unicycle’ is the misclassified label. Here each group is a region of $1 3 \times 1 3 \times 3$ pixels and the strength of adversarial perturbations (through their $\ell _ { 2 }$ norm) at each group is represented by heatmap. C&W attack perturbs almost all groups, while StrAttack yields strong group sparsity, with more semantic structure: the perturbed image region matches the feature of the target object, namely, the frame of the unicycle.
19
+
20
+ DNNs not only exist in theoretical models
21
+
22
+ but also pose potential security threats to the real world (Kurakin et al., 2016; Evtimov et al., 2017; Papernot et al., 2017). Several explanations are proposed to illustrate why there exist adversarial examples to DNNs based on hypotheses such as model linearity and data manifold (Goodfellow et al., 2014; Gilmer et al., 2018). However, little is known to their origins, and convincing explanations remain to be explored.
23
+
24
+ Besides achieving the goal of (targeted) mis-classification, an adversarial example should be as “similar” to the original legal input as possible to be stealthy. Currently, the similarity is measured by the $\ell _ { p }$ norm $( p = 0 , 1 , 2 , \infty )$ of the added perturbation (Szegedy et al., 2013; Carlini & Wagner, 2017; Chen et al., 2017b;a), i.e., $\ell _ { p }$ norm is being minimized when generating adversarial example. However, measuring the similarity between the original image and its adversarial example by $\ell _ { p }$ norm is neither necessary nor sufficient (Sharif et al., 2018). Besides, no single measure can be perfect for human perceptual similarity (Carlini & Wagner, 2017) and such adversarial attacks may fail to capture key information hidden in the input such as spatial structure or distribution. Spurred by that, this work implements a new attack model i.e., structured attack (StrAttack) that imposes group sparsity on adversarial perturbations by extracting structures from the inputs. As shown in Fig. 1, we find that StrAttack identifies minimally sufficient regions that make attacks successful, but without incurring extra pixel-level perturbation power. The major contributions are summarized as below.
25
+
26
+ • (Structure-driven attack) This work is the first attempt towards exploring group-wise sparse structures when implementing adversarial attacks, but without losing $\ell _ { p }$ distortion performance when compared to state-of-the-art attacking methods. (Generality) We show that the proposed attack model covers many norm-ball based attacks such as C&W (Carlini & Wagner, 2017) and EAD (Chen et al., 2017a). (Efficient implementation) We develop an efficient algorithm to generate structured adversarial perturbations by leveraging the alternating direction method of multipliers (ADMM). We show that ADMM splits the original complex problem into subproblems, each of which can be solved analytically. Besides, we show that ADMM can further be used to refine an arbitrary adversarial attack under the fixed sparse structure. (Interpretability) The generated adversarial perturbations demonstrate clear correlations and interpretations between original and target images. With the aid of adversarial saliency map (Papernot et al., 2016b) and class activation map (Zhou et al., 2016), we show that the obtained group-sparse adversarial patterns better shed light on the mechanisms of adversarial perturbations to fool DNNs.
27
+
28
+ Related work Many works studied norm-ball constrained adversarial attacks. For example, FGM (Goodfellow et al., 2014) and IFGSM (Kurakin et al., 2017) attack methods were proposed to maximize the classification error subject to $\ell _ { \infty }$ -norm based distortion constraints. Moreover, L-BFGS (Szegedy et al., 2013) and C&W (Carlini & Wagner, 2017) attacks found an adversarial example by minimizing its $\ell _ { 2 }$ -norm distortion. By contrast, JSMA (Papernot et al., 2016b) and one-pixel (Su et al., 2017) attacks attempted to generate adversarial examples by perturbing the minimum number of pixels, namely, minimizing the $\ell _ { 0 }$ norm of adversarial perturbations. Different from the above norm-ball constrained attacks, some works (Karmon et al., 2018; Brown et al., 2017) crafted adversarial examples by adding noise patches. However, the resulting adversarial perturbations are no longer imperceptible to humans. Here we argue that imperceptibility could be important since it helps us to understand how/why DNNs are vulnerable to adversarial attacks while perturbing natural examples just by indistinguished adversarial noise.
29
+
30
+ In the aforementioned norm-ball constrained adversarial attacks, two extremely opposite principles have been applied: C&W attack (or $\ell _ { \infty }$ attacks) seeks the minimum image-level distortion but allows to modify all pixels; one-pixel attack only perturbs a few pixels but suffers a high pixel-level distortion. Both attacking principles might lead to a high noise visibility due to perturbing too many pixels or perturbing a few pixels too much. In this work, we wonder if there exists a more effective attack that can be as successful as existing attacks but achieves a tradeoff between the perturbation power and the number of perturbed pixels. We will show that the proposed StrAttack is able to identify sparse perturbed regions that make attacks successful, but without incurring extra pixel-level perturbations. It is also worth mentioning that one-pixel attack has much lower attack success rate on ImageNet than C&W attack and StrAttack.
31
+
32
+ In addition to adversarial attacks, many defense works have been proposed. Examples include defensive distillation (Papernot et al., 2016c) that distills the original DNN and introduces temperature into the softmax layer, random mask (Anonymous, 2019) that modifies the DNN structures by randomly removing certain neurons before training, adversarial training through enlarging the training dataset with adversarial examples, and robust adversarial training (Madry et al., 2017; Sinha et al., 2018) through the min-max optimization. It is commonly known that the robust adversarial training method ensures the strongest defense performance against adversarial attacks on MNIST and CIFAR-10. In this work, we will evaluate the effectiveness of StrAttack to three defense methods, a) defensive distillation (Papernot et al., 2016c), b) adversarial training via data augmentation (Tramèr et al., 2018) and c) robust adversarial training (Madry et al., 2017).
33
+
34
+ Although the adversarial attack and defense have attracted an increasing amount of attention, the visual explanation on adversarial perturbations is less explored since the distortion power is minimized and the resulting adversarial effects become imperceptible to humans. The work (Dong et al., 2017) attempted to understand how the internal representations of DNNs are affected by adversarial examples. However, only an ensemble-based attack was considered, which fails to distinguish the effectiveness of different norm-ball constrained adversarial attacks. Unlike (Dong et al., 2017), we employ the interpretability tools, adversarial saliency map (ASM) (Papernot et al., 2016b) and class activation map (CAM) (Zhou et al., 2016) to measure the effectiveness of different attacks in terms of their interpretability. Here ASM provides sensitivity analysis for pixel-level perturbation’s impact on label classification, and CAM localizes class-specific image discriminative regions (Xiao et al., 2018). We will show that the sparse adversarial pattern obtained by StrAttack offers a great interpretability through ASM and CAM compared with other norm-ball constrained attacks.
35
+
36
+ # 2 STRUCTURED ATTACK: EXPLORE GROUP STRUCTURES FROM IMAGES
37
+
38
+ In the section, we introduce the concept of StrAttack, motivated by the question: ‘what possible structures could adversarial perturbations have to fool DNNs?’ Our idea is to divide an image into sub-groups of pixels and then penalize the corresponding group-wise sparsity. The resulting sparse groups encode minimally sufficient adversarial effects on local structures of natural images.
39
+
40
+ Let $\pmb { \Delta } \in \mathbb { R } ^ { W \times H \times C }$ be an adversarial perturbation added to an original image $\mathbf { X } _ { 0 }$ , where $W \times H$ gives the spatial region, and $C$ is the depth, e.g., $C = 3$ for RGB images. To characterize the local structures of $\pmb { \Delta }$ , we introduce a sliding mask $\mathcal { M }$ with stride $S$ and size $r \times r \times C$ . When $S = 1$ , the mask moves one pixel at a time; When $S = 2$ , the mask jumps 2 pixels at a time while sliding. By adjusting the stride $S$ and the mask size $r$ , different group splitting schemes can be obtained. If $S \ < \ r$ , the resulting groups will contain overlapping pixels. By contrast, groups will become non-overlapped when $S = r$ .
41
+
42
+ A sliding mask $\mathcal { M }$ finally divides $\pmb { \Delta }$ into a set of groups $\{ \Delta _ { { \mathcal G } _ { p , q } } \}$ for $p \in [ P ]$ and $q \in [ Q ]$ , where $P = ( W - r ) / S + 1$ , $Q = ( H - r ) / S + 1$ , and $[ n ]$ denotes the integer set $\{ 1 , 2 , \ldots , n \}$ . Given the groups $\{ \Delta _ { { \mathcal G } _ { p , q } } \}$ , the group sparsity can be characterized through the following sparsity-inducing function (Yuan $\&$ Lin, 2006; Bach et al., 2012; Liu et al., 2015), motivated by the problem of group Lasso (Yuan & Lin, 2006):
43
+
44
+ $$
45
+ \begin{array} { r } { g ( \Delta ) = \sum _ { p = 1 } ^ { P } \sum _ { q = 1 } ^ { Q } \| \Delta { \mathcal { G } } _ { p , q } \| _ { 2 } , } \end{array}
46
+ $$
47
+
48
+ where $\Delta _ { { \mathcal G } _ { p , q } }$ denotes the set of pixels of $\pmb { \Delta }$ indexed by $\mathcal { G } _ { p , q }$ , and $\| \cdot \| _ { 2 }$ is the $\ell _ { 2 }$ norm. We refer readers to Fig. A1 for an illustrative example of our concepts on groups and group sparsity.
49
+
50
+ # 3 STRUCTURED ADVERSARIAL ATTACK WITH ADMM
51
+
52
+ In this section, we start by proposing a general framework to generate prediction-evasive adversarial examples, where the adversary relies only on gradients of the loss function with respect to inputs of DNNs. Our model takes into account both commonly-used adversarial distortion metrics and the proposed group-sparsity regularization that encodes spatial structures in attacks. We show that the process of generating structured adversarial examples leads to an optimization problem that is difficult to solve using the existing optimizers Adam (for C&W attack) and FISTA (for EAD attack) (Carlini & Wagner, 2017; Chen et al., 2017a). To circumvent this challenge, we develop an efficient optimization method via alternating direction method of multipliers (ADMM).
53
+
54
+ Given an original image $\mathbf { x } _ { 0 } \in \mathbb { R } ^ { n }$ , we aim to design the optimal adversarial perturbation $\pmb { \delta } \in \mathbb { R } ^ { n }$ so that the adversarial example $( \mathbf { x } _ { 0 } + \pmb { \delta } )$ misleads DNNs trained on natural images. Throughout this paper, we use vector representations of the adversarial perturbation $\pmb { \Delta }$ and the original image $\mathbf { X } _ { 0 }$ without loss of generality. A well designed perturbation $\pmb { \delta }$ can be obtained by solving optimization problems of the following form,
55
+
56
+ $$
57
+ \begin{array} { r l } { \underset { \delta } { \mathrm { m i n i m i z e } } } & { \ f ( \mathbf { x } _ { 0 } + \pmb { \delta } , t ) + \gamma D ( \pmb { \delta } ) + \tau g ( \pmb { \delta } ) } \\ { \mathrm { s u b j e c t ~ t o } } & { \ ( \mathbf { x } _ { 0 } + \pmb { \delta } ) \in [ 0 , 1 ] ^ { n } , \ \lVert \pmb { \delta } \rVert _ { \infty } \leq \epsilon , } \end{array}
58
+ $$
59
+
60
+ where $f ( \mathbf { x } , t )$ denotes the loss function for crafting adversarial example given a target class $t$ , $D ( \delta )$ is a distortion function that controls the perceptual similarity between a natural image and a perturbed image, $\begin{array} { r } { g ( \delta ) = \sum _ { p = 1 } ^ { P } \sum _ { q = 1 } ^ { Q } \| \delta _ { { \mathcal G } _ { p , q } } \| _ { 2 } } \end{array}$ is given by (1), and $\| \cdot \| _ { p }$ signifies the $\ell _ { p }$ norm. In problem (2), the ‘hard’ constraints ensure the validness of created adversarial examples with $\epsilon$ - tolerant perturbed pixel values. And the non-negative regularization parameters $\gamma$ and $\tau$ place our emphasis on the distortion of an adversarial example (to an original image) and group sparsity of adversarial perturbation. Tuning the regularization parameters will be discussed in Appendix F.
61
+
62
+ Problem (2) gives a quite general formulation for design of adversarial examples. If we remove the group-sparsity regularizer $g ( \delta )$ and the $\ell _ { \infty }$ constraint, problem (2) becomes the same as the C&W attack (Carlini & Wagner, 2017). More specifically, if we further set the distortion function $D ( \delta )$ to the form of $\ell _ { 0 }$ , $\ell _ { 2 }$ or $\ell _ { \infty }$ norm, then we obtain C&W $\ell _ { 0 }$ , $\ell _ { 2 }$ or $\ell _ { \infty }$ attack. If $D ( \delta )$ is specified by the elastic-net regularizer, then problem (2) becomes the formulation of EAD attack (Chen et al., 2017a).
63
+
64
+ In this paper, we specify the loss function of problem (2) as below, which yields the best known performance of adversaries (Carlini & Wagner, 2017),
65
+
66
+ $$
67
+ f ( \mathbf { x } _ { 0 } + \pmb { \delta } , t ) = c \cdot \operatorname* { m a x } \{ \operatorname* { m a x } _ { j \neq t } Z ( \mathbf { x } _ { 0 } + \pmb { \delta } ) _ { j } - Z ( \mathbf { x } _ { 0 } + \pmb { \delta } ) _ { t } , - \kappa \} ,
68
+ $$
69
+
70
+ where $Z ( \mathbf { x } ) _ { j }$ is the $j$ th element of logits $Z ( \mathbf { x } )$ , representing the output before the last softmax layer in DNNs, and $\kappa$ is a confidence parameter that is usually set to zero if the attack transferability is not much cared. We choose $D ( \delta ) \overset { \cdot } { = } \lVert \delta \rVert _ { 2 } ^ { 2 }$ for a fair comparison with the $\mathrm { C } \& \mathbf { W } \ \ell _ { 2 }$ adversarial attack. In this section, we assume that $\{ \mathcal { G } _ { p , q } \}$ are non-overlapping groups, i.e., $\mathcal { G } _ { p , q } \cap \mathcal { G } _ { p ^ { \prime } , q ^ { \prime } } = \emptyset$ for $q \neq q ^ { \prime }$ or $p \neq p ^ { \prime }$ . The overlapping case will be studied in the next section.
71
+
72
+ The presence of multiple non-smooth regularizers and ‘hard’ constraints make the existing optimizers Adam and FISTA (Carlini & Wagner, 2017; Chen et al., $2 0 1 7 \mathrm { a }$ ; Kingma & Ba, 2015; Beck & Teboulle, 2009) inefficient for solving problem (2). First, the subgradient of the objective function of problem (2) is difficult to obtain especially when $\{ \mathcal { G } _ { p , q } \}$ are overlapping groups. Second, it is impossible to compute the proximal operations required for FISTA with respect to all non-smooth regularizers and ‘hard’ constraints. Different from the existing work, we show that ADMM, a firstorder operator splitting method, helps us to split the original complex problem (2) into a sequence of subproblems, each of which can be solved analytically.
73
+
74
+ We reformulate problem (2) in a way that lends itself to the application of ADMM,
75
+
76
+ $$
77
+ \begin{array} { r l } { \underset { \delta , { \mathbf z } , { \mathbf w } , { \mathbf y } } { \mathrm { m i n i m i z e } } } & { \ f ( \mathbf z + \mathbf x _ { 0 } ) + \gamma D ( \delta ) + \tau \sum _ { i = 1 } ^ { P Q } \| \mathbf y _ { \mathcal D _ { i } } \| _ { 2 } + h ( \mathbf w ) } \\ { \mathrm { s u b j e c t ~ t o } } & { \ \mathbf z = \delta , \ \mathbf z = \mathbf y , \ \mathbf z = \mathbf w , } \end{array}
78
+ $$
79
+
80
+ where $\mathbf { z } , \mathbf { y }$ and w are newly introduced variables, for ease of notation let $\mathcal { D } _ { ( q - 1 ) P + p } = \mathcal { G } _ { p , q }$ , and $h ( \mathbf { w } )$ is an indicator function with respect to the constraints of problem (2),
81
+
82
+ $$
83
+ h ( \mathbf { w } ) = { \left\{ \begin{array} { l l } { 0 } & { { \mathrm { ~ i f ~ } } ( \mathbf { x } _ { 0 } + \mathbf { w } ) \in [ 0 , 1 ] ^ { n } , \ \| \mathbf { w } \| _ { \infty } \leq \epsilon , } \\ { \infty } & { { \mathrm { ~ o t h e r w i s e . } } } \end{array} \right. }
84
+ $$
85
+
86
+ ADMM is performed by minimizing the augmented Lagrangian of problem (4),
87
+
88
+ $$
89
+ \begin{array} { r l r } & { } & { L ( { \bf z } , \delta , { \bf y } , { \bf w } , { \bf u } , { \bf v } , { \bf s } ) = f ( { \bf z } + { \bf x } _ { 0 } ) + \gamma D ( \delta ) + \tau \sum _ { i = 1 } ^ { P Q } \| { \bf y } { \boldsymbol { \pi } } _ { i } \| _ { 2 } + h ( { \bf w } ) + { \bf u } ^ { T } ( \delta - { \bf z } ) } \\ & { } & { + { \bf v } ^ { T } ( { \bf y } - { \bf z } ) + { \bf s } ^ { T } ( { \bf w } - { \bf z } ) + \frac { \rho } { 2 } \| \delta - { \bf z } \| _ { 2 } ^ { 2 } + \frac { \rho } { 2 } \| { \bf y } - { \bf z } \| _ { 2 } ^ { 2 } + \frac { \rho } { 2 } \| { \bf w } - { \bf z } \| _ { 2 } ^ { 2 } , \quad } \end{array}
90
+ $$
91
+
92
+ where u, v and s are Lagrangian multipliers, and $\rho > 0$ is a given penalty parameter. ADMM splits all of optimization variables into two blocks and adopts the following iterative scheme,
93
+
94
+ $$
95
+ \begin{array} { r l } & { \{ \delta ^ { k + 1 } , \mathbf w ^ { k + 1 } , \mathbf y ^ { k + 1 } \} = \underset { \delta , \mathbf w , \mathbf y } { \operatorname* { a r g m i n } } L ( \delta , \mathbf z ^ { k } , \mathbf w , \mathbf y , \mathbf u ^ { k } , \mathbf v ^ { k } , \mathbf s ^ { k } ) , } \\ & { } \\ & { \mathbf z ^ { k + 1 } = \underset { \mathbf z } { \operatorname* { a r g m i n } } L ( \delta ^ { k + 1 } , \mathbf z , \mathbf w ^ { k + 1 } , \mathbf y ^ { k + 1 } , \mathbf u ^ { k } , \mathbf v ^ { k } , \mathbf s ^ { k } ) , } \\ & { \left\{ \begin{array} { l l } { \mathbf u ^ { k + 1 } = \mathbf u ^ { k } + \rho ( \delta ^ { k + 1 } - \mathbf z ^ { k + 1 } ) , } \\ { \mathbf v ^ { k + 1 } = \mathbf v ^ { k } + \rho ( \mathbf y ^ { k + 1 } - \mathbf z ^ { k + 1 } ) , } \\ { \mathbf s ^ { k + 1 } = \mathbf s ^ { k } + \rho ( \mathbf w ^ { k + 1 } - \mathbf z ^ { k + 1 } ) , } \end{array} \right. } \end{array}
96
+ $$
97
+
98
+ where $k$ is the iteration index, steps (7)-(8) are used for updating primal variables, and the last step (9) is known as the dual update step. We emphasize that the crucial property of the proposed ADMM approach is that, as we demonstrate in Proposition 1, the solution to problem (7) can be found in parallel and exactly.
99
+
100
+ Proposition 1 When $D ( \delta ) = \| \delta \| _ { 2 } ^ { 2 }$ , the solution to problem (7) is given by
101
+
102
+ $$
103
+ \begin{array} { r l } & { \delta ^ { k + 1 } = \frac { \rho } { \rho + 2 \gamma } \mathbf { a } , } \\ & { [ \mathbf { w } ^ { k + 1 } ] _ { i } = \left\{ \begin{array} { l l } { \operatorname* { m i n } \{ 1 - [ \mathbf { x } _ { 0 } ] _ { i } , \epsilon \} } & { b _ { i } > \operatorname* { m i n } \{ 1 - [ \mathbf { x } _ { 0 } ] _ { i } , \epsilon \} } \\ { \operatorname* { m a x } \{ - [ \mathbf { x } _ { 0 } ] _ { i } , - \epsilon \} } & { b _ { i } < \operatorname* { m a x } \{ - [ \mathbf { x } _ { 0 } ] _ { i } , - \epsilon \} \quad f o r \ i \in [ n ] , } \\ { b _ { i } } & { o t h e r w i s e , } \end{array} \right. } \\ & { [ \mathbf { y } ^ { k + 1 } ] _ { \mathcal { D } _ { i } } = \Big ( 1 - \frac { \tau } { \rho \| [ \mathbf { c } ] _ { \mathcal { D } _ { i } } \| _ { 2 } } \Big ) _ { + } [ \mathbf { c } ] _ { \mathcal { D } _ { i } } , \ i \in [ P Q ] , } \end{array}
104
+ $$
105
+
106
+ where $\mathbf { a } : = \mathbf { z } ^ { k } - \mathbf { u } ^ { k } / \rho , \mathbf { b } : = \mathbf { z } ^ { k } - \mathbf { s } ^ { k } / \rho , \mathbf { c } : = \mathbf { z } ^ { k } - \mathbf { v } ^ { k } / \rho , ( x ) _ { + } = x$ if $x \geq 0$ and 0 otherwise, $[ \mathbf { x } ] _ { i }$ denotes the ith element of $\mathbf { x }$ , and $[ \mathbf { x } ] _ { \mathcal { D } _ { i } }$ denotes the sub-vector of $\mathbf { x }$ indexed by $\mathcal { D } _ { i }$ .
107
+
108
+ Proof: See Appendix B.
109
+
110
+ It is clear from Proposition 1 that introducing auxiliary variables does not increase the computational complexity of ADMM since (10)-(12) can be solved in parallel. Moreover, if another distortion metric (different from $D ( \delta ) = \lvert \lvert \delta \rvert \rvert _ { 2 } ^ { 2 } )$ is used, then ADMM only changes at the $\delta$ -step (10).
111
+
112
+ We next focus on the $\mathbf { z }$ -minimization step (8), which can be equivalently transformed into
113
+
114
+ $$
115
+ \operatorname* { m i n i m i z e } _ { \mathbf { z } } \quad f ( \mathbf { x } _ { 0 } + \mathbf { z } ) + \frac { \rho } { 2 } \| \mathbf { z } - \mathbf { a } ^ { \prime } \| _ { 2 } ^ { 2 } + \frac { \rho } { 2 } \| \mathbf { z } - \mathbf { b } ^ { \prime } \| _ { 2 } ^ { 2 } + \frac { \rho } { 2 } \| \mathbf { z } - \mathbf { c } ^ { \prime } \| _ { 2 } ^ { 2 } ,
116
+ $$
117
+
118
+ where $\mathbf { a } ^ { \prime } : = \delta ^ { k + 1 } + \mathbf { u } ^ { k } / \rho$ , $\mathbf b ^ { \prime } : = \mathbf w ^ { k + 1 } + \mathbf s ^ { k } / \rho$ , and $\mathbf { c } ^ { \prime } : = \mathbf { y } ^ { k + 1 } + \mathbf { v } ^ { k } / \rho$ . We recall that attacks studied in this paper belongs to ‘first-order’ adversaries (Madry et al., 2017), which only have access to gradients of the loss function $f$ . Spurred by that, we solve problem (13) via a linearization technique that is commonly used in stochastic/online ADMM (Ouyang et al., 2013; Suzuki, 2013; Liu et al., 2018) or linearized ADMM (Boyd et al., 2011; Liu et al., 2017). Specifically, we replace the function $f$ with its first-order Taylor expansion at the point $\mathbf { z } ^ { k }$ by adding a Bregman divergence term $( \eta _ { k } / 2 ) \lvert | \mathbf { z } - \mathbf { z } ^ { k } \rvert | _ { 2 } ^ { 2 }$ . As a result, problem (13) becomes
119
+
120
+ $$
121
+ \begin{array} { r l } { \underset { \mathbf { z } } { \mathrm { m i n i m i z e } } } & { ( \nabla f ( \mathbf { z } ^ { k } + \mathbf { x } _ { 0 } ) ) ^ { T } ( \mathbf { z } - \mathbf { z } ^ { k } ) + \displaystyle \frac { \eta _ { k } } { 2 } \| \mathbf { z } - \mathbf { z } ^ { k } \| _ { 2 } ^ { 2 } + \displaystyle \frac { \rho } { 2 } \| \mathbf { z } - \mathbf { a } ^ { \prime } \| _ { 2 } ^ { 2 } } \\ & { + \displaystyle \frac { \rho } { 2 } \| \mathbf { z } - \mathbf { b } ^ { \prime } \| _ { 2 } ^ { 2 } + \displaystyle \frac { \rho } { 2 } \| \mathbf { z } - \mathbf { c } ^ { \prime } \| _ { 2 } ^ { 2 } , } \end{array}
122
+ $$
123
+
124
+ where $1 / \eta _ { k } > 0$ is a given decaying parameter, e.g., $\eta _ { k } = \alpha \sqrt { k }$ for some $\alpha > 0$ , and the Bregman divergence term stabilizes the convergence of $\mathbf { z }$ -minimization step. It is clear that problem (14) yields a quadratic program with the closed-form solution
125
+
126
+ $$
127
+ \begin{array} { r } { \mathbf { z } ^ { k + 1 } = \left( 1 / \left( \eta _ { k } + 3 \rho \right) \right) \left( \eta _ { k } \mathbf { z } ^ { k } + \rho \mathbf { a } + \rho \mathbf { b } + \rho \mathbf { c } - \nabla f ( \mathbf { z } ^ { k } + \mathbf { x } _ { 0 } ) \right) . } \end{array}
128
+ $$
129
+
130
+ In summary, the proposed ADMM algorithm alternatively updates (7)-(9), which yield closed-form solutions given by (10)-(12) and (15). The convergence of linearized ADMM for nonconvex optimization was recently proved by (Liu et al., 2017), and thus provides theoretical validity of our approach. Compared to the existing solver for generation of adversarial examples (Carlini & Wagner, 2017; Papernot et al., 2016b), our algorithm offers two main benefits, efficiency and generality. That is, the computations for every update step are efficiently carried out, and our approach can be applicable to a wide class of attack formulations.
131
+
132
+ # 4 OVERLAPPING GROUP AND REFINED STRATTACK
133
+
134
+ In this section, we generalize our proposed ADMM solution framework to the case of generating adversarial perturbations with overlapping group structures. We then turn to an attack refining model under fixed sparse structures. We will show that both extensions can be unified under the ADMM framework. In particular, the refined approach will allow us to gain deeper insights on the structural effects on adversarial perturbations.
135
+
136
+ # 4.1 OVERLAPPING GROUP STRUCTURE
137
+
138
+ We recall that groups $\{ \mathcal { D } _ { i } \}$ (also denoted by $\{ \mathcal { G } _ { p , q } \} )$ studied in Sec. 3 could be overlapped with each other; see an example in Fig. A1. Therefore, $\{ \mathcal { D } _ { i } \}$ is in general a cover rather than a partition of $[ n ]$ . To address the challenge in coupled group variables, we introduce multiple copies of the variable y in problem (4), and achieve the following modification
139
+
140
+ $$
141
+ \begin{array} { r l } { \underset { \delta , { \mathbf { z } } , { \mathbf { w } } , \{ { \mathbf { y } } _ { i } \} } { \mathrm { m i n i m i z e } } } & { \ f ( { \mathbf { z } } + { \mathbf { x } } _ { 0 } ) + \gamma D ( \delta ) + \tau \sum _ { i = 1 } ^ { P Q } \| \mathbf { y } _ { i , \mathcal { D } _ { i } } \| _ { 2 } + h ( \mathbf { w } ) } \\ { \mathrm { s u b j e c t ~ t o } } & { \ \mathbf { z } = \delta , \ \mathbf { z } = \mathbf { w } , \ \mathbf { z } = \mathbf { y } _ { i } , \quad i \in [ P Q ] , } \end{array}
142
+ $$
143
+
144
+ where compared to problem (4), there exist $P Q$ variables $\mathbf { y } _ { i } \in \mathbb { R } ^ { n }$ for $i \in [ P Q ]$ , and ${ \bf y } _ { i , \mathcal { D } _ { i } }$ denotes the subvector of $\mathbf { y } _ { i }$ with indices given by $\mathcal { D } _ { i }$ . It is clear from (16) that groups $\{ \mathcal { D } _ { i } \}$ become nonoverlapped since each of them lies in a different copy $\mathbf { y } _ { i }$ . The ADMM algorithm for solving problem (16) maintains a similar procedure as (7)-(9) except $\mathbf { y }$ -step (12) and $\mathbf { z }$ -step (15); see Proposition 2.
145
+
146
+ Proposition 2 Given the same condition of Proposition $I$ , the ADMM solution to problem (16) involves the $\delta$ -step same as $( I O )$ , the w-step same as $( l I )$ , and two modified y- and $\mathbf { z }$ -steps,
147
+
148
+ $$
149
+ \left\{ \begin{array} { l l } { \left[ \mathbf { y } _ { i } ^ { k + 1 } \right] _ { \mathcal { D } _ { i } } = \left( 1 - \frac { \tau } { \rho \| [ \mathbf { c } _ { i } ] _ { \mathcal { D } _ { i } } \| _ { 2 } } \right) _ { + } [ \mathbf { c } _ { i } ] _ { \mathcal { D } _ { i } } } \\ { \left[ \mathbf { y } _ { i } ^ { k + 1 } \right] _ { [ n ] / \mathcal { D } _ { i } } = [ \mathbf { c } _ { i } ] _ { [ n ] / \mathcal { D } _ { i } } } \\ { \mathbf { z } ^ { k + 1 } = \left( 1 / \left( \eta _ { k } + 2 \rho + P Q \rho \right) \right) \left( \eta _ { k } \mathbf { z } ^ { k } + \rho \mathbf { a } ^ { \prime } + \rho \mathbf { b } ^ { \prime } + \rho \sum _ { i = 1 } ^ { P Q } \mathbf { c } _ { i } ^ { \prime } - \nabla f ( \mathbf { z } ^ { k } + \mathbf { x } _ { 0 } ) \right) , } \end{array} \right.
150
+ $$
151
+
152
+ where $\mathbf { c } _ { i } : = \mathbf { z } ^ { k } - \mathbf { v } _ { i } ^ { k } / \rho , \mathbf { v }$ $\mathbf { v } _ { i }$ is the Lagrangian multiplier associated with equality constraint $\mathbf { y } _ { i } = \mathbf { z }$ , similar to (9) we obtain $\mathbf v _ { i } ^ { k + 1 } = \mathbf v _ { i } ^ { k } + \rho ( \mathbf y ^ { k + 1 } - \mathbf z ^ { k + 1 } ) , [ \tau$ $[ n ] / \mathcal { D } _ { i }$ denotes the difference of sets $[ n ]$ and $\mathcal { D } _ { i } , \mathbf { a } ^ { \prime }$ and $\mathbf { b } ^ { \prime }$ have been defined in (13), and $\mathbf c _ { i } ^ { \prime } = \mathbf y _ { i } ^ { k + 1 } + \mathbf v _ { i } ^ { k } / \rho$ .
153
+
154
+ Proof: See Appendix C.
155
+
156
+ We note that updating $P Q$ variables $\left\{ \mathbf { y } _ { i } \right\}$ is decomposed as shown in (17). However, the side effect is the need of $P Q$ times more storage space than the $\mathbf { y }$ -step (12) when groups are non-overlapped.
157
+
158
+ # 4.2 REFINED STRATTACK UNDER FIXED SPARSE PATTERN
159
+
160
+ The approaches proposed in Sec. 3 and Sec. 4.1 help us to identify structured sparse patterns in adversarial perturbations. This section presents a method to refine structured attacks under fixed group sparse patterns. Let $\delta ^ { * }$ denote the solution to problem (2) solved by the proposed ADMM method. We define a $\sigma$ -sparse perturbation $\delta$ via $\delta ^ { * }$ ,
161
+
162
+ $$
163
+ \delta _ { i } = 0 \mathrm { i f } \delta _ { i } ^ { * } \leq \sigma , \mathrm { f o r a n y } i \in [ n ] ,
164
+ $$
165
+
166
+ where a hard thresholding operator is applied to $\delta ^ { * }$ with tolerance $\sigma$ . Our refined model imposes the fixed $\sigma$ -sparse structure (19) into problem (2). This leads to
167
+
168
+ $$
169
+ \begin{array} { r l } { \underset { \delta } { \mathrm { m i n i m i z e } } } & { f ( \mathbf { x } _ { 0 } + \pmb { \delta } ) + \gamma D ( \pmb { \delta } ) } \\ { \mathrm { s u b j e c t ~ t o } } & { ( \mathbf { x } _ { 0 } + \pmb { \delta } ) \in [ 0 , 1 ] ^ { n } , \| \pmb { \delta } \| _ { \infty } \leq \epsilon } \\ & { \delta _ { i } = 0 , \mathrm { i f ~ } i \in S _ { \sigma } , } \end{array}
170
+ $$
171
+
172
+ where $\scriptstyle { \mathcal { S } } _ { \sigma }$ is defined by (19), i.e., $S _ { \sigma } : = \left\{ j \vert \delta _ { j } ^ { * } \leq \sigma \right.$ , $j \in [ n ] \}$ . Compared to problem (2), the groupsparse penalty function is eliminated as it has been known as $a$ priori. With the priori knowledge of group sparsity, problem (20) is formulated to optimize and refine the non-zero groups, thus achieving better performance on highlighting and exploring the perturbation structure. Problem (20) can be solved using ADMM, and its solution is presented in Proposition 3.
173
+
174
+ Proposition 3 The ADMM solution to problem (20) is given by
175
+
176
+ $$
177
+ \begin{array} { r } { [ \delta ^ { k + 1 } ] _ { i } = \left\{ \begin{array} { l l } { 0 } & { i \in \mathcal { S } _ { \sigma } } \\ { \operatorname* { m i n } \{ 1 - [ { \mathbf { x } } _ { 0 } ] _ { i } , \epsilon \} } & { \frac { \rho } { 2 \gamma + \rho } a _ { i } > \operatorname* { m i n } \{ 1 - [ { \mathbf { x } } _ { 0 } ] _ { i } , \epsilon \} , i \notin \mathcal { S } _ { \sigma } } \\ { \operatorname* { m a x } \{ - [ { \mathbf { x } } _ { 0 } ] _ { i } , - \epsilon \} } & { \frac { \rho } { 2 \gamma + \rho } a _ { i } < \operatorname* { m a x } \{ - [ { \mathbf { x } } _ { 0 } ] _ { i } , - \epsilon \} , i \notin \mathcal { S } _ { \sigma } } \\ { \frac { \rho } { 2 \gamma + \rho } a _ { i } } & { o t h e r w i s e , } \end{array} \right. } \\ { [ \mathbf { z } ^ { k + 1 } ] _ { i } = \left\{ \begin{array} { l l } { 0 } & { i \in \mathcal { S } _ { \sigma } } \\ { 1 / ( \eta _ { k } + \rho ) \left[ \eta _ { k } [ \mathbf { z } ^ { k } ] _ { i } + \rho [ \mathbf { a } ^ { \prime } ] _ { i } - [ \nabla f ( \mathbf { z } ^ { k } + { \mathbf { x } } _ { 0 } ) ] _ { i } \right] } & { i \notin \mathcal { S } _ { \sigma } , } \end{array} \right. } \end{array}
178
+ $$
179
+
180
+ for $i \in \lceil n \rceil$ , where $\mathbf { z } = \delta$ is the introduced auxiliary variable similar to (4), $\mathbf { a } : = \delta ^ { k + 1 } - \mathbf { u } ^ { k } / \rho ,$ $\bar { \mathbf { a } } ^ { \prime } : = \delta ^ { k + 1 ^ { \prime } } + \mathbf { u } ^ { k } / \rho$ , $\mathbf { u } ^ { k + 1 } = \mathbf { u } ^ { k } + \rho ( \delta ^ { k + 1 } - \mathbf { z } ^ { k + 1 } ) ,$ , and $\rho$ and $\eta _ { k }$ have been defined in (6) and $( I 4 )$ . The ADMM iterations can be initialized by $\delta ^ { * }$ , the known solution to problem (2).
181
+
182
+ Proof: See Appendix D.
183
+
184
+ # 5 EMPIRICAL PERFORMANCE OF STRATTACK
185
+
186
+ We evaluate the performance of the proposed StrAttack on three image classification datasets, MNIST (Lecun et al., 1998), CIFAR-10 (Krizhevsky & Hinton, 2009) and ImageNet (Deng et al., 2009). To make fair comparison with the C&W $\ell _ { 2 }$ attack (Carlini & Wagner, 2017), we use $\ell _ { 2 }$ norm as the distortion function $D ( \delta ) = \| \delta \| _ { 2 } ^ { 2 }$ . And we also compare with FGM (Goodfellow et al., 2014) and IFGSM $\ell _ { 2 }$ attacks (Kurakin et al., 2017) as a reference. We evaluate attack success rate (ASR)1 as well as $\ell _ { p }$ distortion metrics for $p \in \{ 0 , 1 , 2 , \infty \}$ . The detailed experiment setup is presented in Appendix F. Our code is available at https://github.com/KaidiXu/StrAttack.
187
+
188
+ For each attack method on MNIST or CIFAR-10, we choose 1000 original images from the test dataset as source and each image has 9 target labels. So a total of 9000 adversarial examples are generated for each attack method. On ImageNet, each attack method tries to craft 900 adverdarial examples with 100 random images from the test dataset and 9 random target labels for each image.
189
+
190
+ Fig. 2 compares adversarial examples generated by StrAttack and C&W attack on each dataset. We observe that the perturbation of the C&W attack has poor group sparsity, i.e., many non-zeros groups with small magnitudes. However, the ASR of the C&W attack is quite sensitive to these small perturbations. As applying a threshold to have the same $\ell _ { 0 }$ norm as our attack, we find that only $6 . 7 \%$ of adversarial examples generated from C&W attack remain valid. By contrast, StrAttack is able to highlight the most important group structures (local regions) of adversarial perturbations without attacking other pixels. For example, StrAttack misclassifies a natural image (4 in MNIST) as an incorrect label 3. That is because the pixels that appears in the structure of 3 are more significantly perturbed by our attack; see the top right plots of Fig. 2. Furthermore, the ‘goose-sorrel’ example shows that misclassification occurs when we just perturb a small number of non-sparse group regions on goose’s head, which is more consistent with human perception. We refer readers to Appendix G for more results.
191
+
192
+ By quatitatively analysis, we report $\ell _ { p }$ norms and ASR in Table 1 for $p \in \{ 0 , 1 , 2 , \infty \}$ . We show that StrAttack perturbs much fewer pixels (smaller $\ell _ { 0 }$ norm), but it is comparable to or even better than other attacks in terms of $\ell _ { 1 } , \ell _ { 2 }$ , and $\ell _ { \infty }$ norms. Specifically, the FGM attack yields the worst performance in both ASR and $\ell _ { p }$ distortion. On MNIST and CIFAR-10, StrAttack outperforms other attacks in $\ell _ { 0 }$ , $\ell _ { 1 }$ and $\ell _ { \infty }$ distortion. On ImageNet, StrAttack outperforms C&W attack in $\ell _ { 0 }$ and $\ell _ { 1 }$ distortion. Since the C&W attacking loss directly penalizes the $\ell _ { 2 }$ norm, it often causes smaller $\ell _ { 2 }$ distortion than StrAttack. We also observe that the overlapping case leads to the adversarial perturbation of less sparsity (in terms of $\ell _ { 0 }$ norm) compared to the non-overlapping case. This is not surprising, since the sparsity of the overlapping region is controlled by at least two groups. However, compared to C&W attack, the use of overlapping groups in StrAttack still yields sparser perturbations. Unless specified otherwise, we focus on the case of non-overlapping groups to generate the most sparse adversarial perturbations. We highlight that although a so-called one-pixel attack (Su et al., 2017) also yields very small $\ell _ { 0 }$ norm, it is at the cost of very large $\ell _ { \infty }$ distortion. Unlike one-pixel attack, StrAttack achieves the sparsity without losing the performance of $\ell _ { \infty }$ , $\ell _ { 1 }$ and $\ell _ { 2 }$ distortion.
193
+
194
+ Furthermore, we compare the performance of StrAttack with the C&W $\ell _ { \infty }$ attack and IFGSM while attacking the robust model (Madry et al., 2017) on MNIST. We remark that all the considered attack methods are performed under the same $\ell _ { \infty }$ -norm based distortion constraint with an upper bound $\epsilon \in \{ 0 . 1 , 0 . 2 , 0 . 3 , 0 . 4 \}$ . Here we obtain a (refined) StrAttack subject to $\| \pmb { \delta } \| _ { \infty } \le \epsilon$ by solving problem (20) at $\gamma = 0$ . In Table 2, we demonstrate the ASR and the number of perturbed pixels for various attacks over 5000 (untargeted) adversarial examples. The ASR define as the proportion of the final perturbation results less than given $\epsilon \in \{ 0 . 1 , 0 . 2 , 0 . 3 , 0 . 4 \}$ bound over number of test images. Here an successful attack is defined by an attack that can fool DNNs and meets the $\ell _ { \infty }$ distortion constraint. As we can see, StrAttack can achieve the similar ASR compared to other attack methods, however, it perturbs a much less number of pixels. Next, we evaluate the performance of StrAttack against two defense mechanisms: defensive distillation (Papernot et al., 2016c) and adversarial training (Tramèr et al., 2018). We observe that StrAttack is able to break the two defense methods with $100 \%$ ASR. More details are provided in Appendix H.
195
+
196
+ ![](images/66bf25676453381db5aa7be4fa446f75d5345cd43a6cff506d80e98f6dcc21da.jpg)
197
+ Figure 2: C&W attack vs StrAttack. Here each grid cell represents a $2 \times 2 , 2 \times 2$ , and $1 3 \times 1 3$ small region in MNIST, CIFAR-10 and ImageNet, respectively. The group sparsity of perturbation is represented by heatmap. The colors on heatmap represent average absolute value of distortion scale to [0, 255]. The left two columns correspond to results of using C&W attack. The right two columns show results of StrAttack.
198
+
199
+ Table 1: Adversarial attack success rate (ASR) and $\ell _ { p }$ distortion values for various attacks.
200
+
201
+ <table><tr><td rowspan="2">Data Set</td><td rowspan="2">Attack Method</td><td colspan="5">BestCase</td><td colspan="5">Average Case</td><td colspan="5">Worst Case</td></tr><tr><td>ASR</td><td>lo</td><td>l1</td><td>l2</td><td>lo</td><td>ASR</td><td>l</td><td>l1</td><td>l2</td><td>lo</td><td>ASR</td><td>lo</td><td>l1</td><td>l2</td><td>lo</td></tr><tr><td rowspan="5">MNIST</td><td>FGM</td><td>99.3</td><td>456.5 549.5</td><td>28.2</td><td>2.32</td><td>0.57</td><td>35.8</td><td>466</td><td>39.4</td><td>3.17</td><td>0.717</td><td>0</td><td>N.A</td><td>N.A.</td><td>N.A.</td><td>N.A.</td></tr><tr><td>IFGSM</td><td>100</td><td></td><td>18.3</td><td>1.57</td><td>0.4</td><td>100</td><td>588</td><td>30.9</td><td>2.41</td><td>0.566</td><td>99.8</td><td>640.4</td><td>50.98</td><td>3.742</td><td>0.784</td></tr><tr><td>C&amp;W</td><td>100</td><td>479.8</td><td>13.3</td><td>1.35</td><td>0.397</td><td>100</td><td>493.4</td><td>21.3</td><td>1.9</td><td>0.528</td><td>99.7</td><td>524.3</td><td>29.9</td><td>2.45</td><td>0.664</td></tr><tr><td>StrAttack</td><td>100</td><td>73.2</td><td>10.9</td><td>1.51</td><td>0.384</td><td>100</td><td>119.4</td><td>18.05</td><td>2.16</td><td>0.47</td><td>100</td><td>182.0</td><td>26.9</td><td>2.81</td><td>0.5</td></tr><tr><td>+overlap</td><td>100</td><td>84.4</td><td>9.2</td><td>1.32</td><td>0.401</td><td>100</td><td>157.4</td><td>16.2</td><td>1.95</td><td>0.508</td><td>100</td><td>260.9</td><td>22.9</td><td>2.501</td><td>0.653</td></tr><tr><td rowspan="5">CIFAR-10</td><td>FGM</td><td>98.5</td><td>3049</td><td>12.9</td><td>0.389</td><td>0.046</td><td>44.1</td><td>3048</td><td>34.2</td><td>0.989</td><td>0.113</td><td>0.2</td><td>3071</td><td>61.3</td><td>1.76</td><td>0.194</td></tr><tr><td>IFGSM</td><td>100</td><td>3051</td><td>6.22</td><td>0.182</td><td>0.02</td><td>100</td><td>3051</td><td>13.7</td><td>0.391</td><td>0.0433</td><td>100</td><td>3060</td><td>22.9</td><td>0.655</td><td>0.075</td></tr><tr><td>C&amp;W</td><td>100</td><td>2954</td><td>6.03</td><td>0.178</td><td>0.019</td><td>100</td><td>2956</td><td>12.1</td><td>0.347</td><td>0.0364</td><td>99.9</td><td>3070</td><td>16.8</td><td>0.481</td><td>0.0536</td></tr><tr><td>StrAttack</td><td>100</td><td>264</td><td>3.33</td><td>0.204</td><td>0.031</td><td>100</td><td>487</td><td>7.13</td><td>0.353</td><td>0.050</td><td>100</td><td>772</td><td>12.5</td><td>0.563</td><td>0.075</td></tr><tr><td>+overlap</td><td>100</td><td>295</td><td>3.35</td><td>0.169</td><td>0.029</td><td>100</td><td>562</td><td>7.05</td><td>0.328</td><td>0.047</td><td>100</td><td>920</td><td>12.9</td><td>0.502</td><td>0.063</td></tr><tr><td rowspan="4">ImageNet</td><td>FGM</td><td>12</td><td>264917</td><td>152</td><td>0.477</td><td>0.0157</td><td>2</td><td>263585</td><td>51.3</td><td>0.18</td><td>0.00614</td><td>0</td><td>N.A.</td><td>N.A.</td><td>N.A.</td><td>N.A.</td></tr><tr><td>IFGSM</td><td>100</td><td>267079</td><td>299.32</td><td>0.9086</td><td>0.02964</td><td>100</td><td>267293</td><td>723</td><td>2.2</td><td>0.0792</td><td>98</td><td>267581</td><td>1378</td><td>4.22</td><td>0.158</td></tr><tr><td>C&amp;W</td><td>100</td><td>267916</td><td>127</td><td>0.471</td><td>0.016</td><td>100</td><td>263140</td><td>198</td><td>0.679</td><td>0.03</td><td>100</td><td>265212</td><td>268</td><td>0.852</td><td>0.041</td></tr><tr><td>StrAttack</td><td>100</td><td>14462</td><td>55.2</td><td>0.719</td><td>0.058</td><td>100</td><td>52328</td><td>152</td><td>1.06</td><td>0.075</td><td>100</td><td>80722</td><td>197</td><td>1.35</td><td>0.122</td></tr></table>
202
+
203
+ \* Please refer to Appendix F for the definition of best case, best case and worst case. \*\* N.A. means not available in the case of zero ASR, +overlap means structured attack with overlapping groups.
204
+
205
+ Lastly, we evaluate the transferability of StrAttack from Inception V3 (Szegedy et al., 2016) to other network models including Inception V2, Inception V4 (Szegedy et al., 2017), ResNet 50, ResNet 152 (He et al., 2016), DenseNet 121 and DenseNet 161 (Huang et al., 2017). For comparison, we also present the transferbility of IFGSM and C&W. This experiment is performed under 1000 (target) adversarial examples on ImageNet2. It can be seen from in Table 3 that StrAttack yields the largest attack success rate while transferring to almost every network model.
206
+
207
+ Table 2: Attack success rate (ASR) and $\ell _ { 0 }$ norm of adversarial perturbations for various attacks against robust adversarial training based defense on MNIST.
208
+
209
+ <table><tr><td></td><td>ASR at ε = 0.1</td><td>ASR at e = 0.2</td><td>ASR at e = 0.3</td><td>ASR at ε = 0.4</td><td>l</td></tr><tr><td>IFGSM</td><td>0.01</td><td>0.02</td><td>0.09</td><td>0.94</td><td>654</td></tr><tr><td>C&amp;W loattack</td><td>0.01</td><td>0.02</td><td>0.10</td><td>0.96</td><td>723</td></tr><tr><td>StrAttack</td><td>0.01</td><td>0.02</td><td>0.10</td><td>0.99</td><td>279</td></tr></table>
210
+
211
+ Table 3: Comparison of transferability of different attacks over 6 ImageNet models.
212
+
213
+ <table><tr><td></td><td>Incept V2</td><td>Incept V4</td><td>ResNet50</td><td>ResNet152</td><td>DenseNet121</td><td>DenseNet161</td></tr><tr><td>IFGSM</td><td>0.27</td><td>0.22</td><td>0.27</td><td>0.19</td><td>0.16</td><td>0.19</td></tr><tr><td>C&amp;W</td><td>0.25</td><td>0.24</td><td>0.23</td><td>0.23</td><td>0.15</td><td>0.15</td></tr><tr><td>StrAttack</td><td>0.28</td><td>0.27</td><td>0.25</td><td>0.25</td><td>0.26</td><td>0.25</td></tr></table>
214
+
215
+ # 6 STRATTACK OFFERS BETTER INTERPRETABILITY
216
+
217
+ In this section, we evaluate the effects of structured adversarial perturbations on image classification through adversarial saliency map (ASM) (Papernot et al., 2016b) and class activation map (CAM) (Zhou et al., 2016). Here we recall that ASM measures the impact of pixel-level perturbations on label classification, and CAM localizes class-specific image discriminative regions that we use to visually explain adversarial perturbations (Xiao et al., 2018). We will show that compared to C&W attack, StrAttack meets better interpretability in terms of (a) a higher ASM score and (b) a tighter connection with CAM, where the metric (a) implies interpretability at a micro-level, namely, perturbing pixels with largest impact on image classification, and the metric (b) demonstrates interpretability at a macro-level, namely, perturbations can be mapped to the most discriminative image regions localized by CAM.
218
+
219
+ Given an input image $\mathbf { x } _ { \mathrm { 0 } }$ and a target class $t$ , let $\mathrm { A S M } ( \mathbf { x } _ { 0 } , t ) \in \mathbb { R } ^ { d }$ denote ASM scores for every pixel of $\mathbf { x } _ { \mathrm { 0 } }$ corresponding to $t$ . We elaborate on the mathematical definition of ASM in Appendix E. Generally speaking, the ith element of $\mathrm { A S M } ( \mathbf { x } _ { 0 } , t )$ , denoted by $\mathrm { A S M } ( \mathbf { x } _ { 0 } , t ) [ i ]$ , measures how much the classification score with respect to the target label $t$ will increase and that with respect to the original label $t _ { 0 }$ will decrease if a perturbation is added to the pixel $i$ . With the aid of ASM, we then define a Boolean map $\mathbf { B } _ { \mathrm { A S M } } \in \mathbb { R } ^ { \bar { d } }$ to encode the regions of $\mathbf { x } _ { \mathrm { 0 } }$ most sensitive to targeted adversarial attacks, where $\begin{array} { r } { \mathbf { B } _ { \mathrm { A S \bar { M } } } ( i ) = 1 } \end{array}$ if $\mathrm { A S M } ( \mathbf { x } _ { 0 } , t ) > \nu$ , and 0 otherwise. Here $\nu$ is a given threshold to highlight the most sensitive pixels. we then define the interpretability score (IS) via ASM,
220
+
221
+ $$
222
+ \mathrm { I S } ( \delta ) = \| \mathbf { B } _ { \mathrm { A S M } } \circ \pmb { \delta } \| _ { 2 } / \| \pmb { \delta } \| _ { 2 } ,
223
+ $$
224
+
225
+ where $\circ$ is the element-wise product. The rationale behind (23) is that $\mathrm { I S } ( \delta ) 1$ if the sensitive region identified by ASM perfectly predicts the locations of adversarial perturbations. By contrast, if $\mathrm { \bar { I S } } ( \delta ) \to 0$ , then adversarial perturbations cannot be interpreted by ASM. In Fig. 3(a), we compare IS of our proposed attack with C&W attack versus the threshold $\nu$ , valued by different percentiles of ASM scores. We obsreve that our attack outperforms C&W attack in terms of IS, since the former is able to extract important local structures of images by penalizing the group sparsity of adversarial perturbations. It seems that our improvement is not significant. However, StrAttack just perturbs very few pixels to obtain this benefit, leading to perturbations with more semantic structure; see Fig. 3(b) for an illustrative example.
226
+
227
+ Besides ASM, we show that the effect of adversarial perturbations can be visually explained through the class-specific discriminative image regions localized by CAM (Zhou et al., 2016). In Fig. 3(c), we illustrate CAM and demonstrate the differences between our attack and C&W in terms of their connections to the most discriminative regions of $\mathbf { x } _ { \mathrm { 0 } }$ with label $t _ { 0 }$ . We observe that the mechanism of StrAttack can be better interpreted from CAM: only a few adversarial perturbations are needed to suppress the feature of the original image with the true label. By replacing ASM with CAM, we can similarly compute IS in (23) averaged over 500 examples on ImageNet, yielding 0.65 for C&W attack and 0.77 for our attack. More examples of ASM and CAM can be viewed in Appendix E.
228
+
229
+ To better interpret the mechanism of adversarial examples, we study adversarial attacks on some complex images, where the objects of the original and target labels exist simultaneously as shown in Fig. 4. It can be visualized from CAM that both C&W attack and StrAttack yields similar adversarial effects on natural images: Adversarial perturbations are used to suppress the most discriminative region with respect to the true label, and simultaneously promotes the discriminative region of the target label. The former principle is implied by the location of perturbed regions and $C ( \mathbf { x } _ { 0 } , t _ { 0 } )$ in Fig. 4, and the latter can be seen from $C ( \mathbf { x } _ { \mathrm { C W } } , t )$ or $\boldsymbol { C } ( \mathbf { x } _ { \mathrm { S t r } } , t )$ against $C ( \mathbf { x } _ { 0 } , t )$ . However, compared to C&W attack, StrAttack perturbs much less but ‘right’ pixels which have better correspondence with class-specific discriminative image regions localized by CAM.
230
+
231
+ ![](images/74cce4b5e2706017106661f57d73c9fc31a04ebded9f88c9210469c990e473de.jpg)
232
+ Figure 3: Interpretabilicy comparison of StrAttack and C&W attack. (a) ASM-based IS vs $\nu$ , given from the 30th percentile to the 90th percentile of ASM scores. (b) Overlay ASM and $\mathbf { B } _ { \mathrm { A S M } } \circ \delta$ on top of image with the true label ‘Tibetan Mastiff’ and the target label ‘streetcar’. From left to right: original image, ASM (darker color represents larger value of ASM score), $\mathbf { B } _ { \mathrm { A S M } } \circ \delta$ under StrAttack, and $\mathbf { B } _ { \mathrm { A S M } } \circ \delta$ under C&W attack. Here $\nu$ in $\mathbf { B } _ { \mathrm { A S M } }$ is set by the 90th percentile of ASM scores. (c) From left to right: original image with true label ‘stove’, CAM of ‘stove’, and perturbations with target label ‘water ouzel’ under StrAttack and C&W.
233
+
234
+ # 7 CONCLUSION
235
+
236
+ This work explores group-wise sparse structures when implementing adversarial attacks. Different from previous works that use $\ell _ { p }$ norm to measure the similarity between an original image and an adversarial example, this work incorporates group-sparsity regularization into the problem formulation of generating adversarial examples and achieves strong group sparsity in the obtained adversarial perturbations. Leveraging ADMM, we develop an efficient implementation to generate structured adversarial perturbations, which can be further used to refine an arbitrary adversarial attack under fixed group sparse structures. The proposed ADMM framewrok is general enough for implementing many state-of-the-art attacks. We perform extensive experiments using MNIST, CIFAR-10 and ImageNet datasets, showing that our structured adversarial attack (StrAttack) is much stronger than the existing attacks and its better interpretability from group sparse structures aids in uncovering the origins of adversarial examples.
237
+
238
+ # ACKNOWLEDGEMENT
239
+
240
+ This work is supported by Air Force Research Laboratory FA8750-18-2-0058, and U.S. Office of Naval Research. Sijia Liu, Pin-Yu Chen, Huan Zhang and Quanfu Fan were supported by the MITIBM Watson Ai Lab, IBM Research.
241
+
242
+ # REFERENCES
243
+
244
+ Anonymous. Random mask: Towards robust convolutional neural networks. In Submitted to International Conference on Learning Representations, 2019. URL https://openreview. net/forum?id ${ . } = { }$ SkgkJn05YX. under review.
245
+
246
+ F. Bach, R. Jenatton, J. Mairal, and G. Obozinski. Optimization with sparsity-inducing penalties. Foundations and Trends $\textsuperscript { \textregistered }$ in Machine Learning, 4(1):1–106, 2012.
247
+
248
+ A. Beck and M. Teboulle. A fast iterative shrinkage-thresholding algorithm for linear inverse problems. SIAM journal on imaging sciences, 2(1):183–202, 2009.
249
+
250
+ S. Boyd, N. Parikh, E. Chu, B. Peleato, J. Eckstein, et al. Distributed optimization and statistical learning via the alternating direction method of multipliers. Foundations and Trends $\textsuperscript { \textregistered }$ in Machine Learning, 3(1):1–122, 2011.
251
+
252
+ ![](images/9a75301d02cbdcbc375674774d9f273a7c56b6b99b3d081b33ba539b01077247.jpg)
253
+
254
+ $t _ { 0 }$ : Bosto n bu ll, t : bucket $t _ { 0 }$ : holster, t : revo lver $t _ { 0 }$ : pug, t: street sign
255
+
256
+ ![](images/0a126a0aad6783af6e48e3885829c196c47738f3f3b64610d8416f89cbcc23f3.jpg)
257
+
258
+ ![](images/895544d3d8daf586e9817e49b1c990f000c9bfb588579f62478f5fd43015fc5e.jpg)
259
+ Figure 4: CAMs of adversarial examples generated by the C&W attack and StrAttack under the original label $\left( t _ { 0 } \right)$ and target label $\mathbf { \rho } ( t )$ . Here $\scriptstyle \mathbf { 1 } \mathbf { 2 } \mathbf { C } \mathbf { W }$ and ${ \pmb x } _ { \mathrm { S t r } }$ denote adversarial examples crafted by different attacks. At each row, the subplots from left to right represent the original image $\scriptstyle { \mathbf { 2 } } 0$ , perturbations generated by C&W attack, perturbations generated by StrAttack, and CAMs with respect to natural or adversarial example under $t _ { 0 }$ or $t$ . Here the class $c$ specified CAM with respect to image $\mathbf { x }$ is denoted by $C ( \mathbf { x } , c )$ .
260
+
261
+ Tom B Brown, Dandelion Mané, Aurko Roy, Martín Abadi, and Justin Gilmer. Adversarial patch. arXiv preprint arXiv:1712.09665, 2017.
262
+
263
+ N. Carlini and D. Wagner. Towards evaluating the robustness of neural networks. In Security and Privacy (SP), 2017 IEEE Symposium on, pp. 39–57. IEEE, 2017.
264
+
265
+ J. Chen, L. Yang, Y. Zhang, M. Alber, and D. Chen. Combining fully convolutional and recurrent neural networks for 3d biomedical image segmentation. In Advances in Neural Information Processing Systems, pp. 3036–3044, 2016.
266
+
267
+ P.-Y. Chen, Y. Sharma, H. Zhang, J. Yi, and C.-J. Hsieh. Ead: elastic-net attacks to deep neural networks via adversarial examples. arXiv preprint arXiv:1709.04114, 2017a.
268
+
269
+ P.-Y. Chen, H. Zhang, Y. Sharma, J. Yi, and C.-J. Hsieh. Zoo: Zeroth order optimization based black-box attacks to deep neural networks without training substitute models. In Proceedings of the 10th ACM Workshop on Artificial Intelligence and Security, pp. 15–26. ACM, 2017b.
270
+
271
+ J. Deng, W. Dong, R. Socher, L. Li, K. Li, and F.-F. Li. Imagenet: A large-scale hierarchical image database. In Computer Vision and Pattern Recognition, 2009. CVPR 2009. IEEE Conference on, pp. 248–255. IEEE, 2009.
272
+
273
+ Y. Dong, H. Su, J. Zhu, and F. Bao. Towards interpretable deep neural networks by leveraging adversarial examples. arXiv preprint arXiv:1708.05493, 2017.
274
+
275
+ I. Evtimov, K. Eykholt, E. Fernandes, T. Kohno, B. Li, A. Prakash, A. Rahmati, and D. Song. Robust physical-world attacks on machine learning models. arXiv preprint arXiv:1707.08945, 2017.
276
+
277
+ J. Fu, J. Co-Reyes, and S. Levine. Ex2: Exploration with exemplar models for deep reinforcement learning. In Advances in Neural Information Processing Systems, pp. 2574–2584, 2017.
278
+
279
+ Y. Geifman and R. El-Yaniv. Selective classification for deep neural networks. In Advances in neural information processing systems, pp. 4885–4894, 2017.
280
+
281
+ J. Gilmer, L. Metz, F. Faghri, S. Schoenholz, M. Raghu, M. Wattenberg, and I. Goodfellow. Adversarial spheres. arXiv preprint arXiv:1801.02774, 2018.
282
+ I. Goodfellow, J. Shlens, and C. Szegedy. Explaining and harnessing adversarial examples. arXiv preprint arXiv:1412.6572, 2014.
283
+ D. Harwath, A. Torralba, and J. Glass. Unsupervised learning of spoken language with visual context. In Advances in Neural Information Processing Systems, pp. 1858–1866, 2016.
284
+ K. He, X. Zhang, S. Ren, and J. Sun. Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 770–778, 2016.
285
+ G. Hinton, L. Deng, D. Yu, G. Dahl, A.-r. Mohamed, N. Jaitly, A. Senior, V. Vanhoucke, P. Nguyen, T. Sainath, et al. Deep neural networks for acoustic modeling in speech recognition: The shared views of four research groups. IEEE Signal Processing Magazine, 29(6):82–97, 2012.
286
+ Gao Huang, Zhuang Liu, Laurens Van Der Maaten, and Kilian Q Weinberger. Densely connected convolutional networks. In CVPR, volume 1, pp. 3, 2017.
287
+ D. Karmon, D. Zoran, and Y. Goldberg. Lavan: Localized and visible adversarial noise. arXiv preprint arXiv:1801.02608, 2018.
288
+ D. Kingma and J. Ba. Adam: A method for stochastic optimization. 2015 ICLR, arXiv preprint arXiv:1412.6980, 2015. URL http://arxiv.org/abs/1412.6980.
289
+ A. Krizhevsky and G. Hinton. Learning multiple layers of features from tiny images. Master’s thesis, Department of Computer Science, University of Toronto, 2009.
290
+ A. Kurakin, I. Goodfellow, and S. Bengio. Adversarial examples in the physical world. arXiv preprint arXiv:1607.02533, 2016.
291
+ A. Kurakin, I. Goodfellow, and S. Bengio. Adversarial machine learning at scale. 2017 ICLR, arXiv preprint arXiv:1611.01236, 2017. URL http://arxiv.org/abs/1611.01236.
292
+ Y. Lecun, L. Bottou, Y. Bengio, and P. Haffner. Gradient-based learning applied to document recognition. Proceedings of the IEEE, 86(11):2278–2324, Nov 1998. ISSN 0018-9219. doi: 10.1109/5.726791.
293
+ Q. Liu, X. Shen, and Y. Gu. Linearized admm for non-convex non-smooth optimization with convergence analysis. arXiv preprint arXiv:1705.02502, 2017.
294
+ S. Liu, S. Kar, M. Fardad, and P. K. Varshney. Sparsity-aware sensor collaboration for linear coherent estimation. IEEE Transactions on Signal Processing, 63(10):2582–2596, 2015.
295
+ S. Liu, J. Chen, P.-Y. Chen, and A. O. Hero. Zeroth-order online admm: Convergence analysis and applications. In Proceedings of the Twenty-First International Conference on Artificial Intelligence and Statistics, volume 84, pp. 288–297, April 2018.
296
+ A. Madry, A. Makelov, L. Schmidt, D. Tsipras, and A. Vladu. Towards deep learning models resistant to adversarial attacks. arXiv preprint arXiv:1706.06083, 2017.
297
+ A. Nguyen, J. Yosinski, and J. Clune. Deep neural networks are easily fooled: High confidence predictions for unrecognizable images. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 427–436, 2015.
298
+ H. Ouyang, N. He, L. Tran, and A. Gray. Stochastic alternating direction method of multipliers. In International Conference on Machine Learning, pp. 80–88, 2013.
299
+ N. Papernot, I. Goodfellow, R. Sheatsley, R. Feinman, and P. McDaniel. cleverhans v1.0.0: an adversarial machine learning library. arXiv preprint arXiv:1610.00768, 2016a.
300
+ N. Papernot, P. McDaniel, S. Jha, M. Fredrikson, B. Celik, and A. Swami. The limitations of deep learning in adversarial settings. In Security and Privacy (EuroS&P), 2016 IEEE European Symposium on, pp. 372–387. IEEE, 2016b.
301
+ N. Papernot, P. McDaniel, X. Wu, S. Jha, and A. Swami. Distillation as a defense to adversarial perturbations against deep neural networks. In Security and Privacy (SP), 2016 IEEE Symposium on, pp. 582–597. IEEE, 2016c.
302
+ N. Papernot, P. McDaniel, I. Goodfellow, S. Jha, Z. Celik, and A. Swami. Practical black-box attacks against machine learning. In Proceedings of the 2017 ACM on Asia Conference on Computer and Communications Security, pp. 506–519. ACM, 2017.
303
+ N. Parikh, S. Boyd, et al. Proximal algorithms. Foundations and Trends $\textsuperscript { \textregistered }$ in Optimization, 1(3): 127–239, 2014.
304
+ M. Sharif, L. Bauer, and M. K. Reiter. On the suitability of lp-norms for creating and preventing adversarial examples. CoRR, abs/1802.09653, 2018.
305
+ X. Shi, M. Sapkota, F. Xing, F. Liu, L. Cui, and L. Yang. Pairwise based deep ranking hashing for histopathology image classification and retrieval. Pattern Recognition, 81:14 – 22, 2018. ISSN 0031-3203. doi: https://doi.org/10.1016/j.patcog.2018.03.015. URL http: //www.sciencedirect.com/science/article/pii/S0031320318301055.
306
+ D. Silver, A. Huang, C. Maddison, A. Guez, L. Sifre, G. Van Den Driessche, J. Schrittwieser, I. Antonoglou, V. Panneershelvam, M. Lanctot, et al. Mastering the game of go with deep neural networks and tree search. nature, 529(7587):484–489, 2016.
307
+ A. Sinha, H. Namkoong, and J. Duchi. Certifying some distributional robustness with principled adversarial training. 2018.
308
+ Dong Su, Huan Zhang, Hongge Chen, Jinfeng Yi, Pin-Yu Chen, and Yupeng Gao. Is robustness the cost of accuracy?–a comprehensive study on the robustness of 18 deep image classification models. arXiv preprint arXiv:1808.01688, 2018.
309
+ J. Su, D. Vargas, and S. Kouichi. One pixel attack for fooling deep neural networks. arXiv preprint arXiv:1710.08864, 2017.
310
+ T. Suzuki. Dual averaging and proximal gradient descent for online alternating direction multiplier method. In International Conference on Machine Learning, pp. 392–400, 2013.
311
+ C. Szegedy, W. Zaremba, I. Sutskever, J. Bruna, D. Erhan, I. Goodfellow, and R. Fergus. Intriguing properties of neural networks. arXiv preprint arXiv:1312.6199, 2013.
312
+ C. Szegedy, V. Vanhoucke, S. Ioffe, J. Shlens, and Z. Wojna. Rethinking the inception architecture for computer vision. 2016 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 2818–2826, 2016.
313
+ Christian Szegedy, Sergey Ioffe, Vincent Vanhoucke, and Alexander A Alemi. Inception-v4, inception-resnet and the impact of residual connections on learning. In AAAI, volume 4, pp. 12, 2017.
314
+ F. Tramèr, A. Kurakin, N. Papernot, I. Goodfellow, D. Boneh, and P. McDaniel. Ensemble adversarial training: Attacks and defenses. 2018 ICLR, arXiv preprint arXiv:1705.07204, 2018.
315
+ C. Xiao, J. Zhu, B. Li, W. He, M. Liu, and D. Song. Spatially transformed adversarial examples. CoRR, abs/1801.02612, 2018. URL http://arxiv.org/abs/1801.02612.
316
+ M. Yuan and Y. Lin. Model selection and estimation in regression with grouped variables. Journal of the Royal Statistical Society: Series B (Statistical Methodology), 68(1):49–67, 2006.
317
+ B. Zhou, A. Khosla, A. Lapedriza, A. Oliva, and A. Torralba. Learning deep features for discriminative localization. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 2921–2929, 2016.
318
+
319
+ # APPENDIX
320
+
321
+ # A ILLUSTRATIVE EXAMPLE OF GROUP SPARSITY
322
+
323
+ ![](images/495f2f1b7630c48a3fc9e71f27d4422891eb7fa55b1b6f64c1ef5711a31e6ed4.jpg)
324
+ Figure A1: An example of $4 \times 4$ perturbation matrix under sliding masks with different strides. The values of matrix elements are represented by color’s intensity (white stands for 0). Left: Non-overlapping groups with $r = 2$ and $S = 2$ . Right: Overlapping groups with $r = 2$ and $S = 1$ . In both cases, two groups $\mathcal { G } _ { 1 , 1 }$ and $\mathcal { G } _ { 1 , 2 }$ are highlighted, where $\mathcal { G } _ { 1 , 1 }$ is non-sparse, and $\mathcal { G } _ { 1 , 2 }$ is sparse.
325
+
326
+ # B PROOF OF PROPOSITION 1
327
+
328
+ We recall that the augmented Lagrangian function $L ( \delta , \mathbf { z } , \mathbf { w } , \mathbf { y } , \mathbf { u } , \mathbf { v } , \mathbf { s } )$ is given by
329
+
330
+ $$
331
+ \begin{array} { r l r } & { } & { L ( { \bf z } , \delta , { \bf y } , { \bf w } , { \bf u } , { \bf v } , { \bf s } ) = f ( { \bf z } + { \bf x } _ { 0 } ) + \gamma D ( \delta ) + \tau \sum _ { i = 1 } ^ { P Q } \| { \bf y } _ { \mathcal { D } _ { i } } \| _ { 2 } + h ( { \bf w } ) + { \bf u } ^ { T } ( \delta - { \bf z } ) } \\ & { } & { + { \bf v } ^ { T } ( { \bf y } - { \bf z } ) + { \bf s } ^ { T } ( { \bf w } - { \bf z } ) + \displaystyle \frac { \rho } { 2 } \| \delta - { \bf z } \| _ { 2 } ^ { 2 } + \displaystyle \frac { \rho } { 2 } \| { \bf y } - { \bf z } \| _ { 2 } ^ { 2 } + \displaystyle \frac { \rho } { 2 } \| { \bf w } - { \bf z } \| _ { 2 } ^ { 2 } . } \end{array}
332
+ $$
333
+
334
+ Problem (7), to minimize $L ( \delta , \mathbf { z } ^ { k } , \mathbf { w } , \mathbf { y } , \mathbf { u } ^ { k } , \mathbf { v } ^ { k } , \mathbf { s } ^ { k } )$ , can be decomposed into three sub-problems:
335
+
336
+ $$
337
+ \operatorname* { m i n i m i z e } _ { \delta } \gamma D ( \pmb { \delta } ) + \frac { \rho } { 2 } \| \pmb { \delta } - \mathbf { a } \| _ { 2 } ^ { 2 } ,
338
+ $$
339
+
340
+ $$
341
+ \operatorname* { m i n i m i z e } _ { \mathbf { w } } { h ( \mathbf { w } ) } + \frac { \rho } { 2 } \| \mathbf { w } - \mathbf { b } \| _ { 2 } ^ { 2 } ,
342
+ $$
343
+
344
+ $$
345
+ \underset { \mathbf { y } } { \mathrm { m i n i m i z e } } \ \tau \sum _ { i = 1 } ^ { P Q } \| \mathbf { y } _ { \mathcal { D } _ { i } } \| _ { 2 } + \frac { \rho } { 2 } \| \mathbf { y } - \mathbf { c } \| _ { 2 } ^ { 2 } ,
346
+ $$
347
+
348
+ where $\mathbf { a } : = \mathbf { z } ^ { k } - \mathbf { u } ^ { k } / \rho , \mathbf { b } : = \mathbf { z } ^ { k } - \mathbf { s } ^ { k } / \rho$ , and $\mathbf { c } : = \mathbf { z } ^ { k } - \mathbf { v } ^ { k } / \rho .$ .
349
+
350
+ $\delta$ -step Suppose $D ( \delta ) = \| \delta \| _ { 2 } ^ { 2 }$ , then the solution to problem (25) is easily acquired as below
351
+
352
+ $$
353
+ \delta ^ { k + 1 } = \frac { \rho } { \rho + 2 \gamma } \mathbf { a }
354
+ $$
355
+
356
+ w-step Based on the definition of $h ( \mathbf { w } )$ , problem (26) becomes
357
+
358
+ $$
359
+ \begin{array} { r l } { \underset { \mathbf { w } } { \mathrm { m i n i m i z e } } } & { \| \mathbf { w } - \mathbf { b } \| _ { 2 } ^ { 2 } } \\ { \mathrm { s u b j e c t ~ t o } } & { ( \mathbf { x } _ { 0 } + \mathbf { w } ) \in [ 0 , 1 ] ^ { n } , \ \| \mathbf { w } \| _ { \infty } \leq \epsilon . } \end{array}
360
+ $$
361
+
362
+ Problem (29) is equivalent to
363
+
364
+ $$
365
+ \begin{array} { r l } { \underset { w _ { i } } { \mathrm { m i n i m i z e } } } & { ( w _ { i } - a _ { i } ) _ { 2 } ^ { 2 } } \\ { \mathrm { s u b j e c t ~ t o } } & { - [ \mathbf { x } _ { 0 } ] _ { i } \leq w _ { i } \leq 1 - [ \mathbf { x } _ { 0 } ] _ { i } , | w _ { i } | \leq \epsilon } \end{array}
366
+ $$
367
+
368
+ for $i \in [ n ]$ , where $x _ { i }$ or $[ \mathbf { x } ] _ { i }$ represents the $i$ th element of $\mathbf { x }$ , and $1 - [ { \bf x } _ { 0 } ] _ { i } > 0$ since $[ \mathbf { x } _ { 0 } ] _ { i } \in [ 0 , 1 ]$ . Problem (30) then yields the solution
369
+
370
+ $$
371
+ [ \mathbf { w } ^ { k + 1 } ] _ { i } = \left\{ \begin{array} { l l } { \operatorname* { m i n } \{ 1 - [ \mathbf { x } _ { 0 } ] _ { i } , \epsilon \} } & { a _ { i } > \operatorname* { m i n } \{ 1 - [ \mathbf { x } _ { 0 } ] _ { i } , \epsilon \} } \\ { \operatorname* { m a x } \{ - [ \mathbf { x } _ { 0 } ] _ { i } , - \epsilon \} } & { a _ { i } < \operatorname* { m a x } \{ - [ \mathbf { x } _ { 0 } ] _ { i } , - \epsilon \} } \\ { a _ { i } } & { \mathrm { o t h e r w i s e } . } \end{array} \right.
372
+ $$
373
+
374
+ y-step Problem (27) becomes
375
+
376
+ $$
377
+ \underset { \mathbf { y } } { \mathrm { m i n i m i z e } } \sum _ { i = 1 } ^ { P Q } \| \mathbf { y } _ { \mathcal { D } _ { i } } \| _ { 2 } + \frac { \rho } { 2 \tau } \| \mathbf { y } - \mathbf { c } \| _ { 2 } ^ { 2 } ,
378
+ $$
379
+
380
+ The solution is given by the proximal operator associated with the $\ell _ { 2 }$ norm with parameter $\tau / \rho$ (Parikh et al., 2014)
381
+
382
+ $$
383
+ [ { \bf y } ^ { k + 1 } ] _ { \mathcal { D } _ { i } } = \left( 1 - \frac { \tau } { \rho \| [ { \bf c } ] _ { \mathcal { D } _ { i } } \| _ { 2 } } \right) _ { + } [ { \bf c } ] _ { \mathcal { D } _ { i } } , \ i \in [ P Q ] ,
384
+ $$
385
+
386
+ where recall that $\cup _ { i \in [ P Q ] } { \mathcal { D } } _ { i } = [ n ]$ , and $\mathcal { D } _ { i } \cap \mathcal { D } _ { j } = \emptyset$ if $i \neq j$ .
387
+
388
+ # C PROOF OF PROPOSITION 2
389
+
390
+ The augmented Lagrangian of problem (16) is given by
391
+
392
+ $$
393
+ \begin{array} { l } { { \displaystyle \langle { \bf z } , \delta , { \bf w } , \{ \bf y } _ { i } \rangle , { \bf u } , { \bf v } _ { i } , { \bf s } \rangle = f ( { \bf z } + { \bf x } _ { 0 } ) + \gamma D ( \delta ) + h ( { \bf w } ) + \tau \sum _ { i = 1 } ^ { P Q } \| { \bf y } _ { i } , { \mathcal D } _ { i } \| _ { 2 } + { \bf u } ^ { T } ( \delta - { \bf z } ) + { \bf s } ^ { T } ( { \bf w } - { \bf z } ) } \\ { { \displaystyle \qquad + \sum _ { i = 1 } ^ { P Q } { \bf v } _ { i } ^ { T } ( { \bf y } _ { i } - { \bf z } ) + \frac { \rho } { 2 } \| \delta - { \bf z } \| _ { 2 } ^ { 2 } + \frac { \rho } { 2 } \| { \bf w } - { \bf z } \| _ { 2 } ^ { 2 } + \frac { \rho } { 2 } \sum _ { i = 1 } ^ { P Q } \| { \bf y } _ { i } - { \bf z } \| _ { 2 } ^ { 2 } } , } \end{array}
394
+ $$
395
+
396
+ where u, $\mathbf { v } _ { i }$ and s are the Lagrangian multipliers.
397
+
398
+ ADMM decomposes the optimization variables into two blocks and adopts the following iterative scheme,
399
+
400
+ $$
401
+ \begin{array} { r l } & { \{ \delta ^ { k + 1 } , \mathbf w ^ { k + 1 } , \mathbf y _ { i } ^ { k + 1 } \} = \underset { \delta , \mathbf w , \{ \mathbf y _ { i } \} } { \arg \operatorname* { m i n } } L ( \mathbf z ^ { k } , \delta , \mathbf w , \mathbf y _ { i } , \mathbf u ^ { k } , \mathbf v _ { i } ^ { k } , \mathbf s ^ { k } ) , } \\ & { } \\ & { \mathbf z ^ { k + 1 } = \underset { \mathbf z } { \arg \operatorname* { m i n } } L ( \mathbf z , \delta ^ { k + 1 } , \mathbf w ^ { k + 1 } , \mathbf y _ { i } ^ { k + 1 } , \mathbf u ^ { k } , \mathbf v _ { i } ^ { k } , \mathbf s ^ { k } ) , } \\ & { \left\{ \begin{array} { l l } { \mathbf u ^ { k + 1 } = \mathbf u ^ { k } + \rho ( \delta ^ { k + 1 } - \mathbf z ^ { k + 1 } ) , } \\ { \mathbf v _ { i } ^ { k + 1 } = \mathbf v _ { i } ^ { k } + \rho ( \mathbf y _ { i } ^ { k + 1 } - \mathbf z ^ { k + 1 } ) , \mathrm { ~ f o r ~ } i \in [ P Q ] , } \\ { \mathbf s ^ { k + 1 } = \mathbf s ^ { k } + \rho ( \mathbf w ^ { k + 1 } - \mathbf z ^ { k + 1 } ) , } \end{array} \right. } \end{array}
402
+ $$
403
+
404
+ where $k$ is the iteration index. Problem (35) can be split into three subproblems as shown below,
405
+
406
+ $$
407
+ \operatorname* { m i n i m i z e } _ { \delta } \gamma D ( \pmb { \delta } ) + \frac { \rho } { 2 } \| \pmb { \delta } - \mathbf { a } \| _ { 2 } ^ { 2 } ,
408
+ $$
409
+
410
+ $$
411
+ \operatorname* { m i n i m i z e } _ { \mathbf { w } } ~ h ( \mathbf { w } ) + \frac { \rho } { 2 } \| \mathbf { w } - \mathbf { b } \| _ { 2 } ^ { 2 } ,
412
+ $$
413
+
414
+ $$
415
+ \operatorname* { m i n i m i z e } _ { \mathbf { y } _ { i } } { \tau } | | \mathbf { y } _ { i , \mathcal { D } _ { i } } | | _ { 2 } + \frac { \rho } { 2 } | | \mathbf { y } _ { i } - \mathbf { c } _ { i } | | _ { 2 } ^ { 2 } , \mathrm { f o r } i \in [ P Q ] .
416
+ $$
417
+
418
+ where $\mathbf { a } = \mathbf { z } ^ { k } - \mathbf { u } ^ { k } / \rho$ , $\mathbf { b } = \mathbf { z } ^ { k } - \mathbf { s } ^ { k } / \rho$ and $\mathbf { c } _ { i } = \mathbf { z } ^ { k } - \mathbf { v } _ { i } ^ { k } / \rho$ . Each problem has a closed form solution. Note that the solutions to problem (38) and problem (39) are given (28) and (31).
419
+
420
+ $\mathbf { y } _ { i }$ -step Problem (40) can be rewritten as
421
+
422
+ $$
423
+ \displaystyle \operatorname* { m i n i m i z e } _ { \mathbf { y } _ { i } } \ : \tau \| \mathbf { y } _ { i , \mathcal { D } _ { i } } \| _ { 2 } + \frac { \rho } { 2 } \| \mathbf { y } _ { i , \mathcal { D } _ { i } } - [ \mathbf { c } _ { i } ] _ { \mathcal { D } _ { i } } \| _ { 2 } ^ { 2 } + \frac { \rho } { 2 } \| \mathbf { y } _ { i , [ n ] / \mathcal { D } _ { i } } - [ \mathbf { c } _ { i } ] _ { [ n ] / \mathcal { D } _ { i } } \| _ { 2 } ^ { 2 } , \mathrm { ~ f o r ~ } i \in [ P Q ] ,
424
+ $$
425
+
426
+ which can be decomposed into
427
+
428
+ $$
429
+ \begin{array} { r l } & { \underset { { \bf y } _ { i , \mathcal { D } _ { i } } } { \mathrm { m i n i m i z e ~ } } \tau \| { \bf y } _ { i , \mathcal { D } _ { i } } \| _ { 2 } + \frac { \rho } { 2 } \| { \bf y } _ { i , \mathcal { D } _ { i } } - [ { \bf c } _ { i } ] _ { \mathcal { D } _ { i } } \| _ { 2 } ^ { 2 } , \mathrm { ~ f o r ~ } i \in [ P Q ] , } \end{array}
430
+ $$
431
+
432
+ and
433
+
434
+ $$
435
+ \mathop { \operatorname* { m i n i m i z e } } _ { \mathbf { y } _ { i , [ n ] / \mathcal { D } _ { i } } } ~ \| \mathbf { y } _ { i , [ n ] / \mathcal { D } _ { i } } - [ \mathbf { c } _ { i } ] _ { [ n ] / \mathcal { D } _ { i } } \| _ { 2 } ^ { 2 } , \mathrm { f o r } i \in [ P Q ] .
436
+ $$
437
+
438
+ The solution to problem (42) can be obtained through the block soft thresholding operator (Parikh et al., 2014),
439
+
440
+ $$
441
+ \big [ \mathbf { y } _ { i } ^ { k + 1 } \big ] _ { \mathcal { D } _ { i } } = \left( 1 - \frac { \tau } { \rho \| \big [ \mathbf { c } _ { i } \big ] _ { \mathcal { D } _ { i } } \| _ { 2 } } \right) _ { + } [ \mathbf { c } _ { i } ] _ { \mathcal { D } _ { i } } , \mathrm { f o r } i \in [ P Q ] ,
442
+ $$
443
+
444
+ The solution to problem (43) is given by,
445
+
446
+ $$
447
+ \begin{array} { r } { \left[ \mathbf { y } _ { i } ^ { k + 1 } \right] _ { [ n ] / \mathcal { D } _ { i } } = [ \mathbf { c } _ { i } ] _ { [ n ] / \mathcal { D } _ { i } } , \mathrm { f o r } i \in [ P Q ] . } \end{array}
448
+ $$
449
+
450
+ z-step Problem (36) can be simplified to
451
+
452
+ $$
453
+ \operatorname* { m i n i m i z e } _ { \mathbf { z } } \quad f ( \mathbf { x } _ { 0 } + \mathbf { z } ) + \frac { \rho } { 2 } \| \mathbf { z } - \mathbf { a } ^ { \prime } \| _ { 2 } ^ { 2 } + \frac { \rho } { 2 } \| \mathbf { z } - \mathbf { b } ^ { \prime } \| _ { 2 } ^ { 2 } + \frac { \rho } { 2 } \sum _ { i = 1 } ^ { P Q } \| \mathbf { z } - \mathbf { c } _ { i } ^ { \prime } \| _ { 2 } ^ { 2 } ,
454
+ $$
455
+
456
+ where $\mathbf { a } ^ { \prime } : = \delta ^ { k + 1 } + \mathbf { u } ^ { k } / \rho$ , $\mathbf b ^ { \prime } : = \mathbf w ^ { k + 1 } + \mathbf s ^ { k } / \rho$ , and $\mathbf c _ { i } ^ { \prime } : = \mathbf y _ { i } ^ { k + 1 } + \mathbf v _ { i } ^ { k } / \rho$ . We solve problem (46) using the linearization technique (Suzuki, 2013; Liu et al., 2018; Boyd et al., 2011). More specifically, the function $f$ is replaced with its first-order Taylor expansion at the point $\mathbf { z } ^ { k }$ by adding a Bregman divergence term $( \eta _ { k } \mathbf { \dot { / } } 2 ) \lVert \mathbf { z } - \mathbf { z } ^ { k } \rVert _ { 2 } ^ { 2 }$ . As a result, problem (46) becomes
457
+
458
+ $$
459
+ \begin{array} { r l } { \underset { \mathbf { z } } { \mathrm { m i n i m i z e } } } & { ( \nabla f ( \mathbf { z } ^ { k } + \mathbf { x } _ { 0 } ) ) ^ { T } ( \mathbf { z } - \mathbf { z } ^ { k } ) + \displaystyle \frac { \eta _ { k } } { 2 } \| \mathbf { z } - \mathbf { z } ^ { k } \| _ { 2 } ^ { 2 } + \displaystyle \frac { \rho } { 2 } \| \mathbf { z } - \mathbf { a } ^ { \prime } \| _ { 2 } ^ { 2 } } \\ & { + \displaystyle \frac { \rho } { 2 } \| \mathbf { z } - \mathbf { b } ^ { \prime } \| _ { 2 } ^ { 2 } + \displaystyle \frac { \rho } { 2 } \sum _ { i = 1 } ^ { P Q } \| \mathbf { z } - \mathbf { c } _ { i } ^ { \prime } \| _ { 2 } ^ { 2 } , } \end{array}
460
+ $$
461
+
462
+ whose solution is given by
463
+
464
+ $$
465
+ \mathbf { z } ^ { k + 1 } = \frac { \eta _ { k } \mathbf { z } ^ { k } + \rho \mathbf { a } ^ { \prime } + \rho \mathbf { b } ^ { \prime } + \rho \sum _ { i = 1 } ^ { P Q } \mathbf { c } _ { i } ^ { \prime } - \nabla f ( \mathbf { z } ^ { k } + \mathbf { x } _ { 0 } ) } { \eta _ { k } + ( 2 + P Q ) \rho } .
466
+ $$
467
+
468
+ # D PROOF OF PROPOSITION 3
469
+
470
+ We start by converting problem (20) into the ADMM form
471
+
472
+ $$
473
+ \begin{array} { r l } { \underset { \delta , \mathbf { z } } { \mathrm { m i n i m i z e } } } & { \ f ( \mathbf { x } _ { 0 } + \mathbf { z } ) + g ( \mathbf { z } ) + \gamma D ( \delta ) + h ( \delta ) + g ( \delta ) } \\ { \mathrm { s u b j e c t \ t o } } & { \ \delta = \mathbf { z } , } \end{array}
474
+ $$
475
+
476
+ where $\mathbf { z }$ and $\delta$ are optimization variables, $g ( \delta )$ is an indicator function with respect to the constraint $\{ \delta _ { i } = 0$ , if $i \in \mathcal { S } _ { \sigma } \bar \}$ , and $h ( \delta )$ is the other indicator function with respect to the other constraints $( \mathbf { x } _ { 0 } + \pmb { \delta } ) \in [ 0 , 1 ] ^ { n }$ , $\| \pmb { \delta } \| _ { \infty } \le \epsilon$ .
477
+
478
+ The augmented Lagrangian of problem (20) is given by
479
+
480
+ $$
481
+ L ( \boldsymbol { \delta } , \mathbf { z } , \mathbf { u } ) = f ( \mathbf { z } + \mathbf { x } _ { 0 } ) + g ( \mathbf { z } ) + \gamma D ( \boldsymbol { \delta } ) + h ( \boldsymbol { \delta } ) + g ( \boldsymbol { \delta } ) + \mathbf { u } ^ { T } ( \boldsymbol { \delta } - \mathbf { z } ) + \frac { \rho } { 2 } \| \boldsymbol { \delta } - \mathbf { z } \| _ { 2 } ^ { 2 } ,
482
+ $$
483
+
484
+ where $\mathbf { u }$ is the Lagrangian multiplier.
485
+
486
+ ADMM yields the following alternating steps
487
+
488
+ $$
489
+ \begin{array} { r l } & { \delta ^ { k + 1 } = \underset { \delta } { \arg \operatorname* { m i n } } L ( \delta , \mathbf { z } ^ { k } , \mathbf { u } ^ { k } ) } \\ & { \mathbf { z } ^ { k + 1 } = \underset { \mathbf { z } } { \arg \operatorname* { m i n } } L ( \delta ^ { k + 1 } , \mathbf { z } , \mathbf { u } ^ { k } ) } \\ & { \mathbf { u } ^ { k + 1 } = \mathbf { u } ^ { k } + \rho ( \delta ^ { k + 1 } - \mathbf { z } ^ { k + 1 } ) . } \end{array}
490
+ $$
491
+
492
+ $\delta$ -step Suppose $D ( \delta ) = \| \delta \| _ { 2 } ^ { 2 }$ , problem (51) becomes
493
+
494
+ $$
495
+ \begin{array} { r l } { \underset { \delta } { \mathrm { m i n i m i z e } } } & { \gamma \| \pmb { \delta } \| _ { 2 } ^ { 2 } + \frac { \rho } { 2 } \| \pmb { \delta } - \mathbf { a } \| _ { 2 } ^ { 2 } } \\ { \mathrm { s u b j e c t ~ t o } } & { ( \mathbf { x } _ { 0 } + \pmb { \delta } ) \in [ 0 , 1 ] ^ { n } , \| \pmb { \delta } \| _ { \infty } \leq \epsilon } \\ & { \delta _ { i } = 0 , \mathrm { i f ~ } i \in \mathcal { S } _ { \sigma } , } \end{array}
496
+ $$
497
+
498
+ where $\mathbf { a } : = \mathbf { z } ^ { k } - \mathbf { u } ^ { k } / \rho$ . Problem (54) can be decomposed elementwise
499
+
500
+ $$
501
+ \begin{array} { r l } { \underset { \delta _ { i } } { \mathrm { m i n i m i z e } } } & { \frac { 2 \gamma + \rho } { \rho } \delta _ { i } ^ { 2 } - 2 a _ { i } \delta _ { i } + a _ { i } ^ { 2 } = \frac { 2 \gamma + \rho } { \rho } \left( \delta _ { i } - \frac { \rho } { 2 \gamma + \rho } a _ { i } \right) ^ { 2 } } \\ { \mathrm { s u b j e c t \ t o } } & { \left( [ \mathbf { x } _ { 0 } ] _ { i } + \delta _ { i } \right) \in [ 0 , 1 ] , ~ | \delta _ { i } | \leq \epsilon } \\ & { \delta _ { i } = 0 , ~ \mathrm { i f } ~ i \in \mathcal { S } _ { \sigma } . } \end{array}
502
+ $$
503
+
504
+ The solution to problem (55) is then given by
505
+
506
+ $$
507
+ [ \delta ^ { k + 1 } ] _ { i } = \left\{ \begin{array} { l l } { 0 } & { i \in { \mathcal { S } } _ { \sigma } } \\ { \operatorname* { m i n } \{ 1 - [ { \mathbf { x } } _ { 0 } ] _ { i } , \epsilon \} } & { \frac { \rho } { 2 \gamma + \rho } a _ { i } > \operatorname* { m i n } \{ 1 - [ { \mathbf { x } } _ { 0 } ] _ { i } , \epsilon \} , i \notin { \mathcal { S } } _ { \sigma } } \\ { \operatorname* { m a x } \{ - [ { \mathbf { x } } _ { 0 } ] _ { i } , - \epsilon \} } & { \frac { \rho } { 2 \gamma + \rho } a _ { i } < \operatorname* { m a x } \{ - [ { \mathbf { x } } _ { 0 } ] _ { i } , - \epsilon \} , i \notin { \mathcal { S } } _ { \sigma } } \\ { \frac { \rho } { 2 \gamma + \rho } a _ { i } } & { \mathrm { o t h e r w i s e } . } \end{array} \right.
508
+ $$
509
+
510
+ $\mathbf { z }$ -step Problem (52) yields
511
+
512
+ $$
513
+ \begin{array} { r l } { \underset { \mathbf { z } } { \mathrm { m i n i m i z e } } } & { { } f ( \mathbf { x } _ { 0 } + \mathbf { z } ) + \displaystyle \frac { \rho } { 2 } \| \mathbf { z } - \mathbf { a } ^ { \prime } \| _ { 2 } ^ { 2 } } \\ { \mathrm { s u b j e c t ~ t o } } & { { } z _ { i } = 0 , \mathrm { ~ i f ~ } i \in \mathcal { S } _ { \sigma } , } \end{array}
514
+ $$
515
+
516
+ where $\mathbf { a } ^ { \prime } = \delta ^ { k + 1 } + \mathbf { u } ^ { k } / \rho$ . We solve problem (57) using the linearization technique (Suzuki, 2013; Liu et al., 2018; Boyd et al., 2011),
517
+
518
+ $$
519
+ \begin{array} { l l } { \mathrm { m i n i m i z e } } & { ( \nabla f ( \mathbf { x } _ { 0 } + \mathbf { z } ^ { k } ) ) ^ { T } ( \mathbf { z } - \mathbf { z } ^ { k } ) + \displaystyle \frac { \eta _ { k } } { 2 } \| \mathbf { z } - \mathbf { z } ^ { k } \| _ { 2 } ^ { 2 } + \displaystyle \frac { \rho } { 2 } \| \mathbf { z } - \mathbf { a } ^ { \prime } \| _ { 2 } ^ { 2 } } \\ { \mathrm { s u b j e c t ~ t o } } & { z _ { i } = 0 , \mathrm { ~ i f ~ } i \in \mathcal { S } _ { \sigma } , } \end{array}
520
+ $$
521
+
522
+ where $\eta _ { k }$ is a decaying parameter associated with the Bregman divergence term $\| \mathbf { z } - \mathbf { z } ^ { k } \| _ { 2 } ^ { 2 }$ . In problems (57) and (58), only variables $\left\{ z _ { i } \right\}$ satisfying $i \notin S _ { \sigma }$ are unknown. The solution to problem (58) is then given by
523
+
524
+ $$
525
+ \begin{array} { r } { [ \mathbf { z } ^ { k + 1 } ] _ { i } = \left\{ \begin{array} { l l } { 0 } & { i \in \mathcal { S } _ { \sigma } } \\ { \frac { \eta _ { k } [ \mathbf { z } ^ { k } ] _ { i } + \rho [ \mathbf { a } ^ { \prime } ] _ { i } - [ \nabla f ( \mathbf { z } ^ { k } + \mathbf { x } _ { 0 } ) ] _ { i } } { \eta _ { k } + \rho } } & { i \notin \mathcal { S } _ { \sigma } . } \end{array} \right. } \end{array}
526
+ $$
527
+
528
+ # E ADVERSARIAL SALIENCY MAP (ASM) AND CLASS ACTIVATION MAPPING (CAM)
529
+
530
+ $\mathrm { A S M } ( \mathbf { x } , t ) \in \mathbb { R } ^ { d }$ is defined by the forward derivative of a neural network given the input sample $\mathbf { x }$ and the target label $t$ (Papernot et al., 2016b)
531
+
532
+ $$
533
+ \begin{array} { r } { \mathrm { A S M } ( \mathbf { x } , t ) [ i ] = \left\{ \begin{array} { l l } { 0 } & { \mathrm { i f } \frac { \partial Z ( \mathbf { x } ) _ { t } } { \partial \mathbf { x } _ { i } } < 0 \mathrm { o r } \sum _ { j \neq t } \frac { \partial Z ( \mathbf { x } ) _ { j } } { \partial \mathbf { x } _ { i } } > 0 } \\ { \left( \frac { \partial Z ( \mathbf { x } ) _ { t } } { \partial \mathbf { x } _ { i } } \right) \left| \sum _ { j \neq t } \frac { \partial Z ( \mathbf { x } ) _ { j } } { \partial \mathbf { x } _ { i } } \right| } & { \mathrm { o t h e r w i s e } , } \end{array} \right. } \end{array}
534
+ $$
535
+
536
+ where $Z ( \mathbf { x } ) _ { j }$ is the $j$ th element of logits $Z ( \mathbf { x } )$ , representing the output before the last softmax layer in DNNs. If there exist many classes in a dataset (e.g., 1000 classes in ImageNet), then computing $\textstyle \sum _ { j \neq t } { \frac { \partial Z ( \mathbf { x } ) _ { j } } { \partial \mathbf { x } _ { i } } }$ t ∂Z(x)j∂x is intensive. To circumvent the scalability issue of ASM, we focus on the logit change with respect to the true label $t _ { 0 }$ and the target label $t$ only. More specifically, we consider three quantities, $\begin{array} { r } { \frac { \partial Z ( \mathbf { x } ) _ { t } } { \partial \mathbf { x } _ { i } } , - \frac { \partial Z ( \mathbf { x } ) _ { 0 } } { \partial \mathbf { x } _ { i } } } \end{array}$ , and $\begin{array} { r } { \left( \frac { \partial Z ( \mathbf { x } ) _ { t } } { \partial \mathbf { x } _ { i } } \right) \left| \sum _ { j \neq t } \frac { \partial Z ( \mathbf { x } ) _ { j } } { \partial \mathbf { x } _ { i } } \right| , } \end{array}$ , which correspond to a) promotion of the score of the target label $t$ , b) suppression of the classification score of the true label $t _ { 0 }$ , and c) a dual role on suppression and promotion. As a result, we modify (60) as
537
+
538
+ $$
539
+ \begin{array} { r } { \mathrm { A S M } ( \mathbf { x } , t ) [ i ] = \left\{ \begin{array} { l l } { 0 } & { \mathrm { ~ i f ~ } \frac { \partial Z ( \mathbf { x } ) _ { t } } { \partial \mathbf { x } _ { i } } < 0 \mathrm { ~ o r ~ } \frac { \partial Z ( \mathbf { x } ) _ { t _ { 0 } } } { \partial \mathbf { x } _ { i } } > 0 } \\ { \left( \frac { \partial Z ( \mathbf { x } ) _ { t } } { \partial \mathbf { x } _ { i } } \right) \left| \frac { \partial Z ( \mathbf { x } ) _ { t _ { 0 } } } { \partial \mathbf { x } _ { i } } \right| } & { \mathrm { ~ o t h e r w i s e } . } \end{array} \right. } \end{array}
540
+ $$
541
+
542
+ CAM allows us to visualize the perturbation of adversaries on predicted class scores given any pair of image and object label, and highlights the discriminative object regions detected by CNNs (Zhou et al., 2016). In Fig. A2, we show ASM and the discriminative regions identified by CAM on several ImageNet samples.
543
+
544
+ ![](images/85cc534c3cb14fcb9e8d40dfbbcc15cf7698922f10fafc4150609cc6375154d4.jpg)
545
+ Figure A2: (a) Overlay ASM and $\mathbf { B } _ { \mathrm { A S M } } \circ \delta$ on top of image with the true and the target label. From left to right: original image, ASM (darker color represents larger value of ASM score), $\mathbf { B } _ { \mathrm { A S M } } \circ \delta$ under our attack, and $\mathbf { B } _ { \mathrm { A S M } } \circ \pmb { \delta }$ under C&W attack. Here $\nu$ in $\mathbf { B } _ { \mathrm { A S M } }$ is set by the 90th percentile of ASM scores. (b) From left to right: original image, CAM of original label, and perturbations with target label generated from the StrAttack and C&W attack, respectively.
546
+
547
+ # F EXPERIMENT SETUP AND PARAMETER SETTING
548
+
549
+ In this work, we consider targeted adversarial attacks since they are believed stronger than untargeted attacks. For targeted attacks, we have different methods to choose the target labels. The average case selects the target label randomly among all the labels that are not the correct label. The best case performs attacks using all incorrect labels, and report the target label that is the least difficult to attack. The worst case performs attacks using all incorrect labels, and report the target label which is the most difficult to attack.
550
+
551
+ In our experiments, two networks are trained for MNIST and CIFAR-10, respectively, and a pretrained network is utilized for ImageNet. The model architectures for MNIST and CIFAR-10 are the same, both with four convolutional layers, two max pooling layers, two fully connected layers and a softmax layer. It can achieve $9 9 . 5 \%$ and $80 \%$ accuracy on MNIST and CIFAR-10, respectively. For ImageNet, a pre-trained Inception v3 network (Szegedy et al., 2016) is applied which can achieve $96 \%$ top-5 accuracy. All experiments are conducted on machines with NVIDIA GTX 1080 TI GPUs.
552
+
553
+ The implementations of FGM and IFGM are based on the CleverHans package (Papernot et al., 2016a). The key distortion parameter $\epsilon$ is determined by a fine-grained grid search. For IFGM, we perform 10 FGM iterations and the distortion parameter $\epsilon ^ { \prime }$ is set to $\epsilon / 1 0$ for effectiveness as shown in Tramèr et al. (2018). The implementation of the C&W attack is based on the opensource code provided by Carlini & Wagner (2017). The maximum iteration number is set to 1000 and it has 9 binary search steps.
554
+
555
+ In the StrAttack, the group size for MNIST and CIFAR-10 is $2 \times 2$ and its stride is set to 2 if the non-overlapping mask is used, otherwise the group size is $3 \times 3$ and stride is 2. The group size for ImageNet is $1 3 \times 1 3$ and its stride is set to 13. In ADMM, the parameter $\rho$ achieves a trade-off between the convergence rate and the convergence value. A larger $\rho$ could make ADMM converging faster but usually leads to perturbations with larger $\ell _ { p }$ distortion values. A proper configuration of the parameters is suggested as follows: We set the penalty parameter $\rho = 1$ , decaying parameter in (14) $\eta _ { 1 } = 5$ , $\tau = 2$ and $\gamma = 1$ . Moreover, we set $c$ defined in (3) to 0.5 for MNIST, 0.25 for CIFAR-10, and 2.5 for ImageNet. Refined attack technique proposed in Sec. 4.2 is applied for all experiments, we set $\sigma$ is equal to $3 \%$ quantile value of non-zero perturbation in $\delta ^ { * }$ . We observe that $73 \%$ of $\delta ^ { * }$ can be retrained to a $\sigma$ -sparse perturbation successfully which proof the effective of our refined attack step.
556
+
557
+ # G SUPPLEMENTARY EXPERIMENTAL RESULTS
558
+
559
+ ![](images/39f973ae40ee9639c50e1d0c0d12ab51daabe2b3424b93e84b701ef9598822b7.jpg)
560
+ Figure A3: C&W attack vs StrAttack on MNIST with grid size $2 \times 2$ .
561
+
562
+ Some random choice samples from MNIST (Fig. A3), CIFAR-10 (Fig. A4) and ImageNet (Fig. A5) compare StrAttack with C&W attack. For better sparse visual effect, we only show non-overlapping mask function results here. From these samples, we can discover a consistent phenomenon that our StrAttack is more interested in some particular regions, they usually appear on the objects or their edges in original images, distinctly seen in MNIST (Fig. A3) and ImageNet (Fig. A5).
563
+
564
+ # H STRATTACK AGAINST DEFENSIVE DISTILLATION AND ADVERSARIALTRAINING
565
+
566
+ In this section, we present the performance of the StrAttack against defensive distillation (Papernot et al., 2016c) and adversarial training (Tramèr et al., 2018). In defensive distillation, we evaluate the
567
+
568
+ ![](images/1709eb9cc90aba912103f361d377de750a609161f1d9a6fdd84a87d51c2bb3a3.jpg)
569
+ Figure A4: C&W attack vs StrAttack on CIFAR-10 with grid size $2 \times 2$ .
570
+
571
+ StrAttack for different temperature parameters on MNIST and CIFAR-10. We generate 9000 adversarial examples with 1000 randomly selected images from MNIST and CIFAR-10, respectively. The attack success rates of the StrAttack for different temperatures $T$ are all $100 \%$ . The reason is that distillation at temperature $T$ makes the logits approximately $T$ times larger but does not change the relative values of logits. The StrAttack which works on the relative values of logits does not fail.
572
+
573
+ We further use the StrAttack to break DNNs training on adversarial examples (Tramèr et al., 2018) with their correct labels on MNIST. The StrAttack is performed on three neural networks: the first network is unprotected, the second is obtained by retraining with $9 0 0 0 \mathrm { C } \& \mathrm { { W } }$ adversarial examples, and the third network is retained with 9000 adversarial examples crafted by the StrAttack. The success rate and distortions on the three networks are shown in Table A1. The StrAttack can break all three networks with $100 \%$ success rate. However, adversarial training shows certain defense effects as an increase on the $\ell _ { 1 }$ or $\ell _ { 2 }$ distortion on the latter two networks over the unprotected network is observed.
574
+
575
+ Table A1: StrAttack against adversarial training on MNIST
576
+
577
+ <table><tr><td rowspan="2">Adversarial training</td><td colspan="3">Best case</td><td colspan="3">Averagecase</td><td colspan="3">Worst case</td></tr><tr><td>ASR</td><td>l1</td><td>l2</td><td>ASR</td><td>l1</td><td>l2</td><td>ASR</td><td>l1</td><td>l2</td></tr><tr><td>None</td><td>100</td><td>10.9</td><td>1.51</td><td>100</td><td>18.05</td><td>2.16</td><td>100</td><td>26.9</td><td>2.81</td></tr><tr><td>C&amp;W</td><td>100</td><td>16.1</td><td>1.87</td><td>100</td><td>25.1</td><td>2.58</td><td>100</td><td>34.2</td><td>3.26</td></tr><tr><td>structured</td><td>100</td><td>15.6</td><td>1.86</td><td>100</td><td>25.1</td><td>2.61</td><td>100</td><td>34.6</td><td>3.31</td></tr></table>
578
+
579
+ ![](images/054d38529f162de9cc5fb7bf9a29dfeeb97413bd5d3c4b9bfc005f20fa05d6ac.jpg)
580
+ Figure A5: C&W attack vs StrAttack on ImageNet with grid size $1 3 \times 1 3$ .
md/train/Bki4EfWCb/Bki4EfWCb.md ADDED
@@ -0,0 +1,366 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # INFERENCE SUBOPTIMALITY IN VARIATIONAL AUTOENCODERS
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Amortized inference has led to efficient approximate inference for large datasets. The quality of posterior inference is largely determined by two factors: a) the ability of the variational distribution to model the true posterior and b) the capacity of the recognition network to generalize inference over all datapoints. We analyze approximate inference in variational autoencoders in terms of these factors. We find that suboptimal inference is often due to amortizing inference rather than the limited complexity of the approximating distribution. We show that this is due partly to the generator learning to accommodate the choice of approximation. Furthermore, we show that the parameters used to increase the expressiveness of the approximation play a role in generalizing inference rather than simply improving the complexity of the approximation.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ There has been significant work on improving inference in variational autoencoders (VAEs) (Kingma & Welling, 2014; Rezende et al., 2014) through the development of expressive approximate posteriors (Rezende & Mohamed, 2015; Kingma et al., 2016; Ranganath et al., 2016; Tomczak & Welling, 2016; 2017). These works have shown that with more expressive approximate posteriors, the model learns a better distribution over the data.
12
+
13
+ In this paper, we analyze inference suboptimality in VAEs: the mismatch between the true and approximate posterior. In other words, we are interested in understanding what factors cause the gap between the marginal log-likelihood and the evidence lower bound (ELBO). We refer to this as the inference gap. Moreover, we break down the inference gap into two components: the approximation gap and the amortization gap. The approximation gap comes from the inability of the approximate distribution family to exactly match the true posterior. The amortization gap refers to the difference caused by amortizing the variational parameters over the entire training set, instead of optimizing for each datapoint independently. We refer the reader to Table 1 for detailed definitions and Figure 1 for a simple illustration of the gaps. In Figure 1, ${ \mathcal { L } } [ q ]$ refers to the ELBO using an amortized distribution $q$ , whereas $q ^ { * }$ is the optimal $q$ within its variational family.
14
+
15
+ Our experiments investigate how the choice of encoder, posterior approximation, decoder, and model optimization affect the approximation and amortization gaps. We train VAE models in a number of settings on the MNIST, Fashion-MNIST (Xiao et al., 2017), and CIFAR10 datasets.
16
+
17
+ Our contributions are: a) we investigate inference suboptimality in terms of the approximation and amortization gaps, providing insight to guide future improvements in VAE inference, b) we quantitatively demonstrate that the learned true posterior accommodates the choice of approximation, and c) we demonstrate that using parameterized functions to improve the expressiveness of the approximation plays a large role in reducing error caused by amortization.
18
+
19
+ ![](images/7083885f712ccbaedc70c4ec67996ea743f40445ce818540472026cabebf20b2.jpg)
20
+ Figure 1: Gaps in Inference
21
+
22
+ <table><tr><td>Term</td><td>Definition</td><td>VAE Formulation</td></tr><tr><td>Inference</td><td>logp(x)-L[q]</td><td>KL(q(z|x)llp(z|x))</td></tr><tr><td>Approximation</td><td>logp(x)-L[q*]</td><td>KL(q*(z|x)lp(z|x))</td></tr><tr><td>Amortization</td><td>C-C[a]</td><td>KL(q(z|x)llp(z|x))-KL(q*(z|x)llp(z|x))</td></tr></table>
23
+
24
+ Table 1: Summary of Gap Terms. The middle column refers to the general case where our variational objective is a lower bound on the marginal log-likelihood (not necessarily the ELBO). The right most column demonstrates the specific case in VAEs. $q ^ { * } ( z | x )$ refers to the optimal approximation within a family $\mathcal { Q }$ , i.e. $\begin{array} { r } { q ^ { * } ( z | x ) = \mathrm { \bar { a r g m i n } } _ { q \in \mathcal { Q } } \mathrm { K L } \left( q ( z | \bar { x } ) | | \dot { p ( z | x ) } \right) } \end{array}$ .
25
+
26
+ # 2 BACKGROUND
27
+
28
+ # 2.1 INFERENCE IN VARIATIONAL AUTOENCODERS
29
+
30
+ Let $x$ be the observed variable, $z$ the latent variable, and $p ( x , z )$ be their joint distribution. Given a dataset $X = \{ x _ { 1 } , x _ { 2 } , . . . , x _ { N } \}$ , we would like to maximize the marginal log-likelihood:
31
+
32
+ $$
33
+ \log p ( X ) = \sum _ { i = 1 } ^ { N } \log p ( x _ { i } ) = \sum _ { i = 1 } ^ { N } \log \int p ( x _ { i } , z _ { i } ) d z _ { i } .
34
+ $$
35
+
36
+ In practice, the marginal log-likelihood is computationally intractable due to the integration over the latent variable $z$ . Instead, VAEs optimize the ELBO of the marginal log-likelihood (Kingma & Welling, 2014; Rezende et al., 2014):
37
+
38
+ $$
39
+ \begin{array} { r l } & { \log p ( x ) = \mathbb { E } _ { z \sim q ( z \mid x ) } \left[ \log \left( \displaystyle \frac { p ( x , z ) } { q ( z \mid x ) } \right) \right] + { \mathrm { K L } } \left( q ( z \mid x ) | | p ( z | x ) \right) } \\ & { \phantom { \exp x } \geq \mathbb { E } _ { z \sim q ( z \mid x ) } \left[ \log \left( \displaystyle \frac { p ( x , z ) } { q ( z \mid x ) } \right) \right] = \mathcal { L } _ { \mathrm { V A E } } [ q ] . } \end{array}
40
+ $$
41
+
42
+ From the above we can see that the lower bound is tight if $q ( z | x ) = p ( z | x )$ . The choice of $q ( z | x )$ is often a factorized Gaussian distribution for its simplicity and efficiency. VAEs perform amortized inference by utilizing a recognition network (encoder), resulting in efficient approximate inference for large datasets. The overall model is trained by stochastically optimizing the ELBO using the reparametrization trick (Kingma & Welling, 2014).
43
+
44
+ # 2.2 EXPRESSIVE APPROXIMATE POSTERIORS
45
+
46
+ There are a number of strategies for increasing the expressiveness of approximate posteriors, going beyond the original factorized-Gaussian. We briefly summarize normalizing flows and auxiliary variables.
47
+
48
+ # 2.2.1 NORMALIZING FLOWS
49
+
50
+ Normalizing flow (Rezende & Mohamed, 2015) is a change of variables procedure for constructing complex distributions by transforming probability densities through a series of invertible mappings. Specifically, if we transform a random variable $z _ { \mathrm { 0 } }$ with distribution $q _ { 0 } ( z )$ , the resulting random variable $z _ { T } = T ( z _ { 0 } )$ has a distribution:
51
+
52
+ $$
53
+ q _ { T } ( z _ { T } ) = q _ { 0 } ( z _ { 0 } ) \left| \mathrm { d e t } \frac { \partial z _ { T } } { \partial z _ { 0 } } \right| ^ { - 1 }
54
+ $$
55
+
56
+ By successively applying these transformations, we can build arbitrarily complex distributions. Stacking these transformations remains tractable due to the determinant being decomposable: $\operatorname* { d e t } ( A { \bar { B } } ) = \operatorname* { d e t } ( A ) \operatorname* { d e t } ( B )$ . An important property of these transformations is that we can take expectations with respect to the transformed density $q _ { T } ( z _ { T } )$ without explicitly knowing its formula known as the law of the unconscious statistician (LOTUS):
57
+
58
+ $$
59
+ \mathbb { E } _ { q _ { T } } [ h ( z _ { T } ) ] = \mathbb { E } _ { q _ { 0 } } [ h ( f _ { T } ( f _ { T - 1 } ( \dots f _ { 1 } ( z _ { 0 } ) ) ) ) ]
60
+ $$
61
+
62
+ Using the change of variable and LOTUS, the lower bound can be written as:
63
+
64
+ $$
65
+ \log p ( x ) \geq \mathbb { E } _ { z _ { 0 } \sim q _ { 0 } ( z | x ) } \left[ \log \left( \frac { p ( x , z _ { T } ) } { q _ { 0 } ( z _ { 0 } | x ) \prod _ { t = 1 } ^ { T } \left| \operatorname* { d e t } \frac { \partial z _ { t } } { \partial z _ { t - 1 } } \right| ^ { - 1 } } \right) \right] .
66
+ $$
67
+
68
+ The main constraint on these transformations is that the determinant of their Jacobian needs to be easily computable.
69
+
70
+ # 2.2.2 AUXILIARY VARIABLES
71
+
72
+ Deep generative models can be extended with auxiliary variables which leave the generative model unchanged but make the variational distribution more expressive. Just as hierarchical Bayesian models induce dependencies between data, hierarchical variational models can induce dependencies between latent variables. The addition of the auxiliary variable changes the lower bound to:
73
+
74
+ $$
75
+ \begin{array} { r l } & { \log p ( x ) \geq \mathbb { E } _ { z , v \sim q ( z , v \mid x ) } \left[ \log \left( \displaystyle \frac { p ( x , z ) r ( v \mid x , z ) } { q ( z , v \mid x ) } \right) \right] } \\ & { \qquad = \mathbb { E } _ { q ( z \mid x ) } \left[ \log \left( \displaystyle \frac { p ( x , z ) } { q ( z \mid x ) } \right) - { \mathrm { K L } \Big ( q ( v \mid z , x ) \| r ( v \mid x , z ) \Big ) } \right] } \end{array}
76
+ $$
77
+
78
+ where $r ( v | x , z )$ is called the reverse model. From Eqn. 8, we see that this bound is looser than the regular ELBO, however the extra flexibility provided by the auxiliary variable can result in a higher lower bound. This idea has been employed in works such as auxiliary deep generative models (ADGM, Maaløe et al. (2016)), hierarchical variational models (HVM, Ranganath et al. (2016)) and Hamiltonian variational inference (HVI, Salimans et al. (2015)).
79
+
80
+ # 2.3 MARGINAL LOG-LIKELIHOOD ESTIMATION
81
+
82
+ We use two bounds to estimate the marginal log-likelihood of a model: IWAE (Burda et al., 2016) and AIS (Neal, 2001). Here we describe the IWAE bound. See Section 6.5 in the appendix for a description of AIS.
83
+
84
+ The IWAE bound is a tighter lower bound than the VAE bound. More specifically, if we take multiple samples from the $q$ distribution, we can compute a tighter lower bound on the marginal log-likelihood:
85
+
86
+ $$
87
+ \log p ( x ) \geq \mathbb { E } _ { z _ { 1 } . . . z _ { k } \sim q ( z | x ) } \left[ \log \left( \frac { 1 } { k } \sum _ { i = 1 } ^ { k } \frac { p ( x , z _ { i } ) } { q ( z _ { i } | x ) } \right) \right] = \mathcal { L } _ { \mathrm { I W A E } } [ q ] .
88
+ $$
89
+
90
+ As the number of importance samples approaches infinity, the bound approaches the marginal loglikelihood. This importance weighted bound was introduced along with the Importance Weighted Autoencoder (Burda et al., 2016), thus we refer to it as the IWAE bound. It is often used as an evaluation metric for generative models (Burda et al., 2016; Kingma et al., 2016). As shown by Bachman & Precup (2015) and Cremer et al. (2017), the IWAE bound can be seen as using the VAE bound but with an importance weighted $q$ distribution.
91
+
92
+ # 3 METHODS
93
+
94
+ # 3.1 APPROXIMATION AND AMORTIZATION GAPS
95
+
96
+ The inference gap $\mathcal { G }$ is the difference between the marginal log-likelihood $\log p ( x )$ and a lower bound ${ \mathcal { L } } [ q ]$ . Given the distribution in the family that maximizes the bound, $q ^ { * } ( z | x ) \ =$ arg $\operatorname* { m a x } _ { q \in \mathcal { Q } } \mathcal { L } [ q ]$ , the inference gap decomposes as the sum of approximation and amortization gaps:
97
+
98
+ $$
99
+ \mathcal { G } = \log p ( x ) - \mathcal { L } [ q ] = \underbrace { \log p ( x ) - \mathcal { L } [ q ^ { * } ] } _ { \mathrm { A p p r o x i m a t i o n } } + \underbrace { \mathcal { L } [ q ^ { * } ] - \mathcal { L } [ q ] } _ { \mathrm { A m o r t i z a t i o n } } .
100
+ $$
101
+
102
+ For VAEs, we can translate the gaps to KL divergences by rearranging (2):
103
+
104
+ $$
105
+ \mathcal { G } _ { \mathrm { V A E } } = \mathrm { K L } \big ( q ^ { * } ( z | x ) | | p ( z | x ) \big ) + \mathrm { K L } \big ( q ( z | x ) | | p ( z | x ) \big ) - \mathrm { K L } \big ( q ^ { * } ( z | x ) | | p ( z | x ) \big ) .
106
+ $$
107
+
108
+ # 3.2 FLEXIBLE APPROXIMATE POSTERIOR
109
+
110
+ Our experimentation compares two families of approximate posteriors: the fully-factorized Gaussian (FFG) and a flexible flow (Flow). Our choice of flow is a combination of the Real NVP (Dinh et al., 2017) and auxiliary variables (Ranganath et al., 2016; Maaløe et al., 2016). Our model also resembles leap-frog dynamics applied in Hamiltonian Monte Carlo (HMC, Neal et al. (2011)).
111
+
112
+ Let $z \in \mathbb { R } ^ { n }$ be the variable of interest and $v \in \mathbb { R } ^ { n }$ the auxiliary variable. Each flow step involves:
113
+
114
+ $$
115
+ \begin{array} { l } { { v ^ { \prime } = v \circ \sigma _ { 1 } ( z ) + \mu _ { 1 } ( z ) } } \\ { { z ^ { \prime } = z \circ \sigma _ { 2 } ( v ^ { \prime } ) + \mu _ { 2 } ( v ^ { \prime } ) } } \end{array}
116
+ $$
117
+
118
+ where $\sigma _ { 1 } , \sigma _ { 2 } , \mu _ { 1 } , \mu _ { 2 } : \mathbb { R } ^ { n } \to \mathbb { R } ^ { n }$ are differentiable mappings parameterized by neural nets and $\circ$ takes the Hadamard or element-wise product. The determinant of the combined transformation’s Jacobian, $| \mathrm { d e t } ( D f ) |$ , can be easily evaluated. See section 6.2 in the Appendix for a detailed derivation.
119
+
120
+ Thus, we can jointly train the generative and flow-based inference model by optimizing the bound:
121
+
122
+ $$
123
+ \log p ( x ) \geq \mathbb { E } _ { z , v \sim q ( z , v \mid x ) } \left[ \log \left( { \frac { p ( x , z ^ { \prime } ) r ( v ^ { \prime } | x , z ^ { \prime } ) } { q ( z , v | x ) \left| \operatorname* { d e t } ( D f ) \right| ^ { - 1 } } } \right) \right] = \mathcal { L } _ { \mathrm { f l o w } } [ q ] .
124
+ $$
125
+
126
+ Additionally, multiple such type of transformations can be stacked to improve expressiveness. We refer readers to section 6.1.2 in the Appendix for details of our flow configuration adopted in the experimentation.
127
+
128
+ # 3.3 EVALUATION BOUNDS
129
+
130
+ We use several bounds to compute the inference gaps. To estimate the marginal log-likelihood, $\log { \hat { p } } ( x )$ , we take the maximum of our tightest lower bounds, specifically the maximum between the IWAE and AIS bounds. To compute the AIS bound, we use 100 chains, each with 500 intermediate distributions, where each transition consists of one HMC trajectory with 10 leapfrog steps. The initial distribution for AIS is the prior, so that it is encoder-independent.
131
+
132
+ For our experiments, we test two different variational distributions: the fully-factorized Gaussian $q _ { F F G }$ and the flexible approximation $q F l o w$ as described in section 3.2. When computing ${ \mathcal { L } } _ { \mathrm { V A E } } [ q ]$ and $\mathcal { L } _ { \mathrm { I W A E } } [ q ]$ , we use 5000 samples. To compute $\mathcal { L } _ { \mathrm { V A E } } [ q ^ { * } ]$ , we optimize the parameters of the variational distribution for every datapoint. See Section 6.4 for details of the local optimization and stopping criteria.
133
+
134
+ # 4 RELATED WORK
135
+
136
+ Much of the earlier work on variational inference focused on optimizing the variational parameters locally for each datapoint, e.g. the original Stochastic Variational Inference scheme (SVI, Hoffman et al. (2013)) specifies the variational parameters to be optimized locally in the inner loop. Salakhutdinov & Larochelle (2010) perform such local optimization when learning deep Boltzmann machines. More recent work has applied this idea to improve approximate inference in directed Belief networks (Hjelm et al., 2015).
137
+
138
+ Most relevant to our work is the recent work of Krishnan et al. (2017). They explicitly remark on two sources of error in variational learning with inference networks, and propose to optimize approximate inference locally from an initialization output by the inference network. They show improved training on high-dimensional, sparse data with the hybrid method, claiming that local optimization reduces the negative effects of random initialization in the inference network early on in training. Yet, their work only dwells on reducing the amortization gap and does analyze the error arising from the use of limited approximating distributions.
139
+
140
+ ![](images/a1d655761a82d6b4bc4ede47b36a7fbb2611e59eeea14fc4cf9c5c21bd3472f8.jpg)
141
+ Figure 2: True Posterior and Approximate Distributions of a VAE with 2D latent space. Columns: 4 different datapoints. FFG: Fully-factorized Gaussian. Flow: Using a flexible approximate distribution. Amortized: Using amortized parameters. Optimal: Parameters optimized for individual datapoints. The green distributions are the true posterior distributions, highlighting the mismatch with the approximation.
142
+
143
+ Even though it is clear that failed inference would lead to a failed generative model, little quantitative assessment has been done showing the effect of the approximate posterior on the true posterior. Burda et al. (2016) visually demonstrate that when trained with an importance-weighted approximate posterior, the resulting true posterior is more complex than those trained with fully-factorized Gaussian approximations. We extend this observation quantitatively in the setting of flow-based approximate inference.
144
+
145
+ # 5 EXPERIMENTAL RESULTS
146
+
147
+ # 5.1 INTUITION THROUGH VISUALIZATION
148
+
149
+ To begin, we would like to gain some insight into the properties of inference in VAEs by visualizing different distributions in the latent space. To this end, we trained a VAE with a two-dimensional latent space on MNIST. We show contour plots of various distributions in the latent space in Fig. 2. The first row contains contour plots of the true posteriors $p ( z | x )$ for four different training datapoints (columns). We have selected these four examples to highlight different inference phenomena. The amortized FFG row refers to the output of the recognition net, in this case, a fully-factorized Gaussian (FFG) approximation. Optimal FFG is the FFG that best fits the posterior of the datapoint. Optimal Flow is the optimal fit of a flexible distribution to the same posterior, where the flexible distribution we use is described in Section 3.2.
150
+
151
+ Posterior A is an example of a distribution where FFG can fit well. Posterior B is an example of dependence between dimensions, demonstrating the limitation of having a factorized approximation. Posterior C highlights a shortcoming of performing amortization with a limited-capacity recognition network, where the amortized FFG shares little support with the true posterior. Posterior $\mathbf { D }$ is a bimodal distribution which demonstrates the ability of the flexible approximation to fit to complex distributions, in contrast to the simple FFG approximation. These observations raise the following question: in more typical VAEs, is the amortization of inference the leading cause of the distribution mismatch, or is it the choice of approximation?
152
+
153
+ <table><tr><td rowspan="2"></td><td colspan="2">MNIST</td><td colspan="2">Fashion-MNIST</td><td colspan="2">CIFAR-10</td></tr><tr><td>qFFG</td><td>qFlow</td><td>qFFG</td><td>qFlow</td><td>qFFG</td><td>qFlow</td></tr><tr><td>log p(x)</td><td>-89.80</td><td>-88.94</td><td>-97.47</td><td>-97.41</td><td>-14913.15</td><td>-14914.45</td></tr><tr><td>LVAE[qFlow]</td><td>-90.80</td><td>-90.38</td><td>-98.92</td><td>-99.10</td><td>-14914.22</td><td>-14915.57</td></tr><tr><td>LVAE[qFFG]</td><td>-91.23</td><td>-113.54</td><td>-100.53</td><td>-132.46</td><td>-14915.40</td><td>-14919.08</td></tr><tr><td>LVAE[q]</td><td>-92.57</td><td>-91.79</td><td>-104.75</td><td>-103.76</td><td>-14976.57</td><td>-14975.12</td></tr><tr><td>Approximation</td><td>1.43</td><td>1.44</td><td>3.06</td><td>1.69</td><td>2.25</td><td>1.12</td></tr><tr><td>Amortization</td><td>1.34</td><td>1.41</td><td>4.22</td><td>4.66</td><td>61.17</td><td>59.55</td></tr><tr><td>Inference</td><td>2.77</td><td>2.85</td><td>7.28</td><td>6.35</td><td>63.42</td><td>60.67</td></tr></table>
154
+
155
+ Table 2: Inference Gaps. The columns $q _ { F F G }$ and $q _ { F l o w }$ refer to the variational distribution used for training the model. All numbers are in nats.
156
+
157
+ # 5.2 AMORTIZATION VS APPROXIMATION GAP
158
+
159
+ Here we will compare the influence that the approximation and amortization errors have on the total inference gap. Table 2 are results from training on MNIST, Fashion-MNIST and CIFAR-10. For each dataset, we trained two different approximate posterior distributions: a fully-factorized Gaussian, $q _ { F F G }$ , and a flexible distribution, $q _ { F l o w }$ . Due to the computational cost of optimizing the local parameters for each datapoint, our evaluation is performed on a subset of 1000 datapoints for MNIST and Fashion-MNIST and a subset of 100 datapoints for CIFAR-10.
160
+
161
+ For MNIST, we see that the amortization and approximation gaps each account for nearly half of the inference gap. On Fashion-MNIST, which is a more difficult dataset to model, the amortization gap becomes larger than the approximation gap. Similarly for CIFAR-10, we see that the amortization gap is much more significant than the approximation gap. Thus, for the three datasets and model architectures that we tested, the amortization gap seems to be the prominent cause of inference suboptimality, especially when the difficulty of the dataset increases. This analysis indicates that improvements in inference will likely be a result of reducing amortization error, rather than approximation errors.
162
+
163
+ With these results in mind, would simply increasing the capacity of the encoder improve the amortization gap? We examined this by training the MNIST and Fashion-MNIST models from above but with larger encoders. See Section 6.1.2 for implementation details. Table 3 are the results of this experiment. Comparing to Table 2, we see that for both datasets and both variational distributions, the inference gap decreases and the decrease is mainly due to a reduction in the amortization gap.
164
+
165
+ <table><tr><td rowspan="7">logp(x) LVAE[qFlow] LVAEqFFG]</td><td colspan="2">MNIST</td><td colspan="2">Fashion-MNIST</td></tr><tr><td>qFFG</td><td>qFlow</td><td>qFFG</td><td>qFlow</td></tr><tr><td>-89.61</td><td>-88.99</td><td>-95.99</td><td>-96.18</td></tr><tr><td>-90.65</td><td>-90.44</td><td>-97.40</td><td>-97.91</td></tr><tr><td>-91.07</td><td>-108.71</td><td>-99.64</td><td>-129.7</td></tr><tr><td>-92.18</td><td>-91.19</td><td>-102.73</td><td>-101.67</td></tr><tr><td>LVAE[q] Approximation 1.46</td><td>1.45</td><td>3.65</td><td>1.73</td></tr><tr><td>Amortization</td><td>1.11</td><td>0.75</td><td>3.09</td><td>3.76</td></tr><tr><td>Inference</td><td>2.56</td><td>2.20</td><td>6.74</td><td>5.49</td></tr></table>
166
+
167
+ Table 3: Larger Encoder. The columns $q _ { F F G }$ and $q F l o w$ refer to the variational distribution used for training the model. All numbers are in nats.
168
+
169
+ # 5.2.1 INFLUENCE OF FLOWS ON AMORTIZATION GAP
170
+
171
+ The common reasoning for increasing the expressiveness of the approximate posterior is to minimize the difference between the true and approximate, i.e. reduce the approximation gap. However, given that the expressive approximation is often accompanied by many additional parameters, we would like to know if it has an influence on the amortization error.
172
+
173
+ To investigate this, we trained a VAE in the same manner as Section 5.2. After training, we kept the generator fixed and trained new encoders to fit to the fixed posterior. Specifically, we trained a small encoder with a factorized Gaussian $q$ distribution to obtain a large amortization gap. We then trained a small encoder with a flow distribution. See Section 6.2 for the details of the experiment. The results are shown in Table 4. As expected, we observe that the small encoder has a very large amortization gap. However, when we use $q _ { F l o w }$ as the approximate distribution, we see the approximation gap decrease, but more importantly, there is a significant decrease in the amortization gap. This indicates that the parameters used for increasing the complexity of the approximation also play a large role in diminishing the amortization error.
174
+
175
+ Table 4: Influence of Flows on the Amortization Gap. The parameters used to increase the flexibility of the approximate distribution also reduce the amortization gap. See Section 5.2.1 for details of the experiment.
176
+
177
+ <table><tr><td>Variational Family</td><td>qFFG</td><td>qFlow</td></tr><tr><td>logp(x) LVAE[q*]</td><td>-84.70 -86.61</td><td>-84.70 -85.48</td></tr><tr><td>LVAE[q] Approximation</td><td>-129.83 1.91</td><td>-98.58 0.78</td></tr><tr><td>Amortization</td><td>43.22</td><td>13.10</td></tr><tr><td>Inference</td><td>45.13</td><td>13.88</td></tr></table>
178
+
179
+ These results are expected given that the parameterization of the Flow distribution can be interpreted as an instance of the RevNet (Gomez et al., 2017) which has demonstrated that Real-NVP like transformations (Dinh et al., 2017) can model complex functions similar to typical MLPs. Thus the flow transformations we employ should also be expected to increase the expressiveness while also increasing the capacity of the encoder. The implication of this observation is that models which improve the flexibility of their variational approximation, and attribute their improved results to the increased expressiveness, may have actually been due to the reduction in amortization error.
180
+
181
+ # 5.3 INFLUENCE OF APPROXIMATE POSTERIOR ON TRUE POSTERIOR
182
+
183
+ We have seen that increasing the expressiveness of the approximation improves the marginal likelihood of the trained model, but to what amount does it alter the true posterior? Will a factorized Gaussian approximation cause the true posterior to be more like a factorized Gaussian or is the true posterior mostly fixed? Just as it is hard to evaluate a generative model by visually inspecting samples from the model, its hard to say how Gaussian the true posterior is by visual inspection. We can quantitatively determine how close the posterior is to a fully factorized Gaussian (FFG) distribution by comparing the marginal log-likelihood estimate, $\log { \dot { \hat { p } } } ( x )$ , and the Optimal FFG bound, $\mathcal { L } _ { \mathrm { V A E } } [ q _ { F F G } ^ { * } ]$ . In other words, we are estimating the KL divergence between the optimal Gaussian and the true posterior, $\mathrm { K L } \left( q ^ { * } ( z | x ) | | p ( z | x ) \right)$ .
184
+
185
+ In Table 2 on MNIST, the Optimal Flow improves upon the Optimal FFG for the FFG trained model by 0.4 nats. In contrast, on the Flow trained model, the difference increases to 12.5 nats. This suggests that the true posterior of a FFG-trained model is closer to FFG than the true posterior of the Flow-trained model. The same observation can be made on the Fashion-MNIST dataset. This implies that the decoder can learn to have a true posterior that fits better to the approximation. Although the generative model can learn to have a posterior that fits to the approximation, it seems that not having this constraint, ie. using a flexible approximate, results in better generative models.
186
+
187
+ We can use these observations to help justify our approximation and amortization gap results of Section 5.2. Those results showed that the amortization error is often the main cause of inference suboptimality. One reason for this is that the generator accommodates to the choice of approximation, as shown above, thus reducing the approximation error.
188
+
189
+ Given that we have seen that the generator could accommodate to the choice of approximation, our next question is whether a generator with more capacity can accommodate more. To this end, we trained VAEs with decoders of different sizes and measured the approximation gaps. Specifically, we trained decoders with 0, 2, and 4 hidden layers on MNIST. See Table 5 for the results. We see that as the capacity of the decoder increases, the approximation gap decreases. This result implies that the more flexible the generator, the less flexible the approximate distribution needs to be.
190
+
191
+ Table 5: Increased decoder capacity reduces approximation gap. All numbers are in nats.
192
+
193
+ <table><tr><td>Generator HiddenLayers</td><td>0</td><td>2</td><td>4</td></tr><tr><td>logp(x)</td><td>-100.52</td><td>-86.61</td><td>-83.82</td></tr><tr><td>LVAE[qFFG]</td><td>-104.42</td><td>-84.78</td><td>-82.19</td></tr><tr><td>Approximation Gap</td><td>3.90</td><td>1.83</td><td>1.63</td></tr></table>
194
+
195
+ # 5.3.1 ANNEALING THE ENTROPY
196
+
197
+ Typical warm-up (Bowman et al., 2015; Sønderby et al., 2016) refers to annealing $\mathrm { K L } \left( q ( \boldsymbol { z } | \boldsymbol { x } ) | | p ( \boldsymbol { z } ) \right)$ during training. This can also be interpreted as performing maximum likelihood estimation (MLE) early on during training. This optimization technique is known to help prevent the latent variable from degrading to the prior (Burda et al., 2016; Sønderby et al., 2016). We employ a similar annealing scheme during training. Rather than annealing the KL divergence, we anneal the entropy of the approximate distribution $q$ :
198
+
199
+ $$
200
+ \begin{array} { r } { \mathbb { E } _ { z \sim q ( z | x ) } \left[ \log p ( x , z ) - \lambda \log q ( z | x ) \right] , } \end{array}
201
+ $$
202
+
203
+ where $\lambda$ is annealed from 0 to 1 over training. This can be interpreted as maximum a posteriori (MAP) in the initial phase. Due to its similarity, we will also refer to this technique as warm-up.
204
+
205
+ We find that warm-up techniques, such as annealing the entropy, are important for allowing the true posterior to be more complex. Table 6 are results from a model trained without the entropy annealing schedule. Comparing these results to Table 2, we observe that the difference between $\mathcal { L } _ { \mathrm { V A E } } [ q _ { F F G } ^ { * } ]$ and $\mathcal { L } _ { \mathrm { V A E } } [ q _ { F l o w } ^ { * } ]$ is significantly smaller without entropy annealing. This indicates that the true posterior is more Gaussian when entropy annealing is not used. This suggests that, in addition to preventing the latent variable from degrading to the prior, entropy annealing allows the true posterior to better utilize the flexibility of the expressive approximation, resulting in a better trained model.
206
+
207
+ <table><tr><td rowspan="7">log p(x) LVAE[qFlow LVAE[qFFG]</td><td colspan="2">MNIST</td><td colspan="2">Fashion-MNIST</td></tr><tr><td>qFFG</td><td>qFlow</td><td>qFFG</td><td>qFlow</td></tr><tr><td>-89.82</td><td>-89.52</td><td>-102.56</td><td>-102.88</td></tr><tr><td>-90.96</td><td>-90.45</td><td>-103.73</td><td>-104.02</td></tr><tr><td>-90.84</td><td>-92.25</td><td>-103.85</td><td>-105.80</td></tr><tr><td>-92.33</td><td>-91.75</td><td>-106.90</td><td>-107.01</td></tr><tr><td>LvAE[q] Approximation 1.02</td><td>0.93</td><td>1.29</td><td>1.14</td></tr><tr><td>Amortization</td><td>1.49</td><td>1.30</td><td>3.05</td><td>2.29</td></tr><tr><td>Inference</td><td>2.51</td><td>2.23</td><td>4.34</td><td>4.13</td></tr></table>
208
+
209
+ Table 6: Models trained without entropy annealing. The columns $q _ { F F G }$ and $q _ { F l o w }$ refer to the variational distribution used for training the model. All numbers are in nats.
210
+
211
+ # 6 CONCLUSION
212
+
213
+ In this paper, we investigated how encoder capacity, approximation choice, decoder capacity, and model optimization influence inference suboptimality in terms of the approximation and amortization gaps. We found that the amortization gap is often the leading source of inference suboptimality and that the generator reduces the approximation gap by learning a true posterior that fits to the choice of approximate distribution. We showed that the parameters used to increase the expressiveness of the approximation play a role in generalizing inference rather than simply improving the complexity of the approximation. We confirmed that increasing the capacity of the encoder reduces the amortization error. We also showed that optimization techniques, such as entropy annealing, help the generative model to better utilize the flexibility of the expressive variational distribution. Computing these gaps can be useful for guiding improvements to inference in VAEs. Future work includes evaluating other types of expressive approximations and more complex likelihood functions.
214
+
215
+ REFERENCES
216
+ P. Bachman and D. Precup. Training Deep Generative Models: Variations on a Theme. NIPS Approximate Inference Workshop, 2015.
217
+ S. R. Bowman, L. Vilnis, O. Vinyals, A. M. Dai, R. Jozefowicz, and S. Bengio. Generating Sentences from a Continuous Space. ArXiv e-prints, November 2015.
218
+ Y. Burda, R. Grosse, and R. Salakhutdinov. Importance weighted autoencoders. In ICLR, 2016.
219
+ Djork-Arne Clevert, Thomas Unterthiner, and Sepp Hochreiter. Fast and accurate deep network ´ learning by exponential linear units (elus). arXiv preprint arXiv:1511.07289, 2015.
220
+ C. Cremer, Q. Morris, and D. Duvenaud. Reinterpreting Importance-Weighted Autoencoders. ICLR Workshop, 2017.
221
+ L. Dinh, J. Sohl-Dickstein, and S. Bengio. Density estimation using Real NVP. ICLR, 2017.
222
+ Xavier Glorot and Yoshua Bengio. Understanding the difficulty of training deep feedforward neural networks. In Proceedings of the Thirteenth International Conference on Artificial Intelligence and Statistics, pp. 249–256, 2010.
223
+ Aidan N Gomez, Mengye Ren, Raquel Urtasun, and Roger B Grosse. The reversible residual network: Backpropagation without storing activations. In Advances in Neural Information Processing Systems, pp. 2211–2221, 2017.
224
+ R. Grosse, Z. Ghahramani, and R. P Adams. Sandwiching the marginal likelihood using bidirectional monte carlo. arXiv preprint arXiv:1511.02543, 2015.
225
+ R Devon Hjelm, Kyunghyun Cho, Junyoung Chung, Russ Salakhutdinov, Vince Calhoun, and Nebojsa Jojic. Iterative refinement of approximate posterior for training directed belief networks. arXiv preprint arXiv:1511.06382, 2015.
226
+ Matthew D Hoffman, David M Blei, Chong Wang, and John Paisley. Stochastic variational inference. The Journal of Machine Learning Research, 14(1):1303–1347, 2013.
227
+ C. Jarzynski. Nonequilibrium equality for free energy differences. Physical Review Letters, 78(14): 2690, 1997.
228
+ Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
229
+ D.P. Kingma and M. Welling. Auto-Encoding Variational Bayes. In ICLR, 2014.
230
+ D.P. Kingma, T. Salimans, R. Jozefowicz, X. Chen, I. Sutskever, and M. Welling. Improving Variational Inference with Inverse Autoregressive Flow. NIPS, 2016.
231
+ R. G. Krishnan, D. Liang, and M. Hoffman. On the challenges of learning with inference networks on sparse, high-dimensional data. ArXiv e-prints, October 2017.
232
+ Hugo Larochelle and Yoshua Bengio. Classification using discriminative restricted boltzmann machines. In Proceedings of the 25th international conference on Machine learning, pp. 536–543. ACM, 2008.
233
+ L. Maaløe, CK. Sønderby, SK. Sønderby, and O. Winther. Auxiliary Deep Generative Models. ICML, 2016.
234
+ Radford M Neal et al. Mcmc using hamiltonian dynamics. Handbook of Markov Chain Monte Carlo, 2(11), 2011.
235
+ R.M. Neal. Annealed importance sampling. Statistics and Computing, 2001.
236
+ R. Ranganath, D. Tran, and D. M. Blei. Hierarchical Variational Models. ICML, 2016.
237
+ D.J. Rezende and S Mohamed. Variational Inference with Normalizing Flows. In ICML, 2015.
238
+
239
+ D.J. Rezende, S. Mohamed, and D. Wierstra. Stochastic Backpropagation and Approximate Inference in Deep Generative Models. ICML, 2014.
240
+
241
+ R. Salakhutdinov and I. Murray. On the quantitative analysis of deep belief networks. In Proceedings of the 25th international conference on Machine learning, pp. 872–879. ACM, 2008.
242
+
243
+ Ruslan Salakhutdinov and Hugo Larochelle. Efficient learning of deep boltzmann machines. In Proceedings of the Thirteenth International Conference on Artificial Intelligence and Statistics, pp. 693–700, 2010.
244
+
245
+ T. Salimans, D.P. Kingma, and M. Welling. Markov chain monte carlo and variational inference: Bridging the gap. In ICML, 2015.
246
+
247
+ Casper Kaae Sønderby, Tapani Raiko, Lars Maaløe, Søren Kaae Sønderby, and Ole Winther. Ladder variational autoencoders. In Advances in Neural Information Processing Systems, pp. 3738–3746, 2016.
248
+
249
+ J. M. Tomczak and M. Welling. Improving Variational Auto-Encoders using Householder Flow. ArXiv e-prints, November 2016.
250
+
251
+ J. M. Tomczak and M. Welling. Improving Variational Auto-Encoders using convex combination linear Inverse Autoregressive Flow. ArXiv e-prints, June 2017.
252
+
253
+ Y. Wu, Y. Burda, R. Salakhutdinov, and R. Grosse. On the Quantitative Analysis of Decoder-Based Generative Models. ICLR, 2017.
254
+
255
+ Han Xiao, Kashif Rasul, and Roland Vollgraf. Fashion-mnist: a novel image dataset for benchmarking machine learning algorithms. github.com/zalandoresearch/fashion-mnist, 2017.
256
+
257
+ # APPENDIX
258
+
259
+ # 6.1 MODEL ARCHITECTURES AND TRAINING HYPERPARAMETERS
260
+
261
+ # 6.1.1 2D VISUALIZATION
262
+
263
+ The VAE model of Fig. 2 uses a decoder $p ( x | z )$ with architecture: $2 - 1 0 0 - 7 8 4$ , and an encoder $q ( z | x )$ with architecture: $7 8 4 - 1 0 0 - 4$ . We use tanh activations and a batch size of 50. The model is trained for 3000 epochs with a learning rate of $1 0 ^ { - 4 }$ using the ADAM optimizer (Kingma & Ba, 2014).
264
+
265
+ # 6.1.2 MNIST & FASHION-MNIST
266
+
267
+ Both MNIST and Fashion-MNIST consist of a training and test set with 60k and 10k datapoints respectively, where each datapoint is a $2 8 \mathbf { x } 2 8$ grey-scale image. We rescale the original images so that pixel values are within the range [0, 1]. For MNIST, We use the statically binarized version described by Larochelle & Bengio (2008). We also binarize Fashion-MINST statically. For both datasets, we adopt the Bernoulli likelihood for the generator.
268
+
269
+ The VAE models for MNIST and Fashion-MNIST experiments have the same architecture given in table 7. The flow configuration is given in table 8.
270
+
271
+ Table 7: Neural net architecture for MNIST/Fashion-MNIST experiments.
272
+
273
+ <table><tr><td>Inference Network</td><td>Generator</td></tr><tr><td>Input ∈R784</td><td>Input ∈R50</td></tr><tr><td>FC.200-ELU-FC.200-ELU-FC.50+50</td><td>FC.200-ELU-FC.200-ELU-FC.784-Sigmoid</td></tr></table>
274
+
275
+ In the large encoder setting, we change the number of hidden units for the inference network to be 500, instead of 200. The warm-up models are trained with a linear schedule over the first 400 epochs according to Section 5.3.1.
276
+
277
+ The activation function is chosen to be the exponential linear unit (ELU, Clevert et al. (2015)), as we observe improved performance compared to tanh. We follow the same learning rate schedule and train for the same amount of epochs as described by Burda et al. (2016). All models are trained with the a batch-size of 100 with ADAM.
278
+
279
+ # 6.1.3 CIFAR-10
280
+
281
+ CIFAR-10 consists of a training and test dataset with $5 0 \mathrm { k }$ and $1 0 \mathrm { k }$ datapoints respectively, where each datapoint is a $3 2 \times 3 2$ color image. We rescale individual pixel values to be in the range [0, 1]. We follow the discretized logistic likelihood model adopted by Kingma et al. (2016), where each input channel has its own scale learned by an MLP. For the latent variable, we use a 32-dimensional factorized Gaussian for $q ( z | x )$ following Kingma et al. (2016). For all neural networks, ELU is chosen to be the activation function. The specific network architecture is shown in Table 9.
282
+
283
+ We adopt a gradually decreasing learning rate with an initialize value of $1 0 ^ { - 3 }$ . Warm-up is applied with a linear schedule over the first 20 epochs. All models are trained with a batch-size of 100 with ADAM. Early-stopping is applied based on the performance on the held-out set.
284
+
285
+ For the model with expressive inference, we use four flow steps as opposed to only two in MNIST/Fashion-MNIST experiments.
286
+
287
+ # 6.2 INFLUENCE OF FLOWS ON AMORTIZATION GAP EXPERIMENT
288
+
289
+ The aim of this experiment is to show that the parameters used for increasing the expressiveness of the approximation also contribute to reducing the amortization error. To show this, we train a VAE on MNIST, discard the encoder, then retrain two encoders on the fixed decoder: one with a factorized Gaussian distribution and the other with a parameterized ’flow’ distribution. We use fixed decoder so that the true posterior is constant for both encoders. See 5.2.1 for the results and below for the architecture details.
290
+
291
+ The architecture of the decoder is: $D _ { Z } - 2 0 0 - 2 0 0 - D _ { X }$ . The architecture of the encoder used to train the decoder is $D _ { X } - 2 0 0 - 2 0 0 - 2 D _ { Z }$ . The approximate distribution $q ( z | x )$ is a factorized Gaussian.
292
+
293
+ Next, we describe the encoders which were trained on the fixed trained decoder. In order to highlight a large amortization gap, we employed a very small encoder architecture: $D _ { X } - 2 D _ { Z }$ . This encoder has no hidden layers, which greatly impoverishes its ability and results in a large amortization gap.
294
+
295
+ We compare two approximate distributions $q ( z | x )$ . Firstly, we experiment with the typical fully factorized Gaussian (FFG). The second is what we call a flow distribution. Specifically, we use the transformations of Dinh et al. (2017). We also include an auxiliary variable so we don’t need to select how to divide the latent space for the transformations. The approximate distribution over the latent $z$ and auxiliary variable $v$ factorizes as: $q ( z , v | x ) = q ( z | x ) \bar { q } ( v )$ . The $q ( v )$ distribution is simply a ${ \bf N } ( 0 , 1 )$ distribution. Since we’re using a auxiliary variable, we also require the $r ( v | z )$ distribution which we parameterize as $r ( v | z )$ : $[ D z ] - 5 0 - 5 0 - 2 D z$ . The flow transformation is the same as in Section 3.2, which we apply twice.
296
+
297
+ <table><tr><td>q(uolz0)</td><td>r(Ur|zT)</td></tr><tr><td>Input ∈R50</td><td>Input ∈ R50</td></tr><tr><td>FC.100-ELU-FC.100-ELU-FC.50+50</td><td>FC.100-ELU-FC.100-ELU-FC.50+50</td></tr></table>
298
+
299
+ <table><tr><td colspan="2">q(Ut+1, Zt+1lUt, zt)</td></tr><tr><td>01(),02()</td><td>μ1(.),μ2(.)</td></tr><tr><td>Input ∈ R50</td><td>Input ∈ R50</td></tr><tr><td>FC.100-ELU-FC.100-ELU-FC.50</td><td>FC.100-ELU-FC.100-ELU-FC.50</td></tr></table>
300
+
301
+ Table 8: Flow setting for MNIST/Fashion-MNIST experiments. $q ( v _ { T } , z _ { T } | v _ { 0 } , z _ { 0 } )$ consists of two normalizing flows given in the second tabular.
302
+
303
+ <table><tr><td>Inference Network</td><td>Generator</td></tr><tr><td>Input 32 × 32 color image</td><td>Input ∈ R32</td></tr><tr><td>4 × 4 conv. 64 channels.stride 2.BN 4 × 4 conv.128 channels.stride 2.BN</td><td>FC.256×2×2ELU;FC.64-ELU-FC.32-ELU-FC.3 4 × 4 deconv. 128 channels. stride 2. BN</td></tr><tr><td>4 × 4 conv. 256 channels. stride 2.BN</td><td>4 × 4 deconv.64 channels.stride 2.BN</td></tr><tr><td>FC.32 + 32.output layer for mean and log-variance</td><td>4 × 4 deconv.3 channels.stride 2. Sigmoid</td></tr></table>
304
+
305
+ Table 9: Network architecture for CIFAR-10 experiments. For the generator, one of the MLPs immediately after the input layer of the generator outputs channel-wise scales for the discretized logistic likelihood model. BN stands for batch-normalization.
306
+
307
+ # 6.3 COMPUTATION OF THE DETERMINANT FOR FLOW
308
+
309
+ The overall mapping $f$ that performs $( z , v ) \mapsto ( z ^ { \prime } , v ^ { \prime } )$ is the composition of two sheer mappings $f _ { 1 }$ and $f _ { 2 }$ that respectively perform $( z , v ) \mapsto ( z , v ^ { \prime } )$ and $( z , v ^ { \prime } ) \mapsto ( z ^ { \prime } , v ^ { \prime } )$ . Since the Jacobian of either one of the sheer mappings is diagonal, the determinant of the composed transformation’s Jacobian $D f$ can be easily computed:
310
+
311
+ $$
312
+ \operatorname * { d e t } ( D f ) = \operatorname * { d e t } ( D f _ { 1 } ) \mathrm { d e t } ( D f _ { 2 } ) = \Bigl ( \prod _ { i = 1 } ^ { n } \sigma _ { 1 } ( z ) _ { i } \Bigr ) \Bigl ( \prod _ { j = 1 } ^ { n } \sigma _ { 2 } ( v ^ { \prime } ) _ { j } \Bigr ) .
313
+ $$
314
+
315
+ # 6.4 LOCAL OPTIMIZATION OF APPROXIMATE DISTRIBUTION
316
+
317
+ For the local FFG optimization, we initialize the mean and variance as the prior, i.e. $\mathcal { N } ( 0 , I )$ . We optimize the mean and variance using the Adam optimizer with a learning rate of $1 0 ^ { - 3 }$ . To determine convergence, after every 100 optimization steps, we compute the average of the previous 100 ELBO values and compare it to the best achieved average. If it does not improve for 10 consecutive iterations then the optimization is terminated. For the Flow model, the same process is used to optimize all of its parameters. All neural nets for the flow were initialized with a variant of the Xavier initilization (Glorot & Bengio, 2010). We use 100 Monte Carlo samples to compute the ELBO to reduce variance.
318
+
319
+ # 6.5 ANNEALED IMPORTANCE SAMPLING
320
+
321
+ Annealed importance sampling (AIS, Neal (2001); Jarzynski (1997)) is a means of computing a lower bound to the marginal log-likelihood. Similarly to the importance weighted bound, AIS must sample a proposal distribution $\bar { f } _ { 1 } ( z )$ and compute the density of these samples, however, AIS then transforms the samples through a sequence of reversible transitions $\mathcal { T } _ { t } ( z ^ { \prime } | z )$ . The transitions anneal the proposal distribution to the desired distribution $f _ { T } ( z )$ .
322
+
323
+ Specifically, AIS samples an initial state $z _ { 1 } \sim f _ { 1 } ( z )$ and sets an initial weight $w _ { 1 } = 1$ . For the following annealing steps, $z _ { t }$ is sampled from $\mathcal { T } _ { t } { \left( z ^ { \prime } \right| } z )$ and the weight is updated according to:
324
+
325
+ $$
326
+ w _ { t } = w _ { t - 1 } \frac { f _ { t } ( z _ { t - 1 } ) } { f _ { t - 1 } ( z _ { t - 1 } ) } .
327
+ $$
328
+
329
+ This procedure produces weight $w _ { T }$ such that $\mathbb { E } \left[ w _ { T } \right] = \mathcal { Z } _ { T } / \mathcal { Z } _ { 1 }$ , where $Z _ { T }$ and $Z _ { 1 }$ are the normalizing constants of $f _ { T } ( z )$ and $f _ { 1 } ( z )$ respectively. This pertains to estimating the marginal likelihood when the target distribution is $p ( x , z )$ when we integrate with respect to $z$ .
330
+
331
+ Typically, the intermediate distributions are simply defined to be geometric averages: $f _ { t } ( z ) ~ =$ $\dot { f _ { 1 } } \dot { ( z ) } ^ { 1 - \dot { \beta _ { t } } } f _ { T } ( z ) ^ { \beta _ { t } }$ , where $\beta _ { t }$ is monotonically increasing with $\beta _ { 1 } = 0$ and $\beta _ { T } = 1$ . When $f _ { 1 } ( z ) =$ $p ( z )$ and $f _ { T } ( z ) = p ( x , z )$ , the intermediate distributions are: $f _ { i } ( x ) = p ( z ) p ( x | z ) ^ { \beta _ { i } }$ .
332
+
333
+ Model evaluation with AIS appears early on in the setting of deep belief networks (Salakhutdinov & Murray, 2008). AIS for decoder-based models was also used by $\mathrm { { W u } }$ et al. (2017). They validated the accuracy of the approach with Bidirectional Monte Carlo (BDMC, Grosse et al. (2015)) and demonstrated the advantage of using AIS over the IWAE bound for evaluation when the inference network overfits to the training data.
334
+
335
+ # 6.6 THE INFERENCE GAP
336
+
337
+ How well is inference done in VAEs during training? Are we close to doing the optimal or is there much room for improvement? To answer this question, we quantitatively measure the inference gap: the gap between the true marginal log-likelihood and the lower bound. This amounts to measuring how well inference is being done during training. Since we cannot compute the exact marginal log-likelihood, we estimate it using the maximum of any of its lower bounds, described in 3.3.
338
+
339
+ Fig. 3a shows training curves for a FFG and Flow inference network as measured by the VAE, IWAE, and AIS bounds on the training and test set. The inference gap on the training set with the FFG model is 3.01 nats, whereas the Flow model is 2.71 nats. Accordingly, Fig. 3a shows that the training IWAE bound is slightly tighter for the Flow model compared to the FFG. Due to this lower inference gap during training, the Flow model achieves a higher AIS bound on the test set than the FFG model.
340
+
341
+ To demonstrate that a very small inference gap can be achieved, even with a limited approximation such as a factorized Gaussian, we train the model on a small dataset. In this experiment, our training set consists of 1000 datapoints randomly chosen from the original MNIST training set. The training curves on this small datatset are show in Fig. 3b. Even with a factorized Gaussian distribution, the inference gap is very small: the AIS and IWAE bounds are overlapping and the VAE is just slightly below. Yet, the model is overfitting as seen by the decreasing test set bounds.
342
+
343
+ ![](images/27084004bf0862c2b0451b27bad5bd7bbe3e9917819b0dc3cd0ee5c7c6bd4713.jpg)
344
+ Figure 3: Training curves for a FFG and a Flow inference model on MNIST. AIS provides the tightest lower bound and is independent of encoder overfitting. There is little difference between FFG and Flow models trained on the 1000 datapoints since inference is nearly equivalent.
345
+
346
+ # 6.6.1 ENCODER AND DECODER OVERFITTING
347
+
348
+ We will begin by explaining how we separate encoder from decoder overfitting. Decoder overfitting is the same as in the regular supervised learning scenario, where we compare the train and test error. To measure decoder overfitting independently from encoder overfitting, we use the AIS bound since it is encoder-independent. Thus we can observe decoder overfitting through the AIS test training curve. In contrast, the encoder can only overfit in the sense that the recognition network becomes unsuitable for computing the marginal likelihood on the test set. Thus, encoder overfitting is computed by: $\mathcal { L } _ { \mathrm { A I S } } \ - \mathcal { L } _ { \mathrm { I W } }$ on the test set.
349
+
350
+ For the small dataset of Fig. 3b, it clear that there is significant encoder and decoder overfitting. A model trained in this setting would benefit from regularization. For Fig. 3a, the model is not overfit and would benefit from more training. However, there is some encoder overfitting due to the gap between the AIS and IWAE bounds on the test set. Comparing the FFG and Flow models, it appears that the Flow does not have a large effect on encoder or decoder overfitting.
351
+
352
+ # 6.7 GAUSSIAN LATENTS WITH FULL COVARIANCE
353
+
354
+ The flexiblity of the Gaussian family with arbitrary covariance lies between that of FFG and Flow. With covariance, the Gaussian distribution can model interactions between different latent dimensions. Yet, compared to Flow, its expressiveness is limited due to its inability to model higher order interactions and its unimodal nature.
355
+
356
+ To apply the reparameterization trick, we perform the Cholesky decomposition on the covariance matrix: $\overrightharpoon { \Sigma } = L \overrightharpoon { L } ^ { \top }$ , where $L$ is lower triangular. A sample from $\mathcal { N } ( \boldsymbol { \mu } , \boldsymbol { \Sigma } )$ could be obtained by first sampling from a unit Gaussian $\epsilon \sim \mathcal { N } ( 0 , \bar { I } )$ , then computing $z = \mu + L \epsilon$ .
357
+
358
+ To analyze the capability of the Gaussian family, we train several VAEs on MNIST and FashionMNIST with the approximate posterior $q ( z | x )$ being a Gaussian with full covariance. To inspect how well inference is done, we perform the local optimizations described in Section 5.2 with FFG and Flow.
359
+
360
+ Table 10: Gaussian latents trained with full covariance.
361
+
362
+ <table><tr><td></td><td>MNIST</td><td>Fashion-MNIST</td></tr><tr><td>logp(x)</td><td>-89.28</td><td>-96.46</td></tr><tr><td>LVAElqFlow]</td><td>-90.69</td><td>-98.19</td></tr><tr><td>LvAE[FFG]</td><td>-101.84</td><td>-107.89</td></tr><tr><td>LvAE[q]</td><td>-92.05</td><td>-102.93</td></tr></table>
363
+
364
+ We can see from table 10 that local optimization with FFG on a model trained with full covariance inference produces a bad lower bound. This resonates with the argument that the approximation has a significant influence on the true posterior as described in section 5.3.
365
+
366
+ Comparing to numbers in table 2, we can see that the full-covariance VAE trained on MNIST is nearly on par with that trained with Flow (-89.28 vs -88.94). For Fashion-MNIST, the fullcovariance VAE even performs better by a large margin in terms of the estimated log-likelihood (-96.46 vs -97.41).
md/train/BkisuzWRW/BkisuzWRW.md ADDED
@@ -0,0 +1,308 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ZERO-SHOT VISUAL IMITATION
2
+
3
+ Deepak Pathak∗, Parsa Mahmoudieh∗, Guanghao Luo∗, Pulkit Agrawal∗, Dian Chen, Yide Shentu, Evan Shelhamer, Jitendra Malik, Alexei A. Efros, Trevor Darrell
4
+
5
+ UC Berkeley
6
+
7
+ {pathak,parsa.m,michaelluo,pulkitag,dianchen, fredshentu,shelhamer,malik,efros,trevor}@cs.berkeley.edu
8
+
9
+ # ABSTRACT
10
+
11
+ The current dominant paradigm for imitation learning relies on strong supervision of expert actions to learn both what and how to imitate. We pursue an alternative paradigm wherein an agent first explores the world without any expert supervision and then distills its experience into a goal-conditioned skill policy with a novel forward consistency loss. In our framework, the role of the expert is only to communicate the goals (i.e., what to imitate) during inference. The learned policy is then employed to mimic the expert (i.e., how to imitate) after seeing just a sequence of images demonstrating the desired task. Our method is “zero-shot” in the sense that the agent never has access to expert actions during training or for the task demonstration at inference. We evaluate our zero-shot imitator in two real-world settings: complex rope manipulation with a Baxter robot and navigation in previously unseen office environments with a TurtleBot. Through further experiments in VizDoom simulation, we provide evidence that better mechanisms for exploration lead to learning a more capable policy which in turn improves end task performance. Videos, models, and more details are available at https://pathak22.github.io/zeroshot-imitation/.
12
+
13
+ # 1 INTRODUCTION
14
+
15
+ Imitating expert demonstration is a powerful mechanism for learning to perform tasks from raw sensory observations. The current dominant paradigm in learning from demonstration (LfD) (Argall et al., 2009; $\mathrm { N g }$ & Russell, 2000; Pomerleau, 1989; Schaal, 1999) requires the expert to either manually move the robot joints (i.e., kinesthetic teaching) or teleoperate the robot to execute the desired task. The expert typically provides multiple demonstrations of a task at training time, and this generates data in the form of observation-action pairs from the agent’s point of view. The agent then distills this data into a policy for performing the task of interest. Such a heavily supervised approach, where it is necessary to provide demonstrations by controlling the robot, is incredibly tedious for the human expert. Moreover, for every new task that the robot needs to execute, the expert is required to provide a new set of demonstrations.
16
+
17
+ Instead of communicating how to perform a task via observation-action pairs, a more general formulation allows the expert to communicate only what needs to be done by providing the observations of the desired world states via a video or a sparse sequence of images. This way, the agent is required to infer how to perform the task (i.e., actions) by itself. In psychology, this is known as observational learning (Bandura & Walters, 1977). While this is a harder learning problem, it is a more interesting setting, because the expert can demonstrate multiple tasks quickly and easily.
18
+
19
+ An agent without any prior knowledge will find it extremely hard to imitate a task by simply watching a visual demonstration in all but the simplest of cases. Thus, the natural question is: in order to imitate, what form of prior knowledge must the agent possess? A large body of work (Breazeal & Scassellati, 2002; Dillmann, 2004; Ikeuchi & Suehiro, 1994; Kuniyoshi et al., 1989; 1994; Yang et al., 2015) has sought to capture prior knowledge by manually pre-defining the state that must be inferred from the observations. The agent then infers how to perform the task (i.e., plan for imitation) using this state. Unfortunately, computer vision systems are often unable to estimate the state variables accurately and it has proven non-trivial for downstream planning systems to be robust to such errors.
20
+
21
+ ![](images/434a373c7a71373e1b8cff5cbcc2f991d2bed131753c2fa08b2da192ece06e28.jpg)
22
+ Figure 1: The goal-conditioned skill policy (GSP) takes as input the current and goal observations and outputs an action sequence that would lead to that goal. We compare the performance of the following GSP models: (a) Simple inverse model; (b) Mutli-step GSP with previous action history; (c) Mutli-step GSP with previous action history and a forward model as regularizer, but no forward consistency; (d) Mutli-step GSP with forward consistency loss proposed in this work.
23
+
24
+ In this paper, we follow (Agrawal et al., 2016; Levine et al., 2016; Pinto & Gupta, 2016) in pursuing an alternative paradigm, where an agent explores the environment without any expert supervision and distills this exploration data into goal-directed skills. These skills can then be used to imitate the visual demonstration provided by the expert (Nair et al., 2017). Here, by skill we mean a function that predicts the sequence of actions to take the agent from the current observation to the goal. We call this function a goal-conditioned skill policy (GSP). The GSP is learned in a self-supervised way by re-labeling the states visited during the agent’s exploration of the environment as goals and the actions executed by the agent as the prediction targets, similar to (Agrawal et al., 2016; Andrychowicz et al., 2017). During inference, given goal observations from a demonstration, the GSP can infer how to reach these goals in turn from the current observation, and thereby imitate the task step-by-step.
25
+
26
+ One critical challenge in learning the GSP is that, in general, there are multiple possible ways of going from one state to another: that is, the distribution of trajectories between states is multimodal. We address this issue with our novel forward consistency loss based on the intuition that, for most tasks, reaching the goal is more important than how it is reached. To operationalize this, we first learn a forward model that predicts the next observation given an action and a current observation. We use the difference in the output of the forward model for the GSP-selected action and the ground truth next state to train the GSP. This loss has the effect of making the GSP-predicted action consistent with the ground-truth action instead of exactly matching the actions themselves, thus ensuring that actions that are different from the ground-truth—but lead to the same next state— are not inadvertently penalized. To account for varying number of steps required to reach different goals, we propose to jointly optimize the GSP with a goal recognizer that determines if the current goal has been satisfied. See Figure 1 for a schematic illustration of the GSP architecture.
27
+
28
+ We call our method zero-shot because the agent never has access to expert actions, neither during training of the GSP nor for task demonstration at inference. In contrast, most recent work on oneshot imitation learning requires full knowledge of actions and a wealth of expert demonstrations during training (Duan et al., 2017; Finn et al., 2017). In summary, we propose a method that (1) does not require any extrinsic reward or expert supervision during learning, (2) only needs demonstrations during inference, and (3) restricts demonstrations to visual observations alone rather than full stateactions. Instead of learning by imitation, our agent learns to imitate.
29
+
30
+ We evaluate our zero-shot imitator on real-world robots for rope manipulation tasks using a Baxter and office navigation using a TurtleBot. We show that the proposed forward consistency loss improves the performance on the complex task of knot tying from $3 \hat { 6 } \%$ to $6 0 \%$ accuracy. In navigation experiments, we steer a simple wheeled robot around partially-observable office environments and show that the learned GSP generalizes to unseen environments. Furthermore, using navigation experiments in VizDoom environment, we show that (GSP) learned using curiosity-driven exploration (Oudeyer et al., 2007; Pathak et al., 2017; Schmidhuber, 1991) can more accurately follow demonstrations as compared to using random exploration data for learning the GSP. Overall our experiments show that the forward-consistent GSP can be used to imitate a variety of tasks without making environment or task-specific assumptions.
31
+
32
+ # 2 LEARNING TO IMITATE WITHOUT EXPERT SUPERVISION
33
+
34
+ Let $\boldsymbol { S } : \{ x _ { 1 } , a _ { 1 } , x _ { 2 } , a _ { 2 } , . . . , x _ { T } \}$ be the sequence of observations and actions generated by the agent as it explores its environment using the policy $a = \pi _ { E } ( s )$ . This exploration data is used to learn the goal-conditioned skill policy (GSP) $\pi$ takes as input a pair of observations $( x _ { i } , x _ { g } )$ and outputs sequence of actions $( \vec { a } _ { \tau } : a _ { 1 } , a _ { 2 } . . . a _ { K } )$ required to reach the goal observation $( x _ { g } )$ from the current observation $( x _ { i } )$ .
35
+
36
+ $$
37
+ \vec { a } _ { \tau } = \pi ( x _ { i } , x _ { g } ; \theta _ { \pi } )
38
+ $$
39
+
40
+ where states $x _ { i } , x _ { g }$ are sampled from the $s$ . The number of actions, $K$ , is also inferred by the model. We represent $\pi$ by a deep network with parameters $\theta _ { \pi }$ in order to capture complex mappings from visual observations $( x )$ to actions. $\pi$ can be thought of as a variable-step generalization of the inverse dynamics model (Jordan & Rumelhart, 1992), or as the policy corresponding to a universal value function (Foster & Dayan, 2002; Schaul et al., 2015), with the difference that $x _ { g }$ need not be the end goal of a task but can also be an intermediate sub-goal.
41
+
42
+ Let the task to be imitated be provided as a sequence of images $\mathcal { D } : \{ x _ { 1 } ^ { d } , x _ { 2 } ^ { d } , . . . , x _ { N } ^ { d } \}$ captured when the expert demonstrates the task. This sequence of images $\mathcal { D }$ could either be temporally dense or sparse. Our agent uses the learned $\mathrm { G S P } \pi$ to imitate the sequence of visual observations $\mathcal { D }$ starting from its initial state $x _ { 0 }$ by following actions predicted by $\bar { \pi } ( x _ { 0 } , x _ { 1 } ^ { d } ; \theta _ { \pi } )$ . Let the observation after executing the predicted action be $x _ { 0 } ^ { \bar { \prime } }$ . Since multiple actions might be required to reach close to $x _ { 1 } ^ { d }$ , the agent queries a separate goal recognizer network to ascertain if the current observation is close to the goal or not. If the answer is negative, the agent executes the action $a = \pi ( x _ { 0 } ^ { \prime } , x _ { 1 } ^ { d } ; \theta _ { \pi } )$ . This process is repeated iteratively until the goal recognizer outputs that agent is near the goal, or a maximum number of steps are reached. Let the observation of the agent at this point be ${ \hat { x } } _ { 1 }$ . After reaching close to the first observation $( x _ { 1 } ^ { d } )$ in the demonstration, the agent sets its goal as $( x _ { 2 } ^ { d } )$ and repeats the process. The agent stops when all observations in the demonstrations are processed.
43
+
44
+ Note that in the method of imitation described above, the expert is never required to convey to the agent what actions it performed. In the following subsections we describe how we learn the GSP, forward consistency loss, goal recognizer network and various baseline methods.
45
+
46
+ # 2.1 LEARNING THE GOAL-CONDITIONED SKILL POLICY (GSP)
47
+
48
+ We first describe the one-step version of GSP and then extend it to variable length multi-step skills. One-step trajectories take the form of $( x _ { t } , a _ { t } , x _ { t + 1 } )$ and GSP, $\hat { a _ { t } } = \pi ( x _ { t } , x _ { t + 1 } ; \theta _ { \pi } )$ , is trained by minimizing the standard cross-entropy loss $\mathcal { L } ( a _ { t } , \hat { a } _ { t } )$ ,
49
+
50
+ $$
51
+ \mathcal { L } ( a _ { t } , \hat { a } _ { t } ) = p ( a _ { t } | x _ { t } , x _ { t + 1 } ) \log ( \hat { a _ { t } } )
52
+ $$
53
+
54
+ with respect to parameters $\theta _ { \pi }$ , where $p$ and $\hat { a _ { t } }$ are the ground-truth and predicted action distributions. While we do not have access to true $p$ , we empirically approximate it using samples from the distribution, $a _ { t }$ , that are executed by the agent during exploration. For minimizing the crossentropy loss, it is common to assume $p$ as a delta function at $a _ { t }$ . However, this assumption is notably violated if $p$ is inherently multi-modal and high-dimensional. If we optimize say a deep neural network assuming $p$ to be a delta function, the same inputs will be presented with different targets (due to multi-modality) leading to high-variance in gradients which in turn would make learning challenging.
55
+
56
+ In our setup, such multi-modality can occur because multiple actions can lead the agent to the same future observation from the initial observation. For instance, in navigation, if the agent is stuck against a corner, turning or moving forward all collapse to the same effect. The issue of multimodality becomes more critical as the length of trajectories grow, because more and more paths may take the agent from the initial observation to the goal observation given more time. Furthermore, it would require many samples to even obtain a good empirical estimate of a high-dimensional multimodal action distribution $p$ .
57
+
58
+ # 2.2 FORWARD CONSISTENCY LOSS
59
+
60
+ One way to account for multi-modality is by employing the likes of variational autoencoders (Kingma & Welling, 2013; Rezende et al., 2014). However, in many practical situations it is not feasible to obtain ample data for each mode. In this work, we propose an alternative based on the insight that in many scenarios, we only care about whether the agent reached the final state or not and the exact trajectory is of lesser interest. Instead of penalizing the actions predicted by the GSP to match the ground truth, we propose to learn the parameters of GSP by minimizing the distance between observation $\hat { x } _ { t + 1 }$ resulting by executing the predicted action $\hat { a } _ { t } = \pi ( x _ { t } , x _ { t + 1 } ; \theta _ { \pi } )$ and the observation $x _ { t + 1 }$ , which is the result of executing the ground truth action $a _ { t }$ being used to train the GSP. In this formulation, even if the predicted and ground-truth action are different, the predicted action will not be penalized if it leads to the same next state as the ground-truth action. While this formulation will not explicitly maintain all modes of the action distribution, it will reduce the variance in gradients and thus help learning. We call this penalty the forward consistency loss.
61
+
62
+ Note that it is not immediately obvious as to how to operationalize forward consistency loss for two reasons: (a) we need the access to a good forward dynamics model that can reliably predict the effect of an action (i.e., the next observation state) given the current observation state, and (b) such a dynamics model should be differentiable in order to train the GSP using the state prediction error. Both of these issues could be resolved if an analytic formulation of forward dynamics is known.
63
+
64
+ In many scenarios of interest, especially if states are represented as images, an analytic forward model is not available. In this work, we learn the forward dynamics $f$ model from the data, and is defined as $\tilde { x } _ { t + 1 } = f ( x _ { t } , a _ { t } ; \theta _ { f } )$ . Let $\hat { x } _ { t + 1 } = f ( x _ { t } , \hat { a } _ { t } ; \theta _ { f } )$ be the state prediction for the action predicted by $\pi$ . Because the forward model is not analytic and learned from data, in general, there is no guarantee that $\tilde { x } _ { t + 1 } = \widehat { x } _ { t + 1 }$ , even though executing these two actions, $a _ { t } , { \hat { a } } _ { t }$ , in the real-world will have the same effect. In order to make the outcome of action predicted by the GSP and the ground-truth action to be consistent with each other, we include an additional term, $\lVert x _ { t + 1 } - \hat { x } _ { t + 1 } \rVert _ { 2 } ^ { 2 }$ in our loss function and infer the parameters $\theta _ { f }$ by minimizing $\begin{array} { r l r } { \| x _ { t + 1 } - \tilde { x } _ { t + 1 } \| _ { 2 } ^ { 2 } } & { { } + } & { \lambda \| x _ { t + 1 } - } \end{array}$ $\hat { x } _ { t + 1 } \| _ { 2 } ^ { 2 }$ , where $\lambda$ is a scalar hyper-parameter. The first term ensures that the learned forward model explains ground truth transitions $( x _ { t } , a _ { t } , x _ { t + 1 } )$ collected by the agent and the second term ensures consistency. The joint objective for training GSP with forward model consistency is:
65
+
66
+ $$
67
+ \begin{array} { r l } { \underset { \theta _ { \pi } , \theta _ { f } } { \operatorname* { m i n } } } & { \| x _ { t + 1 } - \tilde { x } _ { t + 1 } \| _ { 2 } ^ { \overline { { 2 } } } + \lambda \| x _ { t + 1 } - \hat { x } _ { t + 1 } \| _ { 2 } ^ { 2 } + \mathcal { L } ( a _ { t } , \hat { a } _ { t } ) } \\ { \mathrm { s . t . } } & { \tilde { x } _ { t + 1 } = f ( x _ { t } , a _ { t } ; \theta _ { f } ) } \\ & { \hat { x } _ { t + 1 } = f ( x _ { t } , \hat { a } _ { t } ; \theta _ { f } ) } \\ & { \hat { a } _ { t } = \pi ( x _ { t } , x _ { t + 1 } ; \theta _ { \pi } ) } \end{array}
68
+ $$
69
+
70
+ Note that learning $\theta _ { \pi } , \theta _ { f }$ jointly from scratch is precarious, because the forward model $f$ might not be good in the beginning, and hence could make the gradient updates noisier for $\pi$ . To address this issue, we first pre-train the forward model with only the first term and GSP separately by blocking the gradient flow and then fine-tune jointly.
71
+
72
+ Generalization to feature space dynamics Past work has shown that learning forward dynamics in the feature space as opposed to raw observation space is more robust and leads to better generalization (Agrawal et al., 2016; Pathak et al., 2017). Following these works, we extend the GSP to make predictions in feature representation $\phi ( x _ { t } ) , \phi ( x _ { t + 1 } )$ of the observations $x _ { t } , x _ { t + 1 }$ respectively learned through the self-supervised task of action prediction. The forward consistency loss is then computed by making predictions in this feature space $\phi$ instead of raw observations. The optimization objective for feature space generalization with mutli-step objective is shown in Equation (4).
73
+
74
+ Generalization to multi-step GSP We extend our one-step optimization to variable length sequence of actions in a straightforward manner by having a multi-step GSP $\pi _ { m }$ model with a stepwise forward consistency loss. The GSP $\pi _ { m }$ maintains an internal recurrent memory of the system and outputs actions conditioned on current observation $x _ { t }$ , starting from $x _ { i }$ to reach goal observation $x _ { T }$ . The forward consistency loss is computed at each time step, and jointly optimized with the action prediction loss over the whole trajectory. The final multi-step objective with feature space dynamics is as follows:
75
+
76
+ $$
77
+ \begin{array} { r l } { \underset { \theta _ { \pi } , \theta _ { f } , \theta _ { \phi } } { \operatorname* { m i n } } } & { \displaystyle \sum _ { t = i } ^ { t = T } \Big ( \| \phi ( x _ { t + 1 } ) - \tilde { \phi } ( x _ { t + 1 } ) \| _ { 2 } ^ { 2 } + \lambda \| \phi ( x _ { t + 1 } ) - \hat { \phi } ( x _ { t + 1 } ) \| _ { 2 } ^ { 2 } + \mathcal L ( a _ { t } , \hat { a } _ { t } ) \Big ) } \\ { \mathrm { s . t . } } & { \tilde { \phi } ( x _ { t + 1 } ) = f ( \phi ( x _ { t } ) , a _ { t } ; \theta _ { f } ) } \\ & { \hat { \phi } ( x _ { t + 1 } ) = f ( \phi ( x _ { t } ) , \hat { a } _ { t } ; \theta _ { f } ) } \\ & { \hat { a } _ { t } = \pi ( \phi ( x _ { t } ) , \phi ( x _ { T } ) ; \theta _ { \pi } ) } \end{array}
78
+ $$
79
+
80
+ where $\phi ( . )$ is represented by a CNN with parameters $\theta _ { \phi }$ . The number of steps taken by the multistep GSP $\pi _ { m }$ to reach the goal at inference is variable depending on the decision of goal recognizer; described in next subsection. Note that, in this objective, if $\phi$ is identity then the dynamics simply reduces to modeling in raw observation space. We analyze feature space prediction in VizDoom 3D navigation and stick to observation space in the rope manipulation and the office navigation tasks.
81
+
82
+ The multi-step forward-consistent $G S P \pi _ { m }$ is implemented using a recurrent network which at every step takes as input the feature representation of the current $( \phi ( x _ { t } ) )$ state, goal $( \phi ( x _ { T } ) )$ states, action at the previous time step $\left( a _ { t - 1 } \right)$ and the internal hidden representation $h _ { t - 1 }$ of the recurrent units and predicts $\hat { a } _ { t }$ . Note that inputting the previous action to $\mathrm { G S P } \pi _ { m }$ at each time step could be redundant given that hidden representation is already maintaining a history of the trajectory. Nonetheless, it is helpful to explicitly model this history. This formulation amounts to building an auto-regressive model of the joint action that estimates probability $P ( a _ { t } | x _ { 1 } , a _ { 1 } , . . . a _ { t - 1 } , x _ { t } , x _ { g } )$ at every time step. It is possible to further extend our forward-consistent GSP $\pi _ { m }$ to build multi-step forward model, but we leave that direction of future work.
83
+
84
+ # 2.3 GOAL RECOGNIZER
85
+
86
+ We train a goal recognizer network to figure out if the current goal is reached and therefore allow the agent to take variable numbers of steps between goals. Goal recognition is especially critical when the agent has to transit through a sequence of intermediate goals, as is the case for visual imitation, as otherwise compounding error could quickly lead to divergence from the demonstration. This recognition is simple given knowledge of the true physical state, but difficult when working with visual observations. Aside from the usual challenges of visual recognition, the dependence of observations on the agent’s own dynamics further complicates goal recognition, as the same goal can appear different while moving forward or turning during navigation.
87
+
88
+ We pose goal recognition as a binary classification problem that given an observation $x _ { i }$ and the goal $x _ { g }$ infers if $x _ { i }$ is close to $x _ { g }$ or not. Lacking expert supervision of goals, we draw goal observations at random from the agent’s experience during exploration, since they are known to be feasible. For each such pseudo-goal, we consider observations that were only a few actions away to be positives (i.e., close to the goal) and the remaining observations that were more than a fixed number of actions (i.e., a margin) away as negatives. We trained the goal classifier using the standard cross-entropy loss. Like the skill policy, our goal recognizer is conditioned on the goal for generalization across goals. We found that training an independent goal recognition network consistently outperformed the alternative approach that augments the action space with a “stop” action. Making use of temporal proximity as supervision has also been explored for feature learning in the concurrent work of Sermanet et al. (2018).
89
+
90
+ # 2.4 ABLATIONS AND BASELINES
91
+
92
+ Our proposed formulation of GSP composed of following components: (a) recurrent variable-length skill policy network, (b) explicitly encoding previous action in the recurrence, (c) goal recognizer, (d) forward consistency loss function, and (w) learning forward dynamics in the feature space instead of raw observation space. We systematically ablate these components of forward-consistent GSP, to quantitatively review the importance of each component and then perform comparisons to the prior approaches that could be deployed for the task of visual imitation.
93
+
94
+ ![](images/eae4b6382f956de78ccfb3d61bb1504645c7601322aa79336c4ca70b4e33e508.jpg)
95
+ Figure 2: Qualitative visualization of results for rope manipulation task using Baxter robot. (a) Our robotics system setup. (b) The sequence of human demonstration images provided by the human during inference for the task of knot-tying (top row), and the sequences of observation states reached by the robot while imitating the given demonstration (bottom rows). (c) The sequence of human demonstration images and the ones reached by the robot for the task of manipulating rope into $\mathbf { \partial } ^ { \cdot } \mathbf { S } ^ { \prime }$ shape. Our agent is able to successfully imitate the demonstration.
96
+
97
+ The following methods will be evaluated and compared to in the subsequent experiments section: (1) Classical methods: In visual navigation, we attempted to compare against the state-of-the-art open source classical methods, namely, ORB-SLAM2 (Davison & Murray, 1998; Mur-Artal & Tardos, ´ 2017) and Open-SFM (Mapillary, 2016). (2) Inverse Model: Nair et al. (2017) leverage vanilla inverse dynamics to follow demonstration in rope manipulation setup. We compare to their method in both visual navigation and manipulation. (3) GSP-NoPrevAction-NoFwdConst is the ablation of our recurrent GSP without previous action history and without forward consistency loss. (4) GSP-NoFwdConst refers to our recurrent GSP with previous action history, but without forward consistency objective. (5) GSP-FwdRegularizer refers to the model where forward prediction is only used to regularize the features of GSP but has no role to play in the loss function of predicted actions. The purpose of this variant is to particularly ablate the benefit of consistency loss function with respect to just having forward model as feature regularizer. (6) GSP refers to our complete method with all the components. We now discuss the experiments and evaluate these baselines.
98
+
99
+ # 3 EXPERIMENTS
100
+
101
+ We evaluate our model by testing its performance on: rope manipulation using Baxter robot, navigation of a wheeled robot in cluttered office environments, and simulated 3D navigation. The key requirements of a good skill policy are that it should generalize to unseen environments and new goals while staying robust to irrelevant distractors in the observations. For rope manipulation, we evaluate generalization by testing the ability of the robot to manipulate the rope into configurations such as knots that were not seen during random exploration. For navigation, both real-world and simulation, we check generalization by testing on a novel building/floor.
102
+
103
+ # 3.1 ROPE MANIPULATION
104
+
105
+ Manipulation of non-rigid and deformable objects, e.g., rope, is a challenging problem in robotics. Even humans learn complex rope manipulation such as tying knots, either by observing an expert
106
+
107
+ <table><tr><td>Method</td><td>Success %</td></tr><tr><td>Inverse Model [Nair et.al. 2017]</td><td>36%± 9.6%</td></tr><tr><td>Forward-regularized GSP</td><td>44%± 9.9%</td></tr><tr><td>Forward-consistent GSP [Ours]</td><td>60% ± 9.8%</td></tr><tr><td></td><td></td></tr></table>
108
+
109
+ ![](images/c118b28d8a83c13253a4b46c69b0cdd73a3ab2269efb886b97d23af45a7c11ed.jpg)
110
+ Manipulation of non-rigid and deformable objects, e.g., rope, is a challenging problem iFigure 3: GSP trained using forward consistency loss significantly outperforms the baselines at the Even huperformtask of (a) manipulating rope into $\mathbf { \partial } ^ { 6 } \mathbf { S } ^ { \prime }$ s learn complex rope manipulation such as tying knots, either by observingby receiving explicit instructions. To test whether our agent could manipu shape as measured by TPS-RPM error and (b) knot-tying by simply observing a human, we use the dawhere we report success rate with bootstrap standard deviation.
111
+
112
+ 60K interaction pairs of the form (xt, at, xt+1) that are used to train the GSP.perform it or by receiving explicit instructions. We test whether our agent could manipulate ropes During inference, our proposed approach is tasked to follow a visual demonstration provby simply observing a human perform it. We use the data collected by Nair et al. (2017), where human expert for manipulating the rope into a complex ‘S’ shape and tying a knot. Our agea Baxter robot manipulated a rope kept on the table in front of it. During exploration, the robot robot, only gets to observe the image sequence of intermediate states, as human manipinteracts with the rope by using a pick and place primitive that chooses a random point on the rope rope, without any access to the corresponding actions. Note that the knot shape is never enand displaces it by a randomly chosen length and direction. This process is repeated a number of generalize to be able to follow thtimes to collect about 60K interaction pairs of the form $( x _ { t } , a _ { t } , x _ { t + 1 } )$ ration. More details follow in the suppthat are used to train the GSP.
113
+
114
+ During inference, our proposed approach is tasked to follow a visual demonstration provided by a Metric The performance of thhuman expert for manipulating the rope into a complex $\mathbf { \partial } ^ { \bullet } \mathbf { S } ^ { \bullet }$ odel is evaluated by measuring the non-rigid registr shape and tying a knot. Our agent, Baxter the demonstration. The matching cost is measured using the thin plate spline robust pointrobot, only gets to observe the image sequence of intermediate states, as human manipulates the technique (TPS-RPM) described in (Chui & Rangarajan, 2003). While TPS-RPM providrope, without any access to the corresponding actions. Note that the knot shape is never encountered metric for measuring performance for constructing the ‘S’ shape, it is not an appropriateduring the self-supervised data collection phase and therefore the learned GSP model would have to knots because the configuration of the rope in a knot is 3D due to intertwining of the ropegeneralize to be able to follow the human demonstration. More details follow in the supplementary material, Section A.1.
115
+
116
+ Visual Imitation We compare our approach to the previous best method of visual imitMetric The performance of the model is evaluated by measuring the non-rigid registration cost deploys an inverse model which takes as input a pair of current and goal images to between the rope state achieved by the robot and the state demonstrated by the human at every step in for a fair comparison. The comparison is performed apples-to-apples and the only differethe demonstration. The matching cost is measured using the thin plate spline robust point matching we deploy forward-consistency loss for our approach. The results in Figure 2 show that otechnique (TPS-RPM) described in (Chui & Rangarajan, 2003). While TPS-RPM provides a good significantly outperforms the basmetric for measuring performance for constructing the $\mathbf { \epsilon } ^ { 6 } \mathbf { S } ^ { \prime }$ at task of manipulating the rope in the ‘S’ shape and shape, it is not an appropriate metric for an accuracy of 60% in comparison to 36% achieved by the baseline.knots because the configuration of the rope in a knot is 3D due to intertwining of the rope, and it fails to find the correct point correspondences. We, therefore, use success rate as the metric in knot 3.2 NAV IGAT ION IN INDOOR OFFICE ENVIRONMENTStying where the completion of a successful knot is judged by human verification.
117
+
118
+ A natural way to instruct a robot to move in an indoor office environment is to ask it tVisual Imitation Qualitative examples of our agent trying to manipulate rope are shown in Figure 2. command the robot, in this work, we communicate with the robot by either showing it a sinWe compare our approach to the baseline that deploys an inverse model which takes as input a pair of the goal, or a sequence of images leading to faraway goals. In both scenarios, the robot iof current and goal images to output the desired action to reach the goal (Nair et al., 2017). We reto autonomously determine the motor commands for moving to the goal. We used Turtimplement the baseline and train in our setup for a fair comparison. To further ablate the importance navigation using an onboard camera for sensing RGB images. For learning the GSP, an aof consistency loss, we compare to a baseline that just uses a forward model as a regularizer of features. The results in Figure 3 show that our method significantly outperforms the baseline at task twoof manipulating the rope in the $\mathbf { \partial } ^ { \cdot } \mathbf { S } ^ { \prime }$ ors of a academic building in total. We then dep shape and achieves a success rate of $6 0 \%$ the learned model on ain comparison to $3 6 \%$ achieved by the baseline.
119
+
120
+ # 3.2 NAVIGATION IN INDOOR OFFICE ENVIRONMENTS
121
+
122
+ A natural way to instruct a robot to move in an indoor office environment is to ask it to go near a certain location, such as a refrigerator or a someone’s office. Instead of using language to command the robot, in this work, we communicate with the robot by either showing it a single image of the goal, or a sequence of images leading to faraway goals. In both scenarios, the robot is required to autonomously determine the motor commands for moving to the goal. We used TurtleBot2 for navigation using an onboard camera for sensing RGB images. For learning the GSP, an automated
123
+
124
+ ![](images/a29bde948214b45c66c17edaa9b35cd33f80620e6ae9d7303d434715280bc509.jpg)
125
+ Figure 4: Visualization of the TurtleBot trajectory to reach a goal image (right) from the initial image (top-left). Since the initial and goal image have no overlap, the robot first explores the environment by turning in place. Once it detects overlap between its current image and goal image (i.e. step 42 onward), it moves towards the goal. Note that we did not explicitly train the robot to explore and such exploratory behavior naturally emerged from the self-supervised learning.
126
+
127
+ <table><tr><td>Model Name</td><td>Run Id-1</td><td>Run Id-2</td><td>Run Id-3</td><td>Run Id-4</td><td>Run Id-5</td><td>Run Id-6</td><td>Run Id-7</td><td>Run Id-8</td><td>Num Success</td></tr><tr><td>Random Search</td><td>Fail</td><td>Fail</td><td>Fail</td><td>Fail</td><td>Fail</td><td>Fail</td><td>Fail</td><td>Fail</td><td>0</td></tr><tr><td>Inverse Model[Nair et.al. 2017]</td><td>Fail</td><td>Fail</td><td>Fail</td><td>Fail</td><td>Fail</td><td>Fail</td><td>Fail</td><td>Fail</td><td>0</td></tr><tr><td>GSP-NoPrevAction-NoFwdConst</td><td>39 steps</td><td>34 steps</td><td>Fail</td><td>Fail</td><td>Fail</td><td>Fail</td><td>Fail</td><td>Fail</td><td>2</td></tr><tr><td>GSP-NoFwdConst</td><td>22 steps</td><td>22 steps</td><td>39 steps</td><td>48 steps</td><td>Fail</td><td>Fail</td><td>Fail</td><td>Fail</td><td>4</td></tr><tr><td>GSP (Ours)</td><td>119 steps</td><td>66 steps</td><td>144 steps</td><td>67 steps</td><td>51 steps</td><td>Fail</td><td>100 steps</td><td>Fail</td><td>6</td></tr></table>
128
+
129
+ Table 1: Quantitative evaluation of various methods on the task of navigating using a single image of goal in an unseen environment. Each column represents a different run of our system for a different initial/goal image pair. Our full GSP model takes longer to reach the goal on average given a successful run but reaches the goal successfully at a much higher rate.
130
+
131
+ self-supervised scheme for data collection was devised that doesn’t require human supervision. The robot collected a number of navigation trajectories from two floors of a academic building which in total contain 230K interactions data, i.e. $( x _ { t } , a _ { t } , x _ { t + 1 } )$ . We then deployed the learned model on a separate floor of a building with substantially different textures and furniture layout for performing visual imitation at test time. The details of the robotic setup, data collection, and network architecture of GSP are described in supplementary material, Section A.2.
132
+
133
+ 1) Goal Finding We first tested if the GSP learned by the TurtleBot can enable it to find its way to a goal that is within the same room from just a single image of the goal. To test the extrapolative generalization, we keep the Turtlebot approximately 20-30 steps away from the target location in a way that current and goal observations have no overlap as shown in Figure 4. We test the robot in an indoor office environment on a different floor that it has never encountered before. We judge the robot to be successful if it stops close to the goal and failure if it crashed into furniture or does not reach the goal within 200 steps. Since the initial and goal images have no overlap, classical techniques such as structure from motion that rely on feature matching cannot be used to infer the executed action. Therefore, in order to reach the goal, the robot must explore its surroundings. We find that our GSP model outperforms the baseline models in reaching the target location. Our model learns the exploratory behavior of rotating in place until it encounters an overlap between its current and goal image. Results are shown in Table 1 and videos are available at the website 1.
134
+
135
+ 2) Visual Imitation In the previous paragraph, we saw that the robot can reach a goal that’s within the same room. However, our agent is unable to reach far away goals such as in other rooms using just a single image. In such scenarios, an expert might communicate instructions like go to the door, turn right, go to the closest chair etc. Instead of language instruction, in our setup we provide a sequence of landmark images to convey the same high-level idea. These landmark images were captured from the robot’s camera as the expert moved the robot from the start to a goal location. However, note that it is not necessary for the expert to control the robot to capture the images because we don’t make use of the expert’s actions, but only the images. Instead of providing the image after every action in the demonstration, we only provided every fifth image. The rationale behind this choice is that we want to sample the demonstration sparsely to minimize the agent’s
136
+
137
+ ![](images/d73cebcd59f84f7349737b59d7c4d067bdee1cbd515f7bbb88ec98234df23365.jpg)
138
+ Figure 5: The performance of TurtleBot at following a visual demonstration given as a sequence of images (top row). The TurtleBot is positioned in a manner such that the first image in demonstration has no overlap with its current observation. Even under this condition the robot is able to move close to the first demo image (shown as Robot WayPoint-1) and then follow the provided demonstration until the end. This also exemplifies a failure case for classical methods; there are no possible keypoint matches between WayPoint-1 and WayPoint-2, and the initial observation is even farther from WayPoint-1.
139
+
140
+ <table><tr><td></td><td colspan="3">Maze Demonstration</td><td colspan="3">Loop Demonstration</td></tr><tr><td>Model Name</td><td>Run-1</td><td>Run-2</td><td>Run-3</td><td>Run-1</td><td>Run-2</td><td>Run-3</td></tr><tr><td>SIFT</td><td>10%</td><td>5%</td><td>15%</td><td></td><td></td><td></td></tr><tr><td>GSP-NoPrevAction-NoFwdConst</td><td>60%</td><td>70%</td><td>100%</td><td></td><td>一</td><td></td></tr><tr><td>GSP-NoFwdConst</td><td>65%</td><td>90%</td><td>100%</td><td>0%</td><td>0%</td><td>0%</td></tr><tr><td>GSP (ours)</td><td>100%</td><td>60%</td><td>100%</td><td>0%</td><td>100%</td><td>100%</td></tr></table>
141
+
142
+ Table 2: Quantitative evaluation of TurtleBot’s performance at following visual demonstrations in two scenarios: maze and the loop. We report the $\%$ of landmarks reached by the agent across three runs of two different demonstrations. Results show that our method outperforms the baselines. Note that 3 more trials of the loop demonstration were tested under significantly different lighting conditions and neither model succeeded. Detailed results are available in the supplementary materials.
143
+
144
+ reliance on the expert. Such sub-sampling (as shown in Figure 5) provides an easy way to vary the complexity of the task.
145
+
146
+ We evaluate via multiple runs of two demonstrations, namely, maze demonstration where the robot is supposed to navigate through a maze-like path and perturbed loop demonstration, where the robot is supposed to make a complete loop as instructed by demonstration images. The loop demonstration is longer and more difficult than the maze. We start the agent from different starting locations and orientations with respect to that of demonstration. Each orientation is initialized such that no part of the demonstration’s initial frame is visible. Results are shown in Table 2. When we sample every frame, our method and classical structure from motion can both be used to follow the demonstration. However, at sub-sampling rate of five, SIFT-based feature matching approaches did not work and ORBSLAM2 (Mur-Artal & Tardos, 2017) failed to generate a map, whereas our ´ method was successful. Notice that providing sparse landmark images instead of dense video adds robustness to the visual imitation task. In particular, consider the scenario in which the environment has changed since the time the demonstration was recorded. By not requiring the agent to match every demonstration image frame-by-frame, it becomes less sensitive to changes in the environment.
147
+
148
+ # 3.3 3D NAVIGATION IN VIZDOOM
149
+
150
+ We have evaluated our approach on real-robot scenarios thus far. To further analyze the performance and robustness of our approach through large scale experiments, we setup the same navigation task as described in previous subsection in a simulated VizDoom environment. Our goal is to measure: (1) the robustness of each method with proper error bars, (2) the role of initial self-supervised data collection for performance on visual imitation, (3) the quantitative difference in modeling forward consistency loss in feature space in comparison to raw visual space.
151
+
152
+ Table 3: Quantitative evaluation of our proposed GSP and the baseline models at following visual demonstrations in VizDoom 3D Navigation. Medians and $9 5 \%$ confidence intervals are reported for demonstration completion and efficiency over 50 seeds and 5 human paths per environment type.
153
+
154
+ <table><tr><td>Model Name</td><td>Same Map, Same Texture Median%</td><td>Efficiency %</td><td>Same Map,Diff Texture Median %</td><td>Efficiency %</td><td>Diff Map,Diff Texture Median %</td><td>Efficiency %</td></tr><tr><td colspan="7">Random Exploration for Data Collection:</td></tr><tr><td>GSP-NoFwdConst</td><td>63.2 ± 5.7</td><td>36.4 ± 3.3</td><td>32.2 ± 0.7</td><td>28.9 ± 4.0</td><td>34.5 ± 0.6</td><td>23.1 ± 2.4</td></tr><tr><td>GSP (ours pixels)</td><td>62.2 ± 5.1</td><td>43.0±2.6</td><td>32.4 ± 0.8</td><td>30.9 ± 2.9</td><td>35.4 ± 1.1</td><td>29.3 ± 3.9</td></tr><tr><td>GSP (ours features)</td><td>68.9 ± 6.9</td><td>53.9 ±4.0</td><td>32.4 ± 0.7</td><td>47.4 ± 7.6</td><td>39.1 ± 2.0</td><td>30.4 ± 2.5</td></tr><tr><td colspan="7">Curiosity-driven Exploration for Data Collection:</td></tr><tr><td>GSP-NoFwdConst</td><td>78.2 ± 2.3</td><td>63.0 ± 4.3</td><td>43.2 ± 2.6</td><td>33.9 ± 3.0</td><td>40.2 ±4.0</td><td>27.3 ±1.9</td></tr><tr><td>GSP-FwdRegularizer</td><td>78.4± 3.4</td><td>59.8 ± 4.1</td><td>50.6 ± 4.7</td><td>30.9 ±3.0</td><td>37.9 ± 1.1</td><td>28.9 ±1.7</td></tr><tr><td>GSP (ours pixels)</td><td>78.2 ± 3.4</td><td>65.2 ± 4.2</td><td>47.1 ± 4.7</td><td>32.4±3.0</td><td>44.8 ± 4.0</td><td>29.5 ± 1.9</td></tr><tr><td>GSP (ours features)</td><td>78.2 ±4.6</td><td>67.0± 3.3</td><td>49.4 ± 4.8</td><td>26.9 ± 1.5</td><td>47.1 ± 3.0</td><td>24.1 ±1.7</td></tr></table>
155
+
156
+ In VizDoom, we collect data by deploying two types of exploration methods: random exploration and curiosity-driven exploration (Pathak et al., 2017). The hypothesis is that if the initial data collected by the robot is driven by a better strategy than just random, this should eventually help the agent follow long demonstrations better. Our environment consists of 2 maps in total. We train on one map with 5 different starting positions for collecting exploration data. For validation, we collect 5 human demonstrations in a map with the same layout as in training but with different textures. For zero-shot generalization, we collect 5 human demonstrations in a novel map layout with novel textures. Exact details for data collection and training setup are in the supplementary, Section A.3.
157
+
158
+ Metric We report the median of maximum distance reached by the robot in following the given sequence of demonstration images. The maximum distance reached is the distance of farthest landmark point that the agent reaches contiguously, i.e., without missing any intermediate landmarks. Measuring the farthest landmark reached does not capture how efficiently it is reached. Hence, we further measure efficiency of the agent as the ratio of number of steps taken by the agent to reach farthest contiguous landmark with respect to the number of steps shown in human demonstrations.
159
+
160
+ Visual Imitation The task here is same as the one in real robot navigation where the agent is shown a sparse sequence of images to imitate. The results are in Table 3. We found that the exploration data collected via curiosity significantly improves the final imitation performance across all methods including the baselines with respect to random exploration. Our baseline GSP model with a forward regularizer instead of consistency loss ends up overfitting to the training layout. In contrast, our forward-consistent GSP model outperforms other methods in generalizing to new map with novel textures. This indicates that the forward consistency is possibly doing more than just regularizing the policy features. Training forward consistency loss in feature space further enhances the generalization even when both pixel and feature space models perform similarly on training environment.
161
+
162
+ # 4 RELATED WORK
163
+
164
+ Our work is closely related to imitation learning, but we address a different problem statement that gives less supervision and requires generalization across tasks during inference.
165
+
166
+ Imitation Learning The two main threads of imitation learning are behavioral cloning (Argall et al., 2009; Pomerleau, 1989), which directly supervises the mapping of states to actions, and inverse reinforcement learning (Abbeel & Ng, 2004; Ho & Ermon, 2016; Levine et al., 2016; $\mathrm { N g }$ & Russell, 2000; Ziebart et al., 2008), which recovers a reward function that makes the demonstration optimal (or nearly optimal). Inverse RL is most commonly achieved with state-actions, and is difficult to extend to fitting the reward to observations alone, though in principle state occupancy could be sufficient. Recent work in imitation learning (Duan et al., 2017; Finn et al., 2017; Gupta et al., 2017) can generalize to novel goals, but require a wealth of demonstrations comprised of expert state-actions for learning. Our approach does not require expert actions at all.
167
+
168
+ Visual Demonstration The common scenario in LfD is to assume full knowledge of expert states and actions during demonstrations, but several papers have focused on relaxing this supervision to visual observations alone. Nair et al. (2017) observe a sequence of images from the expert demonstration for performing rope manipulations. Sermanet et al. (2017; 2018) imitate humans with robots by self-supervised learning but require expert supervision at training time. Third person imitation learning (Stadie et al., 2017) and the concurrent work of imitation-from-observation (Liu et al., 2018) learn to translate expert observations into agent observations such that they can do policy optimization to minimize the distance between the agent trajectory and the translated demonstration, but they require demonstrations for learning. Visual servoing is a standard problem in robotics (Koichi & Tom, 1993) that seeks to take actions that align the agent’s observation with a target configuration of carefully-designed visual features (Wilson et al., 1996; Yoshimi & Allen, 1994) or raw pixel intensities (Caron et al., 2013). Classical methods rely on fixed features or policies, but more recently end-to-end learning has improved results (Lampe & Riedmiller, 2013; Lee et al., 2017).
169
+
170
+ Forward/Inverse Dynamics and Consistency Numerous prior works, such as Ebert et al. (2017); Oh et al. (2015); Watter et al. (2015), have learned forward dynamics model for planning actions. The works of Agrawal et al. (2016); Jordan & Rumelhart (1992); Pathak et al. (2017); Wolpert et al. (1995) jointly learn forward and inverse dynamics model but do not optimize for consistency between the forward and inverse dynamics. We empirically show that learning models by our forward consistency loss significantly improves task performance. Enforcing consistency as a meta-supervision has also been successful in finding visual correspondences (Zhou et al., 2016) or unpaired image translations (Zhu et al., 2017).
171
+
172
+ Goal Conditioning By parameterizing the value or policy function with a goal, an agent can learn and do multiple tasks. The idea of learning goal-conditioned policies has been explored in (Agrawal et al., 2016; Andrychowicz et al., 2017; Nair et al., 2017; Schaul et al., 2015). Similarly to hindsight experience replay (Andrychowicz et al., 2017) we draw goals from experience, but our policy optimization has better sample efficiency through supervised learning and dynamics modeling instead of reinforcement learning. Moreover, we work from high-dimensional visual inputs instead of knowledge of the true states and do not make use of a task reward during training. In our setting, all of the expert goals are followed zero-shot since they are only revealed after learning.
173
+
174
+ # 5 DISCUSSION
175
+
176
+ In this work, we presented a method for imitating expert demonstrations from visual observations alone. In contrast to most work in imitation learning, we never require access to expert actions. The key idea is to learn a GSP using data collected by self-supervised exploration. However, this limits the quality of the learned GSP as per the exploration data. For instance, we deploy random exploration on our real-world navigation robot, which means that it would almost never follow trajectories that go between rooms. Consequently, the learned GSP is unable to navigate towards a goal image taken in another room without requiring intermediate sub-goals. Pathak et al. (2017) show that the agent learns to move along corridors and transition between rooms purely driven by curiosity in VizDoom. Training GSP on such a structured data could equip the agent with more interesting search behaviors, e.g., going across rooms to find a goal. In general, using better methods of exploration for training the GSP could be a fruitful direction toward generalizing zeroshot imitation.
177
+
178
+ One limitation of our approach is that we require first-person view demonstrations. Extension to third-person demonstrations (Liu et al., 2018; Stadie et al., 2017) would make the method applicable in more general scenarios. Another limitation is that, in the current framework, it is implicitly assumed that the statistics of visual observations when the expert demonstrates the task and the agent follows it are similar. For e.g., when the expert performs a demonstration in one setting, say in daylight and the agent needs to imitate say in the evening, the change in the lighting conditions might result in worse performance. Making the GSP robust to such nuisance changes or other changes in environment by domain adaptation would be necessary to scale the method to practical problems. Another thing to note is that, in the current framework, we do not learn from expert demonstrations, but simply imitate them. It would be interesting to investigate ways for an agent to learn from the expert to bias its exploration to more useful parts of the environment.
179
+
180
+ While we used a sequence of images to provide a demonstration, our work makes no image-specific assumptions and can be extended to using formal language for communicating goals. For instance, after training the GSP, instead of transforming an image into features $\phi$ as described in section 2.2, one could possibly learn a mapping to transform language instructions into this feature space.
181
+
182
+ # ACKNOWLEDGMENTS
183
+
184
+ We would like to thank members of BAIR for fruitful discussions and comments. This work was supported in part by DARPA; NSF IIS-1212798, IIS-1427425, IIS-1536003, Berkeley DeepDrive, and an equipment grant from NVIDIA and the Valrhona Reinforcement Learning Fellowship. DP is supported by NVIDIA and Snapchat’s graduate fellowships.
185
+
186
+ REFERENCES
187
+ Pieter Abbeel and Andrew Y. Ng. Apprenticeship learning via inverse reinforcement learning. In ICML, 2004. 10
188
+ Pulkit Agrawal, Ashvin Nair, Pieter Abbeel, Jitendra Malik, and Sergey Levine. Learning to poke by poking: Experiential learning of intuitive physics. NIPS, 2016. 2, 4, 11
189
+ Marcin Andrychowicz, Filip Wolski, Alex Ray, Jonas Schneider, Rachel Fong, Peter Welinder, Bob McGrew, Josh Tobin, Pieter Abbeel, and Wojciech Zaremba. Hindsight experience replay. In NIPS, 2017. 2, 11
190
+ Brenna D Argall, Sonia Chernova, Manuela Veloso, and Brett Browning. A survey of robot learning from demonstration. Robotics and autonomous systems, 2009. 1, 10
191
+ Albert Bandura and Richard H Walters. Social learning theory, volume 1. Prentice-hall Englewood Cliffs, NJ, 1977. 1
192
+ Cynthia Breazeal and Brian Scassellati. Robots that imitate humans. Trends in cognitive sciences, 2002. 1
193
+ Guillaume Caron, Eric Marchand, and El Mustapha Mouaddib. Photometric visual servoing for omnidirectional cameras. Autonomous Robots, 35(2-3):177–193, 2013. 11
194
+ Haili Chui and Anand Rangarajan. A new point matching algorithm for non-rigid registration. CVIU, 2003. 7
195
+ Andrew J Davison and David W Murray. Mobile robot localisation using active vision. In ECCV, 1998. 6
196
+ Rudiger Dillmann. Teaching and learning of robot tasks via observation of human performance. ¨ Robotics and Autonomous Systems, 2004. 1
197
+ Yan Duan, Marcin Andrychowicz, Bradly Stadie, OpenAI Jonathan Ho, Jonas Schneider, Ilya Sutskever, Pieter Abbeel, and Wojciech Zaremba. One-shot imitation learning. In NIPS, 2017. 2, 10
198
+ Frederik Ebert, Chelsea Finn, Alex X Lee, and Sergey Levine. Self-supervised visual planning with temporal skip connections. arXiv preprint arXiv:1710.05268, 2017. 11
199
+ Chelsea Finn, Tianhe Yu, Tianhao Zhang, Pieter Abbeel, and Sergey Levine. One-shot visual imitation learning via meta-learning. CoRL, 2017. 2, 10
200
+ David Foster and Peter Dayan. Structure in the space of value functions. Machine Learning, 2002. 3
201
+ Saurabh Gupta, James Davidson, Sergey Levine, Rahul Sukthankar, and Jitendra Malik. Cognitive mapping and planning for visual navigation. CVPR, 2017. 10
202
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In CVPR, 2016. 15
203
+ Jonathan Ho and Stefano Ermon. Generative adversarial imitation learning. In NIPS, 2016. 10
204
+ Katsushi Ikeuchi and Takashi Suehiro. Toward an assembly plan from observation. i. task recognition with polyhedral objects. IEEE Transactions on Robotics and Automation, 1994. 1
205
+
206
+ Michael I Jordan and David E Rumelhart. Forward models: Supervised learning with a distal teacher. Cognitive science, 1992. 3, 11
207
+
208
+ Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. ICLR, 2015. 15
209
+
210
+ Diederik $\mathrm { \bf P }$ Kingma and Max Welling. Auto-encoding variational bayes. arXiv preprint arXiv:1312.6114, 2013. 4
211
+
212
+ Hashimoto Koichi and Husband Tom. Visual servoing: real-time control of robot manipulators based on visual sensory feedback, volume 7. World scientific, 1993. 11
213
+
214
+ Yasuo Kuniyoshi, Masayuki Inaba, and Hirockika Inoue. Teaching by showing: Generating robot programs by visual observation of human performance. In International Symposium on Industrial Robots, 1989. 1
215
+
216
+ Yasuo Kuniyoshi, Masayuki Inaba, and Hirochika Inoue. Learning by watching: Extracting reusable task knowledge from visual observation of human performance. IEEE Transactions on Robotics and Automation, 1994. 1
217
+
218
+ Thomas Lampe and Martin Riedmiller. Acquiring visual servoing reaching and grasping skills using neural reinforcement learning. In Neural Networks (IJCNN), The 2013 International Joint Conference on, pp. 1–8. IEEE, 2013. 11
219
+
220
+ Alex X Lee, Sergey Levine, and Pieter Abbeel. Learning visual servoing with deep features and fitted q-iteration. arXiv preprint arXiv:1703.11000, 2017. 11
221
+
222
+ Sergey Levine, Peter Pastor, Alex Krizhevsky, and Deirdre Quillen. Learning hand-eye coordination for robotic grasping with large-scale data collection. In ISER, 2016. 2, 10
223
+
224
+ YuXuan Liu, Abhishek Gupta, Pieter Abbeel, and Sergey Levine. Imitation from observation: Learning to imitate behaviors from raw video via context translation. ICRA, 2018. 11
225
+
226
+ Mapillary. Open source structure from motion pipeline. https://github.com/mapillary/ OpenSfM, 2016. 6
227
+
228
+ Raul Mur-Artal and Juan D Tardos. Orb-slam2: An open-source slam system for monocular, stereo, ´ and rgb-d cameras. IEEE Transactions on Robotics, 2017. 6, 9
229
+
230
+ Ashvin Nair, Dian Chen, Pulkit Agrawal, Phillip Isola, Pieter Abbeel, Jitendra Malik, and Sergey Levine. Combining self-supervised learning and imitation for vision-based rope manipulation. ICRA, 2017. 2, 6, 7, 11, 15
231
+
232
+ Andrew $\mathrm { ~ Y ~ N ~ g ~ }$ and Stuart J Russell. Algorithms for inverse reinforcement learning. In ICML, pp. 663–670, 2000. 1, 10
233
+
234
+ Junhyuk Oh, Xiaoxiao Guo, Honglak Lee, Richard L Lewis, and Satinder Singh. Action-conditional video prediction using deep networks in atari games. In NIPS, 2015. 11
235
+
236
+ Pierre-Yves Oudeyer, Frdric Kaplan, and Verena V Hafner. Intrinsic motivation systems for autonomous mental development. Evolutionary Computation, 2007. 3
237
+
238
+ Deepak Pathak, Pulkit Agrawal, Alexei A. Efros, and Trevor Darrell. Curiosity-driven exploration by self-supervised prediction. In ICML, 2017. 3, 4, 10, 11, 16
239
+
240
+ Lerrel Pinto and Abhinav Gupta. Supersizing self-supervision: Learning to grasp from 50k tries and 700 robot hours. ICRA, 2016. 2
241
+
242
+ Dean A Pomerleau. ALVINN: An autonomous land vehicle in a neural network. In NIPS, 1989. 1, 10
243
+
244
+ Danilo Jimenez Rezende, Shakir Mohamed, and Daan Wierstra. Stochastic backpropagation and approximate inference in deep generative models. arXiv preprint arXiv:1401.4082, 2014. 4
245
+
246
+ Stefan Schaal. Is imitation learning the route to humanoid robots? Trends in cognitive sciences, 1999. 1
247
+
248
+ Tom Schaul, Daniel Horgan, Karol Gregor, and David Silver. Universal value function approximators. In ICML, 2015. 3, 11
249
+
250
+ Jurgen Schmidhuber. A possibility for implementing curiosity and boredom in model-building neural controllers. In From animals to animats: Proceedings of the first international conference on simulation of adaptive behavior, 1991. 3
251
+
252
+ Pierre Sermanet, Kelvin Xu, and Sergey Levine. Unsupervised perceptual rewards for imitation learning. In RSS, 2017. 11
253
+
254
+ Pierre Sermanet, Corey Lynch, Yevgen Chebotar, Jasmine Hsu, Eric Jang, Stefan Schaal, and Sergey Levine. Time-contrastive networks: Self-supervised learning from video. In ICRA, 2018. 5, 11
255
+
256
+ Bradly C. Stadie, Pieter Abbeel, and Ilya Sutskever. Third-person imitation learning. In ICLR, 2017. 11
257
+
258
+ Manuel Watter, Jost Springenberg, Joschka Boedecker, and Martin Riedmiller. Embed to control: A locally linear latent dynamics model for control from raw images. In NIPS, 2015. 11
259
+
260
+ William J Wilson, CC Williams Hulls, and Graham S Bell. Relative end-effector control using cartesian position based visual servoing. IEEE Transactions on Robotics and Automation, 12(5): 684–696, 1996. 11
261
+
262
+ Daniel M Wolpert, Zoubin Ghahramani, and Michael I Jordan. An internal model for sensorimotor integration. Science-AAAS-Weekly Paper Edition, 1995. 11
263
+
264
+ Yezhou Yang, Yi Li, Cornelia Fermuller, and Yiannis Aloimonos. Robot learning manipulation ¨ action plans by ”watching” unconstrained videos from the world wide web. In AAAI, 2015. 1
265
+
266
+ Billibon H Yoshimi and Peter K Allen. Active, uncalibrated visual servoing. In Robotics and Automation, 1994. Proceedings., 1994 IEEE International Conference on, pp. 156–161. IEEE, 1994. 11
267
+
268
+ Tinghui Zhou, Philipp Krahenbuhl, Mathieu Aubry, Qixing Huang, and Alexei A. Efros. Learning dense correspondence via 3d-guided cycle consistency. In CVPR, 2016. 11
269
+
270
+ Jun-Yan Zhu, Taesung Park, Phillip Isola, and Alexei A. Efros. Unpaired image-to-image translation using cycle-consistent adversarial networks. ICCV, 2017. 11
271
+
272
+ Brian D. Ziebart, Andrew Maas, J Andrew Bagnell, and Anind K Dey. Maximum entropy inverse reinforcement learning. In AAAI, 2008. 10
273
+
274
+ # A SUPPLEMENTARY MATERIAL
275
+
276
+ We evaluated our proposed approach across number of environments and tasks. In this section, we provide additional details about the experimental task setup and hyperparameters.
277
+
278
+ # A.1 ROPE MANIPUATION
279
+
280
+ Robotic Setup Our setup of Baxter robot for rope manipulation task follows the one described in Nair et al. (2017). We re-use the data that is collected by a Baxter robot interacting with a rope kept on a table in front of it in a self-supervised manner, and consists of approximately 60K interaction pairs.
281
+
282
+ Implementation Details The base architecture for all the methods consists of a pre-trained AlexNet, whose features are fed into a skill policy network that predicts the location of grasp, direction of displacement, and the magnitude of displacement. For the forward regularizer baseline, a forward model is trained to jointly regularize the AlexNet features along with the skill policy network with loss weight of forward model set to 0.1. For our proposed forward-consistent GSP, a forward consistency loss is then applied to the actions predicted by the skill policy network. The forward consistency loss weight is set to 0.1. Since this is a fully observed setup, we did not use recurrence in any of the skill policy networks. All the models are optimized using Adam (Kingma & Ba, 2015) with a learning rate of $1 e - 4$ . For the first 40K iterations, the AlexNet weights were frozen, and then fine-tuned jointly with the later layers.
283
+
284
+ # A.2 NAVIGATION IN INDOOR OFFICE ENVIRONMENTS
285
+
286
+ Robotic Setup We used the TurtleBot2 robot comprising of a wheeled Kobuki base and an Orbbec Astra camera for capturing RGB images for all our experiments. The robot’s action space had four discrete actions: move forward, turn left, turn right, and stand still (i.e., no-op). The forward action is approximately $1 0 \mathrm { c m }$ forward translation and the turning actions are approximately 14-18 degrees of rotation. These numbers vary due to the use of velocity control. A powerful on-board laptop was used to process the images and infer the motor commands. Several modifications were made to the default TurtleBot setup: the base’s batteries were replaced with longer lasting ones, and the default NVIDIA Jetson TK1 embedded board was replaced with a more powerful GigaByte Aero laptop and an accompanying portable charging power bank.
287
+
288
+ Self-supervised Data Collection We devised an automated self-supervised scheme for data collection which does not require any human supervision. In our scheme, the robot first samples one out of four actions and then the number of times to repeat the selected action (i.e. action repeat). The no-op action is sampled with probability 0.05 and the other three actions are sampled with equal probability. In case the no-op action is chosen, an action repeat of $\{ 1 , 2 \}$ steps is uniformly sampled. In case of other actions, an action repeat of 1-5 steps is randomly and uniformly chosen. The robot autonomously repeated this process and collected 230K interactions from two floors of an academic building. If the robot crashes into an object, it performs a reset maneuver by first moving backwards and then turning right/left by a uniformly sampled angle between 90-270 degrees. A separate floor of the building with substantially different furniture layout and visual textures is then used for testing the learned model.
289
+
290
+ Implementation Details The data collected by self-supervised exploration is then used to train our recurrent forward-consistent GSP. The base architecture of our model is an ImageNet pre-trained ResNet-50 (He et al., 2016) network. Input are the images and output are the actions of robot. The forward consistency model is first pre-trained and then fine-tuned together end-to-end with the GSP. The loss weight of the forward model is 0.1, and the objective is minimized using Adam (Kingma & Ba, 2015) with learning rate of $5 e - 4$ .
291
+
292
+ # A.3 3D NAVIGATION IN VIZDOOM
293
+
294
+ Self-supervised Data Collection Our environment consists of two map. One map is used for training and validation, with different textures for validation. Second map has different textures than training and validation and is used for generalization experiments. For both curiosity and random exploration, we collect a total of 1.5 million frames each with action repeat of 4 collected in the standard DoomMyWayHome map used for training in Pathak et al. (2017). $\sim \textstyle { \frac { 2 } { 3 } }$ of the data comes from random-room resets, and $\sim \frac { 1 } { 3 }$ of the data comes from a fixed-room reset (i.e, room number 10). The curiosity policy was half sampled and half greedy with the exact split being $40 \%$ greedy policy random-room reset, $2 5 \%$ sample policy random-room reset, $2 5 \%$ sample policy fixed-room reset, and $10 \%$ greedy policy fixed-room reset.
295
+
296
+ Table 4: Quantitative evaluation of TurtleBot’s performance at following visual demonstrations in two conditions: maze and the loop. The fraction denotes how many landmarks it reaches out of the total number of landmarks in the full demonstration. The bracketed number represents the number of actions the agent took to reach its farthest landmark.
297
+
298
+ <table><tr><td rowspan="2">Model Name</td><td colspan="3">Maze Runs - Optimal Steps: 100</td><td colspan="3">Loop Runs - Optimal Steps: 85</td></tr><tr><td>Run-1</td><td>Run-2</td><td>Run-3</td><td>Run-1</td><td>Run-2</td><td>Run-3</td></tr><tr><td>SIFT</td><td>2/20 (10)</td><td>1/20 (9)</td><td>3/20 (38)</td><td>一</td><td>1</td><td>1</td></tr><tr><td>GSP-NoPrevAction-NoFwdConst</td><td>12/20 (109)</td><td>14/20 (184)</td><td>20/20 (263)</td><td></td><td></td><td></td></tr><tr><td>GSP-NoFwdConst</td><td>13/20 (147)</td><td>18/20 (325)</td><td>20/20 (166)</td><td>0/17 (0)</td><td>0/17 (0)</td><td>0/17 (0)</td></tr><tr><td>GSP (ours)</td><td>20/20 (353)</td><td>12/20 (194)</td><td>20/20 (168)</td><td>0/17 (0)</td><td>17/17 (243)</td><td>17/17 (165)</td></tr></table>
299
+
300
+ Table 5: Quantitative evaluation of our proposed GSP and the baseline models at following visual demonstrations in VizDoom 3D Navigation. Means and standard errors are reported for demonstration completion and efficiency over 50 seeds and 5 human paths per environment type.
301
+
302
+ <table><tr><td>Model Name</td><td>Same Map,Same Texture Mean %</td><td>Efficiency %</td><td>Same Map,Diff Texture Mean %</td><td>Efficiency %</td><td>Diff Map,Diff Texture Mean %</td><td>Efficiency %</td></tr><tr><td colspan="7">Random Exploration for Data Collection:</td></tr><tr><td>GSP-NoFwdConst</td><td>61.8 ± 0.9</td><td>60.4 ± 2.1</td><td>37.6 ± 0.7</td><td>68.6 ± 2.5</td><td>42.2 ± 0.8</td><td>50.6 ± 1.9</td></tr><tr><td>GSP (ours pixels)</td><td>61.0 ± 1.0</td><td>68.0± 2.2</td><td>38.1 ± 0.7</td><td>69.1 ± 2.5</td><td>40.3 ± 0.9</td><td>64.2 ± 2.3</td></tr><tr><td>GSP (ours features)</td><td>62.0 ± 1.0</td><td>75.8 ± 2.5</td><td>37.0 ± 0.7</td><td>87.1 ± 2.8</td><td>48.7 ± 0.9</td><td>52.5 ± 1.8</td></tr><tr><td colspan="7">Curiosity-driven Exploration for Data Collection:</td></tr><tr><td>GSP-NoFwdConst</td><td>70.7 ± 0.9</td><td>66.9 ± 1.4</td><td>49.8 ± 0.8</td><td>55.8 ± 2.2</td><td>51.2 ±1.0</td><td>39.5 ± 1.3</td></tr><tr><td>GSP-FwdRegularizer</td><td>70.6 ± 0.9</td><td>67.9 ± 1.6</td><td>51.9 ± 0.8</td><td>49.3 ± 1.6</td><td>48.3 ± 1.0</td><td>49.3 ± 1.8</td></tr><tr><td>GSP (ours pixels)</td><td>71.0 ± 0.9</td><td>73.1 ± 2.7</td><td>53.3 ± 0.9</td><td>53.4 ± 2.0</td><td>52.2 ± 1.0</td><td>44.0 ± 1.5</td></tr><tr><td>GSP (ours features)</td><td>68.8 ±1.0</td><td>72.0 ± 1.7</td><td>53.2 ±0.8</td><td>53.0 ± 2.3</td><td>52.8 ± 0.9</td><td>37.7 ± 1.3</td></tr></table>
303
+
304
+ For each scenario, we collect 5 human demonstrations each and give every 10th frame as input to the agent for the task of visual imitation. For each human path, we evaluate on 50 different seeds where the agent starts with a uniformly sampled orientation. We then get the median across 250 (50x5) total runs for each type of environment and report median of the percentage of the human path reached by the agent and how soon it got to that point relative to the human.
305
+
306
+ In the main paper, we report median accuracy and the confidence interval for median 2. Since the initial position of the agent is randomized in orientation compared to the one in visual demonstration, the mean results suffer from high variance due to outliers. Hence, median accuracy results in a more reliable metric. However, we report mean results in Table 5 for the completion.
307
+
308
+ Implementation Details All models were trained with batch size 64, Adam Solver with 1e-4 learning rate, and landmark slices uniformly sampled between 5 to 15 action steps for each batch. The observations are $4 2 \mathbf { x } 4 2$ resolution, grayscale images with only one-time channel both for goal and current state. All models used the same goal recognizer that was trained on the curiosity data. For selecting the hyper-parameters in forward regularizer, pixel-based forward consistency, and featurebased forward consistency models, we selected the best loss coefficient among $\{ 0 . 0 1 , 0 . 0 5 , 0 . 1 \}$ that achieved the highest median completion on our validation environment which consisted of the training maps with novel textures.
md/train/BkjLkSqxg/BkjLkSqxg.md ADDED
@@ -0,0 +1,280 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # LIPNET: END-TO-END SENTENCE-LEVEL LIPREADING
2
+
3
+ Yannis M. Assael1,†, Brendan Shillingford1,†, Shimon Whiteson1 & Nando de Freitas1,2,3
4
+
5
+ Department of Computer Science, University of Oxford, Oxford, UK
6
+ Google DeepMind, London, UK 2
7
+ CIFAR, Canada 3
8
+ {yannis.assael,brendan.shillingford, shimon.whiteson,nando.de.freitas}@cs.ox.ac.uk
9
+
10
+ # ABSTRACT
11
+
12
+ Lipreading is the task of decoding text from the movement of a speaker’s mouth. Traditional approaches separated the problem into two stages: designing or learning visual features, and prediction. More recent deep lipreading approaches are end-to-end trainable (Wand et al., 2016; Chung & Zisserman, 2016a). However, existing work on models trained end-to-end perform only word classification, rather than sentence-level sequence prediction. Studies have shown that human lipreading performance increases for longer words (Easton & Basala, 1982), indicating the importance of features capturing temporal context in an ambiguous communication channel. Motivated by this observation, we present LipNet, a model that maps a variable-length sequence of video frames to text, making use of spatiotemporal convolutions, a recurrent network, and the connectionist temporal classification loss, trained entirely end-to-end. To the best of our knowledge, LipNet is the first end-to-end sentence-level lipreading model that simultaneously learns spatiotemporal visual features and a sequence model. On the GRID corpus, LipNet achieves $9 5 . 2 \%$ accuracy in sentence-level, overlapped speaker split task, outperforming experienced human lipreaders and the previous $8 6 . 4 \%$ word-level state-of-the-art accuracy (Gergen et al., 2016).
13
+
14
+ # 1 INTRODUCTION
15
+
16
+ Lipreading plays a crucial role in human communication and speech understanding, as highlighted by the McGurk effect (McGurk & MacDonald, 1976), where one phoneme’s audio dubbed on top of a video of someone speaking a different phoneme results in a third phoneme being perceived.
17
+
18
+ Lipreading is a notoriously difficult task for humans, specially in the absence of context1. Most lipreading actuations, besides the lips and sometimes tongue and teeth, are latent and difficult to disambiguate without context (Fisher, 1968; Woodward & Barber, 1960). For example, Fisher (1968) gives 5 categories of visual phonemes (called visemes), out of a list of 23 initial consonant phonemes, that are commonly confused by people when viewing a speaker’s mouth. Many of these were asymmetrically confused, and observations were similar for final consonant phonemes.
19
+
20
+ Consequently, human lipreading performance is poor. Hearing-impaired people achieve an accuracy of only $1 7 \pm \mathrm { \dot { 1 } 2 \% }$ even for a limited subset of 30 monosyllabic words and $2 1 \pm 1 1 \%$ for 30 compound words (Easton & Basala, 1982). An important goal, therefore, is to automate lipreading. Machine lipreaders have enormous practical potential, with applications in improved hearing aids, silent dictation in public spaces, security, speech recognition in noisy environments, biometric identification, and silent-movie processing.
21
+
22
+ Machine lipreading is difficult because it requires extracting spatiotemporal features from the video (since both position and motion are important). Recent deep learning approaches attempt to extract those features end-to-end. Most existing work, however, performs only word classification, not sentence-level sequence prediction.
23
+
24
+ In this paper, we present LipNet, which is to the best of our knowledge, the first end-to-end sentence-level lipreading model. As with modern deep learning based automatic speech recognition (ASR), LipNet is trained end-to-end to make sentence-level predictions. Our model operates at the character-level, using spatiotemporal convolutional neural networks (STCNNs), recurrent neural networks (RNNs), and the connectionist temporal classification loss (CTC) Graves et al. (2006).
25
+
26
+ Our empirical results on the GRID corpus (Cooke et al., 2006), one of the few public sentence-level datasets, show that LipNet attains a $9 \bar { 5 } . 2 \%$ sentence-level word accuracy, in a overlapped speakers split that is popular for benchmarking lipreading methods. The previous best accuracy reported on an aligned word classification version of this task was $8 6 . 4 \%$ (Gergen et al., 2016). Furthermore, LipNet can generalise across unseen speakers in the GRID corpus with an accuracy of $8 8 . 6 \%$ .
27
+
28
+ We also compare the performance of LipNet with that of hearing-impaired people who can lipread on the GRID corpus task. On average, they achieve an accuracy of ${ \bar { 5 } } 2 . 3 \%$ , in contrast to LipNet’s $1 . 6 9 \times$ higher accuracy in the same sentences.
29
+
30
+ Finally, by applying saliency visualisation techniques (Zeiler & Fergus, 2014; Simonyan et al., 2013), we interpret LipNet’s learned behaviour, showing that the model attends to phonologically important regions in the video. Furthermore, by computing intra-viseme and inter-viseme confusion matrices at the phoneme level, we show that almost all of LipNet’s few erroneous predictions occur within visemes, since context is sometimes insufficient for disambiguation.
31
+
32
+ # 2 RELATED WORK
33
+
34
+ In this section, we outline various existing approaches to automated lipreading.
35
+
36
+ Automated lipreading: Most existing work on lipreading does not employ deep learning. Such work requires either heavy preprocessing of frames to extract image features, temporal preprocessing of frames to extract video features (e.g., optical flow or movement detection), or other types of handcrafted vision pipelines (Matthews et al., 2002; Zhao et al., 2009; Gurban & Thiran, 2009; Papandreou et al., 2007; 2009; Pitsikalis et al., 2006; Lucey & Sridharan, 2006; Papandreou et al., 2009). The automated lipreading literature is too vast to adequately cover, so we refer the reader to Zhou et al. (2014) for an extensive review.
37
+
38
+ Notably, Goldschen et al. (1997) were the first to do visual-only sentence-level lipreading using hidden Markov models (HMMs) in a limited dataset, using hand-segmented phones. Later, Neti et al. (2000) were the first to do sentence-level audiovisual speech recognition using an HMM combined with hand-engineered features, on the IBM ViaVoice (Neti et al., 2000) dataset. The authors improve speech recognition performance in noisy environments by fusing visual features with audio ones. The dataset contains 17111 utterances of 261 speakers for training (about 34.9 hours) and is not publicly available. As stated, their visual-only results cannot be interpreted as visual-only recognition, as they are used as rescoring of the noisy audio-only lattices. Using a similar approach, Potamianos et al. (2003) report speaker independent and speaker adapted $9 1 . 6 \hat { 2 } \%$ , $8 2 . 3 1 \%$ WER in the same dataset respectively, and $3 8 . 5 3 \%$ , $1 6 . 7 7 \%$ WER in the connected DIGIT corpus, which contains sentences of digits.
39
+
40
+ Furthermore, Gergen et al. (2016) use speaker-dependent training on an LDA-transformed version of the Discrete Cosine Transforms of the mouth regions in an HMM/GMM system. This work holds the previous state-of-the-art on the GRID corpus with a speaker-dependent accuracy of $8 6 . 4 \%$ . Generalisation across speakers and extraction of motion features is considered an open problem, as noted in (Zhou et al., 2014). LipNet addresses both of these issues.
41
+
42
+ Classification with deep learning: In recent years, there have been several attempts to apply deep learning to lipreading. However, all of these approaches perform only word or phoneme classification, whereas LipNet performs full sentence sequence prediction. Approaches include learning multimodal audio-visual representations (Ngiam et al., 2011; Sui et al., 2015; Ninomiya et al., 2015; Petridis & Pantic, 2016), learning visual features as part of a traditional speech-style processing pipeline (e.g. HMMs, GMM-HMMs, etc.) for classifying words and/or phonemes (Almajai et al., 2016; Takashima et al., 2016; Noda et al., 2014; Koller et al., 2015), or combinations thereof (Takashima et al., 2016). Many of these approaches mirror early progress in applying neural networks for acoustic processing in speech recognition (Hinton et al., 2012).
43
+
44
+ Chung & Zisserman (2016a) propose spatial and spatiotemporal convolutional neural networks, based on VGG, for word classification. The architectures are evaluated on a word-level dataset BBC TV (333 and 500 classes), but, as reported, their spatiotemporal models fall short of the spatial architectures by an average of around $1 4 \%$ . Additionally, their models cannot handle variable sequence lengths and they do not attempt sentence-level sequence prediction.
45
+
46
+ Chung & Zisserman (2016b) train an audio-visual max-margin matching model for learning pretrained mouth features, which they use as inputs to an LSTM for 10-phrase classification on the OuluVS2 dataset, as well as a non-lipreading task.
47
+
48
+ Wand et al. (2016) introduce LSTM recurrent neural networks for lipreading but address neither sentence-level sequence prediction nor speaker independence.
49
+
50
+ Garg et al. (2016) apply a VGG pre-trained on faces to classifying words and phrases from the MIRACL-VC1 dataset, which has only 10 words and 10 phrases. However, their best recurrent model is trained by freezing the VGGNet parameters and then training the RNN, rather than training them jointly. Their best model achieves only $5 6 . 0 \%$ word classification accuracy, and $4 4 . 5 \%$ phrase classification accuracy, despite both of these being 10-class classification tasks.
51
+
52
+ Sequence prediction in speech recognition: The field of automatic speech recognition (ASR) would not be in the state it is today without modern advances in deep learning, many of which have occurred in the context of ASR (Graves et al., 2006; Dahl et al., 2012; Hinton et al., 2012). The connectionist temporal classification loss (CTC) of Graves et al. (2006) drove the movement from deep learning as a component of ASR, to deep ASR systems trained end-to-end (Graves & Jaitly, 2014; Maas et al., 2015; Amodei et al., 2015). As mentioned earlier, much recent lipreading progress has mirrored early progress in ASR, but stopping short of sequence prediction.
53
+
54
+ LipNet is the first end-to-end model that performs sentence-level sequence prediction for visual speech recogntion. That is, we demonstrate the first work that takes as input as sequence of images and outputs a distribution over sequences of tokens; it is trained end-to-end using CTC and thus also does not require alignments.
55
+
56
+ Lipreading Datasets: Lipreading datasets (AVICar, AVLetters, AVLetters2, BBC TV, CUAVE, OuluVS1, OuluVS2) are plentiful (Zhou et al., 2014; Chung & Zisserman, 2016a), but most only contain single words or are too small. One exception is the GRID corpus (Cooke et al., 2006), which has audio and video recordings of 34 speakers who produced 1000 sentences each, for a total of 28 hours across 34000 sentences. Table 1 summarises state-of-the-art performance in each of the main lipreading datasets.
57
+
58
+ Table 1: Existing lipreading datasets and the state-of-the-art accuracy reported on these. The size column represents the number of utterances used by the authors for training. Although the GRID corpus contains entire sentences, Gergen et al. (2016) consider only the simpler case of predicting isolated words. LipNet predicts sequences and hence can exploit temporal context to attain much higher accuracy. Phrase-level approaches were treated as plain classification.
59
+
60
+ <table><tr><td>Method</td><td>Dataset</td><td>Size</td><td>Output</td><td>Accuracy</td></tr><tr><td colspan="5"></td></tr><tr><td>Fu et al. (2008)</td><td>AVICAR</td><td>851</td><td>Digits</td><td>37.9%</td></tr><tr><td>Hu et al. (2016)</td><td>AVLetter</td><td>78</td><td>Alphabet</td><td>64.6%</td></tr><tr><td>Papandreou et al. (2009)</td><td>CUAVE</td><td>1800</td><td>Digits</td><td>83.0%</td></tr><tr><td>Chung &amp; Zisserman (2016a)</td><td>OuluVS1</td><td>200</td><td>Phrases</td><td>91.4%</td></tr><tr><td>Chung &amp; Zisserman (2016b)</td><td>OuluVS2</td><td>520</td><td>Phrases</td><td>94.1%</td></tr><tr><td>Chung &amp; Zisserman ( 1 (2016a)</td><td>BBC TV</td><td>&gt; 400000</td><td>Words</td><td>65.4%</td></tr><tr><td>Gergen et al. (2016)</td><td>GRID</td><td>29700</td><td>Words*</td><td>86.4%</td></tr><tr><td>LipNet</td><td>GRID</td><td>28775</td><td>Sentences</td><td>95.2%</td></tr></table>
61
+
62
+ We use the GRID corpus to evaluate LipNet because it is sentence-level and has the most data. The sentences are drawn from the following simple grammar: command $^ { ( 4 ) } + c o l o r ^ { ( 4 ) } +$ prepositio $\ l _ { \ l } ^ { ( 4 ) } + l e t t e r ^ { ( 2 5 ) } + d i g i t ^ { ( 1 0 ) } + a d v e r ^ { \ l } \ l _ { b } ^ { \ l ^ { ( 4 ) } }$ , where the number denotes how many word choices there are for each of the 6 word categories. The categories consist of, respectively, {bin, lay, place, set}, {blue, green, red, white}, {at, by, in, with}, $\{ \bar { A } , \ldots , Z \} \backslash \{ W \}$ , $\{ \mathrm { z e r o } , \ldots , \mathrm { n i n e } \}$ , and {again, now, please, $\operatorname { s o o n } \}$ , yielding 64000 possible sentences. For example, two sentences in the data are “set blue by A four please” and “place red at C zero again”.
63
+
64
+ # 3 LIPNET
65
+
66
+ LipNet is a neural network architecture for lipreading that maps variable-length sequences of video frames to text sequences, and is trained end-to-end. In this section, we describe LipNet’s building blocks and architecture.
67
+
68
+ # 3.1 SPATIOTEMPORAL CONVOLUTIONS
69
+
70
+ Convolutional neural networks (CNNs), containing stacked convolutions operating spatially over an image, have been instrumental in advancing performance in computer visions tasks such as object recognition that receive an image as input (Krizhevsky et al., 2012). A basic 2D convolution layer from $C$ channels to $C ^ { \prime }$ channels (without a bias and with unit stride) computes
71
+
72
+ $$
73
+ [ \mathrm { c o n v } ( { \bf x } , { \bf w } ) ] _ { c ^ { \prime } i j } = \sum _ { c = 1 } ^ { C } \sum _ { i ^ { \prime } = 1 } ^ { k _ { w } } \sum _ { j ^ { \prime } = 1 } ^ { k _ { h } } w _ { c ^ { \prime } c i ^ { \prime } j ^ { \prime } } x _ { c , i + i ^ { \prime } , j + j ^ { \prime } } ,
74
+ $$
75
+
76
+ for input $\mathbf { x }$ and weights $\mathbf { w } \in \mathbb { R } ^ { C ^ { \prime } \times C \times k _ { w } \times k _ { h } }$ where we define $x _ { c i j } = 0$ for $i , j$ out of bounds. Spatiotemporal convolutional neural networks (STCNNs) can process video data by convolving across time, as well as the spatial dimensions (Karpathy et al., 2014; Ji et al., 2013). Hence similarly,
77
+
78
+ $$
79
+ [ \mathrm { s t c o n v } ( { \bf x } , { \bf w } ) ] _ { c ^ { \prime } t i j } = \sum _ { c = 1 } ^ { C } \sum _ { t ^ { \prime } = 1 } ^ { k _ { t } } \sum _ { i ^ { \prime } = 1 } ^ { k _ { w } } \sum _ { j ^ { \prime } = 1 } ^ { k _ { h } } w _ { c ^ { \prime } c t ^ { \prime } i ^ { \prime } j ^ { \prime } } x _ { c , t + t ^ { \prime } , i + i ^ { \prime } , j + j ^ { \prime } } .
80
+ $$
81
+
82
+ # 3.2 GATED RECURRENT UNIT
83
+
84
+ Gated Recurrent Unit (GRU) (Chung et al., 2014) is a type of recurrent neural network (RNN) that improves upon earlier RNNs by adding cells and gates for propagating information over more timesteps and learning to control this information flow. It is similar to the Long Short-Term Memory (LSTM) RNN (Hochreiter & Schmidhuber, 1997). We use the standard formulation:
85
+
86
+ $$
87
+ \begin{array} { r l } & { [ \mathbf { u } _ { t } , \mathbf { r } _ { t } ] ^ { T } = \mathrm { s i g m } ( \mathbf { W } _ { z } \mathbf { z } _ { t } + \mathbf { W } _ { h } \mathbf { h } _ { t - 1 } + \mathbf { b } _ { g } ) } \\ & { \qquad \tilde { \mathbf { h } } _ { t } = \mathrm { t a n h } ( \mathbf { U } _ { z } \mathbf { z } _ { t } + \mathbf { U } _ { h } ( \mathbf { r } _ { t } \odot \mathbf { h } _ { t - 1 } ) + \mathbf { b } _ { h } ) } \\ & { \qquad \mathbf { h } _ { t } = ( \mathbf { 1 } - \mathbf { u } _ { t } ) \odot \mathbf { h } _ { t - 1 } + \mathbf { u } _ { t } \odot \tilde { \mathbf { h } } _ { t } } \end{array}
88
+ $$
89
+
90
+ where $\mathbf { z } : = \{ \mathbf { z } _ { 1 } , \dots , \mathbf { z } _ { T } \}$ is the input sequence to the RNN, $\odot$ denotes element-wise multiplication, and $\mathrm { s i g m } ( r ) = 1 / ( 1 + \exp ( - r ) )$ . We use a bidirectional GRU (Bi-GRU) as introduced by Graves & Schmidhuber (2005) in the context of LSTMs: one RNN maps $\{ \mathbf { z } _ { 1 } , \dotsc , \mathbf { z } _ { T } \} \mapsto \{ \overrightarrow { \mathbf { h } _ { 1 } } , \dotsc , \overrightarrow { \mathbf { h } _ { T } } \}$ , and another $\{ \mathbf { z } _ { T } , \dotsc , \mathbf { z } _ { 1 } \} \mapsto \{ { \overleftarrow { \mathbf { h } _ { 1 } } } , \dotsc , { \overleftarrow { \mathbf { h } _ { T } } } \}$ , then $\mathbf { h } _ { t } : = [ \overrightarrow { \mathbf { h } _ { t } } , \overleftarrow { \mathbf { h } _ { t } } ]$ . The Bi-GRU ensures that $\mathbf { h } _ { t }$ depends on $\mathbf { z } _ { t ^ { \prime } }$ for all $t ^ { \prime }$ . To parameterise a distribution over sequences, at time-step $t$ let $p ( u _ { t } | \mathbf { z } ) =$ softmax $( \mathrm { m l p } ( \mathbf { h } _ { t } ; \mathbf { W } _ { m l p } ) )$ , where mlp is a feed-forward network with weights $\mathbf { W } _ { m l p }$ . Then we can define the distribution over length- $\mathcal { T }$ sequences as $\begin{array} { r } { p ( u _ { 1 } , \ldots , u _ { T } | \mathbf { z } ) = \prod _ { 1 \leq t \leq T } p ( u _ { t } | \mathbf { \bar { z } } ) } \end{array}$ , where $T$ is determined by $\mathbf { z }$ , the input to the GRU. In LipNet, $\mathbf { z }$ is the output of the STCNN.
91
+
92
+ # 3.3 CONNECTIONIST TEMPORAL CLASSIFICATION
93
+
94
+ The connectionist temporal classification (CTC) loss (Graves et al., 2006) is widely used in modern speech recognition as it eliminates the need for training data that aligns inputs to target outputs (Amodei et al., 2015; Graves & Jaitly, 2014; Maas et al., 2015). Given a model that outputs a sequence of discrete distributions over the token classes (vocabulary) augmented with a special “blank” token, CTC computes the probability of a sequence by marginalising over all sequences that are defined as equivalent to this sequence. This simultaneously removes the need for alignments and addresses variable-length sequences. Let $V$ denote the set of tokens that the model classifies at a single time-step of its output (vocabulary), and the blank-augmented vocabulary ${ \tilde { V } } = V \cup \{ \ldots \}$ where denotes the CTC blank symbol. Define the function $B : \tilde { V } ^ { * } \to V ^ { * }$ that, given a string over $\tilde { V }$ , deletes adjacent duplicate characters and removes blank tokens. For a label sequence $y \in V ^ { * }$ , CTC defines $\begin{array} { r } { \dot { p } ( y | \mathbf { x } ) = \sum _ { u \in \mathcal { B } ^ { - 1 } ( y ) } } \end{array}$ s.t. $_ { | u | = T } p \big ( u _ { 1 } , \dots , u _ { T } | \mathbf x \big )$ , where $T$ is the number of time-steps in the sequence model. For example, if $T = 3$ , CTC defines the probability of a string “am” as $p ( a a m ) \bar { + } p ( a m m ) + p ( . a m ) + \bar { p } ( a . m ) + p ( a m . )$ . This sum is computed efficiently by dynamic programming, allowing us to perform maximum likelihood.
95
+
96
+ ![](images/1872721e1db4aa3d870c4e29c3ac890f371742e27758f736f3657583d4e43b7e.jpg)
97
+ Figure 1: LipNet architecture. A sequence of $T$ frames is used as input, and is processed by 3 layers of STCNN, each followed by a spatial max-pooling layer. The features extracted are processed by 2 Bi-GRUs; each time-step of the GRU output is processed by a linear layer and a softmax. This end-to-end model is trained with CTC.
98
+
99
+ # 3.4 LIPNET ARCHITECTURE
100
+
101
+ Figure 1 illustrates the LipNet architecture, which starts with $3 \times$ (spatiotemporal convolutions, channel-wise dropout, spatial max-pooling). Subsequently, the features extracted are followed by two Bi-GRUs. The Bi-GRUs are crucial for efficient further aggregation of the STCNN output. Finally, a linear transformation is applied at each time-step, followed by a softmax over the vocabulary augmented with the CTC blank, and then the CTC loss. All layers use rectified linear unit (ReLU) activation functions. More details including hyperparameters can be found in Table 3 of Appendix A.
102
+
103
+ # 4 LIPREADING EVALUATION
104
+
105
+ In this section, we evaluate LipNet on the GRID corpus. The augmentation methods employed don’t make use of external data and rely purely on the GRID corpus.
106
+
107
+ # 4.1 DATA AUGMENTATION
108
+
109
+ Preprocessing: The GRID corpus consists of 34 subjects, each narrating 1000 sentences. The videos for speaker 21 are missing, and a few others are empty or corrupt, leaving 32746 usable videos. We employ a split (unseen speakers; not previously used in the literature) holding out the data of two male speakers (1 and 2) and two female speakers (20 and 22) for evaluation (3971 videos). The remainder is used for training (28775 videos). We also use a sentence-level variant of the split (overlapped speakers) similar to Wand et al. (2016), where 255 random sentences from each speaker are used for evaluation. All remaining data from all speakers is pooled together for training. All videos are 3 seconds long with a frame rate of 25fps. The videos were processed with the DLib face detector, and the iBug face landmark predictor (Sagonas et al., 2013) with 68 landmarks coupled with an online Kalman Filter. Using these landmarks, we apply an affine transformation to extract a mouth-centred crop of size $1 0 0 \times 5 0$ pixels per frame. We standardise the RGB channels over the whole training set to have zero mean and unit variance.
110
+
111
+ Augmentation: We augment the dataset with simple transformations to reduce overfitting. First, we train on both the regular and the horizontally mirrored image sequence. Second, since the dataset provides word start and end timings for each sentence video, we augment the sentence-level training data with video clips of individual words as additional training instances. These instances have a decay rate of 0.925. Third, to encourage resilience to varying motion speeds by deletion and duplication of frames, this is performed with a per-frame probability of 0.05. The same augmentation methods were followed in all proposed baselines and models.
112
+
113
+ # 4.2 BASELINES
114
+
115
+ To evaluate LipNet, we compare its performance to that of three hearing-impaired people who can lipread, as well as three ablation models inspired by recent state-of-the-art work (Chung & Zisserman, 2016a; Wand et al., 2016).
116
+
117
+ Hearing-Impaired People: This baseline was performed by three members of the Oxford Students’ Disability Community. After being introduced to the grammar of the GRID corpus, they observed 10 minutes of annotated videos from the training dataset, then annotated 300 random videos from the evaluation dataset. When uncertain, they were asked to pick the most probable answer.
118
+
119
+ Baseline-LSTM: Using the sentence-level training setup of LipNet, we replicate the model architecture of the previous deep learning GRID corpus state-of-the-art (Wand et al., 2016). See Appendix A for more implementation details.
120
+
121
+ Baseline-2D: Based on the LipNet architecture, we replace the STCNN with spatial-only convolutions similar to those of Chung & Zisserman (2016a). Notably, contrary to the results we observe with LipNet, Chung & Zisserman (2016a) report $1 4 \%$ and $3 1 \%$ poorer performance of their STCNNs compared to the 2D architectures in their two datasets.
122
+
123
+ Baseline-NoLM: Identical to LipNet, but with the language model used in beam search disabled.
124
+
125
+ # 4.3 PERFORMANCE EVALUATION
126
+
127
+ To measure the performance of LipNet and the baselines, we compute the word error rate (WER) and the character error rate (CER), standard metrics for the performance of ASR models. We produce approximate maximum-probability predictions from LipNet by performing CTC beam search. WER (or CER) is defined as the minimum number of word (or character) insertions, substitutions, and deletions required to transform the prediction into the ground truth, divided by the number of words (or characters) in the ground truth. Note that WER is usually equal to classification error when the predicted sentence has the same number of words as the ground truth, particularly in our case since almost all errors are substitution errors.
128
+
129
+ Table 2 summarises the performance of LipNet compared to the baselines. According to the literature, the accuracy of human lipreaders is around $2 0 \%$ (Easton & Basala, 1982; Hilder et al., 2009). As expected, the fixed sentence structure and the limited subset of words for each position in the GRID corpus facilitate the use of context, increasing performance. On the unseen speakers split, the three hearing-impaired people achieve $5 7 . 3 \%$ , $5 0 . { \overset { - } { 4 } } { \overset { - } { \% } }$ , and $3 5 . 5 \%$ WER respectively, yielding an average of $4 7 . 7 \%$ WER.
130
+
131
+ Table 2: Performance of LipNet on the GRID dataset compared to the baselines, measured on two splits: (a) evaluating on only unseen speakers, and (b) evaluating on a 255 video subset of each speakers’ sentences.
132
+
133
+ <table><tr><td rowspan="2">Method</td><td colspan="2">Unseen Speakers</td><td colspan="2">Overlapped Speakers</td></tr><tr><td>CER</td><td>WER</td><td>CER</td><td>WER</td></tr><tr><td>Hearing-Impaired Person (avg)</td><td></td><td>47.7%</td><td></td><td></td></tr><tr><td>Baseline-LSTM</td><td>38.4%</td><td>52.8%</td><td>15.2%</td><td>26.3%</td></tr><tr><td>Baseline-2D</td><td>16.2%</td><td>26.7%</td><td>4.3%</td><td>11.6%</td></tr><tr><td>Baseline-NoLM</td><td>6.7%</td><td>13.6%</td><td>2.0%</td><td>5.6%</td></tr><tr><td>LipNet</td><td>6.4%</td><td>11.4%</td><td>1.9%</td><td>4.8%</td></tr></table>
134
+
135
+ For both unseen and overlapped speakers evaluation, the highest performance is achieved by the architectures enhanced with convolutional stacks. LipNet exhibits a $2 . 3 \times$ higher performance in the overlapped compared to the unseen speakers split. For unseen speakers, Baseline-2D and LipNet achieve $1 . 8 \times$ and $4 . 2 \times$ lower WER, respectively, than hearing-impaired people.
136
+
137
+ The WER for unseen speakers Baseline-2D is $2 6 . 7 \%$ , whereas for LipNet it is $2 . 3 \times$ lower, at $1 1 . 4 \%$ . Similarly, the error rate for overlapped speakers was $2 . 4 \times$ lower for LipNet compared to Baseline2D. Both results demonstrate the importance of combining STCNNs with RNNs. This performance difference confirms the intuition that extracting spatiotemporal features using a STCNN is better than aggregating spatial-only features. This observation contrasts with the empirical observations of Chung & Zisserman (2016a). Furthermore, LipNet’s use of STCNN, RNNs, and CTC cleanly allow processing both variable-length input and variable-length output sequences, whereas the architectures of Chung & Zisserman (2016a) and Chung & Zisserman (2016b) only handle the former.
138
+
139
+ Baseline-LSTM exhibits the lowest performance, in both unseen and overlapped speakers, with $5 2 . 8 \%$ and $2 6 . 3 \%$ WER, respectively. Interestingly, although Baseline-LSTM replicates the architecture of Wand et al. (2016), and despite the numerous data augmentation methods, the model performs $1 . 3 \times$ lower than the reported $7 9 . 6 \%$ word-level accuracy illustrating the difficulty of a sentence-level task even in a restricted grammar.
140
+
141
+ Finally, by disabling the language model, the Baseline-NoLM exhibits approximately $1 . 2 \times$ higher WER than our proposed model.
142
+
143
+ # 4.4 LEARNED REPRESENTATIONS
144
+
145
+ In this section, we analyse the learned representations of LipNet from a phonological perspective. First, we create saliency visualisations (Simonyan et al., 2013; Zeiler & Fergus, 2014) to illustrate where LipNet has learned to attend. In particular, we feed an input into the model and greedily decode an output sequence, yielding a CTC alignment $\hat { u } \in \tilde { V } ^ { * }$ (following the notation of Sections 3.2 and 3.3). Then, we compute the gradient of $\textstyle \sum _ { t } p ( { \hat { u } } _ { t } | \mathbf { x } )$ with respect to the input video frame sequence, but unlike Simonyan et al. (2013), we use guided backpropagation (Springenberg et al., 2014). Second, we train LipNet to predict ARPAbet phonemes, instead of characters, to analyse visual phoneme similarities using intra-viseme and inter-viseme confusion matrices.
146
+
147
+ # 4.4.1 SALIENCY MAPS
148
+
149
+ We apply saliency visualisation techniques to interpret LipNet’s learned behaviour, showing that the model attends to phonologically important regions in the video. In particular, in Figure 2 we analyse two saliency visualisations for the words please and lay for speaker 25, based on Ashby (2013).
150
+
151
+ ![](images/d6845168838f936d340381ba209455b7c18df7f8eeafe691226d8b5dedc3de4b.jpg)
152
+ Figure 2: Saliency maps for the words (a) please and (b) lay, produced by backpropagation to the input, showing the places where LipNet has learned to attend. The pictured transcription is given by greedy CTC decoding. CTC blanks are denoted by $\cdot \_$ .
153
+
154
+ The production of the word please requires a great deal of articulatory movement at the beginning: the lips are pressed firmly together for the bilabial plosive $/ \mathrm { p } /$ (frame 1). At the same time, the blade of the tongue comes in contact with the alveolar ridge in anticipation of the following lateral $/ \mathrm { { l } } / .$ . The lips then part, allowing the compressed air to escape between the lips (frame 2). The jaw and lips then open further, seen in the distance between the midpoints of the upper and lower lips, and the lips spread (increasing the distance between the corners of the mouth), for the close vowel /iy/ (frame 3–4). Since this is a relatively steady-state vowel, lip position remains unchanged for the rest of its duration (frames 4–8), where the attention level drops considerably. The jaw and the lips then close slightly, as the blade of the tongue needs to be brought close to the alveolar ridge, for $/ \mathbf { Z } /$ (frames 9–10), where attention resumes.
155
+
156
+ Lay is interesting since the bulk of frontally visible articulatory movement involves the blade of the tongue coming into contact with the alveolar ridge for $/ \mathrm { l } / $ (frames 2–6), and then going down for the vowel /ey/ (frames 7–9). That is exactly where most of LipNet’s attention is focused, as there is little change in lip position.
157
+
158
+ # 4.4.2 VISEMES
159
+
160
+ According to DeLand (1931) and Fisher (1968), Alexander Graham Bell first hypothesised that multiple phonemes may be visually identical on a given speaker. This was later verified, giving rise to the concept of a viseme, a visual equivalent of a phoneme (Woodward & Barber, 1960; Fisher, 1968). For our analysis, we use the phoneme-to-viseme mapping of Neti et al. (2000), clustering the phonemes into the following categories: Lip-rounding based vowels (V), Alveolar-semivowels (A), Alveolar-fricatives (B), Alveolar (C), Palato-alveolar (D), Bilabial (E), Dental (F), Labio-dental (G), and Velar (H). The full mapping can be found in Table 4 in Appendix A. The GRID corpus contain 31 out of the 39 phonemes in ARPAbet. We compute confusion matrices between phonemes and then group phonemes into viseme clusters, following Neti et al. (2000). Figure 3 shows the confusion matrices of the 3 most confused viseme categories, as well as the confusions between the viseme categories. The full phoneme confusion matrix is in Figure 4 in Appendix B.
161
+
162
+ ![](images/3feedcc8be2ef8745cfe831ae3909203f4444d251cb9705a44e0d9f421116203.jpg)
163
+ Figure 3: Intra-viseme and inter-viseme confusion matrices, depicting the three categories with the most confusions, as well as the confusions between viseme clusters. Colours are row-normalised to emphasise the errors.
164
+
165
+ Given that the speakers are British, the confusion between /aa/ and /ay/ (Figure 3a) is most probably due to the fact that the first element, and the greater part, of the diphthong /ay/ is articulatorily identical with /aa/: an open back unrounded vowel (Ferragne & Pellegrino, 2010). The confusion of /ih/ (a rather close vowel) and /ae/ (a very open vowel) is at first glance surprising, but in fact in the sample /ae/ occurs only in the word at, which is a function word normally pronounced with a reduced, weak vowel /ah/. /ah/ and $/ \mathrm { i h } I$ are the most frequent unstressed vowels and there is a good deal of variation within and between them, e.g. private and watches (Cruttenden, 2014).
166
+
167
+ The confusion within the categories of bilabial stops $/ { \mathrm { p } } { \mathrm { ~ b ~ m } } ^ { \prime }$ and alveolar stops /t d n/ (Figures 3b-c) is unsurprising: complete closure at the same place of articulation makes them look practically identical. The differences of velum action and vocal fold vibration are unobservable from the front.
168
+
169
+ Finally, the quality of the viseme categorisation of Neti et al. (2000) is confirmed by the fact that the matrix in Figure 3d is diagonal, with only minor confusion between alveolar (C) and palatoalveolar (D) visemes. Articulatorily, alveolar $/ s \ z /$ and palato-alveolar $/ \mathrm { s h \ z h } /$ fricatives are distinguished by only a small difference in tongue position: against the palate just behind the alveolar ridge, which is not easily observed from the front. The same can be said about dental /th/ and alveolar $/ \mathrm { t } / $ .
170
+
171
+ # 5 CONCLUSIONS
172
+
173
+ We proposed LipNet, the first model to apply deep learning to end-to-end learning of a model that maps sequences of image frames of a speaker’s mouth to entire sentences. The end-to-end model eliminates the need to segment videos into words before predicting a sentence. LipNet requires neither hand-engineered spatiotemporal visual features nor a separately-trained sequence model.
174
+
175
+ Our empirical evaluation illustrates the importance of spatiotemporal feature extraction and efficient temporal aggregation, confirming the intuition of Easton & Basala (1982). Furthermore, LipNet greatly outperforms a human lipreading baseline, exhibiting $4 . 1 \times$ better performance, and $\bar { 4 } . 8 \%$ WER which is $2 . 8 \times$ lower than the word-level state-of-the-art (Gergen et al., 2016) in the GRID corpus.
176
+
177
+ While LipNet is already an empirical success, the deep speech recognition literature (Amodei et al., 2015) suggests that performance will only improve with more data. In future work, we hope to demonstrate this by applying LipNet to larger datasets, such as a sentence-level variant of that collected by Chung & Zisserman (2016a).
178
+
179
+ Some applications, such as silent dictation, demand the use of video only. However, to extend the range of potential applications of LipNet, we aim to apply this approach to a jointly trained audiovisual speech recognition model, where visual input assists with robustness in noisy environments.
180
+
181
+ # ACKNOWLEDGMENTS
182
+
183
+ This work was supported by an Oxford-Google DeepMind Graduate Scholarship, the EPSRC, and CIFAR. We would also like to thank: NVIDIA for their generous donation of DGX-1 and GTX Titan X GPUs, used in our experiments; Aine Jackson, Brittany Klug and Samantha Pugh for helping ´ us measure the experienced lipreader baseline; Mitko Sabev for his phonetics guidance; Odysseas Votsis for his video production help; and Alex Graves and Oiwi Parker Jones for helpful comments.
184
+
185
+ # REFERENCES
186
+
187
+ I. Almajai, S. Cox, R. Harvey, and Y. Lan. Improved speaker independent lip reading using speaker adaptive training and deep neural networks. In IEEE International Conference on Acoustics, Speech and Signal Processing, pp. 2722–2726, 2016.
188
+ D. Amodei, R. Anubhai, E. Battenberg, C. Case, J. Casper, B. Catanzaro, J. Chen, M. Chrzanowski, A. Coates, G. Diamos, et al. Deep Speech 2: End-to-end speech recognition in English and Mandarin. arXiv preprint arXiv:1512.02595, 2015.
189
+ P. Ashby. Understanding phonetics. Routledge, 2013.
190
+ J. S. Chung and A. Zisserman. Lip reading in the wild. In Asian Conference on Computer Vision, 2016a.
191
+ J. S. Chung and A. Zisserman. Out of time: automated lip sync in the wild. In Workshop on Multi-view Lip-reading, ACCV, 2016b.
192
+ J. Chung, C. Gulcehre, K. Cho, and Y. Bengio. Empirical evaluation of gated recurrent neural networks on sequence modeling. arXiv preprint arXiv:1412.3555, 2014.
193
+ M. Cooke, J. Barker, S. Cunningham, and X. Shao. An audio-visual corpus for speech perception and automatic speech recognition. The Journal of the Acoustical Society of America, 120(5):2421–2424, 2006.
194
+ A. Cruttenden. Gimson’s pronunciation of English. Routledge, 2014.
195
+ G. E. Dahl, D. Yu, L. Deng, and A. Acero. Context-dependent pre-trained deep neural networks for largevocabulary speech recognition. IEEE Transactions on Audio, Speech, and Language Processing, 20(1): 30–42, 2012.
196
+ F. DeLand. The story of lip-reading, its genesis and development. 1931.
197
+ R. D. Easton and M. Basala. Perceptual dominance during lipreading. Perception & Psychophysics, 32(6): 562–570, 1982.
198
+ E. Ferragne and F. Pellegrino. Formant frequencies of vowels in 13 accents of the british isles. Journal of the International Phonetic Association, 40(01):1–34, 2010.
199
+ C. G. Fisher. Confusions among visually perceived consonants. Journal of Speech, Language, and Hearing Research, 11(4):796–804, 1968.
200
+ Y. Fu, S. Yan, and T. S. Huang. Classification and feature extraction by simplexization. IEEE Transactions on Information Forensics and Security, 3(1):91–100, 2008.
201
+ A. Garg, J. Noyola, and S. Bagadia. Lip reading using CNN and LSTM. Technical report, Stanford University, CS231n project report, 2016.
202
+ S. Gergen, S. Zeiler, A. H. Abdelaziz, R. Nickel, and D. Kolossa. Dynamic stream weighting for turbodecoding-based audiovisual ASR. In Interspeech, pp. 2135–2139, 2016.
203
+ A. J. Goldschen, O. N. Garcia, and E. D. Petajan. Continuous automatic speech recognition by lipreading. In Motion-Based recognition, pp. 321–343. Springer, 1997.
204
+ A. Graves and N. Jaitly. Towards end-to-end speech recognition with recurrent neural networks. In International Conference on Machine Learning, pp. 1764–1772, 2014.
205
+ A. Graves and J. Schmidhuber. Framewise phoneme classification with bidirectional LSTM and other neural network architectures. Neural Networks, 18(5):602–610, 2005.
206
+ A. Graves, S. Fernandez, F. Gomez, and J. Schmidhuber. Connectionist temporal classification: labelling ´ unsegmented sequence data with recurrent neural networks. In ICML, pp. 369–376, 2006.
207
+ M. Gurban and J.-P. Thiran. Information theoretic feature extraction for audio-visual speech recognition. IEEE Transactions on Signal Processing, 57(12):4765–4776, 2009.
208
+ K. He, X. Zhang, S. Ren, and J. Sun. Delving deep into rectifiers: Surpassing human-level performance on imagenet classification. In IEEE International Conference on Computer Vision, pp. 1026–1034, 2015.
209
+ S. Hilder, R. Harvey, and B.-J. Theobald. Comparison of human and machine-based lip-reading. In AVSP, pp. 86–89, 2009.
210
+ G. Hinton, L. Deng, D. Yu, G. E. Dahl, A.-r. Mohamed, N. Jaitly, A. Senior, V. Vanhoucke, P. Nguyen, T. N. Sainath, et al. Deep neural networks for acoustic modeling in speech recognition: The shared views of four research groups. IEEE Signal Processing Magazine, 29(6):82–97, 2012.
211
+ S. Hochreiter and J. Schmidhuber. Long short-term memory. Neural computation, 9(8):1735–1780, 1997.
212
+ D. Hu, X. Li, et al. Temporal multimodal learning in audiovisual speech recognition. In IEEE Conference on Computer Vision and Pattern Recognition, pp. 3574–3582, 2016.
213
+ S. Ji, W. Xu, M. Yang, and K. Yu. 3d convolutional neural networks for human action recognition. IEEE transactions on pattern analysis and machine intelligence, 35(1):221–231, 2013.
214
+ A. Karpathy, G. Toderici, S. Shetty, T. Leung, R. Sukthankar, and L. Fei-Fei. Large-scale video classification with convolutional neural networks. In Proceedings of the IEEE conference on Computer Vision and Pattern Recognition, pp. 1725–1732, 2014.
215
+ D. E. King. Dlib-ml: A machine learning toolkit. JMLR, 10(Jul):1755–1758, 2009.
216
+ D. Kingma and J. Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
217
+ O. Koller, H. Ney, and R. Bowden. Deep learning of mouth shapes for sign language. In ICCV Workshop on Assistive Computer Vision and Robotics, pp. 85–91, 2015.
218
+ A. Krizhevsky, I. Sutskever, and G. E. Hinton. Imagenet classification with deep convolutional neural networks. In Advances in neural information processing systems, pp. 1097–1105, 2012.
219
+ P. Lucey and S. Sridharan. Patch-based representation of visual speech. In HCSNet workshop on use of vision in human-computer interaction, pp. 79–85, 2006.
220
+ A. L. Maas, Z. Xie, D. Jurafsky, and A. Y. Ng. Lexicon-free conversational speech recognition with neural networks. In NAACL, 2015.
221
+ I. Matthews, T. F. Cootes, J. A. Bangham, S. Cox, and R. Harvey. Extraction of visual features for lipreading. IEEE Transactions on Pattern Analysis and Machine Intelligence, 24(2):198–213, 2002.
222
+ H. McGurk and J. MacDonald. Hearing lips and seeing voices. Nature, 264:746–748, 1976.
223
+ C. Neti, G. Potamianos, J. Luettin, I. Matthews, H. Glotin, D. Vergyri, J. Sison, and A. Mashari. Audio visual speech recognition. Technical report, IDIAP, 2000.
224
+ J. Ngiam, A. Khosla, M. Kim, J. Nam, H. Lee, and A. Y. Ng. Multimodal deep learning. In International Conference on Machine Learning, pp. 689–696, 2011.
225
+ H. Ninomiya, N. Kitaoka, S. Tamura, Y. Iribe, and K. Takeda. Integration of deep bottleneck features for audio-visual speech recognition. In International Speech Communication Association, 2015.
226
+ K. Noda, Y. Yamaguchi, K. Nakadai, H. G. Okuno, and T. Ogata. Lipreading using convolutional neural network. In INTERSPEECH, pp. 1149–1153, 2014.
227
+ G. Papandreou, A. Katsamanis, V. Pitsikalis, and P. Maragos. Multimodal fusion and learning with uncertain features applied to audiovisual speech recognition. In Workshop on Multimedia Signal Processing, pp. 264– 267, 2007.
228
+ G. Papandreou, A. Katsamanis, V. Pitsikalis, and P. Maragos. Adaptive multimodal fusion by uncertainty compensation with application to audiovisual speech recognition. IEEE Transactions on Audio, Speech, and Language Processing, 17(3):423–435, 2009.
229
+ S. Petridis and M. Pantic. Deep complementary bottleneck features for visual speech recognition. In IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pp. 2304–2308. IEEE, 2016.
230
+ V. Pitsikalis, A. Katsamanis, G. Papandreou, and P. Maragos. Adaptive multimodal fusion by uncertainty compensation. In Interspeech, 2006.
231
+ G. Potamianos, C. Neti, G. Gravier, A. Garg, and A. W. Senior. Recent advances in the automatic recognition of audiovisual speech. Proceedings of the IEEE, 91(9):1306–1326, 2003.
232
+ C. Sagonas, G. Tzimiropoulos, S. Zafeiriou, and M. Pantic. 300 faces in-the-wild challenge: The first facial landmark localization challenge. In IEEE International Conference on Computer Vision Workshops, pp. 397–403, 2013.
233
+ K. Simonyan, A. Vedaldi, and A. Zisserman. Deep inside convolutional networks: Visualising image classification models and saliency maps. arXiv preprint arXiv:1312.6034, 2013.
234
+ J. T. Springenberg, A. Dosovitskiy, T. Brox, and M. Riedmiller. Striving for simplicity: The all convolutional net. In ICLR Workshop, 2014.
235
+ C. Sui, M. Bennamoun, and R. Togneri. Listening with your eyes: Towards a practical visual speech recognition system using deep boltzmann machines. In IEEE International Conference on Computer Vision, pp. 154– 162, 2015.
236
+ Y. Takashima, R. Aihara, T. Takiguchi, Y. Ariki, N. Mitani, K. Omori, and K. Nakazono. Audio-visual speech recognition using bimodal-trained bottleneck features for a person with severe hearing loss. Interspeech, pp. 277–281, 2016.
237
+ M. Wand, J. Koutnik, and J. Schmidhuber. Lipreading with long short-term memory. In IEEE International Conference on Acoustics, Speech and Signal Processing, pp. 6115–6119, 2016.
238
+ M. F. Woodward and C. G. Barber. Phoneme perception in lipreading. Journal of Speech, Language, and Hearing Research, 3(3):212–222, 1960.
239
+ M. D. Zeiler and R. Fergus. Visualizing and understanding convolutional networks. In European Conference on Computer Vision, pp. 818–833, 2014.
240
+ G. Zhao, M. Barnard, and M. Pietikainen. Lipreading with local spatiotemporal descriptors. IEEE Transactions on Multimedia, 11(7):1254–1265, 2009.
241
+ Z. Zhou, G. Zhao, X. Hong, and M. Pietikainen. A review of recent advances in visual speech decoding. ¨ Image and Vision Computing, 32(9):590–605, 2014.
242
+
243
+ # A ARCHITECTURE DETAILS
244
+
245
+ In this appendix, we provide additional details about the implementation and architecture.
246
+
247
+ # A.1 IMPLEMENTATION
248
+
249
+ LipNet is implemented using Torch, the warp-ctc CTC library (Amodei et al., 2015), and StanfordCTC’s decoder implementation. The network parameters were initialised using He initialisation (He et al., 2015), apart from the square GRU matrices that were orthogonally initialised, as described in (Chung et al., 2014). The models were trained with channel-wise dropout (dropout rate $p = 0 . 5$ ) after each pooling layer and mini-batches of size 50. We used the optimiser Adam (Kingma & Ba, 2014) with a learning rate of $1 0 ^ { - 4 }$ , and the default hyperparameters: a first-moment momentum coefficient of 0.9, a second-moment momentum coefficient of 0.999, and the numerical stability parameter  = 10−8.
250
+
251
+ The CER and WER scores were computed using CTC beam search with the following parameters for Stanford-CTC’s decoder: beam width 200, $\alpha = 1$ , and $\beta = 1 . 5$ . On top of that, we use a character 5-gram binarised language model, as suggested in (Graves & Jaitly, 2014).
252
+
253
+ # A.2 LIPNET ARCHITECTURE
254
+
255
+ The videos were processed with DLib face detector (King, 2009) and the iBug face shape predictor with 68 landmarks (Sagonas et al., 2013). The RGB input frames were normalised using the following per-channel means and standard deviations: $[ \mu _ { R } \bar { = } 0 . 7 1 3 6 , \sigma _ { R } = 0 . 1 1 3 8 , \mu _ { G } = \bar { 0 . 4 9 0 6 } , \sigma _ { G } =$ $0 . 1 0 7 8 , \mu _ { B } = 0 . 3 2 8 3 , \sigma _ { B } = 0 . 0 9 1 7 ]$ ].
256
+
257
+ Table 3 summarises the LipNet architecture hyperparameters, where $T$ denotes time, $C$ denotes channels, $F$ denotes feature dimension, $H$ and $W$ denote height and width and $V$ denotes the number of words in the vocabulary including the CTC blank symbol.
258
+
259
+ Table 3: LipNet architecture hyperparameters.
260
+
261
+ <table><tr><td>Layer</td><td>Size/Stride/Pad</td><td>Input size</td><td>Dimension order</td></tr><tr><td>STCNN</td><td>3 × 5×5/1,2,2/1,2,2</td><td>75 ×3× 50×100</td><td>T xC×H×W</td></tr><tr><td>Pool STCNN Pool</td><td>1×2× 2/1,2,2 3 × 5× 5/1,2,2/1,2,2 1×2×2/1,2,2</td><td>75 ×32×25× 50 75 × 32 ×12 × 25 × 64×12× 25</td><td>T × C ×H×W T × C×H×1 W</td></tr><tr><td>STCNN</td><td>3 × 3× 3/1,2,2/1,1,1</td><td>75 75 ×64×6 ×12</td><td>T × C×H×W T × C×H×W</td></tr><tr><td>Pool</td><td>1×2× 2/1,2,2</td><td>75 ×96×6×12</td><td>T C×H×W</td></tr><tr><td>Bi-GRU</td><td>256</td><td>75</td><td>×</td></tr><tr><td>Bi-GRU</td><td></td><td>× (96×3×6)</td><td>T × (C ×H×W)</td></tr><tr><td>Linear</td><td>256</td><td>75 × 512</td><td>T×F</td></tr><tr><td>Softmax</td><td>27 +blank</td><td>75 × 512 75×28</td><td>T×F</td></tr></table>
262
+
263
+ Note that spatiotemporal convolution sizes depend on the number of channels, and the kernel’s three dimensions. Spatiotemporal kernel sizes are specified in the same order as the input size dimensions. The input dimension orderings are given in parentheses in the input size column.
264
+
265
+ Layers after the Bi-GRU are applied per-timestep.
266
+
267
+ # A.3 BASELINE-LSTM ARCHITECTURE
268
+
269
+ Baseline-LSTM replicates the setup of Wand et al. (2016), and is trained the same way as LipNet. The model uses two LSTM layers with 128 neurons. The input frames were converted to grayscale and were down-sampled to $5 0 \times 2 5 \mathrm { p x }$ , dropout $p = 0$ , and the parameters were initialised uniformly with values between $[ - 0 . 0 5 , 0 . 0 5 ]$ .
270
+
271
+ # B PHONEMES AND VISEMES
272
+
273
+ Table 4 shows the phoneme to viseme clustering of Neti et al. (2000) and Figure 4 shows LipNet’s full phoneme confusion matrix.
274
+
275
+ Table 4: Phoneme to viseme clustering of Neti et al. (2000).
276
+
277
+ <table><tr><td>Code</td><td>Viseme Class</td><td>Phonemes in Cluster</td></tr><tr><td>V1 V2 V3</td><td>Lip-rounding based vowels</td><td>/ao//ah/ /aa/ ler/ /oyl /aw/ /hh/ /uw/ /uh/ /owl /ael leh/ leyl /ayl</td></tr><tr><td>V4 A</td><td>Alveolar-semivowels</td><td>/ih/ /iy/ /ax/ /V lel/ /r/ lyl</td></tr><tr><td>B</td><td>Alveolar-fricatives</td><td>/s/ /zl</td></tr><tr><td>C</td><td>Alveolar</td><td>/t//d/ /n/len/</td></tr><tr><td>D</td><td>Palato-alveolar</td><td>/sh/ /zh/ /ch/ /jh/</td></tr><tr><td>E</td><td>Bilabial</td><td>/p/ /b/ /m/</td></tr><tr><td>F</td><td>Dental</td><td>/th//dh/</td></tr><tr><td>G</td><td>Labio-dental</td><td>/f/Ivl</td></tr><tr><td>H</td><td>Velar</td><td>/ng/ /k/ Ig/ /wl</td></tr><tr><td>S</td><td>Silence</td><td>/sil/ /sp/</td></tr></table>
278
+
279
+ ![](images/4fcca93a2c8e46800fb40e147a97a1af2435cf77ac1d2220fe4e2d17d3e81497.jpg)
280
+ Figure 4: LipNet’s full phoneme confusion matrix.
md/train/Bkl086VYvH/Bkl086VYvH.md ADDED
@@ -0,0 +1,193 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # FEATURE-MAP-LEVEL ONLINE ADVERSARIAL KNOWLEDGE DISTILLATION
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Feature maps contain rich information about image intensity and spatial correlation. However, previous online knowledge distillation methods only utilize the class probabilities. Thus in this paper, we propose an online knowledge distillation method that transfers not only the knowledge of the class probabilities but also that of the feature map using the adversarial training framework. We train multiple networks simultaneously by employing discriminators to distinguish the feature map distributions of different networks. Each network has its corresponding discriminator which discriminates the feature map from its own as fake while classifying that of the other network as real. By training a network to fool the corresponding discriminator, it can learn the other network’s feature map distribution. Discriminators and networks are trained concurrently in a minimax twoplayer game. Also, we propose a novel cyclic learning scheme for training more than two networks together. We have applied our method to various network architectures on the classification task and discovered a significant improvement of performance especially in the case of training a pair of a small network and a large one.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ With the advent of Alexnet (Krizhevsky et al., 2012), deep convolution neural networks have achieved remarkable success in a variety of computer vision tasks. However, high-performance of deep neural network is often gained by increasing the depth or the width of a network. Deep and wide networks cost a large number of computation as well as memory storage which is not suitable for a resource-limited environment such as mobile or embedded systems. To overcome this issue, many researches have been conducted to develop smaller but accurate neural networks. Some of the well-known methods in this line of research are parameter quantization or binarization (Rastegari et al., 2016), pruning (Li et al., 2016) and knowledge distillation (KD) (Hinton et al., 2015).
12
+
13
+ KD has been an active area of research as a solution to improve the performance of a light-weight network by transferring the knowledge of a large pre-trained network (or an ensemble of small networks) as a teacher network. KD sets the teacher network’s class probabilities as a target which a small student network tries to mimic. By aligning the student’s predictions to those of the teacher, the student can improve its performance. Recently, some studies have shown that rather than using a pretrained teacher, simultaneously training networks to learn from each other in a peer-teaching manner is also possible. This approach is called online distillation. Deep mutual learning (DML) (Zhang et al., 2018) and on-the-fly native ensemble (ONE) (Lan et al., 2018) are the representative online distillation methods that show appealing results in the image classification tasks. Conventional distillation method requires pre-training a powerful teacher network and performs an one-way transfer to a relatively small and untrained student network. On the other hand, in online mutual distillation, there is no specific teacher-student role. All the student networks learn simultaneously by teaching each other from the start of training. It trains with the conventional cross-entropy loss from the ground truth label along with the mimicry loss to learn from its peers. Networks trained in such an online distillation way achieve results superior not only to the networks trained with the cross-entropy loss alone but also to those trained in conventional offline distillation manner from a pre-trained teacher network.
14
+
15
+ ![](images/152e0f91fd83e929bd1339fb8de49322b8e5b1b9dd90640fa5570de8581ff42d.jpg)
16
+ Figure 1: The concept of online Adversarial Feature map Distillation (AFD) Each point represents a feature map for the corresponding input denoted by different colors. The thin line arrow indicates the evolvement of feature map data points as iteration goes on and the broader arrow indicates the way each method compares the feature maps from different networks. (a) In direct feature map alignment, networks are trained such that the distance between each pair of points with the same color is minimized. (b) In AFD, the discriminators contain information on feature map distributions and thus the networks are trained such that the distributions match. (best viewed in color)
17
+
18
+ However, aforementioned online distillation methods make use of only the logit information. While the logit contains the probabilistic information over classes, the feature map, the output of convolution layer, has more meaningful and abundant feature information on image intensity and spatial correlation. In offline distillation which utilizes a pre-trained model as a teacher network, many methods such as FitNet (Romero et al., 2014), attention transfer (AT) (Zagoruyko & Komodakis, 2016a) and factor transfer (FT) (Kim et al., 2018) make use of this intermediate feature representation as a target to learn for the student network, but in online distillation, to the best of our knowledge, no feature map-based knowledge distillation method has been proposed.
19
+
20
+ This is due to some challenges. Unlike the offline methods that have a clear target to mimic, there is no static target to follow in an online method. At every training iteration, the feature maps of the co-trained network change, thus in online feature map-level distillation, the problem turns into mimicking the moving target properly. While each node of the logit is confined to represent its assigned class probability which does not change drastically over iterations, at the feature map-level, much more flexibility comes into play, which makes the problem more challenging. Therefore, the direct aligning method such as using L1 or L2 distance is not suitable for online mutual feature map distillation because it updates the network parameters to generate a feature map that tries to mimic the current output feature map of the other network. In other words, the direct alignment method only tries to minimize the distance between the two feature map points (one for each network), hence it ignores the distributional difference between the two feature maps (Fig. 1(a)).
21
+
22
+ To alleviate this problem, in this paper, we propose a novel online distillation method that transfers the knowledge of feature maps adversarially as well as a cyclic learning framework for training more than two networks simultaneously. Unlike the direct aligning method, our adversarial distillation method enables a network to learn the overall feature map distribution of the co-trained network (Fig. 1(b)). Since the discriminator is trained to distinguish the difference between the networks’ feature map distributions (containing the history of feature maps for different input images) at every training iteration, by fooling the discriminator, the network learns the co-trained network’s changing feature map distribution. Exchanging the knowledge of feature map distribution facilitates the networks to converge to a better feature map manifold that generalizes better and yields more accurate results.
23
+
24
+ Our method consists of two major losses: 1) logit-based loss and 2) feature map-based loss. Logitbased loss is defined by two different loss terms which are conventional cross-entropy (CE) loss and the mutual distillation loss using the Kullback-Leibler divergence (KLD). Our newly proposed feature map-based loss is to distill the feature map indirectly via discriminators. We use the feature map from the last convolution layer since deeper convolution layer generates more meaningful features with a high-level abstraction (Kim et al., 2018). The adversarial training scheme of generative adversarial networks (GAN) (Goodfellow et al., 2014) is utilized to transfer the knowledge at feature map-level.
25
+
26
+ The contributions of this paper can be summarized as follows: 1) we propose an online knowledge distillation method that utilizes not only the logit but also the feature map from the convolution layer. 2) Our method transfers the knowledge of feature maps not by directly aligning them using
27
+
28
+ the distance loss but by learning their distributions using the adversarial training via discriminators.
29
+ 3) We propose a novel cyclic learning scheme for training more than two networks simultaneously.
30
+
31
+ # 2 RELATED WORK
32
+
33
+ The idea of model compression by transferring the knowledge of a high performing model to a smaller model was originally proposed by Bucilua et al. (2006). Then in recent years, this research ˇ area got invigorated due to the work of knowledge distillation (KD) by Hinton et al. (2015). The main contribution of KD is to use the softened logit of pre-trained teacher network that has higher entropy as an extra supervision to train a student network. KD trains a compact student network to learn not only by the conventional CE loss subjected to the labeled data but also by the final outputs of the teacher network. While KD only utilizes the logit, method such as FitNet (Romero et al., 2014), AT (Zagoruyko & Komodakis, 2016a), FT (Kim et al., 2018) and KTAN (Liu et al., 2018) use the intermediate feature representation to transfer the knowledge of a teacher network.
34
+
35
+ Online Knowledge Distillation: Conventional offline methods require training a teacher model in advance while online methods do not require any pre-trained model. Instead, the networks teach each other mutually by sharing their knowledge throughout the training process. Some examples of recent online methods are DML (Zhang et al., 2018) and ONE (Lan et al., 2018) which demonstrate promising results. DML simply applies KD losses mutually, treating each other as teachers, and it achieves results that is even better than the offline KD method. The drawback of DML is that it lacks an appropriate teacher role, hence provides only limited information to each network. ONE pointed out this defect of DML. Rather than mutually distilling between the networks, ONE generates a gated ensemble logit of the training networks and uses it as a target to align for each network. ONE tries to create a powerful teacher logit that can provide more generalized information. The flaw of ONE is that it can not train different network architectures at the same time due to its architecture of sharing the low-level layers for the gating module. The common limitation of existing online methods is that they are dependent only on the logit and do not make any use of the feature map information. Considering that KD loss term is only applicable to the classification task, transferring knowledge at feature map-level can enlarge the applicability to other tasks. Therefore, our method proposes a distillation method that utilizes not only the logit but also the feature map via adversarial training, moreover, our method can be applied in case where the co-trained networks have different architectures.
36
+
37
+ Generative Adversarial Network (GAN): GAN (Goodfellow et al., 2014) is a generative model framework that is proposed with an adversarial training scheme, using a generator network $G$ and a discriminator network $D$ . $G$ learns to generate the real data distribution while $D$ is trained to distinguish the real samples of the dataset from the fake results generated by $G$ . The goal of $G$ is to trick $D$ to make a mistake of determining the fake results as the real samples. Though it was initially proposed for generative models, its adversarial training scheme is not limited to data generation. Adversarial training has been adapted to various tasks such as image translation (Isola et al., 2017; Zhu et al., 2017), captioning (Dai et al., 2017), semi-supervised learning (Miyato et al., 2016; Springenberg, 2015), reinforcement learning (Pfau & Vinyals, 2016), and many others. In this paper, we utilize GAN’s adversarial training strategy to transfer the knowledge at feature map-level in an online manner. The networks learn the other networks’ feature map distributions by trying to deceive the discriminators while the discriminators are trained to distinguish the different distributions of each network.
38
+
39
+ # 3 PROPOSED METHOD
40
+
41
+ In this section, we describe the overall process of our proposed Online Adversarial Feature map Distillation (AFD). As can be seen in Figure 2, when training two different networks, $\Theta _ { 1 }$ and $\Theta _ { 2 }$ , in an online manner, we employ two discriminators, $D _ { 1 }$ and $D _ { 2 }$ . We train $D _ { 1 }$ such that the feature map of $\Theta _ { 2 }$ is regarded as a real and that of $\Theta _ { 1 }$ is classified as a fake and do vice versa for discriminator $D _ { 2 }$ . Then, each network $\Theta _ { 1 }$ and $\Theta _ { 2 }$ are trained to fool its corresponding discriminator so that it can generate a feature map that mimics the other network’s feature map. Throughout this adversarial training, each network learns the feature map distribution of the other network. By exploiting both logit-based distillation loss and feature map-based adversarial loss together, we could observe a significant improvement of performance in various pairs of network architectures especially when training small and large networks together. Also we introduce a cyclic learning scheme for training more than two networks simultaneously. It reduces the number of required discriminators from $2 \times _ { 2 } C _ { K }$ (when employing discriminators bidirectionally between every network pairs.) to $K$ where $K$ is the number of networks participating. This cyclic learning framework not only requires less computation than the bidirectional way but also achieves better results compared to other online training schemes for multiple networks.
42
+
43
+ ![](images/59ee2b5d08ffdf4df067c9b42ab71081ff7a5d972694eb4afb866124a1cfea94.jpg)
44
+ Figure 2: Overall schematic of online adversarial feature map distillation (AFD). At feature maplevel, each network is trained to deceive the corresponding discriminator so that it can mimic the other network’s feature map distribution. While at logit-level, KL loss to learn the peer network’s logit is applied as well as the conventional CE loss.
45
+
46
+ First, we explain the conventional mutual knowledge distillation method conducted among the networks at the logit-level. Then we introduce our novel online feature map distillation method using the adversarial training scheme in addition to the cyclic learning framework for training more than two networks at the same time.
47
+
48
+ # 3.1 LOGIT-BASED MUTUAL KNOWLEDGE DISTILLATION
49
+
50
+ We use two loss terms for logit-based learning, one is the conventional cross-entropy(CE) loss and the other is mutual distillation loss between networks based on Kullback Leibler(KL) divergence. We formulate our proposed method assuming training two networks. Training scheme for more than two networks will be explained in Sec 3.3. Below is the overall logit-based loss for two networks:
51
+
52
+ $$
53
+ \begin{array} { r l } & { \mathcal { L } _ { l o g i t } ^ { 1 } = \mathcal { L } _ { c e } ( y , \sigma ( z _ { 1 } ) ) + T ^ { 2 } \times \mathcal { L } _ { k l } ( \sigma ( z _ { 2 } / T ) , \sigma ( z _ { 1 } / T ) ) } \\ & { \mathcal { L } _ { l o g i t } ^ { 2 } = \mathcal { L } _ { c e } ( y , \sigma ( z _ { 2 } ) ) + T ^ { 2 } \times \mathcal { L } _ { k l } ( \sigma ( z _ { 1 } / T ) , \sigma ( z _ { 2 } / T ) ) . } \end{array}
54
+ $$
55
+
56
+ Here, $\sigma ( \cdot )$ refers to softmax function and $z \in \mathbb { R } ^ { C }$ is the logit produced from a network for $C$ - class classification problem. The temperature term $T$ is used to control the level of smoothness in probabilities. As the temperature term $T$ goes up, it creates a more softened probability distribution. We use $T = 3$ for every experiment. $\mathcal { L } _ { c e }$ is the CE loss between the ground truth label $y$ and the softmax output $\sigma ( z )$ that is commonly used in image classification. $\mathcal { L } _ { k l }$ is the KL loss between the softened logit of each network. We multiply the KL loss term with $T ^ { 2 }$ because the gradients produced by the soft targets are scaled by $1 / \dot { T } ^ { 2 }$ . While the CE loss is between the correct labels and the outputs of the model, the KL loss is the KL distance between the outputs of two training networks. The KL loss provides an extra information from the peer network so that the network can improve its generalization performance. The difference with DML is that while DML updates asynchronously which means that it updates one network first and then the other network, our AFD updates the networks synchronously, not alternatingly. The CE loss trains the networks to predict the correct truth label while the mutual distillation loss tries to match the outputs of the peer-networks, enabling the networks to share the knowledge at logit-level.
57
+
58
+ # .2 FEATURE MAP-BASED LEARNING VIA ADVERSARIAL TRAINING
59
+
60
+ Our AFD uses adversarial training to transfer knowledge at feature map-level. We formulate our adversarial feature map distillation for two networks which will be extended for more networks later. We divide a network into two parts, one is the feature extractor part that generates a feature map and the other is the classifier part that transforms the feature map into a logit. Each network also has a corresponding discriminator which distinguishes different feature map distributions. The architecture of the discriminator is simply a series of Conv-Batch Normalization-Leaky ReLU-Conv-Sigmoid. It takes a feature map of the last layer and it reduces the spatial size and the number of channel of the feature map as it goes through the convolution operation so that it can produce a single scalar value. Then we apply the sigmoid function of the value to normalize it between 0 and 1.
61
+
62
+ We utilize the feature extractor part to enable feature map-level distillation. For the convenience of mathematical notation, we name the feature extractor part as $G _ { k }$ and its discriminator as $D _ { k }$ , $k$ indicates the network number. As depicted in Figure 2, each network has to fool its discriminator to mimic the peer network’s feature map and the discriminator has to discriminate from which network the feature map is originated. Following LSGAN (Mao et al., 2017), our overall adversarial loss for discriminator and the feature extractor can be written as below:
63
+
64
+ $$
65
+ \begin{array} { r l } & { \mathcal { L } _ { D _ { 1 } } = [ 1 - D _ { 1 } ( G _ { 2 } ( x ) ) ] ^ { 2 } + [ D _ { 1 } ( G _ { 1 } ( x ) ) ] ^ { 2 } } \\ & { } \\ & { \mathcal { L } _ { G _ { 1 } } = [ 1 - D _ { 1 } ( G _ { 1 } ( x ) ) ] ^ { 2 } . } \end{array}
66
+ $$
67
+
68
+ The feature extractors $G _ { 1 }$ and $G _ { 2 }$ take input $x$ and generate feature maps. The discriminator $D _ { 1 }$ takes a feature map and yields a scalar between 0 (fake) and 1 (real). It is trained to output 1 if the feature map came from the co-trained network (in this case, $G _ { 2 }$ ) or 0 if the feature map is produced from the network it belongs to ( $G _ { 1 }$ in this case). The goal of $D _ { 1 }$ is to minimize the discriminator loss term $\mathcal { L } _ { D 1 }$ by correctly distinguishing the two different feature map distributions while $G _ { 1 }$ ’s goal is to minimize the loss term ${ \mathcal L } _ { G _ { 1 } }$ by fooling $D _ { 1 }$ to make mistake of determining $G _ { 1 }$ ’s feature map as real and yield 1. Each training network’s object is to minimize $\mathcal { L } _ { G _ { k } }$ to mimic the peer network’s feature map distribution. This adversarial scheme works exactly the same by changing the role of two networks.
69
+
70
+ In case where the two networks’ feature map outputs have different channel sizes, for example a pair like (WRN-16-2, WRN-16-4) (Zagoruyko & Komodakis, 2016b), we use a transfer layer that is composed of a convolution layer, a batch normalization and a ReLU which converts the number of channels to that of peer network. The above loss terms change as ${ \mathcal { L } } _ { D _ { 1 } } = [ 1 - D _ { 1 } ( T _ { 2 } ( G _ { 2 } ( x ) ) ) ] ^ { 2 } +$ $[ D _ { 1 } ( T _ { 1 } ( G _ { 1 } ( x ) ) ) ] ^ { 2 }$ and $\mathcal { L } _ { G _ { 1 } } = [ 1 - D _ { 1 } ( T _ { 1 } ( G _ { 1 } ( x ) ) ) ] ^ { 2 }$ when using the transfer layer $T _ { k }$ .
71
+
72
+ Optimization: Combining both logit-based loss and the adversarial feature map-based loss, the overall loss for each network $\Theta _ { 1 }$ and $\Theta _ { 2 }$ are as follows:
73
+
74
+ $$
75
+ \mathcal { L } _ { \Theta _ { 1 } } = \mathcal { L } _ { l o g i t } ^ { 1 } + \mathcal { L } _ { G _ { 1 } } , \qquad \mathcal { L } _ { \Theta _ { 2 } } = \mathcal { L } _ { l o g i t } ^ { 2 } + \mathcal { L } _ { G _ { 2 } }
76
+ $$
77
+
78
+ However, the logit-based loss term by the same optimizer. In fact, they $\mathcal { L } _ { l o g i t } ^ { k }$ and the feature map-based loss term ptimized alternatingly in a same min $\mathcal { L } _ { G _ { k } }$ are not optimizedch. At every minibatch iteration, we infer an image into a model and it computes a logit and a feature map. Then we calculate the two loss terms and optimize the networks based on the two losses separately, meaning that we update the parameters by the logit-based loss once and then update again by the feature map-based loss. The reason we optimize separately for each loss term is because they use different learning rates. The adversarial loss requires much slower learning rate thus if we use the same optimizer with the same learning rate, the networks would not be optimized. Note that we do not infer for each loss term, inference is conducted only once, only the optimization is conducted twice, one for each loss term.
79
+
80
+ # 3.3 CYCLIC LEARNING FRAMEWORK
81
+
82
+ Our method proposes a novel cyclic peer-learning scheme for training more than two networks simultaneously. As can be seen in Figure 3, each network transfers its knowledge to its next peer network in an one-way cyclic manner. If we train $K$ number of networks together, each network distills its knowledge to its next network except the last network transfers its knowledge to the first network, creating a cyclic knowledge transfer flow as $1 \to 2 , 2 \to 3 , \cdots , ( K - 1 ) \to K , K \to 1$ . The main contribution of using this cyclic learning framework is to avoid employing too many number of discriminators. If we apply our adversarial loss for every pair of networks, it would demand two times the amount of every possible pair of $K$ networks which would cost a lot of computation. Also in Sec 4.5, we empirically show that our cyclic training scheme is better than other online methods’ training scheme for multiple networks.
83
+
84
+ ![](images/20e560521e4bd10e2bb504a563a10b0cff737518c82eda761a1ab98a29880778.jpg)
85
+ Figure 3: Schematic of cyclic-learning framework for training 3 networks simultaneously.
86
+
87
+ # 4 EXPERIMENT
88
+
89
+ In this section, to show the adequacy of our method, we first present comparison experiment with distance method and ablation study to analyze our method. Then we compare our approach with existing online knowledge distillation methods under different settings. First of all, we demonstrate results on using the same sub-network architectures in Sec 4.3. Then, we apply our method on subnetworks with different architectures in Sec 4.4. In Sec 4.5, we also show the results of training more than two networks to demonstrate that our method generalizes well even when the number of networks increases.
90
+
91
+ In most of the experiments, we use the CIFAR-100 (Krizhevsky et al.) dataset. It consists of 50K training images and 10K test images over 100 classes, accordingly it has 600 images per each class. All the reported results on CIFAR-100 are average of 5 experiments. Since our method uses two loss terms, logit-based loss and feature map-based loss, we use different learning details for each loss term. For overall learning schedule, we follow the learning schedule of ONE(Lan et al., 2018) to conduct fair comparison which is 300 epochs of training. In terms of logit-based loss, the learning rate starts at 0.1 and is multiplied by 0.1 at 150, 225 epoch. We optimize the logit-based loss using SGD with mini-batch size of 128, momentum 0.9 and weight decay of 1e-4. This learning details for logit-based loss is equally applied to other compared online distillation methods. For feature map-based loss, the learning rate starts at 2e-5 for both discriminators and feature extractors and is decayed by 0.1 at 75, 150 epoch. The feature map-based loss is optimized by ADAM(Kingma & Ba, 2014) with the same mini-batch size and weight decay of 1e-1.
92
+
93
+ In tables, ‘2 Net Avg’ and ‘Ens’ represents the average accuracy of the two sub-networks and the ensemble accuracy respectively. The average ensemble is used for AFD, DML and KD while ONE uses gated ensemble of sub-networks according to its methodology.
94
+
95
+ # .1 COMPARISON WITH DIRECT FEATURE MAP ALIGNMENT METHODS
96
+
97
+ Since our goal is to distill feature map information that suits for mutual online distillation, we briefly compare our method with conventional direct alignment method in Table 1. We train two networks together, in one setting, we use the same architecture (ResNet-32 (He et al., 2016)) and in the other, we use different types (WRN-16-2, WRN-28-2 (Zagoruyko & Komodakis, 2016b)). For $L _ { 1 }$ , each network is trained not only to follow the ground-truth label by CE loss, but also to mimic the other network’s feature map using the $L _ { 1 }$ distance loss. For $L _ { 1 } +$ KD, KD (Hinton et al., 2015) loss is applied mutually along with the $L _ { 1 }$ loss between the feature maps. We also compare our results with offline method, $L 1 +$ KD (offline) employs a pre-trained network as a teacher network and distills its feature map knowledge to an untrained student network by $L 1$ loss as well as the KD loss at logit level. ResNet-32 and WRN-28-2 that shows $6 9 . 7 9 \%$ and $7 3 . 6 2 \%$ accuracy are used as the teacher networks in the two settings respectively. The results clearly show that learning the distributions of feature maps with adversarial loss performs better than direct alignment method in both mutual online distillation and offline distillation. We could observe that using $L _ { 1 }$ distance loss actually disturbs the networks to learn good features in online environment. The accuracy of ResNet-32 has dropped more than $2 \%$ compared to its vanilla version accuracy $( 6 9 . 3 8 \% )$ and the accuracy of WRN-16-2 is also lower than its vanilla network $( 7 1 . 0 7 \% )$ . Even when combined with KD loss $( L 1 + \mathrm { K D } )$ , direct alignment method shows poor performance compared to ours in both online and offline manner. Though distance loss is used in many conventional offline methods, they suffer when it comes to online environment. In case of different architecture types, our method also outperforms the direct alignment method. It indicates that when it comes to online feature map distillation, transferring feature map information with direct alignment method such as $L 1$ distance is worse than indirect distillation that uses feature map distribution via adversarial loss.
98
+
99
+ Table 1: Top-1 accuracy( $\%$ ) comparison with direct alignment methods using CIFAR-100 dataset.
100
+
101
+ <table><tr><td>Model Type</td><td colspan="2">L1</td><td colspan="2">L1+ KD</td><td colspan="3">L1+KD(offline)</td><td colspan="2">AFD</td><td colspan="2"></td><td colspan="2">Vanilla</td></tr><tr><td>Same Arch.</td><td>2 Net Avg</td><td>Ens</td><td>2 NetAvg</td><td></td><td>Ens</td><td>Student</td><td>Teacher</td><td>Ens</td><td></td><td>2 Net Avg</td><td>Ens</td><td>Net</td><td></td></tr><tr><td>ResNet-32</td><td>66.82</td><td>70.69</td><td></td><td>70.16</td><td>72.44</td><td>71.91</td><td>69.79</td><td>72.07</td><td>74.03</td><td></td><td>75.64</td><td>69.38</td><td></td></tr><tr><td>Different Arch.</td><td>Net1 Net2</td><td>Ens</td><td>Net1</td><td>Net2</td><td>Ens</td><td>Student</td><td>Teacher</td><td>Ens</td><td>Net1</td><td>Net2</td><td>Ens</td><td>Net1</td><td>Net2</td></tr><tr><td>WRN-(16-2,28-2)</td><td>69.84 73.41</td><td>74.63</td><td>72.35</td><td>74.82</td><td>75.10</td><td>73.94</td><td>73.62</td><td>76.56</td><td>75.88</td><td>77.08</td><td>77.82</td><td>71.07</td><td>73.50</td></tr></table>
102
+
103
+ Table 2: Ablation study of AFD. Top-1 accuracy $\% )$ on CIFAR-100 dataset.
104
+
105
+ <table><tr><td>Model Type</td><td colspan="3">w/o KD (Adv only)</td><td colspan="3">w/o Adv (KD only)</td><td colspan="3">Full model (AFD)</td></tr><tr><td>Same Arch.</td><td colspan="2">2 Net Avg</td><td>Ens</td><td colspan="2">2 Net Avg</td><td>Ens</td><td colspan="2">2 Net Avg</td><td>Ens</td></tr><tr><td>ResNet-32</td><td colspan="2">70.09</td><td>74.77</td><td colspan="2">73.38</td><td>75.21</td><td colspan="2">74.03</td><td>75.64</td></tr><tr><td>WRN-16-2</td><td colspan="2">71.94</td><td>75.92</td><td colspan="2">74.81</td><td>76.20</td><td colspan="2">75.33</td><td>76.34</td></tr><tr><td>Different Arch.</td><td>Net1</td><td>Net2</td><td>Ens</td><td>Net1</td><td>Net2</td><td>Ens</td><td>Net1</td><td>Net2</td><td>Ens</td></tr><tr><td>WRN-(16-2,28-2)</td><td>72.05</td><td>73.80</td><td>76.82</td><td>74.99</td><td>76.64</td><td>77.28</td><td>75.88</td><td>77.08</td><td>77.82</td></tr></table>
106
+
107
+ # 4.2 ABLATION STUDY
108
+
109
+ Table 2 shows the ablation study of our proposed method. We conduct experiments using the same and different sub-network architectures. We run three experiments with different training settings for each model case. The three settings are full model, without mutual knowledge distillation at logitlevel and without adversarial feature map distillation. When trained without the adversarial feature map distillation, the accuracy decreases in all three model cases. The accuracy of both ResNet-32 and WRN-16-2 dropped by $0 . 6 5 \%$ and $0 . 5 2 \%$ respectively, and those of (WRN-16-2, WRN-28-2) pair declined by $0 . 8 9 \%$ and $0 . 4 4 \%$ compared to the full model. Ensemble results are also lower than those of the full models. When only the adversarial feature map distillation is applied, the accuracy has increased by $0 . 7 1 \%$ and $0 . 8 7 \%$ compared to the vanilla versions of ResNet-32 and WRN-16-2 respectively. Especially in case of different sub-network architecture, the accuracy of WRN-16-2 has increased by almost $1 \%$ . Based on these experiments, we could confirm that adversarial feature map distillation has some efficacy of improving the performance in online environment.
110
+
111
+ # 4.3 SAME ARCHITECTURE
112
+
113
+ We compare our method with DML and ONE for training two sub-networks with the same architecture. The vanilla network refers to the original network trained without any distillation method. As shown in Table 3, in both ResNet and WRN serises, DML, ONE and AFD all improves the networks’ accuracy compared to the vanilla networks. However, AFD shows the highest improvement of performance in both sub-network and ensemble accuracy among the compared distillation methods. Especially in case of ResNet-20, ResNet-32 and WRN-16-2, our method significantly improves the accuracy by more than $4 \%$ compared to the vanilla version while other distillation methods improve around $3 \%$ on average except the ResNet-32 of DML.
114
+
115
+ Table 3: Top-1 accuracy $\% )$ comparison with other online distillation methods for training two same architecture networks as a pair on the CIFAR-100 dataset. The numbers in parentheses refer to the amount of increase in accuracy compared to the vanilla network.
116
+
117
+ <table><tr><td rowspan="2">Model Type</td><td colspan="2">DML</td><td colspan="2">ONE</td><td colspan="2">AFD</td><td rowspan="2">Vanila</td></tr><tr><td>2 Net Avg</td><td>Ens</td><td>2 Net Avg</td><td>Ens</td><td>2 Net Avg</td><td>Ens</td></tr><tr><td>ResNet-20</td><td>70.90(+3.42%)</td><td>72.08</td><td>70.56(+3.08%)</td><td>72.26</td><td>71.72(+4.24%)</td><td>72.98</td><td>67.48</td></tr><tr><td>ResNet-32</td><td>73.40(+4.02%)</td><td>74.89</td><td>72.61(+3.23%)</td><td>74.07</td><td>74.03(+4.65%)</td><td>75.64</td><td>69.38</td></tr><tr><td>ResNet-56</td><td>75.48(+1.64%)</td><td>76.73</td><td>76.45(+2.61%)</td><td>77.16</td><td>77.25(+3.41%)</td><td>78.35</td><td>73.84</td></tr><tr><td>WRN-16-2</td><td>74.68(+3.61%)</td><td>75.81</td><td>73.85(+2.78%)</td><td>74.84</td><td>75.33(+4.26%)</td><td>76.34</td><td>71.07</td></tr><tr><td>WRN-16-4</td><td>78.17(+2.79%)</td><td>79.06</td><td>77.32(+1.94%)</td><td>77.79</td><td>78.55(+3.17%)</td><td>79.28</td><td>75.38</td></tr><tr><td>WRN-28-2</td><td>77.02(+3.52%)</td><td>78.64</td><td>76.67(+3.17%)</td><td>77.40</td><td>77.22(+3.72%)</td><td>78.72</td><td>73.50</td></tr><tr><td>WRN-28-4</td><td>79.16(+2.56%)</td><td>80.56</td><td>79.25(+2.65%)</td><td>79.73</td><td>79.46(+2.86%)</td><td>80.65</td><td>76.60</td></tr></table>
118
+
119
+ Table 4: Top-1 accuracy $( \% )$ comparison with other online distillation methods for training two different architectures as a pair on CIFAR-100 dataset.
120
+
121
+ <table><tr><td colspan="2">Model Types</td><td colspan="3">KD</td><td colspan="3">DML</td><td colspan="3">AFD</td></tr><tr><td>Net1</td><td>Net2</td><td>Net1</td><td>Net2</td><td>Ens</td><td>Net1</td><td>Net2</td><td>Ens</td><td>Net1</td><td>Net2</td><td>Ens</td></tr><tr><td>ResNet-32</td><td>ResNet-56</td><td>72.92</td><td>76.27</td><td>76.71</td><td>73.48</td><td>76.35</td><td>76.74</td><td>74.13</td><td>76.69</td><td>77.11</td></tr><tr><td>ResNet-32</td><td>WRN-16-4</td><td>72.67</td><td>77.26</td><td>76.94</td><td>73.48</td><td>77.43</td><td>77.01</td><td>74.43</td><td>77.82</td><td>77.67</td></tr><tr><td>ResNet-56</td><td>WRN-28-4</td><td>75.48</td><td>78.91</td><td>79.23</td><td>76.03</td><td>79.32</td><td>79.38</td><td>77.95</td><td>79.21</td><td>80.01</td></tr><tr><td>ResNet-20</td><td>WRN-28-10</td><td>70.08</td><td>78.17</td><td>76.12</td><td>71.03</td><td>77.70</td><td>75.78</td><td>72.62</td><td>77.83</td><td>76.70</td></tr><tr><td>WRN-16-2</td><td>WRN-16-4</td><td>74.87</td><td>77.42</td><td>77.30</td><td>74.87</td><td>77.17</td><td>76.96</td><td>75.81</td><td>78.00</td><td>77.84</td></tr><tr><td>WRN-16-2</td><td>WRN-28-2</td><td>74.86</td><td>76.45</td><td>77.29</td><td>75.11</td><td>76.91</td><td>77.24</td><td>75.88</td><td>77.08</td><td>77.82</td></tr><tr><td>WRN-16-2</td><td>WRN-28-4</td><td>74.51</td><td>78.18</td><td>77.60</td><td>74.95</td><td>78.23</td><td>77.67</td><td>76.23</td><td>78.26</td><td>78.28</td></tr><tr><td colspan="2">Average</td><td>73.63</td><td>77.52</td><td>77.31</td><td>74.14</td><td>77.59</td><td>77.25</td><td>75.29</td><td>77.84</td><td>77.92</td></tr></table>
122
+
123
+ # 4.4 DIFFERENT ARCHITECTURE
124
+
125
+ In this section, we compare our method with DML and KD using different network architectures. We set Net2 as the higher capacity network. For KD, we use the ensemble of the two sub-networks as a teacher to mimic at every iteration. The difference with original KD (Hinton et al., 2015) is that it is an online learning method, not offline. We did not include ONE because ONE can not be applied in case where the sub-networks have different model types due to its architecture of sharing the lowlevel layers. In table 4, we could observe that our method shows better performance improvement than other methods in both Net1 and Net2 except for a couple of cases. The interesting result is that when AFD is applied, the performance of Net1 (smaller network) is improved significantly compared to other online distillation methods. This is because AFD can transfer the higher capacity network’s meaningful knowledge (feature map distribution) to the lower capacity one better than other online methods. When compared with KD and DML, AFD’s Net1 accuracy is higher by $1 . 6 6 \%$ and $1 . 1 5 \%$ and the ensemble accuracy is better by $0 . 6 1 \%$ and $0 . 6 7 \%$ on average respectively. In case of (WRN-16-2, WRN-28-4) pair, the Net1’s parameter size (0.70M) is more than 8 times smaller than Net2 (5.87M). Despite the large size difference, our method improves both networks’ accuracy, particularly our Net1 performance is better than KD and DML by $1 . 7 2 \%$ and $1 . 2 8 \%$ respectively. The performance of KD and DML seems to decline as the difference between the two model sizes gets larger. Throughout this experiment, we have shown that our method also works properly for different architectures of sub-networks even when two networks have large difference in their model sizes. Using our method, smaller network considerably benefits from the large network.
126
+
127
+ # 4.5 EXPANSION TO 3 NETWORKS
128
+
129
+ To show our method’s expandability for training more than two networks, we conduct experiment of training 3 networks in this section. As proposed in Sec 3.3, our method uses a cyclic learning framework rather than employing adversarial loss between every network pairs in order to reduce the amount of computation and memory. DML calculates the mutual knowledge distillation loss between every network pairs and uses the average of the losses. ONE generates a gated ensemble of the sub-networks and transfers the knowledge of the ensemble logit to each network. As it can be seen in Table 5, AFD outperforms the compared online distillation methods on both $3 \ \mathrm { N e t }$ average and ensemble accuracy in every model types. Comparing the results of Table 5 to that of Table 3, the overall tendency of performance gains compared to DML and ONE is maintained.
130
+
131
+ Table 5: Top-1 accuracy $\% )$ comparison with other online distillation methods using 3 networks on CIFAR-100 dataset. ’3 Net Avg’ represents the average accuracy of the 3 networks.
132
+
133
+ <table><tr><td rowspan="2">Model Type</td><td colspan="2">DML</td><td colspan="2">ONE</td><td colspan="2">AFD</td><td rowspan="2">Vanilla</td></tr><tr><td>3 Net Avg</td><td>Ens</td><td>3 Net Avg</td><td>Ens</td><td>3 Net Avg</td><td>Ens</td></tr><tr><td>ResNet-32</td><td>73.43</td><td>76.11</td><td>73.25</td><td>74.94</td><td>74.14</td><td>76.64</td><td>69.38</td></tr><tr><td>ResNet-56</td><td>76.11</td><td>77.83</td><td>76.49</td><td>77.38</td><td>77.37</td><td>79.18</td><td>73.84</td></tr><tr><td>WRN-16-2</td><td>75.15</td><td>76.93</td><td>73.87</td><td>75.26</td><td>75.65</td><td>77.54</td><td>71.07</td></tr><tr><td>WRN-28-2</td><td>77.12</td><td>79.41</td><td>76.66</td><td>77.53</td><td>77.20</td><td>79.78</td><td>73.50</td></tr></table>
134
+
135
+ Table 6: Top-1 accuracy( $\textcircled{9}$ comparison with DML on ImageNet dataset.
136
+
137
+ <table><tr><td colspan="2">Model Types</td><td colspan="3">DML</td><td colspan="3">AFD</td><td colspan="2">Vanilla</td></tr><tr><td>Net1</td><td>Net2</td><td>Net1</td><td>Net2</td><td>Ens</td><td>Net1</td><td>Net2</td><td>Ens</td><td>Net1</td><td>Net2</td></tr><tr><td>ResNet-18</td><td>ResNet-34</td><td>70.19</td><td>73.57</td><td>73.33</td><td>70.39</td><td>74.00</td><td>74.47</td><td>69.76</td><td>73.27</td></tr></table>
138
+
139
+ # 4.6 IMAGENET EXPERIMENT
140
+
141
+ We evaluate our method on ImageNet dataset to show that our method can also be applicable to a large scale image dataset. We use ImageNet LSVRC 2015 (Russakovsky et al., 2015) which has 1.2M training images and 50K validation images over 1,000 classes. We compare our method with DML using two pre-trained networks ResNet-18 and ResNet-34 as a pair. The results are after 30 epochs of training. As shown in Table 6, our method improves the networks better than DML.
142
+
143
+ # 5 CONCLUSION
144
+
145
+ We proposed an online knowledge distillation method that transfers the knowledge not only at logitlevel but also at feature map-level using the adversarial training scheme. Unlike existing online distillation methods, our method utilizes the feature map information and showed that knowledge transfer at feature map-level is possible even in an online environment. Through extensive experiments, we demonstrated the adequacy of adopting the distribution learning via adversarial training for online feature map distillation and could achieve better performance than existing online methods. We also introduced a novel cyclic learning framework for training multiple networks concurrently and presented its efficacy by comparing with existing approaches. We also confirmed that our method is broadly suitable to various architecture types from a very small network (ResNet-20) to a large (WRN-28-4) network. We hope that due to the work of our research, the area of knowledge distillation can be further advanced and studied by many researchers.
146
+
147
+ # REFERENCES
148
+
149
+ Cristian Bucilua, Rich Caruana, and Alexandru Niculescu-Mizil. Model compression. In ˇ Proceedings of the 12th ACM SIGKDD international conference on Knowledge discovery and data mining, pp. 535–541. ACM, 2006.
150
+ Bo Dai, Sanja Fidler, Raquel Urtasun, and Dahua Lin. Towards diverse and natural image descriptions via a conditional gan. In Proceedings of the IEEE International Conference on Computer Vision, pp. 2970–2979, 2017.
151
+ Ian Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. Generative adversarial nets. In Advances in neural information processing systems, pp. 2672–2680, 2014.
152
+
153
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 770–778, 2016.
154
+
155
+ Geoffrey Hinton, Oriol Vinyals, and Jeff Dean. Distilling the knowledge in a neural network. arXiv preprint arXiv:1503.02531, 2015.
156
+
157
+ Phillip Isola, Jun-Yan Zhu, Tinghui Zhou, and Alexei A Efros. Image-to-image translation with conditional adversarial networks. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 1125–1134, 2017.
158
+
159
+ Jangho Kim, SeongUk Park, and Nojun Kwak. Paraphrasing complex network: Network compression via factor transfer. In Advances in Neural Information Processing Systems, pp. 2760–2769, 2018.
160
+
161
+ Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
162
+
163
+ Alex Krizhevsky, Vinod Nair, and Geoffrey Hinton. Cifar-100 (canadian institute for advanced research). URL http://www.cs.toronto.edu/˜kriz/cifar.html.
164
+
165
+ Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton. Imagenet classification with deep convolutional neural networks. In Advances in neural information processing systems, pp. 1097–1105, 2012.
166
+
167
+ Xu Lan, Xiatian Zhu, and Shaogang Gong. Knowledge distillation by on-the-fly native ensemble. In Proceedings of the 32nd International Conference on Neural Information Processing Systems, pp. 7528–7538. Curran Associates Inc., 2018.
168
+
169
+ Hao Li, Asim Kadav, Igor Durdanovic, Hanan Samet, and Hans Peter Graf. Pruning filters for efficient convnets. arXiv preprint arXiv:1608.08710, 2016.
170
+
171
+ Peiye Liu, Wu Liu, Huadong Ma, Tao Mei, and Mingoo Seok. Ktan: knowledge transfer adversarial network. arXiv preprint arXiv:1810.08126, 2018.
172
+
173
+ Xudong Mao, Qing Li, Haoran Xie, Raymond YK Lau, Zhen Wang, and Stephen Paul Smolley. Least squares generative adversarial networks. In Proceedings of the IEEE International Conference on Computer Vision, pp. 2794–2802, 2017.
174
+
175
+ Takeru Miyato, Andrew M Dai, and Ian Goodfellow. Adversarial training methods for semisupervised text classification. arXiv preprint arXiv:1605.07725, 2016.
176
+
177
+ David Pfau and Oriol Vinyals. Connecting generative adversarial networks and actor-critic methods. arXiv preprint arXiv:1610.01945, 2016.
178
+
179
+ Mohammad Rastegari, Vicente Ordonez, Joseph Redmon, and Ali Farhadi. Xnor-net: Imagenet classification using binary convolutional neural networks. In European Conference on Computer Vision, pp. 525–542. Springer, 2016.
180
+
181
+ Adriana Romero, Nicolas Ballas, Samira Ebrahimi Kahou, Antoine Chassang, Carlo Gatta, and Yoshua Bengio. Fitnets: Hints for thin deep nets. arXiv preprint arXiv:1412.6550, 2014.
182
+
183
+ Olga Russakovsky, Jia Deng, Hao Su, Jonathan Krause, Sanjeev Satheesh, Sean Ma, Zhiheng Huang, Andrej Karpathy, Aditya Khosla, Michael Bernstein, Alexander C. Berg, and Li Fei-Fei. ImageNet Large Scale Visual Recognition Challenge. International Journal of Computer Vision (IJCV), 115(3):211–252, 2015. doi: 10.1007/s11263-015-0816-y.
184
+
185
+ Jost Tobias Springenberg. Unsupervised and semi-supervised learning with categorical generative adversarial networks. arXiv preprint arXiv:1511.06390, 2015.
186
+
187
+ Sergey Zagoruyko and Nikos Komodakis. Paying more attention to attention: Improving the performance of convolutional neural networks via attention transfer. arXiv preprint arXiv:1612.03928, 2016a.
188
+
189
+ Sergey Zagoruyko and Nikos Komodakis. Wide residual networks. arXiv preprint arXiv:1605.07146, 2016b.
190
+
191
+ Ying Zhang, Tao Xiang, Timothy M Hospedales, and Huchuan Lu. Deep mutual learning. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 4320– 4328, 2018.
192
+
193
+ Jun-Yan Zhu, Taesung Park, Phillip Isola, and Alexei A Efros. Unpaired image-to-image translation using cycle-consistent adversarial networks. In Proceedings of the IEEE international conference on computer vision, pp. 2223–2232, 2017.
md/train/Bkl5kxrKDr/Bkl5kxrKDr.md ADDED
The diff for this file is too large to render. See raw diff
 
md/train/BklEF3VFPB/BklEF3VFPB.md ADDED
@@ -0,0 +1,256 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # TOWARDS STABLE AND COMPREHENSIVE DOMAIN ALIGNMENT: MAX-MARGIN DOMAIN-ADVERSARIAL TRAINING
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Domain adaptation tackles the problem of transferring knowledge from a labelrich source domain to an unlabeled or label-scarce target domain. Recently domain-adversarial training (DAT) has shown promising capacity to learn a domaininvariant feature space by reversing the gradient propagation of a domain classifier. However, DAT is still vulnerable in several aspects including (1) training instability due to the overwhelming discriminative ability of the domain classifier in adversarial training, (2) restrictive feature-level alignment, and (3) lack of interpretability or systematic explanation of the learned feature space. In this paper, we propose a novel Max-margin Domain-Adversarial Training (MDAT) by designing an Adversarial Reconstruction Network (ARN). The proposed MDAT stabilizes the gradient reversing in ARN by replacing the domain classifier with a reconstruction network, and in this manner ARN conducts both feature-level and pixel-level domain alignment without involving extra network structures. Furthermore, ARN demonstrates strong robustness to a wide range of hyper-parameters settings, greatly alleviating the task of model selection. Extensive empirical results validate that our approach outperforms other state-of-the-art domain alignment methods. Additionally, the reconstructed target samples are visualized to interpret the domain-invariant feature space which conforms with our intuition.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Deep neural networks have gained great success on a wide range of tasks such as visual recognition and machine translation (LeCun et al., 2015). They usually require a large number of labeled data that can be prohibitively expensive to collect, and even with sufficient supervision their performance can still be poor when being generalized to a new environment. The problem of discrepancy between the training and testing data distribution is commonly referred to as domain shift (Shimodaira, 2000). To alleviate the effect of such shift, domain adaptation sets out to obtain a model trained in a label-rich source domain to generalize well in an unlabeled target domain. Domain adaptation has benefited various applications in many practical scenarios, including but not limited to object detection under challenging conditions (Chen et al., 2018), cost-effective learning using only synthetic data to generalize to real-world imagery (Vazquez et al., 2013), etc.
12
+
13
+ Prevailing methods for unsupervised domain adaptation (UDA) are mostly based on domain alignment which aims to learn domain-invariant features by reducing the distribution discrepancy between the source and target domain using some pre-defined metrics such as maximum mean discrepancy (Tzeng et al., 2014). Recently, Ganin & Lempitsky (2015) proposed to achieve domain alignment by domainadversarial training (DAT) that reverses the gradients of a domain classifier to maximize domain confusion. Having yielded remarkable performance gain, DAT was employed in many subsequent UDA methods (Long et al., 2018; Shu et al., 2018). Even so, there still exist three critical issues of DAT that hinder its performance: (1) as the domain classifier has high-capacity to discriminate two domains, the unbalanced adversarial training cannot continuously provide effective gradients, which is usually overcome by manually adjusting the weights of adversarial training according to specific tasks; (2) DAT-based methods cannot deal with pixel-level domain shift (Hoffman et al., 2018); (3) the domain-invariant features learned by DAT are only based on intuition but difficult to interpret, which impedes the investigation of the underlying mechanism of adversarial domain adaptation.
14
+
15
+ To overcome the aforementioned difficulties, we propose an innovative DAT approach, namely Max-margin Domain-Adversarial Training (MDAT), to realize stable and comprehensive domain alignment. To demonstrate its effectiveness, we develop an Adversarial Reconstruction Network (ARN) that only utilizes MDAT for UDA. Specifically, ARN consists of a shared feature extractor, a label predictor, and a reconstruction network (i.e. decoder) that serves as a domain classifier. Supervised learning is conducted on source domain, and MDAT helps learn domain-invariant features. In MDAT, the decoder only focuses on reconstructing samples on source domain and pushing the target domain away from a margin, while the feature extractor aims to fool the decoder by learning to reconstruct samples on target domain. In this way, three critical issues can be solved by MDAT: (1) the max-margin loss reduces the discriminative capacity of domain classifier, leading to balanced and thus stable adversarial training; (2) without involving new network structures, MDAT achieves both pixel-level and feature-level domain alignment; (3) visualizing the reconstructed samples reveals how the source and target domains are aligned. We evaluate ARN with MDAT on five visual and non-visual UDA benchmarks. It achieves significant improvement to DAT on all tasks with pixel-level or higher-level domain shift. We also observe that it is insensitive to the choices of hyperparameters and as such is favorable for replication in practice. In principle, our approach is generic and can be used to enhance any UDA methods that leverage domain alignment as an ingredient.
16
+
17
+ # 2 RELATED WORK
18
+
19
+ Domain adaptation aims to transfer knowledge from one domain to another. Ben-David et al. (2010) provide an upper bound of the test error on the target domain in terms of the source error and the $\mathcal { H } \triangle \mathcal { H }$ -distance. As the source error is stationary for a fixed model, the goal of most UDA methods is to minimize the $\mathcal { H } \triangle \mathcal { H }$ -distance by reducing some metrics such as Maximum Mean Discrepancy (MMD) (Tzeng et al., 2014; Long et al., 2015) and CORAL (Sun & Saenko, 2016). Inspired by Generative Adversarial Networks (GAN) (Goodfellow et al., 2014), Ganin & Lempitsky (2015) proposed to learn domain-invariant features by adversarial training, which has inspired many UDA methods thereafter. Adversarial Discriminative Domain Adaptation (ADDA) tried to fool the label classifier by adversarial training but not in an end-to-end manner. CyCADA (Hoffman et al., 2018) and PixelDA (Bousmalis et al., 2017) leveraged GAN to conduct both feature-level and pixel-level domain adaptation, which yields significant improvement yet the network complexity is high.
20
+
21
+ Another line of approaches that are relevant to our method is the reconstruction network (i.e. the decoder network). The success of image-to-image translation corroborates that it helps learn pixellevel features in an unsupervised manner. In UDA, Ghifary et al. (2016) employed a decoder network for pixel-level adaptation, and Domain Separate Network (DSN) (Bousmalis et al., 2016) further leveraged multiple reconstruction networks to learn domain-specific features. These approaches treat the decoder network as an independent component that is irrelevant to domain alignment (Glorot et al., 2011). In this paper, our approach proposes to utilize the decoder network as domain classifier in MDAT which enables both feature-level and pixel-level domain alignment in a stable and straightforward fashion.
22
+
23
+ # 3 PROBLEM FORMULATION
24
+
25
+ # 3.1 PROBLEM DEFINITION AND NOTATIONS
26
+
27
+ In unsupervised domain adaptation, we assume that the model works with a labeled dataset $\mathbf { X } _ { S }$ and an unlabeled dataset $\mathbf { X } _ { T }$ . Let $\mathbf { X } _ { S } = \{ ( \mathbf { x } _ { i } ^ { s } , y _ { i } ^ { s } ) \} _ { i \in [ N _ { s } ] }$ denote the labeled dataset of $N _ { s }$ samples from the source domain, and the certain label $y _ { i } ^ { s }$ belongs to the label space $Y$ that is a finite set $( Y = 1 , 2 , . . . , K )$ . The other dataset $\mathbf { X } _ { T } = \{ \mathbf { x } _ { i } ^ { t } \} _ { i \in [ N _ { t } ] }$ has $N _ { t }$ samples from the target domain but has no labels. We further assume that two domains have different distributions, i.e. $\mathbf { x } _ { i } ^ { s } \sim \mathcal { D } _ { S }$ and $\mathbf { x } _ { i } ^ { t } \sim \mathcal { D } _ { T }$ . In other words, there exist some domain shift (Ben-David et al., 2010) between $\mathcal { D } _ { S }$ and $\mathcal { D } _ { T }$ . The ultimate goal is to learn a model that can predict the label $y _ { i } ^ { t }$ given the target input $\mathbf { x } _ { i } ^ { t }$ .
28
+
29
+ # 3.2 IMBALANCED MINIMAX GAME IN DOMAIN-ADVERSARIAL TRAINING
30
+
31
+ To achieve domain alignment, Domain-Adversarial Training (DAT) is a minimax game between a shared feature extractor $F$ for two domains and a domain classifier $D$ . The domain classifier is
32
+
33
+ ![](images/001311f8f21980fa16dacf066d24b3fe311eef6861e67cfc41a97be754e1ac07.jpg)
34
+ Figure 1: The proposed architecture is composed of a shared feature extractor $G _ { e }$ for two domains, a label predictor $G _ { y }$ and a reconstruction network $G _ { r }$ . In addition to the basic supervised learning in the source domain, our adversarial reconstruction training enables the extractor $G _ { e }$ to learn domain-invariant features. Specifically, the network $G _ { r }$ aims to reconstruct the source samples $x ^ { s }$ and to impede the reconstruction of the target samples $x ^ { t }$ , while the extractor $G _ { e }$ tries to fool the reconstruction network in order to reconstruct the target samples $x ^ { t }$ .
35
+
36
+ trained to determine whether the input sample belongs to the source or the target domain while the feature extractor learns to deceive the domain classifier, which is formulated as:
37
+
38
+ $$
39
+ \operatorname* { m i n } _ { F } \operatorname* { m a x } _ { D } \mathcal { L } _ { D A T } ( D _ { s } , D _ { t } ) = \mathbb { E } _ { x \sim D _ { s } } [ \ln F ( x ) ] + \mathbb { E } _ { x \sim D _ { t } } [ \ln \left( 1 - D ( F ( x ) ) \right) ] .
40
+ $$
41
+
42
+ In DAT, we usually utilize CNN as the feature extractor and fully connected layers (FC) as the domain classifier. DAT reduces the cross-domain discrepancy, achieving significant performance improvement for UDA. Nevertheless, the training of DAT is rather unstable. Without sophisticated tuning of the hyper-parameters, DAT cannot reach the convergence. Through empirical experiments, we observe that such instability is due to the imbalanced minimax game. The binary domain classifier $D$ can easily achieve convergence with very high accuracy at an early training epoch, while it is much harder for the feature extractor $F$ to fool the domain classifier and to simultaneously perform well on the source domain. In this sense, the domain classifier dominates DAT, and the only solution is to palliate the training of $D$ by tuning the hyper-parameters according to different tasks. In our method, we restrict the capacity of the domain classifier so as to form a minimax game in a harmonious manner. Inspired by the max-margin loss in Support Vector Machine (SVM) (Cristianini et al., 2000) (i.e. hinge loss), if we push the source domain and the target domain away from a margin rather than as far as possible, then the training task of $F$ to fool $D$ becomes easier. For a binary domain classifier, we define the margin loss as
43
+
44
+ $$
45
+ \mathcal { L } _ { m a r g i n } ( y ) = [ 0 , m - t \cdot y ] ^ { + } ,
46
+ $$
47
+
48
+ where $y$ is the predicted domain label, $[ \cdot ] ^ { + } : = m a x ( 0 , \cdot )$ , $m$ is a positive margin and $t$ is the ground truth label for two domains $t = - 1$ for the source domain and $t = 1$ for the target domain). Then we introduce our MDAT scheme based on an innovative network architecture.
49
+
50
+ # 3.3 MAX-MARGIN DOMAIN-ADVERSARIAL TRAINING
51
+
52
+ Besides the training instability issue, DAT also suffers from restrictive feature-level alignment – lack of pixel-level alignment. To realize stable and comprehensive domain alignment together, we first propose an Adversarial Reconstruction Network (ARN) and then elaborate MDAT.
53
+
54
+ As depicted in Figure 1, our model consists of three parts including a shared feature extractor $G _ { e }$ for both domains, a label predictor $G _ { y }$ and a reconstruction network $G _ { r }$ . Let the feature extractor $G _ { e } ( \mathbf { x } ; \theta _ { e } )$ be a function parameterized by $\theta _ { e }$ which maps an input sample $\mathbf { X }$ to a deep embedding z. Let the label predictor $G _ { y } ( \pmb { z } ; \theta _ { y } )$ be a task-specific function parameterized by $\theta _ { y }$ which maps an embedding $\mathbf { z }$ to a task-specific prediction $\hat { y }$ . The reconstruction network $G _ { r } ( \pmb { z } ; \bar { \theta } _ { r } )$ is a decoding function parameterized by $\theta _ { r }$ that maps an embedding $\mathbf { z }$ to its corresponding reconstruction $\hat { \bf x }$ .
55
+
56
+ The first learning objective for the feature extractor $G _ { e }$ and label predictor $G _ { y }$ is to perform well in the source domain. For a supervised $\mathrm { K }$ -way classification problem, it is simply achieved by minimizing the negative log-likelihood of the ground truth class for each sample:
57
+
58
+ $$
59
+ \mathcal { L } _ { t a s k } = \sum _ { i = 1 } ^ { N _ { s } } \mathcal { L } _ { y } ( \mathbf { x } _ { i } ^ { s } , \mathbf { y } _ { i } ^ { s } ) = - \sum _ { i = 1 } ^ { N _ { s } } \mathbf { y } _ { i } ^ { s } \cdot \log G _ { y } ( G _ { e } ( \mathbf { x } _ { i } ^ { s } ; \boldsymbol { \theta } _ { e } ) ; \boldsymbol { \theta } _ { y } ) ,
60
+ $$
61
+
62
+ where $\mathbf { y } _ { i } ^ { s }$ is the one-hot encoding of the class label $y _ { i } ^ { s }$ and the logarithm operation is conducted on the softmax predictions of the model.
63
+
64
+ The second objective is to render the feature learning to be domain-invariant. This is motivated by the covariate shift assumption (Shimodaira, 2000) that indicates if the feature distributions $\dot { S } ( \mathbf { z } ) = \{ G _ { e } ( \mathbf { x } ; \theta _ { e } ) | \mathbf { \bar { x } } \sim \mathcal { D } _ { S } \}$ and $T ( \mathbf { z } ) = \{ G _ { e } ( \mathbf { x } ; \boldsymbol { \theta } _ { e } ) | \mathbf { x } \sim \mathcal { D } _ { T } \}$ are similar, the source label predictor $G _ { y }$ can achieve a similar high accuracy in the target domain. To this end, we design a decoder network $G _ { r }$ that serves as a domain classifier, and then MDAT could be applied for stable training. Different from the normal binary domain classifier, MDAT lets the decoder network $G _ { r }$ only reconstruct the features in the source domain and push the features in the target domain away from a margin $m$ . In this way, the decoder has the functionality of distinguishing the source domain from the target domain. The objective of training $G _ { r }$ is formulated as
65
+
66
+ $$
67
+ \operatorname* { m i n } _ { \theta _ { r } } \sum _ { i = 1 } ^ { N _ { s } + N _ { t } } \mathcal { L } _ { m a r g i n } ( \mathcal { L } _ { r } ( \mathbf { x } _ { i } ) ) = \operatorname* { m i n } _ { \theta _ { r } } \sum _ { i = 1 } ^ { N _ { s } } \mathcal { L } _ { r } ( \mathbf { x } _ { i } ^ { s } ) + \sum _ { j = 1 } ^ { N _ { t } } [ m - \mathcal { L } _ { r } ( \mathbf { x } _ { j } ^ { t } ) ] ^ { + } ,
68
+ $$
69
+
70
+ where $m$ is a positive margin and $\textstyle { \mathcal { L } } _ { r } ( \cdot )$ is the mean squared error (MSE) term for the reconstruction loss that is defined as
71
+
72
+ $$
73
+ \mathcal { L } _ { r } ( \mathbf { x } ) = | | G _ { r } ( G _ { e } ( \mathbf { x } ; \boldsymbol { \theta } _ { e } ) ; \boldsymbol { \theta } _ { r } ) - \mathbf { x } | | _ { 2 } ^ { 2 } ,
74
+ $$
75
+
76
+ where $| | \cdot | | _ { 2 } ^ { 2 }$ denotes the squared $L _ { 2 }$ -norm.
77
+
78
+ Oppositely, to form a minimax game, the feature extractor $G _ { e }$ learns to deceive $G _ { r }$ such that the learned target features are indistinguishable to the source ones, which is formulated by:
79
+
80
+ $$
81
+ \operatorname* { m i n } _ { \theta _ { e } } \sum _ { j = 1 } ^ { N _ { t } } \mathcal { L } _ { r } ( \mathbf { x } _ { j } ^ { t } ) .
82
+ $$
83
+
84
+ Then the whole learning procedure of ARN with MDAT can be formulated by:
85
+
86
+ $$
87
+ \begin{array} { l } { { \displaystyle \operatorname* { m i n } _ { \theta _ { e } , \theta _ { c } } \sum _ { i = 1 } ^ { N _ { s } } } \mathcal { L } _ { y } ( \mathbf { x } _ { i } ^ { s } , \mathbf { y } _ { i } ^ { s } ) + \alpha \sum _ { j = 1 } ^ { N _ { t } } \mathcal { L } _ { r } ( \mathbf { x } _ { j } ^ { t } ) , \ ~ } \\ { { \displaystyle \operatorname* { m i n } _ { \theta _ { r } } \sum _ { i = 1 } ^ { N _ { s } } } \mathcal { L } _ { r } ( \mathbf { x } _ { i } ^ { s } ) + \sum _ { j = 1 } ^ { N _ { t } } [ m - \mathcal { L } _ { r } ( \mathbf { x } _ { j } ^ { t } ) ] ^ { + } , \ ~ } \end{array}
88
+ $$
89
+
90
+ where $\mathcal { L } _ { y }$ denotes the negative log-likelihood of the ground truth class for labeled sample $\left( \mathbf { x } _ { i } ^ { s } , \mathbf { y } _ { i } ^ { s } \right)$ and $\alpha$ controls the interaction of the loss terms. In the following section, we provide theoretical justifications on how MDAT reduces the distribution discrepancy, and discuss why it is superior to the classic DAT.
91
+
92
+ # 3.4 THEORETICAL JUSTIFICATIONS
93
+
94
+ In this section, we provide the theoretical justifications on how the proposed method reduces the distribution discrepancy for UDA. The rationale behind domain alignment is motivated from the learning theory of non-conservative domain adaptation problem by Ben-David et al. (Ben-David et al., 2010):
95
+
96
+ Theorem 3.1 Let $\mathcal { H }$ be the hypothesis space where $h \in \mathcal H$ . Let $( \mathcal { D } _ { S } , \epsilon _ { s } )$ and $( \mathcal { D } _ { T } , \epsilon _ { t } )$ be the two domains and their corresponding generalization error functions. The expected error for the target domain is upper bounded by
97
+
98
+ $$
99
+ \epsilon _ { t } ( h ) \leq \epsilon _ { s } ( h ) + \frac { 1 } { 2 } d _ { \mathscr { H } \triangle \mathscr { H } } ( \mathscr { D } _ { S } , \mathscr { D } _ { T } ) + \lambda , \forall h \in \mathscr { H } ,
100
+ $$
101
+
102
+ where $\begin{array} { r } { d _ { \mathcal { H } \triangle \mathcal { H } } ( \mathcal { D } _ { S } , \mathcal { D } _ { T } ) = 2 \operatorname* { s u p } _ { h _ { 1 } , h _ { 2 } \in \mathcal { H } } \big | \operatorname* { P r } _ { x \sim \mathcal { D } _ { S } } [ h _ { 1 } ( x ) \neq h _ { 2 } ( x ) ] - \operatorname* { P r } _ { x \sim \mathcal { D } _ { T } } [ h _ { 1 } ( x ) \neq h _ { 2 } ( x ) ] \big | } \end{array}$ and $\lambda = \mathrm { m i n } _ { h } [ \epsilon _ { s } ( h ) + \epsilon _ { t } ( h ) ]$ .
103
+
104
+ Theoretically, when we minimize the $\mathcal { H } \triangle \mathcal { H }$ -distance, the upper bound of the expected error for the target domain is reduced accordingly. As derived in DAT (Ganin $\&$ Lempitsky, 2015), assuming a family of domain classifiers $\mathcal { H } _ { d }$ to be rich enough to contain the symmetric difference hypothesis set of $\mathcal { H } _ { p }$ , such that $\mathcal { H } _ { p } \triangle \mathcal { H } _ { p } = \{ h | h = h _ { 1 } \oplus \bar { h } _ { 2 } , h _ { 1 } , h _ { 2 } \in \mathcal { H } _ { p } \}$ where $\oplus$ is XOR-function, the empirical $\mathcal { H } _ { p } \triangle \mathcal { H } _ { p }$ -distance has an upper bound with regard to the optimal domain classifier $h$ :
105
+
106
+ $$
107
+ d _ { \mathcal H _ { p } \triangle \mathcal H _ { p } } ( \hat { D } _ { S } , \hat { D } _ { T } ) \le 2 \operatorname* { s u p } _ { h \in \mathcal H _ { d } } \vert \operatorname* { P r } _ { \mathbf z \sim \hat { D } _ { S } } [ h ( \mathbf z ) = 0 ] + \operatorname* { P r } _ { \mathbf z \sim \hat { D } _ { T } } [ h ( \mathbf z ) = 1 ] - 1 \vert ,
108
+ $$
109
+
110
+ where $\hat { \mathcal { D } } _ { S }$ and $\hat { \mathcal { D } } _ { T }$ denote the distributions of the source and target feature space ${ \mathcal { Z } } _ { S }$ and ${ \mathcal { Z } } _ { T }$ , respectively. Note that the MSE of $G _ { r }$ plus a ceiling function is a form of domain classifier $h ( \mathbf { z } )$ , i.e. $\lceil [ m - \bar { \mathcal { L } } _ { r } ( \cdot ) ] ^ { + } - 0 . 5 \rceil$ for $m = 1$ . It maps source samples to 0 and target samples to 1 which is exactly the upper bound in Eq.10. Therefore, our reconstruction network $G _ { r }$ maximizes the domain discrepancy with a margin and the feature extractor learns to minimize it oppositely.
111
+
112
+ # 3.5 DISCUSSIONS
113
+
114
+ Compared with the conventional DAT-based methods that are usually based on a binary logistic network (Ganin & Lempitsky, 2015), the proposed ARN with MDAT is more attractive and incorporates new merits conceptually and theoretically:
115
+
116
+ (1) Stable training and insensitivity to hyper-parameters. Using the decoder as domain classifier with a margin loss to restrain its overwhelming capacity in adversarial training, the minimax game can continuously provide effective gradients for training the feature extractor. Moreover, through the experiments in Section 4, we discover that our method shows strong robustness to the hyperparameters, i.e. $\alpha$ and $m$ , greatly alleviating the parameters tuning for model selection.
117
+
118
+ (2) Richer information for comprehensive domain alignment. Rather than DAT that uses a bit of domain information, MDAT utilizes the reconstruction network as the domain classifier that could capture more domain-specific and pixel-level features during the unsupervised reconstruction (Bousmalis et al., 2016). Therefore, MDAT further helps address pixel-level domain shift apart from the feature-level shift, leading to comprehensive domain alignment in a straightforward manner.
119
+
120
+ (3) Feature visualization for method validation. Another key merit of MDAT is that MDAT allows us to visualize the features directly by the reconstruction network. It is crucial to understand to what extent the features are aligned since this helps to reveal the underlying mechanism of adversarial domain adaptation. We will detail the interpretability of these adapted features in Section 4.3.
121
+
122
+ # 4 EXPERIMENT
123
+
124
+ In this section, we evaluate the proposed ARN with MDAT on a number of visual and non-visual UDA tasks with varying degrees of domain shift. We conduct ablation study to corroborate the effectiveness of MDAT and unsupervised reconstruction for UDA. Then the sensitivity of the hyperparameters is investigated, and the adapted features are interpreted via the reconstruction network in ARN.
125
+
126
+ Setup. We evaluate our method on four classic visual UDA datasets and a WiFi-based Gesture Recognition (WGR) dataset (Zou et al., 2019). The classic datasets have middle level of domain shift including MNIST (LeCun et al., 1998), USPS (Hull, 1994), Street View House Numbers (SVHN) (Netzer et al., 2011) and Synthetic Digits (SYN). For a fair comparison, we follow the same CNN architecture as DANN (Ganin & Lempitsky, 2015) while using the inverse of $G _ { e }$ as $G _ { r }$ with pooling operation replaced by upsampling. For the penalty term $\alpha$ , we choose 0.02 by searching over the grid $\lbrace 1 0 ^ { - 2 } , \dot { 1 } \rbrace$ . We also obtain the optimal margin $m = 5$ by a search over $\{ 1 0 ^ { \dot { - } 1 } , 1 0 \}$ . Then we use the same hyperparameter settings for all tasks to show the robustness. For the optimization, we simply use Adam Optimizer $( l r = 2 \times 1 0 ^ { - 4 } , \beta _ { 1 } = 0 . 5 , \beta _ { 2 } = 0 . 9 9 9 )$ and train all experiments for 50 epochs with batch size 128. We implemented our model and conducted all the experiments using the PyTorch framework. More implementation details are illustrated in the appendix.
127
+
128
+ Baselines. We evaluate the efficacy of our approach by comparing it with existing UDA methods that perform three ways of domain alignment. Specifically, MMD regularization (Long et al., 2015) and Correlation Alignment (Sun & Saenko, 2016) employ the statistical distribution matching. DRCN (Ghifary et al., 2016) and DSN (Bousmalis et al., 2016) use the reconstruction error for UDA,
129
+
130
+ <table><tr><td>Source Target</td><td>MNIST USPS</td><td>USPS MNIST</td><td>SVHN MNIST</td><td>SYN SVHN</td></tr><tr><td>Source-Only model</td><td>78.2</td><td>63.4</td><td>54.9</td><td>86.7</td></tr><tr><td>Train on target</td><td>96.5</td><td>99.4</td><td>99.4</td><td>91.3</td></tr><tr><td>[S] MMD (Long et al., 2015)</td><td>81.1</td><td>-</td><td>71.1</td><td>88.0</td></tr><tr><td>[S] CORAL (Sun &amp; Saenko, 2016)</td><td>80.7</td><td>-</td><td>63.1</td><td>85.2</td></tr><tr><td>[R] DRCN* (Ghifary et al.,2016)</td><td>91.8</td><td>73.7</td><td>82.0</td><td>87.5</td></tr><tr><td>[R] DSN (Bousmalis et al., 2016)</td><td>91.3</td><td>-</td><td>82.7</td><td>91.2</td></tr><tr><td>[A] DANN (Ganin et al., 2016)</td><td>85.1</td><td>73.0</td><td>74.7</td><td>90.3</td></tr><tr><td>[A] ADDA (Tzeng et al., 2017)</td><td>89.4</td><td>90.1</td><td>76.0</td><td>-</td></tr><tr><td>[A] CyCADA (Hoffman et al., 2018)</td><td>95.6</td><td>96.5</td><td>90.4</td><td>-</td></tr><tr><td>[A] CADA (Zou et al., 2019)</td><td>96.4</td><td>97.0</td><td>90.9</td><td>1</td></tr><tr><td>[A] MECA (Morerio et al.,2018)</td><td>-</td><td>-</td><td>95.2</td><td>90.3</td></tr><tr><td>ARN w.0. MDAT</td><td>93.1±0.3</td><td>76.5±1.2</td><td>67.4±0.9</td><td>86.8±0.5</td></tr><tr><td>ARN with MDAT (proposed)</td><td>98.6±0.3</td><td>98.4±0.1</td><td>97.4±0.3</td><td>92.0±0.2</td></tr></table>
131
+
132
+ Table 1: We compare with general, statistics-based (S), reconstruction-based $\mathbf { ( R ) }$ and adversarialbased (A) state-of-the-art approaches. We repeated each experiment for 3 times and report the average and standard deviation (std) of the test accuracy in the target domain.
133
+
134
+ while many prevailing UDA methods adopt domain-adversarial training including DANN (Ganin & Lempitsky, 2015), ADDA (Tzeng et al., 2017), MECA (Morerio et al., 2018), CyCADA (Hoffman et al., 2018) and CADA (Zou et al., 2019). For all transfer tasks, we follow the same protocol as DANN (Ganin & Lempitsky, 2015) that uses official training data split in both domains for training and evaluates the testing data split in the target domain.
135
+
136
+ # 4.1 OVERALL RESULTS
137
+
138
+ MNIST USPS. Both datasets are composed of grey-scale handwritten images with diverse stroke weights, leading to low-level domain shift. Since USPS has only 7291 training images, USPS ${ \bf { \Gamma } } \to \mathbf { M N I S T }$ is more difficult. As shown in Table 1, our method achieves state-of-the-art accuracy of $9 8 . 6 \%$ on MNIST USPS and $9 8 . 4 \%$ on USPS MNIST, which demonstrates that ARN can tackle low-level domain shift by only using ART (rather than many adversarial UDA methods that adopt other loss terms to adjust classifier boundaries or conduct style transfer).
139
+
140
+ Table 2: Comparisons on WGR.
141
+
142
+ <table><tr><td rowspan=1 colspan=1>SourceTarget</td><td rowspan=1 colspan=1>Room ARoom B</td></tr><tr><td rowspan=1 colspan=1>Method</td><td rowspan=1 colspan=1>Accuracy (%)</td></tr><tr><td rowspan=1 colspan=1>Source-only[S] MMD</td><td rowspan=2 colspan=1>58.4±0.761.2±0.569.3±0.3</td></tr><tr><td rowspan=1 colspan=1>[R] DRCN</td></tr><tr><td rowspan=1 colspan=1>[A]DANN</td><td rowspan=1 colspan=1>68.2±0.2</td></tr><tr><td rowspan=1 colspan=1>[A] ADDA</td><td rowspan=1 colspan=1>71.5±0.3</td></tr><tr><td rowspan=1 colspan=1>[A] CADA</td><td rowspan=1 colspan=1>88.8±0.1</td></tr><tr><td rowspan=1 colspan=1>ARN+MDAT</td><td rowspan=1 colspan=1>91.3±0.2</td></tr></table>
143
+
144
+ SVHN MNIST and $\mathbf { S Y N } { } \mathbf { S V H N }$ . The SVHN dataset contains RGB digit images that introduce significant variations such as scale, background, embossing, rotation, slanting and even multiple digits. The SYN data consists of $5 0 k$ RGB images of varying color, background, blur and orientation. These two tasks have tremendous pixel-level domain shfit. The proposed method achieves a state-ofthe-art performance of $9 7 . 4 \%$ for $\mathbf { S V H N { \to } M N I S T }$ , far ahead of other DAT-based methods, significantly improving the classic DANN by $2 2 . 7 \%$ . Similarly, ARN with MDAT also achieves a noticeable improvement of $5 . 3 \%$ compared with the source-only model, even outperforming the supervised SVHN accuracy $9 1 . 3 \%$ .
145
+
146
+ WiFi Gesture Recognition with Distant Domains. To evaluate the proposed method on a non-visual UDA task, we applied our method to the WiFi gesture recognition dataset (Zou et al., 2019). The WiFi data of six gestures was collected in two rooms regarded as two domains. The results in Table 2 demonstrate that our approach significantly improves classification accuracy against Source-Only and DANN by $3 2 . 9 \%$ and $2 3 . 1 \%$ , respectively.
147
+
148
+ Table 3: The accuracy $( \% )$ with different hyperparameters on SVHN MNIST.
149
+
150
+ <table><tr><td>a</td><td>0.01</td><td>0.03</td><td>0.07</td><td>0.1</td><td>0.2</td><td>0.3</td><td>0.5</td><td>1.0</td></tr><tr><td>DANN</td><td>71.1</td><td>74.1</td><td>72.7</td><td>74.1</td><td>74.7</td><td>9.6</td><td>9.7</td><td>10.3</td></tr><tr><td>ARN (m = 1)</td><td>95.7</td><td>95.9</td><td>93.3</td><td>93.2</td><td>80.1</td><td>75.3</td><td>73.1</td><td>67.5</td></tr><tr><td>m</td><td>0.1</td><td>0.3</td><td>0.5</td><td>0.7</td><td>1.0</td><td>2.0</td><td>5.0</td><td>10.0</td></tr><tr><td>ARN(α = 2e-2)</td><td>64.5</td><td>75.2</td><td>90.0</td><td>92.6</td><td>96.0</td><td>97.4</td><td>97.7</td><td>96.7</td></tr></table>
151
+
152
+ # 4.2 ABLATION STUDY AND SENSITIVITY ANALYSIS
153
+
154
+ The contribution of MDAT and image reconstruction in ARN. We design an ablation study to verify the contribution of MDAT and unsupervised reconstruction in ARN. To this end, we discard the term $\dot { \mathcal { L } } _ { r } ( \mathbf { x } ^ { t } )$ in Eq.4, and evaluate the method, denoted as ARN w.o. MDAT in Table 1. (1) Comparing ARN w.o. MDAT with source-only model, we can infer the effect of unsupervised reconstruction for UDA. It is observed that ARN w.o. MDAT improves tasks with low-level domain shift such as MNIST USPS, which conforms with our discussion that the unsupervised reconstruction is instrumental in learning low-level features. (2) Comparing ARN w.o. MDAT with the original ARN, we can infer the contribution of MDAT. Table 1 shows that the MDAT achieves an impressive marginof-improvement. For USPS MNIST and SV $\mathbf { H N } { } \mathbf { M N }$ IST, the MDAT improves ARN w.o. MDAT by around $30 \%$ . It demonstrates that MDAT which helps learn domain-invariant representations is the main reason for the tremendous improvement.
155
+
156
+ Parameter sensitivity. We investigate the effect of $\alpha$ and $m$ on S $\mathbf { \nabla } \sqrt { \mathbf { H N } } \to \mathbf { M }$ NIST. The results in Table 3 show that ARN achieves good performance as $\alpha \in [ 0 . 0 1 , 0 . 1 ]$ and even with larger $\alpha$ ARN is able to achieve convergence. In comparison, denoting $\alpha$ as the weight of adversarial loss, the DANN cannot converge when $\alpha > 0 . 2$ . For the sensitivity of $m$ , the accuracy of ARN exceeds $9 6 . 0 \%$ as $m \geq 1$ . These analyses validate that the training of ARN is not sensitive to the parameters and even in the worst cases ARN can achieve convergence.
157
+
158
+ Gradients and training procedure. We draw the training procedure with regard to loss and target accuracy in Figure 2(b) and Figure 2(a), respectively. In Figure 2(b), ARN has smoother and more effective gradients $( \mathcal { L } _ { r } )$ for all $\alpha$ , while the loss of DAT domain classifier $( \mathcal { L } _ { d } )$ gets extremely small at the beginning. This observation conforms with our intuition, which demonstrates that by restricting the capacity of domain classifier MDAT provides more effective gradients for training feature extractor, leading to a more stable training procedure. This could be further validated in Figure 2(b) where the ARN accuracy is more stable than that of DAT across training epochs.
159
+
160
+ ![](images/52dba511d647d639645ebf2e30bb3449cb0c5632abfcd2262b3a859d0381b616.jpg)
161
+ Figure 2: The training procedure with regard to loss and test accuracy. ( $\mathcal { L } _ { e } : = \mathrm { E q }$ . 6; $\mathcal { L } _ { r }$ := Eq. 4; $\mathcal { L } _ { d }$ is the domain loss of DAT (Ganin & Lempitsky, 2015); $\alpha$ is the penalty term of $\mathcal { L } _ { e }$ and $\mathcal { L } _ { d }$ .)
162
+
163
+ <table><tr><td></td><td>Source Images</td><td>Target Images</td><td>R-Target Images</td></tr><tr><td>MNIST→USPS</td><td>72/04149 97349665 34727121</td><td>06181328 Li;97210 10140198</td><td>618132 108:019 3</td></tr><tr><td>USPS→MNIST</td><td>01870009 z568928i 35418305</td><td>7210414a 97349665 341727121</td><td>72104197 97s41665 34727121</td></tr><tr><td>SVHN→MNIST</td><td>0103457N0 2 19 5 5259.012 1310</td><td>59069015 0740131 2413512</td><td>9101e19101115 :1061:01511 gCk ES52</td></tr><tr><td>SYN-→SVHN</td><td>14366 40570 6.75/ 65 3607 37 1236:83811 094</td><td>6s 31 140885 3 96 品 3913b8m</td><td>64040003 30296651 39)-0s81</td></tr></table>
164
+
165
+ Table 4: Visualizing the source image, target images and reconstructed target images (R-Target Images) for four digit adaptation tasks.
166
+
167
+ # 4.3 VISUALIZATION AND ANALYSIS
168
+
169
+ Interpreting MDAT features via reconstructed images. One of the key advantages of ARN is that by visualizing the reconstructed target images we can infer how the features are domain-invariant. We reconstruct the MDAT features of the test data and visualize them in Table 4. It is observed that the target features are reconstructed to source-like images by the decoder $G _ { r }$ . As discussed before, intuitively, MDAT forces the target features to mimic the source features, which conforms with our visualization. Similar to image-to-image translation, this indicates that our method conducts implicit feature-to-feature translation that transfers the target features to source-like features, and hence the features become domain-invariant.
170
+
171
+ T-SNE embeddings. We analyze the performance of domain alignment for DANN (DAT) (Ganin & Lempitsky, 2015) and ARN (MDAT) by plotting T-SNE embeddings of the features $\mathbf { z }$ on the task SVHN MNIST. In Figure 3(a), the source-only model obtains diverse embeddings for each category but the domains are not aligned. In Figure 3(b), the DANN aligns two domains but the decision boundaries of the classifier are vague. In Figure 3(c), the proposed ARN effectively aligns two domains for all categories and the classifier boundaries are much clearer.
172
+
173
+ ![](images/1bdd1728d9463ce082756cdc92cdc0b4e757f2ee7ad1eb5dff92cdabfb33cf61.jpg)
174
+ Figure 3: T-SNE visualization on SVHN MNIST with their corresponding domain labels (red: target; blue: source) and category labels (10 classes) shown in the left and right subfigures, respectively.
175
+
176
+ # 5 CONCLUSION
177
+
178
+ We proposed a new domain alignment approach namely max-margin domain-adversarial training (MDAT) and a MDAT-based network for unsupervised domain adaptation. The proposed method offers effective and stable gradients for the feature learning via an adversarial game between the feature extractor and the reconstruction network. The theoretical analysis provides justifications on how it minimizes the distribution discrepancy. Extensive experiments demonstrate the effectiveness of our method and we further interpret the features by visualization that conforms with our insight. Potential evaluation on semi-supervised learning constitutes our future work.
179
+
180
+ # REFERENCES
181
+
182
+ Shai Ben-David, John Blitzer, Koby Crammer, Alex Kulesza, Fernando Pereira, and Jennifer Wortman Vaughan. A theory of learning from different domains. Machine learning, 79(1-2):151–175, 2010.
183
+
184
+ Konstantinos Bousmalis, George Trigeorgis, Nathan Silberman, Dilip Krishnan, and Dumitru Erhan. Domain separation networks. In Advances in Neural Information Processing Systems, pp. 343–351, 2016.
185
+
186
+ Konstantinos Bousmalis, Nathan Silberman, David Dohan, Dumitru Erhan, and Dilip Krishnan. Unsupervised pixel-level domain adaptation with generative adversarial networks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 3722–3731, 2017.
187
+
188
+ Yuhua Chen, Wen Li, Christos Sakaridis, Dengxin Dai, and Luc Van Gool. Domain adaptive faster r-cnn for object detection in the wild. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 3339–3348, 2018.
189
+
190
+ Nello Cristianini, John Shawe-Taylor, et al. An introduction to support vector machines and other kernel-based learning methods. Cambridge university press, 2000.
191
+
192
+ Yaroslav Ganin and Victor Lempitsky. Unsupervised domain adaptation by backpropagation. In Francis Bach and David Blei (eds.), Proceedings of the 32nd International Conference on Machine Learning, volume 37 of Proceedings of Machine Learning Research, pp. 1180–1189, Lille, France, 07–09 Jul 2015. PMLR.
193
+
194
+ Yaroslav Ganin, Evgeniya Ustinova, Hana Ajakan, Pascal Germain, Hugo Larochelle, Franc¸ois Laviolette, Mario Marchand, and Victor Lempitsky. Domain-adversarial training of neural networks. The Journal of Machine Learning Research, 17(1):2096–2030, 2016.
195
+
196
+ Muhammad Ghifary, W Bastiaan Kleijn, Mengjie Zhang, David Balduzzi, and Wen Li. Deep reconstruction-classification networks for unsupervised domain adaptation. In European Conference on Computer Vision, pp. 597–613. Springer, 2016.
197
+
198
+ Xavier Glorot, Antoine Bordes, and Yoshua Bengio. Domain adaptation for large-scale sentiment classification: A deep learning approach. In Proceedings of the 28th International Conference on Machine Learning (ICML-11), pp. 513–520, 2011.
199
+
200
+ Ian Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. Generative adversarial nets. In Advances in Neural Information Processing Systems, pp. 2672–2680, 2014.
201
+
202
+ Judy Hoffman, Eric Tzeng, Taesung Park, Jun-Yan Zhu, Phillip Isola, Kate Saenko, Alexei Efros, and Trevor Darrell. CyCADA: Cycle-consistent adversarial domain adaptation. In Proceedings of the 35th International Conference on Machine Learning, pp. 1989–1998, 2018.
203
+
204
+ Jonathan J. Hull. A database for handwritten text recognition research. IEEE Transactions on Pattern Analysis and Machine Intelligence, 16(5):550–554, 1994.
205
+
206
+ Yann LeCun, Leon Bottou, Yoshua Bengio, and Patrick Haffner. Gradient-based learning applied to ´ document recognition. Proceedings of the IEEE, 86(11):2278–2324, 1998.
207
+
208
+ Yann LeCun, Yoshua Bengio, and Geoffrey Hinton. Deep learning. nature, 521(7553):436, 2015.
209
+
210
+ Mingsheng Long, Yue Cao, Jianmin Wang, and Michael I. Jordan. Learning transferable features with deep adaptation networks. In Proceedings of the 32Nd International Conference on International Conference on Machine Learning - Volume 37, ICML’15, pp. 97–105, 2015.
211
+
212
+ Mingsheng Long, Zhangjie Cao, Jianmin Wang, and Michael I Jordan. Conditional adversarial domain adaptation. In Advances in Neural Information Processing Systems, 2018.
213
+
214
+ Pietro Morerio, Jacopo Cavazza, and Vittorio Murino. Minimal-entropy correlation alignment for unsupervised deep domain adaptation. In International Conference on Learning Representations, 2018. URL https://openreview.net/forum?id=rJWechg0Z.
215
+
216
+ Yuval Netzer, Tao Wang, Adam Coates, Alessandro Bissacco, Bo Wu, and Andrew Y Ng. Reading digits in natural images with unsupervised feature learning. In NIPS Workshop on Deep Learning and Unsupervised Feature Learning, volume 2011, pp. 5, 2011.
217
+
218
+ Hidetoshi Shimodaira. Improving predictive inference under covariate shift by weighting the loglikelihood function. Journal of statistical planning and inference, 90(2):227–244, 2000.
219
+
220
+ Rui Shu, Hung H Bui, Hirokazu Narui, and Stefano Ermon. A dirt-t approach to unsupervised domain adaptation. In Proc. 6th International Conference on Learning Representations, 2018.
221
+
222
+ Baochen Sun and Kate Saenko. Deep coral: Correlation alignment for deep domain adaptation. In European Conference on Computer Vision, pp. 443–450. Springer, 2016.
223
+
224
+ Eric Tzeng, Judy Hoffman, Ning Zhang, Kate Saenko, and Trevor Darrell. Deep domain confusion: Maximizing for domain invariance. CoRR, abs/1412.3474, 2014. URL http://arxiv.org/ abs/1412.3474.
225
+
226
+ Eric Tzeng, Judy Hoffman, Kate Saenko, and Trevor Darrell. Adversarial discriminative domain adaptation. In Computer Vision and Pattern Recognition (CVPR), volume 1, pp. 4, 2017.
227
+
228
+ David Vazquez, Antonio M Lopez, Javier Marin, Daniel Ponsa, and David Geronimo. Virtual and real world adaptation for pedestrian detection. IEEE Transactions on Pattern Analysis and Machine Intelligence, 36(4):797–809, 2013.
229
+
230
+ Han Zou, Yuxun Zhou, Jianfei Yang, Huihan Liu, Hari Prasanna Das, and Costas J Spanos. Consensus adversarial domain adaptation. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 33, pp. 5997–6004, 2019.
231
+
232
+ # APPENDIX
233
+
234
+ # IMPLEMENTATION DETAILS
235
+
236
+ Hyperparameter For all tasks, we simply use the same hyperparameters that are chosen from the sensitivity analysis. We use $\alpha = 0 . 0 2$ and $m = 5 . 0$ , and we reckon that better results can be obtained by tuning the hyperparameters for specific tasks.
237
+
238
+ Network Architecture For a fair comparison, we follow the network in DANN (Ganin & Lempitsky, 2015) for digit adaptation and simply build the reconstruction network by the inverse network of the extractor. Here we draw the network architectures in Table 5. For WiFi gesture recognition, we adopt the same architecture as CADA (Zou et al., 2019) that is a modified version of LeNet-5.
239
+
240
+ Table 5: The network architecture used in the experiments.
241
+
242
+ <table><tr><td rowspan=1 colspan=1>Layer Index|</td><td rowspan=1 colspan=1>Feature Extractor</td><td rowspan=1 colspan=2>Decoder Network一Label Predictor</td></tr><tr><td rowspan=1 colspan=1>0</td><td rowspan=1 colspan=3>32 × 32 × 3 Image</td></tr><tr><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1> 5 × 5 conv. 64 ReLU</td><td rowspan=1 colspan=1>2048 dense, ReLU</td><td rowspan=1 colspan=1>10 dense, softmax</td></tr><tr><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>3 × 3 max-pool, stride 2</td><td rowspan=1 colspan=1>3072 dense, ReLU</td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1>3</td><td rowspan=1 colspan=1>5 × 5 conv. 64 ReLU</td><td rowspan=1 colspan=2> 5 × 5 conv. 128 ReLU</td></tr><tr><td rowspan=1 colspan=1>4</td><td rowspan=1 colspan=1> 3 × 3 max-pool, stride 2</td><td rowspan=1 colspan=1>upsample 2</td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1>5</td><td rowspan=1 colspan=1>5 × 5 conv. 128 ReLU</td><td rowspan=1 colspan=1>5 × 5 conv. 64 ReLU</td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1>6</td><td rowspan=1 colspan=1> 3072 dense,dropout, ReLU</td><td rowspan=1 colspan=1>upsample 2 一</td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1>7</td><td rowspan=1 colspan=1>2048 dense, dropout ReLU丨 5 × 5 conv. 64 ReLU</td><td rowspan=1 colspan=1>2048 dense, dropout ReLU丨 5 × 5 conv. 64 ReLU</td><td rowspan=1 colspan=1></td></tr></table>
243
+
244
+ # SENSITIVITY
245
+
246
+ We have presented all the results of the sensitivity study in Section 4.2, and now we show their detailed training procedures in Figure 4(a) and 4(b). It is observed that the accuracy increases when $\alpha$ drops or the margin $m$ increases. The reason is very simple: (1) when $\alpha$ is too large, it affects the effect of supervised training on source domain; (2) when the margin $m$ is small, the divergence between source and target domain (i.e. $\mathcal { H } \triangle \mathcal { H }$ -distance) cannot be measured well.
247
+
248
+ ![](images/51fdf51eb7f411f3f5d635607678c3149a1ab54683a9f9149fc92a99b18e13cf.jpg)
249
+ Figure 4: The training procedure of ARN with different hyper-parameters.
250
+
251
+ # VISUALIZATION
252
+
253
+ Here we provide more visualization of the reconstructed images of target samples. In Figure 5, the target samples are shown in the left column while their corresponding reconstructed samples are shown in the right. We can see that for low-level domain shift such as $\mathbf { M N I S T } { } \mathbf { U S P } \mathbf { \xi }$ S, the reconstructed target samples are very source-like while preserving their original shapes and skeletons. However, for larger domain shift in Figure 5(c) and 5(d), they are reconstructed to source-like same digits but simultaneously some noises are removed. Specifically, in Figure 5(d), we can see that one target sample (SVHN) may contain more than one digits that are noises for recognition. After reconstruction, only the right digits are reconstructed. Some target samples may suffer from terrible illumination conditions but their reconstructed digits are very clear, which is amazing.
254
+
255
+ ![](images/c5f148db888d641992e5b170fed0b90b7901569b1c01614ca8392603fd460948.jpg)
256
+ Figure 5: Visualization of the target samples and their corresponding reconstructed target samples.
md/train/BklEFpEYwS/BklEFpEYwS.md ADDED
@@ -0,0 +1,500 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # META-LEARNING WITHOUT MEMORIZATION
2
+
3
+ Mingzhang $\mathbf { Y i n ^ { 1 2 } }$ , George Tucker2, Mingyuan Zhou1, Sergey Levine23, Chelsea Finn24 mzyin@utexas.edu, gjt@google.com, mingyuan.zhou@mccombs.utexas.edu svlevine@eecs.berkeley.edu, cbfinn@cs.stanford.edu 1UT Austin, 2Google Research, Brain team, 3UC Berkeley, 4Stanford
4
+
5
+ # ABSTRACT
6
+
7
+ The ability to learn new concepts with small amounts of data is a critical aspect of intelligence that has proven challenging for deep learning methods. Meta-learning has emerged as a promising technique for leveraging data from previous tasks to enable efficient learning of new tasks. However, most meta-learning algorithms implicitly require that the meta-training tasks be mutually-exclusive, such that no single model can solve all of the tasks at once. For example, when creating tasks for few-shot image classification, prior work uses a per-task random assignment of image classes to N-way classification labels. If this is not done, the meta-learner can ignore the task training data and learn a single model that performs all of the meta-training tasks zero-shot, but does not adapt effectively to new image classes. This requirement means that the user must take great care in designing the tasks, for example by shuffling labels or removing task identifying information from the inputs. In some domains, this makes meta-learning entirely inapplicable. In this paper, we address this challenge by designing a meta-regularization objective using information theory that places precedence on data-driven adaptation. This causes the meta-learner to decide what must be learned from the task training data and what should be inferred from the task testing input. By doing so, our algorithm can successfully use data from non-mutually-exclusive tasks to efficiently adapt to novel tasks. We demonstrate its applicability to both contextual and gradientbased meta-learning algorithms, and apply it in practical settings where applying standard meta-learning has been difficult. Our approach substantially outperforms standard meta-learning algorithms in these settings.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ The ability to learn new concepts and skills with small amounts of data is a critical aspect of intelligence that many machine learning systems lack. Meta-learning (Schmidhuber, 1987) has emerged as a promising approach for enabling systems to quickly learn new tasks by building upon experience from previous related tasks (Thrun & Pratt, 2012; Koch et al., 2015; Santoro et al., 2016; Ravi & Larochelle, 2016; Finn et al., 2017). Meta-learning accomplishes this by explicitly optimizing for few-shot generalization across a set of meta-training tasks. The meta-learner is trained such that, after being presented with a small task training set, it can accurately make predictions on test datapoints for that meta-training task.
12
+
13
+ While these methods have shown promising results, current methods require careful design of the meta-training tasks to prevent a subtle form of task overfitting, distinct from standard overfitting in supervised learning. If the task can be accurately inferred from the test input alone, then the task training data can be ignored while still achieving low meta-training loss. In effect, the model will collapse to one that makes zero-shot decisions. This presents an opportunity for overfitting where the meta-learner generalizes on meta-training tasks, but fails to adapt when presented with training data from novel tasks. We call this form of overfitting the memorization problem in meta-learning because the meta-learner memorizes a function that solves all of the meta-training tasks, rather than learning to adapt.
14
+
15
+ Existing meta-learning algorithms implicitly resolve this problem by carefully designing the metatraining tasks such that no single model can solve all tasks zero-shot; we call tasks constructed in this way mutually-exclusive. For example, for $N$ -way classification, each task consists of examples from $N$ randomly sampled classes. The $N$ classes are labeled from 1 to $N$ , and critically, for each task, we randomize the assignment of classes to labels $\{ 1 , 2 , \ldots , N \}$ (visualized in Appendix Figure 3). This ensures that the task-specific class-to-label assignment cannot be inferred from a test input alone. However, the mutually-exclusive tasks requirement places a substantial burden on the user to cleverly design the meta-training setup (e.g., by shuffling labels or omitting goal information). While shuffling labels provides a reasonable mechanism to force tasks to be mutually-exclusive with standard few-shot image classification datasets such as MiniImageNet (Ravi & Larochelle, 2016), this solution cannot be applied to all domains where we would like to utilize meta-learning. For example, consider meta-learning a pose predictor that can adapt to different objects: even if $N$ different objects are used for meta-training, a powerful model can simply learn to ignore the training set for each task, and directly learn to predict the pose of each of the $N$ objects. However, such a model would not be able to adapt to new objects at meta-test time.
16
+
17
+ The primary contributions of this work are: 1) to identify and formalize the memorization problem in meta-learning, and 2) to propose a meta-regularizer (MR) using information theory as a general approach for mitigating this problem without placing restrictions on the task distribution. We formally differentiate the meta-learning memorization problem from overfitting problem in conventional supervised learning, and empirically show that na¨ıve applications of standard regularization techniques do not solve the memorization problem in meta-learning. The key insight of our metaregularization approach is that the model acquired when memorizing tasks is more complex than the model that results from task-specific adaptation because the memorization model is a single model that simultaneously performs well on all tasks. It needs to contain all information in its weights needed to do well on test points without looking at training points. Therefore we would expect the information content of the weights of a memorization model to be larger, and hence the model should be more complex. As a result, we propose an objective that regularizes the information complexity of the meta-learned function class (motivated by Alemi et al. (2016); Achille & Soatto (2018)). Furthermore, we show that meta-regularization in MAML can be rigorously motivated by a PAC-Bayes bound on generalization. In a series of experiments on non-mutually-exclusive task distributions entailing both few-shot regression and classification, we find that memorization poses a significant challenge for both gradient-based (Finn et al., 2017) and contextual (Garnelo et al., 2018a) meta-learning methods, resulting in near random performance on test tasks in some cases. Our meta-regularization approach enables both of these methods to achieve efficient adaptation and generalization, leading to substantial performance gains across the board on non-mutually-exclusive tasks.
18
+
19
+ # 2 PRELIMINARIES
20
+
21
+ We focus on the standard supervised meta-learning problem (see, e.g., Finn et al. (2017)). Briefly, we assume tasks $\mathcal { T } _ { i }$ are sampled from a task distribution $p ( \mathcal { T } )$ . During meta-training, for each task, we observe a set of training data $\mathcal { D } _ { i } = ( \boldsymbol { \mathsf { x } } _ { i } , \boldsymbol { \mathsf { y } } _ { i } )$ and a set of test data $\mathcal { D } _ { i } ^ { * } = ( \boldsymbol { x } _ { i } ^ { * } , \boldsymbol { y } _ { i } ^ { * } )$ with $\pmb { x } _ { i } = ( x _ { i 1 } , \dots , x _ { i K } ) , \pmb { y } _ { i } = ( y _ { i 1 } , \bar { \dots } , y _ { i K } )$ sampled from $p ( x , y | \mathcal { T } _ { i } )$ , and similarly for $\mathcal { D } _ { i } ^ { * }$ . We denote the entire meta-training set as $\mathcal { M } = \{ \mathcal { D } _ { i } , \mathcal { D } _ { i } ^ { * } \} _ { i = 1 } ^ { N }$ . The goal of meta-training is to learn a model for a new task $\tau$ by leveraging what is learned during meta-training and a small amount of training data for the new task $\mathcal { D }$ . We use $\theta$ to denote the meta-parameters learned during meta-training and use $\phi$ to denote the task-specific parameters that are computed based on the task training data.
22
+
23
+ Following Grant et al. (2018); Gordon et al. (2018), given a meta-training set $\mathcal { M }$ , we consider meta-learning algorithms that maximize conditional likelihood $q ( \hat { y } ^ { * } = y ^ { * } | x ^ { * } , \theta , \mathcal { D } )$ , which is composed of three distributions: $q ( \theta | { \mathcal { M } } )$ that summarizes meta-training data into a distribution on metaparameters, $q ( \phi | \mathcal { D } , \theta )$ that summarizes the per-task training set into a distribution on task-specific parameters, and $q ( \hat { y } ^ { * } | x ^ { * } , \phi , \theta )$ that is the predictive distribution. These distributions are learned to minimize
24
+
25
+ $$
26
+ \begin{array} { r } { - \frac { 1 } { N } \sum _ { i } \mathbb { E } _ { q ( \theta | \mathcal { M } ) q ( \phi | \mathcal { D } _ { i } , \theta ) } \left[ \frac { 1 } { K } \sum _ { ( x ^ { * } , y ^ { * } ) \in \mathcal { D } _ { i } ^ { * } } \log q ( \hat { y } ^ { * } = y ^ { * } | x ^ { * } , \phi , \theta ) \right] . } \end{array}
27
+ $$
28
+
29
+ For example, in MAML (Finn et al., 2017), $\theta$ and $\phi$ are the weights of a predictor network, $q ( \theta | { \mathcal { M } } )$ is a delta function learned over the meta-training data, $q ( \phi | \mathcal { D } , \theta )$ is a delta function centered at a point defined by gradient optimization, and $\phi$ parameterizes the predictor network $q ( \hat { y } ^ { * } | x ^ { * } , \phi )$ (Grant et al., 2018). In particular, to determine the task-specific parameters $\phi$ , the task training data $\mathcal { D }$ and $\theta$ are used in the predictor model $\begin{array} { r } { \phi = \theta + \frac { \alpha } { K } \sum _ { ( x , y ) \in { \mathcal { D } } } \nabla _ { \theta } \log q ( y | x , \phi = \theta ) } \end{array}$ .
30
+
31
+ Another family of meta-learning algorithms are contextual methods (Santoro et al., 2016), such as conditional neural processes (CNP) (Garnelo et al., 2018b;a). CNP instead defines $q ( \phi | \mathcal { D } , \theta )$ as a mapping from $\mathcal { D }$ to a summary statistic $\phi$ (parameterized by $\theta$ ). In particular, $\phi = a _ { \theta } \circ h _ { \theta } ( \mathcal { D } )$ is the output of an aggregator $a _ { \theta } ( \cdot )$ applied to features $h _ { \theta } ( \mathcal { D } )$ extracted from the task training data. Then $\theta$ parameterizes a predictor network that takes $\phi$ and $x ^ { * }$ as input and produces a predictive distribution $\mathbf { \bar { \rho } } _ { q } ( \hat { y } ^ { * } | x ^ { * } , \phi , \theta )$ .
32
+
33
+ In the following sections, we describe a common pitfall for a variety of meta-learning algorithms, including MAML and CNP, and a general meta-regularization approach to prevent this pitfall.
34
+
35
+ # 3 THE MEMORIZATION PROBLEM IN META-LEARNING
36
+
37
+ The ideal meta-learning algorithm will learn in such a way that generalizes to novel tasks. However, we find that unless tasks are carefully designed, current meta-learning algorithms can overfit to the tasks and end up ignoring the task training data (i.e., either $q ( \phi | \mathcal { D } , \theta )$ does not depend on $\mathcal { D }$ or $q ( \hat { y } ^ { * } | x ^ { * } , \phi , \theta )$ does not depend on $\phi$ , as shown in Figure 1), which can lead to poor generalization. This memorization phenomenon is best understood through examples.
38
+
39
+ Consider a 3D object pose prediction problem (illustrated in Figure 1), where each object has a fixed canonical pose. The $( x , y )$ pairs for the task are 2D grey-scale images of the rotated object $( x )$ and the rotation angle relative to the fixed canonical pose for that object $( y )$ . In the most extreme case, for an unseen object, the task is impossible without using $\mathcal { D }$ because the canonical pose for the unseen object is unknown. The number of objects in the meta-training dataset is small, so it is straightforward for a single network to memorize the canonical pose for each training object and to infer the object from the input image (i.e., task overfitting), thus achieving a low training error without using $\mathcal { D }$ . However, by construction, this solution will necessarily have poor generalization to test tasks with unseen objects.
40
+
41
+ As another example, imagine an automated medical prescription system that suggests medication prescriptions to doctors based on patient symptoms and the patient’s previous record of prescription responses (i.e., medical history) for adaptation. In the meta-learning framework, each patient represents a separate task. Here, the symptoms and prescriptions have a close relationship, so we cannot assign random prescriptions to symptoms, in contrast to the classification tasks where we can randomly shuffle the labels to create mutually-exclusiveness. For this non-mutually-exclusive task distribution, a standard meta-learning system can memorize the patients’ identity information in the training, leading it to ignore the medical history and only utilize the symptoms combined with the memorized information. As a result, it may issue highly accurate prescriptions on the meta-training set, but fail to adapt to new patients effectively. While such a system would achieve a baseline level of accuracy for new patients, it would be no better than a standard supervised learning method applied to the pooled data.
42
+
43
+ We formally define (complete) memorization as:
44
+
45
+ Definition 1 (Complete Meta-Learning Memorization). Complete memorization in meta-learning is when the learned model ignores the task training data such that $I ( \hat { y } ^ { * } ; \mathcal { D } | x ^ { * } , \theta ) ~ = ~ 0$ (i.e., $q ( \hat { y } ^ { * } | x ^ { * } , \theta , \mathcal { D } ) = q ( \hat { y } ^ { * } | x ^ { * } , \theta ) = \mathbb { E } _ { \mathcal { D } ^ { \prime } | x ^ { * } } \left[ q ( \hat { y } ^ { * } | x ^ { * } , \theta , \mathcal { D } ^ { \prime } ) \right] )$ .
46
+
47
+ Memorization describes an issue with overfitting the meta-training tasks, but it does not preclude the network from generalizing to unseen $( x , y )$ pairs on the tasks similar to the training tasks. Memorization becomes an undesired problem for generalization to new tasks when $I ( y ^ { * } ; \bar { \mathcal { D } | } x ^ { * } ) \gg$ $I ( \hat { y } ^ { * } ; \mathcal { D } | x ^ { * } , \theta )$ (i.e., the task training data is necessary to achieve good performance, even with exact inference under the data generating distribution, to make accurate predictions).
48
+
49
+ A model with the memorization problem may generalize to new datapoints in training tasks but cannot generalize to novel tasks, which distinguishes it from typical overfitting in supervised learning. In practice, we find that MAML and CNP frequently converge to this memorization solution (Table 2). For MAML, memorization can occur when a particular setting of $\theta$ that does not adapt to the task training data can achieve comparable meta-training error to a solution that adapts $\theta$ . For example, if a setting of $\theta$ can solve all of the meta-training tasks (i.e., for all $( x , y )$ in $\mathcal { D }$ and ${ \mathcal { D } } ^ { * }$ the predictive error is close to zero), the optimization may converge to a stationary point of the MAML objective where minimal adaptation occurs based on the task training set (i.e., $\phi \approx \theta$ ). For a novel task where it is necessary to use the task training data, MAML can in principle still leverage the task training data because the adaptation step is based on gradient descent. However, in practice, the poor initialization of $\theta$ can affect the model’s ability to generalize from a small mount of data. For CNP, memorization can occur when the predictive distribution network $q ( \hat { y } ^ { * } | x ^ { * } , \phi , \theta )$ can achieve low training error without using the task training summary statistics $\phi$ . On a novel task, the network is not trained to use $\phi$ , so it is unable to use the information extracted from the task training set to effectively generalize.
50
+
51
+ In some problem domains, the memorization problem can be avoided by carefully constructing the tasks. For example, for $N$ -way classification, each task consists of examples from $N$ randomly sampled classes. If the classes are assigned to a random permutation of $N$ for each task, this ensures that the task-specific class-to-label assignment cannot be inferred from the test inputs alone. As a result, a model that ignores the task training data cannot achieve low training error, preventing convergence to the memorization problem. We refer to tasks constructed in this way as mutuallyexclusive. However, the mutually-exclusive tasks requirement places a substantial burden on the user to cleverly design the meta-training setup (e.g., by shuffling labels or omitting goal information) and cannot be applied to all domains where we would like to utilize meta-learning.
52
+
53
+ ![](images/5c5cb71629c85432f9f62f6bd971c50f3c70fb156ef91b77af13f919206ec83d.jpg)
54
+ Figure 1: Left: An example of non-mutually-exclusive pose prediction tasks, which may lead to the memorization problem. The training tasks are non-mutually-exclusive because the test data label (right) can be inferred accurately without using task training data (left) in the training tasks, by memorizing the canonical orientation of the meta-training objects. For a new object and canonical orientation (bottom), the task cannot be solved without using task training data (bottom left) to infer the canonical orientation. Right: Graphical model for meta-learning. Observed variables are shaded. Without either one of the dashed arrows, ${ \hat { Y } } ^ { * }$ is conditionally independent of $\mathcal { D }$ given $\theta$ and $X ^ { * }$ , which we refer to as complete memorization (Definition 1).
55
+
56
+ # 4 META REGULARIZATION USING INFORMATION THEORY
57
+
58
+ At a high level, the sources of information in the predictive distribution $q ( \hat { y } ^ { * } | x ^ { * } , \theta , \mathcal { D } )$ come from the input, the meta-parameters, and the data. The memorization problem occurs when the model encodes task information in the predictive network that is readily available from the task training set (i.e., it memorizes the task information for each meta-training task). We could resolve this problem by encouraging the model to minimize the training error and to rely on the task training dataset as much as possible for the prediction of $y ^ { * }$ (i.e., to maximize $I ( \hat { y } ^ { * } ; \mathcal { D } | x ^ { * } , \theta ) )$ . Explicitly maximizing $I ( \hat { y } ^ { * } ; D | x ^ { * } , \theta )$ requires an intractable marginalization over task training sets to compute $\boldsymbol { q } ( \boldsymbol { \hat { y } } ^ { * } | \boldsymbol { x } ^ { * } , \boldsymbol { \theta } )$ . Instead, we can implicitly encourage it by restricting the information flow from other sources $\boldsymbol { x } ^ { * }$ and $\theta$ ) to $\hat { y } ^ { * }$ . To achieve both low error and low mutual information between $\hat { y } ^ { * }$ and $( x ^ { * } , \theta )$ , the model must use task training data $\mathcal { D }$ to make predictions, hence increasing the mutual information $I ( \hat { y } ^ { * } ; \mathcal { D } | x ^ { * } , \theta )$ , leading to reduced memorization. In this section, we describe two tractable ways to achieve this.
59
+
60
+ # 4.1 META REGULARIZATION ON ACTIVATIONS
61
+
62
+ Given $\theta$ , the statistical dependency between $x ^ { * }$ and $\hat { y } ^ { * }$ is controlled by the direct path from $x ^ { * }$ to $\hat { y } ^ { * }$ and the indirect path through $\mathcal { D }$ (see Figure 1), where the latter is desirable because it leverages the task training data. We can control the information flow between $x ^ { * }$ and $\hat { y } ^ { * }$ by introducing an intermediate stochastic bottleneck variable $z ^ { * }$ such that $q ( \hat { y } ^ { * } | x ^ { * } , \phi , \theta ) \ =$ $\begin{array} { r } { \int q ( \hat { y } ^ { * } | z ^ { * } , \phi , \theta ) q ( \zeta ^ { * } | x ^ { * } , \theta ) \ d z ^ { * } } \end{array}$ (Alemi et al., 2016) as shown in Figure 4. Now, we would like to maximize $I ( \hat { y } ^ { * } ; \mathcal { D } | z ^ { * } , \theta )$ to prevent memorization. We can bound this mutual information by
63
+
64
+ $$
65
+ \begin{array} { r l } & { \quad I ( \hat { y } ^ { * } ; \mathcal { D } | z ^ { * } , \theta ) } \\ & { \geq I ( x ^ { * } ; \hat { y } ^ { * } | \theta , z ^ { * } ) = I ( x ^ { * } ; \hat { y } ^ { * } | \theta ) - I ( x ^ { * } ; z ^ { * } | \theta ) + I ( x ^ { * } ; z ^ { * } | \hat { y } ^ { * } , \theta ) } \\ & { \geq I ( x ^ { * } ; \hat { y } ^ { * } | \theta ) - I ( x ^ { * } ; z ^ { * } | \theta ) } \\ & { = I ( x ^ { * } ; \hat { y } ^ { * } | \theta ) - \mathbb { E } _ { p ( x ^ { * } ) q ( z ^ { * } | x ^ { * } , \theta ) } \left[ \log \frac { q ( z ^ { * } | x ^ { * } , \theta ) } { q ( z ^ { * } | \theta ) } \right] } \\ & { \geq I ( x ^ { * } ; \hat { y } ^ { * } | \theta ) - \mathbb { E } \left[ \log \frac { q ( z ^ { * } | x ^ { * } , \theta ) } { r ( z ^ { * } ) } \right] = I ( x ^ { * } ; \hat { y } ^ { * } | \theta ) - \mathbb { E } \left[ D _ { \mathrm { K L } } ( q ( z ^ { * } | x ^ { * } , \theta ) | | r ( z ^ { * } ) ) \right] } \end{array}
66
+ $$
67
+
68
+ where $r ( z ^ { * } )$ is a variational approximation to the marginal, the first inequality follows from the statistical dependencies in our model (see Figure 4 and Appendix A.2 for the proof). By simultaneously minimizing $\mathbb { E } \left[ D _ { \mathrm { K L } } \big ( q ( z ^ { * } | x ^ { * } , \theta ) | | r ( z ^ { * } ) \big ) \right]$ and maximizing the mutual information $I ( x ^ { * } ; \hat { y } ^ { * } | \theta )$ , we can implicitly encourage the model to use the task training data $\mathcal { D }$ .
69
+
70
+ For non-mutually-exclusive problems, the true label $y ^ { * }$ is dependent on $x ^ { * }$ . If the model has the memorization problem and $\bar { I } ( x ^ { * } ; \hat { y } ^ { * } | \theta ) = 0$ , then $q ( \boldsymbol { \hat { y } } ^ { * } | \boldsymbol { x } ^ { * } , \boldsymbol { \hat { \theta } } , \mathcal { D } ) = q ( \boldsymbol { \hat { y } } ^ { * } | \boldsymbol { x } ^ { * } , \boldsymbol { \theta } ) = q ( \boldsymbol { \hat { y } } ^ { * } | \boldsymbol { \theta } )$ , which means the model predictions do not depend on $x ^ { * }$ or $\mathcal { D }$ . Hence, in practical problems, the predictions generated from the model will have low accuracy.
71
+
72
+ This suggests minimizing the training loss in Eq. (1) can increase $I ( \hat { y } ^ { * } ; \mathcal { D } | x ^ { * } , \theta )$ or $I ( x ^ { * } ; \hat { y } ^ { * } | \theta )$ . Replacing the maximization of $I ( x ^ { * } ; \hat { y } ^ { * } | \theta )$ in Eq. (2) with minimizing the training loss results in the following regularized training objective
73
+
74
+ $$
75
+ \begin{array} { r } { \frac { 1 } { N } \sum _ { i } \mathbb { E } _ { q ( \theta | M ) q ( \phi | \mathcal { D } _ { i } , \theta ) } \left[ - \frac { 1 } { K } \displaystyle \sum _ { ( x ^ { * } , y ^ { * } ) \in \mathcal { D } _ { i } ^ { * } } \log q ( \hat { y } ^ { * } = y ^ { * } | x ^ { * } , \phi , \theta ) + \beta D _ { \mathrm { K L } } ( q ( z ^ { * } | x ^ { * } , \theta ) | | r ( z ^ { * } ) ) \right] } \end{array}
76
+ $$
77
+
78
+ where $\log q ( \hat { y } ^ { \ast } | x ^ { \ast } , \phi , \theta )$ is estimated by $\log q ( \hat { y } ^ { \ast } | z ^ { \ast } , \phi , \theta )$ with $z ^ { * } \sim q ( z ^ { * } | x ^ { * } , \theta )$ , $\beta$ modulates the regularizer and $r ( z ^ { * } )$ can be set as $\mathcal { N } ( z ^ { * } ; 0 , I )$ . We refer to this regularizer as meta-regularization (MR) on the activations.
79
+
80
+ As we demonstrate in Section 6, we find that this regularizer performs well, but in some cases can fail to prevent the memorization problem. Our hypothesis is that in these cases, the network can sidestep the information constraint by storing the prediction of $y ^ { * }$ in a part of $z ^ { * }$ , which incurs a small penalty in Eq. (3) and small lower bound in Eq. (2).
81
+
82
+ # 4.2 META REGULARIZATION ON WEIGHTS
83
+
84
+ Alternatively, we can penalize the task information stored in the meta-parameters $\theta$ . Here, we provide an informal argument and provide the complete argument in Appendix A.3. Analogous to the supervised setting (Achille & Soatto, 2018), given meta-training dataset $\mathcal { M }$ , we consider $\theta$ as random variable where the randomness can be introduced by training stochasticity. We model the stochasticity over $\theta$ with a Gaussian distribution $\mathcal { N } ( \boldsymbol { \theta } ; \boldsymbol { \theta } _ { \mu } , \boldsymbol { \theta } _ { \sigma } )$ with learned mean and variance parameters per dimension (Blundell et al., 2015; Achille & Soatto, 2018). By penalizing $I ( y _ { 1 : N } ^ { * } , \mathcal { D } _ { 1 : N } ; \theta | x _ { 1 : N } ^ { * } )$ , we can limit the information about the training tasks stored in the metaparameters $\theta$ and thus require the network to use the task training data to make accurate predictions. We can tractably upper bound it by
85
+
86
+ $$
87
+ \begin{array} { r } { I ( y _ { 1 : N } ^ { * } , \mathcal { D } _ { 1 : N } ; \theta | x _ { 1 : N } ^ { * } ) = \mathbb { E } \left[ \log \frac { q ( \theta | \mathcal { M } ) } { q ( \theta | x _ { 1 : N } ^ { * } ) } \right] \leq \mathbb { E } \left[ \mathcal { D } _ { \mathrm { K L } } \left( q ( \theta | \mathcal { M } ) \| r ( \theta ) \right) \right] , } \end{array}
88
+ $$
89
+
90
+ where $r ( \theta )$ is a variational approximation to the marginal, which we set to $\mathcal { N } ( \theta ; 0 , I )$ . In practice, we apply meta-regularization to the meta-parameters $\theta$ that are not used to adapt to the task training data and denote the other parameters as $\tilde { \theta }$ . In this way, we control the complexity of the network that can predict the test labels without using task training data, but we do not limit the complexity of the network that processes the task training data. Our final meta-regularized objective can be written as
91
+
92
+ $$
93
+ \begin{array} { r } { \frac { 1 } { N } \sum _ { i } \mathbb { E } _ { q ( \theta ; \theta _ { i } , \theta _ { \sigma } ) q ( \delta ) | \mathcal { D } _ { i } , \bar { \theta } ) } \left[ - \frac { 1 } { K } \displaystyle \sum _ { ( x ^ { * } , y ^ { * } ) \in \mathcal { D } _ { \bar { \epsilon } } ^ { * } } \log q ( \hat { y } ^ { * } = y ^ { * } | x ^ { * } , \phi , \theta , \tilde { \theta } ) + \beta D _ { \mathrm { K L } } ( q ( \theta ; \theta _ { \mu } , \theta _ { \sigma } ) | | r ( \theta ) ) \right] } \end{array}
94
+ $$
95
+
96
+ For MAML, we apply meta-regularization to the parameters uninvolved in the task adaptation. For CNP, we apply meta-regularization to the encoder parameters. The detailed algorithms are shown in Algorithm 1 and 2 in the appendix.
97
+
98
+ # 4.3 DOES META REGULARIZATION LEAD TO BETTER GENERALIZATION?
99
+
100
+ Now that we have derived meta regularization approaches for mitigating the memorization problem, we theoretically analyze whether meta regularization leads to better generalization via a PAC-Bayes bound. In particular, we study meta regularization (MR) on the weights (W) of MAML, i.e. MRMAML (W), as a case study.
101
+
102
+ Meta regularization on the weights of MAML uses a Gaussian distribution $\mathcal { N } ( \boldsymbol { \theta } ; \boldsymbol { \theta } _ { \mu } , \boldsymbol { \theta } _ { \sigma } )$ to model the stochasticity in the weights. Given a task and task training data, the expected error is given by
103
+
104
+ $$
105
+ e r ( \theta _ { \mu } , \theta _ { \sigma } , \mathcal { D } , \mathcal { T } ) = \mathbb { E } _ { \theta \sim \mathcal { N } ( \theta ; \theta _ { \mu } , \theta _ { \sigma } ) , \phi \sim q ( \phi | \theta , \mathcal { D } ) , ( x ^ { * } , y ^ { * } ) \sim p ( x , y | \mathcal { T } ) } \left[ \mathcal { L } ( x ^ { * } , y ^ { * } , \phi ) \right] ,
106
+ $$
107
+
108
+ where the prediction loss $\mathcal { L } ( x ^ { * } , y ^ { * } , \phi _ { i } )$ is bounded1. Then, we would like to minimize the error on novel tasks
109
+
110
+ $$
111
+ e r ( \theta _ { \mu } , \theta _ { \sigma } ) = \mathbb { E } _ { \mathcal { T } \sim p ( \mathcal { T } ) , \mathcal { D } \sim p ( x , y | \mathcal { T } ) } \left[ e r ( \theta _ { \mu } , \theta _ { \sigma } , \mathcal { D } , \mathcal { T } ) \right]
112
+ $$
113
+
114
+ We only have a finite sample of training tasks, so computing $e r ( Q )$ is intractable, but we can form an empirical estimate:
115
+
116
+ $$
117
+ \begin{array} { l } { { \displaystyle \quad \displaystyle \hat { e r } ( \theta _ { \mu } , \theta _ { \sigma } , \mathcal { D } _ { 1 } , \mathcal { D } _ { 1 } ^ { * } , . . . , \mathcal { D } _ { n } , \mathcal { D } _ { n } ^ { * } ) } } \\ { \displaystyle = \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \underbrace { \mathbb { E } _ { \theta \sim \mathcal { N } ( \theta ; \theta _ { \mu } , \theta _ { \sigma } ) , \phi _ { i } \sim q ( \phi | \theta , \mathcal { D } _ { i } ) } \left[ - \frac { 1 } { K } \sum _ { ( x ^ { * } , y ^ { * } ) \in \mathcal { D } _ { i } ^ { * } } \log q ( \hat { y } ^ { * } = y ^ { * } | x ^ { * } , \phi _ { i } ) \right] } _ { \displaystyle \hat { e r } ( \theta _ { \mu } , \theta _ { \sigma } , \mathcal { D } _ { i } , \mathcal { D } _ { i } ^ { * } ) } } \end{array}
118
+ $$
119
+
120
+ where for exposition we have assumed $| \mathcal { D } _ { i } ^ { * } | = K$ are the same for all tasks. We would like to relate $e r ( \theta _ { \mu } , \theta _ { \sigma } )$ and $\hat { e r } ( \theta _ { \mu } , \theta _ { \sigma } , \mathcal { D } _ { 1 } , \mathcal { D } _ { 1 } ^ { * } , . . . , \mathcal { D } _ { n } , \mathcal { D } _ { n } ^ { * } )$ , but the challenge is that $\theta _ { \mu }$ and $\theta _ { \sigma }$ are derived from the meta-training tasks $\mathcal { D } _ { 1 } , \mathcal { D } _ { 1 } ^ { * } , . . . , \mathcal { D } _ { n } , \mathcal { D } _ { n } ^ { * }$ . There are two sources of generalization error: (i) error due to the finite number of observed tasks and (ii) error due to the finite number of examples observed per task. Closely following the arguments in (Amit & Meir, 2018), we apply a standard PAC-Bayes bound to each of these and combine the results with a union bound, resulting in the following Theorem.
121
+
122
+ Theorem 1. Let $P ( \theta )$ be an arbitrary prior distribution over $\theta$ that does not depend on the metatraining data. Then for any $\delta \in ( 0 , 1 ]$ , with probability at least $1 - \delta$ , the following inequality holds uniformly for all choices of $\theta _ { \mu }$ and $\theta _ { \sigma }$ ,
123
+
124
+ $$
125
+ \begin{array} { l } { \displaystyle e r ( \theta _ { \mu } , \theta _ { \sigma } ) \leq \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \hat { e } r ( \theta _ { \mu } , \theta _ { \sigma } , \mathcal { D } _ { i } , \mathcal { D } _ { i } ^ { * } ) + } \\ { \displaystyle \left( \sqrt { \frac { 1 } { 2 ( K - 1 ) } } + \sqrt { \frac { 1 } { 2 ( n - 1 ) } } \right) \sqrt { D _ { K L } ( \mathcal { N } ( \theta ; \theta _ { \mu } , \theta _ { \sigma } ) | | P ) + \log \frac { n ( K + 1 ) } { \delta } } , } \end{array}
126
+ $$
127
+
128
+ where n is the number of meta-training tasks and $K$ is the number of per-task validation datapoints.
129
+
130
+ We defer the proof to the Appendix A.4. The key difference from the result in (Amit & Meir, 2018) is that we leverage the fact that the task training data is split into training and validation.
131
+
132
+ In practice, we set $P ( \theta ) = r ( \theta ) = \mathcal { N } ( \theta ; 0 , I )$ . If we can achieve a low value for the bound, then with high probability, our test error will also be low. As shown in the Appendix A.4, by a first order Taylor expansion of the the second term of the RHS in Eq.(9) and setting the coefficient of the KL√ √ term as β = 1/2(K−1)+ 1/2(n−1)√ , we recover the MR-MAML(W) objective (Eq.(5)). $\beta$ tradesoff between the tightness of the generalization bound and the probability that it holds true. The result of this bound suggests that the proposed meta-regularization on weights does indeed improve generalization on the meta-test set.
133
+
134
+ # 5 RELATED WORK
135
+
136
+ Previous works have developed approaches for mitigating various forms of overfitting in metalearning. These approaches aim to improve generalization in several ways: by reducing the number of parameters that are adapted in MAML (Zintgraf et al., 2019), by compressing the task embedding (Lee et al., 2019), through data augmentation from a GAN (Zhang et al., 2018), by using an auxiliary objective on task gradients (Guiroy et al., 2019), and via an entropy regularization objective (Jamal & Qi, 2019). These methods all focus on the setting with mutually-exclusive task distributions. We instead recognize and formalize the memorization problem, a particular form of overfitting that manifests itself with non-mutually-exclusive tasks, and offer a general and principled solution. Unlike prior methods, our approach is applicable to both contextual and gradientbased meta-learning methods. We additionally validate that prior regularization approaches, namely TAML (Jamal & Qi, 2019), are not effective for addressing this problem setting.
137
+
138
+ Our derivation uses a Bayesian interpretation of meta-learning (Tenenbaum, 1999; Fei-Fei et al., 2003; Edwards & Storkey, 2016; Grant et al., 2018; Gordon et al., 2018; Finn et al., 2018; Kim et al., 2018; Harrison et al., 2018). Some Bayesian meta-learning approaches place a distributional loss on the inferred task variables to constrain them to a prior distribution (Garnelo et al., 2018b; Gordon et al., 2018; Rakelly et al., 2019), which amounts to an information bottleneck on the latent task variables. Similarly Zintgraf et al. (2019); Lee et al. (2019); Guiroy et al. (2019) aim to produce simpler or more compressed task adaptation processes. Our approach does the opposite, penalizing information from the inputs and parameters, to encourage the task-specific variables to contain greater information driven by the per-task data.
139
+
140
+ We use PAC-Bayes theory to study the generalization error of meta-learning and meta-regularization. Pentina & Lampert (2014) extends the single task PAC-Bayes bound (McAllester, 1999) to the multitask setting, which quantifies the gap between empirical error on training tasks and the expected error on new tasks. More recent research shows that, with tightened generalization bounds as the training objective, the algorithms can reduce the test error for mutually-exclusive tasks (Galanti et al., 2016; Amit & Meir, 2018). Our analysis is different from these prior works in that we only include preupdate meta parameters in the generalization bound rather than both pre-update and post-update parameters. In the derivation, we also explicitly consider the splitting of data into the task training set and task validation set, which is aligned with the practical setting.
141
+
142
+ The memorization problem differs from overfitting in conventional supervised learning in several aspects. First, memorization occurs at the task level rather than datapoint level and the model memorizes functions rather than labels. In particular, within a training task, the model can generalize to new datapoints, but it fails to generalize to new tasks. Second, the source of information for achieving generalization is different. For meta-learning the information is from both the meta-training data and new task training data but in standard supervised setting the information is only from training data. Finally, the aim of regularization is different. In the conventional supervised setting, regularization methods such as weight decay (Krogh & Hertz, 1992), dropout (Srivastava et al., 2014), the information bottleneck (Tishby et al., 2000; Tishby & Zaslavsky, 2015), and Bayes-by-Backprop (Blundell et al., 2015) are used to balance the network complexity and the information in the data. The aim of meta-regularization is different. It governs the model complexity to avoid one complex model solving all tasks, while allowing the model’s dependency on the task data to be complex. We further empirically validate this difference, finding that standard regularization techniques do not solve the memorization problem.
143
+
144
+ # 6 EXPERIMENTS
145
+
146
+ In the experimental evaluation, we aim to answer the following questions: (1) How prevalent is the memorization problem across different algorithms and domains? (2) How does the memorization problem affect the performance of algorithms on non-mutually-exclusive task distributions? (3) Is our meta-regularization approach effective for mitigating the problem and is it compatible with multiple types of meta-learning algorithms? (4) Is the problem of memorization empirically distinct from that of the standard overfitting problem?
147
+
148
+ To answer these questions, we propose several meta-learning problems involving non-mutuallyexclusive task distributions, including two problems that are adapted from prior benchmarks with mutually-exclusive task distributions. We consider model-agnostic meta-learning (MAML) and conditional neural processes (CNP) as representative meta-learning algorithms. We study both variants of our method in combination with MAML and CNP. When comparing with meta-learning algorithms with and without meta-regularization, we use the same neural network architecture, while other hyperparameters are tuned via cross-validation per-problem.
149
+
150
+ # 6.1 SINUSOID REGRESSION
151
+
152
+ First, we consider a toy sinusoid regression problem that is non-mutually-exclusive. The data for each task is created in the following way: the amplitude $A$ of the sinusoid is uniformly sampled from a set of 20 equally-spaced points $\{ 0 . 1 , 0 . 3 , \cdot \cdot \cdot , 4 \}$ ; $u$ is sampled uniformly from $[ - 5 , 5 ]$ and $y$ is sampled from $\bar { \mathcal { N } } ( A \bar { \sin ( u ) } , 0 . \bar { 1 } ^ { 2 } )$ . We provide both $u$ and the amplitude $A$ (as a one-hot vector) as input, i.e. $x = ( u , { \dot { A } } )$ . At the test time, we expand the range of the tasks by randomly sampling the data-generating amplitude $A$ uniformly from [0.1, 4] and use a random one-hot vector for the input to the network. The meta-training tasks are a proper subset of the meta-test tasks.
153
+
154
+ Without the additional amplitude input, both MAML and CNP can easily solve the task and generalize to the meta-test tasks. However, once we add the additional amplitude input which indicates the task identity, we find that both MAML and CNP converge to the complete memorization solution and fail to generalize well to test data (Table 1 and Appendix Figures 7 and 8). Both meta-regularized MAML and CNP (MR-MAML) and (MR-CNP) instead converge to a solution that adapts to the data, and as a result, greatly outperform the unregularized methods.
155
+
156
+ Table 1: Test MSE for the non-mutually-exclusive sinusoid regression problem. We compare MAML and CNP against meta-regularized MAML (MR-MAML) and meta-regularized CNP (MR-CNP) where regularization is either on the activations (A) or the weights (W). We report the mean over 5 trials and the standard deviation in parentheses.
157
+
158
+ <table><tr><td>Methods</td><td>MAML</td><td>MR-MAML (A) MR-MAML (W) (ours)</td><td>(ours)</td><td>CNP</td><td>MR-CNP (A) (ours)</td><td>MR-CNP (W) (ours)</td></tr><tr><td>5 shot</td><td>0.46 (0.04)</td><td>0.17 (0.03)</td><td>0.16 (0.04)</td><td>0.91 (0.10)</td><td>0.10 (0.01)</td><td>0.11 (0.02)</td></tr><tr><td>10 shot</td><td>0.13 (0.01)</td><td>0.07 (0.02)</td><td>0.06 (0.01)</td><td>0.92 (0.05)</td><td>0.09 (0.01)</td><td>0.09 (0.01)</td></tr></table>
159
+
160
+ # 6.2 POSE PREDICTION
161
+
162
+ To illustrate the memorization problem on a more realistic task, we create a multi-task regression dataset based on the Pascal 3D data (Xiang et al., 2014) (See Appendix A.5.1 for a complete description). We randomly select 50 objects for meta-training and the other 15 objects for meta-testing. For each object, we use MuJoCo (Todorov et al., 2012) to render images with random orientations of the instance on a table, visualized in Figure 1. For the meta-learning algorithm, the observation $( x )$ is the $1 2 8 \times 1 2 8$ gray-scale image and the label $( y )$ is the orientation relative to a fixed canonical pose. Because the number of objects in the meta-training dataset is small, it is straightforward for a single network to memorize the canonical pose for each training object and to infer the orientation from the input image, thus achieving a low meta-training error without using $\mathcal { D }$ . However, this solution performs poorly at the test time because it has not seen the novel objects and their canonical poses.
163
+
164
+ Optimization modes and hyperparameter sensitivity. We choose the learning rate from $\{ 0 . 0 0 0 1 $ , $0 . 0 0 0 5 , 0 . 0 0 1 \}$ for each method, $\beta$ from $\{ 1 0 ^ { - 6 } , 1 0 ^ { - 5 } , \cdot \cdot \cdot , 1 \}$ for meta-regularization and report the results with the best hyperparameters (as measured on the meta-validation set) for each method. In this domain, we find that the convergence point of the meta-learning algorithm is determined by both the optimization landscape of the objective and the training dynamics, which vary due to stochastic gradients and the random initialization. In particular, we observe that there are two modes of the objective, one that corresponds to complete memorization and one that corresponds to successful adaptation to the task data. As illustrated in the Appendix, we find that models that converge to a memorization solution have lower training error than solutions which use the task training data, indicating a clear need for meta-regularization. When the meta-regularization is on the activations, the solution that the algorithms converge to depends on the learning rate, while MR on the weights consistently converges to the adaptation solution (See Appendix Figure 9 for the sensitivity analysis). This suggests that MR on the activations is not always successful at preventing memorization. Our hypothesis is that there exists a solution in which the bottlenecked activations encode only the prediction $y ^ { * }$ , and discard other information. Such a solution can achieve both low training MSE and low regularization loss without using task training data, particularly if the predicted label contains a small number of bits (i.e., because the activations will have low information complexity).
165
+
166
+ However, note that this solution does not achieve low regularization error when applying MR to the weights because the function needed to produce the predicted label does not have low information complexity. As a result, meta-regularization on the weights does not suffer from this pathology and is robust to different learning rates. Therefore, we will use regularization on weights as the proposed methodology in the following experiments and algorithms in Appendix A.1.
167
+
168
+ Quantitative results. We compare MAML and CNP with their meta-regularized versions (Table 2). We additionally include fine-tuning as baseline, which trains a single network on all the instances jointly, and then fine-tunes on the task training data. Meta-learning with meta-regularization (on weights) outperforms all competing methods by a large margin. We show test error as a function of the meta-regularization coefficient $\beta$ in Appendix Figure 2. The curve reflects the trade-off when changing the amount of information contained in the weights. This indicates that $\beta$ gives a knob that allows us to tune the degree to which the model uses the data to adapt versus relying on the prior.
169
+
170
+ ![](images/5eb44794ca4943d1fcf6fe10b09a7f85a5c4989f737b7ecaa28241d3e651f1dc.jpg)
171
+ Figure 2: The performance of MAML and CNP with meta-regularization on the weights, as a function of the regularization strength $\beta$ . We observe $\beta$ provides us a knob with which we can control the degree to which the algorithm adapts versus memorizes. When $\beta$ is small, we observe memorization, leading to large test error; when $\beta$ is too large, the network does not store enough information in the weights to perform the task. Crucially, in the middle of these two extremes, meta-regularization is effective in inducing adaptation, leading to good generalization. The plot shows the mean and standard deviation across 5 meta-training runs.
172
+
173
+ Table 2: Meta-test MSE for the pose prediction problem. We compare MR-MAML (ours) with conventional MAML and fine-tuning (FT). We report the average over 5 trials and standard deviation in parentheses.
174
+
175
+ <table><tr><td>Method</td><td>MAML</td><td>MR-MAML (W) (ours)</td><td>CNP</td><td>MR-CNP (W) (ours)</td><td>FT</td><td>FT + Weight Decay</td></tr><tr><td>MSE</td><td>5.39 (1.31)</td><td>2.26 (0.09)</td><td>8.48 (0.12)</td><td>2.89 (0.18)</td><td>7.33 (0.35)</td><td>6.16 (0.12)</td></tr></table>
176
+
177
+ Comparison to standard regularization. We compare our meta-regularization with standard regularization techniques, weight decay (Krogh & Hertz, 1992) and Bayes-by-Backprop (Blundell et al., 2015), in Table 3. We observe that simply applying standard regularization to all the weights, as in conventional supervised learning, does not solve the memorization problem, which validates that the memorization problem differs from the standard overfitting problem.
178
+
179
+ Table 3: Meta-testing MSE for the pose prediction problem. We compare MR-CNP (ours) with conventional CNP, CNP with weight decay, and CNP with Bayes-by-Backprop (BbB) regularization on all the weights. We report the average over 5 trials and standard deviation in parentheses.
180
+
181
+ <table><tr><td>Methods</td><td>CNP</td><td>CNP + Weight Decay</td><td>CNP + BbB</td><td>MR-CNP (W) (ours)</td></tr><tr><td>MSE</td><td>8.48 (0.12)</td><td>6.86 (0.27)</td><td>7.73 (0.82)</td><td>2.89 (0.18)</td></tr></table>
182
+
183
+ # 6.3 OMNIGLOT AND MINIIMAGENET CLASSIFICATION
184
+
185
+ Next, we study memorization in the few-shot classification problem by adapting the few-shot Omniglot (Lake et al., 2011) and MiniImagenet (Ravi & Larochelle, 2016; Vinyals et al., 2016) benchmarks to the non-mutually-exclusive setting. In the non-mutually-exclusive N-way K-shot classification problem, each class is (randomly) assigned a fixed classification label from 1 to N. For each task, we randomly select a corresponding class for each classification label and $K$ task training data points and $K$ task test data points from that class2. This ensures that each class takes only one classification label across tasks and different tasks are non-mutually-exclusive (See Appendix A.5.2 for details).
186
+
187
+ We evaluate MAML, TAML (Jamal & Qi, 2019), MR-MAML (ours), fine-tuning, and a nearest neighbor baseline on non-mutually-exclusive classification tasks (Table 4). We find that MR-MAML significantly outperforms previous methods on all of these tasks. To better understand the problem, for the MAML variants, we calculate the pre-update accuracy (before adaptation on the task training data) on the meta-training data in Appendix Table 5. The high pre-update meta-training accuracy and low meta-test accuracy are evidence of the memorization problem for MAML and TAML, indicating that it is learning a model that ignores the task data. In contrast, MR-MAML successfully controls the pre-update accuracy to be near chance and encourages the learner to use the task training data to achieve low meta-training error, resulting in good performance at meta-test time.
188
+
189
+ Finally, we verify that meta-regularization does not degrade performance on the standard mutuallyexclusive task. We evaluate performance as a function of regularization strength on the standard 20-way 1-shot Omniglot task (Appendix Figure 10), and we find that small values of $\beta$ lead to slight improvements over MAML. This indicates that meta-regularization substantially improves performance in the non-mutually-exclusive setting without degrading performance in other settings.
190
+
191
+ Table 4: Meta-test accuracy on non-mutually-exclusive (NME) classification. The fine-tuning and nearestneighbor baseline results for MiniImagenet are from (Ravi & Larochelle, 2016).
192
+
193
+ <table><tr><td>NME Omniglot</td><td>20-way 1-shot</td><td>20-way 5-shot</td></tr><tr><td>MAML</td><td>7.8 (0.2)%</td><td>50.7 (22.9)%</td></tr><tr><td>TAML (Jamal &amp; Qi,2019)</td><td>9.6 (2.3)%</td><td>67.9 (2.3)%</td></tr><tr><td>MR-MAML (W) (ours)</td><td>83.3 (0.8)%</td><td>94.1 (0.1)%</td></tr></table>
194
+
195
+ <table><tr><td>NME Minilmagenet</td><td></td><td>5-way 1-shot 5-way 5-shot</td></tr><tr><td>Fine-tuning</td><td>28.9 (0.5))%</td><td>49.8 (0.8))%</td></tr><tr><td>Nearest-neighbor</td><td>41.1 (0.7)%</td><td>51.0 (0.7) %</td></tr><tr><td>MAML</td><td>26.3 (0.7)%</td><td>41.6 (2.6)%</td></tr><tr><td>TAML (Jamal &amp; Qi, 2019)</td><td>26.1 (0.6)%</td><td>44.2 (1.7)%</td></tr><tr><td>MR-MAML (W) (ours)</td><td>43.6 (0.6)%</td><td>53.8 (0.9)%</td></tr></table>
196
+
197
+ # 7 CONCLUSION AND DISCUSSION
198
+
199
+ Meta-learning has achieved remarkable success in few-shot learning problems. However, we identify a pitfall of current algorithms: the need to create task distributions that are mutually exclusive. This requirement restricts the domains that meta-learning can be applied to. We formalize the failure mode, i.e. the memorization problem, that results from training on non-mutually-exclusive tasks and distinguish it as a function-level overfitting problem compared to the the standard label-level overfitting in supervised learning.
200
+
201
+ We illustrate the memorization problem with different meta-learning algorithms on a number of domains. To address the problem, we propose an algorithm-agnostic meta-regularization (MR) approach that leverages an information-theoretic perspective of the problem. The key idea is that by placing a soft restriction on the information flow from meta-parameters in prediction of test set labels, we can encourage the meta-learner to use task training data during meta-training. We achieve this by successfully controlling the complexity of model prior to the task adaptation.
202
+
203
+ The memorization issue is quite broad and is likely to occur in a wide range of real-world applications, for example, personalized speech recognition systems, learning robots that can adapt to different environments (Nagabandi et al., 2018), and learning goal-conditioned manipulation skills using trial-and-error data. Further, this challenge may also be prevalent in other conditional prediction problems, beyond meta-learning, an interesting direction for future study. By both recognizing the challenge of memorization and developing a general and lightweight approach for solving it, we believe that this work represents an important step towards making meta-learning algorithms applicable to and effective on any problem domain.
204
+
205
+ # ACKNOWLEDGEMENT
206
+
207
+ The authors would like to thank Alexander A. Alemi, Kevin Murphy, Luke Metz, Abhishek Kumar and the anonymous reviewers for helpful discussions and feedback. M. Yin and M. Zhou acknowledge the support of the U.S. National Science Foundation under Grant IIS-1812699.
208
+
209
+ # REFERENCES
210
+
211
+ Alessandro Achille and Stefano Soatto. Emergence of invariance and disentanglement in deep representations. The Journal of Machine Learning Research, 19(1):1947–1980, 2018.
212
+
213
+ Alexander A Alemi, Ian Fischer, Joshua V Dillon, and Kevin Murphy. Deep variational information bottleneck. arXiv preprint arXiv:1612.00410, 2016.
214
+
215
+ Ron Amit and Ron Meir. Meta-learning by adjusting priors based on extended pac-bayes theory. In International Conference on Machine Learning, pp. 205–214, 2018.
216
+
217
+ Charles Blundell, Julien Cornebise, Koray Kavukcuoglu, and Daan Wierstra. Weight uncertainty in neural networks. arXiv preprint arXiv:1505.05424, 2015.
218
+
219
+ Thomas M Cover and Joy A Thomas. Elements of information theory. John Wiley & Sons, 2012.
220
+
221
+ Harrison Edwards and Amos Storkey. Towards a neural statistician. arXiv preprint arXiv:1606.02185, 2016.
222
+
223
+ Li Fei-Fei et al. A bayesian approach to unsupervised one-shot learning of object categories. In Proceedings Ninth IEEE International Conference on Computer Vision, pp. 1134–1141. IEEE, 2003.
224
+
225
+ Chelsea Finn, Pieter Abbeel, and Sergey Levine. Model-agnostic meta-learning for fast adaptation of deep networks. In Proceedings of the 34th International Conference on Machine LearningVolume 70, pp. 1126–1135. JMLR. org, 2017.
226
+
227
+ Chelsea Finn, Kelvin Xu, and Sergey Levine. Probabilistic model-agnostic meta-learning. In Advances in Neural Information Processing Systems, pp. 9516–9527, 2018.
228
+
229
+ Tomer Galanti, Lior Wolf, and Tamir Hazan. A theoretical framework for deep transfer learning. Information and Inference: A Journal of the IMA, 5(2):159–209, 2016.
230
+
231
+ Marta Garnelo, Dan Rosenbaum, Chris J Maddison, Tiago Ramalho, David Saxton, Murray Shanahan, Yee Whye Teh, Danilo J Rezende, and SM Eslami. Conditional neural processes. arXiv preprint arXiv:1807.01613, 2018a.
232
+
233
+ Marta Garnelo, Jonathan Schwarz, Dan Rosenbaum, Fabio Viola, Danilo J Rezende, SM Eslami, and Yee Whye Teh. Neural processes. arXiv preprint, 2018b.
234
+
235
+ Jonathan Gordon, John Bronskill, Matthias Bauer, Sebastian Nowozin, and Richard E Turner. Metalearning probabilistic inference for prediction. arXiv preprint arXiv:1805.09921, 2018.
236
+
237
+ Erin Grant, Chelsea Finn, Sergey Levine, Trevor Darrell, and Thomas Griffiths. Recasting gradientbased meta-learning as hierarchical bayes. arXiv preprint arXiv:1801.08930, 2018.
238
+
239
+ Simon Guiroy, Vikas Verma, and Christopher Pal. Towards understanding generalization in gradientbased meta-learning. arXiv preprint arXiv:1907.07287, 2019.
240
+
241
+ James Harrison, Apoorva Sharma, and Marco Pavone. Meta-learning priors for efficient online bayesian regression. arXiv preprint arXiv:1807.08912, 2018.
242
+
243
+ Muhammad Abdullah Jamal and Guo-Jun Qi. Task agnostic meta-learning for few-shot learning. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 11719– 11727, 2019.
244
+
245
+ Taesup Kim, Jaesik Yoon, Ousmane Dia, Sungwoong Kim, Yoshua Bengio, and Sungjin Ahn. Bayesian model-agnostic meta-learning. arXiv preprint arXiv:1806.03836, 2018.
246
+
247
+ Gregory Koch, Richard Zemel, and Ruslan Salakhutdinov. Siamese neural networks for one-shot image recognition. In ICML deep learning workshop, volume 2, 2015.
248
+
249
+ Anders Krogh and John A Hertz. A simple weight decay can improve generalization. In Advances in neural information processing systems, pp. 950–957, 1992.
250
+
251
+ Brenden Lake, Ruslan Salakhutdinov, Jason Gross, and Joshua Tenenbaum. One shot learning of simple visual concepts. In Proceedings of the annual meeting of the cognitive science society, volume 33, 2011.
252
+
253
+ Yoonho Lee, Wonjae Kim, and Seungjin Choi. Discrete infomax codes for meta-learning. arXiv preprint arXiv:1905.11656, 2019.
254
+
255
+ David A McAllester. Pac-bayesian model averaging. In COLT, volume 99, pp. 164–170. Citeseer, 1999.
256
+
257
+ Anusha Nagabandi, Ignasi Clavera, Simin Liu, Ronald S Fearing, Pieter Abbeel, Sergey Levine, and Chelsea Finn. Learning to adapt in dynamic, real-world environments through metareinforcement learning. arXiv preprint arXiv:1803.11347, 2018.
258
+
259
+ Anastasia Pentina and Christoph Lampert. A pac-bayesian bound for lifelong learning. In International Conference on Machine Learning, pp. 991–999, 2014.
260
+
261
+ Kate Rakelly, Aurick Zhou, Deirdre Quillen, Chelsea Finn, and Sergey Levine. Efficient off-policy meta-reinforcement learning via probabilistic context variables. arXiv preprint arXiv:1903.08254, 2019.
262
+
263
+ Sachin Ravi and Hugo Larochelle. Optimization as a model for few-shot learning. In ICLR 2016, 2016.
264
+
265
+ Adam Santoro, Sergey Bartunov, Matthew Botvinick, Daan Wierstra, and Timothy Lillicrap. Metalearning with memory-augmented neural networks. In International conference on machine learning, pp. 1842–1850, 2016.
266
+
267
+ Jurgen Schmidhuber. Evolutionary principles in self-referential learning. On learning how to learn: The meta-meta-... hook.) Diploma thesis, Institut f. Informatik, Tech. Univ. Munich, 1:2, 1987.
268
+
269
+ Nitish Srivastava, Geoffrey Hinton, Alex Krizhevsky, Ilya Sutskever, and Ruslan Salakhutdinov. Dropout: a simple way to prevent neural networks from overfitting. The journal of machine learning research, 15(1):1929–1958, 2014.
270
+
271
+ Joshua Brett Tenenbaum. A Bayesian framework for concept learning. PhD thesis, Massachusetts Institute of Technology, 1999.
272
+
273
+ Sebastian Thrun and Lorien Pratt. Learning to learn. Springer Science & Business Media, 2012.
274
+
275
+ Naftali Tishby and Noga Zaslavsky. Deep learning and the information bottleneck principle. In 2015 IEEE Information Theory Workshop (ITW), pp. 1–5. IEEE, 2015.
276
+
277
+ Naftali Tishby, Fernando C Pereira, and William Bialek. The information bottleneck method. arXiv preprint physics/0004057, 2000.
278
+
279
+ Emanuel Todorov, Tom Erez, and Yuval Tassa. Mujoco: A physics engine for model-based control. In 2012 IEEE/RSJ International Conference on Intelligent Robots and Systems, pp. 5026–5033. IEEE, 2012.
280
+
281
+ Oriol Vinyals, Charles Blundell, Timothy Lillicrap, Daan Wierstra, et al. Matching networks for one shot learning. In Advances in neural information processing systems, pp. 3630–3638, 2016.
282
+
283
+ Yu Xiang, Roozbeh Mottaghi, and Silvio Savarese. Beyond pascal: A benchmark for 3d object detection in the wild. In IEEE Winter Conference on Applications of Computer Vision (WACV), 2014.
284
+
285
+ Ruixiang Zhang, Tong Che, Zoubin Ghahramani, Yoshua Bengio, and Yangqiu Song. Metagan: An adversarial approach to few-shot learning. In Advances in Neural Information Processing Systems, pp. 2365–2374, 2018.
286
+
287
+ Luisa M Zintgraf, Kyriacos Shiarlis, Vitaly Kurin, Katja Hofmann, and Shimon Whiteson. Fast context adaptation via meta-learning. In Thirty-sixth International Conference on Machine Learning (ICML 2019), 2019.
288
+
289
+ # A APPENDIX
290
+
291
+ # A.1 ALGORITHM
292
+
293
+ We present the detailed algorithm for meta-regularization on weights with conditional neural processes (CNP) in Algorithm 1 and with model-agnostic meta-learning (MAML) in Algorithm 2. For CNP, we add the regularization on the weights $\theta$ of encoder and leave other weights $\bar { \theta }$ unrestricted. For MAML, we similarly regularize the weights $\theta$ from input to an intermediate hidden layer and leave the weights $\tilde { \theta }$ for adaptation unregularized. In this way, we restrict the complexity of the pre-adaptation model not the post-adaptation model.
294
+
295
+ # Algorithm 1: Meta-Regularized CNP
296
+
297
+ input : Task distribution $p ( \mathcal { T } )$ ; Encoder weights distribution $q ( \theta ; \tau ) = \mathcal { N } ( \theta ; \tau )$ with Gaussian parameters $\tau = ( \theta _ { \mu } , \theta _ { \sigma } )$ ; Prior distribution $r ( \theta )$ and Lagrangian multiplier $\beta$ ; $\tilde { \theta }$ that parameterizes feature extractor $h _ { \tilde { \theta } } ( \cdot )$ and decoder $T _ { \tilde { \theta } } ( \cdot )$ . Stepsize $\alpha$ .
298
+
299
+ output: Network parameter $\tau , { \tilde { \theta } }$
300
+
301
+ Initialize $\tau$ , $\tilde { \theta }$ randomly; while not converged do
302
+
303
+ Sample a mini-batch of $\{ \mathcal { T } _ { i } \}$ from $p ( \mathcal { T } )$ ;
304
+ Sample $\theta \sim q ( \theta ; \tau )$ with reparameterization ;
305
+ for all $\mathcal { T } _ { i } \in \{ \mathcal { T } _ { i } \}$ do Sample $\mathcal { D } _ { i } = ( \boldsymbol { \boldsymbol { x } } _ { i } , \boldsymbol { \boldsymbol { y } } _ { i } )$ , $\mathcal { D } _ { i } ^ { * } = ( \boldsymbol { x } _ { i } ^ { * } , \boldsymbol { y } _ { i } ^ { * } )$ from $\mathcal { T } _ { i }$ ; Encode observation $z _ { i } = g _ { \theta } ( \pmb { x } _ { i } )$ , $z _ { i } ^ { * } = g _ { \boldsymbol { \theta } } ( \boldsymbol { x } _ { i } ^ { * } )$ ; Compute task context $\phi _ { i } = a ( h _ { \tilde { \theta } } ( z _ { i } , \pmb { y } _ { i } ) )$ with aggregator $a ( \cdot )$ ;
306
+
307
+ Update $\begin{array} { r } { \tilde { \theta } \gets \tilde { \theta } + \alpha \nabla _ { \tilde { \theta } } \sum _ { \mathcal { T } _ { i } } \log q ( \pmb { y } _ { i } ^ { * } | T _ { \tilde { \theta } } ( \pmb { z } _ { i } ^ { * } , \phi _ { i } ) ) } \end{array}$ ; Update $\begin{array} { r l } & { \sim \sim \sim \smash { \tau } + \alpha \nabla _ { \tau } [ \sum _ { \tau _ { i } } \log q ( { \boldsymbol y } _ { i } ^ { * } | T _ { \tilde { \boldsymbol \theta } } ( { \boldsymbol z } _ { i } ^ { * } , \boldsymbol { \phi } _ { i } ) ) - \beta D _ { \mathrm { K L } } ( q ( { \boldsymbol \theta } ; \tau ) | | \boldsymbol { r } ( { \boldsymbol \theta } ) ) ] } \\ & { \sim \smash { \tau } \tau + \alpha \nabla _ { \tau } [ \sum _ { \tau _ { i } } \log q ( { \boldsymbol y } _ { i } ^ { * } | T _ { \tilde { \boldsymbol \theta } } ( { \boldsymbol z } _ { i } ^ { * } , { \boldsymbol \phi } _ { i } ) ) - \beta D _ { \mathrm { K L } } ( q ( { \boldsymbol \theta } ; \tau ) | | \boldsymbol { r } ( { \boldsymbol \theta } ) ) ] } \end{array}$
308
+
309
+ # Algorithm 2: Meta-Regularized MAML
310
+
311
+ input : Task distribution $p ( \mathcal { T } )$ ; Weights distribution $q ( \theta ; \tau ) = \mathcal { N } ( \theta ; \tau )$ with Gaussian parameters $\tau = ( \theta _ { \mu } , \theta _ { \sigma } )$ ; Prior distribution $r ( \theta )$ and Lagrangian multiplier $\beta$ ; Stepsize $\alpha , \alpha ^ { \prime }$ .
312
+
313
+ output: Network parameter $\tau , { \tilde { \theta } }$ .
314
+
315
+ Initialize $\tau$ , $\tilde { \theta }$ randomly; while not converged do
316
+
317
+ Sample a mini-batch of $\{ \mathcal { T } _ { i } \}$ from $p ( \mathcal { T } )$ ;
318
+ Sample $\theta \sim q ( \theta ; \tau )$ with reparameterization ;
319
+ for all $\mathcal { T } _ { i } \in \{ \mathcal { T } _ { i } \}$ do Sample $\mathcal { D } _ { i } = ( \boldsymbol { \boldsymbol { x } } _ { i } , \boldsymbol { \boldsymbol { y } } _ { i } )$ , $\mathcal { D } _ { i } ^ { * } = ( \boldsymbol { x } _ { i } ^ { * } , \boldsymbol { y } _ { i } ^ { * } )$ from $\mathcal { T } _ { i }$ ; Encode observation $z _ { i } = g _ { \theta } ( \pmb { x } _ { i } )$ , $z _ { i } ^ { * } = g _ { \boldsymbol { \theta } } ( \boldsymbol { x } _ { i } ^ { * } )$ ; Compute task specific parameter $\phi _ { i } = \tilde { \theta } + \alpha ^ { \prime } \nabla _ { \tilde { \theta } } \log q ( \pmb { y } _ { i } | \boldsymbol { z } _ { i } , \tilde { \theta } )$ ;
320
+
321
+ Update $\begin{array} { r } { \tilde { \theta } \gets \tilde { \theta } + \alpha \nabla _ { \tilde { \theta } } \sum _ { \tau _ { i } } \log q ( \pmb { y } _ { i } ^ { * } | \pmb { z } _ { i } ^ { * } , \phi _ { i } ) } \end{array}$ ; Update $\begin{array} { r } { \tau \gets \tau + \alpha \nabla _ { \tau } [ \sum _ { \tau _ { i } } \log q ( \pmb { y } _ { i } ^ { * } | \pmb { z } _ { i } ^ { * } , \phi _ { i } ) - \beta D _ { \mathrm { K L } } ( q ( \theta ; \tau ) | | \boldsymbol { r } ( \theta ) ) ] } \end{array}$
322
+
323
+ # Algorithm 3: Meta-Regularized Methods in Meta-testing
324
+
325
+ input : Meta-testing task $\tau$ with training data $\boldsymbol { \mathcal { D } } = ( \boldsymbol { \mathsf { x } } , \boldsymbol { \mathsf { y } } )$ and testing input $\mathbf { \nabla } _ { \mathbf { \mathcal { X } } } ^ { * }$ , optimized parameters $\tau , { \tilde { \theta } }$ .
326
+
327
+ output: Prediction $\hat { y } ^ { * }$ for $k$ from $I$ to $K$ do
328
+
329
+ Sample $\theta _ { k } \sim q ( \theta ; \tau )$ ;
330
+ Encode observation $z _ { k } = g _ { \theta _ { k } } ( \pmb { x } )$ , $z _ { k } ^ { * } = g _ { \theta _ { k } } ( x ^ { * } )$ ;
331
+ Compute task specific parameter $\phi _ { k } = a ( h _ { \widetilde { \theta } } ( z _ { k } , \pmb { y } ) )$ for MR-CNP and $\phi _ { k } = \tilde { \theta } + \alpha ^ { \prime } \nabla _ { \tilde { \theta } } \log q ( \pmb { y } | \boldsymbol { z } _ { k } , \tilde { \theta } )$ for MR-MAML;
332
+ Predict $\hat { y } _ { k } ^ { * } \sim q ( \hat { y } ^ { * } | z _ { k } ^ { * } , \phi _ { k } , \tilde { \theta } )$
333
+
334
+ Return prediction $\begin{array} { r } { \hat { y } ^ { * } = \frac { 1 } { K } \sum _ { k = 1 } ^ { K } \hat { y } _ { k } ^ { * } } \end{array}$
335
+
336
+ # A.2 META REGULARIZATION ON ACTIVATIONS
337
+
338
+ We show that $I ( x ^ { * } ; \hat { y } ^ { * } | z ^ { * } , \theta ) \le I ( \hat { y } ^ { * } ; D | z ^ { * } , \theta )$ . By Figure 4, we have that $I ( \hat { y } ^ { \ast } ; x ^ { \ast } | \theta , \mathcal { D } , z ^ { \ast } ) = 0$ By the chain rule of mutual information we have
339
+
340
+ $$
341
+ \begin{array} { r l } & { I ( \hat { y } ^ { * } ; \mathcal { D } | z ^ { * } , \theta ) = I ( \hat { y } ^ { * } ; \mathcal { D } | z ^ { * } , \theta ) + I ( \hat { y } ^ { * } ; x ^ { * } | \mathcal { D } , \theta , z ^ { * } ) } \\ & { \quad \quad \quad = I ( \hat { y } ^ { * } ; x ^ { * } , \mathcal { D } | \theta , z ^ { * } ) } \\ & { \quad \quad \quad = I ( x ^ { * } ; \hat { y } ^ { * } | \theta , z ^ { * } ) + I ( \hat { y } ^ { * } ; \mathcal { D } | x ^ { * } , \theta , z ^ { * } ) } \\ & { \quad \quad \quad \geq I ( x ^ { * } ; \hat { y } ^ { * } | \theta , z ^ { * } ) } \end{array}
342
+ $$
343
+
344
+ # A.3 META REGULARIZATION ON WEIGHTS
345
+
346
+ Similar to (Achille & Soatto, 2018), we use $\xi$ to denote the unknown parameters of the true data generating distribution. This defines a joint distribution $p ( \xi , \mathcal { M } , \theta ) = p ( \xi ) p ( \mathcal { M } | \xi ) q ( \theta | \mathcal { M } )$ . Furthermore, we have a predictive distribution $q ( \hat { y } ^ { * } | x ^ { * } , \mathcal { D } , \theta ) = \mathbb { E } _ { \phi | \theta , \mathcal { D } } \left[ q ( \hat { y } ^ { * } | x ^ { * } , \phi , \theta ) \right]$ .
347
+
348
+ The meta-training loss in Eq. 1 is an upper bound for the cross entropy $H _ { p , q } ( y _ { 1 : N } ^ { * } | x _ { 1 : N } ^ { * } , \mathcal { D } _ { 1 : N } , \theta )$ . Using an information decomposition of cross entropy (Achille & Soatto, 2018), we have
349
+
350
+ $$
351
+ \begin{array} { r l } & { H _ { p , q } ( y _ { 1 : N } ^ { * } | x _ { 1 : N } ^ { * } , \mathcal { D } _ { 1 : N } , \theta ) = H ( y _ { 1 : N } ^ { * } | x _ { 1 : N } ^ { * } , \mathcal { D } _ { 1 : N } , \xi ) + I ( \xi ; y _ { 1 : N } ^ { * } | x _ { 1 : N } ^ { * } , \mathcal { D } _ { 1 : N } , \theta ) } \\ & { \qquad + \mathbb { E } \left[ D _ { \mathrm { K L } } ( p ( y _ { 1 : N } ^ { * } | x _ { 1 : N } ^ { * } , \mathcal { D } _ { 1 : N } , \theta ) | | q ( y _ { 1 : N } ^ { * } | x _ { 1 : N } ^ { * } , \mathcal { D } _ { 1 : N } , \theta ) ) \right] + I ( \mathcal { D } _ { 1 : N } ; \theta | x _ { 1 : N } ^ { * } , \xi ) } \\ & { \qquad - I ( y _ { 1 : N } ^ { * } , \mathcal { D } _ { 1 : N } ; \theta | x _ { 1 : N } ^ { * } , \xi ) . } \end{array}
352
+ $$
353
+
354
+ Here the only negative term is the $I ( y _ { 1 : N } ^ { * } , { \cal D } _ { 1 : N } ; \theta | x _ { 1 : N } ^ { * } , \xi )$ , which quantifies the information that the meta-parameters contain about the meta-training data beyond what can be inferred from the data generating parameters (i.e., memorization). Without proper regularization, the cross entropy loss can be minimized by maximizing this term. We can control its value by upper bounding it
355
+
356
+ $$
357
+ \begin{array} { r l } & { I ( y _ { 1 : N } ^ { * } , \mathcal { D } _ { 1 : N } ; \theta | x _ { 1 : N } ^ { * } , \xi ) = \mathbb { E } \left[ \log \frac { q ( \theta | \mathcal { M } , \xi ) } { q ( \theta | x _ { 1 : N } ^ { * } , \xi ) } \right] } \\ & { \quad \quad \quad \quad \quad \quad \quad = \mathbb { E } \left[ \log \frac { q ( \theta | \mathcal { M } ) } { q ( \theta | x _ { 1 : N } ^ { * } , \xi ) } \right] } \\ & { \quad \quad \quad \quad = \mathbb { E } \left[ D _ { \mathrm { K L } } ( q ( \theta | \mathcal { M } ) | | q ( \theta | x _ { 1 : N } ^ { * } , \xi ) ) \right] } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \leq \mathbb { E } \left[ D _ { \mathrm { K L } } ( q ( \theta | \mathcal { M } ) | | r ( \theta ) ) \right] , } \end{array}
358
+ $$
359
+
360
+ where the second equality follows because $\theta$ and $\xi$ are conditionally independent given $\mathcal { M }$ . This gives the regularization in Section 4.2.
361
+
362
+ # A.4 PROOF OF THE PAC-BAYES GENERALIZATION BOUND
363
+
364
+ First, we prove a more general result and then specialize it. The goal of the meta-learner is to extract information about the meta-training tasks and the test task training data to serve as a prior for test examples from the novel task. This information will be in terms of a distribution $Q$ over possible models. When learning a new task, the meta-learner uses the training task data $\mathcal { D }$ and a model parameterized by $\theta$ (sampled from $Q ( \theta ) )$ and outputs a distribution $q ( \phi | \mathcal { D } , \theta )$ over models. Our goal is to learn $Q$ such that it performs well on novel tasks.
365
+
366
+ To formalize this, define
367
+
368
+ $$
369
+ e r ( Q , \mathcal { D } , \mathcal { T } ) = \mathbb { E } _ { \theta \sim Q ( \theta ) , \phi \sim q ( \phi | \theta , \mathcal { D } ) , ( x ^ { * } , y ^ { * } ) \sim p ( x , y | \mathcal { T } ) } \left[ \mathcal { L } \bigl ( \phi ( x ^ { * } ) , y ^ { * } \bigr ) \right]
370
+ $$
371
+
372
+ where $\mathcal { L } ( \phi ( x ^ { * } ) , y ^ { * } )$ is a bounded loss in $[ 0 , 1 ]$ . Then, we would like to minimize the error on novel tasks
373
+
374
+ $$
375
+ e r ( Q ) = \operatorname* { m i n } _ { Q } \mathbb { E } _ { \mathcal { T } \sim p ( \mathcal { T } ) , \mathcal { D } \sim p ( x , y | \mathcal { T } ) } \left[ e r ( Q , \mathcal { D } , \mathcal { T } ) \right]
376
+ $$
377
+
378
+ Because we only have a finite training set, computing $e r ( Q )$ is intractable, but we can form an empirical estimate:
379
+
380
+ $$
381
+ \hat { e r } ( Q , \mathcal { D } _ { 1 } , \mathcal { D } _ { 1 } ^ { * } , . . . , \mathcal { D } _ { n } , \mathcal { D } _ { n } ^ { * } ) = \frac { 1 } { n } \underbrace { \sum _ { i = 1 } ^ { n } \mathbb { E } _ { \theta \sim Q ( \theta ) , \phi _ { i } \sim q ( \phi | \theta , \mathcal { D } _ { i } ) } \left[ \frac { 1 } { K } \sum _ { ( x ^ { * } , y ^ { * } ) \in \mathcal { D } _ { i } ^ { * } } \mathcal { L } ( \phi ( x ^ { * } ) , y ^ { * } ) ) \right] } _ { \hat { e r } ( Q , \mathcal { D } _ { i } , \mathcal { D } _ { i } ^ { * } ) }
382
+ $$
383
+
384
+ where for exposition we assume $K = | \mathcal { D } _ { i } ^ { * } |$ is the same for all $i$ . We would like to relate $e r ( Q )$ and $\hat { e r } ( Q , \mathcal { D } _ { 1 } , \mathcal { D } _ { 1 } ^ { * } , . . . , \mathcal { D } _ { n } , \mathcal { D } _ { n } ^ { * } )$ , but the challenge is that $Q$ may depend on $\mathcal { D } _ { 1 } , \mathcal { D } _ { 1 } ^ { * } , . . . , \mathcal { D } _ { n } , \mathcal { D } _ { n } ^ { * }$ due to the learning algorithm. There are two sources of generalization error: (i) error due to the finite number of observed tasks and (ii) error due to the finite number of examples observed per task. Closely following the arguments in (Amit & Meir, 2018), we apply a standard PAC-Bayes bound to each of these and combine the results with a union bound.
385
+
386
+ Theorem. Let $Q ( \theta )$ be a distribution over parameters $\theta$ and let $P ( \theta )$ be a prior distribution. Then for any $\delta \in ( 0 , 1 ]$ , with probability at least $1 - \delta _ { \mathrm { { i } } }$ , the following inequality holds uniformly for all distributions $Q$ ,
387
+
388
+ $$
389
+ \ L _ { T } ( Q ) \leq { \frac { 1 } { n } } \sum _ { i = 1 } ^ { n } { \hat { e } } r ( Q , { \mathcal { D } } _ { i } , { \mathcal { D } } _ { i } ^ { * } ) + \left( { \sqrt { { \frac { 1 } { 2 ( K - 1 ) } } } } + { \sqrt { { \frac { 1 } { 2 ( n - 1 ) } } } } \right) { \sqrt { D _ { K L } ( Q \| P ) + \log { \frac { n ( K + 1 ) } { \delta } } } }
390
+ $$
391
+
392
+ Proof. To start, we state a classical PAC-Bayes bound and use it to derive generalization bounds on task and datapoint level generalization, respectively.
393
+
394
+ Theorem 2. Let $\mathcal { X }$ be a sample space (i.e. a space of possible datapoints). Let $P ( X )$ be a distribution over $\mathcal { X }$ (i.e. a data distribution). Let $\Theta$ be a hypothesis space. Given a “loss function” $l ( \theta , X ) : \Theta \times \mathcal { X } \to [ 0 , 1 ]$ and a collection of $M$ i.i.d. random variables sampled from $P ( X )$ , $X _ { 1 } , . . . , X _ { M }$ , let $\pi$ be a prior distribution over hypotheses in $\Theta$ that does not depend on the samples but may depend on the data distribution $P ( X )$ . Then, for any $\delta \in ( 0 , 1 ]$ , the following bound holds uniformly for all posterior distributions $\rho$ over $\Theta$
395
+
396
+ $$
397
+ P ( \mathbb { E } _ { X _ { i } \sim P ( X ) , \theta \sim \rho ( \cdot ) } [ l ( \theta , X _ { i } ) ] \le \frac { 1 } { M } \sum _ { m = 1 } ^ { M } \mathbb { E } _ { \theta \sim \rho ( \cdot ) } [ l ( \theta , X _ { m } ] + \sqrt { \frac { 1 } { 2 ( M - 1 ) } ( D _ { K L } ( \rho \| \pi ) + \log \frac { M } { \delta } ) } , \forall \rho ) \qquad \mathrm { ( 1 6 ) }
398
+ $$
399
+
400
+ $e r ( Q )$ leve to $\textstyle { \frac { 1 } { n } } \sum _ { i = 1 } ^ { n } e r ( Q , { D _ { i } } , { T _ { i } } )$ t, we bound the task-leve. Letting the samples be $\begin{array} { r c l } { \bar { X _ { i } } } & { = } & { ( { \mathcal D } _ { i } , { \mathcal T } _ { i } ) } \end{array}$ that , and $l ( \theta , X _ { n } ) ~ =$ $\mathbb { E } _ { \phi _ { i } \sim q ( \phi | \mathcal { D } _ { i } , \theta ) , ( x ^ { * } , y ^ { * } ) \sim \mathcal { T } _ { i } } [ \mathcal { L } ( \phi ( x ^ { * } ) , y ^ { * } ) ]$ , then Theorem 1 says that for any $\delta _ { 0 } \sim ( 0 , 1 ]$
401
+
402
+ $$
403
+ P \left( e r ( Q ) \leq \frac { 1 } { n } \sum _ { i = 1 } ^ { n } e r ( Q , \mathcal { D } _ { i } , \mathcal { T } _ { i } ) + \sqrt { \frac { 1 } { 2 ( n - 1 ) } \left( D _ { K L } ( Q \| P ) + \log \frac { n } { \delta _ { 0 } } \right) } , \forall Q \right) \geq 1 - \delta _ { 0 } ,
404
+ $$
405
+
406
+ where $P$ is a prior over $\theta$ .
407
+
408
+ Within task generalization Next, we relate $e r ( Q , { \mathcal { D } } _ { i } , { \mathcal { T } } _ { i } )$ to $\hat { e r } ( Q , \mathcal { D } _ { i } , \mathcal { D } _ { i } ^ { * } )$ via the PAC-Bayes bound. For a fixed task $i$ , task training data $\mathcal { D } _ { i }$ , a prior $\pi ( \phi | { \mathcal { T } } _ { i } )$ that only depends on the training
409
+
410
+ data, and any $\delta _ { i } \in ( 0 , 1 ]$ , we have that
411
+
412
+ $$
413
+ \begin{array} { r l } & { \displaystyle > ( \mathbb { E } _ { ( x ^ { * } , y ^ { * } ) \sim p ( x , y | T _ { i } ) \rho ( \phi _ { i } ) } [ \mathcal { L } ( \phi _ { i } ( x ^ { * } ) , y ^ { * } ) ] \leq \mathbb { E } _ { \rho ( \phi _ { i } ) } [ \frac { 1 } { K } \sum _ { ( x ^ { * } , y ^ { * } ) \in \mathcal { D } _ { i } ^ { * } } \mathcal { L } ( \phi _ { i } ( x ^ { * } ) , y ^ { * } ) ] } \\ & { \quad \quad \quad \quad \quad \quad \quad + \sqrt { \frac { 1 } { 2 ( K - 1 ) } ( D _ { K L } ( { \rho } | | \pi ) + \log \frac { K } { \delta _ { i } } ) } , \forall { \rho } \Big ) \geq 1 - \delta _ { i } . } \end{array}
414
+ $$
415
+
416
+ Now, we choose $\pi ( \phi | { \mathcal { T } } _ { i } )$ to be $\begin{array} { r l } { \int P ( \theta ) q ( \phi | \theta , \mathcal { D } _ { i } ) d \theta } \end{array}$ and restrict $\rho ( \phi )$ to be of the form $\textstyle { \int Q ( \theta ) q ( \phi | \theta , \mathcal { D } _ { i } ) d \theta }$ for any $Q$ . While, $\pi$ and $\rho$ may be complicated distributions (especially, if they are defined implicitly), we know that with this choice of $\pi$ and $\rho$ $, D _ { K L } ( \rho | | \pi ) \leq D _ { K L } ( Q | | P )$ (Cover & Thomas, 2012), hence, we have
417
+
418
+ $$
419
+ P \left( e r ( Q , \mathcal { D } _ { i } , \mathcal { T } _ { i } ) \leq \hat { e r } ( Q , \mathcal { D } _ { i } , \mathcal { D } _ { i } ^ { * } ) + \sqrt { \frac { 1 } { 2 ( K - 1 ) } \left( D _ { K L } ( Q \| P ) + \log { \frac { K } { \delta _ { i } } } \right) } , \forall Q \right) \geq 1 - \delta _ { i }
420
+ $$
421
+
422
+ Overall bound on meta-learner generalization Combining Eq. (17) and (18) using the union bound, we have
423
+
424
+ $$
425
+ \begin{array} { r l } { { P \Big ( e r ( Q ) \leq \frac { 1 } { n } \displaystyle \sum _ { i = 1 } ^ { n } \hat { e r } ( Q , \mathcal { D } _ { i } , \mathcal { D } _ { i } ^ { * } ) + \sqrt { \frac { 1 } { 2 ( K - 1 ) } D _ { K L } ( Q \| P ) + \log \frac { K } { \delta _ { i } } } } \quad } & { { } } \\ { + \sqrt { \frac { 1 } { 2 ( n - 1 ) } D _ { K L } ( Q \| P ) + \log \frac { n } { \delta _ { 0 } } } , \forall Q \Big ) \geq 1 - ( \sum _ { i } \delta _ { i } + \delta _ { 0 } ) } & { { } } \end{array}
426
+ $$
427
+
428
+ Choosing $\begin{array} { r } { \delta _ { 0 } = \frac { \delta } { K + 1 } } \end{array}$ and $\begin{array} { r } { \delta _ { i } = \frac { K \delta } { n ( K + 1 ) } } \end{array}$ , then we have:
429
+
430
+ $$
431
+ \begin{array} { r l r } { { P \Big ( e r ( Q ) \leq \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \hat { e } r ( Q , \mathcal { D } _ { i } , \mathcal { D } _ { i } ^ { * } ) + ( \sqrt { \frac { 1 } { 2 ( K - 1 ) } } + \sqrt { \frac { 1 } { 2 ( n - 1 ) } } ) \sqrt { D _ { K L } ( Q \| P ) + \log \frac { n ( K + 1 ) } { \delta } } , \forall Q \Big ) } } \\ & { > 1 - \delta . } & ( 2 0 \end{array}
432
+ $$
433
+
434
+ Because $n$ is generally large, by Taylor expansion of the complexity term we have
435
+
436
+ $$
437
+ \begin{array} { r l } & { \left( \sqrt { \frac { 1 } { 2 ( K - 1 ) } } + \sqrt { \frac { 1 } { 2 ( n - 1 ) } } \right) \sqrt { \left( D _ { K L } Q | | P \rangle + \log \frac { n ( K + 1 ) } { \delta } \right) } } \\ & { = \frac { 1 } { 2 \sqrt { \log n ( K + 1 ) / \delta } } \left( \sqrt { \frac { 1 } { 2 ( K - 1 ) } } + \sqrt { \frac { 1 } { 2 ( n - 1 ) } } \right) \left( D _ { K L } Q | | P \rangle + 2 \log ( \frac { n ( K + 1 ) } { \delta } ) \right) + o ( 1 ) } \end{array}
438
+ $$
439
+
440
+ Re-defining the coefficient of $\mathrm { K L }$ term as $\beta$ and omitting the constant and higher order term, we recover the meta-regularization bound in Eq.(5) when $Q ( \bar { \theta } ) = \mathcal { N } ( \theta ; \theta _ { \mu } , \theta _ { \sigma } )$ .
441
+
442
+ # A.5 EXPERIMENTAL DETAILS
443
+
444
+ # A.5.1 POSE PREDICTION
445
+
446
+ We create a multi-task regression dataset based on the Pascal 3D data (Xiang et al., 2014). The dataset consists of 10 classes of 3D object such as “aeroplane”, “sofa”, “TV monitor”, etc. Each class has multiple different objects and there are 65 objects in total. We randomly select 50 objects for meta-training and the other 15 objects for meta-testing. For each object, we use MuJoCo (Todorov et al., 2012) to render 100 images with random orientations of the instance on a table, visualized in Figure 1. For the meta-learning algorithm, the observation $( x )$ is the $1 2 8 \times 1 2 8$ gray-scale image and the label $( y )$ is the orientation re-scaled to be within $[ 0 , 1 \dot { 0 } ]$ . For each task, we randomly sample
447
+
448
+ 30 $( x , y )$ pairs for an object and evenly split them between task training and task test data. We use a meta batch-size of 10 tasks per iteration.
449
+
450
+ For MR-CNP, we use a convolutional encoder with a fully connected bottom layer to map the input image to a 20-dimensional latent representation $z$ and $z ^ { * }$ for task training input $x$ and test input $x ^ { * }$ respectively. The $( z , y )$ are concatenated and mapped by the feature extractor and aggregator which are fully connected networks to the 200 dimensional task summary statistics $\phi$ . The decoder is a fully connected network that maps $( \phi , z ^ { * } )$ to the prediction $\hat { y } ^ { * }$ .
451
+
452
+ For MR-MAML, we use a convolutional encoder to map the input image to a $1 4 \times 1 4$ dimensional latent representation $z$ and $z ^ { * }$ . The pairs $( z , y )$ are used in the task adaptation step to get a task specific parameter $\phi$ via gradient descent. Then $z ^ { * }$ is mapped to the prediction $\hat { y } ^ { * }$ with a convolutional predictor parameterized by $\phi$ . The network is trained using 5 gradient steps with learning rate 0.01 in the inner loop for adaptation and evaluated using 20 gradient steps at the test-time.
453
+
454
+ # A.5.2 NON-MUTUALLY-EXCLUSIVE CLASSIFICATION
455
+
456
+ The Omniglot dataset consists of 20 instances of 1623 characters from 50 different alphabets. We randomly choose 1200 characters for meta-training and use the remaining for testing. The metatraining characters are partitioned into 60 disjoint sets for 20-way classification. The MiniImagenet dataset contains 100 classes of images including 64 training classes, 12 validation classes, and 24 test classes. We randomly partition the 64 meta-training classes into 13 disjoint sets for 5-way classification with one label having one less class of images than the others.
457
+
458
+ For MR-MAML we use a convolutional encoder similar to the pose prediction problem. The dimension of $z$ and $z ^ { * }$ is $1 4 \times 1 4$ for Omniglot and $2 0 \times 2 0$ for MiniImagenet. We use a convolutional decoder for both datasets. Following (Finn et al., 2017), we use a meta batch-size of 16 for 20-way Omniglot classification and meta batch-size of 4 for 5-way MiniImagenet classification. The metalearning rate is chosen from $\lbrace 0 . 0 0 1 , 0 . 0 0 5 \rbrace$ and the $\beta$ for meta-regularized methods are chosen from $\{ 1 0 ^ { - 7 } , \overset { \vartriangle } { 1 0 ^ { - 6 } } , \dots , 1 0 ^ { - 3 } \}$ . The optimal hyperparameters are chosen for each method separately via cross-validation.
459
+
460
+ # A.6 ADDITIONAL ILLUSTRATION AND GRAPHICAL MODEL
461
+
462
+ We show a standard few-shot classification setup in meta-learning to illustrate a mutually-exclusive task distribution and a graphical model for the regularization on the activations.
463
+
464
+ ![](images/5396ede84de50281da40fd81621c726813dfa3e6dd5a08a36ee6f411dd78c147.jpg)
465
+ Figure 3: An example of mutually-exclusive task distributions. In each task of mutually-exclusive few-shot classification, different classes are randomly assigned to the $N$ -way classification labels. The same class, such as the dog and butterfly in this illustration, can be assigned different labels across tasks which makes it impossible for one model to solve all tasks simultaneously.
466
+
467
+ ![](images/ed215f1ed8d799b43988426f7b9ebc3bc735ebcc0ba6af524e9e98a7a6bbb07f.jpg)
468
+ Figure 4: Graphical model of the regularization on activations. Observed variables are shaded and $Z$ is bottleneck variable. The complete memorization corresponds to the graph without the dashed arrows.
469
+
470
+ # A.7 ADDITIONAL RESULTS
471
+
472
+ As shown in Figures 5, 7 and 8, when meta-learning algorithms converge to the memorization solution, the test tasks must be similar to the train tasks in order to achieve low test error. For CNP, although the task training set contains sufficient information to infer the correct amplitude, this information is ignored and the regression curve at test-time is determined by the one-hot vector. As a result, CNP can only generalize to points from the curves it has seen in the training (Figure 7 first row). On the other hand, MAML does use the task training data (Figure 5, 8 and Table 1), however, its performance is much worse than in the mutually-exclusive task. MR-MAML and MR-CNP avoid converging to a memorization solution and achieve excellent test performance on sinusoid task.
473
+
474
+ ![](images/7690a9fff2a5977010c69799f794ff023adffbdd215ac1f44735fc27de70d704.jpg)
475
+ Figure 5: Test MSE on the mutually-non-exclusive sinusoid problem as function of the number of gradient steps used in the inner loop of MAML and MR-MAML. For each trial, we calculate the mean MSE over 100 randomly generated meta-testing tasks. We report the mean and standard deviation over 5 random trials.
476
+
477
+ ![](images/69d2480381965d685785cc26b11ab24485ee525f72239401869796f9f4142ae5.jpg)
478
+ Figure 6: Visualization of the optimized weight matrix $W$ that is connected to the inputs in the sinusoid regression example. The input $x = ( u , A )$ where $u \sim \mathrm { U n i f } ( - 5 , 5 )$ , $A$ is 20 dimensional one-hot vector and the intermediate layer is 100 dimensional, hence $\boldsymbol { x } \in \mathbb { R } ^ { 2 1 }$ and $W \in \mathbb { R } ^ { 2 1 \times 1 0 0 }$ . For both CNP and MAML, the meta-regularization restricts the part of weights that is connected to $A$ close to 0. Therefore it avoids storing the amplitude information in weights and forces the amplitude to be inferred from the task training data $\mathcal { D }$ , hence preventing the memorization problem.
479
+
480
+ ![](images/213a43ad041fd63b7843a387eb38621d3d3593b2fa8255019e61ea29177bfd06.jpg)
481
+ Figure 7: Meta-test results on the non-mutually-exclusive sinusoid regression problem with CNP. For each row, the amplitudes of the true curves (orange) are randomly sampled uniformly from [0.1, 4]. For illustrative purposes, we fix the one-hot vector component of the input. (a): The vanilla CNP cannot adapt to new task training data at test-time and the shape of prediction curve (blue) is determined by the one-hot amplitude not the task training data. (b) (c): Adding meta-regularization on both activation and weights enables the CNP to use the task training data at meta-training and causes the model to generalize well at test-time.
482
+
483
+ ![](images/8a707bc640c1b0eed86cee56f6acd4628f857b202085673efe68bed1ce20bee7.jpg)
484
+ Figure 8: Meta-test results on the non-mutually-exclusive sinusoid regression problem with MAML. For each row, the true amplitudes of the true curves (orange) are randomly sampled uniformly from [0.1, 4]. For illustrative purposes, we fix the one-hot vector component of the input. (a): Due to memorization, MAML adapts slowly and has large generalization error at test-time. (b) (c): Adding meta-regularization on both activation and weights recovers efficient adaptation.
485
+
486
+ ![](images/4498cbbefc413ecd8eade6b2ec6b58e9d870304ee03dc6139511a3d7e6bc8f9a.jpg)
487
+ Figure 9: Sensitivity of activation regularization and weight regularization with respect to the learning rate on the pose prediction problem. For activation regularization, lower training loss corresponds to higher test MSE which indicates that the memorization solution is not solved. For weights regularization, lower training loss corresponds to lower test MSE which indicates proper training can converge to the adaptation solution.
488
+
489
+ In Table 5, we report the pre-update accuracy for the non-mutually-exclusive classification experiment in Section 6.3. The pre-update accuracy is obtained by the initial parameters $\theta$ rather than the task adapted parameters $\phi$ . At the meta-training time, for both MAML and MR-MAML the post-update accuracy obtained by using $\phi$ gets close to 1. High pre-update accuracy reflects the memorization problem. For example, in 20-way 1-shot Omniglot example, the pre-update accuracy for MAML is ${ \bar { 9 } } 9 . 2 \%$ at the training time, which means only $\bar { 0 . 8 \% }$ improvement in accuracy is due to adaptation, so the task training data is ignored to a large extent. The pre-update training accuracy for MR-MAML is $5 \%$ , which means $9 5 \%$ improvement in accuracy during training is due to the adaptation. This explains why in Table 4, the test accuracy of MR-MAML is much higher than that of MAML at the test-time, since the task training data is used to achieve fast adaptation.
490
+
491
+ Table 5: Meta-training pre-update accuracy on non-mutually-exclusive classification. MR-MAML controls the meta-training pre-update accuracy close to random guess and achieves low training error after adaptation.
492
+
493
+ <table><tr><td>NME Omniglot</td><td>20-way 1-shot</td><td>20-way 5-shot</td></tr><tr><td>MAML</td><td>99.2 (0.2)%</td><td>45.1 (38.9)%</td></tr><tr><td>TAML</td><td>68.9(43.1)%</td><td>6.7 (1.8)%</td></tr><tr><td>MR-MAML (ours)</td><td>5.0 (0)%</td><td>5.0 (0)%</td></tr></table>
494
+
495
+ Mutually-exclusive Omniglot 20-way 1-shot
496
+
497
+ <table><tr><td>NME MiniImagenet5-way 1-shot</td><td></td><td>5-way 5-shot</td></tr><tr><td>MAML</td><td>99.4 (0.1)%</td><td>21.0(1.2)%</td></tr><tr><td>TAML</td><td>99.4 (0.1)%</td><td>20.8(0.4)%</td></tr><tr><td>MR-MAML (ours)</td><td>20.0(0)%</td><td>20.2(0.1)%</td></tr></table>
498
+
499
+ ![](images/1b1b258dacf7a7e02a6a57603a0202a2d519d1888b49e8975a7ee849559cccb2.jpg)
500
+ Figure 10: The test accuracy of MAML with meta-regularization on the weights as a function of the regularization strength $\beta$ on the mutually-exclusive 20-way 1-shot Omniglot problem. The plot shows the mean and standard deviation across 5 meta-training runs. When $\beta$ is small, MR-MAML slightly outperforms MAML, indicating that meta-regularization does not degrade performance on mutually-exclusive tasks. The accuracy numbers are not directly comparable to previous work (e.g., (Finn et al., 2017)) because we do not use data augmentation.