ZHANGYUXUAN-zR commited on
Commit
da5675f
·
verified ·
1 Parent(s): 2cf800a

Add files using upload-large-folder tool

Browse files
parse/train/BJDEbngCZ/BJDEbngCZ.md ADDED
The diff for this file is too large to render. See raw diff
 
parse/train/BJDEbngCZ/BJDEbngCZ_content_list.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/train/BJDEbngCZ/BJDEbngCZ_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/train/BJDEbngCZ/BJDEbngCZ_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/train/Byg3y3C9Km/Byg3y3C9Km.md ADDED
@@ -0,0 +1,583 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # LEARNING PROTEIN STRUCTURE WITH A DIFFERENTIABLE SIMULATOR
2
+
3
+ John Ingraham1⇤, Adam Riesselman1, Chris Sander1,2,3, Debora Marks1,3 1Harvard Medical School 2Dana-Farber Cancer Institute 3Broad Institute of Harvard and MIT
4
+
5
+ # ABSTRACT
6
+
7
+ The Boltzmann distribution is a natural model for many systems, from brains to materials and biomolecules, but is often of limited utility for fitting data because Monte Carlo algorithms are unable to simulate it in available time. This gap between the expressive capabilities and sampling practicalities of energy-based models is exemplified by the protein folding problem, since energy landscapes underlie contemporary knowledge of protein biophysics but computer simulations are challenged to fold all but the smallest proteins from first principles. In this work we aim to bridge the gap between the expressive capacity of energy functions and the practical capabilities of their simulators by using an unrolled Monte Carlo simulation as a model for data. We compose a neural energy function with a novel and efficient simulator based on Langevin dynamics to build an end-toend-differentiable model of atomic protein structure given amino acid sequence information. We introduce techniques for stabilizing backpropagation under long roll-outs and demonstrate the model’s capacity to make multimodal predictions and to, in some cases, generalize to unobserved protein fold types when trained on a large corpus of protein structures.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Many natural systems, such as cells in a tissue or atoms in a protein, organize into complex structures from simple underlying interactions. Explaining and predicting how macroscopic structures such as these arise from simple interactions is a major goal of science and, increasingly, machine learning.
12
+
13
+ The Boltzmann distribution is a foundational model for relating local interactions to system behavior, but can be difficult to fit to data. Given an energy function $U _ { \pmb \theta } [ \pmb x ]$ , the probability of a system configuration $_ { \textbf { \em x } }$ scales exponentially with energy as
14
+
15
+ $$
16
+ p _ { \pmb \theta } ( \pmb x ) = \frac { 1 } { Z } \exp \left( - U _ { \pmb \theta } [ \pmb x ] \right) ,
17
+ $$
18
+
19
+ where the (typically intractable) constant $Z$ normalizes the distribution. Importantly, simple energy functions $\bar { U _ { \pmb \theta } [ \pmb x ] }$ consisting of weak, local interactions can collectively encode complex system behaviors, such as the structures of materials and molecules or, when endowed with latent variables, the statistics of images, sound, and text (Ackley et al., 1985; Salakhutdinov & Larochelle, 2010). Unfortunately, learning model parameters $\hat { \pmb { \theta } }$ and generating samples $\pmb { x } \sim p _ { \pmb { \theta } } ( \pmb { x } )$ of the Boltzmann distribution is difficult in practice, as these procedures depend on expensive Monte Carlo simulations that may struggle to mix effectively. These difficulties have driven a shift towards generative models that are easier to learn and sample from, such as directed latent variable models and autoregressive models (Goodfellow et al., 2016).
20
+
21
+ The protein folding problem provides a prime example of both the power of energy-based models at describing complex relationships in data as well as the challenge of generating samples from them. Decades of research in biochemistry and biophysics support an energy landscape theory of protein folding (Dill et al., 2017), in which the folds that natural protein sequences adopt are those that minimize free energy. Without the availability of external information such as coevolutionary information (Marks et al., 2012) or homologous structures (Mart´ı-Renom et al., 2000) to constrain the energy function, however, contemporary simulations are challenged to generate globally favorable low-energy structures in available time.
22
+
23
+ ![](images/e2799e210d60d44cbed4220c8a246c7fa62e0b817d18dc1f614ce3568f228a38.jpg)
24
+ Figure 1: An unrolled simulator as a model for protein structure. NEMO combines a neural energy function for coarse protein structure, a stochastic simulator based on Langevin dynamics with learned (amortized) initialization, and an atomic imputation network to build atomic coordinate output from sequence information. It is trained end-to-end by backpropagating through the unrolled folding simulation.
25
+
26
+ How can we get the representational benefits of energy-based models with the sampling efficiency of directed models? Here we explore a potential solution of directly training an unrolled simulator of an energy function as a model for data. By directly training the sampling process, we eschew the question ‘when has the simulator converged’ and instead demand that it produce a useful answer in a fixed amount of time. Leveraging this idea, we construct an end-to-end differentiable model of protein structure that is trained by backpropagtion through folding (Figure 1). NEMO (Neural energy modeling and optimization) can learn at scale to generate 3D protein structures consisting of hundreds of points directly from sequence information. Our main contributions are:
27
+
28
+ • Neural energy simulator model for protein structure that composes a deep energy function, unrolled Langevin dynamics, and an atomic imputation network for an end-to-end differentiable model of protein structure given sequence information
29
+ • Efficient sampling algorithm that is based on a transform integrator for efficient sampling in transformed coordinate systems
30
+ • Stabilization techniques for long roll-outs of simulators that can exhibit chaotic dynamics and, in turn, exploding gradients during backpropagation
31
+ • Systematic analysis of combinatorial generalization with a new dataset of protein sequence and structure
32
+
33
+ # 1.1 RELATED WORK
34
+
35
+ Protein modeling Our model builds on a long history of coarse-grained modeling of protein structure (Kolinski et al., 1998; Kmiecik et al., 2016). Recently, multiple groups have demonstrated how to learn full force fields using likelihood-based approaches (Jumper et al., 2018; Krupa et al., 2017), similar to our maximum likelihood loss (but without backpropagtion through folding for fast sampling). While this work was in progress, two groups reported neural models of protein structure (AlQuraishi, 2018; Anand & Huang, 2018), where the former focused on modeling structure in terms of backbone angles and the latter in terms of residue-residue distances. We show how an energy function provides a natural framework to integrate both kinds of constraints, which in turn is important for achieving sample-efficient structural generalization.
36
+
37
+ Learning to infer or sample Structured prediction includes a long history of casting predictions in terms of energy minimization (LeCun et al., 2006). Recently, others have built hybrid neural networks that use differentiable optimization as a building block in neural architectures (Wang et al.,
38
+
39
+ ![](images/2b4158e27794c2d5531afbb73b71337fa5611cd45b2dbfd54ba7f00fc93d99c2.jpg)
40
+ Figure 2: A neural energy function models coarse grained structure and is sampled by internal coordinate dynamics. (A) The energy function is formulated as a Markov Random Field with structure-based features and sequence-based weights computed by neural networks (Figure 6). (B) To rapidly sample low-energy configurations, the Langevin dynamics simulator leverages both (i) an internal coordinate parameterization, which is more effective for global rearrangements, and (ii) a Cartesian parameterization, which is more effective for localized structural refinement. (C) The base features of the structure network are rotationally and translationally invariant internal coordinates (not shown), pairwise distances, and pairwise orientations.
41
+
42
+ 2016; Amos & Kolter, 2017; Belanger & McCallum, 2016). Structured Prediction Energy Networks (SPENs) with unrolled optimization (Belanger et al., 2017) are a highly similar approach to ours, differing in terms of the use of optimization rather than sampling. Additional methodologically related work includes approaches to learn energy functions and samplers simultaneously (Kim & Bengio, 2016; Wang & Liu, 2017; Dai et al., 2017; Song et al., 2017; Chen et al., 2018a), to learn efficient MCMC operators (Song et al., 2017; Levy et al., 2018), to build expressive approximating distributions with unrolled Monte Carlo simulations (Salimans et al., 2015; Titsias, 2017), and to learn the parameters of simulators with implicitly defined likelihoods1 (Mohamed & Lakshminarayanan, 2016; Tran et al., 2017).
43
+
44
+ # 2 MODEL
45
+
46
+ Overview NEMO is an end-to-end differentiable model of protein structure $\boldsymbol { X }$ conditioned on sequence information $\pmb { s }$ consisting of three components (Figure 1): (i) a neural energy function $U _ { \pmb \theta } [ \pmb x ; \pmb s ]$ for coarse grained structure $_ { \textbf { \em x } }$ given sequence, (ii) an unrolled simulator that generates approximate samples from $U$ via internal coordinate Langevin dynamics (§ 2.3), and (iii) an imputation network that generates an atomic model $\boldsymbol { X }$ from the final coarse-grained sample $\pmb { x } ^ { ( T ) }$ $\ S 2 . 4 )$ . All components are trained simultaneously via backpropagation through the unrolled process.
47
+
48
+ # 2.1 REPRESENTATION
49
+
50
+ Proteins Proteins are linear polymers (sequences) of amino acids that fold into defined 3D structures. The 20 natural amino acids have a common monomer structure $[ - ( \mathrm { N - H } ) - ( \mathsf { C } \mathrm { - } \mathbb { R } ) - ( \mathsf { C } \mathrm { = } 0 ) - ]$ with variable side-chain R groups that can differ in properties such as hydrophobicity, charge, and ability to form hydrogen bonds. When placed in solvent (such as water or a lipid membrane), interactions between the side-chains, backbone, and solvent drive proteins into particular 3D configurations (‘folds’), which are the basis for understanding protein properties such as biochemical activity, ligand binding, and interactions with drugs.
51
+
52
+ Coordinate representations We predict protein structure $\boldsymbol { X }$ in terms of 5 positions per amino acid: the four heavy atoms of the backbone (N, $\mathrm { C } _ { \alpha }$ , and carbonyl ${ \mathrm { C } } { = } { \mathrm { O } } { \mathrm { \Omega } }$ ) and the center of mass of the side chain R group. While it is well-established that the locations of $\complement _ { \alpha }$ carbons are sufficient to reconstruct a full atomic structure (Kmiecik et al., 2016), we include these additional positions for evaluating backbone hydrogen bonding (secondary structure) and coarse side-chain placement. Internally, the differentiable simulator generates an initial coarse-grained structure (1-position-peramino-acid) with the loss function targeted to the midpoint of the $\complement _ { \alpha }$ carbon and the side chain center of mass.
53
+
54
+ Sequence conditioning We consider two modes for conditioning our model on sequence information: (1) 1-seq, in which $\pmb { s }$ is an $L \times 2 0$ matrix containing a one-hot encoding of the amino acid sequence, and (2) Profile, in which $\pmb { s }$ is an $L \times 4 0$ matrix encoding both the amino acid sequence and a profile of evolutionarily related sequences $( \ S \mathbf { B } . 7 )$ .
55
+
56
+ Internal coordinates In contrast to Cartesian coordinates $_ { \textbf { \em x } }$ , which parameterize structure in terms of absolute positions of points $\pmb { x } _ { i } \in \mathbb { R } ^ { 3 }$ , internal coordinates $_ { z }$ parameterize structure in terms of relative distances and angles between points. We adopt a standard convention for internal coordinates of chains (Parsons et al., 2005) where each point $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { i } }$ is placed in a spherical coordinate system defined by the three preceding points ${ \pmb x } _ { i - 1 } , { \pmb x } _ { i - 2 } , { \pmb x } _ { i - 3 }$ in terms of a radius (bond length2) $\bar { b _ { i } } \in ( 0 , \infty )$ , a polar angle (bond angle) $a _ { i } \in [ 0 , \pi )$ , and an azimuthal angle (dihedral angle) $d _ { i } \in [ 0 , 2 \pi )$ (Figure 2B). We define $z _ { i } = \{ \tilde { b } _ { i } , \tilde { a } _ { i } , d _ { i } \}$ , where $\tilde { b } _ { i } , \tilde { a } _ { i }$ are unconstrained parameterizations of $b _ { i }$ and $a _ { i }$ ( $\ S$ A.1). The transformation $\begin{array} { r } { \pmb { x } = \mathcal { F } ( z ) } \end{array}$ from internal coordinates to Cartesian is then defined by the recurrence
57
+
58
+ $$
59
+ \pmb { x } _ { i } = \pmb { x } _ { i - 1 } + b _ { i } \left[ \hat { \pmb { u } } _ { i - 1 } \ \hat { \pmb { n } } _ { i - 1 } \times \hat { \pmb { u } } _ { i - 1 } \ \hat { \pmb { n } } _ { i - 1 } \right] \left[ \begin{array} { c } { \cos ( \pi - a _ { i } ) } \\ { \sin ( \pi - a _ { i } ) \cos ( d _ { i } ) } \\ { \sin ( \pi - a _ { i } ) \sin ( d _ { i } ) } \end{array} \right] ,
60
+ $$
61
+
62
+ where uˆi = $\begin{array} { r } { \hat { \pmb { u } } _ { i } = \frac { { \pmb x } _ { i } - { \pmb x } _ { i - 1 } } { | | { \pmb x } _ { i } - { \pmb x } _ { i - 1 } | | } } \end{array}$ is a unit vector from ${ \bf { \mathbf { x } } } _ { i - 1 }$ to $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { i } }$ and $\begin{array} { r } { \hat { \pmb { n } } _ { i } = \frac { \hat { \pmb { u } } _ { i - 1 } \times \hat { \pmb { u } } _ { i } } { | | \hat { \pmb { u } } _ { i - 1 } \times \hat { \pmb { u } } _ { i } | | } } \end{array}$ is a unit vector normal to each bond plane. The inverse transformation $z = \mathcal { F } ^ { - 1 } ( \pmb { x } )$ is simpler to compute, as it only involves local (and fully parallelizable) calculations of distances and angles $( \ S \operatorname { A } . 1 )$ .
63
+
64
+ # 2.2 NEURAL ENERGY FUNCTION
65
+
66
+ Deep Markov Random Field We model the distribution of a structure $_ { \textbf { \em x } }$ conditioned on a sequence s with the Boltzmann distribution, $\begin{array} { r } { p _ { \pmb \theta } ( \pmb x | s ) = \frac { 1 } { Z } \exp \left( - U _ { \pmb \theta } [ \pmb x ; \pmb s ] \right) } \end{array}$ , where $U _ { \pmb \theta } [ \pmb x ; \pmb s ]$ is a sequenceconditioned energy function parameterized by a neural network. Our approach is compatible with any differentiable energy function $U [ { \pmb x } ; s ]$ , though we focus on a decomposition
67
+
68
+ $$
69
+ U _ { \pmb \theta } [ \pmb x ; \pmb s ] = \sum _ { i } l _ { i } ( \pmb s ; \pmb \theta ) f _ { i } ( \pmb x ; \pmb \theta ) ,
70
+ $$
71
+
72
+ which is a Markov Random Field with coefficients $\{ l _ { i } ( s ; \theta ) \} _ { i = 1 } ^ { M }$ computed by a sequence network and structural features $\{ f _ { i } ( \pmb { x } ; \pmb { \theta } ) \} _ { i = 1 } ^ { M }$ computed by a structure network (Figure 2A). This decomposition facilitates (i) increased interpretability, as the (learned) structural features are independent of sequence, and (ii) increased computational efficiency, as the sequence-based coefficients can be computed once and reused throughout a simulation.
73
+
74
+ Sequence network The sequence network takes as input one-dimensional sequence information $\pmb { s }$ and outputs: (1) Energetic coefficients, a set of 1- and 2-dimensional sequence features $\{ l _ { i } ( s ; \theta ) \} _ { i = 1 } ^ { M }$ (2) Simulator initial state $z ^ { ( 0 ) }$ , (3) Simulator hyperparameters preconditioning matrix $C$ , and (4) Predicted secondary structure (Figure 6). It is parameterized by a combination of 1D, 2D, and graph convolutions (Gilmer et al., 2017) $( \ S \mathrm { \ A } )$ .
75
+
76
+ Structure network The structure network takes as input a coarse-grained structure $_ { \textbf { \em x } }$ and outputs a set of 1D and 2D structural features $\{ f _ { i } ( { \pmb x } ; { \pmb \theta } ) \} _ { i = 1 } ^ { M }$ (Figure 6). We design the energy function to be invariant to rigid body motions (rotations and translations in SE(3)) by leveraging a set of invariant base features (Figure 2C) which are:
77
+
78
+ 1. Internal coordinates $_ z$ All internal coordinates except 6 are invariant to rotation and translation3 and we mask these in the energy loss.
79
+ 2. Distances $D _ { i j } = \| { \pmb x } _ { i } - { \pmb x } _ { j } \|$ between all pairs of points. We further process these by 4 radial basis functions with (learned) Gaussian kernels.
80
+ 3. Orientation vectors $\hat { \mathbf { v } } _ { i j }$ , which are unit vectors encoding the relative position of point $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { j } }$ in a local coordinate system of $\mathbf { \boldsymbol { x } } _ { i }$ with base vectors $\frac { \hat { \pmb u } _ { i } - \hat { \pmb u } _ { i + 1 } } { \| \hat { \pmb u } _ { i } - \hat { \pmb u } _ { i + 1 } \| }$ , $\hat { \pmb { n } } _ { i + 1 }$ , and the cross product thereof.
81
+
82
+ # 2.3 EFFICIENT SIMULATOR
83
+
84
+ Langevin dynamics The Langevin dynamics is a stochastic differential equation that aymptotically samples from the Boltzmann distribution (Equation 1). It is typically simulated by a first-order discretization as
85
+
86
+ $$
87
+ \pmb { x } ^ { ( t + \epsilon ) } \pmb { x } ^ { ( t ) } - \frac { \epsilon } { 2 } \nabla _ { \pmb { x } } U ^ { ( t ) } + \sqrt { \epsilon } \mathbf { p } , \mathbf { p } \sim \mathcal { N } ( 0 , I ) .
88
+ $$
89
+
90
+ Internal coordinate dynamics The efficiency with which Langevin dynamics explores conformational space is highly dependent on the geometry (and thus parameterization) of the energy landscape $U ( { \pmb x } )$ . While Cartesian dynamics are efficient at local structural rearrangement, internal coordinate dynamics much more efficiently sample global, coherent changes to the topology of the fold (Figure 2B) . We interleave the Cartesian Langevin dynamics with preconditioned Internal Coordinate dynamics,
91
+
92
+ $$
93
+ \boldsymbol { z } ^ { ( t + \epsilon ) } \boldsymbol { z } ^ { ( t ) } - \frac { \epsilon C } { 2 } \nabla _ { \boldsymbol { z } } \boldsymbol { U } ^ { ( t ) } + \sqrt { \epsilon C } \mathbf { p } , ~ \mathbf { p } \sim \mathcal { N } ( 0 , I ) ,
94
+ $$
95
+
96
+ where $C$ is a preconditioning matrix that sets the relative scaling of changes to each degree of freedom. For all simulations we unroll $T = 2 5 0$ time steps, each of which is comprised of one Cartesian step followed by one internal coordinate step (Equation 9,§ A.3).
97
+
98
+ Transform integrator Simulating internal coordinate dynamics is often computationally intensive as it requires rebuilding Cartesian geometry $_ { \textbf { \em x } }$ from internal coordinates $_ { z }$ with $\mathcal { F } ( z )$ (Parsons et al., 2005) which is an intrinsically sequential process. Here we bypass the need for recomputing coordinate transformations at every step by instead computing on-the-fly transformation integration (Figure 3). The idea is to directly apply coordinate updates in one coordinate system to another by numerically integrating the Jacobian. This can be favorable when the Jacobian has a simple structure, such as in our case where it requires only distributed cross products.
99
+
100
+ # 2.4 ATOMIC IMPUTATION
101
+
102
+ Local reference frame reconstruction The imputation network builds an atomic model $\boldsymbol { X }$ from the final coarse coordinates $\pmb { x } ^ { ( T ) }$ . Each atomic coordinate $\mathbf { X } _ { i , j }$ of atom type $j$ at position $i$ is placed in a local reference frame as
103
+
104
+ $$
105
+ { \bf X } _ { i , j } = { \pmb x } _ { i } + e _ { i , j } ( z ; \theta ) \left[ \hat { \pmb u } _ { i } \hat { \pmb n } _ { i + 1 } \hat { \pmb n } _ { i + 1 } \times \hat { \pmb u } _ { i } \right] { \bf r } _ { i , j } ( z ; \theta ) ,
106
+ $$
107
+
108
+ where $e _ { i , j } ( z ; \theta )$ and $\mathbf { r } _ { i , j } ( z ; \theta )$ are computed by a 1D convolutional neural network (Figure 6).
109
+
110
+ # 3 TRAINING
111
+
112
+ We train and evaluate the model on a set of ${ \sim } 6 7 { , } 0 0 0$ protein structures (domains) that are hierarchically and temporally split. The model is trained by gradient descent using a composite loss that combines terms from likelihood-based and empirical-risk minimization-based training.
113
+
114
+ ![](images/1c4da3a73f8c3a99176208fde6a4625d4f229807f91b918d72913bfe95dda5c8.jpg)
115
+ Figure 3: A transform integrator simulates Langevin dynamics in a more favorable coordinate system (e.g. internal coordinates z) directly in terms of the untransformed state variables (e.g. Cartesian $\mathbf { x }$ ). This exchanges the cost of an inner-loop transformation step (e.g. geometry construction $\mathcal { F } ( z ) )$ for an extra Jacobian evaluation, which is fully parallelizable on modern hardware (e.g. GPUs).
116
+
117
+ # 3.1 DATA
118
+
119
+ Structural stratification There are several scales of generalization in protein structure prediction, which range from predicting the structure of a sequence that differs from the training set at a few positions to predicting a 3D fold topology that is absent from training set. To test these various levels of generalization systematically across many different protein families, we built a dataset on top of the CATH hierarchical classification of protein folds (Orengo et al., 1997). CATH hierarchically organizes proteins from the Protein Data Bank (Berman et al., 2000) into domains (individual folds) that are classified at the levels of Class, Architecture, Topology, and Homologous superfamily (from general to specific). We collected protein domains from CATH releases 4.1 and 4.2 up to length 200 and hierarchically and temporally split this set (§ B.1) into training $\mathrm { \sim } 3 5 \mathrm { k }$ folds), validation $\mathord { \sim } 2 1 \mathrm { k }$ folds), and test sets ( $\mathord { \sim } 1 0 \mathrm { k }$ folds).
120
+
121
+ Test subsets The final test set is subdivided into four subsets: C, A, T, and H, based on the level of maximal similarity between a given test domain and domains in the training set. For example, domains in the $\mathbf { C }$ or $\mathbf { A }$ sets may share class and potentially architecture classifications with train but will not share topology (i.e. fold).
122
+
123
+ # 3.2 LOSS
124
+
125
+ Likelihood The gradient of the data-averaged log likelihood of the Boltzmann distribution is
126
+
127
+ $$
128
+ \frac { \partial } { \partial \theta _ { i } } \mathbb { E } _ { \boldsymbol { x } \sim \mathrm { D a t a } } \left[ \log p ( \boldsymbol { x } | \boldsymbol { s } , \boldsymbol { \theta } ) \right] = \mathbb { E } _ { \boldsymbol { x } \sim p ( \boldsymbol { x } | \boldsymbol { \theta } ) } \left[ \frac { \partial } { \partial \theta _ { i } } U _ { \boldsymbol { \theta } } ( \boldsymbol { x } ; \boldsymbol { s } ) \right] - \mathbb { E } _ { \boldsymbol { x } \sim \mathrm { D a t a } } \left[ \frac { \partial } { \partial \theta _ { i } } U _ { \boldsymbol { \theta } } ( \boldsymbol { x } ; \boldsymbol { s } ) \right] ,
129
+ $$
130
+
131
+ which, when ascended, will minimize the average energy of samples from the data relative to samples from the model. In an automatic differentiation setting, we implement a Monte Carlo estimator for (the negative of) this gradient by adding the energy ${ g a p }$ ,
132
+
133
+ $$
134
+ \begin{array} { r } { \mathcal { L } _ { \mathrm { M L } } = U _ { \theta } ( \bot ( \pmb { x } ^ { \mathrm { ( D ) } } ) ; \pmb { s } ) - U _ { \theta } ( \bot ( \pmb { x } ^ { \mathrm { ( M ) } } ) ; \pmb { s } ) , } \end{array}
135
+ $$
136
+
137
+ to the loss, where $\perp$ is an identity operator that sets the gradient to zero4.
138
+
139
+ Empirical Risk In addition to the likelihood loss, which backpropagates through the energy function but not the whole simulation, we developed an empirical risk loss composing several measures of protein model quality. It takes the form
140
+
141
+ $$
142
+ { \mathcal { L } } _ { \mathrm { E R } } = { \mathcal { L } } _ { \mathrm { D i s t a n c e s } } + { \mathcal { L } } _ { \mathrm { A n g l e s } } + { \mathcal { L } } _ { \mathrm { H \mathrm { - } b o n d s } } + { \mathcal { L } } _ { \mathrm { T M \mathrm { - } s c o r e } } + { \mathcal { L } } _ { \mathrm { I n i t } } + { \mathcal { L } } _ { \mathrm { T r a j e c t o r y } }
143
+ $$
144
+
145
+ ![](images/cc2f7a74f2cece312c11e826f3734b7b4e23a9a486fe6129dd0bfa09531c5359.jpg)
146
+ Figure 4: Model generalizes and outperforms end-to-end baseline for unseen fold topologies. Colors indicate varying difficulty levels of protein domains in the test set, with the C (cyan) and A (magenta) subsets containing corresponding to test-set domains with topologies (folds) and superfamilies that were not represented in the training set. (Left) As the model exhibits higher confidence (reduced structural diversity), it becomes more accurate. (Center) The model occasionally achieves TM scores greater than 0.5 even for difficult C and A level generalization tasks. (Right) NEMO outperforms a strong RNN baseline for difficult generalization problems. All results for NEMO and RNN baselines are conditioned on profiles.
147
+
148
+ Table 1: Test set performance across different levels of generalization
149
+
150
+ <table><tr><td>Model</td><td>#params</td><td>Total</td><td>C</td><td>A</td><td>T</td><td>H</td></tr><tr><td>NEMO (ours, profile)</td><td>21.3m</td><td>0.366</td><td>0.274</td><td>0.361</td><td>0.331</td><td>0.431</td></tr><tr><td>NEMO (ours, sequence-only) RNN baseline model (profile)</td><td>19.1m</td><td>0.248</td><td>0.198</td><td>0.245</td><td>0.254</td><td>0.263</td></tr><tr><td>2x100</td><td>5.9m</td><td>0.293</td><td>0.213</td><td>0.230</td><td>0.247</td><td>0.388</td></tr><tr><td>2x300 (avg. of 3)</td><td>8.8m</td><td>0.335</td><td>0.229</td><td>0.282</td><td>0.278</td><td>0.446</td></tr><tr><td></td><td>13.7m</td><td>0.347</td><td>0.222</td><td></td><td></td><td></td></tr><tr><td>2x500</td><td></td><td></td><td></td><td>0.272</td><td>0.286</td><td>0.477</td></tr><tr><td>2x700</td><td>21.4m</td><td>0.309</td><td>0.223</td><td>0.259</td><td>0.261</td><td>0.403</td></tr><tr><td>Number of structures</td><td></td><td>10381</td><td>1537</td><td>1705</td><td>3198</td><td>3941</td></tr></table>
151
+
152
+ schematized in Figure 6. Our combined loss sums all of the terms $\begin{array} { r } { \mathcal { L } = \mathcal { L } _ { \mathrm { E R } } + \mathcal { L } _ { \mathrm { M L } } } \end{array}$ without weighting.
153
+
154
+ # 3.3 STABILIZING BACKPROPAGATION THROUGH TIME
155
+
156
+ We found that the long roll-outs of our simulator were prone to chaotic dynamics and exploding gradients, as seen in other work (Maclaurin et al., 2015; Parmas et al., 2018). Unfortunately, when chaotic dynamics do occur, it is typical for all gradients to explode (across learning steps) and standard techniques such as gradient clipping (Pascanu et al., 2013) are unable to rescue learning $( \ S \ B . 5 )$ . To stabilize training, we developed two complimentary techniques that regularize against chaotic simulator dynamics while still facilitating learning when they arise. They are
157
+
158
+ • Lyapunov regularization We regularize the simulator time-step function (rather than the energy function) to be approximately 1-Lipschitz. (If exactly satisfied, this eliminates the possibility of chaotic dynamics.)
159
+
160
+ • Damped backpropagation through time We exponentially decay gradient accumulation on the backwards pass of automatic differentiation by multiplying each backwards iteration by a damping factor $\gamma$ . We adaptively tune $\gamma$ to cancel the scale of the exploding gradients. This can be thought of as a continuous relaxation of and a quantitatively tunable alternative to truncated backpropagation through time.
161
+
162
+ ![](images/948d67910e60de29004a037c9a0099f1e3d5f2048fad91045938c68d72aa3ef5.jpg)
163
+ Figure 5: Examples of fold generalization at topology and architecture level. These predicted structures show a range of prediction accuracy for structural generalization (C and A) tasks, with the TM-score comparing the top ranked 3D-Jury pick against the target. The largest clusters are the three most-populated clusters derived from 100 models per domain with a within-cluster cutoff of $\mathbf { T M } >$ 0.5. CATH IDs: 2oy8A03; 5c3uA02; 2y6xA00; 3cimB00; 4ykaC00; 2f09A00; 3i5qA02; 2ayxA01.
164
+
165
+ # 4 RESULTS
166
+
167
+ # 4.1 GENERALIZATION ACROSS CATH
168
+
169
+ For each of the 10,381 protein structures in our test set, we sampled 100 models from NEMO, clustered them by structural similarity, and selected a representative structure by a standard consensus algorithm (Ginalski et al., 2003). For evaluation of performance we focus on the TM-Score (Zhang & Skolnick, 2005), a measure of structural similarity between 0 and 1 for which $\mathrm { T M } > 0 . 5$ is typically considered an approximate reconstruction of a fold.
170
+
171
+ Calibrated uncertainty We find that, when the model is confident (i.e. the number of distinct structural clusters is low ${ \sim } 1 { - } 3$ ), it is also accurate with some predictions having average $\mathbf { T M } >$ 0.5 (Figure 4, left). Unsurprisingly, the confidence of the model tends to go with the difficulty of generalization, with the most confident predictions from the H test set and the least confident from C.
172
+
173
+ Structural generalization However, even when sequence identity is low and generalization difficulty is high (Figure 4, center), the model is still able to make some accurate predictions of 3D structures. Figure 5 illustrates some of these successful predictions at C and A levels, specifically 4ykaC00, 5c3uA02 and beta sheet formation in 2oy8A03. We observe that the predictive distribution is multimodal with non-trivial differences between the clusters representing alternate packing of the chain. In some of the models there is uneven distribition of uncertainty along the chain, which sometimes corresponded to loosely packed regions of the protein.
174
+
175
+ Comparison to an end-to-end baseline We constructed a baseline model that is a non-iterative replica of NEMO which replaces the coarse-grained simulator module (and energy function) with a two-layer bidirectional LSTM that directly predicts coarse internal coordinates $z ^ { ( 0 ) }$ (followed by transformation to Cartesian coordinates with $\mathcal { F }$ ). We trained this baseline across a range of hyperparameter values and found that for difficult C, A, and $\mathbf { T }$ tasks, NEMO generalized more effectively than the RNNs (Table 1). For the best performing $2 \mathrm { x } 3 0 0$ architecture, we trained two additional replicates and report the averaged perfomance in Figure 4 (right).
176
+
177
+ Additionally, we report the results of a sequence-only NEMO model in Table 1. Paralleling secondary structure prediction (Rost & Sander, 1993; McGuffin et al., 2000), we find that the availability of evolutionary information has significant impact on prediction quality.
178
+
179
+ # 4.2 ADVANTAGES AND DISADVANTAGES
180
+
181
+ This work presents a novel approach for protein structure prediction that combines the inductive bias of simulators with the speed of directed models. A major advantage of the approach is that model sampling (inference) times can be considerably faster than conventional approaches to protein structure prediction (Table 4). There are two major disadvantages. First, the computational cost of training and sampling is higher than that of angle-predicting RNNs (Figure 10) such as our baseline or AlQuraishi (2018). Consequently, those methods have been scaled to larger datasets than ours (in protein length and diversity) which are more relevant to protein structure prediction tasks. Second, the instability of backpropagating through long simulations is unavoidable and only partially remedied by our approaches of Lipschitz regularization and gradient damping. These approaches can also lead to slower learning and less expressive energy functions. Methods for efficient (i.e. subquadratic) $N$ -body simulations and for more principled stabilization of deep networks may be relevant to addressing both of these challenges in the future.
182
+
183
+ # 5 CONCLUSION
184
+
185
+ We described a model for protein structure given sequence information that combines a coarse-grained neural energy function and an unrolled simulation into an end-to-end differentiable model. To realize this idea at the scale of real proteins, we introduced an efficient simulator for Langevin dynamics in transformed coordinate systems and stabilization techniques for backpropagating through long simulator roll-outs. We find that that model is able to predict the structures of protein molecules with hundreds of atoms while capturing structural uncertainty, and that the model can structurally generalize to distant fold classifications more effectively than a strong baseline.
186
+
187
+ # ACKNOWLEDGEMENTS
188
+
189
+ We thank members of the Marks lab for useful discussions and feedback. Parts of this work were performed on the Orchestra compute cluster at Harvard Medical School.
190
+
191
+ # REFERENCES
192
+
193
+ David H Ackley, Geoffrey E Hinton, and Terrence J Sejnowski. A learning algorithm for boltzmann machines. Cognitive science, 9(1):147–169, 1985.
194
+
195
+ Mohammed AlQuraishi. End-to-end differentiable learning of protein structure. bioRxiv, pp. 265231, 2018.
196
+
197
+ Brandon Amos and J Zico Kolter. Optnet: Differentiable optimization as a layer in neural networks. In International Conference on Machine Learning, pp. 136–145, 2017.
198
+
199
+ Namrata Anand and Possu Huang. Generative modeling for protein structures. In Advances in Neural Information Processing Systems, pp. 7505–7516, 2018.
200
+
201
+ R Apweiler, A Bairoch, CH Wu, WC Barker, B Boeckmann, S Ferro, E Gasteiger, H Huang, R Lopez, M Magrane, et al. Uniprot: the universal protein knowledgebase. Nucleic acids research, 32(Database issue): D115–9, 2004.
202
+
203
+ David Belanger and Andrew McCallum. Structured prediction energy networks. In International Conference on Machine Learning, pp. 983–992, 2016.
204
+
205
+ David Belanger, Bishan Yang, and Andrew McCallum. End-to-end learning for structured prediction energy networks. In International Conference on Machine Learning, pp. 429–439, 2017.
206
+
207
+ Helen M Berman, John Westbrook, Zukang Feng, Gary Gilliland, Talapady N Bhat, Helge Weissig, Ilya N Shindyalov, and Philip E Bourne. The protein data bank. Nucleic acids research, 28(1):235–242, 2000.
208
+
209
+ Changyou Chen, Chunyuan Li, Liquan Chen, Wenlin Wang, Yunchen Pu, and Lawrence Carin Duke. Continuoustime flows for efficient inference and density estimation. In International Conference on Machine Learning, pp. 823–832, 2018a.
210
+
211
+ Minmin Chen, Jeffrey Pennington, and Samuel Schoenholz. Dynamical isometry and a mean field theory of rnns: Gating enables signal propagation in recurrent neural networks. In International Conference on Machine Learning, pp. 872–881, 2018b.
212
+
213
+ Zihang Dai, Amjad Almahairi, Philip Bachman, Eduard Hovy, and Aaron Courville. Calibrating energy-based generative adversarial networks. In International Conference on Learning Representations, 2017.
214
+
215
+ Ken Dill, Robert L Jernigan, and Ivet Bahar. Protein Actions: Principles and Modeling. Garland Science, 2017.
216
+
217
+ Sean R Eddy. Accelerated profile hmm searches. PLoS computational biology, 7(10):e1002195, 2011.
218
+
219
+ Justin Gilmer, Samuel S Schoenholz, Patrick F Riley, Oriol Vinyals, and George E Dahl. Neural message passing for quantum chemistry. arXiv preprint arXiv:1704.01212, 2017.
220
+
221
+ Krzysztof Ginalski, Arne Elofsson, Daniel Fischer, and Leszek Rychlewski. 3d-jury: a simple approach to improve protein structure predictions. Bioinformatics, 19(8):1015–1018, 2003.
222
+
223
+ Ian Goodfellow, Yoshua Bengio, and Aaron Courville. Deep Learning. MIT Press, 2016. http://www. deeplearningbook.org.
224
+
225
+ Mikael Henaff, Arthur Szlam, and Yann LeCun. Recurrent orthogonal networks and long-memory tasks. In International Conference on Machine Learning, pp. 2034–2042, 2016.
226
+
227
+ Sergey Ioffe. Batch renormalization: Towards reducing minibatch dependence in batch-normalized models. In Advances in Neural Information Processing Systems, pp. 1945–1953, 2017.
228
+
229
+ John M Jumper, Nabil F Faruk, Karl F Freed, and Tobin R Sosnick. Trajectory-based training enables protein simulations with accurate folding and boltzmann ensembles in cpu-hours. PLoS computational biology, 14 (12):e1006578, 2018.
230
+
231
+ Wolfgang Kabsch and Christian Sander. Dictionary of protein secondary structure: pattern recognition of hydrogen-bonded and geometrical features. Biopolymers: Original Research on Biomolecules, 22(12): 2577–2637, 1983.
232
+
233
+ Taesup Kim and Yoshua Bengio. Deep directed generative models with energy-based probability estimation. In International Conference on Learning Representations, 2016.
234
+
235
+ Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
236
+
237
+ Sebastian Kmiecik, Dominik Gront, Michal Kolinski, Lukasz Wieteska, Aleksandra Elzbieta Dawid, and Andrzej Kolinski. Coarse-grained protein models and their applications. Chemical Reviews, 116(14):7898–7936, 2016.
238
+
239
+ Andrzej Kolinski, Lukasz Jaroszewski, Piotr Rotkiewicz, and Jeffrey Skolnick. An efficient monte carlo model of protein chains. modeling the short-range correlations between side group centers of mass. The Journal of Physical Chemistry B, 102(23):4628–4637, 1998.
240
+
241
+ Paweł Krupa, Anna Hałabis, Wioletta Zmudzinska, Stanisław Ołdziej, Harold A Scheraga, and Adam Liwo. Maximum likelihood calibration of the unres force field for simulation of protein structure and dynamics. Journal of chemical information and modeling, 57(9):2364–2377, 2017.
242
+
243
+ Yann LeCun, Sumit Chopra, Raia Hadsell, M Ranzato, and F Huang. A tutorial on energy-based learning. Predicting structured data, 1(0), 2006.
244
+
245
+ Daniel Levy, Matthew D Hoffman, and Jascha Sohl-Dickstein. Generalizing hamiltonian monte carlo with neural networks. In International Conference on Learning Representations, 2018.
246
+
247
+ Xiaoyu Lu, Valerio Perrone, Leonard Hasenclever, Yee Whye Teh, and Sebastian Vollmer. Relativistic monte carlo. In Artificial Intelligence and Statistics, pp. 1236–1245, 2017.
248
+
249
+ Dougal Maclaurin, David Duvenaud, and Ryan Adams. Gradient-based hyperparameter optimization through reversible learning. In International Conference on Machine Learning, pp. 2113–2122, 2015.
250
+
251
+ Debora S Marks, Thomas A Hopf, and Chris Sander. Protein structure prediction from sequence variation. Nature biotechnology, 30(11):1072, 2012.
252
+
253
+ Marc A Mart´ı-Renom, Ashley C Stuart, Andras Fiser, Roberto S ´ anchez, Francisco Melo, and Andrej ´ Sali. ˇ Comparative protein structure modeling of genes and genomes. Annual review of biophysics and biomolecular structure, 29(1):291–325, 2000.
254
+
255
+ Liam J McGuffin, Kevin Bryson, and David T Jones. The psipred protein structure prediction server. Bioinformatics, 16(4):404–405, 2000.
256
+
257
+ Shakir Mohamed and Balaji Lakshminarayanan. Learning in implicit generative models. arXiv preprint arXiv:1610.03483, 2016.
258
+
259
+ Christine A Orengo, AD Michie, S Jones, David T Jones, MB Swindells, and Janet M Thornton. Cath–a hierarchic classification of protein domain structures. Structure, 5(8):1093–1109, 1997.
260
+
261
+ Paavo Parmas, Carl Edward Rasmussen, Jan Peters, and Kenji Doya. Pipps: Flexible model-based policy search robust to the curse of chaos. In International Conference on Machine Learning, pp. 4062–4071, 2018.
262
+
263
+ Jerod Parsons, J Bradley Holmes, J Maurice Rojas, Jerry Tsai, and Charlie EM Strauss. Practical conversion from torsion space to cartesian space for in silico protein synthesis. Journal of computational chemistry, 26 (10):1063–1068, 2005.
264
+
265
+ Razvan Pascanu, Tomas Mikolov, and Yoshua Bengio. On the difficulty of training recurrent neural networks. In International Conference on Machine Learning, pp. 1310–1318, 2013.
266
+
267
+ Michael Remmert, Andreas Biegert, Andreas Hauser, and Johannes Soding. Hhblits: lightning-fast iterative ¨ protein sequence searching by hmm-hmm alignment. Nature methods, 9(2):173, 2012.
268
+
269
+ Burkhard Rost and Chris Sander. Prediction of protein secondary structure at better than $70 \%$ accuracy. Journal of molecular biology, 232(2):584–599, 1993.
270
+
271
+ Ruslan Salakhutdinov and Hugo Larochelle. Efficient learning of deep boltzmann machines. In Proceedings of the thirteenth international conference on artificial intelligence and statistics, pp. 693–700, 2010.
272
+
273
+ Tim Salimans, Diederik Kingma, and Max Welling. Markov chain monte carlo and variational inference: Bridging the gap. In International Conference on Machine Learning, pp. 1218–1226, 2015.
274
+
275
+ Naomi Siew, Arne Elofsson, Leszek Rychlewski, and Daniel Fischer. Maxsub: an automated measure for the assessment of protein structure prediction quality. Bioinformatics, 16(9):776–785, 2000.
276
+
277
+ Jiaming Song, Shengjia Zhao, and Stefano Ermon. A-nice-mc: Adversarial training for mcmc. In Advances in Neural Information Processing Systems, pp. 5140–5150, 2017.
278
+
279
+ Steven H Strogatz. Nonlinear dynamics and chaos: with applications to physics, biology, chemistry, and engineering. CRC Press, 2018.
280
+
281
+ Baris E Suzek, Yuqi Wang, Hongzhan Huang, Peter B McGarvey, Cathy H Wu, and UniProt Consortium. Uniref clusters: a comprehensive and scalable alternative for improving sequence similarity searches. Bioinformatics, 31(6):926–932, 2014.
282
+
283
+ Michalis K Titsias. Learning model reparametrizations: Implicit variational inference by fitting mcmc distributions. arXiv preprint arXiv:1708.01529, 2017.
284
+
285
+ Dustin Tran, Rajesh Ranganath, and David Blei. Hierarchical implicit models and likelihood-free variational inference. In Advances in Neural Information Processing Systems, pp. 5523–5533, 2017.
286
+
287
+ Dilin Wang and Qiang Liu. Learning to draw samples with amortized stein variational gradient descent. In Uncertainty in Artificial Intelligence, 2017.
288
+
289
+ Shenlong Wang, Sanja Fidler, and Raquel Urtasun. Proximal deep structured models. In Advances in Neural Information Processing Systems, pp. 865–873, 2016.
290
+
291
+ Yang Zhang and Jeffrey Skolnick. Tm-align: a protein structure alignment algorithm based on the tm-score. Nucleic acids research, 33(7):2302–2309, 2005.
292
+
293
+ ![](images/29683992dc3c6d7c23520e7196e59e407782d3d30b26eb6a45ba6a196cfc5c1e.jpg)
294
+ Figure 6: Model schematic. The model generates an atomic structure $\boldsymbol { X }$ (top right) from sequence information $\pmb { s }$ (top left) via 3 steps: First, a sequence network takes in the sequence information $\pmb { s }$ , processes it with a combination of 1D, 2D, and graph convolutions (MPNN, bottom left), and outputs energy function weights $l$ as well as simulator hyperparameters (top center). Second, the simulator iteratively modifies the structure via Langevin dynamics based on the gradient of the energy landscape (Forces, bottom center). Third, the imputation network constructs predicted atomic coordinates $\boldsymbol { X }$ from the final simulator time step $\pmb { x } ^ { ( T ) }$ . During training, the true atomic coordinates $X ^ { ( \mathsf { D a t a } ) }$ , predicted atomic coordinates $\boldsymbol { X }$ , simulator trajectory $\bar { \pmb { x } ^ { ( 1 ) } } , \dots , \bar { \pmb { x } ^ { ( T ) } }$ , and secondary structure predictions $S S ^ { ( \mathsf { M o d e l } ) }$ feed into a composite loss function (Loss, bottom right), which is then optimized via backpropagation.
295
+
296
+ APPENDICES
297
+
298
+ A MODEL
299
+
300
+ A.1 COORDINATE SYSTEMS
301
+
302
+ Inverse transformation The inverse transformation $z = \mathcal { F } ^ { - 1 } ( \pmb { x } )$ involves fully local computations of bong lengths and angles.
303
+
304
+ $$
305
+ b _ { i } = \left| \left| x _ { i } - \mathbf { x } _ { i - 1 } \right| \right| , \left. a _ { i } = \operatorname { a r c c o s } \left( - { \hat { u } } _ { i } \cdot { \hat { u } } _ { i - 1 } \right) , \right. \ d _ { i } = \operatorname { s i g n } \left( { \hat { u } } _ { i - 2 } \cdot { \hat { n } } _ { i } \right) \operatorname { a r c c o s } \left( { \hat { n } } _ { i - 1 } \cdot { \hat { n } } _ { i } \right) .
306
+ $$
307
+
308
+ Jacobian The Jacobian @x@z defines the infinitesimal response of the Cartesian coordinates x to perturbations of the internal coordinates $\mathbf { z }$ . It will be important for both converting Cartesian forces into angular torques and bond forces as well as the development of our transform integrator. It is
309
+
310
+ ![](images/520390309aa9a4427fa6f67d43b6c35e3b951adf8c34f0dc6f392e132200fa41.jpg)
311
+ Figure 7: Component architectures. (Left) The energy function is the inner product of sequencebased weights and structure-based features. A combination of low- and high-level features capture multi-scale constraints on structure. (Center) The structure network is a lightweight convolutional network operating on both 1D (backbone) and 2D (interaction) features. (Right) Convolutional neural network modules used for sequence processing are composed of residual blocks that interleave spatial convolutions with 1x1 convolutions.
312
+
313
+ defined element-wise as
314
+
315
+ $$
316
+ \begin{array} { r l } & { \frac { \partial \pmb { x } _ { j } } { \partial b _ { i } } = \left\{ \begin{array} { l l } { \hat { \pmb { u } } _ { i } } & { i \leq j } \\ { 0 } & { i > j } \end{array} \right. , } \\ & { \frac { \partial \pmb { x } _ { j } } { \partial a _ { i } } = \left\{ \begin{array} { l l } { \hat { \pmb { n } } _ { i } \times ( \pmb { x } _ { j } - \pmb { x } _ { i - 1 } ) } & { i \leq j } \\ { 0 } & { i > j } \end{array} \right. , } \\ & { \frac { \partial \pmb { x } _ { j } } { \partial d _ { i } } = \left\{ \begin{array} { l l } { \hat { \pmb { u } } _ { i - 1 } \times ( \pmb { x } _ { j } - \pmb { x } _ { i - 1 } ) } & { i \leq j } \\ { 0 } & { i > j } \end{array} \right. . } \end{array}
317
+ $$
318
+
319
+ The Jacobian has a simple form that can be understood by imagining the protein backbone as a robot arm that is planted at $\scriptstyle { \pmb x } _ { 0 }$ (Figure 2B). Increasing or decreasing the bond length $b _ { i }$ extends or retracts all downstream coordinates along the bonds axis, moving a bond angle $a _ { i }$ drives circular motion of all downstream coordinates around the bond normal vector $\hat { \mathbf { \ b { n } } } _ { i }$ centered at $\mathbf { \delta } _ { \mathbf { \mathcal { X } } i - 1 }$ , and moving a dihedral angle $d _ { i }$ drives circular motion of downstream coordinate $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { j } }$ around bond vector $\hat { \pmb { u } } _ { i - 1 }$ centered at ${ \bf { \mathbf { \mathit { x } } } } _ { i - 1 }$ .
320
+
321
+ Unconstrained representations Bond lengths and angles are subject to the constraints $b _ { i } > 0$ and $0 < a _ { i } < \pi$ . We enforce these constraints by representing these degrees of freedom in terms of fully unconstrained variables $\tilde { b } _ { i }$ and $\tilde { a } _ { i }$ via the transformations $b _ { i } = \log \biggl ( 1 + e ^ { \tilde { b } _ { i } } \biggr )$ and $\begin{array} { r } { a _ { i } = \frac { \pi } { 1 + e ^ { - \bar { a } _ { i } } } } \end{array}$ ⇡1+ea˜i . All references to the internal coordinates $_ { z }$ and Jacobians $\textstyle { \frac { \partial { \boldsymbol { x } } } { \partial z } }$ will refer to the use of fully unconstrained representations (Table 2).
322
+
323
+ # A.2 ENERGY FUNCTION
324
+
325
+ Figure 6 provides an overall schematic of the model, including the components of the energy function.
326
+
327
+ CNN primitives All convolutional neural network primitives in the model schematic (Figure 6) follow a common structure consisting of stacks of residual blocks. Each residual block includes consists of a layer of channel mixing (1x1 convolution), a variable-sized convolution layer, and a second layer of channel mixing. We use dropout with $p = 0 . 9$ and Batch Renormalization (Ioffe, 2017) on all convolutional layers. Batch Renormalization rather than Normalization was necessary rather owing to the large variation in sizes of the structures of the proteins and resulting large variation in mini-batch statistics.
328
+
329
+ Table 2: Coordinate systems and representations for protein structure.
330
+
331
+ <table><tr><td>Variable</td><td>Notation</td><td>Shape</td></tr><tr><td>Sequence</td><td>S</td><td>[L,20]</td></tr><tr><td>Cartesian coordinates (coarse)</td><td>C</td><td>[3L,1]</td></tr><tr><td>Internal coordinates</td><td>之</td><td>[3L,1]</td></tr><tr><td>Cartesian coordinates (atomic)</td><td>X</td><td>[3L,A]</td></tr><tr><td>Cartesian coordinates forposition i</td><td>xi</td><td>[3,1]</td></tr><tr><td>Internal coordinate for position i</td><td>2=biaid]</td><td>[3,1]</td></tr><tr><td>Unit vector from xi-1 to xi</td><td>Wi</td><td>[3,1]</td></tr><tr><td>Unit vector normal to bond plane at xi-1</td><td>ni</td><td>[3,1]</td></tr><tr><td>Bond length ||xi- xi-1ll</td><td>bi</td><td>[1]</td></tr><tr><td>Bond angle ∠(ui,-ui-1)</td><td>ai</td><td>[1]</td></tr><tr><td>Dihedral angle ∠(ni,ni-1)</td><td>di</td><td>[1]</td></tr><tr><td>Unconstrained bond length</td><td>bi</td><td>[1]</td></tr><tr><td>Unconstrained bond angle</td><td>ai</td><td>[1]</td></tr><tr><td>Jacobian matrix</td><td>x dz</td><td>[3L,3L]</td></tr></table>
332
+
333
+ # A.3 INTERNAL COORDINATE DYNAMICS WITH A TRANSFORM INTEGRATOR
334
+
335
+ Why sampling vs. optimization Deterministic methods for optimizing the energy $U ( { \pmb x } ; { \pmb s } )$ such as gradient descent or quasi-Newton methods can effectively seek local minima of the energy surface, but are challenged to optimize globally and completely ignore the contribution of the widths of energy minima (entropy) to their probability. We prefer sampling to optimization for three reasons: (i) noise in sampling algorithms can facilitate faster global conformational exploration by overcoming local minima and saddle points, (ii) sampling generates populations of states that respect the width (entropy) of wells in $U$ and can be used for uncertainty quantification, and (iii) sampling allows training with an approximate Maximum Likelihood objective (Equation 5).
336
+
337
+ Langevin Dynamics The Langevin dynamics are a stochastic dynamics that sample from the canonical ensemble. They are defined as a continuous-time stochastic differential equation, and are simulated in discrete time with the first order discretization
338
+
339
+ $$
340
+ \pmb { x } ^ { ( t + \epsilon ) } \pmb { x } ^ { ( t ) } - \frac { \epsilon } { 2 } \nabla _ { \pmb { x } } U ^ { ( t ) } + \sqrt { \epsilon } \mathbf { p } , \mathbf { p } \sim \mathcal { N } ( 0 , I ) .
341
+ $$
342
+
343
+ Each time step of $\epsilon$ involves a descent step down the energy gradient plus a perturbation of Gaussian noise. Importantly, as time tends toward to infinity, the time-distribution of the Langevin dynamics converges to the canonical ensemble. Our goal is to design a dynamics that converge to an approximate sample in a very short period of time.
344
+
345
+ Table 3: Model architecture. Input number of channels $q = 2 0$ for sequence-only and $q = 4 0$ for profiles.
346
+
347
+ <table><tr><td>Location</td><td>Type</td><td>Channels</td><td>#Blocks</td><td>Width</td><td>Dilation</td><td>Stride</td></tr><tr><td>Pre-MPNN</td><td>1D</td><td>128</td><td>12</td><td>3</td><td>[1,2,4, 8] × 3</td><td>1</td></tr><tr><td>MPNN</td><td>1D</td><td>128</td><td>4</td><td>3</td><td>[1, 2, 4, 8]</td><td>1</td></tr><tr><td>MPNN</td><td>2D</td><td>50</td><td>1</td><td>7</td><td>1</td><td>1</td></tr><tr><td>Post-MPNN</td><td>1D</td><td>q+256</td><td>12</td><td>3</td><td>[1,2,4,8] × 3</td><td>1</td></tr><tr><td>Post-MPNN*</td><td>2D</td><td>100</td><td>1</td><td>9</td><td>1</td><td>1</td></tr><tr><td>Imputation</td><td>1D</td><td>q+256</td><td>12</td><td>3</td><td>[1,2,4, 8] × 3</td><td>1</td></tr></table>
348
+
349
+ Coordinate systems and preconditioning The efficiency with which Langevin dynamics explore conformational space is highly dependent on the geometry of the energy landscape $U ( { \pmb x } )$ , which in turn depends on how the system is parameterized. Molecular energy functions in Cartesian coordinates tend to exhibit strong correlations between variables that result from the requirement that underlying molecular geometries satisfy highly stereotyped bond lengths and angles. As a result, simulations of naive Cartesian Langevin dynamics require a small time step to satisfy these constraints and tend to be dominated by high-frequency, localized vibrations of the chain. The large, global motions that are essential to protein folding can require thousands to millions of times steps to manifest.
350
+
351
+ A well-known solution to the complex dependencies of Cartesian coordinates is to carry out optimization and simulation in internal coordinates, which directly parameterize molecular geometries in terms of the bond lengths and angles (Parsons et al., 2005). Internal coordinate parameterizations possess the advantages that (i) bond length and angle constraints are easy to satisfy and (ii) small changes to a single angle can drive large, coherent rearrangements of the chain (Figure 2B). For example, simply replacing x’s with $\mathbf { z }$ ’s in Equation 8 yields the dynamics
352
+
353
+ $$
354
+ \boldsymbol { z } ^ { ( t + \epsilon ) } \boldsymbol { z } ^ { ( t ) } - \frac { \epsilon } { 2 } \nabla _ { \boldsymbol { z } } \boldsymbol { U } ^ { ( t ) } + \sqrt { \epsilon } \mathbf { p } , \qquad \mathbf { p } \sim \mathcal { N } ( 0 , I ) .
355
+ $$
356
+
357
+ The advantages and disadvantages of the two coordinate systems are complementary: Cartesian dynamics efficiently sample local structural rearrangements and inefficiently sample global chain motions, while internal coordinate dynamics efficiently sample global, correlated motions of the chain but are challenged to make precise local rearrangements.
358
+
359
+ The time dynamics of these alternative parameterizations need not be kinetically realistic to converge to the correct distribution over conformational space. Different coordinate systems warp the local geometry of the energy landscape and will in turn rescale and redirect which global vibrational and local vibrations dominate the dynamics. This relative rescaling can be further optimized by applying a global linear transformation to the energy landscape with a preconditioning ‘inverse mass’ matrix $C$ , giving the update
360
+
361
+ $$
362
+ \boldsymbol { z } ^ { ( t + \epsilon ) } \boldsymbol { z } ^ { ( t ) } - \frac { \epsilon C } { 2 } \nabla _ { \boldsymbol { z } } \boldsymbol { U } ^ { ( t ) } + \sqrt { \epsilon C } \mathbf { p } , \mathbf { p } \sim \mathcal { N } ( 0 , I ) .
363
+ $$
364
+
365
+ Transform integrator The need to rebuild Cartesian geometry $_ { \textbf { \em x } }$ from internal coordinates $_ z$ with $\mathcal F ( z )$ at every time step is one of the major costs of conformational sampling codes based on Internal coordinates (Parsons et al., 2005) because it is intrinsically sequential. Here we show how it is possible to bypass the need for geometry reconstruction at every step by instead computing on-the-fly geometry modification.
366
+
367
+ Imagine following a change to the internal coordinates $\Delta z ^ { ( t ) }$ along a straight path from $z ^ { ( t ) }$ to $\tilde { \mathbf { \Lambda } } _ { Z } ( t + \bar { \mathbf { \Lambda } } \epsilon )$ and tracking the corresponding nonlinear path of the Cartesian coordinates from $\mathbf { \boldsymbol { x } } ^ { ( t ) }$ to $\mathbf { \boldsymbol { x } } ^ { ( t + \epsilon ) }$ . If this path is indexed by $u \in ( t , t + \epsilon )$ , then the dynamics of $\mathbf { x }$ with respect to $u$ are given by $\begin{array} { r } { \frac { \partial \pmb { x } } { \partial u } = \frac { \bar { \partial } \pmb { x } } { \partial z } \frac { \partial z } { \partial u } = \frac { \partial \pmb { x } } { \partial z } \frac { 1 } { \epsilon } \Delta z } \end{array}$ @x@z 1✏ z. Integrating the dynamics of x gives
368
+
369
+ $$
370
+ \begin{array} { l } { \displaystyle \pmb { x } ^ { ( t + \epsilon ) } = \mathcal { F } \left( \pmb { z } ^ { ( t ) } + \Delta \pmb { z } ^ { ( t ) } \right) } \\ { \displaystyle = \pmb { x } ^ { ( t ) } + \int _ { t } ^ { t + \epsilon } \frac { 1 } { \epsilon } \frac { \partial \pmb { x } } { \partial \pmb { z } } ^ { ( u ) } \Delta \pmb { z } ^ { ( t ) } d u . } \end{array}
371
+ $$
372
+
373
+ This illustrates that it is possible to convert coordinate changes in one coordinate system (e.g. Internal Coordinates) to coordinate changes in another (e.g. Cartesian) by integrating an autonomous system of ODEs with dynamics governed by the Jacobian. Since $\epsilon$ is small, we integrate this system with a single step of Heun’s method (improved Euler), where we first substitute an Euler approximation to predict $\pmb { x } ^ { ( t + \epsilon ) }$ as
374
+
375
+ $$
376
+ \tilde { \mathbf { x } } ^ { ( t + \epsilon ) } \approx \mathbf { x } ^ { ( t ) } + \frac { \partial \mathbf { x } } { \partial z } ^ { ( t ) } \Delta z ^ { ( t ) } ,
377
+ $$
378
+
379
+ and then substitute the Jacobian evaluated at the predicted state $\tilde { { \mathbf x } } ^ { ( t + \epsilon ) }$ to form trapezoidal approximation
380
+
381
+ $$
382
+ { \pmb x } ^ { ( t + \epsilon ) } \approx { \pmb x } ^ { ( t ) } + \frac { 1 } { 2 } \left( \frac { \partial { \pmb x } ^ { ( t ) } } { \partial z } + \frac { \partial \tilde { \bf x } } { \partial z } ^ { ( t + \epsilon ) } \right) \Delta { \pmb z } ^ { ( t ) } .
383
+ $$
384
+
385
+ ![](images/5fefea7dc47d2136ae3926d2e69174705366c866ef772696adcdd681954301a8.jpg)
386
+ Figure 8: Accounting for second order errors is essential for internal coordinate dynamics. (Top) Discarding the corrector step rapidly accumulates errors due to the curvilinear motions of internal coordinate dynamics. (Bottom) Heun integration with a corrector step accounts for curvature in curvilinear motion.
387
+
388
+ The comparison of this algorithm with naive integration is given in Figure 8. The corrector step is important for eliminating the large second-order errors that arise in curvilinear motions caused by angle changes (Figure 2B and Figure 8). In principle higher-order numerical integration methods or more time steps could increase accuracy at the cost of more evaluations of the Jacobian, but we found that second-order effects seemed to be the most relevant on our timescales.
389
+
390
+ Mixed integrator Cartesian dynamics favor local structural rearrangements, such as the transitioning from a helical to an extended conformation, while internal coordinate dynamics favor global motions such as the change of the overall fold topology. Since both kinds of structural rearrangements are important to the folding process, we form a hybrid integrator (Algorithm 3) by taking one step with each integrator per force evaluation.
391
+
392
+ Translational and rotational detrending Both Cartesian and Internal coordinates are overparameterized with $3 L$ degrees of freedom, since only $3 L - 6$ degrees of freedom are necessary to encode a centered and un-oriented structure5. As a consequence, a significant fraction of the per time-step changes $\Delta \mathbfit { x }$ can be explained by rigid translational and rotational motions of the entire structure. We isolate and remove these components of motion by treating the system $\{ \pmb { x } _ { 1 } , \ldots , \pmb { x } _ { L } \}$ as a set of particles with unit mass, and computing effective structural translational and rotational velocities by summing point-wise momenta.
393
+
394
+ The translational component of motion is simply the average displacement across positions $\Delta { x } _ { i } ^ { \mathrm { { T r a n s } } } =$ $\langle \Delta \pmb { x } _ { i } \rangle$ . For rotational motion around the center of mass, it is convenient to define the non-translational motion as $\Delta \bar { \mathbf { x } } _ { i } = \Delta \mathbf { x } _ { i } - \Delta \mathbf { x } _ { i } ^ { \mathrm { { T r a n s } } }$ and the centered Cartesian coordinates as $\bar { \pmb x } _ { i } = \pmb x _ { i } - \langle \pmb x _ { i } \rangle$ . The point-wise angular momentum is then $\boldsymbol { l } _ { i } = \bar { \mathbf { x } } _ { i } \times \Delta \bar { \mathbf { x } } _ { i }$ and we define a total angular velocity of the structure $\omega$ by summing these and dividing by the moment of inertia as $\begin{array} { r } { \omega = ( \bar { \sum _ { i } } l _ { i } ) / \left( \sum _ { i } \bar { | } | \bar { \mathbf { x } } _ { i } | | _ { 2 } ^ { 2 } \right) } \end{array}$ . We convert the angular velocity $\omega$ into Cartesian displacements with an unrolled Heun integration as $\Delta \mathbf { x } _ { i } ^ { \mathrm { R o t } } = \frac { 1 } { 2 } \boldsymbol { \omega } \times \left( \bar { \mathbf { x } } _ { i } + \boldsymbol { \omega } \times \bar { \mathbf { x } } _ { i } \right)$ , which leaves the isolated structural motions as $\Delta \mathbf { x } _ { i } ^ { \mathrm { { S t r u c t } } } =$ $\Delta { { \bf { x } } _ { i } } - \Delta { { \bf { x } } _ { i } ^ { \mathrm { { T r a n s } } } } - \Delta { { \bf { x } } _ { i } ^ { \mathrm { R o t } } }$ .
395
+
396
+ # Algorithm 3: Mixed Integrator
397
+
398
+ Input : Initial state $z ^ { ( 0 ) }$ , energy $U ( { \pmb x } )$ , time steps $\epsilon _ { x } , \epsilon _ { z }$ , total time $T$ , preconditioners $\mathbf { C } _ { \mathbf { \mathcal { X } } } , \mathbf { C } _ { z }$ ,
399
+ Output :Trajectory $\pmb { x } ^ { ( 0 ) } , \ldots , \pmb { x } ^ { ( T ) }$
400
+ Initialize $\pmb { x } ^ { ( 0 ) } \mathcal { F } ( \pmb { z } ^ { ( 0 ) } )$ ;
401
+ while $t < T$ do $f _ { x } \gets \nabla _ { x } U$ ; x(Cart) CartesianStep $\begin{array} { r } { \langle \pmb { x } ^ { ( t ) } , \pmb { f } _ { \pmb { x } } , \epsilon _ { \pmb { x } } , \mathbf { C } _ { \pmb { x } } \rangle } \end{array}$ ; $\Delta \pmb { x } ^ { ( I n t ) } \mathsf { C 1 }$ ippedInternalStep $( \pmb { x } + \Delta \pmb { x } ^ { ( C a r t ) } , \pmb { f _ { x } } , \epsilon _ { z } , \mathbf { C } _ { z } ) ;$ ; x x + Detrend $( \Delta \pmb { x } ^ { ( C a r t ) } + \Delta \pmb { x } ^ { ( I n t ) } )$ ; $t t + \epsilon$ ;
402
+ end
403
+
404
+ Speed clipping We found it helpful to stabilize the model by enforcing a speed limit on overall structural motions for the internal coordinate steps. This prevents small changes to the energy function during learning from causing extreme dynamics that in turn produce a non-informative learning signal. To accomplish this, we translationally and rotationally detrend the update of the predictor step $\Delta \mathbf { x }$ and compute a hypothetical time step $\hat { \epsilon } _ { z }$ that would limit the fastest motion to 2 Angstroms per iteration. We then compute modified predictor and corrector steps subject to this new, potentially slower, time step. While this breaks the asymptotics of Langevin dynamics, (i) it is unlikely on our timescales that we achieve stationarity and (ii) it can be avoided by regularizing the dynamics away from situations where clipping is necessary. In the future, considering non-Gaussian perturbations with kinetic energies similar to Relativistic Monte Carlo (Lu et al., 2017) might accomplish a similar goal in a more principled manner. The final integrator combining these ideas is presented in Figure 3.
405
+
406
+ # B APPENDIX B: TRAINING
407
+
408
+ # B.1 DATA
409
+
410
+ For a training and validation set, we downloaded all protein domains of length $L \leq 2 0 0$ from Classes $\alpha , \beta$ , and $\alpha / \beta$ in CATH release 4.1 (2015), and then hierarchically purged a randomly selected set of A, $\mathbf { T }$ , and $\mathbf { H }$ categories. This created three validation sets of increasing levels of difficulty: $\mathbf { H }$ , which contains domains with superfamilies that are excluded from train (but fold topologies may be present), T, which contains fold topologies that were excluded from train (fold generalization), and A which contains secondary structure architectures that were excluded from train.
411
+
412
+ For a test set, we downloaded all folds that were new to CATH release 4.2 (2017), which (due to a propensity of structural biology to make new structures of previously solved folds), provided 10,381 test domains. We further stratified this test set into C, A, T, and $\mathbf { H }$ categories based on their nearest CATH classification in the training set.
413
+
414
+ We also analyzed test set stratifications based on nearest neighbors in both training and validation in figure Figure 12. We note that the validation set was not explicitly used to tune hyperparameters due to the large cost of training ( 2 months on 2 M40 GPUs), but we did keep track of validation statistics during training.
415
+
416
+ # B.2 SGD
417
+
418
+ We optimized all models for 200,000 iterations with Adam (Kingma & Ba, 2014).
419
+
420
+ # B.3 LOSS
421
+
422
+ We optimize the model using a composite loss containing several terms, which are detailed as follows.
423
+
424
+ Distance loss We score distances in the model with a contact-focused distance loss
425
+
426
+ $$
427
+ \sum _ { i < j } w _ { i j } \left| D _ { i j } ^ { ( \mathrm { M o d e l } ) } - D _ { i j } ^ { ( \mathrm { D a t a } ) } \right| ,
428
+ $$
429
+
430
+ where the contact-focusing weights are
431
+
432
+ $$
433
+ w _ { i j } = \frac { \sigma \left( \alpha ( D _ { 0 } - \mathrm { m i n } ( D _ { i j } ^ { ( \mathrm { M o d e l } ) } , D _ { i j } ^ { ( \mathrm { D a t a } ) } ) ) \right) } { \sum _ { k < l } \sigma \left( \alpha ( D _ { 0 } - \mathrm { m i n } ( D _ { k l } ^ { ( \mathrm { M o d e l } ) } , D _ { k l } ^ { ( \mathrm { D a t a } ) } ) ) \right) }
434
+ $$
435
+
436
+ and $\begin{array} { r } { \sigma ( u ) = \frac { 1 } { 1 + \exp ( - u ) } } \end{array}$ is the sigmoid function.
437
+
438
+ Angle loss We use the loss
439
+
440
+ $$
441
+ \mathcal { L } _ { \mathrm { a n g l e s } } = \sum _ { i } | | \mathcal { H } ( z _ { i } ^ { ( T ) } ) - \mathcal { H } ( z _ { i } ^ { ( \mathrm { D a t a } ) } ) | | ,
442
+ $$
443
+
444
+ where ${ \mathcal { H } } ( z ) = [ \cos ( a _ { i } ) \ \sin ( a _ { i } ) \cos ( d _ { i } ) \ \sin ( a _ { i } ) \sin ( d _ { i } ) ] ^ { T }$ are unit length feature vectors that map the angles $\{ a _ { i } , d _ { i } \}$ to the unit sphere.
445
+
446
+ Other angular losses, such as the negative log probability of a Von-Mises Fisher distribution, are based on the inner product of the feature vectors $\mathcal { H } ( z _ { a } ) \cdot \mathcal { H } ( z _ { b } )$ rather than the Euclidean distance $| | \mathcal { H } ( z _ { a } ) - \mathcal { H } ( z _ { b } ) | |$ between them. It is worth noting that these two quantities are directly related by $| | \mathcal { H } ( z _ { a } ) - \mathcal { H } ( z _ { b } ) | | = \sqrt { 2 ( 1 - \mathcal { H } ( z _ { a } ) \cdot \mathcal { H } ( z _ { b } ) ) } .$ . Taking $z _ { a }$ as fixed and $z _ { b }$ as the argument, the Euclidean loss has a cusp at $z _ { a }$ whereas the Von-Mises Fisher loss is smooth around $z _ { a }$ . This is analogous to the difference between $L ^ { 1 }$ and $L ^ { 2 }$ losses, where the cusped $L ^ { 1 }$ loss favors median behavior while the smooth $L ^ { 2 }$ loss favors average behavior.
447
+
448
+ Trajectory loss In a further analogy to reinforcement learning, damped backpropation through time necessitates an intermediate loss function that can criticize transient states of the simulator. We compute this by featurizing the per time step coordinates as the product $D _ { i j } \hat { \pmb { v } } _ { i j }$ (Figure 2C) and doing the same contact-weighted averaging as the distance loss.
449
+
450
+ Template Modelling (TM) Score The TM-score (Zhang & Skolnick, 2005),
451
+
452
+ $$
453
+ \sum _ { i } { \frac { 1 } { 1 + \left( { \frac { D _ { i } } { D _ { 0 } } } \right) ^ { 2 } } } ,
454
+ $$
455
+
456
+ is a measure of superposition quality between two protein structures on $[ 0 , 1 ]$ that was presented as an approximately length-independent alternative to RMSD. The TM-score is the best attainable value of the preceding quantity for all possible superpositions of two structures, where $D _ { i } \ =$ $| | \mathbf { \boldsymbol { x } } ^ { ( \mathrm { M o d e l } ) } - \mathbf { \bar { \boldsymbol { x } } } ^ { ( \mathrm { D a t a } ) } | |$ . This requires iterative optimization, which we implemented with a sign gradient descent with 100 iterations to optimally superimpose the model and target structure. We backpropagate through this unrolled optimization process as well as that of the simulator.
457
+
458
+ Hydrogen bond loss We determine intra-backbone hydrogen bonds using the electrostatic model of DSSP (Kabsch & Sander, 1983). First, we place virtual hydrogens at 1 Angstroms along the negative angle bisector of the $C _ { i - 1 } - N _ { i } - C \alpha _ { i }$ bond angle. Second, we compute a putative energy $U _ { i j } ^ { \mathrm { { h - b o n d } } }$ ( $\mathrm { n \ k c a l / m o l } )$ ) for each potential hydrogen bond from an amide donor at $i$ to a carbonyl acceptor at $j$ as
459
+
460
+ $$
461
+ \begin{array} { l } { { \displaystyle U _ { i j } ^ { \mathrm { h - b o n d } } ( { \bf X } ) = \left( \frac { q _ { N } q _ { O } } { D _ { N O } } + \frac { q _ { H } q _ { C } } { D _ { H C } } + \frac { q _ { H } q _ { O } } { D _ { H O } } + \frac { q _ { N } q _ { C } } { D _ { N C } } \right) ~ 3 3 2 } } \\ { { \displaystyle ~ = 0 . 0 8 4 \left( \frac { 1 } { D _ { N O } } + \frac { 1 } { D _ { H C } } - \frac { 1 } { D _ { H O } } - \frac { 1 } { D _ { N C } } \right) ~ 3 3 2 } } \end{array}
462
+ $$
463
+
464
+ where $D _ { a b } = | | \mathbf { X } _ { i , a } - \mathbf { X } _ { j , b } | |$ is the Euclidean distance between atom $a$ of residue $i$ and atom $b$ of residue $j$ . We then make hard assignments of hydrogen bonds for the data with
465
+
466
+ $$
467
+ y _ { i j } ^ { \mathrm { d a t a } } = { \bf 1 } \left( U _ { i j } ^ { \mathrm { h - b o n d } } ( { \bf X } ^ { \mathrm { ( d a t a ) } } ) < - 0 . 5 \right) .
468
+ $$
469
+
470
+ We ‘predict’ the probabilities of hydrogen bonds of the data given the model via logisitic regression of soft model assignments as
471
+
472
+ $$
473
+ y _ { i j } ^ { \mathrm { m o d e l } } = \sigma \left( a \sigma \left( b \left( - U _ { i j } ^ { \mathrm { h - b o n d } } ( \mathbf { X } ^ { ( m o d e l ) } ) + 0 . 5 \right) \right) + c \right) ,
474
+ $$
475
+
476
+ where $a , b , c$ are learned parameters with the softplus parameterizations enforcing $a , b > 0$ and $\sigma ( u ) = 1 / ( 1 + \exp ( - u )$ is the sigmoid function. The final hydrogen bond loss is the cross-entropy between these predictions and the data,
477
+
478
+ $$
479
+ { \mathcal { L } } _ { \mathrm { h - b o n d } } = \sum _ { | i - j | > 2 } y _ { i j } ^ { \mathrm { d a t a } } \log y _ { i j } ^ { \mathrm { m o d e l } } + \left( 1 - y _ { i j } ^ { \mathrm { d a t a } } \right) \log \left( 1 - y _ { i j } ^ { \mathrm { m o d e l } } \right) .
480
+ $$
481
+
482
+ Secondary Structure Prediction We output standard 8-class predictions of secondary structure and score them with a cross-entropy loss.
483
+
484
+ # B.4 STABILIZING BACKPROPAGATION THROUGH TIME
485
+
486
+ The combination of energy function, simulator, and refinement network can build an atomic level model of protein structure from sequence, and our goal is to optimize (meta-learn) this entire procedure by gradient descent. Before going into specifics of the loss function, however, we will discuss a challenges and solutions for computing gradients of unrolled simulations in the face of chaos.
487
+
488
+ # B.5 CHAOS AND EXPLODING GRADIENTS
489
+
490
+ Gradient-based learning of iterative computational procedures such as Recurrent Neural Networks (RNNs) is well known to be subject to the problems of exploding and vanishing gradients (Pascanu et al., 2013). Informally, these occur when the sensitivities of model outputs to inputs become either extremely large or extremely small and the gradient is no longer an informative signal for optimization. We find that backpropagation through unrolled simulations such as those presented is no exception to this rule. Often we observed that a model would productively learn for tens of thousands of iterations, only to suddenly and catastrophically exhibit diverging gradients from which the optimizer could not recover - even when the observed simulation dynamics exhibited no obvious qualitative changes to behavior and the standard solutions of gradient clipping (Pascanu et al., 2013) were in effect. Similar phenomena have been observed previously in the context of meta-learning (Maclaurin et al., 2015) and are explored in detail in a concurrent work (Parmas et al., 2018).
491
+
492
+ In Figure 9, we furnish a minimal example that illustrates how chaos can lead to irrevocable loss of learning. We see that for even a simple particle-in-a-well, some choices of system parameters (such as too large a time step) can lead to chaotic dynamics which are synonymous with explosive gradients. This example is hardly contrived, and is in fact a simple model of the distance potentials between coordinates in our simulations. Moreover, it is important to note that chaos may not be easy to diagnose: for learning rates $\alpha \in [ 1 . 7 , 1 . 8 ]$ the position of the particle $x$ remains more or less confined in the well while the sensitivities diverge to $1 0 ^ { 2 0 0 }$ . It seems unlikely that meta-learning would be able to recover after descending into chaos.
493
+
494
+ The view per time step Exploding gradients and chaotic dynamics involve the same mechanism: a multiplicative accumulation of sensitivities. In dynamical systems this is frequently phrased as ‘exponentially diverging sensitivity to initial conditions’. Intuitively, this can be understood by examining how the Jacobian of an entire trajectory decomposes into a product of Jacobians as
495
+
496
+ $$
497
+ \frac { \partial \pmb { x } ^ { ( T ) } } { \partial \pmb { x } ^ { ( 0 ) } } = \frac { \partial \pmb { x } ^ { ( T ) } } { \partial \pmb { x } ^ { ( T - 1 ) } } \frac { \partial \pmb { x } ^ { ( T - 1 ) } } { \partial \pmb { x } ^ { ( T - 2 ) } } \cdot \cdot \cdot \frac { \partial \pmb { x } ^ { ( 1 ) } } { \partial \pmb { x } ^ { ( 0 ) } } .
498
+ $$
499
+
500
+ When the norms of the per time-step Jacobians @x(t)@x(t1) are typically larger than 1, the sensitivity $\big | \big | \frac { \partial \pmb { x } ^ { ( T ) } } { \partial \pmb { x } ^ { ( 0 ) } } \big | \big |$ will grow exponentially with $T$ . Ideally, we would keep these norms well-behaved which is the rationale recent work on stabilization of RNNs (Henaff et al., 2016; Chen et al., 2018b). Next we will offer a general-purpose regularizer to approximately enforce this goal for any differentiable computational iteration with continuous state.
501
+
502
+ ![](images/ca7d5b1eb6e91174b340bdcfb50f31950203a916d4ab08d2b7044b70de45d1ab.jpg)
503
+ Figure 9: Chaos impedes meta-learning for gradient descent in a well. (a) Gradient descent of a particle in a well with initial conditions $x ^ { ( 0 ) }$ and step size $\alpha$ . (b) Orbit diagrams visualize long-term dynamics from iterations 1000 to 2000 of the position $x$ (top) and the gradient $\frac { d x ^ { ( t ) } } { d x ^ { ( 0 ) } }$ (bottom). When the step size $\alpha$ is small, these dynamics converge to a periodic orbit over $2 ^ { k }$ values where $0 \leq k < \infty$ . After some critical step size, the dynamics undergo a period-doubling bifurcation (Strogatz, 2018), become chaotic, and the gradients regularly diverge to huge numbers.
504
+
505
+ Approximate Lipschitz conditions One condition that guarantees that a deterministic map $F$ : $\mathbb { R } ^ { \tilde { N } } \to \mathbb { R } ^ { N }$ , ${ \pmb x } _ { t } = F ( { \pmb x } _ { t - 1 } , \theta )$ cannot exhibit exponential sensitivity to initial conditions is the condition of being non-expansive (also known as 1-Lipschitz or Metric). That is, for any two input points $\pmb { x } _ { a } , \pmb { x } _ { b } \in \bar { \mathbb { R } } ^ { N }$ , iterating the map cannot increase the distance between them as $\left| F ( \pmb { x } _ { a } , \theta ) - \right.$ $F ( \pmb { x } _ { b } , \theta ) | \leq | \pmb { x } _ { a } - \pmb { x } _ { b } |$ . Repplying the map to the bound immediately implies
506
+
507
+ $$
508
+ | F ^ { ( t ) } ( { \pmb x } , \theta ) - F ^ { ( t ) } ( { \pmb x } + \Delta { \pmb x } , \theta ) | \leq | \Delta { \pmb x } |
509
+ $$
510
+
511
+ for any number of iterations $t$ . Thus, two initially close trajectories iterated through a non-expansive mapping must remain at least that close for arbitrary time.
512
+
513
+ We approximately enforce non-expansivity by performing an online sensitivity analysis within simulations. At randomly selected time-steps, the current time step $\mathbf { \boldsymbol { x } } ^ { ( t ) }$ is rolled back to the preceding state and re-executed with small Gaussian perturbations to the state $\delta \sim \mathcal { N } ( 0 , 1 0 ^ { - 4 } I ) ^ { 6 }$ . We regularize the sensitivity by adding
514
+
515
+ $$
516
+ \mathcal { L } _ { L y a p u n o v } = \operatorname* { m a x } \left( 0 , \log \frac { | F ( { \pmb x } ^ { ( t ) } ) - F ( { \pmb x } ^ { ( t ) } + \pmb \delta ) | } { | \pmb \delta | } \right)
517
+ $$
518
+
519
+ to the loss. Interestingly, the stochastic nature of this approximate regularizer is likely a good thing - a truly non-expansive map is quite limited in what it can model. However, being ‘almost’ non-expansive seems to be incredibly helpful for learning.
520
+
521
+ Damped Backpropagation through Time The approximate Lipschitz conditions (or Lyapunov regularization) encourage but do not guarantee stable backpropagation. When chaotic phasetransitions or otherwise occur we need a fall-back plan to be able to continue learning. At the same time, we would like gradient descent to proceed in the usual manner when simulator dynamics are stable. To this end we introduce a damping factor to backpropagation that can adaptively combat exponentially diverging gradients with exponential discounting (Algorithm 4).
522
+
523
+ Algorithm 4: Damped Backpropagation Through Time
524
+
525
+ <table><tr><td></td><td>Input :Initial state x(O),time-stepping function F(x,s,0), external inputs S1,..., ST parameters 0,Loss function L(x1,.:.,xr),Damping factor O &lt;&lt; γ &lt;1 Output :Exponentially damped gradient Vθ L</td><td></td><td></td></tr><tr><td>Initialize x(O) ← F(z(0));</td><td></td><td></td><td></td></tr><tr><td>for t ← 2,...,T do</td><td></td><td></td><td></td></tr><tr><td></td><td>Compute time step Xt ← F(xt-1,St,0);</td><td></td><td></td></tr><tr><td>end</td><td>Decay the gradient† xt ← (1-γ)⊥(xt) + γxt;</td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td></tr><tr><td></td><td>Compute loss L(x1,..., xT) ;</td><td></td><td></td></tr><tr><td></td><td>Compute gradient VθL ← AutoDiff(L,θ) ;</td><td></td><td></td></tr><tr><td></td><td>twhere ⊥(-)is the stop-gradient function.</td><td></td><td></td></tr></table>
526
+
527
+ Damped backpropagation can be seen as a continuous alternative to the standard approach of Truncated Backpropagation through Time. Rather than setting the gradient to 0 after some fixed intervals of time-steps, we decay it on the backwards pass of reverse-mode differentiation by a factor of $\gamma$ . This is mildly evocative of the notion of discounted future rewards in reinforcement learning. During backpropagation this causes a biased estimate of Jacobians that favors short term sensitivities (or rewards) as
528
+
529
+ $$
530
+ \partial { \frac { \hat { \mathbf { x } ^ { ( t ) } } } { \partial x ^ { ( t - k ) } } } = \left( \left( \left( \gamma { \frac { \partial x ^ { ( t ) } } { \partial x ^ { ( t - 1 ) } } } \right) \gamma { \frac { \partial x ^ { ( t - 1 ) } } { \partial x ^ { ( t - 2 ) } } } \right) \cdot \cdot \cdot \gamma { \frac { \partial x ^ { ( t - k + 1 ) } } { \partial x ^ { ( t - k ) } } } \right) = \gamma ^ { k } { \frac { \partial x ^ { ( t ) } } { \partial x ^ { ( t - k ) } } } .
531
+ $$
532
+
533
+ # B.6 MULTIPLE SEQUENCE ALIGNMENT GENERATION
534
+
535
+ We use multiple sequence alignments of evolutionarily related sequences for both profile construction $( \ S \mathrm { B } . 7 )$ and (ii) data augmentation $( \ S \ B . 8 )$ . For every domain in the dataset, we extracted the sequence from the PDB and then used jackhmmer (Eddy, 2011), to iteratively search the Uniprot90 database (Suzek et al., 2014) (release 4/2016) with 5 iterations and a length-normalized bitscore threshold of 0.3. We then removed sequences with over $50 \%$ gaps relative to the query sequence and then redundancy-reduced the alignment with hhfilter (Remmert et al., 2012) such that all sequences are at least a normalized Hamming distance of 0.8 away from one another.
536
+
537
+ # B.7 PROFILE GENERATION
538
+
539
+ We briefly describe how we construct evolutionary profiles, or position-specific scoring matrices (PSSMs), for each protein domain. Let $\pmb { S } = \{ \pmb { S } ^ { ( 1 ) } , \dots , \pmb { S } ^ { ( L ) } \}$ be the set of $L$ columns of a multiple sequence alignment over $M$ sequences where each column $S ^ { ( i ) }$ is an $M \times q$ matrix that one-hot encodes the sequence data at position $i$ (for an alphabet of size $q$ ). The regularized empirical frequency of letter $a$ at site $i$ is then
540
+
541
+ $$
542
+ f _ { a } ^ { ( i ) } = \frac { \alpha + \sum _ { j } S _ { j a } ^ { ( i ) } } { \alpha + M } ,
543
+ $$
544
+
545
+ where $\alpha$ is a pseudocount that we set to 10. We compute our PSSM features for letter $a$ at site $i$ as
546
+
547
+ $$
548
+ w _ { a } ^ { ( i ) } = \sigma \left( \log \frac { f _ { a } ^ { ( i ) } } { B _ { a } } \right)
549
+ $$
550
+
551
+ where (u) = 11+exp( u) is the logistic sigmoid and $B _ { a }$ is the average frequency of amino acid $a$ in UniProt (Apweiler et al., 2004).
552
+
553
+ Table 4: Qualitative timings. †Results on CATH dataset and 2 M40 GPUs.
554
+
555
+ <table><tr><td>Method</td><td>Generation time</td><td>Training time</td></tr><tr><td>RNNbaseline†</td><td>milliseconds</td><td>~1week</td></tr><tr><td>NEMOt</td><td>seconds</td><td>~ 2 months</td></tr><tr><td>Coevolution-based methods</td><td>minutes to hours</td><td>Coupled to generation</td></tr><tr><td>Physical simulations</td><td>days to weeks</td><td>N/A</td></tr></table>
556
+
557
+ # B.8 EVOLUTIONARY DATA AUGMENTATION
558
+
559
+ To reduce our reliance on alignments and the generation of profiles for inference of new sequences while still leveraging evolutionary sequence data, we augmented our training set by dynamically spiking in diverse, related sequence into the model during training. Given a set of $M$ sequences in the alignment we sample a sequence $t$ based on its normalized Hamming distance $d _ { t }$ with probability
560
+
561
+ $$
562
+ p _ { t } = \frac { e ^ { \lambda _ { \mathrm { E D A } } d _ { t } } } { \sum _ { s = 1 } ^ { M } e ^ { \lambda _ { \mathrm { E D A } } d _ { s } } } ,
563
+ $$
564
+
565
+ where $\lambda _ { \mathrm { E D A } }$ is a scaling parameter that we set to 5. When the alternate sequence contains gaps, we construct a chimeric sequence that substitutes those sites with the query. This strategy increased the number of available sequence-structure pairs by several orders of magnitude, and we used it for both profile and 1-seq based training.
566
+
567
+ # C APPENDIX C: RESULTS
568
+
569
+ # C.1 STRUCTURE GENERATION AND PROCESSING
570
+
571
+ For each sequence from the CATH release 4.2 dataset, 100 structures were generated from both the profile and sequence-only models, while a single structure was generated from the RNN baseline models. The reported TM-scores were calculated using Maxcluster (Siew et al., 2000). A single representative structure was chosen from the ensemble of 100 structures using 3D-Jury (Ginalski et al., 2003). A pairwise distance matrix of TM-scores was calculated for all of the 100 structures in the ensemble. Clusters were determined by agglomerative hierarchical clustering with complete linkage using a TM-score threshold of 0.5 to determine cluster membership.
572
+
573
+ ![](images/6ec077ba2a3ea603b0a6158f8b7c789c10d90baf5a059c78a36c73939e6e7cf5.jpg)
574
+ Figure 10: Sampling speed. Per-protein sampling times for various batch sizes across NEMO and one of the RNN baselines on a single Tesla M40 GPU with 12GB memory and 20 cores. For all results in the main paper, 100 models were sampled per protein followed by consensus clustering with 3D-jury, adding an additional factor of $1 0 ^ { 2 }$ cost between NEMO and the RNN.
575
+
576
+ ![](images/1ea0976aebaf295dca3f2854624f237af2891b00f35061711fa2ceb4cc5ed6dd.jpg)
577
+ Figure 11: Predictive performance of structures generated by the sequence-only model. (left) Structures in the test set are hierarchically organized by CATH classification. Groups further up the tree are broader generalization. (center-left) Ensembles of models with increasing certainty tend to have a better average TM-score. (center-right) TM-score of 3D-jury-selected models versus distance from the training data. Withheld (right) Comparing the energy-based model with and without profiles. Profile information greatly improves protein model accuracy as judged by TM-score.
578
+
579
+ ![](images/163e2a3b7750145d38a8288d4da862c51da4488606921da15da4c3a9a0851df5.jpg)
580
+ Figure 12: Generalization results upon re-stratification. Profile-based model.
581
+
582
+ ![](images/dbd71c9574a8ca5ce6110b2313476bf6ab2cf9096d9c10859d58a93dcf003d7a.jpg)
583
+ Figure 13: RNN baseline performance for different hyperparameters. Predictive performance of the two-layer bidirectional LSTM baseline models across a range of hidden unit dimensions compared to the energy model.
parse/train/Byg3y3C9Km/Byg3y3C9Km_content_list.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/train/Byg3y3C9Km/Byg3y3C9Km_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/train/Byg3y3C9Km/Byg3y3C9Km_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/train/S1lOTC4tDS/S1lOTC4tDS.md ADDED
@@ -0,0 +1,346 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # DREAM TO CONTROL: LEARNING BEHAVIORS BY LATENT IMAGINATION
2
+
3
+ Jimmy Ba University of Toronto
4
+
5
+ Danijar Hafner ∗ Timothy Lillicrap University of Toronto DeepMind Google Brain
6
+
7
+ Mohammad Norouzi Google Brain
8
+
9
+ # Abstract
10
+
11
+ Learned world models summarize an agent’s experience to facilitate learning complex behaviors. While learning world models from high-dimensional sensory inputs is becoming feasible through deep learning, there are many potential ways for deriving behaviors from them. We present Dreamer, a reinforcement learning agent that solves long-horizon tasks from images purely by latent imagination. We efficiently learn behaviors by propagating analytic gradients of learned state values back through trajectories imagined in the compact state space of a learned world model. On 20 challenging visual control tasks, Dreamer exceeds existing approaches in data-efficiency, computation time, and final performance.
12
+
13
+ # 1 INTRODUCTION
14
+
15
+ Intelligent agents can achieve goals in complex environments even though they never encounter the exact same situation twice. This ability requires building representations of the world from past experience that enable generalization to novel situations. World models offer an explicit way to represent an agent’s knowledge about the world in a parametric model that can make predictions about the future.
16
+
17
+ ![](images/d327d66fd0ad9783d8149fdd5707ab2ea8d9125ba7389924d060073ebdd45fc2.jpg)
18
+ Dataset of Experience
19
+
20
+ When the sensory inputs are high-dimensional images, latent dynamics models can abstract observations to predict forward in compact state spaces (Watter et al., 2015; Oh et al., 2017; Gregor et al., 2019). Compared to predictions in image space, latent states have a small memory footprint that enables imagining thousands of trajectories in parallel. Learning effective latent dynamics models is becoming feasible through advances in deep learning and latent variable models (Krishnan et al., 2015; Karl et al., 2016; Doerr et al., 2018; Buesing et al., 2018).
21
+
22
+ ![](images/9a631d6a7117d14932ee2bd92c2fbdff4c5440b21ebeac9094689765a5c34551.jpg)
23
+ Learned Latent Dynamics
24
+
25
+ Behaviors can be derived from dynamics models in many ways. Often, imagined rewards are maximized with a parametric policy (Sutton, 1991; Ha and Schmidhuber, 2018; Zhang et al., 2019) or by online planning (Chua et al., 2018; Hafner et al., 2018). However, considering only rewards within a fixed imagination horizon results in shortsighted behaviors (Wang et al., 2019). Moreover, prior work commonly resorts to derivative-free optimization for robustness to model errors (Ebert et al., 2017; Chua et al., 2018; Parmas et al., 2019), rather than leveraging analytic gradients offered by neural network dynamics (Henaff et al., 2019; Srinivas et al., 2018).
26
+
27
+ Value and Action Learned by Latent Imagination
28
+
29
+ We present Dreamer, an agent that learns long-horizon behaviors from images purely by latent imagination. A novel actor critic algorithm accounts for rewards beyond the imagination horizon while making efficient use of the neural network dynamics. For this, we predict state values and actions in the learned latent space as summarized in Figure 1. The values optimize Bellman consistency for imagined rewards and the policy maximizes the values by propagating their analytic gradients back through the dynamics.
30
+
31
+ In comparison to actor critic algorithms that learn online or by experience replay (Lillicrap et al., 2015; Mnih et al., 2016; Schulman et al., 2017; Haarnoja et al., 2018; Lee et al., 2019), world models can interpolate past experience and offer analytic gradients of multi-step returns for efficient policy optimization.
32
+
33
+ ![](images/f8db63927c642f785139582878fc542dfeb9163a1ced1d891e306451041ef977.jpg)
34
+ Figure 1: Dreamer learns a world model from past experience and efficiently learns farsighted behaviors in its latent space by backpropagating value estimates back through imagined trajectories.
35
+
36
+ ![](images/d9f7c5ebf29f6653896e1df62642d1355ad8bc0a46e7a916bceff0cee540a3de.jpg)
37
+ Figure 2: Image observations for 5 of the 20 visual control tasks used in our experiments. The tasks pose a variety of challenges including contact dynamics, sparse rewards, many degrees of freedom, and 3D environments. Several of these tasks could previously not be solved through world models.
38
+
39
+ The key contributions of this paper are summarized as follows:
40
+
41
+ • Learning long-horizon behaviors by latent imagination Model-based agents can be shortsighted if they use a finite imagination horizon. We approach this limitation by predicting both actions and state values. Training purely by imagination in a latent space lets us efficiently learn the policy by propagating analytic value gradients back through the latent dynamics. • Empirical performance for visual control We pair Dreamer with existing representation learning methods and evaluate it on the DeepMind Control Suite with image inputs, illustrated in Figure 2. Using the same hyper parameters for all tasks, Dreamer exceeds previous model-based and model-free agents in terms of data-efficiency, computation time, and final performance.
42
+
43
+ # 2 CONTROL WITH WORLD MODELS
44
+
45
+ Reinforcement learning We formulate visual control as a partially observable Markov decision process (POMDP) with discrete time step $t \in [ 1 ; T ]$ , continuous vector-valued actions $a _ { t } \sim p ( a _ { t } \ |$ $o _ { \leq t } , a _ { < t } )$ generated by the agent, and high-dimensional observations and scalar rewards $o _ { t } , r _ { t } \sim$ $p ( o _ { t } , r _ { t } \mid o _ { < t } , a _ { < t } )$ generated by the unknown environment. The goal is to develop an agent that maximizes the expected sum of rewards $\textstyle \mathrm { E } _ { p } { \big ( } \sum _ { t = 1 } ^ { T } r _ { t } { \big ) }$ . Figure 2 shows a selection of our tasks.
46
+
47
+ Agent components The classical components of agents that learn in imagination are dynamics learning, behavior learning, and environment interaction (Sutton, 1991). In the case of Dreamer, the behavior is learned by predicting hypothetical trajectories in the compact latent space of the world model. As outlined in Figure 3 and detailed in Algorithm 1, Dreamer performs the following operations throughout the agent’s life time, either interleaved or in parallel:
48
+
49
+ • Learning the latent dynamics model from the dataset of past experience to predict future rewards from actions and past observations. Any learning objective for the world model can be incorporated with Dreamer. We review existing methods for learning latent dynamics in Section 4. • Learning action and value models from predicted latent trajectories, as described in Section 3. The value model optimizes Bellman consistency for imagined rewards and the action model is updated by propagating gradients of value estimates back through the neural network dynamics. • Executing the learned action model in the world to collect new experience for growing the dataset.
50
+
51
+ Latent dynamics Dreamer uses a latent dynamics model that consists of three components. The representation model encodes observations and actions to create continuous vector-valued model states $s _ { t }$ with Markovian transitions (Watter et al., 2015; Zhang et al., 2019; Hafner et al., 2018). The transition model predicts future model states without seeing the corresponding observations that will later cause them. The reward model predicts the rewards given the model states,
52
+
53
+ $$
54
+ \begin{array} { l l } { { \mathrm { R e p r e s e n t a t i o n ~ m o d e l : } \qquad } } & { { p ( s _ { t } \mid s _ { t - 1 } , a _ { t - 1 } , o _ { t } ) } } \\ { { \mathrm { T r a n s i t i o n ~ m o d e l : } \qquad } } & { { q ( s _ { t } \mid s _ { t - 1 } , a _ { t - 1 } ) } } \\ { { \mathrm { R e w a r d ~ m o d e l : } \qquad } } & { { q ( r _ { t } \mid s _ { t } ) . } } \end{array}
55
+ $$
56
+
57
+ We use $p$ for distributions that generate samples in the real environment and $q$ for their approximations that enable latent imagination. Specifically, the transition model lets us predict ahead in the compact latent space without having to observe or imagine the corresponding images. This results in a low memory footprint and fast predictions of thousands of imagined trajectories in parallel.
58
+
59
+ The model mimics a non-linear Kalman filter (Kalman, 1960), latent state space model, or HMM with real-valued states. However, it is conditioned on actions and predicts rewards, allowing the agent to imagine the outcomes of potential action sequences without executing them in the environment.
60
+
61
+ ![](images/89473689530c445c2809e2a19db1486b930224b3c8ab7b6ae24a22abe2ab58cf.jpg)
62
+ Figure 3: Components of Dreamer. (a) From the dataset of past experience, the agent learns to encode observations and actions into compact latent states $\left( \bigcirc \right)$ , for example via reconstruction, and predicts environment rewards $\mathbf { \Pi } ( \circledast )$ . (b) In the compact latent space, Dreamer predicts state values $( \ I ^ { \prime } )$ and actions $( \triangleq )$ that maximize future value predictions by propagating gradients back through imagined trajectories. (c) The agent encodes the history of the episode to compute the current model state and predict the next action to execute in the environment. See Algorithm 1 for pseudo code of the agent.
63
+
64
+ # 3 LEARNING BEHAVIORS BY LATENT IMAGINATION
65
+
66
+ Dreamer learns long-horizon behaviors in the compact latent space of a learned world model by efficiently leveraging the neural network latent dynamics. For this, we propagate stochastic gradients of multi-step returns through neural network predictions of actions, states, rewards, and values using reparameterization. This section describes the main contribution of our paper.
67
+
68
+ Imagination environment The latent dynamics define a Markov decision process (MDP; Sutton, 1991) that is fully observed because the compact model states $s _ { t }$ are Markovian. We denote imagined quantities with $\tau$ as the time index. Imagined trajectories start at the true model states $s _ { t }$ of observation sequences drawn from the agent’s past experience. They follow predictions of the transition model $s _ { \tau } \sim q ( s _ { \tau } \mid s _ { \tau - 1 } , a _ { \tau - 1 } )$ , reward model $\boldsymbol { r } _ { \ u { \tau } } \sim \boldsymbol { q } ( \boldsymbol { r } _ { \ u { \tau } } \mid s _ { \tau } )$ , and a policy $\smash { a _ { \tau } \sim q ( a _ { \tau } \mid s _ { \tau } ) }$ . The objective is to maximize expected imagined rewards $\begin{array} { r } { \mathrm { E } _ { q } \big ( \sum _ { \tau = t } ^ { \infty } \gamma ^ { \tau - \bar { t } } r _ { \tau } \big ) } \end{array}$ with respect to the policy.
69
+
70
+ # Algorithm 1: Dreamer
71
+
72
+ Initialize dataset $\mathcal { D }$ with $S$ random seed episodes.
73
+
74
+ Initialize neural network parameters $\theta , \phi , \psi$ randomly. while not converged do
75
+
76
+ for update step $c = 1 . . C$ do
77
+
78
+ # Model components
79
+
80
+ Representation $p _ { \theta } ( s _ { t } \mid s _ { t - 1 } , a _ { t - 1 } , o _ { t } )$ Transition $q _ { \theta } ( s _ { t } \mid s _ { t - 1 } , a _ { t - 1 } )$ Reward $q _ { \theta } ( r _ { t } \mid s _ { t } )$ Action $q _ { \phi } ( a _ { t } \mid s _ { t } )$ Value $\boldsymbol { v } _ { \boldsymbol { \psi } } ( s _ { t } )$
81
+
82
+ // DDraw $B$ amics leardata sequences $\{ ( a _ { t } , o _ { t } , r _ { t } ) \} _ { t = k } ^ { k + L } \sim \mathcal { D }$ .
83
+ Compute model states $s _ { t } \sim p _ { \theta } \left( s _ { t } ~ | ~ s _ { t - 1 } , a _ { t - 1 } , o _ { t } \right)$ .
84
+ Update $\theta$ using representation learning.
85
+
86
+ # Hyper parameters
87
+
88
+ Seed episodes $S$ Collect interval $C$ Batch size $B$ Sequence length $L$ Imagination horizon $H$ Learning rate $\alpha$ // Environment interaction $o _ { 1 } \gets \in \mathrm { { n v } }$ .reset() for time step $t = 1 . . T$ do
89
+
90
+ Compute $s _ { t } \sim p _ { \theta } \left( s _ { t } ~ | ~ s _ { t - 1 } , a _ { t - 1 } , o _ { t } \right)$ from history.
91
+ Compute $\boldsymbol { a } _ { t } \sim q _ { \phi } ( \boldsymbol { a } _ { t } \mid \boldsymbol { s } _ { t } )$ with the action model.
92
+ Add exploration noise to action.
93
+ $r _ { t } , o _ { t + 1 } \gets \mathsf { e n v }$ .step $( a _ { t } )$ .
94
+
95
+ Add experience to dataset $\mathcal { D } \mathcal { D } \cup \{ ( o _ { t } , a _ { t } , r _ { t } ) _ { t = 1 } ^ { T } \} .$ .
96
+
97
+ ![](images/1e19815833391a90ecd02126c8b6ecb6102cd66f766e7b198a3ac90ffba2cf51.jpg)
98
+ Figure 4: Imagination horizons. We compare the final performance of Dreamer, learning an action model without value prediction, and online planning using PlaNet. Learning a state value model to estimate rewards beyond the imagination horizon makes Dreamer more robust to the horizon length. The agents use pixel reconstruction for representation learning and an action repeat of $R = 2$ .
99
+
100
+ Action and value models Consider imagined trajectories with a finite horizon $H$ . Dreamer uses an actor critic approach to learn behaviors that consider rewards beyond the horizon. We learn an action model and a value model in the latent space of the world model for this. The action model implements the policy and aims to predict actions that solve the imagination environment. The value model estimates the expected imagined rewards that the action model achieves from each state $s _ { \tau }$ ,
101
+
102
+ Value model:
103
+
104
+ $$
105
+ \begin{array} { r l } & { a _ { \tau } \sim q _ { \phi } ( a _ { \tau } \mid s _ { \tau } ) } \\ & { v _ { \psi } ( s _ { \tau } ) \approx \mathrm { E } _ { q ( \cdot \mid s _ { \tau } ) } \big ( \sum _ { \tau = t } ^ { t + H } \gamma ^ { \tau - t } r _ { \tau } \big ) . } \end{array}
106
+ $$
107
+
108
+ The action and value models are trained cooperatively as typical in policy iteration: the action model aims to maximize an estimate of the value, while the value model aims to match an estimate of the value that changes as the action model changes.
109
+
110
+ We use dense neural networks for the action and value models with parameters $\phi$ and $\psi$ , respectively. The action model outputs a tanh-transformed Gaussian (Haarnoja et al., 2018) with sufficient statistics predicted by the neural network. This allows for reparameterized sampling (Kingma and Welling, 2013; Rezende et al., 2014) that views sampled actions as deterministically dependent on the neural network output, allowing us to backpropagate analytic gradients through the sampling operation,
111
+
112
+ $$
113
+ \begin{array} { r } { a _ { \tau } = \operatorname { t a n h } \bigl ( \mu _ { \phi } ( s _ { \tau } ) + \sigma _ { \phi } ( s _ { \tau } ) \epsilon \bigr ) , \quad \epsilon \sim \mathrm { N o r m a l } ( 0 , \mathbb { I } ) . } \end{array}
114
+ $$
115
+
116
+ Value estimation To lof imagined trajectories $\{ s _ { \tau } , a _ { \tau } , r _ { \tau } \} _ { \tau = t } ^ { t + H }$ and value models, we need to estimate the state v. These trajectories branch off of the model states $s _ { t }$ esof horizon $H$ using actions sampled from the action model. State values can be estimated in multiple ways that trade off bias and variance (Sutton and Barto, 2018),
117
+
118
+ $$
119
+ \begin{array} { l } { { \displaystyle \mathrm { V } _ { \mathrm { R } } ( s _ { \tau } ) \doteq \mathrm { E } _ { q _ { \theta } , q _ { \phi } } \biggl ( \displaystyle \sum _ { n = \tau } ^ { t + H } r _ { n } \biggr ) , } } \\ { { \displaystyle \mathrm { V } _ { \mathrm { N } } ^ { k } ( s _ { \tau } ) \doteq \mathrm { E } _ { q _ { \theta } , q _ { \phi } } \biggl ( \displaystyle \sum _ { n = \tau } ^ { h - 1 } \gamma ^ { n - \tau } r _ { n } + \gamma ^ { h - \tau } v _ { \psi } ( s _ { h } ) \biggr ) \quad \mathrm { w i t h } \quad h = \mathrm { m i n } ( \tau + k , t + H ) , } } \\ { { \displaystyle \mathrm { V } _ { \lambda } ( s _ { \tau } ) \doteq ( 1 - \lambda ) \sum _ { n = 1 } ^ { H - 1 } \lambda ^ { n - 1 } \mathrm { V } _ { \mathrm { N } } ^ { n } ( s _ { \tau } ) + \lambda ^ { H - 1 } \mathrm { V } _ { \mathrm { N } } ^ { H } ( s _ { \tau } ) , } } \end{array}
120
+ $$
121
+
122
+ where the expectations are estimated under the imagined trajectories. $\mathrm { V _ { R } }$ simply sums the rewards from $\tau$ until the horizon and ignores rewards beyond it. This allows learning the action model without a value model, an ablation we compare to in our experiments. $\mathrm { V } _ { \mathrm { N } } ^ { k }$ estimates rewards beyond $k$ steps with the learned value model. Dreamer uses $\mathrm { V } _ { \lambda }$ , an exponentially-weighted average of the estimates for different $k$ to balance bias and variance. Figure 4 shows that learning a value model in imagination enables Dreamer to solve long-horizon tasks while being robust to the imagination horizon. The experimental details and results on all tasks are described in Section 6.
123
+
124
+ ![](images/2ef5f86171682781a63bed4df3ae36bea1083084156ea29642abf8c3fc344333.jpg)
125
+ Figure 5: Reconstructions of long-term predictions. We apply the representation model to the first 5 images of two hold-out trajectories and predict forward for 45 steps using the latent dynamics, given only the actions. The recurrent state space model (RSSM; Hafner et al., 2018) performs accurate long-term predictions, enabling Dreamer to learn successful behaviors in a compact latent space.
126
+
127
+ Learning objective To update the action and value models, we first compute the value estimates $\mathrm { V } _ { \lambda } ( s _ { \tau } )$ for all states $s _ { \tau }$ along the imagined trajectories. The objective for the action model $q _ { \phi } ( a _ { \tau } \mid s _ { \tau } )$ is to predict actions that result in state trajectories with high value estimates. The objective for the value model $v _ { \psi } ( s _ { \tau } )$ , in turn, is to regress the value estimates,
128
+
129
+ $$
130
+ \operatorname* { m a x } _ { \phi } \mathrm { E } _ { q _ { \theta } , q _ { \phi } } \left( \sum _ { \tau = t } ^ { t + H } \mathrm { V } _ { \lambda } ( s _ { \tau } ) \right) , \qquad ( 7 ) \qquad \operatorname* { m i n } _ { \psi } \mathrm { E } _ { q _ { \theta } , q _ { \phi } } \left( \sum _ { \tau = t } ^ { t + H } \frac { 1 } { 2 } \Big \| v _ { \psi } ( s _ { \tau } ) - \mathrm { V } _ { \lambda } ( s _ { \tau } ) ) \Big \| ^ { 2 } \right) .
131
+ $$
132
+
133
+ The value model is updated to regress the targets, around which we stop the gradient as typical (Sutton and Barto, 2018). The action model uses analytic gradients through the learned dynamics to maximize the value estimates. To understand this, we note that the value estimates depend on the reward and value predictions, which depend on the imagined states, which in turn depend on $\begin{array} { r } { \nabla _ { \phi } \mathrm { E } _ { q _ { \theta } , q _ { \phi } } \big ( \sum _ { \tau = t } ^ { t + H } \mathrm { V } _ { \lambda } ( s _ { \tau } ) \big ) } \end{array}$ all steps are implemented as neural networks, we analytically compute by stochastic backpropagation (Kingma and Welling, 2013; Rezende et al., 2014). We use reparameterization for continuous actions and latent states and straight-through gradients (Bengio et al., 2013) for discrete actions. The world model is fixed while learning behaviors. In tasks with early termination, the world model also predicts the discount factor from each latent state to weigh the time steps in Equations 7 and 8 by the cumulative product of the predicted discount factors, so terms are weighted down based on how likely the imagined trajectory would have ended.
134
+
135
+ Comparison to actor critic methods Agents using Reinforce gradients (Williams, 1992), such as A3C and PPO (Mnih et al., 2016; Schulman et al., 2017), employ value baselines to reduce gradient variance, while Dreamer backpropagates through the value model. This is similar to deterministic or reparameterized actor critics (Silver et al., 2014), such as DDPG and SAC (Lillicrap et al., 2015; Haarnoja et al., 2018). However, these do not leverage gradients through transitions and only maximize immediate Q-values. MVE and STEVE (Feinberg et al., 2018; Buckman et al., 2018) extend them to multi-step Q-learning with learned dynamics to provide more accurate Q-value targets. We predict state values, which is sufficient for policy optimization since we backpropagate through the dynamics. Refer to Section 5 for a more detailed comparison to related work.
136
+
137
+ # 4 LEARNING LATENT DYNAMICS
138
+
139
+ Learning behaviors in imagination requires a world model that generalizes well. We focus on latent dynamics models that predict forward in a compact latent space, facilitating long-term predictions and allowing the agent to imagine thousands of trajectories in parallel. Several objectives for learning representations for control have been proposed (Watter et al., 2015; Jaderberg et al., 2016; Oord et al., 2018; Eslami et al., 2018). We review three approaches for learning representations to use with Dreamer: reward prediction, image reconstruction, and contrastive estimation.
140
+
141
+ Reward prediction Latent imagination requires a representation model $p ( s _ { t } \mid s _ { t - 1 } , a _ { t - 1 } , o _ { t } )$ , transition model $q ( s _ { t } \mid s _ { t - 1 } , a _ { t - 1 } , \bar { ) }$ , and reward model $q ( r _ { t } \mid s _ { t } )$ , as described in Section 2. In principle, this could be achieved by simply learning to predict future rewards given actions and past observations (Oh et al., 2017; Gelada et al., 2019; Schrittwieser et al., 2019). With a large and diverse dataset, such representations should be sufficient for solving a control task. However, with a finite dataset and especially when rewards are sparse, learning about observations that correlate with rewards is likely to improve the world model (Jaderberg et al., 2016; Gregor et al., 2019).
142
+
143
+ ![](images/850edcfff38df126bd48410320f30bae3bc5443dd9c224051abff742bb4817c2.jpg)
144
+ Figure 6: Performance comparison to existing methods. Dreamer inherits the data-efficiency of PlaNet while exceeding the asymptotic performance of the best model-free agents. After $5 \times 1 0 ^ { 6 }$ environment steps, Dreamer reaches an average performance of 823 across tasks, compared to PlaNet at 332 and the top model-free D4PG agent at 786 after $1 0 ^ { 9 }$ steps. Results are averages over 5 seeds.
145
+
146
+ Reconstruction We first describe the world model used by PlaNet (Hafner et al., 2018) that learns latent dynamics by reconstructing images as shown in Figure 3a. The world model consists of the following components, where the observation model is only used to provide a learning signal,
147
+
148
+ $$
149
+ { \begin{array} { r l r l } & { { \mathrm { R e p r e s e n t a t i o n ~ m o d e l : } } \quad } & & { p _ { \theta } ( s _ { t } \mid s _ { t - 1 } , a _ { t - 1 } , o _ { t } ) } \\ & { { \mathrm { O b s e r v a t i o n ~ m o d e l : } } \quad } & & { q _ { \theta } ( o _ { t } \mid s _ { t } ) } \\ & { { \mathrm { R e w a r d ~ m o d e l : } } \quad } & & { q _ { \theta } ( r _ { t } \mid s _ { t } ) } \\ & { { \mathrm { T r a n s i t i o n ~ m o d e l : } } \quad } & & { q _ { \theta } ( s _ { t } \mid s _ { t - 1 } , a _ { t - 1 } ) . } \end{array} }
150
+ $$
151
+
152
+ The components are optimized jointly to increase the variational lower bound (ELBO; Jordan et al., 1999) or more generally the variational information bottleneck (VIB; Tishby et al., 2000; Alemi et al., 2016). As derived in Appendix B, the bound includes reconstruction terms for observations and rewards and a KL regularizer. The expectation is taken under the dataset and representation model,
153
+
154
+ $$
155
+ \begin{array} { r l } & { \mathcal { T } _ { \mathrm { R E C } } \doteq \mathrm { E } _ { p } \Bigg ( \displaystyle \sum _ { t } \left( \mathcal { T } _ { \mathrm { O } } ^ { t } + \mathcal { T } _ { \mathrm { R } } ^ { t } + \mathcal { I } _ { \mathrm { D } } ^ { t } \right) \Bigg ) + \mathrm { c o n s t } \qquad \mathcal { I } _ { \mathrm { O } } ^ { t } \doteq \mathrm { l n } q ( o _ { t } \mid s _ { t } ) } \\ & { \mathcal { I } _ { \mathrm { R } } ^ { t } \doteq \mathrm { l n } q ( r _ { t } \mid s _ { t } ) \qquad \mathcal { I } _ { \mathrm { D } } ^ { t } \doteq \ - \beta \operatorname { K L } \big ( p ( s _ { t } \mid s _ { t - 1 } , a _ { t - 1 } , o _ { t } ) \big \parallel q ( o _ { t } \mid s _ { t - 1 } , a _ { t - 1 } ) \big ) . } \end{array}
156
+ $$
157
+
158
+ We implement the transition model as a recurrent state space model (RSSM; Hafner et al., 2018), the representation model by combining the RSSM with a convolutional neural network (CNN; LeCun et al., 1989) applied to the image observation, the observation model as a transposed CNN, and the reward model as a dense network. The combined parameter vector $\theta$ is updated by stochastic backpropagation (Kingma and Welling, 2013; Rezende et al., 2014). Figure 5 shows video predictions of this model. We refer to Appendix A and Hafner et al. (2018) model details.
159
+
160
+ Contrastive estimation Predicting pixels can require high model capacity. We can also encourage mutual information between model states and observations by instead predicting the states from the images (Guo et al., 2018). This replaces the observation model with a state model,
161
+
162
+ State model:
163
+
164
+ $$
165
+ q _ { \theta } { \left( s _ { t } \mid o _ { t } \right) } .
166
+ $$
167
+
168
+ While the reconstruction objective used the fact that the observation marginal is a constant, we now face the state marginal. As shown in Appendix B, this can be estimated via noise contrastive estimation (NCE; Gutmann and Hyvärinen, 2010; Oord et al., 2018) by averaging the state model over observations $o ^ { \prime }$ of the current sequence batch. Intuitively, $q ( s _ { t } \mid o _ { t } )$ makes the state predictable from the current image while $\ln { \textstyle \sum _ { o ^ { \prime } } \bar { q } } ( s _ { t } \mid o ^ { \prime } )$ keeps it diverse to prevent collapse,
169
+
170
+ $$
171
+ \mathcal { I } _ { \mathrm { N C E } } \doteq \mathrm { E } \biggl ( \sum _ { t } \Big ( \mathcal { I } _ { \mathrm { S } } ^ { t } + \mathcal { I } _ { \mathrm { R } } ^ { t } + \mathcal { I } _ { \mathrm { D } } ^ { t } \Big ) \biggr ) \quad \mathcal { I } _ { \mathrm { S } } ^ { t } \doteq \ln q ( s _ { t } \mid o _ { t } ) - \ln \left( \sum _ { o ^ { \prime } } q ( s _ { t } \mid o ^ { \prime } ) \right) .
172
+ $$
173
+
174
+ We implement the state model as a CNN and again optimize the bound with respect to the combined parameter vector $\theta$ using stochastic backpropagation. While avoiding pixel prediction, the amount of information this bound can extract efficiently is limited (McAllester and Statos, 2018). We empirically compare reward, reconstruction, and contrastive objectives in our experiments in Figure 8.
175
+
176
+ ![](images/7cb2a9948aaab447ba5b50c03e1ad20e63c9bf9369affa3ea5f7c2c2971093b9.jpg)
177
+ Figure 7: Dreamer succeeds at visual control tasks that require long-horizon credit assignment, such as the acrobot and hopper tasks. Optimizing only imagined rewards within the horizon via an action model or by online planning yields shortsighted behaviors that only succeed in reactive tasks, such as in the walker domain. The performance on all 20 tasks is summarized in Figure 6 and training curves are shown in Appendix D. See Tassa et al. (2018) for performance curves of D4PG and A3C.
178
+
179
+ # 5 RELATED WORK
180
+
181
+ Prior works learn latent dynamics for visual control by derivative-free policy learning or online planning, augment model-free agents with multi-step predictions, or use analytic gradients of Qvalues or multi-step rewards, often for low-dimensional tasks. In comparison, Dreamer uses analytic gradients to efficiently learn long-horizon behaviors for visual control purely by latent imagination.
182
+
183
+ Control with latent dynamics E2C (Watter et al., 2015) and RCE (Banijamali et al., 2017) embed images to predict forward in a compact space to solve simple tasks. World Models (Ha and Schmidhuber, 2018) learn latent dynamics in a two-stage process to evolve linear controllers in imagination. PlaNet (Hafner et al., 2018) learns them jointly and solves visual locomotion tasks by latent online planning. SOLAR (Zhang et al., 2019) solves robotic tasks via guided policy search in latent space. I2A (Weber et al., 2017) hands imagined trajectories to a model-free policy, while Lee et al. (2019) and Gregor et al. (2019) learn belief representations to accelerate model-free agents.
184
+
185
+ Imagined multi-step returns VPN (Oh et al., 2017), MVE (Feinberg et al., 2018), and STEVE (Buckman et al., 2018) learn dynamics for multi-step Q-learning from a replay buffer. AlphaGo (Silver et al., 2017) combines predictions of actions and state values with planning, assuming access to the true dynamics. Also assuming access to the dynamics, POLO (Lowrey et al., 2018) plans to explore by learning a value ensemble. MuZero (Schrittwieser et al., 2019) learns task-specific reward and value models to solve challenging tasks but requires large amounts of experience. PETS (Chua et al., 2018), VisualMPC (Ebert et al., 2017), and PlaNet (Hafner et al., 2018) plan online using derivative-free optimization. POPLIN (Wang and Ba, 2019) improves over online planning by self-imitation. Piergiovanni et al. (2018) learn robot policies by imagination with a latent dynamics model. Planning with neural network gradients was shown on small problems (Schmidhuber, 1990; Henaff et al., 2018) but has been challenging to scale (Parmas et al., 2019).
186
+
187
+ Analytic value gradients DPG (Silver et al., 2014), DDPG (Lillicrap et al., 2015), and SAC (Haarnoja et al., 2018) leverage gradients of learned immediate action values to learn a policy by experience replay. SVG (Heess et al., 2015) reduces the variance of model-free on-policy algorithms by analytic value gradients of one-step model predictions. Concurrent work by Byravan et al. (2019) uses latent imagination with deterministic models for navigation and manipulation tasks. ME-TRPO (Kurutach et al., 2018) accelerates an otherwise model-free agent via gradients of predicted rewards for proprioceptive inputs. DistGBP (Henaff et al., 2017; 2019) uses model gradients for online planning in simple tasks.
188
+
189
+ ![](images/6454d7e9fc0f9e0992dd9840b84c4ab2b8972dfe74176d26757c747a902489ee.jpg)
190
+ Figure 8: Comparison of representation learning objectives to be used with Dreamer. Pixel reconstruction performs best for the majority of tasks. The contrastive objective solves about half of the tasks, while predicting rewards alone was not sufficient in our experiments. The results suggest that future developments in learning representations are likely to translate into improved task performance for Dreamer. The performance curves for all tasks are included in Appendix E.
191
+
192
+ # 6 EXPERIMENTS
193
+
194
+ We experimentally evaluate Dreamer on a variety of control tasks. We designed the experiments to compare Dreamer to current best methods in the literature, and to evaluate its ability to solve tasks with long horizons, continuous actions, discrete actions, and early termination. We further compare the orthogonal choice of learning objective for the world model. The source code for all our experiments and videos of Dreamer are available at https://danijar.com/dreamer.
195
+
196
+ Control tasks We evaluate Dreamer on 20 visual control tasks of the DeepMind Control Suite (Tassa et al., 2018), illustrated in Figure 2. These tasks pose a variety of challenges, including sparse rewards, contact dynamics, and 3D scenes. We selected the tasks on which Tassa et al. (2018) report non-zero performance from image inputs. Agent observations are images of shape $6 4 \times 6 4 \times 3$ , actions range from 1 to 12 dimensions, rewards range from 0 to 1, episodes last for 1000 steps and have randomized initial states. We use a fixed action repeat of $R = 2$ across tasks. We further evaluate the applicability of Dreamer to discrete actions and early termination on a subset of Atari games (Bellemare et al., 2013) and DeepMind Lab levels (Beattie et al., 2016) as detailed in Appendix C.
197
+
198
+ Implementation Our implementation uses TensorFlow Probability (Dillon et al., 2017). We use a single Nvidia V100 GPU and 10 CPU cores for each training run. The training time for our Dreamer implementation is below 5 hours per $1 0 ^ { 6 }$ environment steps on the control suite, compared to 11 hours for online planning using PlaNet, and the 24 hours used by D4PG to reach similar performance. We use the same hyper parameters across all continuous tasks, and similarly across all discrete tasks, detailed in Appendix A. The world models are learned via reconstruction unless specified.
199
+
200
+ Baseline methods The highest reported performance on the continuous tasks is achieved by D4PG (Barth-Maron et al., 2018), an improved variant of DDPG (Lillicrap et al., 2015) that uses distributed collection, distributional Q-learning, multi-step returns, and prioritized replay. We include the scores for D4PG with pixel inputs and A3C (Mnih et al., 2016) with state inputs from Tassa et al. (2018). PlaNet (Hafner et al., 2018) learns the same world model as Dreamer and selects actions via online planning without an action model and drastically improves over D4PG and A3C in data efficiency. We re-run PlaNet with $R = 2$ for a unified experimental setup. For Atari, we show the final performance of SimPLe (Kaiser et al., 2019), DQN (Mnih et al., 2015) and Rainbow (Hessel et al., 2018) reported by Castro et al. (2018), and for DeepMind Lab that of IMPALA (Espeholt et al., 2018) as a guideline.
201
+
202
+ Performance To evaluate the performance of Dreamer, we compare it to state-of-the-art reinforcement learning agents. The results are summarized in Figure 6. With an average score of 823 across tasks after $5 \times \bar { 1 0 ^ { 6 } }$ environment steps, Dreamer exceeds the performance of the strong model-free D4PG agent that achieves an average of 786 within $1 0 ^ { 9 }$ environment steps. At the same time, Dreamer inherits the data-efficiency of PlaNet, confirming that the learned world model can help to generalize from small amounts of experience. The empirical success of Dreamer shows that learning behaviors by latent imagination with world models can outperform top methods based on experience replay.
203
+
204
+ Long horizons To investigate its ability to learn long-horizon behaviors, we compare Dreamer to alternatives for deriving behaviors from the world model at various horizon lengths. For this, we learn an action model to maximize imagined rewards without a value model and compare to online planning using PlaNet. Figure 4 shows the final performance for different imagination horizons, confirming that the value model makes Dreamer more robust to the horizon and performs well even for short horizons. Performance curves for all 19 tasks with horizon of 20 are shown in Appendix D, where Dreamer outperforms the alternatives on 16 of 20 tasks, with 4 ties.
205
+
206
+ Representation learning Dreamer can be used with any differentiable dynamics model that predicts future rewards given actions and past observations. Since the representation learning objective is orthogonal to our algorithm, we compare three natural choices described in Section 4: pixel reconstruction, contrastive estimation, and pure reward prediction. Figure 8 shows clear differences in task performance for different representation learning approaches, with pixel reconstruction outperforming contrastive estimation on most tasks. This suggests that future improvements in representation learning are likely to translate to higher task performance with Dreamer. Reward prediction alone was not sufficient in our experiments. Further ablations are included in the appendix of the paper.
207
+
208
+ # 7 CONCLUSION
209
+
210
+ We present Dreamer, an agent that learns long-horizon behaviors purely by latent imagination. For this, we propose an actor critic method that optimizes a parametric policy by propagating analytic gradients of multi-step values back through learned latent dynamics. Dreamer outperforms previous methods in data-efficiency, computation time, and final performance on a variety of challenging continuous control tasks with image inputs. We further show that Dreamer is applicable to tasks with discrete actions and early episode termination. Future research on representation learning can likely scale latent imagination to environments of higher visual complexity.
211
+
212
+ Acknowledgements We thank Simon Kornblith, Benjamin Eysenbach, Ian Fischer, Amy Zhang, Geoffrey Hinton, Shane Gu, Adam Kosiorek, Jacob Buckman, Calvin Luo, and Rishabh Agarwal, and our anonymous reviewers for feedback and discussions. We thank Yuval Tassa for adding the quadruped environment to the control suite.
213
+
214
+ # REFERENCES
215
+
216
+ A. A. Alemi, I. Fischer, J. V. Dillon, and K. Murphy. Deep variational information bottleneck. arXiv preprint arXiv:1612.00410, 2016.
217
+ E. Banijamali, R. Shu, M. Ghavamzadeh, H. Bui, and A. Ghodsi. Robust locally-linear controllable embedding. arXiv preprint arXiv:1710.05373, 2017.
218
+ G. Barth-Maron, M. W. Hoffman, D. Budden, W. Dabney, D. Horgan, A. Muldal, N. Heess, and T. Lillicrap. Distributed distributional deterministic policy gradients. arXiv preprint arXiv:1804.08617, 2018.
219
+ C. Beattie, J. Z. Leibo, D. Teplyashin, T. Ward, M. Wainwright, H. Küttler, A. Lefrancq, S. Green, V. Valdés, A. Sadik, et al. Deepmind lab. arXiv preprint arXiv:1612.03801, 2016.
220
+ M. G. Bellemare, Y. Naddaf, J. Veness, and M. Bowling. The arcade learning environment: An evaluation platform for general agents. Journal of Artificial Intelligence Research, 47:253–279, 2013.
221
+ Y. Bengio, N. Léonard, and A. Courville. Estimating or propagating gradients through stochastic neurons for conditional computation. arXiv preprint arXiv:1308.3432, 2013.
222
+ J. Buckman, D. Hafner, G. Tucker, E. Brevdo, and H. Lee. Sample-efficient reinforcement learning with stochastic ensemble value expansion. In Advances in Neural Information Processing Systems, pages 8224–8234, 2018.
223
+ L. Buesing, T. Weber, S. Racaniere, S. Eslami, D. Rezende, D. P. Reichert, F. Viola, F. Besse, K. Gregor, D. Hassabis, et al. Learning and querying fast generative models for reinforcement learning. arXiv preprint arXiv:1802.03006, 2018.
224
+ A. Byravan, J. T. Springenberg, A. Abdolmaleki, R. Hafner, M. Neunert, T. Lampe, N. Siegel, N. Heess, and M. Riedmiller. Imagined value gradients: Model-based policy optimization with transferable latent dynamics models. arXiv preprint arXiv:1910.04142, 2019.
225
+ P. S. Castro, S. Moitra, C. Gelada, S. Kumar, and M. G. Bellemare. Dopamine: A research framework for deep reinforcement learning. arXiv preprint arXiv:1812.06110, 2018.
226
+ K. Chua, R. Calandra, R. McAllister, and S. Levine. Deep reinforcement learning in a handful of trials using probabilistic dynamics models. In Advances in Neural Information Processing Systems, pages 4754–4765, 2018.
227
+ D.-A. Clevert, T. Unterthiner, and S. Hochreiter. Fast and accurate deep network learning by exponential linear units (elus). arXiv preprint arXiv:1511.07289, 2015.
228
+ J. V. Dillon, I. Langmore, D. Tran, E. Brevdo, S. Vasudevan, D. Moore, B. Patton, A. Alemi, M. Hoffman, and R. A. Saurous. Tensorflow distributions. arXiv preprint arXiv:1711.10604, 2017.
229
+ A. Doerr, C. Daniel, M. Schiegg, D. Nguyen-Tuong, S. Schaal, M. Toussaint, and S. Trimpe. Probabilistic recurrent state-space models. arXiv preprint arXiv:1801.10395, 2018.
230
+ F. Ebert, C. Finn, A. X. Lee, and S. Levine. Self-supervised visual planning with temporal skip connections. arXiv preprint arXiv:1710.05268, 2017.
231
+ S. A. Eslami, D. J. Rezende, F. Besse, F. Viola, A. S. Morcos, M. Garnelo, A. Ruderman, A. A. Rusu, I. Danihelka, K. Gregor, et al. Neural scene representation and rendering. Science, 360(6394): 1204–1210, 2018.
232
+ L. Espeholt, H. Soyer, R. Munos, K. Simonyan, V. Mnih, T. Ward, Y. Doron, V. Firoiu, T. Harley, I. Dunning, et al. Impala: Scalable distributed deep-rl with importance weighted actor-learner architectures. arXiv preprint arXiv:1802.01561, 2018.
233
+ V. Feinberg, A. Wan, I. Stoica, M. I. Jordan, J. E. Gonzalez, and S. Levine. Model-based value estimation for efficient model-free reinforcement learning. arXiv preprint arXiv:1803.00101, 2018.
234
+ C. Gelada, S. Kumar, J. Buckman, O. Nachum, and M. G. Bellemare. Deepmdp: Learning continuous latent space models for representation learning. arXiv preprint arXiv:1906.02736, 2019.
235
+ K. Gregor, D. J. Rezende, F. Besse, Y. Wu, H. Merzic, and A. v. d. Oord. Shaping belief states with generative environment models for rl. arXiv preprint arXiv:1906.09237, 2019.
236
+ Z. D. Guo, M. G. Azar, B. Piot, B. A. Pires, T. Pohlen, and R. Munos. Neural predictive belief representations. arXiv preprint arXiv:1811.06407, 2018.
237
+ M. Gutmann and A. Hyvärinen. Noise-contrastive estimation: A new estimation principle for unnormalized statistical models. In Proceedings of the Thirteenth International Conference on Artificial Intelligence and Statistics, pages 297–304, 2010.
238
+ D. Ha and J. Schmidhuber. World models. arXiv preprint arXiv:1803.10122, 2018.
239
+ T. Haarnoja, A. Zhou, P. Abbeel, and S. Levine. Soft actor-critic: Off-policy maximum entropy deep reinforcement learning with a stochastic actor. arXiv preprint arXiv:1801.01290, 2018.
240
+ D. Hafner, T. Lillicrap, I. Fischer, R. Villegas, D. Ha, H. Lee, and J. Davidson. Learning latent dynamics for planning from pixels. arXiv preprint arXiv:1811.04551, 2018.
241
+ N. Heess, G. Wayne, D. Silver, T. Lillicrap, T. Erez, and Y. Tassa. Learning continuous control policies by stochastic value gradients. In Advances in Neural Information Processing Systems, pages 2944–2952, 2015.
242
+ M. Henaff, W. F. Whitney, and Y. LeCun. Model-based planning in discrete action spaces. CoRR, abs/1705.07177, 2017.
243
+ M. Henaff, W. F. Whitney, and Y. LeCun. Model-based planning with discrete and continuous actions. arXiv preprint arXiv:1705.07177, 2018.
244
+ M. Henaff, A. Canziani, and Y. LeCun. Model-predictive policy learning with uncertainty regularization for driving in dense traffic. arXiv preprint arXiv:1901.02705, 2019.
245
+ M. Hessel, J. Modayil, H. Van Hasselt, T. Schaul, G. Ostrovski, W. Dabney, D. Horgan, B. Piot, M. Azar, and D. Silver. Rainbow: Combining improvements in deep reinforcement learning. In Thirty-Second AAAI Conference on Artificial Intelligence, 2018.
246
+ M. Jaderberg, V. Mnih, W. M. Czarnecki, T. Schaul, J. Z. Leibo, D. Silver, and K. Kavukcuoglu. Reinforcement learning with unsupervised auxiliary tasks. arXiv preprint arXiv:1611.05397, 2016.
247
+ M. I. Jordan, Z. Ghahramani, T. S. Jaakkola, and L. K. Saul. An introduction to variational methods for graphical models. Machine learning, 37(2):183–233, 1999.
248
+ L. Kaiser, M. Babaeizadeh, P. Milos, B. Osinski, R. H. Campbell, K. Czechowski, D. Erhan, C. Finn, P. Kozakowski, S. Levine, et al. Model-based reinforcement learning for atari. arXiv preprint arXiv:1903.00374, 2019.
249
+ R. E. Kalman. A new approach to linear filtering and prediction problems. Journal of basic Engineering, 82(1):35–45, 1960.
250
+ M. Karl, M. Soelch, J. Bayer, and P. van der Smagt. Deep variational bayes filters: Unsupervised learning of state space models from raw data. arXiv preprint arXiv:1605.06432, 2016.
251
+ D. P. Kingma and J. Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
252
+ D. P. Kingma and M. Welling. Auto-encoding variational bayes. arXiv preprint arXiv:1312.6114, 2013.
253
+ R. G. Krishnan, U. Shalit, and D. Sontag. Deep kalman filters. arXiv preprint arXiv:1511.05121, 2015.
254
+ T. Kurutach, I. Clavera, Y. Duan, A. Tamar, and P. Abbeel. Model-ensemble trust-region policy optimization. arXiv preprint arXiv:1802.10592, 2018.
255
+ Y. LeCun, B. Boser, J. S. Denker, D. Henderson, R. E. Howard, W. Hubbard, and L. D. Jackel. Backpropagation applied to handwritten zip code recognition. Neural computation, 1(4):541–551, 1989.
256
+ A. X. Lee, A. Nagabandi, P. Abbeel, and S. Levine. Stochastic latent actor-critic: Deep reinforcement learning with a latent variable model. arXiv preprint arXiv:1907.00953, 2019.
257
+ T. P. Lillicrap, J. J. Hunt, A. Pritzel, N. Heess, T. Erez, Y. Tassa, D. Silver, and D. Wierstra. Continuous control with deep reinforcement learning. arXiv preprint arXiv:1509.02971, 2015.
258
+ K. Lowrey, A. Rajeswaran, S. Kakade, E. Todorov, and I. Mordatch. Plan online, learn offline: Efficient learning and exploration via model-based control. arXiv preprint arXiv:1811.01848, 2018.
259
+ M. C. Machado, M. G. Bellemare, E. Talvitie, J. Veness, M. Hausknecht, and M. Bowling. Revisiting the arcade learning environment: Evaluation protocols and open problems for general agents. Journal of Artificial Intelligence Research, 61:523–562, 2018.
260
+ D. McAllester and K. Statos. Formal limitations on the measurement of mutual information. arXiv preprint arXiv:1811.04251, 2018.
261
+ V. Mnih, K. Kavukcuoglu, D. Silver, A. A. Rusu, J. Veness, M. G. Bellemare, A. Graves, M. Riedmiller, A. K. Fidjeland, G. Ostrovski, et al. Human-level control through deep reinforcement learning. Nature, 518(7540):529, 2015.
262
+ V. Mnih, A. P. Badia, M. Mirza, A. Graves, T. Lillicrap, T. Harley, D. Silver, and K. Kavukcuoglu. Asynchronous methods for deep reinforcement learning. In International Conference on Machine Learning, pages 1928–1937, 2016.
263
+ J. Oh, S. Singh, and H. Lee. Value prediction network. In Advances in Neural Information Processing Systems, pages 6118–6128, 2017.
264
+ A. v. d. Oord, Y. Li, and O. Vinyals. Representation learning with contrastive predictive coding. arXiv preprint arXiv:1807.03748, 2018.
265
+ P. Parmas, C. E. Rasmussen, J. Peters, and K. Doya. Pipps: Flexible model-based policy search robust to the curse of chaos. arXiv preprint arXiv:1902.01240, 2019.
266
+ A. Piergiovanni, A. Wu, and M. S. Ryoo. Learning real-world robot policies by dreaming. arXiv preprint arXiv:1805.07813, 2018.
267
+ B. Poole, S. Ozair, A. v. d. Oord, A. A. Alemi, and G. Tucker. On variational bounds of mutual information. arXiv preprint arXiv:1905.06922, 2019.
268
+ D. J. Rezende, S. Mohamed, and D. Wierstra. Stochastic backpropagation and approximate inference in deep generative models. arXiv preprint arXiv:1401.4082, 2014.
269
+ J. Schmidhuber. Making the world differentiable: On using self-supervised fully recurrent neural networks for dynamic reinforcement learning and planning in non-stationary environments. 1990.
270
+ J. Schrittwieser, I. Antonoglou, T. Hubert, K. Simonyan, L. Sifre, S. Schmitt, A. Guez, E. Lockhart, D. Hassabis, T. Graepel, et al. Mastering atari, go, chess and shogi by planning with a learned model. arXiv preprint arXiv:1911.08265, 2019.
271
+ J. Schulman, F. Wolski, P. Dhariwal, A. Radford, and O. Klimov. Proximal policy optimization algorithms. arXiv preprint arXiv:1707.06347, 2017.
272
+ D. Silver, G. Lever, N. Heess, T. Degris, D. Wierstra, and M. Riedmiller. Deterministic policy gradient algorithms. In Proceedings of the 31st International Conference on Machine Learning, 2014.
273
+ D. Silver, J. Schrittwieser, K. Simonyan, I. Antonoglou, A. Huang, A. Guez, T. Hubert, L. Baker, M. Lai, A. Bolton, et al. Mastering the game of go without human knowledge. Nature, 550(7676): 354, 2017.
274
+ A. Srinivas, A. Jabri, P. Abbeel, S. Levine, and C. Finn. Universal planning networks. arXiv preprint arXiv:1804.00645, 2018.
275
+ R. S. Sutton. Dyna, an integrated architecture for learning, planning, and reacting. ACM SIGART Bulletin, 2(4):160–163, 1991.
276
+ R. S. Sutton and A. G. Barto. Reinforcement learning: An introduction. MIT press, 2018.
277
+ Y. Tassa, Y. Doron, A. Muldal, T. Erez, Y. Li, D. d. L. Casas, D. Budden, A. Abdolmaleki, J. Merel, A. Lefrancq, et al. Deepmind control suite. arXiv preprint arXiv:1801.00690, 2018.
278
+ N. Tishby, F. C. Pereira, and W. Bialek. The information bottleneck method. arXiv preprint physics/0004057, 2000.
279
+ T. Wang and J. Ba. Exploring model-based planning with policy networks. arXiv preprint arXiv:1906.08649, 2019.
280
+ T. Wang, X. Bao, I. Clavera, J. Hoang, Y. Wen, E. Langlois, S. Zhang, G. Zhang, P. Abbeel, and J. Ba. Benchmarking model-based reinforcement learning. CoRR, abs/1907.02057, 2019.
281
+ M. Watter, J. Springenberg, J. Boedecker, and M. Riedmiller. Embed to control: A locally linear latent dynamics model for control from raw images. In Advances in neural information processing systems, pages 2746–2754, 2015.
282
+ T. Weber, S. Racanière, D. P. Reichert, L. Buesing, A. Guez, D. J. Rezende, A. P. Badia, O. Vinyals, N. Heess, Y. Li, et al. Imagination-augmented agents for deep reinforcement learning. arXiv preprint arXiv:1707.06203, 2017.
283
+ R. J. Williams. Simple statistical gradient-following algorithms for connectionist reinforcement learning. Machine learning, 8(3-4):229–256, 1992.
284
+ M. Zhang, S. Vikram, L. Smith, P. Abbeel, M. Johnson, and S. Levine. Solar: deep structured representations for model-based reinforcement learning. In International Conference on Machine Learning, 2019.
285
+
286
+ # A HYPER PARAMETERS
287
+
288
+ Model components We use the convolutional encoder and decoder networks from Ha and Schmidhuber (2018), the RSSM of Hafner et al. (2018), and implement all other functions as three dense layers of size 300 with ELU activations (Clevert et al., 2015). Distributions in latent space are 30-dimensional diagonal Gaussians. The action model outputs a tanh mean scaled by a factor of 5 and a softplus standard deviation for the Normal distribution that is then transformed using tanh (Haarnoja et al., 2018). The scaling factor allows the agent to saturate the action distribution.
289
+
290
+ Learning updates We draw batches of 50 sequences of length 50 to train the world model, value model, and action model models using Adam (Kingma and Ba, 2014) with learning rates $6 \times 1 0 ^ { - 4 }$ , $8 \times 1 0 ^ { - 5 }$ , $8 \times 1 0 ^ { - 5 }$ , respectively and scale down gradient norms that exceed 100. We do not scale the KL regularizers ( $\beta = 1 \AA$ ) but clip them below 3 free nats as in PlaNet. The imagination horizon is $H = 1 5$ and the same trajectories are used to update both action and value models. We compute the $\mathrm { V } _ { \lambda }$ targets with $\gamma = 0 . 9 9$ and $\lambda = 0 . 9 5$ . We did not find latent overshooting for learning the model, an entropy bonus for the action model, or target networks for the value model necessary.
291
+
292
+ Environment interaction The dataset is initialized with $S = 5$ episodes collected using random actions. We iterate between 100 training steps and collecting 1 episode by executing the predicted mode action with Norma $_ { . ( 0 , 0 . 3 ) }$ exploration noise. Instead of manually selecting the action repeat for each environment as in Hafner et al. (2018) and Lee et al. (2019), we fix it to 2 for all environments. See Figure 12 for an assessment of the robustness to different action repeat values.
293
+
294
+ Discrete control For experiments on Atari games and DeepMind Lab levels, the action model predicts the logits of a categorical distribution. We use straight-through gradients for the sampling step during latent imagination. The action noise is epsilon greedy where $\epsilon$ is linearly scheduled from $0 . 4 0 . 1$ over the first 200, 000 gradient steps. To account for the higher complexity of these tasks, we use an imagination horizon of $H = 1 0$ , scale the KL regularizers by $\beta = 0 . 1$ , and bound rewards using tanh. We predict the discount factor from the latent state with a binary classifier that is trained towards the soft labels of 0 and $\gamma$ .
295
+
296
+ # B DERIVATIONS
297
+
298
+ e define the information bottleneck objective (Tishby et al., 2000) for latent dynamics models,
299
+
300
+ $$
301
+ \operatorname* { m a x } { \mathrm { I } \big ( } s _ { 1 : T } ; { \big ( } o _ { 1 : T } , r _ { 1 : T } { \big ) } \mid a _ { 1 : T } { \big ) } - \beta { \mathrm { I } \big ( } s _ { 1 : T } , i _ { 1 : T } { \mathrm { ~ \big | ~ } } a _ { 1 : T } { \big ) } ,
302
+ $$
303
+
304
+ where $\beta$ is scalar and $i _ { t }$ are dataset indices that determine the observations $p ( o _ { t } \mid i _ { t } ) \doteq \delta ( o _ { t } - \bar { o } _ { t } )$ as in Alemi et al. (2016).
305
+
306
+ Maximizing the objective leads to model states that can predict the sequence of observations and rewards while limiting the amount of information extracted at each time step. This encourages the model to reconstruct each image by relying on information extracted at preceeding time steps to the extent possible, and only accessing additional information from the current image when necessary. As a result, the information regularizer encourages the model to learn long-term dependencies.
307
+
308
+ For the generative objective, we lower bound the first term using the non-negativity of the KL divergence and drop the marginal data probability as it does not depend on the representation model,
309
+
310
+ $$
311
+ \begin{array} { r l } & { \mathrm { I } \big ( { { s _ { 1 : T } } ; \big ( { o _ { 1 : T } } , { r _ { 1 : T } } \big ) \ } \big | { a _ { 1 : T } } \big ) } \\ & { = \mathrm { E } _ { p \big ( { o _ { 1 : T } } , { r _ { 1 : T } } , { s _ { 1 : T } } , { a _ { 1 : T } } \big ) } \bigg ( \displaystyle \sum _ { t } \ln p \big ( { o _ { 1 : T } } , { r _ { 1 : T } } \big | { s _ { 1 : T } } , { a _ { 1 : T } } \big ) - \displaystyle \frac { \ln p \big ( { o _ { 1 : T } } , { r _ { 1 : T } } \big | { a _ { 1 : T } } \big ) } { \cos { \mathrm { s i } } } \bigg ) } \\ & { \stackrel { \mathrm { \scriptsize ~ \pm ~ } } { = } \mathrm { E } \bigg ( \displaystyle \sum _ { t } \ln p \big ( { o _ { 1 : T } } , { r _ { 1 : T } } \big | { s _ { 1 : T } } , { a _ { 1 : T } } \big ) \bigg ) } \\ & { \geq \mathrm { E } \bigg ( \displaystyle \sum _ { t } \ln p \big ( { o _ { 1 : T } } , { r _ { 1 : T } } \big | { s _ { 1 : T } } , { a _ { 1 : T } } \big ) \bigg ) - \mathrm { K L } \bigg ( p \big ( { o _ { 1 : T } } , { r _ { 1 : T } } \big | { s _ { 1 : T } } , { a _ { 1 : T } } \big ) \bigg | \bigg | \displaystyle \prod _ { t } q ( { o _ { t } } \mid { s _ { t } } ) q \big ( { r _ { t } } \mid { s _ { t } } \big ) } \\ & { = \mathrm { E } \bigg ( \displaystyle \sum _ { t } \ln q \big ( { o _ { t } } \mid { s _ { t } } \big ) + \ln q \big ( { r _ { t } } \mid { s _ { t } } \big ) \bigg ) . } \end{array}
312
+ $$
313
+
314
+ For the contrastive objective, we subtract the constant marginal probability of the data under the variational encoder, apply Bayes rule, and use the InfoNCE mini-batch bound (Poole et al., 2019),
315
+
316
+ $$
317
+ \begin{array} { l } { \displaystyle \operatorname { E } \big ( \ln q ( o _ { t } \mid s _ { t } ) + \ln q ( r _ { t } \mid s _ { t } ) \big ) } \\ { \displaystyle \pm \ \operatorname { E } \big ( \ln q ( o _ { t } \mid s _ { t } ) - \ln q ( o _ { t } ) + \ln q ( r _ { t } \mid s _ { t } ) \big ) } \\ { \displaystyle = \ \operatorname { E } \big ( \ln q ( s _ { t } \mid o _ { t } ) - \ln q ( s _ { t } ) + \ln q ( r _ { t } \mid s _ { t } ) \big ) } \\ { \displaystyle \geq \ \operatorname { E } \bigg ( \ln q ( s _ { t } \mid o _ { t } ) - \ln \sum _ { o ^ { \prime } } q ( s _ { t } \mid o ^ { \prime } ) + \ln q ( r _ { t } \mid s _ { t } ) \bigg ) . } \end{array}
318
+ $$
319
+
320
+ For the second term, we use the non-negativity of the KL divergence to obtain an upper bound,
321
+
322
+ $$
323
+ \begin{array} { r l } & { \quad \operatorname { I } ( s _ { 1 : T } ; i _ { 1 : T } \mid a _ { 1 : T } ) } \\ & { = \operatorname { E } _ { p ( o _ { 1 : T } , r _ { 1 : T } , s _ { 1 : T } , a _ { 1 : T } , i _ { 1 : T } ) } \Big ( \displaystyle \sum _ { t } \ln p ( s _ { t } \mid s _ { t - 1 } , a _ { t - 1 } , i _ { t } ) - \ln p ( s _ { t } \mid s _ { t - 1 } , a _ { t - 1 } ) \Big ) } \\ & { = \operatorname { E } \Big ( \displaystyle \sum _ { t } \ln p ( s _ { t } \mid s _ { t - 1 } , a _ { t - 1 } , o _ { t } ) - \ln p ( s _ { t } \mid s _ { t - 1 } , a _ { t - 1 } ) \Big ) } \\ & { \le \operatorname { E } \Big ( \displaystyle \sum _ { t } \ln p ( s _ { t } \mid s _ { t - 1 } , a _ { t - 1 } , o _ { t } ) - \ln q ( s _ { t } \mid s _ { t - 1 } , a _ { t - 1 } ) \Big ) } \\ & { = \operatorname { E } \Big ( \displaystyle \sum _ { t } \operatorname { K L } ( p ( s _ { t } \mid s _ { t - 1 } , a _ { t - 1 } , o _ { t } ) q ( s _ { t } \mid s _ { t - 1 } , a _ { t - 1 } ) ) \Big ) . } \end{array}
324
+ $$
325
+
326
+ This lower bounds the objective.
327
+
328
+ # C DISCRETE CONTROL
329
+
330
+ We evaluate Dreamer on a subset of tasks with discrete actions from the Atari suite (Bellemare et al., 2013) and DeepMind Lab (Beattie et al., 2016). While agents that purely learn through world models are not yet competitive in these domains (Kaiser et al., 2019), the tasks offer a diverse test bed with visual complexity, sparse rewards, and early termination. Agents observe $6 4 \times 6 4 \times 3$ images and select one of between 3 and 18 actions. For Atari, we follow the evaluation protocol of Machado et al. (2018) with sticky actions. Refer to Figure 9 for these experiments.
331
+
332
+ ![](images/54c4a69cd24668624ad348a40c55ab9d3a7460138994d3ca510004d405288631.jpg)
333
+ Figure 9: Performance of Dreamer in environments with discrete actions and early termination. Dreamer learns successful behaviors on this subset of Atari games and the object collection level of DMLab. We highlight representation learning for these environments as a direction of future work that could enable competitive performance across all Atari games and DMLab levels using Dreamer.
334
+
335
+ ![](images/f12f0cdb7e38810e708552d7c04ffeffc9c9b00342a1c52e5376244628f6bc75.jpg)
336
+ Figure 10: Comparison of action selection schemes on the continuous control tasks of the DeepMind Control Suite from pixel inputs. The lines show mean scores over environment steps and the shaded areas show the standard deviation across 5 seeds. We compare Dreamer that learns both actions and values in imagination, to only learning actions in imagination, and Planet that selects actions by online planning instead of learning a policy. The baselines include the top model-free algorithm D4PG, the well-known A3C agent, and the hybrid SLAC agent.
337
+
338
+ ![](images/5a9c38d8c0485a4ef52fc65440e051e04e8fd454624ac1f35f1b8530e00c6533.jpg)
339
+ Figure 11: Comparison of representation learning methods for Dreamer. The lines show mean scores and the shaded areas show the standard deviation across 5 seeds. We compare generating both images and rewards, generating rewards and using a contrastive loss to learn about the images, and only predicting rewards. Image reconstruction provides the best learning signal across most of the tasks, followed by the contrastive objective. Learning purely from rewards was not sufficient in our experiments and might require larger amounts of experience.
340
+
341
+ ![](images/3a34a8d3f7ed373e9b5ead839e74e36440074ba4dfff1e951ff3201565e226ba.jpg)
342
+ Figure 12: Robustness of Dreamer to different control frequencies. Reinforcement learning methods can be sensitive to this hyper parameter, which could be amplified when learning dynamics models at the control frequency of the environment. For this experiment, we train Dreamer with different amounts of action repeat. The areas show one standard deviation across 2 seeds. We used a previous hyper parameter setting for this experiment. We find that a value of $R = 2$ works best across tasks.
343
+
344
+ G CONTINUOUS CONTROL SCORES
345
+
346
+ <table><tr><td></td><td>A3C</td><td>D4PG</td><td>PlaNet1</td><td>Dreamer</td></tr><tr><td>Modality</td><td>proprio</td><td>pixels 109</td><td>pixels 5×106</td><td>pixels</td></tr><tr><td>Steps</td><td>109</td><td></td><td></td><td>5×106</td></tr><tr><td>Acrobot Swingup</td><td>41.90</td><td>91.70</td><td>3.21</td><td>365.26</td></tr><tr><td>Cartpole Balance</td><td>951.60</td><td>992.80</td><td>452.56</td><td>979.56</td></tr><tr><td>Cartpole Balance Sparse</td><td>857.40</td><td>1000.00</td><td>164.74</td><td>941.84</td></tr><tr><td>Cartpole Swingup</td><td>558.40</td><td>862.00</td><td>312.56</td><td>833.66</td></tr><tr><td>Cartpole Swingup Sparse</td><td>179.80</td><td>482.00</td><td>0.64</td><td>812.22</td></tr><tr><td>Cheetah Run</td><td>213.90</td><td>523.80</td><td>496.12</td><td>894.56</td></tr><tr><td>Cup Catch</td><td>104.70</td><td>980.50</td><td>455.98</td><td>962.48</td></tr><tr><td>Finger Spin</td><td>129.40</td><td>985.70</td><td>495.25</td><td>498.88</td></tr><tr><td>Finger Turn Easy</td><td>167.30</td><td>971.40</td><td>451.22</td><td>825.86</td></tr><tr><td>Finger Turn Hard</td><td>88.70</td><td>966.00</td><td>312.55</td><td>891.38</td></tr><tr><td>Hopper Hop</td><td>0.50</td><td>242.00</td><td>0.37</td><td>368.97</td></tr><tr><td>Hopper Stand</td><td>27.90</td><td>929.90</td><td>5.96</td><td>923.72</td></tr><tr><td>Pendulum Swingup</td><td>48.60</td><td>680.90</td><td>3.27</td><td>833.00</td></tr><tr><td>Quadruped Run</td><td>1</td><td>1</td><td>280.45</td><td>888.39</td></tr><tr><td>Quadruped Walk</td><td>一</td><td>1</td><td>238.90</td><td>931.61</td></tr><tr><td>Reacher Easy</td><td>95.60</td><td>967.40</td><td>468.50</td><td>935.08</td></tr><tr><td>Reacher Hard</td><td>39.70</td><td>957.10</td><td>187.02</td><td>817.05</td></tr><tr><td>Walker Run</td><td>191.80</td><td>567.20</td><td>626.25</td><td>824.67</td></tr><tr><td>Walker Stand</td><td>378.40</td><td>985.20</td><td>759.19</td><td>977.99</td></tr><tr><td>Walker Walk</td><td>311.00</td><td>968.30</td><td>944.70</td><td>961.67</td></tr><tr><td>Average</td><td>243.70</td><td>786.32</td><td>332.97</td><td>823.39</td></tr></table>
parse/train/S1lOTC4tDS/S1lOTC4tDS_content_list.json ADDED
@@ -0,0 +1,1425 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "type": "text",
4
+ "text": "DREAM TO CONTROL: LEARNING BEHAVIORS BY LATENT IMAGINATION ",
5
+ "text_level": 1,
6
+ "bbox": [
7
+ 176,
8
+ 83,
9
+ 730,
10
+ 131
11
+ ],
12
+ "page_idx": 0
13
+ },
14
+ {
15
+ "type": "text",
16
+ "text": "Jimmy Ba University of Toronto ",
17
+ "bbox": [
18
+ 495,
19
+ 150,
20
+ 637,
21
+ 183
22
+ ],
23
+ "page_idx": 0
24
+ },
25
+ {
26
+ "type": "text",
27
+ "text": "Danijar Hafner ∗ Timothy Lillicrap University of Toronto DeepMind Google Brain ",
28
+ "bbox": [
29
+ 181,
30
+ 148,
31
+ 475,
32
+ 199
33
+ ],
34
+ "page_idx": 0
35
+ },
36
+ {
37
+ "type": "text",
38
+ "text": "Mohammad Norouzi Google Brain ",
39
+ "bbox": [
40
+ 661,
41
+ 150,
42
+ 808,
43
+ 181
44
+ ],
45
+ "page_idx": 0
46
+ },
47
+ {
48
+ "type": "text",
49
+ "text": "Abstract ",
50
+ "text_level": 1,
51
+ "bbox": [
52
+ 468,
53
+ 212,
54
+ 529,
55
+ 226
56
+ ],
57
+ "page_idx": 0
58
+ },
59
+ {
60
+ "type": "text",
61
+ "text": "Learned world models summarize an agent’s experience to facilitate learning complex behaviors. While learning world models from high-dimensional sensory inputs is becoming feasible through deep learning, there are many potential ways for deriving behaviors from them. We present Dreamer, a reinforcement learning agent that solves long-horizon tasks from images purely by latent imagination. We efficiently learn behaviors by propagating analytic gradients of learned state values back through trajectories imagined in the compact state space of a learned world model. On 20 challenging visual control tasks, Dreamer exceeds existing approaches in data-efficiency, computation time, and final performance. ",
62
+ "bbox": [
63
+ 232,
64
+ 233,
65
+ 766,
66
+ 358
67
+ ],
68
+ "page_idx": 0
69
+ },
70
+ {
71
+ "type": "text",
72
+ "text": "1 INTRODUCTION ",
73
+ "text_level": 1,
74
+ "bbox": [
75
+ 176,
76
+ 375,
77
+ 336,
78
+ 390
79
+ ],
80
+ "page_idx": 0
81
+ },
82
+ {
83
+ "type": "text",
84
+ "text": "Intelligent agents can achieve goals in complex environments even though they never encounter the exact same situation twice. This ability requires building representations of the world from past experience that enable generalization to novel situations. World models offer an explicit way to represent an agent’s knowledge about the world in a parametric model that can make predictions about the future. ",
85
+ "bbox": [
86
+ 174,
87
+ 401,
88
+ 663,
89
+ 484
90
+ ],
91
+ "page_idx": 0
92
+ },
93
+ {
94
+ "type": "image",
95
+ "img_path": "images/d327d66fd0ad9783d8149fdd5707ab2ea8d9125ba7389924d060073ebdd45fc2.jpg",
96
+ "image_caption": [
97
+ "Dataset of Experience "
98
+ ],
99
+ "image_footnote": [],
100
+ "bbox": [
101
+ 700,
102
+ 425,
103
+ 792,
104
+ 486
105
+ ],
106
+ "page_idx": 0
107
+ },
108
+ {
109
+ "type": "text",
110
+ "text": "When the sensory inputs are high-dimensional images, latent dynamics models can abstract observations to predict forward in compact state spaces (Watter et al., 2015; Oh et al., 2017; Gregor et al., 2019). Compared to predictions in image space, latent states have a small memory footprint that enables imagining thousands of trajectories in parallel. Learning effective latent dynamics models is becoming feasible through advances in deep learning and latent variable models (Krishnan et al., 2015; Karl et al., 2016; Doerr et al., 2018; Buesing et al., 2018). ",
111
+ "bbox": [
112
+ 174,
113
+ 488,
114
+ 663,
115
+ 599
116
+ ],
117
+ "page_idx": 0
118
+ },
119
+ {
120
+ "type": "image",
121
+ "img_path": "images/9a631d6a7117d14932ee2bd92c2fbdff4c5440b21ebeac9094689765a5c34551.jpg",
122
+ "image_caption": [
123
+ "Learned Latent Dynamics "
124
+ ],
125
+ "image_footnote": [],
126
+ "bbox": [
127
+ 681,
128
+ 523,
129
+ 818,
130
+ 646
131
+ ],
132
+ "page_idx": 0
133
+ },
134
+ {
135
+ "type": "text",
136
+ "text": "Behaviors can be derived from dynamics models in many ways. Often, imagined rewards are maximized with a parametric policy (Sutton, 1991; Ha and Schmidhuber, 2018; Zhang et al., 2019) or by online planning (Chua et al., 2018; Hafner et al., 2018). However, considering only rewards within a fixed imagination horizon results in shortsighted behaviors (Wang et al., 2019). Moreover, prior work commonly resorts to derivative-free optimization for robustness to model errors (Ebert et al., 2017; Chua et al., 2018; Parmas et al., 2019), rather than leveraging analytic gradients offered by neural network dynamics (Henaff et al., 2019; Srinivas et al., 2018). ",
137
+ "bbox": [
138
+ 174,
139
+ 603,
140
+ 663,
141
+ 728
142
+ ],
143
+ "page_idx": 0
144
+ },
145
+ {
146
+ "type": "text",
147
+ "text": "Value and Action Learned by Latent Imagination ",
148
+ "bbox": [
149
+ 684,
150
+ 654,
151
+ 816,
152
+ 674
153
+ ],
154
+ "page_idx": 0
155
+ },
156
+ {
157
+ "type": "text",
158
+ "text": "We present Dreamer, an agent that learns long-horizon behaviors from images purely by latent imagination. A novel actor critic algorithm accounts for rewards beyond the imagination horizon while making efficient use of the neural network dynamics. For this, we predict state values and actions in the learned latent space as summarized in Figure 1. The values optimize Bellman consistency for imagined rewards and the policy maximizes the values by propagating their analytic gradients back through the dynamics. ",
159
+ "bbox": [
160
+ 174,
161
+ 731,
162
+ 661,
163
+ 829
164
+ ],
165
+ "page_idx": 0
166
+ },
167
+ {
168
+ "type": "text",
169
+ "text": "In comparison to actor critic algorithms that learn online or by experience replay (Lillicrap et al., 2015; Mnih et al., 2016; Schulman et al., 2017; Haarnoja et al., 2018; Lee et al., 2019), world models can interpolate past experience and offer analytic gradients of multi-step returns for efficient policy optimization. ",
170
+ "bbox": [
171
+ 174,
172
+ 832,
173
+ 661,
174
+ 901
175
+ ],
176
+ "page_idx": 0
177
+ },
178
+ {
179
+ "type": "image",
180
+ "img_path": "images/f8db63927c642f785139582878fc542dfeb9163a1ced1d891e306451041ef977.jpg",
181
+ "image_caption": [
182
+ "Figure 1: Dreamer learns a world model from past experience and efficiently learns farsighted behaviors in its latent space by backpropagating value estimates back through imagined trajectories. "
183
+ ],
184
+ "image_footnote": [],
185
+ "bbox": [
186
+ 684,
187
+ 678,
188
+ 799,
189
+ 752
190
+ ],
191
+ "page_idx": 0
192
+ },
193
+ {
194
+ "type": "image",
195
+ "img_path": "images/d9f7c5ebf29f6653896e1df62642d1355ad8bc0a46e7a916bceff0cee540a3de.jpg",
196
+ "image_caption": [
197
+ "Figure 2: Image observations for 5 of the 20 visual control tasks used in our experiments. The tasks pose a variety of challenges including contact dynamics, sparse rewards, many degrees of freedom, and 3D environments. Several of these tasks could previously not be solved through world models. "
198
+ ],
199
+ "image_footnote": [],
200
+ "bbox": [
201
+ 174,
202
+ 99,
203
+ 825,
204
+ 212
205
+ ],
206
+ "page_idx": 1
207
+ },
208
+ {
209
+ "type": "text",
210
+ "text": "The key contributions of this paper are summarized as follows: ",
211
+ "bbox": [
212
+ 176,
213
+ 267,
214
+ 586,
215
+ 281
216
+ ],
217
+ "page_idx": 1
218
+ },
219
+ {
220
+ "type": "text",
221
+ "text": "• Learning long-horizon behaviors by latent imagination Model-based agents can be shortsighted if they use a finite imagination horizon. We approach this limitation by predicting both actions and state values. Training purely by imagination in a latent space lets us efficiently learn the policy by propagating analytic value gradients back through the latent dynamics. • Empirical performance for visual control We pair Dreamer with existing representation learning methods and evaluate it on the DeepMind Control Suite with image inputs, illustrated in Figure 2. Using the same hyper parameters for all tasks, Dreamer exceeds previous model-based and model-free agents in terms of data-efficiency, computation time, and final performance. ",
222
+ "bbox": [
223
+ 181,
224
+ 285,
225
+ 826,
226
+ 400
227
+ ],
228
+ "page_idx": 1
229
+ },
230
+ {
231
+ "type": "text",
232
+ "text": "2 CONTROL WITH WORLD MODELS ",
233
+ "text_level": 1,
234
+ "bbox": [
235
+ 176,
236
+ 411,
237
+ 488,
238
+ 428
239
+ ],
240
+ "page_idx": 1
241
+ },
242
+ {
243
+ "type": "text",
244
+ "text": "Reinforcement learning We formulate visual control as a partially observable Markov decision process (POMDP) with discrete time step $t \\in [ 1 ; T ]$ , continuous vector-valued actions $a _ { t } \\sim p ( a _ { t } \\ |$ $o _ { \\leq t } , a _ { < t } )$ generated by the agent, and high-dimensional observations and scalar rewards $o _ { t } , r _ { t } \\sim$ $p ( o _ { t } , r _ { t } \\mid o _ { < t } , a _ { < t } )$ generated by the unknown environment. The goal is to develop an agent that maximizes the expected sum of rewards $\\textstyle \\mathrm { E } _ { p } { \\big ( } \\sum _ { t = 1 } ^ { T } r _ { t } { \\big ) }$ . Figure 2 shows a selection of our tasks. ",
245
+ "bbox": [
246
+ 173,
247
+ 436,
248
+ 825,
249
+ 508
250
+ ],
251
+ "page_idx": 1
252
+ },
253
+ {
254
+ "type": "text",
255
+ "text": "Agent components The classical components of agents that learn in imagination are dynamics learning, behavior learning, and environment interaction (Sutton, 1991). In the case of Dreamer, the behavior is learned by predicting hypothetical trajectories in the compact latent space of the world model. As outlined in Figure 3 and detailed in Algorithm 1, Dreamer performs the following operations throughout the agent’s life time, either interleaved or in parallel: ",
256
+ "bbox": [
257
+ 174,
258
+ 510,
259
+ 825,
260
+ 580
261
+ ],
262
+ "page_idx": 1
263
+ },
264
+ {
265
+ "type": "text",
266
+ "text": "• Learning the latent dynamics model from the dataset of past experience to predict future rewards from actions and past observations. Any learning objective for the world model can be incorporated with Dreamer. We review existing methods for learning latent dynamics in Section 4. • Learning action and value models from predicted latent trajectories, as described in Section 3. The value model optimizes Bellman consistency for imagined rewards and the action model is updated by propagating gradients of value estimates back through the neural network dynamics. • Executing the learned action model in the world to collect new experience for growing the dataset. ",
267
+ "bbox": [
268
+ 181,
269
+ 583,
270
+ 826,
271
+ 688
272
+ ],
273
+ "page_idx": 1
274
+ },
275
+ {
276
+ "type": "text",
277
+ "text": "Latent dynamics Dreamer uses a latent dynamics model that consists of three components. The representation model encodes observations and actions to create continuous vector-valued model states $s _ { t }$ with Markovian transitions (Watter et al., 2015; Zhang et al., 2019; Hafner et al., 2018). The transition model predicts future model states without seeing the corresponding observations that will later cause them. The reward model predicts the rewards given the model states, ",
278
+ "bbox": [
279
+ 176,
280
+ 690,
281
+ 825,
282
+ 760
283
+ ],
284
+ "page_idx": 1
285
+ },
286
+ {
287
+ "type": "equation",
288
+ "img_path": "images/95e9c39317cc9eab651b242b65200cf8b83aa775a99b584f304fc2745f51a3bb.jpg",
289
+ "text": "$$\n\\begin{array} { l l } { { \\mathrm { R e p r e s e n t a t i o n ~ m o d e l : } \\qquad } } & { { p ( s _ { t } \\mid s _ { t - 1 } , a _ { t - 1 } , o _ { t } ) } } \\\\ { { \\mathrm { T r a n s i t i o n ~ m o d e l : } \\qquad } } & { { q ( s _ { t } \\mid s _ { t - 1 } , a _ { t - 1 } ) } } \\\\ { { \\mathrm { R e w a r d ~ m o d e l : } \\qquad } } & { { q ( r _ { t } \\mid s _ { t } ) . } } \\end{array}\n$$",
290
+ "text_format": "latex",
291
+ "bbox": [
292
+ 321,
293
+ 763,
294
+ 676,
295
+ 820
296
+ ],
297
+ "page_idx": 1
298
+ },
299
+ {
300
+ "type": "text",
301
+ "text": "We use $p$ for distributions that generate samples in the real environment and $q$ for their approximations that enable latent imagination. Specifically, the transition model lets us predict ahead in the compact latent space without having to observe or imagine the corresponding images. This results in a low memory footprint and fast predictions of thousands of imagined trajectories in parallel. ",
302
+ "bbox": [
303
+ 174,
304
+ 823,
305
+ 825,
306
+ 880
307
+ ],
308
+ "page_idx": 1
309
+ },
310
+ {
311
+ "type": "text",
312
+ "text": "The model mimics a non-linear Kalman filter (Kalman, 1960), latent state space model, or HMM with real-valued states. However, it is conditioned on actions and predicts rewards, allowing the agent to imagine the outcomes of potential action sequences without executing them in the environment. ",
313
+ "bbox": [
314
+ 174,
315
+ 882,
316
+ 825,
317
+ 924
318
+ ],
319
+ "page_idx": 1
320
+ },
321
+ {
322
+ "type": "image",
323
+ "img_path": "images/89473689530c445c2809e2a19db1486b930224b3c8ab7b6ae24a22abe2ab58cf.jpg",
324
+ "image_caption": [
325
+ "Figure 3: Components of Dreamer. (a) From the dataset of past experience, the agent learns to encode observations and actions into compact latent states $\\left( \\bigcirc \\right)$ , for example via reconstruction, and predicts environment rewards $\\mathbf { \\Pi } ( \\circledast )$ . (b) In the compact latent space, Dreamer predicts state values $( \\ I ^ { \\prime } )$ and actions $( \\triangleq )$ that maximize future value predictions by propagating gradients back through imagined trajectories. (c) The agent encodes the history of the episode to compute the current model state and predict the next action to execute in the environment. See Algorithm 1 for pseudo code of the agent. "
326
+ ],
327
+ "image_footnote": [],
328
+ "bbox": [
329
+ 176,
330
+ 97,
331
+ 815,
332
+ 256
333
+ ],
334
+ "page_idx": 2
335
+ },
336
+ {
337
+ "type": "text",
338
+ "text": "3 LEARNING BEHAVIORS BY LATENT IMAGINATION ",
339
+ "text_level": 1,
340
+ "bbox": [
341
+ 176,
342
+ 357,
343
+ 622,
344
+ 373
345
+ ],
346
+ "page_idx": 2
347
+ },
348
+ {
349
+ "type": "text",
350
+ "text": "Dreamer learns long-horizon behaviors in the compact latent space of a learned world model by efficiently leveraging the neural network latent dynamics. For this, we propagate stochastic gradients of multi-step returns through neural network predictions of actions, states, rewards, and values using reparameterization. This section describes the main contribution of our paper. ",
351
+ "bbox": [
352
+ 173,
353
+ 378,
354
+ 825,
355
+ 434
356
+ ],
357
+ "page_idx": 2
358
+ },
359
+ {
360
+ "type": "text",
361
+ "text": "Imagination environment The latent dynamics define a Markov decision process (MDP; Sutton, 1991) that is fully observed because the compact model states $s _ { t }$ are Markovian. We denote imagined quantities with $\\tau$ as the time index. Imagined trajectories start at the true model states $s _ { t }$ of observation sequences drawn from the agent’s past experience. They follow predictions of the transition model $s _ { \\tau } \\sim q ( s _ { \\tau } \\mid s _ { \\tau - 1 } , a _ { \\tau - 1 } )$ , reward model $\\boldsymbol { r } _ { \\ u { \\tau } } \\sim \\boldsymbol { q } ( \\boldsymbol { r } _ { \\ u { \\tau } } \\mid s _ { \\tau } )$ , and a policy $\\smash { a _ { \\tau } \\sim q ( a _ { \\tau } \\mid s _ { \\tau } ) }$ . The objective is to maximize expected imagined rewards $\\begin{array} { r } { \\mathrm { E } _ { q } \\big ( \\sum _ { \\tau = t } ^ { \\infty } \\gamma ^ { \\tau - \\bar { t } } r _ { \\tau } \\big ) } \\end{array}$ with respect to the policy. ",
362
+ "bbox": [
363
+ 173,
364
+ 438,
365
+ 825,
366
+ 523
367
+ ],
368
+ "page_idx": 2
369
+ },
370
+ {
371
+ "type": "text",
372
+ "text": "Algorithm 1: Dreamer ",
373
+ "text_level": 1,
374
+ "bbox": [
375
+ 174,
376
+ 539,
377
+ 326,
378
+ 553
379
+ ],
380
+ "page_idx": 2
381
+ },
382
+ {
383
+ "type": "text",
384
+ "text": "Initialize dataset $\\mathcal { D }$ with $S$ random seed episodes. ",
385
+ "bbox": [
386
+ 178,
387
+ 563,
388
+ 500,
389
+ 577
390
+ ],
391
+ "page_idx": 2
392
+ },
393
+ {
394
+ "type": "text",
395
+ "text": "Initialize neural network parameters $\\theta , \\phi , \\psi$ randomly. while not converged do ",
396
+ "bbox": [
397
+ 173,
398
+ 578,
399
+ 529,
400
+ 604
401
+ ],
402
+ "page_idx": 2
403
+ },
404
+ {
405
+ "type": "text",
406
+ "text": "for update step $c = 1 . . C$ do ",
407
+ "bbox": [
408
+ 199,
409
+ 606,
410
+ 385,
411
+ 618
412
+ ],
413
+ "page_idx": 2
414
+ },
415
+ {
416
+ "type": "text",
417
+ "text": "Model components ",
418
+ "text_level": 1,
419
+ "bbox": [
420
+ 575,
421
+ 563,
422
+ 709,
423
+ 575
424
+ ],
425
+ "page_idx": 2
426
+ },
427
+ {
428
+ "type": "text",
429
+ "text": "Representation $p _ { \\theta } ( s _ { t } \\mid s _ { t - 1 } , a _ { t - 1 } , o _ { t } )$ Transition $q _ { \\theta } ( s _ { t } \\mid s _ { t - 1 } , a _ { t - 1 } )$ Reward $q _ { \\theta } ( r _ { t } \\mid s _ { t } )$ Action $q _ { \\phi } ( a _ { t } \\mid s _ { t } )$ Value $\\boldsymbol { v } _ { \\boldsymbol { \\psi } } ( s _ { t } )$ ",
430
+ "bbox": [
431
+ 573,
432
+ 577,
433
+ 823,
434
+ 660
435
+ ],
436
+ "page_idx": 2
437
+ },
438
+ {
439
+ "type": "text",
440
+ "text": "// DDraw $B$ amics leardata sequences $\\{ ( a _ { t } , o _ { t } , r _ { t } ) \\} _ { t = k } ^ { k + L } \\sim \\mathcal { D }$ . \nCompute model states $s _ { t } \\sim p _ { \\theta } \\left( s _ { t } ~ | ~ s _ { t - 1 } , a _ { t - 1 } , o _ { t } \\right)$ . \nUpdate $\\theta$ using representation learning. ",
441
+ "bbox": [
442
+ 222,
443
+ 622,
444
+ 558,
445
+ 684
446
+ ],
447
+ "page_idx": 2
448
+ },
449
+ {
450
+ "type": "text",
451
+ "text": "Hyper parameters ",
452
+ "text_level": 1,
453
+ "bbox": [
454
+ 575,
455
+ 665,
456
+ 705,
457
+ 678
458
+ ],
459
+ "page_idx": 2
460
+ },
461
+ {
462
+ "type": "text",
463
+ "text": "Seed episodes $S$ Collect interval $C$ Batch size $B$ Sequence length $L$ Imagination horizon $H$ Learning rate $\\alpha$ // Environment interaction $o _ { 1 } \\gets \\in \\mathrm { { n v } }$ .reset() for time step $t = 1 . . T$ do ",
464
+ "bbox": [
465
+ 573,
466
+ 679,
467
+ 821,
468
+ 779
469
+ ],
470
+ "page_idx": 2
471
+ },
472
+ {
473
+ "type": "text",
474
+ "text": "",
475
+ "bbox": [
476
+ 197,
477
+ 794,
478
+ 455,
479
+ 834
480
+ ],
481
+ "page_idx": 2
482
+ },
483
+ {
484
+ "type": "text",
485
+ "text": "Compute $s _ { t } \\sim p _ { \\theta } \\left( s _ { t } ~ | ~ s _ { t - 1 } , a _ { t - 1 } , o _ { t } \\right)$ from history. \nCompute $\\boldsymbol { a } _ { t } \\sim q _ { \\phi } ( \\boldsymbol { a } _ { t } \\mid \\boldsymbol { s } _ { t } )$ with the action model. \nAdd exploration noise to action. \n$r _ { t } , o _ { t + 1 } \\gets \\mathsf { e n v }$ .step $( a _ { t } )$ . ",
486
+ "bbox": [
487
+ 220,
488
+ 835,
489
+ 557,
490
+ 892
491
+ ],
492
+ "page_idx": 2
493
+ },
494
+ {
495
+ "type": "text",
496
+ "text": "Add experience to dataset $\\mathcal { D } \\mathcal { D } \\cup \\{ ( o _ { t } , a _ { t } , r _ { t } ) _ { t = 1 } ^ { T } \\} .$ . ",
497
+ "bbox": [
498
+ 199,
499
+ 892,
500
+ 553,
501
+ 909
502
+ ],
503
+ "page_idx": 2
504
+ },
505
+ {
506
+ "type": "image",
507
+ "img_path": "images/1e19815833391a90ecd02126c8b6ecb6102cd66f766e7b198a3ac90ffba2cf51.jpg",
508
+ "image_caption": [
509
+ "Figure 4: Imagination horizons. We compare the final performance of Dreamer, learning an action model without value prediction, and online planning using PlaNet. Learning a state value model to estimate rewards beyond the imagination horizon makes Dreamer more robust to the horizon length. The agents use pixel reconstruction for representation learning and an action repeat of $R = 2$ . "
510
+ ],
511
+ "image_footnote": [],
512
+ "bbox": [
513
+ 173,
514
+ 98,
515
+ 825,
516
+ 215
517
+ ],
518
+ "page_idx": 3
519
+ },
520
+ {
521
+ "type": "text",
522
+ "text": "Action and value models Consider imagined trajectories with a finite horizon $H$ . Dreamer uses an actor critic approach to learn behaviors that consider rewards beyond the horizon. We learn an action model and a value model in the latent space of the world model for this. The action model implements the policy and aims to predict actions that solve the imagination environment. The value model estimates the expected imagined rewards that the action model achieves from each state $s _ { \\tau }$ , ",
523
+ "bbox": [
524
+ 176,
525
+ 291,
526
+ 825,
527
+ 362
528
+ ],
529
+ "page_idx": 3
530
+ },
531
+ {
532
+ "type": "text",
533
+ "text": "Value model: ",
534
+ "bbox": [
535
+ 274,
536
+ 397,
537
+ 362,
538
+ 411
539
+ ],
540
+ "page_idx": 3
541
+ },
542
+ {
543
+ "type": "equation",
544
+ "img_path": "images/f6e9d96b5610876e32d4806bdc0f3841256fd1581281c18d5218d7819b07171e.jpg",
545
+ "text": "$$\n\\begin{array} { r l } & { a _ { \\tau } \\sim q _ { \\phi } ( a _ { \\tau } \\mid s _ { \\tau } ) } \\\\ & { v _ { \\psi } ( s _ { \\tau } ) \\approx \\mathrm { E } _ { q ( \\cdot \\mid s _ { \\tau } ) } \\big ( \\sum _ { \\tau = t } ^ { t + H } \\gamma ^ { \\tau - t } r _ { \\tau } \\big ) . } \\end{array}\n$$",
546
+ "text_format": "latex",
547
+ "bbox": [
548
+ 485,
549
+ 372,
550
+ 723,
551
+ 416
552
+ ],
553
+ "page_idx": 3
554
+ },
555
+ {
556
+ "type": "text",
557
+ "text": "The action and value models are trained cooperatively as typical in policy iteration: the action model aims to maximize an estimate of the value, while the value model aims to match an estimate of the value that changes as the action model changes. ",
558
+ "bbox": [
559
+ 178,
560
+ 426,
561
+ 823,
562
+ 468
563
+ ],
564
+ "page_idx": 3
565
+ },
566
+ {
567
+ "type": "text",
568
+ "text": "We use dense neural networks for the action and value models with parameters $\\phi$ and $\\psi$ , respectively. The action model outputs a tanh-transformed Gaussian (Haarnoja et al., 2018) with sufficient statistics predicted by the neural network. This allows for reparameterized sampling (Kingma and Welling, 2013; Rezende et al., 2014) that views sampled actions as deterministically dependent on the neural network output, allowing us to backpropagate analytic gradients through the sampling operation, ",
569
+ "bbox": [
570
+ 173,
571
+ 477,
572
+ 826,
573
+ 549
574
+ ],
575
+ "page_idx": 3
576
+ },
577
+ {
578
+ "type": "equation",
579
+ "img_path": "images/f3e6b6ffa0b3a6439d414d6131dc117235747e9822e56c26f1addc0f3c7ac386.jpg",
580
+ "text": "$$\n\\begin{array} { r } { a _ { \\tau } = \\operatorname { t a n h } \\bigl ( \\mu _ { \\phi } ( s _ { \\tau } ) + \\sigma _ { \\phi } ( s _ { \\tau } ) \\epsilon \\bigr ) , \\quad \\epsilon \\sim \\mathrm { N o r m a l } ( 0 , \\mathbb { I } ) . } \\end{array}\n$$",
581
+ "text_format": "latex",
582
+ "bbox": [
583
+ 320,
584
+ 559,
585
+ 678,
586
+ 579
587
+ ],
588
+ "page_idx": 3
589
+ },
590
+ {
591
+ "type": "text",
592
+ "text": "Value estimation To lof imagined trajectories $\\{ s _ { \\tau } , a _ { \\tau } , r _ { \\tau } \\} _ { \\tau = t } ^ { t + H }$ and value models, we need to estimate the state v. These trajectories branch off of the model states $s _ { t }$ esof horizon $H$ using actions sampled from the action model. State values can be estimated in multiple ways that trade off bias and variance (Sutton and Barto, 2018), ",
593
+ "bbox": [
594
+ 173,
595
+ 601,
596
+ 825,
597
+ 671
598
+ ],
599
+ "page_idx": 3
600
+ },
601
+ {
602
+ "type": "equation",
603
+ "img_path": "images/285a9dc51bd3aa9931d86863210a3b28667708471acc93e10639a55e1ed84d78.jpg",
604
+ "text": "$$\n\\begin{array} { l } { { \\displaystyle \\mathrm { V } _ { \\mathrm { R } } ( s _ { \\tau } ) \\doteq \\mathrm { E } _ { q _ { \\theta } , q _ { \\phi } } \\biggl ( \\displaystyle \\sum _ { n = \\tau } ^ { t + H } r _ { n } \\biggr ) , } } \\\\ { { \\displaystyle \\mathrm { V } _ { \\mathrm { N } } ^ { k } ( s _ { \\tau } ) \\doteq \\mathrm { E } _ { q _ { \\theta } , q _ { \\phi } } \\biggl ( \\displaystyle \\sum _ { n = \\tau } ^ { h - 1 } \\gamma ^ { n - \\tau } r _ { n } + \\gamma ^ { h - \\tau } v _ { \\psi } ( s _ { h } ) \\biggr ) \\quad \\mathrm { w i t h } \\quad h = \\mathrm { m i n } ( \\tau + k , t + H ) , } } \\\\ { { \\displaystyle \\mathrm { V } _ { \\lambda } ( s _ { \\tau } ) \\doteq ( 1 - \\lambda ) \\sum _ { n = 1 } ^ { H - 1 } \\lambda ^ { n - 1 } \\mathrm { V } _ { \\mathrm { N } } ^ { n } ( s _ { \\tau } ) + \\lambda ^ { H - 1 } \\mathrm { V } _ { \\mathrm { N } } ^ { H } ( s _ { \\tau } ) , } } \\end{array}\n$$",
605
+ "text_format": "latex",
606
+ "bbox": [
607
+ 222,
608
+ 683,
609
+ 772,
610
+ 815
611
+ ],
612
+ "page_idx": 3
613
+ },
614
+ {
615
+ "type": "text",
616
+ "text": "where the expectations are estimated under the imagined trajectories. $\\mathrm { V _ { R } }$ simply sums the rewards from $\\tau$ until the horizon and ignores rewards beyond it. This allows learning the action model without a value model, an ablation we compare to in our experiments. $\\mathrm { V } _ { \\mathrm { N } } ^ { k }$ estimates rewards beyond $k$ steps with the learned value model. Dreamer uses $\\mathrm { V } _ { \\lambda }$ , an exponentially-weighted average of the estimates for different $k$ to balance bias and variance. Figure 4 shows that learning a value model in imagination enables Dreamer to solve long-horizon tasks while being robust to the imagination horizon. The experimental details and results on all tasks are described in Section 6. ",
617
+ "bbox": [
618
+ 173,
619
+ 825,
620
+ 825,
621
+ 924
622
+ ],
623
+ "page_idx": 3
624
+ },
625
+ {
626
+ "type": "image",
627
+ "img_path": "images/2ef5f86171682781a63bed4df3ae36bea1083084156ea29642abf8c3fc344333.jpg",
628
+ "image_caption": [
629
+ "Figure 5: Reconstructions of long-term predictions. We apply the representation model to the first 5 images of two hold-out trajectories and predict forward for 45 steps using the latent dynamics, given only the actions. The recurrent state space model (RSSM; Hafner et al., 2018) performs accurate long-term predictions, enabling Dreamer to learn successful behaviors in a compact latent space. "
630
+ ],
631
+ "image_footnote": [],
632
+ "bbox": [
633
+ 171,
634
+ 97,
635
+ 825,
636
+ 252
637
+ ],
638
+ "page_idx": 4
639
+ },
640
+ {
641
+ "type": "text",
642
+ "text": "Learning objective To update the action and value models, we first compute the value estimates $\\mathrm { V } _ { \\lambda } ( s _ { \\tau } )$ for all states $s _ { \\tau }$ along the imagined trajectories. The objective for the action model $q _ { \\phi } ( a _ { \\tau } \\mid s _ { \\tau } )$ is to predict actions that result in state trajectories with high value estimates. The objective for the value model $v _ { \\psi } ( s _ { \\tau } )$ , in turn, is to regress the value estimates, ",
643
+ "bbox": [
644
+ 174,
645
+ 325,
646
+ 825,
647
+ 382
648
+ ],
649
+ "page_idx": 4
650
+ },
651
+ {
652
+ "type": "equation",
653
+ "img_path": "images/ec6929f3f7f24e13ba4d4a879d451b858ce32778e2570156a461212b5d4807e9.jpg",
654
+ "text": "$$\n\\operatorname* { m a x } _ { \\phi } \\mathrm { E } _ { q _ { \\theta } , q _ { \\phi } } \\left( \\sum _ { \\tau = t } ^ { t + H } \\mathrm { V } _ { \\lambda } ( s _ { \\tau } ) \\right) , \\qquad ( 7 ) \\qquad \\operatorname* { m i n } _ { \\psi } \\mathrm { E } _ { q _ { \\theta } , q _ { \\phi } } \\left( \\sum _ { \\tau = t } ^ { t + H } \\frac { 1 } { 2 } \\Big \\| v _ { \\psi } ( s _ { \\tau } ) - \\mathrm { V } _ { \\lambda } ( s _ { \\tau } ) ) \\Big \\| ^ { 2 } \\right) .\n$$",
655
+ "text_format": "latex",
656
+ "bbox": [
657
+ 199,
658
+ 383,
659
+ 777,
660
+ 428
661
+ ],
662
+ "page_idx": 4
663
+ },
664
+ {
665
+ "type": "text",
666
+ "text": "The value model is updated to regress the targets, around which we stop the gradient as typical (Sutton and Barto, 2018). The action model uses analytic gradients through the learned dynamics to maximize the value estimates. To understand this, we note that the value estimates depend on the reward and value predictions, which depend on the imagined states, which in turn depend on $\\begin{array} { r } { \\nabla _ { \\phi } \\mathrm { E } _ { q _ { \\theta } , q _ { \\phi } } \\big ( \\sum _ { \\tau = t } ^ { t + H } \\mathrm { V } _ { \\lambda } ( s _ { \\tau } ) \\big ) } \\end{array}$ all steps are implemented as neural networks, we analytically compute by stochastic backpropagation (Kingma and Welling, 2013; Rezende et al., 2014). We use reparameterization for continuous actions and latent states and straight-through gradients (Bengio et al., 2013) for discrete actions. The world model is fixed while learning behaviors. In tasks with early termination, the world model also predicts the discount factor from each latent state to weigh the time steps in Equations 7 and 8 by the cumulative product of the predicted discount factors, so terms are weighted down based on how likely the imagined trajectory would have ended. ",
667
+ "bbox": [
668
+ 173,
669
+ 428,
670
+ 825,
671
+ 583
672
+ ],
673
+ "page_idx": 4
674
+ },
675
+ {
676
+ "type": "text",
677
+ "text": "Comparison to actor critic methods Agents using Reinforce gradients (Williams, 1992), such as A3C and PPO (Mnih et al., 2016; Schulman et al., 2017), employ value baselines to reduce gradient variance, while Dreamer backpropagates through the value model. This is similar to deterministic or reparameterized actor critics (Silver et al., 2014), such as DDPG and SAC (Lillicrap et al., 2015; Haarnoja et al., 2018). However, these do not leverage gradients through transitions and only maximize immediate Q-values. MVE and STEVE (Feinberg et al., 2018; Buckman et al., 2018) extend them to multi-step Q-learning with learned dynamics to provide more accurate Q-value targets. We predict state values, which is sufficient for policy optimization since we backpropagate through the dynamics. Refer to Section 5 for a more detailed comparison to related work. ",
678
+ "bbox": [
679
+ 174,
680
+ 585,
681
+ 826,
682
+ 710
683
+ ],
684
+ "page_idx": 4
685
+ },
686
+ {
687
+ "type": "text",
688
+ "text": "4 LEARNING LATENT DYNAMICS ",
689
+ "text_level": 1,
690
+ "bbox": [
691
+ 176,
692
+ 719,
693
+ 465,
694
+ 736
695
+ ],
696
+ "page_idx": 4
697
+ },
698
+ {
699
+ "type": "text",
700
+ "text": "Learning behaviors in imagination requires a world model that generalizes well. We focus on latent dynamics models that predict forward in a compact latent space, facilitating long-term predictions and allowing the agent to imagine thousands of trajectories in parallel. Several objectives for learning representations for control have been proposed (Watter et al., 2015; Jaderberg et al., 2016; Oord et al., 2018; Eslami et al., 2018). We review three approaches for learning representations to use with Dreamer: reward prediction, image reconstruction, and contrastive estimation. ",
701
+ "bbox": [
702
+ 173,
703
+ 739,
704
+ 825,
705
+ 824
706
+ ],
707
+ "page_idx": 4
708
+ },
709
+ {
710
+ "type": "text",
711
+ "text": "Reward prediction Latent imagination requires a representation model $p ( s _ { t } \\mid s _ { t - 1 } , a _ { t - 1 } , o _ { t } )$ , transition model $q ( s _ { t } \\mid s _ { t - 1 } , a _ { t - 1 } , \\bar { ) }$ , and reward model $q ( r _ { t } \\mid s _ { t } )$ , as described in Section 2. In principle, this could be achieved by simply learning to predict future rewards given actions and past observations (Oh et al., 2017; Gelada et al., 2019; Schrittwieser et al., 2019). With a large and diverse dataset, such representations should be sufficient for solving a control task. However, with a finite dataset and especially when rewards are sparse, learning about observations that correlate with rewards is likely to improve the world model (Jaderberg et al., 2016; Gregor et al., 2019). ",
712
+ "bbox": [
713
+ 173,
714
+ 827,
715
+ 825,
716
+ 924
717
+ ],
718
+ "page_idx": 4
719
+ },
720
+ {
721
+ "type": "image",
722
+ "img_path": "images/850edcfff38df126bd48410320f30bae3bc5443dd9c224051abff742bb4817c2.jpg",
723
+ "image_caption": [
724
+ "Figure 6: Performance comparison to existing methods. Dreamer inherits the data-efficiency of PlaNet while exceeding the asymptotic performance of the best model-free agents. After $5 \\times 1 0 ^ { 6 }$ environment steps, Dreamer reaches an average performance of 823 across tasks, compared to PlaNet at 332 and the top model-free D4PG agent at 786 after $1 0 ^ { 9 }$ steps. Results are averages over 5 seeds. "
725
+ ],
726
+ "image_footnote": [],
727
+ "bbox": [
728
+ 171,
729
+ 97,
730
+ 826,
731
+ 246
732
+ ],
733
+ "page_idx": 5
734
+ },
735
+ {
736
+ "type": "text",
737
+ "text": "Reconstruction We first describe the world model used by PlaNet (Hafner et al., 2018) that learns latent dynamics by reconstructing images as shown in Figure 3a. The world model consists of the following components, where the observation model is only used to provide a learning signal, ",
738
+ "bbox": [
739
+ 174,
740
+ 320,
741
+ 825,
742
+ 363
743
+ ],
744
+ "page_idx": 5
745
+ },
746
+ {
747
+ "type": "equation",
748
+ "img_path": "images/f17afd2b24aeef485076f56b7ca6cd26fafc2b593c6d5613b2d808a7f2538516.jpg",
749
+ "text": "$$\n{ \\begin{array} { r l r l } & { { \\mathrm { R e p r e s e n t a t i o n ~ m o d e l : } } \\quad } & & { p _ { \\theta } ( s _ { t } \\mid s _ { t - 1 } , a _ { t - 1 } , o _ { t } ) } \\\\ & { { \\mathrm { O b s e r v a t i o n ~ m o d e l : } } \\quad } & & { q _ { \\theta } ( o _ { t } \\mid s _ { t } ) } \\\\ & { { \\mathrm { R e w a r d ~ m o d e l : } } \\quad } & & { q _ { \\theta } ( r _ { t } \\mid s _ { t } ) } \\\\ & { { \\mathrm { T r a n s i t i o n ~ m o d e l : } } \\quad } & & { q _ { \\theta } ( s _ { t } \\mid s _ { t - 1 } , a _ { t - 1 } ) . } \\end{array} }\n$$",
750
+ "text_format": "latex",
751
+ "bbox": [
752
+ 316,
753
+ 369,
754
+ 679,
755
+ 444
756
+ ],
757
+ "page_idx": 5
758
+ },
759
+ {
760
+ "type": "text",
761
+ "text": "The components are optimized jointly to increase the variational lower bound (ELBO; Jordan et al., 1999) or more generally the variational information bottleneck (VIB; Tishby et al., 2000; Alemi et al., 2016). As derived in Appendix B, the bound includes reconstruction terms for observations and rewards and a KL regularizer. The expectation is taken under the dataset and representation model, ",
762
+ "bbox": [
763
+ 173,
764
+ 448,
765
+ 825,
766
+ 505
767
+ ],
768
+ "page_idx": 5
769
+ },
770
+ {
771
+ "type": "equation",
772
+ "img_path": "images/ea47cca3cacc71243e2917d501e72456edc3fe4d1108c39ea0a95c7964aa5c80.jpg",
773
+ "text": "$$\n\\begin{array} { r l } & { \\mathcal { T } _ { \\mathrm { R E C } } \\doteq \\mathrm { E } _ { p } \\Bigg ( \\displaystyle \\sum _ { t } \\left( \\mathcal { T } _ { \\mathrm { O } } ^ { t } + \\mathcal { T } _ { \\mathrm { R } } ^ { t } + \\mathcal { I } _ { \\mathrm { D } } ^ { t } \\right) \\Bigg ) + \\mathrm { c o n s t } \\qquad \\mathcal { I } _ { \\mathrm { O } } ^ { t } \\doteq \\mathrm { l n } q ( o _ { t } \\mid s _ { t } ) } \\\\ & { \\mathcal { I } _ { \\mathrm { R } } ^ { t } \\doteq \\mathrm { l n } q ( r _ { t } \\mid s _ { t } ) \\qquad \\mathcal { I } _ { \\mathrm { D } } ^ { t } \\doteq \\ - \\beta \\operatorname { K L } \\big ( p ( s _ { t } \\mid s _ { t - 1 } , a _ { t - 1 } , o _ { t } ) \\big \\parallel q ( o _ { t } \\mid s _ { t - 1 } , a _ { t - 1 } ) \\big ) . } \\end{array}\n$$",
774
+ "text_format": "latex",
775
+ "bbox": [
776
+ 212,
777
+ 511,
778
+ 759,
779
+ 573
780
+ ],
781
+ "page_idx": 5
782
+ },
783
+ {
784
+ "type": "text",
785
+ "text": "We implement the transition model as a recurrent state space model (RSSM; Hafner et al., 2018), the representation model by combining the RSSM with a convolutional neural network (CNN; LeCun et al., 1989) applied to the image observation, the observation model as a transposed CNN, and the reward model as a dense network. The combined parameter vector $\\theta$ is updated by stochastic backpropagation (Kingma and Welling, 2013; Rezende et al., 2014). Figure 5 shows video predictions of this model. We refer to Appendix A and Hafner et al. (2018) model details. ",
786
+ "bbox": [
787
+ 173,
788
+ 580,
789
+ 825,
790
+ 666
791
+ ],
792
+ "page_idx": 5
793
+ },
794
+ {
795
+ "type": "text",
796
+ "text": "Contrastive estimation Predicting pixels can require high model capacity. We can also encourage mutual information between model states and observations by instead predicting the states from the images (Guo et al., 2018). This replaces the observation model with a state model, ",
797
+ "bbox": [
798
+ 173,
799
+ 670,
800
+ 825,
801
+ 712
802
+ ],
803
+ "page_idx": 5
804
+ },
805
+ {
806
+ "type": "text",
807
+ "text": "State model: ",
808
+ "bbox": [
809
+ 348,
810
+ 720,
811
+ 431,
812
+ 734
813
+ ],
814
+ "page_idx": 5
815
+ },
816
+ {
817
+ "type": "equation",
818
+ "img_path": "images/82528c9b626138a749871eecf3c4cddf40c08e1c5b7b7aef9735da4dbe7fad6b.jpg",
819
+ "text": "$$\nq _ { \\theta } { \\left( s _ { t } \\mid o _ { t } \\right) } .\n$$",
820
+ "text_format": "latex",
821
+ "bbox": [
822
+ 558,
823
+ 719,
824
+ 633,
825
+ 736
826
+ ],
827
+ "page_idx": 5
828
+ },
829
+ {
830
+ "type": "text",
831
+ "text": "While the reconstruction objective used the fact that the observation marginal is a constant, we now face the state marginal. As shown in Appendix B, this can be estimated via noise contrastive estimation (NCE; Gutmann and Hyvärinen, 2010; Oord et al., 2018) by averaging the state model over observations $o ^ { \\prime }$ of the current sequence batch. Intuitively, $q ( s _ { t } \\mid o _ { t } )$ makes the state predictable from the current image while $\\ln { \\textstyle \\sum _ { o ^ { \\prime } } \\bar { q } } ( s _ { t } \\mid o ^ { \\prime } )$ keeps it diverse to prevent collapse, ",
832
+ "bbox": [
833
+ 173,
834
+ 743,
835
+ 825,
836
+ 815
837
+ ],
838
+ "page_idx": 5
839
+ },
840
+ {
841
+ "type": "equation",
842
+ "img_path": "images/41b8b6e2ceb0c75b27c66c7474038cc2b0403a95b06b36d305a559b1035bce2d.jpg",
843
+ "text": "$$\n\\mathcal { I } _ { \\mathrm { N C E } } \\doteq \\mathrm { E } \\biggl ( \\sum _ { t } \\Big ( \\mathcal { I } _ { \\mathrm { S } } ^ { t } + \\mathcal { I } _ { \\mathrm { R } } ^ { t } + \\mathcal { I } _ { \\mathrm { D } } ^ { t } \\Big ) \\biggr ) \\quad \\mathcal { I } _ { \\mathrm { S } } ^ { t } \\doteq \\ln q ( s _ { t } \\mid o _ { t } ) - \\ln \\left( \\sum _ { o ^ { \\prime } } q ( s _ { t } \\mid o ^ { \\prime } ) \\right) .\n$$",
844
+ "text_format": "latex",
845
+ "bbox": [
846
+ 202,
847
+ 821,
848
+ 751,
849
+ 861
850
+ ],
851
+ "page_idx": 5
852
+ },
853
+ {
854
+ "type": "text",
855
+ "text": "We implement the state model as a CNN and again optimize the bound with respect to the combined parameter vector $\\theta$ using stochastic backpropagation. While avoiding pixel prediction, the amount of information this bound can extract efficiently is limited (McAllester and Statos, 2018). We empirically compare reward, reconstruction, and contrastive objectives in our experiments in Figure 8. ",
856
+ "bbox": [
857
+ 173,
858
+ 867,
859
+ 825,
860
+ 924
861
+ ],
862
+ "page_idx": 5
863
+ },
864
+ {
865
+ "type": "image",
866
+ "img_path": "images/7cb2a9948aaab447ba5b50c03e1ad20e63c9bf9369affa3ea5f7c2c2971093b9.jpg",
867
+ "image_caption": [
868
+ "Figure 7: Dreamer succeeds at visual control tasks that require long-horizon credit assignment, such as the acrobot and hopper tasks. Optimizing only imagined rewards within the horizon via an action model or by online planning yields shortsighted behaviors that only succeed in reactive tasks, such as in the walker domain. The performance on all 20 tasks is summarized in Figure 6 and training curves are shown in Appendix D. See Tassa et al. (2018) for performance curves of D4PG and A3C. "
869
+ ],
870
+ "image_footnote": [],
871
+ "bbox": [
872
+ 171,
873
+ 97,
874
+ 826,
875
+ 347
876
+ ],
877
+ "page_idx": 6
878
+ },
879
+ {
880
+ "type": "text",
881
+ "text": "5 RELATED WORK ",
882
+ "text_level": 1,
883
+ "bbox": [
884
+ 176,
885
+ 431,
886
+ 344,
887
+ 448
888
+ ],
889
+ "page_idx": 6
890
+ },
891
+ {
892
+ "type": "text",
893
+ "text": "Prior works learn latent dynamics for visual control by derivative-free policy learning or online planning, augment model-free agents with multi-step predictions, or use analytic gradients of Qvalues or multi-step rewards, often for low-dimensional tasks. In comparison, Dreamer uses analytic gradients to efficiently learn long-horizon behaviors for visual control purely by latent imagination. ",
894
+ "bbox": [
895
+ 174,
896
+ 460,
897
+ 825,
898
+ 516
899
+ ],
900
+ "page_idx": 6
901
+ },
902
+ {
903
+ "type": "text",
904
+ "text": "Control with latent dynamics E2C (Watter et al., 2015) and RCE (Banijamali et al., 2017) embed images to predict forward in a compact space to solve simple tasks. World Models (Ha and Schmidhuber, 2018) learn latent dynamics in a two-stage process to evolve linear controllers in imagination. PlaNet (Hafner et al., 2018) learns them jointly and solves visual locomotion tasks by latent online planning. SOLAR (Zhang et al., 2019) solves robotic tasks via guided policy search in latent space. I2A (Weber et al., 2017) hands imagined trajectories to a model-free policy, while Lee et al. (2019) and Gregor et al. (2019) learn belief representations to accelerate model-free agents. ",
905
+ "bbox": [
906
+ 174,
907
+ 521,
908
+ 825,
909
+ 619
910
+ ],
911
+ "page_idx": 6
912
+ },
913
+ {
914
+ "type": "text",
915
+ "text": "Imagined multi-step returns VPN (Oh et al., 2017), MVE (Feinberg et al., 2018), and STEVE (Buckman et al., 2018) learn dynamics for multi-step Q-learning from a replay buffer. AlphaGo (Silver et al., 2017) combines predictions of actions and state values with planning, assuming access to the true dynamics. Also assuming access to the dynamics, POLO (Lowrey et al., 2018) plans to explore by learning a value ensemble. MuZero (Schrittwieser et al., 2019) learns task-specific reward and value models to solve challenging tasks but requires large amounts of experience. PETS (Chua et al., 2018), VisualMPC (Ebert et al., 2017), and PlaNet (Hafner et al., 2018) plan online using derivative-free optimization. POPLIN (Wang and Ba, 2019) improves over online planning by self-imitation. Piergiovanni et al. (2018) learn robot policies by imagination with a latent dynamics model. Planning with neural network gradients was shown on small problems (Schmidhuber, 1990; Henaff et al., 2018) but has been challenging to scale (Parmas et al., 2019). ",
916
+ "bbox": [
917
+ 173,
918
+ 623,
919
+ 825,
920
+ 776
921
+ ],
922
+ "page_idx": 6
923
+ },
924
+ {
925
+ "type": "text",
926
+ "text": "Analytic value gradients DPG (Silver et al., 2014), DDPG (Lillicrap et al., 2015), and SAC (Haarnoja et al., 2018) leverage gradients of learned immediate action values to learn a policy by experience replay. SVG (Heess et al., 2015) reduces the variance of model-free on-policy algorithms by analytic value gradients of one-step model predictions. Concurrent work by Byravan et al. (2019) uses latent imagination with deterministic models for navigation and manipulation tasks. ME-TRPO (Kurutach et al., 2018) accelerates an otherwise model-free agent via gradients of predicted rewards for proprioceptive inputs. DistGBP (Henaff et al., 2017; 2019) uses model gradients for online planning in simple tasks. ",
927
+ "bbox": [
928
+ 173,
929
+ 781,
930
+ 825,
931
+ 893
932
+ ],
933
+ "page_idx": 6
934
+ },
935
+ {
936
+ "type": "image",
937
+ "img_path": "images/6454d7e9fc0f9e0992dd9840b84c4ab2b8972dfe74176d26757c747a902489ee.jpg",
938
+ "image_caption": [
939
+ "Figure 8: Comparison of representation learning objectives to be used with Dreamer. Pixel reconstruction performs best for the majority of tasks. The contrastive objective solves about half of the tasks, while predicting rewards alone was not sufficient in our experiments. The results suggest that future developments in learning representations are likely to translate into improved task performance for Dreamer. The performance curves for all tasks are included in Appendix E. "
940
+ ],
941
+ "image_footnote": [],
942
+ "bbox": [
943
+ 173,
944
+ 97,
945
+ 826,
946
+ 347
947
+ ],
948
+ "page_idx": 7
949
+ },
950
+ {
951
+ "type": "text",
952
+ "text": "6 EXPERIMENTS ",
953
+ "text_level": 1,
954
+ "bbox": [
955
+ 176,
956
+ 434,
957
+ 326,
958
+ 450
959
+ ],
960
+ "page_idx": 7
961
+ },
962
+ {
963
+ "type": "text",
964
+ "text": "We experimentally evaluate Dreamer on a variety of control tasks. We designed the experiments to compare Dreamer to current best methods in the literature, and to evaluate its ability to solve tasks with long horizons, continuous actions, discrete actions, and early termination. We further compare the orthogonal choice of learning objective for the world model. The source code for all our experiments and videos of Dreamer are available at https://danijar.com/dreamer. ",
965
+ "bbox": [
966
+ 174,
967
+ 470,
968
+ 825,
969
+ 541
970
+ ],
971
+ "page_idx": 7
972
+ },
973
+ {
974
+ "type": "text",
975
+ "text": "Control tasks We evaluate Dreamer on 20 visual control tasks of the DeepMind Control Suite (Tassa et al., 2018), illustrated in Figure 2. These tasks pose a variety of challenges, including sparse rewards, contact dynamics, and 3D scenes. We selected the tasks on which Tassa et al. (2018) report non-zero performance from image inputs. Agent observations are images of shape $6 4 \\times 6 4 \\times 3$ , actions range from 1 to 12 dimensions, rewards range from 0 to 1, episodes last for 1000 steps and have randomized initial states. We use a fixed action repeat of $R = 2$ across tasks. We further evaluate the applicability of Dreamer to discrete actions and early termination on a subset of Atari games (Bellemare et al., 2013) and DeepMind Lab levels (Beattie et al., 2016) as detailed in Appendix C. ",
976
+ "bbox": [
977
+ 174,
978
+ 551,
979
+ 825,
980
+ 662
981
+ ],
982
+ "page_idx": 7
983
+ },
984
+ {
985
+ "type": "text",
986
+ "text": "Implementation Our implementation uses TensorFlow Probability (Dillon et al., 2017). We use a single Nvidia V100 GPU and 10 CPU cores for each training run. The training time for our Dreamer implementation is below 5 hours per $1 0 ^ { 6 }$ environment steps on the control suite, compared to 11 hours for online planning using PlaNet, and the 24 hours used by D4PG to reach similar performance. We use the same hyper parameters across all continuous tasks, and similarly across all discrete tasks, detailed in Appendix A. The world models are learned via reconstruction unless specified. ",
987
+ "bbox": [
988
+ 174,
989
+ 672,
990
+ 825,
991
+ 757
992
+ ],
993
+ "page_idx": 7
994
+ },
995
+ {
996
+ "type": "text",
997
+ "text": "Baseline methods The highest reported performance on the continuous tasks is achieved by D4PG (Barth-Maron et al., 2018), an improved variant of DDPG (Lillicrap et al., 2015) that uses distributed collection, distributional Q-learning, multi-step returns, and prioritized replay. We include the scores for D4PG with pixel inputs and A3C (Mnih et al., 2016) with state inputs from Tassa et al. (2018). PlaNet (Hafner et al., 2018) learns the same world model as Dreamer and selects actions via online planning without an action model and drastically improves over D4PG and A3C in data efficiency. We re-run PlaNet with $R = 2$ for a unified experimental setup. For Atari, we show the final performance of SimPLe (Kaiser et al., 2019), DQN (Mnih et al., 2015) and Rainbow (Hessel et al., 2018) reported by Castro et al. (2018), and for DeepMind Lab that of IMPALA (Espeholt et al., 2018) as a guideline. ",
998
+ "bbox": [
999
+ 173,
1000
+ 767,
1001
+ 825,
1002
+ 892
1003
+ ],
1004
+ "page_idx": 7
1005
+ },
1006
+ {
1007
+ "type": "text",
1008
+ "text": "Performance To evaluate the performance of Dreamer, we compare it to state-of-the-art reinforcement learning agents. The results are summarized in Figure 6. With an average score of 823 across tasks after $5 \\times \\bar { 1 0 ^ { 6 } }$ environment steps, Dreamer exceeds the performance of the strong model-free D4PG agent that achieves an average of 786 within $1 0 ^ { 9 }$ environment steps. At the same time, Dreamer inherits the data-efficiency of PlaNet, confirming that the learned world model can help to generalize from small amounts of experience. The empirical success of Dreamer shows that learning behaviors by latent imagination with world models can outperform top methods based on experience replay. ",
1009
+ "bbox": [
1010
+ 174,
1011
+ 103,
1012
+ 825,
1013
+ 202
1014
+ ],
1015
+ "page_idx": 8
1016
+ },
1017
+ {
1018
+ "type": "text",
1019
+ "text": "Long horizons To investigate its ability to learn long-horizon behaviors, we compare Dreamer to alternatives for deriving behaviors from the world model at various horizon lengths. For this, we learn an action model to maximize imagined rewards without a value model and compare to online planning using PlaNet. Figure 4 shows the final performance for different imagination horizons, confirming that the value model makes Dreamer more robust to the horizon and performs well even for short horizons. Performance curves for all 19 tasks with horizon of 20 are shown in Appendix D, where Dreamer outperforms the alternatives on 16 of 20 tasks, with 4 ties. ",
1020
+ "bbox": [
1021
+ 174,
1022
+ 205,
1023
+ 825,
1024
+ 301
1025
+ ],
1026
+ "page_idx": 8
1027
+ },
1028
+ {
1029
+ "type": "text",
1030
+ "text": "Representation learning Dreamer can be used with any differentiable dynamics model that predicts future rewards given actions and past observations. Since the representation learning objective is orthogonal to our algorithm, we compare three natural choices described in Section 4: pixel reconstruction, contrastive estimation, and pure reward prediction. Figure 8 shows clear differences in task performance for different representation learning approaches, with pixel reconstruction outperforming contrastive estimation on most tasks. This suggests that future improvements in representation learning are likely to translate to higher task performance with Dreamer. Reward prediction alone was not sufficient in our experiments. Further ablations are included in the appendix of the paper. ",
1031
+ "bbox": [
1032
+ 174,
1033
+ 306,
1034
+ 825,
1035
+ 417
1036
+ ],
1037
+ "page_idx": 8
1038
+ },
1039
+ {
1040
+ "type": "text",
1041
+ "text": "7 CONCLUSION ",
1042
+ "text_level": 1,
1043
+ "bbox": [
1044
+ 176,
1045
+ 433,
1046
+ 318,
1047
+ 449
1048
+ ],
1049
+ "page_idx": 8
1050
+ },
1051
+ {
1052
+ "type": "text",
1053
+ "text": "We present Dreamer, an agent that learns long-horizon behaviors purely by latent imagination. For this, we propose an actor critic method that optimizes a parametric policy by propagating analytic gradients of multi-step values back through learned latent dynamics. Dreamer outperforms previous methods in data-efficiency, computation time, and final performance on a variety of challenging continuous control tasks with image inputs. We further show that Dreamer is applicable to tasks with discrete actions and early episode termination. Future research on representation learning can likely scale latent imagination to environments of higher visual complexity. ",
1054
+ "bbox": [
1055
+ 174,
1056
+ 460,
1057
+ 825,
1058
+ 559
1059
+ ],
1060
+ "page_idx": 8
1061
+ },
1062
+ {
1063
+ "type": "text",
1064
+ "text": "Acknowledgements We thank Simon Kornblith, Benjamin Eysenbach, Ian Fischer, Amy Zhang, Geoffrey Hinton, Shane Gu, Adam Kosiorek, Jacob Buckman, Calvin Luo, and Rishabh Agarwal, and our anonymous reviewers for feedback and discussions. We thank Yuval Tassa for adding the quadruped environment to the control suite. ",
1065
+ "bbox": [
1066
+ 176,
1067
+ 563,
1068
+ 825,
1069
+ 617
1070
+ ],
1071
+ "page_idx": 8
1072
+ },
1073
+ {
1074
+ "type": "text",
1075
+ "text": "REFERENCES ",
1076
+ "text_level": 1,
1077
+ "bbox": [
1078
+ 174,
1079
+ 103,
1080
+ 285,
1081
+ 118
1082
+ ],
1083
+ "page_idx": 9
1084
+ },
1085
+ {
1086
+ "type": "text",
1087
+ "text": "A. A. Alemi, I. Fischer, J. V. Dillon, and K. Murphy. Deep variational information bottleneck. arXiv preprint arXiv:1612.00410, 2016. \nE. Banijamali, R. Shu, M. Ghavamzadeh, H. Bui, and A. Ghodsi. Robust locally-linear controllable embedding. arXiv preprint arXiv:1710.05373, 2017. \nG. Barth-Maron, M. W. Hoffman, D. Budden, W. Dabney, D. Horgan, A. Muldal, N. Heess, and T. Lillicrap. Distributed distributional deterministic policy gradients. arXiv preprint arXiv:1804.08617, 2018. \nC. Beattie, J. Z. Leibo, D. Teplyashin, T. Ward, M. Wainwright, H. Küttler, A. Lefrancq, S. Green, V. Valdés, A. Sadik, et al. Deepmind lab. arXiv preprint arXiv:1612.03801, 2016. \nM. G. Bellemare, Y. Naddaf, J. Veness, and M. Bowling. The arcade learning environment: An evaluation platform for general agents. Journal of Artificial Intelligence Research, 47:253–279, 2013. \nY. Bengio, N. Léonard, and A. Courville. Estimating or propagating gradients through stochastic neurons for conditional computation. arXiv preprint arXiv:1308.3432, 2013. \nJ. Buckman, D. Hafner, G. Tucker, E. Brevdo, and H. Lee. Sample-efficient reinforcement learning with stochastic ensemble value expansion. In Advances in Neural Information Processing Systems, pages 8224–8234, 2018. \nL. Buesing, T. Weber, S. Racaniere, S. Eslami, D. Rezende, D. P. Reichert, F. Viola, F. Besse, K. Gregor, D. Hassabis, et al. Learning and querying fast generative models for reinforcement learning. arXiv preprint arXiv:1802.03006, 2018. \nA. Byravan, J. T. Springenberg, A. Abdolmaleki, R. Hafner, M. Neunert, T. Lampe, N. Siegel, N. Heess, and M. Riedmiller. Imagined value gradients: Model-based policy optimization with transferable latent dynamics models. arXiv preprint arXiv:1910.04142, 2019. \nP. S. Castro, S. Moitra, C. Gelada, S. Kumar, and M. G. Bellemare. Dopamine: A research framework for deep reinforcement learning. arXiv preprint arXiv:1812.06110, 2018. \nK. Chua, R. Calandra, R. McAllister, and S. Levine. Deep reinforcement learning in a handful of trials using probabilistic dynamics models. In Advances in Neural Information Processing Systems, pages 4754–4765, 2018. \nD.-A. Clevert, T. Unterthiner, and S. Hochreiter. Fast and accurate deep network learning by exponential linear units (elus). arXiv preprint arXiv:1511.07289, 2015. \nJ. V. Dillon, I. Langmore, D. Tran, E. Brevdo, S. Vasudevan, D. Moore, B. Patton, A. Alemi, M. Hoffman, and R. A. Saurous. Tensorflow distributions. arXiv preprint arXiv:1711.10604, 2017. \nA. Doerr, C. Daniel, M. Schiegg, D. Nguyen-Tuong, S. Schaal, M. Toussaint, and S. Trimpe. Probabilistic recurrent state-space models. arXiv preprint arXiv:1801.10395, 2018. \nF. Ebert, C. Finn, A. X. Lee, and S. Levine. Self-supervised visual planning with temporal skip connections. arXiv preprint arXiv:1710.05268, 2017. \nS. A. Eslami, D. J. Rezende, F. Besse, F. Viola, A. S. Morcos, M. Garnelo, A. Ruderman, A. A. Rusu, I. Danihelka, K. Gregor, et al. Neural scene representation and rendering. Science, 360(6394): 1204–1210, 2018. \nL. Espeholt, H. Soyer, R. Munos, K. Simonyan, V. Mnih, T. Ward, Y. Doron, V. Firoiu, T. Harley, I. Dunning, et al. Impala: Scalable distributed deep-rl with importance weighted actor-learner architectures. arXiv preprint arXiv:1802.01561, 2018. \nV. Feinberg, A. Wan, I. Stoica, M. I. Jordan, J. E. Gonzalez, and S. Levine. Model-based value estimation for efficient model-free reinforcement learning. arXiv preprint arXiv:1803.00101, 2018. \nC. Gelada, S. Kumar, J. Buckman, O. Nachum, and M. G. Bellemare. Deepmdp: Learning continuous latent space models for representation learning. arXiv preprint arXiv:1906.02736, 2019. \nK. Gregor, D. J. Rezende, F. Besse, Y. Wu, H. Merzic, and A. v. d. Oord. Shaping belief states with generative environment models for rl. arXiv preprint arXiv:1906.09237, 2019. \nZ. D. Guo, M. G. Azar, B. Piot, B. A. Pires, T. Pohlen, and R. Munos. Neural predictive belief representations. arXiv preprint arXiv:1811.06407, 2018. \nM. Gutmann and A. Hyvärinen. Noise-contrastive estimation: A new estimation principle for unnormalized statistical models. In Proceedings of the Thirteenth International Conference on Artificial Intelligence and Statistics, pages 297–304, 2010. \nD. Ha and J. Schmidhuber. World models. arXiv preprint arXiv:1803.10122, 2018. \nT. Haarnoja, A. Zhou, P. Abbeel, and S. Levine. Soft actor-critic: Off-policy maximum entropy deep reinforcement learning with a stochastic actor. arXiv preprint arXiv:1801.01290, 2018. \nD. Hafner, T. Lillicrap, I. Fischer, R. Villegas, D. Ha, H. Lee, and J. Davidson. Learning latent dynamics for planning from pixels. arXiv preprint arXiv:1811.04551, 2018. \nN. Heess, G. Wayne, D. Silver, T. Lillicrap, T. Erez, and Y. Tassa. Learning continuous control policies by stochastic value gradients. In Advances in Neural Information Processing Systems, pages 2944–2952, 2015. \nM. Henaff, W. F. Whitney, and Y. LeCun. Model-based planning in discrete action spaces. CoRR, abs/1705.07177, 2017. \nM. Henaff, W. F. Whitney, and Y. LeCun. Model-based planning with discrete and continuous actions. arXiv preprint arXiv:1705.07177, 2018. \nM. Henaff, A. Canziani, and Y. LeCun. Model-predictive policy learning with uncertainty regularization for driving in dense traffic. arXiv preprint arXiv:1901.02705, 2019. \nM. Hessel, J. Modayil, H. Van Hasselt, T. Schaul, G. Ostrovski, W. Dabney, D. Horgan, B. Piot, M. Azar, and D. Silver. Rainbow: Combining improvements in deep reinforcement learning. In Thirty-Second AAAI Conference on Artificial Intelligence, 2018. \nM. Jaderberg, V. Mnih, W. M. Czarnecki, T. Schaul, J. Z. Leibo, D. Silver, and K. Kavukcuoglu. Reinforcement learning with unsupervised auxiliary tasks. arXiv preprint arXiv:1611.05397, 2016. \nM. I. Jordan, Z. Ghahramani, T. S. Jaakkola, and L. K. Saul. An introduction to variational methods for graphical models. Machine learning, 37(2):183–233, 1999. \nL. Kaiser, M. Babaeizadeh, P. Milos, B. Osinski, R. H. Campbell, K. Czechowski, D. Erhan, C. Finn, P. Kozakowski, S. Levine, et al. Model-based reinforcement learning for atari. arXiv preprint arXiv:1903.00374, 2019. \nR. E. Kalman. A new approach to linear filtering and prediction problems. Journal of basic Engineering, 82(1):35–45, 1960. \nM. Karl, M. Soelch, J. Bayer, and P. van der Smagt. Deep variational bayes filters: Unsupervised learning of state space models from raw data. arXiv preprint arXiv:1605.06432, 2016. \nD. P. Kingma and J. Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014. \nD. P. Kingma and M. Welling. Auto-encoding variational bayes. arXiv preprint arXiv:1312.6114, 2013. \nR. G. Krishnan, U. Shalit, and D. Sontag. Deep kalman filters. arXiv preprint arXiv:1511.05121, 2015. \nT. Kurutach, I. Clavera, Y. Duan, A. Tamar, and P. Abbeel. Model-ensemble trust-region policy optimization. arXiv preprint arXiv:1802.10592, 2018. \nY. LeCun, B. Boser, J. S. Denker, D. Henderson, R. E. Howard, W. Hubbard, and L. D. Jackel. Backpropagation applied to handwritten zip code recognition. Neural computation, 1(4):541–551, 1989. \nA. X. Lee, A. Nagabandi, P. Abbeel, and S. Levine. Stochastic latent actor-critic: Deep reinforcement learning with a latent variable model. arXiv preprint arXiv:1907.00953, 2019. \nT. P. Lillicrap, J. J. Hunt, A. Pritzel, N. Heess, T. Erez, Y. Tassa, D. Silver, and D. Wierstra. Continuous control with deep reinforcement learning. arXiv preprint arXiv:1509.02971, 2015. \nK. Lowrey, A. Rajeswaran, S. Kakade, E. Todorov, and I. Mordatch. Plan online, learn offline: Efficient learning and exploration via model-based control. arXiv preprint arXiv:1811.01848, 2018. \nM. C. Machado, M. G. Bellemare, E. Talvitie, J. Veness, M. Hausknecht, and M. Bowling. Revisiting the arcade learning environment: Evaluation protocols and open problems for general agents. Journal of Artificial Intelligence Research, 61:523–562, 2018. \nD. McAllester and K. Statos. Formal limitations on the measurement of mutual information. arXiv preprint arXiv:1811.04251, 2018. \nV. Mnih, K. Kavukcuoglu, D. Silver, A. A. Rusu, J. Veness, M. G. Bellemare, A. Graves, M. Riedmiller, A. K. Fidjeland, G. Ostrovski, et al. Human-level control through deep reinforcement learning. Nature, 518(7540):529, 2015. \nV. Mnih, A. P. Badia, M. Mirza, A. Graves, T. Lillicrap, T. Harley, D. Silver, and K. Kavukcuoglu. Asynchronous methods for deep reinforcement learning. In International Conference on Machine Learning, pages 1928–1937, 2016. \nJ. Oh, S. Singh, and H. Lee. Value prediction network. In Advances in Neural Information Processing Systems, pages 6118–6128, 2017. \nA. v. d. Oord, Y. Li, and O. Vinyals. Representation learning with contrastive predictive coding. arXiv preprint arXiv:1807.03748, 2018. \nP. Parmas, C. E. Rasmussen, J. Peters, and K. Doya. Pipps: Flexible model-based policy search robust to the curse of chaos. arXiv preprint arXiv:1902.01240, 2019. \nA. Piergiovanni, A. Wu, and M. S. Ryoo. Learning real-world robot policies by dreaming. arXiv preprint arXiv:1805.07813, 2018. \nB. Poole, S. Ozair, A. v. d. Oord, A. A. Alemi, and G. Tucker. On variational bounds of mutual information. arXiv preprint arXiv:1905.06922, 2019. \nD. J. Rezende, S. Mohamed, and D. Wierstra. Stochastic backpropagation and approximate inference in deep generative models. arXiv preprint arXiv:1401.4082, 2014. \nJ. Schmidhuber. Making the world differentiable: On using self-supervised fully recurrent neural networks for dynamic reinforcement learning and planning in non-stationary environments. 1990. \nJ. Schrittwieser, I. Antonoglou, T. Hubert, K. Simonyan, L. Sifre, S. Schmitt, A. Guez, E. Lockhart, D. Hassabis, T. Graepel, et al. Mastering atari, go, chess and shogi by planning with a learned model. arXiv preprint arXiv:1911.08265, 2019. \nJ. Schulman, F. Wolski, P. Dhariwal, A. Radford, and O. Klimov. Proximal policy optimization algorithms. arXiv preprint arXiv:1707.06347, 2017. \nD. Silver, G. Lever, N. Heess, T. Degris, D. Wierstra, and M. Riedmiller. Deterministic policy gradient algorithms. In Proceedings of the 31st International Conference on Machine Learning, 2014. \nD. Silver, J. Schrittwieser, K. Simonyan, I. Antonoglou, A. Huang, A. Guez, T. Hubert, L. Baker, M. Lai, A. Bolton, et al. Mastering the game of go without human knowledge. Nature, 550(7676): 354, 2017. \nA. Srinivas, A. Jabri, P. Abbeel, S. Levine, and C. Finn. Universal planning networks. arXiv preprint arXiv:1804.00645, 2018. \nR. S. Sutton. Dyna, an integrated architecture for learning, planning, and reacting. ACM SIGART Bulletin, 2(4):160–163, 1991. \nR. S. Sutton and A. G. Barto. Reinforcement learning: An introduction. MIT press, 2018. \nY. Tassa, Y. Doron, A. Muldal, T. Erez, Y. Li, D. d. L. Casas, D. Budden, A. Abdolmaleki, J. Merel, A. Lefrancq, et al. Deepmind control suite. arXiv preprint arXiv:1801.00690, 2018. \nN. Tishby, F. C. Pereira, and W. Bialek. The information bottleneck method. arXiv preprint physics/0004057, 2000. \nT. Wang and J. Ba. Exploring model-based planning with policy networks. arXiv preprint arXiv:1906.08649, 2019. \nT. Wang, X. Bao, I. Clavera, J. Hoang, Y. Wen, E. Langlois, S. Zhang, G. Zhang, P. Abbeel, and J. Ba. Benchmarking model-based reinforcement learning. CoRR, abs/1907.02057, 2019. \nM. Watter, J. Springenberg, J. Boedecker, and M. Riedmiller. Embed to control: A locally linear latent dynamics model for control from raw images. In Advances in neural information processing systems, pages 2746–2754, 2015. \nT. Weber, S. Racanière, D. P. Reichert, L. Buesing, A. Guez, D. J. Rezende, A. P. Badia, O. Vinyals, N. Heess, Y. Li, et al. Imagination-augmented agents for deep reinforcement learning. arXiv preprint arXiv:1707.06203, 2017. \nR. J. Williams. Simple statistical gradient-following algorithms for connectionist reinforcement learning. Machine learning, 8(3-4):229–256, 1992. \nM. Zhang, S. Vikram, L. Smith, P. Abbeel, M. Johnson, and S. Levine. Solar: deep structured representations for model-based reinforcement learning. In International Conference on Machine Learning, 2019. ",
1088
+ "bbox": [
1089
+ 171,
1090
+ 126,
1091
+ 828,
1092
+ 924
1093
+ ],
1094
+ "page_idx": 9
1095
+ },
1096
+ {
1097
+ "type": "text",
1098
+ "text": "",
1099
+ "bbox": [
1100
+ 171,
1101
+ 73,
1102
+ 828,
1103
+ 928
1104
+ ],
1105
+ "page_idx": 10
1106
+ },
1107
+ {
1108
+ "type": "text",
1109
+ "text": "",
1110
+ "bbox": [
1111
+ 169,
1112
+ 84,
1113
+ 828,
1114
+ 928
1115
+ ],
1116
+ "page_idx": 11
1117
+ },
1118
+ {
1119
+ "type": "text",
1120
+ "text": "",
1121
+ "bbox": [
1122
+ 171,
1123
+ 101,
1124
+ 828,
1125
+ 540
1126
+ ],
1127
+ "page_idx": 12
1128
+ },
1129
+ {
1130
+ "type": "text",
1131
+ "text": "A HYPER PARAMETERS ",
1132
+ "text_level": 1,
1133
+ "bbox": [
1134
+ 176,
1135
+ 102,
1136
+ 387,
1137
+ 117
1138
+ ],
1139
+ "page_idx": 13
1140
+ },
1141
+ {
1142
+ "type": "text",
1143
+ "text": "Model components We use the convolutional encoder and decoder networks from Ha and Schmidhuber (2018), the RSSM of Hafner et al. (2018), and implement all other functions as three dense layers of size 300 with ELU activations (Clevert et al., 2015). Distributions in latent space are 30-dimensional diagonal Gaussians. The action model outputs a tanh mean scaled by a factor of 5 and a softplus standard deviation for the Normal distribution that is then transformed using tanh (Haarnoja et al., 2018). The scaling factor allows the agent to saturate the action distribution. ",
1144
+ "bbox": [
1145
+ 174,
1146
+ 131,
1147
+ 825,
1148
+ 214
1149
+ ],
1150
+ "page_idx": 13
1151
+ },
1152
+ {
1153
+ "type": "text",
1154
+ "text": "Learning updates We draw batches of 50 sequences of length 50 to train the world model, value model, and action model models using Adam (Kingma and Ba, 2014) with learning rates $6 \\times 1 0 ^ { - 4 }$ , $8 \\times 1 0 ^ { - 5 }$ , $8 \\times 1 0 ^ { - 5 }$ , respectively and scale down gradient norms that exceed 100. We do not scale the KL regularizers ( $\\beta = 1 \\AA$ ) but clip them below 3 free nats as in PlaNet. The imagination horizon is $H = 1 5$ and the same trajectories are used to update both action and value models. We compute the $\\mathrm { V } _ { \\lambda }$ targets with $\\gamma = 0 . 9 9$ and $\\lambda = 0 . 9 5$ . We did not find latent overshooting for learning the model, an entropy bonus for the action model, or target networks for the value model necessary. ",
1155
+ "bbox": [
1156
+ 173,
1157
+ 218,
1158
+ 825,
1159
+ 315
1160
+ ],
1161
+ "page_idx": 13
1162
+ },
1163
+ {
1164
+ "type": "text",
1165
+ "text": "Environment interaction The dataset is initialized with $S = 5$ episodes collected using random actions. We iterate between 100 training steps and collecting 1 episode by executing the predicted mode action with Norma $_ { . ( 0 , 0 . 3 ) }$ exploration noise. Instead of manually selecting the action repeat for each environment as in Hafner et al. (2018) and Lee et al. (2019), we fix it to 2 for all environments. See Figure 12 for an assessment of the robustness to different action repeat values. ",
1166
+ "bbox": [
1167
+ 174,
1168
+ 319,
1169
+ 825,
1170
+ 388
1171
+ ],
1172
+ "page_idx": 13
1173
+ },
1174
+ {
1175
+ "type": "text",
1176
+ "text": "Discrete control For experiments on Atari games and DeepMind Lab levels, the action model predicts the logits of a categorical distribution. We use straight-through gradients for the sampling step during latent imagination. The action noise is epsilon greedy where $\\epsilon$ is linearly scheduled from $0 . 4 0 . 1$ over the first 200, 000 gradient steps. To account for the higher complexity of these tasks, we use an imagination horizon of $H = 1 0$ , scale the KL regularizers by $\\beta = 0 . 1$ , and bound rewards using tanh. We predict the discount factor from the latent state with a binary classifier that is trained towards the soft labels of 0 and $\\gamma$ . ",
1177
+ "bbox": [
1178
+ 173,
1179
+ 392,
1180
+ 825,
1181
+ 491
1182
+ ],
1183
+ "page_idx": 13
1184
+ },
1185
+ {
1186
+ "type": "text",
1187
+ "text": "B DERIVATIONS ",
1188
+ "text_level": 1,
1189
+ "bbox": [
1190
+ 174,
1191
+ 102,
1192
+ 325,
1193
+ 118
1194
+ ],
1195
+ "page_idx": 14
1196
+ },
1197
+ {
1198
+ "type": "text",
1199
+ "text": "e define the information bottleneck objective (Tishby et al., 2000) for latent dynamics models, ",
1200
+ "bbox": [
1201
+ 192,
1202
+ 128,
1203
+ 795,
1204
+ 145
1205
+ ],
1206
+ "page_idx": 14
1207
+ },
1208
+ {
1209
+ "type": "equation",
1210
+ "img_path": "images/76e9d966cff511055462ce2355b8a97f0f6de499b3bf63aaa2eee6849d443b99.jpg",
1211
+ "text": "$$\n\\operatorname* { m a x } { \\mathrm { I } \\big ( } s _ { 1 : T } ; { \\big ( } o _ { 1 : T } , r _ { 1 : T } { \\big ) } \\mid a _ { 1 : T } { \\big ) } - \\beta { \\mathrm { I } \\big ( } s _ { 1 : T } , i _ { 1 : T } { \\mathrm { ~ \\big | ~ } } a _ { 1 : T } { \\big ) } ,\n$$",
1212
+ "text_format": "latex",
1213
+ "bbox": [
1214
+ 313,
1215
+ 151,
1216
+ 681,
1217
+ 169
1218
+ ],
1219
+ "page_idx": 14
1220
+ },
1221
+ {
1222
+ "type": "text",
1223
+ "text": "where $\\beta$ is scalar and $i _ { t }$ are dataset indices that determine the observations $p ( o _ { t } \\mid i _ { t } ) \\doteq \\delta ( o _ { t } - \\bar { o } _ { t } )$ as in Alemi et al. (2016). ",
1224
+ "bbox": [
1225
+ 173,
1226
+ 174,
1227
+ 828,
1228
+ 203
1229
+ ],
1230
+ "page_idx": 14
1231
+ },
1232
+ {
1233
+ "type": "text",
1234
+ "text": "Maximizing the objective leads to model states that can predict the sequence of observations and rewards while limiting the amount of information extracted at each time step. This encourages the model to reconstruct each image by relying on information extracted at preceeding time steps to the extent possible, and only accessing additional information from the current image when necessary. As a result, the information regularizer encourages the model to learn long-term dependencies. ",
1235
+ "bbox": [
1236
+ 173,
1237
+ 207,
1238
+ 826,
1239
+ 276
1240
+ ],
1241
+ "page_idx": 14
1242
+ },
1243
+ {
1244
+ "type": "text",
1245
+ "text": "For the generative objective, we lower bound the first term using the non-negativity of the KL divergence and drop the marginal data probability as it does not depend on the representation model, ",
1246
+ "bbox": [
1247
+ 173,
1248
+ 279,
1249
+ 823,
1250
+ 309
1251
+ ],
1252
+ "page_idx": 14
1253
+ },
1254
+ {
1255
+ "type": "equation",
1256
+ "img_path": "images/71f21b957d0619e662b7b727f7fbcfd8e430853c332a79999adc24b9832c3af4.jpg",
1257
+ "text": "$$\n\\begin{array} { r l } & { \\mathrm { I } \\big ( { { s _ { 1 : T } } ; \\big ( { o _ { 1 : T } } , { r _ { 1 : T } } \\big ) \\ } \\big | { a _ { 1 : T } } \\big ) } \\\\ & { = \\mathrm { E } _ { p \\big ( { o _ { 1 : T } } , { r _ { 1 : T } } , { s _ { 1 : T } } , { a _ { 1 : T } } \\big ) } \\bigg ( \\displaystyle \\sum _ { t } \\ln p \\big ( { o _ { 1 : T } } , { r _ { 1 : T } } \\big | { s _ { 1 : T } } , { a _ { 1 : T } } \\big ) - \\displaystyle \\frac { \\ln p \\big ( { o _ { 1 : T } } , { r _ { 1 : T } } \\big | { a _ { 1 : T } } \\big ) } { \\cos { \\mathrm { s i } } } \\bigg ) } \\\\ & { \\stackrel { \\mathrm { \\scriptsize ~ \\pm ~ } } { = } \\mathrm { E } \\bigg ( \\displaystyle \\sum _ { t } \\ln p \\big ( { o _ { 1 : T } } , { r _ { 1 : T } } \\big | { s _ { 1 : T } } , { a _ { 1 : T } } \\big ) \\bigg ) } \\\\ & { \\geq \\mathrm { E } \\bigg ( \\displaystyle \\sum _ { t } \\ln p \\big ( { o _ { 1 : T } } , { r _ { 1 : T } } \\big | { s _ { 1 : T } } , { a _ { 1 : T } } \\big ) \\bigg ) - \\mathrm { K L } \\bigg ( p \\big ( { o _ { 1 : T } } , { r _ { 1 : T } } \\big | { s _ { 1 : T } } , { a _ { 1 : T } } \\big ) \\bigg | \\bigg | \\displaystyle \\prod _ { t } q ( { o _ { t } } \\mid { s _ { t } } ) q \\big ( { r _ { t } } \\mid { s _ { t } } \\big ) } \\\\ & { = \\mathrm { E } \\bigg ( \\displaystyle \\sum _ { t } \\ln q \\big ( { o _ { t } } \\mid { s _ { t } } \\big ) + \\ln q \\big ( { r _ { t } } \\mid { s _ { t } } \\big ) \\bigg ) . } \\end{array}\n$$",
1258
+ "text_format": "latex",
1259
+ "bbox": [
1260
+ 169,
1261
+ 314,
1262
+ 816,
1263
+ 473
1264
+ ],
1265
+ "page_idx": 14
1266
+ },
1267
+ {
1268
+ "type": "text",
1269
+ "text": "For the contrastive objective, we subtract the constant marginal probability of the data under the variational encoder, apply Bayes rule, and use the InfoNCE mini-batch bound (Poole et al., 2019), ",
1270
+ "bbox": [
1271
+ 174,
1272
+ 484,
1273
+ 825,
1274
+ 512
1275
+ ],
1276
+ "page_idx": 14
1277
+ },
1278
+ {
1279
+ "type": "equation",
1280
+ "img_path": "images/0416428c3d33bc85e6ae165922818a530320ea33d15036c6906d31360bac1f98.jpg",
1281
+ "text": "$$\n\\begin{array} { l } { \\displaystyle \\operatorname { E } \\big ( \\ln q ( o _ { t } \\mid s _ { t } ) + \\ln q ( r _ { t } \\mid s _ { t } ) \\big ) } \\\\ { \\displaystyle \\pm \\ \\operatorname { E } \\big ( \\ln q ( o _ { t } \\mid s _ { t } ) - \\ln q ( o _ { t } ) + \\ln q ( r _ { t } \\mid s _ { t } ) \\big ) } \\\\ { \\displaystyle = \\ \\operatorname { E } \\big ( \\ln q ( s _ { t } \\mid o _ { t } ) - \\ln q ( s _ { t } ) + \\ln q ( r _ { t } \\mid s _ { t } ) \\big ) } \\\\ { \\displaystyle \\geq \\ \\operatorname { E } \\bigg ( \\ln q ( s _ { t } \\mid o _ { t } ) - \\ln \\sum _ { o ^ { \\prime } } q ( s _ { t } \\mid o ^ { \\prime } ) + \\ln q ( r _ { t } \\mid s _ { t } ) \\bigg ) . } \\end{array}\n$$",
1282
+ "text_format": "latex",
1283
+ "bbox": [
1284
+ 313,
1285
+ 518,
1286
+ 679,
1287
+ 622
1288
+ ],
1289
+ "page_idx": 14
1290
+ },
1291
+ {
1292
+ "type": "text",
1293
+ "text": "For the second term, we use the non-negativity of the KL divergence to obtain an upper bound, ",
1294
+ "bbox": [
1295
+ 169,
1296
+ 626,
1297
+ 794,
1298
+ 642
1299
+ ],
1300
+ "page_idx": 14
1301
+ },
1302
+ {
1303
+ "type": "equation",
1304
+ "img_path": "images/b01e3bb672830e09843e77044bd0e7b0d8a908f580aadaa769a3647f268e863b.jpg",
1305
+ "text": "$$\n\\begin{array} { r l } & { \\quad \\operatorname { I } ( s _ { 1 : T } ; i _ { 1 : T } \\mid a _ { 1 : T } ) } \\\\ & { = \\operatorname { E } _ { p ( o _ { 1 : T } , r _ { 1 : T } , s _ { 1 : T } , a _ { 1 : T } , i _ { 1 : T } ) } \\Big ( \\displaystyle \\sum _ { t } \\ln p ( s _ { t } \\mid s _ { t - 1 } , a _ { t - 1 } , i _ { t } ) - \\ln p ( s _ { t } \\mid s _ { t - 1 } , a _ { t - 1 } ) \\Big ) } \\\\ & { = \\operatorname { E } \\Big ( \\displaystyle \\sum _ { t } \\ln p ( s _ { t } \\mid s _ { t - 1 } , a _ { t - 1 } , o _ { t } ) - \\ln p ( s _ { t } \\mid s _ { t - 1 } , a _ { t - 1 } ) \\Big ) } \\\\ & { \\le \\operatorname { E } \\Big ( \\displaystyle \\sum _ { t } \\ln p ( s _ { t } \\mid s _ { t - 1 } , a _ { t - 1 } , o _ { t } ) - \\ln q ( s _ { t } \\mid s _ { t - 1 } , a _ { t - 1 } ) \\Big ) } \\\\ & { = \\operatorname { E } \\Big ( \\displaystyle \\sum _ { t } \\operatorname { K L } ( p ( s _ { t } \\mid s _ { t - 1 } , a _ { t - 1 } , o _ { t } ) q ( s _ { t } \\mid s _ { t - 1 } , a _ { t - 1 } ) ) \\Big ) . } \\end{array}\n$$",
1306
+ "text_format": "latex",
1307
+ "bbox": [
1308
+ 225,
1309
+ 647,
1310
+ 767,
1311
+ 809
1312
+ ],
1313
+ "page_idx": 14
1314
+ },
1315
+ {
1316
+ "type": "text",
1317
+ "text": "This lower bounds the objective. ",
1318
+ "bbox": [
1319
+ 173,
1320
+ 814,
1321
+ 387,
1322
+ 829
1323
+ ],
1324
+ "page_idx": 14
1325
+ },
1326
+ {
1327
+ "type": "text",
1328
+ "text": "C DISCRETE CONTROL ",
1329
+ "text_level": 1,
1330
+ "bbox": [
1331
+ 174,
1332
+ 102,
1333
+ 382,
1334
+ 117
1335
+ ],
1336
+ "page_idx": 15
1337
+ },
1338
+ {
1339
+ "type": "text",
1340
+ "text": "We evaluate Dreamer on a subset of tasks with discrete actions from the Atari suite (Bellemare et al., 2013) and DeepMind Lab (Beattie et al., 2016). While agents that purely learn through world models are not yet competitive in these domains (Kaiser et al., 2019), the tasks offer a diverse test bed with visual complexity, sparse rewards, and early termination. Agents observe $6 4 \\times 6 4 \\times 3$ images and select one of between 3 and 18 actions. For Atari, we follow the evaluation protocol of Machado et al. (2018) with sticky actions. Refer to Figure 9 for these experiments. ",
1341
+ "bbox": [
1342
+ 173,
1343
+ 128,
1344
+ 826,
1345
+ 213
1346
+ ],
1347
+ "page_idx": 15
1348
+ },
1349
+ {
1350
+ "type": "image",
1351
+ "img_path": "images/54c4a69cd24668624ad348a40c55ab9d3a7460138994d3ca510004d405288631.jpg",
1352
+ "image_caption": [
1353
+ "Figure 9: Performance of Dreamer in environments with discrete actions and early termination. Dreamer learns successful behaviors on this subset of Atari games and the object collection level of DMLab. We highlight representation learning for these environments as a direction of future work that could enable competitive performance across all Atari games and DMLab levels using Dreamer. "
1354
+ ],
1355
+ "image_footnote": [],
1356
+ "bbox": [
1357
+ 179,
1358
+ 223,
1359
+ 825,
1360
+ 733
1361
+ ],
1362
+ "page_idx": 15
1363
+ },
1364
+ {
1365
+ "type": "image",
1366
+ "img_path": "images/f12f0cdb7e38810e708552d7c04ffeffc9c9b00342a1c52e5376244628f6bc75.jpg",
1367
+ "image_caption": [
1368
+ "Figure 10: Comparison of action selection schemes on the continuous control tasks of the DeepMind Control Suite from pixel inputs. The lines show mean scores over environment steps and the shaded areas show the standard deviation across 5 seeds. We compare Dreamer that learns both actions and values in imagination, to only learning actions in imagination, and Planet that selects actions by online planning instead of learning a policy. The baselines include the top model-free algorithm D4PG, the well-known A3C agent, and the hybrid SLAC agent. "
1369
+ ],
1370
+ "image_footnote": [],
1371
+ "bbox": [
1372
+ 171,
1373
+ 128,
1374
+ 826,
1375
+ 776
1376
+ ],
1377
+ "page_idx": 16
1378
+ },
1379
+ {
1380
+ "type": "image",
1381
+ "img_path": "images/5a9c38d8c0485a4ef52fc65440e051e04e8fd454624ac1f35f1b8530e00c6533.jpg",
1382
+ "image_caption": [
1383
+ "Figure 11: Comparison of representation learning methods for Dreamer. The lines show mean scores and the shaded areas show the standard deviation across 5 seeds. We compare generating both images and rewards, generating rewards and using a contrastive loss to learn about the images, and only predicting rewards. Image reconstruction provides the best learning signal across most of the tasks, followed by the contrastive objective. Learning purely from rewards was not sufficient in our experiments and might require larger amounts of experience. "
1384
+ ],
1385
+ "image_footnote": [],
1386
+ "bbox": [
1387
+ 171,
1388
+ 128,
1389
+ 825,
1390
+ 776
1391
+ ],
1392
+ "page_idx": 17
1393
+ },
1394
+ {
1395
+ "type": "image",
1396
+ "img_path": "images/3a34a8d3f7ed373e9b5ead839e74e36440074ba4dfff1e951ff3201565e226ba.jpg",
1397
+ "image_caption": [
1398
+ "Figure 12: Robustness of Dreamer to different control frequencies. Reinforcement learning methods can be sensitive to this hyper parameter, which could be amplified when learning dynamics models at the control frequency of the environment. For this experiment, we train Dreamer with different amounts of action repeat. The areas show one standard deviation across 2 seeds. We used a previous hyper parameter setting for this experiment. We find that a value of $R = 2$ works best across tasks. "
1399
+ ],
1400
+ "image_footnote": [],
1401
+ "bbox": [
1402
+ 171,
1403
+ 128,
1404
+ 828,
1405
+ 756
1406
+ ],
1407
+ "page_idx": 18
1408
+ },
1409
+ {
1410
+ "type": "table",
1411
+ "img_path": "images/0722ea6dc64735b738974789cec3d811564c2399565ed7f98298060e31220dac.jpg",
1412
+ "table_caption": [
1413
+ "G CONTINUOUS CONTROL SCORES "
1414
+ ],
1415
+ "table_footnote": [],
1416
+ "table_body": "<table><tr><td></td><td>A3C</td><td>D4PG</td><td>PlaNet1</td><td>Dreamer</td></tr><tr><td>Modality</td><td>proprio</td><td>pixels 109</td><td>pixels 5×106</td><td>pixels</td></tr><tr><td>Steps</td><td>109</td><td></td><td></td><td>5×106</td></tr><tr><td>Acrobot Swingup</td><td>41.90</td><td>91.70</td><td>3.21</td><td>365.26</td></tr><tr><td>Cartpole Balance</td><td>951.60</td><td>992.80</td><td>452.56</td><td>979.56</td></tr><tr><td>Cartpole Balance Sparse</td><td>857.40</td><td>1000.00</td><td>164.74</td><td>941.84</td></tr><tr><td>Cartpole Swingup</td><td>558.40</td><td>862.00</td><td>312.56</td><td>833.66</td></tr><tr><td>Cartpole Swingup Sparse</td><td>179.80</td><td>482.00</td><td>0.64</td><td>812.22</td></tr><tr><td>Cheetah Run</td><td>213.90</td><td>523.80</td><td>496.12</td><td>894.56</td></tr><tr><td>Cup Catch</td><td>104.70</td><td>980.50</td><td>455.98</td><td>962.48</td></tr><tr><td>Finger Spin</td><td>129.40</td><td>985.70</td><td>495.25</td><td>498.88</td></tr><tr><td>Finger Turn Easy</td><td>167.30</td><td>971.40</td><td>451.22</td><td>825.86</td></tr><tr><td>Finger Turn Hard</td><td>88.70</td><td>966.00</td><td>312.55</td><td>891.38</td></tr><tr><td>Hopper Hop</td><td>0.50</td><td>242.00</td><td>0.37</td><td>368.97</td></tr><tr><td>Hopper Stand</td><td>27.90</td><td>929.90</td><td>5.96</td><td>923.72</td></tr><tr><td>Pendulum Swingup</td><td>48.60</td><td>680.90</td><td>3.27</td><td>833.00</td></tr><tr><td>Quadruped Run</td><td>1</td><td>1</td><td>280.45</td><td>888.39</td></tr><tr><td>Quadruped Walk</td><td>一</td><td>1</td><td>238.90</td><td>931.61</td></tr><tr><td>Reacher Easy</td><td>95.60</td><td>967.40</td><td>468.50</td><td>935.08</td></tr><tr><td>Reacher Hard</td><td>39.70</td><td>957.10</td><td>187.02</td><td>817.05</td></tr><tr><td>Walker Run</td><td>191.80</td><td>567.20</td><td>626.25</td><td>824.67</td></tr><tr><td>Walker Stand</td><td>378.40</td><td>985.20</td><td>759.19</td><td>977.99</td></tr><tr><td>Walker Walk</td><td>311.00</td><td>968.30</td><td>944.70</td><td>961.67</td></tr><tr><td>Average</td><td>243.70</td><td>786.32</td><td>332.97</td><td>823.39</td></tr></table>",
1417
+ "bbox": [
1418
+ 171,
1419
+ 132,
1420
+ 826,
1421
+ 559
1422
+ ],
1423
+ "page_idx": 19
1424
+ }
1425
+ ]
parse/train/S1lOTC4tDS/S1lOTC4tDS_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/train/S1lOTC4tDS/S1lOTC4tDS_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/train/kmG8vRXTFv/kmG8vRXTFv.md ADDED
@@ -0,0 +1,574 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # AUGMENTING PHYSICAL MODELS WITH DEEP NET-WORKS FOR COMPLEX DYNAMICS FORECASTING
2
+
3
+ ∗Yuan $\mathbf { Y i n } ^ { 1 }$ ∗Vincent Le Guen2,3 ∗Jérémie Dona1 ∗Emmanuel de Bézenac1
4
+ ∗Ibrahim Ayed1,4 Nicolas Thome2 Patrick Gallinari1,5
5
+ 1 Sorbonne Université, CNRS, LIP6, Paris, France
6
+ 2 Conservatoire National des Arts et Métiers, CEDRIC, Paris, France
7
+ 3 EDF R&D, Chatou, France
8
+ 4 Theresis Lab, Thales
9
+ 5 Criteo AI Lab, Paris, France
10
+
11
+ # ABSTRACT
12
+
13
+ Forecasting complex dynamical phenomena in settings where only partial knowledge of their dynamics is available is a prevalent problem across various scientific fields. While purely data-driven approaches are arguably insufficient in this context, standard physical modeling based approaches tend to be over-simplistic, inducing non-negligible errors. In this work, we introduce the APHYNITY framework, a principled approach for augmenting incomplete physical dynamics described by differential equations with deep data-driven models. It consists in decomposing the dynamics into two components: a physical component accounting for the dynamics for which we have some prior knowledge, and a data-driven component accounting for errors of the physical model. The learning problem is carefully formulated such that the physical model explains as much of the data as possible, while the data-driven component only describes information that cannot be captured by the physical model, no more, no less. This not only provides the existence and uniqueness for this decomposition, but also ensures interpretability and benefits generalization. Experiments made on three important use cases, each representative of a different family of phenomena, i.e. reaction-diffusion equations, wave equations and the non-linear damped pendulum, show that APHYNITY can efficiently leverage approximate physical models to accurately forecast the evolution of the system and correctly identify relevant physical parameters.
14
+
15
+ # 1 INTRODUCTION
16
+
17
+ Modeling and forecasting complex dynamical systems is a major challenge in domains such as environment and climate (Rolnick et al., 2019), health science (Choi et al., 2016), and in many industrial applications (Toubeau et al., 2018). Model Based (MB) approaches typically rely on partial or ordinary differential equations (PDE/ODE) and stem from a deep understanding of the underlying physical phenomena. Machine learning (ML) and deep learning methods are more prior agnostic yet have become state-of-the-art for several spatio-temporal prediction tasks (Shi et al., 2015; Wang et al., 2018; Oreshkin et al., 2020; Donà et al., 2020), and connections have been drawn between deep architectures and numerical ODE solvers, e.g. neural ODEs (Chen et al., 2018; Ayed et al., 2019b). However, modeling complex physical dynamics is still beyond the scope of pure ML methods, which often cannot properly extrapolate to new conditions as MB approaches do.
18
+
19
+ Combining the MB and ML paradigms is an emerging trend to develop the interplay between the two paradigms. For example, Brunton et al. (2016); Long et al. (2018b) learn the explicit form of PDEs directly from data, Raissi et al. (2019); Sirignano & Spiliopoulos (2018) use NNs as implicit methods for solving PDEs, Seo et al. (2020) learn spatial differences with a graph network, Ummenhofer et al. (2020) introduce continuous convolutions for fluid simulations, de Bézenac et al. (2018) learn the velocity field of an advection-diffusion system, Greydanus et al. (2019); Chen et al. (2020) enforce conservation laws in the network architecture or in the loss function.
20
+
21
+ ![](images/d3d108682e49d81c82e74952e0c258fb293d54da5639e524361a33e02d28621a.jpg)
22
+ Figure 1: Predicted dynamics for the damped pendulum vs. ground truth (GT) trajectories $\mathrm { d } ^ { 2 } \theta / \mathrm { d } t ^ { 2 } +$ $\omega _ { 0 } ^ { \mathrm { - } } \sin \theta + \alpha ^ { \mathrm { d } \theta } / { \mathrm { d } t } = \mathrm { ~ \dot { 0 } ~ }$ . We show that in (a) the data-driven approach (Chen et al., 2018) fails to properly learn the dynamics due to the lack of training data, while in (b) an ideal pendulum cannot take friction into account. The proposed APHYNITY shown in (c) augments the over-simplified physical model in (b) with a data-driven component. APHYNITY improves both forecasting (MSE) and parameter identification (Error $T _ { 0 }$ ) compared to (b).
23
+
24
+ The large majority of aforementioned MB/ML hybrid approaches assume that the physical model adequately describes the observed dynamics. This assumption is, however, commonly violated in practice. This may be due to various factors, e.g. idealized assumptions and difficulty to explain processes from first principles (Gentine et al., 2018), computational constraints prescribing a fine grain modeling of the system (Ayed et al., 2019a), unknown external factors, forces and sources which are present (Large & Yeager, 2004). In this paper, we aim at leveraging prior dynamical ODE/PDE knowledge in situations where this physical model is incomplete, i.e. unable to represent the whole complexity of observed data. To handle this case, we introduce a principled learning framework to Augment incomplete PHYsical models for ideNtIfying and forecasTing complex dYnamics (APHYNITY). The rationale of APHYNITY, illustrated in Figure 1 on the pendulum problem, is to augment the physical model when—and only when—it falls short.
25
+
26
+ Designing a general method for combining MB and ML approaches is still a widely open problem, and a clear problem formulation for the latter is lacking (Reichstein et al., 2019). Our contributions towards these goals are the following:
27
+
28
+ • We introduce a simple yet principled framework for combining both approaches. We decompose the data into a physical and a data-driven term such that the data-driven component only models information that cannot be captured by the physical model. We provide existence and uniqueness guarantees (Section 3.1) for the decomposition given mild conditions, and show that this formulation ensures interpretability and benefits generalization.
29
+
30
+ • We propose a trajectory-based training formulation (Section 3.2) along with an adaptive optimization scheme (Section 3.3) enabling end-to-end learning for both physical and deep learning components. This allows APHYNITY to automatically adjust the complexity of the neural network to different approximation levels of the physical model, paving the way to flexible learned hybrid models.
31
+
32
+ • We demonstrate the generality of the approach on three use cases (reaction-diffusion, wave equations and the pendulum) representative of different PDE families (parabolic, hyperbolic), having a wide spectrum of application domains, e.g. acoustics, electromagnetism, chemistry, biology, physics (Section 4). We show that APHYNITY is able to achieve performances close to complete physical models by augmenting incomplete ones, both in terms of forecasting accuracy and physical parameter identification. Moreover, APHYNITY can also be successfully extended to the partially observable setting (see discussion in Section 5).
33
+
34
+ # 2 RELATED WORK
35
+
36
+ Correction in data assimilation Prediction under approximate physical models has been tackled by traditional statistical calibration techniques, which often rely on Bayesian methods (Pernot & Cailliez, 2017). Data assimilation techniques, e.g. the Kalman filter (Kalman, 1960; Becker et al., 2019), 4D-var (Courtier et al., 1994), prediction errors are modeled probabilistically and a correction using observed data is applied after each prediction step. Similar residual correction procedures are commonly used in robotics and optimal control (Chen, 2004; Li et al., 2014). However, these sequential (two-stage) procedures prevent the cooperation between prediction and correction. Besides, in model-based reinforcement learning, model deficiencies are typically handled by considering only short-term rollouts (Janner et al., 2019) or by model predictive control (Nagabandi et al., 2018). The originality of APHYNITY is to leverage model-based prior knowledge by augmenting it with neurally parametrized dynamics. It does so while ensuring optimal cooperation between the prior model and the augmentation.
37
+
38
+ Augmented physical models Combining physical models with machine learning (gray-box or hybrid modeling) was first explored from the 1990’s: Psichogios & Ungar (1992); Thompson & Kramer (1994); Rico-Martinez et al. (1994) use neural networks to predict the unknown parameters of physical models. The challenge of proper MB/ML cooperation was already raised as a limitation of gray-box approaches but not addressed. Moreover these methods were evaluated on specific applications with a residual targeted to the form of the equation. In the last few years, there has been a renewed interest in deep hybrid models bridging data assimilation techniques and machine learning to identify complex PDE parameters using cautiously constrained forward model (Long et al., 2018b; de Bézenac et al., 2018), as discussed in introduction. Recently, some approaches have specifically targetted the MB/ML cooperation. HybridNet (Long et al., 2018a) and PhICNet (Saha et al., 2020) both use data-driven networks to learn additive perturbations or source terms to a given PDE. The former considers the favorable context where the perturbations can be accessed, and the latter the special case of additive noise on the input. Wang et al. (2019); Mehta et al. (2020) propose several empirical fusion strategies with deep neural networks but lack theoretical groundings. PhyDNet (Le Guen & Thome, 2020) tackles augmentation in partially-observed settings, but with specific recurrent architectures dedicated to video prediction. Crucially, all the aforementioned approaches do not address the issues of uniqueness of the decomposition or of proper cooperation for correct parameter identification. Besides, we found experimentally that this vanilla cooperation is inferior to the APHYNITY learning scheme in terms of forecasting and parameter identification performances (see experiments in Section 4.2).
39
+
40
+ # 3 THE APHYNITY MODEL
41
+
42
+ In the following, we study dynamics driven by an equation of the form:
43
+
44
+ $$
45
+ { \frac { \mathrm { d } X _ { t } } { \mathrm { d } t } } = F ( X _ { t } )
46
+ $$
47
+
48
+ defined over a finite time interval $[ 0 , T ]$ , where the state $X$ is either vector-valued, i.e. we have $X _ { t } ~ \in ~ \mathbb { R } ^ { d }$ for every $t$ , (pendulum equations in Section 4), or $X _ { t }$ is a $d$ -dimensional vector field over a spatial domain $\bar { \Omega } \subset \mathbb { R } ^ { k }$ , with $k \in \{ 2 , 3 \}$ , i.e. $X _ { t } ( x ) \in \mathbb { R } ^ { d }$ for every $( t , x ) \in [ 0 , T ] \times \Omega$ (reaction-diffusion and wave equations in Section 4). We suppose that we have access to a set of observed trajectories $\mathcal { D } = \{ X . : [ 0 , T ] \to \mathcal { A } | \forall t \in [ 0 , T ] , \mathrm { d } X _ { t } / \mathrm { d } t = F ( X _ { t } ) \}$ , where $\mathcal { A }$ is the set of $X$ values (either $\mathbb { R } ^ { d }$ or vector field). In our case, the unknown $F$ has $\mathcal { A }$ as domain and we only assume that $F \in { \mathcal { F } }$ , with $( \mathcal { F } , \| \cdot \| )$ a normed vector space.
49
+
50
+ # 3.1 DECOMPOSING DYNAMICS INTO PHYSICAL AND AUGMENTED TERMS
51
+
52
+ As introduced in Section 1, we consider the common situation where incomplete information is available on the dynamics, under the form of a family of ODEs or PDEs characterized by their temporal evolution $F _ { p } \in { \mathcal { F } } _ { p } \subset { \mathcal { F } }$ . The APHYNITY framework leverages the knowledge of $\mathcal { F } _ { p }$ while mitigating the approximations induced by this simplified model through the combination of physical and data-driven components. $\mathcal { F }$ being a vector space, we can write:
53
+
54
+ $$
55
+ F = F _ { p } + F _ { a }
56
+ $$
57
+
58
+ where $F _ { p } \in \mathcal { F } _ { p }$ encodes the incomplete physical knowledge and $F _ { a } \in \mathcal { F }$ is the data-driven augmentation term complementing $F _ { p }$ . The incomplete physical prior is supposed to belong to a known family, but the physical parameters (e.g. propagation speed for the wave equation) are unknown and need to be estimated from data. Both $F _ { p }$ and $F _ { a }$ parameters are estimated by fitting the trajectories from $\mathcal { D }$ .
59
+
60
+ The decomposition $F = F _ { p } + F _ { a }$ is in general not unique. For example, all the dynamics could be captured by the $F _ { a }$ component. This decomposition is thus ill-defined, which hampers the interpretability and the extrapolation abilities of the model. In other words, one wants the estimated parameters of $F _ { p }$ to be as close as possible to the true parameter values of the physical model and $F _ { a }$ to play only a complementary role w.r.t $F _ { p }$ , so as to model only the information that cannot be captured by the physical prior. For example, when $F \in \mathcal { F } _ { p }$ , the data can be fully described by the physical model, and in this case it is sensible to desire $F _ { a }$ to be nullified; this is of central importance in a setting where one wishes to identify physical quantities, and for the model to generalize and extrapolate to new conditions. In a more general setting where the physical model is incomplete, the action of $F _ { a }$ on the dynamics, as measured through its norm, should be as small as possible.
61
+
62
+ This general idea is embedded in the following optimization problem:
63
+
64
+ $$
65
+ \operatorname* { m i n } _ { F _ { p } \in \mathcal { F } _ { p } , F _ { a } \in \mathcal { F } } \quad \| F _ { a } \| \quad \mathrm { s u b j e c t ~ t o } \quad \forall X \in \mathcal { D } , \forall t , \frac { \mathrm { d } X _ { t } } { \mathrm { d } t } = ( F _ { p } + F _ { a } ) ( X _ { t } )
66
+ $$
67
+
68
+ The originality of APHYNITY is to leverage model-based prior knowledge by augmenting it with neurally parametrized dynamics. It does so while ensuring optimal cooperation between the prior model and the augmentation.
69
+
70
+ A first key question is whether the minimum in Eq. (2) is indeed well-defined, in other words whether there exists indeed a decomposition with a minimal norm $F _ { a }$ . The answer actually depends on the geometry of ${ \mathcal { F } } _ { p }$ , and is formulated in the following proposition proven in Appendix B:
71
+
72
+ Proposition 1 (Existence of a minimizing pair). If ${ \mathcal { F } } _ { p }$ is a proximinal set1, there exists a decomposition minimizing Eq. (2).
73
+
74
+ Proximinality is a mild condition which, as shown through the proof of the proposition, cannot be weakened. It is a property verified by any boundedly compact set. In particular, it is true for closed subsets of finite dimensional spaces. However, if only existence is guaranteed, while forecasts would be expected to be accurate, non-uniqueness of the decomposition would hamper the interpretability of $F _ { p }$ and this would mean that the identified physical parameters are not uniquely determined.
75
+
76
+ It is then natural to ask under which conditions solving problem Eq. (2) leads to a unique decomposition into a physical and a data-driven component. The following result provides guarantees on the existence and uniqueness of the decomposition under mild conditions. The proof is given in Appendix B:
77
+
78
+ Proposition 2 (Uniqueness of the minimizing pair). If ${ \mathcal { F } } _ { p }$ is a Chebyshev set1, Eq. (2) admits $a$ unique minimizer. The $F _ { p }$ in this minimizer pair is the metric projection of the unknown $F$ onto $\mathcal { F } _ { p }$ .
79
+
80
+ The Chebyshev assumption condition is strictly stronger than proximinality but is still quite mild and necessary. Indeed, in practice, many sets of interest are Chebyshev, including all closed convex spaces in strict normed spaces and, if $\dot { \mathcal { F } } = L ^ { 2 }$ , ${ \mathcal { F } } _ { p }$ can be any closed convex set, including all finite dimensional subspaces. In particular, all examples considered in the experiments are Chebyshev sets.
81
+
82
+ Propositions 1 and 2 provide, under mild conditions, the theoretical guarantees for the APHYNITY formulation to infer the correct MB/ML decomposition, thus enabling both recovering the proper physical parameters and accurate forecasting.
83
+
84
+ # 3.2 SOLVING APHYNITY WITH DEEP NEURAL NETWORKS
85
+
86
+ In the following, both terms of the decomposition are parametrized and are denoted as $F _ { p } ^ { \theta _ { p } }$ and $F _ { p } ^ { \theta _ { a } }$ . Solving APHYNITY then consists in estimating the parameters $\theta _ { p }$ and $\theta _ { a }$ . $\theta _ { p }$ are the physical parameters and are typically low-dimensional, e.g. 2 or 3 in our experiments for the considered physical models. For $F _ { a }$ , we need sufficiently expressive models able to optimize over all $\mathcal { F }$ : we thus use deep neural networks, which have shown promising performances for the approximation of differential equations (Raissi et al., 2019; Ayed et al., 2019b).
87
+
88
+ When learning the parameters of $F _ { p } ^ { \theta _ { p } }$ and $F _ { a } ^ { \theta _ { a } }$ , we have access to a finite dataset of trajectories discretized with a given temporal resolution $\Delta t$ $\mathcal { D } _ { \mathrm { t r a i n } } = \{ ( X _ { k \Delta t } ^ { ( i ) } ) _ { 0 \leq k \leq \lfloor { ^ T / \Delta t } \rfloor } \} _ { 1 \leq i \leq N }$ . Solving $\mathrm { d } X _ { t } { \big / } \mathrm { d } t$
89
+ is to approximate this derivative using e.g. finite differences as in (Brunton et al., 2016; Greydanus et al., 2019; Cranmer et al., 2020). This numerical scheme requires high space and time resolutions in the observation space in order to get reliable gradient estimates. Furthermore it is often unstable, leading to explosive numerical errors as discussed in Appendix D. We propose instead to solve Eq. (2) using an integral trajectory-based approach: we compute $\widetilde { X } _ { k \Delta t , X _ { 0 } } ^ { i }$ from an initial state $X _ { 0 } ^ { ( i ) }$ using the current $F _ { p } ^ { \theta _ { p } } + F _ { a } ^ { \theta _ { a } }$ dynamics, then enforce the constraint $\widetilde { X } _ { k \Delta t , X _ { 0 } } ^ { i } = X _ { k \Delta t } ^ { i }$ . This leads to our final objective function on $( \theta _ { p } , \theta _ { a } )$ :
90
+
91
+ $$
92
+ \operatorname* { m i n } _ { \theta _ { p } , \theta _ { a } } \quad \left\| F _ { a } ^ { \theta _ { a } } \right\| \mathrm { ~ \ s u b j e c t ~ t o ~ } \forall i , \forall k , \widetilde { X } _ { k \Delta t } ^ { ( i ) } = X _ { k \Delta t } ^ { ( i ) }
93
+ $$
94
+
95
+ where $\widetilde { X } _ { k \Delta t } ^ { ( i ) }$ is the approximate solution of the integral $\begin{array} { r } { \int _ { X _ { 0 } ^ { ( i ) } } ^ { X _ { 0 } ^ { ( i ) } + k \Delta t } ( F _ { p } ^ { \theta _ { p } } + F _ { a } ^ { \theta _ { a } } ) ( X _ { s } ) \mathrm { d } X _ { s } } \end{array}$ obtained by a differentiable ODE solver.
96
+
97
+ In our setting, where we consider situations for which $F _ { p } ^ { \theta _ { p } }$ only partially describes the physical phenomenon, this coupled $\mathbf { M B } + \mathbf { M L }$ formulation leads to different parameter estimates than using the MB formulation alone, as analyzed more thoroughly in Appendix C. Interestingly, our experiments show that using this formulation also leads to a better identification of the physical parameters $\theta _ { p }$ than when fitting the simplified physical model $F _ { p } ^ { \theta _ { p } }$ alone (Section 4). With only an incomplete knowledge on the physics, $\theta _ { p }$ estimator will be biased by the additional dynamics which needs to be fitted in the data. Appendix F also confirms that the integral formulation gives better forecasting results and a more stable behavior than supervising over finite difference approximations of the derivatives.
98
+
99
+ # 3.3 ADAPTIVELY CONSTRAINED OPTIMIZATION
100
+
101
+ The formulation in Eq. (3) involves constraints which are difficult to enforce exactly in practice. We considered a variant of the method of multipliers (Bertsekas, 1996) which uses a sequence of Lagrangian relaxations $\mathcal { L } _ { \lambda _ { j } } ( \theta _ { p } , \theta _ { a } )$ :
102
+
103
+ $$
104
+ \mathcal { L } _ { \lambda _ { j } } ( \theta _ { p } , \theta _ { a } ) = \| F _ { a } ^ { \theta _ { a } } \| + \lambda _ { j } \cdot \mathcal { L } _ { t r a j } ( \theta _ { p } , \theta _ { a } )
105
+ $$
106
+
107
+ This method needs an increasing sequence $( \lambda _ { j } ) _ { j }$ such that the successive minima of $\mathcal { L } _ { \lambda _ { j } }$ converge to a solution (at least a local one) of the constrained problem Eq. (3). We select $( \lambda _ { j } ) _ { j }$ by using an iterative strategy: starting from a value $\lambda _ { 0 }$ , we iterate, minimizing $\mathcal { L } _ { \lambda _ { i } }$ by gradient descent2, then update $\lambda _ { j }$ with: $\lambda _ { j + 1 } = \bar { \lambda _ { j } } + \tau _ { 2 } \mathcal { L } _ { t r a j } ( \theta _ { j + 1 } )$ , where $\tau _ { 2 }$ is a chosen hyper-parameter and $\bar { \theta } \stackrel { - } { = } \left( \theta _ { p } , \theta _ { a } \right)$ . This procedure is summarized in Algorithm 1. This adaptive iterative procedure allows us to obtain stable and robust results, in a reproducible fashion, as shown in the experiments.
108
+
109
+ <table><tr><td>Algorithm1:APHYNITY</td></tr><tr><td>Initialization:入o ≥ O,T1 &gt; O,T2 &gt;O; for epoch = 1 : Nepochs do for iter in 1 : Niter do for batch in1 :B do 0j+1=0j- TiV[jLtraj(0j)+Fall] Xj+1=λj+ T2Ltraj(0j+1)</td></tr></table>
110
+
111
+ # 4 EXPERIMENTAL VALIDATION
112
+
113
+ We validate our approach on 3 classes of challenging physical dynamics: reaction-diffusion, wave propagation, and the damped pendulum, representative of various application domains such as chemistry, biology or ecology (for reaction-diffusion) and earth physic, acoustic, electromagnetism or even neuro-biology (for waves equations). The two first dynamics are described by PDEs and thus in practice should be learned from very high-dimensional vectors, discretized from the original compact domain. This makes the learning much more difficult than from the one-dimensional pendulum case. For each problem, we investigate the cooperation between physical models of increasing complexity encoding incomplete knowledge of the dynamics (denoted Incomplete physics in the following) and data-driven models. We show the relevance of APHYNITY (denoted APHYNITY models) both in terms of forecasting accuracy and physical parameter identification.
114
+
115
+ # 4.1 EXPERIMENTAL SETTING
116
+
117
+ We describe the three families of equations studied in the experiments. In all experiments, $\mathcal { F } = \mathcal { L } ^ { 2 } ( \mathcal { A } )$ where $\mathcal { A }$ is the set of all admissible states for each problem, and the $\textstyle { \mathcal { L } } ^ { 2 }$ norm is computed on $\mathcal { D } _ { t r a i n }$ by: $\begin{array} { r } { \| \boldsymbol { F } \| ^ { 2 } \approx \sum _ { i , k } \| \boldsymbol { F } ( \boldsymbol { X } _ { k \Delta t } ^ { ( i ) } ) \| ^ { 2 } } \end{array}$ . All considered sets of physical functionals ${ \mathcal { F } } _ { p }$ are closed and convex in $\mathcal { F }$ and thus are Chebyshev. In order to enable the evaluation on both prediction and parameter identification, all our experiments are conducted on simulated datasets with known model parameters. Each dataset has been simulated using an appropriate high-precision integration scheme for the corresponding equation. All solver-based models take the first state $X _ { 0 }$ as input and predict the remaining time-steps by integrating $F$ through the same differentiable generic and common ODE solver (4th order Runge-Kutta)3. Implementation details and architectures are given in Appendix E.
118
+
119
+ Reaction-diffusion equations We consider a 2D FitzHugh-Nagumo type model (Klaasen & Troy, 1984). The system is driven by the PDE $\begin{array} { r } { \frac { \partial u } { \partial t } = a \Delta u + \check { R _ { u } } ( u , \check { v ; } k ) } \end{array}$ , $\begin{array} { r } { \frac { \partial \bar { \boldsymbol { v } } } { \partial t } = b \Delta \boldsymbol { v } + R _ { v } ( \boldsymbol { u } , \boldsymbol { v } ) } \end{array}$ where $a$ and $b$ are respectively the diffusion coefficients of $u$ and $v , \Delta$ is the Laplace operator. The local reaction terms are $\bar { R _ { u } ( u , v ; k ) } = u - u ^ { 3 } - k - v , R _ { v } ( u , v ) = u - v$ . The state is $X = ( u , v )$ and is defined over a compact rectangular domain $\Omega$ with periodic boundary conditions. The considered physical models are: • Param PDE $( a , b )$ , with unknown $( a , b )$ diffusion terms and without reaction terms: $\mathcal { F } _ { p } = \{ F _ { p } ^ { a , b } : ( u , v ) \mapsto ( a \Delta u , b \Delta v ) | a \geq a _ { \operatorname* { m i n } } > 0 , b \geq b _ { \operatorname* { m i n } } > 0 \} \mathrm { { ; } }$ ; • Param PDE $( a , b , k )$ , the full PDE with unknown parameters: ${ \mathcal { F } } _ { p } ~ = ~ \{ F _ { p } ^ { a , b , k } ~ : ~ ( u , v ) ~ \mapsto ~$ $( a \Delta u + R _ { u } ( u , v ; k ) , b \Delta v + R _ { v } ( u , v ) \mid a \geq a _ { \operatorname* { m i n } } > 0 , b \geq b _ { \operatorname* { m i n } } > 0 , k \geq k _ { \operatorname* { m i n } } > 0 )$ .
120
+
121
+ $k$ amped wave equations We investigate tis the damping coefficient. The state is $\begin{array} { r } { X \ = \ ( w , \frac { \partial w } { \partial t } ) } \end{array}$ ve PDE: and we $\begin{array} { r } { \frac { \partial ^ { 2 } w } { \partial t ^ { 2 } } - c ^ { 2 } \Delta w + k \frac { \partial w } { \partial t } = 0 } \end{array}$ whereial domain $\Omega$ with Neumann homogeneous boundary conditions. Note that this damping differs from the pendulum, as its effect is global. Our physical models are: • Param PDE (c), without damping term: ${ \mathcal { F } } _ { p } = \{ F _ { p } ^ { c } : ( u , \bar { v _ { } } ) \mapsto ( v , c ^ { 2 } \bar { \Delta u } ) | c \in [ \epsilon , + \infty ) $ with $\epsilon > 0 \}$ ; $\bullet$ Param PDE $( c , k )$ : $\mathcal { F } _ { p } = \{ F _ { p } ^ { c , k } : ( u , v ) \mapsto ( v , c ^ { 2 } \Delta u - k v ) \mid c , k \in [ \epsilon , + \infty )$ with $\epsilon > 0 \}$ .
122
+
123
+ Damped pendulum The evolution follows the ODE $\mathrm { d } ^ { 2 } \theta \big / \mathrm { d } t ^ { 2 } + \omega _ { 0 } ^ { 2 } \sin \theta + \alpha ^ { \mathrm { d } \theta } \big / \mathrm { d } t = 0$ , where $\theta ( t )$ is the angle, $\omega _ { 0 }$ the proper pulsation ( $T _ { 0 }$ the period) and $\alpha$ the damping coefficient. With state $X ~ = ~ \left( \theta , \mathrm { d } \theta / \mathrm { d } t \right)$ , the ODE is $F _ { p } ^ { \omega _ { 0 } , \alpha } ~ : ~ \stackrel { \triangledown } { X } ~ \stackrel { \triangledown } { \mapsto } ~ ( \mathrm { d } \theta / \mathrm { d } t , - \omega _ { 0 } ^ { 2 } \sin \theta ~ - ~ \alpha \bar { \mathrm { d } } \theta / \mathrm { d } t )$ . Our physical models are: $\bullet$ Hamiltonian (Greydanus et al., 2019), a conservative approximation, with $\mathcal { F } _ { p } = \{ F _ { p } ^ { \mathcal { H } } : ( u , v ) \mapsto ( \partial _ { y } \mathcal { H } ( u , v ) , - \partial _ { x } \mathcal { H } ( u , v ) ) | \mathcal { H } \in H ^ { 1 } ( \mathbb { R } ^ { 2 } ) \}$ , $H ^ { 1 } ( \mathbb { R } ^ { 2 } )$ is the first order Sobolev space. • • Param $O D E \left( \omega _ { 0 } \right)$ , the frictionless pendulu full pendulum equation: $\mathcal { F } _ { p } = \{ F _ { p } ^ { \omega _ { 0 } , \alpha = 0 } | \ \omega _ { 0 } \in [ \epsilon , + \infty )$ wth $\epsilon > 0 \}$ $O D E \left( \omega _ { 0 } , \alpha \right)$ $\mathcal { F } _ { p } = \{ F _ { p } ^ { \omega _ { 0 } , \alpha } | \omega _ { 0 } , \alpha \in [ \epsilon , + \infty )$ $\epsilon > 0 \}$
124
+
125
+ Baselines As purely data-driven baselines, we use Neural ODE (Chen et al., 2018) for the three problems and PredR $\mathrm { N N } { + } { + }$ (Wang et al., 2018, for reaction-diffusion only) which are competitive models for datasets generated by differential equations and for spatio-temporal data. As MB/ML methods, in the ablations studies (see Appendix F), we compare for all problems, to the vanilla MB/ML cooperation scheme found in (Wang et al., 2019; Mehta et al., 2020). We also show results for True PDE/ODE, which corresponds to the equation for data simulation (which do not lead to zero error due to the difference between simulation and training integration schemes). For the pendulum, we compare to Hamiltonian neural networks (Greydanus et al., 2019; Toth et al., 2020) and to the the deep Galerkin method (DGM, Sirignano & Spiliopoulos, 2018). See additional details in Appendix E.
126
+
127
+ Table 1: Forecasting and identification results on the (a) reaction-diffusion, (b) wave equation, and (c) damped pendulum datasets. We set for (a) $a = 1 \times 1 0 ^ { - 3 } , b = 5 \times 1 0 ^ { - 3 } , k = 5 \times 1 0 ^ { - 3 }$ , for (b) $c = 3 3 0$ , $k = 5 0$ and for (c) $T _ { 0 } = 6$ , $\alpha = 0 . 2$ as true parameters. log MSEs are computed respectively over 25, 25, and 40 predicted time-steps. $\% \mathrm { E r r }$ param. averages the results when several physical parameters are present. For each level of incorporated physical knowledge, equivalent best results according to a Student t-test are shown in bold. $\mathrm { n / a }$ corresponds to non-applicable cases.
128
+
129
+ <table><tr><td>Dataset</td><td colspan="2">Method</td><td>log MSE</td><td>%Err param.</td><td>/Fall2</td></tr><tr><td rowspan="8">(a) Reaction- diffusion</td><td rowspan="3">Data- driven</td><td>Neural ODE</td><td>-3.76±0.02</td><td>n/a</td><td>n/a</td></tr><tr><td>PredRNN++</td><td>-4.60±0.01</td><td>n/a</td><td>n/a</td></tr><tr><td>Param PDE (a,b) Incomplete</td><td>-1.26±0.02</td><td>67.6</td><td>n/a</td></tr><tr><td rowspan="3">physics Complete</td><td>APHYNITY Param PDE (a, b)</td><td>-5.10±0.21</td><td>2.3</td><td>67</td></tr><tr><td>Param PDE (a,b,k)</td><td>-9.34±0.20</td><td>0.17</td><td>n/a</td></tr><tr><td>APHYNITYParamPDE(a, b, k)</td><td>-9.35±0.02</td><td>0.096</td><td>1.5e-6</td></tr><tr><td rowspan="3">physics Data-driven</td><td>TruePDE</td><td>-8.81±0.05</td><td>n/a</td><td>n/a</td></tr><tr><td>APHYNITYTrue PDE</td><td>-9.17±0.02</td><td>n/a</td><td>1.4e-7</td></tr><tr><td>Neural ODE</td><td>-2.51±0.29</td><td>n/a</td><td>n/a</td></tr><tr><td rowspan="8">(b) Wave equation</td><td>Incomplete physics</td><td>Param PDE (c)</td><td>0.51±0.07</td><td>10.4</td><td>n/a</td></tr><tr><td rowspan="2"></td><td>APHYNITY Param PDE (c)</td><td>-4.64±0.25</td><td>0.31</td><td>71.</td></tr><tr><td>Param PDE (c,k)</td><td>-4.68±0.55</td><td>1.38</td><td></td></tr><tr><td rowspan="3">Complete physics</td><td>APHYNITY Param PDE (c, k)</td><td>-6.09±0.28</td><td>0.70</td><td>n/a 4.54</td></tr><tr><td>True PDE</td><td>-4.66±0.30</td><td>n/a</td><td></td></tr><tr><td>APHYNITYTrue PDE</td><td>-5.24±0.45</td><td>n/a</td><td>n/a 0.14</td></tr><tr><td>Data-driven</td><td>Neural ODE</td><td>-2.84±0.70</td><td>n/a</td><td></td></tr><tr><td rowspan="6">(c) Damped pendulum</td><td></td><td>Hamiltonian</td><td>-0.35±0.10</td><td></td><td>n/a</td></tr><tr><td rowspan="4">Incomplete physics</td><td></td><td>-3.97±1.20</td><td>n/a</td><td>n/a</td></tr><tr><td>APHYNITY Hamiltonian</td><td></td><td>n/a</td><td>623</td></tr><tr><td>Param ODE (ωo)</td><td>-0.14±0.10</td><td>13.2</td><td>n/a</td></tr><tr><td>Deep Galerkin Method (ωo) APHYNITY Param ODE (ωo)</td><td>-3.10±0.40 -7.86±0.60</td><td>22.1</td><td>n/a</td></tr><tr><td rowspan="5">Complete physics</td><td>Param ODE (wo,α)</td><td></td><td>4.0</td><td>132</td></tr><tr><td>Deep Galerkin Method (ωo, α)</td><td>-8.28±0.40 -3.14±0.40</td><td>0.45 7.1</td><td>n/a</td></tr><tr><td>APHYNITYParam ODE (ωo, α)</td><td>-8.31±0.30</td><td>0.39</td><td>n/a 8.5</td></tr><tr><td>True ODE</td><td>-8.58±0.20</td><td>n/a</td><td>n/a</td></tr><tr><td>APHYNITY True ODE</td><td>-8.44±0.20</td><td>n/a</td><td>2.3</td></tr></table>
130
+
131
+ # 4.2 RESULTS
132
+
133
+ We analyze and discuss below the results obtained for the three kind of dynamics. We successively examine different evaluation or quality criteria. The conclusions are consistent for the three problems, which allows us to highlight clear trends for all of them.
134
+
135
+ Forecasting accuracy The data-driven models do not perform well compared to True PDE/ODE (all values are test errors expressed as log MSE): -4.6 for PredRNN++ vs. -9.17 for reaction-diffusion, -2.51 vs. -5.24 for wave equation, and -2.84 vs. -8.44 for the pendulum in Table 1. The Deep Galerkin method for the pendulum in complete physics DGM $( \omega _ { 0 } , \alpha )$ , being constrained by the equation, outperforms Neural ODE but is far inferior to APHYNITY models. In the incomplete physics case, $D G M \left( \omega _ { 0 } \right)$ fails to compensate for the missing information. The incomplete physical models, Param $P D E \left( a , b \right)$ for the reaction-diffusion, Param PDE (c) for the wave equation, and Param $O D E \left( \omega _ { 0 } \right)$ and Hamiltonian models for the damped pendulum, have even poorer performances than purely data-driven ones, as can be expected since they ignore important dynamical components, e.g. friction in the pendulum case. Using APHYNITY with these imperfect physical models greatly improves forecasting accuracy in all cases, significantly outperforming purely data-driven models, and reaching results often close to the accuracy of the true ODE, when APHYNITY and the true ODE models are integrated with the same numerical scheme (which is different from the one used for data generation, hence the non-null errors even for the true equations), e.g. -5.92 vs. -5.24 for wave equation in
136
+
137
+ ![](images/a5e3e28fce1405d4af82da9a1c33e730229c5f51d3fcc1232f5dd265358cb8ad.jpg)
138
+
139
+ ![](images/b429dacbf3e2746c66e2020b2190c38c5499c519b7be60be609b3dcdbfeff198.jpg)
140
+ Figure 2: Comparison of predictions of two components $u$ (top) and $v$ (bottom) of the reactiondiffusion system. Note that $t = 4$ is largely beyond the dataset horizon $t = 2 . 5$ ).
141
+ Figure 3: Comparison between the prediction of APHYNITY when $c$ is estimated and Neural ODE for the damped wave equation. Note that $t + 3 2$ , last column for (a, b, c) is already beyond the training time horizon $( t + 2 5 )$ , showing the consistency of APHYNITY method.
142
+
143
+ Table 1. This clearly highlights the capacity of our approach to augment incomplete physical models with a learned data-driven component.
144
+
145
+ Physical parameter estimation Confirming the phenomenon mentioned in the introduction and detailed in Appendix C, incomplete physical models can lead to bad estimates for the relevant physical parameters: an error respectively up to $6 7 . 6 \%$ and $1 0 . 4 \%$ for parameters in the reaction-diffusion and wave equations, and an error of more than $13 \%$ for parameters for the pendulum in Table 1. APHYNITY is able to significantly improve physical parameters identification: $2 . 3 \%$ error for the reaction-diffusion, $0 . 3 \%$ for the wave equation, and $4 \%$ for the pendulum. This validates the fact that augmenting a simple physical model to compensate its approximations is not only beneficial for prediction, but also helps to limit errors for parameter identification when dynamical models do not fit data well. This is crucial for interpretability and explainability of the estimates.
146
+
147
+ Ablation study We conduct ablation studies to validate the importance of the APHYNITY augmentation compared to a naive strategy consisting in learning $F = F _ { p } + F _ { a }$ without taking care on the quality of the decomposition, as done in (Wang et al., 2019; Mehta et al., 2020). Results shown in Table 1 of Appendix F show a consistent gain of APHYNITY for the three use cases and for all physical models: for instance for Param ODE $( a , b )$ in reaction-diffusion, both forecasting performances $( \log \mathbf { M S E } = - 5 . 1 0$ vs. -4.56) and identification parameter $( \mathrm { E r r o r } { = 2 . 3 3 \% }$ vs. $6 . 3 9 \%$ ) improve. Other ablation results are provided in Appendix F showing the relevance of the the trajectory-based approach described in Section 3.2 (vs supervising over finite difference approximations of the derivative $F$ ).
148
+
149
+ Flexibility When applied to complete physical models, APHYNITY does not degrade accuracy, contrary to a vanilla cooperation scheme (see ablations in Appendix F). This is due to the least action principle of our approach: when the physical knowledge is sufficient for properly predicting the observed dynamics, the model learns to ignore the data-driven augmentation. This is shown by the norm of the trained neural net component $F _ { a }$ , which is reported in Table 1 last column: as expected, $\| F _ { a } \| ^ { 2 }$ diminishes as the complexity of the corresponding physical model increases, and, relative to incomplete models, the norm becomes very small for complete physical models (for example in the pendulum experiments, we have $\| F _ { a } \| = \dot { 8 } . 5$ for the APHYNITY model to be compared with 132 and 623 for the incomplete models). Thus, we see that the norm of $F _ { a }$ is a good indication of how imperfect the physical models ${ \mathcal { F } } _ { p }$ are. It highlights the flexibility of APHYNITY to successfully adapt to very different levels of prior knowledge. Note also that APHYNITY sometimes slightly improves over the true ODE, as it compensates the error introduced by different numerical integration methods for data simulation and training (see Appendix E).
150
+
151
+ Qualitative visualizations Results in Figure 2 for reaction-diffusion show that the incomplete diffusion parametric PDE in Figure 2(a) is unable to properly match ground truth simulations: the behavior of the two components in Figure 2(a) is reduced to simple independent diffusions due to the lack of interaction terms between $u$ and $v$ . By using APHYNITY in Figure 2(b), the correlation between the two components appears together with the formation of Turing patterns, which is very similar to the ground truth. This confirms that $F _ { a }$ can learn the reaction terms and improve prediction quality. In Figure 3, we see for the wave equation that the data-driven Neural ODE model fails at approximating $\mathrm { d } w \big / \mathrm { d } t$ as the forecast horizon increases: it misses crucial details for the second component $\mathrm { d } w \big / \mathrm { d } t$ which makes the forecast diverge from the ground truth. APHYNITY incorporates a Laplacian term as well as the data-driven $F _ { a }$ thus capturing the damping phenomenon and succeeding in maintaining physically sound results for long term forecasts, unlike Neural ODE.
152
+
153
+ Extension to non-stationary dynamics We provide additional results in Appendix G to tackle datasets where physical parameters of the equations vary in each sequence. To this end, we design an encoder able to perform parameter estimation for each sequence. Results show that APHYNITY accommodates well to this setting, with similar trends as those reported in this section.
154
+
155
+ Additional illustrations We give further visual illustrations to demonstrate how the estimation of parameters in incomplete physical models is improved with APHYNITY. For the reaction-diffusion equation, we show that the incomplete parametric PDE underestimates both diffusion coefficients. The difference is visually recognizable between the poorly estimated diffusion (Figure 4(a)) and the true one (Figure 4(c)) while APHYNITY gives a fairly good estimation of those diffusion parameters as shown in Figure 4(b).
156
+
157
+ ![](images/b9a7240d38b2be0003afed922344d08a751ee6cbd5c50470aa1d3c46cde7a2ce.jpg)
158
+ Figure 4: Diffusion predictions using coefficient learned with (a) incomplete physical model Param PDE $( a , b )$ and (b) APHYNITY-augmented Param $\mathrm { P D E } ( a , b )$ , compared with the (c) true diffusion
159
+
160
+ # 5 CONCLUSION
161
+
162
+ In this work, we introduce the APHYNITY framework that can efficiently augment approximate physical models with deep data-driven networks, performing similarly to models for which the underlying dynamics are entirely known. We exhibit the superiority of APHYNITY over data-driven, incomplete physics, and state-of-the-art approaches combining ML and MB methods, both in terms of forecasting and parameter identification on three various classes of physical systems. Besides, APHYNITY is flexible enough to adapt to different approximation levels of prior physical knowledge.
163
+
164
+ An appealing perspective is the applicability of APHYNITY on partially-observable settings, such as video prediction. Besides, we hope that the APHYNITY framework will open up the way to the design of a wide range of more flexible MB/ML models, e.g. in climate science, robotics or reinforcement learning. In particular, analyzing the theoretical decomposition properties in a partially-observed setting is an important direction for future work.
165
+
166
+ # ACKNOWLEDGEMENTS:
167
+
168
+ Funding (P. Gallinari), Chaires de recherche et d’enseignement en intelligence artificielle (Chaires IA), DL4Clim project.
169
+
170
+ # REFERENCES
171
+
172
+ Ibrahim Ayed, Nicolas Cedilnik, Patrick Gallinari, and Maxime Sermesant. Ep-net: Learning cardiac electrophysiology models for physiology-based constraints in data-driven predictions. In Yves Coudière, Valéry Ozenne, Edward J. Vigmond, and Nejib Zemzemi (eds.), Functional Imaging and Modeling of the Heart - 10th International Conference, FIMH 2019, Bordeaux, France, June 6-8, 2019, Proceedings, volume 11504 of Lecture Notes in Computer Science, pp. 55–63. Springer, 2019a.
173
+
174
+ Ibrahim Ayed, Emmanuel de Bézenac, Arthur Pajot, Julien Brajard, and Patrick Gallinari. Learning dynamical systems from partial observations. arXiv preprint arXiv:1902.11136, 2019b.
175
+
176
+ Philipp Becker, Harit Pandya, Gregor Gebhardt, Cheng Zhao, James Taylor, and Gerhard Neumann. Recurrent kalman networks: Factorized inference in high-dimensional deep feature spaces. International Conference on Machine Learning (ICML), 2019.
177
+
178
+ Dimitri P. Bertsekas. Constrained Optimization and Lagrange Multiplier Methods (Optimization and Neural Computation Series). Athena Scientific, 1 edition, 1996.
179
+
180
+ Steven L. Brunton, Joshua L. Proctor, and J. Nathan Kutz. Discovering governing equations from data by sparse identification of nonlinear dynamical systems. Proceedings of the National Academy of Sciences, 113(15):3932–3937, 2016.
181
+
182
+ Tian Qi Chen, Yulia Rubanova, Jesse Bettencourt, and David K. Duvenaud. Neural ordinary differential equations. In Advances in neural information processing systems (NeurIPS), pp. 6571–6583, 2018.
183
+
184
+ Wen-Hua Chen. Disturbance observer based control for nonlinear systems. IEEE/ASME transactions on mechatronics, 9(4):706–710, 2004.
185
+
186
+ Zhengdao Chen, Jianyu Zhang, Martin Arjovsky, and Léon Bottou. Symplectic recurrent neural networks. International Conference on Learning Representations (ICLR), 2020.
187
+
188
+ Edward Choi, Mohammad Taha Bahadori, Jimeng Sun, Joshua Kulas, Andy Schuetz, and Walter Stewart. RETAIN: An interpretable predictive model for healthcare using reverse time attention mechanism. In Advances in Neural Information Processing Systems (NeurIPS), pp. 3504–3512, 2016.
189
+
190
+ Philippe Courtier, J-N Thépaut, and Anthony Hollingsworth. A strategy for operational implementation of 4d-var, using an incremental approach. Quarterly Journal of the Royal Meteorological Society, 120(519):1367–1387, 1994.
191
+
192
+ Miles Cranmer, Sam Greydanus, Stephan Hoyer, Peter Battaglia, David Spergel, and Shirley Ho. Lagrangian neural networks. ICLR 2020 Deep Differential Equations Workshop, 2020.
193
+
194
+ Emmanuel de Bézenac, Arthur Pajot, and Patrick Gallinari. Deep learning for physical processes: Incorporating prior scientific knowledge. International Conference on Learning Representations (ICLR), 2018.
195
+
196
+ Jérémie Donà, Jean-Yves Franceschi, Sylvain Lamprier, and Patrick Gallinari. Pde-driven spatiotemporal disentanglement. International Conference on Learning Representations (ICLR), 2020.
197
+
198
+ John R Dormand and Peter J Prince. A family of embedded runge-kutta formulae. Journal of computational and applied mathematics, 6(1):19–26, 1980.
199
+
200
+ James Fletcher and Warren Moors. Chebyshev sets. Journal of the Australian Mathematical Society, 98:161–231, 04 2014. doi: 10.1017/S1446788714000561.
201
+
202
+ P. Gentine, M. Pritchard, S. Rasp, G. Reinaudi, and G. Yacalis. Could machine learning break the convection parameterization deadlock? Geophysical Research Letters, 45(11):5742–5751, 2018.
203
+
204
+ Samuel Greydanus, Misko Dzamba, and Jason Yosinski. Hamiltonian neural networks. In Advances in Neural Information Processing Systems (NeurIPS), pp. 15353–15363, 2019.
205
+
206
+ Michael Janner, Justin Fu, Marvin Zhang, and Sergey Levine. When to trust your model: Modelbased policy optimization. In Advances in Neural Information Processing Systems (NeurIPS), pp. 12519–12530, 2019.
207
+
208
+ Gordon G Johnson. A nonconvex set which has the unique nearest point property. Journal of Approximation Theory, 51(4):289 – 332, 1987.
209
+
210
+ Rudolph Emil Kalman. A new approach to linear filtering and prediction problems. 1960.
211
+
212
+ Gene A. Klaasen and William C. Troy. Stationary wave solutions of a system of reaction-diffusion equations derived from the fitzhugh–nagumo equations. SIAM Journal on Applied Mathematics, 44(1):96–110, 1984. doi: 10.1137/0144008.
213
+
214
+ William Large and Stephen Yeager. Diurnal to decadal global forcing for ocean and sea-ice models: The data sets and flux climatologies, 05 2004.
215
+
216
+ Vincent Le Guen and Nicolas Thome. Disentangling physical dynamics from unknown factors for unsupervised video prediction. In Computer Vision and Pattern Recognition (CVPR). 2020.
217
+
218
+ Shihua Li, Jun Yang, Wen-Hua Chen, and Xisong Chen. Disturbance observer-based control: methods and applications. CRC press, 2014.
219
+
220
+ Yun Long, Xueyuan She, and Saibal Mukhopadhyay. Hybridnet: integrating model-based and data-driven learning to predict evolution of dynamical systems. Conference on Robot Learning (CoRL), 2018a.
221
+
222
+ Zichao Long, Yiping Lu, Xianzhong Ma, and Bin Dong. PDE-Net: Learning PDEs from data. In International Conference on Machine Learning (ICML), 2018b.
223
+
224
+ Viraj Mehta, Ian Char, Willie Neiswanger, Youngseog Chung, and Jeff Schneider. Neural dynamical systems. ICLR 2020 Deep Differential Equations Workshop, 2020.
225
+
226
+ Anusha Nagabandi, Gregory Kahn, Ronald S Fearing, and Sergey Levine. Neural network dynamics for model-based deep reinforcement learning with model-free fine-tuning. In 2018 IEEE International Conference on Robotics and Automation (ICRA), pp. 7559–7566. IEEE, 2018.
227
+
228
+ Boris N. Oreshkin, Dmitri Carpov, Nicolas Chapados, and Yoshua Bengio. N-BEATS: Neural basis expansion analysis for interpretable time series forecasting. International Conference on Learning Representations (ICLR), 2020.
229
+
230
+ Adam Paszke, Sam Gross, Francisco Massa, Adam Lerer, James Bradbury, Gregory Chanan, Trevor Killeen, Zeming Lin, Natalia Gimelshein, Luca Antiga, Alban Desmaison, Andreas Kopf, Edward Yang, Zachary DeVito, Martin Raison, Alykhan Tejani, Sasank Chilamkurthy, Benoit Steiner, Lu Fang, Junjie Bai, and Soumith Chintala. Pytorch: An imperative style, high-performance deep learning library. In H. Wallach, H. Larochelle, A. Beygelzimer, F. d’Alché Buc, E. Fox, and R. Garnett (eds.), Advances in Neural Information Processing Systems 32, pp. 8024–8035. 2019.
231
+
232
+ Pascal Pernot and Fabien Cailliez. A critical review of statistical calibration/prediction models handling data inconsistency and model inadequacy. AIChE Journal, 63(10):4642–4665, 2017.
233
+
234
+ Dimitris C Psichogios and Lyle H Ungar. A hybrid neural network-first principles approach to process modeling. AIChE Journal, 38(10):1499–1511, 1992.
235
+
236
+ Maziar Raissi, Paris Perdikaris, and George Em Karniadakis. Physics-informed neural networks: A deep learning framework for solving forward and inverse problems involving nonlinear partial differential equations. Journal of Computational Physics, 473:686–707, 2019.
237
+
238
+ Markus Reichstein, Gustau Camps-Valls, Bjorn Stevens, Martin Jung, Joachim Denzler, Nuno Carvalhais, and & Prabhat. Deep learning and process understanding for data-driven Earth system science. Nature, 566:195–204, 2019.
239
+
240
+ R Rico-Martinez, JS Anderson, and IG Kevrekidis. Continuous-time nonlinear signal processing: a neural network based approach for gray box identification. In Proceedings of IEEE Workshop on Neural Networks for Signal Processing, pp. 596–605. IEEE, 1994.
241
+
242
+ David Rolnick, Priya L Donti, Lynn H Kaack, Kelly Kochanski, Alexandre Lacoste, Kris Sankaran, Andrew Slavin Ross, Nikola Milojevic-Dupont, Natasha Jaques, Anna Waldman-Brown, et al. Tackling climate change with machine learning. In NeurIPS 2019 workshop on Climate Change with Machine Learning, 2019.
243
+
244
+ Priyabrata Saha, Saurabh Dash, and Saibal Mukhopadhyay. PHICNet: Physics-incorporated convolutional recurrent neural networks for modeling dynamical systems. arXiv preprint arXiv:2004.06243, 2020.
245
+
246
+ Sungyong Seo, Chuizheng Meng, and Yan Liu. Physics-aware difference graph networks for sparselyobserved dynamics. International Conference on Learning Representations (ICLR), 2020.
247
+
248
+ Xingjian Shi, Zhourong Chen, Hao Wang, Dit-Yan Yeung, Wai-Kin Wong, and Wang-chun Woo. Convolutional LSTM network: A machine learning approach for precipitation nowcasting. In Advances in neural information processing systems (NeurIPS), pp. 802–810, 2015.
249
+
250
+ Justin Sirignano and Konstantinos Spiliopoulos. Dgm: A deep learning algorithm for solving partial differential equations. Journal of computational physics, 375:1339–1364, 2018.
251
+
252
+ Michael L Thompson and Mark A Kramer. Modeling chemical processes using prior knowledge and neural networks. AIChE Journal, 40(8):1328–1340, 1994.
253
+
254
+ Peter Toth, Danilo Jimenez Rezende, Andrew Jaegle, Sébastien Racanière, Aleksandar Botev, and Irina Higgins. Hamiltonian generative networks. International Conference on Learning Representations (ICLR), 2020.
255
+
256
+ Jean-François Toubeau, Jérémie Bottieau, François Vallée, and Zacharie De Grève. Deep learningbased multivariate probabilistic forecasting for short-term scheduling in power markets. IEEE Transactions on Power Systems, 34(2):1203–1215, 2018.
257
+
258
+ Benjamin Ummenhofer, Lukas Prantl, Nils Thuerey, and Vladlen Koltun. Lagrangian fluid simulation with continuous convolutions. International Conference on Learning Representations (ICLR), 2020.
259
+
260
+ Qi Wang, Feng Li, Yi Tang, and Yan Xu. Integrating model-driven and data-driven methods for power system frequency stability assessment and control. IEEE Transactions on Power Systems, 34(6):4557–4568, 2019.
261
+
262
+ Yunbo Wang, Zhifeng Gao, Mingsheng Long, Jianmin Wang, and Philip S. Yu. PredRNN $^ { + + }$ : Towards a resolution of the deep-in-time dilemma in spatiotemporal predictive learning. In International Conference on Machine Learning (ICML), 2018.
263
+
264
+ # A REMINDER ON PROXIMINAL AND CHEBYSHEV SETS
265
+
266
+ We begin by giving a definition of proximinal and Chebyshev sets, taken from (Fletcher & Moors, 2014):
267
+
268
+ Definition 1. A proximinal set of a normed space $( E , \| \cdot \| )$ is a subset $\mathcal { C } \subset E$ such that every $x \in E$ admits at least a nearest point in $\mathcal { C }$ .
269
+
270
+ Definition 2. A Chebyshev set of a normed space $( E , \| \cdot \| )$ is a subset $\mathcal { C } \subset E$ such that every $x \in E$ admits a unique nearest point in $\mathcal { C }$ .
271
+
272
+ Proximinality reduces to a compacity condition in finite dimensional spaces. In general, it is a weaker one: Boundedly compact sets verify this property for example.
273
+
274
+ In Euclidean spaces, Chebyshev sets are simply the closed convex subsets. The question of knowing whether it is the case that all Chebyshev sets are closed convex sets in infinite dimensional Hilbert spaces is still an open question. In general, there exists examples of non-convex Chebyshev sets, a famous one being presented in (Johnson, 1987) for a non-complete inner-product space.
275
+
276
+ Given the importance of this topic in approximation theory, finding necessary conditions for a set to be Chebyshev and studying the properties of those sets have been the subject of many efforts. Some of those properties are summarized below:
277
+
278
+ • The metric projection on a boundedly compact Chebyshev set is continuous.
279
+ • If the norm is strict, every closed convex space, in particular any finite dimensional subspace is Chebyshev.
280
+ • In a Hilbert space, every closed convex set is Chebyshev.
281
+
282
+ # B PROOF OF PROPOSITIONS 1 AND 2
283
+
284
+ We prove the following result which implies both propositions in the article:
285
+
286
+ Proposition 3. The optimization problem:
287
+
288
+ $$
289
+ \operatorname* { m i n } _ { F _ { p } \in \mathcal { F } _ { p } , F _ { a } \in \mathcal { F } } \quad \| F _ { a } \| \quad \mathrm { s u b j e c t ~ t o } \quad \forall X \in \mathcal { D } , \forall t , \frac { \mathrm { d } X _ { t } } { \mathrm { d } t } = ( F _ { p } + F _ { a } ) ( X _ { t } )
290
+ $$
291
+
292
+ is equivalent a metric projection onto $\mathcal { F } _ { p }$
293
+
294
+ If ${ \mathcal { F } } _ { p }$ is proximinal, Eq. (5) admits a minimizing pair.
295
+
296
+ If ${ \mathcal { F } } _ { p }$ is Chebyshev, Eq. (5) admits a unique minimizing pair which $F _ { p }$ is the metric projection.
297
+
298
+ Proof. The idea is to reconstruct the full functional from the trajectories of $\mathcal { D }$ . By definition, $\mathcal { A }$ is the set of points reached by trajectories in $\mathcal { D }$ so that:
299
+
300
+ $$
301
+ \mathcal { A } = \{ x \in \mathbb { R } ^ { d } \mid \exists X . \in \mathcal { D } , \exists t , X _ { t } = x \}
302
+ $$
303
+
304
+ Then let us define a function $F ^ { \mathcal { D } }$ in the following way: For $a \in { \mathcal { A } }$ , we can find $X , \in { \mathcal { D } }$ and $t _ { 0 }$ such that $X _ { t _ { 0 } } = a$ . Differentiating $X$ at $t _ { 0 }$ , which is possible by definition of $\mathcal { D }$ , we take:
305
+
306
+ $$
307
+ \boldsymbol { F } ^ { \mathcal { D } } ( \boldsymbol { a } ) = \left. \frac { \mathrm { d } X _ { t } } { \mathrm { d } t } \right| _ { t = t _ { 0 } }
308
+ $$
309
+
310
+ For any $( F _ { p } , F _ { a } )$ satisfying the constraint in Eq. (5), we then have that $( F _ { p } + F _ { a } ) ( a ) = \mathrm { d } X _ { t } / \mathrm { d } t _ { | t _ { 0 } } =$ $F ^ { \mathcal { D } } ( a )$ for all $a \in { \mathcal { A } }$ . Conversely, any pair such that $( F _ { p } , F _ { a } ) \in \mathcal { F } _ { p } \times \mathcal { F }$ and $F _ { p } + F _ { a } = F ^ { \mathcal { D } }$ , verifies the constraint.
311
+
312
+ Thus we have the equivalence between Eq. (5) and the metric projection formulated as:
313
+
314
+ $$
315
+ \operatorname* { m i n i m i z e } _ { F _ { p } \in \mathcal { F } _ { p } } \quad \left\| F ^ { D } - F _ { p } \right\|
316
+ $$
317
+
318
+ If $\mathcal { F } _ { p }$ is proximinal, the projection problem admits a solution which we denote $F _ { p } ^ { \star }$ . Taking $F _ { a } ^ { \star } =$ $F ^ { \mathcal { D } } - F _ { p } ^ { \star }$ , we have that $F _ { p } ^ { \star } + F _ { a } ^ { \star } = F ^ { \mathcal { D } }$ so that $( F _ { p } ^ { \star } , F _ { a } ^ { \star } )$ verifies the constraint of Eq. (2). Moreover, if there is $( F _ { p } , F _ { a } )$ satisfying the constraint of Eq. (2), we have that $F _ { p } + F _ { a } = F ^ { \mathcal { D } }$ by what was shown above and $\| F _ { a } \| = \| F ^ { \mathcal { D } } - F _ { p } \| \ge \| F ^ { \mathcal { D } } - F _ { p } ^ { \star } \|$ by definition of $F _ { p } ^ { \star }$ . This shows that $( F _ { p } ^ { \star } , F _ { a } ^ { \star } )$ is minimal.
319
+
320
+ Moreover, if ${ \mathcal { F } } _ { p }$ is a Chebyshev set, by uniqueness of the projection, if $F _ { p } \neq F _ { p } ^ { \star }$ then $\left\| F _ { a } \right\| > \left\| F _ { a } ^ { \star } \right\|$ Thus the minimal pair is unique.
321
+
322
+ # C PARAMETER ESTIMATION IN INCOMPLETE PHYSICAL MODELS
323
+
324
+ Classically, when a set $\mathcal { F } _ { p } \subset \mathcal { F }$ summarising the most important properties of a system is available, this gives a simplified model of the true dynamics and the adopted problem is then to fit the trajectories using this model as well as possible, solving:
325
+
326
+ $$
327
+ \begin{array} { r l } { \underset { { \boldsymbol { F } } _ { p } \in { \mathcal { F } } _ { p } } { \mathrm { m i n i m i z e } } } & { \mathbb { E } _ { \boldsymbol { X } \sim \mathcal { D } } L ( \widetilde { \boldsymbol { X } } ^ { X _ { 0 } } , \boldsymbol { X } ) } \\ { \mathrm { s u b j e c t ~ t o } } & { \forall g \in \mathbb { Z } , \widetilde { X } _ { 0 } ^ { g } = g \mathrm { ~ a n d ~ } \forall t , \frac { \mathrm { d } \widetilde { X } _ { t } ^ { g } } { \mathrm { d } t } = F _ { p } ( \widetilde { X } _ { t } ^ { g } ) } \end{array}
328
+ $$
329
+
330
+ where $L$ is a discrepancy measure between trajectories. Recall that $\widetilde { X } ^ { X _ { 0 } }$ is the result trajectory of an ODE solver taking $X _ { 0 }$ as initial condition. In other words, we try to find a function $F _ { p }$ which gives trajectories as close as possible to the ones from the dataset. While estimation of the function becomes easier, there is then a residual part which is left unexplained and this can be a non negligible issue in at least two ways:
331
+
332
+ • When $F \notin \mathcal { F } _ { p }$ , the loss is strictly positive at the minimum. This means that reducing the space of functions ${ \mathcal { F } } _ { p }$ makes us lose in terms of accuracy.4 • The obtained function $F _ { p }$ might not even be the most meaningful function from ${ \mathcal { F } } _ { p }$ as it would try to capture phenomena which are not explainable with functions in ${ \mathcal { F } } _ { p }$ , thus giving the wrong bias to the calculated function. For example, if one is considering a dampened periodic trajectory where only the period can be learned in $\mathcal { F } _ { p }$ but not the dampening, the estimated period will account for the dampening and will thus be biased.
333
+
334
+ This is confirmed in the paper in Section 4: the incomplete physical models augmented with APHYNITY get different and experimentally better physical identification results than the physical models alone.
335
+
336
+ Let us compare our approach with this one on the linearized damped pendulum to show how estimates of physical parameters can differ. The equation is the following:
337
+
338
+ $$
339
+ { \frac { \mathrm { d } ^ { 2 } \theta } { \mathrm { d } t ^ { 2 } } } + \omega _ { 0 } ^ { 2 } \theta + \alpha { \frac { \mathrm { d } \theta } { \mathrm { d } t } } = 0
340
+ $$
341
+
342
+ We take the same notations as in the article and parametrize the simplified physical models as:
343
+
344
+ $$
345
+ F _ { p } ^ { a } : X \mapsto ( { \frac { \mathrm { d } \theta } { \mathrm { d } t } } , - a \theta )
346
+ $$
347
+
348
+ where $a > 0$ corresponds to $\omega _ { 0 } ^ { 2 }$ . The corresponding solution for an initial state $X _ { 0 }$ , which we denote $X ^ { a }$ , can then written explicitly as:
349
+
350
+ $$
351
+ \theta _ { t } ^ { a } = \theta _ { 0 } \cos \sqrt { a } t
352
+ $$
353
+
354
+ Let us consider damped pendulum solutions $X$ written as:
355
+
356
+ $$
357
+ \theta _ { t } = \theta _ { 0 } e ^ { - t } \cos t
358
+ $$
359
+
360
+ which corresponds to:
361
+
362
+ $$
363
+ F : X \mapsto ( { \frac { \mathrm { d } \theta } { \mathrm { d } t } } , - 2 ( \theta + { \frac { \mathrm { d } \theta } { \mathrm { d } t } } ) )
364
+ $$
365
+
366
+ 4This is true in theory, although not necessarily in practice when $F$ overfits a small dataset.
367
+
368
+ It is then easy to see that the estimate of $a$ with the physical model alone can be obtained by minimizing:
369
+
370
+ $$
371
+ \int _ { 0 } ^ { T } | e ^ { - t } \cos t - \cos \sqrt { a } t | ^ { 2 }
372
+ $$
373
+
374
+ This expression depends on $T$ and thus, depending on the chosen time interval and the way the integral is discretized will almost always give biased estimates. In other words, the estimated value of $a$ will not give us the desired solution $t \mapsto \cos t$ .
375
+
376
+ On the other hand, for a given $a$ , in the APHYNITY framework, the residual must be equal to:
377
+
378
+ $$
379
+ F _ { r } ^ { a } : X \mapsto ( 0 , ( a - 2 ) \theta - 2 { \frac { \mathrm { d } \theta } { \mathrm { d } t } } )
380
+ $$
381
+
382
+ in order to satisfy the fitting constraint. Here $a$ corresponds to $1 + \omega _ { 0 } ^ { 2 }$ not to $\omega _ { 0 } ^ { 2 }$ as in the simplified case. Minimizing its norm, we obtain $a = 2$ which gives us the desired solution:
383
+
384
+ $$
385
+ \theta _ { t } = \theta _ { 0 } e ^ { - t } \cos t
386
+ $$
387
+
388
+ with the right period.
389
+
390
+ # D DISCUSSION ON SUPERVISION OVER DERIVATIVES
391
+
392
+ In order to find the appropriate decomposition $( F _ { p } , F _ { a } )$ , we use a trajectory-based error by solving:
393
+
394
+ $$
395
+ \begin{array} { r l r } { \underset { \boldsymbol { F _ { p } } \in \mathcal { F } _ { p } , \boldsymbol { F _ { a } } \in \mathcal { F } } { \mathrm { m i n i m i z e } } } & { \| \boldsymbol { F _ { a } } \| } & \\ { \mathrm { s u b j e c t ~ t o } } & { \forall g \in \mathcal { T } , \ \widetilde { X } _ { 0 } ^ { g } = g \mathrm { ~ a n d ~ } \forall t , \ \frac { \mathrm { d } \widetilde { X } _ { t } ^ { g } } { \mathrm { d } t } = ( \boldsymbol { F _ { p } } + \boldsymbol { F _ { a } } ) ( \widetilde { X } _ { t } ^ { g } ) , } & \\ & { \forall X \in \mathcal { D } , \ L ( X , \widetilde { X } ^ { X _ { 0 } } ) = 0 } \end{array}
396
+ $$
397
+
398
+ In the continuous setting where the data is available at all times $t$ , this problem is in fact equivalent to the following one:
399
+
400
+ $$
401
+ \underset { F _ { p } \in \mathcal { F } _ { p } } { \mathrm { m i n i m i z e } } \quad \mathbb { E } _ { X \sim \mathcal { D } } \int \left\| \frac { \mathrm { d } X _ { t } } { \mathrm { d } t } - F _ { p } ( X _ { t } ) \right\|
402
+ $$
403
+
404
+ where the supervision is done directly over derivatives, obtained through finite-difference schemes. This echoes the proof in Section B of the Appendix where $F$ can be reconstructed from the continuous data.
405
+
406
+ However, in practice, data is only available at discrete times with a certain time resolution. While Eq. (9) is indeed equivalent to Eq. (8) in the continuous setting, in the practical discrete one, the way error propagates is not anymore: For Eq. (8) it is controlled over integrated trajectories while for Eq. (9) the supervision is over the approximate derivatives of the trajectories from the dataset. We argue that the trajectory-based approach is more flexible and more robust for the following reasons:
407
+
408
+ • In Eq. (8), if $F _ { a }$ is appropriately parameterized, it is possible to perfectly fit the data trajectories at the sampled points.
409
+ • The use of finite differences schemes to estimate $F$ as is done in Eq. (9) necessarily induces a non-zero discretization error.
410
+ • This discretization error is explosive in terms of divergence from the true trajectories.
411
+
412
+ This last point is quite important, especially when time sampling is sparse (even though we do observe this adverse effect empirically in our experiments with relatively finely time-sampled trajectories). The following gives a heuristical reasoning as to why this is the case. Let $\widetilde { \boldsymbol { F } } = \boldsymbol { F } + \boldsymbol { \epsilon }$ be the function estimated from the sampled points with an error $\epsilon$ such that $\| \epsilon \| _ { \infty } \leq \alpha$ . Denoting $\widetilde { X }$ the corresponding trajectory generated by $\widetilde { F }$ , we then have, for all $X \in { \mathcal { D } }$ :
413
+
414
+ $$
415
+ \forall t , \ \frac { \mathrm { d } ( X - \widetilde { X } ) _ { t } } { \mathrm { d } t } = F ( X _ { t } ) - F ( \widetilde { X } _ { t } ) - \epsilon ( \widetilde { X } _ { t } )
416
+ $$
417
+
418
+ Integrating over $[ 0 , T ]$ and using the triangular inequality as well as the mean value inequality, supposing that $F$ has uniformly bounded spatial derivatives:
419
+
420
+ $$
421
+ \forall t \in [ 0 , T ] , \ \lVert ( X - \widetilde { X } ) _ { t } \rVert \leq \lVert \nabla F \rVert _ { \infty } \int _ { 0 } ^ { t } \lVert X _ { s } - \widetilde { X } _ { s } \rVert + \alpha t
422
+ $$
423
+
424
+ which, using a variant of the Grönwall lemma, gives us the inequality:
425
+
426
+ $$
427
+ \forall t \in [ 0 , T ] , \ \lVert X _ { t } - \widetilde { X } _ { t } \rVert \leq \frac { \alpha } { \lVert \nabla F \rVert _ { \infty } } ( \exp ( \Vert \nabla F \Vert _ { \infty } t ) - 1 )
428
+ $$
429
+
430
+ When $\alpha$ tends to 0, we recover the true trajectories $X$ . However, as $\alpha$ is bounded away from 0 by the available temporal resolution, this inequality gives a rough estimate of the way $\widetilde { X }$ diverges from them, and it can be an equality in many cases. This exponential behaviour explains our choice of a trajectory-based optimization.
431
+
432
+ # E IMPLEMENTATION DETAILS
433
+
434
+ We describe here the three use cases studied in the paper for validating APHYNITY. All experiments are implemented with PyTorch (Paszke et al., 2019) and the differentiable ODE solvers with the adjoint method implemented in torchdiffeq.5
435
+
436
+ # E.1 REACTION-DIFFUSION EQUATIONS
437
+
438
+ The system is driven by a FitzHugh-Nagumo type PDE (Klaasen & Troy, 1984)
439
+
440
+ $$
441
+ \frac { \partial u } { \partial t } = a \Delta u + R _ { u } ( u , v ; k ) , \frac { \partial v } { \partial t } = b \Delta v + R _ { v } ( u , v )
442
+ $$
443
+
444
+ where $a$ and $b$ are respectively the diffusion coefficients of $u$ and $v , \Delta$ is the Laplace operator. The local reaction terms are $R _ { u } ( \dot { u , } v ; k ) = u - u ^ { 3 } - k - v , R _ { v } ( u , v ) = u - v$ .
445
+
446
+ The state $X = ( u , v )$ is defined over a compact rectangular domain $\Omega = [ - 1 , 1 ] ^ { 2 }$ with periodic boundary conditions. $\Omega$ is spatially discretized with a $3 2 \times 3 2 ~ 2 \mathrm { { D } }$ uniform square mesh grid. The periodic boundary condition is implemented with circular padding around the borders. $\Delta$ is systematically estimated with a $3 \times 3$ discrete Laplace operator.
447
+
448
+ Dataset Starting from a randomly sampled initial state $X _ { \mathrm { i n i t } } \in [ 0 , 1 ] ^ { 2 \times 3 2 \times 3 2 }$ , we generate states by integrating the true PDE with fixed $a , b$ , and $k$ in a dataset $( a = 1 \times 1 0 ^ { - 3 } , b = 5 \times 1 0 ^ { - 3 } , k = 5 \times 1 0 ^ { - 3 } )$ . We firstly simulate high time-resolution $( \delta t _ { \mathrm { s i m } } = 0 . 0 0 1 $ ) sequences with explicit finite difference method. We then extract states every $\delta t _ { \mathrm { d a t a } } = 0 . 1$ to construct our low time-resolution datasets.
449
+
450
+ We set the time of random initial state to $t = - 0 . 5$ and the time horizon to $t = 2 . 5$ . 1920 sequences are generated, with 1600 for training/validation and 320 for test. We take the state at $t = 0$ as $X _ { 0 }$ and predict the sequence until the horizon (equivalent to 25 time steps) in all reaction-diffusion experiments. Note that the sub-sequence with $t < 0$ are reserved for the extensive experiments in Appendix G.1.
451
+
452
+ Neural network architectures Our $F _ { a }$ here is a 3-layer convolution network (ConvNet). The two input channels are $( u , v )$ and two output ones are $\textstyle { \bigl ( } { \frac { \partial u } { \partial t } } , { \frac { \tilde { \partial } v } { \partial t } } { \bigr ) }$ . The purely data-driven Neural ODE uses such ConvNet as its $F$ . The detailed architecture is provided in Table 2. The estimated physical parameters $\theta _ { p }$ in $F _ { p }$ are simply a trainable vector $( a , \dot { b } ) \in \mathbb { R } _ { + } ^ { 2 }$ or $( a , b , k ) \in \mathbb { R } _ { + } ^ { 3 }$ .
453
+
454
+ Table 2: ConvNet architecture in reaction-diffusion and wave equation experiments, used as datadriven derivative operator in APHYNITY and Neural ODE (Chen et al., 2018).
455
+
456
+ <table><tr><td>Module</td><td>Specification</td></tr><tr><td>2D Conv. 2D Batch Norm.</td><td>3 × 3 kernel, 2 input channels,16 output channels,1 pixel zero padding No average tracking</td></tr><tr><td>ReLUactivation 2D Conv.</td><td>3 × 3 kernel, 16 input channels,16 output channels,1 pixel zero padding</td></tr><tr><td>2D Batch Norm. ReLU activation</td><td>No average tracking</td></tr><tr><td>2D Conv.</td><td>3 × 3 kernel, 16 input channels,2 output channels,1 pixel zero padding</td></tr></table>
457
+
458
+ Optimization hyperparameters We choose to apply the same hyperparameters for all the reactiondiffusion experiments: $N i t e r = 1 , \lambda _ { 0 } = 1 , \tau _ { 1 } = \dot { 1 } \stackrel { . } { \times } \dot { 1 } 0 ^ { - 3 } , \tau _ { 2 } = \dot { 1 } \stackrel { . } { \times } \dot { 1 } 0 ^ { 3 }$ .
459
+
460
+ # E.2 WAVE EQUATIONS
461
+
462
+ The damped wave equation is defined by
463
+
464
+ $$
465
+ \frac { \partial ^ { 2 } w } { \partial t ^ { 2 } } - c ^ { 2 } \Delta w + k \frac { \partial w } { \partial t } = 0
466
+ $$
467
+
468
+ where $c$ is the wave speed and $k$ is the damping coefficient. The state is $\begin{array} { r } { X = ( w , \frac { \partial w } { \partial t } ) } \end{array}$
469
+
470
+ We consider a compact spatial domain $\Omega$ represented as a $6 4 \times 6 4$ grid and discretize the Laplacian operator similarly. $\Delta$ is implemented using a $5 \times 5$ discrete Laplace operator in simulation whereas in the experiment is a $3 \times 3$ Laplace operator. Null Neumann boundary condition are imposed for generation.
471
+
472
+ Dataset $\delta t$ was set to 0.001 to respect Courant number and provide stable integration. The simulation was integrated using a 4th order finite difference Runge-Kutta scheme for 300 steps from an initial Gaussian state, i.e for all sequence at $t = 0$ , we have:
473
+
474
+ $$
475
+ w ( x , y , t = 0 ) = C \times \exp ^ { \frac { ( x - x _ { 0 } ) ^ { 2 } + ( y - y _ { 0 } ) ^ { 2 } } { \sigma ^ { 2 } } }
476
+ $$
477
+
478
+ The amplitude $C$ is fixed to 1, and $( x _ { 0 } , y _ { 0 } ) = ( 3 2 , 3 2 )$ to make the Gaussian curve centered for all sequences. However, $\sigma$ is different for each sequence and uniformly sampled in [10, 100]. The same $\delta t$ was used for train and test. All initial conditions are Gaussian with varying amplitudes. 250 sequences are generated, 200 are used for training while 50 are reserved as a test set. In the main paper setting, $c = 3 3 0$ and $k = 5 0$ . As with the reaction diffusion case, the algorithm takes as input a state $\begin{array} { r } { X _ { t _ { 0 } } = ( w , \frac { \mathrm { d } w } { \mathrm { d } t } ) ( t _ { 0 } ) } \end{array}$ and predicts all states from $t _ { 0 } + \delta t$ up to $t _ { 0 } + 2 5 \delta t$ .
479
+
480
+ Neural network architectures The neural network for $F _ { a }$ is a 3-layer convolution neural network with the same architecture as in Table 2. For $F _ { p }$ , the parameter(s) to be estimated is either a scalar $c \in \mathbb { R } _ { + }$ or a vector $( c , k ) \in \mathbb { R } _ { + } ^ { 2 }$ . Similarly, Neural ODE networks are build as presented in Table 2.
481
+
482
+ Optimization hyperparameters We use the same hyperparameters for the experiments: $\bar { N i t e r } = 3 , \lambda _ { 0 } = \bar { 1 } , \bar { \tau _ { 1 } } = 1 \times 1 0 ^ { - 4 } , \tau _ { 2 } = 1 \times 1 0 ^ { 2 }$ .
483
+
484
+ # E.3 DAMPED PENDULUM
485
+
486
+ We consider the non-linear damped pendulum problem, governed by the ODE
487
+
488
+ $$
489
+ { \frac { \mathrm { d } ^ { 2 } \theta } { \mathrm { d } t ^ { 2 } } } + \omega _ { 0 } ^ { 2 } \sin \theta + \alpha { \frac { \mathrm { d } \theta } { \mathrm { d } t } } = 0
490
+ $$
491
+
492
+ $\theta ( t )$ $\begin{array} { r } { \omega _ { 0 } = \frac { 2 \pi } { T _ { 0 } } } \end{array}$ proper pulsation , the ODE can b $T _ { 0 }$ being thritten as $\alpha$ is thwith $\begin{array} { r } { X = ( \theta , \frac { \mathrm { d } \theta } { \mathrm { d } t } ) } \end{array}$ $\begin{array} { r } { \frac { \mathrm { d } \boldsymbol { X } _ { t } } { \mathrm { d } t } = \boldsymbol { F } ( \boldsymbol { X } _ { t } ) } \end{array}$ $F : X \mapsto$ $\textstyle \bigl ( { \frac { \mathrm { d } \theta } { \mathrm { d } t } } , - \omega _ { 0 } ^ { 2 } \sin \theta - \alpha { \frac { \mathrm { d } \theta } { \mathrm { d } t } } \bigr )$
493
+
494
+ Dataset For each train / validation / test split, we simulate a dataset with 25 trajectories of 40 timesteps (time interval [0, 20], timestep $\delta t = 0 . 5$ ) with fixed ODE coefficients $( T _ { 0 } = 1 2 , \alpha = 0 . 2 )$ and varying initial conditions. The simulation integrator is Dormand-Prince Runge-Kutta method of order (4)5 (DOPRI5, Dormand & Prince, 1980). We also add a small amount of white gaussian noise $\sigma = 0 . 0 1$ ) to the state. Note that our pendulum dataset is much more challenging than the ideal frictionless pendulum considered in Greydanus et al. (2019).
495
+
496
+ Neural network architectures We detail in Table 3 the neural architectures used for the damped pendulum experiments. All data-driven augmentations for approximating the mapping $X _ { t } \mapsto F ( X _ { t } )$ are implemented by multi-layer perceptrons (MLP) with 3 layers of 200 neurons and ReLU activation functions (except at the last layer: linear activation). The Hamiltonian (Greydanus et al., 2019; Toth et al., 2020) is implemented by a MLP that takes the state $X _ { t }$ and outputs a scalar estimation of the Hamiltonian $\mathcal { H }$ of the system: the derivative is then computed by an in-graph gradient of $\mathcal { H }$ with respect to the input: $\begin{array} { r } { \dot { F ( X _ { t } ) } = \left( \frac { \partial \mathcal { H } } { \partial ( \mathrm { d } \theta / \mathrm { d } t ) } , - \frac { \partial \mathcal { H } } { \mathrm { d } \theta } \right) } \end{array}$
497
+
498
+ Table 3: Neural network architectures for the damped pendulum experiments. $\mathrm { n / a }$ corresponds to non-applicable cases.
499
+
500
+ <table><tr><td>Method</td><td>Physical model</td><td>Data-driven model</td></tr><tr><td colspan="2">Neural ODE n/a</td><td>MLP(in=2,units=200,layers=3,out=2)</td></tr><tr><td>Hamiltonian APHYNITY Hamiltonian</td><td>MLP(in=2,units=200,layers=3,out=1) MLP(in=2,units=200,layers=3,out=1)</td><td>n/a MLP(in=2,units=200,layers=3,out=2)</td></tr><tr><td>Param ODE (wo) APHYNITY Param ODE (ωo)</td><td>1 trainable parameter wo</td><td>n/a MLP(in=2,units=200,layers=3,out=2)</td></tr><tr><td></td><td>1 trainable parameter ωo</td><td></td></tr><tr><td>Param ODE (ωo, α) APHYNITY Param ODE (wo,α)</td><td>2 trainable parameters w,入 2 trainable parameters ωo,入</td><td>n/a MLP(in=2,units=200,layers=3,out=2)</td></tr></table>
501
+
502
+ Optimization hyperparameters The hyperparameters of the APHYNITY optimization algorithm $( N i t e r , \lambda _ { 0 } , \tau _ { 1 } , \tau _ { 2 } )$ were cross-validated on the validation set and are shown in Table 4. All models were trained with a maximum number of 5000 steps with early stopping.
503
+
504
+ Table 4: Hyperparameters of the damped pendulum experiments.
505
+
506
+ <table><tr><td>Method</td><td>Niter</td><td>入0</td><td>T1</td><td>T2</td></tr><tr><td>APHYNITY Hamiltonian</td><td>5</td><td>1</td><td>1</td><td>0.1</td></tr><tr><td>APHYNITY ParamODE (ωo)</td><td>5</td><td>1</td><td>1</td><td>10</td></tr><tr><td>APHYNITY ParamODE (ωo,入)</td><td>5</td><td>1000</td><td>1</td><td>100</td></tr></table>
507
+
508
+ # F ABLATION STUDY
509
+
510
+ We conduct ablation studies to show the effectiveness of APHYNITY’s adaptive optimization and trajectory-based learning scheme.
511
+
512
+ # F.1 ABLATION TO VANILLA MB/ML COOPERATION
513
+
514
+ In Table 5, we consider the ablation case with the vanilla augmentation scheme found in Le Guen & Thome (2020); Wang et al. (2019); Mehta et al. (2020), which does not present any proper decomposition guarantee. We observe that the APHYNITY cooperation scheme outperforms this vanilla scheme in all case, both in terms of forecasting performances (e.g. log $\mathrm { M S E } { = } { - 0 . 3 5 }$ vs. -3.97 for the Hamiltonian in the pendulum case) and parameter identification (e.g. Err Param ${ \it 1 } = 8 . 4 \%$ vs. 2.3 for Param PDE $[ a , b$ for reaction-diffusion). It confirms the crucial benefits of APHYNITY’s principled decomposition scheme.
515
+
516
+ Table 5: Ablation study comparing APHYNITY to the vanilla augmentation scheme (Wang et al., 2019; Mehta et al., 2020) for the reaction-diffusion equation, wave equation and damped pendulum.
517
+
518
+ <table><tr><td>Dataset</td><td>Method</td><td>log MSE</td><td>%Err Param.</td><td>|Fall²2</td></tr><tr><td rowspan="3">Reaction- diffusion</td><td>Param. PDE (a,b) with vanilla aug. APHYNITY Param. PDE (a,b)</td><td>-4.56±0.52 -5.10±0.21</td><td>8.4 2.3</td><td>(7.5±1.4)e1 (6.7±0.4)e1</td></tr><tr><td>Param. PDE (a,b, k) with vanilla aug. APHYNITY Param. PDE (a,b, k)</td><td>-8.04±0.03 -9.35±0.02</td><td>25.4 0.096</td><td>(1.5±0.2)e-2 (1.5±0.4)e-6</td></tr><tr><td>True PDE with vanilla aug. APHYNITY True PDE</td><td>-8.12±0.05 -9.17±0.02</td><td>n/a n/a</td><td>(6.1±2.3)e-4 (1.4±0.8)e-7</td></tr><tr><td rowspan="2">Wave equation</td><td>Param PDE (c) with vanilla aug. APHYNITY Param PDE (c)</td><td>-3.90 ± 0.27 -4.64±0.25</td><td>0.51 0.31</td><td>88.66 71.0</td></tr><tr><td>Param PDE (c, k) with vanilla aug. APHYNITY Param PDE (c, k)</td><td>-5.96 ± 0.10 -6.09±0.28</td><td>0.71 0.70</td><td>25.1 4.54</td></tr><tr><td rowspan="4">Damped pendulum</td><td>Hamiltonian with vanilla aug. APHYNITY Hamiltonian</td><td>-0.35±0.1 -3.97±1.2</td><td>n/a n/a</td><td>837±117 623±68</td></tr><tr><td>Param ODE (ωo) with vanilla aug. APHYNITY Param ODE (ωo)</td><td>-7.02±1.7 -7.86±0.6</td><td>4.5 4.0</td><td>148±49</td></tr><tr><td>Param ODE (wo,α) with vanilla aug. APHYNITY Param ODE (ωo, α)</td><td>-7.60±0.6</td><td>4.65</td><td>132±11 35.5±6.2</td></tr><tr><td>Augmented True ODE with vanilla aug. APHYNITY True ODE</td><td>-8.31±0.3 -8.40±0.2 -8.44±0.2</td><td>0.39 n/a n/a</td><td>8.5±2.0 3.4±0.8 2.3±0.4</td></tr></table>
519
+
520
+ # F.2 DETAILED ABLATION STUDY
521
+
522
+ We conduct also two other ablations in Table 6:
523
+
524
+ • derivative supervision: in which $F _ { p } + F _ { a }$ is trained with supervision over approximated derivatives on ground truth trajectory, as performed in Greydanus et al. (2019); Cranmer et al. (2020). More precisely, APHYNITY’s ${ \mathcal { L } } _ { \mathrm { t r a j } }$ is here replaced with $\begin{array} { r } { \mathcal { L } _ { \mathrm { d e r i v } } = \| \frac { \mathrm { d } X _ { t } } { \mathrm { d } t } - F ( X _ { t } ) \| } \end{array}$ as in Eq. (9), where $\frac { \mathrm { d } X _ { t } } { \mathrm { d } t }$ is approximated by finite differences on $X _ { t }$ . • non-adaptive optim.: in which we train APHYNITY by minimizing $\| F _ { a } \|$ without the adaptive optimization of $\lambda$ shown in Algorithm 1. This case is equivalent to $\lambda = 1 , \tau _ { 2 } = 0$ .
525
+
526
+ We highlight the importance to use a principled adaptive optimization algorithm (APHYNITY algorithm described in paper) compared to a non-adpative optimization: for example in the reactiondiffusion case, log $\mathrm { M S E } { = } { - 4 . 5 5 }$ vs. -5.10 for Param PDE $( a , b )$ . Finally, when the supervision occurs on the derivative, both forecasting and parameter identification results are systematically lower than with APHYNITY’s trajectory based approach: for example, $\log { \mathrm { M S E } } { = } { - } 1 . 1 6$ vs. -4.64 for Param PDE $( c )$ in the wave equation. It confirms the good properties of the APHYNITY training scheme.
527
+
528
+ Table 6: Detailed ablation study on supervision and optimization for the reaction-diffusion equation, wave equation and damped pendulum.
529
+
530
+ <table><tr><td>Dataset</td><td>Method</td><td>log MSE</td><td>%Err Param.</td><td>|Fall2</td></tr><tr><td rowspan="4">Reaction- diffusion</td><td>Augmented Param.PDE (a,b) derivative supervision Augmented Param. PDE(a,b) non-adaptive optim.</td><td>-4.42±0.25 -4.55±0.11</td><td>12.6 7.5</td><td>(6.8±0.6)e1 (7.6±1.0)e1</td></tr><tr><td>APHYNITY Param. PDE (a, b)</td><td>-5.10±0.21</td><td>2.3</td><td>(6.7±0.4)e1</td></tr><tr><td>Augmented Param.PDE (a,b, k) derivative supervision Augmented Param.PDE (a,b,k) non-adaptive optim.</td><td>-4.90±0.06 -9.10±0.02</td><td>11.7</td><td>(1.9±0.3)e-1</td></tr><tr><td>APHYNITY Param.PDE (a,b,k) Augmented True PDE derivative supervision Augmented True PDE non-adaptive optim.</td><td>-9.35±0.02 -6.03±0.01</td><td>0.21 0.096 n/a</td><td>(5.5±2.9)e-7 (1.5±0.4)e-6 (3.1±0.8)e-3</td></tr><tr><td rowspan="4">Wave equation</td><td>APHYNITY True PDE Augmented Param PDE (c) derivative supervision</td><td>-9.01±0.01 -9.17±0.02 -1.16±0.48</td><td>n/a n/a 12.1</td><td>(1.5±0.8)e-6 (1.4±0.8)e-7 0.00024</td></tr><tr><td>Augmented Param PDE (c) non-adaptive optim. APHYNITY Param PDE (c) Augmented Param PDE (c, k) derivative supervision</td><td>-2.57±0.21 -4.64±0.25 -4.19±0.36</td><td>3.1 0.31 7.2</td><td>43.6 71.0 0.00012</td></tr><tr><td>Augmented Param PDE (c, k) non-adaptive optim. APHYNITY Param PDE (c, k)</td><td>-4.93±0.51 -6.09±0.28</td><td>1.32 0.70</td><td>0.054 4.54</td></tr><tr><td>Augmented True PDE derivative supervision Augmented True PDE non-adaptive optim. APHYNITY True PDE</td><td>-4.42 ± 0.33 -4.97±0.49 -5.24±0.45</td><td>n/a n/a</td><td>6.02e-5 0.23</td></tr><tr><td rowspan="6">Damped pendulum</td><td>Augmented Hamiltonian derivative supervision Augmented Hamiltonian non-adaptive optim.</td><td>-0.83±0.3</td><td>n/a n/a</td><td>0.14 642±121</td></tr><tr><td>APHYNITYHamiltonian</td><td>-0.49±0.58 -3.97±1.2</td><td>n/a n/a</td><td>165±30 623±68</td></tr><tr><td>Augmented Param ODE (ωo) derivative supervision Augmented Param ODE (ωo) non-adaptive optim. APHYNITY Param ODE (ωo)</td><td>-1.02±0.04 -4.30±1.3</td><td>5.8 4.4</td><td>136±13 90.4±27</td></tr><tr><td>Augmented Param ODE (ωo,α) derivative supervision</td><td>-7.86±0.6 -2.61±0.2</td><td>4.0 5.0</td><td>132±11</td></tr><tr><td>Augmented Param ODE (ωo,α) non-adaptive optim. APHYNITY Param ODE (ωo, α)</td><td>-7.69±1.3</td><td>1.65</td><td>3.2±1.7 4.8±7.7</td></tr><tr><td>Augmented True ODE derivative supervision</td><td>-8.31±0.3 -2.14±0.3</td><td>0.39</td><td>8.5±2.0</td></tr><tr><td>Augmented True ODE non-adaptive optim. APHYNITY True ODE</td><td></td><td>-8.34±0.4 -8.44±0.2</td><td>n/a n/a n/a</td><td>4.1±0.6 1.4±0.3 2.3±0.4</td></tr></table>
531
+
532
+ # G ADDITIONAL EXPERIMENTS
533
+
534
+ # G.1 REACTION-DIFFUSION SYSTEMS WITH VARYING DIFFUSION PARAMETERS
535
+
536
+ We conduct an extensive evaluation on a setting with varying diffusion parameters for reactiondiffusion equations. The only varying parameters are diffusion coefficients, i.e. individual $a$ and $b$ for each sequence. We randomly sample $\mathbf { \bar { \alpha } } a \in [ 1 \times 1 0 ^ { - 3 } , 2 \times 1 0 ^ { - 3 } ]$ and $b \in [ 3 \times 1 0 ^ { - 3 } , 7 \times 1 0 ^ { - 3 } ]$ . $k$ is still fixed to $5 \times 1 0 ^ { - 3 }$ across the dataset.
537
+
538
+ In order to estimate $a$ and $b$ for each sequence, we use here a ConvNet encoder $E$ to estimate parameters from 5 reserved frames $( t < 0 )$ ). The architecture of the encoder $E$ is similar to the one in Table 2 except that $E$ takes 5 frames (10 channels) as input and $E$ outputs a vector of estimated $( \tilde { a } , \tilde { b } )$ after applying a sigmoid activation scaled by $1 \times 1 0 ^ { - 2 }$ (to avoid possible divergence). For the baseline Neural ODE, we concatenate $a$ and $b$ to each sequence as two channels.
539
+
540
+ In Table 7, we observe that combining data-driven and physical components outperforms the pure data-driven one. When applying APHYNITY to Param PDE $( a , b )$ , the prediction precision is significantly improved (log MSE: -1.32 vs. -4.32) with $a$ and $b$ respectively reduced from $5 5 . 6 \%$ and $5 4 . 1 \%$ to $1 1 . 8 \%$ and $1 8 . 7 \%$ . For complete physics cases, the parameter estimations are also improved for Param PDE $( a , b , k )$ by reducing over $60 \%$ of the error of $b$ (3.10 vs. 1.23) and $10 \%$ to $20 \%$ of the errors of $a$ and $k$ (resp. 1.55/0.59 vs. 1.29/0.39).
541
+
542
+ The extensive results reflect the same conclusion as shown in the main article: APHYNITY improves the prediction precision and parameter estimation. The same decreasing tendency of $\| F _ { a } \|$ is also confirmed.
543
+
544
+ Table 7: Results of the dataset of reaction-diffusion with varying $( a , b )$ . $k = 5 \times 1 0 ^ { - 3 }$ is shared across the dataset.
545
+
546
+ <table><tr><td></td><td>Method</td><td>log MSE</td><td>%Err a</td><td>%Err b</td><td>%Err k</td><td>|Fall2</td></tr><tr><td>Data- driven</td><td>Neural ODE (Chen et al., 2018)</td><td>-3.61±0.07</td><td>n/a</td><td>n/a</td><td>n/a</td><td>n/a</td></tr><tr><td rowspan="2">Incomplete physics</td><td>Param PDE (a,b)</td><td>-1.32±0.02</td><td>55.6</td><td>54.1</td><td>n/a</td><td>n/a</td></tr><tr><td>APHYNITY Param PDE (a, b)</td><td>-4.32±0.32</td><td>11.8</td><td>18.7</td><td>n/a</td><td>(4.3±0.6)e1</td></tr><tr><td rowspan="4">Complete physics</td><td>Param PDE (a,b, k)</td><td>-5.54±0.38</td><td>1.55</td><td>3.10</td><td>0.59</td><td>n/a</td></tr><tr><td>APHYNITY Param PDE (a, b, k)</td><td>-5.72±0.25</td><td>1.29</td><td>1.23</td><td>0.39</td><td>(5.9±4.3)e-1</td></tr><tr><td>True PDE</td><td>-8.86±0.02</td><td>n/a</td><td>n/a</td><td>n/a</td><td>n/a</td></tr><tr><td>APHYNITY True PDE</td><td>-8.82±0.15</td><td>n/a</td><td>n/a</td><td>n/a</td><td>(1.8±0.6)e-5</td></tr></table>
547
+
548
+ # G.2 ADDITIONAL RESULTS FOR THE WAVE EQUATION
549
+
550
+ We conduct an experiment where each sequence is generated with a different wave celerity. This dataset is challenging because both $c$ and the initial conditions vary across the sequences. For each simulated sequence, an initial condition is sampled as described previously, along with a wave celerity $c$ also sampled uniformly in [300, 400]. Finally our initial state is integrated with the same Runge-Kutta scheme. 200 of such sequences are generated for training while 50 are kept for testing.
551
+
552
+ For this experiment, we also use a ConvNet encoder to estimate the wave speed $c$ from 5 consecutive reserved states $\begin{array} { r } { ( w , \frac { \partial w } { \partial t } ) } \end{array}$ . The architecture of the encoder $E$ is the same as in Table 2 but with 10 input channels. Here also, $k$ is fixed for all sequences and $k = 5 0$ . The hyper-parameters used in these experiments are the same than described in the Section E.2.
553
+
554
+ The results when multiple wave speeds $c$ are in the dataset are consistent with the one present when only one is considered. Indeed, while prediction performances are slightly hindered, the parameter estimation remains consistent for both $c$ and $k$ . This extension provides elements attesting for the robustness and adaptability of our method to more complex settings. Finally the purely data-driven Neural-ODE fails to cope with the increasing difficulty.
555
+
556
+ Table 8: Results for the damped wave equation when considering multiple $c$ sampled uniformly in [300, 400] in the dataset, $k$ is shared across all sequences and $k = 5 0$ .
557
+
558
+ <table><tr><td></td><td>Method</td><td>log MSE</td><td>%Error c</td><td>%Error k</td><td>Fall²</td></tr><tr><td>Data- driven</td><td>Neural ODE</td><td>0.056±0.34</td><td>n/a</td><td>n/a</td><td>n/a</td></tr><tr><td rowspan="2">Incomplete physics</td><td>Param PDE (c)</td><td>-1.32±0.27</td><td>23.9</td><td>n/a</td><td>n/a</td></tr><tr><td>APHYNITY Param PDE (c)</td><td>-4.51±0.38</td><td>3.2</td><td>n/a</td><td>171</td></tr><tr><td rowspan="4">Complete physics</td><td>Param PDE (c, k)</td><td>-4.25±0.28</td><td>3.54</td><td>1.43</td><td>n/a</td></tr><tr><td>APHYNITY Param PDE (c, k)</td><td>-4.84±0.57</td><td>2.41</td><td>0.064</td><td>3.64</td></tr><tr><td>True PDE (c, k)</td><td>-4.51±0.29</td><td>n/a</td><td>n/a</td><td>n/a</td></tr><tr><td>APHYNITY True PDE (c, k)</td><td>-4.49±0.22</td><td>n/a</td><td>n/a</td><td>0.0005</td></tr></table>
559
+
560
+ # G.3 DAMPED PENDULUM WITH VARYING PARAMETERS
561
+
562
+ To extend the experiments conducted in the paper (section 4) with fixed parameters $( T _ { 0 } = 6 , \alpha = 0 . 2 )$ and varying initial conditions, we evaluate APHYNITY on a much more challenging dataset where we vary both the parameters $( T _ { 0 } , \alpha )$ and the initial conditions between trajectories.
563
+
564
+ We simulate 500/50/50 trajectories for the train/valid/test sets integrated with DOPRI5. For each trajectory, the period $T _ { 0 }$ (resp. the damping coefficient $\alpha$ ) are sampled uniformly in the range [3, 10] (resp. [0, 0.5]).
565
+
566
+ We train models that take the first 20 steps as input and predict the next 20 steps. To account for the varying ODE parameters between sequences, we use an encoder that estimates the parameters based on the first 20 timesteps. In practice, we use a recurrent encoder composed of 1 layer of 128 GRU units. The output of the encoder is fed as additional input to the data-driven augmentation models and to an MLP with final softplus activations to estimate the physical parameters when necessary $( \omega _ { 0 } \in \mathbb { R } _ { + }$ for Param ODE $\left( \omega _ { 0 } \right)$ , $( \omega _ { 0 } , \alpha ) \in \mathbb { R } _ { + } ^ { 2 }$ for Param ODE $( \omega _ { 0 } , \alpha ) _ { , } ^ { \prime }$ ).
567
+
568
+ In this varying ODE context, we also compare to the state-of-the-art univariate time series forecasting method N-Beats (Oreshkin et al., 2020).
569
+
570
+ Results shown in Table 9 are consistent with those presented in the paper. Pure data-driven models Neural ODE (Chen et al., 2018) and N-Beats (Oreshkin et al., 2020) fail to properly extrapolate the pendulum dynamics. Incomplete physical models (Hamiltonian and ParamODE $\left( \omega _ { 0 } \right)$ ) are even worse since they do not account for friction. Augmenting them with APHYNITY significantly and consistently improves forecasting results and parameter identification.
571
+
572
+ Table 9: Forecasting and identification results on the damped pendulum dataset with different parameters for each sequence. log MSEs are computed over 20 predicted time-steps. For each level of incorporated physical knowledge, equivalent best results according to a Student t-test are shown in bold. n/a corresponds to non-applicable cases.
573
+
574
+ <table><tr><td>Method</td><td></td><td>log MSE</td><td>%Error To</td><td>%Error α</td><td>|Fal2</td></tr><tr><td rowspan="2">data- driven</td><td>Neural ODE (Chen et al., 2018)</td><td>-4.35±0.9</td><td>n/a</td><td>n/a</td><td>n/a</td></tr><tr><td>N-Beats (Oreshkin et al., 2020)</td><td>-4.57±0.5</td><td>n/a</td><td>n/a</td><td>n/a</td></tr><tr><td rowspan="4">Incomplete physics</td><td>Hamiltonian (Greydanus et al., 2019)</td><td>-1.31±0.4</td><td>n/a</td><td>n/a</td><td>n/a</td></tr><tr><td>APHYNITY Hamiltonian</td><td>-4.72±0.4</td><td>n/a</td><td>n/a</td><td>5.6±0.6</td></tr><tr><td>Param ODE (ωo) APHYNITY Param ODE (ωo)</td><td>-2.66±0.9 -5.94±0.7</td><td>21.5±19 5.0±1.8</td><td>n/a</td><td>n/a</td></tr><tr><td>Param ODE (ωo,α)</td><td>-5.71±0.4</td><td>4.08±0.8</td><td>n/a</td><td>0.49±0.1</td></tr><tr><td rowspan="4">Complete physics</td><td>APHYNITY Param ODE (ωo, α)</td><td>-6.22±0.7</td><td>3.26±0.6</td><td>152±129 62±27</td><td>n/a (5.39±0.1)e-10</td></tr><tr><td>True ODE</td><td>-8.58±0.1</td><td>n/a</td><td>n/a</td><td></td></tr><tr><td>APHYNITY True ODE</td><td>-8.58±0.1</td><td></td><td></td><td>n/a</td></tr><tr><td></td><td></td><td>n/a</td><td>n/a</td><td>(2.15±1.6)e-4</td></tr></table>
parse/train/kmG8vRXTFv/kmG8vRXTFv_content_list.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/train/kmG8vRXTFv/kmG8vRXTFv_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/train/kmG8vRXTFv/kmG8vRXTFv_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/train/rJl8viCqKQ/rJl8viCqKQ.md ADDED
@@ -0,0 +1,243 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # LOW LATENCY PRIVACY PRESERVING INFERENCE
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ When applying machine learning to sensitive data one has to balance between accuracy, information leakage, and computational-complexity. Recent studies have shown that Homomorphic Encryption (HE) can be used for protecting against information leakage while applying neural networks. However, this comes with the cost of limiting the kind of neural networks that can be used (and hence the accuracy) and with latency of the order of several minutes even for relatively simple networks. In this study we improve on previous results both in the kind of networks that can be applied and in terms of the latency. Most of the improvement is achieved by novel ways to represent the data to make better use of the capabilities of the encryption scheme.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Machine learning is used in domains such as education, health, and finance in which data may be private or confidential. Therefore, machine learning algorithms should preserve privacy while making accurate predictions. The privacy requirement pertains to all sub-tasks of the learning process, such as training and inference. In this work, we focus on private neural-networks inference. In this problem, popularized by the work on CryptoNets (Dowlin et al., 2016), the goal is to build an inference service that can make predictions on private data. To achieve this goal, the data is encrypted before it is sent to the prediction service which should be capable of operating on the encrypted data without having access to the raw content. To allow that, several cryptology technologies have been proposed, including Secure Multi-Party Computation (MPC) (Yao, 1982; Goldreich et al., 1987), hardware enclaves, such as Intel’s Software Guard Extensions (SGX) (McKeen et al., 2013), Homomorphic Encryption (Gentry, 2009), and combinations of these techniques.
12
+
13
+ The different approaches present different trade-offs in terms of computation, accuracy, and security. HE presents the most stringent security model. The security assumption relies on the hardness of solving a mathematical problem for which there are no known efficient algorithms, even in the presence of quantum computers (Gentry, 2009; Albrecht et al., 2018). Other techniques, such as MPC and SGX make additional assumptions and therefore provide a weaker sense of protection to the data (Yao, 1982; McKeen et al., 2013; Chen et al., 2018; Koruyeh et al., 2018).
14
+
15
+ While HE provides the highest level of security it is also limited in the kind of operations it allows and the complexity of these operations (see Section 1.1). CryptoNets (Dowlin et al., 2016) was the first demonstration that it may be feasible to use HE to build privacy preserving Encrypted Prediction as a Service (EPaaS) solutions (Sanyal et al., 2018). CryptoNets are capable of making predictions with accuracy of $9 9 \%$ on the MNIST task (LeCun et al., 2010) such that each prediction takes 250 seconds to complete. CryptoNets are also capable of packing 4096 prediction requests and operate on all of them in parallel which allows throughput of $\sim 5 9 0 0 0$ predictions per hour.
16
+
17
+ CryptoNets have several limitations that we address in this work, the first of them is latency. CryptoNets provide high throughput by operating on 4096 instances in parallel, however, all these instances have to come from a single source and use the same secret key. Therefore, this capability may be of little use in practice. Thus, we trade the high throughput in favor of low latency and show that the same neural network that was used by CryptoNets can be evaluated in as little as 2.2 seconds. We show that a part of this gain is an “engineering gain” which is a result of using a more recent implementation of HE. However, this “engineering gain” accounts for only $1 0 \times$ speedup. Most of the speedup comes from a new way to represent data when applying neural-networks using HE which we call LoLa. In a nut-shell, CryptoNets represent each node in the neural network as a separate message for encryption, while LoLa encrypts entire layers which results in a $1 1 . 2 \times$ speedup on top of the “engineering gain”. Together, these improvements results in a $1 1 4 \times$ improvement in latency while maintaining the same level of security and accuracy.1
18
+
19
+ LoLa provides another significant benefit over CryptoNets. Since CryptoNets encode every node in the network as a separate message, they create a memory bottleneck when applied to networks with many nodes. We demonstrate that in an experiment conducted on the CIFAR-10 dataset for which the CryptoNets approach fails to execute since it requires 100’s of Gigabytes of RAM. However, the low-latency approach, LoLa, which encodes layers instead of nodes, can make predictions in 12 minutes using only few Gigabytes of RAM.
20
+
21
+ The experiment on CIFAR demonstrates that the LoLa approach can handle larger networks than CryptoNets. However, there is still a big penalty for the size of the network: predictions on MNIST are achieved in 2.2 seconds, and this latency jumps to 12 minutes for the slightly more complex task in the CIFAR-10 dataset. Therefore, it is reasonable to ask whether any of these approaches can scale to handle tasks such as analyzing large and complex images. To that extent, we propose another solution which represents the input to the network using semantically meaningful features instead of pixels. These semantically meaningful features are extracted using the convolution layers of standard networks such as AlexNet (Krizhevsky et al., 2012). We consider these networks as “standard libraries” for machine learning tasks. Using such features allows reducing the size of the message to be sent and the complexity of the network that is needed for classification. Indeed, we use this approach to demonstrate private predictions in 0.18 seconds on the CalTech-101 dataset with class balanced accuracy of $7 5 . 7 \%$ .
22
+
23
+ # 1.1 HOMOMORPHIC ENCRYPTION
24
+
25
+ In this work we use Homomorphic Encryptions (HE) to provide privacy (we refer the reader to Dowlin et al. (2017) for a more comprehensive introduction). HEs are encryptions that allow operating on data while it is encrypted without requiring access to the secret key (Gentry, 2009). The data used for encryption is assumed to be elements in a ring $\mathcal { R }$ . On top of the encryption function $\mathbb { E }$ and the decryption function $\mathbb { D }$ , the HE scheme provides two additional operators $\oplus$ and $\otimes$ such that for any $x _ { 1 } , x _ { 2 } \in \mathcal { R }$
26
+
27
+ $$
28
+ \begin{array} { r l } & { \mathbb { D } \left( \mathbb { E } ( x _ { 1 } ) \oplus \mathbb { E } \left( x _ { 2 } \right) \right) = x _ { 1 } + x _ { 2 } \mathrm { ~ a n d ~ } } \\ & { \mathbb { D } \left( \mathbb { E } \left( x _ { 1 } \right) \otimes \mathbb { E } \left( x _ { 2 } \right) \right) = x _ { 1 } \times x _ { 2 } } \end{array}
29
+ $$
30
+
31
+ where $^ +$ and $\times$ are the standard addition and multiplication operations on the ring $\mathcal { R }$ . Therefore, the $\oplus$ and $\otimes$ operators allow computing addition and multiplication operators on the data in its encrypted form and thus computing any polynomial function.
32
+
33
+ Since Gentry’s seminal paper, in which he introduced the first HE scheme (Gentry, 2009), additional schemes have been proposed. In this work we use the Brakerski/Fan-Vercauteren scheme (BFV) (Fan & Vercauteren, 2012; Brakerski & Vaikuntanathan, 2014) as it is implemented in the SEAL library version 2.3.1.2 In this scheme, the ring on which the Homomorphic Encryption operates is $\begin{array} { r } { \mathcal { R } = \frac { \mathbb { Z } _ { p } [ x ] } { x ^ { n } + 1 } } \end{array}$ where $\begin{array} { r } { \mathbb { Z } _ { p } = \frac { \mathbb { Z } } { p \mathbb { Z } } } \end{array}$ . If the parameters $p$ and $n$ are chosen such that there is an order $2 n$ root of unity in $\mathbb { Z } _ { p }$ , then every element in can be viewed as a vector of dimension $n$ of elements in $\mathbb { Z } _ { p }$ where addition and multiplication operate component-wise (Brakerski et al., 2014). In this view, the BFV scheme allows a another operation on the encrypted data: rotation. The ideal rotation operation of size $k$ sends the value in the $\because$ ’th coordinate of a vector to the $( ( i + k )$ mod $n$ ) coordinate. The BFV scheme allows a slight modified version of the ideal rotation (see Appendix A) but for the sake of our discussion this detail is insignificant.
34
+
35
+ # 1.2 RELATED WORK
36
+
37
+ The task of private predictions gained significant attention in recent years. Dowlin et al. (2016) presented CryptoNets which demonstrated the feasibility of private neural networks predictions using
38
+
39
+ HE. CryptoNets are capable of making predictions with high throughput but are limited in both the depth of the network they can support and the latency per prediction. Bourse et al. (2017) used a different HE scheme that allows fast bootstrapping which results in only linear penalty for additional layers in the network. However, it is slower per operation and therefore, the results they presented on the MNIST data-set use small models with significantly lower accuracy (see Table 1). Sanyal et al. (2018) argued that many of these methods leak information about the structure of the neuralnetwork that the service provider uses through the parameters of the encryption. They presented a method that leaks less information about the neural-network but their solution is orders of magnitude slower. Nevertheless, their solution has the nice benefit that it allows the service provider to change the network without requiring changes in the client side.
40
+
41
+ Other researchers proposed using different encryption schemes. For example, the Chameleon system (Riazi et al., 2018) uses MPC to demonstrate private predictions on MNIST and Juvekar et al. (2018) use a hybrid MPC-HE approach for the same task. Hardware based solutions were also proposed, for example, Tramer & Boneh (2018). Some of these approaches provide faster predictions which are, in some cases, more accurate, however, this comes with the cost of a using a lower level of security.
42
+
43
+ # 2 DATA REPRESENTATION
44
+
45
+ Feed-forward neural networks are functions that can be computed by an alternating sequence of linear transformations and non-linear transformations. Linear transformations include dense, convolution layers and average pooling layers. Non-linear transformations include activation functions and max pooling layers. In most cases, we can consider this sequence to be alternating between linear transformations and non-linear ones since consecutive linear transformations can be combined into a single linear transformation and sequences of non-linear transformations can be merged as well.
46
+
47
+ For most of this work, we restrict the non-linear transformations to the square activation function. This follows CryptoNets (Dowlin et al., 2016) that showed that high accuracy can be achieved even with this restriction. We demonstrate this again on the CIFAR data-set in Section 4. Recall that HE supports point-wise multiplication of vectors and therefore it is straight-forward to implement the square activation function.
48
+
49
+ The main linear transformations we consider are dot-products and matrix-vector multiplications. Given two vectors, we can implement a dot product between two vectors whose size is a power of 2 by first applying point-wise multiplication between the two vectors and then a series of $\log n$ rotations of size $1 , 2 , 4 , \ldots , n / 2$ and addition between each rotation. The result of such a dot product operation is a vector that holds the results of the dot-product in all its coordinates.3
50
+
51
+ The dot-product operation can induce a change in representations. For example, given a weights matrix and an input vector represented as a single message, we can multiply the matrix by the vector using $r$ dot-product operations where $r$ is the number of rows in the matrix. The result of this operation is a vector of length $r$ that is spread across $r$ messages. Therefore, the result has a different representation than the representation of the input vector. Different representations can induce different computational costs and therefore choosing the right representations throughout the computation is important for computational efficiency. It is possible to change representations but this requires additional computational steps. Instead, we propose using various representations in the network inference. We start our discussion by presenting different possible vector representations.
52
+
53
+ # 2.1 VECTOR REPRESENTATIONS
54
+
55
+ Recall that a message in HE can be thought of as a vector of length $n$ of elements in $\mathbb { Z } _ { p }$ . For the sake of brevity, we assume that the dimension of the vector $\mathbf { v }$ to be encoded is of length $k$ such that $k \leq n$ , for otherwise multiple messages can be combined. For any vector $\mathbf { u }$ we denote by $u _ { i }$ its $i ^ { \mathrm { { t h } } }$ coordinate.
56
+
57
+ 2.1.1 Dense representation: A vector $\mathbf { v }$ is represented as a single message m by setting $v _ { i } \mapsto m _ { i }$
58
+
59
+ 2.1.2 Sparse representation: A vector $\mathbf { v }$ of length $k$ is represented in $k$ messages $\mathbf { m } ^ { 1 } , \ldots . \mathbf { m } ^ { k }$ such that $\mathbf { m } ^ { i }$ is a vector in which every coordinate is set to $v _ { i }$ .4
60
+
61
+ 2.1.3 Stacked representation: For a short (low dimension) vector $\mathbf { v }$ , the stacked representation holds several copies of the vector $\mathbf { v }$ in a single message m. Typically this will be done by finding $d = \lceil \log \left( k \right) \rceil$ , the smallest $d$ such that the dimension of $\mathbf { v }$ is at most $2 ^ { d }$ and setting $m _ { i } , m _ { i + 2 ^ { d } } , m _ { i + 2 \cdot 2 ^ { d } } , . . . = v _ { i }$ .
62
+
63
+ 2.1.4 Interleaved representation: The interleaved representation uses a permutation $\sigma$ of $[ 1 , \ldots , n ]$ to set $m _ { \sigma ( i ) } = v _ { i }$ . The dense representation can be viewed as a special case of the interleaved representation where $\sigma$ is the identity permutation.
64
+
65
+ 2.1.5 Convolution representation: This is a special representation that makes convolution operations efficient. A convolution, when flattened to a single dimension, can be viewed as a restricted linear operation where there is a weight vector w of length $r$ (the window size) and a set of permutations $\sigma _ { i }$ such that the $\overrightarrow { \imath } ^ { \prime }$ ’th output of the linear transformation is $\textstyle \sum _ { j } w _ { j } v _ { \sigma _ { i } ( j ) }$ . The convolution representation takes a vector $v$ and represents it as $r$ messages $\mathbf { m } ^ { 1 } , \ldots , \mathbf { m } ^ { r }$ such that $m _ { i } ^ { j } = v _ { \sigma _ { i } ( j ) }$ . 5
66
+
67
+ 2.1.6 SIMD representation: CryptoNets (Dowlin et al., 2016) represent each data element as a separate message but maps multiple data vectors into the same set of messages. More details about this representation are in Appendix B.
68
+
69
+ # 2.2 MATRIX-VECTOR MULTIPLICATIONS
70
+
71
+ Matrix-vector multiplication is a core operation in neural networks. The matrix may contain the learned weights of the network and the vector represents the values of the nodes at a certain layer. Here we present different ways to implement such matrix-vector operations. Each method operates on vectors in different representations and produces output in yet another representation. Furthermore, the weight matrix has to be represented appropriately as a set of vectors, either column-major or row-major to allow the operation. We assume that the matrix $W$ has $k$ columns $\mathbf { c } ^ { 1 } , \ldots , \mathbf { c } ^ { k }$ and $r$ rows $\mathbf { r } ^ { 1 } , \ldots , \mathbf { r } ^ { r }$ .
72
+
73
+ 2.2.1 Dense Vector – Row Major: If the vector is given as a dense vector and each row $\mathbf { r } ^ { j }$ of the weight matrix is encoded as a dense vector then the matrix-vector multiplication can be applied using $r$ dot-product operations. As already described above, a dot-product requires a single multiplication and $\log \left( n \right)$ additions and rotations. The result is a sparse vector of length $r$ .
74
+
75
+ 2.2.2 Sparse Vector – Column Major: Recall that $W \mathbf { v } = \sum v _ { i } \mathbf { c } ^ { i }$ . Therefore, when $\mathbf { v }$ is encoded in a sparse format, the message $\mathbf { m } ^ { i }$ has all its coordinate set to $v _ { i }$ and $v _ { i } \mathbf { c } ^ { i }$ can be computed using a single point-wise multiplication. Therefore, $W \mathbf { v }$ can be computed using $k$ multiplications and additions and the result is a dense vector.
76
+
77
+ 2.2.3 Stacked Vector – Row Major: For the sake of clarity, assume that $k = 2 ^ { d }$ for some $d$ . In this case $n / k$ copies of $\mathbf { v }$ can be stacked in a single message $\mathbf { m }$ (this operation requires $\log { ( n / k ) } - 1$ rotations and additions). By concatenating $n / k$ rows of $W$ into a single message a special version of the dot-product operation can be used to compute $n / k$ elements of $W \mathbf { v }$ at once. First, a pointwise multiplication of the stacked vector and the concatenated rows is applied followed by $d - 1$ rotations and additions where the rotations are of size $1 , 2 , \ldots , 2 ^ { d - 1 }$ . The result is in the interleaved representation.6
78
+
79
+ The Stacked Vector - Row Major gets its efficiency from two places. First, the number of modified dot product operations is $\left. r k \right/ n$ and each dot product operation requires a single multiplication and second, only $d$ rotations and additions (compared to $\log n$ rotations and additions in the standard dot-product procedure).
80
+
81
+ 2.2.4 Interleaved Vector – Row Major: This setting is very similar to the dense vector – row major matrix multiplication procedure with the only difference being that the columns of the matrix have to be shuffled to match the permutation of the interleaved representation of the vector. The result is in sparse format.
82
+
83
+ 2.2.5 Convolution vector – Row Major: A convolution layer applies the same linear transformation to different locations on the data vector v. For the sake of brevity, assume the transformation is one-dimensional. In neural network language that would mean that the kernel has a single map. Obviously, if more maps exist, then the process described here can be repeated multiple times.
84
+
85
+ Recall that a convolution, when flattened to a single dimension, is a restricted linear operation where the weight vector w is of length $r$ , and there exists a set of permutations $\sigma _ { i }$ such that the $\ddot { \iota }$ ’th output of the linear transformation is $\sum w _ { j } v _ { \sigma _ { i } ( j ) }$ . In this case, the convolution representation is made of $r$ messages such that the $\ddot { \iota }$ ’th element in the message $\mathbf { m } ^ { j }$ is $v _ { \sigma _ { i } ( j ) }$ . By using a sparse representation of the vector w, we get that $\sum w _ { j } \mathbf { m } ^ { j }$ computes the set of required outputs using $r$ multiplications and additions. When the weights are not encrypted, the multiplications used here are relatively cheap since the weights are scalar and BFV supports fast implementation of multiplying a message by a scalar. The result of this operation is in a dense format.
86
+
87
+ # 3 SECURE NETWORKS FOR MNIST
88
+
89
+ The neural network used for the MNIST data-set (LeCun et al., 2010) is the same network used by CryptoNets (Dowlin et al., 2016). After suppressing adjacent linear layers it can be presented as a $5 \times 5$ convolution layer with a stride of $( 2 , 2 )$ and 5 output maps, which is followed by a square activation function that feeds a fully connected layer with 100 output maps, another square activation and another fully connected layer with 10 outputs (see Figure 2 in the appendix).
90
+
91
+ The baseline implementation uses the techniques presented in CryptoNets in Table 1. Recall that CryptoNets use the SIMD representation (Section 2.1.6) in which each pixel requires its own message. Therefore, since each image in the MNIST data-set is made of an array of $2 8 \times 2 8$ pixels, the input to the CryptoNets network is made of 784 messages. On the reference machine used for this work (Azure standard B8ms virtual machine with 8 vCPUs and 32GB of ram) the original CryptoNets implementation runs in 205 seconds. Re-implementing it to use better memory management and multi-threading in SEAL 2.3 reduces the running time to 24.8 seconds. Since this implementation allows batching of 8192 images to be processed simultaneously, it has a potential throughput of 1189161 predictions per hour which is, as far as we know, the highest throughput reported on this task by a large margin.
92
+
93
+ While CryptoNets provide high throughput, in many cases, it is hard to utilize this high throughput which requires batching together 8192 requests from sources that share the same secret key. If each user has only a single record to be predicted on, the throughput is governed by the latency and therefore, we move towards reducing latency. We do that by replacing the SIMD representation with other representations. As a result, throughput is sacrificed in favor of latency.
94
+
95
+ The Low-Latency CryptoNets (LoLa) uses the same network layout and has accuracy of $9 8 . 9 5 \%$ (see Table 2 for a summary of the data representations used by LoLa). However, it is implemented differently: the input to the network is a single dense message where the pixel values are mapped to coordinates in the encoded vector line after line . The first step in processing this message is breaking it into 25 messages corresponding to the 25 pixels in the convolution map to generate a convolution representation. Creating each message requires a single vector multiplication. This is performed by creating 25 masks. The first mask is a vector of zeros and ones that corresponds to a matrix of size $2 8 \times 2 8$ such that a one is in the $( i , j )$ coordinate if the $i , j$ pixel in the image appears as the upper left corner of the $5 \times 5$ window of the convolution layer. Multiplying point-wise the input vector by the mask creates the first message in the convolution representation as described in Section 2.1.5 hybrided with the interleaved representation as described in footnote 5. Similarly the other messages in the convolution representation are created. Note that all masks are shifts of each other which allows using the convolution representation-row major multiplication to implement the convolution layer (see Section 2.2.5). To do that, think of the 25 messages as a matrix and the weights of a map of the convolution layer as a sparse vector. Therefore, the outputs of the entire map can be computed using 25 multiplications (of each weight by the corresponding vector) and 24 additions. Note that there are 169 windows and all of them are computed simultaneously. However, the process repeats 5 times for the 5 maps of the convolution layer.
96
+
97
+ Table 1: MNIST performance comparison. Solutions are grouped by accuracy levels.
98
+
99
+ <table><tr><td>Method</td><td>Accuracy</td><td>Latency</td><td> Throughput</td><td></td></tr><tr><td>FHE-DiNN100</td><td>96.35%</td><td>1.65</td><td>2182</td><td>(Bourse et al., 2017)</td></tr><tr><td>LoLa-Small</td><td>96.92%</td><td>0.29</td><td>12500</td><td></td></tr><tr><td>CryptoNets</td><td>98.95%</td><td>250</td><td>58982</td><td>(Dowlin et al., 2016)</td></tr><tr><td>CryptoNets 2.3</td><td>98.95%</td><td>24.8</td><td>1189160</td><td></td></tr><tr><td>LoLa</td><td>98.95%</td><td>7.2</td><td>500</td><td></td></tr><tr><td>LoLa-Conv</td><td>98.95%</td><td>2.2</td><td>1636</td><td></td></tr></table>
100
+
101
+ The result of the convolution layer are 5 messages, each one of them contains 169 results. They are united into a single vector by rotating the messages such that they will not have active values in the same locations and summing the results. At this point, a single message holds all the 845 values (169 windows $\times 5$ maps). This vector is squared, using a single multiplication operation, to implement the activation function that follows the convolution layer. This demonstrates one of the main differences between CryptoNets and LoLa; In CryptoNets, the activation layer requires 845 multiplication operations, whereas in LoLa it is a single multiplication. Even if we add the manipulation of the vector to place all values in a single message, as described above, we add only 4 rotations and 4 additions which are still much fewer operations than in CryptoNets.
102
+
103
+ Next, we apply a dense layer with 100 maps. LoLa uses messages of size $n = 1 6 3 8 4$ where the 845 results of the previous layer, even though they are in interleaving representation, take fewer than 1024 dimensions. Therefore, 16 copies are stacked together which allows the use of the Stacked vector – Row Major multiplication method. This allows computing 16 out of the 100 maps in each operation and therefore, the entire dense layer is computed in 7 iterations resulting in 7 interleaved messages. By shifting the $i ^ { \mathrm { { t h } } }$ message by $i - 1$ positions, the active outputs in each of the messages are no longer in the same position and they are added together to form a single interleaved message that contains the 100 outputs. The following square activation requires a single point-wisemultiplication of this message. The final dense layer is applied using the Interleaved vector – Row Major method to generate 10 messages, each of which contains one of the 10 outputs.7
104
+
105
+ Overall, applying the entire network takes only 7.2 seconds on the same reference hardware which is $3 4 . 7 \times$ faster than CryptoNets and $3 . 4 \times$ faster than CryptoNets 2.3. This result can be further improved by changing the input to the network; Instead of taking as an input a dense representation of the image, the LoLa-Conv network takes as its input 25 messages which are the convolution representation of the image. This removes a processing step which saves time but also reduces the amount of noise accumulated during the computation and allows working with messages of size $n = 8 1 9 2$ , which further reduces the computation time.
106
+
107
+ The LoLa-Conv starts with a convolution vector – row major multiplication for each of the 5 maps of the convolution layer. The 5 dense output messages are joined together with a rotation and addition to form a single dense vector of 845 elements. This vector is squared using a single multiplication and 8 copies of the results are stacked before applying the dense layer as 13 rounds of Stacked vector – Row Major multiplication. The 13 vectors of interleaved results are rotated and added to form a single interleaved vector of results which is squared using a single multiplication. Finally, Interleaved vector – Row Major multiplication is used to obtain the final result. This version computes the entire network in only 2.2 seconds which is $3 . 3 \times$ faster than LoLa, $1 1 \times$ faster than CryptoNets 2.3 and $1 1 4 \times$ faster than CryptoNets. See Table 3 for a summary of the data representations used by LoLa-Conv.
108
+
109
+ Table 1 shows a summary of the performance of different methods and more details can be found in Appendix C. Bourse et al. (2017) showed faster results with similar security level, albeit with lower accuracy. To compare with that, LoLa-Small is similar to Lola-Conv but has only a convolution layer, square activation and a dense layer. This solution is more accurate than the networks used by Bourse et al. (2017) and at the same time it is $5 . 5 \times$ faster.
110
+
111
+ # 4 SECURE NETWORKS FOR CIFAR
112
+
113
+ The Cifar-10 data-set (Krizhevsky & Hinton, 2009) presents a more challenging task of recognizing one of 10 different types of objects in a small image. The neural network used has the following layout: the input is a $3 \times 3 2 \times 3 2$ image (i) $3 \times 3$ linear convolution with stride of $( 1 , 1 )$ and 128 output maps, (ii) $2 \times 2$ average pooling with $( 2 , 2 )$ stride (iii) $3 \times 3$ convolution with $( 1 , 1 )$ stride and 83 maps (iv) Square activation (v) $2 \times 2$ average pooling with $( 2 , 2 )$ stride (vi) $3 \times 3$ convolution with $( 1 , 1 )$ stride and 163 maps (vii) Square activation (vii) $2 \times 2$ average pooling with stride $( 2 , 2 )$ (viii) fully connected layer with 1024 outputs (ix) fully connected layer with 10 outputs $\mathbf { \tau } ( \mathbf { x } )$ softmax. ADAM was used for optimization (Kingma & Ba, 2014) together with dropouts after layers (vii) and (viii). We use zero-padding in layers (i) and (vii). See Figure 3 for an illustration of the network.
114
+
115
+ For inference, adjacent linear layers were collapsed to form the following structure: (i) $8 \times 8 \times 3$ convolutions with a stride of $( 2 , 2 , 0 )$ and 83 maps (ii) square activation (iii) $6 \times 6 \times 8 3$ convolution with stride $( 2 , 2 , 0 )$ and 163 maps (iv) square activation (v) dense layer with 10 output maps. This network is much larger than the network used for MNIST by CryptoNets. The input to the CIFAR network has 3072 nodes, the first hidden layer has 16268 nodes and the second hidden layer has 4075 nodes (compared to 784, 845, and 100 nodes respectively for MNIST).8 The accuracy of this network is $7 4 . 1 \%$ and it uses plain-text modulus $p = 2 1 4 8 7 2 8 8 3 3 \times 2 1 4 8 7 9 4 3 6 9 \times 2 1 4 9 8 1 0 1 7 7$ (the factors are combined using the Chinese Reminder Theorem) and $n = 1 6 3 8 4$ . See Figure 4 for an illustration of this network.
116
+
117
+ Due to the sizes of the hidden layers, implementing this network with SIMD representation requires more memory than available on the reference machine, since the SIMD representation requires a message for each node in each layer. Therefore, we used the LoLa-Conv approach to implement this network. The image is encoded using the convolution representation into $3 \times 8 \times 8 = 1 9 2$ messages. The convolution layer is implemented using the convolution vector – row major matrixvector multiplication technique. The results are combined into a single message using rotations and additions which allows the square activation to be performed with a single point-wise multiplication. The second convolution layer is performed using row major-dense vector multiplication. Although this layer is a convolution layer, each window of the convolution is so large that it is more efficient to implement it as a dense layer. The output is a sparse vector which is converted into a dense vector by point-wise multiplications and additions which allows the second square activation to be performed with a single point-wise multiplication. The last dense layer is implemented with a row major-dense vector technique again resulting in a sparse output.
118
+
119
+ Executing this network takes 730 seconds out of which the second layer consumes 711 seconds. Therefore, for this task the bottleneck in performance is the sizes of the weight matrices and data vectors as evident by the number of parameters which is $< \ 9 0 , 0 0 0$ in the MNIST network and $> 5 0 0 , 0 0 0$ in the CIFAR network. In the following section we present an approach to mitigate this problem.
120
+
121
+ # 5 APPLYING DEEP NETS USING DEEP REPRESENTATIONS
122
+
123
+ Homomorphic Encryption has two main limitations when used for evaluating deep networks: noise growth and message size growth. Noise growth is a result of the number of operations that has to take place. Each such operation increases the noise in the encrypted message and when this noise becomes too large, it is no longer possible to decrypt the message correctly. This problem can be mitigated using bootstrapping, while taking a performance hit. The message size grows with the size of the network as well. Since, in its core, the HE scheme operates in $\mathbb { Z } _ { p }$ , the parameter $p$ has to be selected such that the largest number obtained during computation would be smaller than $p$ . Since every multiplication might double the required size of $p$ , it has to grow exponentially with respect to the number of layers in the network. The recently introduced HEAAN scheme (Cheon et al., 2017) is more tolerant towards message growth but even HEAAN would not be able to operate efficiently on very deep networks.
124
+
125
+ We propose solving both the message growth and the noise growth problems using deep representations. Instead of encrypting the data in its raw format, it is first converted, by a standard network, to create a deep representation. For example, if the data is an image, then instead of encrypting the image as an array of pixels, a network, such as AlexNet (Krizhevsky et al., 2012), VGG (Simonyan & Zisserman, 2014), or ResNet (He et al., 2016), first extracts a deep representation of the image, using one of its last layers. The resulting representation is encrypted and sent for evaluation. This approach has several advantages. First, this representation is small even if the original image is large. Moreover, with deep representations it is possible to obtain high accuracies using shallow networks: in most cases a linear predictor is sufficient which translates to a fast evaluation with HE. It is also a very natural thing to do since in many cases of interest, such as in medical image, training a very deep network from scratch is almost impossible since data is scarce. Hence, it is a common practice to use deep representation and train only the top layer(s) (Yosinski et al., 2014).
126
+
127
+ To test the deep representation approach we used AlexNet (Krizhevsky et al., 2012) to generate features and trained a linear model to make predictions on the CalTech-101 data-set (Fei-Fei et al., 2006).9 See Table 4 for a summary of the data representations used for the CalTech-101 dataset. Since the CalTech-101 dataset is not class balanced, we used only the first 30 images from each class where the first 20 where used for training and the other 10 examples where used for testing. The obtained model has class-balanced accuracy of $7 5 . 7 \%$ . The inference time, on the encrypted data, takes only 0.178 seconds when using the dense vector – row major multiplication.
128
+
129
+ # 6 CONCLUSIONS
130
+
131
+ The problem of privacy in machine learning is gaining importance due to legal requirements and greater awareness to the benefits and risks of machine learning systems. The task of private inference, specifically with neural networks, serves as a benchmark and catalyst to promote further study in this domain. In this work, we showed how data representations can be used to accelerate private predictions using Homomorphic Encryption. We demonstrated both the ability to operate on more complex networks as well as lower latency on networks that were already studied in the past.
132
+
133
+ Some of the methods we propose require precomputation on the client side. In many cases, HE is presented as a method to offload computation from a power-limited client to the cloud. However, this is not the only reason to use privacy preserving prediction services: in some applications the data is sensitive while the service provider is not willing to share the model which may be a result of a costly development process. In these cases, the techniques we present here allow the provider to offer its services while respecting the privacy of data.
134
+
135
+ # REFERENCES
136
+
137
+ Martin Albrecht, Melissa Chase, Hao Chen, Jintai Ding, Shafi Goldwasser, Sergey Gorbunov, Jeffrey Hoffstein, Kristin Lauter, Satya Lokam, Daniele Micciancio, et al. Homomorphic encryption standard. 2018.
138
+
139
+ Florian Bourse, Michele Minelli, Matthias Minihold, and Pascal Paillier. Fast homomorphic evaluation of deep discretized neural networks. Technical report, Cryptology ePrint Archive, Report 2017/1114, 2017.
140
+
141
+ Zvika Brakerski and Vinod Vaikuntanathan. Efficient fully homomorphic encryption from (standard) lwe. SIAM Journal on Computing, 43(2):831–871, 2014.
142
+
143
+ Zvika Brakerski, Craig Gentry, and Vinod Vaikuntanathan. (leveled) fully homomorphic encryption without bootstrapping. ACM Transactions on Computation Theory (TOCT), 6(3):13, 2014.
144
+
145
+ Guoxing Chen, Sanchuan Chen, Yuan Xiao, Yinqian Zhang, Zhiqiang Lin, and Ten H Lai. Sgxpectre attacks: Leaking enclave secrets via speculative execution. arXiv preprint arXiv:1802.09085, 2018.
146
+
147
+ Jung Hee Cheon, Andrey Kim, Miran Kim, and Yongsoo Song. Homomorphic encryption for arithmetic of approximate numbers. In International Conference on the Theory and Application of Cryptology and Information Security, pp. 409–437. Springer, 2017.
148
+
149
+ Nathan Dowlin, Ran Gilad-Bachrach, Kim Laine, Kristin Lauter, Michael Naehrig, and John Wernsing. Cryptonets: Applying neural networks to encrypted data with high throughput and accuracy. In International Conference on Machine Learning, pp. 201–210, 2016.
150
+
151
+ Nathan Dowlin, Ran Gilad-Bachrach, Kim Laine, Kristin Lauter, Michael Naehrig, and John Wernsing. Manual for using homomorphic encryption for bioinformatics. Proceedings of the IEEE, 105 (3):552–567, 2017.
152
+
153
+ Junfeng Fan and Frederik Vercauteren. Somewhat practical fully homomorphic encryption. IACR Cryptology ePrint Archive, 2012:144, 2012.
154
+
155
+ Li Fei-Fei, Rob Fergus, and Pietro Perona. One-shot learning of object categories. IEEE transactions on pattern analysis and machine intelligence, 28(4):594–611, 2006.
156
+
157
+ Craig Gentry. Fully homomorphic encryption using ideal lattices. In STOC, volume 9, pp. 169–178, 2009.
158
+
159
+ Oded Goldreich, Silvio Micali, and Avi Wigderson. How to play any mental game. In Proceedings of the nineteenth annual ACM symposium on Theory of computing, pp. 218–229. ACM, 1987.
160
+
161
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 770–778, 2016.
162
+
163
+ Chiraag Juvekar, Vinod Vaikuntanathan, and Anantha Chandrakasan. Gazelle: A low latency framework for secure neural network inference. arXiv preprint arXiv:1801.05507, 2018.
164
+
165
+ Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
166
+
167
+ Esmaeil Mohammadian Koruyeh, Khaled Khasawneh, Chengyu Song, and Nael Abu-Ghazaleh. Spectre returns! speculation attacks using the return stack buffer. In 12th USENIX Workshop on Offensive Technologies (WOOT 18). USENIX Association, 2018.
168
+
169
+ Alex Krizhevsky and Geoffrey Hinton. Learning multiple layers of features from tiny images. Technical report, Citeseer, 2009.
170
+
171
+ Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton. Imagenet classification with deep convolutional neural networks. In Advances in neural information processing systems, pp. 1097–1105, 2012.
172
+
173
+ Yann LeCun, Corinna Cortes, and Christopher JC Burges. Mnist handwritten digit database. at&t labs, 2010.
174
+
175
+ Frank McKeen, Ilya Alexandrovich, Alex Berenzon, Carlos V Rozas, Hisham Shafi, Vedvyas Shanbhogue, and Uday R Savagaonkar. Innovative instructions and software model for isolated execution. HASP@ ISCA, 10, 2013.
176
+
177
+ M Sadegh Riazi, Christian Weinert, Oleksandr Tkachenko, Ebrahim M Songhori, Thomas Schneider, and Farinaz Koushanfar. Chameleon: A hybrid secure computation framework for machine learning applications. In Proceedings of the 2018 on Asia Conference on Computer and Communications Security, pp. 707–721. ACM, 2018.
178
+
179
+ Amartya Sanyal, Matt J Kusner, Adrià Gascón, and Varun Kanade. Tapas: Tricks to accelerate (encrypted) prediction as a service. arXiv preprint arXiv:1806.03461, 2018.
180
+
181
+ Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. arXiv preprint arXiv:1409.1556, 2014.
182
+
183
+ Florian Tramer and Dan Boneh. Slalom: Fast, verifiable and private execution of neural networks in trusted hardware. arXiv preprint arXiv:1806.03287, 2018.
184
+
185
+ Andrew C Yao. Protocols for secure computations. In Foundations of Computer Science, 1982. SFCS’08. 23rd Annual Symposium on, pp. 160–164. IEEE, 1982.
186
+
187
+ Jason Yosinski, Jeff Clune, Yoshua Bengio, and Hod Lipson. How transferable are features in deep neural networks? In Advances in neural information processing systems, pp. 3320–3328, 2014.
188
+
189
+ # A ROTATIONS
190
+
191
+ For the rotation operation in the BFV encryption scheme it is easier to think of the message as a $2 \times n / 2$ matrix:
192
+
193
+ $$
194
+ \left[ \begin{array} { c c c c c } { { m _ { 1 } } } & { { m _ { 2 } } } & { { \cdot } } & { { \cdot } } & { { m _ { n / 2 } } } \\ { { m _ { n / 2 + 1 } } } & { { m _ { n / 2 + 2 } } } & { { \cdot } } & { { \cdot } } & { { m _ { n } } } \end{array} \right]
195
+ $$
196
+
197
+ with this representation in mind, there are two rotations allowed, one switches the row, which will turn the above matrix to
198
+
199
+ $$
200
+ \left[ \begin{array} { c c c c c c } { { m _ { n / 2 + 1 } } } & { { m _ { n / 2 + 2 } } } & { { . } } & { { . } } & { { m _ { n } } } \\ { { m _ { 1 } } } & { { m _ { 2 } } } & { { . } } & { { . } } & { { m _ { n / 2 } } } \end{array} \right]
201
+ $$
202
+
203
+ and the other rotates the columns. For example, rotating the original matrix by one column to the right will result in
204
+
205
+ $$
206
+ \left[ \begin{array} { c c c c c c } { { m _ { n / 2 } } } & { { m _ { 1 } } } & { { \cdot } } & { { \cdot } } & { { m _ { n / 2 - 1 } } } \\ { { m _ { n } } } & { { m _ { n / 2 + 1 } } } & { { \cdot } } & { { \cdot } } & { { m _ { n - 1 } } } \end{array} \right] ~ .
207
+ $$
208
+
209
+ Since $n$ is a power of two, and the rotations we are interested in are powers of two as well, for the sake of this work, thinking about the rotations as simple rotations of the elements in the message yields similar results. In this view, the row-rotation is a rotation of size $n / 2$ and smaller rotations are achieved by column rotations.
210
+
211
+ # B THE SIMD REPRESENTATION
212
+
213
+ The vector structure of messages used by CryptoNets allow parallel execution over multiple data simultaneously. CryptoNets takes $n$ input vectors $\mathbf { v } ^ { 1 } , \ldots , \mathbf { v } ^ { n }$ and creates a dense representation in which these $n$ messages of length $k$ are encoded in $k$ messages $\mathbf { m } ^ { 1 } , \ldots , \mathbf { m } ^ { k }$ such that $\begin{array} { r } { m _ { i } ^ { j } = v _ { j } ^ { i } } \end{array}$ . All operations between vectors and matrices are implemented using additions and multiplications only. For example, a dot product between two vectors of length $k$ is implemented by $k$ multiplications and additions. Therefore, it acts as a sparse representation.
214
+
215
+ The advantage of this representation, which we call the SIMD Representation, is that the cost of applying an operation to a vector is the same cost of applying the same operation to $n$ vectors, hence it supports the Single Instruction Multiple Data (SIMD) framework. However, it is costly in two ways: the computational complexity of multiplying a matrix of size $r \times k$ with a vector of length $k$ is $O \left( r k \right)$ HE operations, and the memory consumption is large as well since a vector of length $k$ requires $k$ messages. In this sense it is similar to the sparse representation. However, the ability to perform SIMD operations provides it with high throughput, much like the dense representation.
216
+
217
+ ![](images/e4ce767c918b9d1bba37640ebbb86be199f331c4033c5ec03f0ac36c453ce07a.jpg)
218
+ Figure 1: The latency of the different network implementations for the MNIST task with respect to the number of available cores. The right figure shows the ratio between the latency of each solution and the latency of the LoLa-Conv
219
+
220
+ # C PARALLEL SCALING
221
+
222
+ The performance of the different solutions is affected by the amount of parallelism allowed. The hardware used for experimentation in this work has 8 cores. Therefore, we tested the performance of the different solutions with 1, 2, 4, and 8 cores to see how the performance varies. The results of these experiments are presented in Figure 1. These results show that at least up to 8 cores the performance of all methods scales linearly when tested on the MNIST data-set. This suggests that the latency can be further improved by using machines with higher core count.
223
+
224
+ # D LOLA REPRESENTATION CHANGES
225
+
226
+ The following tables show the different stages that the data goes through when using LoLa. This illustrates how the different representations are used during the computation. Table 2 shows the process that LoLa applies, Table 3 shows the process for LoLa-Conv, and Table 4 shows the process for the method proposed for processing the CalTech-101 dataset.
227
+
228
+ ![](images/1728aad799d580b4c5d8d21741622977d51a87b761cfdbf7050a18b2a834e4cd.jpg)
229
+ Figure 2: The structure of the network used for MNIST classification
230
+
231
+ ![](images/8c9f08c727d2ca6e2dab44cd7216ffd2286781f902acc61bee2f0bfb3ce651c2.jpg)
232
+ Figure 3: The structure of the network used for CIFAR classification.
233
+
234
+ ![](images/d205b40d843399975727833c507901ad6d80eb0509576f662e64fff9e09153cc.jpg)
235
+ Figure 4: The structure of the network used for CIFAR classification after collapsing adjacent layers.
236
+
237
+ <table><tr><td rowspan=1 colspan=1>rrrrrireg</td><td rowspan=1 colspan=1>eserseopereseee</td><td rowspan=1 colspan=1>srsserts ereere or inter ree</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>oro nner sesessee s negigoe</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>serdoerr res</td><td rowspan=1 colspan=1>sesseauindino</td><td rowspan=1 colspan=1>oo oar sesesses engio</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1>rog indhno</td><td rowspan=1 colspan=1>dsues</td><td rowspan=1 colspan=1>Gorraiiirreinniiiiir</td><td rowspan=1 colspan=1>Trrereeiee</td><td rowspan=1 colspan=1>Trreaeeiee</td><td rowspan=1 colspan=1>Trreeeeee</td><td rowspan=1 colspan=1>Trrepiepereeee</td><td rowspan=1 colspan=1>Trreeeiee</td><td rowspan=1 colspan=1>Trreeeeee</td><td rowspan=1 colspan=1>Trrereeiee</td><td rowspan=1 colspan=1>Sssree</td></tr><tr><td rowspan=1 colspan=1>wtr sreer</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>oreri-ninior)uinnnirnos</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>(porarssrtrrt-etg</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>JIma-min</td></tr><tr><td rowspan=1 colspan=1>azs gndu</td><td rowspan=1 colspan=1>8</td><td rowspan=1 colspan=1>3</td><td rowspan=1 colspan=1>6912</td><td rowspan=1 colspan=1>691×</td><td rowspan=1 colspan=1>3</td><td rowspan=1 colspan=1>3</td><td rowspan=1 colspan=1>皖58×91</td><td rowspan=1 colspan=1>9×∠</td><td rowspan=1 colspan=1>100</td><td rowspan=1 colspan=1>100</td></tr><tr><td rowspan=1 colspan=1>Jaker</td><td rowspan=1 colspan=1>ropdkioug</td><td rowspan=1 colspan=3>Jrr grniniruirg x</td><td rowspan=1 colspan=1>Jrrrerenee</td><td rowspan=1 colspan=3>Jaer eseee</td><td rowspan=1 colspan=1>Jhrrreerrtt</td><td rowspan=1 colspan=1>Jareeseea</td></tr></table>
238
+
239
+ <table><tr><td rowspan=1 colspan=1>Brnreiieen</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>areserss oirpeidrrtesreree</td><td rowspan=1 colspan=1>sasessss oseep s ursr indin</td><td rowspan=1 colspan=1>ouo oinrseesseg oegqee</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>ssrdeeg reees</td><td rowspan=1 colspan=1>ssesssrr unindino</td><td rowspan=1 colspan=1>ono nner sesesseegr nerioioee</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1>Jror indino</td><td rowspan=1 colspan=1>conniinuio</td><td rowspan=1 colspan=1>Coonninuin</td><td rowspan=1 colspan=1>asuee</td><td rowspan=1 colspan=1>asues</td><td rowspan=1 colspan=1>esues</td><td rowspan=1 colspan=1>sseeee</td><td rowspan=1 colspan=1>Trreeiee</td><td rowspan=1 colspan=1>Trrereeene</td><td rowspan=1 colspan=1>Trrereeene</td><td rowspan=1 colspan=1>Ssrrre</td></tr><tr><td rowspan=1 colspan=1>Wrtrsraea</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>(ooorr-nuniir)uinnniruir</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>prrrrssrterets</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>JIii-mir</td></tr><tr><td rowspan=1 colspan=1>Jzis jndu</td><td rowspan=1 colspan=1>84</td><td rowspan=1 colspan=1>691397</td><td rowspan=1 colspan=1>69137</td><td rowspan=1 colspan=1>691×</td><td rowspan=1 colspan=1>5</td><td rowspan=1 colspan=1>5</td><td rowspan=1 colspan=1>8×8</td><td rowspan=1 colspan=1>8x1</td><td rowspan=1 colspan=1>10</td><td rowspan=1 colspan=1>10</td></tr><tr><td rowspan=1 colspan=1>Vaker</td><td rowspan=1 colspan=1>preeeeces</td><td rowspan=1 colspan=1>rrndrging</td><td rowspan=1 colspan=2>Jxrrr glnnninuirg x </td><td rowspan=1 colspan=1>Jreeaeeb</td><td rowspan=1 colspan=3>Jarer eseer</td><td rowspan=1 colspan=1>shrrrearett</td><td rowspan=1 colspan=1>Jaer saeaa</td></tr></table>
240
+
241
+ Table 4: LoLa-CalTech data representation changes. The table shows the different formats of the data during its evaluation with LoLa on the CalTech-101 dataset
242
+
243
+ <table><tr><td rowspan=1 colspan=1>Layer</td><td rowspan=1 colspan=1>Input size</td><td rowspan=1 colspan=1>Weights format</td><td rowspan=1 colspan=1>Output format</td><td rowspan=1 colspan=1>Description</td></tr><tr><td rowspan=1 colspan=1>Preprocess</td><td rowspan=1 colspan=1>200 ×300</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>dense</td><td rowspan=1 colspan=1> apply convolution layers from Alex-Net</td></tr><tr><td rowspan=1 colspan=1>Encryption</td><td rowspan=1 colspan=1>1000</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>dense</td><td rowspan=1 colspan=1> image is encrypted into 1 message</td></tr><tr><td rowspan=1 colspan=1>dense layer</td><td rowspan=1 colspan=1>1000</td><td rowspan=1 colspan=1>row-major</td><td rowspan=1 colspan=1>sparse</td><td></td></tr></table>
parse/train/rJl8viCqKQ/rJl8viCqKQ_content_list.json ADDED
@@ -0,0 +1,1384 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "type": "text",
4
+ "text": "LOW LATENCY PRIVACY PRESERVING INFERENCE ",
5
+ "text_level": 1,
6
+ "bbox": [
7
+ 176,
8
+ 98,
9
+ 776,
10
+ 121
11
+ ],
12
+ "page_idx": 0
13
+ },
14
+ {
15
+ "type": "text",
16
+ "text": "Anonymous authors Paper under double-blind review ",
17
+ "bbox": [
18
+ 183,
19
+ 145,
20
+ 400,
21
+ 172
22
+ ],
23
+ "page_idx": 0
24
+ },
25
+ {
26
+ "type": "text",
27
+ "text": "ABSTRACT ",
28
+ "text_level": 1,
29
+ "bbox": [
30
+ 454,
31
+ 210,
32
+ 544,
33
+ 224
34
+ ],
35
+ "page_idx": 0
36
+ },
37
+ {
38
+ "type": "text",
39
+ "text": "When applying machine learning to sensitive data one has to balance between accuracy, information leakage, and computational-complexity. Recent studies have shown that Homomorphic Encryption (HE) can be used for protecting against information leakage while applying neural networks. However, this comes with the cost of limiting the kind of neural networks that can be used (and hence the accuracy) and with latency of the order of several minutes even for relatively simple networks. In this study we improve on previous results both in the kind of networks that can be applied and in terms of the latency. Most of the improvement is achieved by novel ways to represent the data to make better use of the capabilities of the encryption scheme. ",
40
+ "bbox": [
41
+ 233,
42
+ 242,
43
+ 764,
44
+ 381
45
+ ],
46
+ "page_idx": 0
47
+ },
48
+ {
49
+ "type": "text",
50
+ "text": "1 INTRODUCTION ",
51
+ "text_level": 1,
52
+ "bbox": [
53
+ 176,
54
+ 411,
55
+ 336,
56
+ 428
57
+ ],
58
+ "page_idx": 0
59
+ },
60
+ {
61
+ "type": "text",
62
+ "text": "Machine learning is used in domains such as education, health, and finance in which data may be private or confidential. Therefore, machine learning algorithms should preserve privacy while making accurate predictions. The privacy requirement pertains to all sub-tasks of the learning process, such as training and inference. In this work, we focus on private neural-networks inference. In this problem, popularized by the work on CryptoNets (Dowlin et al., 2016), the goal is to build an inference service that can make predictions on private data. To achieve this goal, the data is encrypted before it is sent to the prediction service which should be capable of operating on the encrypted data without having access to the raw content. To allow that, several cryptology technologies have been proposed, including Secure Multi-Party Computation (MPC) (Yao, 1982; Goldreich et al., 1987), hardware enclaves, such as Intel’s Software Guard Extensions (SGX) (McKeen et al., 2013), Homomorphic Encryption (Gentry, 2009), and combinations of these techniques. ",
63
+ "bbox": [
64
+ 174,
65
+ 443,
66
+ 825,
67
+ 597
68
+ ],
69
+ "page_idx": 0
70
+ },
71
+ {
72
+ "type": "text",
73
+ "text": "The different approaches present different trade-offs in terms of computation, accuracy, and security. HE presents the most stringent security model. The security assumption relies on the hardness of solving a mathematical problem for which there are no known efficient algorithms, even in the presence of quantum computers (Gentry, 2009; Albrecht et al., 2018). Other techniques, such as MPC and SGX make additional assumptions and therefore provide a weaker sense of protection to the data (Yao, 1982; McKeen et al., 2013; Chen et al., 2018; Koruyeh et al., 2018). ",
74
+ "bbox": [
75
+ 174,
76
+ 603,
77
+ 825,
78
+ 686
79
+ ],
80
+ "page_idx": 0
81
+ },
82
+ {
83
+ "type": "text",
84
+ "text": "While HE provides the highest level of security it is also limited in the kind of operations it allows and the complexity of these operations (see Section 1.1). CryptoNets (Dowlin et al., 2016) was the first demonstration that it may be feasible to use HE to build privacy preserving Encrypted Prediction as a Service (EPaaS) solutions (Sanyal et al., 2018). CryptoNets are capable of making predictions with accuracy of $9 9 \\%$ on the MNIST task (LeCun et al., 2010) such that each prediction takes 250 seconds to complete. CryptoNets are also capable of packing 4096 prediction requests and operate on all of them in parallel which allows throughput of $\\sim 5 9 0 0 0$ predictions per hour. ",
85
+ "bbox": [
86
+ 174,
87
+ 694,
88
+ 825,
89
+ 791
90
+ ],
91
+ "page_idx": 0
92
+ },
93
+ {
94
+ "type": "text",
95
+ "text": "CryptoNets have several limitations that we address in this work, the first of them is latency. CryptoNets provide high throughput by operating on 4096 instances in parallel, however, all these instances have to come from a single source and use the same secret key. Therefore, this capability may be of little use in practice. Thus, we trade the high throughput in favor of low latency and show that the same neural network that was used by CryptoNets can be evaluated in as little as 2.2 seconds. We show that a part of this gain is an “engineering gain” which is a result of using a more recent implementation of HE. However, this “engineering gain” accounts for only $1 0 \\times$ speedup. Most of the speedup comes from a new way to represent data when applying neural-networks using HE which we call LoLa. In a nut-shell, CryptoNets represent each node in the neural network as a separate message for encryption, while LoLa encrypts entire layers which results in a $1 1 . 2 \\times$ speedup on top of the “engineering gain”. Together, these improvements results in a $1 1 4 \\times$ improvement in latency while maintaining the same level of security and accuracy.1 ",
96
+ "bbox": [
97
+ 174,
98
+ 797,
99
+ 823,
100
+ 924
101
+ ],
102
+ "page_idx": 0
103
+ },
104
+ {
105
+ "type": "text",
106
+ "text": "",
107
+ "bbox": [
108
+ 174,
109
+ 103,
110
+ 823,
111
+ 146
112
+ ],
113
+ "page_idx": 1
114
+ },
115
+ {
116
+ "type": "text",
117
+ "text": "LoLa provides another significant benefit over CryptoNets. Since CryptoNets encode every node in the network as a separate message, they create a memory bottleneck when applied to networks with many nodes. We demonstrate that in an experiment conducted on the CIFAR-10 dataset for which the CryptoNets approach fails to execute since it requires 100’s of Gigabytes of RAM. However, the low-latency approach, LoLa, which encodes layers instead of nodes, can make predictions in 12 minutes using only few Gigabytes of RAM. ",
118
+ "bbox": [
119
+ 174,
120
+ 152,
121
+ 825,
122
+ 236
123
+ ],
124
+ "page_idx": 1
125
+ },
126
+ {
127
+ "type": "text",
128
+ "text": "The experiment on CIFAR demonstrates that the LoLa approach can handle larger networks than CryptoNets. However, there is still a big penalty for the size of the network: predictions on MNIST are achieved in 2.2 seconds, and this latency jumps to 12 minutes for the slightly more complex task in the CIFAR-10 dataset. Therefore, it is reasonable to ask whether any of these approaches can scale to handle tasks such as analyzing large and complex images. To that extent, we propose another solution which represents the input to the network using semantically meaningful features instead of pixels. These semantically meaningful features are extracted using the convolution layers of standard networks such as AlexNet (Krizhevsky et al., 2012). We consider these networks as “standard libraries” for machine learning tasks. Using such features allows reducing the size of the message to be sent and the complexity of the network that is needed for classification. Indeed, we use this approach to demonstrate private predictions in 0.18 seconds on the CalTech-101 dataset with class balanced accuracy of $7 5 . 7 \\%$ . ",
129
+ "bbox": [
130
+ 173,
131
+ 243,
132
+ 825,
133
+ 410
134
+ ],
135
+ "page_idx": 1
136
+ },
137
+ {
138
+ "type": "text",
139
+ "text": "1.1 HOMOMORPHIC ENCRYPTION ",
140
+ "text_level": 1,
141
+ "bbox": [
142
+ 176,
143
+ 426,
144
+ 419,
145
+ 440
146
+ ],
147
+ "page_idx": 1
148
+ },
149
+ {
150
+ "type": "text",
151
+ "text": "In this work we use Homomorphic Encryptions (HE) to provide privacy (we refer the reader to Dowlin et al. (2017) for a more comprehensive introduction). HEs are encryptions that allow operating on data while it is encrypted without requiring access to the secret key (Gentry, 2009). The data used for encryption is assumed to be elements in a ring $\\mathcal { R }$ . On top of the encryption function $\\mathbb { E }$ and the decryption function $\\mathbb { D }$ , the HE scheme provides two additional operators $\\oplus$ and $\\otimes$ such that for any $x _ { 1 } , x _ { 2 } \\in \\mathcal { R }$ ",
152
+ "bbox": [
153
+ 173,
154
+ 452,
155
+ 825,
156
+ 536
157
+ ],
158
+ "page_idx": 1
159
+ },
160
+ {
161
+ "type": "equation",
162
+ "img_path": "images/a9a9f1d4ab39d5ea8307955be6977d547b4a5e79100f2d8cd25a38eff8ff4e5b.jpg",
163
+ "text": "$$\n\\begin{array} { r l } & { \\mathbb { D } \\left( \\mathbb { E } ( x _ { 1 } ) \\oplus \\mathbb { E } \\left( x _ { 2 } \\right) \\right) = x _ { 1 } + x _ { 2 } \\mathrm { ~ a n d ~ } } \\\\ & { \\mathbb { D } \\left( \\mathbb { E } \\left( x _ { 1 } \\right) \\otimes \\mathbb { E } \\left( x _ { 2 } \\right) \\right) = x _ { 1 } \\times x _ { 2 } } \\end{array}\n$$",
164
+ "text_format": "latex",
165
+ "bbox": [
166
+ 382,
167
+ 541,
168
+ 614,
169
+ 579
170
+ ],
171
+ "page_idx": 1
172
+ },
173
+ {
174
+ "type": "text",
175
+ "text": "where $^ +$ and $\\times$ are the standard addition and multiplication operations on the ring $\\mathcal { R }$ . Therefore, the $\\oplus$ and $\\otimes$ operators allow computing addition and multiplication operators on the data in its encrypted form and thus computing any polynomial function. ",
176
+ "bbox": [
177
+ 174,
178
+ 583,
179
+ 825,
180
+ 626
181
+ ],
182
+ "page_idx": 1
183
+ },
184
+ {
185
+ "type": "text",
186
+ "text": "Since Gentry’s seminal paper, in which he introduced the first HE scheme (Gentry, 2009), additional schemes have been proposed. In this work we use the Brakerski/Fan-Vercauteren scheme (BFV) (Fan & Vercauteren, 2012; Brakerski & Vaikuntanathan, 2014) as it is implemented in the SEAL library version 2.3.1.2 In this scheme, the ring on which the Homomorphic Encryption operates is $\\begin{array} { r } { \\mathcal { R } = \\frac { \\mathbb { Z } _ { p } [ x ] } { x ^ { n } + 1 } } \\end{array}$ where $\\begin{array} { r } { \\mathbb { Z } _ { p } = \\frac { \\mathbb { Z } } { p \\mathbb { Z } } } \\end{array}$ . If the parameters $p$ and $n$ are chosen such that there is an order $2 n$ root of unity in $\\mathbb { Z } _ { p }$ , then every element in can be viewed as a vector of dimension $n$ of elements in $\\mathbb { Z } _ { p }$ where addition and multiplication operate component-wise (Brakerski et al., 2014). In this view, the BFV scheme allows a another operation on the encrypted data: rotation. The ideal rotation operation of size $k$ sends the value in the $\\because$ ’th coordinate of a vector to the $( ( i + k )$ mod $n$ ) coordinate. The BFV scheme allows a slight modified version of the ideal rotation (see Appendix A) but for the sake of our discussion this detail is insignificant. ",
187
+ "bbox": [
188
+ 174,
189
+ 632,
190
+ 825,
191
+ 790
192
+ ],
193
+ "page_idx": 1
194
+ },
195
+ {
196
+ "type": "text",
197
+ "text": "1.2 RELATED WORK ",
198
+ "text_level": 1,
199
+ "bbox": [
200
+ 176,
201
+ 808,
202
+ 331,
203
+ 821
204
+ ],
205
+ "page_idx": 1
206
+ },
207
+ {
208
+ "type": "text",
209
+ "text": "The task of private predictions gained significant attention in recent years. Dowlin et al. (2016) presented CryptoNets which demonstrated the feasibility of private neural networks predictions using ",
210
+ "bbox": [
211
+ 176,
212
+ 833,
213
+ 820,
214
+ 861
215
+ ],
216
+ "page_idx": 1
217
+ },
218
+ {
219
+ "type": "text",
220
+ "text": "HE. CryptoNets are capable of making predictions with high throughput but are limited in both the depth of the network they can support and the latency per prediction. Bourse et al. (2017) used a different HE scheme that allows fast bootstrapping which results in only linear penalty for additional layers in the network. However, it is slower per operation and therefore, the results they presented on the MNIST data-set use small models with significantly lower accuracy (see Table 1). Sanyal et al. (2018) argued that many of these methods leak information about the structure of the neuralnetwork that the service provider uses through the parameters of the encryption. They presented a method that leaks less information about the neural-network but their solution is orders of magnitude slower. Nevertheless, their solution has the nice benefit that it allows the service provider to change the network without requiring changes in the client side. ",
221
+ "bbox": [
222
+ 173,
223
+ 103,
224
+ 825,
225
+ 242
226
+ ],
227
+ "page_idx": 2
228
+ },
229
+ {
230
+ "type": "text",
231
+ "text": "Other researchers proposed using different encryption schemes. For example, the Chameleon system (Riazi et al., 2018) uses MPC to demonstrate private predictions on MNIST and Juvekar et al. (2018) use a hybrid MPC-HE approach for the same task. Hardware based solutions were also proposed, for example, Tramer & Boneh (2018). Some of these approaches provide faster predictions which are, in some cases, more accurate, however, this comes with the cost of a using a lower level of security. ",
232
+ "bbox": [
233
+ 174,
234
+ 250,
235
+ 825,
236
+ 333
237
+ ],
238
+ "page_idx": 2
239
+ },
240
+ {
241
+ "type": "text",
242
+ "text": "2 DATA REPRESENTATION ",
243
+ "text_level": 1,
244
+ "bbox": [
245
+ 176,
246
+ 353,
247
+ 406,
248
+ 369
249
+ ],
250
+ "page_idx": 2
251
+ },
252
+ {
253
+ "type": "text",
254
+ "text": "Feed-forward neural networks are functions that can be computed by an alternating sequence of linear transformations and non-linear transformations. Linear transformations include dense, convolution layers and average pooling layers. Non-linear transformations include activation functions and max pooling layers. In most cases, we can consider this sequence to be alternating between linear transformations and non-linear ones since consecutive linear transformations can be combined into a single linear transformation and sequences of non-linear transformations can be merged as well. ",
255
+ "bbox": [
256
+ 174,
257
+ 383,
258
+ 825,
259
+ 481
260
+ ],
261
+ "page_idx": 2
262
+ },
263
+ {
264
+ "type": "text",
265
+ "text": "For most of this work, we restrict the non-linear transformations to the square activation function. This follows CryptoNets (Dowlin et al., 2016) that showed that high accuracy can be achieved even with this restriction. We demonstrate this again on the CIFAR data-set in Section 4. Recall that HE supports point-wise multiplication of vectors and therefore it is straight-forward to implement the square activation function. ",
266
+ "bbox": [
267
+ 174,
268
+ 488,
269
+ 823,
270
+ 558
271
+ ],
272
+ "page_idx": 2
273
+ },
274
+ {
275
+ "type": "text",
276
+ "text": "The main linear transformations we consider are dot-products and matrix-vector multiplications. Given two vectors, we can implement a dot product between two vectors whose size is a power of 2 by first applying point-wise multiplication between the two vectors and then a series of $\\log n$ rotations of size $1 , 2 , 4 , \\ldots , n / 2$ and addition between each rotation. The result of such a dot product operation is a vector that holds the results of the dot-product in all its coordinates.3 ",
277
+ "bbox": [
278
+ 174,
279
+ 565,
280
+ 825,
281
+ 635
282
+ ],
283
+ "page_idx": 2
284
+ },
285
+ {
286
+ "type": "text",
287
+ "text": "The dot-product operation can induce a change in representations. For example, given a weights matrix and an input vector represented as a single message, we can multiply the matrix by the vector using $r$ dot-product operations where $r$ is the number of rows in the matrix. The result of this operation is a vector of length $r$ that is spread across $r$ messages. Therefore, the result has a different representation than the representation of the input vector. Different representations can induce different computational costs and therefore choosing the right representations throughout the computation is important for computational efficiency. It is possible to change representations but this requires additional computational steps. Instead, we propose using various representations in the network inference. We start our discussion by presenting different possible vector representations. ",
288
+ "bbox": [
289
+ 174,
290
+ 642,
291
+ 825,
292
+ 767
293
+ ],
294
+ "page_idx": 2
295
+ },
296
+ {
297
+ "type": "text",
298
+ "text": "2.1 VECTOR REPRESENTATIONS ",
299
+ "text_level": 1,
300
+ "bbox": [
301
+ 176,
302
+ 784,
303
+ 406,
304
+ 796
305
+ ],
306
+ "page_idx": 2
307
+ },
308
+ {
309
+ "type": "text",
310
+ "text": "Recall that a message in HE can be thought of as a vector of length $n$ of elements in $\\mathbb { Z } _ { p }$ . For the sake of brevity, we assume that the dimension of the vector $\\mathbf { v }$ to be encoded is of length $k$ such that $k \\leq n$ , for otherwise multiple messages can be combined. For any vector $\\mathbf { u }$ we denote by $u _ { i }$ its $i ^ { \\mathrm { { t h } } }$ coordinate. ",
311
+ "bbox": [
312
+ 174,
313
+ 809,
314
+ 823,
315
+ 864
316
+ ],
317
+ "page_idx": 2
318
+ },
319
+ {
320
+ "type": "text",
321
+ "text": "2.1.1 Dense representation: A vector $\\mathbf { v }$ is represented as a single message m by setting $v _ { i } \\mapsto m _ { i }$ ",
322
+ "bbox": [
323
+ 173,
324
+ 103,
325
+ 823,
326
+ 118
327
+ ],
328
+ "page_idx": 3
329
+ },
330
+ {
331
+ "type": "text",
332
+ "text": "2.1.2 Sparse representation: A vector $\\mathbf { v }$ of length $k$ is represented in $k$ messages $\\mathbf { m } ^ { 1 } , \\ldots . \\mathbf { m } ^ { k }$ such that $\\mathbf { m } ^ { i }$ is a vector in which every coordinate is set to $v _ { i }$ .4 ",
333
+ "bbox": [
334
+ 174,
335
+ 136,
336
+ 821,
337
+ 166
338
+ ],
339
+ "page_idx": 3
340
+ },
341
+ {
342
+ "type": "text",
343
+ "text": "2.1.3 Stacked representation: For a short (low dimension) vector $\\mathbf { v }$ , the stacked representation holds several copies of the vector $\\mathbf { v }$ in a single message m. Typically this will be done by finding $d = \\lceil \\log \\left( k \\right) \\rceil$ , the smallest $d$ such that the dimension of $\\mathbf { v }$ is at most $2 ^ { d }$ and setting $m _ { i } , m _ { i + 2 ^ { d } } , m _ { i + 2 \\cdot 2 ^ { d } } , . . . = v _ { i }$ . ",
344
+ "bbox": [
345
+ 174,
346
+ 181,
347
+ 825,
348
+ 238
349
+ ],
350
+ "page_idx": 3
351
+ },
352
+ {
353
+ "type": "text",
354
+ "text": "2.1.4 Interleaved representation: The interleaved representation uses a permutation $\\sigma$ of $[ 1 , \\ldots , n ]$ to set $m _ { \\sigma ( i ) } = v _ { i }$ . The dense representation can be viewed as a special case of the interleaved representation where $\\sigma$ is the identity permutation. ",
355
+ "bbox": [
356
+ 173,
357
+ 253,
358
+ 823,
359
+ 295
360
+ ],
361
+ "page_idx": 3
362
+ },
363
+ {
364
+ "type": "text",
365
+ "text": "2.1.5 Convolution representation: This is a special representation that makes convolution operations efficient. A convolution, when flattened to a single dimension, can be viewed as a restricted linear operation where there is a weight vector w of length $r$ (the window size) and a set of permutations $\\sigma _ { i }$ such that the $\\overrightarrow { \\imath } ^ { \\prime }$ ’th output of the linear transformation is $\\textstyle \\sum _ { j } w _ { j } v _ { \\sigma _ { i } ( j ) }$ . The convolution representation takes a vector $v$ and represents it as $r$ messages $\\mathbf { m } ^ { 1 } , \\ldots , \\mathbf { m } ^ { r }$ such that $m _ { i } ^ { j } = v _ { \\sigma _ { i } ( j ) }$ . 5 ",
366
+ "bbox": [
367
+ 173,
368
+ 310,
369
+ 825,
370
+ 386
371
+ ],
372
+ "page_idx": 3
373
+ },
374
+ {
375
+ "type": "text",
376
+ "text": "2.1.6 SIMD representation: CryptoNets (Dowlin et al., 2016) represent each data element as a separate message but maps multiple data vectors into the same set of messages. More details about this representation are in Appendix B. ",
377
+ "bbox": [
378
+ 174,
379
+ 401,
380
+ 821,
381
+ 444
382
+ ],
383
+ "page_idx": 3
384
+ },
385
+ {
386
+ "type": "text",
387
+ "text": "2.2 MATRIX-VECTOR MULTIPLICATIONS ",
388
+ "text_level": 1,
389
+ "bbox": [
390
+ 176,
391
+ 462,
392
+ 465,
393
+ 476
394
+ ],
395
+ "page_idx": 3
396
+ },
397
+ {
398
+ "type": "text",
399
+ "text": "Matrix-vector multiplication is a core operation in neural networks. The matrix may contain the learned weights of the network and the vector represents the values of the nodes at a certain layer. Here we present different ways to implement such matrix-vector operations. Each method operates on vectors in different representations and produces output in yet another representation. Furthermore, the weight matrix has to be represented appropriately as a set of vectors, either column-major or row-major to allow the operation. We assume that the matrix $W$ has $k$ columns $\\mathbf { c } ^ { 1 } , \\ldots , \\mathbf { c } ^ { k }$ and $r$ rows $\\mathbf { r } ^ { 1 } , \\ldots , \\mathbf { r } ^ { r }$ . ",
400
+ "bbox": [
401
+ 173,
402
+ 487,
403
+ 825,
404
+ 585
405
+ ],
406
+ "page_idx": 3
407
+ },
408
+ {
409
+ "type": "text",
410
+ "text": "2.2.1 Dense Vector – Row Major: If the vector is given as a dense vector and each row $\\mathbf { r } ^ { j }$ of the weight matrix is encoded as a dense vector then the matrix-vector multiplication can be applied using $r$ dot-product operations. As already described above, a dot-product requires a single multiplication and $\\log \\left( n \\right)$ additions and rotations. The result is a sparse vector of length $r$ . ",
411
+ "bbox": [
412
+ 173,
413
+ 599,
414
+ 825,
415
+ 656
416
+ ],
417
+ "page_idx": 3
418
+ },
419
+ {
420
+ "type": "text",
421
+ "text": "2.2.2 Sparse Vector – Column Major: Recall that $W \\mathbf { v } = \\sum v _ { i } \\mathbf { c } ^ { i }$ . Therefore, when $\\mathbf { v }$ is encoded in a sparse format, the message $\\mathbf { m } ^ { i }$ has all its coordinate set to $v _ { i }$ and $v _ { i } \\mathbf { c } ^ { i }$ can be computed using a single point-wise multiplication. Therefore, $W \\mathbf { v }$ can be computed using $k$ multiplications and additions and the result is a dense vector. ",
422
+ "bbox": [
423
+ 173,
424
+ 671,
425
+ 825,
426
+ 729
427
+ ],
428
+ "page_idx": 3
429
+ },
430
+ {
431
+ "type": "text",
432
+ "text": "2.2.3 Stacked Vector – Row Major: For the sake of clarity, assume that $k = 2 ^ { d }$ for some $d$ . In this case $n / k$ copies of $\\mathbf { v }$ can be stacked in a single message $\\mathbf { m }$ (this operation requires $\\log { ( n / k ) } - 1$ rotations and additions). By concatenating $n / k$ rows of $W$ into a single message a special version of the dot-product operation can be used to compute $n / k$ elements of $W \\mathbf { v }$ at once. First, a pointwise multiplication of the stacked vector and the concatenated rows is applied followed by $d - 1$ rotations and additions where the rotations are of size $1 , 2 , \\ldots , 2 ^ { d - 1 }$ . The result is in the interleaved representation.6 ",
433
+ "bbox": [
434
+ 173,
435
+ 744,
436
+ 825,
437
+ 787
438
+ ],
439
+ "page_idx": 3
440
+ },
441
+ {
442
+ "type": "text",
443
+ "text": "",
444
+ "bbox": [
445
+ 174,
446
+ 103,
447
+ 823,
448
+ 159
449
+ ],
450
+ "page_idx": 4
451
+ },
452
+ {
453
+ "type": "text",
454
+ "text": "The Stacked Vector - Row Major gets its efficiency from two places. First, the number of modified dot product operations is $\\left. r k \\right/ n$ and each dot product operation requires a single multiplication and second, only $d$ rotations and additions (compared to $\\log n$ rotations and additions in the standard dot-product procedure). ",
455
+ "bbox": [
456
+ 174,
457
+ 166,
458
+ 825,
459
+ 222
460
+ ],
461
+ "page_idx": 4
462
+ },
463
+ {
464
+ "type": "text",
465
+ "text": "2.2.4 Interleaved Vector – Row Major: This setting is very similar to the dense vector – row major matrix multiplication procedure with the only difference being that the columns of the matrix have to be shuffled to match the permutation of the interleaved representation of the vector. The result is in sparse format. ",
466
+ "bbox": [
467
+ 174,
468
+ 237,
469
+ 825,
470
+ 292
471
+ ],
472
+ "page_idx": 4
473
+ },
474
+ {
475
+ "type": "text",
476
+ "text": "2.2.5 Convolution vector – Row Major: A convolution layer applies the same linear transformation to different locations on the data vector v. For the sake of brevity, assume the transformation is one-dimensional. In neural network language that would mean that the kernel has a single map. Obviously, if more maps exist, then the process described here can be repeated multiple times. ",
477
+ "bbox": [
478
+ 174,
479
+ 306,
480
+ 823,
481
+ 363
482
+ ],
483
+ "page_idx": 4
484
+ },
485
+ {
486
+ "type": "text",
487
+ "text": "Recall that a convolution, when flattened to a single dimension, is a restricted linear operation where the weight vector w is of length $r$ , and there exists a set of permutations $\\sigma _ { i }$ such that the $\\ddot { \\iota }$ ’th output of the linear transformation is $\\sum w _ { j } v _ { \\sigma _ { i } ( j ) }$ . In this case, the convolution representation is made of $r$ messages such that the $\\ddot { \\iota }$ ’th element in the message $\\mathbf { m } ^ { j }$ is $v _ { \\sigma _ { i } ( j ) }$ . By using a sparse representation of the vector w, we get that $\\sum w _ { j } \\mathbf { m } ^ { j }$ computes the set of required outputs using $r$ multiplications and additions. When the weights are not encrypted, the multiplications used here are relatively cheap since the weights are scalar and BFV supports fast implementation of multiplying a message by a scalar. The result of this operation is in a dense format. ",
488
+ "bbox": [
489
+ 174,
490
+ 369,
491
+ 825,
492
+ 486
493
+ ],
494
+ "page_idx": 4
495
+ },
496
+ {
497
+ "type": "text",
498
+ "text": "3 SECURE NETWORKS FOR MNIST ",
499
+ "text_level": 1,
500
+ "bbox": [
501
+ 176,
502
+ 505,
503
+ 483,
504
+ 521
505
+ ],
506
+ "page_idx": 4
507
+ },
508
+ {
509
+ "type": "text",
510
+ "text": "The neural network used for the MNIST data-set (LeCun et al., 2010) is the same network used by CryptoNets (Dowlin et al., 2016). After suppressing adjacent linear layers it can be presented as a $5 \\times 5$ convolution layer with a stride of $( 2 , 2 )$ and 5 output maps, which is followed by a square activation function that feeds a fully connected layer with 100 output maps, another square activation and another fully connected layer with 10 outputs (see Figure 2 in the appendix). ",
511
+ "bbox": [
512
+ 174,
513
+ 535,
514
+ 825,
515
+ 606
516
+ ],
517
+ "page_idx": 4
518
+ },
519
+ {
520
+ "type": "text",
521
+ "text": "The baseline implementation uses the techniques presented in CryptoNets in Table 1. Recall that CryptoNets use the SIMD representation (Section 2.1.6) in which each pixel requires its own message. Therefore, since each image in the MNIST data-set is made of an array of $2 8 \\times 2 8$ pixels, the input to the CryptoNets network is made of 784 messages. On the reference machine used for this work (Azure standard B8ms virtual machine with 8 vCPUs and 32GB of ram) the original CryptoNets implementation runs in 205 seconds. Re-implementing it to use better memory management and multi-threading in SEAL 2.3 reduces the running time to 24.8 seconds. Since this implementation allows batching of 8192 images to be processed simultaneously, it has a potential throughput of 1189161 predictions per hour which is, as far as we know, the highest throughput reported on this task by a large margin. ",
522
+ "bbox": [
523
+ 174,
524
+ 613,
525
+ 825,
526
+ 752
527
+ ],
528
+ "page_idx": 4
529
+ },
530
+ {
531
+ "type": "text",
532
+ "text": "While CryptoNets provide high throughput, in many cases, it is hard to utilize this high throughput which requires batching together 8192 requests from sources that share the same secret key. If each user has only a single record to be predicted on, the throughput is governed by the latency and therefore, we move towards reducing latency. We do that by replacing the SIMD representation with other representations. As a result, throughput is sacrificed in favor of latency. ",
533
+ "bbox": [
534
+ 174,
535
+ 758,
536
+ 825,
537
+ 828
538
+ ],
539
+ "page_idx": 4
540
+ },
541
+ {
542
+ "type": "text",
543
+ "text": "The Low-Latency CryptoNets (LoLa) uses the same network layout and has accuracy of $9 8 . 9 5 \\%$ (see Table 2 for a summary of the data representations used by LoLa). However, it is implemented differently: the input to the network is a single dense message where the pixel values are mapped to coordinates in the encoded vector line after line . The first step in processing this message is breaking it into 25 messages corresponding to the 25 pixels in the convolution map to generate a convolution representation. Creating each message requires a single vector multiplication. This is performed by creating 25 masks. The first mask is a vector of zeros and ones that corresponds to a matrix of size $2 8 \\times 2 8$ such that a one is in the $( i , j )$ coordinate if the $i , j$ pixel in the image appears as the upper left corner of the $5 \\times 5$ window of the convolution layer. Multiplying point-wise the input vector by the mask creates the first message in the convolution representation as described in Section 2.1.5 hybrided with the interleaved representation as described in footnote 5. Similarly the other messages in the convolution representation are created. Note that all masks are shifts of each other which allows using the convolution representation-row major multiplication to implement the convolution layer (see Section 2.2.5). To do that, think of the 25 messages as a matrix and the weights of a map of the convolution layer as a sparse vector. Therefore, the outputs of the entire map can be computed using 25 multiplications (of each weight by the corresponding vector) and 24 additions. Note that there are 169 windows and all of them are computed simultaneously. However, the process repeats 5 times for the 5 maps of the convolution layer. ",
544
+ "bbox": [
545
+ 176,
546
+ 835,
547
+ 821,
548
+ 863
549
+ ],
550
+ "page_idx": 4
551
+ },
552
+ {
553
+ "type": "table",
554
+ "img_path": "images/327615d0cfa5c76cee48797a59fd727b031f1ca3128cae9e7b959e809a506844.jpg",
555
+ "table_caption": [
556
+ "Table 1: MNIST performance comparison. Solutions are grouped by accuracy levels. "
557
+ ],
558
+ "table_footnote": [],
559
+ "table_body": "<table><tr><td>Method</td><td>Accuracy</td><td>Latency</td><td> Throughput</td><td></td></tr><tr><td>FHE-DiNN100</td><td>96.35%</td><td>1.65</td><td>2182</td><td>(Bourse et al., 2017)</td></tr><tr><td>LoLa-Small</td><td>96.92%</td><td>0.29</td><td>12500</td><td></td></tr><tr><td>CryptoNets</td><td>98.95%</td><td>250</td><td>58982</td><td>(Dowlin et al., 2016)</td></tr><tr><td>CryptoNets 2.3</td><td>98.95%</td><td>24.8</td><td>1189160</td><td></td></tr><tr><td>LoLa</td><td>98.95%</td><td>7.2</td><td>500</td><td></td></tr><tr><td>LoLa-Conv</td><td>98.95%</td><td>2.2</td><td>1636</td><td></td></tr></table>",
560
+ "bbox": [
561
+ 225,
562
+ 101,
563
+ 772,
564
+ 252
565
+ ],
566
+ "page_idx": 5
567
+ },
568
+ {
569
+ "type": "text",
570
+ "text": "",
571
+ "bbox": [
572
+ 174,
573
+ 309,
574
+ 825,
575
+ 531
576
+ ],
577
+ "page_idx": 5
578
+ },
579
+ {
580
+ "type": "text",
581
+ "text": "The result of the convolution layer are 5 messages, each one of them contains 169 results. They are united into a single vector by rotating the messages such that they will not have active values in the same locations and summing the results. At this point, a single message holds all the 845 values (169 windows $\\times 5$ maps). This vector is squared, using a single multiplication operation, to implement the activation function that follows the convolution layer. This demonstrates one of the main differences between CryptoNets and LoLa; In CryptoNets, the activation layer requires 845 multiplication operations, whereas in LoLa it is a single multiplication. Even if we add the manipulation of the vector to place all values in a single message, as described above, we add only 4 rotations and 4 additions which are still much fewer operations than in CryptoNets. ",
582
+ "bbox": [
583
+ 174,
584
+ 539,
585
+ 825,
586
+ 664
587
+ ],
588
+ "page_idx": 5
589
+ },
590
+ {
591
+ "type": "text",
592
+ "text": "Next, we apply a dense layer with 100 maps. LoLa uses messages of size $n = 1 6 3 8 4$ where the 845 results of the previous layer, even though they are in interleaving representation, take fewer than 1024 dimensions. Therefore, 16 copies are stacked together which allows the use of the Stacked vector – Row Major multiplication method. This allows computing 16 out of the 100 maps in each operation and therefore, the entire dense layer is computed in 7 iterations resulting in 7 interleaved messages. By shifting the $i ^ { \\mathrm { { t h } } }$ message by $i - 1$ positions, the active outputs in each of the messages are no longer in the same position and they are added together to form a single interleaved message that contains the 100 outputs. The following square activation requires a single point-wisemultiplication of this message. The final dense layer is applied using the Interleaved vector – Row Major method to generate 10 messages, each of which contains one of the 10 outputs.7 ",
593
+ "bbox": [
594
+ 174,
595
+ 670,
596
+ 825,
597
+ 809
598
+ ],
599
+ "page_idx": 5
600
+ },
601
+ {
602
+ "type": "text",
603
+ "text": "Overall, applying the entire network takes only 7.2 seconds on the same reference hardware which is $3 4 . 7 \\times$ faster than CryptoNets and $3 . 4 \\times$ faster than CryptoNets 2.3. This result can be further improved by changing the input to the network; Instead of taking as an input a dense representation of the image, the LoLa-Conv network takes as its input 25 messages which are the convolution representation of the image. This removes a processing step which saves time but also reduces the amount of noise accumulated during the computation and allows working with messages of size $n = 8 1 9 2$ , which further reduces the computation time. ",
604
+ "bbox": [
605
+ 174,
606
+ 816,
607
+ 823,
608
+ 886
609
+ ],
610
+ "page_idx": 5
611
+ },
612
+ {
613
+ "type": "text",
614
+ "text": "",
615
+ "bbox": [
616
+ 171,
617
+ 103,
618
+ 823,
619
+ 132
620
+ ],
621
+ "page_idx": 6
622
+ },
623
+ {
624
+ "type": "text",
625
+ "text": "The LoLa-Conv starts with a convolution vector – row major multiplication for each of the 5 maps of the convolution layer. The 5 dense output messages are joined together with a rotation and addition to form a single dense vector of 845 elements. This vector is squared using a single multiplication and 8 copies of the results are stacked before applying the dense layer as 13 rounds of Stacked vector – Row Major multiplication. The 13 vectors of interleaved results are rotated and added to form a single interleaved vector of results which is squared using a single multiplication. Finally, Interleaved vector – Row Major multiplication is used to obtain the final result. This version computes the entire network in only 2.2 seconds which is $3 . 3 \\times$ faster than LoLa, $1 1 \\times$ faster than CryptoNets 2.3 and $1 1 4 \\times$ faster than CryptoNets. See Table 3 for a summary of the data representations used by LoLa-Conv. ",
626
+ "bbox": [
627
+ 173,
628
+ 138,
629
+ 825,
630
+ 277
631
+ ],
632
+ "page_idx": 6
633
+ },
634
+ {
635
+ "type": "text",
636
+ "text": "Table 1 shows a summary of the performance of different methods and more details can be found in Appendix C. Bourse et al. (2017) showed faster results with similar security level, albeit with lower accuracy. To compare with that, LoLa-Small is similar to Lola-Conv but has only a convolution layer, square activation and a dense layer. This solution is more accurate than the networks used by Bourse et al. (2017) and at the same time it is $5 . 5 \\times$ faster. ",
637
+ "bbox": [
638
+ 174,
639
+ 285,
640
+ 825,
641
+ 354
642
+ ],
643
+ "page_idx": 6
644
+ },
645
+ {
646
+ "type": "text",
647
+ "text": "4 SECURE NETWORKS FOR CIFAR ",
648
+ "text_level": 1,
649
+ "bbox": [
650
+ 176,
651
+ 375,
652
+ 478,
653
+ 391
654
+ ],
655
+ "page_idx": 6
656
+ },
657
+ {
658
+ "type": "text",
659
+ "text": "The Cifar-10 data-set (Krizhevsky & Hinton, 2009) presents a more challenging task of recognizing one of 10 different types of objects in a small image. The neural network used has the following layout: the input is a $3 \\times 3 2 \\times 3 2$ image (i) $3 \\times 3$ linear convolution with stride of $( 1 , 1 )$ and 128 output maps, (ii) $2 \\times 2$ average pooling with $( 2 , 2 )$ stride (iii) $3 \\times 3$ convolution with $( 1 , 1 )$ stride and 83 maps (iv) Square activation (v) $2 \\times 2$ average pooling with $( 2 , 2 )$ stride (vi) $3 \\times 3$ convolution with $( 1 , 1 )$ stride and 163 maps (vii) Square activation (vii) $2 \\times 2$ average pooling with stride $( 2 , 2 )$ (viii) fully connected layer with 1024 outputs (ix) fully connected layer with 10 outputs $\\mathbf { \\tau } ( \\mathbf { x } )$ softmax. ADAM was used for optimization (Kingma & Ba, 2014) together with dropouts after layers (vii) and (viii). We use zero-padding in layers (i) and (vii). See Figure 3 for an illustration of the network. ",
660
+ "bbox": [
661
+ 174,
662
+ 406,
663
+ 825,
664
+ 532
665
+ ],
666
+ "page_idx": 6
667
+ },
668
+ {
669
+ "type": "text",
670
+ "text": "For inference, adjacent linear layers were collapsed to form the following structure: (i) $8 \\times 8 \\times 3$ convolutions with a stride of $( 2 , 2 , 0 )$ and 83 maps (ii) square activation (iii) $6 \\times 6 \\times 8 3$ convolution with stride $( 2 , 2 , 0 )$ and 163 maps (iv) square activation (v) dense layer with 10 output maps. This network is much larger than the network used for MNIST by CryptoNets. The input to the CIFAR network has 3072 nodes, the first hidden layer has 16268 nodes and the second hidden layer has 4075 nodes (compared to 784, 845, and 100 nodes respectively for MNIST).8 The accuracy of this network is $7 4 . 1 \\%$ and it uses plain-text modulus $p = 2 1 4 8 7 2 8 8 3 3 \\times 2 1 4 8 7 9 4 3 6 9 \\times 2 1 4 9 8 1 0 1 7 7$ (the factors are combined using the Chinese Reminder Theorem) and $n = 1 6 3 8 4$ . See Figure 4 for an illustration of this network. ",
671
+ "bbox": [
672
+ 174,
673
+ 537,
674
+ 825,
675
+ 662
676
+ ],
677
+ "page_idx": 6
678
+ },
679
+ {
680
+ "type": "text",
681
+ "text": "Due to the sizes of the hidden layers, implementing this network with SIMD representation requires more memory than available on the reference machine, since the SIMD representation requires a message for each node in each layer. Therefore, we used the LoLa-Conv approach to implement this network. The image is encoded using the convolution representation into $3 \\times 8 \\times 8 = 1 9 2$ messages. The convolution layer is implemented using the convolution vector – row major matrixvector multiplication technique. The results are combined into a single message using rotations and additions which allows the square activation to be performed with a single point-wise multiplication. The second convolution layer is performed using row major-dense vector multiplication. Although this layer is a convolution layer, each window of the convolution is so large that it is more efficient to implement it as a dense layer. The output is a sparse vector which is converted into a dense vector by point-wise multiplications and additions which allows the second square activation to be performed with a single point-wise multiplication. The last dense layer is implemented with a row major-dense vector technique again resulting in a sparse output. ",
682
+ "bbox": [
683
+ 174,
684
+ 670,
685
+ 825,
686
+ 851
687
+ ],
688
+ "page_idx": 6
689
+ },
690
+ {
691
+ "type": "text",
692
+ "text": "Executing this network takes 730 seconds out of which the second layer consumes 711 seconds. Therefore, for this task the bottleneck in performance is the sizes of the weight matrices and data vectors as evident by the number of parameters which is $< \\ 9 0 , 0 0 0$ in the MNIST network and $> 5 0 0 , 0 0 0$ in the CIFAR network. In the following section we present an approach to mitigate this problem. ",
693
+ "bbox": [
694
+ 176,
695
+ 858,
696
+ 821,
697
+ 886
698
+ ],
699
+ "page_idx": 6
700
+ },
701
+ {
702
+ "type": "text",
703
+ "text": "",
704
+ "bbox": [
705
+ 174,
706
+ 103,
707
+ 825,
708
+ 146
709
+ ],
710
+ "page_idx": 7
711
+ },
712
+ {
713
+ "type": "text",
714
+ "text": "5 APPLYING DEEP NETS USING DEEP REPRESENTATIONS ",
715
+ "text_level": 1,
716
+ "bbox": [
717
+ 176,
718
+ 174,
719
+ 665,
720
+ 190
721
+ ],
722
+ "page_idx": 7
723
+ },
724
+ {
725
+ "type": "text",
726
+ "text": "Homomorphic Encryption has two main limitations when used for evaluating deep networks: noise growth and message size growth. Noise growth is a result of the number of operations that has to take place. Each such operation increases the noise in the encrypted message and when this noise becomes too large, it is no longer possible to decrypt the message correctly. This problem can be mitigated using bootstrapping, while taking a performance hit. The message size grows with the size of the network as well. Since, in its core, the HE scheme operates in $\\mathbb { Z } _ { p }$ , the parameter $p$ has to be selected such that the largest number obtained during computation would be smaller than $p$ . Since every multiplication might double the required size of $p$ , it has to grow exponentially with respect to the number of layers in the network. The recently introduced HEAAN scheme (Cheon et al., 2017) is more tolerant towards message growth but even HEAAN would not be able to operate efficiently on very deep networks. ",
727
+ "bbox": [
728
+ 174,
729
+ 212,
730
+ 825,
731
+ 364
732
+ ],
733
+ "page_idx": 7
734
+ },
735
+ {
736
+ "type": "text",
737
+ "text": "We propose solving both the message growth and the noise growth problems using deep representations. Instead of encrypting the data in its raw format, it is first converted, by a standard network, to create a deep representation. For example, if the data is an image, then instead of encrypting the image as an array of pixels, a network, such as AlexNet (Krizhevsky et al., 2012), VGG (Simonyan & Zisserman, 2014), or ResNet (He et al., 2016), first extracts a deep representation of the image, using one of its last layers. The resulting representation is encrypted and sent for evaluation. This approach has several advantages. First, this representation is small even if the original image is large. Moreover, with deep representations it is possible to obtain high accuracies using shallow networks: in most cases a linear predictor is sufficient which translates to a fast evaluation with HE. It is also a very natural thing to do since in many cases of interest, such as in medical image, training a very deep network from scratch is almost impossible since data is scarce. Hence, it is a common practice to use deep representation and train only the top layer(s) (Yosinski et al., 2014). ",
738
+ "bbox": [
739
+ 174,
740
+ 371,
741
+ 825,
742
+ 537
743
+ ],
744
+ "page_idx": 7
745
+ },
746
+ {
747
+ "type": "text",
748
+ "text": "To test the deep representation approach we used AlexNet (Krizhevsky et al., 2012) to generate features and trained a linear model to make predictions on the CalTech-101 data-set (Fei-Fei et al., 2006).9 See Table 4 for a summary of the data representations used for the CalTech-101 dataset. Since the CalTech-101 dataset is not class balanced, we used only the first 30 images from each class where the first 20 where used for training and the other 10 examples where used for testing. The obtained model has class-balanced accuracy of $7 5 . 7 \\%$ . The inference time, on the encrypted data, takes only 0.178 seconds when using the dense vector – row major multiplication. ",
749
+ "bbox": [
750
+ 174,
751
+ 545,
752
+ 825,
753
+ 642
754
+ ],
755
+ "page_idx": 7
756
+ },
757
+ {
758
+ "type": "text",
759
+ "text": "6 CONCLUSIONS ",
760
+ "text_level": 1,
761
+ "bbox": [
762
+ 176,
763
+ 671,
764
+ 328,
765
+ 688
766
+ ],
767
+ "page_idx": 7
768
+ },
769
+ {
770
+ "type": "text",
771
+ "text": "The problem of privacy in machine learning is gaining importance due to legal requirements and greater awareness to the benefits and risks of machine learning systems. The task of private inference, specifically with neural networks, serves as a benchmark and catalyst to promote further study in this domain. In this work, we showed how data representations can be used to accelerate private predictions using Homomorphic Encryption. We demonstrated both the ability to operate on more complex networks as well as lower latency on networks that were already studied in the past. ",
772
+ "bbox": [
773
+ 174,
774
+ 708,
775
+ 823,
776
+ 791
777
+ ],
778
+ "page_idx": 7
779
+ },
780
+ {
781
+ "type": "text",
782
+ "text": "Some of the methods we propose require precomputation on the client side. In many cases, HE is presented as a method to offload computation from a power-limited client to the cloud. However, this is not the only reason to use privacy preserving prediction services: in some applications the data is sensitive while the service provider is not willing to share the model which may be a result of a costly development process. In these cases, the techniques we present here allow the provider to offer its services while respecting the privacy of data. ",
783
+ "bbox": [
784
+ 174,
785
+ 799,
786
+ 825,
787
+ 883
788
+ ],
789
+ "page_idx": 7
790
+ },
791
+ {
792
+ "type": "text",
793
+ "text": "REFERENCES ",
794
+ "text_level": 1,
795
+ "bbox": [
796
+ 176,
797
+ 102,
798
+ 285,
799
+ 118
800
+ ],
801
+ "page_idx": 8
802
+ },
803
+ {
804
+ "type": "text",
805
+ "text": "Martin Albrecht, Melissa Chase, Hao Chen, Jintai Ding, Shafi Goldwasser, Sergey Gorbunov, Jeffrey Hoffstein, Kristin Lauter, Satya Lokam, Daniele Micciancio, et al. Homomorphic encryption standard. 2018. ",
806
+ "bbox": [
807
+ 174,
808
+ 132,
809
+ 825,
810
+ 175
811
+ ],
812
+ "page_idx": 8
813
+ },
814
+ {
815
+ "type": "text",
816
+ "text": "Florian Bourse, Michele Minelli, Matthias Minihold, and Pascal Paillier. Fast homomorphic evaluation of deep discretized neural networks. Technical report, Cryptology ePrint Archive, Report 2017/1114, 2017. ",
817
+ "bbox": [
818
+ 173,
819
+ 184,
820
+ 825,
821
+ 227
822
+ ],
823
+ "page_idx": 8
824
+ },
825
+ {
826
+ "type": "text",
827
+ "text": "Zvika Brakerski and Vinod Vaikuntanathan. Efficient fully homomorphic encryption from (standard) lwe. SIAM Journal on Computing, 43(2):831–871, 2014. ",
828
+ "bbox": [
829
+ 173,
830
+ 236,
831
+ 823,
832
+ 265
833
+ ],
834
+ "page_idx": 8
835
+ },
836
+ {
837
+ "type": "text",
838
+ "text": "Zvika Brakerski, Craig Gentry, and Vinod Vaikuntanathan. (leveled) fully homomorphic encryption without bootstrapping. ACM Transactions on Computation Theory (TOCT), 6(3):13, 2014. ",
839
+ "bbox": [
840
+ 171,
841
+ 272,
842
+ 825,
843
+ 303
844
+ ],
845
+ "page_idx": 8
846
+ },
847
+ {
848
+ "type": "text",
849
+ "text": "Guoxing Chen, Sanchuan Chen, Yuan Xiao, Yinqian Zhang, Zhiqiang Lin, and Ten H Lai. Sgxpectre attacks: Leaking enclave secrets via speculative execution. arXiv preprint arXiv:1802.09085, 2018. ",
850
+ "bbox": [
851
+ 174,
852
+ 310,
853
+ 825,
854
+ 353
855
+ ],
856
+ "page_idx": 8
857
+ },
858
+ {
859
+ "type": "text",
860
+ "text": "Jung Hee Cheon, Andrey Kim, Miran Kim, and Yongsoo Song. Homomorphic encryption for arithmetic of approximate numbers. In International Conference on the Theory and Application of Cryptology and Information Security, pp. 409–437. Springer, 2017. ",
861
+ "bbox": [
862
+ 171,
863
+ 361,
864
+ 825,
865
+ 405
866
+ ],
867
+ "page_idx": 8
868
+ },
869
+ {
870
+ "type": "text",
871
+ "text": "Nathan Dowlin, Ran Gilad-Bachrach, Kim Laine, Kristin Lauter, Michael Naehrig, and John Wernsing. Cryptonets: Applying neural networks to encrypted data with high throughput and accuracy. In International Conference on Machine Learning, pp. 201–210, 2016. ",
872
+ "bbox": [
873
+ 174,
874
+ 412,
875
+ 823,
876
+ 457
877
+ ],
878
+ "page_idx": 8
879
+ },
880
+ {
881
+ "type": "text",
882
+ "text": "Nathan Dowlin, Ran Gilad-Bachrach, Kim Laine, Kristin Lauter, Michael Naehrig, and John Wernsing. Manual for using homomorphic encryption for bioinformatics. Proceedings of the IEEE, 105 (3):552–567, 2017. ",
883
+ "bbox": [
884
+ 173,
885
+ 464,
886
+ 825,
887
+ 507
888
+ ],
889
+ "page_idx": 8
890
+ },
891
+ {
892
+ "type": "text",
893
+ "text": "Junfeng Fan and Frederik Vercauteren. Somewhat practical fully homomorphic encryption. IACR Cryptology ePrint Archive, 2012:144, 2012. ",
894
+ "bbox": [
895
+ 169,
896
+ 515,
897
+ 825,
898
+ 545
899
+ ],
900
+ "page_idx": 8
901
+ },
902
+ {
903
+ "type": "text",
904
+ "text": "Li Fei-Fei, Rob Fergus, and Pietro Perona. One-shot learning of object categories. IEEE transactions on pattern analysis and machine intelligence, 28(4):594–611, 2006. ",
905
+ "bbox": [
906
+ 171,
907
+ 553,
908
+ 825,
909
+ 583
910
+ ],
911
+ "page_idx": 8
912
+ },
913
+ {
914
+ "type": "text",
915
+ "text": "Craig Gentry. Fully homomorphic encryption using ideal lattices. In STOC, volume 9, pp. 169–178, 2009. ",
916
+ "bbox": [
917
+ 171,
918
+ 590,
919
+ 823,
920
+ 619
921
+ ],
922
+ "page_idx": 8
923
+ },
924
+ {
925
+ "type": "text",
926
+ "text": "Oded Goldreich, Silvio Micali, and Avi Wigderson. How to play any mental game. In Proceedings of the nineteenth annual ACM symposium on Theory of computing, pp. 218–229. ACM, 1987. ",
927
+ "bbox": [
928
+ 173,
929
+ 627,
930
+ 823,
931
+ 659
932
+ ],
933
+ "page_idx": 8
934
+ },
935
+ {
936
+ "type": "text",
937
+ "text": "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. ",
938
+ "bbox": [
939
+ 174,
940
+ 665,
941
+ 823,
942
+ 708
943
+ ],
944
+ "page_idx": 8
945
+ },
946
+ {
947
+ "type": "text",
948
+ "text": "Chiraag Juvekar, Vinod Vaikuntanathan, and Anantha Chandrakasan. Gazelle: A low latency framework for secure neural network inference. arXiv preprint arXiv:1801.05507, 2018. ",
949
+ "bbox": [
950
+ 171,
951
+ 717,
952
+ 821,
953
+ 746
954
+ ],
955
+ "page_idx": 8
956
+ },
957
+ {
958
+ "type": "text",
959
+ "text": "Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014. ",
960
+ "bbox": [
961
+ 171,
962
+ 755,
963
+ 823,
964
+ 784
965
+ ],
966
+ "page_idx": 8
967
+ },
968
+ {
969
+ "type": "text",
970
+ "text": "Esmaeil Mohammadian Koruyeh, Khaled Khasawneh, Chengyu Song, and Nael Abu-Ghazaleh. Spectre returns! speculation attacks using the return stack buffer. In 12th USENIX Workshop on Offensive Technologies (WOOT 18). USENIX Association, 2018. ",
971
+ "bbox": [
972
+ 173,
973
+ 792,
974
+ 823,
975
+ 835
976
+ ],
977
+ "page_idx": 8
978
+ },
979
+ {
980
+ "type": "text",
981
+ "text": "Alex Krizhevsky and Geoffrey Hinton. Learning multiple layers of features from tiny images. Technical report, Citeseer, 2009. ",
982
+ "bbox": [
983
+ 169,
984
+ 843,
985
+ 823,
986
+ 872
987
+ ],
988
+ "page_idx": 8
989
+ },
990
+ {
991
+ "type": "text",
992
+ "text": "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. ",
993
+ "bbox": [
994
+ 176,
995
+ 881,
996
+ 825,
997
+ 922
998
+ ],
999
+ "page_idx": 8
1000
+ },
1001
+ {
1002
+ "type": "text",
1003
+ "text": "Yann LeCun, Corinna Cortes, and Christopher JC Burges. Mnist handwritten digit database. at&t labs, 2010. ",
1004
+ "bbox": [
1005
+ 171,
1006
+ 103,
1007
+ 823,
1008
+ 132
1009
+ ],
1010
+ "page_idx": 9
1011
+ },
1012
+ {
1013
+ "type": "text",
1014
+ "text": "Frank McKeen, Ilya Alexandrovich, Alex Berenzon, Carlos V Rozas, Hisham Shafi, Vedvyas Shanbhogue, and Uday R Savagaonkar. Innovative instructions and software model for isolated execution. HASP@ ISCA, 10, 2013. ",
1015
+ "bbox": [
1016
+ 173,
1017
+ 140,
1018
+ 823,
1019
+ 183
1020
+ ],
1021
+ "page_idx": 9
1022
+ },
1023
+ {
1024
+ "type": "text",
1025
+ "text": "M Sadegh Riazi, Christian Weinert, Oleksandr Tkachenko, Ebrahim M Songhori, Thomas Schneider, and Farinaz Koushanfar. Chameleon: A hybrid secure computation framework for machine learning applications. In Proceedings of the 2018 on Asia Conference on Computer and Communications Security, pp. 707–721. ACM, 2018. ",
1026
+ "bbox": [
1027
+ 176,
1028
+ 190,
1029
+ 821,
1030
+ 247
1031
+ ],
1032
+ "page_idx": 9
1033
+ },
1034
+ {
1035
+ "type": "text",
1036
+ "text": "Amartya Sanyal, Matt J Kusner, Adrià Gascón, and Varun Kanade. Tapas: Tricks to accelerate (encrypted) prediction as a service. arXiv preprint arXiv:1806.03461, 2018. ",
1037
+ "bbox": [
1038
+ 169,
1039
+ 255,
1040
+ 823,
1041
+ 285
1042
+ ],
1043
+ "page_idx": 9
1044
+ },
1045
+ {
1046
+ "type": "text",
1047
+ "text": "Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. arXiv preprint arXiv:1409.1556, 2014. ",
1048
+ "bbox": [
1049
+ 173,
1050
+ 292,
1051
+ 823,
1052
+ 321
1053
+ ],
1054
+ "page_idx": 9
1055
+ },
1056
+ {
1057
+ "type": "text",
1058
+ "text": "Florian Tramer and Dan Boneh. Slalom: Fast, verifiable and private execution of neural networks in trusted hardware. arXiv preprint arXiv:1806.03287, 2018. ",
1059
+ "bbox": [
1060
+ 171,
1061
+ 329,
1062
+ 823,
1063
+ 358
1064
+ ],
1065
+ "page_idx": 9
1066
+ },
1067
+ {
1068
+ "type": "text",
1069
+ "text": "Andrew C Yao. Protocols for secure computations. In Foundations of Computer Science, 1982. SFCS’08. 23rd Annual Symposium on, pp. 160–164. IEEE, 1982. ",
1070
+ "bbox": [
1071
+ 173,
1072
+ 366,
1073
+ 821,
1074
+ 396
1075
+ ],
1076
+ "page_idx": 9
1077
+ },
1078
+ {
1079
+ "type": "text",
1080
+ "text": "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. ",
1081
+ "bbox": [
1082
+ 171,
1083
+ 404,
1084
+ 823,
1085
+ 433
1086
+ ],
1087
+ "page_idx": 9
1088
+ },
1089
+ {
1090
+ "type": "text",
1091
+ "text": "A ROTATIONS ",
1092
+ "text_level": 1,
1093
+ "bbox": [
1094
+ 174,
1095
+ 457,
1096
+ 307,
1097
+ 473
1098
+ ],
1099
+ "page_idx": 9
1100
+ },
1101
+ {
1102
+ "type": "text",
1103
+ "text": "For the rotation operation in the BFV encryption scheme it is easier to think of the message as a $2 \\times n / 2$ matrix: ",
1104
+ "bbox": [
1105
+ 174,
1106
+ 487,
1107
+ 825,
1108
+ 516
1109
+ ],
1110
+ "page_idx": 9
1111
+ },
1112
+ {
1113
+ "type": "equation",
1114
+ "img_path": "images/4d1eadd0570e6edfd909cc087780880521e5e63e098f1767f5abb3269fbb9af6.jpg",
1115
+ "text": "$$\n\\left[ \\begin{array} { c c c c c } { { m _ { 1 } } } & { { m _ { 2 } } } & { { \\cdot } } & { { \\cdot } } & { { m _ { n / 2 } } } \\\\ { { m _ { n / 2 + 1 } } } & { { m _ { n / 2 + 2 } } } & { { \\cdot } } & { { \\cdot } } & { { m _ { n } } } \\end{array} \\right]\n$$",
1116
+ "text_format": "latex",
1117
+ "bbox": [
1118
+ 385,
1119
+ 532,
1120
+ 611,
1121
+ 568
1122
+ ],
1123
+ "page_idx": 9
1124
+ },
1125
+ {
1126
+ "type": "text",
1127
+ "text": "with this representation in mind, there are two rotations allowed, one switches the row, which will turn the above matrix to ",
1128
+ "bbox": [
1129
+ 178,
1130
+ 569,
1131
+ 823,
1132
+ 594
1133
+ ],
1134
+ "page_idx": 9
1135
+ },
1136
+ {
1137
+ "type": "equation",
1138
+ "img_path": "images/d7febe5d564dacedec068726c72d5cf294fc478ff3ca385e7111a9e3351dfc00.jpg",
1139
+ "text": "$$\n\\left[ \\begin{array} { c c c c c c } { { m _ { n / 2 + 1 } } } & { { m _ { n / 2 + 2 } } } & { { . } } & { { . } } & { { m _ { n } } } \\\\ { { m _ { 1 } } } & { { m _ { 2 } } } & { { . } } & { { . } } & { { m _ { n / 2 } } } \\end{array} \\right]\n$$",
1140
+ "text_format": "latex",
1141
+ "bbox": [
1142
+ 387,
1143
+ 592,
1144
+ 611,
1145
+ 626
1146
+ ],
1147
+ "page_idx": 9
1148
+ },
1149
+ {
1150
+ "type": "text",
1151
+ "text": "and the other rotates the columns. For example, rotating the original matrix by one column to the right will result in ",
1152
+ "bbox": [
1153
+ 176,
1154
+ 627,
1155
+ 823,
1156
+ 654
1157
+ ],
1158
+ "page_idx": 9
1159
+ },
1160
+ {
1161
+ "type": "equation",
1162
+ "img_path": "images/1c0506ee554c22b5b4bfabb9aaf05f7f60e43c9ae53eed3076611b0fadc54e27.jpg",
1163
+ "text": "$$\n\\left[ \\begin{array} { c c c c c c } { { m _ { n / 2 } } } & { { m _ { 1 } } } & { { \\cdot } } & { { \\cdot } } & { { m _ { n / 2 - 1 } } } \\\\ { { m _ { n } } } & { { m _ { n / 2 + 1 } } } & { { \\cdot } } & { { \\cdot } } & { { m _ { n - 1 } } } \\end{array} \\right] ~ .\n$$",
1164
+ "text_format": "latex",
1165
+ "bbox": [
1166
+ 379,
1167
+ 652,
1168
+ 619,
1169
+ 688
1170
+ ],
1171
+ "page_idx": 9
1172
+ },
1173
+ {
1174
+ "type": "text",
1175
+ "text": "Since $n$ is a power of two, and the rotations we are interested in are powers of two as well, for the sake of this work, thinking about the rotations as simple rotations of the elements in the message yields similar results. In this view, the row-rotation is a rotation of size $n / 2$ and smaller rotations are achieved by column rotations. ",
1176
+ "bbox": [
1177
+ 174,
1178
+ 695,
1179
+ 825,
1180
+ 753
1181
+ ],
1182
+ "page_idx": 9
1183
+ },
1184
+ {
1185
+ "type": "text",
1186
+ "text": "B THE SIMD REPRESENTATION ",
1187
+ "text_level": 1,
1188
+ "bbox": [
1189
+ 176,
1190
+ 771,
1191
+ 457,
1192
+ 787
1193
+ ],
1194
+ "page_idx": 9
1195
+ },
1196
+ {
1197
+ "type": "text",
1198
+ "text": "The vector structure of messages used by CryptoNets allow parallel execution over multiple data simultaneously. CryptoNets takes $n$ input vectors $\\mathbf { v } ^ { 1 } , \\ldots , \\mathbf { v } ^ { n }$ and creates a dense representation in which these $n$ messages of length $k$ are encoded in $k$ messages $\\mathbf { m } ^ { 1 } , \\ldots , \\mathbf { m } ^ { k }$ such that $\\begin{array} { r } { m _ { i } ^ { j } = v _ { j } ^ { i } } \\end{array}$ . All operations between vectors and matrices are implemented using additions and multiplications only. For example, a dot product between two vectors of length $k$ is implemented by $k$ multiplications and additions. Therefore, it acts as a sparse representation. ",
1199
+ "bbox": [
1200
+ 174,
1201
+ 801,
1202
+ 825,
1203
+ 888
1204
+ ],
1205
+ "page_idx": 9
1206
+ },
1207
+ {
1208
+ "type": "text",
1209
+ "text": "The advantage of this representation, which we call the SIMD Representation, is that the cost of applying an operation to a vector is the same cost of applying the same operation to $n$ vectors, hence it supports the Single Instruction Multiple Data (SIMD) framework. However, it is costly in two ways: the computational complexity of multiplying a matrix of size $r \\times k$ with a vector of length $k$ is $O \\left( r k \\right)$ HE operations, and the memory consumption is large as well since a vector of length $k$ requires $k$ messages. In this sense it is similar to the sparse representation. However, the ability to perform SIMD operations provides it with high throughput, much like the dense representation. ",
1210
+ "bbox": [
1211
+ 173,
1212
+ 895,
1213
+ 823,
1214
+ 924
1215
+ ],
1216
+ "page_idx": 9
1217
+ },
1218
+ {
1219
+ "type": "image",
1220
+ "img_path": "images/e4ce767c918b9d1bba37640ebbb86be199f331c4033c5ec03f0ac36c453ce07a.jpg",
1221
+ "image_caption": [
1222
+ "Figure 1: The latency of the different network implementations for the MNIST task with respect to the number of available cores. The right figure shows the ratio between the latency of each solution and the latency of the LoLa-Conv "
1223
+ ],
1224
+ "image_footnote": [],
1225
+ "bbox": [
1226
+ 210,
1227
+ 132,
1228
+ 787,
1229
+ 251
1230
+ ],
1231
+ "page_idx": 10
1232
+ },
1233
+ {
1234
+ "type": "text",
1235
+ "text": "",
1236
+ "bbox": [
1237
+ 174,
1238
+ 364,
1239
+ 825,
1240
+ 434
1241
+ ],
1242
+ "page_idx": 10
1243
+ },
1244
+ {
1245
+ "type": "text",
1246
+ "text": "C PARALLEL SCALING ",
1247
+ "text_level": 1,
1248
+ "bbox": [
1249
+ 176,
1250
+ 454,
1251
+ 379,
1252
+ 469
1253
+ ],
1254
+ "page_idx": 10
1255
+ },
1256
+ {
1257
+ "type": "text",
1258
+ "text": "The performance of the different solutions is affected by the amount of parallelism allowed. The hardware used for experimentation in this work has 8 cores. Therefore, we tested the performance of the different solutions with 1, 2, 4, and 8 cores to see how the performance varies. The results of these experiments are presented in Figure 1. These results show that at least up to 8 cores the performance of all methods scales linearly when tested on the MNIST data-set. This suggests that the latency can be further improved by using machines with higher core count. ",
1259
+ "bbox": [
1260
+ 174,
1261
+ 484,
1262
+ 825,
1263
+ 569
1264
+ ],
1265
+ "page_idx": 10
1266
+ },
1267
+ {
1268
+ "type": "text",
1269
+ "text": "D LOLA REPRESENTATION CHANGES ",
1270
+ "text_level": 1,
1271
+ "bbox": [
1272
+ 174,
1273
+ 589,
1274
+ 498,
1275
+ 604
1276
+ ],
1277
+ "page_idx": 10
1278
+ },
1279
+ {
1280
+ "type": "text",
1281
+ "text": "The following tables show the different stages that the data goes through when using LoLa. This illustrates how the different representations are used during the computation. Table 2 shows the process that LoLa applies, Table 3 shows the process for LoLa-Conv, and Table 4 shows the process for the method proposed for processing the CalTech-101 dataset. ",
1282
+ "bbox": [
1283
+ 174,
1284
+ 619,
1285
+ 825,
1286
+ 676
1287
+ ],
1288
+ "page_idx": 10
1289
+ },
1290
+ {
1291
+ "type": "image",
1292
+ "img_path": "images/1728aad799d580b4c5d8d21741622977d51a87b761cfdbf7050a18b2a834e4cd.jpg",
1293
+ "image_caption": [
1294
+ "Figure 2: The structure of the network used for MNIST classification "
1295
+ ],
1296
+ "image_footnote": [],
1297
+ "bbox": [
1298
+ 171,
1299
+ 256,
1300
+ 831,
1301
+ 738
1302
+ ],
1303
+ "page_idx": 11
1304
+ },
1305
+ {
1306
+ "type": "image",
1307
+ "img_path": "images/8c9f08c727d2ca6e2dab44cd7216ffd2286781f902acc61bee2f0bfb3ce651c2.jpg",
1308
+ "image_caption": [
1309
+ "Figure 3: The structure of the network used for CIFAR classification. "
1310
+ ],
1311
+ "image_footnote": [],
1312
+ "bbox": [
1313
+ 171,
1314
+ 133,
1315
+ 828,
1316
+ 460
1317
+ ],
1318
+ "page_idx": 12
1319
+ },
1320
+ {
1321
+ "type": "image",
1322
+ "img_path": "images/d205b40d843399975727833c507901ad6d80eb0509576f662e64fff9e09153cc.jpg",
1323
+ "image_caption": [
1324
+ "Figure 4: The structure of the network used for CIFAR classification after collapsing adjacent layers. "
1325
+ ],
1326
+ "image_footnote": [],
1327
+ "bbox": [
1328
+ 197,
1329
+ 536,
1330
+ 826,
1331
+ 854
1332
+ ],
1333
+ "page_idx": 12
1334
+ },
1335
+ {
1336
+ "type": "table",
1337
+ "img_path": "images/c4495bde182eaa6552a793d6ba7e3faff572bb801d6a72d91f8dc71bd9d16a60.jpg",
1338
+ "table_caption": [
1339
+ "",
1340
+ ""
1341
+ ],
1342
+ "table_footnote": [],
1343
+ "table_body": "<table><tr><td rowspan=1 colspan=1>rrrrrireg</td><td rowspan=1 colspan=1>eserseopereseee</td><td rowspan=1 colspan=1>srsserts ereere or inter ree</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>oro nner sesessee s negigoe</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>serdoerr res</td><td rowspan=1 colspan=1>sesseauindino</td><td rowspan=1 colspan=1>oo oar sesesses engio</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1>rog indhno</td><td rowspan=1 colspan=1>dsues</td><td rowspan=1 colspan=1>Gorraiiirreinniiiiir</td><td rowspan=1 colspan=1>Trrereeiee</td><td rowspan=1 colspan=1>Trreaeeiee</td><td rowspan=1 colspan=1>Trreeeeee</td><td rowspan=1 colspan=1>Trrepiepereeee</td><td rowspan=1 colspan=1>Trreeeiee</td><td rowspan=1 colspan=1>Trreeeeee</td><td rowspan=1 colspan=1>Trrereeiee</td><td rowspan=1 colspan=1>Sssree</td></tr><tr><td rowspan=1 colspan=1>wtr sreer</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>oreri-ninior)uinnnirnos</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>(porarssrtrrt-etg</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>JIma-min</td></tr><tr><td rowspan=1 colspan=1>azs gndu</td><td rowspan=1 colspan=1>8</td><td rowspan=1 colspan=1>3</td><td rowspan=1 colspan=1>6912</td><td rowspan=1 colspan=1>691×</td><td rowspan=1 colspan=1>3</td><td rowspan=1 colspan=1>3</td><td rowspan=1 colspan=1>皖58×91</td><td rowspan=1 colspan=1>9×∠</td><td rowspan=1 colspan=1>100</td><td rowspan=1 colspan=1>100</td></tr><tr><td rowspan=1 colspan=1>Jaker</td><td rowspan=1 colspan=1>ropdkioug</td><td rowspan=1 colspan=3>Jrr grniniruirg x</td><td rowspan=1 colspan=1>Jrrrerenee</td><td rowspan=1 colspan=3>Jaer eseee</td><td rowspan=1 colspan=1>Jhrrreerrtt</td><td rowspan=1 colspan=1>Jareeseea</td></tr></table>",
1344
+ "bbox": [
1345
+ 372,
1346
+ 164,
1347
+ 583,
1348
+ 853
1349
+ ],
1350
+ "page_idx": 13
1351
+ },
1352
+ {
1353
+ "type": "table",
1354
+ "img_path": "images/c5df3ae764fb59c92871a7154cb3cde8975ce429ed2b4f32fab332111ef48ed0.jpg",
1355
+ "table_caption": [
1356
+ ""
1357
+ ],
1358
+ "table_footnote": [],
1359
+ "table_body": "<table><tr><td rowspan=1 colspan=1>Brnreiieen</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>areserss oirpeidrrtesreree</td><td rowspan=1 colspan=1>sasessss oseep s ursr indin</td><td rowspan=1 colspan=1>ouo oinrseesseg oegqee</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>ssrdeeg reees</td><td rowspan=1 colspan=1>ssesssrr unindino</td><td rowspan=1 colspan=1>ono nner sesesseegr nerioioee</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1>Jror indino</td><td rowspan=1 colspan=1>conniinuio</td><td rowspan=1 colspan=1>Coonninuin</td><td rowspan=1 colspan=1>asuee</td><td rowspan=1 colspan=1>asues</td><td rowspan=1 colspan=1>esues</td><td rowspan=1 colspan=1>sseeee</td><td rowspan=1 colspan=1>Trreeiee</td><td rowspan=1 colspan=1>Trrereeene</td><td rowspan=1 colspan=1>Trrereeene</td><td rowspan=1 colspan=1>Ssrrre</td></tr><tr><td rowspan=1 colspan=1>Wrtrsraea</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>(ooorr-nuniir)uinnniruir</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>prrrrssrterets</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>JIii-mir</td></tr><tr><td rowspan=1 colspan=1>Jzis jndu</td><td rowspan=1 colspan=1>84</td><td rowspan=1 colspan=1>691397</td><td rowspan=1 colspan=1>69137</td><td rowspan=1 colspan=1>691×</td><td rowspan=1 colspan=1>5</td><td rowspan=1 colspan=1>5</td><td rowspan=1 colspan=1>8×8</td><td rowspan=1 colspan=1>8x1</td><td rowspan=1 colspan=1>10</td><td rowspan=1 colspan=1>10</td></tr><tr><td rowspan=1 colspan=1>Vaker</td><td rowspan=1 colspan=1>preeeeces</td><td rowspan=1 colspan=1>rrndrging</td><td rowspan=1 colspan=2>Jxrrr glnnninuirg x </td><td rowspan=1 colspan=1>Jreeaeeb</td><td rowspan=1 colspan=3>Jarer eseer</td><td rowspan=1 colspan=1>shrrrearett</td><td rowspan=1 colspan=1>Jaer saeaa</td></tr></table>",
1360
+ "bbox": [
1361
+ 372,
1362
+ 185,
1363
+ 583,
1364
+ 835
1365
+ ],
1366
+ "page_idx": 14
1367
+ },
1368
+ {
1369
+ "type": "table",
1370
+ "img_path": "images/9f052fe9087b330df8f41c0e291da9228f9ac40c466b535b8bb73cf83e7091c3.jpg",
1371
+ "table_caption": [
1372
+ "Table 4: LoLa-CalTech data representation changes. The table shows the different formats of the data during its evaluation with LoLa on the CalTech-101 dataset "
1373
+ ],
1374
+ "table_footnote": [],
1375
+ "table_body": "<table><tr><td rowspan=1 colspan=1>Layer</td><td rowspan=1 colspan=1>Input size</td><td rowspan=1 colspan=1>Weights format</td><td rowspan=1 colspan=1>Output format</td><td rowspan=1 colspan=1>Description</td></tr><tr><td rowspan=1 colspan=1>Preprocess</td><td rowspan=1 colspan=1>200 ×300</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>dense</td><td rowspan=1 colspan=1> apply convolution layers from Alex-Net</td></tr><tr><td rowspan=1 colspan=1>Encryption</td><td rowspan=1 colspan=1>1000</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>dense</td><td rowspan=1 colspan=1> image is encrypted into 1 message</td></tr><tr><td rowspan=1 colspan=1>dense layer</td><td rowspan=1 colspan=1>1000</td><td rowspan=1 colspan=1>row-major</td><td rowspan=1 colspan=1>sparse</td><td></td></tr></table>",
1376
+ "bbox": [
1377
+ 173,
1378
+ 460,
1379
+ 892,
1380
+ 523
1381
+ ],
1382
+ "page_idx": 15
1383
+ }
1384
+ ]
parse/train/rJl8viCqKQ/rJl8viCqKQ_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/train/rJl8viCqKQ/rJl8viCqKQ_model.json ADDED
The diff for this file is too large to render. See raw diff